diff --git a/functions.py b/functions.py index b7862893cc..446b2fe719 100644 --- a/functions.py +++ b/functions.py @@ -247,11 +247,15 @@ known_funcs = { 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"), + 0x800C6188:("func_800C6188","UNK_TYPE","z_GlobalContext*, UNK_PTR, z_Actor*, UNK_TYPE"), 0x800C6248:("func_800C6248","UNK_TYPE","UNK_TYPE, UNK_TYPE"), + 0x800C64CC:("func_800C64CC","UNK_RET","z_GlobalContext*, UNK_PTR, UNK_TYPE"), + 0x800C9564:("func_800C9564","UNK_RET","UNK_TYPE, UNK_PTR"), 0x800CAAD0:("func_800CAAD0","UNK_RET","UNK_TYPE, UNK_TYPE, UNK_TYPE"), 0x800CAC0C:("func_800CAC0C","UNK_RET","UNK_TYPE, UNK_TYPE, UNK_TYPE"), 0x800CACA0:("func_800CACA0","UNK_RET","UNK_TYPE, UNK_TYPE, UNK_TYPE"), 0x800CAD2C:("func_800CAD2C","UNK_TYPE","UNK_TYPE, UNK_TYPE, UNK_TYPE"), + 0x800CAE10:("func_800CAE10","UNK_RET","z_Actor*, UNK_TYPE"), 0x800CAE88:("func_800CAE88","UNK_RET","UNK_TYPE"), 0x800CAF24:("func_800CAF24","UNK_RET","UNK_TYPE"), 0x800CAF38:("func_800CAF38","UNK_RET","UNK_TYPE"), @@ -301,6 +305,7 @@ known_funcs = { 0x80183070:("func_80183070","void","void"), 0x8018349C:("func_8018349C","UNK_RET","UNK_TYPE, UNK_TYPE"), 0x8019F0C8:("func_8019F0C8","UNK_RET","UNK_TYPE"), + 0x8019FAD8:("func_8019FAD8","UNK_RET","UNK_PTR, UNK_TYPE, f32"), # ovl_En_Test #0x80862B70:("func_80862B70","void","void* a0"), diff --git a/include/functions.h b/include/functions.h index abcc2342b4..ecabcbd4ad 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1016,13 +1016,13 @@ void func_800BE03C(z_GlobalContext*, UNK_TYPE); // func_800BE03C UNK_TYPE func_800C6024(UNK_TYPE); // func_800C6024 // UNK_RET func_800C6044(UNK_ARGS); // UNK_RET func_800C6098(UNK_ARGS); -// UNK_RET func_800C6188(UNK_ARGS); +UNK_TYPE func_800C6188(z_GlobalContext*, UNK_PTR, z_Actor*, UNK_TYPE); UNK_TYPE func_800C6248(UNK_TYPE, UNK_TYPE); // func_800C6248 // UNK_RET func_800C62BC(UNK_ARGS); // UNK_RET func_800C6314(UNK_ARGS); // UNK_RET func_800C636C(UNK_ARGS); // UNK_RET func_800C641C(UNK_ARGS); -// UNK_RET func_800C64CC(UNK_ARGS); +UNK_RET func_800C64CC(z_GlobalContext*, UNK_PTR, UNK_TYPE); // UNK_RET func_800C6554(UNK_ARGS); // UNK_RET func_800C656C(UNK_ARGS); // UNK_RET func_800C6838(UNK_ARGS); @@ -1042,7 +1042,7 @@ UNK_TYPE func_800C6248(UNK_TYPE, UNK_TYPE); // func_800C6248 // UNK_RET func_800C921C(UNK_ARGS); // UNK_RET func_800C9380(UNK_ARGS); // UNK_RET func_800C94E0(UNK_ARGS); -// UNK_RET func_800C9564(UNK_ARGS); +UNK_RET func_800C9564(UNK_TYPE, UNK_PTR); // UNK_RET func_800C9640(UNK_ARGS); // UNK_RET func_800C9694(UNK_ARGS); // UNK_RET func_800C9704(UNK_ARGS); @@ -1080,7 +1080,7 @@ UNK_RET func_800CAAD0(UNK_TYPE, UNK_TYPE, UNK_TYPE); // func_800CAAD0 UNK_RET func_800CAC0C(UNK_TYPE, UNK_TYPE, UNK_TYPE); // func_800CAC0C UNK_RET func_800CACA0(UNK_TYPE, UNK_TYPE, UNK_TYPE); // func_800CACA0 UNK_TYPE func_800CAD2C(UNK_TYPE, UNK_TYPE, UNK_TYPE); // func_800CAD2C -// UNK_RET func_800CAE10(UNK_ARGS); +UNK_RET func_800CAE10(z_Actor*, UNK_TYPE); // UNK_RET func_800CAE34(UNK_ARGS); // UNK_RET func_800CAE7C(UNK_ARGS); UNK_RET func_800CAE88(UNK_TYPE); // func_800CAE88 @@ -4219,7 +4219,7 @@ UNK_RET func_8019F0C8(UNK_TYPE); // func_8019F0C8 // UNK_RET func_8019F88C(UNK_ARGS); // UNK_RET func_8019F900(UNK_ARGS); // UNK_RET func_8019FA18(UNK_ARGS); -// UNK_RET func_8019FAD8(UNK_ARGS); +UNK_RET func_8019FAD8(UNK_PTR, UNK_TYPE, f32); // UNK_RET func_8019FB0C(UNK_ARGS); // UNK_RET func_8019FC20(UNK_ARGS); // UNK_RET func_8019FCB8(UNK_ARGS); diff --git a/include/structs.h b/include/structs.h index 1443aca3e6..6e2d1383bc 100644 --- a/include/structs.h +++ b/include/structs.h @@ -118,26 +118,31 @@ typedef void(*z_ActorFunc)(struct z_Actor*, void*); typedef struct { /* 0x000 */ u8 pad0[4]; /* 0x004 */ UNK_TYPE unk4; - /* 0x008 */ u8 pad1[0x14]; + /* 0x008 */ z_Vector3D unk8; // Pos1? + /* 0x014 */ u8 pad1[0x8]; /* 0x01C */ s16 unk1C; - /* 0x01E */ u8 pad2[0x3A]; + /* 0x01E */ u8 pad2[0x6]; + /* 0x024 */ z_Vector3D unk24; // Pos2? + /* 0x030 */ u8 pad3[0x28]; /* 0x058 */ z_Vector3D unk58; // scale? - /* 0x064 */ u8 pad3[0x2E]; + /* 0x064 */ u8 pad4[0x2E]; /* 0x092 */ s16 unk92; - /* 0x094 */ u8 pad4[0x22]; + /* 0x094 */ u8 pad5[0x22]; /* 0x0B6 */ u8 unkB6; - /* 0x0B7 */ u8 pad5[5]; + /* 0x0B7 */ u8 pad6[5]; /* 0x0BC */ u16 unkBC; // or char /* 0x0BE */ s16 unkBE; - /* 0x0C0 */ u8 pad6[0x3C]; + /* 0x0C0 */ u8 pad7[0x2C]; + /* 0x0EC */ UNK_TYPE unkEC; + /* 0x0F0 */ u8 pad8[0xC]; /* 0x0FC */ f32 unkFC; // start of z_Vector3D? /* 0x100 */ f32 unk100; /* 0x104 */ f32 unk104; - /* 0x108 */ u8 pad7[0xE]; + /* 0x108 */ u8 pad9[0xE]; /* 0x116 */ u16 unk116; - /* 0x118 */ u8 pad8[0x24]; + /* 0x118 */ u8 pad10[0x24]; /* 0x13C */ z_ActorFunc drawFunc; - /* 0x140 */ u8 pad9[4]; + /* 0x140 */ u8 pad11[4]; // TODO figure out what size this is } z_Actor; @@ -158,17 +163,19 @@ typedef struct { typedef struct { /* 0x00000 */ z_GraphicsContext* unk0; - /* 0x00004 */ u8 pad0[0x1C9C]; + /* 0x00004 */ u8 pad0[0x87C]; + /* 0x00880 */ UNK_TYPE unk880; + /* 0x00884 */ u8 pad1[0x141C]; /* 0x01CA0 */ UNK_TYPE unk1CA0; - /* 0x01CA4 */ u8 pad1[0x28]; + /* 0x01CA4 */ u8 pad2[0x28]; /* 0x01CCC */ sGlobalContext1CCC* unk1CCC; - /* 0x01CD0 */ u8 pad2[0x15330]; + /* 0x01CD0 */ u8 pad3[0x15330]; /* 0x17000 */ u16 unk17000; - /* 0x17002 */ u8 pad3[0xD86]; + /* 0x17002 */ u8 pad4[0xD86]; /* 0x17D88 */ UNK_TYPE unk17D88; - /* 0x17D8C */ u8 pad4[0xAB4]; + /* 0x17D8C */ u8 pad5[0xAB4]; /* 0x18840 */ UNK_TYPE unk18840; - /* 0x18844 */ u8 pad5[0x40]; + /* 0x18844 */ u8 pad6[0x40]; /* 0x18884 */ UNK_TYPE unk18884; } z_GlobalContext; diff --git a/include/variables.h b/include/variables.h index 005993dcba..b92e5178d6 100644 --- a/include/variables.h +++ b/include/variables.h @@ -698,7 +698,7 @@ extern UNK_TYPE D_00C7A4E0; // D_00C7A4E0 //extern UNK_TYPE D_060005C0; //extern UNK_TYPE D_060005C4; //extern UNK_TYPE D_060005C8; -//extern UNK_TYPE D_060005D0; +extern UNK_TYPE D_060005D0; //extern UNK_TYPE D_060005D4; //extern UNK_TYPE D_060005F8; //extern UNK_TYPE D_060005FC; @@ -1058,7 +1058,7 @@ extern UNK_TYPE D_06001228; // D_06001228 //extern UNK_TYPE D_06002CD0; //extern UNK_TYPE D_06002CE0; //extern UNK_TYPE D_06002D28; -//extern UNK_TYPE D_06002D30; +extern UNK_TYPE D_06002D30; //extern UNK_TYPE D_06002D84; //extern UNK_TYPE D_06002DD4; //extern UNK_TYPE D_06002DE8; @@ -11194,7 +11194,7 @@ extern f32 D_808637D0; // D_808637D0 //extern UNK_TYPE D_80ACA9F0; //extern UNK_TYPE D_80ACB140; //extern UNK_TYPE D_80ACB3B0; -//extern UNK_TYPE D_80ACB650; +extern f32 D_80ACB650; //extern UNK_TYPE D_80ACC2C0; //extern UNK_TYPE D_80ACC2EC; //extern UNK_TYPE D_80ACC308; diff --git a/src/actors/ovl_Bg_Fu_Kaiten_0x80ACB400/ovl_Bg_Fu_Kaiten_0x80ACB400.c b/src/actors/ovl_Bg_Fu_Kaiten_0x80ACB400/ovl_Bg_Fu_Kaiten_0x80ACB400.c new file mode 100644 index 0000000000..78874922b2 --- /dev/null +++ b/src/actors/ovl_Bg_Fu_Kaiten_0x80ACB400/ovl_Bg_Fu_Kaiten_0x80ACB400.c @@ -0,0 +1,125 @@ +#include +#include + +typedef struct z_ActorBgFuKaiten_s { + /* 0x000 */ z_Actor baseActor; + /* 0x144 */ UNK_TYPE unk144; + /* 0x148 */ u8 pad0[0x18]; + /* 0x160 */ f32 unk160; + /* 0x164 */ f32 unk164; + /* 0x168 */ s16 unk168; + /* 0x16A */ s16 unk16A; + /* 0x16C */ s16 unk16C; + /* 0x16E */ u8 pad1[0x2]; +} z_ActorBgFuKaiten; + +void z_bg_fu_kaiten_init(z_ActorBgFuKaiten* this, z_GlobalContext* ctxt); +void z_bg_fu_kaiten_fini(z_ActorBgFuKaiten* this, z_GlobalContext* ctxt); +UNK_RET func_80ACB4B4(z_ActorBgFuKaiten* this); +UNK_RET func_80ACB50C(z_ActorBgFuKaiten* this); +void z_bg_fu_kaiten_main(z_ActorBgFuKaiten* this, z_GlobalContext* ctxt); +void z_bg_fu_kaiten_draw(z_ActorBgFuKaiten* this, z_GlobalContext* ctxt); + +z_ActorInit bgBgFuKaitenInitVar = { + 0x01AE, + 1, + 0, + 0x30, + 0x01A0, + sizeof(z_ActorBgFuKaiten), + (z_ActorFunc)z_bg_fu_kaiten_init, + (z_ActorFunc)z_bg_fu_kaiten_fini, + (z_ActorFunc)z_bg_fu_kaiten_main, + (z_ActorFunc)z_bg_fu_kaiten_draw +}; + +f32 D_80ACB650 = 0.002; + + +// This starts with 3 NOPs, is this another section? +GLOBAL_ASM( +.data +glabel D_80ACB654 +/* 000149 0x80ACB654 */ .word 0x00000000 +/* 000150 0x80ACB658 */ .word 0x00000000 +/* 000151 0x80ACB65C */ .word 0x00000000 +/* 000152 0x80ACB660 */ .word 0x00000230 +/* 000153 0x80ACB664 */ .word 0x00000020 +/* 000154 0x80ACB668 */ .word 0x00000010 +/* 000155 0x80ACB66C */ .word 0x00000000 +/* 000156 0x80ACB670 */ .word 0x00000008 +/* 000157 0x80ACB674 */ .word 0x450000D8 +/* 000158 0x80ACB678 */ .word 0x460000DC +/* 000159 0x80ACB67C */ .word 0x44000180 +/* 000160 0x80ACB680 */ .word 0x44000188 +/* 000161 0x80ACB684 */ .word 0x82000010 +/* 000162 0x80ACB688 */ .word 0x82000014 +/* 000163 0x80ACB68C */ .word 0x82000018 +/* 000164 0x80ACB690 */ .word 0x8200001C +/* 000165 0x80ACB694 */ .word 0x00000000 +/* 000166 0x80ACB698 */ .word 0x00000000 +/* 000167 0x80ACB69C */ .word 0x00000040 +) + +void z_bg_fu_kaiten_init(z_ActorBgFuKaiten* this, z_GlobalContext* ctxt) { + UNK_TYPE pad0; + UNK_TYPE pad1; + UNK_TYPE sp24 = 0; + + func_800B67E0((z_Actor*)this, 1.0); + func_800CAE10((z_Actor*)this, 3); + func_800C9564((UNK_TYPE)&D_06002D30, &sp24); // XXX: D_06002D30 is probably a constant + this->unk144 = func_800C6188(ctxt, &ctxt->unk880, (z_Actor*)this, sp24); + + this->unk164 = 0.0; + this->unk168 = 0; + this->unk16A = 0; + this->unk16C = 0; +} + +void z_bg_fu_kaiten_fini(z_ActorBgFuKaiten* this, z_GlobalContext* ctxt) { + func_800C64CC(ctxt, &ctxt->unk880, this->unk144); +} + +UNK_RET func_80ACB4B4(z_ActorBgFuKaiten* this) { + s16 v0 = this->unk168; + f32 f0; + this->baseActor.unkBE += v0; + if (v0 > 0) + { + f0 = (f32)v0 * D_80ACB650; + func_8019FAD8(&this->baseActor.unkEC, 8310, f0); + } +} + +UNK_RET func_80ACB50C(z_ActorBgFuKaiten* this) { + this->unk16C += this->unk16A; + this->baseActor.unk24.y = this->baseActor.unk8.y + this->unk160 + this->unk164; + + this->baseActor.unk24.y -= this->unk164 * func_800FED44(this->unk16C); +} + +void z_bg_fu_kaiten_main(z_ActorBgFuKaiten* this, z_GlobalContext* ctxt) { + func_80ACB4B4(this); + func_80ACB50C(this); +} + +void z_bg_fu_kaiten_draw(z_ActorBgFuKaiten* this, z_GlobalContext* ctxt) { + z_GraphicsContext* sp24 = ctxt->unk0; + UNK_TYPE pad; + u32* v0; + + // XXX: register allocation is wrong here + + func_8012C28C(sp24); + + v0 = sp24->unk2B0; + sp24->unk2B0 += 2; + v0[0] = 0xDA380003; + v0[1] = func_80181A40(ctxt->unk0); + + v0 = sp24->unk2B0; + sp24->unk2B0 += 2; + v0[1] = (u32)&D_060005D0; // XXX: D_060005D0 is probably a constant + v0[0] = 0xDE000000; +} diff --git a/variables.py b/variables.py index 57bd54a04d..0577a48a35 100644 --- a/variables.py +++ b/variables.py @@ -5,8 +5,10 @@ known_vars = { 0x00ACC000:("","UNK_TYPE",False), # this seems low 0x00B3C000:("","UNK_TYPE",False), # this seems low 0x00C7A4E0:("","UNK_TYPE",False), # this seems low + 0x060005D0:("","UNK_TYPE",False), # this seems low 0x06001100:("","UNK_TYPE",False), # this seems low 0x06001228:("","UNK_TYPE",False), # this seems low + 0x06002D30:("","UNK_TYPE",False), # this seems low 0x80000300:("osTvType","UNK_TYPE",False), 0x80000304:("osRomType","UNK_TYPE",False), 0x80000308:("osRomBase","UNK_TYPE",False), @@ -193,6 +195,8 @@ known_vars = { # En_Test 0x808637D0:("","f32",False), + 0x80ACB650:("bgBgFuKaitenInitVar","z_ActorInit",False), + 0x80ACB650:("","f32",False), 0x80BD55D0:("bgIkanaRayInitVar","z_ActorInit",False), 0x80BD55F0:("","UNK_TYPE",False), 0x80BD561C:("bgIkanaRayCompInit","z_ActorCompInitEntry",True),