diff --git a/disasm.py b/disasm.py index 63bb3e3a24..c50b1cbaaf 100644 --- a/disasm.py +++ b/disasm.py @@ -557,7 +557,7 @@ class Disassembler: else: dis += "%s, %s, %d" % (regs[get_rt(inst)], regs[get_rs(inst)], get_signed_imm(inst)) elif op_num == 12 or op_num == 13 or op_num == 14: # andi, ori, xori - dis += "%s, %s, 0x%X" % (regs[get_rt(inst)], regs[get_rs(inst)], get_imm(inst)) + dis += "%s, %s, %#X" % (regs[get_rt(inst)], regs[get_rs(inst)], get_imm(inst)) elif op_num == 15: # lui self.determine_load_ref(file, i) if addr in loadHighRefs: # lui loading the higher half of a pointer @@ -569,23 +569,23 @@ class Disassembler: if addr in loadLowRefs: # loading with immediate forming lower half of pointer dis += "%s, %%lo(%s)(%s)" % (regs[get_rt(inst)], self.make_load(loadLowRefs[addr]), regs[get_rs(inst)]) else: - dis += "%s, %d(%s)" % (regs[get_rt(inst)], get_signed_imm(inst), regs[get_rs(inst)]) + dis += "%s, %#X(%s)" % (regs[get_rt(inst)], get_signed_imm(inst), regs[get_rs(inst)]) elif op_num == 36 or op_num == 37: # lbu, lhu if addr in loadLowRefs: # loading with immediate forming lower half of pointer dis += "%s, %%lo(%s)(%s)" % (regs[get_rt(inst)], self.make_load(loadLowRefs[addr]), regs[get_rs(inst)]) else: - dis += "%s, %d(%s)" % (regs[get_rt(inst)], get_signed_imm(inst), regs[get_rs(inst)]) + dis += "%s, %#X(%s)" % (regs[get_rt(inst)], get_signed_imm(inst), regs[get_rs(inst)]) elif (op_num == 49 or op_num == 50 or op_num == 53 or op_num == 54 or op_num == 57 or op_num == 58 or op_num == 61 or op_num == 62): # load/store between co-processors if addr in loadLowRefs: # loading with immediate forming lower half of pointer dis += "%s, %%lo(%s)(%s)" % (float_reg(get_rt(inst)), self.make_load(loadLowRefs[addr]), regs[get_rs(inst)]) else: - dis += "%s, %d(%s)" % (float_reg(get_rt(inst)), get_signed_imm(inst), regs[get_rs(inst)]) + dis += "%s, %#X(%s)" % (float_reg(get_rt(inst)), get_signed_imm(inst), regs[get_rs(inst)]) elif op_num == 47: # cache if addr in loadLowRefs: # cache op with immediate forming lower half of pointer dis += "0x%02X, %%lo(%s)(%s)" % (get_rt(inst), self.make_load(loadLowRefs[addr]), regs[get_rs(inst)]) else: - dis += "0x%02X, %d(%s)" % (get_rt(inst), get_signed_imm(inst), regs[get_rs(inst)]) + dis += "0x%02X, %#X(%s)" % (get_rt(inst), get_signed_imm(inst), regs[get_rs(inst)]) return dis diff --git a/functions.py b/functions.py index beca84502e..fc4499c15b 100644 --- a/functions.py +++ b/functions.py @@ -22,7 +22,7 @@ known_funcs = { 0x80080C90:("func_80080C90","s32","UNK_TYPE, UNK_PTR, UNK_TYPE"), 0x80080D0C:("func_80080D0C","void","void"), 0x80080E00:("func_80080E00","void","void"), - 0x80081754:("func_80081754","UNK_RET","UNK_PTR, struct s80085320*, UNK_TYPE, UNK_TYPE"), + 0x80081754:("func_80081754","UNK_RET","UNK_PTR, s80085320*, UNK_TYPE, UNK_TYPE"), 0x80081820:("func_80081820","void","void"), 0x80081828:("func_80081828","void","void"), 0x80081830:("func_80081830","void","void"), @@ -42,11 +42,11 @@ known_funcs = { 0x8008481C:("func_8008481C","UNK_RET","UNK_TYPE, UNK_TYPE, UNK_PTR, UNK_PTR"), 0x80084940:("func_80084940","void","void"), 0x80084968:("func_80084968","void","void"), - 0x80085320:("func_80085320","void","struct s80085320*, UNK_PTR, UNK_PTR, UNK_TYPE, UNK_TYPE, UNK_PTR"), - 0x800853F8:("func_800853F8","UNK_RET","struct s80085320*"), - 0x80085468:("func_80085468","UNK_TYPE","struct s80085320*"), + 0x80085320:("func_80085320","void"," s80085320*, UNK_PTR, UNK_PTR, UNK_TYPE, UNK_TYPE, UNK_PTR"), + 0x800853F8:("func_800853F8","UNK_RET","s80085320*"), + 0x80085468:("func_80085468","UNK_TYPE","s80085320*"), 0x800854E0:("func_800854E0","UNK_TYPE","UNK_ARGS"), - 0x80085538:("func_80085538","UNK_RET","struct s80085320*"), + 0x80085538:("func_80085538","UNK_RET","s80085320*"), 0x80087830:("func_80087830","UNK_TYPE","UNK_TYPE, UNK_TYPE, UNK_TYPE"), 0x80087854:("func_80087854","UNK_TYPE","u8*, UNK_TYPE, UNK_PTR"), 0x800878A4:("func_800878A4","UNK_TYPE","u8*, UNK_TYPE, UNK_TYPE, UNK_TYPE"), @@ -209,19 +209,19 @@ known_funcs = { 0x800991a0:("__osRcpImTable","UNK_RET","UNK_ARGS"), 0x80099450:("__libm_qnan_f","UNK_RET","UNK_ARGS"), 0x800A5AC0:("func_800A5AC0","UNK_RET","void*, UNK_TYPE"), # guessing this is void* bc it's a thread entry point - 0x800A5B6C:("func_800A5B6C","UNK_RET","struct s800A5AC0*, z_GlobalContext*"), - 0x800A5B98:("func_800A5B98","UNK_RET","struct s800A5AC0*, UNK_TYPE"), - 0x800A5C28:("func_800A5C28","UNK_RET","struct s800A5AC0*"), - 0x800A5C60:("func_800A5C60","UNK_RET","struct s800A5AC0*, UNK_TYPE"), - 0x800A5CB8:("func_800A5CB8","UNK_RET","struct s800A5AC0*, UNK_TYPE"), + 0x800A5B6C:("func_800A5B6C","UNK_RET","s800A5AC0*, z_GlobalContext*"), + 0x800A5B98:("func_800A5B98","UNK_RET","s800A5AC0*, UNK_TYPE"), + 0x800A5C28:("func_800A5C28","UNK_RET","s800A5AC0*"), + 0x800A5C60:("func_800A5C60","UNK_RET","s800A5AC0*, UNK_TYPE"), + 0x800A5CB8:("func_800A5CB8","UNK_RET","s800A5AC0*, UNK_TYPE"), 0x800B3BA4:("func_800B3BA4","UNK_RET","UNK_PTR, f32, UNK_PTR, UNK_TYPE"), 0x800B3FC0:("func_800B3FC0","UNK_TYPE","UNK_TYPE"), 0x800B5BB0:("func_800B5BB0","UNK_TYPE","z_GlobalContext*, UNK_TYPE"), - 0x800B675C:("func_800B675C","UNK_RET","struct s800A5AC0*, UNK_TYPE"), - 0x800B84D0:("func_800B84D0","UNK_TYPE","struct s800A5AC0*, UNK_TYPE"), - 0x800B863C:("func_800B863C","UNK_RET","struct s800A5AC0*, UNK_TYPE"), - 0x800B867C:("func_800B867C","UNK_TYPE","struct s800A5AC0*"), - 0x800BDFC0:("func_800BDFC0","UNK_RET","UNK_TYPE, UNK_TYPE, UNK_TYPE, struct s800A5AC0*"), + 0x800B675C:("func_800B675C","UNK_RET","s800A5AC0*, UNK_TYPE"), + 0x800B84D0:("func_800B84D0","UNK_TYPE","s800A5AC0*, UNK_TYPE"), + 0x800B863C:("func_800B863C","UNK_RET","s800A5AC0*, UNK_TYPE"), + 0x800B867C:("func_800B867C","UNK_TYPE","s800A5AC0*"), + 0x800BDFC0:("func_800BDFC0","UNK_RET","UNK_TYPE, UNK_TYPE, UNK_TYPE, s800A5AC0*"), 0x800BE03C:("func_800BE03C","void","z_GlobalContext*, UNK_TYPE"), 0x800C6024:("func_800C6024","UNK_TYPE","UNK_TYPE"), 0x800C6248:("func_800C6248","UNK_TYPE","UNK_TYPE, UNK_TYPE"), diff --git a/include/functions.h b/include/functions.h index 2d1aa4578f..29241b4f7c 100644 --- a/include/functions.h +++ b/include/functions.h @@ -44,6 +44,7 @@ void func_80080E00(void); // func_80080E00 // UNK_RET func_80081550(UNK_ARGS); // UNK_RET func_800815A8(UNK_ARGS); // UNK_RET func_800815CC(UNK_ARGS); +// UNK_RET func_800815CC(UNK_ARGS); // UNK_RET func_80081684(UNK_ARGS); // UNK_RET func_800816E8(UNK_ARGS); // UNK_RET func_800816F8(UNK_ARGS); @@ -51,7 +52,7 @@ void func_80080E00(void); // func_80080E00 // UNK_RET func_80081718(UNK_ARGS); // UNK_RET func_80081728(UNK_ARGS); // UNK_RET func_80081730(UNK_ARGS); -UNK_RET func_80081754(UNK_PTR, struct s80085320*, UNK_TYPE, UNK_TYPE); // func_80081754 +UNK_RET func_80081754(UNK_PTR, s80085320*, UNK_TYPE, UNK_TYPE); // func_80081754 void func_80081820(void); // func_80081820 void func_80081828(void); // func_80081828 void func_80081830(void); // func_80081830 @@ -130,11 +131,11 @@ void func_80084968(void); // func_80084968 // UNK_RET func_800851FC(UNK_ARGS); // UNK_RET func_80085204(UNK_ARGS); // UNK_RET func_8008524C(UNK_ARGS); -void func_80085320(struct s80085320*, UNK_PTR, UNK_PTR, UNK_TYPE, UNK_TYPE, UNK_PTR); // func_80085320 -UNK_RET func_800853F8(struct s80085320*); // func_800853F8 -UNK_TYPE func_80085468(struct s80085320*); // func_80085468 +void func_80085320(s80085320*, UNK_PTR, UNK_PTR, UNK_TYPE, UNK_TYPE, UNK_PTR); // func_80085320 +UNK_RET func_800853F8(s80085320*); // func_800853F8 +UNK_TYPE func_80085468(s80085320*); // func_80085468 UNK_TYPE func_800854E0(UNK_ARGS); // func_800854E0 -UNK_RET func_80085538(struct s80085320*); // func_80085538 +UNK_RET func_80085538(s80085320*); // func_80085538 // UNK_RET func_80085570(UNK_ARGS); // UNK_RET func_800859BC(UNK_ARGS); // UNK_RET func_80085A08(UNK_ARGS); @@ -459,11 +460,11 @@ UNK_RET osViModeMpalLan1(UNK_ARGS); // func_80098010 UNK_RET __osRcpImTable(UNK_ARGS); // func_800991A0 UNK_RET __libm_qnan_f(UNK_ARGS); // func_80099450 UNK_RET func_800A5AC0(void*, UNK_TYPE); // func_800A5AC0 -UNK_RET func_800A5B6C(struct s800A5AC0*, z_GlobalContext*); // func_800A5B6C -UNK_RET func_800A5B98(struct s800A5AC0*, UNK_TYPE); // func_800A5B98 -UNK_RET func_800A5C28(struct s800A5AC0*); // func_800A5C28 -UNK_RET func_800A5C60(struct s800A5AC0*, UNK_TYPE); // func_800A5C60 -UNK_RET func_800A5CB8(struct s800A5AC0*, UNK_TYPE); // func_800A5CB8 +UNK_RET func_800A5B6C(s800A5AC0*, z_GlobalContext*); // func_800A5B6C +UNK_RET func_800A5B98(s800A5AC0*, UNK_TYPE); // func_800A5B98 +UNK_RET func_800A5C28(s800A5AC0*); // func_800A5C28 +UNK_RET func_800A5C60(s800A5AC0*, UNK_TYPE); // func_800A5C60 +UNK_RET func_800A5CB8(s800A5AC0*, UNK_TYPE); // func_800A5CB8 // UNK_RET func_800A5D00(UNK_ARGS); // UNK_RET func_800A5D70(UNK_ARGS); // UNK_RET func_800A5E80(UNK_ARGS); @@ -728,7 +729,7 @@ UNK_TYPE func_800B5BB0(z_GlobalContext*, UNK_TYPE); // func_800B5BB0 // UNK_RET func_800B6680(UNK_ARGS); // UNK_RET func_800B670C(UNK_ARGS); // UNK_RET func_800B672C(UNK_ARGS); -UNK_RET func_800B675C(struct s800A5AC0*, UNK_TYPE); // func_800B675C +UNK_RET func_800B675C(s800A5AC0*, UNK_TYPE); // func_800B675C // UNK_RET func_800B67C0(UNK_ARGS); // UNK_RET func_800B67E0(UNK_ARGS); // UNK_RET func_800B67FC(UNK_ARGS); @@ -788,12 +789,12 @@ UNK_RET func_800B675C(struct s800A5AC0*, UNK_TYPE); // func_800B675C // UNK_RET func_800B8248(UNK_ARGS); // UNK_RET func_800B82EC(UNK_ARGS); // UNK_RET func_800B83BC(UNK_ARGS); -UNK_TYPE func_800B84D0(struct s800A5AC0*, UNK_TYPE); // func_800B84D0 +UNK_TYPE func_800B84D0(s800A5AC0*, UNK_TYPE); // func_800B84D0 // UNK_RET func_800B8500(UNK_ARGS); // UNK_RET func_800B85E0(UNK_ARGS); // UNK_RET func_800B8614(UNK_ARGS); -UNK_RET func_800B863C(struct s800A5AC0*, UNK_TYPE); // func_800B863C -UNK_TYPE func_800B867C(struct s800A5AC0*); // func_800B867C +UNK_RET func_800B863C(s800A5AC0*, UNK_TYPE); // func_800B863C +UNK_TYPE func_800B867C(s800A5AC0*); // func_800B867C // UNK_RET func_800B86C8(UNK_ARGS); // UNK_RET func_800B8708(UNK_ARGS); // UNK_RET func_800B8718(UNK_ARGS); @@ -888,7 +889,7 @@ UNK_TYPE func_800B867C(struct s800A5AC0*); // func_800B867C // UNK_RET func_800BDAA0(UNK_ARGS); // UNK_RET func_800BDC5C(UNK_ARGS); // UNK_RET func_800BDFB0(UNK_ARGS); -UNK_RET func_800BDFC0(UNK_TYPE, UNK_TYPE, UNK_TYPE, struct s800A5AC0*); // func_800BDFC0 +UNK_RET func_800BDFC0(UNK_TYPE, UNK_TYPE, UNK_TYPE, s800A5AC0*); // func_800BDFC0 void func_800BE03C(z_GlobalContext*, UNK_TYPE); // func_800BE03C // UNK_RET func_800BE0B8(UNK_ARGS); // UNK_RET func_800BE184(UNK_ARGS); diff --git a/include/os.h b/include/os.h index ba8be94c4f..a89c91c975 100644 --- a/include/os.h +++ b/include/os.h @@ -8,81 +8,81 @@ typedef s32 OSPri; typedef s32 OSId; typedef union { - /* 0 */ struct { - /* 0 */ f32 f_odd; - /* 4 */ f32 f_even; + /* 0x0 */ struct { + /* 0x0 */ f32 f_odd; + /* 0x4 */ f32 f_even; } f; - /* 0 */ f64 d; + /* 0x0 */ f64 d; } __OSfp; typedef struct { - /* 0 */ u64 at; - /* 8 */ u64 v0; - /* 16 */ u64 v1; - /* 24 */ u64 a0; - /* 32 */ u64 a1; - /* 40 */ u64 a2; - /* 48 */ u64 a3; - /* 56 */ u64 t0; - /* 64 */ u64 t1; - /* 72 */ u64 t2; - /* 80 */ u64 t3; - /* 88 */ u64 t4; - /* 96 */ u64 t5; - /* 104 */ u64 t6; - /* 112 */ u64 t7; - /* 120 */ u64 s0; - /* 128 */ u64 s1; - /* 136 */ u64 s2; - /* 144 */ u64 s3; - /* 152 */ u64 s4; - /* 160 */ u64 s5; - /* 168 */ u64 s6; - /* 176 */ u64 s7; - /* 184 */ u64 t8; - /* 192 */ u64 t9; - /* 200 */ u64 gp; - /* 208 */ u64 sp; - /* 216 */ u64 s8; - /* 224 */ u64 ra; - /* 232 */ u64 lo; - /* 240 */ u64 hi; - /* 248 */ u32 sr; - /* 252 */ u32 pc; - /* 256 */ u32 cause; - /* 260 */ u32 badvaddr; - /* 264 */ u32 rcp; - /* 268 */ u32 fpcsr; - /* 272 */ __OSfp fp0; - /* 280 */ __OSfp fp2; - /* 288 */ __OSfp fp4; - /* 296 */ __OSfp fp6; - /* 304 */ __OSfp fp8; - /* 312 */ __OSfp fp10; - /* 320 */ __OSfp fp12; - /* 328 */ __OSfp fp14; - /* 336 */ __OSfp fp16; - /* 344 */ __OSfp fp18; - /* 352 */ __OSfp fp20; - /* 360 */ __OSfp fp22; - /* 368 */ __OSfp fp24; - /* 376 */ __OSfp fp26; - /* 384 */ __OSfp fp28; - /* 392 */ __OSfp fp30; + /* 0x0 */ u64 at; + /* 0x8 */ u64 v0; + /* 0x10 */ u64 v1; + /* 0x18 */ u64 a0; + /* 0x20 */ u64 a1; + /* 0x28 */ u64 a2; + /* 0x30 */ u64 a3; + /* 0x38 */ u64 t0; + /* 0x40 */ u64 t1; + /* 0x48 */ u64 t2; + /* 0x50 */ u64 t3; + /* 0x58 */ u64 t4; + /* 0x60 */ u64 t5; + /* 0x68 */ u64 t6; + /* 0x70 */ u64 t7; + /* 0x78 */ u64 s0; + /* 0x80 */ u64 s1; + /* 0x88 */ u64 s2; + /* 0x90 */ u64 s3; + /* 0x98 */ u64 s4; + /* 0xA0 */ u64 s5; + /* 0xA8 */ u64 s6; + /* 0xB0 */ u64 s7; + /* 0xB8 */ u64 t8; + /* 0xC0 */ u64 t9; + /* 0xC8 */ u64 gp; + /* 0xD0 */ u64 sp; + /* 0xD8 */ u64 s8; + /* 0xE0 */ u64 ra; + /* 0xE8 */ u64 lo; + /* 0xF0 */ u64 hi; + /* 0xF8 */ u32 sr; + /* 0xFC */ u32 pc; + /* 0x100 */ u32 cause; + /* 0x104 */ u32 badvaddr; + /* 0x108 */ u32 rcp; + /* 0x10C */ u32 fpcsr; + /* 0x110 */ __OSfp fp0; + /* 0x118 */ __OSfp fp2; + /* 0x120 */ __OSfp fp4; + /* 0x128 */ __OSfp fp6; + /* 0x130 */ __OSfp fp8; + /* 0x138 */ __OSfp fp10; + /* 0x140 */ __OSfp fp12; + /* 0x148 */ __OSfp fp14; + /* 0x150 */ __OSfp fp16; + /* 0x158 */ __OSfp fp18; + /* 0x160 */ __OSfp fp20; + /* 0x168 */ __OSfp fp22; + /* 0x170 */ __OSfp fp24; + /* 0x178 */ __OSfp fp26; + /* 0x180 */ __OSfp fp28; + /* 0x188 */ __OSfp fp30; } __OSThreadContext; typedef struct OSThread_s { - /* 0 */ struct OSThread_s* next; - /* 4 */ OSPri priority; - /* 8 */ struct OSThread_s** queue; - /* 12 */ struct OSThread_s* tlnext; - /* 16 */ u16 state; - /* 18 */ u16 flags; - /* 20 */ OSId id; - /* 24 */ int fp; - /* 32 */ __OSThreadContext context; + /* 0x0 */ struct OSThread_s* next; + /* 0x4 */ OSPri priority; + /* 0x8 */ struct OSThread_s** queue; + /* 0xC */ struct OSThread_s* tlnext; + /* 0x10 */ u16 state; + /* 0x12 */ u16 flags; + /* 0x14 */ OSId id; + /* 0x18 */ int fp; + /* 0x20 */ __OSThreadContext context; } OSThread; typedef u32 OSEvent; @@ -94,176 +94,176 @@ typedef u32 OSPageMask; typedef void* OSMesg; typedef struct { - /* 0 */ OSThread* mtqueue; - /* 4 */ OSThread* fullqueue; - /* 8 */ s32 validCount; - /* 12 */ s32 first; - /* 16 */ s32 msgCount; - /* 20 */ OSMesg* msg; + /* 0x0 */ OSThread* mtqueue; + /* 0x4 */ OSThread* fullqueue; + /* 0x8 */ s32 validCount; + /* 0xC */ s32 first; + /* 0x10 */ s32 msgCount; + /* 0x14 */ OSMesg* msg; } OSMesgQueue; typedef struct { - /* 0 */ u32 errStatus; - /* 4 */ void* dramAddr; - /* 8 */ void* C2Addr; - /* 12 */ u32 sectorSize; - /* 16 */ u32 C1ErrNum; - /* 20 */ u32 C1ErrSector[4]; + /* 0x0 */ u32 errStatus; + /* 0x4 */ void* dramAddr; + /* 0x8 */ void* C2Addr; + /* 0xC */ u32 sectorSize; + /* 0x10 */ u32 C1ErrNum; + /* 0x14 */ u32 C1ErrSector[4]; } __OSBlockInfo; typedef struct { - /* 0 */ u32 cmdType; - /* 4 */ u16 transferMode; - /* 6 */ u16 blockNum; - /* 8 */ s32 sectorNum; - /* 12 */ u32 devAddr; - /* 16 */ u32 bmCtlShadow; - /* 20 */ u32 seqCtlShadow; - /* 24 */ __OSBlockInfo block[2]; + /* 0x0 */ u32 cmdType; + /* 0x4 */ u16 transferMode; + /* 0x6 */ u16 blockNum; + /* 0x8 */ s32 sectorNum; + /* 0xC */ u32 devAddr; + /* 0x10 */ u32 bmCtlShadow; + /* 0x14 */ u32 seqCtlShadow; + /* 0x18 */ __OSBlockInfo block[2]; } __OSTranxInfo; typedef struct OSPiHandle_s { - /* 0 */ struct OSPiHandle_s* next; - /* 4 */ u8 type; - /* 5 */ u8 latency; - /* 6 */ u8 pageSize; - /* 7 */ u8 relDuration; - /* 8 */ u8 pulse; - /* 9 */ u8 domain; - /* 12 */ u32 baseAddress; - /* 16 */ u32 speed; - /* 20 */ __OSTranxInfo transferInfo; + /* 0x0 */ struct OSPiHandle_s* next; + /* 0x4 */ u8 type; + /* 0x5 */ u8 latency; + /* 0x6 */ u8 pageSize; + /* 0x7 */ u8 relDuration; + /* 0x8 */ u8 pulse; + /* 0x9 */ u8 domain; + /* 0xC */ u32 baseAddress; + /* 0x10 */ u32 speed; + /* 0x14 */ __OSTranxInfo transferInfo; } OSPiHandle; typedef struct { - /* 0 */ u8 type; - /* 4 */ u32 address; + /* 0x0 */ u8 type; + /* 0x4 */ u32 address; } OSPiInfo; typedef struct { - /* 0 */ u16 type; - /* 2 */ u8 pri; - /* 3 */ u8 status; - /* 4 */ OSMesgQueue* retQueue; + /* 0x0 */ u16 type; + /* 0x2 */ u8 pri; + /* 0x3 */ u8 status; + /* 0x4 */ OSMesgQueue* retQueue; } OSIoMesgHdr; typedef struct { - /* 0 */ OSIoMesgHdr hdr; - /* 8 */ void* dramAddr; - /* 12 */ u32 devAddr; - /* 16 */ u32 size; + /* 0x0 */ OSIoMesgHdr hdr; + /* 0x8 */ void* dramAddr; + /* 0xC */ u32 devAddr; + /* 0x10 */ u32 size; } OSIoMesg; typedef struct { - /* 0 */ s32 active; - /* 4 */ OSThread* thread; - /* 8 */ OSMesgQueue* cmdQueue; - /* 12 */ OSMesgQueue* evtQueue; - /* 16 */ OSMesgQueue* acsQueue; - /* 20 */ s32 (*dma)(... /* ECOFF does not store param types */); + /* 0x0 */ s32 active; + /* 0x4 */ OSThread* thread; + /* 0x8 */ OSMesgQueue* cmdQueue; + /* 0xC */ OSMesgQueue* evtQueue; + /* 0x10 */ OSMesgQueue* acsQueue; + /* 0x14 */ s32 (*dma)(... /* ECOFF does not store param types */); } OSDevMgr; typedef struct { - /* 0 */ u32 ctrl; - /* 4 */ u32 width; - /* 8 */ u32 burst; - /* 12 */ u32 vSync; - /* 16 */ u32 hSync; - /* 20 */ u32 leap; - /* 24 */ u32 hStart; - /* 28 */ u32 xScale; - /* 32 */ u32 vCurrent; + /* 0x0 */ u32 ctrl; + /* 0x4 */ u32 width; + /* 0x8 */ u32 burst; + /* 0xC */ u32 vSync; + /* 0x10 */ u32 hSync; + /* 0x14 */ u32 leap; + /* 0x18 */ u32 hStart; + /* 0x1C */ u32 xScale; + /* 0x20 */ u32 vCurrent; } OSViCommonRegs; typedef struct { - /* 0 */ u32 origin; - /* 4 */ u32 yScale; - /* 8 */ u32 vStart; - /* 12 */ u32 vBurst; - /* 16 */ u32 vIntr; + /* 0x0 */ u32 origin; + /* 0x4 */ u32 yScale; + /* 0x8 */ u32 vStart; + /* 0xC */ u32 vBurst; + /* 0x10 */ u32 vIntr; } OSViFieldRegs; typedef struct { - /* 0 */ u8 type; - /* 4 */ OSViCommonRegs comRegs; - /* 40 */ OSViFieldRegs fldRegs[2]; + /* 0x0 */ u8 type; + /* 0x4 */ OSViCommonRegs comRegs; + /* 0x28 */ OSViFieldRegs fldRegs[2]; } OSViMode; typedef u64 OSTime; typedef struct OSTimer_s { - /* 0 */ struct OSTimer_s* next; - /* 4 */ struct OSTimer_s* prev; - /* 8 */ OSTime interval; - /* 16 */ OSTime value; - /* 24 */ OSMesgQueue* mq; - /* 28 */ OSMesg msg; + /* 0x0 */ struct OSTimer_s* next; + /* 0x4 */ struct OSTimer_s* prev; + /* 0x8 */ OSTime interval; + /* 0x10 */ OSTime value; + /* 0x18 */ OSMesgQueue* mq; + /* 0x1C */ OSMesg msg; } OSTimer; typedef struct { - /* 0 */ u16 type; - /* 2 */ u8 status; - /* 3 */ u8 errno; + /* 0x0 */ u16 type; + /* 0x2 */ u8 status; + /* 0x3 */ u8 errno; } OSContStatus; typedef struct { - /* 0 */ u16 button; - /* 2 */ s8 stick_x; - /* 3 */ s8 stick_y; - /* 4 */ u8 errno; + /* 0x0 */ u16 button; + /* 0x2 */ s8 stick_x; + /* 0x3 */ s8 stick_y; + /* 0x4 */ u8 errno; } OSContPad; typedef struct { - /* 0 */ void* address; - /* 4 */ u8 databuffer[32]; - /* 36 */ u8 addressCrc; - /* 37 */ u8 dataCrc; - /* 38 */ u8 errno; + /* 0x0 */ void* address; + /* 0x4 */ u8 databuffer[32]; + /* 0x24 */ u8 addressCrc; + /* 0x25 */ u8 dataCrc; + /* 0x26 */ u8 errno; } OSContRamIo; typedef struct { - /* 0 */ int status; - /* 4 */ OSMesgQueue* queue; - /* 8 */ int channel; - /* 12 */ u8 id[32]; - /* 44 */ u8 backup_id[32]; - /* 76 */ u8 label[32]; - /* 108 */ int pack_size; - /* 112 */ int version; - /* 116 */ int dir_size; - /* 120 */ int inode_start_page; + /* 0x0 */ int status; + /* 0x4 */ OSMesgQueue* queue; + /* 0x8 */ int channel; + /* 0xC */ u8 id[32]; + /* 0x2C */ u8 backup_id[32]; + /* 0x4C */ u8 label[32]; + /* 0x6C */ int pack_size; + /* 0x70 */ int version; + /* 0x74 */ int dir_size; + /* 0x78 */ int inode_start_page; } OSPfs; typedef struct { - /* 0 */ u32 file_size; - /* 4 */ u16 company_code; - /* 6 */ u16 game_code; - /* 8 */ unsigned char ext_name[4]; - /* 12 */ unsigned char game_name[16]; + /* 0x0 */ u32 file_size; + /* 0x4 */ u16 company_code; + /* 0x6 */ u16 game_code; + /* 0x8 */ unsigned char ext_name[4]; + /* 0xC */ unsigned char game_name[16]; } OSPfsState; typedef struct { - /* 0 */ u16* histo_base; - /* 4 */ u32 histo_size; - /* 8 */ u32* text_start; - /* 12 */ u32* text_end; + /* 0x0 */ u16* histo_base; + /* 0x4 */ u32 histo_size; + /* 0x8 */ u32* text_start; + /* 0xC */ u32* text_end; } OSProf; #endif diff --git a/include/osint.h b/include/osint.h index da4a49107b..423884d3ce 100644 --- a/include/osint.h +++ b/include/osint.h @@ -11,14 +11,14 @@ #include typedef struct { - /* 0 */ OSMesgQueue* messageQueue; - /* 4 */ OSMesg message; + /* 0x0 */ OSMesgQueue* messageQueue; + /* 0x4 */ OSMesg message; } __OSEventState; typedef struct { - /* 0 */ OSThread* next; - /* 4 */ OSPri priority; + /* 0x0 */ OSThread* next; + /* 0x4 */ OSPri priority; } __OSThreadTail; #include // TODO all variables should be moved to the file that logically defines them diff --git a/include/ramrom.h b/include/ramrom.h index c386f33dde..be33d8dc89 100644 --- a/include/ramrom.h +++ b/include/ramrom.h @@ -4,10 +4,10 @@ #include typedef struct { - /* 0 */ long type; - /* 4 */ long length; - /* 8 */ long magic; - /* 12 */ unsigned char userdata[24564]; + /* 0x0 */ long type; + /* 0x4 */ long length; + /* 0x8 */ long magic; + /* 0xC */ unsigned char userdata[24564]; } RamRomBuffer; #endif diff --git a/include/rdb.h b/include/rdb.h index 58baae00fd..04b3ed5bc5 100644 --- a/include/rdb.h +++ b/include/rdb.h @@ -2,9 +2,9 @@ #define _RDB_H_ typedef struct { - /* 0 */ unsigned int type : 2; - /* 0 */ unsigned int length : 2; - /* 1 */ unsigned char buf[3]; + /* 0x0 */ unsigned int type : 2; + /* 0x0 */ unsigned int length : 2; + /* 0x1 */ unsigned char buf[3]; } rdbPacket; #endif diff --git a/include/sptask.h b/include/sptask.h index ebf275d453..f2536b43bf 100644 --- a/include/sptask.h +++ b/include/sptask.h @@ -4,28 +4,28 @@ #include typedef struct { - /* 0 */ u32 type; - /* 4 */ u32 flags; - /* 8 */ u64* ucode_boot; - /* 12 */ u32 ucode_boot_size; - /* 16 */ u64* ucode; - /* 20 */ u32 ucode_size; - /* 24 */ u64* ucode_data; - /* 28 */ u32 ucode_data_size; - /* 32 */ u64* dram_stack; - /* 36 */ u32 dram_stack_size; - /* 40 */ u64* output_buff; - /* 44 */ u64* output_buff_size; - /* 48 */ u64* data_ptr; - /* 52 */ u32 data_size; - /* 56 */ u64* yield_data_ptr; - /* 60 */ u32 yield_data_size; + /* 0x0 */ u32 type; + /* 0x4 */ u32 flags; + /* 0x8 */ u64* ucode_boot; + /* 0xC */ u32 ucode_boot_size; + /* 0x10 */ u64* ucode; + /* 0x14 */ u32 ucode_size; + /* 0x18 */ u64* ucode_data; + /* 0x1C */ u32 ucode_data_size; + /* 0x20 */ u64* dram_stack; + /* 0x24 */ u32 dram_stack_size; + /* 0x28 */ u64* output_buff; + /* 0x2C */ u64* output_buff_size; + /* 0x30 */ u64* data_ptr; + /* 0x34 */ u32 data_size; + /* 0x38 */ u64* yield_data_ptr; + /* 0x3C */ u32 yield_data_size; } OSTask_t; typedef union { - /* 0 */ OSTask_t t; - /* 0 */ long long force_structure_alignment; + /* 0x0 */ OSTask_t t; + /* 0x0 */ long long force_structure_alignment; } OSTask; typedef u32 OSYieldResult; diff --git a/include/structs.h b/include/structs.h index eddd217a1b..a7763dca10 100644 --- a/include/structs.h +++ b/include/structs.h @@ -5,104 +5,104 @@ #include #include -struct s80085320 { -/* 00 */ struct s80085320* next; -/* 04 */ struct s80085320* prev; -/* 08 */ UNK_TYPE* unk8; -/* 12 */ UNK_TYPE* unk12; -/* 16 */ UNK_TYPE unk16; -/* 20 */ UNK_TYPE unk20; -/* 24 */ UNK_TYPE* unk24; -}; +typedef struct s80085320_s { +/* 0x00 */ struct s80085320_s* next; +/* 0x04 */ struct s80085320_s* prev; +/* 0x08 */ UNK_TYPE* unk8; +/* 0x0C */ UNK_TYPE* unkC; +/* 0x10 */ UNK_TYPE unk10; +/* 0x14 */ UNK_TYPE unk14; +/* 0x18 */ UNK_TYPE* unk18; +} s80085320; -struct s8008A6FC { -/* 00 */ UNK_TYPE unk0; -/* 04 */ UNK_TYPE unk4; -/* 08 */ UNK_TYPE unk8; -/* 12 */ UNK_TYPE unk12; -}; +typedef struct { +/* 0x0 */ UNK_TYPE unk0; +/* 0x4 */ UNK_TYPE unk4; +/* 0x8 */ UNK_TYPE unk8; +/* 0xC */ UNK_TYPE unkC; +} s8008A6FC; // TODO this should extend from z_Actor -struct s800A5AC0 { - /* 000 */ u8 pad0[28]; - /* 028 */ s16 unk28; - /* 030 */ u8 pad1[116]; - /* 146 */ s16 unk146; - /* 148 */ u8 pad2[34]; - /* 182 */ u8 unk182; - /* 183 */ u8 pad4[5]; - /* 188 */ u16 unk188; // or char - /* 190 */ s16 unk190; - /* 192 */ u8 pad5[86]; - /* 278 */ u16 unk278; - /* 280 */ u8 pad6[44]; - /* 324 */ void(*unk324)(struct s800A5AC0*, UNK_TYPE); - /* 328 */ UNK_TYPE unk328; -}; +typedef struct s800A5AC0_s { + /* 0x000 */ u8 pad0[0x1C]; + /* 0x01C */ s16 unk1C; + /* 0x01E */ u8 pad1[0x74]; + /* 0x092 */ s16 unk92; + /* 0x094 */ u8 pad2[0x22]; + /* 0x0B6 */ u8 unkB6; + /* 0x0B7 */ u8 pad4[5]; + /* 0x0BC */ u16 unkBC; // or char + /* 0x0BE */ s16 unkBE; + /* 0x0C0 */ u8 pad5[0x56]; + /* 0x116 */ u16 unk116; + /* 0x118 */ u8 pad6[0x2C]; + /* 0x144 */ void(*unk144)(struct s800A5AC0_s*, UNK_TYPE); + /* 0x148 */ UNK_TYPE unk148; +} s800A5AC0; -typedef struct s800BF9A0_s { - /* 000 */ u8 pad0[8]; - /* 008 */ UNK_TYPE unk8; - /* 012 */ UNK_TYPE unk12; - /* 016 */ u32 unk16; - /* 020 */ u8 pad1[10]; - /* 030 */ s8 unk30; - /* 031 */ u8 pad2[1]; -} s800BF9A0_s; +typedef struct { + /* 0x00 */ u8 pad0[8]; + /* 0x08 */ UNK_TYPE unk8; + /* 0x0C */ UNK_TYPE unkC; + /* 0x10 */ u32 unk10; + /* 0x14 */ u8 pad1[0xA]; + /* 0x1E */ s8 unk1E; + /* 0x1F */ u8 pad2[1]; +} s800BF9A0; -typedef struct s800CAAD0_s { - /* 000 */ UNK_TYPE unk0; - /* 004 */ UNK_TYPE unk4; - /* 008 */ UNK_TYPE unk8; - /* 012 */ u8 pad0[92]; - /* 104 */ UNK_TYPE unk104; - /* 108 */ UNK_TYPE unk108; - /* 112 */ UNK_TYPE unk112; - /* 116 */ u16 unk116; - /* 118 */ u16 unk118; - /* 120 */ u16 unk120; - /* 122 */ u8 pad1[2]; - /* 124 */ f32 unk124; - /* 128 */ f32 unk128; - /* 132 */ f32 unk132; - /* 136 */ UNK_TYPE unk136; - /* 140 */ UNK_TYPE unk140; - /* 144 */ UNK_TYPE unk144; - /* 148 */ u16 unk148; - /* 150 */ u16 unk150; - /* 152 */ u16 unk152; - /* 154 */ u8 pad2[2]; - /* 156 */ f32 unk156; - /* 160 */ f32 unk160; - /* 164 */ f32 unk164; +typedef struct { + /* 0x00 */ UNK_TYPE unk0; + /* 0x04 */ UNK_TYPE unk4; + /* 0x08 */ UNK_TYPE unk8; + /* 0x12 */ u8 pad0[0x5C]; + /* 0x68 */ UNK_TYPE unk68; + /* 0x6C */ UNK_TYPE unk6C; + /* 0x70 */ UNK_TYPE unk70; + /* 0x72 */ u16 unk72; + /* 0x74 */ u16 unk74; + /* 0x76 */ u16 unk76; + /* 0x78 */ u8 pad1[2]; + /* 0x7C */ f32 unk7C; + /* 0x80 */ f32 unk80; + /* 0x84 */ f32 unk84; + /* 0x88 */ UNK_TYPE unk88; + /* 0x8C */ UNK_TYPE unk8C; + /* 0x90 */ UNK_TYPE unk90; + /* 0x94 */ u16 unk94; + /* 0x96 */ u16 unk96; + /* 0x98 */ u16 unk98; + /* 0x9A */ u8 pad2[2]; + /* 0x9C */ f32 unk9C; + /* 0xA0 */ f32 unkA0; + /* 0xA4 */ f32 unkA4; } s800CAAD0; -typedef struct s800E03A0_s { - /* 000 */ u8 pad[32]; +typedef struct { + /* 0x00 */ u8 pad[0x20]; } s800E03A0; // Entries in dmadata typedef struct { - /* 000 */ u32 vromStart; - /* 004 */ u32 vromEnd; - /* 008 */ u32 romStart; - /* 012 */ u32 romEnd; + /* 0x0 */ u32 vromStart; + /* 0x4 */ u32 vromEnd; + /* 0x8 */ u32 romStart; + /* 0xC */ u32 romEnd; } DmadataEntry; -typedef struct s80080A08_s { - /* 000 */ UNK_PTR unk0; - /* 004 */ UNK_FUN_PTR(unk4); - /* 008 */ UNK_TYPE unk8; - /* 012 */ u8 pad1[8]; - /* 020 */ UNK_TYPE unk20; - /* 024 */ OSMesgQueue* unk24; - /* 028 */ UNK_TYPE unk28; +typedef struct { + /* 0x00 */ UNK_PTR unk0; + /* 0x04 */ UNK_FUN_PTR(unk4); + /* 0x08 */ UNK_TYPE unk8; + /* 0x0C */ u8 pad1[8]; + /* 0x14 */ UNK_TYPE unk14; + /* 0x18 */ OSMesgQueue* unk18; + /* 0x1C */ UNK_TYPE unk1C; } s80080A08; // This struct is huge! Global context? -typedef struct s800F4F54_s { - /* 00000 */ u8 pad[92152]; - /* 92152 */ u8 unk92152; +typedef struct { + /* 0x00000 */ u8 pad[0x167F8]; + /* 0x167F8 */ u8 unk167F8; } s800F4F54; typedef struct { @@ -116,34 +116,34 @@ struct z_Actor; typedef void(*z_ActorFunc)(struct z_Actor*, void*); typedef struct { - /* 000 */ u8 pad0[4]; - /* 004 */ UNK_TYPE unk4; - /* 008 */ u8 pad1[20]; - /* 028 */ s16 unk28; - /* 030 */ u8 pad2[58]; - /* 088 */ z_Vector3D unk088; // scale? - /* 100 */ u8 pad3[46]; - /* 146 */ s16 unk146; - /* 148 */ u8 pad4[34]; - /* 182 */ u8 unk182; - /* 183 */ u8 pad5[5]; - /* 188 */ u16 unk188; // or char - /* 190 */ s16 unk190; - /* 192 */ u8 pad6[60]; - /* 252 */ f32 unk252; // start of z_Vector3D? - /* 256 */ f32 unk256; - /* 260 */ f32 unk260; - /* 264 */ u8 pad7[14]; - /* 278 */ u16 unk278; - /* 280 */ u8 pad8[36]; - /* 316 */ z_ActorFunc drawFunc; - /* 320 */ u8 pad9[4]; + /* 0x000 */ u8 pad0[4]; + /* 0x004 */ UNK_TYPE unk4; + /* 0x008 */ u8 pad1[0x14]; + /* 0x01C */ s16 unk1C; + /* 0x01E */ u8 pad2[0x3A]; + /* 0x058 */ z_Vector3D unk58; // scale? + /* 0x064 */ u8 pad3[0x2E]; + /* 0x092 */ s16 unk92; + /* 0x094 */ u8 pad4[0x22]; + /* 0x0B6 */ u8 unkB6; + /* 0x0B7 */ u8 pad5[5]; + /* 0x0BC */ u16 unkBC; // or char + /* 0x0BE */ s16 unkBE; + /* 0x0C0 */ u8 pad6[0x3C]; + /* 0x0FC */ f32 unkFC; // start of z_Vector3D? + /* 0x100 */ f32 unk100; + /* 0x104 */ f32 unk104; + /* 0x108 */ u8 pad7[0xE]; + /* 0x116 */ u16 unk116; + /* 0x118 */ u8 pad8[0x24]; + /* 0x13C */ z_ActorFunc drawFunc; + /* 0x140 */ u8 pad9[4]; // TODO figure out what size this is } z_Actor; typedef struct s80BD5530_s { - /* 000000 */ u8 pad[100484]; - /* 100484 */ UNK_TYPE unk100484; + /* 0x00000 */ u8 pad[0x18884]; + /* 0x18884 */ UNK_TYPE unk18884; } z_GlobalContext; typedef struct { @@ -173,26 +173,26 @@ typedef struct { typedef long Mtx_t[4][4]; typedef union { - /* 0 */ Mtx_t m; - /* 0 */ long long force_structure_alignment; + /* 0x0 */ Mtx_t m; + /* 0x0 */ long long force_structure_alignment; } Mtx; typedef struct { - /* 0 */ int quot; - /* 4 */ int rem; + /* 0x0 */ int quot; + /* 0x4 */ int rem; } div_t; typedef struct { - /* 0 */ long quot; - /* 4 */ long rem; + /* 0x0 */ long quot; + /* 0x4 */ long rem; } ldiv_t; typedef struct { - /* 0 */ long long quot; - /* 8 */ long long rem; + /* 0x0 */ long long quot; + /* 0x8 */ long long rem; } lldiv_t; typedef unsigned int size_t; @@ -200,22 +200,22 @@ typedef unsigned int size_t; typedef double ldouble; typedef struct { - /* 0 */ union { - /* 0 */ long long ll; - /* 0 */ ldouble ld; + /* 0x0 */ union { + /* 0x0 */ long long ll; + /* 0x0 */ ldouble ld; } v; - /* 8 */ unsigned char* s; - /* 12 */ int n0; - /* 16 */ int nz0; - /* 20 */ int n1; - /* 24 */ int nz1; - /* 28 */ int n2; - /* 32 */ int nz2; - /* 36 */ int prec; - /* 40 */ int width; - /* 44 */ size_t nchar; - /* 48 */ unsigned int flags; - /* 52 */ unsigned char qual; + /* 0x8 */ unsigned char* s; + /* 0xC */ int n0; + /* 0x10 */ int nz0; + /* 0x14 */ int n1; + /* 0x18 */ int nz1; + /* 0x1C */ int n2; + /* 0x20 */ int nz2; + /* 0x24 */ int prec; + /* 0x28 */ int width; + /* 0x2C */ size_t nchar; + /* 0x30 */ unsigned int flags; + /* 0x34 */ unsigned char qual; } _Pft; #endif diff --git a/include/ultralog.h b/include/ultralog.h index 2f16e419f3..401baf193f 100644 --- a/include/ultralog.h +++ b/include/ultralog.h @@ -4,25 +4,25 @@ #include typedef struct { - /* 0 */ u32 magic; - /* 4 */ u32 len; - /* 8 */ u32* base; - /* 12 */ s32 startCount; - /* 16 */ s32 writeOffset; + /* 0x0 */ u32 magic; + /* 0x4 */ u32 len; + /* 0x8 */ u32* base; + /* 0xC */ s32 startCount; + /* 0x10 */ s32 writeOffset; } OSLog; typedef struct { - /* 0 */ u32 magic; - /* 4 */ u32 timeStamp; - /* 8 */ u16 argCount; - /* 10 */ u16 eventID; + /* 0x0 */ u32 magic; + /* 0x4 */ u32 timeStamp; + /* 0x8 */ u16 argCount; + /* 0xA */ u16 eventID; } OSLogItem; typedef struct { - /* 0 */ u32 magic; - /* 4 */ u32 version; + /* 0x0 */ u32 magic; + /* 0x4 */ u32 version; } OSLogFileHdr; #endif diff --git a/include/variables.h b/include/variables.h index 98613f4fe8..09cbef105d 100644 --- a/include/variables.h +++ b/include/variables.h @@ -834,7 +834,7 @@ extern UNK_TYPE D_00C7A4E0; // D_00C7A4E0 //extern UNK_TYPE D_060010E0; //extern UNK_TYPE D_060010F0; //extern UNK_TYPE D_060010F4; -//extern UNK_TYPE D_06001100; +extern UNK_TYPE D_06001100; //extern UNK_TYPE D_06001118; //extern UNK_TYPE D_06001140; //extern UNK_TYPE D_06001158; @@ -853,7 +853,7 @@ extern UNK_TYPE D_00C7A4E0; // D_00C7A4E0 //extern UNK_TYPE D_06001210; //extern UNK_TYPE D_06001214; //extern UNK_TYPE D_06001220; -//extern UNK_TYPE D_06001228; +extern UNK_TYPE D_06001228; //extern UNK_TYPE D_06001254; //extern UNK_TYPE D_06001290; //extern UNK_TYPE D_06001298; @@ -1888,8 +1888,8 @@ extern UNK_TYPE* D_80096B60; // D_80096B60 //extern UNK_TYPE D_80096BE4; //extern UNK_TYPE D_80096C20; //extern UNK_TYPE D_80096C30; -extern struct s80085320* g_s80085320_ListHead; // D_80096C40 -extern struct s80085320* g_s80085320_ListTail; // D_80096C44 +extern s80085320* g_s80085320_ListHead; // D_80096C40 +extern s80085320* g_s80085320_ListTail; // D_80096C44 //extern UNK_TYPE D_80096C50; //extern UNK_TYPE D_80096CD0; //extern UNK_TYPE D_80096CF0; @@ -2094,22 +2094,22 @@ extern UNK_TYPE leoDiskStack; // D_80099290 //extern UNK_TYPE D_800994C8; extern UNK_TYPE D_800994D0; // D_800994D0 extern UNK_TYPE D_800994DC; // D_800994DC -extern struct s80085320 D_80099500; // D_80099500 +extern s80085320 D_80099500; // D_80099500 extern OSThread D_80099520; // D_80099520 extern UNK_TYPE D_800996D0; // D_800996D0 -extern struct s80085320 D_80099AD0; // D_80099AD0 +extern s80085320 D_80099AD0; // D_80099AD0 extern UNK_TYPE D_80099AF0; // D_80099AF0 extern UNK_TYPE D_80099EF0; // D_80099EF0 extern UNK_TYPE D_8009A170; // D_8009A170 -extern struct s80085320 D_8009A670; // D_8009A670 +extern s80085320 D_8009A670; // D_8009A670 extern UNK_TYPE D_8009A690; // D_8009A690 extern UNK_TYPE D_8009A840; // D_8009A840 -extern struct s80085320 D_8009B140; // D_8009B140 +extern s80085320 D_8009B140; // D_8009B140 extern UNK_TYPE D_8009B160; // D_8009B160 extern UNK_TYPE D_8009B228; // D_8009B228 extern u32* D_8009B240; // D_8009B240 extern u8 D_8009B290; // D_8009B290 -extern struct s80085320 D_8009B2A0; // D_8009B2A0 +extern s80085320 D_8009B2A0; // D_8009B2A0 extern u16 D_8009B2BC; // D_8009B2BC extern OSMesgQueue D_8009B2C0; // D_8009B2C0 extern UNK_TYPE D_8009B2D8; // D_8009B2D8 @@ -2278,7 +2278,7 @@ extern int D_801ADEB0[]; // D_801ADEB0 //extern UNK_TYPE D_801AEFB8; //extern UNK_TYPE D_801AEFBC; //extern UNK_TYPE D_801AEFC0; -extern s800BF9A0_s D_801AEFD0; // D_801AEFD0 +extern s800BF9A0 D_801AEFD0; // D_801AEFD0 //extern UNK_TYPE D_801AEFE0; //extern UNK_TYPE D_801AEFE4; //extern UNK_TYPE D_801AEFEE; diff --git a/include/viint.h b/include/viint.h index 1da1113b02..2952a4ec7e 100644 --- a/include/viint.h +++ b/include/viint.h @@ -7,22 +7,22 @@ #include typedef struct { - /* 0 */ f32 factor; - /* 4 */ u16 offset; - /* 8 */ u32 scale; + /* 0x0 */ f32 factor; + /* 0x4 */ u16 offset; + /* 0x8 */ u32 scale; } __OSViScale; typedef struct { - /* 0 */ u16 state; - /* 2 */ u16 retraceCount; - /* 4 */ void* framep; - /* 8 */ OSViMode* modep; - /* 12 */ u32 control; - /* 16 */ OSMesgQueue* msgq; - /* 20 */ OSMesg msg; - /* 24 */ __OSViScale x; - /* 36 */ __OSViScale y; + /* 0x0 */ u16 state; + /* 0x2 */ u16 retraceCount; + /* 0x4 */ void* framep; + /* 0x8 */ OSViMode* modep; + /* 0xC */ u32 control; + /* 0x10 */ OSMesgQueue* msgq; + /* 0x14 */ OSMesg msg; + /* 0x18 */ __OSViScale x; + /* 0x24 */ __OSViScale y; } __OSViContext; #endif diff --git a/print_mdebug.py b/print_mdebug.py index c13d69fdc0..51572628a9 100644 --- a/print_mdebug.py +++ b/print_mdebug.py @@ -21,32 +21,32 @@ is_comment = False symbol_type_list = [ 'stNil', 'stGlobal', 'stStatic', 'stParam', 'stLocal', 'stLabel', 'stProc', 'stBlock', 'stEnd', 'stMember', 'stTypedef', 'stFile', 'INVALID', 'INVALID', 'stStaticProc', 'stConstant', - 'stStaParam', 'INVALID', 'INVALID', 'INVALID', 'INVALID', 'INVALID', 'INVALID', 'INVALID', + 'stStaParam', 'INVALID', 'INVALID', 'INVALID', 'INVALID', 'INVALID', 'INVALID', 'INVALID', 'INVALID', 'INVALID', 'stStruct', 'stUnion', 'stEnum', 'INVALID', 'INVALID', 'INVALID', 'INVALID', 'INVALID', 'stIndirect'] storage_class_list = ['scNil', 'scText', 'scData', 'scBss', 'scRegister', 'scAbs', 'scUndefined', 'reserved', 'scBits', 'scDbx', 'scRegImage', 'scInfo', 'scUserStruct', 'scSData', 'scSBss', 'scRData', 'scVar', 'scCommon', 'scSCommon', 'scVarRegister', 'scVariant', 'scUndefined', 'scInit'] basic_type_c_list = ['nil', 'addr', 'signed char', 'unsigned char', 'short', 'unsigned short', 'int', 'unsigned int', - 'long', 'unsigned long', 'float', 'double', 'struct', 'union', 'enum', 'typedef', - 'range', 'set', 'complex', 'double complex', 'indirect', 'fixed decimal', 'float decimal', 'string', - 'bit', 'picture', 'void', 'long long', 'unsigned long long', 'INVALID', 'long', 'unsigned long', + 'long', 'unsigned long', 'float', 'double', 'struct', 'union', 'enum', 'typedef', + 'range', 'set', 'complex', 'double complex', 'indirect', 'fixed decimal', 'float decimal', 'string', + 'bit', 'picture', 'void', 'long long', 'unsigned long long', 'INVALID', 'long', 'unsigned long', 'long long', 'unsigned long long', 'addr', 'int64', 'unsigned int64'] - + def increase_indent(): global indent_level indent_level += 1 - + def decrease_indent(): global indent_level indent_level -= 1 - + def set_is_comment(set_to): global is_comment old = is_comment is_comment = set_to return old - + def get_indent(): global indent_level global is_comment @@ -63,20 +63,20 @@ def read_uint16_be(file_data, offset): def read_uint8_be(file_data, offset): return struct.unpack('>B', file_data[offset:offset+1])[0] - + def read_elf_header(file_data, offset): Header = collections.namedtuple('ElfHeader', '''e_magic e_class e_data e_version e_osabi e_abiversion e_pad e_type e_machine e_version2 e_entry e_phoff e_shoff e_flags e_ehsize e_phentsize e_phnum e_shentsize e_shnum e_shstrndx''') return Header._make(struct.unpack('>I5B7s2H5I6H', file_data[offset:offset+52])) - + def read_elf_section_header(file_data, offset): Header = collections.namedtuple('SectionHeader', '''sh_name sh_type sh_flags sh_addr sh_offset sh_size sh_link sh_info sh_addralign sh_entsize''') return Header._make(struct.unpack('>10I', file_data[offset:offset+40])) - + def read_symbolic_header(file_data, offset): Header = collections.namedtuple('SymbolicHeader', '''magic vstamp ilineMax cbLine cbLineOffset idnMax cbDnOffset @@ -105,7 +105,7 @@ def read_procedure_descriptor(file_data, offset): '''adr isym iline regmask regoffset iopt fregmask fregoffset frameoffset framereg pcreg lnLow lnHigh cbLineOffset''') return Header._make(struct.unpack('>I8i2h2iI', file_data[offset:offset+52])) - + def read_symbol(file_data, offset): if 'init' not in read_symbol.__dict__: read_symbol.cache = {} @@ -117,7 +117,7 @@ def read_symbol(file_data, offset): read_symbol.cache[offset] = read_symbol.header._make(( word0, word1, (word2 >> 26) & 0x3F, (word2 >> 21) & 0x1F, word2 & 0xFFFFF)) return read_symbol.cache[offset] - + def read_auxiliary_symbol(file_data, offset): if 'init' not in read_auxiliary_symbol.__dict__: read_auxiliary_symbol.cache = {} @@ -131,11 +131,11 @@ def read_auxiliary_symbol(file_data, offset): return read_auxiliary_symbol.cache[offset] word0 = struct.unpack('>I', file_data[offset:offset+4])[0] read_auxiliary_symbol.cache[offset] = read_auxiliary_symbol.header._make(( - read_auxiliary_symbol.type_info._make(((word0 >> 31) & 1, (word0 >> 30) & 1, (word0 >> 24) & 0x3F, (word0 >> 20) & 0xF, (word0 >> 16) & 0xF, (word0 >> 12) & 0xF, (word0 >> 8) & 0xF, (word0 >> 4) & 0xF, word0 & 0xF)), - read_auxiliary_symbol.rel_sym._make(((word0 >> 20) & 0xFFF, word0 & 0xFFFFF)), + read_auxiliary_symbol.type_info._make(((word0 >> 31) & 1, (word0 >> 30) & 1, (word0 >> 24) & 0x3F, (word0 >> 20) & 0xF, (word0 >> 16) & 0xF, (word0 >> 12) & 0xF, (word0 >> 8) & 0xF, (word0 >> 4) & 0xF, word0 & 0xF)), + read_auxiliary_symbol.rel_sym._make(((word0 >> 20) & 0xFFF, word0 & 0xFFFFF)), word0, word0, word0, word0, word0, word0)) return read_auxiliary_symbol.cache[offset] - + def read_string(file_data, offset): current_offset = 0 current_string = b'' @@ -146,7 +146,7 @@ def read_string(file_data, offset): else: current_string += char current_offset += 1 - + def get_symbol_name_from_aux(file_data, fd, symbolic_header, aux_num, search_for_typedef): aux = read_auxiliary_symbol(file_data, symbolic_header.cbAuxOffset - OFFSET + (fd.iauxBase + aux_num)*4) fd_num = aux.rndx.rfd @@ -168,7 +168,7 @@ def get_symbol_name_from_aux(file_data, fd, symbolic_header, aux_num, search_for else: ret = read_string(file_data, symbolic_header.cbSsOffset - OFFSET + fd2.issBase + sym.iss) return (ret, next_aux) - + def get_type_string(file_data, fd, symbolic_header, aux_num, name, search_for_typedef): ret = '' aux = read_auxiliary_symbol(file_data, symbolic_header.cbAuxOffset - OFFSET + (fd.iauxBase + aux_num)*4) @@ -191,9 +191,9 @@ def get_type_string(file_data, fd, symbolic_header, aux_num, name, search_for_ty (ret, next_aux) = get_symbol_name_from_aux(file_data, fd, symbolic_header, next_aux, search_for_typedef) else: ret = basic_type_c_list[aux.ti.bt] - + tq_list = (aux.ti.tq0, aux.ti.tq1, aux.ti.tq2, aux.ti.tq3, aux.ti.tq4, aux.ti.tq5) - + # TODO this is very naive and probably does not work in a large amount of cases last_was_proc = False # if we see a tqProc, assume the next will be a tqPtr for tq in tq_list: @@ -226,7 +226,7 @@ def get_type_string(file_data, fd, symbolic_header, aux_num, name, search_for_ty if has_bitfield: name += ' : %d' % bitwidth return ret + ' ' + name - + def get_enum_string(file_data, fd, symbolic_header, enum_sym_num): ret = '' start_sym = read_symbol(file_data, symbolic_header.cbSymOffset - OFFSET + enum_sym_num*12) @@ -282,7 +282,7 @@ def get_struct_or_union_string(file_data, fd, symbolic_header, union_sym_num, se elif sym.st == 9: # stMember name = read_string(file_data, symbolic_header.cbSsOffset - OFFSET + fd.issBase + sym.iss) ret += get_indent() - ret += '/* %d */ %s;\n' % (sym.value / 8, get_type_string(file_data, fd, symbolic_header, sym.index, name, True)) + ret += '/* %#X */ %s;\n' % (sym.value // 8, get_type_string(file_data, fd, symbolic_header, sym.index, name, True)) elif sym.st == 26 or sym.st == 27: #stStruct, stUnion sym_num = fd.isymBase + sym.index continue @@ -294,7 +294,7 @@ def get_struct_or_union_string(file_data, fd, symbolic_header, union_sym_num, se break sym_num += 1 return ret - + def print_typedef_symbols(file_data, fd, symbolic_header, typedef_sym_num): typedef_sym = read_symbol(file_data, symbolic_header.cbSymOffset - OFFSET + typedef_sym_num*12) if typedef_sym.st != 10: # stTypedef @@ -302,7 +302,7 @@ def print_typedef_symbols(file_data, fd, symbolic_header, typedef_sym_num): return name = read_string(file_data, symbolic_header.cbSsOffset - OFFSET + fd.issBase + typedef_sym.iss) print('typedef %s;' % get_type_string(file_data, fd, symbolic_header, typedef_sym.index, name, False)) - + def print_procedure(file_data, fd, symbolic_header, proc_sym_num): proc_sym = read_symbol(file_data, symbolic_header.cbSymOffset - OFFSET + proc_sym_num*12) proc_name = read_string(file_data, symbolic_header.cbSsOffset - OFFSET + fd.issBase + proc_sym.iss) @@ -318,7 +318,7 @@ def print_procedure(file_data, fd, symbolic_header, proc_sym_num): sym_num += 1 param_sym = read_symbol(file_data, symbolic_header.cbSymOffset - OFFSET + sym_num*12) first = False - + print(');') comment_old = set_is_comment(True) while sym_num < fd.isymBase + fd.csym: @@ -357,7 +357,7 @@ def print_procedure(file_data, fd, symbolic_header, proc_sym_num): print('ERROR unkown st in print_procedure: %d' % sym.st) set_is_comment(comment_old) return sym_num - + def print_symbols(file_data, fd, symbolic_header): sym_num = fd.isymBase while sym_num < fd.isymBase + fd.csym: @@ -401,7 +401,7 @@ def main(): global OFFSET if len(sys.argv) < 2: return # TODO print usage - + filename = sys.argv[1] try: @@ -410,7 +410,7 @@ def main(): except IOError: print('failed to read file ' + filename) return - + elf_header = read_elf_header(file_data, 0) section_headers = [] debug_index = 0xFFFFFFFF @@ -420,7 +420,7 @@ def main(): #print('%r' % (section_headers[i],)) if section_headers[i].sh_type == 0x70000005: debug_index = i - + if debug_index != 0xFFFFFFFF: symbolic_header = read_symbolic_header(file_data, section_headers[debug_index].sh_offset) file_descriptors = [] @@ -441,12 +441,12 @@ def main(): fd = read_file_descriptor(file_data, symbolic_header.cbFdOffset - OFFSET + file_num*72) print('%r' % (fd,)) print(' name:%s' % read_string(file_data, symbolic_header.cbSsOffset - OFFSET + fd.issBase + fd.rss)) - + print(' procedures:') for proc_num in range(fd.ipdFirst, fd.ipdFirst + fd.cpd): pd = read_procedure_descriptor(file_data, symbolic_header.cbPdOffset - OFFSET + proc_num*52) print(' %r' % ((pd,))) - + print(' symbols:') for sym_num in range(fd.isymBase, fd.isymBase + fd.csym): sym = read_symbol(file_data, symbolic_header.cbSymOffset - OFFSET + sym_num*12) @@ -477,9 +477,9 @@ def main(): type_aux = read_auxiliary_symbol(file_data, symbolic_header.cbAuxOffset - OFFSET + (fd.iauxBase + sym.index+1)*4) print(' %r' % ((aux,))) print(' %r' % ((type_aux,))) - + print(' pretty print:') print_symbols(file_data, fd, symbolic_header) - - + + main() \ No newline at end of file diff --git a/src/actors/ovl_Bg_Ikana_Ray_0x80BD53C0/ovl_Bg_Ikana_Ray_0x80BD53C0.c b/src/actors/ovl_Bg_Ikana_Ray_0x80BD53C0/ovl_Bg_Ikana_Ray_0x80BD53C0.c index 9d3a6d28cd..0529cc35f8 100644 --- a/src/actors/ovl_Bg_Ikana_Ray_0x80BD53C0/ovl_Bg_Ikana_Ray_0x80BD53C0.c +++ b/src/actors/ovl_Bg_Ikana_Ray_0x80BD53C0/ovl_Bg_Ikana_Ray_0x80BD53C0.c @@ -2,11 +2,11 @@ #include typedef struct z_ActorBgIkanaRay_s { - /* 000 */ z_Actor baseActor; - /* 324 */ UNK_TYPE unk324; - /* 328 */ u8 pad5[72]; - /* 400 */ UNK_TYPE unk400; - /* 404 */ void(*unk404)(struct z_ActorBgIkanaRay_s*, z_GlobalContext*); + /* 0x000 */ z_Actor baseActor; + /* 0x144 */ UNK_TYPE unk144; + /* 0x148 */ u8 pad5[0x48]; + /* 0x190 */ UNK_TYPE unk190; + /* 0x194 */ void(*unk404)(struct z_ActorBgIkanaRay_s*, z_GlobalContext*); } z_ActorBgIkanaRay; void z_bg_ikana_ray_init(z_ActorBgIkanaRay* this, z_GlobalContext* ctxt); @@ -85,16 +85,16 @@ glabel D_80BD562C ) void z_bg_ikana_ray_init(z_ActorBgIkanaRay* this, z_GlobalContext* ctxt) { - UNK_TYPE* sp36 = &this->unk324; + UNK_TYPE* sp24 = &this->unk144; u32 pad; func_800FFADC((z_Actor*)this, bgIkanaRayCompInit); - func_800E119C(ctxt, sp36); - func_800E130C(ctxt, sp36, (z_Actor*)this, &D_80BD55F0); - func_800E7DF8((z_Actor*)this, &this->unk324); - this->unk400 = func_80100504((UNK_TYPE)&D_06001228); // XXX: D_06001228 is probably a constant + func_800E119C(ctxt, sp24); + func_800E130C(ctxt, sp24, (z_Actor*)this, &D_80BD55F0); + func_800E7DF8((z_Actor*)this, &this->unk144); + this->unk190 = func_80100504((UNK_TYPE)&D_06001228); // XXX: D_06001228 is probably a constant - if (func_800B5BB0(ctxt, this->baseActor.unk28 & 0x7F) != 0) { + if (func_800B5BB0(ctxt, this->baseActor.unk1C & 0x7F) != 0) { func_80BD5500(this); } else { func_80BD5498(this); @@ -102,7 +102,7 @@ void z_bg_ikana_ray_init(z_ActorBgIkanaRay* this, z_GlobalContext* ctxt) { } void z_bg_ikana_ray_fini(z_ActorBgIkanaRay* this, z_GlobalContext* ctxt) { - UNK_TYPE* a1 = &this->unk324; + UNK_TYPE* a1 = &this->unk144; func_800E11EC(ctxt, a1); } @@ -113,7 +113,7 @@ void func_80BD5498(z_ActorBgIkanaRay* this) { } void func_80BD54BC(z_ActorBgIkanaRay* this, z_GlobalContext* ctxt) { - if (func_800B5BB0(ctxt, this->baseActor.unk28 & 0x7F) != 0) { + if (func_800B5BB0(ctxt, this->baseActor.unk1C & 0x7F) != 0) { func_80BD5500(this); } } @@ -125,7 +125,7 @@ void func_80BD5500(z_ActorBgIkanaRay* this) { } void func_80BD5530(z_ActorBgIkanaRay* this, z_GlobalContext* ctxt) { - func_800E2558(ctxt, &ctxt->unk100484, &this->unk324); + func_800E2558(ctxt, &ctxt->unk18884, &this->unk144); } void z_bg_ikana_ray_main(z_ActorBgIkanaRay* this, z_GlobalContext* ctxt) { @@ -133,6 +133,6 @@ void z_bg_ikana_ray_main(z_ActorBgIkanaRay* this, z_GlobalContext* ctxt) { } void z_bg_ikana_ray_draw(z_ActorBgIkanaRay* this, z_GlobalContext* ctxt) { - func_80131758(ctxt, this->unk400); + func_80131758(ctxt, this->unk190); func_800BE03C(ctxt, (UNK_TYPE)&D_06001100); // XXX: D_06001100 is probably a constant } diff --git a/src/boot/boot_0x80080180.c b/src/boot/boot_0x80080180.c index a6281955bf..175e6a8e7a 100644 --- a/src/boot/boot_0x80080180.c +++ b/src/boot/boot_0x80080180.c @@ -15,40 +15,40 @@ UNK_RET func_8008019C(void) { } UNK_RET func_800801EC(void) { - UNK_TYPE sp28; - UNK_PTR sp24 = (UNK_PTR)(0x80000000 + osMemSize); + UNK_TYPE sp1C; + UNK_PTR sp18 = (UNK_PTR)(0x80000000 + osMemSize); func_80080150((void*)0x80000400, &D_80000500); func_80080150(&D_80025D00, (int*)func_80080060); - func_80080150(&D_80208EA0, sp24); + func_80080150(&D_80208EA0, sp18); } UNK_RET func_80080250(void) { UNK_TYPE* v0; UNK_PTR v1; UNK_PTR t7; - UNK_TYPE sp88; - UNK_TYPE sp84; - UNK_TYPE sp80; - UNK_TYPE sp76; - UNK_TYPE sp72; - OSMesgQueue sp48; - OSMesg sp44; - UNK_TYPE sp40; + UNK_TYPE sp58; + UNK_TYPE sp54; + UNK_TYPE sp50; + UNK_TYPE sp4C; + UNK_TYPE sp48; + OSMesgQueue sp30; + OSMesg sp2C; + UNK_TYPE sp28; - osCreateMesgQueue(&sp48, &sp44, 1); + osCreateMesgQueue(&sp30, &sp2C, 1); v1 = &D_00B3C000; t7 = &D_00C7A4E0; v0 = &D_80096B50; - sp40 = *v0; + sp28 = *v0; *v0 = 0; - func_80080C04((s80080A08*)&sp72, (UNK_FUN_ARG)func_800A5AC0, v1, (u32)t7 - (u32)v1, 0, &sp48, 0); + func_80080C04((s80080A08*)&sp48, (UNK_FUN_ARG)func_800A5AC0, v1, (u32)t7 - (u32)v1, 0, &sp30, 0); func_8008019C(); func_800801EC(); - osRecvMesg(&sp48, 0, 1); + osRecvMesg(&sp30, 0, 1); - D_80096B50 = sp40; + D_80096B50 = sp28; func_80080150(&D_801E3FA0, &D_80208EA0); } diff --git a/src/boot/boot_0x80085320.c b/src/boot/boot_0x80085320.c index fe15167f45..191a67cb89 100644 --- a/src/boot/boot_0x80085320.c +++ b/src/boot/boot_0x80085320.c @@ -1,48 +1,48 @@ #include #include -void func_80085320(struct s80085320* a0, UNK_PTR a1, UNK_PTR a2, UNK_TYPE a3, UNK_TYPE sp16, UNK_PTR sp20) { +void func_80085320(s80085320* a0, UNK_PTR a1, UNK_PTR a2, UNK_TYPE a3, UNK_TYPE sp10, UNK_PTR sp14) { UNK_TYPE* i; - struct s80085320* v0; - + s80085320* v0; + if (a0 == NULL) { g_s80085320_ListHead = NULL; return; } - + a0->unk8 = a1; - a0->unk12 = a2; - a0->unk16 = a3; - a0->unk20 = sp16; - a0->unk24 = sp20; - + a0->unkC = a2; + a0->unk10 = a3; + a0->unk14 = sp10; + a0->unk18 = sp14; + v0 = g_s80085320_ListHead; while (v0 != NULL) { if (v0 == a0) return; v0 = v0->next; } - + a0->prev = g_s80085320_ListTail; a0->next = NULL; - + if (g_s80085320_ListTail != NULL) { g_s80085320_ListTail->next = a0; } - + g_s80085320_ListTail = a0; - + if (g_s80085320_ListHead == NULL) { g_s80085320_ListHead = a0; } - - if (a0->unk20 != -1) { - for (i = a0->unk8; i < a0->unk12; i++) { - *i = a0->unk16; + + if (a0->unk14 != -1) { + for (i = a0->unk8; i < a0->unkC; i++) { + *i = a0->unk10; } } } -UNK_RET func_800853F8(struct s80085320* a0) { +UNK_RET func_800853F8(s80085320* a0) { if (a0->prev == NULL) { if (g_s80085320_ListHead == a0) { g_s80085320_ListHead = a0->next; @@ -50,7 +50,7 @@ UNK_RET func_800853F8(struct s80085320* a0) { } else { a0->prev->next = a0->next; } - + if (a0->next == NULL) { if (g_s80085320_ListTail == a0) { g_s80085320_ListTail = a0->prev; @@ -58,32 +58,32 @@ UNK_RET func_800853F8(struct s80085320* a0) { } } -UNK_TYPE func_80085468(struct s80085320* a0) { +UNK_TYPE func_80085468(s80085320* a0) { UNK_TYPE* v1 = a0->unk8; - UNK_TYPE* a1 = a0->unk12; + UNK_TYPE* a1 = a0->unkC; UNK_TYPE* v0 = v1; u32 x; // ptr_diff - + while (v0 < a1) { - if (*v0++ != a0->unk16) break; + if (*v0++ != a0->unk10) break; a1 = (UNK_TYPE*)((u32)v0 - (u32)v1); } - + x = v0 - v1; - + if (x == 0) { return 2; } - - if ((x < a0->unk20) && (a0->unk20 != -1)) { + + if ((x < a0->unk14) && (a0->unk14 != -1)) { return 1; } - + return 0; } UNK_TYPE func_800854E0(UNK_ARGS) { - struct s80085320* s0 = g_s80085320_ListHead; + s80085320* s0 = g_s80085320_ListHead; UNK_TYPE ret = 0; while (s0 != NULL) { if (func_80085468(s0) != 0) { @@ -91,11 +91,11 @@ UNK_TYPE func_800854E0(UNK_ARGS) { } s0 = s0->next; } - + return ret; } -UNK_RET func_80085538(struct s80085320* a0) { +UNK_RET func_80085538(s80085320* a0) { if (a0 == NULL) { func_800854E0(); } else { diff --git a/src/boot_O1/boot_0x8008D350.c b/src/boot_O1/boot_0x8008D350.c index 348b8b3fbe..38f929551f 100644 --- a/src/boot_O1/boot_0x8008D350.c +++ b/src/boot_O1/boot_0x8008D350.c @@ -2,29 +2,29 @@ #include UNK_TYPE func_8008D350(void) { - u32* sp12; + u32* spC; u32 sp8; u32 sp4; u32 sp0; - + sp8 = 0x400000; - + do { - sp12 = (u32*)(sp8 + 0xA0000000); + spC = (u32*)(sp8 + 0xA0000000); sp4 = *(u32*)(0xA0000000 + sp8); sp0 = *(u32*)(0xA00FFFFC + sp8); *(u32*)(0xA0000000 + sp8) = *(u32*)(0xA0000000 + sp8) ^ 0xFFFFFFFF; - sp12[0x000FFFFC/4] = sp12[0x000FFFFC/4] ^ 0xFFFFFFFF; - - if ((sp12[0] != (sp4 ^ 0xFFFFFFFF)) || - (sp12[0x000FFFFC/4] != (sp0 ^ 0xFFFFFFFF))) { + spC[0x000FFFFC/4] = spC[0x000FFFFC/4] ^ 0xFFFFFFFF; + + if ((spC[0] != (sp4 ^ 0xFFFFFFFF)) || + (spC[0x000FFFFC/4] != (sp0 ^ 0xFFFFFFFF))) { return sp8; } - - *sp12 = sp4; - sp12[0x000FFFFC/4] = sp0; + + *spC = sp4; + spC[0x000FFFFC/4] = sp0; sp8 = sp8 + 0x100000; } while(sp8 < 0x800000); - + return sp8; } diff --git a/src/boot_O2_g3/boot_0x80080790.c b/src/boot_O2_g3/boot_0x80080790.c index b19dbac834..2458133ea2 100644 --- a/src/boot_O2_g3/boot_0x80080790.c +++ b/src/boot_O2_g3/boot_0x80080790.c @@ -3,40 +3,40 @@ s32 func_80080790(void* a0, void* a1, s32 a2) { u32 spPad; - OSIoMesg sp96; - OSMesgQueue sp72; - OSMesg sp68; + OSIoMesg sp60; + OSMesgQueue sp48; + OSMesg sp44; s32 ret; u32 s0 = D_80096B50; osInvalDCache(a1, a2); - osCreateMesgQueue(&sp72, &sp68, 1); + osCreateMesgQueue(&sp48, &sp44, 1); if (s0 != 0) { while (s0 < a2) { - sp96.hdr.pri = 0; - sp96.hdr.retQueue = &sp72; - sp96.devAddr = (u32)a0; - sp96.dramAddr = a1; - sp96.size = s0; - ret = osEPiStartDma(D_80096B40, &sp96, 0); + sp60.hdr.pri = 0; + sp60.hdr.retQueue = &sp48; + sp60.devAddr = (u32)a0; + sp60.dramAddr = a1; + sp60.size = s0; + ret = osEPiStartDma(D_80096B40, &sp60, 0); if (ret) goto END; - osRecvMesg(&sp72, NULL, 1); + osRecvMesg(&sp48, NULL, 1); a2 -= s0; a0 = (u8*)a0 + s0; a1 = (u8*)a1 + s0; } } - sp96.hdr.pri = 0; - sp96.hdr.retQueue = &sp72; - sp96.devAddr = (u32)a0; - sp96.dramAddr = a1; - sp96.size = (u32)a2; - ret = osEPiStartDma(D_80096B40, &sp96, 0); + sp60.hdr.pri = 0; + sp60.hdr.retQueue = &sp48; + sp60.devAddr = (u32)a0; + sp60.dramAddr = a1; + sp60.size = (u32)a2; + ret = osEPiStartDma(D_80096B40, &sp60, 0); if (ret) goto END; - osRecvMesg(&sp72, NULL, 1); + osRecvMesg(&sp48, NULL, 1); osInvalDCache(a1, a2); @@ -83,7 +83,6 @@ s32 func_800809BC(u32 a0) { DmadataEntry* v0 = func_800808F4(a0); if (v0 != NULL) { - // TODO this uses t7 to shift instead of reusing v0 return v0 - dmadata; } @@ -97,44 +96,44 @@ UNK_TYPE* func_800809F4(u32 a0) { #ifdef NONMATCHING void func_80080A08(s80080A08* a0) { - UNK_TYPE sp52; - UNK_TYPE sp48; - UNK_TYPE sp44; - UNK_TYPE sp40; - UNK_TYPE sp36; - UNK_TYPE sp32; - s32 sp28; + UNK_TYPE sp34; + UNK_TYPE sp30; + UNK_TYPE sp2C; + UNK_TYPE sp28; UNK_TYPE sp24; + UNK_TYPE sp20; + s32 sp1C; + UNK_TYPE sp18; - sp52 = (UNK_TYPE)a0->unk0; - sp48 = (UNK_TYPE)a0->unk4; - sp44 = a0->unk8; + sp34 = (UNK_TYPE)a0->unk0; + sp30 = (UNK_TYPE)a0->unk4; + sp2C = a0->unk8; - sp28 = func_800809BC(sp52); + sp1C = func_800809BC(sp34); - if ((sp28 >= 0) && (sp28 < D_8009B2BC)) { - if (dmadata[sp28].romEnd == 0) { - if (dmadata[sp28].vromEnd < (sp44 + sp52)) { + if ((sp1C >= 0) && (sp1C < D_8009B2BC)) { + if (dmadata[sp1C].romEnd == 0) { + if (dmadata[sp1C].vromEnd < (sp2C + sp34)) { func_80083E4C(&D_800981C4, 499); } - func_80080790((u8*)((dmadata[sp28].romStart + sp52) - dmadata[sp28].vromStart), (u8*)sp48, sp44); + func_80080790((u8*)((dmadata[sp1C].romStart + sp34) - dmadata[sp1C].vromStart), (u8*)sp30, sp2C); return; } // TODO this part is arranged slightly different is ASM - sp36 = dmadata[sp28].romEnd - dmadata[sp28].romStart; - sp40 = dmadata[sp28].romStart; + sp24 = dmadata[sp1C].romEnd - dmadata[sp1C].romStart; + sp28 = dmadata[sp1C].romStart; - if (sp52 != dmadata[sp28].vromStart) { + if (sp34 != dmadata[sp1C].vromStart) { func_80083E4C(&D_800981D4, 518); } - if (sp44 != (dmadata[sp28].vromEnd - dmadata[sp28].vromStart)) { + if (sp2C != (dmadata[sp1C].vromEnd - dmadata[sp1C].vromStart)) { func_80083E4C(&D_800981E4, 525); } osSetThreadPri(NULL, 10); - func_80081178(sp40, sp48, sp36); + func_80081178(sp28, sp30, sp24); osSetThreadPri(NULL, 17); } else { func_80083E4C(&D_800981F4, 558); @@ -253,18 +252,18 @@ glabel func_80080A08 #ifdef NONMATCHING void func_80080B84(void* a0) { - s80080A08* sp52; + s80080A08* sp34; UNK_TYPE pad; s80080A08* s0; for (;;) { - osRecvMesg(&D_8009B2C0, (OSMesg)&sp52, 1); - if (sp52 == NULL) return; - s0 = sp52; + osRecvMesg(&D_8009B2C0, (OSMesg)&sp34, 1); + if (sp34 == NULL) return; + s0 = sp34; func_80080A08(s0); // TODO a0 isn't being used for this comparison - if (s0->unk24 == NULL) continue; - osSendMesg(&D_8009B2C0, (OSMesg)s0->unk28, 0); + if (s0->unk18 == NULL) continue; + osSendMesg(&D_8009B2C0, (OSMesg)s0->unk1C, 0); } } @@ -312,7 +311,7 @@ glabel func_80080B84 #ifdef NONMATCHING -s32 func_80080C04(s80080A08* a0, UNK_FUN_PTR(a1), UNK_PTR a2, UNK_TYPE a3, UNK_TYPE sp48, OSMesgQueue* sp52, UNK_TYPE sp56) { +s32 func_80080C04(s80080A08* a0, UNK_FUN_PTR(a1), UNK_PTR a2, UNK_TYPE a3, UNK_TYPE sp30, OSMesgQueue* sp34, UNK_TYPE sp38) { // TODO this isn't correct, it uses a lui, addiu to get the address of D_80096B60, then loads it, // meaning that this is likely just "if (*D_80096B60 >= 2)". However, I can not get it to not // produce the usual lui, lw combo to load from an address :/ @@ -323,9 +322,9 @@ s32 func_80080C04(s80080A08* a0, UNK_FUN_PTR(a1), UNK_PTR a2, UNK_TYPE a3, UNK_T a0->unk0 = a2; a0->unk4 = a1; a0->unk8 = a3; - a0->unk20 = 0; - a0->unk24 = sp52; - a0->unk28 = sp56; + a0->unk14 = 0; + a0->unk18 = sp34; + a0->unk1C = sp38; osSendMesg(&D_8009B2C0, (OSMesg)a0, 1); @@ -378,19 +377,19 @@ glabel func_80080C04 #endif s32 func_80080C90(UNK_TYPE a0, UNK_PTR a1, UNK_TYPE a2) { - s80080A08 sp72; - OSMesgQueue sp48; - OSMesg sp44; + s80080A08 sp48; + OSMesgQueue sp30; + OSMesg sp2C; s32 ret; - osCreateMesgQueue(&sp48, &sp44, 1); + osCreateMesgQueue(&sp30, &sp2C, 1); - ret = func_80080C04(&sp72, (UNK_FUN_ARG)a0, a1, a2, 0, &sp48, 0); + ret = func_80080C04(&sp48, (UNK_FUN_ARG)a0, a1, a2, 0, &sp30, 0); if (ret == -1) { return ret; } else { - osRecvMesg(&sp48, NULL, 1); + osRecvMesg(&sp30, NULL, 1); } return 0; diff --git a/src/code/code_0x800A5AC0.c b/src/code/code_0x800A5AC0.c index 88216c55c3..ce9a6abebd 100644 --- a/src/code/code_0x800A5AC0.c +++ b/src/code/code_0x800A5AC0.c @@ -4,48 +4,48 @@ // TODO this file looks like an actor, it should be cleaned up as such UNK_RET func_800A5AC0(void* a0, UNK_TYPE a1) { - struct s800A5AC0* s0 = (struct s800A5AC0*)a0; - s0->unk278 = ((s0->unk28 >> 8) & 0xFF) | 0x300; - s0->unk28 = (s0->unk28 & 0xFF) - 9; + s800A5AC0* s0 = (s800A5AC0*)a0; + s0->unk116 = ((s0->unk1C >> 8) & 0xFF) | 0x300; + s0->unk1C = (s0->unk1C & 0xFF) - 9; func_800FFADC((z_Actor*)s0, (z_ActorCompInitEntry*)&D_801ADEAC); - func_800B3BA4(&s0->unk188, 0, (void*)&func_800B3FC0, 0x41400000); - func_800E1374(a1, &s0->unk328, (z_Actor*)s0, &D_801ADE80); - func_800E7DF8((z_Actor*)s0, &s0->unk328); - s0->unk182 = 255; - s0->unk324 = func_800A5B98; + func_800B3BA4(&s0->unkBC, 0, (void*)&func_800B3FC0, 0x41400000); + func_800E1374(a1, &s0->unk148, (z_Actor*)s0, &D_801ADE80); + func_800E7DF8((z_Actor*)s0, &s0->unk148); + s0->unkB6 = 255; + s0->unk144 = func_800A5B98; } -UNK_RET func_800A5B6C(struct s800A5AC0* a0, z_GlobalContext* a1) { - UNK_TYPE* a2 = &a0->unk328; +UNK_RET func_800A5B6C(s800A5AC0* a0, z_GlobalContext* a1) { + UNK_TYPE* a2 = &a0->unk148; func_800E11EC(a1, a2); } -UNK_RET func_800A5B98(struct s800A5AC0* a0, UNK_TYPE a1) { +UNK_RET func_800A5B98(s800A5AC0* a0, UNK_TYPE a1) { s16 v0; s32 v1; if (func_800B84D0(a0, a1) != 0) { - a0->unk324 = (void(*)(struct s800A5AC0*, UNK_TYPE))func_800A5C28; //! Is this cast correct? + a0->unk144 = (void(*)(s800A5AC0*, UNK_TYPE))func_800A5C28; //! Is this cast correct? } else { - v0 = a0->unk146 - a0->unk190; + v0 = a0->unk92 - a0->unkBE; v1 = (v0 < 0)? -v0 : v0; - if ((v1 < 10240) || ((a0->unk28 == 1) && (v1 > 22528))) { + if ((v1 < 10240) || ((a0->unk1C == 1) && (v1 > 22528))) { func_800B863C(a0, a1); } } } -UNK_RET func_800A5C28(struct s800A5AC0* a0) { +UNK_RET func_800A5C28(s800A5AC0* a0) { if (func_800B867C(a0) != 0) { - a0->unk324 = func_800A5B98; + a0->unk144 = func_800A5B98; } } -UNK_RET func_800A5C60(struct s800A5AC0* a0, UNK_TYPE a1) { - (a0->unk324)(a0, a1); +UNK_RET func_800A5C60(s800A5AC0* a0, UNK_TYPE a1) { + (a0->unk144)(a0, a1); func_800B675C(a0, 0x42340000); - func_800E2928(a1, a1 + 0x18884, &a0->unk328); + func_800E2928(a1, a1 + 0x18884, &a0->unk148); } -UNK_RET func_800A5CB8(struct s800A5AC0* a0, UNK_TYPE a1) { - func_800BDFC0(a1, D_801ADEB0[a0->unk28], a1, a0); +UNK_RET func_800A5CB8(s800A5AC0* a0, UNK_TYPE a1) { + func_800BDFC0(a1, D_801ADEB0[a0->unk1C], a1, a0); } diff --git a/src/code/code_0x800BF9A0.c b/src/code/code_0x800BF9A0.c index 1b22f04a4b..4617d11b63 100644 --- a/src/code/code_0x800BF9A0.c +++ b/src/code/code_0x800BF9A0.c @@ -3,7 +3,7 @@ UNK_RET func_800BF9A0(UNK_TYPE a0, UNK_TYPE a1) { s32 i; - s800BF9A0_s* s0; + s800BF9A0* s0; UNK_TYPE v1; func_8008439C(-2, 0); @@ -11,27 +11,27 @@ UNK_RET func_800BF9A0(UNK_TYPE a0, UNK_TYPE a1) { func_800847CC(&D_801DCBC4); for (i = 0, s0 = &D_801AEFD0; i < D_801B4610; i++, s0++) { - v1 = s0->unk12 - s0->unk8; - if (s0->unk16 == 0) continue; - func_800847CC(&D_801DCBE4, i, s0->unk16, s0->unk16 + v1, s0->unk30, &D_801DCBFC); + v1 = s0->unkC - s0->unk8; + if (s0->unk10 == 0) continue; + func_800847CC(&D_801DCBE4, i, s0->unk10, s0->unk10 + v1, s0->unk1E, &D_801DCBFC); } } UNK_TYPE func_800BFA78(UNK_TYPE a0, UNK_TYPE a1) { s32 i; - s800BF9A0_s* v0 = &D_801AEFD0; + s800BF9A0* v0 = &D_801AEFD0; UNK_TYPE t1; UNK_TYPE a2; UNK_TYPE a0_2 = a0; for (i = 0; i < D_801B4610; i++, v0++) { - t1 = v0->unk8 - v0->unk16; - a2 = v0->unk12 - v0->unk8; + t1 = v0->unk8 - v0->unk10; + a2 = v0->unkC - v0->unk8; - if (v0->unk16 == 0) continue; - if (a0_2 < v0->unk16) continue; + if (v0->unk10 == 0) continue; + if (a0_2 < v0->unk10) continue; - if (a0_2 < (v0->unk16 + a2)) { + if (a0_2 < (v0->unk10 + a2)) { return a0_2 + t1; } } diff --git a/src/code/code_0x800CAAD0.c b/src/code/code_0x800CAAD0.c index e5fc11c216..748b162abc 100644 --- a/src/code/code_0x800CAAD0.c +++ b/src/code/code_0x800CAAD0.c @@ -2,98 +2,98 @@ #include UNK_RET func_800CAAD0(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { - UNK_TYPE sp208; - UNK_TYPE sp144; - UNK_TYPE sp80; - UNK_TYPE sp68; - UNK_TYPE sp56; - UNK_TYPE sp36; - + UNK_TYPE spD0; + UNK_TYPE sp90; + UNK_TYPE sp50; + UNK_TYPE sp44; + UNK_TYPE sp38; + UNK_TYPE sp24; + s800CAAD0* v1; - + if (func_800C6024(a1) == 0) return; - + v1 = (s800CAAD0*)(a0 + a1 * 100); - - func_80139894(&sp208, v1->unk104, v1->unk108, v1->unk112, v1->unk116, v1->unk118, - v1->unk120, v1->unk124, v1->unk128, v1->unk132); - - if (func_80139188(&sp208, &sp144) == 2) return; - - func_80139894(&sp80, v1->unk136, v1->unk140, v1->unk144, v1->unk148, v1->unk150, - v1->unk152, v1->unk156, v1->unk160, v1->unk164); - - func_80138C88(&sp144, (UNK_PTR)(a2 + 36), &sp36); - func_80138C88(&sp80, &sp56, &sp68); - - v1->unk0 = *(UNK_TYPE*)((u8*)sp36 + 0); - v1->unk4 = *(UNK_TYPE*)((u8*)sp36 + 4); - v1->unk8 = *(UNK_TYPE*)((u8*)sp36 + 8); + + func_80139894(&spD0, v1->unk68, v1->unk6C, v1->unk70, v1->unk72, v1->unk74, + v1->unk76, v1->unk7C, v1->unk80, v1->unk84); + + if (func_80139188(&spD0, &sp90) == 2) return; + + func_80139894(&sp50, v1->unk88, v1->unk8C, v1->unk90, v1->unk94, v1->unk96, + v1->unk98, v1->unk9C, v1->unkA0, v1->unkA4); + + func_80138C88(&sp90, (UNK_PTR)(a2 + 36), &sp24); + func_80138C88(&sp50, &sp38, &sp44); + + v1->unk0 = *(UNK_TYPE*)((u8*)sp24 + 0); + v1->unk4 = *(UNK_TYPE*)((u8*)sp24 + 4); + v1->unk8 = *(UNK_TYPE*)((u8*)sp24 + 8); } UNK_RET func_800CAC0C(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { UNK_TYPE v0; s16 v1; - + if (func_800C6024(a0) == 0) return; - + v0 = a0 + a1 * 100; - + v1 = *(s16*)(v0 + 150) - *(s16*)(v0 + 118); - + if (*(s16*)a2 == 0) { *(s16*)(a2 + 2772) += v1; } - + *(s16*)(a2 + 190) += v1; *(s16*)(a2 + 50) += v1; } UNK_RET func_800CACA0(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { - UNK_TYPE sp28; - + UNK_TYPE sp1C; + if (func_800C6024(a2) == 0) return; - - sp28 = func_800C6248(a0, a2); - - if (sp28 == 0) return; - - func_800CAE88(sp28); - + + sp1C = func_800C6248(a0, a2); + + if (sp1C == 0) return; + + func_800CAE88(sp1C); + if ((*(u32*)(a1 + 4) & 0x04000000) == 0x0400) { - func_800CAF24(sp28); + func_800CAF24(sp1C); } - + if ((*(u32*)(a1 + 4) & 0x20000) == 0x20000) { - func_800CAF38(sp28); + func_800CAF38(sp1C); } } UNK_TYPE func_800CAD2C(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { UNK_TYPE v1; - UNK_TYPE sp36 = 0; - + UNK_TYPE sp24 = 0; + if (func_800C6024(a1) == 0) return; - - if (((*(u16*)(a0 + a1*2 + 5084) & 0x2) != 0) || + + if (((*(u16*)(a0 + a1*2 + 5084) & 0x2) != 0) || ((*(u16*)(a0 + a1*2 + 5084) & 0x1) == 0)) { return 0; } - + v1 = func_800C6248(a0, a1); if (v1 == 0) { return 0; } - + if ((*(u32*)(v1 + 340) & 0x1) != 0) { func_800CAAD0(a0, a1, a2); - sp36 = 1; + sp24 = 1; } - + if ((*(u32*)(v1 + 340) & 0x2) != 0) { func_800CAC0C(a0, a1, a2); - sp36 = 1; + sp24 = 1; } - - return sp36; + + return sp24; } diff --git a/src/code/code_0x800F4F40.c.ignore b/src/code/code_0x800F4F40.c.ignore index 65830b4df4..c28a46b289 100644 --- a/src/code/code_0x800F4F40.c.ignore +++ b/src/code/code_0x800F4F40.c.ignore @@ -6,7 +6,7 @@ void func_800F4F40(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { } void func_800F4F54(s800F4F54* a0, u8 a1, UNK_TYPE a2) { - u32 arg0 = (u32)a0 + a0->unk92152 * (15 * 1024) + a2 + 19056; + u32 arg0 = (u32)a0 + a0->unk167F8 * (15 * 1024) + a2 + 19056; u32 arg1 = ((a1 * 128) - 4096) + (u32)&D_00ACC000; func_80080C90(arg0, arg1, 128); } diff --git a/src/libultra/io/controller.h b/src/libultra/io/controller.h index 0980c1ff4a..b76c4cbf78 100644 --- a/src/libultra/io/controller.h +++ b/src/libultra/io/controller.h @@ -2,59 +2,59 @@ #define _CONTROLLER_H_ typedef struct { - /* 0 */ u32 ramarray[15]; - /* 60 */ u32 pifstatus; + /* 0x00 */ u32 ramarray[15]; + /* 0x3C */ u32 pifstatus; } OSPifRam; typedef struct { - /* 0 */ u8 dummy; - /* 1 */ u8 txsize; - /* 2 */ u8 rxsize; - /* 3 */ u8 cmd; - /* 4 */ u16 button; - /* 6 */ s8 stick_x; - /* 7 */ s8 stick_y; + /* 0x0 */ u8 dummy; + /* 0x1 */ u8 txsize; + /* 0x2 */ u8 rxsize; + /* 0x3 */ u8 cmd; + /* 0x4 */ u16 button; + /* 0x6 */ s8 stick_x; + /* 0x7 */ s8 stick_y; } __OSContReadFormat; typedef struct { - /* 0 */ u8 dummy; - /* 1 */ u8 txsize; - /* 2 */ u8 rxsize; - /* 3 */ u8 cmd; - /* 4 */ u8 typeh; - /* 5 */ u8 typel; - /* 6 */ u8 status; - /* 7 */ u8 dummy1; + /* 0x0 */ u8 dummy; + /* 0x1 */ u8 txsize; + /* 0x2 */ u8 rxsize; + /* 0x3 */ u8 cmd; + /* 0x4 */ u8 typeh; + /* 0x5 */ u8 typel; + /* 0x6 */ u8 status; + /* 0x7 */ u8 dummy1; } __OSContRequesFormat; typedef struct { - /* 0 */ u8 dummy; - /* 1 */ u8 txsize; - /* 2 */ u8 rxsize; - /* 3 */ u8 cmd; - /* 4 */ u16 address; - /* 6 */ u8 data[32]; - /* 38 */ u8 datacrc; + /* 0x00 */ u8 dummy; + /* 0x01 */ u8 txsize; + /* 0x02 */ u8 rxsize; + /* 0x03 */ u8 cmd; + /* 0x04 */ u16 address; + /* 0x06 */ u8 data[32]; + /* 0x26 */ u8 datacrc; } __OSContRamReadFormat; typedef struct { - /* 0 */ u16 company_code; - /* 2 */ u16 game_code; - /* 4 */ u8 start_page; - /* 5 */ u8 status; - /* 6 */ u16 data_sum; - /* 8 */ unsigned char ext_name[4]; - /* 12 */ unsigned char game_name[16]; - /* 28 */ s32 reserved; + /* 0x00 */ u16 company_code; + /* 0x02 */ u16 game_code; + /* 0x04 */ u8 start_page; + /* 0x05 */ u8 status; + /* 0x06 */ u16 data_sum; + /* 0x08 */ unsigned char ext_name[4]; + /* 0x0C */ unsigned char game_name[16]; + /* 0x1C */ s32 reserved; } __OSDir; typedef struct { - /* 0 */ u8 inode_page[256]; + /* 0x0 */ u8 inode_page[256]; } __OSInode; #endif diff --git a/src/libultra/os/initialize.c b/src/libultra/os/initialize.c index eaa1d4a449..88ae0dd3ca 100644 --- a/src/libultra/os/initialize.c +++ b/src/libultra/os/initialize.c @@ -30,10 +30,10 @@ void osInitialize(void) { while (__osSiRawReadIo(0x1FC007FC, &pifdata) != 0); while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8) != 0); - *(struct s8008A6FC*)0x80000000 = *((struct s8008A6FC*)__osExceptionPreamble); - *(struct s8008A6FC*)0x80000080 = *((struct s8008A6FC*)__osExceptionPreamble); - *(struct s8008A6FC*)0x80000100 = *((struct s8008A6FC*)__osExceptionPreamble); - *(struct s8008A6FC*)0x80000180 = *((struct s8008A6FC*)__osExceptionPreamble); + *(s8008A6FC*)0x80000000 = *((s8008A6FC*)__osExceptionPreamble); + *(s8008A6FC*)0x80000080 = *((s8008A6FC*)__osExceptionPreamble); + *(s8008A6FC*)0x80000100 = *((s8008A6FC*)__osExceptionPreamble); + *(s8008A6FC*)0x80000180 = *((s8008A6FC*)__osExceptionPreamble); osWritebackDCache((void*)0x80000000, 400); osInvalICache((void*)0x80000000, 400); diff --git a/variables.py b/variables.py index 96fc9bdf7b..08558938eb 100644 --- a/variables.py +++ b/variables.py @@ -24,8 +24,8 @@ known_vars = { 0x80096B40:("","OSPiHandle*",False), 0x80096B50:("","UNK_TYPE",False), 0x80096B60:("","UNK_TYPE*",False), - 0x80096C40:("g_s80085320_ListHead","struct s80085320*",False), # TODO rename? - 0x80096C44:("g_s80085320_ListTail","struct s80085320*",False), # TODO rename? + 0x80096C40:("g_s80085320_ListHead","s80085320*",False), # TODO rename? + 0x80096C44:("g_s80085320_ListTail","s80085320*",False), # TODO rename? 0x80097590:("","UNK_TYPE",False), 0x80097E10:("__osThreadTail","OSThread*",False), 0x80097E18:("__osRunQueue","OSThread*",False), @@ -71,22 +71,22 @@ known_vars = { 0x80099290:("leoDiskStack","UNK_TYPE",False), 0x800994D0:("","UNK_TYPE",False), 0x800994DC:("","UNK_TYPE",False), - 0x80099500:("","struct s80085320",False), + 0x80099500:("","s80085320",False), 0x80099520:("","OSThread",False), 0x800996D0:("","UNK_TYPE",False), - 0x80099AD0:("","struct s80085320",False), + 0x80099AD0:("","s80085320",False), 0x80099AF0:("","UNK_TYPE",False), 0x80099EF0:("","UNK_TYPE",False), 0x8009A170:("","UNK_TYPE",False), - 0x8009A670:("","struct s80085320",False), + 0x8009A670:("","s80085320",False), 0x8009A690:("","UNK_TYPE",False), 0x8009A840:("","UNK_TYPE",False), - 0x8009B140:("","struct s80085320",False), + 0x8009B140:("","s80085320",False), 0x8009B160:("","UNK_TYPE",False), 0x8009B228:("","UNK_TYPE",False), 0x8009B240:("","u32*",False), 0x8009B290:("","u8",False), - 0x8009B2A0:("","struct s80085320",False), + 0x8009B2A0:("","s80085320",False), 0x8009B2BC:("","u16",False), # Count of entries in dmadata 0x8009B2C0:("","OSMesgQueue",False), 0x8009B2D8:("","UNK_TYPE",False), @@ -126,7 +126,7 @@ known_vars = { 0x801ADE80:("","UNK_TYPE",False), 0x801ADEAC:("","UNK_TYPE",False), 0x801ADEB0:("D_801ADEB0","int",True), # TODO better array representation - 0x801AEFD0:("","s800BF9A0_s",False), + 0x801AEFD0:("","s800BF9A0",False), 0x801B4610:("","UNK_TYPE",False), 0x801B9F20:("","s800E03A0",False), # actually an array of size 23? 0x801BDB30:("","u8",True),