View source: Task Queue System (revision 340)

From Wulinshu
Jump to navigation Jump to search

2018-12-30T20:01:52Z · PhilYeahz · Download source

=Task memory structure=
{| class="wikitable"
|-
! Position !! Length !! Type !! Description 
|-
| 0x00 || 0x08 || uint64_t* || Callback function pointer
|-
| 0x08 || 0x04 || char* || Task type/name token
|-
| 0x0C || 0x01 || uint8_t || Unknown value
|-
| 0x0D || 0x01 || uint8_t || Unknown value
|-
| 0x10 || 0x08 || uint64_t* || Unknown pointer
|-
| 0x18 || 0x08 || uint64_t* || Next task address
|-
| 0x20 || 0x08 || uint64_t* || Task queue address (at the moment of creation)
|-
| 0x28 || 0x08 || uint64_t* || Unknown pointer
|-
| 0x30 || 0x08 || uint64_t* || Unknown pointer
|-
| 0x38 || 0x08 || uint64_t* || Unknown pointer
|-
| 0x40 || 0x08 || uint64_t* || Unknown pointer
|-
| 0x48 || 0x08 || uint64_t* || Unknown pointer
|-
| 0x50 || 0x08 || uint64_t* || Unknown pointer
|-
| 0x58 || 0x08 || uint64_t* || Unknown pointer
|-
| 0x60 || 0x08 || uint64_t* || Unknown pointer
|-
| 0x68 || 0x08 || uint64_t* || Callback function parameter struct pointer
|}

=Task Queue=
Task Queue Pointer Offset: 0x1481FFA50 (v1.07)<br>
At the start an ROOT task is created.<br>
When the ROOT task was created the Queue gets filled with NONE task's which do nothing.
At initialization each task has the next task in order as their next task specified inside 0x18.
The last task however points to 0x142A88530 (v1.07) as their next task.
The ROOT task points to the first task as it's next task.

=Enqueue Task=

==Enqueue task without parameter==
To enqueue an task without parameter the subroutine 0x14049D890 (v1.07) needs to be called.

==Enqueue task with parameter==
To enqueue an task with parameter the subroutine 0x14049DA10 (v1.07) needs to be called.

==Task creation==
During the enqueue process the task will be created with the given callback function.<br>
The callback function parameter, which is optional, is an pointer to an struct than can have any shape or size the callback function needs.

=Task execution=
The main loop iterates through the task queue and calls the callback function with the optional parameter.<br>
When the callback function returns the next task pointer is read from the current task and moved into the task queue address pointer.