diff --git a/configure.py b/configure.py index 3f035642..14180103 100755 --- a/configure.py +++ b/configure.py @@ -173,6 +173,7 @@ cflags_runtime = [ cflags_rel = [ *cflags_base, "-O0,s", + "-char unsigned", "-sdata 0", "-sdata2 0", ] @@ -181,6 +182,7 @@ cflags_rel = [ cflags_game = [ *cflags_base, "-O0,p", + "-char unsigned", ] config.linker_version = "GC/2.6" @@ -231,7 +233,7 @@ config.libs = [ Object(Matching, "game/malloc.c"), Object(Matching, "game/memory.c"), Object(NonMatching, "game/printfunc.c"), - Object(NonMatching, "game/process.c"), + Object(Matching, "game/process.c"), Object(NonMatching, "game/sprman.c"), Object(NonMatching, "game/sprput.c"), ], diff --git a/include/common_structs.h b/include/common_structs.h index 6bc0e07c..cc12f449 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -15,14 +15,33 @@ typedef struct Vec3f { f32 z; } Vec3f; -typedef struct unkStruct145A98 { - s16 unk_00; - char unk_02[10]; - s16 unk_0C; - char unk_0E[6]; - u8 unk_14; - char unk_15[0x53]; -} unkStruct145A98; // sizeof 0x68 +typedef struct jump_buf { + u32 lr; + u32 cr; + u32 sp; + u32 r2; + u32 pad; + u32 regs[19]; + double flt_regs[19]; +} jmp_buf; + +typedef struct process { + struct process *next; + struct process *prev; + struct process *child; + struct process *parent; + struct process *next_child; + struct process *last_child; + void *heap; + u16 exec; + u16 stat; + u16 prio; + s32 sleep_time; + void *base_sp; + jmp_buf jump; + void (*dtor)(void); + void *user_data; +} Process; typedef struct unkStruct1D3B44 { struct unkStruct1D3B44 *prev; diff --git a/include/functions.h b/include/functions.h index cb626b73..a6e79d03 100644 --- a/include/functions.h +++ b/include/functions.h @@ -4,9 +4,6 @@ #include "types.h" #include "common_structs.h" -void* HuPrcCreate(void (*), s32, s32, s32); -void HuPrcSleep(s32, f32); -void HuPrcVSleep(void); void Hu3DBGColorSet(u8, u8, u8); void Hu3DCameraCreate(s16); void Hu3DCameraPerspectiveSet(s16, f32, f32, f32, f32); @@ -43,6 +40,9 @@ s32 HuMemUsedMemoryBlockGet(void *heap_ptr); s32 HuMemMemoryAllocSizeGet(s32 size); void HuMemHeapDump(void *heap_ptr, s16 status); +Process *HuPrcCreate(void (*func)(void), u16 prio, s32 stack_size, s32 extra_size); +void HuPrcSleep(s32 time); +void HuPrcVSleep(void); #endif diff --git a/src/game/printfunc.c b/src/game/printfunc.c new file mode 100644 index 00000000..82adf6c2 --- /dev/null +++ b/src/game/printfunc.c @@ -0,0 +1,51 @@ +#include "common.h" +#include "dolphin/gx.h" + +struct strline_data { + u16 type; + u16 last_idx; + s16 x; + s16 y; + s16 w; + s16 h; + s16 empty_line; + float scale; + char str[80]; + GXColor color; +}; + +static struct strline_data strline[256]; +static char pfStrBuf[256]; + +BOOL saftyFrameF; +u16 strlinecnt; +u16 empstrline; +int fontcolor; + +void pfClsScr(void); + +void pfInit(void) +{ + int i; + fontcolor = 15; + empstrline = 0; + + for (i = 0; i < 256; i++) { + strline[i].str[0] = 0; + } + pfClsScr(); +} + +void pfClsScr(void) +{ + int i; + empstrline = 0; + strlinecnt = 0; + for (i = 0; i < 256; i++) { + strline[i].empty_line = i+1; + strline[i].type = 0; + if (strline[i].str[0] != 0) { + strline[i].str[0] = 0; + } + } +} \ No newline at end of file diff --git a/src/game/process.c b/src/game/process.c new file mode 100644 index 00000000..94b49fc4 --- /dev/null +++ b/src/game/process.c @@ -0,0 +1,112 @@ +#include "common.h" +#include "dolphin/os.h" + +void HuPrcInit() +{ + +} + +Process *HuPrcCreate(void (*func)(void), u16 prio, s32 stack_size, s32 extra_size) +{ + return NULL; +} + +void HuPrcChildLink() +{ + +} + +void HuPrcChildUnlink() +{ + +} + +void HuPrcChildCreate() +{ + +} + +void HuPrcChildWatch() +{ + +} + +void HuPrcCurrentGet() +{ + +} + +void HuPrcKill() +{ + +} + +void HuPrcChildKill() +{ + +} + +void HuPrcEnd() +{ + +} + +void HuPrcSleep(s32 time) +{ + +} + +void HuPrcVSleep() +{ + +} + +void HuPrcWakeup() +{ + +} + +void HuPrcDestructorSet2() +{ + +} + +void HuPrcDestructorSet() +{ + +} + +void HuPrcCall() +{ + +} + +void HuPrcMemAlloc() +{ + +} + +void HuPrcMemFree() +{ + +} + +void HuPrcSetStat() +{ + +} + +void HuPrcResetStat() +{ + +} + +void HuPrcAllPause() +{ + +} + +void HuPrcAllUPause() +{ + +} \ No newline at end of file