Start decompiling some code

This commit is contained in:
gamemasterplc 2023-11-23 08:42:06 -06:00
parent 2e79185e91
commit 41f0ffb565
5 changed files with 196 additions and 12 deletions

View file

@ -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"),
],

View file

@ -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;

View file

@ -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

51
src/game/printfunc.c Normal file
View file

@ -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;
}
}
}

112
src/game/process.c Normal file
View file

@ -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()
{
}