65#define SetSpadStack(addr) \
66 __asm__ volatile("move $8,%0\n\tsw $29,0($8)\n\taddiu $8,$8,-16\n\tmove $29,$8" : : "r"(addr) : "$8", "memory")
67#define ResetSpadStack() __asm__ volatile("addiu $29,$29,16\n\tlw $29,0($29)" : : : "memory")
99 for (i = 0; i < count; i++) {
100 if (children[i] !=
NULL) {
#define TASK_REGISTRY_SIZE
The tasks the registry holds at most.
void clearTaskRegistry(void)
Forgets every registered task.
Task * runTask(Task *task)
Runs a frame of a task and its children; returns it, or NULL once it is gone.
#define SetSpadStack(addr)
The update runs with its stack in the scratchpad.
void unregisterTask(Task *task)
Removes a task from the registry.
void registerTask(Task *task)
Adds a task to the first free entry of the registry (ignored when it is full)
void * findNextTask(void)
The next registered task that matches findTask's id and keys (-1 matches anything),...
TaskRegistry TASK_REGISTRY
Task * executeTask(Task *task)
One frame of a task and its children; returns NULL once the task is gone.
void runChildTasks(Task *task)
Runs a frame of each child of a task, dropping the ones that end.
void killTask(Task *task)
Ends a task now: its last update and destroy run at once.
void * findTask(s32 id, s32 key1, s32 key2)
The first registered task that matches (-1 matches anything), or NULL.
struct Task *(* run)(struct Task *task)
void(* runChildren)(struct Task *task)
Tasks created with an id, so that other code can find them.
Task * tasks[100]
NULL for a free entry.
s32 findId
-1 matches anything
Any task, seen through its header.
void(* destroy)(struct Task *task)
void(* setState)(struct Task *task, s32 state)