From b4a3e4f7cbd556f77e35902ffafd81983e3f81ff Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Thu, 26 Oct 2023 15:19:09 -0400 Subject: [PATCH 1/2] fix asmdiff directory --- tools/asmdiff/asmdiff.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/asmdiff/asmdiff.sh b/tools/asmdiff/asmdiff.sh index 2fd472ce4f..981a91cdbe 100644 --- a/tools/asmdiff/asmdiff.sh +++ b/tools/asmdiff/asmdiff.sh @@ -15,7 +15,7 @@ MYDIR=$(dirname "$0") mkdir -p "${MYDIR}"/.bins "${MYDIR}"/.files DEFAULT_BASEROM=baserom.nds -DEFAULT_ARM9BUILDDIR=build/platinum.us +DEFAULT_ARM9BUILDDIR=build DEFAULT_ARM7BUILDDIR=sub/build DEFAULT_FSDIR=files From 4045bb1578a99e2e4a05babe70c8d9ed2c36e391 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Thu, 26 Oct 2023 15:19:57 -0400 Subject: [PATCH 2/2] start matching functions --- include/overlay098/ov98_022499C8.h | 4 +- include/overlay104/ov104_02231F74.h | 4 +- src/overlay005/ov5_021F6454.c | 94 +++---- src/overlay005/ov5_021F77A8.c | 34 +-- src/overlay021/ov21_021D5600.c | 227 ++++++----------- src/overlay052/ov52_02256694.c | 74 ++---- src/overlay066/ov66_022324F0.c | 29 +-- src/overlay067/ov67_0225C700.c | 41 +-- src/overlay070/ov70_0225D9A4.c | 40 +-- src/overlay094/ov94_022414B8.c | 64 ++--- src/overlay098/ov98_02246C20.c | 283 ++++++--------------- src/overlay098/ov98_022471C8.c | 296 ++++++---------------- src/overlay098/ov98_022499C8.c | 259 ++++++------------- src/overlay104/ov104_0222FBE4.c | 41 ++- src/overlay104/ov104_02231F74.c | 338 +++++-------------------- src/overlay105/ov105_02241AE0.c | 83 +----- src/overlay107/ov107_02241AE0.c | 303 ++++------------------ src/overlay107/ov107_02245EB0.c | 373 +++++---------------------- src/overlay109/ov109_021D0D80.c | 44 +--- src/overlay110/ov110_021D0D80.c | 380 +++++----------------------- src/overlay111/ov111_021D0D80.c | 60 +---- src/overlay117/ov117_02263AF0.c | 100 ++------ 22 files changed, 683 insertions(+), 2488 deletions(-) diff --git a/include/overlay098/ov98_022499C8.h b/include/overlay098/ov98_022499C8.h index 3d428784b7..7c83207ba9 100644 --- a/include/overlay098/ov98_022499C8.h +++ b/include/overlay098/ov98_022499C8.h @@ -4,7 +4,7 @@ #include "strbuf.h" void ov98_022499C8(Strbuf *param0, char * param1, int param2); -void ov98_02249A80(void); -void ov98_02249ACC(void); +int ov98_02249A80(Strbuf *param0, int param1); +void ov98_02249ACC(const char * param0, u32 * param1, int param2); #endif // POKEPLATINUM_OV98_022499C8_H diff --git a/include/overlay104/ov104_02231F74.h b/include/overlay104/ov104_02231F74.h index f9490d3c43..b029afb464 100644 --- a/include/overlay104/ov104_02231F74.h +++ b/include/overlay104/ov104_02231F74.h @@ -40,7 +40,7 @@ void ov104_022330FC(UnkStruct_ov104_0222E930 * param0, u16 * param1); void ov104_0223310C(UnkStruct_ov104_0222E930 * param0, u16 * param1, u32 param2); void ov104_0223319C(SysTask * param0, void * param1); void ov104_022331E8(SysTask * param0, void * param1); -void ov104_0223327C(void); -void ov104_02233298(void); +void ov104_0223327C(UnkStruct_ov104_02232B5C * param0, int param1); +void ov104_02233298(UnkStruct_ov104_02232B5C * param0, int param1); #endif // POKEPLATINUM_OV104_02231F74_H diff --git a/src/overlay005/ov5_021F6454.c b/src/overlay005/ov5_021F6454.c index 22e6647b91..b32c2a6ae8 100644 --- a/src/overlay005/ov5_021F6454.c +++ b/src/overlay005/ov5_021F6454.c @@ -1104,71 +1104,41 @@ BOOL ov5_021F76D0 (UnkStruct_0203E724 * param0) return 0; } -asm BOOL ov5_021F7704 (UnkStruct_0203E724 * param0) -{ - push {r4, lr} - add r0, #0x80 - ldr r0, [r0, #0] - mov r1, #0xf - ldr r0, [r0, #0x38] - bl sub_0206251C - add r4, r0, #0 - beq _021F774E - bl sub_02063020 - cmp r0, #0x28 - bgt _021F7730 - cmp r0, #0x26 - blt _021F772A - beq _021F773A - cmp r0, #0x28 - beq _021F773E - b _021F7746 - _021F772A: - cmp r0, #0x1c - beq _021F7736 - b _021F7746 - _021F7730: - cmp r0, #0x30 - beq _021F7742 - b _021F7746 - _021F7736: - mov r1, #6 - b _021F7748 - _021F773A: - mov r1, #5 - b _021F7748 - _021F773E: - mov r1, #3 - b _021F7748 - _021F7742: - mov r1, #2 - b _021F7748 - _021F7746: - mov r1, #4 - _021F7748: - add r0, r4, #0 - bl ov5_021F7654 - _021F774E: - mov r0, #0 - pop {r4, pc} +BOOL ov5_021F7704 (UnkStruct_0203E724 * param0) +{ + int v0; + UnkStruct_02061AB4 * v1 = sub_0206251C(param0->unk_34->unk_38, 15); + if (v1 != NULL) + { + switch (sub_02063020(v1)) + { + case 28: + v0 = 6; + break; + case 38: + v0 = 5; + break; + case 40: + v0 = 3; + break; + case 48: + v0 = 2; + break; + default: + v0 = 4; + break; + } + ov5_021F7654(v1, v0); + } + return 0; } -asm BOOL ov5_021F7754 (UnkStruct_0203E724 * param0) +BOOL ov5_021F7754 (UnkStruct_0203E724 * param0) { - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0] - mov r1, #0xf - ldr r0, [r0, #0x38] - bl sub_0206251C - cmp r0, #0 - beq _021F776E - mov r1, #2 - lsl r1, r1, #0xc - bl sub_020628C4 - _021F776E: - mov r0, #0 - pop {r3, pc} + UnkStruct_02061AB4 * v0 = sub_0206251C(param0->unk_34->unk_38, 15); + if (v0 != NULL) + sub_020628C4(v0, 8192); + return 0; } BOOL ov5_021F7774 (UnkStruct_0203E724 * param0) diff --git a/src/overlay005/ov5_021F77A8.c b/src/overlay005/ov5_021F77A8.c index df617a04e0..d3b9d71d6b 100644 --- a/src/overlay005/ov5_021F77A8.c +++ b/src/overlay005/ov5_021F77A8.c @@ -653,34 +653,14 @@ static const UnkStruct_ov5_02200CE4 Unk_ov5_02200CE4[] = { {0xFD, 0x0, 0x0, 0x6, 0x2, 0x2} }; -asm BOOL ov5_021F77A8 (UnkStruct_0203E724 * param0) +BOOL ov5_021F77A8 (UnkStruct_0203E724 * param0) { - push {r4, r5, r6, lr} - add r5, r0, #0 - bl sub_0203E838 - add r1, r0, #0 - add r0, r5, #0 - add r0, #0x80 - ldr r0, [r0, #0] - bl sub_0203F150 - add r6, r0, #0 - add r0, r5, #0 - bl sub_0203E838 - add r1, r0, #0 - add r0, r5, #0 - add r0, #0x80 - ldr r0, [r0, #0] - bl sub_0203F118 - add r5, #0x80 - add r4, r0, #0 - ldr r0, [r5, #0] - ldr r0, [r0, #0xc] - bl sub_02027560 - add r1, r6, #0 - bl sub_02026FE8 - strh r0, [r4] - mov r0, #0 - pop {r4, r5, r6, pc} + u16 v0 = sub_0203F150(param0->unk_34, sub_0203E838(param0)); + u16 * v1 = sub_0203F118(param0->unk_34, sub_0203E838(param0)); + UnkStruct_02026324 * v2 = sub_02027560(param0->unk_34->unk_0C); + + *v1 = sub_02026FE8(v2, v0); + return 0; } BOOL ov5_021F77E8 (UnkStruct_0203E724 * param0) diff --git a/src/overlay021/ov21_021D5600.c b/src/overlay021/ov21_021D5600.c index b939931480..a45c3981f5 100644 --- a/src/overlay021/ov21_021D5600.c +++ b/src/overlay021/ov21_021D5600.c @@ -35,162 +35,89 @@ int ov21_021D5608 (int param0) } -static const u32 Unk_ov21_021E9CCC[] = { - 0x2CD, - 0x2C8, - 0x2C9, - 0x2CA, - 0x2CB, - 0x2CC -}; - -asm Strbuf* ov21_021D561C (int param0, int param1, int param2) +Strbuf* ov21_021D561C (int param0, int param1, int param2) { - push {r4, r5, r6, lr} - sub sp, #0x28 - add r4, r2, #0 - add r2, sp, #4 - str r2, [sp] - add r2, sp, #0xc - add r3, sp, #8 - add r5, r0, #0 - bl ov21_021D5764 - ldr r2, [sp, #4] - cmp r2, #6 - bne _021D5642 - add r0, r5, #0 - add r1, r4, #0 - bl sub_0200B32C - add sp, #0x28 - pop {r4, r5, r6, pc} - _021D5642: - ldr r6, = Unk_ov21_021E9CCC - add r5, sp, #0x10 - add r3, r5, #0 - ldmia r6 !, {r0, r1} - stmia r5 !, {r0, r1} - ldmia r6 !, {r0, r1} - stmia r5 !, {r0, r1} - ldmia r6 !, {r0, r1} - stmia r5 !, {r0, r1} - lsl r0, r2, #2 - ldr r1, [sp, #0xc] - ldr r0, [r3, r0] - add r2, r4, #0 - str r1, [sp, #4] - bl ov21_021D5724 - add sp, #0x28 - pop {r4, r5, r6, pc} - nop + int v0; + int v1; + int v2; + int v3; + + ov21_021D5764(param0, param1, &v0, &v1, &v2); + + if (v2 == 6) { + return sub_0200B32C(param0, param2); + } else { + const int Unk_ov21_021E9CCC[] = { + 0x2CD, + 0x2C8, + 0x2C9, + 0x2CA, + 0x2CB, + 0x2CC + }; + v3 = Unk_ov21_021E9CCC[v2]; + v2 = v0; + } + + return ov21_021D5724(v3, v2, param2); } -static const u32 Unk_ov21_021E9CE4[] = { - 0x2D3, - 0x2CE, - 0x2CF, - 0x2D0, - 0x2D1, - 0x2D2 -}; - -asm Strbuf* ov21_021D566C (int param0, int param1, int param2) +Strbuf* ov21_021D566C (int param0, int param1, int param2) { - push {r4, r5, r6, lr} - sub sp, #0x28 - add r4, r2, #0 - add r2, sp, #4 - str r2, [sp] - add r2, sp, #0xc - add r3, sp, #8 - add r5, r0, #0 - bl ov21_021D5764 - ldr r2, [sp, #4] - cmp r2, #6 - bne _021D568C - str r5, [sp, #4] - ldr r0, = 0x2C7 - b _021D56A6 - _021D568C: - ldr r6, = Unk_ov21_021E9CE4 - add r5, sp, #0x10 - add r3, r5, #0 - ldmia r6 !, {r0, r1} - stmia r5 !, {r0, r1} - ldmia r6 !, {r0, r1} - stmia r5 !, {r0, r1} - ldmia r6 !, {r0, r1} - stmia r5 !, {r0, r1} - lsl r0, r2, #2 - ldr r1, [sp, #0xc] - ldr r0, [r3, r0] - str r1, [sp, #4] - _021D56A6: - ldr r1, [sp, #4] - add r2, r4, #0 - bl ov21_021D5724 - add sp, #0x28 - pop {r4, r5, r6, pc} + int v0; + int v1; + int v2; + int v3; + + ov21_021D5764(param0, param1, &v0, &v1, &v2); + + if (v2 == 6) { + v2 = param0; + v3 = 711; + } else { + const int Unk_ov21_021E9CE4[] = { + 0x2D3, + 0x2CE, + 0x2CF, + 0x2D0, + 0x2D1, + 0x2D2 + }; + v3 = Unk_ov21_021E9CE4[v2]; + v2 = v0; + } + + return ov21_021D5724(v3, v2, param2); } - -static const u32 Unk_ov21_021E9CFC[] = { - 0x2C1, - 0x2BC, - 0x2BD, - 0x2BE, - 0x2BF, - 0x2C0 -}; - -asm Strbuf* ov21_021D56BC (int param0, int param1, int param2, int param3) + +Strbuf* ov21_021D56BC (int param0, int param1, int param2, int param3) { - push {r4, r5, r6, lr} - sub sp, #0x28 - add r4, r2, #0 - add r2, sp, #4 - add r6, r3, #0 - str r2, [sp] - add r2, sp, #0xc - add r3, sp, #8 - add r5, r0, #0 - bl ov21_021D5764 - ldr r0, [sp, #4] - cmp r0, #6 - bne _021D56E8 - cmp r4, #1 - blt _021D56E0 - bl ErrorHandling_AssertFail - _021D56E0: - add r0, r5, r4 - str r0, [sp, #4] - ldr r0, = 0x2C2 - b _021D570E - _021D56E8: - ldr r3, = Unk_ov21_021E9CFC - add r2, sp, #0x10 - ldmia r3 !, {r0, r1} - stmia r2 !, {r0, r1} - ldmia r3 !, {r0, r1} - stmia r2 !, {r0, r1} - ldmia r3 !, {r0, r1} - stmia r2 !, {r0, r1} - cmp r4, #1 - blt _021D5700 - bl ErrorHandling_AssertFail - _021D5700: - ldr r0, [sp, #4] - lsl r1, r0, #2 - add r0, sp, #0x10 - ldr r0, [r0, r1] - ldr r1, [sp, #0xc] - add r1, r1, r4 - str r1, [sp, #4] - _021D570E: - ldr r1, [sp, #4] - add r2, r6, #0 - bl ov21_021D5724 - add sp, #0x28 - pop {r4, r5, r6, pc} - nop + int v0; + int v1; + int v2; + int v3; + + ov21_021D5764(param0, param1, &v0, &v1, &v2); + + if (v2 == 6) { + GF_ASSERT(param2 < 1); + v2 = param0 * 1 + param2; + v3 = 706; + } else { + const int Unk_ov21_021E9CFC[] = { + 0x2C1, + 0x2BC, + 0x2BD, + 0x2BE, + 0x2BF, + 0x2C0 + }; + GF_ASSERT(param2 < 1); + v3 = Unk_ov21_021E9CFC[v2]; + v2 = v0 * 1 + param2; + } + + return ov21_021D5724(v3, v2, param3); } static inline BOOL inline_ov21_021D5764_1 (int param0, int param1) diff --git a/src/overlay052/ov52_02256694.c b/src/overlay052/ov52_02256694.c index 83b7075e48..b548430c18 100644 --- a/src/overlay052/ov52_02256694.c +++ b/src/overlay052/ov52_02256694.c @@ -374,66 +374,22 @@ static void ov52_02256B64 (UnkStruct_ov52_02256694 * param0) sub_0201ACCC(¶m0->unk_20); } -asm static void ov52_02256BDC (UnkStruct_ov52_02256694 * param0) +static void ov52_02256BDC (UnkStruct_ov52_02256694 * param0) { - push {r4, lr} - sub sp, #0x10 - add r4, r0, #0 - add r0, #0x20 - mov r1, #4 - bl BGL_FillWindow - ldr r0, [r4, #0x58] - ldr r2, [r4, #0x5c] - mov r1, #2 - bl MessageLoader_GetStrbuf - mov r0, #0 - ldr r1, [r4, #0x5c] - add r2, r0, #0 - bl sub_02002D7C - mov r1, #0xc0 - sub r0, r1, r0 - lsr r3, r0, #1 - mov r0, #8 - str r0, [sp] - mov r0, #0xff - str r0, [sp, #4] - ldr r0, = 0x10804 - mov r1, #0 - str r0, [sp, #8] - str r1, [sp, #0xc] - add r0, r4, #0 - ldr r2, [r4, #0x5c] - add r0, #0x20 - bl sub_0201D78C - ldr r0, [r4, #0x58] - ldr r2, [r4, #0x5c] - mov r1, #4 - bl MessageLoader_GetStrbuf - mov r0, #0 - ldr r1, [r4, #0x5c] - add r2, r0, #0 - bl sub_02002EB4 - mov r1, #0xc0 - sub r0, r1, r0 - lsr r3, r0, #1 - mov r0, #0x18 - str r0, [sp] - mov r0, #0xff - str r0, [sp, #4] - ldr r0, = 0x10804 - mov r1, #0 - str r0, [sp, #8] - str r1, [sp, #0xc] - add r0, r4, #0 - ldr r2, [r4, #0x5c] - add r0, #0x20 - bl sub_0201D78C - add r4, #0x20 - add r0, r4, #0 - bl sub_0201ACCC - add sp, #0x10 - pop {r4, pc} - nop + u32 v0; + u32 v1; + + BGL_FillWindow(¶m0->unk_20, 4); + MessageLoader_GetStrbuf(param0->unk_58, 2, param0->unk_5C); + + v0 = ((24 * 8) - sub_02002D7C(0, param0->unk_5C, 0)) / 2; + sub_0201D78C(¶m0->unk_20, 0, param0->unk_5C, v0, 8, 0xff, (u32)(((1 & 0xff) << 16) | ((8 & 0xff) << 8) | ((4 & 0xff) << 0)), NULL); + MessageLoader_GetStrbuf(param0->unk_58, 4, param0->unk_5C); + + v1 = ((24 * 8) - sub_02002EB4(0, param0->unk_5C, 0)) / 2; + sub_0201D78C(¶m0->unk_20, 0, param0->unk_5C, v1, 24, 0xff, (u32)(((1 & 0xff) << 16) | ((8 & 0xff) << 8) | ((4 & 0xff) << 0)), NULL); + + sub_0201ACCC(¶m0->unk_20); } static void ov52_02256C64 (UnkStruct_ov52_02256694 * param0, const UnkStruct_ov52_02256694_1 * param1) diff --git a/src/overlay066/ov66_022324F0.c b/src/overlay066/ov66_022324F0.c index 82177e09c4..bef186251a 100644 --- a/src/overlay066/ov66_022324F0.c +++ b/src/overlay066/ov66_022324F0.c @@ -250,27 +250,14 @@ UnkEnum_ov66_0223287C ov66_022325D8 (void) return ov66_0223287C(); } -asm PPW_LOBBY_ERROR ov66_022326DC (void) -{ - push {r3, lr} - ldr r0, = Unk_ov66_0225B6C0 - ldr r0, [r0, #0] - cmp r0, #0 - bne _022326EA - bl ErrorHandling_AssertFail - _022326EA: - ldr r0, = Unk_ov66_0225B6C0 - ldr r1, [r0, #0] - ldr r0, = 0x984 - ldr r0, [r1, r0] - cmp r0, #0 - bne _022326FC - bl PPW_LobbyGetLastError - pop {r3, pc} - _022326FC: - bl ov66_02237134 - pop {r3, pc} - nop +PPW_LOBBY_ERROR ov66_022326DC (void) +{ + GF_ASSERT(Unk_ov66_0225B6C0 != NULL); + + if (Unk_ov66_0225B6C0->unk_984 == 0) + return PPW_LobbyGetLastError(); + else + return ov66_02237134(Unk_ov66_0225B6C0->unk_984); } s32 ov66_0223270C (PPW_LOBBY_ERROR param0) diff --git a/src/overlay067/ov67_0225C700.c b/src/overlay067/ov67_0225C700.c index 9f3129199f..a75d35e5f1 100644 --- a/src/overlay067/ov67_0225C700.c +++ b/src/overlay067/ov67_0225C700.c @@ -729,43 +729,12 @@ static void ov67_0225D330 (UnkStruct_ov67_0225D210 * param0) sub_0200B3F0(param0->unk_00); } -asm static void ov67_0225D37C (UnkStruct_ov67_0225D210 * param0, u32 param1) +static void ov67_0225D37C (UnkStruct_ov67_0225D210 * param0, u32 param1) { - push {r3, r4, r5, lr} - sub sp, #0x10 - add r4, r0, #0 - add r5, r1, #0 - add r0, #8 - mov r1, #0 - bl BGL_FillWindow - ldr r0, [r4, #4] - ldr r2, [r4, #0x1c] - add r1, r5, #0 - bl MessageLoader_GetStrbuf - ldr r0, [r4, #0] - ldr r1, [r4, #0x18] - ldr r2, [r4, #0x1c] - bl sub_0200C388 - mov r0, #0 - ldr r1, [r4, #0x18] - add r2, r0, #0 - mov r3, #0xb0 - bl sub_02002EEC - mov r1, #0 - add r3, r0, #0 - str r1, [sp] - ldr r0, = 0xF0E00 - str r1, [sp, #4] - str r0, [sp, #8] - str r1, [sp, #0xc] - add r0, r4, #0 - ldr r2, [r4, #0x18] - add r0, #8 - mov r1, #1 - bl sub_0201D78C - add sp, #0x10 - pop {r3, r4, r5, pc} - nop + BGL_FillWindow(¶m0->unk_08, 0); + MessageLoader_GetStrbuf(param0->unk_04, param1, param0->unk_1C); + sub_0200C388(param0->unk_00, param0->unk_18, param0->unk_1C); + sub_0201D78C(¶m0->unk_08, 1, param0->unk_18, sub_02002EEC(0, param0->unk_18, 0, 0xB0), 0, 0, 0xF0E00, 0); } static void ov67_0225D3D0 (UnkStruct_ov67_0225D210 * param0, u32 param1) diff --git a/src/overlay070/ov70_0225D9A4.c b/src/overlay070/ov70_0225D9A4.c index d6bac79bde..4e1db322aa 100644 --- a/src/overlay070/ov70_0225D9A4.c +++ b/src/overlay070/ov70_0225D9A4.c @@ -1733,37 +1733,15 @@ static void ov70_0225ED4C (UnkStruct_ov70_0225EC20 * param0, UnkStruct_ov70_0225 } } -asm static void ov70_0225EDA8 (UnkStruct_ov70_0225EC20 * param0, u32 param1, u32 param2, u32 param3) -{ - push {r3, r4, r5, r6, r7, lr} - add r5, r0, #0 - ldr r0, [r5, #0x34] - add r4, r1, #0 - add r7, r2, #0 - add r6, r3, #0 - cmp r0, #0 - beq _0225EDBC - bl ErrorHandling_AssertFail - _0225EDBC: - add r0, r4, #0 - add r1, r7, #0 - bl sub_02013A04 - str r0, [r5, #0x34] - mov r1, #0 - strh r4, [r5, #0x38] - cmp r4, #0 - bls _0225EDDE - add r2, r1, #0 - _0225EDD0: - ldr r0, [r5, #0x34] - add r1, r1, #1 - add r0, r0, r2 - str r6, [r0, #4] - add r2, #8 - cmp r1, r4 - blo _0225EDD0 - _0225EDDE: - pop {r3, r4, r5, r6, r7, pc} +static void ov70_0225EDA8 (UnkStruct_ov70_0225EC20 * param0, u32 param1, u32 param2, u32 param3) +{ + int v0; + GF_ASSERT(param0->unk_34 == NULL); + param0->unk_34 = sub_02013A04(param1, param2); + param0->unk_38 = param1; + + for (v0 = 0; v0 < param1; v0++) + param0->unk_34[v0].unk_04 = param3; } static void ov70_0225EDE0 (UnkStruct_ov70_0225EC20 * param0) diff --git a/src/overlay094/ov94_022414B8.c b/src/overlay094/ov94_022414B8.c index df18a31d4d..7f7379decf 100644 --- a/src/overlay094/ov94_022414B8.c +++ b/src/overlay094/ov94_022414B8.c @@ -902,59 +902,25 @@ void ov94_02242204 (Window * param0, MessageLoader * param1, int param2, int par Strbuf_Free(v0); } -asm void ov94_0224226C (Window * param0, MessageLoader * param1, int param2, int param3, int param4, u32 param5, int param6, int param7) +void ov94_0224226C (Window * param0, MessageLoader * param1, int param2, int param3, int param4, u32 param5, int param6, int param7) { - push {r4, r5, r6, lr} - sub sp, #8 - add r6, r0, #0 - mov r0, #0 - mvn r0, r0 - add r5, r3, #0 - cmp r2, r0 - beq _022422AC - ldr r0, [sp, #0x20] - cmp r0, #0 - bne _02242286 - ldr r3, = Unk_ov94_0224610C - b _02242288 - _02242286: - ldr r3, = Unk_ov94_022460AC - _02242288: - add r0, r1, #0 - lsl r1, r2, #3 - ldr r1, [r3, r1] - bl MessageLoader_GetNewStrbuf - add r4, r0, #0 - ldr r0, [sp, #0x1c] - str r5, [sp] - str r0, [sp, #4] - ldr r2, [sp, #0x24] - ldr r3, [sp, #0x18] - add r0, r6, #0 - add r1, r4, #0 - bl ov94_02245900 - add r0, r4, #0 - bl Strbuf_Free - _022422AC: - add sp, #8 - pop {r4, r5, r6, pc} + Strbuf * v0; + if (param2 != -1) { + const UnkStruct_ov94_022460AC * v1; + if (param6 == 0) { + v1 = Unk_ov94_0224610C; + } else { + v1 = Unk_ov94_022460AC; + } + v0 = MessageLoader_GetNewStrbuf(param1, v1[param2].unk_00); + ov94_02245900(param0, v0, param7, param4, param3, param5); + Strbuf_Free(v0); + } } -asm void ov94_022422B8 (Window * param0, MessageLoader * param1, int param2, int param3, int param4, u32 param5, int param6) +void ov94_022422B8 (Window * param0, MessageLoader * param1, int param2, int param3, int param4, u32 param5, int param6) { - push {r4, lr} - sub sp, #0x10 - ldr r4, [sp, #0x18] - str r4, [sp] - ldr r4, [sp, #0x1c] - str r4, [sp, #4] - ldr r4, [sp, #0x20] - str r4, [sp, #8] - mov r4, #0 - str r4, [sp, #0xc] - bl ov94_0224226C - add sp, #0x10 - pop {r4, pc} + ov94_0224226C(param0, param1, param2, param3, param4, param5, param6, 0); } void ov94_022422D4 (MessageLoader * param0, MessageLoader * param1, UnkStruct_0200B358 * param2, Window param3[], int param4, int param5, int param6) diff --git a/src/overlay098/ov98_02246C20.c b/src/overlay098/ov98_02246C20.c index 8447eb6536..813f1c89e3 100644 --- a/src/overlay098/ov98_02246C20.c +++ b/src/overlay098/ov98_02246C20.c @@ -9,6 +9,7 @@ #include "struct_defs/struct_0203CC84.h" #include "struct_defs/struct_0208BE5C.h" +#include "struct_defs/struct_02089438.h" #include "overlay098/struct_ov98_02246E88.h" #include "overlay098/struct_ov98_02247168.h" @@ -344,215 +345,83 @@ static void ov98_02246FC0 (UnkStruct_ov98_02246E88 * param0) return; } -asm void * ov98_02246FC4 (UnkStruct_ov98_02246E88 * param0) -{ - push {r4, lr} - sub sp, #0x18 - add r4, r0, #0 - mov r0, #4 - str r0, [sp, #8] - str r0, [sp, #0xc] - str r0, [sp, #0x10] - str r0, [sp, #0x14] - ldr r0, [r4, #4] - bl sub_02025E44 - add r3, r0, #0 - mov r0, #4 - str r0, [sp] - mov r0, #0 - str r0, [sp, #4] - mov r0, #0x6c - mov r1, #0x10 - add r2, sp, #8 - bl sub_02089400 - add r1, r4, #0 - add r1, #0x94 - add r4, #0x94 - str r0, [r1, #0] - ldr r0, [r4, #0] - add sp, #0x18 - pop {r4, pc} -} - -asm void ov98_02246FFC (UnkStruct_ov98_02246E88 * param0) -{ - push {r3, r4, r5, lr} - add r5, r0, #0 - add r0, #0x94 - ldr r4, [r0, #0] - mov r1, #0x6c - ldr r0, [r4, #0x1c] - bl ov98_02249A80 - cmp r0, #0 - beq _0224701A - add r0, r5, #0 - mov r1, #1 - bl ov98_02246FAC - b _0224705C - _0224701A: - add r0, r5, #0 - bl ov98_02246FB4 - cmp r0, #2 - bne _02247048 - mov r0, #0x11 - lsl r0, r0, #4 - ldr r0, [r5, r0] - ldr r1, [r4, #0x1c] - bl Strbuf_Compare - cmp r0, #0 - beq _0224703E - add r0, r5, #0 - mov r1, #3 - bl ov98_02246FAC - b _0224705C - _0224703E: - add r0, r5, #0 - mov r1, #0 - bl ov98_02246FAC - b _0224705C - _02247048: - mov r0, #0x11 - lsl r0, r0, #4 - ldr r0, [r5, r0] - ldr r1, [r4, #0x1c] - bl Strbuf_Copy - add r0, r5, #0 - mov r1, #2 - bl ov98_02246FAC - _0224705C: - add r0, r4, #0 - bl sub_02089438 - mov r1, #0 - add r0, r5, #0 - add r2, r1, #0 - bl ov98_02246E88 - pop {r3, r4, r5, pc} -} - -asm void * ov98_02247070 (UnkStruct_ov98_02246E88 * param0) -{ - push {r4, lr} - sub sp, #0x20 - add r4, r0, #0 - mov r0, #3 - str r0, [sp, #0x10] - mov r0, #4 - str r0, [sp, #0x14] - mov r0, #0 - str r0, [sp, #0x18] - str r0, [sp, #0x1c] - ldr r0, [r4, #4] - bl sub_02025E44 - add r3, r0, #0 - mov r0, #5 - str r0, [sp] - mov r0, #1 - str r0, [sp, #4] - str r0, [sp, #8] - add r0, r4, #0 - add r0, #0x78 - ldrh r0, [r0] - mov r1, #7 - add r2, sp, #0x10 - str r0, [sp, #0xc] - mov r0, #0x6c - bl sub_0208941C - add r1, r4, #0 - add r1, #0x94 - add r4, #0x94 - str r0, [r1, #0] - ldr r0, [r4, #0] - add sp, #0x20 - pop {r4, pc} -} - -extern void _ull_mod(void); - -asm void ov98_022470B8 (UnkStruct_ov98_02246E88 * param0) -{ - push {r3, r4, r5, lr} - add r5, r0, #0 - add r0, #0x94 - ldr r4, [r0, #0] - add r1, sp, #0 - ldr r0, [r4, #0x1c] - bl Strbuf_AtoI - ldr r2, = 0x2710 - mov r3, #0 - bl _ull_mod - mov r1, #0x42 - lsl r1, r1, #2 - str r0, [r5, r1] - ldr r0, [sp] - cmp r0, #0 - bne _022470E0 - bl ErrorHandling_AssertFail - _022470E0: - add r0, r4, #0 - bl sub_02089438 - mov r1, #0 - add r0, r5, #0 - add r2, r1, #0 - bl ov98_02246E88 - pop {r3, r4, r5, pc} - nop -} - -asm void * ov98_022470F8 (UnkStruct_ov98_02246E88 * param0) +void * ov98_02246FC4 (UnkStruct_ov98_02246E88 * param0) +{ + int v0[4]; + + v0[0] = 4; + v0[1] = 4; + v0[2] = 4; + v0[3] = 4; + + param0->unk_98 = sub_02089400(108, 16, v0, sub_02025E44(param0->unk_04), 4, 0); + return param0->unk_98; +} + +void ov98_02246FFC (UnkStruct_ov98_02246E88 * param0) +{ + UnkStruct_02089438 * v0 = param0->unk_98; + if (ov98_02249A80(v0->unk_1C, 108)) { + ov98_02246FAC(param0, 1); + } else if (ov98_02246FB4(param0) == 2) { + if (Strbuf_Compare(param0->unk_114, v0->unk_1C) != 0) { + ov98_02246FAC(param0, 3); + } else { + ov98_02246FAC(param0, 0); + } + } else { + Strbuf_Copy(param0->unk_114, v0->unk_1C); + ov98_02246FAC(param0, 2); + } + + sub_02089438(v0); + ov98_02246E88(param0, 0, 0); +} + +void * ov98_02247070 (UnkStruct_ov98_02246E88 * param0) +{ + int v0[4]; + + v0[0] = 3; + v0[1] = 4; + v0[2] = 0; + v0[3] = 0; + + param0->unk_98 = sub_0208941C(108, 7, v0, sub_02025E44(param0->unk_04), 5, 1, 1, param0->unk_7C); + return param0->unk_98; +} + +void ov98_022470B8 (UnkStruct_ov98_02246E88 * param0) { - push {r4, lr} - sub sp, #0x18 - add r4, r0, #0 - mov r0, #4 - str r0, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - str r0, [sp, #0x10] - str r0, [sp, #0x14] - ldr r0, [r4, #4] - bl sub_02025E44 - add r3, r0, #0 - mov r0, #6 - str r0, [sp] - mov r0, #0 - str r0, [sp, #4] - mov r0, #0x6c - mov r1, #4 - add r2, sp, #8 - bl sub_02089400 - add r1, r4, #0 - add r1, #0x94 - add r4, #0x94 - str r0, [r1, #0] - ldr r0, [r4, #0] - add sp, #0x18 - pop {r4, pc} -} - -asm void ov98_02247134 (UnkStruct_ov98_02246E88 * param0) + UnkStruct_02089438 * v0 = param0->unk_98; + BOOL v1; + param0->unk_10C = Strbuf_AtoI(v0->unk_1C, &v1) % 10000; + GF_ASSERT(v1); + sub_02089438(v0); + ov98_02246E88(param0, 0, 0); +} + +void * ov98_022470F8 (UnkStruct_ov98_02246E88 * param0) +{ + int v0[4]; + + v0[0] = 4; + v0[1] = 0; + v0[2] = 0; + v0[3] = 0; + + param0->unk_98 = sub_02089400(108, 4, v0, sub_02025E44(param0->unk_04), 6, 0); + return param0->unk_98; +} + +void ov98_02247134 (UnkStruct_ov98_02246E88 * param0) { - push {r3, r4, r5, lr} - add r5, r0, #0 - add r0, #0x94 - ldr r4, [r0, #0] - add r1, sp, #0 - ldr r0, [r4, #0x1c] - bl Strbuf_AtoI - mov r1, #0x41 - lsl r1, r1, #2 - str r0, [r5, r1] - ldr r0, [sp] - cmp r0, #0 - bne _02247154 - bl ErrorHandling_AssertFail - _02247154: - add r0, r4, #0 - bl sub_02089438 - mov r1, #0 - add r0, r5, #0 - add r2, r1, #0 - bl ov98_02246E88 - pop {r3, r4, r5, pc} + UnkStruct_02089438 * v0 = param0->unk_98; + BOOL v1; + param0->unk_108 = Strbuf_AtoI(v0->unk_1C, &v1); + GF_ASSERT(v1); + sub_02089438(v0); + ov98_02246E88(param0, 0, 0); } static void * ov98_02247168 (UnkStruct_ov98_02246E88 * param0) diff --git a/src/overlay098/ov98_022471C8.c b/src/overlay098/ov98_022471C8.c index 12c1cc7b50..d281a74c03 100644 --- a/src/overlay098/ov98_022471C8.c +++ b/src/overlay098/ov98_022471C8.c @@ -985,66 +985,24 @@ static void ov98_02247FBC (UnkStruct_ov98_02247704 * param0) } } -asm static void ov98_022482CC (UnkStruct_ov98_02247704 * param0) +static void ov98_022482CC (UnkStruct_ov98_02247704 * param0) { - push {r4, r5, r6, r7, lr} - sub sp, #0x14 - add r7, r0, #0 - add r0, #0xc4 - mov r1, #0xf - bl BGL_FillWindow - ldr r0, [r7, #0x34] - mov r1, #0x2c - bl MessageLoader_GetNewStrbuf - str r0, [sp, #0xc] - bl Strbuf_Length - mov r1, #0x6d - bl Strbuf_Init - add r6, r0, #0 - add r0, r7, #0 - add r0, #0xac - ldr r4, [r0, #0] - add r0, r4, #6 - cmp r4, r0 - bge _02248336 - add r0, r7, #0 - str r0, [sp, #0x10] - add r0, #0xc4 - mov r5, #0 - str r0, [sp, #0x10] - _02248306: - ldr r1, [sp, #0xc] - add r0, r6, #0 - add r2, r4, #0 - bl Strbuf_CopyLineNum - str r5, [sp] - mov r0, #0xff - str r0, [sp, #4] - mov r0, #0 - str r0, [sp, #8] - ldr r0, [sp, #0x10] - mov r1, #0 - add r2, r6, #0 - mov r3, #4 - bl sub_0201D738 - add r0, r7, #0 - add r0, #0xac - ldr r0, [r0, #0] - add r4, r4, #1 - add r0, r0, #6 - add r5, #0x10 - cmp r4, r0 - blt _02248306 - _02248336: - ldr r0, [sp, #0xc] - bl Strbuf_Free - add r0, r6, #0 - bl Strbuf_Free - add r7, #0xc4 - add r0, r7, #0 - bl sub_0201A954 - add sp, #0x14 - pop {r4, r5, r6, r7, pc} + int v0; + int v1 = 0; + Strbuf* v2; + Strbuf* v3; + + BGL_FillWindow(¶m0->unk_C4, 0x0f0f); + v2 = MessageLoader_GetNewStrbuf(param0->unk_34, 44); + v3 = Strbuf_Init(Strbuf_Length(v2), 109); + for (v0 = param0->unk_AC; v0 < param0->unk_AC + 6; v0++) { + Strbuf_CopyLineNum(v3, v2, v0); + sub_0201D738(¶m0->unk_C4, 0, v3, 4, v1 * 16, 0xFF, NULL); + v1++; + } + Strbuf_Free(v2); + Strbuf_Free(v3); + sub_0201A954(¶m0->unk_C4); } asm static int ov98_02248350 (UnkStruct_ov98_02247704 * param0) @@ -1500,39 +1458,23 @@ static int ov98_022487AC (UnkStruct_ov98_02247704 * param0) return 0; } -asm static int ov98_022487CC (UnkStruct_ov98_02247704 * param0) -{ - push {r4, lr} - add r4, r0, #0 - ldr r0, [r4, #0] - bl ov98_02246FB4 - cmp r0, #1 - beq _022487E4 - cmp r0, #2 - beq _022487EA - cmp r0, #3 - beq _022487EA - b _022487F2 - _022487E4: - mov r0, #0 - str r0, [r4, #8] - pop {r4, pc} - _022487EA: - mov r0, #0x25 - str r0, [r4, #8] - mov r0, #0 - pop {r4, pc} - _022487F2: - add r0, r4, #0 - add r0, #0x94 - ldr r0, [r0, #0] - cmp r0, #0 - bne _02248800 - mov r0, #7 - str r0, [r4, #8] - _02248800: - mov r0, #0 - pop {r4, pc} +static int ov98_022487CC (UnkStruct_ov98_02247704 * param0) +{ + charcode_t * v0; + switch (ov98_02246FB4(param0->unk_00)) { + case 1: + param0->unk_08 = 0; + return 0; + case 2: + case 3: + param0->unk_08 = 37; + return 0; + } + + if (param0->unk_94 == 0) + param0->unk_08 = 7; + + return 0; } static int ov98_02248804 (UnkStruct_ov98_02247704 * param0) @@ -2487,137 +2429,53 @@ static int ov98_0224977C (int param0) return 1; } -asm static int ov98_02249798 (UnkStruct_ov98_02247704 * param0) +static int ov98_02249798 (UnkStruct_ov98_02247704 * param0) { - push {r3, r4, lr} - sub sp, #4 - add r4, r0, #0 - ldr r0, [r4, #0x44] - bl ov98_0224977C - cmp r0, #1 - bne _022497AE - add sp, #4 - mov r0, #0 - pop {r3, r4, pc} - _022497AE: - add r0, r4, #0 - add r0, #0x94 - ldr r0, [r0, #0] - cmp r0, #0 - beq _022497BE - cmp r0, #1 - beq _022497EA - b _022497EE - _022497BE: - ldr r0, [r4, #0] - bl ov98_02246FB4 - cmp r0, #2 - bne _022497CC - mov r2, #0x26 - b _022497CE - _022497CC: - mov r2, #0x27 - _022497CE: - ldr r0, = 0xF0F - mov r3, #1 - str r0, [sp] - ldr r1, [r4, #0x34] - add r0, r4, #0 - bl ov98_02249714 - add r0, r4, #0 - add r0, #0x94 - ldr r0, [r0, #0] - add r4, #0x94 - add r0, r0, #1 - str r0, [r4, #0] - b _022497EE - _022497EA: - mov r0, #5 - str r0, [r4, #8] - _022497EE: - mov r0, #0 - add sp, #4 - pop {r3, r4, pc} + if (ov98_0224977C(param0->unk_44) == 1) + return 0; + + switch (param0->unk_94) { + case 0: + ov98_02249714(param0, param0->unk_34, ov98_02246FB4(param0->unk_00) == 2 ? 0x26 : 0x27, 1, 0x0F0F); + param0->unk_94++; + break; + case 1: + param0->unk_08 = 5; + break; + } + + return 0; } -asm static int ov98_022497F8 (UnkStruct_ov98_02247704 * param0) +static int ov98_022497F8 (UnkStruct_ov98_02247704 * param0) { - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x18 - add r6, r0, #0 - ldr r0, [r6, #0x44] - ldr r4, [r6, #0] - bl ov98_0224977C - cmp r0, #1 - bne _02249810 - add sp, #0x18 - mov r0, #0 - pop {r3, r4, r5, r6, r7, pc} - _02249810: - add r0, r6, #0 - add r0, #0x94 - ldr r0, [r0, #0] - cmp r0, #0 - beq _02249820 - cmp r0, #1 - beq _02249884 - b _02249888 - _02249820: - add r0, r4, #0 - bl ov98_02246FA4 - add r5, r0, #0 - ldr r0, [r4, #4] - mov r1, #3 - bl sub_02030D98 - cmp r5, r0 - bne _02249866 - ldr r0, [r4, #4] - bl sub_02030D50 - add r1, sp, #8 - mov r2, #0x6c - bl ov98_02249ACC - mov r4, #0 - add r5, sp, #8 - mov r7, #2 - _02249848: - str r7, [sp] - mov r0, #1 - str r0, [sp, #4] - ldr r0, [r6, #0x20] - ldr r2, [r5, #0] - add r1, r4, #0 - mov r3, #4 - bl sub_0200B60C - add r4, r4, #1 - add r5, r5, #4 - cmp r4, #4 - blo _02249848 - mov r2, #0x29 - b _02249868 - _02249866: - mov r2, #0x28 - _02249868: - ldr r0, = 0xF0F - mov r3, #1 - str r0, [sp] - ldr r1, [r6, #0x34] - add r0, r6, #0 - bl ov98_02249714 - add r0, r6, #0 - add r0, #0x94 - ldr r0, [r0, #0] - add r6, #0x94 - add r0, r0, #1 - str r0, [r6, #0] - b _02249888 - _02249884: - mov r0, #0 - str r0, [r6, #8] - _02249888: - mov r0, #0 - add sp, #0x18 - pop {r3, r4, r5, r6, r7, pc} - nop + UnkStruct_ov98_02246E88 * v0 = param0->unk_00; + int v1; + u32 v2[4]; + u32 v3; + + if (ov98_0224977C(param0->unk_44) == 1) + return 0; + + switch (param0->unk_94) { + case 0: + if (ov98_02246FA4(v0) == sub_02030D98(v0->unk_04, 3)) { + ov98_02249ACC(sub_02030D50(v0->unk_04), v2, 108); + for (v3 = 0; v3 < 4; v3++) + sub_0200B60C(param0->unk_20, v3, v2[v3], 4, 2, 1); + v1 = 41; + } else { + v1 = 40; + } + ov98_02249714(param0, param0->unk_34, v1, 1, 0x0F0F); + param0->unk_94++; + break; + case 1: + param0->unk_08 = 0; + break; + } + + return 0; } static int ov98_02249894 (Window * param0, Strbuf *param1, int param2, int param3, u32 param4, int param5) diff --git a/src/overlay098/ov98_022499C8.c b/src/overlay098/ov98_022499C8.c index 379a574fc7..06a577155f 100644 --- a/src/overlay098/ov98_022499C8.c +++ b/src/overlay098/ov98_022499C8.c @@ -3,15 +3,12 @@ #include #include "strbuf.h" - +#include "charcode.h" #include "heap.h" #include "error_handling.h" #include "strbuf.h" #include "overlay098/ov98_022499C8.h" -static const char Unk_ov98_02249D1C[] = "w"; -static const char Unk_ov98_02249D20[] = "@wii.com"; - static const struct { u16 unk_00; char unk_02; @@ -28,189 +25,83 @@ static const struct { {0x12a, '9'}, }; -asm void ov98_022499C8 (Strbuf *param0, char * param1, int param2) -{ - push {r3, r4, r5, r6, r7, lr} - sub sp, #8 - add r7, r2, #0 - mov r4, #0 - add r5, r1, #0 - ldr r2, = Unk_ov98_02249D1C - str r0, [sp] - add r1, r4, #0 - add r0, r2, #0 - add r3, r4, #0 - _022499DC: - add r6, r1, #0 - ldrsb r6, [r0, r6] - add r2, r2, #1 - add r1, r1, #1 - strb r6, [r5, r4] - ldrsb r6, [r2, r3] - add r4, r4, #1 - cmp r6, #0 - bne _022499DC - add r0, r7, #0 - mov r1, #0xc8 - bl Heap_AllocFromHeap - str r0, [sp, #4] - ldr r0, [sp] - ldr r1, [sp, #4] - mov r2, #0x64 - bl Strbuf_ToChars - ldr r7, [sp, #4] - mov r6, #0 - _02249A06: - ldrh r1, [r7] - ldr r0, = 0xFFFF - cmp r1, r0 - bne _02249A14 - mov r2, #0 - strb r2, [r5, r4] - b _02249A4A - _02249A14: - ldr r2, [sp, #4] - lsl r3, r6, #1 - ldrh r3, [r2, r3] - ldr r1, = Unk_ov98_02249D2C - mov r0, #0 - _02249A1E: - ldrh r2, [r1] - cmp r2, r3 - bne _02249A32 - ldr r1, = Unk_ov98_02249D2C - lsl r2, r0, #2 - add r2, r1, r2 - mov r1, #2 - ldrsb r1, [r2, r1] - strb r1, [r5, r4] - b _02249A3A - _02249A32: - add r0, r0, #1 - add r1, r1, #4 - cmp r0, #0xa - blo _02249A1E - _02249A3A: - cmp r0, #0xa - blo _02249A42 - bl ErrorHandling_AssertFail - _02249A42: - add r4, r4, #1 - add r7, r7, #2 - add r6, r6, #1 - b _02249A06 - _02249A4A: - ldr r1, = Unk_ov98_02249D20 - add r3, r2, #0 - add r0, r1, #0 - _02249A50: - add r6, r2, #0 - ldrsb r6, [r0, r6] - add r1, r1, #1 - add r2, r2, #1 - strb r6, [r5, r4] - ldrsb r6, [r1, r3] - add r4, r4, #1 - cmp r6, #0 - bne _02249A50 - mov r0, #0 - strb r0, [r5, r4] - ldr r0, [sp, #4] - bl Heap_FreeToHeap - add sp, #8 - pop {r3, r4, r5, r6, r7, pc} +void ov98_022499C8 (Strbuf *param0, char * param1, int param2) +{ + static const char Unk_ov98_02249D1C[] = "w"; + static const char Unk_ov98_02249D20[] = "@wii.com"; + int v0; + charcode_t * v1; + int v2 = 0, v3; + + for (v0 = 0; Unk_ov98_02249D1C[v0]; v2++) + param1[v2] = Unk_ov98_02249D1C[v0++]; + + v1 = Heap_AllocFromHeap(param2, sizeof(charcode_t) * 100); + Strbuf_ToChars(param0, v1, 100); + + v0 = 0; + while (1) { + if (v1[v0] == CHAR_EOS) { + param1[v2] = '\0'; + break; + } + for (v3 = 0; v3 < NELEMS(Unk_ov98_02249D2C); v3++) { + if (Unk_ov98_02249D2C[v3].unk_00 == v1[v0]) { + param1[v2] = Unk_ov98_02249D2C[v3].unk_02; + break; + } + } + GF_ASSERT(v3 < NELEMS(Unk_ov98_02249D2C)); + v2++; + v0++; + } + + for (v0 = 0; Unk_ov98_02249D20[v0]; v2++) + param1[v2] = Unk_ov98_02249D20[v0++]; + param1[v2] = '\0'; + Heap_FreeToHeap(v1); } -asm void ov98_02249A80 (void) -{ - push {r4, r5, r6, lr} - add r6, r0, #0 - add r0, r1, #0 - mov r1, #0xc8 - mov r5, #1 - bl Heap_AllocFromHeap - add r4, r0, #0 - add r0, r6, #0 - add r1, r4, #0 - mov r2, #0x64 - bl Strbuf_ToChars - ldrh r1, [r4] - ldr r0, = 0xFFFF - cmp r1, r0 - beq _02249AB8 - ldr r1, = 0x121 - add r3, r4, #0 - _02249AA6: - ldrh r2, [r3] - cmp r2, r1 - beq _02249AB0 - mov r5, #0 - b _02249AB8 - _02249AB0: - add r3, r3, #2 - ldrh r2, [r3] - cmp r2, r0 - bne _02249AA6 - _02249AB8: - add r0, r4, #0 - bl Heap_FreeToHeap - add r0, r5, #0 - pop {r4, r5, r6, pc} - nop +int ov98_02249A80 (Strbuf *param0, int param1) +{ + charcode_t * v0; + BOOL v1 = TRUE; + int v2; + + v0 = Heap_AllocFromHeap(param1, sizeof(charcode_t) * 100); + Strbuf_ToChars(param0, v0, 100); + + for (v2 = 0; v0[v2] != CHAR_EOS; v2++) { + if (v0[v2] != CHAR_EN_0) { + v1 = FALSE; + break; + } + } + + Heap_FreeToHeap(v0); + return v1; } -asm void ov98_02249ACC (void) +void ov98_02249ACC (const char * param0, u32 * param1, int param2) { - push {r3, r4, r5, r6, r7, lr} - sub sp, #8 - mov r4, #0 - add r5, r0, #0 - add r7, r1, #0 - str r4, [sp, #4] - _02249AD8: - mov r0, #0 - str r0, [r7, #0] - str r0, [sp] - b _02249B14 - _02249AE0: - cmp r0, #0 - bne _02249AEC - bne _02249AFA - bl ErrorHandling_AssertFail - b _02249AFA - _02249AEC: - add r4, r4, #1 - _02249AEE: - ldrsb r0, [r5, r4] - add r6, r5, r4 - cmp r0, #0x30 - blt _02249AE0 - cmp r0, #0x39 - bgt _02249AE0 - _02249AFA: - ldr r1, [r7, #0] - mov r0, #0xa - mul r0, r1 - str r0, [r7, #0] - mov r1, #0 - ldrsb r1, [r6, r1] - add r4, r4, #1 - sub r1, #0x30 - add r0, r0, r1 - str r0, [r7, #0] - ldr r0, [sp] - add r0, r0, #1 - str r0, [sp] - _02249B14: - ldr r0, [sp] - cmp r0, #4 - blt _02249AEE - ldr r0, [sp, #4] - add r7, r7, #4 - add r0, r0, #1 - str r0, [sp, #4] - cmp r0, #4 - blt _02249AD8 - add sp, #8 - pop {r3, r4, r5, r6, r7, pc} + int v0, v1; + int v2 = 0; + const char * v3; + + for (v0 = 0; v0 < 4; v0++) { + param1[v0] = 0; + for (v1 = 0; v1 < 4; v1++) { + while (param0[v2] < '0' || param0[v2] > '9') { + if (param0[v2] == '\0') { + GF_ASSERT(param0[v2] != '\0'); + break; + } + v2++; + } + v3 = ¶m0[v2]; + param1[v0] *= 10; + param1[v0] += *v3 - '0'; + v2++; + } + } } diff --git a/src/overlay104/ov104_0222FBE4.c b/src/overlay104/ov104_0222FBE4.c index c773c75062..0e3f8b9eae 100644 --- a/src/overlay104/ov104_0222FBE4.c +++ b/src/overlay104/ov104_0222FBE4.c @@ -2887,30 +2887,19 @@ static BOOL ov104_02231F34 (UnkStruct_ov104_0222E930 * param0) return 0; } -static asm BOOL ov104_02231F44 (UnkStruct_ov104_0222E930 * param0) -{ - push {r3, lr} - ldr r2, [r0, #0x1c] - ldr r3, [r0, #0] - add r1, r2, #1 - str r1, [r0, #0x1c] - ldrb r1, [r2] - ldr r0, [r3, #0x60] - bl ov104_0223327C - mov r0, #1 - pop {r3, pc} -} - -static asm BOOL ov104_02231F5C (UnkStruct_ov104_0222E930 * param0) -{ - push {r3, lr} - ldr r2, [r0, #0x1c] - ldr r3, [r0, #0] - add r1, r2, #1 - str r1, [r0, #0x1c] - ldrb r1, [r2] - ldr r0, [r3, #0x60] - bl ov104_02233298 - mov r0, #1 - pop {r3, pc} +static BOOL ov104_02231F44 (UnkStruct_ov104_0222E930 * param0) +{ + UnkStruct_ov104_022320B4 * v0 = param0->unk_00; + u8 v1 = *(param0->unk_1C++); + ov104_0223327C(v0->unk_60, v1); + return 1; +} + + +static BOOL ov104_02231F5C (UnkStruct_ov104_0222E930 * param0) +{ + UnkStruct_ov104_022320B4 * v0 = param0->unk_00; + u8 v1 = *(param0->unk_1C++); + ov104_02233298(v0->unk_60, v1); + return 1; } diff --git a/src/overlay104/ov104_02231F74.c b/src/overlay104/ov104_02231F74.c index e5219d728a..4c6d190ef2 100644 --- a/src/overlay104/ov104_02231F74.c +++ b/src/overlay104/ov104_02231F74.c @@ -84,7 +84,9 @@ typedef struct UnkStruct_ov104_02232B5C_t { u8 unk_96; u8 unk_97_0 : 1; u8 unk_97_1 : 1; - u8 unk_97_2 : 6; + u8 unk_97_2 : 4; + u8 unk_97_6 : 1; + u8 unk_97_7 : 1; u8 unk_98; u8 unk_99; u8 unk_9A; @@ -139,8 +141,8 @@ static void ov104_02232B2C(UnkStruct_ov104_02232B5C * param0); void ov104_02232B5C(UnkStruct_ov104_02232B5C * param0); void ov104_022330FC(UnkStruct_ov104_0222E930 * param0, u16 * param1); void ov104_0223310C(UnkStruct_ov104_0222E930 * param0, u16 * param1, u32 param2); -extern void ov104_0223327C(void); -extern void ov104_02233298(void); +extern void ov104_0223327C(UnkStruct_ov104_02232B5C * param0, int param1); +extern void ov104_02233298(UnkStruct_ov104_02232B5C * param0, int param1); void ov104_02231F74 (UnkStruct_ov104_022320B4 * param0, const MessageLoader * param1, u16 param2, u8 param3, UnkStruct_ov104_0222FEDC * param4) { @@ -311,112 +313,28 @@ void ov104_022322A8 (UnkStruct_ov104_02232B5C * param0, u32 param1, u32 param2, return; } -asm void ov104_022322B0 (UnkStruct_ov104_02232B5C * param0) +void ov104_022322B0 (UnkStruct_ov104_02232B5C * param0) { - push {r4, r5, lr} - sub sp, #0x14 - add r5, r0, #0 - ldr r0, [r5, #0] - bl ov104_0222E924 - add r4, r0, #0 - add r0, r5, #0 - bl ov104_02232414 - mov r1, #7 - tst r1, r0 - bne _022322CE - lsr r0, r0, #3 - b _022322D2 - _022322CE: - lsr r0, r0, #3 - add r0, r0, #1 - _022322D2: - add r1, r5, #0 - add r1, #0x97 - ldrb r1, [r1] - lsl r1, r1, #0x19 - lsr r1, r1, #0x1f - beq _022322EC - add r1, r5, #0 - add r1, #0x98 - ldrb r1, [r1] - sub r2, r1, r0 - add r1, r5, #0 - add r1, #0x98 - strb r2, [r1] - _022322EC: - add r1, r5, #0 - add r1, #0x97 - ldrb r1, [r1] - lsl r1, r1, #0x18 - lsr r1, r1, #0x1f - beq _0223230E - add r1, r5, #0 - add r1, #0x99 - ldrb r2, [r1] - add r1, r5, #0 - add r1, #0x9b - ldrb r1, [r1] - lsl r1, r1, #1 - sub r2, r2, r1 - add r1, r5, #0 - add r1, #0x99 - strb r2, [r1] - _0223230E: - add r1, r5, #0 - add r1, #0x99 - ldrb r1, [r1] - lsl r0, r0, #0x18 - add r3, r5, #0 - str r1, [sp] - lsr r0, r0, #0x18 - str r0, [sp, #4] - add r0, r5, #0 - add r0, #0x9b - ldrb r0, [r0] - add r1, r5, #0 - mov r2, #1 - lsl r0, r0, #0x19 - lsr r0, r0, #0x18 - str r0, [sp, #8] - mov r0, #0xe - str r0, [sp, #0xc] - str r2, [sp, #0x10] - add r3, #0x98 - ldrb r3, [r3] - ldr r0, [r4, #0] - add r1, #8 - bl BGL_AddWindow - add r0, r5, #0 - ldr r2, = 0x3D9 - add r0, #8 - mov r1, #1 - mov r3, #0xc - bl Window_Show - add r0, r5, #0 - bl ov104_02232454 - ldr r2, [r5, #0] - add r1, r5, #0 - add r1, #0x96 - ldr r2, [r2, #0x34] - add r0, r5, #0 - lsl r2, r2, #0x18 - ldrb r1, [r1] - add r0, #0xa4 - lsr r2, r2, #0x18 - bl sub_02001B9C - add r1, r5, #0 - add r1, #0xb0 - str r0, [r1, #0] - add r0, r5, #0 - bl ov104_022325D8 - ldr r0, = ov104_022324C8 - add r1, r5, #0 - mov r2, #0 - bl SysTask_Start - str r0, [r5, #4] - add sp, #0x14 - pop {r4, r5, pc} - nop + u32 v0; + UnkStruct_ov104_0223C4CC * v1 = ov104_0222E924(param0->unk_00); + + v0 = ov104_02232414(param0); + if (v0 % 8 == 0) + v0 /= 8; + else + v0 = v0 / 8 + 1; + + if (param0->unk_97_6) + param0->unk_98 -= v0; + if (param0->unk_97_7) + param0->unk_99 -= param0->unk_9B * 2; + + BGL_AddWindow(v1->unk_00, ¶m0->unk_08, 1, param0->unk_98, param0->unk_99, v0, param0->unk_9B * 2, 14, 1); + Window_Show(¶m0->unk_08, 1, 985, 12); + ov104_02232454(param0); + param0->unk_B0 = sub_02001B9C(¶m0->unk_A4, param0->unk_96, param0->unk_00->unk_34); + ov104_022325D8(param0); + param0->unk_04 = SysTask_Start(ov104_022324C8, param0, 0); } static void ov104_02232390 (UnkStruct_ov104_02232B5C * param0, u32 param1, u32 param2, u32 param3) @@ -571,152 +489,34 @@ void ov104_0223261C (UnkStruct_ov104_02232B5C * param0, u32 param1, u32 param2, return; } -asm void ov104_02232624 (UnkStruct_ov104_02232B5C * param0) +void ov104_02232624 (UnkStruct_ov104_02232B5C * param0) { - push {r4, r5, lr} - sub sp, #0x14 - add r5, r0, #0 - ldr r0, [r5, #0] - bl ov104_0222E924 - add r4, r0, #0 - add r0, r5, #0 - bl ov104_022327F0 - mov r1, #7 - tst r1, r0 - bne _02232642 - lsr r1, r0, #3 - b _02232646 - _02232642: - lsr r0, r0, #3 - add r1, r0, #1 - _02232646: - add r0, r5, #0 - add r0, #0x97 - ldrb r0, [r0] - lsl r0, r0, #0x19 - lsr r0, r0, #0x1f - beq _02232660 - add r0, r5, #0 - add r0, #0x98 - ldrb r0, [r0] - sub r2, r0, r1 - add r0, r5, #0 - add r0, #0x98 - strb r2, [r0] - _02232660: - add r0, r5, #0 - add r0, #0x9b - ldrb r0, [r0] - cmp r0, #8 - bls _022326B0 - add r0, r5, #0 - add r0, #0x97 - ldrb r0, [r0] - lsl r0, r0, #0x18 - lsr r0, r0, #0x1f - beq _02232684 - add r0, r5, #0 - add r0, #0x99 - ldrb r2, [r0] - add r0, r5, #0 - add r0, #0x99 - sub r2, #0x10 - strb r2, [r0] - _02232684: - add r0, r5, #0 - add r0, #0x99 - ldrb r0, [r0] - add r3, r5, #0 - mov r2, #1 - str r0, [sp] - lsl r0, r1, #0x18 - lsr r0, r0, #0x18 - str r0, [sp, #4] - mov r0, #0x10 - str r0, [sp, #8] - mov r0, #0xe - str r0, [sp, #0xc] - str r2, [sp, #0x10] - add r3, #0x98 - add r1, r5, #0 - ldrb r3, [r3] - ldr r0, [r4, #0] - add r1, #8 - bl BGL_AddWindow - b _022326FE - _022326B0: - add r2, r5, #0 - add r2, #0x97 - ldrb r2, [r2] - lsl r2, r2, #0x18 - lsr r2, r2, #0x1f - beq _022326CC - add r2, r5, #0 - add r2, #0x99 - ldrb r2, [r2] - lsl r0, r0, #1 - sub r2, r2, r0 - add r0, r5, #0 - add r0, #0x99 - strb r2, [r0] - _022326CC: - add r0, r5, #0 - add r0, #0x99 - ldrb r0, [r0] - add r3, r5, #0 - mov r2, #1 - str r0, [sp] - lsl r0, r1, #0x18 - lsr r0, r0, #0x18 - str r0, [sp, #4] - add r0, r5, #0 - add r0, #0x9b - ldrb r0, [r0] - add r1, r5, #0 - add r3, #0x98 - lsl r0, r0, #0x19 - lsr r0, r0, #0x18 - str r0, [sp, #8] - mov r0, #0xe - str r0, [sp, #0xc] - str r2, [sp, #0x10] - ldrb r3, [r3] - ldr r0, [r4, #0] - add r1, #8 - bl BGL_AddWindow - _022326FE: - add r0, r5, #0 - ldr r2, = 0x3D9 - add r0, #8 - mov r1, #1 - mov r3, #0xc - bl Window_Show - add r0, r5, #0 - bl ov104_02232830 - ldr r3, [r5, #0] - add r2, r5, #0 - add r2, #0x96 - ldr r3, [r3, #0x34] - mov r0, #0x65 - lsl r0, r0, #2 - lsl r3, r3, #0x18 - ldrb r2, [r2] - add r0, r5, r0 - mov r1, #0 - lsr r3, r3, #0x18 - bl sub_0200112C - mov r1, #0x6d - lsl r1, r1, #2 - str r0, [r5, r1] - add r0, r5, #0 - bl ov104_02232B2C - ldr r0, = ov104_0223296C - add r1, r5, #0 - mov r2, #0 - bl SysTask_Start - str r0, [r5, #4] - add sp, #0x14 - pop {r4, r5, pc} + u32 v0; + UnkStruct_ov104_0223C4CC * v1 = ov104_0222E924(param0->unk_00); + + v0 = ov104_022327F0(param0); + if (v0 % 8 == 0) + v0 /= 8; + else + v0 = v0 / 8 + 1; + + if (param0->unk_97_6) + param0->unk_98 -= v0; + + if (param0->unk_9B > 8) { + if (param0->unk_97_7) + param0->unk_99 -= 8 * 2; + BGL_AddWindow(v1->unk_00, ¶m0->unk_08, 1, param0->unk_98, param0->unk_99, v0, 8 * 2, 14, 1); + } else { + if (param0->unk_97_7) + param0->unk_99 -= param0->unk_9B * 2; + BGL_AddWindow(v1->unk_00, ¶m0->unk_08, 1, param0->unk_98, param0->unk_99, v0, param0->unk_9B * 2, 14, 1); + } + Window_Show(¶m0->unk_08, 1, 985, 12); + ov104_02232830(param0); + param0->unk_1B4 = sub_0200112C((const UnkStruct_ov84_02240FA8 *)¶m0->unk_194, 0, param0->unk_96, param0->unk_00->unk_34); + ov104_02232B2C(param0); + param0->unk_04 = SysTask_Start(ov104_0223296C, param0, 0); } static void ov104_02232750 (UnkStruct_ov104_02232B5C * param0, u32 param1, u32 param2, u32 param3) @@ -1356,36 +1156,12 @@ void ov104_022331E8 (SysTask * param0, void * param1) } } -asm void ov104_0223327C (void) +void ov104_0223327C(UnkStruct_ov104_02232B5C * param0, int param1) { - add r2, r0, #0 - add r2, #0x97 - ldrb r3, [r2] - lsl r1, r1, #0x18 - lsr r1, r1, #0x18 - mov r2, #0x40 - lsl r1, r1, #0x1f - bic r3, r2 - lsr r1, r1, #0x19 - orr r1, r3 - add r0, #0x97 - strb r1, [r0] - bx lr + param0->unk_97_6 = param1; } -asm void ov104_02233298 (void) +void ov104_02233298(UnkStruct_ov104_02232B5C * param0, int param1) { - add r2, r0, #0 - add r2, #0x97 - ldrb r3, [r2] - lsl r1, r1, #0x18 - lsr r1, r1, #0x18 - mov r2, #0x80 - lsl r1, r1, #0x1f - bic r3, r2 - lsr r1, r1, #0x18 - orr r1, r3 - add r0, #0x97 - strb r1, [r0] - bx lr + param0->unk_97_7 = param1; } diff --git a/src/overlay105/ov105_02241AE0.c b/src/overlay105/ov105_02241AE0.c index acbc016265..f15f4694d1 100644 --- a/src/overlay105/ov105_02241AE0.c +++ b/src/overlay105/ov105_02241AE0.c @@ -1761,78 +1761,17 @@ static void ov105_02243D84 (UnkStruct_ov105_02241FF4 * param0) return; } -asm static void ov105_02243DE4 (UnkStruct_ov105_02241FF4 * param0) -{ - push {r4, lr} - sub sp, #0x18 - add r4, r0, #0 - mov r0, #0xab - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl ov105_02246060 - mov r0, #0xab - mov r1, #0 - lsl r0, r0, #2 - str r1, [r4, r0] - sub r0, r0, #4 - ldr r0, [r4, r0] - bl ov105_022461A4 - add r1, r4, #0 - ldr r0, [r4, #0x4c] - add r1, #0xc0 - bl ov105_02246260 - mov r3, #1 - add r1, r4, #0 - str r3, [sp] - mov r0, #0xff - str r0, [sp, #4] - str r3, [sp, #8] - mov r0, #2 - str r0, [sp, #0xc] - mov r0, #0xf - str r0, [sp, #0x10] - mov r0, #0 - str r0, [sp, #0x14] - add r0, r4, #0 - add r1, #0xc0 - mov r2, #0x17 - bl ov105_02244C60 - strb r0, [r4, #0x10] - mov r0, #0x11 - str r0, [sp] - mov r0, #0xff - str r0, [sp, #4] - mov r3, #1 - add r1, r4, #0 - str r3, [sp, #8] - mov r0, #2 - str r0, [sp, #0xc] - mov r0, #0xf - str r0, [sp, #0x10] - mov r0, #0 - str r0, [sp, #0x14] - add r0, r4, #0 - add r1, #0xc0 - mov r2, #0x18 - bl ov105_02244CC0 - strb r0, [r4, #0x10] - mov r0, #0x4e - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl sub_02027B50 - add r1, r0, #0 - add r0, r4, #0 - add r0, #0xa0 - bl ov105_0224628C - add r0, r4, #0 - mov r1, #0xd - bl ov105_02244D14 - strb r0, [r4, #0x10] - add r4, #0xc0 - add r0, r4, #0 - bl sub_0201A9A4 - add sp, #0x18 - pop {r4, pc} +static void ov105_02243DE4 (UnkStruct_ov105_02241FF4 * param0) +{ + ov105_02246060(param0->unk_310); + param0->unk_310 = NULL; + ov105_022461A4(param0->unk_30C, 0); + ov105_02246260(param0->unk_4C, ¶m0->unk_50[7]); + param0->unk_10 = ov105_02244C60(param0, ¶m0->unk_50[7], 23, 1, 1, 0xFF, 1, 2, 15, 0); + param0->unk_10 = ov105_02244CC0(param0, ¶m0->unk_50[7], 24, 1, 1 + 16, 0xFF, 1, 2, 15, 0); + ov105_0224628C(¶m0->unk_50[5], sub_02027B50(param0->unk_138)); + param0->unk_10 = ov105_02244D14(param0, 13); + sub_0201A9A4(¶m0->unk_50[7]); } static BOOL ov105_02243E84 (UnkStruct_ov105_02241FF4 * param0) diff --git a/src/overlay107/ov107_02241AE0.c b/src/overlay107/ov107_02241AE0.c index 677648e479..0b302f2978 100644 --- a/src/overlay107/ov107_02241AE0.c +++ b/src/overlay107/ov107_02241AE0.c @@ -324,12 +324,12 @@ static void ov107_022436F4(UnkStruct_ov107_02241D6C * param0, u32 param1); static void ov107_02243678(void); static void ov107_0224373C(UnkStruct_ov107_02241D6C * param0, u32 param1); static u8 ov107_0224379C(UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9); -static u8 ov107_022437CC(UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9); +static u8 ov107_022437CC(UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9, int param10); static u8 ov107_02243860(UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9); static u8 ov107_02243890(UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9, u32 param10); static u8 ov107_02243918(UnkStruct_ov107_02241D6C * param0, int param1, u8 param2); static void ov107_02243950(UnkStruct_ov107_02241D6C * param0, Window * param1, Pokemon * param2); -static void ov107_02243B5C(UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u16 param3, u16 param4); +static void ov107_02243B5C(UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u16 param3, u16 param4, int param5); static void ov107_02243B84(UnkStruct_ov107_02241D6C * param0, Window * param1, Pokemon * param2); static void ov107_02243C18(UnkStruct_ov107_02241D6C * param0, Window * param1, u8 param2, u32 param3, u32 param4, Pokemon * param5, u32 param6, u32 param7, u32 param8); static void ov107_02243CC0(UnkStruct_ov107_02241D6C * param0, Window * param1); @@ -1821,199 +1821,57 @@ static void ov107_0224373C (UnkStruct_ov107_02241D6C * param0, u32 param1) return; } -asm static u8 ov107_0224379C (UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9) +static u8 ov107_0224379C (UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9) { - push {r4, r5, lr} - sub sp, #0x1c - ldr r4, [sp, #0x28] - str r4, [sp] - ldr r4, [sp, #0x2c] - str r4, [sp, #4] - add r4, sp, #0x18 - ldrb r5, [r4, #0x18] - str r5, [sp, #8] - ldrb r4, [r4, #0x1c] - str r4, [sp, #0xc] - add r4, sp, #0x38 - ldrb r4, [r4] - str r4, [sp, #0x10] - add r4, sp, #0x3c - ldrb r4, [r4] - str r4, [sp, #0x14] - mov r4, #0 - str r4, [sp, #0x18] - bl ov107_022437CC - add sp, #0x1c - pop {r4, r5, pc} + ov107_022437CC(param0, param1, param2, param3, param4, param5, param6, param7, param8, param9, 0); } -asm static u8 ov107_022437CC (UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9) +static u8 ov107_022437CC (UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9, int param10) { - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x10 - add r6, r1, #0 - add r1, sp, #0x38 - ldrb r1, [r1] - add r5, r0, #0 - add r0, r6, #0 - add r7, r2, #0 - add r4, r3, #0 - bl BGL_FillWindow - ldr r0, [r5, #0x20] - ldr r2, [r5, #0x2c] - add r1, r7, #0 - bl MessageLoader_GetStrbuf - ldr r0, [r5, #0x24] - ldr r1, [r5, #0x28] - ldr r2, [r5, #0x2c] - bl sub_0200C388 - ldr r0, [sp, #0x40] - cmp r0, #1 - beq _02243802 - cmp r0, #2 - beq _02243814 - b _02243820 - _02243802: - mov r0, #0 - ldr r1, [r5, #0x28] - add r2, r0, #0 - bl sub_02002D7C - add r0, r0, #1 - lsr r0, r0, #1 - sub r4, r4, r0 - b _02243820 - _02243814: - mov r0, #0 - ldr r1, [r5, #0x28] - add r2, r0, #0 - bl sub_02002D7C - sub r4, r4, r0 - _02243820: - ldr r0, [sp, #0x28] - add r2, sp, #0x18 - str r0, [sp] - ldr r0, [sp, #0x2c] - add r3, r4, #0 - str r0, [sp, #4] - add r0, sp, #0x38 - ldrb r1, [r0] - ldrb r0, [r2, #0x18] - ldrb r2, [r2, #0x1c] - lsl r0, r0, #0x18 - lsl r2, r2, #0x18 - lsr r0, r0, #8 - lsr r2, r2, #0x10 - orr r0, r2 - orr r0, r1 - str r0, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - add r1, sp, #0x3c - ldrb r1, [r1] - ldr r2, [r5, #0x28] - add r0, r6, #0 - bl sub_0201D78C - add r4, r0, #0 - add r0, r6, #0 - bl sub_0201A9A4 - add r0, r4, #0 - add sp, #0x10 - pop {r3, r4, r5, r6, r7, pc} + u8 v0; + BGL_FillWindow(param1, param8); + MessageLoader_GetStrbuf(param0->unk_20, param2, param0->unk_2C); + sub_0200C388(param0->unk_24, param0->unk_28, param0->unk_2C); + + switch (param10) { + case 1: + param3 -= (sub_02002D7C(0, param0->unk_28, 0) + 1) / 2; + break; + case 2: + param3 -= sub_02002D7C(0, param0->unk_28, 0); + break; + } + + v0 = sub_0201D78C(param1, param9, param0->unk_28, param3, param4, param5, (u32)((((param6) & 0xFF) << 16) | (((param7) & 0xFF) << 8) | ((param8) & 0xFF)), NULL); + sub_0201A9A4(param1); + + return v0; } -asm static u8 ov107_02243860 (UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9) +static u8 ov107_02243860 (UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9) { - push {r4, r5, lr} - sub sp, #0x1c - ldr r4, [sp, #0x28] - str r4, [sp] - ldr r4, [sp, #0x2c] - str r4, [sp, #4] - add r4, sp, #0x18 - ldrb r5, [r4, #0x18] - str r5, [sp, #8] - ldrb r4, [r4, #0x1c] - str r4, [sp, #0xc] - add r4, sp, #0x38 - ldrb r4, [r4] - str r4, [sp, #0x10] - add r4, sp, #0x3c - ldrb r4, [r4] - str r4, [sp, #0x14] - mov r4, #0 - str r4, [sp, #0x18] - bl ov107_02243890 - add sp, #0x1c - pop {r4, r5, pc} + return ov107_02243890(param0, param1, param2, param3, param4, param5, param6, param7, param8, param9, 0); } -asm static u8 ov107_02243890 (UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9, u32 param10) +static u8 ov107_02243890 (UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9, u32 param10) { - push {r4, r5, r6, lr} - sub sp, #0x10 - add r5, r0, #0 - add r6, r1, #0 - add r1, r2, #0 - ldr r0, [r5, #0x20] - ldr r2, [r5, #0x2c] - add r4, r3, #0 - bl MessageLoader_GetStrbuf - ldr r0, [r5, #0x24] - ldr r1, [r5, #0x28] - ldr r2, [r5, #0x2c] - bl sub_0200C388 - ldr r0, [sp, #0x38] - cmp r0, #1 - beq _022438BA - cmp r0, #2 - beq _022438CC - b _022438D8 - _022438BA: - mov r0, #0 - ldr r1, [r5, #0x28] - add r2, r0, #0 - bl sub_02002D7C - add r0, r0, #1 - lsr r0, r0, #1 - sub r4, r4, r0 - b _022438D8 - _022438CC: - mov r0, #0 - ldr r1, [r5, #0x28] - add r2, r0, #0 - bl sub_02002D7C - sub r4, r4, r0 - _022438D8: - ldr r0, [sp, #0x20] - add r2, sp, #0x10 - str r0, [sp] - ldr r0, [sp, #0x24] - add r3, r4, #0 - str r0, [sp, #4] - add r0, sp, #0x30 - ldrb r1, [r0] - ldrb r0, [r2, #0x18] - ldrb r2, [r2, #0x1c] - lsl r0, r0, #0x18 - lsl r2, r2, #0x18 - lsr r0, r0, #8 - lsr r2, r2, #0x10 - orr r0, r2 - orr r0, r1 - str r0, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - add r1, sp, #0x34 - ldrb r1, [r1] - ldr r2, [r5, #0x28] - add r0, r6, #0 - bl sub_0201D78C - add r4, r0, #0 - add r0, r6, #0 - bl sub_0201A9A4 - add r0, r4, #0 - add sp, #0x10 - pop {r4, r5, r6, pc} + u8 v0; + MessageLoader_GetStrbuf(param0->unk_20, param2, param0->unk_2C); + sub_0200C388(param0->unk_24, param0->unk_28, param0->unk_2C); + + switch (param10) { + case 1: + param3 -= (sub_02002D7C(0, param0->unk_28, 0) + 1) / 2; + break; + case 2: + param3 -= sub_02002D7C(0, param0->unk_28, 0); + break; + } + + v0 = sub_0201D78C(param1, param9, param0->unk_28, param3, param4, param5, (u32)((((param6) & 0xFF) << 16) | (((param7) & 0xFF) << 8) | ((param8) & 0xFF)), NULL); + sub_0201A9A4(param1); + + return v0; } static u8 ov107_02243918 (UnkStruct_ov107_02241D6C * param0, int param1, u8 param2) @@ -2257,27 +2115,9 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, Window * para pop {r4, r5, r6, pc} } -asm static void ov107_02243B5C (UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u16 param3, u16 param4) +static void ov107_02243B5C (UnkStruct_ov107_02241D6C * param0, Window * param1, int param2, u16 param3, u16 param4, int param5) { - push {r3, r4, lr} - sub sp, #0x1c - add r4, sp, #0x18 - ldrh r4, [r4, #0x10] - str r4, [sp] - mov r4, #0xff - str r4, [sp, #4] - mov r4, #1 - str r4, [sp, #8] - mov r4, #2 - str r4, [sp, #0xc] - mov r4, #0 - str r4, [sp, #0x10] - str r4, [sp, #0x14] - ldr r4, [sp, #0x2c] - str r4, [sp, #0x18] - bl ov107_02243890 - add sp, #0x1c - pop {r3, r4, pc} + ov107_02243890(param0, param1, param2, param3, param4, 0xff, 1, 2, 0, 0, param5); } static void ov107_02243B84 (UnkStruct_ov107_02241D6C * param0, Window * param1, Pokemon * param2) @@ -2464,55 +2304,12 @@ static void ov107_02243F4C (UnkStruct_ov107_02241D6C * param0, Window * param1, return; } -asm static void ov107_02243FA4 (UnkStruct_ov107_02241D6C * param0) +static void ov107_02243FA4 (UnkStruct_ov107_02241D6C * param0) { - push {r3, r4, lr} - sub sp, #0x1c - mov r1, #5 - str r1, [sp] - mov r1, #0xff - str r1, [sp, #4] - mov r2, #1 - str r2, [sp, #8] - mov r1, #2 - str r1, [sp, #0xc] - mov r1, #0 - str r1, [sp, #0x10] - str r1, [sp, #0x14] - add r4, r0, #0 - add r1, r4, #0 - str r2, [sp, #0x18] - add r1, #0x60 - mov r2, #6 - mov r3, #0x10 - bl ov107_022437CC - strb r0, [r4, #0xa] - mov r0, #0x72 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl sub_02027B50 - add r1, r0, #0 - add r0, r4, #0 - add r0, #0xc0 - bl ov107_02249DBC - mov r3, #1 - add r1, r4, #0 - str r3, [sp] - mov r0, #0xff - str r0, [sp, #4] - str r3, [sp, #8] - mov r0, #2 - str r0, [sp, #0xc] - mov r0, #0xf - str r0, [sp, #0x10] - add r0, r4, #0 - add r1, #0xc0 - mov r2, #5 - str r3, [sp, #0x14] - bl ov107_0224379C - strb r0, [r4, #0xa] - add sp, #0x1c - pop {r3, r4, pc} + + param0->unk_0A = ov107_022437CC(param0, ¶m0->unk_50[1], 6, 16, 1 + 4, 0xFF, 1, 2, 0, 0, 1); + ov107_02249DBC(¶m0->unk_50[7], sub_02027B50(param0->unk_1C8)); + param0->unk_0A = ov107_0224379C(param0, ¶m0->unk_50[7], 5, 1, 1, 0xFF, 1, 2, 15, 1); } static void ov107_0224400C (UnkStruct_ov107_02241D6C * param0) diff --git a/src/overlay107/ov107_02245EB0.c b/src/overlay107/ov107_02245EB0.c index 481a5b4196..13dbe6bb85 100644 --- a/src/overlay107/ov107_02245EB0.c +++ b/src/overlay107/ov107_02245EB0.c @@ -1480,199 +1480,57 @@ static void ov107_022475F0 (UnkStruct_ov107_02246170 * param0, u32 param1) return; } -asm static u8 ov107_02247650 (UnkStruct_ov107_02246170 * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9) -{ - push {r4, r5, lr} - sub sp, #0x1c - ldr r4, [sp, #0x28] - str r4, [sp] - ldr r4, [sp, #0x2c] - str r4, [sp, #4] - add r4, sp, #0x18 - ldrb r5, [r4, #0x18] - str r5, [sp, #8] - ldrb r4, [r4, #0x1c] - str r4, [sp, #0xc] - add r4, sp, #0x38 - ldrb r4, [r4] - str r4, [sp, #0x10] - add r4, sp, #0x3c - ldrb r4, [r4] - str r4, [sp, #0x14] - mov r4, #0 - str r4, [sp, #0x18] - bl ov107_02247680 - add sp, #0x1c - pop {r4, r5, pc} -} - -asm static u8 ov107_02247680 (UnkStruct_ov107_02246170 * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9, u32 param10) +static u8 ov107_02247650 (UnkStruct_ov107_02246170 * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9) { - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x10 - add r6, r1, #0 - add r1, sp, #0x38 - ldrb r1, [r1] - add r5, r0, #0 - add r0, r6, #0 - add r7, r2, #0 - add r4, r3, #0 - bl BGL_FillWindow - ldr r0, [r5, #0x20] - ldr r2, [r5, #0x2c] - add r1, r7, #0 - bl MessageLoader_GetStrbuf - ldr r0, [r5, #0x24] - ldr r1, [r5, #0x28] - ldr r2, [r5, #0x2c] - bl sub_0200C388 - ldr r0, [sp, #0x40] - cmp r0, #1 - beq _022476B6 - cmp r0, #2 - beq _022476C8 - b _022476D4 - _022476B6: - mov r0, #0 - ldr r1, [r5, #0x28] - add r2, r0, #0 - bl sub_02002D7C - add r0, r0, #1 - lsr r0, r0, #1 - sub r4, r4, r0 - b _022476D4 - _022476C8: - mov r0, #0 - ldr r1, [r5, #0x28] - add r2, r0, #0 - bl sub_02002D7C - sub r4, r4, r0 - _022476D4: - ldr r0, [sp, #0x28] - add r2, sp, #0x18 - str r0, [sp] - ldr r0, [sp, #0x2c] - add r3, r4, #0 - str r0, [sp, #4] - add r0, sp, #0x38 - ldrb r1, [r0] - ldrb r0, [r2, #0x18] - ldrb r2, [r2, #0x1c] - lsl r0, r0, #0x18 - lsl r2, r2, #0x18 - lsr r0, r0, #8 - lsr r2, r2, #0x10 - orr r0, r2 - orr r0, r1 - str r0, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - add r1, sp, #0x3c - ldrb r1, [r1] - ldr r2, [r5, #0x28] - add r0, r6, #0 - bl sub_0201D78C - add r4, r0, #0 - add r0, r6, #0 - bl sub_0201A9A4 - add r0, r4, #0 - add sp, #0x10 - pop {r3, r4, r5, r6, r7, pc} + return ov107_02247680(param0, param1, param2, param3, param4, param5, param6, param7, param8, param9, 0); } -asm static u8 ov107_02247714 (UnkStruct_ov107_02246170 * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9) -{ - push {r4, r5, lr} - sub sp, #0x1c - ldr r4, [sp, #0x28] - str r4, [sp] - ldr r4, [sp, #0x2c] - str r4, [sp, #4] - add r4, sp, #0x18 - ldrb r5, [r4, #0x18] - str r5, [sp, #8] - ldrb r4, [r4, #0x1c] - str r4, [sp, #0xc] - add r4, sp, #0x38 - ldrb r4, [r4] - str r4, [sp, #0x10] - add r4, sp, #0x3c - ldrb r4, [r4] - str r4, [sp, #0x14] - mov r4, #0 - str r4, [sp, #0x18] - bl ov107_02247744 - add sp, #0x1c - pop {r4, r5, pc} +static u8 ov107_02247680 (UnkStruct_ov107_02246170 * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9, u32 param10) +{ + u8 v0; + BGL_FillWindow(param1, param8); + MessageLoader_GetStrbuf(param0->unk_20, param2, param0->unk_2C); + sub_0200C388(param0->unk_24, param0->unk_28, param0->unk_2C); + + switch (param10) { + case 1: + param3 -= (sub_02002D7C(0, param0->unk_28, 0) + 1) / 2; + break; + case 2: + param3 -= sub_02002D7C(0, param0->unk_28, 0); + break; + } + + v0 = sub_0201D78C(param1, param9, param0->unk_28, param3, param4, param5, (u32)((((param6) & 0xFF) << 16) | (((param7) & 0xFF) << 8) | ((param8) & 0xFF)), NULL); + sub_0201A9A4(param1); + + return v0; } -asm static u8 ov107_02247744 (UnkStruct_ov107_02246170 * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9, u32 param10) +static u8 ov107_02247714 (UnkStruct_ov107_02246170 * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9) { - push {r4, r5, r6, lr} - sub sp, #0x10 - add r5, r0, #0 - add r6, r1, #0 - add r1, r2, #0 - ldr r0, [r5, #0x20] - ldr r2, [r5, #0x2c] - add r4, r3, #0 - bl MessageLoader_GetStrbuf - ldr r0, [r5, #0x24] - ldr r1, [r5, #0x28] - ldr r2, [r5, #0x2c] - bl sub_0200C388 - ldr r0, [sp, #0x38] - cmp r0, #1 - beq _0224776E - cmp r0, #2 - beq _02247780 - b _0224778C - _0224776E: - mov r0, #0 - ldr r1, [r5, #0x28] - add r2, r0, #0 - bl sub_02002D7C - add r0, r0, #1 - lsr r0, r0, #1 - sub r4, r4, r0 - b _0224778C - _02247780: - mov r0, #0 - ldr r1, [r5, #0x28] - add r2, r0, #0 - bl sub_02002D7C - sub r4, r4, r0 - _0224778C: - ldr r0, [sp, #0x20] - add r2, sp, #0x10 - str r0, [sp] - ldr r0, [sp, #0x24] - add r3, r4, #0 - str r0, [sp, #4] - add r0, sp, #0x30 - ldrb r1, [r0] - ldrb r0, [r2, #0x18] - ldrb r2, [r2, #0x1c] - lsl r0, r0, #0x18 - lsl r2, r2, #0x18 - lsr r0, r0, #8 - lsr r2, r2, #0x10 - orr r0, r2 - orr r0, r1 - str r0, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - add r1, sp, #0x34 - ldrb r1, [r1] - ldr r2, [r5, #0x28] - add r0, r6, #0 - bl sub_0201D78C - add r4, r0, #0 - add r0, r6, #0 - bl sub_0201A9A4 - add r0, r4, #0 - add sp, #0x10 - pop {r4, r5, r6, pc} + ov107_02247744(param0, param1, param2, param3, param4, param5, param6, param7, param8, param9, 0); +} + +static u8 ov107_02247744 (UnkStruct_ov107_02246170 * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9, u32 param10) +{ + u8 v0; + MessageLoader_GetStrbuf(param0->unk_20, param2, param0->unk_2C); + sub_0200C388(param0->unk_24, param0->unk_28, param0->unk_2C); + + switch (param10) { + case 1: + param3 -= (sub_02002D7C(0, param0->unk_28, 0) + 1) / 2; + break; + case 2: + param3 -= sub_02002D7C(0, param0->unk_28, 0); + break; + } + + v0 = sub_0201D78C(param1, param9, param0->unk_28, param3, param4, param5, (u32)((((param6) & 0xFF) << 16) | (((param7) & 0xFF) << 8) | ((param8) & 0xFF)), NULL); + sub_0201A9A4(param1); + + return v0; } static u8 ov107_022477CC (UnkStruct_ov107_02246170 * param0, int param1, u8 param2) @@ -1922,7 +1780,6 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, Window * para static void ov107_02247A14 (UnkStruct_ov107_02246170 * param0, Window * param1, int param2, u16 param3, u16 param4, u32 param5) { ov107_02247744(param0, param1, param2, param3, param4, 0xff, 1, 2, 0, 0, param5); - return; } static void ov107_02247A3C (UnkStruct_ov107_02246170 * param0, Window * param1, Pokemon * param2) @@ -1938,84 +1795,19 @@ static void ov107_02247A3C (UnkStruct_ov107_02246170 * param0, Window * param1, return; } -asm static void ov107_02247AD0 (UnkStruct_ov107_02246170 * param0, Window * param1, u8 param2, u32 param3, u32 param4, Pokemon * param5, u32 param6, u32 param7, u32 param8) +static void ov107_02247AD0 (UnkStruct_ov107_02246170 * param0, Window * param1, u8 param2, u32 param3, u32 param4, Pokemon * param5, u32 param6, u32 param7, u32 param8) { - push {r4, r5, r6, r7, lr} - sub sp, #0x1c - add r4, r0, #0 - add r6, r1, #0 - add r5, r2, #0 - ldr r0, [sp, #0x34] - ldr r1, [sp, #0x38] - mov r2, #0 - add r7, r3, #0 - bl Pokemon_GetValue - add r2, r0, #0 - ldr r0, [r4, #0x24] - add r1, r5, #0 - bl sub_0200B630 - mov r0, #0x18 - mul r0, r5 - add r0, #0xc - lsl r0, r0, #0x10 - lsr r5, r0, #0x10 - str r5, [sp] - mov r0, #0xff - str r0, [sp, #4] - mov r0, #1 - str r0, [sp, #8] - mov r0, #2 - str r0, [sp, #0xc] - mov r0, #0 - str r0, [sp, #0x10] - str r0, [sp, #0x14] - add r0, r4, #0 - add r1, r6, #0 - add r2, r7, #0 - mov r3, #0x20 - bl ov107_02247714 - strb r0, [r4, #0xa] - ldr r0, [sp, #0x34] - ldr r1, [sp, #0x3c] - mov r2, #0 - bl Pokemon_GetValue - add r2, r0, #0 - mov r0, #0 - str r0, [sp] - add r0, r4, #0 - mov r1, #4 - mov r3, #3 - bl ov107_022480EC - ldr r0, [sp, #0x34] - ldr r1, [sp, #0x40] - mov r2, #0 - bl Pokemon_GetValue - add r2, r0, #0 - mov r0, #0 - str r0, [sp] - add r0, r4, #0 - mov r1, #5 - mov r3, #3 - bl ov107_022480EC - str r5, [sp] - mov r0, #0xff - str r0, [sp, #4] - mov r1, #1 - str r1, [sp, #8] - mov r0, #2 - str r0, [sp, #0xc] - mov r0, #0 - str r0, [sp, #0x10] - str r0, [sp, #0x14] - str r1, [sp, #0x18] - ldr r2, [sp, #0x30] - add r0, r4, #0 - add r1, r6, #0 - mov r3, #0x91 - bl ov107_02247744 - strb r0, [r4, #0xa] - add sp, #0x1c - pop {r4, r5, r6, r7, pc} + u16 v0, v1, v2, v3; + + v0 = 4 * 8; + v1 = (2 * 8 - 4) + param2 * 24; + v2 = 18 * 8 + 1; + v3 = (2 * 8 - 4) + param2 * 24; + sub_0200B630(param0->unk_24, param2, Pokemon_GetValue(param5, param6, NULL)); + param0->unk_0A = ov107_02247714(param0, param1, param3, v0, v1, 0xFF, 1, 2, 0, 0); + ov107_022480EC(param0, 4, Pokemon_GetValue(param5, param7, NULL), 3, 0); + ov107_022480EC(param0, 5, Pokemon_GetValue(param5, param8, NULL), 3, 0); + param0->unk_0A = ov107_02247744(param0, param1, param4, v2, v3, 0xFF, 1, 2, 0, 0, 1); } static void ov107_02247B78 (UnkStruct_ov107_02246170 * param0, Window * param1) @@ -2417,54 +2209,11 @@ static void ov107_022481FC (UnkStruct_ov107_02246170 * param0, Window * param1, return; } -asm static void ov107_02248240 (UnkStruct_ov107_02246170 * param0) +static void ov107_02248240 (UnkStruct_ov107_02246170 * param0) { - push {r3, r4, lr} - sub sp, #0x1c - mov r2, #5 - str r2, [sp] - mov r1, #0xff - str r1, [sp, #4] - mov r3, #1 - str r3, [sp, #8] - mov r1, #2 - str r1, [sp, #0xc] - mov r1, #0 - str r1, [sp, #0x10] - str r1, [sp, #0x14] - add r4, r0, #0 - add r1, r4, #0 - str r3, [sp, #0x18] - add r1, #0x60 - mov r3, #0x10 - bl ov107_02247680 - strb r0, [r4, #0xa] - mov r0, #0x52 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl sub_02027B50 - add r1, r0, #0 - add r0, r4, #0 - add r0, #0xd0 - bl ov107_02249DBC - mov r3, #1 - add r1, r4, #0 - str r3, [sp] - mov r0, #0xff - str r0, [sp, #4] - str r3, [sp, #8] - mov r0, #2 - str r0, [sp, #0xc] - mov r0, #0xf - str r0, [sp, #0x10] - add r0, r4, #0 - add r1, #0xd0 - mov r2, #4 - str r3, [sp, #0x14] - bl ov107_02247650 - strb r0, [r4, #0xa] - add sp, #0x1c - pop {r3, r4, pc} + param0->unk_0A = ov107_02247680(param0, ¶m0->unk_50[1], 5, 16, 1 + 4, 0xFF, 1, 2, 0, 0, 1); + ov107_02249DBC(¶m0->unk_50[8], sub_02027B50(param0->unk_148)); + param0->unk_0A = ov107_02247650(param0, ¶m0->unk_50[8], 4, 1, 1, 0xFF, 1, 2, 15, 1); } static void ov107_022482A4 (UnkStruct_ov107_02246170 * param0) diff --git a/src/overlay109/ov109_021D0D80.c b/src/overlay109/ov109_021D0D80.c index 4beaefb485..771b3ef650 100644 --- a/src/overlay109/ov109_021D0D80.c +++ b/src/overlay109/ov109_021D0D80.c @@ -2143,42 +2143,14 @@ static void ov109_021D27F0 (UnkStruct_ov109_021D0F70 * param0) } } -asm static void ov109_021D2820 (UnkStruct_ov109_021D0F70 * param0, Strbuf *param1, int param2, u32 param3) -{ - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x10 - add r6, r1, #0 - ldr r1, = 0xCB8 - lsl r4, r2, #4 - add r5, r0, r1 - mov r1, #1 - add r7, r3, #0 - add r0, r5, r4 - add r2, r1, #0 - mov r3, #0xe - bl Window_Show - add r0, r5, r4 - mov r1, #0xf - bl BGL_FillWindow - mov r0, #0 - add r1, r6, #0 - add r2, r0, #0 - mov r3, #0x40 - bl sub_02002EEC - mov r1, #0 - add r3, r0, #0 - str r1, [sp] - mov r0, #0xff - str r0, [sp, #4] - str r7, [sp, #8] - add r0, r5, r4 - add r2, r6, #0 - str r1, [sp, #0xc] - bl sub_0201D78C - add r0, r5, r4 - bl sub_0201A9A4 - add sp, #0x10 - pop {r3, r4, r5, r6, r7, pc} +static void ov109_021D2820 (UnkStruct_ov109_021D0F70 * param0, Strbuf *param1, int param2, u32 param3) +{ + UnkStruct_ov109_021D24F8 * v0 = ¶m0->unk_C9C; + Window * v1 = &v0->unk_1C[param2]; + Window_Show(v1, 1, 1, 14); + BGL_FillWindow(v1, 15); + sub_0201D78C(v1, 0, param1, sub_02002EEC(0, param1, 0, 8 * 8), 0, 0xFF, param3, NULL); + sub_0201A9A4(v1); } static void ov109_021D2874 (UnkStruct_ov109_021D0F70 * param0, Strbuf *param1, int param2, int param3) diff --git a/src/overlay110/ov110_021D0D80.c b/src/overlay110/ov110_021D0D80.c index f9479f1da0..114d193d19 100644 --- a/src/overlay110/ov110_021D0D80.c +++ b/src/overlay110/ov110_021D0D80.c @@ -83,7 +83,7 @@ static u8 ov110_021D1208(u8 param0); static void ov110_021D123C(UnkStruct_ov110_021D0F78 * param0, u32 param1); static void ov110_021D128C(void); static void ov110_021D12C0(UnkStruct_ov110_021D0F78 * param0, u32 param1); -static u8 ov110_021D1324(UnkStruct_ov110_021D0F78 * param0, Window * param1, int param2, u32 param3, u32 param4, u8 param5, u8 param6, u8 param7, u8 param8, u8 param9); +static u8 ov110_021D1324(UnkStruct_ov110_021D0F78 * param0, Window * param1, int param2, u32 param3, u32 param4, u8 param5, u8 param6, u8 param7, u8 param8, u8 param9, int param10); static u8 ov110_021D13CC(UnkStruct_ov110_021D0F78 * param0, Window * param1, int param2, u8 param3); static void ov110_021D13F0(UnkStruct_ov110_021D0F78 * param0, u32 param1, s32 param2); static void ov110_021D140C(UnkStruct_ov110_021D0F78 * param0); @@ -482,110 +482,28 @@ static void ov110_021D12C0 (UnkStruct_ov110_021D0F78 * param0, u32 param1) return; } -asm static u8 ov110_021D1324 (UnkStruct_ov110_021D0F78 * param0, Window * param1, int param2, u32 param3, u32 param4, u8 param5, u8 param6, u8 param7, u8 param8, u8 param9) +static u8 ov110_021D1324 (UnkStruct_ov110_021D0F78 * param0, Window * param1, int param2, u32 param3, u32 param4, u8 param5, u8 param6, u8 param7, u8 param8, u8 param9, int param10) { - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x10 - add r5, r0, #0 - add r0, sp, #0x3c - ldrb r0, [r0] - add r6, r1, #0 - add r7, r2, #0 - add r4, r3, #0 - cmp r0, #0 - beq _021D1342 - add r1, sp, #0x18 - ldrb r1, [r1, #0x1c] - add r0, r6, #0 - bl BGL_FillWindow - _021D1342: - mov r2, #0x11 - lsl r2, r2, #4 - ldr r0, [r5, r2] - add r2, #0xc - ldr r2, [r5, r2] - add r1, r7, #0 - bl MessageLoader_GetStrbuf - mov r2, #0x45 - lsl r2, r2, #2 - add r1, r2, #4 - ldr r0, [r5, r2] - add r2, #8 - ldr r1, [r5, r1] - ldr r2, [r5, r2] - bl sub_0200C388 - ldr r0, [sp, #0x40] - cmp r0, #1 - beq _021D1370 - cmp r0, #2 - beq _021D1386 - b _021D1396 - _021D1370: - mov r1, #0x46 - lsl r1, r1, #2 - mov r0, #0 - ldr r1, [r5, r1] - add r2, r0, #0 - bl sub_02002D7C - add r0, r0, #1 - lsr r0, r0, #1 - sub r4, r4, r0 - b _021D1396 - _021D1386: - mov r1, #0x46 - lsl r1, r1, #2 - mov r0, #0 - ldr r1, [r5, r1] - add r2, r0, #0 - bl sub_02002D7C - sub r4, r4, r0 - _021D1396: - ldr r0, [sp, #0x28] - mov r2, #0 - str r0, [sp] - str r2, [sp, #4] - add r3, sp, #0x18 - ldrb r0, [r3, #0x14] - ldrb r1, [r3, #0x1c] - ldrb r3, [r3, #0x18] - lsl r0, r0, #0x18 - lsr r0, r0, #8 - lsl r3, r3, #0x18 - lsr r3, r3, #0x10 - orr r0, r3 - orr r0, r1 - str r0, [sp, #8] - str r2, [sp, #0xc] - add r1, sp, #0x38 - mov r2, #0x46 - lsl r2, r2, #2 - ldrb r1, [r1] - ldr r2, [r5, r2] - add r0, r6, #0 - add r3, r4, #0 - bl sub_0201D78C - add sp, #0x10 - pop {r3, r4, r5, r6, r7, pc} + if (param9) + BGL_FillWindow(param1, param7); + MessageLoader_GetStrbuf(param0->unk_110, param2, param0->unk_11C); + sub_0200C388(param0->unk_114, param0->unk_118, param0->unk_11C); + + switch(param10) { + case 1: + param3 -= (sub_02002D7C(0, param0->unk_118, 0) + 1) / 2; + break; + case 2: + param3 -= sub_02002D7C(0, param0->unk_118, 0); + break; + } + + sub_0201D78C(param1, param8, param0->unk_118, param3, param4, 0, ((((u32)(param5) & 0xFF) << 16) | (((param6) & 0xFF) << 8) | (((param7) & 0xFF))), NULL); } -asm static u8 ov110_021D13CC (UnkStruct_ov110_021D0F78 * param0, Window * param1, int param2, u8 param3) +static u8 ov110_021D13CC (UnkStruct_ov110_021D0F78 * param0, Window * param1, int param2, u8 param3) { - push {r4, r5, lr} - sub sp, #0x1c - mov r5, #0 - str r5, [sp] - mov r4, #1 - str r4, [sp, #4] - mov r4, #2 - str r4, [sp, #8] - str r5, [sp, #0xc] - str r5, [sp, #0x10] - str r3, [sp, #0x14] - add r3, r5, #0 - str r5, [sp, #0x18] - bl ov110_021D1324 - add sp, #0x1c - pop {r4, r5, pc} + return ov110_021D1324 (param0, param1, param2, 0, 0, 1, 2, 0, 0, param3, 0); } static void ov110_021D13F0 (UnkStruct_ov110_021D0F78 * param0, u32 param1, s32 param2) @@ -628,227 +546,47 @@ static void ov110_021D140C (UnkStruct_ov110_021D0F78 * param0) return; } -asm static void ov110_021D1468 (UnkStruct_ov110_021D0F78 * param0) +static void ov110_021D1468 (UnkStruct_ov110_021D0F78 * param0) { - push {r3, r4, lr} - sub sp, #0x1c - add r4, r0, #0 - add r0, #0x10 - mov r1, #0 - bl BGL_FillWindow - mov r1, #0 - str r1, [sp] - mov r0, #1 - str r0, [sp, #4] - mov r0, #2 - str r0, [sp, #8] - str r1, [sp, #0xc] - str r1, [sp, #0x10] - str r1, [sp, #0x14] - str r1, [sp, #0x18] - add r1, r4, #0 - add r0, r4, #0 - add r1, #0x10 - mov r2, #0x16 - mov r3, #8 - bl ov110_021D1324 - ldrb r0, [r4, #5] - cmp r0, #0 - bne _021D14A4 - mov r2, #0x1a - mov r3, #0xd8 - b _021D14B2 - _021D14A4: - cmp r0, #1 - bne _021D14AE - mov r2, #0x1b - mov r3, #0xd8 - b _021D14B2 - _021D14AE: - mov r2, #0x1c - mov r3, #0xd8 - _021D14B2: - mov r1, #0 - str r1, [sp] - mov r0, #1 - str r0, [sp, #4] - mov r0, #2 - str r0, [sp, #8] - str r1, [sp, #0xc] - str r1, [sp, #0x10] - str r1, [sp, #0x14] - add r1, r4, #0 - str r0, [sp, #0x18] - add r0, r4, #0 - add r1, #0x10 - bl ov110_021D1324 - add r0, r4, #0 - add r0, #0x10 - bl sub_0201A9A4 - add r1, r4, #0 - add r0, r4, #0 - add r1, #0x20 - mov r2, #0x22 - mov r3, #1 - bl ov110_021D13CC - mov r1, #0 - str r1, [sp] - mov r0, #1 - str r0, [sp, #4] - mov r0, #2 - str r0, [sp, #8] - str r1, [sp, #0xc] - str r1, [sp, #0x10] - str r1, [sp, #0x14] - add r1, r4, #0 - str r0, [sp, #0x18] - add r0, r4, #0 - add r1, #0x20 - mov r2, #0x24 - mov r3, #0xe0 - bl ov110_021D1324 - add r0, r4, #0 - add r0, #0x20 - bl sub_0201A9A4 - add r0, r4, #0 - mov r1, #0 - bl ov110_021D17AC - add r1, r4, #0 - add r2, r0, #0 - add r0, r4, #0 - add r1, #0x30 - mov r3, #1 - bl ov110_021D13CC - ldrb r1, [r4, #5] - mov r0, #0 - bl sub_0205E430 - add r1, r0, #0 - mov r0, #0x4b - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r2, #0xff - bl sub_02030698 - add r2, r0, #0 - add r0, r4, #0 - mov r1, #0 - bl ov110_021D13F0 - mov r2, #0 - str r2, [sp] - mov r1, #1 - str r1, [sp, #4] - mov r0, #2 - str r0, [sp, #8] - str r2, [sp, #0xc] - str r2, [sp, #0x10] - str r2, [sp, #0x14] - str r1, [sp, #0x18] - add r1, r4, #0 - add r0, r4, #0 - add r1, #0x30 - mov r2, #0x26 - mov r3, #0x70 - bl ov110_021D1324 - ldrb r1, [r4, #5] - mov r0, #0 - bl sub_0205E488 - add r1, r0, #0 - mov r0, #0x4b - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r2, #0xff - bl sub_02030698 - add r2, r0, #0 - add r0, r4, #0 - mov r1, #0 - bl ov110_021D13F0 - mov r1, #0 - str r1, [sp] - mov r0, #1 - str r0, [sp, #4] - mov r0, #2 - str r0, [sp, #8] - str r1, [sp, #0xc] - str r1, [sp, #0x10] - str r1, [sp, #0x14] - add r1, r4, #0 - str r0, [sp, #0x18] - add r0, r4, #0 - add r1, #0x30 - mov r2, #0x28 - mov r3, #0xe0 - bl ov110_021D1324 - add r0, r4, #0 - add r0, #0x30 - bl sub_0201A9A4 - add r1, r4, #0 - add r0, r4, #0 - add r1, #0x40 - mov r2, #0x1f - mov r3, #1 - bl ov110_021D13CC - ldrb r1, [r4, #5] - mov r0, #0 - bl sub_0205E45C - add r1, r0, #0 - mov r0, #0x4b - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r2, #0xff - bl sub_02030698 - add r2, r0, #0 - add r0, r4, #0 - mov r1, #0 - bl ov110_021D13F0 - mov r2, #0 - str r2, [sp] - mov r1, #1 - str r1, [sp, #4] - mov r0, #2 - str r0, [sp, #8] - str r2, [sp, #0xc] - str r2, [sp, #0x10] - str r2, [sp, #0x14] - str r1, [sp, #0x18] - add r1, r4, #0 - add r0, r4, #0 - add r1, #0x40 - mov r2, #0x26 - mov r3, #0x70 - bl ov110_021D1324 - ldrb r1, [r4, #5] - mov r0, #0 - bl sub_0205E4B4 - add r1, r0, #0 - mov r0, #0x4b - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r2, #0xff - bl sub_02030698 - add r2, r0, #0 - add r0, r4, #0 - mov r1, #0 - bl ov110_021D13F0 - mov r1, #0 - str r1, [sp] - mov r0, #1 - str r0, [sp, #4] - mov r0, #2 - str r0, [sp, #8] - str r1, [sp, #0xc] - str r1, [sp, #0x10] - str r1, [sp, #0x14] - add r1, r4, #0 - str r0, [sp, #0x18] - add r0, r4, #0 - add r1, #0x40 - mov r2, #0x28 - mov r3, #0xe0 - bl ov110_021D1324 - add r4, #0x40 - add r0, r4, #0 - bl sub_0201A9A4 - add sp, #0x1c - pop {r3, r4, pc} + u8 v0, v1; + int v2; + u32 v3; + + v0 = 0; + BGL_FillWindow(¶m0->unk_10[v0], 0); + ov110_021D1324(param0, ¶m0->unk_10[v0], 22, 8, 0, 1, 2, 0, 0, 0, 0); + + if (param0->unk_05 == 0) { + v2 = 26; + v3 = 216; + } else if (param0->unk_05 == 1) { + v2 = 27; + v3 = 216; + } else { + v2 = 28; + v3 = 216; + } + + ov110_021D1324(param0, ¶m0->unk_10[v0], v2, v3, 0, 1, 2, 0, 0, 0, 2); + sub_0201A9A4(¶m0->unk_10[v0]); + v0 = 1; + ov110_021D13CC(param0, ¶m0->unk_10[v0], 34, 1); + ov110_021D1324(param0, ¶m0->unk_10[v0], 36, 28 * 8, 0, 1, 2, 0, 0, 0, 2); + sub_0201A9A4(¶m0->unk_10[v0]); + v0 = 2; + ov110_021D13CC(param0, ¶m0->unk_10[v0], ov110_021D17AC(param0, 0), 1); + ov110_021D13F0(param0, 0, sub_02030698(param0->unk_12C, sub_0205E430(0, param0->unk_05), 0xFF)); + ov110_021D1324(param0, ¶m0->unk_10[v0], 38, 14 * 8, 0, 1, 2, 0, 0, 0, 1); + ov110_021D13F0(param0, 0, sub_02030698(param0->unk_12C, sub_0205E488(0, param0->unk_05), 0xFF)); + ov110_021D1324(param0, ¶m0->unk_10[v0], 40, 28 * 8, 0, 1, 2, 0, 0, 0, 2); + sub_0201A9A4(¶m0->unk_10[v0]); + v0 = 3; + ov110_021D13CC(param0, ¶m0->unk_10[v0], 31, 1); + ov110_021D13F0(param0, 0, sub_02030698(param0->unk_12C, sub_0205E45C(0, param0->unk_05), 0xFF)); + ov110_021D1324(param0, ¶m0->unk_10[v0], 38, 14 * 8, 0, 1, 2, 0, 0, 0, 1); + ov110_021D13F0(param0, 0, sub_02030698(param0->unk_12C, sub_0205E4B4(0, param0->unk_05), 0xFF)); + ov110_021D1324(param0, ¶m0->unk_10[v0], 40, 28 * 8, 0, 1, 2, 0, 0, 0, 2); + sub_0201A9A4(¶m0->unk_10[v0]); } asm static void ov110_021D1650 (UnkStruct_ov110_021D0F78 * param0) diff --git a/src/overlay111/ov111_021D0D80.c b/src/overlay111/ov111_021D0D80.c index fcba5e0b10..a615ee9214 100644 --- a/src/overlay111/ov111_021D0D80.c +++ b/src/overlay111/ov111_021D0D80.c @@ -1538,59 +1538,13 @@ static u8 ov111_021D23C4 (UnkStruct_ov111_021D0F7C * param0, Window * param1, in return sub_0201D78C(param1, param9, param0->unk_40, param3, param4, param5, (u32)((((param6) & 0xff) << 16) | (((param7) & 0xff) << 8) | (((param8) & 0xff) << 0)), NULL); } -asm static u8 ov111_021D2424 (UnkStruct_ov111_021D0F7C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9) -{ - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x10 - add r4, r1, #0 - add r1, sp, #0x38 - ldrb r1, [r1] - add r5, r0, #0 - add r0, r4, #0 - add r7, r2, #0 - add r6, r3, #0 - bl BGL_FillWindow - ldr r0, [r5, #0x38] - ldr r2, [r5, #0x44] - add r1, r7, #0 - bl MessageLoader_GetStrbuf - ldr r0, [r5, #0x3c] - ldr r1, [r5, #0x40] - ldr r2, [r5, #0x44] - bl sub_0200C388 - add r0, sp, #0x3c - ldrb r0, [r0] - ldr r1, [r5, #0x40] - mov r2, #0 - bl sub_02002D7C - add r0, r0, #1 - lsr r0, r0, #1 - sub r3, r6, r0 - ldr r0, [sp, #0x28] - add r2, sp, #0x18 - str r0, [sp] - ldr r0, [sp, #0x2c] - str r0, [sp, #4] - add r0, sp, #0x38 - ldrb r1, [r0] - ldrb r0, [r2, #0x18] - ldrb r2, [r2, #0x1c] - lsl r0, r0, #0x18 - lsl r2, r2, #0x18 - lsr r0, r0, #8 - lsr r2, r2, #0x10 - orr r0, r2 - orr r0, r1 - str r0, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - add r1, sp, #0x3c - ldrb r1, [r1] - ldr r2, [r5, #0x40] - add r0, r4, #0 - bl sub_0201D78C - add sp, #0x10 - pop {r3, r4, r5, r6, r7, pc} +static u8 ov111_021D2424 (UnkStruct_ov111_021D0F7C * param0, Window * param1, int param2, u32 param3, u32 param4, u32 param5, u8 param6, u8 param7, u8 param8, u8 param9) +{ + BGL_FillWindow(param1, param8); + MessageLoader_GetStrbuf(param0->unk_38, param2, param0->unk_44); + sub_0200C388(param0->unk_3C, param0->unk_40, param0->unk_44); + param3 -= (sub_02002D7C(param9, param0->unk_40, 0) + 1) / 2; + return sub_0201D78C(param1, param9, param0->unk_40, param3, param4, param5, (u32)((((param6) & 0xff) << 16) | (((param7) & 0xff) << 8) | (((param8) & 0xff) << 0)), NULL); } static u8 ov111_021D2494 (UnkStruct_ov111_021D0F7C * param0) diff --git a/src/overlay117/ov117_02263AF0.c b/src/overlay117/ov117_02263AF0.c index 64f962031e..eb1882ea27 100644 --- a/src/overlay117/ov117_02263AF0.c +++ b/src/overlay117/ov117_02263AF0.c @@ -2239,91 +2239,21 @@ CellActorData * ov117_02266130 (UnkStruct_ov117_02261280 * param0) return v0; } -extern void _u32_div_f(void); - -asm void ov117_02266150 (UnkStruct_ov117_02261280 * param0) -{ - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x40 - add r7, r0, #0 - ldr r0, = 0x3848 - add r6, r7, #0 - ldr r0, [r7, r0] - add r4, r7, #0 - str r0, [sp, #0x2c] - mov r0, #5 - str r0, [sp, #0x30] - ldr r0, = 0x16B0 - add r6, #0x64 - add r5, r7, r0 - add r4, #0xc8 - add r5, #0x64 - _0226616E: - ldr r0, = 0x16B0 - ldr r0, [r6, r0] - cmp r0, #0 - beq _0226617A - bl ErrorHandling_AssertFail - _0226617A: - ldr r0, [sp, #0x2c] - mov r1, #0xa - bl _u32_div_f - add r0, r7, #0 - add r0, #0x80 - ldr r0, [r0, #0] - add r1, r1, #4 - bl MessageLoader_GetNewStrbuf - str r0, [sp, #0x34] - ldr r0, [sp, #0x2c] - mov r1, #0xa - bl _u32_div_f - str r0, [sp, #0x2c] - ldr r0, = 0x15AC - add r1, sp, #0x3c - ldr r0, [r4, r0] - add r2, sp, #0x38 - bl sub_020129A4 - ldr r0, [sp, #0x34] - add r2, r7, #0 - str r0, [sp] - mov r0, #0 - str r0, [sp, #4] - ldr r0, = 0xE0F00 - add r2, #0x90 - str r0, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - ldr r0, = 0x2713 - add r3, r5, #0 - str r0, [sp, #0x10] - ldr r0, [sp, #0x3c] - str r0, [sp, #0x14] - mov r0, #0xa8 - str r0, [sp, #0x18] - mov r0, #0 - str r0, [sp, #0x1c] - mov r0, #1 - str r0, [sp, #0x20] - mov r0, #0xc - str r0, [sp, #0x24] - mov r0, #2 - str r0, [sp, #0x28] - ldr r0, [r7, #0x2c] - ldr r1, [r7, #0x28] - ldr r2, [r2, #0] - bl ov117_02265DB8 - ldr r0, [sp, #0x34] - bl Strbuf_Free - ldr r0, [sp, #0x30] - sub r6, #0x14 - sub r4, #0x28 - sub r5, #0x14 - sub r0, r0, #1 - str r0, [sp, #0x30] - bpl _0226616E - add sp, #0x40 - pop {r3, r4, r5, r6, r7, pc} - nop +void ov117_02266150 (UnkStruct_ov117_02261280 * param0) +{ + Strbuf * v0; + int v1, v2, v3; + u32 v4; + + v4 = param0->unk_3D4C; + for (v1 = 6 - 1; v1 >= 0; v1--) { + GF_ASSERT(param0->unk_15A8.unk_108[v1].unk_00 == NULL); + v0 = MessageLoader_GetNewStrbuf(param0->unk_80, 4 + (v4 % 10)); + v4 /= 10; + sub_020129A4(param0->unk_15A8.unk_04[v1][0].unk_00, &v2, &v3); + ov117_02265DB8(param0->unk_2C, param0->unk_28, param0->unk_90, ¶m0->unk_15A8.unk_108[v1], v0, 0, (u32)(((0xE & 0xFF) << 0x10) | ((0xF & 0xFF) << 0x8) | ((0x0 & 0xFF) << 0x0)), 0, 10003, v2, 168, 0, 1, 12, 2 * 1); + Strbuf_Free(v0); + } } void ov117_02266210 (UnkStruct_ov117_02261280 * param0)