diff --git a/include/global.h b/include/global.h index ecb2bb8..5387aa5 100644 --- a/include/global.h +++ b/include/global.h @@ -459,7 +459,9 @@ typedef struct unk_D_86002F30 { typedef struct UnkInputStruct8000D738 { /* 0x00 */ s16 unk_00; - /* 0x00 */ s32 unk_04; + /* 0x02 */ u8 unk_02; + /* 0x03 */ u8 unk_03; + /* 0x04 */ u16 (*unk_04)[6][0x640]; } UnkInputStruct8000D738; // size = 0x8 typedef struct UnkStruct800AA660 { diff --git a/src/1AB70.h b/src/1AB70.h index c0b4ebe..06c9806 100644 --- a/src/1AB70.h +++ b/src/1AB70.h @@ -59,6 +59,7 @@ typedef struct unk_func_8001A024 { unk_func_8001A024* func_8001A024(unk_D_86002F58_004_000_010*, s16, s16, s16); void func_8001A324(unk_func_8001A024*, s32, s32, u16); +void func_8001A46C(unk_func_8001A024*, s32, unk_func_80026268_arg0*, s32); s32 func_8001ABAC(unk_func_8001A024*, s32); void* func_8001AFD8(unk_func_8001A024*, s32); void func_8001B058(void); diff --git a/src/29BA0.c b/src/29BA0.c index c242196..ea82760 100644 --- a/src/29BA0.c +++ b/src/29BA0.c @@ -532,7 +532,7 @@ void func_8002A728(void) { func_80001BD4(2); func_8000D358(); - sp2C.unk_04 = main_pool_alloc(0x4B00, 0); + sp2C.unk_04 = main_pool_alloc(sizeof(*sp2C.unk_04), 0); FRAGMENT_LOAD_AND_CALL(fragment53, D_80075674, &sp2C); func_8000D738(&sp2C); diff --git a/src/fragments/53/fragment53.c b/src/fragments/53/fragment53.c index 71f5ee3..d28b6b0 100644 --- a/src/fragments/53/fragment53.c +++ b/src/fragments/53/fragment53.c @@ -1,9 +1,87 @@ -#include "global.h" +#include "fragment53.h" +#include "src/19840.h" +#include "src/1AB70.h" +#include "src/232C0.h" +#include "src/26820.h" +#include "src/3FB0.h" +#include "src/6A40.h" +#include "src/6BC0.h" +#include "src/controller.h" +#include "src/memory.h" +#include "src/stage_loader.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/53/fragment53/func_82A00020.s") +static unk_D_86002F58_004_000_010* D_82A00370; +static unk_func_8001A024* D_82A00374; +static unk_func_80026268_arg0 D_82A00378[6]; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/53/fragment53/func_82A000F0.s") +static s32 D_82A00360 = 0; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/53/fragment53/func_82A00144.s") +void func_82A00020(s32 arg0) { + s32 i; + unk_func_80022C28_ret* temp_v0; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/53/fragment53/func_82A00224.s") + if (func_80023AF8(arg0) != 0) { + temp_v0 = func_80022C28(0x20, arg0, 0, 0); + D_82A00360 = func_80022E18(D_82A00378, 6, temp_v0); + func_80022D8C(temp_v0); + } + + for (i = 0; i < D_82A00360; i++) { + func_8001A46C(D_82A00374, i, &D_82A00378[i], 1); + } +} + +s32 func_82A000F0(u8 arg0) { + Cont_StartReadInputs(); + Cont_ReadInputs(); + func_8001ABAC(D_82A00374, 0); + func_800079C4(); + func_8000699C(&gDisplayListHead, 1); + return 0; +} + +void func_82A00144(UnkInputStruct8000D738* arg0) { + s32 i; + unk_func_8002A728 sp34; + u16(*var_s1)[0x640] = arg0->unk_04[0]; + + func_80027F24(&sp34); + arg0->unk_02 = sp34.unk_00; + arg0->unk_00 = sp34.unk_04; + arg0->unk_03 = D_82A00360; + + for (i = 0; i < D_82A00360; i++, var_s1++) { + _bcopy(func_8001AFD8(D_82A00374, i), var_s1, sizeof(var_s1[0])); + } + + if (D_82A00360 < 6) { + bzero(var_s1, 0x4B00 + (-D_82A00360 * 0xC80)); + } +} + +s32 func_82A00224(s32 arg0, UnkInputStruct8000D738* arg1) { + unk_func_80007444* sp24; + + main_pool_push_state('PREP'); + + func_80005E40(0x10000, 0); + sp24 = func_80007444(0, 1, 2, 0, 1, 1); + + ASSET_LOAD(D_1000000, common_menu1_ui, 0); + FRAGMENT_LOAD(fragment31); + + D_82A00370 = func_80019760(1); + D_82A00374 = func_8001A024(D_82A00370, 6, 0x28, 0x28); + func_8001987C(); + func_82A00020(arg0); + func_80028AFC(2); + func_80007678(sp24); + func_80007820(8, func_82A000F0); + func_800076C0(); + func_82A00144(arg1); + func_80005EAC(); + + main_pool_pop_state('PREP'); + + return D_82A00360; +} diff --git a/src/fragments/53/fragment53.h b/src/fragments/53/fragment53.h new file mode 100644 index 0000000..15853e9 --- /dev/null +++ b/src/fragments/53/fragment53.h @@ -0,0 +1,11 @@ +#ifndef _FRAGMENT53_H_ +#define _FRAGMENT53_H_ + +#include "global.h" + +void func_82A00020(s32 arg0); +s32 func_82A000F0(u8 arg0); +void func_82A00144(UnkInputStruct8000D738* arg0); +s32 func_82A00224(s32 arg0, UnkInputStruct8000D738* arg1); + +#endif // _FRAGMENT53_H_ diff --git a/yamls/us/rom.yaml b/yamls/us/rom.yaml index 73841d8..c569494 100644 --- a/yamls/us/rom.yaml +++ b/yamls/us/rom.yaml @@ -1918,9 +1918,9 @@ subsegments: - [0x2BD6E0, textbin, fragments/53/fragment53_header] - [0x2BD700, c, fragments/53/fragment53] - - [0x2BDA40, data, fragments/53/fragment53_data] + - [0x2BDA40, .data, fragments/53/fragment53] - - {vram: 0x82A00370, type: bss, name: fragments/53/fragment53_bss} + - {vram: 0x82A00370, type: .bss, name: fragments/53/fragment53} - name: fragment53_relocs type: code