From 9bff34f5ed78da1c6dea8e6a5a19458160616029 Mon Sep 17 00:00:00 2001 From: tgsm Date: Wed, 31 Mar 2021 09:47:13 -0400 Subject: Decompile scrcmd_13 --- arm9/asm/scrcmd_13.s | 220 ------------------------------------------------ arm9/asm/unk_02038C78.s | 8 +- arm9/global.inc | 8 +- arm9/src/scrcmd_13.c | 111 ++++++++++++++++++++++++ 4 files changed, 119 insertions(+), 228 deletions(-) delete mode 100644 arm9/asm/scrcmd_13.s create mode 100644 arm9/src/scrcmd_13.c (limited to 'arm9') diff --git a/arm9/asm/scrcmd_13.s b/arm9/asm/scrcmd_13.s deleted file mode 100644 index 1b31ce71..00000000 --- a/arm9/asm/scrcmd_13.s +++ /dev/null @@ -1,220 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_0204387C -FUN_0204387C: ; 0x0204387C - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - cmp r0, #0x0 - bne _020438B2 - add r0, r4, #0x0 - bl FUN_0205F224 - add r5, #0x80 - ldr r0, [r5, #0x0] - bl FUN_0204B9EC - b _020438CA -_020438B2: - cmp r0, #0x1 - bne _020438C6 - add r0, r4, #0x0 - bl FUN_0205F234 - add r5, #0x80 - ldr r0, [r5, #0x0] - bl FUN_0204BA1C - b _020438CA -_020438C6: - bl ErrorHandling -_020438CA: - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_020438D0 -FUN_020438D0: ; 0x020438D0 - push {r4-r6, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl FUN_02022528 - add r6, r0, #0x0 - mov r0, #0x20 - bl AllocMonZeroed - add r5, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - add r4, r0, #0x0 - add r0, r6, #0x0 - bl FUN_0202C000 - cmp r0, #0x6 - bne _02043908 - mov r0, #0x1 - b _0204390A -_02043908: - mov r0, #0x0 -_0204390A: - strh r0, [r4, #0x0] - add r0, r5, #0x0 - bl FreeToHeap - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02043918 -FUN_02043918: ; 0x02043918 - push {r4-r7, lr} - sub sp, #0xc - add r6, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl FUN_02022528 - add r7, r0, #0x0 - add r0, r6, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl GetStoragePCPointer - str r0, [sp, #0x8] - mov r0, #0x20 - bl AllocMonZeroed - add r4, r0, #0x0 - add r0, r6, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Sav2_PlayerData_GetProfileAddr - str r0, [sp, #0x4] - add r0, r6, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Sav2_Pokedex_get - mov r5, #0x0 -_0204395C: - add r0, r7, #0x0 - add r1, r5, #0x0 - add r2, r4, #0x0 - bl FUN_0202BFD8 - mov r0, #0x20 - str r0, [sp, #0x0] - ldr r1, [sp, #0x4] - add r0, r4, #0x0 - mov r2, #0x2 - mov r3, #0x0 - bl FUN_0208089C - add r0, r4, #0x0 - bl FUN_020690E4 - add r1, r0, #0x0 - ldr r0, [sp, #0x8] - bl PCStorage_PlaceMonInFirstEmptySlotInAnyBox - cmp r0, #0x0 - bne _0204398C - bl ErrorHandling -_0204398C: - add r0, r6, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - add r1, r4, #0x0 - ldr r0, [r0, #0xc] - bl FUN_0202C144 - add r5, r5, #0x1 - cmp r5, #0x6 - blt _0204395C - add r0, r4, #0x0 - bl FreeToHeap - add r0, r7, #0x0 - bl FUN_0202BEDC - mov r0, #0x0 - add sp, #0xc - pop {r4-r7, pc} - .balign 4 - - thumb_func_start FUN_020439B4 -FUN_020439B4: ; 0x020439B4 - push {r3-r7, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r6, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - cmp r6, #0x3 - bhi _02043A40 - add r0, r6, r6 - add r0, pc - ldrh r0, [r0, #0x6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_020439EE: ; jump table (using 16-bit offset) - .short _020439F6 - _020439EE - 2; case 0 - .short _02043A02 - _020439EE - 2; case 1 - .short _02043A0E - _020439EE - 2; case 2 - .short _02043A1A - _020439EE - 2; case 3 -_020439F6: - add r4, #0x80 - ldr r0, [r4, #0x0] - bl FUN_0204BAC4 - strh r0, [r5, #0x0] - b _02043A40 -_02043A02: - add r4, #0x80 - ldr r0, [r4, #0x0] - bl FUN_0204BAD4 - strh r0, [r5, #0x0] - b _02043A40 -_02043A0E: - add r4, #0x80 - ldr r0, [r4, #0x0] - bl FUN_0204BAE4 - strh r0, [r5, #0x0] - b _02043A40 -_02043A1A: - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl FUN_0204BAD4 - add r6, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl FUN_0204BAC4 - add r4, #0x80 - add r7, r0, #0x0 - ldr r0, [r4, #0x0] - bl FUN_0204BAE4 - add r0, r7, r0 - add r0, r6, r0 - strh r0, [r5, #0x0] -_02043A40: - mov r0, #0x0 - pop {r3-r7, pc} diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index 4b80024a..a5037d01 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -744,10 +744,10 @@ gScriptCmdTable: ; 0x020F355C .word FUN_02041340 .word FUN_02040964 .word ScrCmd_pcfreespace - .word FUN_0204387C - .word FUN_020438D0 - .word FUN_02043918 - .word FUN_020439B4 + .word ScrCmd_Unk0253 + .word ScrCmd_Unk0254 + .word ScrCmd_Unk0255 + .word ScrCmd_Unk0256 .word FUN_0203FE80 .word FUN_0203EDA4 .word FUN_0203EDC8 diff --git a/arm9/global.inc b/arm9/global.inc index d5d12155..63ab1566 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -3274,10 +3274,10 @@ .extern FUN_02042C8C .extern FUN_02042CBC .extern FUN_02042D1C -.extern FUN_0204387C -.extern FUN_020438D0 -.extern FUN_02043918 -.extern FUN_020439B4 +.extern ScrCmd_Unk0253 +.extern ScrCmd_Unk0254 +.extern ScrCmd_Unk0255 +.extern ScrCmd_Unk0256 .extern ScrCmd_Unk0075 .extern ScrCmd_Unk0076 .extern ScrCmd_Unk0077 diff --git a/arm9/src/scrcmd_13.c b/arm9/src/scrcmd_13.c new file mode 100644 index 00000000..3b21facc --- /dev/null +++ b/arm9/src/scrcmd_13.c @@ -0,0 +1,111 @@ +#include "scrcmd.h" +#include "event_data.h" +#include "heap.h" +#include "pokedex.h" +#include "pokemon_storage_system.h" +#include "unk_0202C144.h" + +extern struct PCStorage* GetStoragePCPointer(struct SaveBlock2* sav2); +extern void* FUN_02022528(struct SaveBlock2* sav2); +extern void FUN_0202BEDC(struct Pokemon* pokemon); +extern void FUN_0202BFD8(void* a0, s32 a1, struct Pokemon* pokemon); +extern u16 FUN_0202C000(struct Pokemon* pokemon); +extern void FUN_0204B9EC(struct UnkSavStruct80*); +extern u32 FUN_0204BA1C(struct UnkSavStruct80*); +extern u16 FUN_0204BAC4(struct UnkSavStruct80*); +extern u16 FUN_0204BAD4(struct UnkSavStruct80*); +extern u16 FUN_0204BAE4(struct UnkSavStruct80*); +extern void FUN_0205F224(struct ScriptState* state); +extern void FUN_0205F234(struct ScriptState* state); +extern void FUN_0208089C(struct Pokemon* pokemon, struct PlayerData* player, u32 a2, u32 a3, u32 heap_id); + +THUMB_FUNC BOOL ScrCmd_Unk0253(struct ScriptContext* ctx) +{ + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + if (unk == 0) + { + FUN_0205F224(state); + FUN_0204B9EC(ctx->unk80); + } + else if (unk == 1) + { + FUN_0205F234(state); + FUN_0204BA1C(ctx->unk80); + } + else + { + GF_ASSERT(FALSE); + } + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0254(struct ScriptContext* ctx) +{ + void* unk = FUN_02022528(ctx->unk80->saveBlock2); + struct Pokemon* pokemon = AllocMonZeroed(32); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + u16 eggs = FUN_0202C000(unk); + if (eggs == 6) { + *ret_ptr = 1; + } else { + *ret_ptr = 0; + } + + FreeToHeap(pokemon); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0255(struct ScriptContext* ctx) +{ + void* unk = FUN_02022528(ctx->unk80->saveBlock2); + struct PCStorage* pc = GetStoragePCPointer(ctx->unk80->saveBlock2); + struct Pokemon* pokemon = AllocMonZeroed(32); + struct PlayerData* player = Sav2_PlayerData_GetProfileAddr(ctx->unk80->saveBlock2); + struct Pokedex* pokedex = Sav2_Pokedex_get(ctx->unk80->saveBlock2); // unused + + for (s32 i = 0; i < PARTY_SIZE; i++) + { + FUN_0202BFD8(unk, i, pokemon); + FUN_0208089C(pokemon, player, 2, 0, 32); + + struct BoxPokemon* box_mon = FUN_020690E4(pokemon); + GF_ASSERT(PCStorage_PlaceMonInFirstEmptySlotInAnyBox(pc, box_mon)); + + FUN_0202C144(ctx->unk80->saveBlock2, pokemon); + } + + FreeToHeap(pokemon); + FUN_0202BEDC(unk); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0256(struct ScriptContext* ctx) +{ + u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + switch (unk) + { + case 0: + *ret_ptr = FUN_0204BAC4(ctx->unk80); + break; + case 1: + *ret_ptr = FUN_0204BAD4(ctx->unk80); + break; + case 2: + *ret_ptr = FUN_0204BAE4(ctx->unk80); + break; + case 3: + // For some reason, mwcc puts the FUN_0204BAD4 call before the FUN_0204BAC4 and FUN_0204BAE4 calls. + *ret_ptr = (u16)(FUN_0204BAC4(ctx->unk80) + FUN_0204BAE4(ctx->unk80) + FUN_0204BAD4(ctx->unk80)); + break; + } + + return FALSE; +} -- cgit v1.2.3 From 8958487e95618eaea84f4aaa02f68d3ef467a874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 3 Apr 2021 11:57:44 +0200 Subject: decomp unk_0205FA2C.s --- arm9/asm/unk_0205FA2C.s | 930 ------------------------------------------------ arm9/src/unk_0205FA2C.c | 595 +++++++++++++++++++++++++++++++ 2 files changed, 595 insertions(+), 930 deletions(-) delete mode 100644 arm9/asm/unk_0205FA2C.s create mode 100644 arm9/src/unk_0205FA2C.c (limited to 'arm9') diff --git a/arm9/asm/unk_0205FA2C.s b/arm9/asm/unk_0205FA2C.s deleted file mode 100644 index ae0d9d3f..00000000 --- a/arm9/asm/unk_0205FA2C.s +++ /dev/null @@ -1,930 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .extern UNK_020F96DC - .extern UNK_020FA6E8 - - .section .rodata - - .global UNK_020F7454 -UNK_020F7454: ; 0x020F7454 - .byte 0x00, 0x01, 0x02, 0x04, 0x03, 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00 - - .text - - thumb_func_start FUN_0205FA2C -FUN_0205FA2C: ; 0x0205FA2C - push {r3-r7, lr} - add r5, r0, #0x0 - add r7, r1, #0x0 - add r0, r2, #0x0 - mov r1, #0x40 - bl AllocFromHeapAtEnd - ldr r6, [r7, #0xc] - mov r1, #0x0 - mov r2, #0x40 - add r4, r0, #0x0 - bl MI_CpuFill8 - add r0, r6, #0x0 - bl Sav2_PlayerData_GetOptionsAddr - str r0, [r4, #0xc] - add r0, r6, #0x0 - bl SavArray_PlayerParty_get - str r0, [r4, #0x0] - add r0, r6, #0x0 - bl Sav2_Bag_get - str r0, [r4, #0x4] - add r0, r4, #0x0 - mov r1, #0x0 - add r0, #0x21 - strb r1, [r0, #0x0] - add r0, r4, #0x0 - ldrb r2, [r5, #0x8] - add r0, #0x20 - strb r2, [r0, #0x0] - add r0, r4, #0x0 - add r0, #0x32 - ldrb r0, [r0, #0x0] - mov r2, #0xf - ldrb r3, [r5, #0xa] - bic r0, r2 - mov r2, #0xf - and r2, r3 - orr r2, r0 - add r0, r4, #0x0 - add r0, #0x32 - strb r2, [r0, #0x0] - add r0, r4, #0x0 - add r0, #0x32 - ldrb r0, [r0, #0x0] - mov r2, #0xf0 - bic r0, r2 - ldrb r2, [r5, #0xb] - lsl r2, r2, #0x1c - lsr r2, r2, #0x18 - orr r2, r0 - add r0, r4, #0x0 - add r0, #0x32 - strb r2, [r0, #0x0] - add r0, r4, #0x0 - ldrb r2, [r5, #0xc] - add r0, #0x33 - strb r2, [r0, #0x0] - add r0, r4, #0x0 - ldrb r2, [r5, #0xd] - add r0, #0x22 - strb r2, [r0, #0x0] -_0205FAAE: - add r0, r5, r1 - ldrb r2, [r0, #0xe] - add r0, r4, r1 - add r0, #0x2c - strb r2, [r0, #0x0] - add r0, r1, #0x1 - lsl r0, r0, #0x18 - lsr r1, r0, #0x18 - cmp r1, #0x6 - blo _0205FAAE - ldr r1, _0205FAD4 ; =UNK_020F96DC - add r0, r7, #0x0 - add r2, r4, #0x0 - bl FUN_020373D4 - ldr r0, [r5, #0x14] - str r4, [r0, #0x0] - mov r0, #0x1 - pop {r3-r7, pc} - .balign 4 -_0205FAD4: .word UNK_020F96DC - - thumb_func_start FUN_0205FAD8 -FUN_0205FAD8: ; 0x0205FAD8 - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, r1, #0x0 - bl FUN_0204647C - cmp r0, #0x0 - beq _0205FAEA - mov r0, #0x1 - pop {r3-r5, pc} -_0205FAEA: - ldr r0, [r5, #0x14] - ldr r4, [r0, #0x0] - add r0, r4, #0x0 - add r0, #0x22 - ldrb r0, [r0, #0x0] - cmp r0, #0x6 - beq _0205FB04 - cmp r0, #0x7 - bne _0205FB0C - mov r0, #0x0 - str r0, [r5, #0x0] - mov r0, #0x4 - pop {r3-r5, pc} -_0205FB04: - mov r0, #0x1 - str r0, [r5, #0x0] - mov r0, #0x4 - pop {r3-r5, pc} -_0205FB0C: - add r0, r4, #0x0 - add r1, r5, #0x0 - add r0, #0x2c - add r1, #0xe - mov r2, #0x6 - bl MI_CpuCopy8 - add r0, r4, #0x0 - add r0, #0x22 - ldrb r0, [r0, #0x0] - strb r0, [r5, #0xd] - add r0, r4, #0x0 - bl FreeToHeap - ldr r0, [r5, #0x14] - mov r1, #0x0 - str r1, [r0, #0x0] - mov r0, #0x2 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_0205FB34 -FUN_0205FB34: ; 0x0205FB34 - push {r3-r7, lr} - add r7, r1, #0x0 - add r6, r0, #0x0 - ldr r5, [r7, #0xc] - add r0, r2, #0x0 - mov r1, #0x30 - bl AllocFromHeapAtEnd - mov r1, #0x0 - mov r2, #0x30 - add r4, r0, #0x0 - bl MI_CpuFill8 - add r0, r5, #0x0 - bl Sav2_PlayerData_GetOptionsAddr - str r0, [r4, #0x4] - add r0, r5, #0x0 - bl SavArray_PlayerParty_get - str r0, [r4, #0x0] - add r0, r5, #0x0 - bl FUN_0206BB28 - str r0, [r4, #0x1c] - add r0, r5, #0x0 - bl FUN_02079C70 - str r0, [r4, #0x2c] - mov r0, #0x1 - strb r0, [r4, #0x11] - ldrb r0, [r6, #0xd] - strb r0, [r4, #0x14] - ldr r0, [r4, #0x0] - bl GetPartyCount - strb r0, [r4, #0x13] - mov r0, #0x0 - strh r0, [r4, #0x18] - ldrb r0, [r6, #0x9] - strb r0, [r4, #0x12] - add r0, r5, #0x0 - bl FUN_0202A918 - str r0, [r4, #0x20] - ldr r1, _0205FBB8 ; =UNK_020F7454 - add r0, r4, #0x0 - bl FUN_0207B000 - add r0, r5, #0x0 - bl Sav2_PlayerData_GetProfileAddr - add r1, r0, #0x0 - add r0, r4, #0x0 - bl FUN_0207C2A4 - ldr r1, _0205FBBC ; =UNK_020FA6E8 - add r0, r7, #0x0 - add r2, r4, #0x0 - bl FUN_020373D4 - ldr r0, [r6, #0x14] - str r4, [r0, #0x0] - mov r0, #0x3 - pop {r3-r7, pc} - nop -_0205FBB8: .word UNK_020F7454 -_0205FBBC: .word UNK_020FA6E8 - - thumb_func_start FUN_0205FBC0 -FUN_0205FBC0: ; 0x0205FBC0 - push {r4, lr} - add r4, r0, #0x0 - add r0, r1, #0x0 - bl FUN_0204647C - cmp r0, #0x0 - beq _0205FBD2 - mov r0, #0x3 - pop {r4, pc} -_0205FBD2: - ldr r0, [r4, #0x14] - ldr r0, [r0, #0x0] - ldrb r1, [r0, #0x14] - strb r1, [r4, #0xd] - bl FreeToHeap - ldr r1, [r4, #0x14] - mov r0, #0x0 - str r0, [r1, #0x0] - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_0205FBE8 -FUN_0205FBE8: ; 0x0205FBE8 - push {r3-r5, lr} - add r4, r0, #0x0 - bl FUN_02046528 - add r5, r0, #0x0 - add r0, r4, #0x0 - bl FUN_0204652C - add r4, r0, #0x0 - ldr r1, [r4, #0x4] - cmp r1, #0x4 - bhi _0205FC4A - add r1, r1, r1 - add r1, pc - ldrh r1, [r1, #0x6] - lsl r1, r1, #0x10 - asr r1, r1, #0x10 - add pc, r1 -_0205FC0C: ; jump table (using 16-bit offset) - .short _0205FC16 - _0205FC0C - 2; case 0 - .short _0205FC22 - _0205FC0C - 2; case 1 - .short _0205FC2C - _0205FC0C - 2; case 2 - .short _0205FC38 - _0205FC0C - 2; case 3 - .short _0205FC42 - _0205FC0C - 2; case 4 -_0205FC16: - add r1, r5, #0x0 - mov r2, #0xb - bl FUN_0205FA2C - str r0, [r4, #0x4] - b _0205FC4A -_0205FC22: - add r1, r5, #0x0 - bl FUN_0205FAD8 - str r0, [r4, #0x4] - b _0205FC4A -_0205FC2C: - add r1, r5, #0x0 - mov r2, #0xb - bl FUN_0205FB34 - str r0, [r4, #0x4] - b _0205FC4A -_0205FC38: - add r1, r5, #0x0 - bl FUN_0205FBC0 - str r0, [r4, #0x4] - b _0205FC4A -_0205FC42: - bl FreeToHeap - mov r0, #0x1 - pop {r3-r5, pc} -_0205FC4A: - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_0205FC50 -FUN_0205FC50: ; 0x0205FC50 - push {r3-r7, lr} - add r5, r1, #0x0 - add r6, r2, #0x0 - add r7, r3, #0x0 - bl FUN_02046528 - str r0, [sp, #0x0] - mov r0, #0xb - mov r1, #0x18 - bl AllocFromHeap - add r4, r0, #0x0 - mov r1, #0x0 - mov r2, #0x18 - bl MI_CpuFill8 - strb r6, [r4, #0x8] - strb r7, [r4, #0x9] - add r0, sp, #0x8 - ldrb r1, [r0, #0x10] - add r2, r4, #0x0 - strb r1, [r4, #0xa] - ldrb r1, [r0, #0x14] - strb r1, [r4, #0xb] - ldrb r1, [r0, #0x18] - strb r1, [r4, #0xc] - ldrb r0, [r0, #0x1c] - ldr r1, _0205FC98 ; =FUN_0205FBE8 - strb r0, [r4, #0xd] - ldr r0, [sp, #0x0] - str r5, [r4, #0x14] - ldr r0, [r0, #0x10] - bl FUN_0204640C - pop {r3-r7, pc} - nop -_0205FC98: .word FUN_0205FBE8 - - thumb_func_start FUN_0205FC9C -FUN_0205FC9C: ; 0x0205FC9C - push {r3-r5, lr} - add r5, r1, #0x0 - add r4, r0, #0x0 - ldr r0, [r5, #0xc] - bl FUN_0203384C - cmp r0, #0x0 - beq _0205FCBC - ldrh r1, [r4, #0x12] - ldrh r2, [r4, #0x14] - add r0, r5, #0x0 - bl FUN_02038790 - str r0, [r4, #0x8] - mov r0, #0x1 - pop {r3-r5, pc} -_0205FCBC: - mov r0, #0x1 - str r0, [r4, #0x0] - mov r0, #0x2 - pop {r3-r5, pc} - - thumb_func_start FUN_0205FCC4 -FUN_0205FCC4: ; 0x0205FCC4 - push {r4, lr} - add r4, r0, #0x0 - add r0, r1, #0x0 - bl FUN_0204647C - cmp r0, #0x0 - beq _0205FCD6 - mov r0, #0x1 - pop {r4, pc} -_0205FCD6: - ldr r0, [r4, #0x8] - ldr r0, [r0, #0x20] - str r0, [r4, #0x0] - ldr r0, [r4, #0x8] - bl FreeToHeap - mov r0, #0x2 - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_0205FCE8 -FUN_0205FCE8: ; 0x0205FCE8 - push {r3-r5, lr} - add r4, r0, #0x0 - bl FUN_02046528 - add r5, r0, #0x0 - add r0, r4, #0x0 - bl FUN_0204652C - add r4, r0, #0x0 - ldr r1, [r4, #0x4] - cmp r1, #0x0 - beq _0205FD0A - cmp r1, #0x1 - beq _0205FD14 - cmp r1, #0x2 - beq _0205FD1E - b _0205FD34 -_0205FD0A: - add r1, r5, #0x0 - bl FUN_0205FC9C - str r0, [r4, #0x4] - b _0205FD34 -_0205FD14: - add r1, r5, #0x0 - bl FUN_0205FCC4 - str r0, [r4, #0x4] - b _0205FD34 -_0205FD1E: - ldrh r1, [r4, #0x10] - add r0, r5, #0x0 - bl GetVarPointer - ldr r1, [r4, #0x0] - strh r1, [r0, #0x0] - add r0, r4, #0x0 - bl FreeToHeap - mov r0, #0x1 - pop {r3-r5, pc} -_0205FD34: - mov r0, #0x0 - pop {r3-r5, pc} - - thumb_func_start FUN_0205FD38 -FUN_0205FD38: ; 0x0205FD38 - push {r3-r7, lr} - add r5, r1, #0x0 - add r6, r2, #0x0 - add r7, r3, #0x0 - bl FUN_02046528 - str r0, [sp, #0x0] - mov r0, #0xb - mov r1, #0x18 - bl AllocFromHeap - add r4, r0, #0x0 - mov r1, #0x0 - mov r2, #0x18 - bl MI_CpuFill8 - strh r5, [r4, #0x12] - strh r7, [r4, #0x14] - ldr r0, [sp, #0x0] - strh r6, [r4, #0x10] - ldr r0, [r0, #0x10] - ldr r1, _0205FD6C ; =FUN_0205FCE8 - add r2, r4, #0x0 - bl FUN_0204640C - pop {r3-r7, pc} - .balign 4 -_0205FD6C: .word FUN_0205FCE8 - - thumb_func_start FUN_0205FD70 -FUN_0205FD70: ; 0x0205FD70 - push {r3-r7, lr} - add r4, r0, #0x0 - bl FUN_02046528 - add r6, r0, #0x0 - add r0, r4, #0x0 - bl FUN_0204652C - add r5, r0, #0x0 - bl FUN_02031190 - mov r1, #0x1 - sub r0, r1, r0 - bl FUN_020316E0 - add r7, r0, #0x0 - bne _0205FD96 - mov r0, #0x0 - pop {r3-r7, pc} -_0205FD96: - ldrh r1, [r5, #0x2] - add r0, r6, #0x0 - bl GetVarPointer - add r4, r0, #0x0 - ldrh r0, [r5, #0x0] - cmp r0, #0x0 - beq _0205FDB0 - cmp r0, #0x1 - beq _0205FDBC - cmp r0, #0x2 - beq _0205FDC8 - b _0205FDD2 -_0205FDB0: - add r0, r6, #0x0 - add r1, r7, #0x0 - bl MOD06_02244660 - strh r0, [r4, #0x0] - b _0205FDD2 -_0205FDBC: - add r0, r6, #0x0 - add r1, r7, #0x0 - bl MOD06_022446BC - strh r0, [r4, #0x0] - b _0205FDD2 -_0205FDC8: - add r0, r6, #0x0 - add r1, r7, #0x0 - bl MOD06_022446E0 - strh r0, [r4, #0x0] -_0205FDD2: - add r0, r5, #0x0 - bl FreeToHeap - mov r0, #0x1 - pop {r3-r7, pc} - - thumb_func_start FUN_0205FDDC -FUN_0205FDDC: ; 0x0205FDDC - push {r3-r7, lr} - add r5, r1, #0x0 - add r6, r2, #0x0 - bl FUN_02046528 - add r7, r0, #0x0 - mov r0, #0xb - mov r1, #0x4 - bl AllocFromHeap - add r4, r0, #0x0 - mov r1, #0x0 - mov r2, #0x4 - bl MI_CpuFill8 - strh r5, [r4, #0x0] - strh r6, [r4, #0x2] - ldr r0, [r7, #0x10] - ldr r1, _0205FE0C ; =FUN_0205FD70 - add r2, r4, #0x0 - bl FUN_0204640C - pop {r3-r7, pc} - nop -_0205FE0C: .word FUN_0205FD70 - - thumb_func_start FUN_0205FE10 -FUN_0205FE10: ; 0x0205FE10 - push {r4-r7, lr} - sub sp, #0x14 - str r0, [sp, #0x0] - bl FUN_02029FC8 - mov r1, #0x35 - bl FUN_0202A150 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - str r0, [sp, #0x10] - cmp r0, #0x14 - bhs _0205FE30 - add sp, #0x14 - mov r0, #0x0 - pop {r4-r7, pc} -_0205FE30: - ldr r0, [sp, #0x0] - bl FUN_0202A8D8 - mov r1, #0xd - mov r2, #0x0 - add r4, r0, #0x0 - bl FUN_0202A578 - lsl r0, r0, #0x18 - mov r1, #0x0 - lsr r7, r0, #0x18 - add r0, r4, #0x0 - add r2, r1, #0x0 - bl FUN_0202A578 - lsl r0, r0, #0x18 - lsr r6, r0, #0x18 - add r0, r4, #0x0 - mov r1, #0x1 - mov r2, #0x0 - bl FUN_0202A578 - lsl r0, r0, #0x18 - lsr r5, r0, #0x18 - add r0, r4, #0x0 - mov r1, #0xe - mov r2, #0x0 - bl FUN_0202A578 - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - str r0, [sp, #0xc] - add r0, r4, #0x0 - mov r1, #0x2 - mov r2, #0x0 - bl FUN_0202A578 - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - str r0, [sp, #0x8] - add r0, r4, #0x0 - mov r1, #0x3 - mov r2, #0x0 - bl FUN_0202A578 - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - str r0, [sp, #0x4] - cmp r7, #0x0 - beq _0205FEA2 - cmp r6, #0x0 - beq _0205FEA2 - cmp r5, #0x0 - beq _0205FEA2 - add sp, #0x14 - mov r0, #0x0 - pop {r4-r7, pc} -_0205FEA2: - ldr r0, [sp, #0x0] - bl FUN_02026CC4 - cmp r7, #0x0 - bne _0205FEDC - mov r1, #0x55 - bl FUN_02025D94 - cmp r0, #0x0 - beq _0205FEC6 - add r0, r4, #0x0 - mov r1, #0xd - mov r2, #0x1 - bl FUN_0202A578 - add sp, #0x14 - mov r0, #0x1 - pop {r4-r7, pc} -_0205FEC6: - ldr r0, [sp, #0xc] - cmp r0, #0x0 - bne _0205FED6 - add r0, r4, #0x0 - mov r1, #0xe - mov r2, #0x1 - bl FUN_0202A578 -_0205FED6: - add sp, #0x14 - mov r0, #0x4 - pop {r4-r7, pc} -_0205FEDC: - ldr r1, [sp, #0x10] - cmp r1, #0x32 - bhs _0205FEE8 - add sp, #0x14 - mov r0, #0x0 - pop {r4-r7, pc} -_0205FEE8: - cmp r6, #0x0 - bne _0205FF1C - mov r1, #0x56 - bl FUN_02025D94 - cmp r0, #0x0 - beq _0205FF06 - add r0, r4, #0x0 - mov r1, #0x0 - mov r2, #0x1 - bl FUN_0202A578 - add sp, #0x14 - mov r0, #0x2 - pop {r4-r7, pc} -_0205FF06: - ldr r0, [sp, #0x8] - cmp r0, #0x0 - bne _0205FF16 - add r0, r4, #0x0 - mov r1, #0x2 - mov r2, #0x1 - bl FUN_0202A578 -_0205FF16: - add sp, #0x14 - mov r0, #0x4 - pop {r4-r7, pc} -_0205FF1C: - cmp r1, #0x64 - blo _0205FF24 - cmp r5, #0x0 - beq _0205FF2A -_0205FF24: - add sp, #0x14 - mov r0, #0x0 - pop {r4-r7, pc} -_0205FF2A: - mov r1, #0x57 - bl FUN_02025D94 - cmp r0, #0x0 - beq _0205FF44 - mov r1, #0x1 - add r0, r4, #0x0 - add r2, r1, #0x0 - bl FUN_0202A578 - add sp, #0x14 - mov r0, #0x3 - pop {r4-r7, pc} -_0205FF44: - ldr r0, [sp, #0x4] - cmp r0, #0x0 - bne _0205FF54 - add r0, r4, #0x0 - mov r1, #0x3 - mov r2, #0x1 - bl FUN_0202A578 -_0205FF54: - mov r0, #0x4 - add sp, #0x14 - pop {r4-r7, pc} - .balign 4 - - thumb_func_start FUN_0205FF5C -FUN_0205FF5C: ; 0x0205FF5C - push {r4-r7, lr} - sub sp, #0xc - add r4, r0, #0x0 - bl FUN_02029FC8 - mov r1, #0x35 - bl FUN_0202A150 - lsl r0, r0, #0x10 - lsr r7, r0, #0x10 - cmp r7, #0x14 - bhs _0205FF7A - add sp, #0xc - mov r0, #0x0 - pop {r4-r7, pc} -_0205FF7A: - add r0, r4, #0x0 - bl FUN_0202A8D8 - mov r1, #0xd - mov r2, #0x0 - str r0, [sp, #0x8] - bl FUN_0202A578 - lsl r0, r0, #0x18 - lsr r6, r0, #0x18 - mov r1, #0x0 - ldr r0, [sp, #0x8] - add r2, r1, #0x0 - bl FUN_0202A578 - lsl r0, r0, #0x18 - lsr r4, r0, #0x18 - ldr r0, [sp, #0x8] - mov r1, #0x1 - mov r2, #0x0 - bl FUN_0202A578 - lsl r0, r0, #0x18 - lsr r5, r0, #0x18 - ldr r0, [sp, #0x8] - mov r1, #0xe - mov r2, #0x0 - bl FUN_0202A578 - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - str r0, [sp, #0x4] - ldr r0, [sp, #0x8] - mov r1, #0x2 - mov r2, #0x0 - bl FUN_0202A578 - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - str r0, [sp, #0x0] - ldr r0, [sp, #0x8] - mov r1, #0x3 - mov r2, #0x0 - bl FUN_0202A578 - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - cmp r6, #0x0 - beq _0205FFEA - cmp r4, #0x0 - beq _0205FFEA - cmp r5, #0x0 - beq _0205FFEA - add sp, #0xc - mov r0, #0x0 - pop {r4-r7, pc} -_0205FFEA: - cmp r6, #0x0 - bne _02060000 - ldr r0, [sp, #0x4] - cmp r0, #0x0 - beq _0205FFFA - add sp, #0xc - mov r0, #0x4 - pop {r4-r7, pc} -_0205FFFA: - add sp, #0xc - mov r0, #0x1 - pop {r4-r7, pc} -_02060000: - cmp r7, #0x32 - bhs _0206000A - add sp, #0xc - mov r0, #0x0 - pop {r4-r7, pc} -_0206000A: - cmp r4, #0x0 - bne _02060020 - ldr r0, [sp, #0x0] - cmp r0, #0x0 - beq _0206001A - add sp, #0xc - mov r0, #0x5 - pop {r4-r7, pc} -_0206001A: - add sp, #0xc - mov r0, #0x2 - pop {r4-r7, pc} -_02060020: - cmp r7, #0x64 - bhs _0206002A - add sp, #0xc - mov r0, #0x0 - pop {r4-r7, pc} -_0206002A: - cmp r5, #0x0 - beq _02060034 - add sp, #0xc - mov r0, #0x0 - pop {r4-r7, pc} -_02060034: - cmp r0, #0x0 - beq _0206003E - add sp, #0xc - mov r0, #0x6 - pop {r4-r7, pc} -_0206003E: - mov r0, #0x3 - add sp, #0xc - pop {r4-r7, pc} - - thumb_func_start FUN_02060044 -FUN_02060044: ; 0x02060044 - add r0, #0xa8 - ldr r0, [r0, #0x0] - ldr r2, [r1, #0x0] - ldrh r3, [r0, #0x24] - add r2, r3, r2 - strh r2, [r0, #0x24] - ldrh r3, [r0, #0x28] - ldr r2, [r1, #0x4] - add r2, r3, r2 - strh r2, [r0, #0x28] - ldrh r2, [r0, #0x26] - ldr r1, [r1, #0x8] - add r1, r2, r1 - strh r1, [r0, #0x26] - bx lr - .balign 4 - - thumb_func_start FUN_02060064 -FUN_02060064: ; 0x02060064 - ldr r1, _0206006C ; =0x02E90EDD - mul r1, r0 - add r0, r1, #0x1 - bx lr - .balign 4 -_0206006C: .word 0x02E90EDD - - thumb_func_start FUN_02060070 -FUN_02060070: ; 0x02060070 - ldr r1, _02060078 ; =0x5D588B65 - mul r1, r0 - add r0, r1, #0x1 - bx lr - .balign 4 -_02060078: .word 0x5D588B65 - - thumb_func_start FUN_0206007C -FUN_0206007C: ; 0x0206007C - push {r3-r5, lr} - add r5, r0, #0x0 - bl FUN_0202881C - bl FUN_020287A4 - bl FUN_02060070 - add r4, r0, #0x0 - add r0, r5, #0x0 - bl FUN_0202A8D8 - add r1, r4, #0x0 - bl FUN_0202A5CC - add r0, r4, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_020600A0 -FUN_020600A0: ; 0x020600A0 - push {r3-r6, lr} - sub sp, #0x4 - add r5, r0, #0x0 - bl FUN_0202A8D8 - add r6, r0, #0x0 - bl FUN_0202A5D0 - bl FUN_02060070 - add r4, r0, #0x0 - add r0, r6, #0x0 - add r1, r4, #0x0 - bl FUN_0202A5CC - add r0, r4, #0x0 - bl FUN_02060064 - str r0, [sp, #0x0] - add r0, r5, #0x0 - bl FUN_0202A8CC - mov r1, #0xa - add r2, sp, #0x0 - bl FUN_0202A2C4 - ldr r0, [sp, #0x0] - add sp, #0x4 - pop {r3-r6, pc} - .balign 4 - - thumb_func_start FUN_020600DC -FUN_020600DC: ; 0x020600DC - push {r3-r6, lr} - sub sp, #0x4 - add r6, r0, #0x0 - bl FUN_0202A8D8 - add r4, r0, #0x0 - add r0, r6, #0x0 - bl FUN_0202A8CC - add r5, r0, #0x0 - add r0, r4, #0x0 - bl FUN_0202A5D0 - bl FUN_02060064 - mov r1, #0x0 - str r0, [sp, #0x0] - add r0, r5, #0x0 - add r2, r1, #0x0 - bl FUN_0202A240 - add r1, r0, #0x0 - lsl r1, r1, #0x10 - add r0, r4, #0x0 - lsr r1, r1, #0x10 - mov r2, #0x0 - bl FUN_0202A538 - mov r1, #0x18 - add r5, r0, #0x0 - mul r5, r1 - mov r4, #0x0 - cmp r5, #0x0 - ble _0206012E - ldr r0, [sp, #0x0] -_02060122: - bl FUN_02060064 - add r4, r4, #0x1 - str r0, [sp, #0x0] - cmp r4, r5 - blt _02060122 -_0206012E: - add r0, r6, #0x0 - bl FUN_0202A8CC - mov r1, #0xa - add r2, sp, #0x0 - bl FUN_0202A2C4 - ldr r0, [sp, #0x0] - add sp, #0x4 - pop {r3-r6, pc} - .balign 4 - - thumb_func_start FUN_02060144 -FUN_02060144: ; 0x02060144 - ldr r0, [r0, #0x1c] - ldr r1, [r0, #0x0] - ldr r0, _02060158 ; =0x000001ED - cmp r1, r0 - bne _02060152 - mov r0, #0x1 - bx lr -_02060152: - mov r0, #0x0 - bx lr - nop -_02060158: .word 0x000001ED diff --git a/arm9/src/unk_0205FA2C.c b/arm9/src/unk_0205FA2C.c new file mode 100644 index 00000000..e5c717b8 --- /dev/null +++ b/arm9/src/unk_0205FA2C.c @@ -0,0 +1,595 @@ +#include "unk_0205FA2C.h" + +extern void *UNK_020F96DC; +extern void *UNK_020FA6E8; +extern u32 FUN_02079C70(struct SaveBlock2 *sav2); +extern void FUN_0207B000(void *ptr, u8 param1[12]); +extern void FUN_0207C2A4(void *ptr, struct PlayerData *player_data); +extern u32 FUN_0203384C(u32 param0); +extern u32 FUN_02038790(u32 *param0, u16 param1, u16 param2); +extern u16 *GetVarPointer(void *arg, u16); +extern u32 FUN_02031190(); +extern u32 FUN_020316E0(u32 param0); +extern u16 MOD06_02244660(struct UnkStruct_0204639C *param0, u32 param1); +extern u16 MOD06_022446BC(struct UnkStruct_0204639C *param0, u32 param1); +extern u16 MOD06_022446E0(struct UnkStruct_0204639C *param0, u32 param1); +extern void FUN_0202A5CC(u32 param0, u32 param1); +extern u32 FUN_0202A5D0(u32 param0); +extern u32 FUN_0202A150(struct UnkStruct_02029FB0 *param0, u32 param1); +extern u32 FUN_0202A8D8(struct SaveBlock2 *sav2); +extern u32 FUN_0202A578(u32 param0, u32 param1, u32 param2); +extern u32 FUN_02026CC4(struct SaveBlock2 *sav2); +extern u32 FUN_02025D94(u32 param0, u32 param1); +extern u32 FUN_0202A8CC(struct SaveBlock2 *sav2); +extern void FUN_0202A2C4(u32 param0, u32 param1, u32 *param2); +extern u32 FUN_0202A240(u32 param0, u32 param1, u32 param2); +extern int FUN_0202A538(u32 param0, u16 param1, u32 param2); + +struct UnkStruct3 +{ + /* 0x00 */ struct PlayerParty *player_party; + /* 0x04 */ struct Bag *bag; + u32 unk08; + /* 0x0c */ struct Options *options; + u32 unk10[4]; + u8 unk20; + u8 unk21; + u8 unk22; + u8 unk23; + u32 unk24[2]; + u8 unk2c[6]; + u8 unk32:4; + u8 unk322:4; + u8 unk33; + u32 unk34[3]; +}; + +THUMB_FUNC u32 FUN_0205FA2C(u8 *param0, struct UnkStruct_0204639C *param1, u32 heap_id) +{ + struct UnkStruct3 *ptr = + (struct UnkStruct3 *)AllocFromHeapAtEnd(heap_id, sizeof(struct UnkStruct3)); + + struct SaveBlock2 *sav2 = (struct SaveBlock2 *)(param1->unkC); + MI_CpuFill8(ptr, 0, sizeof(struct UnkStruct3)); + + ptr->options = Sav2_PlayerData_GetOptionsAddr(sav2); + + ptr->player_party = SavArray_PlayerParty_get(sav2); + + ptr->bag = Sav2_Bag_get(sav2); + + ptr->unk21 = 0; + ptr->unk20 = param0[8]; + ptr->unk32 = param0[10]; + ptr->unk322 = param0[11]; + ptr->unk33 = param0[0xc]; + ptr->unk22 = param0[0xd]; + + for (u8 i = 0; i < 6; i++) + { + ptr->unk2c[i] = param0[i + 0xe]; + + } + + + FUN_020373D4(param1, &UNK_020F96DC, ptr); + + *((u32 **)param0)[5] = ptr; + + return 1; +} + +THUMB_FUNC u32 FUN_0205FAD8(u8 *param0, void *param1) +{ + if (FUN_0204647C(param1)) + { + return 1; + } + + void *ptr = *((u32 **)param0)[5]; + + u8 r1 = *(u8 *)(ptr + 0x22); + if (r1 != 6) + { + if (r1 == 7) + { + ((u32 *)param0)[0] = 0; + return 4; + } + } + else + { + ((u32 *)param0)[0] = 1; + return 4; + } + + MI_CpuCopy8(ptr + 0x2c, param0 + 0xe, 6); + + param0[0xd] = *(u8 *)(ptr + 0x22); + FreeToHeap(ptr); + + *((u32 **)param0)[5] = 0; + + return 2; +} + + +struct UnkStruct4 { + /* 0x00 */ struct PlayerData *player_data; + /* 0x04 */ struct Options *options; + u32 unk08; + u32 unk0c; + u8 unk10; + u8 unk11; + u8 unk12; + u8 unk13; + u8 unk14; + u8 unk15[3]; + u16 unk18; + u16 unk1a; + u32 unk1c; + u32 unk20; + u32 unk24; + u32 unk28; + u32 unk2c; + +}; + +THUMB_FUNC u32 FUN_0205FB34(u8 *param0, struct UnkStruct_0204639C *param1, u32 heap_id) +{ + struct SaveBlock2 *sav2 = (struct SaveBlock2 *)(param1->unkC); + + struct UnkStruct4 *ptr = (struct UnkStruct4 *)AllocFromHeapAtEnd(heap_id, sizeof(struct UnkStruct4)); + MI_CpuFill8(ptr, 0, sizeof(struct UnkStruct4)); + + ptr->options = Sav2_PlayerData_GetOptionsAddr(sav2); + ptr->player_data = SavArray_PlayerParty_get(sav2); + ptr->unk1c = FUN_0206BB28(sav2); + ptr->unk2c = FUN_02079C70(sav2); + + ptr->unk11 = 1; + ptr->unk14 = param0[0xd]; + + ptr->unk13 = GetPartyCount(*(u32 *)ptr); + + ptr->unk18 = 0; + ptr->unk12 = param0[9]; + + ptr->unk20 = FUN_0202A918(sav2); + + FUN_0207B000(ptr, UNK_020F7454); + + FUN_0207C2A4(ptr, Sav2_PlayerData_GetProfileAddr(sav2)); + + FUN_020373D4(param1, &UNK_020FA6E8, ptr); + + *((u32 **)param0)[5] = ptr; + + return 3; +} + +THUMB_FUNC u32 FUN_0205FBC0(u8 ***param0, void *param1) +{ + if (FUN_0204647C(param1)) + { + return 3; + } + + u8 *r0 = param0[5][0]; + ((u8 *)param0)[0xd] = r0[20]; + FreeToHeap(r0); + + param0[5][0] = 0; + + return 0; +} + +THUMB_FUNC int FUN_0205FBE8(struct UnkStruct_0204639C *param0) +{ + struct UnkStruct_0204639C *res = FUN_02046528(param0); + struct SaveBlock2 *sav2 = (struct SaveBlock2 *)FUN_0204652C(param0); + switch (sav2->unk_00004) + { + case 0: + sav2->unk_00004 = FUN_0205FA2C((u8 *)sav2, res, 0xb); + break; + case 1: + sav2->unk_00004 = FUN_0205FAD8((u8 *)sav2, res); + break; + case 2: + sav2->unk_00004 = FUN_0205FB34((u8 *)sav2, res, 0xb); + break; + case 3: + sav2->unk_00004 = FUN_0205FBC0((u8 ***)sav2, res); + break; + case 4: + FreeToHeap(sav2); + return 1; + } + + return 0; +} + +struct UnkStruct1 +{ + u32 unk00; + u32 unk04; + u8 unk08; + u8 unk09; + u8 unk0a; + u8 unk0b; + u8 unk0c; + u8 unk0d; + u16 unk0e; + u32 unk10; + u32 unk14; +}; + +THUMB_FUNC void FUN_0205FC50(struct UnkStruct_0204639C *param0, + u32 param1, + u8 param2, + u8 param3, + u8 param4, + u8 param5, + u8 param6, + u8 param7) +{ + struct UnkStruct_0204639C *res = FUN_02046528(param0); + + struct UnkStruct1 *ptr = (struct UnkStruct1 *)AllocFromHeap(0xb, sizeof(struct UnkStruct1)); + MI_CpuFill8(ptr, 0, sizeof(struct UnkStruct1)); + ptr->unk08 = param2; + ptr->unk09 = param3; + + ptr->unk0a = param4; + ptr->unk0b = param5; + ptr->unk0c = param6; + ptr->unk0d = param7; + ptr->unk14 = param1; + + FUN_0204640C(res->unk10, &FUN_0205FBE8, (u32 *)ptr); +} + +THUMB_FUNC u32 FUN_0205FC9C(u16 *param0, u32 *param1) +{ + if (FUN_0203384C(param1[3])) + { + + ((u32 *)param0)[2] = FUN_02038790(param1, param0[9], param0[10]); + return 1; + } + + ((u32 *)param0)[0] = 1; + return 2; +} + +THUMB_FUNC u32 FUN_0205FCC4(u32 **param0, void *param1) +{ + if (FUN_0204647C(param1)) + { + return 1; + } + + param0[0] = param0[2][8]; + FreeToHeap(param0[2]); + + return 2; +} + +THUMB_FUNC int FUN_0205FCE8(struct UnkStruct_0204639C *param0) +{ + struct UnkStruct_0204639C *res = FUN_02046528(param0); + struct SaveBlock2 *sav2 = (struct SaveBlock2 *)FUN_0204652C(param0); + + switch (sav2->unk_00004) + { + case 0: + sav2->unk_00004 = FUN_0205FC9C((u16 *)sav2, (u32 *)res); + break; + case 1: + sav2->unk_00004 = FUN_0205FCC4((u32 **)sav2, (void *)res); + break; + case 2: + u16 *var = GetVarPointer(res, ((u16 *)sav2)[8]); + *var = sav2->flashOkay; + FreeToHeap(sav2); + + return 1; + } + + return 0; +} + +struct UnkStruct2 +{ + u32 unk00; + u32 unk04; + u8 unk08; + u8 unk09; + u8 unk0a; + u8 unk0b; + u8 unk0c; + u8 unk0d; + u16 unk0e; + u16 unk10; + u16 unk12; + u16 unk14; + u16 unk16; +}; + +THUMB_FUNC void FUN_0205FD38(struct UnkStruct_0204639C *param0, u16 param1, u16 param2, u16 param3) +{ + struct UnkStruct_0204639C *res = FUN_02046528(param0); + struct UnkStruct2 *ptr = (struct UnkStruct2 *)AllocFromHeap(0xb, sizeof(struct UnkStruct2)); + MI_CpuFill8(ptr, 0, sizeof(struct UnkStruct2)); + + ptr->unk12 = param1; + ptr->unk14 = param3; + ptr->unk10 = param2; + + FUN_0204640C(res->unk10, &FUN_0205FCE8, (u32 *)ptr); +} + +THUMB_FUNC int FUN_0205FD70(struct UnkStruct_0204639C *param0) +{ + struct UnkStruct_0204639C *res = FUN_02046528(param0); + u16 *res2 = (u16 *)FUN_0204652C(param0); + u32 res3 = FUN_020316E0(1 - FUN_02031190()); + if (res3 == 0) + { + return 0; + } + + u16 *var = GetVarPointer(res, res2[1]); + switch (res2[0]) + { + case 0: + *var = MOD06_02244660(res, res3); + break; + case 1: + *var = MOD06_022446BC(res, res3); + + break; + case 2: + *var = MOD06_022446E0(res, res3); + + break; + } + + FreeToHeap(res2); + + return 1; +} + +THUMB_FUNC void FUN_0205FDDC(struct UnkStruct_0204639C *param0, u16 param1, u16 param2) +{ + struct UnkStruct_0204639C *res = FUN_02046528(param0); + + u16 *ptr = AllocFromHeap(0xb, 2 * sizeof(u16)); + MI_CpuFill8(ptr, 0, 2 * sizeof(u16)); + + ptr[0] = param1; + ptr[1] = param2; + + FUN_0204640C(res->unk10, &FUN_0205FD70, ptr); +} + +THUMB_FUNC u32 FUN_0205FE10(struct SaveBlock2 *sav2) +{ + + u16 res = FUN_0202A150(FUN_02029FC8(sav2), 0x35); + if (res < 20) + { + return 0; + } + + u32 res2 = FUN_0202A8D8(sav2); + + u8 res3 = FUN_0202A578(res2, 0xd, 0); + u8 res4 = FUN_0202A578(res2, 0, 0); + u8 res5 = FUN_0202A578(res2, 1, 0); + + u8 res6 = FUN_0202A578(res2, 0xe, 0); + u8 res7 = FUN_0202A578(res2, 2, 0); + u8 res8 = FUN_0202A578(res2, 3, 0); + + if (res3 != 0 && res4 != 0 && res5 != 0) + { + return 0; + } + + u32 res9 = FUN_02026CC4(sav2); + if (res3 == 0) + { + if (FUN_02025D94(res9, 0x55) != 0) + { + FUN_0202A578(res2, 0xd, 1); + return 1; + } + + if (res6 == 0) + { + FUN_0202A578(res2, 0xe, 1); + } + + return 4; + } + + if (res < 50) + { + return 0; + } + + if (res4 == 0) + { + if (FUN_02025D94(res9, 0x56) != 0) + { + FUN_0202A578(res2, 0, 1); + return 2; + } + + if (res7 == 0) + { + FUN_0202A578(res2, 2, 1); + } + + return 4; + } + + if (res < 100 || res5 != 0) + { + return 0; + } + + if (FUN_02025D94(res9, 0x57) != 0) + { + FUN_0202A578(res2, 1, 1); + return 3; + } + + if (res8 == 0) + { + FUN_0202A578(res2, 3, 1); + } + + return 4; +} + +THUMB_FUNC u32 FUN_0205FF5C(struct SaveBlock2 *sav2) +{ + u16 res = FUN_0202A150(FUN_02029FC8(sav2), 0x35); + if (res < 20) + { + return 0; + } + + u32 res2 = FUN_0202A8D8(sav2); + + u8 res3 = FUN_0202A578(res2, 0xd, 0); + u8 res4 = FUN_0202A578(res2, 0, 0); + u8 res5 = FUN_0202A578(res2, 1, 0); + + u8 res6 = FUN_0202A578(res2, 0xe, 0); + u8 res7 = FUN_0202A578(res2, 2, 0); + u8 res8 = FUN_0202A578(res2, 3, 0); + + if (res3 != 0 && res4 != 0 && res5 != 0) + { + return 0; + } + + if (res3 == 0) + { + if (res6 != 0) + { + return 4; + } + + return 1; + } + + if (res < 50) + { + return 0; + } + + if (res4 == 0) + { + if (res7 != 0) + { + return 5; + } + + return 2; + } + + if (res < 100) + { + return 0; + } + + if (res5 != 0) + { + return 0; + } + + if (res8 != 0) + { + return 6; + } + + return 3; +} + +THUMB_FUNC void FUN_02060044(u16 **param0, u32 *param1) +{ + u16 *ptr = param0[42]; + + ptr[18] += param1[0]; + ptr[20] += param1[1]; + ptr[19] += param1[2]; +} + +THUMB_FUNC u32 FUN_02060064(u32 param0) +{ + return param0 * 0x02E90EDD + 1; +} + +THUMB_FUNC u32 FUN_02060070(u32 param0) +{ + return param0 * 0x5D588B65 + 1; +} + +THUMB_FUNC u32 FUN_0206007C(struct SaveBlock2 *sav2) +{ + u32 res = FUN_02060070(FUN_020287A4(FUN_0202881C(sav2))); + + FUN_0202A5CC(FUN_0202A8D8(sav2), res); + + return res; +} + +THUMB_FUNC u32 FUN_020600A0(struct SaveBlock2 *sav2) +{ + u32 res = FUN_0202A8D8(sav2); + + u32 res2 = FUN_02060070(FUN_0202A5D0(res)); + + FUN_0202A5CC(res, res2); + u32 res3 = FUN_02060064(res2); + + FUN_0202A2C4(FUN_0202A8CC(sav2), 0xa, &res3); + + return res3; +} + +THUMB_FUNC u32 FUN_020600DC(struct SaveBlock2 *sav2) +{ + u32 res = FUN_0202A8D8(sav2); + + u32 res2 = FUN_0202A8CC(sav2); + + u32 res3 = FUN_02060064(FUN_0202A5D0(res)); + + int i = 0; + int res4 = FUN_0202A538(res, FUN_0202A240(res2, 0, 0), 0) * 0x18; + + for (i = 0; i < res4; i++) + { + res3 = FUN_02060064(res3); + } + + FUN_0202A2C4(FUN_0202A8CC(sav2), 0xa, &res3); + + return res3; +} + +THUMB_FUNC BOOL FUN_02060144(u32 **param0) +{ + if (param0[7][0] == 0x1ED) + { + return TRUE; + } + + return FALSE; +} -- cgit v1.2.3 From b20e00af7417022971bdf37870b66ccb8d3c52a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 3 Apr 2021 15:11:23 +0200 Subject: better structs and signatures --- arm9/asm/unk_02035068.s | 6 +- arm9/asm/unk_020377F0.s | 10 +- arm9/asm/unk_02050E48.s | 2 +- arm9/global.inc | 4 +- arm9/modules/11/asm/module_11_thumb2.s | 2 +- arm9/modules/14/asm/module_14.s | 4 +- arm9/src/unk_0205FA2C.c | 245 ++++++++++++--------------------- arm9/src/unk_0206BB28.c | 6 +- 8 files changed, 108 insertions(+), 171 deletions(-) (limited to 'arm9') diff --git a/arm9/asm/unk_02035068.s b/arm9/asm/unk_02035068.s index 0c8e3612..f0cdc150 100644 --- a/arm9/asm/unk_02035068.s +++ b/arm9/asm/unk_02035068.s @@ -1870,7 +1870,7 @@ _02035ECC: bl FUN_0202A918 str r0, [r7, #0x20] ldr r0, [r5, #0xc] - bl FUN_0206BB28 + bl SavArray_IsNatDexEnabled str r0, [r7, #0x1c] ldr r0, [r5, #0xc] bl FUN_02079C70 @@ -1918,7 +1918,7 @@ _02035F4A: mov r0, #0x2 strb r0, [r7, #0x12] ldr r0, [r5, #0xc] - bl FUN_0206BB28 + bl SavArray_IsNatDexEnabled str r0, [r7, #0x1c] ldr r0, [r5, #0xc] bl FUN_02079C70 @@ -1975,7 +1975,7 @@ _02035FD0: mov r0, #0x2 strb r0, [r7, #0x12] ldr r0, [r5, #0xc] - bl FUN_0206BB28 + bl SavArray_IsNatDexEnabled str r0, [r7, #0x1c] ldr r0, [r5, #0xc] bl FUN_02079C70 diff --git a/arm9/asm/unk_020377F0.s b/arm9/asm/unk_020377F0.s index 9d5e2f32..7c45ad7a 100644 --- a/arm9/asm/unk_020377F0.s +++ b/arm9/asm/unk_020377F0.s @@ -773,7 +773,7 @@ FUN_02037C00: ; 0x02037C00 bl FUN_0202A918 str r0, [r4, #0x20] ldr r0, [r5, #0xc] - bl FUN_0206BB28 + bl SavArray_IsNatDexEnabled str r0, [r4, #0x1c] ldr r0, [r5, #0xc] bl FUN_02079C70 @@ -827,7 +827,7 @@ FUN_02037C7C: ; 0x02037C7C strh r0, [r4, #0x18] strb r6, [r4, #0x12] add r0, r5, #0x0 - bl FUN_0206BB28 + bl SavArray_IsNatDexEnabled str r0, [r4, #0x1c] add r0, r5, #0x0 bl FUN_02079C70 @@ -874,7 +874,7 @@ FUN_02037CF0: ; 0x02037CF0 mov r0, #0x2 strb r0, [r4, #0x12] ldr r0, [r5, #0xc] - bl FUN_0206BB28 + bl SavArray_IsNatDexEnabled str r0, [r4, #0x1c] ldr r0, [r5, #0xc] bl FUN_02079C70 @@ -1426,7 +1426,7 @@ FUN_02038144: ; 0x02038144 bl Sav2_Pokedex_get str r0, [r5, #0x24] ldr r0, [r4, #0xc] - bl FUN_0206BB28 + bl SavArray_IsNatDexEnabled str r0, [r5, #0x30] ldr r0, [r4, #0xc] str r0, [r5, #0x10] @@ -2157,7 +2157,7 @@ FUN_020386E0: ; 0x020386E0 ldr r0, [r5, #0xc] str r0, [r4, #0x20] ldr r0, [r5, #0xc] - bl FUN_0206BB28 + bl SavArray_IsNatDexEnabled str r0, [r4, #0x34] ldr r0, [r4, #0x14] bl FUN_02033830 diff --git a/arm9/asm/unk_02050E48.s b/arm9/asm/unk_02050E48.s index 5746b23f..c8a8a153 100644 --- a/arm9/asm/unk_02050E48.s +++ b/arm9/asm/unk_02050E48.s @@ -35,7 +35,7 @@ FUN_02050E48: ; 0x02050E48 add r0, r4, #0x0 bl FUN_0207C2A4 add r0, r6, #0x0 - bl FUN_0206BB28 + bl SavArray_IsNatDexEnabled str r0, [r4, #0x1c] add r0, r6, #0x0 bl FUN_02079C70 diff --git a/arm9/global.inc b/arm9/global.inc index a2fd15c3..d77b0a72 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -4887,8 +4887,8 @@ .extern CopyPlayerParty .extern PartyHasMon .extern SavArray_PlayerParty_get -.extern FUN_0206BB28 -.extern FUN_0206BB34 +.extern SavArray_IsNatDexEnabled +.extern Pokedex_IsNatDexEnabled .extern FUN_0206BB48 .extern FUN_0206BB5C .extern FUN_0206BB74 diff --git a/arm9/modules/11/asm/module_11_thumb2.s b/arm9/modules/11/asm/module_11_thumb2.s index 3e416af6..62996375 100644 --- a/arm9/modules/11/asm/module_11_thumb2.s +++ b/arm9/modules/11/asm/module_11_thumb2.s @@ -25381,7 +25381,7 @@ _0223B916: str r0, [sp, #0xe0] ldr r0, [r4] bl MOD11_022300D0 - bl FUN_0206BB34 + bl Pokedex_IsNatDexEnabled str r0, [sp, #0xe4] bl FUN_0201D658 str r0, [r4, #0x54] diff --git a/arm9/modules/14/asm/module_14.s b/arm9/modules/14/asm/module_14.s index edbb6d86..37a18d6d 100644 --- a/arm9/modules/14/asm/module_14.s +++ b/arm9/modules/14/asm/module_14.s @@ -1925,7 +1925,7 @@ _021D84AA: str r1, [r4, r0] sub r0, #0x38 ldr r0, [r4, r0] - bl FUN_0206BB28 + bl SavArray_IsNatDexEnabled mov r1, #0x52 lsl r1, r1, #2 str r0, [r4, r1] @@ -9205,7 +9205,7 @@ MOD14_021DBEAC: ; 0x021DBEAC mov r0, #0x47 lsl r0, r0, #2 ldr r0, [r6, r0] - bl FUN_0206BB28 + bl SavArray_IsNatDexEnabled ldrh r1, [r4, #4] bl FUN_0206BB48 strh r0, [r4, #8] diff --git a/arm9/src/unk_0205FA2C.c b/arm9/src/unk_0205FA2C.c index e5c717b8..dde83a06 100644 --- a/arm9/src/unk_0205FA2C.c +++ b/arm9/src/unk_0205FA2C.c @@ -3,11 +3,11 @@ extern void *UNK_020F96DC; extern void *UNK_020FA6E8; extern u32 FUN_02079C70(struct SaveBlock2 *sav2); -extern void FUN_0207B000(void *ptr, u8 param1[12]); -extern void FUN_0207C2A4(void *ptr, struct PlayerData *player_data); -extern u32 FUN_0203384C(u32 param0); -extern u32 FUN_02038790(u32 *param0, u16 param1, u16 param2); -extern u16 *GetVarPointer(void *arg, u16); +extern void FUN_0207B000(struct UnkPlayerStruct2_0205FA2C *ptr, const u8 param1[12]); +extern void FUN_0207C2A4(struct UnkPlayerStruct2_0205FA2C *ptr, struct PlayerData *player_data); +extern u32 FUN_0203384C(u32 *param0); +extern u32 *FUN_02038790(struct UnkStruct_0204639C *param0, u16 param1, u16 param2); +extern u16 *GetVarPointer(struct UnkSavStruct80 *arg, u16); extern u32 FUN_02031190(); extern u32 FUN_020316E0(u32 param0); extern u16 MOD06_02244660(struct UnkStruct_0204639C *param0, u32 param1); @@ -25,32 +25,15 @@ extern void FUN_0202A2C4(u32 param0, u32 param1, u32 *param2); extern u32 FUN_0202A240(u32 param0, u32 param1, u32 param2); extern int FUN_0202A538(u32 param0, u16 param1, u32 param2); -struct UnkStruct3 -{ - /* 0x00 */ struct PlayerParty *player_party; - /* 0x04 */ struct Bag *bag; - u32 unk08; - /* 0x0c */ struct Options *options; - u32 unk10[4]; - u8 unk20; - u8 unk21; - u8 unk22; - u8 unk23; - u32 unk24[2]; - u8 unk2c[6]; - u8 unk32:4; - u8 unk322:4; - u8 unk33; - u32 unk34[3]; -}; - -THUMB_FUNC u32 FUN_0205FA2C(u8 *param0, struct UnkStruct_0204639C *param1, u32 heap_id) + + +THUMB_FUNC u32 FUN_0205FA2C(struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1, u32 heap_id) { - struct UnkStruct3 *ptr = - (struct UnkStruct3 *)AllocFromHeapAtEnd(heap_id, sizeof(struct UnkStruct3)); + struct UnkPlayerStruct1_0205FA2C *ptr = + (struct UnkPlayerStruct1_0205FA2C *)AllocFromHeapAtEnd(heap_id, sizeof(struct UnkPlayerStruct1_0205FA2C)); struct SaveBlock2 *sav2 = (struct SaveBlock2 *)(param1->unkC); - MI_CpuFill8(ptr, 0, sizeof(struct UnkStruct3)); + MI_CpuFill8(ptr, 0, sizeof(struct UnkPlayerStruct1_0205FA2C)); ptr->options = Sav2_PlayerData_GetOptionsAddr(sav2); @@ -59,101 +42,83 @@ THUMB_FUNC u32 FUN_0205FA2C(u8 *param0, struct UnkStruct_0204639C *param1, u32 h ptr->bag = Sav2_Bag_get(sav2); ptr->unk21 = 0; - ptr->unk20 = param0[8]; - ptr->unk32 = param0[10]; - ptr->unk322 = param0[11]; - ptr->unk33 = param0[0xc]; - ptr->unk22 = param0[0xd]; + ptr->unk20 = param0->unk08; + ptr->unk32 = param0->unk0a; + ptr->unk322 = param0->unk0b; + ptr->unk33 = param0->unk0c; + ptr->unk22 = param0->unk0d; for (u8 i = 0; i < 6; i++) { - ptr->unk2c[i] = param0[i + 0xe]; + ptr->unk2c[i] = param0->unk0e[i]; } - FUN_020373D4(param1, &UNK_020F96DC, ptr); + FUN_020373D4(param1, (u32)&UNK_020F96DC, (u32)ptr); - *((u32 **)param0)[5] = ptr; + *param0->unk14 = ptr; return 1; } -THUMB_FUNC u32 FUN_0205FAD8(u8 *param0, void *param1) +THUMB_FUNC u32 FUN_0205FAD8(struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1) { if (FUN_0204647C(param1)) { return 1; } - void *ptr = *((u32 **)param0)[5]; + struct UnkPlayerStruct1_0205FA2C *ptr = (struct UnkPlayerStruct1_0205FA2C *)*param0->unk14; - u8 r1 = *(u8 *)(ptr + 0x22); + u8 r1 = ptr->unk22; if (r1 != 6) { if (r1 == 7) { - ((u32 *)param0)[0] = 0; + param0->unk00 = 0; return 4; } } else { - ((u32 *)param0)[0] = 1; + param0->unk00 = 1; return 4; } - MI_CpuCopy8(ptr + 0x2c, param0 + 0xe, 6); + MI_CpuCopy8(ptr->unk2c, param0->unk0e, 6); - param0[0xd] = *(u8 *)(ptr + 0x22); + param0->unk0d = ptr->unk22; FreeToHeap(ptr); - *((u32 **)param0)[5] = 0; + *param0->unk14 = NULL; return 2; } -struct UnkStruct4 { - /* 0x00 */ struct PlayerData *player_data; - /* 0x04 */ struct Options *options; - u32 unk08; - u32 unk0c; - u8 unk10; - u8 unk11; - u8 unk12; - u8 unk13; - u8 unk14; - u8 unk15[3]; - u16 unk18; - u16 unk1a; - u32 unk1c; - u32 unk20; - u32 unk24; - u32 unk28; - u32 unk2c; - -}; - -THUMB_FUNC u32 FUN_0205FB34(u8 *param0, struct UnkStruct_0204639C *param1, u32 heap_id) + + + +THUMB_FUNC u32 FUN_0205FB34(struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1, u32 heap_id) { struct SaveBlock2 *sav2 = (struct SaveBlock2 *)(param1->unkC); - struct UnkStruct4 *ptr = (struct UnkStruct4 *)AllocFromHeapAtEnd(heap_id, sizeof(struct UnkStruct4)); - MI_CpuFill8(ptr, 0, sizeof(struct UnkStruct4)); + struct UnkPlayerStruct2_0205FA2C *ptr = (struct UnkPlayerStruct2_0205FA2C *)AllocFromHeapAtEnd(heap_id, sizeof(struct UnkPlayerStruct2_0205FA2C)); + MI_CpuFill8(ptr, 0, sizeof(struct UnkPlayerStruct2_0205FA2C)); ptr->options = Sav2_PlayerData_GetOptionsAddr(sav2); - ptr->player_data = SavArray_PlayerParty_get(sav2); - ptr->unk1c = FUN_0206BB28(sav2); + ptr->player_party = SavArray_PlayerParty_get(sav2); + ptr->IsNatDex = SavArray_IsNatDexEnabled(sav2); ptr->unk2c = FUN_02079C70(sav2); ptr->unk11 = 1; - ptr->unk14 = param0[0xd]; + ptr->unk14 = param0->unk0d; - ptr->unk13 = GetPartyCount(*(u32 *)ptr); + ptr->party_count = (u8)GetPartyCount(ptr->player_party); ptr->unk18 = 0; - ptr->unk12 = param0[9]; + ptr->unk12 = param0->unk09; ptr->unk20 = FUN_0202A918(sav2); @@ -161,25 +126,25 @@ THUMB_FUNC u32 FUN_0205FB34(u8 *param0, struct UnkStruct_0204639C *param1, u32 h FUN_0207C2A4(ptr, Sav2_PlayerData_GetProfileAddr(sav2)); - FUN_020373D4(param1, &UNK_020FA6E8, ptr); + FUN_020373D4(param1, (u32)&UNK_020FA6E8, (u32)ptr); - *((u32 **)param0)[5] = ptr; + *param0->unk14 = ptr; return 3; } -THUMB_FUNC u32 FUN_0205FBC0(u8 ***param0, void *param1) +THUMB_FUNC u32 FUN_0205FBC0(struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1) { if (FUN_0204647C(param1)) { return 3; } - u8 *r0 = param0[5][0]; - ((u8 *)param0)[0xd] = r0[20]; - FreeToHeap(r0); + struct UnkPlayerStruct2_0205FA2C *ptr = (struct UnkPlayerStruct2_0205FA2C *)*param0->unk14; + param0->unk0d = ptr->unk14; + FreeToHeap(ptr); - param0[5][0] = 0; + *param0->unk14 = NULL; return 0; } @@ -187,46 +152,32 @@ THUMB_FUNC u32 FUN_0205FBC0(u8 ***param0, void *param1) THUMB_FUNC int FUN_0205FBE8(struct UnkStruct_0204639C *param0) { struct UnkStruct_0204639C *res = FUN_02046528(param0); - struct SaveBlock2 *sav2 = (struct SaveBlock2 *)FUN_0204652C(param0); - switch (sav2->unk_00004) + struct UnkCallbackStruct1_0205FA2C *res2 = (struct UnkCallbackStruct1_0205FA2C *)FUN_0204652C(param0); + switch (res2->unk04) { case 0: - sav2->unk_00004 = FUN_0205FA2C((u8 *)sav2, res, 0xb); + res2->unk04 = FUN_0205FA2C(res2, res, 0xb); break; case 1: - sav2->unk_00004 = FUN_0205FAD8((u8 *)sav2, res); + res2->unk04 = FUN_0205FAD8(res2, res); break; case 2: - sav2->unk_00004 = FUN_0205FB34((u8 *)sav2, res, 0xb); + res2->unk04 = FUN_0205FB34(res2, res, 0xb); break; case 3: - sav2->unk_00004 = FUN_0205FBC0((u8 ***)sav2, res); + res2->unk04 = FUN_0205FBC0(res2, res); break; case 4: - FreeToHeap(sav2); + FreeToHeap(res2); return 1; } return 0; } -struct UnkStruct1 -{ - u32 unk00; - u32 unk04; - u8 unk08; - u8 unk09; - u8 unk0a; - u8 unk0b; - u8 unk0c; - u8 unk0d; - u16 unk0e; - u32 unk10; - u32 unk14; -}; THUMB_FUNC void FUN_0205FC50(struct UnkStruct_0204639C *param0, - u32 param1, + void **param1, u8 param2, u8 param3, u8 param4, @@ -236,11 +187,11 @@ THUMB_FUNC void FUN_0205FC50(struct UnkStruct_0204639C *param0, { struct UnkStruct_0204639C *res = FUN_02046528(param0); - struct UnkStruct1 *ptr = (struct UnkStruct1 *)AllocFromHeap(0xb, sizeof(struct UnkStruct1)); - MI_CpuFill8(ptr, 0, sizeof(struct UnkStruct1)); + struct UnkCallbackStruct1_0205FA2C *ptr = (struct UnkCallbackStruct1_0205FA2C *)AllocFromHeap(0xb, sizeof(struct UnkCallbackStruct1_0205FA2C)); + MI_CpuFill8(ptr, 0, sizeof(struct UnkCallbackStruct1_0205FA2C)); + ptr->unk08 = param2; ptr->unk09 = param3; - ptr->unk0a = param4; ptr->unk0b = param5; ptr->unk0c = param6; @@ -250,28 +201,29 @@ THUMB_FUNC void FUN_0205FC50(struct UnkStruct_0204639C *param0, FUN_0204640C(res->unk10, &FUN_0205FBE8, (u32 *)ptr); } -THUMB_FUNC u32 FUN_0205FC9C(u16 *param0, u32 *param1) + +THUMB_FUNC u32 FUN_0205FC9C(struct UnkCallbackStruct2_0205FA2C *param0, struct UnkStruct_0204639C *param1) { - if (FUN_0203384C(param1[3])) + if (FUN_0203384C(param1->unkC)) { - ((u32 *)param0)[2] = FUN_02038790(param1, param0[9], param0[10]); + param0->unk08 = FUN_02038790(param1, param0->unk12, param0->unk14); return 1; } - ((u32 *)param0)[0] = 1; + param0->unk00 = 1; return 2; } -THUMB_FUNC u32 FUN_0205FCC4(u32 **param0, void *param1) +THUMB_FUNC u32 FUN_0205FCC4(struct UnkCallbackStruct2_0205FA2C *param0, struct UnkStruct_0204639C *param1) { if (FUN_0204647C(param1)) { return 1; } - param0[0] = param0[2][8]; - FreeToHeap(param0[2]); + param0->unk00 = param0->unk08[8]; + FreeToHeap(param0->unk08); return 2; } @@ -279,20 +231,20 @@ THUMB_FUNC u32 FUN_0205FCC4(u32 **param0, void *param1) THUMB_FUNC int FUN_0205FCE8(struct UnkStruct_0204639C *param0) { struct UnkStruct_0204639C *res = FUN_02046528(param0); - struct SaveBlock2 *sav2 = (struct SaveBlock2 *)FUN_0204652C(param0); + struct UnkCallbackStruct2_0205FA2C *res2 = (struct UnkCallbackStruct2_0205FA2C *)FUN_0204652C(param0); - switch (sav2->unk_00004) + switch (res2->unk04) { case 0: - sav2->unk_00004 = FUN_0205FC9C((u16 *)sav2, (u32 *)res); + res2->unk04 = FUN_0205FC9C(res2, res); break; case 1: - sav2->unk_00004 = FUN_0205FCC4((u32 **)sav2, (void *)res); + res2->unk04 = FUN_0205FCC4(res2, res); break; case 2: - u16 *var = GetVarPointer(res, ((u16 *)sav2)[8]); - *var = sav2->flashOkay; - FreeToHeap(sav2); + u16 *var = GetVarPointer((struct UnkSavStruct80 *)res, res2->unk10); + *var = (u16)res2->unk00; + FreeToHeap(res2); return 1; } @@ -300,28 +252,13 @@ THUMB_FUNC int FUN_0205FCE8(struct UnkStruct_0204639C *param0) return 0; } -struct UnkStruct2 -{ - u32 unk00; - u32 unk04; - u8 unk08; - u8 unk09; - u8 unk0a; - u8 unk0b; - u8 unk0c; - u8 unk0d; - u16 unk0e; - u16 unk10; - u16 unk12; - u16 unk14; - u16 unk16; -}; + THUMB_FUNC void FUN_0205FD38(struct UnkStruct_0204639C *param0, u16 param1, u16 param2, u16 param3) { struct UnkStruct_0204639C *res = FUN_02046528(param0); - struct UnkStruct2 *ptr = (struct UnkStruct2 *)AllocFromHeap(0xb, sizeof(struct UnkStruct2)); - MI_CpuFill8(ptr, 0, sizeof(struct UnkStruct2)); + struct UnkCallbackStruct2_0205FA2C *ptr = (struct UnkCallbackStruct2_0205FA2C *)AllocFromHeap(0xb, sizeof(struct UnkCallbackStruct2_0205FA2C)); + MI_CpuFill8(ptr, 0, sizeof(struct UnkCallbackStruct2_0205FA2C)); ptr->unk12 = param1; ptr->unk14 = param3; @@ -340,7 +277,7 @@ THUMB_FUNC int FUN_0205FD70(struct UnkStruct_0204639C *param0) return 0; } - u16 *var = GetVarPointer(res, res2[1]); + u16 *var = GetVarPointer((struct UnkSavStruct80 *)res, res2[1]); switch (res2[0]) { case 0: @@ -371,13 +308,13 @@ THUMB_FUNC void FUN_0205FDDC(struct UnkStruct_0204639C *param0, u16 param1, u16 ptr[0] = param1; ptr[1] = param2; - FUN_0204640C(res->unk10, &FUN_0205FD70, ptr); + FUN_0204640C(res->unk10, &FUN_0205FD70, (u32 *)ptr); } THUMB_FUNC u32 FUN_0205FE10(struct SaveBlock2 *sav2) { - u16 res = FUN_0202A150(FUN_02029FC8(sav2), 0x35); + u16 res = (u16)FUN_0202A150(FUN_02029FC8(sav2), 0x35); if (res < 20) { return 0; @@ -385,13 +322,13 @@ THUMB_FUNC u32 FUN_0205FE10(struct SaveBlock2 *sav2) u32 res2 = FUN_0202A8D8(sav2); - u8 res3 = FUN_0202A578(res2, 0xd, 0); - u8 res4 = FUN_0202A578(res2, 0, 0); - u8 res5 = FUN_0202A578(res2, 1, 0); + u8 res3 = (u8)FUN_0202A578(res2, 0xd, 0); + u8 res4 = (u8)FUN_0202A578(res2, 0, 0); + u8 res5 = (u8)FUN_0202A578(res2, 1, 0); - u8 res6 = FUN_0202A578(res2, 0xe, 0); - u8 res7 = FUN_0202A578(res2, 2, 0); - u8 res8 = FUN_0202A578(res2, 3, 0); + u8 res6 = (u8)FUN_0202A578(res2, 0xe, 0); + u8 res7 = (u8)FUN_0202A578(res2, 2, 0); + u8 res8 = (u8)FUN_0202A578(res2, 3, 0); if (res3 != 0 && res4 != 0 && res5 != 0) { @@ -457,7 +394,7 @@ THUMB_FUNC u32 FUN_0205FE10(struct SaveBlock2 *sav2) THUMB_FUNC u32 FUN_0205FF5C(struct SaveBlock2 *sav2) { - u16 res = FUN_0202A150(FUN_02029FC8(sav2), 0x35); + u16 res = (u16)FUN_0202A150(FUN_02029FC8(sav2), 0x35); if (res < 20) { return 0; @@ -465,13 +402,13 @@ THUMB_FUNC u32 FUN_0205FF5C(struct SaveBlock2 *sav2) u32 res2 = FUN_0202A8D8(sav2); - u8 res3 = FUN_0202A578(res2, 0xd, 0); - u8 res4 = FUN_0202A578(res2, 0, 0); - u8 res5 = FUN_0202A578(res2, 1, 0); + u8 res3 = (u8)FUN_0202A578(res2, 0xd, 0); + u8 res4 = (u8)FUN_0202A578(res2, 0, 0); + u8 res5 = (u8)FUN_0202A578(res2, 1, 0); - u8 res6 = FUN_0202A578(res2, 0xe, 0); - u8 res7 = FUN_0202A578(res2, 2, 0); - u8 res8 = FUN_0202A578(res2, 3, 0); + u8 res6 = (u8)FUN_0202A578(res2, 0xe, 0); + u8 res7 = (u8)FUN_0202A578(res2, 2, 0); + u8 res8 = (u8)FUN_0202A578(res2, 3, 0); if (res3 != 0 && res4 != 0 && res5 != 0) { @@ -572,7 +509,7 @@ THUMB_FUNC u32 FUN_020600DC(struct SaveBlock2 *sav2) u32 res3 = FUN_02060064(FUN_0202A5D0(res)); int i = 0; - int res4 = FUN_0202A538(res, FUN_0202A240(res2, 0, 0), 0) * 0x18; + int res4 = FUN_0202A538(res, (u16)FUN_0202A240(res2, 0, 0), 0) * 0x18; for (i = 0; i < res4; i++) { diff --git a/arm9/src/unk_0206BB28.c b/arm9/src/unk_0206BB28.c index baaecc6a..e7c12793 100644 --- a/arm9/src/unk_0206BB28.c +++ b/arm9/src/unk_0206BB28.c @@ -6,12 +6,12 @@ #pragma thumb on -BOOL FUN_0206BB28(struct SaveBlock2 * sav2) +BOOL SavArray_IsNatDexEnabled(struct SaveBlock2 * sav2) { - return FUN_0206BB34(Sav2_Pokedex_get(sav2)); + return Pokedex_IsNatDexEnabled(Sav2_Pokedex_get(sav2)); } -BOOL FUN_0206BB34(struct Pokedex * pokedex) +BOOL Pokedex_IsNatDexEnabled(struct Pokedex * pokedex) { return Pokedex_GetNatDexFlag(pokedex) == TRUE; } -- cgit v1.2.3 From 44a082830ef1aaff60449d9dc2b01fdcf8300e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 3 Apr 2021 15:18:24 +0200 Subject: remove extern declaration --- arm9/modules/52/src/module_52.c | 2 +- arm9/src/unk_0205FA2C.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'arm9') diff --git a/arm9/modules/52/src/module_52.c b/arm9/modules/52/src/module_52.c index a5b53e6c..1f74c77f 100644 --- a/arm9/modules/52/src/module_52.c +++ b/arm9/modules/52/src/module_52.c @@ -1,5 +1,6 @@ #include "module_52.h" #include "heap.h" +#include "unk_0205FA2C.h" extern struct Unk21DBE18 UNK_020FD144; @@ -7,7 +8,6 @@ extern struct Unk21DBE18 UNK_020F2B7C; extern struct Unk21DBE18 UNK_020F2B8C; extern void FUN_02015E3C(struct IGT *igt); -extern void FUN_0206007C(struct SaveBlock2 *sav2); extern int FUN_02053678(u32 random, u32 gender, u32 param2); extern void FUN_020250C4(void *sav_ptr, u32 heap_id, const u8 param2[], u32 param3); extern void FUN_020377E0(struct SaveBlock2 *sav2); diff --git a/arm9/src/unk_0205FA2C.c b/arm9/src/unk_0205FA2C.c index dde83a06..25411c1a 100644 --- a/arm9/src/unk_0205FA2C.c +++ b/arm9/src/unk_0205FA2C.c @@ -27,6 +27,23 @@ extern int FUN_0202A538(u32 param0, u16 param1, u32 param2); + +const u8 UNK_020F7454[] = { + 0x00, + 0x01, + 0x02, + 0x04, + 0x03, + 0x05, + 0x06, + 0x07, + 0x08, + 0x00, + 0x00, + 0x00, +}; + + THUMB_FUNC u32 FUN_0205FA2C(struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1, u32 heap_id) { struct UnkPlayerStruct1_0205FA2C *ptr = -- cgit v1.2.3 From c54ec6c98fa9ac1affed7fb1233e9b9aa84a27c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 3 Apr 2021 18:10:46 +0200 Subject: run clang-format --- arm9/src/unk_0205FA2C.c | 51 +++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_0205FA2C.c b/arm9/src/unk_0205FA2C.c index 25411c1a..93bd2e4e 100644 --- a/arm9/src/unk_0205FA2C.c +++ b/arm9/src/unk_0205FA2C.c @@ -25,9 +25,6 @@ extern void FUN_0202A2C4(u32 param0, u32 param1, u32 *param2); extern u32 FUN_0202A240(u32 param0, u32 param1, u32 param2); extern int FUN_0202A538(u32 param0, u16 param1, u32 param2); - - - const u8 UNK_020F7454[] = { 0x00, 0x01, @@ -43,11 +40,11 @@ const u8 UNK_020F7454[] = { 0x00, }; - -THUMB_FUNC u32 FUN_0205FA2C(struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1, u32 heap_id) +THUMB_FUNC u32 FUN_0205FA2C( + struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1, u32 heap_id) { - struct UnkPlayerStruct1_0205FA2C *ptr = - (struct UnkPlayerStruct1_0205FA2C *)AllocFromHeapAtEnd(heap_id, sizeof(struct UnkPlayerStruct1_0205FA2C)); + struct UnkPlayerStruct1_0205FA2C *ptr = (struct UnkPlayerStruct1_0205FA2C *)AllocFromHeapAtEnd( + heap_id, sizeof(struct UnkPlayerStruct1_0205FA2C)); struct SaveBlock2 *sav2 = (struct SaveBlock2 *)(param1->unkC); MI_CpuFill8(ptr, 0, sizeof(struct UnkPlayerStruct1_0205FA2C)); @@ -68,9 +65,7 @@ THUMB_FUNC u32 FUN_0205FA2C(struct UnkCallbackStruct1_0205FA2C *param0, struct U for (u8 i = 0; i < 6; i++) { ptr->unk2c[i] = param0->unk0e[i]; - } - FUN_020373D4(param1, (u32)&UNK_020F96DC, (u32)ptr); @@ -79,7 +74,8 @@ THUMB_FUNC u32 FUN_0205FA2C(struct UnkCallbackStruct1_0205FA2C *param0, struct U return 1; } -THUMB_FUNC u32 FUN_0205FAD8(struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1) +THUMB_FUNC u32 FUN_0205FAD8( + struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1) { if (FUN_0204647C(param1)) { @@ -113,15 +109,13 @@ THUMB_FUNC u32 FUN_0205FAD8(struct UnkCallbackStruct1_0205FA2C *param0, struct U return 2; } - - - - -THUMB_FUNC u32 FUN_0205FB34(struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1, u32 heap_id) +THUMB_FUNC u32 FUN_0205FB34( + struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1, u32 heap_id) { struct SaveBlock2 *sav2 = (struct SaveBlock2 *)(param1->unkC); - struct UnkPlayerStruct2_0205FA2C *ptr = (struct UnkPlayerStruct2_0205FA2C *)AllocFromHeapAtEnd(heap_id, sizeof(struct UnkPlayerStruct2_0205FA2C)); + struct UnkPlayerStruct2_0205FA2C *ptr = (struct UnkPlayerStruct2_0205FA2C *)AllocFromHeapAtEnd( + heap_id, sizeof(struct UnkPlayerStruct2_0205FA2C)); MI_CpuFill8(ptr, 0, sizeof(struct UnkPlayerStruct2_0205FA2C)); ptr->options = Sav2_PlayerData_GetOptionsAddr(sav2); @@ -150,7 +144,8 @@ THUMB_FUNC u32 FUN_0205FB34(struct UnkCallbackStruct1_0205FA2C *param0, struct U return 3; } -THUMB_FUNC u32 FUN_0205FBC0(struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1) +THUMB_FUNC u32 FUN_0205FBC0( + struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1) { if (FUN_0204647C(param1)) { @@ -169,7 +164,8 @@ THUMB_FUNC u32 FUN_0205FBC0(struct UnkCallbackStruct1_0205FA2C *param0, struct U THUMB_FUNC int FUN_0205FBE8(struct UnkStruct_0204639C *param0) { struct UnkStruct_0204639C *res = FUN_02046528(param0); - struct UnkCallbackStruct1_0205FA2C *res2 = (struct UnkCallbackStruct1_0205FA2C *)FUN_0204652C(param0); + struct UnkCallbackStruct1_0205FA2C *res2 = + (struct UnkCallbackStruct1_0205FA2C *)FUN_0204652C(param0); switch (res2->unk04) { case 0: @@ -192,7 +188,6 @@ THUMB_FUNC int FUN_0205FBE8(struct UnkStruct_0204639C *param0) return 0; } - THUMB_FUNC void FUN_0205FC50(struct UnkStruct_0204639C *param0, void **param1, u8 param2, @@ -204,7 +199,8 @@ THUMB_FUNC void FUN_0205FC50(struct UnkStruct_0204639C *param0, { struct UnkStruct_0204639C *res = FUN_02046528(param0); - struct UnkCallbackStruct1_0205FA2C *ptr = (struct UnkCallbackStruct1_0205FA2C *)AllocFromHeap(0xb, sizeof(struct UnkCallbackStruct1_0205FA2C)); + struct UnkCallbackStruct1_0205FA2C *ptr = (struct UnkCallbackStruct1_0205FA2C *)AllocFromHeap( + 0xb, sizeof(struct UnkCallbackStruct1_0205FA2C)); MI_CpuFill8(ptr, 0, sizeof(struct UnkCallbackStruct1_0205FA2C)); ptr->unk08 = param2; @@ -218,8 +214,8 @@ THUMB_FUNC void FUN_0205FC50(struct UnkStruct_0204639C *param0, FUN_0204640C(res->unk10, &FUN_0205FBE8, (u32 *)ptr); } - -THUMB_FUNC u32 FUN_0205FC9C(struct UnkCallbackStruct2_0205FA2C *param0, struct UnkStruct_0204639C *param1) +THUMB_FUNC u32 FUN_0205FC9C( + struct UnkCallbackStruct2_0205FA2C *param0, struct UnkStruct_0204639C *param1) { if (FUN_0203384C(param1->unkC)) { @@ -232,7 +228,8 @@ THUMB_FUNC u32 FUN_0205FC9C(struct UnkCallbackStruct2_0205FA2C *param0, struct U return 2; } -THUMB_FUNC u32 FUN_0205FCC4(struct UnkCallbackStruct2_0205FA2C *param0, struct UnkStruct_0204639C *param1) +THUMB_FUNC u32 FUN_0205FCC4( + struct UnkCallbackStruct2_0205FA2C *param0, struct UnkStruct_0204639C *param1) { if (FUN_0204647C(param1)) { @@ -248,7 +245,8 @@ THUMB_FUNC u32 FUN_0205FCC4(struct UnkCallbackStruct2_0205FA2C *param0, struct U THUMB_FUNC int FUN_0205FCE8(struct UnkStruct_0204639C *param0) { struct UnkStruct_0204639C *res = FUN_02046528(param0); - struct UnkCallbackStruct2_0205FA2C *res2 = (struct UnkCallbackStruct2_0205FA2C *)FUN_0204652C(param0); + struct UnkCallbackStruct2_0205FA2C *res2 = + (struct UnkCallbackStruct2_0205FA2C *)FUN_0204652C(param0); switch (res2->unk04) { @@ -269,12 +267,11 @@ THUMB_FUNC int FUN_0205FCE8(struct UnkStruct_0204639C *param0) return 0; } - - THUMB_FUNC void FUN_0205FD38(struct UnkStruct_0204639C *param0, u16 param1, u16 param2, u16 param3) { struct UnkStruct_0204639C *res = FUN_02046528(param0); - struct UnkCallbackStruct2_0205FA2C *ptr = (struct UnkCallbackStruct2_0205FA2C *)AllocFromHeap(0xb, sizeof(struct UnkCallbackStruct2_0205FA2C)); + struct UnkCallbackStruct2_0205FA2C *ptr = (struct UnkCallbackStruct2_0205FA2C *)AllocFromHeap( + 0xb, sizeof(struct UnkCallbackStruct2_0205FA2C)); MI_CpuFill8(ptr, 0, sizeof(struct UnkCallbackStruct2_0205FA2C)); ptr->unk12 = param1; -- cgit v1.2.3 From cc54fce78c69e0646ed6d128eadbbfc21c1e0143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 3 Apr 2021 20:35:31 +0200 Subject: remove unnecessary padding --- arm9/src/unk_0205FA2C.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_0205FA2C.c b/arm9/src/unk_0205FA2C.c index 93bd2e4e..3d74a9c8 100644 --- a/arm9/src/unk_0205FA2C.c +++ b/arm9/src/unk_0205FA2C.c @@ -35,9 +35,6 @@ const u8 UNK_020F7454[] = { 0x06, 0x07, 0x08, - 0x00, - 0x00, - 0x00, }; THUMB_FUNC u32 FUN_0205FA2C( -- cgit v1.2.3 From 72ecd04439857ccf7a07d8142d9d2bf50af13747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 3 Apr 2021 20:35:56 +0200 Subject: replace hard-coded number with constant --- arm9/src/unk_0205FA2C.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arm9') diff --git a/arm9/src/unk_0205FA2C.c b/arm9/src/unk_0205FA2C.c index 3d74a9c8..7bcdf950 100644 --- a/arm9/src/unk_0205FA2C.c +++ b/arm9/src/unk_0205FA2C.c @@ -534,7 +534,7 @@ THUMB_FUNC u32 FUN_020600DC(struct SaveBlock2 *sav2) THUMB_FUNC BOOL FUN_02060144(u32 **param0) { - if (param0[7][0] == 0x1ED) + if (param0[7][0] == SPECIES_ARCEUS) { return TRUE; } -- cgit v1.2.3 From 8132e1e5678b0bde7421acf7600c223854fe7c01 Mon Sep 17 00:00:00 2001 From: tgsm Date: Mon, 5 Apr 2021 12:41:20 -0400 Subject: Decompile scrcmd_16 -> scrcmd_daycare --- arm9/arm9.lsf | 2 +- arm9/asm/scrcmd_16.s | 408 ---------------------------------------------- arm9/asm/unk_02038C78.s | 32 ++-- arm9/global.inc | 32 ++-- arm9/src/scrcmd_daycare.c | 192 ++++++++++++++++++++++ 5 files changed, 225 insertions(+), 441 deletions(-) delete mode 100644 arm9/asm/scrcmd_16.s create mode 100644 arm9/src/scrcmd_daycare.c (limited to 'arm9') diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index 05a905ee..b0bb0a55 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -167,7 +167,7 @@ Static arm9 Object scrcmd_13.o Object scrcmd_coins.o Object scrcmd_money.o - Object scrcmd_16.o + Object scrcmd_daycare.o Object scrcmd_17.o Object scrcmd_18_c.o Object scrcmd_18.o diff --git a/arm9/asm/scrcmd_16.s b/arm9/asm/scrcmd_16.s deleted file mode 100644 index 8afbf518..00000000 --- a/arm9/asm/scrcmd_16.s +++ /dev/null @@ -1,408 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_02043E00 -FUN_02043E00: ; 0x02043E00 - push {r3-r5, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - ldr r5, [r0, #0xc] - bl FUN_02039438 - add r4, r0, #0x0 - add r0, r5, #0x0 - bl Sav2_DayCare_get - ldr r1, [r4, #0x0] - bl MOD05_021ED4E0 - mov r0, #0x0 - pop {r3-r5, pc} - - thumb_func_start FUN_02043E20 -FUN_02043E20: ; 0x02043E20 - push {r3-r5, lr} - add r5, r0, #0x0 - add r1, r5, #0x0 - add r1, #0x80 - ldr r1, [r1, #0x0] - ldr r4, [r1, #0xc] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - add r0, r4, #0x0 - mov r1, #0x8 - bl SavArray_get - bl MOD05_021ED5EC - strh r0, [r5, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_02043E50 -FUN_02043E50: ; 0x02043E50 - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0x8 - ldr r0, [r0, #0xc] - bl SavArray_get - bl MOD05_021ECD64 - mov r0, #0x0 - pop {r3, pc} - .balign 4 - - thumb_func_start FUN_02043E68 -FUN_02043E68: ; 0x02043E68 - push {r4-r6, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r5, [r0, #0x0] - mov r1, #0x8 - ldr r0, [r5, #0xc] - bl SavArray_get - add r6, r0, #0x0 - ldr r0, [r5, #0xc] - bl SavArray_PlayerParty_get - add r4, #0x80 - add r5, r0, #0x0 - ldr r0, [r4, #0x0] - bl ScriptEnvironment_GetSav2Ptr - bl Sav2_PlayerData_GetProfileAddr - add r2, r0, #0x0 - add r0, r6, #0x0 - add r1, r5, #0x0 - bl MOD05_DayCare_GiveEggToPlayer - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start FUN_02043E9C -FUN_02043E9C: ; 0x02043E9C - push {r3-r7, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r5, [r0, #0x0] - mov r1, #0xf - add r0, r5, #0x0 - bl FUN_02039438 - add r7, r0, #0x0 - add r0, r4, #0x0 - ldr r6, [r5, #0xc] - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - str r0, [sp, #0x0] - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl VarGet - add r4, r0, #0x0 - add r0, r6, #0x0 - mov r1, #0x8 - bl SavArray_get - add r6, r0, #0x0 - ldr r0, [r5, #0xc] - bl SavArray_PlayerParty_get - lsl r3, r4, #0x18 - ldr r1, [r7, #0x0] - add r2, r6, #0x0 - lsr r3, r3, #0x18 - bl MOD05_021EC71C - ldr r1, [sp, #0x0] - strh r0, [r1, #0x0] - mov r0, #0x0 - pop {r3-r7, pc} - .balign 4 - - thumb_func_start FUN_02043EFC -FUN_02043EFC: ; 0x02043EFC - push {r3-r7, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r5, [r0, #0x0] - mov r1, #0xf - add r0, r5, #0x0 - bl FUN_02039438 - add r7, r0, #0x0 - add r0, r4, #0x0 - ldr r5, [r5, #0xc] - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r6, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl VarGet - add r4, r0, #0x0 - add r0, r5, #0x0 - mov r1, #0x8 - bl SavArray_get - lsl r1, r4, #0x18 - ldr r2, [r7, #0x0] - lsr r1, r1, #0x18 - bl MOD05_021EC854 - strh r0, [r6, #0x0] - mov r0, #0x0 - pop {r3-r7, pc} - .balign 4 - - thumb_func_start FUN_02043F50 -FUN_02043F50: ; 0x02043F50 - push {r3-r7, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - ldr r4, [r0, #0xc] - bl FUN_02039438 - add r6, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r7, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r5, r0, #0x0 - add r0, r4, #0x0 - mov r1, #0x8 - bl SavArray_get - ldr r2, [r6, #0x0] - add r1, r5, #0x0 - bl MOD05_021EC864 - strh r0, [r7, #0x0] - mov r0, #0x0 - pop {r3-r7, pc} - .balign 4 - - thumb_func_start FUN_02043FA0 -FUN_02043FA0: ; 0x02043FA0 - push {r3-r7, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r5, [r0, #0x0] - mov r1, #0xf - add r0, r5, #0x0 - bl FUN_02039438 - add r6, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r7, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - add r4, r0, #0x0 - ldr r0, [r5, #0xc] - bl SavArray_PlayerParty_get - ldr r2, [r6, #0x0] - add r1, r7, #0x0 - bl MOD05_021ED5C4 - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r7, pc} - .balign 4 - - thumb_func_start FUN_02043FF4 -FUN_02043FF4: ; 0x02043FF4 - push {r4-r6, lr} - add r6, r0, #0x0 - add r1, r6, #0x0 - add r1, #0x80 - ldr r4, [r1, #0x0] - ldr r5, [r4, #0xc] - bl ScriptReadHalfword - add r6, #0x80 - add r1, r0, #0x0 - ldr r0, [r6, #0x0] - bl VarGet - add r6, r0, #0x0 - ldr r0, [r4, #0xc] - bl SavArray_PlayerParty_get - add r4, r0, #0x0 - add r0, r5, #0x0 - mov r1, #0x8 - bl SavArray_get - lsl r1, r6, #0x18 - add r2, r0, #0x0 - add r0, r4, #0x0 - lsr r1, r1, #0x18 - add r3, r5, #0x0 - bl MOD05_021EC57C - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02044034 -FUN_02044034: ; 0x02044034 - push {r3-r7, lr} - sub sp, #0x10 - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - ldr r5, [r0, #0xc] - bl FUN_02039438 - add r6, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r7, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - str r0, [sp, #0x8] - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - str r0, [sp, #0xc] - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl VarGet - add r4, r0, #0x0 - add r0, r5, #0x0 - bl Sav2_DayCare_get - lsl r1, r4, #0x18 - lsr r1, r1, #0x18 - str r1, [sp, #0x0] - ldr r1, [r6, #0x0] - ldr r2, [sp, #0x8] - ldr r3, [sp, #0xc] - str r1, [sp, #0x4] - lsl r1, r7, #0x18 - lsl r2, r2, #0x18 - lsl r3, r3, #0x18 - lsr r1, r1, #0x18 - lsr r2, r2, #0x18 - lsr r3, r3, #0x18 - bl MOD05_021ED52C - mov r0, #0x0 - add sp, #0x10 - pop {r3-r7, pc} - - thumb_func_start FUN_020440C0 -FUN_020440C0: ; 0x020440C0 - push {r3-r5, lr} - add r5, r0, #0x0 - add r1, r5, #0x0 - add r1, #0x80 - ldr r1, [r1, #0x0] - ldr r4, [r1, #0xc] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - add r0, r4, #0x0 - mov r1, #0x8 - bl SavArray_get - bl MOD05_021ED644 - strh r0, [r5, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_020440F0 -FUN_020440F0: ; 0x020440F0 - push {r3-r5, lr} - add r5, r0, #0x0 - add r1, r5, #0x0 - add r1, #0x80 - ldr r1, [r1, #0x0] - ldr r4, [r1, #0xc] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - add r0, r4, #0x0 - mov r1, #0x8 - bl SavArray_get - bl Sav2_DayCare_GetEggPID - strh r0, [r5, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_02044120 -FUN_02044120: ; 0x02044120 - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - mov r0, #0x0 - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_02044138 -FUN_02044138: ; 0x02044138 - mov r0, #0x0 - bx lr - - thumb_func_start FUN_0204413C -FUN_0204413C: ; 0x0204413C - mov r0, #0x0 - bx lr - - thumb_func_start FUN_02044140 -FUN_02044140: ; 0x02044140 - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - mov r0, #0x0 - pop {r4, pc} - .balign 4 diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index a5037d01..70b66348 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -514,8 +514,8 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203DC70 .word FUN_0203DC88 .word FUN_0203DCA0 - .word FUN_02043E00 - .word FUN_02043E20 + .word ScrCmd_Unk016D + .word ScrCmd_Unk016E .word FUN_0203DCB8 .word FUN_0203DCC8 .word FUN_0203DCD8 @@ -569,19 +569,19 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203DE58 .word FUN_0203DE80 .word ScrCmd_TakeMoneyAddress - .word FUN_02043E9C - .word FUN_02044120 - .word FUN_02044138 - .word FUN_0204413C - .word FUN_02043E50 - .word FUN_02043E68 - .word FUN_02043EFC + .word ScrCmd_Unk01A4 + .word ScrCmd_Unk01A5 + .word ScrCmd_Unk01A6 + .word ScrCmd_Unk01A7 + .word ScrCmd_Unk01A8 + .word ScrCmd_Unk01A9 + .word ScrCmd_Unk01AA .word ScrCmd_HasEnoughMoneyAddress .word FUN_0203DD50 - .word FUN_02044140 - .word FUN_02043F50 - .word FUN_02043FA0 - .word FUN_02043FF4 + .word ScrCmd_Unk01AD + .word ScrCmd_Unk01AE + .word ScrCmd_Unk01AF + .word ScrCmd_Unk01B0 .word FUN_0203DEC4 .word FUN_0203DEF8 .word FUN_0203DF2C @@ -593,10 +593,10 @@ gScriptCmdTable: ; 0x020F355C .word ScrCmd_getpartymonfriendship .word FUN_020448D4 .word FUN_020449A4 - .word FUN_02044034 + .word ScrCmd_Unk01BC .word FUN_0203B618 - .word FUN_020440C0 - .word FUN_020440F0 + .word ScrCmd_Unk01BE + .word ScrCmd_Unk01BF .word FUN_02044F58 .word FUN_0203E018 .word FUN_0203E054 diff --git a/arm9/global.inc b/arm9/global.inc index 63ab1566..2029d1c1 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -3296,22 +3296,22 @@ .extern ScrCmd_Unk0072 .extern ScrCmd_Unk0073 .extern ScrCmd_Unk0074 -.extern FUN_02043E00 -.extern FUN_02043E20 -.extern FUN_02043E50 -.extern FUN_02043E68 -.extern FUN_02043E9C -.extern FUN_02043EFC -.extern FUN_02043F50 -.extern FUN_02043FA0 -.extern FUN_02043FF4 -.extern FUN_02044034 -.extern FUN_020440C0 -.extern FUN_020440F0 -.extern FUN_02044120 -.extern FUN_02044138 -.extern FUN_0204413C -.extern FUN_02044140 +.extern ScrCmd_Unk016D +.extern ScrCmd_Unk016E +.extern ScrCmd_Unk01A8 +.extern ScrCmd_Unk01A9 +.extern ScrCmd_Unk01A4 +.extern ScrCmd_Unk01AA +.extern ScrCmd_Unk01AE +.extern ScrCmd_Unk01AF +.extern ScrCmd_Unk01B0 +.extern ScrCmd_Unk01BC +.extern ScrCmd_Unk01BE +.extern ScrCmd_Unk01BF +.extern ScrCmd_Unk01A5 +.extern ScrCmd_Unk01A6 +.extern ScrCmd_Unk01A7 +.extern ScrCmd_Unk01AD .extern FUN_02044158 .extern FUN_0204416C .extern FUN_02044198 diff --git a/arm9/src/scrcmd_daycare.c b/arm9/src/scrcmd_daycare.c new file mode 100644 index 00000000..4e2f925e --- /dev/null +++ b/arm9/src/scrcmd_daycare.c @@ -0,0 +1,192 @@ +#include "scrcmd.h" +#include "daycare.h" +#include "party.h" +#include "script_buffers.h" + +extern void* FUN_02039438(struct UnkSavStruct80*, int idx); + +extern void MOD05_021EC57C(struct PlayerParty* party, u8 idx, struct DayCare* daycare, struct SaveBlock2* sav2); +extern u16 MOD05_021EC71C(struct PlayerParty* party, struct ScrStrBufs* mgr, struct DayCare* daycare, u8 idx); +extern u16 MOD05_021EC854(struct DayCare* daycare, u8 idx, struct ScrStrBufs* mgr); +extern u8 MOD05_021EC864(struct DayCare* daycare, int idx, struct ScrStrBufs* mgr); +extern void MOD05_021ECD64(struct DayCare* daycare); +extern void MOD05_DayCare_GiveEggToPlayer(struct DayCare* daycare, struct PlayerParty* party, struct PlayerData* player); +extern void MOD05_021ED4E0(struct DayCare* daycare, struct ScrStrBufs* mgr); +extern void MOD05_021ED52C(struct DayCare* daycare, u8 idx1, u8 idx2, u8 idx3, u8 idx4, struct ScrStrBufs* mgr); +extern u16 MOD05_021ED5C4(struct PlayerParty* party, int idx, struct ScrStrBufs* mgr); +extern u16 MOD05_021ED5EC(struct DayCare* daycare); +extern u32 MOD05_021ED644(struct DayCare* daycare); + +THUMB_FUNC BOOL ScrCmd_Unk016D(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + struct DayCare* daycare = Sav2_DayCare_get(sav2); + + MOD05_021ED4E0(daycare, *mgr); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk016E(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct SaveBlock2* sav2 = sav_ptr->saveBlock2; + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + struct DayCare* daycare = SavArray_get(sav2, 8); + + *ret_ptr = MOD05_021ED5EC(daycare); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01A8(struct ScriptContext* ctx) +{ + struct DayCare* daycare = SavArray_get(ctx->unk80->saveBlock2, 8); + MOD05_021ECD64(daycare); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01A9(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct DayCare* daycare = SavArray_get(sav_ptr->saveBlock2, 8); + struct PlayerParty* party = SavArray_PlayerParty_get(sav_ptr->saveBlock2); + struct SaveBlock2* sav2 = ScriptEnvironment_GetSav2Ptr(ctx->unk80); + struct PlayerData* player = Sav2_PlayerData_GetProfileAddr(sav2); + + MOD05_DayCare_GiveEggToPlayer(daycare, party, player); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01A4(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + struct SaveBlock2* sav2 = sav_ptr->saveBlock2; + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct DayCare* daycare = SavArray_get(sav2, 8); + struct PlayerParty* party = SavArray_PlayerParty_get(sav_ptr->saveBlock2); + + *ret_ptr = MOD05_021EC71C(party, *mgr, daycare, (u8)idx); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01AA(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + struct SaveBlock2* sav2 = sav_ptr->saveBlock2; + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct DayCare* daycare = SavArray_get(sav2, 8); + + *ret_ptr = MOD05_021EC854(daycare, (u8)idx, *mgr); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01AE(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct DayCare* daycare = SavArray_get(sav2, 8); + + *ret_ptr = MOD05_021EC864(daycare, idx, *mgr); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01AF(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u16 unused = ScriptReadHalfword(ctx); + u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + struct PlayerParty* party = SavArray_PlayerParty_get(sav_ptr->saveBlock2); + + *ret_ptr = MOD05_021ED5C4(party, idx, *mgr); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01B0(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct SaveBlock2* sav2 = sav_ptr->saveBlock2; + u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct PlayerParty* party = SavArray_PlayerParty_get(sav_ptr->saveBlock2); + struct DayCare* daycare = SavArray_get(sav2, 8); + + MOD05_021EC57C(party, (u8)idx, daycare, sav2); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01BC(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u16 idx1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 idx2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 idx3 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 idx4 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct DayCare* daycare = Sav2_DayCare_get(sav2); + + MOD05_021ED52C(daycare, (u8)idx1, (u8)idx2, (u8)idx3, (u8)idx4, *mgr); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01BE(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + struct DayCare* daycare = SavArray_get(sav2, 8); + + *ret_ptr = (u16)MOD05_021ED644(daycare); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01BF(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + struct DayCare* daycare = SavArray_get(sav2, 8); + + *ret_ptr = (u16)Sav2_DayCare_GetEggPID(daycare); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01A5(struct ScriptContext* ctx) +{ + u16* unused = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01A6(struct ScriptContext* ctx) +{ +#pragma unused(ctx) + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01A7(struct ScriptContext* ctx) +{ +#pragma unused(ctx) + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01AD(struct ScriptContext* ctx) +{ + u16* unused = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + return FALSE; +} -- cgit v1.2.3 From 3f493d7ab6c45e17e515fd9901450935a6a08f14 Mon Sep 17 00:00:00 2001 From: tgsm Date: Mon, 5 Apr 2021 20:55:25 -0400 Subject: Decompile scrcmd_11 --- arm9/asm/scrcmd_11.s | 239 ------------------------------------------------ arm9/asm/unk_02038C78.s | 18 ++-- arm9/global.inc | 18 ++-- arm9/src/scrcmd_11.c | 120 ++++++++++++++++++++++++ 4 files changed, 138 insertions(+), 257 deletions(-) delete mode 100644 arm9/asm/scrcmd_11.s create mode 100644 arm9/src/scrcmd_11.c (limited to 'arm9') diff --git a/arm9/asm/scrcmd_11.s b/arm9/asm/scrcmd_11.s deleted file mode 100644 index 5612284f..00000000 --- a/arm9/asm/scrcmd_11.s +++ /dev/null @@ -1,239 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_02042B0C -FUN_02042B0C: ; 0x02042B0C - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r4, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xa - bl FUN_02039438 - add r1, r0, #0x0 - add r5, #0x80 - ldr r0, [r5, #0x0] - ldr r1, [r1, #0x0] - bl FUN_0204B5FC - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - - thumb_func_start FUN_02042B40 -FUN_02042B40: ; 0x02042B40 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xa - bl FUN_02039438 - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r6, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r1, [r4, #0x0] - bl FUN_0204B63C - strh r0, [r6, #0x0] - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start FUN_02042B74 -FUN_02042B74: ; 0x02042B74 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xa - bl FUN_02039438 - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r6, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r1, [r4, #0x0] - bl FUN_0204B660 - strh r0, [r6, #0x0] - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start FUN_02042BA8 -FUN_02042BA8: ; 0x02042BA8 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xa - bl FUN_02039438 - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r6, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r1, [r4, #0x0] - bl FUN_0204B684 - strh r0, [r6, #0x0] - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start FUN_02042BDC -FUN_02042BDC: ; 0x02042BDC - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xa - bl FUN_02039438 - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r6, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r1, [r4, #0x0] - bl FUN_0204B6A4 - strh r0, [r6, #0x0] - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start FUN_02042C10 -FUN_02042C10: ; 0x02042C10 - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xa - bl FUN_02039438 - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r5, #0x80 - add r2, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r1, [r4, #0x0] - bl FUN_0204B57C - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_02042C44 -FUN_02042C44: ; 0x02042C44 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xa - bl FUN_02039438 - add r4, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl FUN_02029FC8 - add r6, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r5, #0x80 - add r2, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r1, [r4, #0x0] - bl FUN_0204B5A8 - add r0, r6, #0x0 - mov r1, #0x3 - bl FUN_0202A0E8 - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start FUN_02042C8C -FUN_02042C8C: ; 0x02042C8C - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - cmp r0, #0x0 - beq _02042C9E - cmp r0, #0x1 - beq _02042CA8 - b _02042CB2 -_02042C9E: - add r4, #0x80 - ldr r0, [r4, #0x0] - bl FUN_0204B9A0 - b _02042CB6 -_02042CA8: - add r4, #0x80 - ldr r0, [r4, #0x0] - bl FUN_0204B9CC - b _02042CB6 -_02042CB2: - bl ErrorHandling -_02042CB6: - mov r0, #0x1 - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_02042CBC -FUN_02042CBC: ; 0x02042CBC - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl FUN_02029FC8 - add r4, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xa - bl FUN_02039438 - add r1, r0, #0x0 - add r5, #0x80 - ldr r0, [r5, #0x0] - ldr r1, [r1, #0x0] - bl FUN_0204B4FC - add r0, r4, #0x0 - mov r1, #0x0 - bl FUN_0202A170 - mov r0, #0x0 - pop {r3-r5, pc} diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index 70b66348..b79288ca 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -530,15 +530,15 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203D958 .word FUN_02040D04 .word FUN_02040D7C - .word FUN_02042B0C - .word FUN_02042B40 - .word FUN_02042B74 - .word FUN_02042BA8 - .word FUN_02042BDC - .word FUN_02042C10 - .word FUN_02042C44 - .word FUN_02042C8C - .word FUN_02042CBC + .word ScrCmd_Unk017D + .word ScrCmd_Unk017E + .word ScrCmd_Unk017F + .word ScrCmd_Unk0180 + .word ScrCmd_Unk0181 + .word ScrCmd_Unk0182 + .word ScrCmd_Unk0183 + .word ScrCmd_Unk0184 + .word ScrCmd_Unk0185 .word FUN_0203D998 .word FUN_0203D9E8 .word FUN_0203DA78 diff --git a/arm9/global.inc b/arm9/global.inc index b09157f2..0da3fadd 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -3264,15 +3264,15 @@ .extern FUN_02042A18 .extern FUN_02042A48 .extern FUN_02042A98 -.extern FUN_02042B0C -.extern FUN_02042B40 -.extern FUN_02042B74 -.extern FUN_02042BA8 -.extern FUN_02042BDC -.extern FUN_02042C10 -.extern FUN_02042C44 -.extern FUN_02042C8C -.extern FUN_02042CBC +.extern ScrCmd_Unk017D +.extern ScrCmd_Unk017E +.extern ScrCmd_Unk017F +.extern ScrCmd_Unk0180 +.extern ScrCmd_Unk0181 +.extern ScrCmd_Unk0182 +.extern ScrCmd_Unk0183 +.extern ScrCmd_Unk0184 +.extern ScrCmd_Unk0185 .extern FUN_02042D1C .extern ScrCmd_Unk0253 .extern ScrCmd_Unk0254 diff --git a/arm9/src/scrcmd_11.c b/arm9/src/scrcmd_11.c new file mode 100644 index 00000000..8553adfa --- /dev/null +++ b/arm9/src/scrcmd_11.c @@ -0,0 +1,120 @@ +#include "scrcmd.h" +#include "unk_02029FB0.h" + +extern void* FUN_02039438(struct UnkSavStruct80*, int idx); + +extern void FUN_0202A0E8(struct UnkStruct_02029FB0*, int); +extern void FUN_0202A170(struct UnkStruct_02029FB0*, int); +extern u8 FUN_0204B5FC(struct UnkSavStruct80*, void*); +extern void FUN_0204B57C(struct UnkSavStruct80*, void*, int); +extern u16 FUN_0204B63C(struct UnkSavStruct80*, void*); +extern u16 FUN_0204B660(struct UnkSavStruct80*, void*); +extern u16 FUN_0204B684(struct UnkSavStruct80*, void*); +extern u16 FUN_0204B6A4(struct UnkSavStruct80*, void*); +extern void FUN_0204B9CC(struct UnkSavStruct80*); +extern void FUN_0204B5A8(struct UnkSavStruct80*, void*, u16); +extern void FUN_0204B9A0(struct UnkSavStruct80*); +extern void FUN_0204B4FC(struct UnkSavStruct80*, void*); + +THUMB_FUNC BOOL ScrCmd_Unk017D(struct ScriptContext* ctx) +{ + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + void** unk = FUN_02039438(ctx->unk80, 10); + + *ret_ptr = FUN_0204B5FC(ctx->unk80, *unk); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk017E(struct ScriptContext* ctx) +{ + void** unk = FUN_02039438(ctx->unk80, 10); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + *ret_ptr = FUN_0204B63C(ctx->unk80, *unk); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk017F(struct ScriptContext* ctx) +{ + void** unk = FUN_02039438(ctx->unk80, 10); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + *ret_ptr = FUN_0204B660(ctx->unk80, *unk); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0180(struct ScriptContext* ctx) +{ + void** unk = FUN_02039438(ctx->unk80, 10); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + *ret_ptr = FUN_0204B684(ctx->unk80, *unk); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0181(struct ScriptContext* ctx) +{ + void** unk = FUN_02039438(ctx->unk80, 10); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + *ret_ptr = FUN_0204B6A4(ctx->unk80, *unk); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0182(struct ScriptContext* ctx) +{ + void** unk = FUN_02039438(ctx->unk80, 10); + u16 unk2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + FUN_0204B57C(ctx->unk80, *unk, unk2); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0183(struct ScriptContext* ctx) +{ + void** unk = FUN_02039438(ctx->unk80, 10); + struct UnkStruct_02029FB0* unk2 = FUN_02029FC8(ctx->unk80->saveBlock2); + u16 unk3 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + FUN_0204B5A8(ctx->unk80, *unk, unk3); + FUN_0202A0E8(unk2, 3); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0184(struct ScriptContext* ctx) +{ + u16 unk = ScriptReadHalfword(ctx); + + switch (unk) + { + case 0: + FUN_0204B9A0(ctx->unk80); + break; + case 1: + FUN_0204B9CC(ctx->unk80); + break; + default: + GF_ASSERT(FALSE); + break; + } + + return TRUE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0185(struct ScriptContext* ctx) +{ + struct UnkStruct_02029FB0* unk = FUN_02029FC8(ctx->unk80->saveBlock2); + void** unk2 = FUN_02039438(ctx->unk80, 10); + + FUN_0204B4FC(ctx->unk80, *unk2); + FUN_0202A170(unk, 0); + + return FALSE; +} -- cgit v1.2.3 From a4a5cc6169360abd5687cbf39b9fa6bd3fb7ca5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Wed, 7 Apr 2021 21:47:39 +0200 Subject: decomp start of unk_0202F150.s --- arm9/arm9.lsf | 1 + arm9/asm/unk_0202F150.s | 959 +--------------------------------------------- arm9/global.inc | 9 + arm9/src/unk_0202F150_c.c | 417 ++++++++++++++++++++ 4 files changed, 433 insertions(+), 953 deletions(-) create mode 100644 arm9/src/unk_0202F150_c.c (limited to 'arm9') diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index 05a905ee..7aad650f 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -127,6 +127,7 @@ Static arm9 Object unk_0202D8D0.o Object unk_0202DB14.o Object unk_0202E29C.o + Object unk_0202F150_c.o Object unk_0202F150.o Object unk_02031480.o Object unk_02031734.o diff --git a/arm9/asm/unk_0202F150.s b/arm9/asm/unk_0202F150.s index a4efe28d..873f7d0b 100644 --- a/arm9/asm/unk_0202F150.s +++ b/arm9/asm/unk_0202F150.s @@ -5,971 +5,24 @@ .section .bss - .global UNK_021C59F4 -UNK_021C59F4: ; 0x021C59F4 - .space 0x8 .section .data - .global UNK_02105D58 -UNK_02105D58: ; 0x02105D58 - .byte 4, 4 + .text - thumb_func_start FUN_0202F150 -FUN_0202F150: ; 0x0202F150 - push {r4-r6, lr} - add r6, r1, #0x0 - mov r4, #0x0 - ldr r1, _0202F2BC ; =UNK_021C59F4 - cmp r0, #0x0 - strb r4, [r1, #0x0] - beq _0202F25C - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D858 - add r5, r0, #0x1 - ldr r0, _0202F2BC ; =UNK_021C59F4 - ldr r0, [r0, #0x4] - cmp r0, #0x0 - beq _0202F178 - mov r0, #0x1 - pop {r4-r6, pc} -_0202F178: - mov r0, #0xf - bl FUN_02031480 - ldr r1, _0202F2C0 ; =0x0000068C - mov r0, #0xf - bl AllocFromHeap - ldr r1, _0202F2BC ; =UNK_021C59F4 - ldr r2, _0202F2C0 ; =0x0000068C - str r0, [r1, #0x4] - add r1, r4, #0x0 - bl MI_CpuFill8 - ldr r2, _0202F2BC ; =UNK_021C59F4 - ldr r1, _0202F2C4 ; =0x00000658 - ldr r0, [r2, #0x4] - add r6, #0x40 - str r6, [r0, r1] - add r0, r1, #0x0 - ldr r3, [r2, #0x4] - add r6, r4, #0x0 - add r0, #0x25 - strb r6, [r3, r0] - add r0, r1, #0x0 - ldr r3, [r2, #0x4] - mov r6, #0x1b - add r0, #0x26 - strb r6, [r3, r0] - ldr r2, [r2, #0x4] - mov r0, #0xf - ldr r1, [r2, r1] - lsl r1, r1, #0x1 - bl AllocFromHeap - ldr r2, _0202F2BC ; =UNK_021C59F4 - ldr r1, _0202F2C8 ; =0x0000045C - ldr r3, [r2, #0x4] - str r0, [r3, r1] - ldr r2, [r2, #0x4] - ldr r1, _0202F2C4 ; =0x00000658 - mov r0, #0xf - ldr r1, [r2, r1] - bl AllocFromHeap - ldr r2, _0202F2BC ; =UNK_021C59F4 - mov r1, #0x46 - ldr r3, [r2, #0x4] - lsl r1, r1, #0x4 - str r0, [r3, r1] - ldr r2, [r2, #0x4] - ldr r1, _0202F2C4 ; =0x00000658 - mov r0, #0xf - ldr r1, [r2, r1] - mul r1, r5 - bl AllocFromHeap - ldr r2, _0202F2BC ; =UNK_021C59F4 - ldr r1, _0202F2CC ; =0x00000458 - ldr r3, [r2, #0x4] - str r0, [r3, r1] - ldr r2, [r2, #0x4] - ldr r1, _0202F2C4 ; =0x00000658 - mov r0, #0xf - ldr r1, [r2, r1] - mul r1, r5 - bl AllocFromHeap - ldr r1, _0202F2BC ; =UNK_021C59F4 - ldr r2, [r1, #0x4] - ldr r1, _0202F2D0 ; =0x00000454 - str r0, [r2, r1] - bl FUN_02033534 - cmp r0, #0xa - ldr r2, _0202F2D4 ; =0x0000054C - bne _0202F236 - ldr r0, _0202F2BC ; =UNK_021C59F4 - mov r1, #0x64 - ldr r3, [r0, #0x4] - add r0, r3, r2 - sub r2, #0xe8 - add r2, r3, r2 - bl FUN_0202D7D8 - ldr r0, _0202F2BC ; =UNK_021C59F4 - mov r1, #0x32 - ldr r3, [r0, #0x4] - ldr r2, _0202F2D8 ; =0x0000056C - lsl r1, r1, #0x4 - add r0, r3, r2 - sub r2, #0x90 - add r2, r3, r2 - bl FUN_0202D7D8 - b _0202F268 -_0202F236: - ldr r0, _0202F2BC ; =UNK_021C59F4 - mov r1, #0x14 - ldr r3, [r0, #0x4] - add r0, r3, r2 - sub r2, #0xe8 - add r2, r3, r2 - bl FUN_0202D7D8 - ldr r0, _0202F2BC ; =UNK_021C59F4 - add r1, r6, #0x0 - ldr r3, [r0, #0x4] - ldr r2, _0202F2D8 ; =0x0000056C - add r1, #0xfd - add r0, r3, r2 - sub r2, #0x90 - add r2, r3, r2 - bl FUN_0202D7D8 - b _0202F268 -_0202F25C: - ldr r0, [r1, #0x4] - mov r4, #0x1 - cmp r0, #0x0 - bne _0202F268 - bl ErrorHandling -_0202F268: - ldr r2, _0202F2BC ; =UNK_021C59F4 - ldr r1, _0202F2DC ; =0x0000065C - ldr r3, [r2, #0x4] - mov r0, #0x0 - strh r0, [r3, r1] - mov r5, #0xff - add r1, #0x1b -_0202F276: - ldr r3, [r2, #0x4] - add r3, r3, r0 - add r0, r0, #0x1 - strb r5, [r3, r1] - cmp r0, #0x4 - blt _0202F276 - cmp r4, #0x0 - bne _0202F28A - bl FUN_0202F2F0 -_0202F28A: - ldr r0, _0202F2BC ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _0202F2E0 ; =0x000005F8 - add r0, r1, r0 - bl FUN_020312BC - cmp r4, #0x0 - bne _0202F2AC - mov r1, #0x0 - ldr r0, _0202F2E4 ; =FUN_0202FB20 - add r2, r1, #0x0 - bl FUN_0200CA60 - ldr r1, _0202F2BC ; =UNK_021C59F4 - ldr r2, [r1, #0x4] - ldr r1, _0202F2E8 ; =0x00000548 - str r0, [r2, r1] -_0202F2AC: - ldr r0, _0202F2BC ; =UNK_021C59F4 - mov r2, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _0202F2EC ; =0x00000687 - strb r2, [r1, r0] - mov r0, #0x1 - pop {r4-r6, pc} - nop -_0202F2BC: .word UNK_021C59F4 -_0202F2C0: .word 0x0000068C -_0202F2C4: .word 0x00000658 -_0202F2C8: .word 0x0000045C -_0202F2CC: .word 0x00000458 -_0202F2D0: .word 0x00000454 -_0202F2D4: .word 0x0000054C -_0202F2D8: .word 0x0000056C -_0202F2DC: .word 0x0000065C -_0202F2E0: .word 0x000005F8 -_0202F2E4: .word FUN_0202FB20 -_0202F2E8: .word 0x00000548 -_0202F2EC: .word 0x00000687 - thumb_func_start FUN_0202F2F0 -FUN_0202F2F0: ; 0x0202F2F0 - push {r3-r7, lr} - ldr r3, _0202F54C ; =UNK_021C59F4 - ldr r2, _0202F550 ; =0x0000062C - ldr r1, [r3, #0x4] - mov r0, #0x0 - strb r0, [r1, r2] - ldr r4, [r3, #0x4] - add r1, r2, #0x1 - strb r0, [r4, r1] - add r1, r2, #0x0 - ldr r4, [r3, #0x4] - add r1, #0x53 - strb r0, [r4, r1] - ldr r1, [r3, #0x4] - add r2, #0x54 - strb r0, [r1, r2] - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D858 - add r6, r0, #0x1 - ldr r0, _0202F54C ; =UNK_021C59F4 - ldr r2, _0202F554 ; =0x00000658 - ldr r3, [r0, #0x4] - ldr r0, _0202F558 ; =0x00000458 - mov r1, #0x0 - ldr r0, [r3, r0] - ldr r3, [r3, r2] - add r2, r3, #0x0 - mul r2, r6 - bl MI_CpuFill8 - mov r4, #0x0 - cmp r6, #0x0 - ble _0202F360 - ldr r7, _0202F54C ; =UNK_021C59F4 - add r5, r4, #0x0 -_0202F33E: - ldr r3, [r7, #0x4] - ldr r0, _0202F554 ; =0x00000658 - ldr r1, _0202F558 ; =0x00000458 - ldr r2, [r3, r0] - ldr r0, _0202F55C ; =0x000004E8 - add r0, r3, r0 - ldr r3, [r3, r1] - add r1, r4, #0x0 - mul r1, r2 - add r0, r0, r5 - add r1, r3, r1 - bl FUN_0202D394 - add r4, r4, #0x1 - add r5, #0xc - cmp r4, r6 - blt _0202F33E -_0202F360: - ldr r0, _0202F54C ; =UNK_021C59F4 - ldr r2, _0202F554 ; =0x00000658 - ldr r3, [r0, #0x4] - ldr r0, _0202F560 ; =0x00000454 - mov r1, #0x0 - ldr r0, [r3, r0] - ldr r3, [r3, r2] - add r2, r3, #0x0 - mul r2, r6 - bl MI_CpuFill8 - mov r5, #0x0 - cmp r6, #0x0 - ble _0202F3A2 - ldr r7, _0202F54C ; =UNK_021C59F4 - add r4, r5, #0x0 -_0202F380: - ldr r3, [r7, #0x4] - ldr r0, _0202F554 ; =0x00000658 - ldr r1, _0202F560 ; =0x00000454 - ldr r2, [r3, r0] - ldr r0, _0202F564 ; =0x0000047C - add r0, r3, r0 - ldr r3, [r3, r1] - add r1, r5, #0x0 - mul r1, r2 - add r0, r0, r4 - add r1, r3, r1 - bl FUN_0202D394 - add r5, r5, #0x1 - add r4, #0xc - cmp r5, r6 - blt _0202F380 -_0202F3A2: - ldr r0, _0202F54C ; =UNK_021C59F4 - mov r2, #0x6 - ldr r1, [r0, #0x4] - mov r0, #0xb5 - lsl r0, r0, #0x2 - add r0, r1, r0 - mov r1, #0x0 - lsl r2, r2, #0x6 - bl MI_CpuFill8 - ldr r0, _0202F54C ; =UNK_021C59F4 - mov r1, #0xb5 - ldr r2, [r0, #0x4] - ldr r0, _0202F568 ; =0x000004DC - lsl r1, r1, #0x2 - add r0, r2, r0 - add r1, r2, r1 - mov r2, #0x6 - lsl r2, r2, #0x6 - bl FUN_0202D394 - mov r0, #0xee - add r2, r0, #0x0 - mov r3, #0x85 - ldr r4, _0202F54C ; =UNK_021C59F4 - mov r1, #0x0 - add r2, #0x66 - lsl r3, r3, #0x2 -_0202F3DA: - ldr r5, [r4, #0x4] - add r5, r5, r1 - strb r0, [r5, r2] - ldr r5, [r4, #0x4] - add r5, r5, r1 - add r1, r1, #0x1 - strb r0, [r5, r3] - cmp r1, #0xc0 - blt _0202F3DA - ldr r0, _0202F54C ; =UNK_021C59F4 - mov r2, #0x42 - ldr r0, [r0, #0x4] - mov r1, #0x0 - add r0, #0x4c - lsl r2, r2, #0x2 - bl MI_CpuFill8 - ldr r0, _0202F54C ; =UNK_021C59F4 - mov r2, #0x42 - ldr r1, [r0, #0x4] - ldr r0, _0202F56C ; =0x00000464 - lsl r2, r2, #0x2 - add r0, r1, r0 - add r1, #0x4c - bl FUN_0202D394 - ldr r1, _0202F54C ; =UNK_021C59F4 - mov r2, #0xff - ldr r0, [r1, #0x4] - mov r3, #0x1 - strb r2, [r0, #0x0] - ldr r0, [r1, #0x4] - add r0, #0x26 - strb r2, [r0, #0x0] - mov r2, #0xee -_0202F420: - ldr r0, [r1, #0x4] - strb r2, [r0, r3] - ldr r0, [r1, #0x4] - add r0, r0, r3 - add r0, #0x26 - add r3, r3, #0x1 - strb r2, [r0, #0x0] - cmp r3, #0x26 - blt _0202F420 - ldr r0, _0202F54C ; =UNK_021C59F4 - ldr r2, _0202F554 ; =0x00000658 - ldr r3, [r0, #0x4] - ldr r0, _0202F570 ; =0x0000045C - ldr r2, [r3, r2] - ldr r0, [r3, r0] - mov r1, #0x0 - lsl r2, r2, #0x1 - bl MI_CpuFill8 - ldr r0, _0202F54C ; =UNK_021C59F4 - mov r1, #0x47 - ldr r3, [r0, #0x4] - ldr r2, _0202F554 ; =0x00000658 - lsl r1, r1, #0x4 - add r0, r3, r1 - sub r1, #0x14 - ldr r2, [r3, r2] - ldr r1, [r3, r1] - lsl r2, r2, #0x1 - bl FUN_0202D394 - mov r2, #0x0 - ldr r0, _0202F54C ; =UNK_021C59F4 - ldr r1, _0202F574 ; =0x00000684 - ldr r3, [r0, #0x4] - mov r12, r2 - strb r2, [r3, r1] - ldr r3, [r0, #0x4] - add r1, r1, #0x1 - strb r2, [r3, r1] - add r1, r2, #0x0 - add r7, r2, #0x0 - add r6, r2, #0x0 -_0202F476: - ldr r3, [r0, #0x4] - add r4, r3, r2 - ldr r3, _0202F578 ; =0x0000065F - strb r6, [r4, r3] - ldr r3, [r0, #0x4] - ldr r4, _0202F57C ; =0x00000667 - add r5, r3, r2 - mov r3, #0x1 - strb r3, [r5, r4] - ldr r3, [r0, #0x4] - add r4, #0x8 - add r5, r3, r2 - mov r3, #0x1 - strb r3, [r5, r4] - ldr r4, [r0, #0x4] - mov r3, r12 - add r4, r4, r3 - mov r3, #0x61 - lsl r3, r3, #0x4 - strh r6, [r4, r3] - ldr r3, [r0, #0x4] - mov r4, #0xee - add r5, r3, r1 - ldr r3, _0202F580 ; =0x00000596 - add r2, r2, #0x1 - strb r4, [r5, r3] - ldr r3, [r0, #0x4] - ldr r4, _0202F584 ; =0x0000FFFF - add r5, r3, r1 - ldr r3, _0202F588 ; =0x00000594 - strh r4, [r5, r3] - ldr r3, [r0, #0x4] - add r4, r3, r1 - mov r3, #0x59 - lsl r3, r3, #0x4 - str r6, [r4, r3] - ldr r3, [r0, #0x4] - add r4, r3, r1 - ldr r3, _0202F58C ; =0x0000058C - add r1, #0xc - str r6, [r4, r3] - ldr r3, [r0, #0x4] - add r4, r3, r7 - ldr r3, _0202F590 ; =0x00000638 - add r7, r7, #0x4 - str r6, [r4, r3] - mov r3, r12 - add r3, r3, #0x2 - mov r12, r3 - cmp r2, #0x8 - blt _0202F476 - ldr r1, _0202F54C ; =UNK_021C59F4 - ldr r0, _0202F594 ; =0x00000634 - ldr r2, [r1, #0x4] - sub r3, r0, #0x4 - str r6, [r2, r0] - ldr r4, [r1, #0x4] - mov r2, #0x1 - str r2, [r4, r3] - add r3, r0, #0x0 - ldr r4, [r1, #0x4] - sub r3, #0x3e - mov r2, #0xee - strb r2, [r4, r3] - add r3, r0, #0x0 - ldr r4, [r1, #0x4] - ldr r2, _0202F584 ; =0x0000FFFF - sub r3, #0x40 - strh r2, [r4, r3] - add r2, r0, #0x0 - ldr r3, [r1, #0x4] - sub r2, #0x44 - str r6, [r3, r2] - add r2, r0, #0x0 - ldr r3, [r1, #0x4] - sub r2, #0x48 - str r6, [r3, r2] - add r3, r0, #0x0 - ldr r4, [r1, #0x4] - add r3, #0x4e - mov r2, #0x1 - strb r2, [r4, r3] - add r3, r0, #0x0 - ldr r4, [r1, #0x4] - add r3, #0x4f - strb r2, [r4, r3] - ldr r2, _0202F598 ; =UNK_02105D58 - mov r3, #0x4 - strb r3, [r2, #0x1] - strb r3, [r2, #0x0] - ldr r1, [r1, #0x4] - sub r0, #0xe8 - add r0, r1, r0 - bl FUN_0202D804 - ldr r0, _0202F54C ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _0202F59C ; =0x0000056C - add r0, r1, r0 - bl FUN_0202D804 - ldr r0, _0202F54C ; =UNK_021C59F4 - mov r2, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _0202F5A0 ; =0x00000688 - strb r2, [r1, r0] - pop {r3-r7, pc} - .balign 4 -_0202F54C: .word UNK_021C59F4 -_0202F550: .word 0x0000062C -_0202F554: .word 0x00000658 -_0202F558: .word 0x00000458 -_0202F55C: .word 0x000004E8 -_0202F560: .word 0x00000454 -_0202F564: .word 0x0000047C -_0202F568: .word 0x000004DC -_0202F56C: .word 0x00000464 -_0202F570: .word 0x0000045C -_0202F574: .word 0x00000684 -_0202F578: .word 0x0000065F -_0202F57C: .word 0x00000667 -_0202F580: .word 0x00000596 -_0202F584: .word 0x0000FFFF -_0202F588: .word 0x00000594 -_0202F58C: .word 0x0000058C -_0202F590: .word 0x00000638 -_0202F594: .word 0x00000634 -_0202F598: .word UNK_02105D58 -_0202F59C: .word 0x0000056C -_0202F5A0: .word 0x00000688 - thumb_func_start FUN_0202F5A4 -FUN_0202F5A4: ; 0x0202F5A4 - push {r3-r7, lr} - ldr r1, _0202F7D4 ; =UNK_021C59F4 - ldr r0, _0202F7D8 ; =0x0000062C - ldr r2, [r1, #0x4] - mov r3, #0x0 - strb r3, [r2, r0] - ldr r1, [r1, #0x4] - add r0, r0, #0x1 - strb r3, [r1, r0] - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D858 - add r6, r0, #0x1 - ldr r0, _0202F7D4 ; =UNK_021C59F4 - ldr r2, _0202F7DC ; =0x00000658 - ldr r3, [r0, #0x4] - ldr r0, _0202F7E0 ; =0x00000458 - mov r1, #0x0 - ldr r0, [r3, r0] - ldr r3, [r3, r2] - add r2, r3, #0x0 - mul r2, r6 - bl MI_CpuFill8 - mov r4, #0x0 - cmp r6, #0x0 - ble _0202F606 - ldr r7, _0202F7D4 ; =UNK_021C59F4 - add r5, r4, #0x0 -_0202F5E4: - ldr r3, [r7, #0x4] - ldr r0, _0202F7DC ; =0x00000658 - ldr r1, _0202F7E0 ; =0x00000458 - ldr r2, [r3, r0] - ldr r0, _0202F7E4 ; =0x000004E8 - add r0, r3, r0 - ldr r3, [r3, r1] - add r1, r4, #0x0 - mul r1, r2 - add r0, r0, r5 - add r1, r3, r1 - bl FUN_0202D394 - add r4, r4, #0x1 - add r5, #0xc - cmp r4, r6 - blt _0202F5E4 -_0202F606: - ldr r0, _0202F7D4 ; =UNK_021C59F4 - ldr r2, _0202F7DC ; =0x00000658 - ldr r3, [r0, #0x4] - ldr r0, _0202F7E8 ; =0x00000454 - mov r1, #0x0 - ldr r0, [r3, r0] - ldr r3, [r3, r2] - add r2, r3, #0x0 - mul r2, r6 - bl MI_CpuFill8 - mov r5, #0x0 - cmp r6, #0x0 - ble _0202F648 - ldr r7, _0202F7D4 ; =UNK_021C59F4 - add r4, r5, #0x0 -_0202F626: - ldr r3, [r7, #0x4] - ldr r0, _0202F7DC ; =0x00000658 - ldr r1, _0202F7E8 ; =0x00000454 - ldr r2, [r3, r0] - ldr r0, _0202F7EC ; =0x0000047C - add r0, r3, r0 - ldr r3, [r3, r1] - add r1, r5, #0x0 - mul r1, r2 - add r0, r0, r4 - add r1, r3, r1 - bl FUN_0202D394 - add r5, r5, #0x1 - add r4, #0xc - cmp r5, r6 - blt _0202F626 -_0202F648: - ldr r0, _0202F7D4 ; =UNK_021C59F4 - mov r2, #0x6 - ldr r1, [r0, #0x4] - mov r0, #0xb5 - lsl r0, r0, #0x2 - add r0, r1, r0 - mov r1, #0x0 - lsl r2, r2, #0x6 - bl MI_CpuFill8 - ldr r0, _0202F7D4 ; =UNK_021C59F4 - mov r1, #0xb5 - ldr r2, [r0, #0x4] - ldr r0, _0202F7F0 ; =0x000004DC - lsl r1, r1, #0x2 - add r0, r2, r0 - add r1, r2, r1 - mov r2, #0x6 - lsl r2, r2, #0x6 - bl FUN_0202D394 - mov r0, #0xee - add r2, r0, #0x0 - mov r3, #0x85 - ldr r4, _0202F7D4 ; =UNK_021C59F4 - mov r1, #0x0 - add r2, #0x66 - lsl r3, r3, #0x2 -_0202F680: - ldr r5, [r4, #0x4] - add r5, r5, r1 - strb r0, [r5, r2] - ldr r5, [r4, #0x4] - add r5, r5, r1 - add r1, r1, #0x1 - strb r0, [r5, r3] - cmp r1, #0xc0 - blt _0202F680 - ldr r0, _0202F7D4 ; =UNK_021C59F4 - mov r2, #0x42 - ldr r0, [r0, #0x4] - mov r1, #0x0 - add r0, #0x4c - lsl r2, r2, #0x2 - bl MI_CpuFill8 - ldr r0, _0202F7D4 ; =UNK_021C59F4 - mov r2, #0x42 - ldr r1, [r0, #0x4] - ldr r0, _0202F7F4 ; =0x00000464 - lsl r2, r2, #0x2 - add r0, r1, r0 - add r1, #0x4c - bl FUN_0202D394 - ldr r1, _0202F7D4 ; =UNK_021C59F4 - mov r2, #0xff - ldr r0, [r1, #0x4] - mov r3, #0x1 - strb r2, [r0, #0x0] - ldr r0, [r1, #0x4] - add r0, #0x26 - strb r2, [r0, #0x0] - mov r2, #0xee -_0202F6C6: - ldr r0, [r1, #0x4] - strb r2, [r0, r3] - ldr r0, [r1, #0x4] - add r0, r0, r3 - add r0, #0x26 - add r3, r3, #0x1 - strb r2, [r0, #0x0] - cmp r3, #0x26 - blt _0202F6C6 - ldr r0, _0202F7D4 ; =UNK_021C59F4 - ldr r2, _0202F7DC ; =0x00000658 - ldr r3, [r0, #0x4] - ldr r0, _0202F7F8 ; =0x0000045C - ldr r2, [r3, r2] - ldr r0, [r3, r0] - mov r1, #0x0 - lsl r2, r2, #0x1 - bl MI_CpuFill8 - ldr r0, _0202F7D4 ; =UNK_021C59F4 - mov r1, #0x47 - ldr r3, [r0, #0x4] - ldr r2, _0202F7DC ; =0x00000658 - lsl r1, r1, #0x4 - add r0, r3, r1 - sub r1, #0x14 - ldr r2, [r3, r2] - ldr r1, [r3, r1] - lsl r2, r2, #0x1 - bl FUN_0202D394 - ldr r0, _0202F7D4 ; =UNK_021C59F4 - mov r3, #0x0 - ldr r2, [r0, #0x4] - ldr r1, _0202F7FC ; =0x00000684 - add r7, r3, #0x0 - strb r3, [r2, r1] - ldr r2, [r0, #0x4] - add r1, r1, #0x1 - strb r3, [r2, r1] - add r1, r3, #0x0 - add r2, r3, #0x0 -_0202F71A: - ldr r4, [r0, #0x4] - add r5, r4, r3 - ldr r4, _0202F800 ; =0x0000065F - strb r7, [r5, r4] - ldr r4, [r0, #0x4] - ldr r5, _0202F804 ; =0x00000667 - add r6, r4, r3 - mov r4, #0x1 - strb r4, [r6, r5] - ldr r4, [r0, #0x4] - add r5, #0x8 - add r6, r4, r3 - mov r4, #0x1 - strb r4, [r6, r5] - ldr r4, [r0, #0x4] - add r3, r3, #0x1 - add r5, r4, r1 - mov r4, #0x61 - lsl r4, r4, #0x4 - strh r7, [r5, r4] - ldr r4, [r0, #0x4] - ldr r5, _0202F808 ; =0x00000596 - add r6, r4, r2 - mov r4, #0xee - strb r4, [r6, r5] - ldr r4, [r0, #0x4] - ldr r5, _0202F80C ; =0x0000FFFF - add r6, r4, r2 - ldr r4, _0202F810 ; =0x00000594 - add r1, r1, #0x2 - strh r5, [r6, r4] - ldr r4, [r0, #0x4] - add r5, r4, r2 - mov r4, #0x59 - lsl r4, r4, #0x4 - str r7, [r5, r4] - ldr r4, [r0, #0x4] - add r5, r4, r2 - ldr r4, _0202F814 ; =0x0000058C - add r2, #0xc - str r7, [r5, r4] - cmp r3, #0x8 - blt _0202F71A - ldr r1, _0202F7D4 ; =UNK_021C59F4 - add r0, r4, #0x0 - ldr r3, [r1, #0x4] - add r0, #0xa4 - mov r2, #0x1 - str r2, [r3, r0] - add r3, r0, #0x0 - ldr r4, [r1, #0x4] - sub r3, #0x3a - mov r2, #0xee - strb r2, [r4, r3] - add r3, r0, #0x0 - ldr r4, [r1, #0x4] - ldr r2, _0202F80C ; =0x0000FFFF - sub r3, #0x3c - strh r2, [r4, r3] - add r2, r0, #0x0 - ldr r3, [r1, #0x4] - sub r2, #0x40 - str r7, [r3, r2] - add r2, r0, #0x0 - ldr r3, [r1, #0x4] - sub r2, #0x44 - str r7, [r3, r2] - add r3, r0, #0x0 - ldr r4, [r1, #0x4] - add r3, #0x52 - mov r2, #0x1 - strb r2, [r4, r3] - add r3, r0, #0x0 - ldr r4, [r1, #0x4] - add r3, #0x53 - strb r2, [r4, r3] - ldr r1, [r1, #0x4] - sub r0, #0xe4 - add r0, r1, r0 - bl FUN_0202D804 - ldr r0, _0202F7D4 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _0202F818 ; =0x0000056C - add r0, r1, r0 - bl FUN_0202D804 - ldr r0, _0202F7D4 ; =UNK_021C59F4 - mov r2, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _0202F81C ; =0x00000688 - strb r2, [r1, r0] - pop {r3-r7, pc} - .balign 4 -_0202F7D4: .word UNK_021C59F4 -_0202F7D8: .word 0x0000062C -_0202F7DC: .word 0x00000658 -_0202F7E0: .word 0x00000458 -_0202F7E4: .word 0x000004E8 -_0202F7E8: .word 0x00000454 -_0202F7EC: .word 0x0000047C -_0202F7F0: .word 0x000004DC -_0202F7F4: .word 0x00000464 -_0202F7F8: .word 0x0000045C -_0202F7FC: .word 0x00000684 -_0202F800: .word 0x0000065F -_0202F804: .word 0x00000667 -_0202F808: .word 0x00000596 -_0202F80C: .word 0x0000FFFF -_0202F810: .word 0x00000594 -_0202F814: .word 0x0000058C -_0202F818: .word 0x0000056C -_0202F81C: .word 0x00000688 - thumb_func_start FUN_0202F820 -FUN_0202F820: ; 0x0202F820 - push {r4-r6, lr} - add r5, r0, #0x0 - ldr r0, _0202F8B8 ; =UNK_021C59F4 - ldr r3, _0202F8BC ; =0x0000065F - ldr r1, [r0, #0x4] - mov r2, #0x0 - add r1, r1, r5 - strb r2, [r1, r3] - ldr r4, [r0, #0x4] - mov r1, #0x1 - add r6, r4, r5 - add r4, r3, #0x0 - add r4, #0x8 - strb r1, [r6, r4] - ldr r6, [r0, #0x4] - lsl r4, r5, #0x2 - add r6, r6, r4 - add r4, r3, #0x0 - sub r4, #0x27 - str r2, [r6, r4] - ldr r2, [r0, #0x4] - add r4, r2, r5 - add r2, r3, #0x0 - add r2, #0x10 - strb r1, [r4, r2] - ldr r1, [r0, #0x4] - sub r0, r3, #0x7 - ldr r2, [r1, r0] - ldr r3, _0202F8C0 ; =0x0000047C - mov r0, #0xc - add r4, r5, #0x0 - mul r4, r0 - add r0, r1, r3 - sub r3, #0x28 - ldr r3, [r1, r3] - add r1, r5, #0x0 - mul r1, r2 - add r0, r0, r4 - add r1, r3, r1 - bl FUN_0202D394 - ldr r0, _0202F8B8 ; =UNK_021C59F4 - ldr r3, _0202F8C4 ; =0x000004E8 - ldr r1, [r0, #0x4] - ldr r0, _0202F8C8 ; =0x00000658 - ldr r2, [r1, r0] - add r0, r1, r3 - sub r3, #0x90 - ldr r3, [r1, r3] - add r1, r5, #0x0 - mul r1, r2 - add r0, r0, r4 - add r1, r3, r1 - bl FUN_0202D394 - ldr r3, _0202F8B8 ; =UNK_021C59F4 - ldr r2, _0202F8CC ; =0x00000596 - ldr r0, [r3, #0x4] - mov r1, #0xee - add r0, r0, r4 - strb r1, [r0, r2] - ldr r0, [r3, #0x4] - ldr r5, _0202F8D0 ; =0x0000FFFF - add r1, r0, r4 - sub r0, r2, #0x2 - strh r5, [r1, r0] - ldr r1, [r3, #0x4] - mov r0, #0x0 - add r5, r1, r4 - sub r1, r2, #0x6 - str r0, [r5, r1] - ldr r1, [r3, #0x4] - sub r2, #0xa - add r1, r1, r4 - str r0, [r1, r2] - pop {r4-r6, pc} - .balign 4 -_0202F8B8: .word UNK_021C59F4 -_0202F8BC: .word 0x0000065F -_0202F8C0: .word 0x0000047C -_0202F8C4: .word 0x000004E8 -_0202F8C8: .word 0x00000658 -_0202F8CC: .word 0x00000596 -_0202F8D0: .word 0x0000FFFF - thumb_func_start FUN_0202F8D4 -FUN_0202F8D4: ; 0x0202F8D4 - push {r4-r6, lr} - ldr r4, _0202F908 ; =UNK_021C59F4 - ldr r6, _0202F90C ; =0x00000667 - mov r5, #0x1 -_0202F8DC: - lsl r0, r5, #0x10 - lsr r0, r0, #0x10 - bl FUN_02030E7C - cmp r0, #0x0 - bne _0202F900 - ldr r0, [r4, #0x4] - add r0, r0, r5 - ldrb r0, [r0, r6] - cmp r0, #0x0 - bne _0202F900 - bl FUN_02031280 - cmp r0, #0x0 - bne _0202F900 - add r0, r5, #0x0 - bl FUN_0202F820 -_0202F900: - add r5, r5, #0x1 - cmp r5, #0x8 - blt _0202F8DC - pop {r4-r6, pc} - .balign 4 -_0202F908: .word UNK_021C59F4 -_0202F90C: .word 0x00000667 - thumb_func_start FUN_0202F910 -FUN_0202F910: ; 0x0202F910 - ldr r3, _0202F914 ; =FUN_0202F820 - bx r3 - .balign 4 -_0202F914: .word FUN_0202F820 - thumb_func_start FUN_0202F918 -FUN_0202F918: ; 0x0202F918 - push {r3-r7, lr} - add r5, r0, #0x0 - add r6, r1, #0x0 - add r7, r2, #0x0 - str r3, [sp, #0x0] - mov r4, #0x1 - bl FUN_02033534 - cmp r0, #0x13 - bge _0202F93E - ldr r2, [sp, #0x0] - add r0, r5, #0x0 - add r1, r6, #0x0 - bl FUN_0202E5F8 - add r4, r0, #0x0 - ldr r0, _0202F94C ; =FUN_0202F910 - bl FUN_0202D330 -_0202F93E: - add r0, r5, #0x0 - add r1, r7, #0x0 - bl FUN_0202F150 - add r0, r4, #0x0 - pop {r3-r7, pc} - nop -_0202F94C: .word FUN_0202F910 + + + + + thumb_func_start FUN_0202F950 FUN_0202F950: ; 0x0202F950 diff --git a/arm9/global.inc b/arm9/global.inc index a00970de..2e1926cd 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8517,3 +8517,12 @@ .extern FUN_02025490 .extern FUN_020254A0 .extern FUN_020254B4 +.extern UNK_021C59F4 +.extern UNK_02105D58 +.extern FUN_0202F150 +.extern FUN_0202F2F0 +.extern FUN_0202F5A4 +.extern FUN_0202F820 +.extern FUN_0202F8D4 +.extern FUN_0202F910 +.extern FUN_0202F918 diff --git a/arm9/src/unk_0202F150_c.c b/arm9/src/unk_0202F150_c.c new file mode 100644 index 00000000..e618469a --- /dev/null +++ b/arm9/src/unk_0202F150_c.c @@ -0,0 +1,417 @@ +#include "global.h" +#include "MI_memory.h" +#include "heap.h" + +struct +{ + u8 unk00; + struct UnkStruct1 *unk04; +} UNK_021C59F4; + +// struct UnkStruct2 { +// u8 unk00; +// u8 unk01; +// }; + +u8 UNK_02105D58 = 4; +u8 UNK_02105D59 = 4; + +extern int FUN_02033534(); +extern u32 FUN_0202D858(u16 param0); +extern void FUN_02031480(u32 param0); +extern void FUN_0202D7D8(u32 *param0, u32 param1, u32 param2); +extern void FUN_0202F2F0(); +extern void FUN_020312BC(u32 param0); +extern void FUN_0202FB20(); + +extern u32 FUN_0200CA60(void (*param0)(), u32 param1, u32 param2); +extern void FUN_0202D394(u32 param0, u32 param1, u32 param2); + +extern void FUN_0202D804(u32 *param0); +extern u32 FUN_02030E7C(u16 param0); + +struct UnkStruct1 +{ + u8 unk000[38]; + u8 unk026[38]; + u8 unk04c[264]; + u8 unk154[192]; + u8 unk214[192]; + u8 unk2D4[384]; + u32 unk454; + u32 unk458; + u32 unk45C; + u32 unk460; + u32 unk464; + u8 unk468[0x8]; + u32 unk470; + u8 unk474[0x8]; + struct + { + u32 unk00; + u32 unk04; + u32 unk08; + } unk47C[8]; + u32 unk4DC; + u8 unk4E0[0x8]; + struct + { + u32 unk00; + u32 unk04; + u32 unk08; + } unk4E8[8]; + u32 unk548; + u8 unk54C[32]; + u8 unk56C[32]; + struct + { + u32 unk00; + u32 unk04; + u16 unk08; + u8 unk0a; + u8 unk0b; + } unk58C[8]; + u32 unk5EC; + u32 unk5F0; + u16 unk5F4; + u8 unk5F6; + u8 unk5F7; + u32 unk5F8; + u8 unk5FC[0x14]; + u16 unk610[8]; + u8 unk620[0xc]; + u8 unk62C; + u8 unk62D; + u8 unk62E[0x2]; + u32 unk630; + u32 unk634; + u32 unk638[8]; + u32 unk658; + u16 unk65C; + u8 unk65E; + u8 unk65F[8]; + u8 unk667[8]; + u8 unk66F[8]; + u8 unk677[4]; + u8 unk67B[0x2]; + u8 unk67D; + u8 unk67E; + u8 unk67F; + u8 unk680; + u8 unk681; + u8 unk682; + u8 unk683; + u8 unk684; + u8 unk685; + u8 unk686; + u8 unk687; + u8 unk688; + u8 unk689[0x3]; +}; + +THUMB_FUNC u32 FUN_0202F150(u32 param0, u32 param1) +{ + u32 r4 = 0; + UNK_021C59F4.unk00 = 0; + if (param0 != 0) + { + u32 res = FUN_0202D858(FUN_02033534()) + 1; + + if (UNK_021C59F4.unk04 != 0) + { + return 1; + } + + FUN_02031480(0xf); + struct UnkStruct1 *ptr = (struct UnkStruct1 *)AllocFromHeap(0xf, 0x68C); + UNK_021C59F4.unk04 = ptr; + MI_CpuFill8(ptr, 0, 0x68C); + + UNK_021C59F4.unk04->unk658 = param1 + 0x40; + UNK_021C59F4.unk04->unk67D = 0; + UNK_021C59F4.unk04->unk67E = 0x1b; + + UNK_021C59F4.unk04->unk45C = AllocFromHeap(0xf, UNK_021C59F4.unk04->unk658 << 1); + + UNK_021C59F4.unk04->unk460 = AllocFromHeap(0xf, UNK_021C59F4.unk04->unk658); + + UNK_021C59F4.unk04->unk458 = AllocFromHeap(0xf, res * UNK_021C59F4.unk04->unk658); + + UNK_021C59F4.unk04->unk454 = AllocFromHeap(0xf, res * UNK_021C59F4.unk04->unk658); + + if (FUN_02033534() == 0xa) + { + FUN_0202D7D8(UNK_021C59F4.unk04->unk54C, 0x64, &UNK_021C59F4.unk04->unk464); + FUN_0202D7D8(UNK_021C59F4.unk04->unk56C, 0x32 << 4, &UNK_021C59F4.unk04->unk4DC); + } + else + { + FUN_0202D7D8(UNK_021C59F4.unk04->unk54C, 0x14, &UNK_021C59F4.unk04->unk464); + FUN_0202D7D8(UNK_021C59F4.unk04->unk56C, 0x1b + 0xfd, &UNK_021C59F4.unk04->unk4DC); + } + } + else + { + + r4 = 1; + if (UNK_021C59F4.unk04 == 0) + { + ErrorHandling(); + } + } + + UNK_021C59F4.unk04->unk65C = 0; + + for (int i = 0; i < 4; i++) + { + UNK_021C59F4.unk04->unk677[i] = 0xff; + } + + if (r4 == 0) + { + FUN_0202F2F0(); + } + + FUN_020312BC(&UNK_021C59F4.unk04->unk5F8); + + if (r4 == 0) + { + u32 res2 = FUN_0200CA60(FUN_0202FB20, 0, 0); + + UNK_021C59F4.unk04->unk548 = res2; + } + + UNK_021C59F4.unk04->unk687 = 0; + + return 1; +} + +THUMB_FUNC void FUN_0202F2F0() +{ + UNK_021C59F4.unk04->unk62C = 0; + UNK_021C59F4.unk04->unk62D = 0; + UNK_021C59F4.unk04->unk67F = 0; + UNK_021C59F4.unk04->unk680 = 0; + + s32 res = FUN_0202D858(FUN_02033534()) + 1; + + MI_CpuFill8(UNK_021C59F4.unk04->unk458, 0, UNK_021C59F4.unk04->unk658 * res); + + int i; + for (i = 0; i < res; i++) + { + FUN_0202D394(&UNK_021C59F4.unk04->unk4E8[i], + UNK_021C59F4.unk04->unk458 + i * UNK_021C59F4.unk04->unk658, + UNK_021C59F4.unk04->unk658); + } + + MI_CpuFill8(UNK_021C59F4.unk04->unk454, 0, UNK_021C59F4.unk04->unk658 * res); + + for (i = 0; i < res; i++) + { + FUN_0202D394(&UNK_021C59F4.unk04->unk47C[i], + UNK_021C59F4.unk04->unk454 + i * UNK_021C59F4.unk04->unk658, + UNK_021C59F4.unk04->unk658); + } + + MI_CpuFill8(&UNK_021C59F4.unk04->unk2D4, 0, 6 << 6); + FUN_0202D394(&UNK_021C59F4.unk04->unk4DC, &UNK_021C59F4.unk04->unk2D4, 6 << 6); + + for (i = 0; i < 0xc0; i++) + { + UNK_021C59F4.unk04->unk154[i] = 0xee; + UNK_021C59F4.unk04->unk214[i] = 0xee; + } + + MI_CpuFill8(&UNK_021C59F4.unk04->unk04c, 0, 0x42 << 2); + FUN_0202D394(&UNK_021C59F4.unk04->unk464, &UNK_021C59F4.unk04->unk04c, 0x42 << 2); + + UNK_021C59F4.unk04->unk000[0] = 0xff; + UNK_021C59F4.unk04->unk026[0] = 0xff; + + for (i = 1; i < 0x26; i++) + { + UNK_021C59F4.unk04->unk000[i] = 0xee; + UNK_021C59F4.unk04->unk026[i] = 0xee; + } + + MI_CpuFill8(UNK_021C59F4.unk04->unk45C, 0, UNK_021C59F4.unk04->unk658 << 1); + + FUN_0202D394( + &UNK_021C59F4.unk04->unk470, UNK_021C59F4.unk04->unk45C, UNK_021C59F4.unk04->unk658 * 2); + + UNK_021C59F4.unk04->unk684 = 0; + UNK_021C59F4.unk04->unk685 = 0; + + for (i = 0; i < 8; i++) + { + UNK_021C59F4.unk04->unk65F[i] = 0; + UNK_021C59F4.unk04->unk667[i] = 1; + UNK_021C59F4.unk04->unk66F[i] = 1; + UNK_021C59F4.unk04->unk610[i] = 0; + + UNK_021C59F4.unk04->unk58C[i].unk0a = 0xee; + UNK_021C59F4.unk04->unk58C[i].unk08 = 0xffff; + UNK_021C59F4.unk04->unk58C[i].unk04 = 0; + UNK_021C59F4.unk04->unk58C[i].unk00 = 0; + + UNK_021C59F4.unk04->unk638[i] = 0; + } + + UNK_021C59F4.unk04->unk634 = 0; + UNK_021C59F4.unk04->unk630 = 1; + UNK_021C59F4.unk04->unk5F6 = 0xee; + UNK_021C59F4.unk04->unk5F4 = 0xffff; + UNK_021C59F4.unk04->unk5F0 = 0; + UNK_021C59F4.unk04->unk5EC = 0; + UNK_021C59F4.unk04->unk682 = 1; + UNK_021C59F4.unk04->unk683 = 1; + + UNK_02105D59 = 4; + UNK_02105D58 = 4; + + FUN_0202D804(UNK_021C59F4.unk04->unk54C); + FUN_0202D804(UNK_021C59F4.unk04->unk56C); + + UNK_021C59F4.unk04->unk688 = 0; +} + +THUMB_FUNC void FUN_0202F5A4() +{ + UNK_021C59F4.unk04->unk62C = 0; + UNK_021C59F4.unk04->unk62D = 0; + + s32 res = FUN_0202D858(FUN_02033534()) + 1; + + MI_CpuFill8(UNK_021C59F4.unk04->unk458, 0, UNK_021C59F4.unk04->unk658 * res); + + int i; + for (i = 0; i < res; i++) + { + FUN_0202D394(&UNK_021C59F4.unk04->unk4E8[i], + UNK_021C59F4.unk04->unk458 + i * UNK_021C59F4.unk04->unk658, + UNK_021C59F4.unk04->unk658); + } + + MI_CpuFill8(UNK_021C59F4.unk04->unk454, 0, UNK_021C59F4.unk04->unk658 * res); + + for (i = 0; i < res; i++) + { + FUN_0202D394(&UNK_021C59F4.unk04->unk47C[i], + UNK_021C59F4.unk04->unk454 + i * UNK_021C59F4.unk04->unk658, + UNK_021C59F4.unk04->unk658); + } + + MI_CpuFill8(&UNK_021C59F4.unk04->unk2D4, 0, 6 << 6); + FUN_0202D394(&UNK_021C59F4.unk04->unk4DC, &UNK_021C59F4.unk04->unk2D4, 6 << 6); + + for (i = 0; i < 0xc0; i++) + { + UNK_021C59F4.unk04->unk154[i] = 0xee; + UNK_021C59F4.unk04->unk214[i] = 0xee; + } + + MI_CpuFill8(&UNK_021C59F4.unk04->unk04c, 0, 0x42 << 2); + FUN_0202D394(&UNK_021C59F4.unk04->unk464, &UNK_021C59F4.unk04->unk04c, 0x42 << 2); + + UNK_021C59F4.unk04->unk000[0] = 0xff; + UNK_021C59F4.unk04->unk026[0] = 0xff; + + for (i = 1; i < 0x26; i++) + { + UNK_021C59F4.unk04->unk000[i] = 0xee; + UNK_021C59F4.unk04->unk026[i] = 0xee; + } + + MI_CpuFill8(UNK_021C59F4.unk04->unk45C, 0, UNK_021C59F4.unk04->unk658 << 1); + FUN_0202D394( + &UNK_021C59F4.unk04->unk470, UNK_021C59F4.unk04->unk45C, UNK_021C59F4.unk04->unk658 * 2); + + UNK_021C59F4.unk04->unk684 = 0; + UNK_021C59F4.unk04->unk685 = 0; + + for (i = 0; i < 8; i++) + { + UNK_021C59F4.unk04->unk65F[i] = 0; + UNK_021C59F4.unk04->unk667[i] = 1; + UNK_021C59F4.unk04->unk66F[i] = 1; + UNK_021C59F4.unk04->unk610[i] = 0; + + UNK_021C59F4.unk04->unk58C[i].unk0a = 0xee; + UNK_021C59F4.unk04->unk58C[i].unk08 = 0xffff; + UNK_021C59F4.unk04->unk58C[i].unk04 = 0; + UNK_021C59F4.unk04->unk58C[i].unk00 = 0; + } + + UNK_021C59F4.unk04->unk630 = 1; + UNK_021C59F4.unk04->unk5F6 = 0xee; + UNK_021C59F4.unk04->unk5F4 = 0xffff; + UNK_021C59F4.unk04->unk5F0 = 0; + UNK_021C59F4.unk04->unk5EC = 0; + UNK_021C59F4.unk04->unk682 = 1; + UNK_021C59F4.unk04->unk683 = 1; + + FUN_0202D804(UNK_021C59F4.unk04->unk54C); + FUN_0202D804(UNK_021C59F4.unk04->unk56C); + + UNK_021C59F4.unk04->unk688 = 0; +} + +THUMB_FUNC void FUN_0202F820(u32 param0) +{ + UNK_021C59F4.unk04->unk65F[param0] = 0; + + UNK_021C59F4.unk04->unk667[param0] = 1; + + UNK_021C59F4.unk04->unk638[param0] = 0; + + UNK_021C59F4.unk04->unk66F[param0] = 1; + + FUN_0202D394(&UNK_021C59F4.unk04->unk47C[param0], + UNK_021C59F4.unk04->unk454 + param0 * UNK_021C59F4.unk04->unk658, + UNK_021C59F4.unk04->unk658); + + FUN_0202D394(&UNK_021C59F4.unk04->unk4E8[param0], + UNK_021C59F4.unk04->unk458 + param0 * UNK_021C59F4.unk04->unk658, + UNK_021C59F4.unk04->unk658); + + UNK_021C59F4.unk04->unk58C[param0].unk0a = 0xee; + UNK_021C59F4.unk04->unk58C[param0].unk08 = 0xffff; + UNK_021C59F4.unk04->unk58C[param0].unk04 = 0; + UNK_021C59F4.unk04->unk58C[param0].unk00 = 0; +} + +extern u32 FUN_02031280(); + +THUMB_FUNC void FUN_0202F8D4() +{ + for (int i = 1; i < 8; i++) + { + if (FUN_02030E7C(i) == 0 && UNK_021C59F4.unk04->unk667[i] == 0 && FUN_02031280() == 0) + { + FUN_0202F820(i); + } + } +} + +THUMB_FUNC void FUN_0202F910(u32 param0) +{ + FUN_0202F820(param0); +} + +extern u32 FUN_0202E5F8(u32 param0, u32 param1, u32 param2); +extern void FUN_0202D330(void (*param0)(u32)); + +THUMB_FUNC u32 FUN_0202F918(u32 param0, u32 param1, u32 param2, u32 param3) +{ + u32 ret = 1; + if (FUN_02033534() < 0x13) + { + ret = FUN_0202E5F8(param0, param1, param3); + FUN_0202D330(FUN_0202F910); + } + + FUN_0202F150(param0, param2); + + return ret; +} \ No newline at end of file -- cgit v1.2.3 From c0dc03771119177fed8cf15d12bebcc1b3aa9206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Thu, 8 Apr 2021 22:26:10 +0200 Subject: first nonmatching --- arm9/asm/unk_0202F150.s | 723 ---------------------------------------------- arm9/global.inc | 6 + arm9/src/unk_0202F150_c.c | 549 +++++++++++++++++++++++++++++++++-- 3 files changed, 535 insertions(+), 743 deletions(-) (limited to 'arm9') diff --git a/arm9/asm/unk_0202F150.s b/arm9/asm/unk_0202F150.s index 873f7d0b..395ebd44 100644 --- a/arm9/asm/unk_0202F150.s +++ b/arm9/asm/unk_0202F150.s @@ -12,729 +12,6 @@ .text - - - - - - - - - - - - - thumb_func_start FUN_0202F950 -FUN_0202F950: ; 0x0202F950 - push {r3-r7, lr} - add r5, r0, #0x0 - add r6, r1, #0x0 - add r7, r2, #0x0 - mov r4, #0x1 - bl FUN_02033534 - cmp r0, #0x13 - bge _0202F96C - add r0, r5, #0x0 - add r1, r6, #0x0 - bl FUN_0202E66C - add r4, r0, #0x0 -_0202F96C: - add r0, r5, #0x0 - add r1, r7, #0x0 - bl FUN_0202F150 - ldr r0, _0202F980 ; =UNK_02105D58 - mov r1, #0x4 - strb r1, [r0, #0x0] - add r0, r4, #0x0 - pop {r3-r7, pc} - nop -_0202F980: .word UNK_02105D58 - - thumb_func_start FUN_0202F984 -FUN_0202F984: ; 0x0202F984 - push {r4, lr} - mov r4, #0x0 - bl FUN_02031190 - cmp r0, #0x0 - bne _0202F99A - ldr r0, _0202F9D4 ; =UNK_02105D58 - ldrb r0, [r0, #0x1] - cmp r0, #0x4 - beq _0202F9A2 - pop {r4, pc} -_0202F99A: - ldr r0, _0202F9D4 ; =UNK_02105D58 - ldrb r0, [r0, #0x0] - cmp r0, #0x4 - bne _0202F9D0 -_0202F9A2: - ldr r0, _0202F9D8 ; =UNK_021C59F4 - ldr r2, [r0, #0x4] - ldr r0, _0202F9DC ; =0x0000067D - ldrb r1, [r2, r0] - cmp r1, #0x2 - bne _0202F9B4 - mov r1, #0x0 - strb r1, [r2, r0] - mov r4, #0x1 -_0202F9B4: - ldr r0, _0202F9D8 ; =UNK_021C59F4 - ldr r2, [r0, #0x4] - ldr r0, _0202F9DC ; =0x0000067D - ldrb r1, [r2, r0] - cmp r1, #0x3 - bne _0202F9C4 - mov r4, #0x1 - strb r4, [r2, r0] -_0202F9C4: - cmp r4, #0x0 - beq _0202F9CC - bl FUN_0202F5A4 -_0202F9CC: - bl FUN_02031088 -_0202F9D0: - pop {r4, pc} - nop -_0202F9D4: .word UNK_02105D58 -_0202F9D8: .word UNK_021C59F4 -_0202F9DC: .word 0x0000067D - - thumb_func_start FUN_0202F9E0 -FUN_0202F9E0: ; 0x0202F9E0 - ldr r1, _0202FA08 ; =UNK_021C59F4 - ldr r3, [r1, #0x4] - ldr r1, _0202FA0C ; =0x0000067D - ldrb r2, [r3, r1] - cmp r2, #0x0 - bne _0202F9F6 - cmp r0, #0x1 - bne _0202F9F6 - mov r0, #0x3 - strb r0, [r3, r1] - bx lr -_0202F9F6: - cmp r2, #0x1 - bne _0202FA04 - cmp r0, #0x0 - bne _0202FA04 - ldr r0, _0202FA0C ; =0x0000067D - mov r1, #0x2 - strb r1, [r3, r0] -_0202FA04: - bx lr - nop -_0202FA08: .word UNK_021C59F4 -_0202FA0C: .word 0x0000067D - - thumb_func_start FUN_0202FA10 -FUN_0202FA10: ; 0x0202FA10 - ldr r3, _0202FA18 ; =FUN_0202F9E0 - mov r0, #0x1 - bx r3 - nop -_0202FA18: .word FUN_0202F9E0 - - thumb_func_start FUN_0202FA1C -FUN_0202FA1C: ; 0x0202FA1C - ldr r3, _0202FA24 ; =FUN_0202F9E0 - mov r0, #0x0 - bx r3 - nop -_0202FA24: .word FUN_0202F9E0 - - thumb_func_start FUN_0202FA28 -FUN_0202FA28: ; 0x0202FA28 - ldr r0, _0202FA40 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _0202FA44 ; =0x0000067D - ldrb r0, [r1, r0] - cmp r0, #0x2 - bne _0202FA38 - mov r0, #0x1 - bx lr -_0202FA38: - cmp r0, #0x3 - bne _0202FA3E - mov r0, #0x0 -_0202FA3E: - bx lr - .balign 4 -_0202FA40: .word UNK_021C59F4 -_0202FA44: .word 0x0000067D - - thumb_func_start FUN_0202FA48 -FUN_0202FA48: ; 0x0202FA48 - push {r3, lr} - bl FUN_0202FA28 - cmp r0, #0x1 - bne _0202FA56 - mov r0, #0x1 - pop {r3, pc} -_0202FA56: - mov r0, #0x0 - pop {r3, pc} - .balign 4 - - thumb_func_start FUN_0202FA5C -FUN_0202FA5C: ; 0x0202FA5C - push {r4, lr} - ldr r0, _0202FB00 ; =UNK_021C59F4 - mov r4, #0x0 - ldr r0, [r0, #0x4] - cmp r0, #0x0 - beq _0202FA82 - bl FUN_02033534 - cmp r0, #0x13 - blt _0202FA78 - bl MOD04_021D83C0 - mov r4, #0x1 - b _0202FA82 -_0202FA78: - bl FUN_0202E784 - cmp r0, #0x0 - beq _0202FA82 - mov r4, #0x1 -_0202FA82: - cmp r4, #0x0 - beq _0202FAFE - bl FUN_020314D0 - bl FUN_0202DBA4 - ldr r0, _0202FB00 ; =UNK_021C59F4 - mov r1, #0x0 - strb r1, [r0, #0x0] - ldr r1, [r0, #0x4] - ldr r0, _0202FB04 ; =0x00000548 - ldr r0, [r1, r0] - bl FUN_0200CAB4 - ldr r1, _0202FB00 ; =UNK_021C59F4 - ldr r0, _0202FB04 ; =0x00000548 - ldr r2, [r1, #0x4] - mov r3, #0x0 - str r3, [r2, r0] - ldr r1, [r1, #0x4] - sub r0, #0xec - ldr r0, [r1, r0] - bl FreeToHeap - ldr r0, _0202FB00 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - mov r0, #0x46 - lsl r0, r0, #0x4 - ldr r0, [r1, r0] - bl FreeToHeap - ldr r0, _0202FB00 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _0202FB08 ; =0x00000458 - ldr r0, [r1, r0] - bl FreeToHeap - ldr r0, _0202FB00 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _0202FB0C ; =0x00000454 - ldr r0, [r1, r0] - bl FreeToHeap - ldr r0, _0202FB00 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _0202FB10 ; =0x0000056C - add r0, r1, r0 - bl FUN_0202D824 - ldr r0, _0202FB00 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _0202FB14 ; =0x0000054C - add r0, r1, r0 - bl FUN_0202D824 - ldr r0, _0202FB00 ; =UNK_021C59F4 - ldr r0, [r0, #0x4] - bl FreeToHeap - ldr r0, _0202FB00 ; =UNK_021C59F4 - mov r1, #0x0 - str r1, [r0, #0x4] -_0202FAFE: - pop {r4, pc} - .balign 4 -_0202FB00: .word UNK_021C59F4 -_0202FB04: .word 0x00000548 -_0202FB08: .word 0x00000458 -_0202FB0C: .word 0x00000454 -_0202FB10: .word 0x0000056C -_0202FB14: .word 0x0000054C - - thumb_func_start FUN_0202FB18 -FUN_0202FB18: ; 0x0202FB18 - ldr r3, _0202FB1C ; =FUN_0202E9E8 - bx r3 - .balign 4 -_0202FB1C: .word FUN_0202E9E8 - - thumb_func_start FUN_0202FB20 -FUN_0202FB20: ; 0x0202FB20 - push {r3, lr} - ldr r0, _0202FB54 ; =UNK_021C59F4 - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - beq _0202FB52 - bl FUN_0203050C - bl FUN_02031190 - cmp r0, #0x0 - bne _0202FB40 - mov r0, #0x0 - bl FUN_02030E7C - cmp r0, #0x0 - bne _0202FB48 -_0202FB40: - bl FUN_02031280 - cmp r0, #0x0 - beq _0202FB4C -_0202FB48: - bl FUN_0202FEEC -_0202FB4C: - ldr r0, _0202FB54 ; =UNK_021C59F4 - mov r1, #0x0 - strb r1, [r0, #0x0] -_0202FB52: - pop {r3, pc} - .balign 4 -_0202FB54: .word UNK_021C59F4 - - thumb_func_start FUN_0202FB58 -FUN_0202FB58: ; 0x0202FB58 - push {r3, lr} - bl FUN_0202F03C - cmp r0, #0x0 - beq _0202FB7C - bl FUN_02031190 - cmp r0, #0x0 - bne _0202FB78 - bl FUN_0202EE24 - cmp r0, #0x0 - bne _0202FB7C - bl FUN_0202FA5C - pop {r3, pc} -_0202FB78: - bl FUN_0202FA5C -_0202FB7C: - pop {r3, pc} - .balign 4 - - thumb_func_start FUN_0202FB80 -FUN_0202FB80: ; 0x0202FB80 - push {r4, lr} - bl FUN_02031CDC - ldr r1, _0202FC48 ; =UNK_021C59F4 - ldr r2, [r1, #0x4] - cmp r2, #0x0 - beq _0202FC34 - ldr r0, _0202FC4C ; =0x0000068A - ldrb r0, [r2, r0] - cmp r0, #0x0 - bne _0202FC16 - mov r0, #0x0 - strb r0, [r1, #0x0] - bl FUN_0202F984 - ldr r0, _0202FC48 ; =UNK_021C59F4 - ldr r1, _0202FC50 ; =gMain - ldr r0, [r0, #0x4] - ldr r2, _0202FC54 ; =0x00000628 - ldr r3, [r1, #0x44] - ldr r1, _0202FC58 ; =0x00007FFF - ldrh r4, [r0, r2] - and r1, r3 - orr r1, r4 - strh r1, [r0, r2] - bl FUN_02030674 - bl FUN_0202FCCC - ldr r0, _0202FC48 ; =UNK_021C59F4 - ldr r1, _0202FC54 ; =0x00000628 - ldr r3, [r0, #0x4] - mov r0, #0x2 - ldrh r2, [r3, r1] - lsl r0, r0, #0xe - and r0, r2 - strh r0, [r3, r1] - bl FUN_0202FA28 - cmp r0, #0x0 - bne _0202FBD6 - bl FUN_02030DA4 -_0202FBD6: - bl FUN_02031190 - cmp r0, #0x0 - bne _0202FBE8 - mov r0, #0x0 - bl FUN_02030E7C - cmp r0, #0x0 - bne _0202FBF0 -_0202FBE8: - bl FUN_02031280 - cmp r0, #0x0 - beq _0202FBF4 -_0202FBF0: - bl FUN_02030074 -_0202FBF4: - bl FUN_02031190 - cmp r0, #0x0 - beq _0202FC0C - bl FUN_0202FA28 - cmp r0, #0x1 - beq _0202FC0C - bl FUN_02031280 - cmp r0, #0x0 - beq _0202FC10 -_0202FC0C: - bl FUN_02030DFC -_0202FC10: - ldr r0, _0202FC48 ; =UNK_021C59F4 - mov r1, #0x1 - strb r1, [r0, #0x0] -_0202FC16: - ldr r0, _0202FC48 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _0202FC5C ; =0x0000065C - ldrh r0, [r1, r0] - bl FUN_0202ED70 - bl FUN_02031190 - cmp r0, #0x0 - bne _0202FC2E - bl FUN_0202F8D4 -_0202FC2E: - bl FUN_0202FB58 - b _0202FC3A -_0202FC34: - mov r0, #0x0 - bl FUN_0202ED70 -_0202FC3A: - mov r0, #0x0 - bl FUN_020335F4 - bl FUN_020315A4 - mov r0, #0x1 - pop {r4, pc} - .balign 4 -_0202FC48: .word UNK_021C59F4 -_0202FC4C: .word 0x0000068A -_0202FC50: .word gMain -_0202FC54: .word 0x00000628 -_0202FC58: .word 0x00007FFF -_0202FC5C: .word 0x0000065C - - thumb_func_start FUN_0202FC60 -FUN_0202FC60: ; 0x0202FC60 - push {r4, lr} - ldr r0, _0202FC7C ; =UNK_021C59F4 - mov r1, #0x0 - ldrb r4, [r0, #0x0] - strb r1, [r0, #0x0] - ldr r0, [r0, #0x4] - cmp r0, #0x0 - beq _0202FC74 - bl FUN_0202F2F0 -_0202FC74: - ldr r0, _0202FC7C ; =UNK_021C59F4 - strb r4, [r0, #0x0] - pop {r4, pc} - nop -_0202FC7C: .word UNK_021C59F4 - - thumb_func_start FUN_0202FC80 -FUN_0202FC80: ; 0x0202FC80 - push {r4, lr} - ldr r0, _0202FCA0 ; =UNK_021C59F4 - mov r1, #0x0 - ldrb r4, [r0, #0x0] - strb r1, [r0, #0x0] - ldr r2, [r0, #0x4] - cmp r2, #0x0 - beq _0202FC9A - ldr r0, _0202FCA4 ; =0x0000067D - mov r1, #0x1 - strb r1, [r2, r0] - bl FUN_0202F2F0 -_0202FC9A: - ldr r0, _0202FCA0 ; =UNK_021C59F4 - strb r4, [r0, #0x0] - pop {r4, pc} - .balign 4 -_0202FCA0: .word UNK_021C59F4 -_0202FCA4: .word 0x0000067D - - thumb_func_start FUN_0202FCA8 -FUN_0202FCA8: ; 0x0202FCA8 - push {r4, lr} - ldr r0, _0202FCC8 ; =UNK_021C59F4 - mov r1, #0x0 - ldrb r4, [r0, #0x0] - strb r1, [r0, #0x0] - ldr r0, [r0, #0x4] - cmp r0, #0x0 - beq _0202FCC0 - bl FUN_0202F2F0 - bl FUN_0202E538 -_0202FCC0: - ldr r0, _0202FCC8 ; =UNK_021C59F4 - strb r4, [r0, #0x0] - pop {r4, pc} - nop -_0202FCC8: .word UNK_021C59F4 - - thumb_func_start FUN_0202FCCC -FUN_0202FCCC: ; 0x0202FCCC - push {r3, lr} - ldr r0, _0202FE14 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _0202FE18 ; =0x00000683 - ldrb r0, [r1, r0] - cmp r0, #0x0 - beq _0202FD40 - bl FUN_02033534 - cmp r0, #0x13 - blt _0202FD06 - ldr r0, _0202FE14 ; =UNK_021C59F4 - ldr r1, _0202FE1C ; =0x00000687 - ldr r0, [r0, #0x4] - ldrb r1, [r0, r1] - cmp r1, #0x0 - beq _0202FCF8 - mov r1, #0x26 - bl MOD04_021D78FC - cmp r0, #0x0 - bne _0202FCFA -_0202FCF8: - b _0202FE10 -_0202FCFA: - ldr r0, _0202FE14 ; =UNK_021C59F4 - mov r2, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _0202FE18 ; =0x00000683 - strb r2, [r1, r0] - pop {r3, pc} -_0202FD06: - bl FUN_0202CBD4 - cmp r0, #0x4 - bne _0202FD1A - bl FUN_02031190 - bl FUN_02030E7C - cmp r0, #0x0 - bne _0202FD22 -_0202FD1A: - bl FUN_02031280 - cmp r0, #0x0 - beq _0202FE10 -_0202FD22: - ldr r0, _0202FE20 ; =UNK_02105D58 - mov r1, #0x0 - strb r1, [r0, #0x0] - bl FUN_0203050C - ldr r0, _0202FE20 ; =UNK_02105D58 - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - beq _0202FE10 - ldr r0, _0202FE14 ; =UNK_021C59F4 - mov r2, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _0202FE18 ; =0x00000683 - strb r2, [r1, r0] - pop {r3, pc} -_0202FD40: - bl FUN_02033534 - cmp r0, #0x13 - blt _0202FDB2 - ldr r0, _0202FE14 ; =UNK_021C59F4 - ldr r2, _0202FE1C ; =0x00000687 - ldr r0, [r0, #0x4] - ldrb r1, [r0, r2] - cmp r1, #0x0 - beq _0202FE10 - add r1, r2, #0x0 - sub r1, #0x57 - ldr r1, [r0, r1] - cmp r1, #0x0 - beq _0202FD7A - sub r2, #0x53 - ldr r1, [r0, r2] - cmp r1, #0x3 - bgt _0202FE10 - ldr r1, _0202FE20 ; =UNK_02105D58 - ldrb r1, [r1, #0x0] - cmp r1, #0x4 - bne _0202FD90 - bl FUN_02030930 - ldr r0, _0202FE20 ; =UNK_02105D58 - mov r1, #0x2 - strb r1, [r0, #0x0] - b _0202FD90 -_0202FD7A: - ldr r1, _0202FE20 ; =UNK_02105D58 - ldrb r1, [r1, #0x0] - cmp r1, #0x4 - bne _0202FD90 - bl FUN_02030930 - cmp r0, #0x0 - beq _0202FE10 - ldr r0, _0202FE20 ; =UNK_02105D58 - mov r1, #0x2 - strb r1, [r0, #0x0] -_0202FD90: - ldr r0, _0202FE14 ; =UNK_021C59F4 - mov r1, #0x26 - ldr r0, [r0, #0x4] - bl MOD04_021D78FC - cmp r0, #0x0 - beq _0202FE10 - ldr r0, _0202FE20 ; =UNK_02105D58 - mov r1, #0x4 - strb r1, [r0, #0x0] - ldr r0, _0202FE14 ; =UNK_021C59F4 - ldr r2, [r0, #0x4] - ldr r0, _0202FE24 ; =0x00000634 - ldr r1, [r2, r0] - add r1, r1, #0x1 - str r1, [r2, r0] - pop {r3, pc} -_0202FDB2: - bl FUN_0202CBD4 - cmp r0, #0x4 - bne _0202FDC6 - bl FUN_02031190 - bl FUN_02030E7C - cmp r0, #0x0 - bne _0202FDCE -_0202FDC6: - bl FUN_02031280 - cmp r0, #0x0 - beq _0202FE10 -_0202FDCE: - ldr r0, _0202FE20 ; =UNK_02105D58 - ldrb r0, [r0, #0x0] - cmp r0, #0x4 - bne _0202FE10 - ldr r0, _0202FE14 ; =UNK_021C59F4 - ldr r2, [r0, #0x4] - ldr r0, _0202FE24 ; =0x00000634 - ldr r1, [r2, r0] - cmp r1, #0x3 - bgt _0202FE10 - add r0, #0x4b - ldrb r1, [r2, r0] - mov r0, #0x26 - mul r0, r1 - add r0, r2, r0 - bl FUN_02030930 - ldr r0, _0202FE14 ; =UNK_021C59F4 - ldr r2, [r0, #0x4] - ldr r0, _0202FE28 ; =0x0000067F - ldrb r1, [r2, r0] - mov r0, #0x1 - sub r1, r0, r1 - mov r0, #0x26 - mul r0, r1 - add r0, r2, r0 - bl FUN_02030930 - ldr r0, _0202FE20 ; =UNK_02105D58 - mov r1, #0x0 - strb r1, [r0, #0x0] - bl FUN_0203050C -_0202FE10: - pop {r3, pc} - nop -_0202FE14: .word UNK_021C59F4 -_0202FE18: .word 0x00000683 -_0202FE1C: .word 0x00000687 -_0202FE20: .word UNK_02105D58 -_0202FE24: .word 0x00000634 -_0202FE28: .word 0x0000067F - - thumb_func_start FUN_0202FE2C -FUN_0202FE2C: ; 0x0202FE2C - push {r3-r7, lr} - sub sp, #0x10 - str r0, [sp, #0x0] - mov r0, #0x0 - str r0, [sp, #0x4] - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_02031228 - str r0, [sp, #0xc] - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D858 - add r0, r0, #0x1 - mov r7, #0x0 - str r0, [sp, #0x8] - cmp r0, #0x0 - ble _0202FED0 - ldr r0, [sp, #0x0] - mov r1, #0xc0 - add r6, r0, #0x0 - add r4, r7, #0x0 - add r5, r7, #0x0 - mul r6, r1 -_0202FE66: - ldr r0, _0202FEE4 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _0202FEE8 ; =0x0000047C - add r0, r1, r0 - add r0, r0, r4 - bl FUN_0202D4BC - lsl r0, r7, #0x10 - lsr r0, r0, #0x10 - bl FUN_02030E7C - cmp r0, #0x0 - beq _0202FE90 - ldr r0, _0202FEE4 ; =UNK_021C59F4 - mov r1, #0xe - ldr r0, [r0, #0x4] - add r0, r6, r0 - add r2, r5, r0 - mov r0, #0x55 - lsl r0, r0, #0x2 - strb r1, [r2, r0] -_0202FE90: - ldr r0, _0202FEE4 ; =UNK_021C59F4 - mov r2, #0x55 - ldr r1, [r0, #0x4] - ldr r0, _0202FEE8 ; =0x0000047C - lsl r2, r2, #0x2 - add r0, r1, r0 - add r1, r1, r2 - add r1, r1, r6 - ldr r2, [sp, #0xc] - add r0, r0, r4 - add r1, r1, r5 - bl FUN_0202D400 - ldr r0, _0202FEE4 ; =UNK_021C59F4 - ldr r0, [r0, #0x4] - add r0, r6, r0 - add r1, r5, r0 - mov r0, #0x55 - lsl r0, r0, #0x2 - ldrb r0, [r1, r0] - cmp r0, #0xe - bne _0202FEC2 - ldr r0, [sp, #0x4] - add r0, r0, #0x1 - str r0, [sp, #0x4] -_0202FEC2: - ldr r0, [sp, #0xc] - add r7, r7, #0x1 - add r5, r5, r0 - ldr r0, [sp, #0x8] - add r4, #0xc - cmp r7, r0 - blt _0202FE66 -_0202FED0: - ldr r1, [sp, #0x4] - ldr r0, [sp, #0x8] - cmp r1, r0 - bne _0202FEDE - add sp, #0x10 - mov r0, #0x0 - pop {r3-r7, pc} -_0202FEDE: - mov r0, #0x1 - add sp, #0x10 - pop {r3-r7, pc} - .balign 4 -_0202FEE4: .word UNK_021C59F4 -_0202FEE8: .word 0x0000047C - thumb_func_start FUN_0202FEEC FUN_0202FEEC: ; 0x0202FEEC push {r3-r7, lr} diff --git a/arm9/global.inc b/arm9/global.inc index 2e1926cd..1fc85f18 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8526,3 +8526,9 @@ .extern FUN_0202F8D4 .extern FUN_0202F910 .extern FUN_0202F918 +.extern FUN_0202F984 +.extern FUN_0202F9E0 +.extern FUN_0202FA28 +.extern FUN_0202FB58 +.extern FUN_0202FB80 +.extern FUN_0202FE2C diff --git a/arm9/src/unk_0202F150_c.c b/arm9/src/unk_0202F150_c.c index e618469a..b0a249cf 100644 --- a/arm9/src/unk_0202F150_c.c +++ b/arm9/src/unk_0202F150_c.c @@ -1,6 +1,7 @@ #include "global.h" #include "MI_memory.h" #include "heap.h" +#include "main.h" struct { @@ -17,7 +18,7 @@ u8 UNK_02105D58 = 4; u8 UNK_02105D59 = 4; extern int FUN_02033534(); -extern u32 FUN_0202D858(u16 param0); +extern int FUN_0202D858(u16 param0); extern void FUN_02031480(u32 param0); extern void FUN_0202D7D8(u32 *param0, u32 param1, u32 param2); extern void FUN_0202F2F0(); @@ -32,11 +33,11 @@ extern u32 FUN_02030E7C(u16 param0); struct UnkStruct1 { - u8 unk000[38]; - u8 unk026[38]; + u8 unk000[2][38]; + // u8 unk026[38]; u8 unk04c[264]; - u8 unk154[192]; - u8 unk214[192]; + u8 unk154[2][192]; + // u8 unk214[192]; u8 unk2D4[384]; u32 unk454; u32 unk458; @@ -79,7 +80,9 @@ struct UnkStruct1 u32 unk5F8; u8 unk5FC[0x14]; u16 unk610[8]; - u8 unk620[0xc]; + u8 unk620[0x8]; + u16 unk628; + u8 unk62A[0x2]; u8 unk62C; u8 unk62D; u8 unk62E[0x2]; @@ -106,7 +109,9 @@ struct UnkStruct1 u8 unk686; u8 unk687; u8 unk688; - u8 unk689[0x3]; + u8 unk689; + u8 unk68A; + u8 unk68B; }; THUMB_FUNC u32 FUN_0202F150(u32 param0, u32 param1) @@ -219,20 +224,20 @@ THUMB_FUNC void FUN_0202F2F0() for (i = 0; i < 0xc0; i++) { - UNK_021C59F4.unk04->unk154[i] = 0xee; - UNK_021C59F4.unk04->unk214[i] = 0xee; + UNK_021C59F4.unk04->unk154[0][i] = 0xee; + UNK_021C59F4.unk04->unk154[1][i] = 0xee; } MI_CpuFill8(&UNK_021C59F4.unk04->unk04c, 0, 0x42 << 2); FUN_0202D394(&UNK_021C59F4.unk04->unk464, &UNK_021C59F4.unk04->unk04c, 0x42 << 2); - UNK_021C59F4.unk04->unk000[0] = 0xff; - UNK_021C59F4.unk04->unk026[0] = 0xff; + UNK_021C59F4.unk04->unk000[0][0] = 0xff; + UNK_021C59F4.unk04->unk000[1][0] = 0xff; for (i = 1; i < 0x26; i++) { - UNK_021C59F4.unk04->unk000[i] = 0xee; - UNK_021C59F4.unk04->unk026[i] = 0xee; + UNK_021C59F4.unk04->unk000[0][i] = 0xee; + UNK_021C59F4.unk04->unk000[1][i] = 0xee; } MI_CpuFill8(UNK_021C59F4.unk04->unk45C, 0, UNK_021C59F4.unk04->unk658 << 1); @@ -307,20 +312,20 @@ THUMB_FUNC void FUN_0202F5A4() for (i = 0; i < 0xc0; i++) { - UNK_021C59F4.unk04->unk154[i] = 0xee; - UNK_021C59F4.unk04->unk214[i] = 0xee; + UNK_021C59F4.unk04->unk154[0][i] = 0xee; + UNK_021C59F4.unk04->unk154[1][i] = 0xee; } MI_CpuFill8(&UNK_021C59F4.unk04->unk04c, 0, 0x42 << 2); FUN_0202D394(&UNK_021C59F4.unk04->unk464, &UNK_021C59F4.unk04->unk04c, 0x42 << 2); - UNK_021C59F4.unk04->unk000[0] = 0xff; - UNK_021C59F4.unk04->unk026[0] = 0xff; + UNK_021C59F4.unk04->unk000[0][0] = 0xff; + UNK_021C59F4.unk04->unk000[1][0] = 0xff; for (i = 1; i < 0x26; i++) { - UNK_021C59F4.unk04->unk000[i] = 0xee; - UNK_021C59F4.unk04->unk026[i] = 0xee; + UNK_021C59F4.unk04->unk000[0][i] = 0xee; + UNK_021C59F4.unk04->unk000[1][i] = 0xee; } MI_CpuFill8(UNK_021C59F4.unk04->unk45C, 0, UNK_021C59F4.unk04->unk658 << 1); @@ -414,4 +419,508 @@ THUMB_FUNC u32 FUN_0202F918(u32 param0, u32 param1, u32 param2, u32 param3) FUN_0202F150(param0, param2); return ret; -} \ No newline at end of file +} + +extern u32 FUN_0202E66C(u32 param0, u32 param1); + +THUMB_FUNC u32 FUN_0202F950(u32 param0, u32 param1, u32 param2) { + u32 ret = 1; + if (FUN_02033534() < 0x13) + { + ret = FUN_0202E66C(param0, param1); + } + + FUN_0202F150(param0, param2); + + UNK_02105D58 = 4; + + return ret; +} + +extern u16 FUN_02031190(); +extern void FUN_02031088(); + + + + + +THUMB_FUNC void FUN_0202F984() { + u32 r4 = 0; + if (FUN_02031190() == 0 ) { + if (UNK_02105D59 != 4) { + return; + } + } else { + if (UNK_02105D58 != 4) { + return; + } + } + + if (UNK_021C59F4.unk04->unk67D == 2) { + UNK_021C59F4.unk04->unk67D = 0; + r4 = 1; + } + + if (UNK_021C59F4.unk04->unk67D == 3) { + UNK_021C59F4.unk04->unk67D = 1; + r4 = 1; + } + + if (r4 != 0) { + FUN_0202F5A4(); + } + FUN_02031088(); +} + + + + +THUMB_FUNC void FUN_0202F9E0(u32 param0) { + u8 r2 = UNK_021C59F4.unk04->unk67D; + if (r2 == 0 && param0 == 1) { + UNK_021C59F4.unk04->unk67D = 3; + } else if (r2 == 1 && param0 == 0) { + UNK_021C59F4.unk04->unk67D = 2; + } +} + + +THUMB_FUNC void FUN_0202FA10() { + FUN_0202F9E0(1); +} + + +THUMB_FUNC void FUN_0202FA1C() { + FUN_0202F9E0(0); +} + + + +THUMB_FUNC u8 FUN_0202FA28() { + u8 ret = UNK_021C59F4.unk04->unk67D; + if (ret == 2){ + return 1; + } else if (ret == 3) { + return 0; + } + + return ret; +} + +THUMB_FUNC u32 FUN_0202FA48() { + if (FUN_0202FA28() == 1) { + return 1; + } + + return 0; +} + +extern void MOD04_021D83C0(); +extern u32 FUN_0202E784(); +extern void FUN_020314D0(); +extern void FUN_0202DBA4(); +extern void FUN_0200CAB4(u32 param0); +extern void FUN_0202D824(u32 *param0); + +THUMB_FUNC void FUN_0202FA5C() { + u32 r4 = 0; + if (UNK_021C59F4.unk04 != 0) { + if (FUN_02033534() >= 0x13) { + MOD04_021D83C0(); + r4 = 1; + } else { + if (FUN_0202E784() != 0) { + r4 = 1; + } + } + } + + if (r4 != 0) { + FUN_020314D0(); + FUN_0202DBA4(); + UNK_021C59F4.unk00 = 0; + + FUN_0200CAB4(UNK_021C59F4.unk04->unk548); + UNK_021C59F4.unk04->unk548 = 0; + FreeToHeap(UNK_021C59F4.unk04->unk45C); + FreeToHeap(UNK_021C59F4.unk04->unk460); + FreeToHeap(UNK_021C59F4.unk04->unk458); + FreeToHeap(UNK_021C59F4.unk04->unk454); + FUN_0202D824(UNK_021C59F4.unk04->unk56C); + FUN_0202D824(UNK_021C59F4.unk04->unk54C); + FreeToHeap(UNK_021C59F4.unk04); + UNK_021C59F4.unk04 = NULL; + } +} + +extern u32 FUN_0202E9E8(u32 param0); + +THUMB_FUNC u32 FUN_0202FB18(u32 param0) { + return FUN_0202E9E8(param0); +} + + +extern void FUN_0203050C(); +extern void FUN_0202FEEC(); +extern u32 FUN_0202F03C(); +extern u32 FUN_0202EE24(); + + + +THUMB_FUNC void FUN_0202FB20() { + if (UNK_021C59F4.unk00 != 0) { + FUN_0203050C(); + if ((FUN_02031190() == 0 && FUN_02030E7C(0) != 0) || FUN_02031280() != 0){ + FUN_0202FEEC(); + } + + UNK_021C59F4.unk00 = 0; + } +} + +THUMB_FUNC void FUN_0202FB58() { + if (FUN_0202F03C() != 0) { + if (FUN_02031190() == 0 ) { + if (FUN_0202EE24() == 0) { + FUN_0202FA5C(); + } + } else { + FUN_0202FA5C(); + } + } +} + +extern void FUN_02031CDC(); +extern void FUN_02030674(); +extern void FUN_0202FCCC(); +extern void FUN_02030DA4(); +extern void FUN_02030074(); +extern void FUN_02030DFC(); +extern void FUN_0202EBD0(u16 param0); +extern void FUN_0202ED70(u32 param0); +extern void FUN_020335F4(u32 param0); +extern void FUN_020315A4(); + + + +THUMB_FUNC u32 FUN_0202FB80() { + FUN_02031CDC(); + + if (UNK_021C59F4.unk04 != NULL) { + if (UNK_021C59F4.unk04->unk68A == 0) { + UNK_021C59F4.unk00 = 0; + FUN_0202F984(); + UNK_021C59F4.unk04->unk628 |= gMain.unk44 & 0x7FFF; + FUN_02030674(); + FUN_0202FCCC(); + + UNK_021C59F4.unk04->unk628 &= 2<<0xe; + if (FUN_0202FA28() == 0) { + FUN_02030DA4(); + } + + if ((FUN_02031190() == 0 && FUN_02030E7C(0) != 0) || FUN_02031280() != 0){ + FUN_02030074(); + } + + if (FUN_02031190() == 0 || FUN_0202FA28() == 1 || FUN_02031280() != 0) { + FUN_02030DFC(); + } + + UNK_021C59F4.unk00 = 1; + } + + + FUN_0202ED70(UNK_021C59F4.unk04->unk65C); + + if (FUN_02031190() == 0) { + FUN_0202F8D4(); + } + + FUN_0202FB58(); + } else { + FUN_0202ED70(0); + } + + + FUN_020335F4(0); + FUN_020315A4(); + + return 1; +} + + +THUMB_FUNC void FUN_0202FC60() { + u8 r4 = UNK_021C59F4.unk00; + + UNK_021C59F4.unk00 = 0; + + if (UNK_021C59F4.unk04 != NULL) { + FUN_0202F2F0(); + } + + UNK_021C59F4.unk00 = r4; +} + + +THUMB_FUNC void FUN_0202FC80() { + u8 r4 = UNK_021C59F4.unk00; + + UNK_021C59F4.unk00 = 0; + + if (UNK_021C59F4.unk04 != NULL) { + UNK_021C59F4.unk04->unk67D = 1; + FUN_0202F2F0(); + } + + UNK_021C59F4.unk00 = r4; +} + + +extern void FUN_0202E538(); + + +THUMB_FUNC void FUN_0202FCA8() { + u8 r4 = UNK_021C59F4.unk00; + + UNK_021C59F4.unk00 = 0; + + if (UNK_021C59F4.unk04 != NULL) { + FUN_0202F2F0(); + FUN_0202E538(); + } + + UNK_021C59F4.unk00 = r4; +} + + +extern u32 MOD04_021D78FC(void *param0, u32 param1); +extern u32 FUN_0202CBD4(); +extern u32 FUN_02030930(void *param0); + + + +THUMB_FUNC void FUN_0202FCCC() { + if (UNK_021C59F4.unk04->unk683 != 0 ) { + if (FUN_02033534() >= 0x13) { + if (UNK_021C59F4.unk04->unk687 == 0 || MOD04_021D78FC(UNK_021C59F4.unk04, 0x26) == 0) { + return; + } + + UNK_021C59F4.unk04->unk683 = 0; + return; + } + + if (FUN_0202CBD4() != 4 || FUN_02030E7C(FUN_02031190()) == 0) { + if (FUN_02031280() == 0) { + return; + } + } + + UNK_02105D58 = 0; + FUN_0203050C(); + if (UNK_02105D58 == 0) { + return; + } + + UNK_021C59F4.unk04->unk683 = 0; + return; + } + + + if (FUN_02033534() >= 0x13) { + if (UNK_021C59F4.unk04->unk687 == 0) { + return; + } + + if (UNK_021C59F4.unk04->unk630 != 0){ + if ((int)UNK_021C59F4.unk04->unk634 > 3) { + return; + } + + if (UNK_02105D58 == 4) { + FUN_02030930(UNK_021C59F4.unk04); + UNK_02105D58 = 2; + } + } else { + if (UNK_02105D58 == 4) { + if (FUN_02030930(UNK_021C59F4.unk04) == 0) { + return; + } + + UNK_02105D58 = 2; + } + } + + + if (MOD04_021D78FC(UNK_021C59F4.unk04, 0x26) == 0) { + return; + } + + UNK_02105D58 = 4; + UNK_021C59F4.unk04->unk634++; + return; + } + + + if (FUN_0202CBD4() != 4 || FUN_02030E7C(FUN_02031190()) == 0) { + if (FUN_02031280() == 0) { + return; + } + } + + if (UNK_02105D58 != 4) { + return; + } + + + + //nonmatching + if ((int)UNK_021C59F4.unk04->unk634 > 3) { + return; + } + + FUN_02030930(&UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F]); + + FUN_02030930(&UNK_021C59F4.unk04->unk000[1-UNK_021C59F4.unk04->unk67F]); + + UNK_02105D58 = 0; + FUN_0203050C(); +} + +extern int FUN_02031228(u16 param0); +extern void FUN_0202D4BC(void *param0); +extern int FUN_0202D400(u32 param0, u32 param1, u32 param2); + + + + + + +#ifdef NONMATCHING +THUMB_FUNC u32 FUN_0202FE2C(int param0) { + + // these 3 variables are shuffled on the stack, everything else matches + int st4 = 0; + int stc = FUN_02031228(FUN_02033534()); + int st8 = FUN_0202D858(FUN_02033534()) + 1; + + + for (int r7 = 0; r7 < st8 ; r7++) { + + FUN_0202D4BC(&UNK_021C59F4.unk04->unk47C[r7]); + + if (FUN_02030E7C(r7) != 0) { + UNK_021C59F4.unk04->unk154[param0][r7*stc] = 0xe; + } + + FUN_0202D400(&UNK_021C59F4.unk04->unk47C[r7], &UNK_021C59F4.unk04->unk154[param0][r7*stc], stc); + + if (UNK_021C59F4.unk04->unk154[param0][r7*stc] == 0xe) { + st4++; + } + } + + if (st4 == st8) { + return 0; + } + + return 1; +} +#else +THUMB_FUNC asm u32 FUN_0202FE2C(int param0) { + push {r3-r7, lr} + sub sp, #0x10 + str r0, [sp, #0x0] + mov r0, #0x0 + str r0, [sp, #0x4] + bl FUN_02033534 + lsl r0, r0, #0x10 + lsr r0, r0, #0x10 + bl FUN_02031228 + str r0, [sp, #0xc] + bl FUN_02033534 + lsl r0, r0, #0x10 + lsr r0, r0, #0x10 + bl FUN_0202D858 + add r0, r0, #0x1 + mov r7, #0x0 + str r0, [sp, #0x8] + cmp r0, #0x0 + ble _0202FED0 + ldr r0, [sp, #0x0] + mov r1, #0xc0 + add r6, r0, #0x0 + add r4, r7, #0x0 + add r5, r7, #0x0 + mul r6, r1 +_0202FE66: + ldr r0, =UNK_021C59F4 + ldr r1, [r0, #0x4] + ldr r0, =0x0000047C + add r0, r1, r0 + add r0, r0, r4 + bl FUN_0202D4BC + lsl r0, r7, #0x10 + lsr r0, r0, #0x10 + bl FUN_02030E7C + cmp r0, #0x0 + beq _0202FE90 + ldr r0, =UNK_021C59F4 + mov r1, #0xe + ldr r0, [r0, #0x4] + add r0, r6, r0 + add r2, r5, r0 + mov r0, #0x55 + lsl r0, r0, #0x2 + strb r1, [r2, r0] +_0202FE90: + ldr r0, =UNK_021C59F4 + mov r2, #0x55 + ldr r1, [r0, #0x4] + ldr r0, =0x0000047C + lsl r2, r2, #0x2 + add r0, r1, r0 + add r1, r1, r2 + add r1, r1, r6 + ldr r2, [sp, #0xc] + add r0, r0, r4 + add r1, r1, r5 + bl FUN_0202D400 + ldr r0, =UNK_021C59F4 + ldr r0, [r0, #0x4] + add r0, r6, r0 + add r1, r5, r0 + mov r0, #0x55 + lsl r0, r0, #0x2 + ldrb r0, [r1, r0] + cmp r0, #0xe + bne _0202FEC2 + ldr r0, [sp, #0x4] + add r0, r0, #0x1 + str r0, [sp, #0x4] +_0202FEC2: + ldr r0, [sp, #0xc] + add r7, r7, #0x1 + add r5, r5, r0 + ldr r0, [sp, #0x8] + add r4, #0xc + cmp r7, r0 + blt _0202FE66 +_0202FED0: + ldr r1, [sp, #0x4] + ldr r0, [sp, #0x8] + cmp r1, r0 + bne _0202FEDE + add sp, #0x10 + mov r0, #0x0 + pop {r3-r7, pc} +_0202FEDE: + mov r0, #0x1 + add sp, #0x10 + pop {r3-r7, pc} +} +#endif + + + -- cgit v1.2.3 From cbe18ecb3e513a30da11aaef1ef22cd855c60d7a Mon Sep 17 00:00:00 2001 From: tgsm Date: Thu, 8 Apr 2021 21:31:13 -0400 Subject: Decompile scrcmd_4 -> scrcmd_names --- arm9/arm9.lsf | 2 +- arm9/asm/scrcmd_4.s | 1313 ----------------------------------------------- arm9/asm/unk_02038C78.s | 82 +-- arm9/global.inc | 82 +-- arm9/src/scrcmd_names.c | 540 +++++++++++++++++++ 5 files changed, 623 insertions(+), 1396 deletions(-) delete mode 100644 arm9/asm/scrcmd_4.s create mode 100644 arm9/src/scrcmd_names.c (limited to 'arm9') diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index b0bb0a55..dee43fd0 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -155,7 +155,7 @@ Static arm9 Object scrcmd_asm.o Object scrcmd_2.o Object scrcmd_3.o - Object scrcmd_4.o + Object scrcmd_names.o Object scrcmd_5.o Object scrcmd_6.o Object scrcmd_7.o diff --git a/arm9/asm/scrcmd_4.s b/arm9/asm/scrcmd_4.s deleted file mode 100644 index 3bad9d50..00000000 --- a/arm9/asm/scrcmd_4.s +++ /dev/null @@ -1,1313 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .extern gGameLanguage - - .text - - thumb_func_start FUN_020406CC -FUN_020406CC: ; 0x020406CC - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r6, [r0, #0x0] - mov r1, #0xf - add r0, r6, #0x0 - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r4, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - ldrb r5, [r1, #0x0] - add r0, r6, #0x0 - bl ScriptEnvironment_GetSav2Ptr - bl Sav2_PlayerData_GetProfileAddr - add r2, r0, #0x0 - ldr r0, [r4, #0x0] - add r1, r5, #0x0 - bl BufferPlayersName - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02040700 -FUN_02040700: ; 0x02040700 - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r4, [r0, #0x0] - mov r1, #0xf - add r0, r4, #0x0 - bl FUN_02039438 - ldr r2, [r5, #0x8] - add r1, r2, #0x1 - str r1, [r5, #0x8] - ldrb r1, [r2, #0x0] - ldr r0, [r0, #0x0] - ldr r2, [r4, #0xc] - bl BufferRivalsName - mov r0, #0x0 - pop {r3-r5, pc} - - thumb_func_start FUN_02040724 -FUN_02040724: ; 0x02040724 - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r4, [r0, #0x0] - mov r1, #0xf - add r0, r4, #0x0 - bl FUN_02039438 - ldr r2, [r5, #0x8] - add r1, r2, #0x1 - str r1, [r5, #0x8] - ldrb r1, [r2, #0x0] - ldr r0, [r0, #0x0] - ldr r2, [r4, #0xc] - bl BufferFriendsName - mov r0, #0x0 - pop {r3-r5, pc} - - thumb_func_start FUN_02040748 -FUN_02040748: ; 0x02040748 - push {r3-r7, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r6, [r0, #0x0] - mov r1, #0xf - add r0, r6, #0x0 - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r7, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r5, r0, #0x0 - ldr r0, [r6, #0xc] - bl SavArray_PlayerParty_get - add r1, r5, #0x0 - bl GetPartyMonByIndex - add r2, r0, #0x0 - ldr r0, [r7, #0x0] - add r1, r4, #0x0 - bl BufferBoxMonSpeciesName - mov r0, #0x0 - pop {r3-r7, pc} - .balign 4 - - thumb_func_start FUN_02040790 -FUN_02040790: ; 0x02040790 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferItemName - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_020407C8 -FUN_020407C8: ; 0x020407C8 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferPocketName - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02040800 -FUN_02040800: ; 0x02040800 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - bl TMHMGetMove - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferMoveName - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_0204083C -FUN_0204083C: ; 0x0204083C - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferMoveName - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02040874 -FUN_02040874: ; 0x02040874 - push {r4-r6, lr} - sub sp, #0x8 - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r5, r0, #0x0 - bl FUN_02054C14 - add r3, r0, #0x0 - mov r0, #0x1 - str r0, [sp, #0x0] - str r0, [sp, #0x4] - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - add r2, r5, #0x0 - bl BufferIntegerAsString - mov r0, #0x0 - add sp, #0x8 - pop {r4-r6, pc} - - thumb_func_start FUN_020408BC -FUN_020408BC: ; 0x020408BC - push {r4-r7, lr} - sub sp, #0xc - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r7, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r6, [r1, #0x0] - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - str r0, [sp, #0x8] - ldr r1, [r5, #0x8] - add r2, r1, #0x1 - str r2, [r5, #0x8] - ldrb r4, [r1, #0x0] - add r1, r2, #0x1 - str r1, [r5, #0x8] - ldrb r3, [r2, #0x0] - cmp r4, #0x0 - bne _02040904 - bl FUN_02054C14 - lsl r0, r0, #0x18 - lsr r3, r0, #0x18 -_02040904: - str r4, [sp, #0x0] - mov r0, #0x1 - str r0, [sp, #0x4] - ldr r0, [r7, #0x0] - ldr r2, [sp, #0x8] - add r1, r6, #0x0 - bl BufferIntegerAsString - mov r0, #0x0 - add sp, #0xc - pop {r4-r7, pc} - .balign 4 - - thumb_func_start FUN_0204091C -FUN_0204091C: ; 0x0204091C - push {r3-r7, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r6, [r0, #0x0] - mov r1, #0xf - add r0, r6, #0x0 - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r7, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r5, r0, #0x0 - ldr r0, [r6, #0xc] - bl SavArray_PlayerParty_get - add r1, r5, #0x0 - bl GetPartyMonByIndex - add r2, r0, #0x0 - ldr r0, [r7, #0x0] - add r1, r4, #0x0 - bl BufferBoxMonNickname - mov r0, #0x0 - pop {r3-r7, pc} - .balign 4 - - thumb_func_start FUN_02040964 -FUN_02040964: ; 0x02040964 - push {r3-r7, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r4, [r0, #0x0] - ldr r0, [r4, #0xc] - bl GetStoragePCPointer - str r0, [sp, #0x0] - add r0, r4, #0x0 - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r5, r0, #0x0 - mov r1, #0x1e - bl _s32_div_f - add r7, r0, #0x0 - add r0, r5, #0x0 - mov r1, #0x1e - bl _s32_div_f - add r2, r1, #0x0 - ldr r0, [sp, #0x0] - add r1, r7, #0x0 - bl PCStorage_GetMonByIndexPair - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferBoxMonNickname - mov r0, #0x0 - pop {r3-r7, pc} - - thumb_func_start FUN_020409C0 -FUN_020409C0: ; 0x020409C0 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferPoketchAppName - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_020409F8 -FUN_020409F8: ; 0x020409F8 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferTrainerClassName - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02040A30 -FUN_02040A30: ; 0x02040A30 - push {r3-r7, lr} - add r7, r0, #0x0 - add r0, #0x80 - ldr r5, [r0, #0x0] - add r0, r5, #0x0 - bl ScriptEnvironment_GetSav2Ptr - bl Sav2_PlayerData_GetProfileAddr - add r4, r0, #0x0 - add r0, r5, #0x0 - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r7, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r7, #0x8] - add r0, r4, #0x0 - ldrb r5, [r1, #0x0] - bl PlayerProfile_GetTrainerGender - add r7, r0, #0x0 - add r0, r4, #0x0 - bl PlayerProfile_GetAvatar - add r1, r0, #0x0 - add r0, r7, #0x0 - mov r2, #0x2 - bl FUN_020536D0 - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r5, #0x0 - bl BufferTrainerClassNameWithArticle - mov r0, #0x0 - pop {r3-r7, pc} - - thumb_func_start FUN_02040A7C -FUN_02040A7C: ; 0x02040A7C - push {r4-r7, lr} - sub sp, #0xc - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r7, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r6, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - ldr r1, [r5, #0x8] - str r0, [sp, #0x8] - add r0, r1, #0x1 - str r0, [r5, #0x8] - ldrb r5, [r1, #0x0] - add r0, r6, #0x0 - mov r1, #0x4 - bl FUN_02040AE4 - add r6, r0, #0x0 - str r5, [sp, #0x0] - mov r0, #0x2 - str r0, [sp, #0x4] - ldr r0, [r7, #0x0] - ldr r3, [sp, #0x8] - add r1, r4, #0x0 - add r2, r6, #0x0 - bl BufferString - add r0, r6, #0x0 - bl String_dtor - mov r0, #0x0 - add sp, #0xc - pop {r4-r7, pc} - .balign 4 - - thumb_func_start FUN_02040AE4 -FUN_02040AE4: ; 0x02040AE4 - push {r3-r5, lr} - ldr r2, _02040B08 ; =0x0000016A - add r4, r0, #0x0 - add r3, r1, #0x0 - mov r0, #0x1 - mov r1, #0x1a - bl NewMsgDataFromNarc - add r5, r0, #0x0 - add r1, r4, #0x0 - bl NewString_ReadMsgData - add r4, r0, #0x0 - add r0, r5, #0x0 - bl DestroyMsgData - add r0, r4, #0x0 - pop {r3-r5, pc} - .balign 4 -_02040B08: .word 0x0000016A - - thumb_func_start FUN_02040B0C -FUN_02040B0C: ; 0x02040B0C - push {r4-r6, lr} - sub sp, #0x8 - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r4, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r4, #0x8] - add r4, #0x80 - ldr r0, [r4, #0x0] - ldrb r5, [r1, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - bl FUN_0205F388 - mov r1, #0x4 - bl FUN_02040AE4 - add r4, r0, #0x0 - mov r0, #0x1 - str r0, [sp, #0x0] - mov r0, #0x2 - str r0, [sp, #0x4] - ldr r0, [r6, #0x0] - add r1, r5, #0x0 - add r2, r4, #0x0 - mov r3, #0x0 - bl BufferString - add r0, r4, #0x0 - bl String_dtor - mov r0, #0x0 - add sp, #0x8 - pop {r4-r6, pc} - - thumb_func_start FUN_02040B5C -FUN_02040B5C: ; 0x02040B5C - push {r4-r6, lr} - sub sp, #0x8 - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r4, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r4, #0x8] - add r4, #0x80 - ldr r0, [r4, #0x0] - ldrb r5, [r1, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - bl FUN_0205F398 - mov r1, #0x4 - bl FUN_02040AE4 - add r4, r0, #0x0 - mov r0, #0x1 - str r0, [sp, #0x0] - mov r0, #0x2 - str r0, [sp, #0x4] - ldr r0, [r6, #0x0] - add r1, r5, #0x0 - add r2, r4, #0x0 - mov r3, #0x0 - bl BufferString - add r0, r4, #0x0 - bl String_dtor - mov r0, #0x0 - add sp, #0x8 - pop {r4-r6, pc} - - thumb_func_start FUN_02040BAC -FUN_02040BAC: ; 0x02040BAC - push {r4-r6, lr} - sub sp, #0x8 - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r4, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r4, #0x8] - add r4, #0x80 - ldr r0, [r4, #0x0] - ldrb r5, [r1, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - bl FUN_0205F3C0 - mov r1, #0x4 - bl FUN_02040AE4 - add r4, r0, #0x0 - mov r0, #0x1 - str r0, [sp, #0x0] - mov r0, #0x2 - str r0, [sp, #0x4] - ldr r0, [r6, #0x0] - add r1, r5, #0x0 - add r2, r4, #0x0 - mov r3, #0x0 - bl BufferString - add r0, r4, #0x0 - bl String_dtor - mov r0, #0x0 - add sp, #0x8 - pop {r4-r6, pc} - - thumb_func_start FUN_02040BFC -FUN_02040BFC: ; 0x02040BFC - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferDecorationName - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02040C34 -FUN_02040C34: ; 0x02040C34 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferUndergroundTrapName - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02040C6C -FUN_02040C6C: ; 0x02040C6C - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferUndergroundItemName - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02040CA4 -FUN_02040CA4: ; 0x02040CA4 - push {r3-r7, lr} - sub sp, #0x8 - add r5, r0, #0x0 - mov r0, #0x16 - mov r1, #0x4 - bl String_ctor - add r4, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r7, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r6, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - mov r1, #0x4 - add r2, r4, #0x0 - bl FUN_02064E60 - mov r0, #0x1 - str r0, [sp, #0x0] - mov r0, #0x2 - str r0, [sp, #0x4] - ldr r0, [r7, #0x0] - add r1, r6, #0x0 - add r2, r4, #0x0 - mov r3, #0x0 - bl BufferString - add r0, r4, #0x0 - bl String_dtor - mov r0, #0x0 - add sp, #0x8 - pop {r3-r7, pc} - .balign 4 - - thumb_func_start FUN_02040D04 -FUN_02040D04: ; 0x02040D04 - push {r3-r7, lr} - sub sp, #0x8 - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r4, #0x8] - add r7, r0, #0x0 - add r0, r1, #0x1 - str r0, [r4, #0x8] - add r0, r4, #0x0 - ldrb r6, [r1, #0x0] - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r5, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl VarGet - sub r5, #0x95 - add r4, r0, #0x0 - lsl r0, r5, #0x10 - lsr r0, r0, #0x10 - mov r1, #0x20 - bl GetNutName - add r5, r0, #0x0 - cmp r4, #0x2 - bhs _02040D5A - mov r0, #0x1 - b _02040D5C -_02040D5A: - mov r0, #0x0 -_02040D5C: - str r0, [sp, #0x0] - mov r0, #0x2 - str r0, [sp, #0x4] - ldr r0, [r7, #0x0] - add r1, r6, #0x0 - add r2, r5, #0x0 - mov r3, #0x0 - bl BufferString - add r0, r5, #0x0 - bl String_dtor - mov r0, #0x0 - add sp, #0x8 - pop {r3-r7, pc} - .balign 4 - - thumb_func_start FUN_02040D7C -FUN_02040D7C: ; 0x02040D7C - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferNatureName - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02040DB4 -FUN_02040DB4: ; 0x02040DB4 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferFashionName - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02040DEC -FUN_02040DEC: ; 0x02040DEC - push {r3-r7, lr} - sub sp, #0x8 - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r7, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - mov r0, #0xb - ldrb r6, [r1, #0x0] - add r1, r0, #0x0 - bl String_ctor - add r5, #0x80 - add r4, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl FUN_02024EB4 - bl FUN_02024F0C - add r1, r0, #0x0 - add r0, r4, #0x0 - bl CopyU16ArrayToString - ldr r0, _02040E48 ; =gGameLanguage - mov r3, #0x0 - ldrb r0, [r0, #0x0] - str r3, [sp, #0x0] - add r1, r6, #0x0 - str r0, [sp, #0x4] - ldr r0, [r7, #0x0] - add r2, r4, #0x0 - bl BufferString - add r0, r4, #0x0 - bl String_dtor - mov r0, #0x0 - add sp, #0x8 - pop {r3-r7, pc} - nop -_02040E48: .word gGameLanguage - - thumb_func_start FUN_02040E4C -FUN_02040E4C: ; 0x02040E4C - push {r3-r7, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r6, [r0, #0x0] - mov r1, #0xf - add r0, r6, #0x0 - bl FUN_02039438 - ldr r1, [r4, #0x8] - add r7, r0, #0x0 - add r0, r1, #0x1 - str r0, [r4, #0x8] - add r0, r4, #0x0 - ldrb r5, [r1, #0x0] - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - str r0, [sp, #0x0] - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl VarGet - add r4, r0, #0x0 - ldr r0, [r6, #0xc] - bl SavArray_PlayerParty_get - ldr r1, [sp, #0x0] - bl GetPartyMonByIndex - add r4, #0x36 - add r1, r4, #0x0 - mov r2, #0x0 - bl GetMonData - lsl r0, r0, #0x10 - lsr r2, r0, #0x10 - ldr r0, [r7, #0x0] - add r1, r5, #0x0 - bl BufferMoveName - mov r0, #0x0 - pop {r3-r7, pc} - .balign 4 - - thumb_func_start FUN_02040EB4 -FUN_02040EB4: ; 0x02040EB4 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - mov r1, #0x3 - bl FUN_0207FC5C - lsl r0, r0, #0x10 - lsr r2, r0, #0x10 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferRibbonNameOrDesc - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02040EF8 -FUN_02040EF8: ; 0x02040EF8 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - sub r2, r2, #0x1 - lsl r2, r2, #0x10 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - lsr r2, r2, #0x10 - bl BufferSealName - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start FUN_02040F34 -FUN_02040F34: ; 0x02040F34 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferItemNameWithIndefArticle - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02040F6C -FUN_02040F6C: ; 0x02040F6C - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferItemNamePlural - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02040FA4 -FUN_02040FA4: ; 0x02040FA4 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferDecorationNameWithArticle - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02040FDC -FUN_02040FDC: ; 0x02040FDC - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferUndergroundTrapNameWithArticle - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02041014 -FUN_02041014: ; 0x02041014 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferUndergroundItemNameWithArticle - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_0204104C -FUN_0204104C: ; 0x0204104C - push {r3-r7, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r7, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - ldr r0, [r5, #0x8] - add r1, r4, #0x0 - add r0, r0, #0x1 - str r0, [r5, #0x8] - ldr r0, [r6, #0x0] - add r2, r7, #0x0 - bl BufferSpeciesNameWithArticle - mov r0, #0x0 - pop {r3-r7, pc} - .balign 4 - - thumb_func_start FUN_02041094 -FUN_02041094: ; 0x02041094 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r5, #0x80 - ldr r0, [r5, #0x0] - ldrb r4, [r1, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - bl FUN_0205F3C0 - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferSpeciesNameWithArticle - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start FUN_020410C8 -FUN_020410C8: ; 0x020410C8 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferFashionNameWithArticle - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02041100 -FUN_02041100: ; 0x02041100 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - bl BufferTrainerClassNameWithArticle - mov r0, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_02041138 -FUN_02041138: ; 0x02041138 - push {r4-r6, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r1, [r5, #0x8] - add r6, r0, #0x0 - add r0, r1, #0x1 - str r0, [r5, #0x8] - add r0, r5, #0x0 - ldrb r4, [r1, #0x0] - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl VarGet - add r2, r0, #0x0 - sub r2, r2, #0x1 - lsl r2, r2, #0x10 - ldr r0, [r6, #0x0] - add r1, r4, #0x0 - lsr r2, r2, #0x10 - bl BufferSealNamePlural - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start FUN_02041174 -FUN_02041174: ; 0x02041174 - push {r4, lr} - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - ldr r2, [r4, #0x8] - add r1, r2, #0x1 - str r1, [r4, #0x8] - ldrb r1, [r2, #0x0] - ldr r0, [r0, #0x0] - bl ScrStrBufs_UpperFirstChar - mov r0, #0x0 - pop {r4, pc} diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index b79288ca..a4b7aa12 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -354,28 +354,28 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203CB20 .word FUN_0203CB48 .word FUN_0203CB60 - .word FUN_020406CC - .word FUN_02040700 - .word FUN_02040724 - .word FUN_02040748 - .word FUN_02040790 - .word FUN_020407C8 - .word FUN_02040800 - .word FUN_0204083C - .word FUN_02040874 - .word FUN_0204091C - .word FUN_020409C0 - .word FUN_020409F8 - .word FUN_02040A30 - .word FUN_02040A7C - .word FUN_02040B0C - .word FUN_02040B5C - .word FUN_02040BAC + .word ScrCmd_GetPlayerName + .word ScrCmd_GetRivalName + .word ScrCmd_GetFriendName + .word ScrCmd_Unk00D0 + .word ScrCmd_GetItemName + .word ScrCmd_GetPocketName + .word ScrCmd_GetTMHMMoveName + .word ScrCmd_GetMoveName + .word ScrCmd_Unk00D5 + .word ScrCmd_Unk00D6 + .word ScrCmd_GetPoketchAppName + .word ScrCmd_GetTrainerClassName + .word ScrCmd_Unk00D9 + .word ScrCmd_Unk00DA + .word ScrCmd_Unk00DB + .word ScrCmd_Unk00DC + .word ScrCmd_Unk00DD .word FUN_0203CBBC - .word FUN_02040BFC - .word FUN_02040C34 - .word FUN_02040C6C - .word FUN_02040CA4 + .word ScrCmd_GetDecorationName + .word ScrCmd_GetUndergroundTrapName + .word ScrCmd_GetUndergroundItemName + .word ScrCmd_Unk00E2 .word FUN_0203CB70 .word FUN_0204185C .word FUN_0204188C @@ -528,8 +528,8 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203C460 .word FUN_0203C4B0 .word FUN_0203D958 - .word FUN_02040D04 - .word FUN_02040D7C + .word ScrCmd_Unk017B + .word ScrCmd_GetNatureName .word ScrCmd_Unk017D .word ScrCmd_Unk017E .word ScrCmd_Unk017F @@ -608,7 +608,7 @@ gScriptCmdTable: ; 0x020F355C .word FUN_02044D8C .word FUN_02044E34 .word FUN_02044E78 - .word FUN_02040E4C + .word ScrCmd_GetPokemonMoveName .word FUN_0203E138 .word FUN_0203E168 .word FUN_0203E254 @@ -711,7 +711,7 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0204505C .word FUN_02045104 .word FUN_02045170 - .word FUN_02040EB4 + .word ScrCmd_Unk0232 .word FUN_0203E9CC .word FUN_0203EA68 .word FUN_02041E40 @@ -742,7 +742,7 @@ gScriptCmdTable: ; 0x020F355C .word FUN_02041194 .word FUN_020411C4 .word FUN_02041340 - .word FUN_02040964 + .word ScrCmd_Unk0251 .word ScrCmd_pcfreespace .word ScrCmd_Unk0253 .word ScrCmd_Unk0254 @@ -758,7 +758,7 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203EE58 .word FUN_0203EE68 .word FUN_0203EE78 - .word FUN_02040DB4 + .word ScrCmd_GetFashionName .word FUN_0203EE98 .word FUN_0203EED8 .word FUN_0203EF58 @@ -775,7 +775,7 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203F254 .word FUN_0203F26C .word FUN_0203C58C - .word FUN_02040DEC + .word ScrCmd_Unk0272 .word FUN_0203F2AC .word ScrCmd_HasEnoughCoinsImmediate .word FUN_0203F2E4 @@ -789,7 +789,7 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203F3AC .word FUN_0203F44C .word FUN_0203F418 - .word FUN_020408BC + .word ScrCmd_Unk0280 .word FUN_02044A0C .word FUN_0203F484 .word FUN_02041674 @@ -840,7 +840,7 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203FB94 .word FUN_0203FBA0 .word FUN_0203FBAC - .word FUN_02040EF8 + .word ScrCmd_GetSealName .word FUN_0203B2E0 .word FUN_0203FBBC .word FUN_0203FC1C @@ -857,17 +857,17 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203FC80 .word FUN_0203FCB0 .word FUN_0203FCDC - .word FUN_02040F34 - .word FUN_02040F6C - .word FUN_02040FA4 - .word FUN_02040FDC - .word FUN_02041014 - .word FUN_0204104C - .word FUN_02041094 - .word FUN_020410C8 - .word FUN_02041100 - .word FUN_02041138 - .word FUN_02041174 + .word ScrCmd_GetItemNameWithIndefArticle + .word ScrCmd_GetItemNamePlural + .word ScrCmd_GetDecorationNameWithArticle + .word ScrCmd_GetUndergroundTrapNameWithArticle + .word ScrCmd_GetUndergroundItemNameWithArticle + .word ScrCmd_Unk02C9 + .word ScrCmd_Unk02CA + .word ScrCmd_GetFashionNameWithArticle + .word ScrCmd_Unk02CC + .word ScrCmd_GetSealNamePlural + .word ScrCmd_CapitalizeFirstChar .word ScrCmd_Unk02CF .word ScrCmd_Unk02D0 diff --git a/arm9/global.inc b/arm9/global.inc index 0da3fadd..bda86b74 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -3152,47 +3152,47 @@ .extern FUN_0204064C .extern FUN_02040660 .extern FUN_020406C0 -.extern FUN_020406CC -.extern FUN_02040700 -.extern FUN_02040724 -.extern FUN_02040748 -.extern FUN_02040790 -.extern FUN_020407C8 -.extern FUN_02040800 -.extern FUN_0204083C -.extern FUN_02040874 -.extern FUN_020408BC -.extern FUN_0204091C -.extern FUN_02040964 -.extern FUN_020409C0 -.extern FUN_020409F8 -.extern FUN_02040A30 -.extern FUN_02040A7C -.extern FUN_02040B0C -.extern FUN_02040B5C -.extern FUN_02040BAC -.extern FUN_02040BFC -.extern FUN_02040C34 -.extern FUN_02040C6C -.extern FUN_02040CA4 -.extern FUN_02040D04 -.extern FUN_02040D7C -.extern FUN_02040DB4 -.extern FUN_02040DEC -.extern FUN_02040E4C -.extern FUN_02040EB4 -.extern FUN_02040EF8 -.extern FUN_02040F34 -.extern FUN_02040F6C -.extern FUN_02040FA4 -.extern FUN_02040FDC -.extern FUN_02041014 -.extern FUN_0204104C -.extern FUN_02041094 -.extern FUN_020410C8 -.extern FUN_02041100 -.extern FUN_02041138 -.extern FUN_02041174 +.extern ScrCmd_GetPlayerName +.extern ScrCmd_GetRivalName +.extern ScrCmd_GetFriendName +.extern ScrCmd_Unk00D0 +.extern ScrCmd_GetItemName +.extern ScrCmd_GetPocketName +.extern ScrCmd_GetTMHMMoveName +.extern ScrCmd_GetMoveName +.extern ScrCmd_Unk00D5 +.extern ScrCmd_Unk0280 +.extern ScrCmd_Unk00D6 +.extern ScrCmd_Unk0251 +.extern ScrCmd_GetPoketchAppName +.extern ScrCmd_GetTrainerClassName +.extern ScrCmd_Unk00D9 +.extern ScrCmd_Unk00DA +.extern ScrCmd_Unk00DB +.extern ScrCmd_Unk00DC +.extern ScrCmd_Unk00DD +.extern ScrCmd_GetDecorationName +.extern ScrCmd_GetUndergroundTrapName +.extern ScrCmd_GetUndergroundItemName +.extern ScrCmd_Unk00E2 +.extern ScrCmd_Unk017B +.extern ScrCmd_GetNatureName +.extern ScrCmd_GetFashionName +.extern ScrCmd_Unk0272 +.extern ScrCmd_GetPokemonMoveName +.extern ScrCmd_Unk0232 +.extern ScrCmd_GetSealName +.extern ScrCmd_GetItemNameWithIndefArticle +.extern ScrCmd_GetItemNamePlural +.extern ScrCmd_GetDecorationNameWithArticle +.extern ScrCmd_GetUndergroundTrapNameWithArticle +.extern ScrCmd_GetUndergroundItemNameWithArticle +.extern ScrCmd_Unk02C9 +.extern ScrCmd_Unk02CA +.extern ScrCmd_GetFashionNameWithArticle +.extern ScrCmd_Unk02CC +.extern ScrCmd_GetSealNamePlural +.extern ScrCmd_CapitalizeFirstChar .extern FUN_02041194 .extern FUN_020411C4 .extern FUN_02041340 diff --git a/arm9/src/scrcmd_names.c b/arm9/src/scrcmd_names.c new file mode 100644 index 00000000..cf721328 --- /dev/null +++ b/arm9/src/scrcmd_names.c @@ -0,0 +1,540 @@ +#include "scrcmd.h" +#include "event_data.h" +#include "itemtool.h" +#include "nutdata.h" +#include "party.h" +#include "player_data.h" +#include "script_buffers.h" +#include "unk_02024E64.h" +#include "unk_02064E4C.h" +#include "unk_0207FC5C.h" + +extern void* FUN_02039438(struct UnkSavStruct80* sav_ptr, int idx); + +extern u32 FUN_020536D0(u32 gender, u32 avatar, u32 a2); +extern u32 FUN_0205F388(struct ScriptState* state); +extern u32 FUN_0205F398(struct ScriptState* state); +extern struct PCStorage* GetStoragePCPointer(struct SaveBlock2* sav2); +extern u32 FUN_0205F3C0(struct ScriptState* state); +extern u32 FUN_02054C14(u32 number); + +THUMB_FUNC BOOL ScrCmd_GetPlayerName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + struct SaveBlock2* sav2 = ScriptEnvironment_GetSav2Ptr(sav_ptr); + struct PlayerData* player = Sav2_PlayerData_GetProfileAddr(sav2); + + BufferPlayersName(*mgr, idx, player); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetRivalName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + + BufferRivalsName(*mgr, idx, sav_ptr->saveBlock2); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetFriendName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + + BufferFriendsName(*mgr, idx, sav_ptr->saveBlock2); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00D0(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 mon_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct PlayerParty* party = SavArray_PlayerParty_get(sav_ptr->saveBlock2); + struct Pokemon* mon = GetPartyMonByIndex(party, mon_idx); + + BufferBoxMonSpeciesName(*mgr, idx, &mon->box); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetItemName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 item = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferItemName(*mgr, idx, item); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetPocketName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 pocket = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferPocketName(*mgr, idx, pocket); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetTMHMMoveName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 tmhm = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 move = TMHMGetMove(tmhm); + + BufferMoveName(*mgr, idx, move); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetMoveName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 move = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferMoveName(*mgr, idx, move); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00D5(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u32 digits = FUN_02054C14(unk); + + BufferIntegerAsString(*mgr, idx, unk, digits, 1, TRUE); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0280(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u8 unk2 = ScriptReadByte(ctx); + u8 digits = ScriptReadByte(ctx); + if (unk2 == 0) + { + digits = (u8)FUN_02054C14(unk); + } + + BufferIntegerAsString(*mgr, idx, unk, digits, unk2, TRUE); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00D6(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 mon_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct PlayerParty* party = SavArray_PlayerParty_get(sav_ptr->saveBlock2); + struct Pokemon* pokemon = GetPartyMonByIndex(party, mon_idx); + + BufferBoxMonNickname(*mgr, idx, &pokemon->box); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0251(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct PCStorage* pc = GetStoragePCPointer(sav_ptr->saveBlock2); + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 box_mon_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + s32 box_no = box_mon_idx / 30; + s32 slot_no = box_mon_idx % 30; + struct BoxPokemon* box_mon = PCStorage_GetMonByIndexPair(pc, box_no, slot_no); + + BufferBoxMonNickname(*mgr, idx, box_mon); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetPoketchAppName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 app = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferPoketchAppName(*mgr, idx, app); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetTrainerClassName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 trainer_class = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferTrainerClassName(*mgr, idx, trainer_class); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00D9(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct SaveBlock2* sav2 = ScriptEnvironment_GetSav2Ptr(sav_ptr); + struct PlayerData* player = Sav2_PlayerData_GetProfileAddr(sav2); + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u32 gender = PlayerProfile_GetTrainerGender(player); + u32 avatar = PlayerProfile_GetAvatar(player); + u32 trainer_class = FUN_020536D0(gender, avatar, 2); + + BufferTrainerClassNameWithArticle(*mgr, idx, trainer_class); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00DA(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 msg_no = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unk1 = ScriptReadHalfword(ctx); + u8 unk2 = ScriptReadByte(ctx); + struct String* str = FUN_02040AE4(msg_no, 4); + + BufferString(*mgr, idx, str, unk1, unk2, 2); + String_dtor(str); + + return FALSE; +} + +THUMB_FUNC struct String* FUN_02040AE4(u32 msg_no, u32 heap_id) +{ + struct MsgData* msg_data = NewMsgDataFromNarc(1, NARC_MSGDATA_MSG, 362, heap_id); + struct String* ret = NewString_ReadMsgData(msg_data, msg_no); + DestroyMsgData(msg_data); + + return ret; +} + +THUMB_FUNC BOOL ScrCmd_Unk00DB(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + u32 msg_no = FUN_0205F388(state); + struct String* str = FUN_02040AE4(msg_no, 4); + + BufferString(*mgr, idx, str, 0, 1, 2); + String_dtor(str); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00DC(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + u32 msg_no = FUN_0205F398(state); + struct String* str = FUN_02040AE4(msg_no, 4); + + BufferString(*mgr, idx, str, 0, 1, 2); + String_dtor(str); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00DD(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + u32 msg_no = FUN_0205F3C0(state); + struct String* str = FUN_02040AE4(msg_no, 4); + + BufferString(*mgr, idx, str, 0, 1, 2); + String_dtor(str); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetDecorationName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 decoration = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferDecorationName(*mgr, idx, decoration); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetUndergroundTrapName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 underground_trap = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferUndergroundTrapName(*mgr, idx, underground_trap); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetUndergroundItemName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 underground_item = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferUndergroundItemName(*mgr, idx, underground_item); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00E2(struct ScriptContext* ctx) +{ + struct String* str = String_ctor(22, 4); + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 map_no = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + FUN_02064E60(map_no, 4, str); + BufferString(*mgr, idx, str, 0, 1, 2); + String_dtor(str); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk017B(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 berry = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct String* nut_name = GetNutName((u16)(berry - FIRST_BERRY_IDX), 32); + + BufferString(*mgr, idx, nut_name, 0, unk < 2, 2); + String_dtor(nut_name); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetNatureName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 nature = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferNatureName(*mgr, idx, nature); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetFashionName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 fashion = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferFashionName(*mgr, idx, fashion); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0272(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + struct String* str = String_ctor(11, 11); + struct UnkStruct_02024E64* unk = FUN_02024EB4(ctx->unk80->saveBlock2); + u16* unk_buffer = FUN_02024F0C(unk); + + CopyU16ArrayToString(str, unk_buffer); + BufferString(*mgr, idx, str, 0, 0, gGameLanguage); + String_dtor(str); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetPokemonMoveName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 mon_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 mon_move_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct PlayerParty* party = SavArray_PlayerParty_get(sav_ptr->saveBlock2); + struct Pokemon* pokemon = GetPartyMonByIndex(party, mon_idx); + u16 move = (u16)GetMonData(pokemon, MON_DATA_MOVE1 + mon_move_idx, NULL); + + BufferMoveName(*mgr, idx, move); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0232(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u8 unk = (u8)VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 ribbon = (u16)FUN_0207FC5C(unk, 3); + + BufferRibbonNameOrDesc(*mgr, idx, ribbon); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetSealName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 seal = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferSealName(*mgr, idx, (u16)(seal - 1)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetItemNameWithIndefArticle(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 item = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferItemNameWithIndefArticle(*mgr, idx, item); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetItemNamePlural(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 item = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferItemNamePlural(*mgr, idx, item); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetDecorationNameWithArticle(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 decoration = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferDecorationNameWithArticle(*mgr, idx, decoration); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetUndergroundTrapNameWithArticle(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 underground_trap = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferUndergroundTrapNameWithArticle(*mgr, idx, underground_trap); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetUndergroundItemNameWithArticle(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 underground_item = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferUndergroundItemNameWithArticle(*mgr, idx, underground_item); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk02C9(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 species = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused1 = ScriptReadHalfword(ctx); + u8 unused2 = ScriptReadByte(ctx); + + BufferSpeciesNameWithArticle(*mgr, idx, species); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk02CA(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + u32 species = FUN_0205F3C0(state); + + BufferSpeciesNameWithArticle(*mgr, idx, species); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetFashionNameWithArticle(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 fashion = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferFashionNameWithArticle(*mgr, idx, fashion); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk02CC(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 trainer_class = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferTrainerClassNameWithArticle(*mgr, idx, trainer_class); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetSealNamePlural(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 seal = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferSealNamePlural(*mgr, idx, (u16)(seal - 1)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_CapitalizeFirstChar(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + + ScrStrBufs_UpperFirstChar(*mgr, idx); + + return FALSE; +} -- cgit v1.2.3 From 419991733b49432fbd2f130e960736469af85400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Fri, 9 Apr 2021 20:12:14 +0200 Subject: more decomp --- arm9/asm/unk_0202F150.s | 948 ---------------------------------------------- arm9/global.inc | 5 + arm9/src/unk_0202F150_c.c | 368 +++++++++++++++++- 3 files changed, 371 insertions(+), 950 deletions(-) (limited to 'arm9') diff --git a/arm9/asm/unk_0202F150.s b/arm9/asm/unk_0202F150.s index 395ebd44..802807f5 100644 --- a/arm9/asm/unk_0202F150.s +++ b/arm9/asm/unk_0202F150.s @@ -12,954 +12,6 @@ .text - thumb_func_start FUN_0202FEEC -FUN_0202FEEC: ; 0x0202FEEC - push {r3-r7, lr} - ldr r0, _02030064 ; =UNK_021C59F4 - ldr r0, [r0, #0x4] - cmp r0, #0x0 - beq _0202FEFE - bl FUN_02033534 - cmp r0, #0x13 - blt _0202FF00 -_0202FEFE: - b _02030062 -_0202FF00: - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_02031228 - str r0, [sp, #0x0] - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D858 - add r6, r0, #0x1 - ldr r0, _02030068 ; =UNK_02105D58 - ldrb r1, [r0, #0x1] - cmp r1, #0x2 - beq _0202FF2C - ldrb r0, [r0, #0x1] - cmp r0, #0x0 - beq _0202FF2C - b _02030062 -_0202FF2C: - ldr r0, _02030068 ; =UNK_02105D58 - ldrb r1, [r0, #0x1] - add r1, r1, #0x1 - strb r1, [r0, #0x1] - bl FUN_0202FA28 - cmp r0, #0x1 - bne _0202FF4A - ldr r0, _02030064 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - mov r0, #0x1a - lsl r0, r0, #0x6 - ldrb r0, [r1, r0] - bl FUN_0202FE2C -_0202FF4A: - bl FUN_0202CBD4 - cmp r0, #0x4 - bne _0202FF86 - bl FUN_02031280 - cmp r0, #0x0 - bne _0202FF86 - ldr r0, _02030064 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - mov r0, #0x55 - lsl r0, r0, #0x2 - add r3, r1, r0 - mov r0, #0x1a - lsl r0, r0, #0x6 - ldrb r0, [r1, r0] - mov r1, #0xc0 - add r2, r0, #0x0 - mul r2, r1 - add r0, r3, r2 - ldr r3, _0203006C ; =FUN_020304F0 - mov r2, #0xe - bl FUN_0202D0D0 - cmp r0, #0x0 - bne _0202FF86 - ldr r0, _02030068 ; =UNK_02105D58 - ldrb r1, [r0, #0x1] - sub r1, r1, #0x1 - strb r1, [r0, #0x1] -_0202FF86: - ldr r0, _02030068 ; =UNK_02105D58 - ldrb r1, [r0, #0x1] - cmp r1, #0x1 - beq _0202FF94 - ldrb r0, [r0, #0x1] - cmp r0, #0x3 - bne _0203000A -_0202FF94: - mov r4, #0x0 - cmp r6, #0x0 - ble _0202FFDC - ldr r7, _02030064 ; =UNK_021C59F4 - add r5, r4, #0x0 -_0202FF9E: - lsl r0, r4, #0x10 - lsr r0, r0, #0x10 - bl FUN_02030E7C - cmp r0, #0x0 - beq _0202FFBA - ldr r0, [r7, #0x4] - ldr r1, _02030070 ; =0x00000638 - add r0, r0, r5 - ldr r1, [r0, r1] - add r2, r1, #0x1 - ldr r1, _02030070 ; =0x00000638 - str r2, [r0, r1] - b _0202FFD4 -_0202FFBA: - bl FUN_02031280 - cmp r0, #0x0 - beq _0202FFD4 - cmp r4, #0x0 - bne _0202FFD4 - ldr r0, [r7, #0x4] - ldr r1, _02030070 ; =0x00000638 - add r0, r0, r5 - ldr r1, [r0, r1] - add r2, r1, #0x1 - ldr r1, _02030070 ; =0x00000638 - str r2, [r0, r1] -_0202FFD4: - add r4, r4, #0x1 - add r5, r5, #0x4 - cmp r4, r6 - blt _0202FF9E -_0202FFDC: - ldr r0, _02030064 ; =UNK_021C59F4 - mov r1, #0x55 - ldr r2, [r0, #0x4] - lsl r1, r1, #0x2 - add r4, r2, r1 - mov r1, #0x1a - lsl r1, r1, #0x6 - ldrb r1, [r2, r1] - mov r2, #0xc0 - mov r0, #0x0 - add r3, r1, #0x0 - mul r3, r2 - add r1, r4, r3 - bl FUN_0203026C - ldr r0, _02030064 ; =UNK_021C59F4 - mov r1, #0x1a - ldr r3, [r0, #0x4] - lsl r1, r1, #0x6 - ldrb r2, [r3, r1] - mov r0, #0x1 - sub r0, r0, r2 - strb r0, [r3, r1] -_0203000A: - mov r5, #0x0 - cmp r6, #0x0 - ble _0203004A - add r4, r5, #0x0 - mov r7, #0xff -_02030014: - lsl r0, r5, #0x10 - lsr r0, r0, #0x10 - bl FUN_02030E7C - cmp r0, #0x0 - bne _02030040 - bl FUN_0202FA28 - cmp r0, #0x1 - bne _02030040 - ldr r0, _02030064 ; =UNK_021C59F4 - mov r1, #0x1a - ldr r0, [r0, #0x4] - lsl r1, r1, #0x6 - ldrb r2, [r0, r1] - mov r1, #0xc0 - mul r1, r2 - add r0, r0, r1 - add r1, r4, r0 - mov r0, #0x55 - lsl r0, r0, #0x2 - strb r7, [r1, r0] -_02030040: - ldr r0, [sp, #0x0] - add r5, r5, #0x1 - add r4, r4, r0 - cmp r5, r6 - blt _02030014 -_0203004A: - bl FUN_0202CBD4 - cmp r0, #0x4 - bne _0203005A - bl FUN_02031280 - cmp r0, #0x0 - beq _02030062 -_0203005A: - ldr r0, _02030068 ; =UNK_02105D58 - ldrb r1, [r0, #0x1] - add r1, r1, #0x1 - strb r1, [r0, #0x1] -_02030062: - pop {r3-r7, pc} - .balign 4 -_02030064: .word UNK_021C59F4 -_02030068: .word UNK_02105D58 -_0203006C: .word FUN_020304F0 -_02030070: .word 0x00000638 - - thumb_func_start FUN_02030074 -FUN_02030074: ; 0x02030074 - push {r3-r7, lr} - ldr r0, _02030228 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _0203022C ; =0x00000683 - ldrb r0, [r1, r0] - cmp r0, #0x0 - beq _020300DC - bl FUN_02033534 - cmp r0, #0x13 - blt _020300B4 - mov r0, #0x0 - bl FUN_02030E7C - cmp r0, #0x0 - beq _020300DC - ldr r0, _02030228 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - mov r0, #0x55 - lsl r0, r0, #0x2 - add r0, r1, r0 - mov r1, #0x4c - bl MOD04_021D79B4 - cmp r0, #0x0 - beq _020300DC - ldr r0, _02030228 ; =UNK_021C59F4 - mov r2, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _0203022C ; =0x00000683 - strb r2, [r1, r0] - pop {r3-r7, pc} -_020300B4: - bl FUN_0202CBD4 - cmp r0, #0x4 - beq _020300C4 - bl FUN_02031280 - cmp r0, #0x0 - beq _020300DC -_020300C4: - bl FUN_0202FEEC - ldr r0, _02030230 ; =UNK_02105D58 - ldrb r0, [r0, #0x1] - cmp r0, #0x2 - bne _020300DC - ldr r0, _02030228 ; =UNK_021C59F4 - mov r2, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _0203022C ; =0x00000683 - strb r2, [r1, r0] - pop {r3-r7, pc} -_020300DC: - bl FUN_02033534 - cmp r0, #0x13 - blt _02030184 - mov r0, #0x0 - bl FUN_02030E7C - cmp r0, #0x0 - bne _020300F0 - b _02030224 -_020300F0: - ldr r0, _02030228 ; =UNK_021C59F4 - mov r1, #0x63 - ldr r2, [r0, #0x4] - lsl r1, r1, #0x4 - ldr r0, [r2, r1] - cmp r0, #0x0 - beq _02030130 - add r0, r1, #0x0 - add r0, #0xc - ldr r0, [r2, r0] - cmp r0, #0x3 - bgt _02030110 - add r1, #0x8 - ldr r0, [r2, r1] - cmp r0, #0x3 - ble _02030112 -_02030110: - b _02030224 -_02030112: - ldr r0, _02030230 ; =UNK_02105D58 - ldrb r0, [r0, #0x1] - cmp r0, #0x4 - bne _02030150 - bl FUN_0202FA28 - cmp r0, #0x1 - bne _02030128 - mov r0, #0x0 - bl FUN_0202FE2C -_02030128: - ldr r0, _02030230 ; =UNK_02105D58 - mov r1, #0x2 - strb r1, [r0, #0x1] - b _02030150 -_02030130: - ldr r0, _02030230 ; =UNK_02105D58 - ldrb r0, [r0, #0x1] - cmp r0, #0x4 - bne _0203014A - bl FUN_0202FA28 - cmp r0, #0x1 - bne _0203014A - mov r0, #0x0 - bl FUN_0202FE2C - cmp r0, #0x0 - beq _02030224 -_0203014A: - ldr r0, _02030230 ; =UNK_02105D58 - mov r1, #0x2 - strb r1, [r0, #0x1] -_02030150: - ldr r0, _02030228 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - mov r0, #0x55 - lsl r0, r0, #0x2 - add r0, r1, r0 - mov r1, #0x4c - bl MOD04_021D79B4 - cmp r0, #0x0 - beq _02030224 - ldr r0, _02030230 ; =UNK_02105D58 - mov r1, #0x4 - strb r1, [r0, #0x1] - ldr r1, _02030228 ; =UNK_021C59F4 - ldr r0, _02030234 ; =0x00000638 - ldr r3, [r1, #0x4] - ldr r2, [r3, r0] - add r2, r2, #0x1 - str r2, [r3, r0] - ldr r2, [r1, #0x4] - add r1, r0, #0x4 - ldr r1, [r2, r1] - add r0, r0, #0x4 - add r1, r1, #0x1 - str r1, [r2, r0] - pop {r3-r7, pc} -_02030184: - bl FUN_0202CBD4 - cmp r0, #0x4 - beq _02030194 - bl FUN_02031280 - cmp r0, #0x0 - beq _02030224 -_02030194: - ldr r0, _02030230 ; =UNK_02105D58 - ldrb r0, [r0, #0x1] - cmp r0, #0x4 - bne _02030224 - ldr r6, _02030228 ; =UNK_021C59F4 - ldr r7, _02030234 ; =0x00000638 - mov r4, #0x1 - mov r5, #0x4 -_020301A4: - lsl r0, r4, #0x10 - lsr r0, r0, #0x10 - bl FUN_02030E7C - cmp r0, #0x0 - beq _020301BC - ldr r0, [r6, #0x4] - add r0, r0, r5 - ldr r0, [r0, r7] - cmp r0, #0x3 - ble _020301D2 - pop {r3-r7, pc} -_020301BC: - cmp r4, #0x0 - bne _020301D2 - bl FUN_02031280 - cmp r0, #0x0 - beq _020301D2 - ldr r1, [r6, #0x4] - ldr r0, _02030234 ; =0x00000638 - ldr r0, [r1, r0] - cmp r0, #0x3 - bgt _02030224 -_020301D2: - add r4, r4, #0x1 - add r5, r5, #0x4 - cmp r4, #0x8 - blt _020301A4 - bl FUN_0202FA28 - cmp r0, #0x0 - bne _0203021A - ldr r0, _02030228 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - mov r0, #0x55 - lsl r0, r0, #0x2 - add r2, r1, r0 - mov r0, #0x1a - lsl r0, r0, #0x6 - ldrb r1, [r1, r0] - mov r0, #0xc0 - mul r0, r1 - add r0, r2, r0 - bl FUN_02030A00 - ldr r0, _02030228 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - mov r0, #0x55 - lsl r0, r0, #0x2 - add r2, r1, r0 - mov r0, #0x1a - lsl r0, r0, #0x6 - ldrb r1, [r1, r0] - mov r0, #0x1 - sub r1, r0, r1 - mov r0, #0xc0 - mul r0, r1 - add r0, r2, r0 - bl FUN_02030A00 -_0203021A: - ldr r0, _02030230 ; =UNK_02105D58 - mov r1, #0x0 - strb r1, [r0, #0x1] - bl FUN_0202FEEC -_02030224: - pop {r3-r7, pc} - nop -_02030228: .word UNK_021C59F4 -_0203022C: .word 0x00000683 -_02030230: .word UNK_02105D58 -_02030234: .word 0x00000638 - - thumb_func_start FUN_02030238 -FUN_02030238: ; 0x02030238 - push {r4-r6, lr} - ldr r4, _02030264 ; =UNK_021C59F4 - ldr r3, _02030268 ; =0x0000066F - ldr r5, [r4, #0x4] - ldrb r6, [r5, r3] - cmp r6, #0x0 - beq _0203025C - add r0, r3, #0x0 - sub r0, #0x3b - ldr r0, [r5, r0] - sub r1, r0, #0x1 - add r0, r3, #0x0 - sub r0, #0x3b - str r1, [r5, r0] - ldr r0, [r4, #0x4] - mov r1, #0x0 - strb r1, [r0, r3] - pop {r4-r6, pc} -_0203025C: - bl FUN_0203026C - pop {r4-r6, pc} - nop -_02030264: .word UNK_021C59F4 -_02030268: .word 0x0000066F - - thumb_func_start FUN_0203026C -FUN_0203026C: ; 0x0203026C - push {r3-r7, lr} - sub sp, #0x8 - ldr r0, _020303A0 ; =UNK_021C59F4 - add r5, r1, #0x0 - ldr r2, [r0, #0x4] - ldr r0, _020303A4 ; =0x00000634 - ldr r1, [r2, r0] - sub r1, r1, #0x1 - str r1, [r2, r0] - cmp r5, #0x0 - beq _02030290 - ldrb r0, [r5, #0x0] - cmp r0, #0xb - bne _02030296 - bl FUN_0202FA28 - cmp r0, #0x1 - bne _02030292 -_02030290: - b _0203039C -_02030292: - add r5, r5, #0x1 - b _0203029E -_02030296: - bl FUN_0202FA28 - cmp r0, #0x0 - beq _0203039C -_0203029E: - ldr r0, _020303A0 ; =UNK_021C59F4 - ldr r1, _020303A8 ; =0x00000682 - ldr r0, [r0, #0x4] - ldrb r1, [r0, r1] - cmp r1, #0x0 - beq _020302B2 - ldrb r2, [r5, #0x0] - mov r1, #0x1 - tst r1, r2 - bne _0203039C -_020302B2: - ldr r1, _020303A8 ; =0x00000682 - mov r2, #0x0 - strb r2, [r0, r1] - bl FUN_0202FA28 - cmp r0, #0x1 - bne _0203036E - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_02031228 - add r6, r0, #0x0 - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D858 - add r0, r0, #0x1 - mov r4, #0x0 - str r0, [sp, #0x4] - cmp r0, #0x0 - ble _0203039C - sub r0, r6, #0x1 - add r7, r4, #0x0 - str r0, [sp, #0x0] -_020302EA: - ldrb r0, [r5, #0x0] - cmp r0, #0xff - bne _02030302 - ldr r0, _020303A0 ; =UNK_021C59F4 - mov r2, #0x1 - ldr r1, [r0, #0x4] - ldr r0, _020303AC ; =0x0000065C - lsl r2, r4 - ldrh r0, [r1, r0] - mvn r2, r2 - and r2, r0 - b _02030310 -_02030302: - ldr r0, _020303A0 ; =UNK_021C59F4 - mov r2, #0x1 - ldr r1, [r0, #0x4] - ldr r0, _020303AC ; =0x0000065C - lsl r2, r4 - ldrh r0, [r1, r0] - orr r2, r0 -_02030310: - ldr r0, _020303AC ; =0x0000065C - strh r2, [r1, r0] - ldrb r2, [r5, #0x0] - cmp r2, #0xff - bne _0203031E - add r5, r5, r6 - b _02030360 -_0203031E: - cmp r2, #0xe - bne _02030326 - add r5, r5, r6 - b _02030360 -_02030326: - ldr r0, _020303A0 ; =UNK_021C59F4 - ldr r3, [r0, #0x4] - ldr r0, _020303B0 ; =0x00000667 - add r1, r3, r4 - ldrb r0, [r1, r0] - cmp r0, #0x0 - beq _0203033E - mov r0, #0x1 - tst r0, r2 - beq _0203033E - add r5, r5, r6 - b _02030360 -_0203033E: - ldr r0, _020303B4 ; =0x000004E8 - add r5, r5, #0x1 - add r0, r3, r0 - ldr r2, [sp, #0x0] - ldr r3, _020303B8 ; =0x000005E6 - add r0, r0, r7 - add r1, r5, #0x0 - bl FUN_0202D3A4 - ldr r0, [sp, #0x0] - mov r1, #0x0 - add r5, r5, r0 - ldr r0, _020303A0 ; =UNK_021C59F4 - ldr r0, [r0, #0x4] - add r2, r0, r4 - ldr r0, _020303B0 ; =0x00000667 - strb r1, [r2, r0] -_02030360: - ldr r0, [sp, #0x4] - add r4, r4, #0x1 - add r7, #0xc - cmp r4, r0 - blt _020302EA - add sp, #0x8 - pop {r3-r7, pc} -_0203036E: - ldr r0, _020303A0 ; =UNK_021C59F4 - ldrb r2, [r5, #0x1] - ldr r1, [r0, #0x4] - ldr r3, _020303AC ; =0x0000065C - strh r2, [r1, r3] - ldr r2, [r0, #0x4] - ldrh r1, [r2, r3] - lsl r1, r1, #0x8 - strh r1, [r2, r3] - ldr r4, [r0, #0x4] - ldrb r1, [r5, #0x2] - ldrh r2, [r4, r3] - add r1, r2, r1 - strh r1, [r4, r3] - ldr r1, [r0, #0x4] - mov r0, #0x47 - lsl r0, r0, #0x4 - add r0, r1, r0 - ldrb r2, [r5, #0x3] - add r1, r5, #0x4 - sub r3, #0x5d - bl FUN_0202D3A4 -_0203039C: - add sp, #0x8 - pop {r3-r7, pc} - .balign 4 -_020303A0: .word UNK_021C59F4 -_020303A4: .word 0x00000634 -_020303A8: .word 0x00000682 -_020303AC: .word 0x0000065C -_020303B0: .word 0x00000667 -_020303B4: .word 0x000004E8 -_020303B8: .word 0x000005E6 - - thumb_func_start FUN_020303BC -FUN_020303BC: ; 0x020303BC - push {r4-r6, lr} - ldr r3, _020303EC ; =UNK_021C59F4 - ldr r6, _020303F0 ; =0x0000066F - ldr r5, [r3, #0x4] - add r4, r5, r0 - ldrb r4, [r4, r6] - cmp r4, #0x0 - beq _020303E4 - add r1, r6, #0x0 - sub r1, #0x37 - add r4, r5, r1 - lsl r2, r0, #0x2 - ldr r1, [r4, r2] - sub r1, r1, #0x1 - str r1, [r4, r2] - ldr r1, [r3, #0x4] - mov r2, #0x0 - add r0, r1, r0 - strb r2, [r0, r6] - pop {r4-r6, pc} -_020303E4: - bl FUN_020303F4 - pop {r4-r6, pc} - nop -_020303EC: .word UNK_021C59F4 -_020303F0: .word 0x0000066F - - thumb_func_start FUN_020303F4 -FUN_020303F4: ; 0x020303F4 - push {r4-r6, lr} - ldr r3, _020304B8 ; =UNK_021C59F4 - add r5, r0, #0x0 - ldr r0, [r3, #0x4] - ldr r2, _020304BC ; =0x00000638 - add r4, r1, #0x0 - add r1, r0, r2 - lsl r0, r5, #0x2 - ldr r6, [r1, r0] - sub r6, r6, #0x1 - str r6, [r1, r0] - cmp r4, #0x0 - beq _020304B4 - ldr r0, [r3, #0x4] - add r2, #0x2f - add r0, r0, r2 - ldrb r1, [r0, r5] - cmp r1, #0x0 - beq _02030422 - ldrb r2, [r4, #0x0] - mov r1, #0x1 - tst r1, r2 - bne _020304B4 -_02030422: - mov r1, #0x0 - strb r1, [r0, r5] - bl FUN_0202FA28 - cmp r0, #0x1 - bne _02030478 - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_02031228 - add r6, r0, #0x0 - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D858 - ldrb r1, [r4, #0x0] - mov r0, #0x2 - tst r0, r1 - bne _02030468 - ldr r0, _020304B8 ; =UNK_021C59F4 - ldr r3, _020304C0 ; =0x0000065E - ldr r1, [r0, #0x4] - ldr r0, _020304C4 ; =0x0000047C - add r2, r6, #0x0 - add r1, r1, r0 - mov r0, #0xc - mul r0, r5 - add r0, r1, r0 - add r1, r4, #0x0 - bl FUN_0202D3A4 -_02030468: - ldr r0, _020304B8 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _020304C8 ; =0x0000065F - add r1, r1, r0 - ldrb r0, [r1, r5] - add r0, r0, #0x1 - strb r0, [r1, r5] - pop {r4-r6, pc} -_02030478: - add r0, r4, #0x0 - add r1, r5, #0x0 - bl FUN_020307E4 - ldrb r1, [r4, #0x0] - mov r0, #0x2 - tst r0, r1 - bne _020304B4 - mov r0, #0xc - add r6, r5, #0x0 - mul r6, r0 - ldr r0, _020304B8 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _020304CC ; =0x000004E8 - add r0, r1, r0 - add r0, r0, r6 - bl FUN_0202D498 - cmp r0, #0xb - blt _020304B4 - ldr r0, _020304B8 ; =UNK_021C59F4 - ldr r3, _020304D0 ; =0x0000066E - ldr r1, [r0, #0x4] - ldr r0, _020304CC ; =0x000004E8 - mov r2, #0xb - add r0, r1, r0 - add r0, r0, r6 - add r1, r4, #0x1 - bl FUN_0202D3A4 -_020304B4: - pop {r4-r6, pc} - nop -_020304B8: .word UNK_021C59F4 -_020304BC: .word 0x00000638 -_020304C0: .word 0x0000065E -_020304C4: .word 0x0000047C -_020304C8: .word 0x0000065F -_020304CC: .word 0x000004E8 -_020304D0: .word 0x0000066E - - thumb_func_start FUN_020304D4 -FUN_020304D4: ; 0x020304D4 - push {r3, lr} - cmp r0, #0x0 - beq _020304E4 - ldr r0, _020304EC ; =UNK_02105D58 - ldrb r1, [r0, #0x0] - add r1, r1, #0x1 - strb r1, [r0, #0x0] - pop {r3, pc} -_020304E4: - bl ErrorHandling - pop {r3, pc} - nop -_020304EC: .word UNK_02105D58 - - thumb_func_start FUN_020304F0 -FUN_020304F0: ; 0x020304F0 - push {r3, lr} - cmp r0, #0x0 - beq _02030500 - ldr r0, _02030508 ; =UNK_02105D58 - ldrb r1, [r0, #0x1] - add r1, r1, #0x1 - strb r1, [r0, #0x1] - pop {r3, pc} -_02030500: - bl ErrorHandling - pop {r3, pc} - nop -_02030508: .word UNK_02105D58 - - thumb_func_start FUN_0203050C -FUN_0203050C: ; 0x0203050C - push {r4, lr} - ldr r0, _02030660 ; =UNK_021C59F4 - ldr r0, [r0, #0x4] - cmp r0, #0x0 - beq _0203051E - bl FUN_02033534 - cmp r0, #0x13 - blt _02030520 -_0203051E: - b _0203065E -_02030520: - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_02031228 - add r4, r0, #0x0 - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D858 - bl FUN_02031280 - cmp r0, #0x0 - beq _02030594 - ldr r0, _02030664 ; =UNK_02105D58 - ldrb r1, [r0, #0x0] - cmp r1, #0x2 - beq _02030550 - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - bne _02030594 -_02030550: - ldr r0, _02030664 ; =UNK_02105D58 - ldrb r1, [r0, #0x0] - add r1, r1, #0x1 - strb r1, [r0, #0x0] - mov r0, #0x1 - bl FUN_020304D4 - ldr r0, _02030660 ; =UNK_021C59F4 - ldr r1, _02030668 ; =0x0000067F - ldr r3, [r0, #0x4] - mov r0, #0x0 - ldrb r2, [r3, r1] - mov r1, #0x26 - mul r1, r2 - lsl r2, r4, #0x10 - add r1, r3, r1 - lsr r2, r2, #0x10 - bl FUN_020303F4 - ldr r2, _02030660 ; =UNK_021C59F4 - ldr r1, _02030668 ; =0x0000067F - ldr r4, [r2, #0x4] - mov r0, #0x1 - ldrb r3, [r4, r1] - sub r0, r0, r3 - strb r0, [r4, r1] - add r0, r1, #0x0 - ldr r2, [r2, #0x4] - sub r0, #0x4b - ldr r0, [r2, r0] - sub r1, #0x4b - add r0, r0, #0x1 - str r0, [r2, r1] - pop {r4, pc} -_02030594: - bl FUN_0202CBD4 - cmp r0, #0x4 - bne _0203065E - bl FUN_02031190 - bl FUN_02030E7C - cmp r0, #0x0 - bne _020305AE - bl FUN_02031190 - pop {r4, pc} -_020305AE: - ldr r0, _02030664 ; =UNK_02105D58 - ldrb r1, [r0, #0x0] - cmp r1, #0x2 - beq _020305BC - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - bne _0203065E -_020305BC: - bl FUN_02031190 - cmp r0, #0x0 - beq _02030612 - ldr r0, _02030664 ; =UNK_02105D58 - ldr r3, _0203066C ; =FUN_020304D4 - ldrb r1, [r0, #0x0] - add r1, r1, #0x1 - strb r1, [r0, #0x0] - ldr r0, _02030660 ; =UNK_021C59F4 - ldr r2, [r0, #0x4] - ldr r0, _02030668 ; =0x0000067F - ldrb r1, [r2, r0] - mov r0, #0x26 - mul r0, r1 - lsl r1, r4, #0x10 - add r0, r2, r0 - lsr r1, r1, #0x10 - mov r2, #0xe - bl FUN_0202D0D0 - cmp r0, #0x0 - bne _020305F4 - ldr r0, _02030664 ; =UNK_02105D58 - ldrb r1, [r0, #0x0] - sub r1, r1, #0x1 - strb r1, [r0, #0x0] - pop {r4, pc} -_020305F4: - ldr r2, _02030660 ; =UNK_021C59F4 - ldr r1, _02030668 ; =0x0000067F - ldr r4, [r2, #0x4] - mov r0, #0x1 - ldrb r3, [r4, r1] - sub r0, r0, r3 - strb r0, [r4, r1] - add r0, r1, #0x0 - ldr r2, [r2, #0x4] - sub r0, #0x4b - ldr r0, [r2, r0] - sub r1, #0x4b - add r0, r0, #0x1 - str r0, [r2, r1] - pop {r4, pc} -_02030612: - bl FUN_0202CB8C - ldr r1, _02030670 ; =0x0000FFFE - tst r0, r1 - beq _0203065E - ldr r0, _02030664 ; =UNK_02105D58 - ldrb r1, [r0, #0x0] - add r1, r1, #0x1 - strb r1, [r0, #0x0] - mov r0, #0x1 - bl FUN_020304D4 - ldr r0, _02030660 ; =UNK_021C59F4 - ldr r1, _02030668 ; =0x0000067F - ldr r3, [r0, #0x4] - mov r0, #0x0 - ldrb r2, [r3, r1] - mov r1, #0x26 - mul r1, r2 - lsl r2, r4, #0x10 - add r1, r3, r1 - lsr r2, r2, #0x10 - bl FUN_020303F4 - ldr r2, _02030660 ; =UNK_021C59F4 - ldr r1, _02030668 ; =0x0000067F - ldr r4, [r2, #0x4] - mov r0, #0x1 - ldrb r3, [r4, r1] - sub r0, r0, r3 - strb r0, [r4, r1] - add r0, r1, #0x0 - ldr r2, [r2, #0x4] - sub r0, #0x4b - ldr r0, [r2, r0] - sub r1, #0x4b - add r0, r0, #0x1 - str r0, [r2, r1] -_0203065E: - pop {r4, pc} - .balign 4 -_02030660: .word UNK_021C59F4 -_02030664: .word UNK_02105D58 -_02030668: .word 0x0000067F -_0203066C: .word FUN_020304D4 -_02030670: .word 0x0000FFFE - thumb_func_start FUN_02030674 FUN_02030674: ; 0x02030674 push {r3-r7, lr} diff --git a/arm9/global.inc b/arm9/global.inc index 1fc85f18..5700a247 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8532,3 +8532,8 @@ .extern FUN_0202FB58 .extern FUN_0202FB80 .extern FUN_0202FE2C +.extern FUN_0202FEEC +.extern FUN_02030074 +.extern FUN_020303F4 +.extern FUN_020304D4 +.extern FUN_020304F0 diff --git a/arm9/src/unk_0202F150_c.c b/arm9/src/unk_0202F150_c.c index b0a249cf..162761a8 100644 --- a/arm9/src/unk_0202F150_c.c +++ b/arm9/src/unk_0202F150_c.c @@ -14,8 +14,8 @@ struct // u8 unk01; // }; -u8 UNK_02105D58 = 4; -u8 UNK_02105D59 = 4; +vu8 UNK_02105D58 = 4; +vu8 UNK_02105D59 = 4; extern int FUN_02033534(); extern int FUN_0202D858(u16 param0); @@ -796,6 +796,7 @@ extern int FUN_0202D400(u32 param0, u32 param1, u32 param2); +THUMB_FUNC u32 FUN_0202FE2C(int param0); #ifdef NONMATCHING THUMB_FUNC u32 FUN_0202FE2C(int param0) { @@ -923,4 +924,367 @@ _0202FEDE: #endif +extern void FUN_020304F0(u32 param0); +extern u32 FUN_0202D0D0(void *, u16 param1, u32 param2, void (*param3)(u32)); +extern void FUN_0203026C(u32 param0,u8 *param1, u32 param2); + +THUMB_FUNC void FUN_0202FEEC() { + if (UNK_021C59F4.unk04 == NULL || FUN_02033534() >= 0x13) { + return; + } + + int st0 = FUN_02031228(FUN_02033534()); + int r6 = FUN_0202D858(FUN_02033534())+1; + + if (UNK_02105D59 == 2 || UNK_02105D59 == 0){ + + UNK_02105D59++; + + if (FUN_0202FA28() == 1) { + FUN_0202FE2C(UNK_021C59F4.unk04->unk680); + } + + if (FUN_0202CBD4() == 4 && FUN_02031280() == 0) { + + if (FUN_0202D0D0(UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680], 0xc0, 0xe, FUN_020304F0) == 0) { + UNK_02105D59--; + } + } + + int i; + if (UNK_02105D59 == 1 || UNK_02105D59 == 3) { + for (i = 0; i < r6; i++) { + if (FUN_02030E7C(i) != 0) { + UNK_021C59F4.unk04->unk638[i]++; + } else if (FUN_02031280() != 0 && i == 0) { + UNK_021C59F4.unk04->unk638[i]++; + } + } + + + FUN_0203026C(0, UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680], 0xc0); + + UNK_021C59F4.unk04->unk680 = 1 - UNK_021C59F4.unk04->unk680; + } + + + + for (i = 0; i < r6; i++) { + if (FUN_02030E7C(i) == 0 && FUN_0202FA28() == 1) { + UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680][i *st0] = 0xff; + } + } + + + if (FUN_0202CBD4() != 4 || FUN_02031280() != 0) { + UNK_02105D59++; + } + } +} + + +extern u32 MOD04_021D79B4(void *param0, u32 param1); +extern void FUN_02030A00(void *param0); + + + +THUMB_FUNC void FUN_02030074() { + if (UNK_021C59F4.unk04->unk683 != 0) { + if (FUN_02033534() >= 0x13) { + if (FUN_02030E7C(0) != 0 && MOD04_021D79B4(UNK_021C59F4.unk04->unk154, 0x4c) != 0) { + UNK_021C59F4.unk04->unk683 = 0; + return; + } + } else if (FUN_0202CBD4() == 4 || FUN_02031280() != 0) { + FUN_0202FEEC(); + if (UNK_02105D59 == 2) { + UNK_021C59F4.unk04->unk683 = 0; + return; + } + } + } + + if (FUN_02033534() >= 0x13) { + if (FUN_02030E7C(0) != 0) { + if (UNK_021C59F4.unk04->unk630 != 0) { + if ((int)UNK_021C59F4.unk04->unk638[1] > 3 || (int)UNK_021C59F4.unk04->unk638[0] > 3) { + return; + } + + if (UNK_02105D59 == 4) { + if (FUN_0202FA28() == 1) { + FUN_0202FE2C(0); + } + + UNK_02105D59 = 2; + } + } else { + if (UNK_02105D59 == 4 ) { + if (FUN_0202FA28() == 1) { + if (FUN_0202FE2C(0) == 0) { + return; + } + } + } + + + UNK_02105D59 = 2; + } + + + + if (MOD04_021D79B4(UNK_021C59F4.unk04->unk154, 0x4c) == 0) { + return; + } + + UNK_02105D59 = 4; + UNK_021C59F4.unk04->unk638[0]++; + UNK_021C59F4.unk04->unk638[1]++; + } + } else if (FUN_0202CBD4() == 4 || FUN_02031280() != 0) { + if (UNK_02105D59 == 4) { + for (int r4 = 1; r4 < 8; r4++) + { + if (FUN_02030E7C(r4) != 0) { + if ((int)UNK_021C59F4.unk04->unk638[r4] > 3) { + return; + } + } else if (r4 == 0) { + if (FUN_02031280() != 0) { + if ((int)UNK_021C59F4.unk04->unk638[0] > 3) { + return; + } + } + } + } + + + if (FUN_0202FA28() == 0) { + FUN_02030A00(UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680]); + FUN_02030A00(UNK_021C59F4.unk04->unk154[1-UNK_021C59F4.unk04->unk680]); + } + + + UNK_02105D59 = 0; + FUN_0202FEEC(); + } + } +} + + + +THUMB_FUNC void FUN_02030238(u32 param0, void *param1, u32 param2) { + if (UNK_021C59F4.unk04->unk66F[0] != 0) { + UNK_021C59F4.unk04->unk634--; + UNK_021C59F4.unk04->unk66F[0] = 0; + return; + } + + FUN_0203026C(param0, param1, param2); +} + +extern void FUN_0202D3A4(void *param0, u8 *param1, u32 param2, u32 param3); + + + +THUMB_FUNC void FUN_0203026C(u32 param0, u8 *param1, u32 param2) { + UNK_021C59F4.unk04->unk634--; + if (param1 == 0) { + return; + } + + if (param1[0] == 0xb) { + if (FUN_0202FA28() == 1) { + return; + } + param1++; + } else { + if (FUN_0202FA28() == 0) { + return; + } + } + + + if (UNK_021C59F4.unk04->unk682 != 0) { + if ((param1[0] & 1) != 0) { + return; + } + } + + UNK_021C59F4.unk04->unk682 = 0; + if (FUN_0202FA28() == 1) { + int r6 = FUN_02031228(FUN_02033534()); + int st4 = FUN_0202D858(FUN_02033534())+1; + + int r4 = 0; + while (r4 < st4) { + u32 new; + if (param1[0] == 0xff) { + new = UNK_021C59F4.unk04->unk65C & ~(1<unk65C | (1<unk65C = new; + + if (param1[0] == 0xff) { + param1 += r6; + } else if (param1[0] == 0xe){ + param1 += r6; + } else if (UNK_021C59F4.unk04->unk667[r4] != 0 && (param1[0] & 1) != 0) { + param1 += r6; + } else { + param1++; + FUN_0202D3A4(&UNK_021C59F4.unk04->unk4E8[r4], param1, r6-1, 0x5E6); + + param1 += r6-1; + UNK_021C59F4.unk04->unk667[r4] = 0; + } + + + r4++; + } + + return; + } + + + UNK_021C59F4.unk04->unk65C = param1[1]; + UNK_021C59F4.unk04->unk65C = UNK_021C59F4.unk04->unk65C << 8; + + UNK_021C59F4.unk04->unk65C = UNK_021C59F4.unk04->unk65C + param1[2]; + FUN_0202D3A4(&UNK_021C59F4.unk04->unk470, param1+4, param1[3], 0x5FF); +} + +extern void FUN_020303F4(u32 param0, u8 *param1, u16 param2); + + +THUMB_FUNC void FUN_020303BC(u32 param0, u32 param1, u16 param2) { + if (UNK_021C59F4.unk04->unk66F[param0] != 0) { + + UNK_021C59F4.unk04->unk638[param0]--; + UNK_021C59F4.unk04->unk66F[param0] = 0; + return; + } + + FUN_020303F4(param0, param1, param2); +} + +extern void FUN_020307E4(u8 *param0, u32 param1); +extern int FUN_0202D498(void *param0); + + + +THUMB_FUNC void FUN_020303F4(u32 param0, u8 *param1, u16 param2) { + UNK_021C59F4.unk04->unk638[param0]--; + if (param1 == 0) { + return; + } + + if (UNK_021C59F4.unk04->unk667[param0] != 0 && (param1[0] & 1) != 0) { + return; + } + + UNK_021C59F4.unk04->unk667[param0] = 0; + if (FUN_0202FA28() == 1) { + int r6 = FUN_02031228(FUN_02033534()); + FUN_0202D858(FUN_02033534()); + + if ((param1[0] & 2) == 0) { + FUN_0202D3A4(&UNK_021C59F4.unk04->unk47C[param0], param1, r6, 0x65E); + } + + UNK_021C59F4.unk04->unk65F[param0]++; + return; + } + + + FUN_020307E4(param1, param0); + + if ((param1[0] & 2) == 0 && FUN_0202D498(&UNK_021C59F4.unk04->unk4E8[param0]) >= 0xb) { + FUN_0202D3A4(&UNK_021C59F4.unk04->unk4E8[param0], param1 +1, 0xb, 0x66E); + } +} + + +THUMB_FUNC void FUN_020304D4(u32 param0) { + if (param0 != 0) { + UNK_02105D58++; + return; + } + + ErrorHandling(); +} + +THUMB_FUNC void FUN_020304F0(u32 param0) { + if (param0 != 0) { + UNK_02105D59++; + return; + } + + ErrorHandling(); +} + +extern u16 FUN_0202CB8C(); + + +THUMB_FUNC void FUN_0203050C() { + if (UNK_021C59F4.unk04 == 0 || FUN_02033534() >= 0x13) { + return; + } + + int r4 = FUN_02031228(FUN_02033534()); + FUN_0202D858(FUN_02033534()); + + if (FUN_02031280() != 0 && (UNK_02105D58 == 2 || UNK_02105D58 == 0)) { + UNK_02105D58++; + FUN_020304D4(1); + + + FUN_020303F4(0, UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4); + + UNK_021C59F4.unk04->unk67F = 1-UNK_021C59F4.unk04->unk67F; + UNK_021C59F4.unk04->unk634++; + return; + } + + if (FUN_0202CBD4() != 4) { + return; + } + + if (FUN_02030E7C(FUN_02031190()) == 0) { + FUN_02031190(); + return; + } + + if (UNK_02105D58 != 2 && UNK_02105D58 != 0) { + return; + } + + + if (FUN_02031190() != 0) { + UNK_02105D58++; + + + if (FUN_0202D0D0(UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4, 0xe, FUN_020304D4) == 0) { + UNK_02105D58--; + return; + } + + UNK_021C59F4.unk04->unk67F = 1 - UNK_021C59F4.unk04->unk67F; + UNK_021C59F4.unk04->unk634++; + return; + } + + + if ((FUN_0202CB8C() & 0xFFFE) != 0) { + UNK_02105D58++; + FUN_020304D4(1); + + + FUN_020303F4(0, UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4); + + UNK_021C59F4.unk04->unk67F = 1-UNK_021C59F4.unk04->unk67F; + UNK_021C59F4.unk04->unk634++; + } +} \ No newline at end of file -- cgit v1.2.3 From f37e674e468b37a6f30abdbdf4f68ead98c3afb1 Mon Sep 17 00:00:00 2001 From: tgsm Date: Fri, 9 Apr 2021 13:41:02 -0400 Subject: scrcmd_25: Fix naming --- arm9/asm/unk_02038C78.s | 8 ++++---- arm9/global.inc | 8 ++++---- arm9/src/scrcmd_25.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'arm9') diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index a4b7aa12..dbdfba49 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -724,10 +724,10 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203EB48 .word FUN_0203EB88 .word FUN_02042D1C - .word ScrCmd_Unk02EF - .word ScrCmd_Unk02F0 - .word ScrCmd_Unk02F1 - .word ScrCmd_Unk02F2 + .word ScrCmd_Unk023F + .word ScrCmd_Unk0240 + .word ScrCmd_Unk0241 + .word ScrCmd_Unk0242 .word FUN_0203C5BC .word FUN_0203C614 .word FUN_0203C680 diff --git a/arm9/global.inc b/arm9/global.inc index bda86b74..084ddd40 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -3412,10 +3412,10 @@ .extern FUN_02045F84 .extern FUN_02045F88 .extern FUN_02045FCC -.extern ScrCmd_Unk02EF -.extern ScrCmd_Unk02F0 -.extern ScrCmd_Unk02F1 -.extern ScrCmd_Unk02F2 +.extern ScrCmd_Unk023F +.extern ScrCmd_Unk0240 +.extern ScrCmd_Unk0241 +.extern ScrCmd_Unk0242 .extern FUN_02046030 .extern SavArray_Flags_sizeof .extern SavArray_Flags_init diff --git a/arm9/src/scrcmd_25.c b/arm9/src/scrcmd_25.c index e3638675..5124ad9a 100644 --- a/arm9/src/scrcmd_25.c +++ b/arm9/src/scrcmd_25.c @@ -1,26 +1,26 @@ #include "scrcmd.h" -THUMB_FUNC BOOL ScrCmd_Unk02EF(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_Unk023F(struct ScriptContext * ctx) { #pragma unused(ctx) GF_ASSERT(FALSE); return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk02F0(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_Unk0240(struct ScriptContext * ctx) { #pragma unused(ctx) GF_ASSERT(FALSE); return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk02F1(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_Unk0241(struct ScriptContext * ctx) { #pragma unused(ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk02F2(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_Unk0242(struct ScriptContext * ctx) { #pragma unused(ctx) return FALSE; -- cgit v1.2.3 From 91ba9c6177680893e43d7f59a04858950aaf069a Mon Sep 17 00:00:00 2001 From: tgsm Date: Sat, 10 Apr 2021 00:24:56 -0400 Subject: Decompile scrcmd_23 --- arm9/asm/scrcmd_23.s | 483 ------------------------------------------------ arm9/asm/unk_02038C78.s | 32 ++-- arm9/global.inc | 32 ++-- arm9/src/scrcmd_23.c | 169 +++++++++++++++++ 4 files changed, 201 insertions(+), 515 deletions(-) delete mode 100644 arm9/asm/scrcmd_23.s create mode 100644 arm9/src/scrcmd_23.c (limited to 'arm9') diff --git a/arm9/asm/scrcmd_23.s b/arm9/asm/scrcmd_23.s deleted file mode 100644 index 3d38b510..00000000 --- a/arm9/asm/scrcmd_23.s +++ /dev/null @@ -1,483 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_02045958 -FUN_02045958: ; 0x02045958 - push {r4-r6, lr} - add r4, r0, #0x0 - add r1, r4, #0x0 - add r1, #0x80 - ldr r1, [r1, #0x0] - ldr r5, [r1, #0xc] - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r6, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - add r4, r0, #0x0 - add r0, r5, #0x0 - bl FUN_02026CC4 - add r1, r6, #0x0 - bl FUN_02025D6C - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start FUN_020459AC -FUN_020459AC: ; 0x020459AC - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - mov r0, #0x0 - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_020459E8 -FUN_020459E8: ; 0x020459E8 - push {r4-r6, lr} - add r4, r0, #0x0 - add r1, r4, #0x0 - add r1, #0x80 - ldr r1, [r1, #0x0] - ldr r5, [r1, #0xc] - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r6, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - add r4, r0, #0x0 - add r0, r5, #0x0 - bl FUN_02026CC4 - add r1, r6, #0x0 - bl FUN_02025D94 - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start FUN_02045A3C -FUN_02045A3C: ; 0x02045A3C - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - mov r0, #0x0 - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_02045A78 -FUN_02045A78: ; 0x02045A78 - push {r4-r6, lr} - add r4, r0, #0x0 - add r1, r4, #0x0 - add r1, #0x80 - ldr r1, [r1, #0x0] - ldr r5, [r1, #0xc] - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r6, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - add r4, r0, #0x0 - add r0, r5, #0x0 - bl FUN_02026CC4 - add r1, r6, #0x0 - bl FUN_02026298 - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start FUN_02045ACC -FUN_02045ACC: ; 0x02045ACC - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - mov r0, #0x0 - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_02045B08 -FUN_02045B08: ; 0x02045B08 - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - mov r0, #0x0 - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_02045B44 -FUN_02045B44: ; 0x02045B44 - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - mov r0, #0x0 - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_02045B80 -FUN_02045B80: ; 0x02045B80 - push {r3-r5, lr} - add r5, r0, #0x0 - add r1, r5, #0x0 - add r1, #0x80 - ldr r1, [r1, #0x0] - ldr r4, [r1, #0xc] - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r5, #0x0 - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r0, r4, #0x0 - bl FUN_02026CC4 - mov r0, #0x0 - pop {r3-r5, pc} - - thumb_func_start FUN_02045BC8 -FUN_02045BC8: ; 0x02045BC8 - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - mov r0, #0x0 - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_02045C04 -FUN_02045C04: ; 0x02045C04 - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - mov r0, #0x0 - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_02045C40 -FUN_02045C40: ; 0x02045C40 - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - mov r0, #0x0 - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_02045C7C -FUN_02045C7C: ; 0x02045C7C - push {r3-r7, lr} - add r4, r0, #0x0 - add r1, r4, #0x0 - add r1, #0x80 - ldr r1, [r1, #0x0] - ldr r5, [r1, #0xc] - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r6, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r7, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - add r4, r0, #0x0 - add r0, r5, #0x0 - bl FUN_02026CC4 - add r1, r6, #0x0 - add r2, r7, #0x0 - bl FUN_020260C4 - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r7, pc} - - thumb_func_start FUN_02045CD4 -FUN_02045CD4: ; 0x02045CD4 - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - mov r0, #0x0 - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_02045D10 -FUN_02045D10: ; 0x02045D10 - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - mov r0, #0x0 - pop {r4, pc} - .balign 4 - - thumb_func_start FUN_02045D4C -FUN_02045D4C: ; 0x02045D4C - push {r4, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - mov r0, #0x0 - pop {r4, pc} - .balign 4 diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index dbdfba49..08416fc7 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -280,22 +280,22 @@ gScriptCmdTable: ; 0x020F355C .word ScrCmd_GetItemPocketId .word ScrCmd_Unk0081 .word ScrCmd_Unk0082 - .word FUN_02045958 - .word FUN_020459AC - .word FUN_020459E8 - .word FUN_02045A3C - .word FUN_02045A78 - .word FUN_02045ACC - .word FUN_02045B08 - .word FUN_02045B44 - .word FUN_02045B80 - .word FUN_02045BC8 - .word FUN_02045C04 - .word FUN_02045C40 - .word FUN_02045C7C - .word FUN_02045CD4 - .word FUN_02045D10 - .word FUN_02045D4C + .word ScrCmd_Unk0083 + .word ScrCmd_Unk0084 + .word ScrCmd_Unk0085 + .word ScrCmd_Unk0086 + .word ScrCmd_Unk0087 + .word ScrCmd_Unk0088 + .word ScrCmd_Unk0089 + .word ScrCmd_Unk008A + .word ScrCmd_Unk008B + .word ScrCmd_Unk008C + .word ScrCmd_Unk008D + .word ScrCmd_Unk008E + .word ScrCmd_Unk008F + .word ScrCmd_Unk0090 + .word ScrCmd_Unk0091 + .word ScrCmd_Unk0092 .word FUN_0203B81C .word FUN_0203B85C .word FUN_0203B8A0 diff --git a/arm9/global.inc b/arm9/global.inc index 084ddd40..9df9973e 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -3386,22 +3386,22 @@ .extern ScrCmd_GetItemPocketId .extern ScrCmd_Unk0081 .extern ScrCmd_Unk0082 -.extern FUN_02045958 -.extern FUN_020459AC -.extern FUN_020459E8 -.extern FUN_02045A3C -.extern FUN_02045A78 -.extern FUN_02045ACC -.extern FUN_02045B08 -.extern FUN_02045B44 -.extern FUN_02045B80 -.extern FUN_02045BC8 -.extern FUN_02045C04 -.extern FUN_02045C40 -.extern FUN_02045C7C -.extern FUN_02045CD4 -.extern FUN_02045D10 -.extern FUN_02045D4C +.extern ScrCmd_Unk0083 +.extern ScrCmd_Unk0084 +.extern ScrCmd_Unk0085 +.extern ScrCmd_Unk0086 +.extern ScrCmd_Unk0087 +.extern ScrCmd_Unk0088 +.extern ScrCmd_Unk0089 +.extern ScrCmd_Unk008A +.extern ScrCmd_Unk008B +.extern ScrCmd_Unk008C +.extern ScrCmd_Unk008D +.extern ScrCmd_Unk008E +.extern ScrCmd_Unk008F +.extern ScrCmd_Unk0090 +.extern ScrCmd_Unk0091 +.extern ScrCmd_Unk0092 .extern FUN_02045D88 .extern FUN_02045DD0 .extern FUN_02045E1C diff --git a/arm9/src/scrcmd_23.c b/arm9/src/scrcmd_23.c new file mode 100644 index 00000000..0c9907a5 --- /dev/null +++ b/arm9/src/scrcmd_23.c @@ -0,0 +1,169 @@ +#include "scrcmd.h" + +extern BOOL FUN_02025D6C(void*, u16); +extern BOOL FUN_02025D94(void*, u16); +extern BOOL FUN_02026298(void*, u16); +extern void* FUN_02026CC4(struct SaveBlock2* sav2); +extern BOOL FUN_020260C4(void*, u16, u16); + +THUMB_FUNC BOOL ScrCmd_Unk0083(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + u16 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + void* unk2 = FUN_02026CC4(sav2); + + *ret_ptr = (u16)FUN_02025D6C(unk2, unk1); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0084(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0085(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + u16 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + void* unk2 = FUN_02026CC4(sav2); + + *ret_ptr = (u16)FUN_02025D94(unk2, unk1); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0086(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0087(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + u16 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + void* unk2 = FUN_02026CC4(sav2); + + *ret_ptr = (u16)FUN_02026298(unk2, unk1); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0088(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0089(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk008A(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk008B(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + void* unused3 = FUN_02026CC4(sav2); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk008C(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk008D(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk008E(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk008F(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + u16 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unk2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + void* unk3 = FUN_02026CC4(sav2); + + *ret_ptr = (u16)FUN_020260C4(unk3, unk1, unk2); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0090(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0091(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0092(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} -- cgit v1.2.3 From 405d77ac981ce6ece1c529ab153543d118014661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 10 Apr 2021 17:26:38 +0200 Subject: decomp finished --- arm9/arm9.lsf | 1 - arm9/asm/unk_0202F150.s | 1898 ------------------------------------ arm9/global.inc | 25 +- arm9/src/unk_0202F150.c | 2382 +++++++++++++++++++++++++++++++++++++++++++++ arm9/src/unk_0202F150_c.c | 1290 ------------------------ 5 files changed, 2383 insertions(+), 3213 deletions(-) delete mode 100644 arm9/asm/unk_0202F150.s create mode 100644 arm9/src/unk_0202F150.c delete mode 100644 arm9/src/unk_0202F150_c.c (limited to 'arm9') diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index 7aad650f..05a905ee 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -127,7 +127,6 @@ Static arm9 Object unk_0202D8D0.o Object unk_0202DB14.o Object unk_0202E29C.o - Object unk_0202F150_c.o Object unk_0202F150.o Object unk_02031480.o Object unk_02031734.o diff --git a/arm9/asm/unk_0202F150.s b/arm9/asm/unk_0202F150.s deleted file mode 100644 index 802807f5..00000000 --- a/arm9/asm/unk_0202F150.s +++ /dev/null @@ -1,1898 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .extern gMain - - .section .bss - - - .section .data - - - - .text - - thumb_func_start FUN_02030674 -FUN_02030674: ; 0x02030674 - push {r3-r7, lr} - ldr r7, _02030798 ; =UNK_021C59F4 - mov r6, #0x0 - ldr r5, [r7, #0x4] - ldr r2, _0203079C ; =0x0000062C - add r4, r6, #0x0 - ldrb r0, [r5, r2] - cmp r0, #0x0 - beq _02030690 - sub r1, r2, #0x4 - ldrh r1, [r5, r1] - mov r3, #0xf0 - tst r3, r1 - bne _02030692 -_02030690: - b _02030794 -_02030692: - cmp r0, #0x2 - bne _020306D0 - mov r0, #0x20 - tst r0, r1 - beq _020306A4 - mov r0, #0x10 - orr r0, r6 - lsl r0, r0, #0x10 - lsr r4, r0, #0x10 -_020306A4: - mov r0, #0x10 - tst r0, r1 - beq _020306B2 - mov r0, #0x20 - orr r0, r4 - lsl r0, r0, #0x10 - lsr r4, r0, #0x10 -_020306B2: - mov r0, #0x40 - tst r0, r1 - beq _020306C0 - mov r0, #0x80 - orr r0, r4 - lsl r0, r0, #0x10 - lsr r4, r0, #0x10 -_020306C0: - mov r0, #0x80 - tst r0, r1 - beq _0203077E - mov r0, #0x40 - orr r0, r4 - lsl r0, r0, #0x10 - lsr r4, r0, #0x10 - b _0203077E -_020306D0: - add r0, r2, #0x2 - ldrh r0, [r5, r0] - cmp r0, #0x0 - beq _020306F2 - add r4, r0, #0x0 - add r0, r2, #0x1 - ldrsb r0, [r5, r0] - sub r1, r0, #0x1 - add r0, r2, #0x1 - strb r1, [r5, r0] - ldr r1, [r7, #0x4] - ldrsb r0, [r1, r0] - cmp r0, #0x0 - bge _0203077E - add r0, r2, #0x2 - strh r6, [r1, r0] - b _0203077E -_020306F2: - add r0, r2, #0x0 - sub r0, #0x34 - add r6, r5, r0 - sub r2, #0x34 - ldr r0, [r6, #0x8] - ldr r1, [r6, #0xc] - ldr r2, [r5, r2] - ldr r3, [r6, #0x4] - bl _ll_mul - add r3, r0, #0x0 - add r2, r1, #0x0 - ldr r0, [r6, #0x10] - ldr r1, [r6, #0x14] - add r0, r0, r3 - adc r1, r2 - ldr r2, _020307A0 ; =0x000005F8 - str r0, [r5, r2] - mov r2, #0x0 - str r1, [r6, #0x4] - lsr r0, r1, #0x1e - lsl r1, r2, #0x2 - orr r1, r0 - cmp r1, #0x3 - bhi _02030746 - add r0, r1, r1 - add r0, pc - ldrh r0, [r0, #0x6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_02030730: ; jump table (using 16-bit offset) - .short _02030738 - _02030730 - 2; case 0 - .short _0203073C - _02030730 - 2; case 1 - .short _02030740 - _02030730 - 2; case 2 - .short _02030744 - _02030730 - 2; case 3 -_02030738: - mov r4, #0x20 - b _02030746 -_0203073C: - mov r4, #0x10 - b _02030746 -_02030740: - mov r4, #0x40 - b _02030746 -_02030744: - mov r4, #0x80 -_02030746: - ldr r0, _02030798 ; =UNK_021C59F4 - ldr r5, [r0, #0x4] - ldr r0, _020307A0 ; =0x000005F8 - add r6, r5, r0 - ldr r0, [r6, #0x8] - ldr r1, [r6, #0xc] - ldr r2, [r6, #0x0] - ldr r3, [r6, #0x4] - bl _ll_mul - ldr r3, [r6, #0x10] - ldr r2, [r6, #0x14] - add r0, r3, r0 - adc r2, r1 - ldr r1, _020307A0 ; =0x000005F8 - mov r3, #0x0 - str r0, [r5, r1] - str r2, [r6, #0x4] - lsr r0, r2, #0x1c - lsl r2, r3, #0x4 - orr r2, r0 - add r0, r1, #0x0 - add r0, #0x35 - strb r2, [r5, r0] - ldr r0, _02030798 ; =UNK_021C59F4 - add r1, #0x36 - ldr r0, [r0, #0x4] - strh r4, [r0, r1] -_0203077E: - ldr r2, _02030798 ; =UNK_021C59F4 - ldr r1, _020307A4 ; =0x00000628 - ldr r5, [r2, #0x4] - mov r0, #0xf0 - ldrh r3, [r5, r1] - bic r3, r0 - strh r3, [r5, r1] - ldr r2, [r2, #0x4] - ldrh r0, [r2, r1] - add r0, r0, r4 - strh r0, [r2, r1] -_02030794: - pop {r3-r7, pc} - nop -_02030798: .word UNK_021C59F4 -_0203079C: .word 0x0000062C -_020307A0: .word 0x000005F8 -_020307A4: .word 0x00000628 - - thumb_func_start FUN_020307A8 -FUN_020307A8: ; 0x020307A8 - ldr r0, _020307B4 ; =UNK_021C59F4 - mov r2, #0x1 - ldr r1, [r0, #0x4] - ldr r0, _020307B8 ; =0x0000062C - strb r2, [r1, r0] - bx lr - .balign 4 -_020307B4: .word UNK_021C59F4 -_020307B8: .word 0x0000062C - - thumb_func_start FUN_020307BC -FUN_020307BC: ; 0x020307BC - ldr r0, _020307C8 ; =UNK_021C59F4 - mov r2, #0x2 - ldr r1, [r0, #0x4] - ldr r0, _020307CC ; =0x0000062C - strb r2, [r1, r0] - bx lr - .balign 4 -_020307C8: .word UNK_021C59F4 -_020307CC: .word 0x0000062C - - thumb_func_start FUN_020307D0 -FUN_020307D0: ; 0x020307D0 - ldr r0, _020307DC ; =UNK_021C59F4 - mov r2, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _020307E0 ; =0x0000062C - strb r2, [r1, r0] - bx lr - .balign 4 -_020307DC: .word UNK_021C59F4 -_020307E0: .word 0x0000062C - - thumb_func_start FUN_020307E4 -FUN_020307E4: ; 0x020307E4 - push {r4-r7} - ldr r4, _02030868 ; =UNK_021C59F4 - lsl r6, r1, #0x1 - ldr r2, [r4, #0x4] - mov r5, #0x0 - add r3, r2, r6 - mov r2, #0x61 - lsl r2, r2, #0x4 - strh r5, [r3, r2] - ldrb r5, [r0, #0x0] - mov r3, #0x10 - add r7, r5, #0x0 - and r7, r3 - cmp r7, #0x10 - bne _02030860 - mov r7, #0xc - and r5, r7 - lsl r5, r5, #0x18 - lsr r5, r5, #0x18 - bne _0203081A - ldr r3, [r4, #0x4] - add r4, r3, r2 - ldrh r3, [r4, r6] - mov r2, #0x40 - orr r2, r3 - strh r2, [r4, r6] - b _0203084C -_0203081A: - cmp r5, #0x4 - bne _0203082C - ldr r3, [r4, #0x4] - add r4, r3, r2 - ldrh r3, [r4, r6] - mov r2, #0x80 - orr r2, r3 - strh r2, [r4, r6] - b _0203084C -_0203082C: - cmp r5, #0x8 - bne _0203083E - ldr r3, [r4, #0x4] - add r4, r3, r2 - ldrh r3, [r4, r6] - mov r2, #0x20 - orr r2, r3 - strh r2, [r4, r6] - b _0203084C -_0203083E: - cmp r5, #0xc - bne _0203084C - ldr r4, [r4, #0x4] - add r4, r4, r2 - ldrh r2, [r4, r6] - orr r2, r3 - strh r2, [r4, r6] -_0203084C: - ldrb r0, [r0, #0x0] - asr r2, r0, #0x5 - mov r0, #0x7 - and r2, r0 - ldr r0, _02030868 ; =UNK_021C59F4 - ldr r0, [r0, #0x4] - add r1, r0, r1 - mov r0, #0x62 - lsl r0, r0, #0x4 - strb r2, [r1, r0] -_02030860: - mov r0, #0x1 - pop {r4-r7} - bx lr - nop -_02030868: .word UNK_021C59F4 - - thumb_func_start FUN_0203086C -FUN_0203086C: ; 0x0203086C - bx lr - .balign 4 - - thumb_func_start FUN_02030870 -FUN_02030870: ; 0x02030870 - push {r4, lr} - add r4, r0, #0x0 - ldr r0, _0203091C ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _02030920 ; =0x0000062A - ldrb r0, [r1, r0] - cmp r0, #0x0 - beq _02030884 - mov r0, #0x0 - pop {r4, pc} -_02030884: - bl FUN_02030FE0 - cmp r0, #0x0 - bne _02030890 - mov r0, #0x0 - pop {r4, pc} -_02030890: - ldr r0, _0203091C ; =UNK_021C59F4 - ldr r2, [r0, #0x4] - ldr r0, _02030924 ; =0x00000681 - ldrb r1, [r2, r0] - cmp r1, #0x0 - beq _020308A0 - sub r1, r1, #0x1 - strb r1, [r2, r0] -_020308A0: - ldr r1, _0203091C ; =UNK_021C59F4 - ldr r0, _02030928 ; =0x00000628 - ldr r2, [r1, #0x4] - mov r3, #0x40 - ldrh r2, [r2, r0] - tst r3, r2 - beq _020308C0 - ldrb r3, [r4, #0x0] - mov r2, #0x10 - add r0, #0x59 - orr r2, r3 - strb r2, [r4, #0x0] - ldr r1, [r1, #0x4] - mov r2, #0x8 - strb r2, [r1, r0] - b _02030906 -_020308C0: - mov r3, #0x80 - tst r3, r2 - beq _020308D8 - ldrb r3, [r4, #0x0] - mov r2, #0x14 - add r0, #0x59 - orr r2, r3 - strb r2, [r4, #0x0] - ldr r1, [r1, #0x4] - mov r2, #0x8 - strb r2, [r1, r0] - b _02030906 -_020308D8: - mov r3, #0x20 - tst r3, r2 - beq _020308F0 - ldrb r3, [r4, #0x0] - mov r2, #0x18 - add r0, #0x59 - orr r2, r3 - strb r2, [r4, #0x0] - ldr r1, [r1, #0x4] - mov r2, #0x8 - strb r2, [r1, r0] - b _02030906 -_020308F0: - mov r3, #0x10 - tst r2, r3 - beq _02030906 - ldrb r3, [r4, #0x0] - mov r2, #0x1c - add r0, #0x59 - orr r2, r3 - strb r2, [r4, #0x0] - ldr r1, [r1, #0x4] - mov r2, #0x8 - strb r2, [r1, r0] -_02030906: - ldr r0, _0203091C ; =UNK_021C59F4 - ldrb r2, [r4, #0x0] - ldr r1, [r0, #0x4] - ldr r0, _0203092C ; =0x0000062B - ldrb r0, [r1, r0] - lsl r0, r0, #0x5 - orr r0, r2 - strb r0, [r4, #0x0] - mov r0, #0x0 - pop {r4, pc} - nop -_0203091C: .word UNK_021C59F4 -_02030920: .word 0x0000062A -_02030924: .word 0x00000681 -_02030928: .word 0x00000628 -_0203092C: .word 0x0000062B - - thumb_func_start FUN_02030930 -FUN_02030930: ; 0x02030930 - push {r3-r5, lr} - sub sp, #0x8 - add r4, r0, #0x0 - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_02031228 - add r5, r0, #0x0 - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D858 - ldr r0, _020309F0 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _020309F4 ; =0x00000684 - ldrb r0, [r1, r0] - cmp r0, #0x0 - bne _02030960 - mov r0, #0x0 - b _02030962 -_02030960: - mov r0, #0x1 -_02030962: - strb r0, [r4, #0x0] - bl FUN_0202FA28 - cmp r0, #0x0 - bne _02030972 - add r0, r4, #0x0 - bl FUN_02030870 -_02030972: - ldr r1, _020309F0 ; =UNK_021C59F4 - ldr r0, _020309F4 ; =0x00000684 - ldr r2, [r1, #0x4] - mov r3, #0x0 - strb r3, [r2, r0] - ldr r1, [r1, #0x4] - ldr r0, _020309F8 ; =0x0000054C - add r0, r1, r0 - bl FUN_0202D4E4 - cmp r0, #0x0 - beq _0203099E - ldrb r1, [r4, #0x0] - mov r0, #0x2 - orr r0, r1 - strb r0, [r4, #0x0] - ldrb r0, [r4, #0x0] - cmp r0, #0x2 - bne _020309E8 - add sp, #0x8 - mov r0, #0x0 - pop {r3-r5, pc} -_0203099E: - sub r0, r5, #0x1 - str r0, [sp, #0x4] - add r0, r4, #0x1 - str r0, [sp, #0x0] - ldr r0, _020309F0 ; =UNK_021C59F4 - mov r2, #0x1 - ldr r1, [r0, #0x4] - ldr r0, _020309F8 ; =0x0000054C - add r0, r1, r0 - add r1, sp, #0x0 - bl FUN_0202D760 - cmp r0, #0x0 - bne _020309C4 - ldr r0, _020309F0 ; =UNK_021C59F4 - mov r2, #0x1 - ldr r1, [r0, #0x4] - ldr r0, _020309F4 ; =0x00000684 - strb r2, [r1, r0] -_020309C4: - bl FUN_0202FA28 - cmp r0, #0x1 - bne _020309E8 - ldr r2, _020309F0 ; =UNK_021C59F4 - ldr r1, _020309FC ; =0x0000065E - ldr r3, [r2, #0x4] - ldrb r0, [r3, r1] - add r0, r0, #0x1 - strb r0, [r3, r1] - ldr r2, [r2, #0x4] - ldrb r0, [r4, #0x0] - ldrb r1, [r2, r1] - lsl r2, r1, #0x4 - mov r1, #0xf0 - and r1, r2 - orr r0, r1 - strb r0, [r4, #0x0] -_020309E8: - mov r0, #0x1 - add sp, #0x8 - pop {r3-r5, pc} - nop -_020309F0: .word UNK_021C59F4 -_020309F4: .word 0x00000684 -_020309F8: .word 0x0000054C -_020309FC: .word 0x0000065E - - thumb_func_start FUN_02030A00 -FUN_02030A00: ; 0x02030A00 - push {r4, lr} - sub sp, #0x8 - add r4, r0, #0x0 - mov r0, #0xb - strb r0, [r4, #0x0] - ldr r0, _02030A6C ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _02030A70 ; =0x00000685 - ldrb r0, [r1, r0] - cmp r0, #0x0 - bne _02030A1A - mov r0, #0x0 - b _02030A1C -_02030A1A: - mov r0, #0x1 -_02030A1C: - strb r0, [r4, #0x1] - bl FUN_0202CB8C - asr r1, r0, #0x8 - strb r1, [r4, #0x2] - strb r0, [r4, #0x3] - mov r0, #0xbb - str r0, [sp, #0x4] - add r0, r4, #0x5 - str r0, [sp, #0x0] - ldr r0, _02030A6C ; =UNK_021C59F4 - mov r2, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _02030A74 ; =0x0000056C - add r0, r1, r0 - add r1, sp, #0x0 - bl FUN_0202D760 - cmp r0, #0x0 - beq _02030A5A - ldr r0, _02030A6C ; =UNK_021C59F4 - mov r2, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _02030A70 ; =0x00000685 - strb r2, [r1, r0] - ldr r1, [sp, #0x4] - mov r0, #0xbb - sub r0, r0, r1 - add sp, #0x8 - strb r0, [r4, #0x4] - pop {r4, pc} -_02030A5A: - ldr r0, _02030A6C ; =UNK_021C59F4 - mov r2, #0x1 - ldr r1, [r0, #0x4] - ldr r0, _02030A70 ; =0x00000685 - strb r2, [r1, r0] - mov r0, #0xbb - strb r0, [r4, #0x4] - add sp, #0x8 - pop {r4, pc} - .balign 4 -_02030A6C: .word UNK_021C59F4 -_02030A70: .word 0x00000685 -_02030A74: .word 0x0000056C - - thumb_func_start FUN_02030A78 -FUN_02030A78: ; 0x02030A78 - push {r4-r6, lr} - sub sp, #0x8 - add r5, r0, #0x0 - add r4, r1, #0x0 - add r6, r2, #0x0 - bl FUN_02031190 - bl FUN_02030E7C - cmp r0, #0x0 - bne _02030A9C - bl FUN_02031280 - cmp r0, #0x0 - bne _02030A9C - add sp, #0x8 - mov r0, #0x0 - pop {r4-r6, pc} -_02030A9C: - mov r0, #0x1 - str r0, [sp, #0x0] - mov r0, #0x0 - str r0, [sp, #0x4] - ldr r0, _02030AD4 ; =UNK_021C59F4 - add r2, r4, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _02030AD8 ; =0x0000054C - add r3, r6, #0x0 - add r0, r1, r0 - add r1, r5, #0x0 - bl FUN_0202D684 - cmp r0, #0x0 - beq _02030AC0 - add sp, #0x8 - mov r0, #0x1 - pop {r4-r6, pc} -_02030AC0: - bl FUN_02033534 - cmp r0, #0xa - bne _02030ACC - bl FUN_02031454 -_02030ACC: - mov r0, #0x0 - add sp, #0x8 - pop {r4-r6, pc} - nop -_02030AD4: .word UNK_021C59F4 -_02030AD8: .word 0x0000054C - - thumb_func_start FUN_02030ADC -FUN_02030ADC: ; 0x02030ADC - push {r4-r6, lr} - sub sp, #0x8 - add r5, r0, #0x0 - add r4, r1, #0x0 - add r6, r2, #0x0 - bl FUN_02031190 - bl FUN_02030E7C - cmp r0, #0x0 - bne _02030B00 - bl FUN_02031280 - cmp r0, #0x0 - bne _02030B00 - add sp, #0x8 - mov r0, #0x0 - pop {r4-r6, pc} -_02030B00: - mov r0, #0x1 - str r0, [sp, #0x0] - str r0, [sp, #0x4] - ldr r0, _02030B34 ; =UNK_021C59F4 - add r2, r4, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _02030B38 ; =0x0000054C - add r3, r6, #0x0 - add r0, r1, r0 - add r1, r5, #0x0 - bl FUN_0202D684 - cmp r0, #0x0 - beq _02030B22 - add sp, #0x8 - mov r0, #0x1 - pop {r4-r6, pc} -_02030B22: - bl FUN_02033534 - cmp r0, #0xa - bne _02030B2E - bl FUN_02031454 -_02030B2E: - mov r0, #0x0 - add sp, #0x8 - pop {r4-r6, pc} - .balign 4 -_02030B34: .word UNK_021C59F4 -_02030B38: .word 0x0000054C - - thumb_func_start FUN_02030B3C -FUN_02030B3C: ; 0x02030B3C - push {r4-r6, lr} - sub sp, #0x8 - add r5, r0, #0x0 - add r4, r1, #0x0 - add r6, r2, #0x0 - bl FUN_02031190 - cmp r0, #0x0 - beq _02030B58 - bl ErrorHandling - add sp, #0x8 - mov r0, #0x0 - pop {r4-r6, pc} -_02030B58: - mov r0, #0x0 - bl FUN_02030E7C - cmp r0, #0x0 - bne _02030B70 - bl FUN_02031280 - cmp r0, #0x0 - bne _02030B70 - add sp, #0x8 - mov r0, #0x0 - pop {r4-r6, pc} -_02030B70: - bl FUN_0202FA28 - cmp r0, #0x1 - bne _02030B86 - add r0, r5, #0x0 - add r1, r4, #0x0 - add r2, r6, #0x0 - bl FUN_02030A78 - add sp, #0x8 - pop {r4-r6, pc} -_02030B86: - mov r0, #0x1 - str r0, [sp, #0x0] - mov r0, #0x0 - str r0, [sp, #0x4] - ldr r0, _02030BBC ; =UNK_021C59F4 - add r2, r4, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _02030BC0 ; =0x0000056C - add r3, r6, #0x0 - add r0, r1, r0 - add r1, r5, #0x0 - bl FUN_0202D684 - cmp r0, #0x0 - beq _02030BAA - add sp, #0x8 - mov r0, #0x1 - pop {r4-r6, pc} -_02030BAA: - bl FUN_02033534 - cmp r0, #0xa - bne _02030BB6 - bl FUN_02031454 -_02030BB6: - mov r0, #0x0 - add sp, #0x8 - pop {r4-r6, pc} - .balign 4 -_02030BBC: .word UNK_021C59F4 -_02030BC0: .word 0x0000056C - - thumb_func_start FUN_02030BC4 -FUN_02030BC4: ; 0x02030BC4 - push {r4-r6, lr} - sub sp, #0x8 - add r5, r0, #0x0 - add r4, r1, #0x0 - add r6, r2, #0x0 - bl FUN_02031190 - cmp r0, #0x0 - beq _02030BE0 - bl FUN_02031454 - add sp, #0x8 - mov r0, #0x0 - pop {r4-r6, pc} -_02030BE0: - mov r0, #0x0 - bl FUN_02030E7C - cmp r0, #0x0 - bne _02030BF8 - bl FUN_02031280 - cmp r0, #0x0 - bne _02030BF8 - add sp, #0x8 - mov r0, #0x0 - pop {r4-r6, pc} -_02030BF8: - bl FUN_0202FA28 - cmp r0, #0x1 - bne _02030C0E - add r0, r5, #0x0 - add r1, r4, #0x0 - add r2, r6, #0x0 - bl FUN_02030ADC - add sp, #0x8 - pop {r4-r6, pc} -_02030C0E: - mov r0, #0x1 - str r0, [sp, #0x0] - str r0, [sp, #0x4] - ldr r0, _02030C44 ; =UNK_021C59F4 - add r2, r4, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _02030C48 ; =0x0000056C - add r3, r6, #0x0 - add r0, r1, r0 - add r1, r5, #0x0 - bl FUN_0202D684 - cmp r0, #0x0 - beq _02030C30 - add sp, #0x8 - mov r0, #0x1 - pop {r4-r6, pc} -_02030C30: - bl FUN_02033534 - cmp r0, #0xa - bne _02030C3C - bl FUN_02031454 -_02030C3C: - mov r0, #0x0 - add sp, #0x8 - pop {r4-r6, pc} - nop -_02030C44: .word UNK_021C59F4 -_02030C48: .word 0x0000056C - - thumb_func_start FUN_02030C4C -FUN_02030C4C: ; 0x02030C4C - ldr r3, _02030C54 ; =FUN_02030BC4 - mov r2, #0x0 - bx r3 - nop -_02030C54: .word FUN_02030BC4 - - thumb_func_start FUN_02030C58 -FUN_02030C58: ; 0x02030C58 - ldr r0, _02030C64 ; =UNK_021C59F4 - ldr r3, _02030C68 ; =FUN_0202D498 - ldr r1, [r0, #0x4] - ldr r0, _02030C6C ; =0x00000464 - add r0, r1, r0 - bx r3 - .balign 4 -_02030C64: .word UNK_021C59F4 -_02030C68: .word FUN_0202D498 -_02030C6C: .word 0x00000464 - - thumb_func_start FUN_02030C70 -FUN_02030C70: ; 0x02030C70 - push {r4, lr} - ldr r4, [sp, #0x8] - bl FUN_0202D934 - mov r0, #0xee - strb r0, [r4, #0xa] - ldr r0, _02030C88 ; =0x0000FFFF - strh r0, [r4, #0x8] - mov r0, #0x0 - str r0, [r4, #0x4] - str r0, [r4, #0x0] - pop {r4, pc} - .balign 4 -_02030C88: .word 0x0000FFFF - - thumb_func_start FUN_02030C8C -FUN_02030C8C: ; 0x02030C8C - push {r4-r7, lr} - sub sp, #0x14 - add r6, r0, #0x0 - str r1, [sp, #0x4] - str r2, [sp, #0x8] - ldr r5, [sp, #0x28] - bl FUN_0202D478 - cmp r0, #0x0 - beq _02030D94 -_02030CA0: - ldrb r7, [r5, #0xa] - cmp r7, #0xee - bne _02030CB2 - add r0, r6, #0x0 - bl FUN_0202D41C - add r7, r0, #0x0 - cmp r7, #0xee - beq _02030D8A -_02030CB2: - mov r0, #0x4 - ldrsh r0, [r6, r0] - strb r7, [r5, #0xa] - ldrh r4, [r5, #0x8] - str r0, [sp, #0x10] - ldr r0, _02030D98 ; =0x0000FFFF - cmp r4, r0 - bne _02030D06 - add r0, r7, #0x0 - bl FUN_0202D9A0 - add r4, r0, #0x0 - ldr r0, _02030D9C ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _02030DA0 ; =0x00000689 - ldrb r0, [r1, r0] - cmp r0, #0x0 - bne _02030D94 - ldr r0, _02030D98 ; =0x0000FFFF - cmp r4, r0 - bne _02030D04 - add r0, r6, #0x0 - bl FUN_0202D478 - cmp r0, #0x1 - bge _02030CEE - ldr r0, [sp, #0x10] - add sp, #0x14 - strh r0, [r6, #0x4] - pop {r4-r7, pc} -_02030CEE: - add r0, r6, #0x0 - bl FUN_0202D41C - lsl r4, r0, #0x8 - add r0, r6, #0x0 - bl FUN_0202D41C - add r4, r4, r0 - mov r0, #0x4 - ldrsh r0, [r6, r0] - str r0, [sp, #0x10] -_02030D04: - strh r4, [r5, #0x8] -_02030D06: - add r0, r7, #0x0 - bl FUN_0202DA04 - cmp r0, #0x0 - beq _02030D5E - ldr r0, [r5, #0x4] - cmp r0, #0x0 - bne _02030D22 - ldrh r2, [r5, #0x8] - ldr r1, [sp, #0x4] - add r0, r7, #0x0 - bl FUN_0202DA40 - str r0, [r5, #0x4] -_02030D22: - ldr r2, [r5, #0x0] - ldr r1, [sp, #0x8] - add r0, r6, #0x0 - sub r2, r4, r2 - bl FUN_0202D400 - ldr r2, [r5, #0x4] - str r0, [sp, #0xc] - cmp r2, #0x0 - beq _02030D42 - ldr r1, [r5, #0x0] - ldr r0, [sp, #0x8] - add r1, r2, r1 - ldr r2, [sp, #0xc] - bl MI_CpuCopy8 -_02030D42: - ldr r1, [r5, #0x0] - ldr r0, [sp, #0xc] - add r0, r1, r0 - str r0, [r5, #0x0] - cmp r0, r4 - blt _02030D8A - str r5, [sp, #0x0] - ldr r0, [sp, #0x4] - ldr r3, [r5, #0x4] - add r1, r7, #0x0 - add r2, r4, #0x0 - bl FUN_02030C70 - b _02030D8A -_02030D5E: - add r0, r6, #0x0 - bl FUN_0202D478 - cmp r0, r4 - blt _02030D82 - ldr r1, [sp, #0x8] - add r0, r6, #0x0 - add r2, r4, #0x0 - bl FUN_0202D400 - ldr r0, [sp, #0x4] - ldr r3, [sp, #0x8] - add r1, r7, #0x0 - add r2, r4, #0x0 - str r5, [sp, #0x0] - bl FUN_02030C70 - b _02030D8A -_02030D82: - ldr r0, [sp, #0x10] - add sp, #0x14 - strh r0, [r6, #0x4] - pop {r4-r7, pc} -_02030D8A: - add r0, r6, #0x0 - bl FUN_0202D478 - cmp r0, #0x0 - bne _02030CA0 -_02030D94: - add sp, #0x14 - pop {r4-r7, pc} - .balign 4 -_02030D98: .word 0x0000FFFF -_02030D9C: .word UNK_021C59F4 -_02030DA0: .word 0x00000689 - - thumb_func_start FUN_02030DA4 -FUN_02030DA4: ; 0x02030DA4 - push {r3, lr} - ldr r0, _02030DF0 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - cmp r1, #0x0 - beq _02030DEE - ldr r0, _02030DF4 ; =0x0000068B - ldrb r0, [r1, r0] - cmp r0, #0x0 - bne _02030DEE - mov r0, #0x47 - lsl r0, r0, #0x4 - add r0, r1, r0 - bl FUN_0202D4BC - ldr r0, _02030DF0 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - mov r0, #0x47 - lsl r0, r0, #0x4 - add r0, r1, r0 - bl FUN_0202D478 - cmp r0, #0x0 - ble _02030DEE - ldr r0, _02030DF0 ; =UNK_021C59F4 - mov r2, #0x47 - ldr r3, [r0, #0x4] - ldr r0, _02030DF8 ; =0x000005EC - lsl r2, r2, #0x4 - add r0, r3, r0 - str r0, [sp, #0x0] - add r0, r3, r2 - sub r2, #0x10 - ldr r2, [r3, r2] - mov r1, #0x0 - mov r3, #0x1 - bl FUN_02030C8C -_02030DEE: - pop {r3, pc} - .balign 4 -_02030DF0: .word UNK_021C59F4 -_02030DF4: .word 0x0000068B -_02030DF8: .word 0x000005EC - - thumb_func_start FUN_02030DFC -FUN_02030DFC: ; 0x02030DFC - push {r3-r7, lr} - ldr r0, _02030E6C ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - cmp r1, #0x0 - beq _02030E68 - ldr r0, _02030E70 ; =0x0000068B - ldrb r0, [r1, r0] - cmp r0, #0x0 - bne _02030E68 - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D858 - add r7, r0, #0x1 - mov r4, #0x0 - cmp r7, #0x0 - ble _02030E68 - ldr r6, _02030E6C ; =UNK_021C59F4 - add r5, r4, #0x0 -_02030E26: - ldr r1, [r6, #0x4] - ldr r0, _02030E74 ; =0x000004E8 - add r0, r1, r0 - add r0, r0, r5 - bl FUN_0202D4BC - ldr r1, [r6, #0x4] - ldr r0, _02030E74 ; =0x000004E8 - add r0, r1, r0 - add r0, r0, r5 - bl FUN_0202D478 - cmp r0, #0x0 - ble _02030E60 - ldr r3, [r6, #0x4] - ldr r0, _02030E78 ; =0x0000058C - mov r2, #0x46 - add r0, r3, r0 - add r0, r0, r5 - str r0, [sp, #0x0] - ldr r0, _02030E74 ; =0x000004E8 - lsl r2, r2, #0x4 - add r0, r3, r0 - ldr r2, [r3, r2] - add r0, r0, r5 - add r1, r4, #0x0 - mov r3, #0x0 - bl FUN_02030C8C -_02030E60: - add r4, r4, #0x1 - add r5, #0xc - cmp r4, r7 - blt _02030E26 -_02030E68: - pop {r3-r7, pc} - nop -_02030E6C: .word UNK_021C59F4 -_02030E70: .word 0x0000068B -_02030E74: .word 0x000004E8 -_02030E78: .word 0x0000058C - - thumb_func_start FUN_02030E7C -FUN_02030E7C: ; 0x02030E7C - push {r4, lr} - add r4, r0, #0x0 - ldr r0, _02030F14 ; =UNK_021C59F4 - ldr r0, [r0, #0x4] - cmp r0, #0x0 - bne _02030E8C - mov r0, #0x0 - pop {r4, pc} -_02030E8C: - bl FUN_02033534 - cmp r0, #0x13 - blt _02030EC0 - ldr r0, _02030F14 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _02030F18 ; =0x00000687 - ldrb r0, [r1, r0] - cmp r0, #0x0 - beq _02030EBC - bl MOD04_021D8018 - mov r1, #0x0 - mvn r1, r1 - cmp r0, r1 - beq _02030EBC - cmp r4, #0x0 - bne _02030EB4 - mov r0, #0x1 - pop {r4, pc} -_02030EB4: - cmp r4, #0x1 - bne _02030EBC - mov r0, #0x1 - pop {r4, pc} -_02030EBC: - mov r0, #0x0 - pop {r4, pc} -_02030EC0: - bl FUN_02030F40 - cmp r0, #0x0 - bne _02030ECC - mov r0, #0x0 - pop {r4, pc} -_02030ECC: - bl FUN_0202CBD4 - cmp r0, #0x4 - beq _02030ED8 - mov r0, #0x0 - pop {r4, pc} -_02030ED8: - bl FUN_02031190 - cmp r4, r0 - bne _02030EE4 - mov r0, #0x1 - pop {r4, pc} -_02030EE4: - bl FUN_02031190 - cmp r0, #0x0 - bne _02030EFE - bl FUN_0202CB8C - mov r1, #0x1 - add r2, r1, #0x0 - lsl r2, r4 - tst r0, r2 - beq _02030F10 - add r0, r1, #0x0 - pop {r4, pc} -_02030EFE: - ldr r0, _02030F14 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _02030F1C ; =0x0000065C - ldrh r2, [r1, r0] - mov r0, #0x1 - add r1, r0, #0x0 - lsl r1, r4 - tst r1, r2 - bne _02030F12 -_02030F10: - mov r0, #0x0 -_02030F12: - pop {r4, pc} - .balign 4 -_02030F14: .word UNK_021C59F4 -_02030F18: .word 0x00000687 -_02030F1C: .word 0x0000065C - - thumb_func_start FUN_02030F20 -FUN_02030F20: ; 0x02030F20 - push {r3-r5, lr} - mov r4, #0x0 - add r5, r4, #0x0 -_02030F26: - lsl r0, r5, #0x10 - lsr r0, r0, #0x10 - bl FUN_02030E7C - cmp r0, #0x0 - beq _02030F34 - add r4, r4, #0x1 -_02030F34: - add r5, r5, #0x1 - cmp r5, #0x8 - blt _02030F26 - add r0, r4, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_02030F40 -FUN_02030F40: ; 0x02030F40 - push {r3, lr} - ldr r0, _02030F5C ; =UNK_021C59F4 - ldr r0, [r0, #0x4] - cmp r0, #0x0 - beq _02030F56 - bl FUN_02033534 - cmp r0, #0x13 - blt _02030F56 - mov r0, #0x1 - pop {r3, pc} -_02030F56: - bl FUN_0202EDF8 - pop {r3, pc} - .balign 4 -_02030F5C: .word UNK_021C59F4 - - thumb_func_start FUN_02030F60 -FUN_02030F60: ; 0x02030F60 - ldr r1, _02030F6C ; =UNK_021C59F4 - ldr r2, [r1, #0x4] - ldr r1, _02030F70 ; =0x0000062B - strb r0, [r2, r1] - bx lr - nop -_02030F6C: .word UNK_021C59F4 -_02030F70: .word 0x0000062B - - thumb_func_start FUN_02030F74 -FUN_02030F74: ; 0x02030F74 - ldr r1, _02030F84 ; =UNK_021C59F4 - ldr r1, [r1, #0x4] - add r1, r1, r0 - mov r0, #0x62 - lsl r0, r0, #0x4 - ldrb r0, [r1, r0] - bx lr - nop -_02030F84: .word UNK_021C59F4 - - thumb_func_start FUN_02030F88 -FUN_02030F88: ; 0x02030F88 - ldr r1, _02030FA4 ; =UNK_021C59F4 - ldr r2, [r1, #0x4] - cmp r2, #0x0 - bne _02030F94 - mov r0, #0x0 - bx lr -_02030F94: - mov r1, #0x61 - lsl r1, r1, #0x4 - add r3, r2, r1 - lsl r2, r0, #0x1 - ldrh r0, [r3, r2] - mov r1, #0x0 - strh r1, [r3, r2] - bx lr - .balign 4 -_02030FA4: .word UNK_021C59F4 - - thumb_func_start FUN_02030FA8 -FUN_02030FA8: ; 0x02030FA8 - ldr r0, _02030FC0 ; =UNK_021C59F4 - ldr r3, [r0, #0x4] - cmp r3, #0x0 - beq _02030FBC - ldr r1, _02030FC4 ; =0x00000628 - mov r0, #0x2 - ldrh r2, [r3, r1] - lsl r0, r0, #0xe - orr r0, r2 - strh r0, [r3, r1] -_02030FBC: - bx lr - nop -_02030FC0: .word UNK_021C59F4 -_02030FC4: .word 0x00000628 - - thumb_func_start FUN_02030FC8 -FUN_02030FC8: ; 0x02030FC8 - ldr r0, _02030FD8 ; =UNK_021C59F4 - ldr r2, [r0, #0x4] - cmp r2, #0x0 - beq _02030FD6 - ldr r0, _02030FDC ; =0x00000628 - mov r1, #0x0 - strh r1, [r2, r0] -_02030FD6: - bx lr - .balign 4 -_02030FD8: .word UNK_021C59F4 -_02030FDC: .word 0x00000628 - - thumb_func_start FUN_02030FE0 -FUN_02030FE0: ; 0x02030FE0 - ldr r0, _02030FF8 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - cmp r1, #0x0 - beq _02030FF4 - ldr r0, _02030FFC ; =0x00000628 - ldrh r1, [r1, r0] - mov r0, #0x2 - lsl r0, r0, #0xe - and r0, r1 - bx lr -_02030FF4: - mov r0, #0x1 - bx lr - .balign 4 -_02030FF8: .word UNK_021C59F4 -_02030FFC: .word 0x00000628 - - thumb_func_start FUN_02031000 -FUN_02031000: ; 0x02031000 - push {r4-r6, lr} - sub sp, #0x8 - add r5, r0, #0x0 - add r4, r1, #0x0 - add r6, r2, #0x0 - bl FUN_0202FA28 - cmp r0, #0x1 - bne _02031030 - mov r0, #0x1 - str r0, [sp, #0x0] - mov r0, #0x0 - str r0, [sp, #0x4] - ldr r0, _02031050 ; =UNK_021C59F4 - add r2, r4, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _02031054 ; =0x0000054C - add r3, r6, #0x0 - add r0, r1, r0 - add r1, r5, #0x0 - bl FUN_0202D684 - add sp, #0x8 - pop {r4-r6, pc} -_02031030: - mov r0, #0x1 - str r0, [sp, #0x0] - mov r0, #0x0 - str r0, [sp, #0x4] - ldr r0, _02031050 ; =UNK_021C59F4 - add r2, r4, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _02031058 ; =0x0000056C - add r3, r6, #0x0 - add r0, r1, r0 - add r1, r5, #0x0 - bl FUN_0202D684 - add sp, #0x8 - pop {r4-r6, pc} - nop -_02031050: .word UNK_021C59F4 -_02031054: .word 0x0000054C -_02031058: .word 0x0000056C - - thumb_func_start FUN_0203105C -FUN_0203105C: ; 0x0203105C - push {r3-r5, lr} - sub sp, #0x8 - add r5, r0, #0x0 - mov r0, #0x0 - str r0, [sp, #0x0] - str r0, [sp, #0x4] - ldr r0, _02031080 ; =UNK_021C59F4 - add r4, r1, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _02031084 ; =0x0000054C - add r3, r2, #0x0 - add r0, r1, r0 - add r1, r5, #0x0 - add r2, r4, #0x0 - bl FUN_0202D684 - add sp, #0x8 - pop {r3-r5, pc} - .balign 4 -_02031080: .word UNK_021C59F4 -_02031084: .word 0x0000054C - - thumb_func_start FUN_02031088 -FUN_02031088: ; 0x02031088 - push {r3, lr} - ldr r0, _02031100 ; =UNK_021C59F4 - ldr r2, [r0, #0x4] - cmp r2, #0x0 - beq _020310FC - ldr r1, _02031104 ; =0x0000067B - ldrb r0, [r2, r1] - cmp r0, #0x1 - beq _020310A0 - cmp r0, #0x3 - beq _020310D8 - pop {r3, pc} -_020310A0: - bl FUN_0202FA28 - cmp r0, #0x1 - bne _020310B8 - ldr r1, _02031100 ; =UNK_021C59F4 - mov r0, #0xb - ldr r2, [r1, #0x4] - ldr r1, _02031108 ; =0x0000067C - add r1, r2, r1 - bl FUN_020311D0 - b _020310C8 -_020310B8: - ldr r1, _02031100 ; =UNK_021C59F4 - mov r0, #0xb - ldr r2, [r1, #0x4] - ldr r1, _02031108 ; =0x0000067C - add r1, r2, r1 - mov r2, #0x1 - bl FUN_02030BC4 -_020310C8: - cmp r0, #0x0 - beq _020310FC - ldr r0, _02031100 ; =UNK_021C59F4 - mov r2, #0x2 - ldr r1, [r0, #0x4] - ldr r0, _02031104 ; =0x0000067B - strb r2, [r1, r0] - pop {r3, pc} -_020310D8: - add r1, r1, #0x1 - mov r0, #0xc - add r1, r2, r1 - bl FUN_020311D0 - cmp r0, #0x0 - beq _020310FC - ldr r0, _02031100 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _02031108 ; =0x0000067C - ldrb r0, [r1, r0] - bl FUN_0202F9E0 - ldr r0, _02031100 ; =UNK_021C59F4 - mov r2, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _02031104 ; =0x0000067B - strb r2, [r1, r0] -_020310FC: - pop {r3, pc} - nop -_02031100: .word UNK_021C59F4 -_02031104: .word 0x0000067B -_02031108: .word 0x0000067C - - thumb_func_start FUN_0203110C -FUN_0203110C: ; 0x0203110C - push {r4, lr} - add r4, r2, #0x0 - bl FUN_02031190 - cmp r0, #0x0 - bne _0203112A - ldr r1, _0203112C ; =UNK_021C59F4 - ldr r0, _02031130 ; =0x0000067B - ldr r2, [r1, #0x4] - mov r3, #0x1 - strb r3, [r2, r0] - ldrb r2, [r4, #0x0] - ldr r1, [r1, #0x4] - add r0, r0, #0x1 - strb r2, [r1, r0] -_0203112A: - pop {r4, pc} - .balign 4 -_0203112C: .word UNK_021C59F4 -_02031130: .word 0x0000067B - - thumb_func_start FUN_02031134 -FUN_02031134: ; 0x02031134 - push {r4, lr} - add r4, r2, #0x0 - bl FUN_02031190 - cmp r0, #0x0 - beq _02031152 - ldr r1, _02031154 ; =UNK_021C59F4 - ldrb r3, [r4, #0x0] - ldr r2, [r1, #0x4] - ldr r0, _02031158 ; =0x0000067C - strb r3, [r2, r0] - ldr r1, [r1, #0x4] - mov r2, #0x3 - sub r0, r0, #0x1 - strb r2, [r1, r0] -_02031152: - pop {r4, pc} - .balign 4 -_02031154: .word UNK_021C59F4 -_02031158: .word 0x0000067C - - thumb_func_start FUN_0203115C -FUN_0203115C: ; 0x0203115C - push {r4, lr} - add r4, r2, #0x0 - bl FUN_02031190 - cmp r0, #0x0 - bne _02031184 - ldr r0, _02031188 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _0203118C ; =0x0000067B - ldrb r0, [r1, r0] - cmp r0, #0x2 - bne _02031184 - ldrb r0, [r4, #0x0] - bl FUN_0202F9E0 - ldr r0, _02031188 ; =UNK_021C59F4 - mov r2, #0x0 - ldr r1, [r0, #0x4] - ldr r0, _0203118C ; =0x0000067B - strb r2, [r1, r0] -_02031184: - pop {r4, pc} - nop -_02031188: .word UNK_021C59F4 -_0203118C: .word 0x0000067B - - thumb_func_start FUN_02031190 -FUN_02031190: ; 0x02031190 - push {r3, lr} - ldr r0, _020311CC ; =UNK_021C59F4 - ldr r0, [r0, #0x4] - cmp r0, #0x0 - beq _020311C6 - bl FUN_02033534 - cmp r0, #0x13 - blt _020311B4 - bl MOD04_021D8018 - mov r1, #0x0 - mvn r1, r1 - cmp r0, r1 - beq _020311C6 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - pop {r3, pc} -_020311B4: - bl FUN_02031280 - cmp r0, #0x0 - beq _020311C0 - mov r0, #0x0 - pop {r3, pc} -_020311C0: - bl FUN_0202D19C - pop {r3, pc} -_020311C6: - mov r0, #0x0 - pop {r3, pc} - nop -_020311CC: .word UNK_021C59F4 - - thumb_func_start FUN_020311D0 -FUN_020311D0: ; 0x020311D0 - ldr r3, _020311D8 ; =FUN_02030ADC - mov r2, #0x0 - bx r3 - nop -_020311D8: .word FUN_02030ADC - - thumb_func_start FUN_020311DC -FUN_020311DC: ; 0x020311DC - ldr r3, _020311E4 ; =FUN_02030ADC - mov r1, #0x0 - add r2, r1, #0x0 - bx r3 - .balign 4 -_020311E4: .word FUN_02030ADC - - thumb_func_start FUN_020311E8 -FUN_020311E8: ; 0x020311E8 - ldr r3, _020311EC ; =FUN_0202EE24 - bx r3 - .balign 4 -_020311EC: .word FUN_0202EE24 - - thumb_func_start FUN_020311F0 -FUN_020311F0: ; 0x020311F0 - push {r3, lr} - bl FUN_02031280 - cmp r0, #0x0 - beq _020311FE - mov r0, #0x0 - pop {r3, pc} -_020311FE: - ldr r0, _02031220 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - cmp r1, #0x0 - beq _0203121A - ldr r0, _02031224 ; =0x00000689 - ldrb r0, [r1, r0] - cmp r0, #0x0 - beq _0203121A - mov r0, #0x1 - add r1, r0, #0x0 - bl FUN_020334E8 - mov r0, #0x1 - pop {r3, pc} -_0203121A: - bl FUN_0202EE60 - pop {r3, pc} - .balign 4 -_02031220: .word UNK_021C59F4 -_02031224: .word 0x00000689 - - thumb_func_start FUN_02031228 -FUN_02031228: ; 0x02031228 - push {r3, lr} - bl FUN_0202D858 - cmp r0, #0x5 - blo _02031236 - mov r0, #0xc - pop {r3, pc} -_02031236: - bl FUN_0202FA28 - cmp r0, #0x0 - bne _02031242 - mov r0, #0xc - pop {r3, pc} -_02031242: - mov r0, #0x26 - pop {r3, pc} - .balign 4 - - thumb_func_start FUN_02031248 -FUN_02031248: ; 0x02031248 - push {r3, lr} - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D858 - add r0, r0, #0x1 - pop {r3, pc} - .balign 4 - - thumb_func_start FUN_02031258 -FUN_02031258: ; 0x02031258 - push {r3, lr} - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D884 - add r0, r0, #0x1 - pop {r3, pc} - .balign 4 - - thumb_func_start FUN_02031268 -FUN_02031268: ; 0x02031268 - ldr r1, _02031278 ; =UNK_021C59F4 - ldr r2, [r1, #0x4] - cmp r2, #0x0 - beq _02031274 - ldr r1, _0203127C ; =0x00000686 - strb r0, [r2, r1] -_02031274: - bx lr - nop -_02031278: .word UNK_021C59F4 -_0203127C: .word 0x00000686 - - thumb_func_start FUN_02031280 -FUN_02031280: ; 0x02031280 - ldr r0, _02031294 ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - cmp r1, #0x0 - beq _0203128E - ldr r0, _02031298 ; =0x00000686 - ldrb r0, [r1, r0] - bx lr -_0203128E: - mov r0, #0x0 - bx lr - nop -_02031294: .word UNK_021C59F4 -_02031298: .word 0x00000686 - - thumb_func_start FUN_0203129C -FUN_0203129C: ; 0x0203129C - push {r3, lr} - bl FUN_0202F03C - cmp r0, #0x0 - bne _020312B6 - bl FUN_02031190 - cmp r0, #0x0 - bne _020312B6 - mov r0, #0x2 - add r1, sp, #0x0 - bl FUN_02030C4C -_020312B6: - bl FUN_0202F05C - pop {r3, pc} - - thumb_func_start FUN_020312BC -FUN_020312BC: ; 0x020312BC - push {r3-r7, lr} - sub sp, #0x20 - add r4, r0, #0x0 - add r0, sp, #0x10 - add r1, sp, #0x4 - bl GF_RTC_CopyDateTime - ldr r0, _02031340 ; =gMain - ldr r6, [sp, #0x10] - mov r5, #0x0 - lsr r7, r6, #0x1c - lsl r5, r5, #0x4 - ldr r1, [sp, #0xc] - ldr r0, [r0, #0x2c] - lsl r6, r6, #0x4 - add r3, r1, r0 - ldr r0, [sp, #0x18] - orr r5, r7 - str r0, [sp, #0x0] - ldr r0, [sp, #0x14] - ldr r1, [sp, #0x4] - add r6, r0, r6 - ldr r0, _02031344 ; =0x00000000 - ldr r2, [sp, #0x8] - adc r0, r5 - lsr r5, r6, #0x1b - lsl r0, r0, #0x5 - orr r0, r5 - ldr r5, [sp, #0x0] - lsl r6, r6, #0x5 - add r6, r5, r6 - ldr r5, _02031344 ; =0x00000000 - adc r5, r0 - lsr r0, r6, #0x1b - lsl r5, r5, #0x5 - orr r5, r0 - lsl r0, r6, #0x5 - add r6, r1, r0 - ldr r1, _02031344 ; =0x00000000 - adc r1, r5 - lsr r0, r6, #0x1a - lsl r1, r1, #0x6 - orr r1, r0 - lsl r0, r6, #0x6 - add r5, r2, r0 - ldr r2, _02031344 ; =0x00000000 - adc r2, r1 - lsr r0, r5, #0x1a - lsl r1, r2, #0x6 - orr r1, r0 - lsl r0, r5, #0x6 - add r2, r3, r0 - ldr r0, _02031344 ; =0x00000000 - str r2, [r4, #0x0] - adc r0, r1 - str r0, [r4, #0x4] - ldr r1, _02031348 ; =0x6C078965 - ldr r0, _0203134C ; =0x5D588B65 - str r1, [r4, #0x8] - str r0, [r4, #0xc] - ldr r0, _02031350 ; =0x00269EC3 - str r0, [r4, #0x10] - mov r0, #0x0 - str r0, [r4, #0x14] - add sp, #0x20 - pop {r3-r7, pc} - .balign 4 -_02031340: .word gMain -_02031344: .word 0x00000000 -_02031348: .word 0x6C078965 -_0203134C: .word 0x5D588B65 -_02031350: .word 0x00269EC3 - - thumb_func_start FUN_02031354 -FUN_02031354: ; 0x02031354 - add r1, r0, #0x0 - ldr r0, _02031364 ; =UNK_021C59F4 - ldr r3, _02031368 ; =FUN_0202D830 - ldr r2, [r0, #0x4] - ldr r0, _0203136C ; =0x0000056C - add r0, r2, r0 - bx r3 - nop -_02031364: .word UNK_021C59F4 -_02031368: .word FUN_0202D830 -_0203136C: .word 0x0000056C - - thumb_func_start FUN_02031370 -FUN_02031370: ; 0x02031370 - ldr r0, _0203137C ; =UNK_021C59F4 - ldr r3, _02031380 ; =FUN_0202D4E4 - ldr r1, [r0, #0x4] - ldr r0, _02031384 ; =0x0000056C - add r0, r1, r0 - bx r3 - .balign 4 -_0203137C: .word UNK_021C59F4 -_02031380: .word FUN_0202D4E4 -_02031384: .word 0x0000056C - - thumb_func_start FUN_02031388 -FUN_02031388: ; 0x02031388 - ldr r0, _02031394 ; =UNK_021C59F4 - ldr r3, _02031398 ; =FUN_0202D4E4 - ldr r1, [r0, #0x4] - ldr r0, _0203139C ; =0x0000054C - add r0, r1, r0 - bx r3 - .balign 4 -_02031394: .word UNK_021C59F4 -_02031398: .word FUN_0202D4E4 -_0203139C: .word 0x0000054C - - thumb_func_start FUN_020313A0 -FUN_020313A0: ; 0x020313A0 - ldr r1, _020313AC ; =UNK_021C59F4 - ldr r2, [r1, #0x4] - ldr r1, _020313B0 ; =0x00000687 - strb r0, [r2, r1] - bx lr - nop -_020313AC: .word UNK_021C59F4 -_020313B0: .word 0x00000687 - - thumb_func_start FUN_020313B4 -FUN_020313B4: ; 0x020313B4 - ldr r2, _020313C4 ; =UNK_021C59F4 - ldr r2, [r2, #0x4] - cmp r2, #0x0 - beq _020313C2 - add r2, r2, r1 - ldr r1, _020313C8 ; =0x00000677 - strb r0, [r2, r1] -_020313C2: - bx lr - .balign 4 -_020313C4: .word UNK_021C59F4 -_020313C8: .word 0x00000677 - - thumb_func_start FUN_020313CC -FUN_020313CC: ; 0x020313CC - ldr r1, _020313E4 ; =UNK_021C59F4 - ldr r1, [r1, #0x4] - cmp r1, #0x0 - beq _020313E0 - add r2, r1, r0 - ldr r1, _020313E8 ; =0x00000677 - ldrb r1, [r2, r1] - cmp r1, #0xff - beq _020313E0 - add r0, r1, #0x0 -_020313E0: - bx lr - nop -_020313E4: .word UNK_021C59F4 -_020313E8: .word 0x00000677 - - thumb_func_start FUN_020313EC -FUN_020313EC: ; 0x020313EC - push {r3, lr} - bl FUN_02033534 - cmp r0, #0x13 - bge _020313FA - mov r0, #0x0 - pop {r3, pc} -_020313FA: - bl MOD04_021D8624 - pop {r3, pc} - - thumb_func_start FUN_02031400 -FUN_02031400: ; 0x02031400 - push {r4, lr} - add r4, r0, #0x0 - bl FUN_02033534 - cmp r0, #0x13 - blt _02031430 - ldr r2, _02031434 ; =UNK_021C59F4 - mov r1, #0x63 - ldr r0, [r2, #0x4] - lsl r1, r1, #0x4 - str r4, [r0, r1] - cmp r4, #0x0 - beq _02031430 - ldr r3, [r2, #0x4] - mov r4, #0x0 - add r0, r1, #0x4 - str r4, [r3, r0] - add r0, r1, #0x0 - ldr r3, [r2, #0x4] - add r0, #0x8 - str r4, [r3, r0] - ldr r0, [r2, #0x4] - add r1, #0xc - str r4, [r0, r1] -_02031430: - pop {r4, pc} - nop -_02031434: .word UNK_021C59F4 - - thumb_func_start FUN_02031438 -FUN_02031438: ; 0x02031438 - ldr r0, _0203144C ; =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, _02031450 ; =0x00000681 - ldrb r0, [r1, r0] - cmp r0, #0x0 - beq _02031448 - mov r0, #0x1 - bx lr -_02031448: - mov r0, #0x0 - bx lr - .balign 4 -_0203144C: .word UNK_021C59F4 -_02031450: .word 0x00000681 - - thumb_func_start FUN_02031454 -FUN_02031454: ; 0x02031454 - ldr r0, _02031460 ; =UNK_021C59F4 - mov r2, #0x1 - ldr r1, [r0, #0x4] - ldr r0, _02031464 ; =0x00000689 - strb r2, [r1, r0] - bx lr - .balign 4 -_02031460: .word UNK_021C59F4 -_02031464: .word 0x00000689 - - thumb_func_start FUN_02031468 -FUN_02031468: ; 0x02031468 - ldr r0, _02031478 ; =UNK_021C59F4 - ldr r2, [r0, #0x4] - cmp r2, #0x0 - beq _02031476 - ldr r0, _0203147C ; =0x0000068A - mov r1, #0x1 - strb r1, [r2, r0] -_02031476: - bx lr - .balign 4 -_02031478: .word UNK_021C59F4 -_0203147C: .word 0x0000068A diff --git a/arm9/global.inc b/arm9/global.inc index 5700a247..c28b0d53 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8513,27 +8513,4 @@ .extern CARDi_InitCommon .extern MonNotFaintedOrEgg .extern CountAlivePokemon -.extern FUN_02025484 -.extern FUN_02025490 -.extern FUN_020254A0 -.extern FUN_020254B4 -.extern UNK_021C59F4 -.extern UNK_02105D58 -.extern FUN_0202F150 -.extern FUN_0202F2F0 -.extern FUN_0202F5A4 -.extern FUN_0202F820 -.extern FUN_0202F8D4 -.extern FUN_0202F910 -.extern FUN_0202F918 -.extern FUN_0202F984 -.extern FUN_0202F9E0 -.extern FUN_0202FA28 -.extern FUN_0202FB58 -.extern FUN_0202FB80 -.extern FUN_0202FE2C -.extern FUN_0202FEEC -.extern FUN_02030074 -.extern FUN_020303F4 -.extern FUN_020304D4 -.extern FUN_020304F0 + diff --git a/arm9/src/unk_0202F150.c b/arm9/src/unk_0202F150.c new file mode 100644 index 00000000..dd86b10d --- /dev/null +++ b/arm9/src/unk_0202F150.c @@ -0,0 +1,2382 @@ +#include "global.h" +#include "MI_memory.h" +#include "heap.h" +#include "main.h" +#include "RTC_api.h" + +struct +{ + u8 unk00; + struct UnkStruct1 *unk04; +} UNK_021C59F4; + + +vu8 UNK_02105D58 = 4; +vu8 UNK_02105D59 = 4; + +extern int FUN_02033534(); +extern u32 FUN_0202D858(u16 param0); +extern void FUN_02031480(u32 param0); +extern void FUN_0202D7D8(u32 *param0, u32 param1, u32 param2); +extern void FUN_0202F2F0(); +extern void FUN_020312BC(u32 param0); +extern void FUN_0202FB20(); + +extern u32 FUN_0200CA60(void (*param0)(), u32 param1, u32 param2); +extern void FUN_0202D394(u32 param0, u32 param1, u32 param2); + +extern void FUN_0202D804(u32 *param0); +extern u32 FUN_02030E7C(u16 param0); + +struct UnkStruct1 +{ + u8 unk000[2][38]; + u8 unk04c[264]; + u8 unk154[2][192]; + u8 unk2D4[384]; + u32 unk454; + u32 unk458; + u32 unk45C; + u32 unk460; + u32 unk464; + u8 unk468[0x8]; + u32 unk470; + u8 unk474[0x8]; + struct + { + u32 unk00; + u32 unk04; + u32 unk08; + } unk47C[8]; + u32 unk4DC; + u8 unk4E0[0x8]; + struct + { + u32 unk00; + u32 unk04; + u32 unk08; + } unk4E8[8]; + u32 unk548; + u8 unk54C[32]; + u8 unk56C[32]; + struct + { + u32 unk00; + u32 unk04; + u16 unk08; + u8 unk0a; + u8 unk0b; + } unk58C[8]; + u32 unk5EC; + u32 unk5F0; + u16 unk5F4; + u8 unk5F6; + u8 unk5F7; + s64 unk5F8[3]; + u16 unk610[8]; + u8 unk620[0x8]; + u16 unk628; + u8 unk62A; + u8 unk62B; + u8 unk62C; + s8 unk62D; + u16 unk62E; + u32 unk630; + u32 unk634; + u32 unk638[8]; + u32 unk658; + u16 unk65C; + u8 unk65E; + u8 unk65F[8]; + u8 unk667[8]; + u8 unk66F[8]; + u8 unk677[4]; + u8 unk67B; + u8 unk67C; + u8 unk67D; + u8 unk67E; + u8 unk67F; + u8 unk680; + u8 unk681; + u8 unk682; + u8 unk683; + u8 unk684; + u8 unk685; + u8 unk686; + u8 unk687; + u8 unk688; + u8 unk689; + u8 unk68A; + u8 unk68B; +}; + +THUMB_FUNC u32 FUN_0202F150(u32 param0, u32 param1) +{ + u32 r4 = 0; + UNK_021C59F4.unk00 = 0; + if (param0 != 0) + { + u32 res = FUN_0202D858(FUN_02033534()) + 1; + + if (UNK_021C59F4.unk04 != 0) + { + return 1; + } + + FUN_02031480(0xf); + struct UnkStruct1 *ptr = (struct UnkStruct1 *)AllocFromHeap(0xf, sizeof(struct UnkStruct1)); + UNK_021C59F4.unk04 = ptr; + MI_CpuFill8(ptr, 0, 0x68C); + + UNK_021C59F4.unk04->unk658 = param1 + 0x40; + UNK_021C59F4.unk04->unk67D = 0; + UNK_021C59F4.unk04->unk67E = 0x1b; + + UNK_021C59F4.unk04->unk45C = AllocFromHeap(0xf, UNK_021C59F4.unk04->unk658 << 1); + + UNK_021C59F4.unk04->unk460 = AllocFromHeap(0xf, UNK_021C59F4.unk04->unk658); + + UNK_021C59F4.unk04->unk458 = AllocFromHeap(0xf, res * UNK_021C59F4.unk04->unk658); + + UNK_021C59F4.unk04->unk454 = AllocFromHeap(0xf, res * UNK_021C59F4.unk04->unk658); + + if (FUN_02033534() == 0xa) + { + FUN_0202D7D8(UNK_021C59F4.unk04->unk54C, 0x64, &UNK_021C59F4.unk04->unk464); + FUN_0202D7D8(UNK_021C59F4.unk04->unk56C, 0x32 << 4, &UNK_021C59F4.unk04->unk4DC); + } + else + { + FUN_0202D7D8(UNK_021C59F4.unk04->unk54C, 0x14, &UNK_021C59F4.unk04->unk464); + FUN_0202D7D8(UNK_021C59F4.unk04->unk56C, 0x1b + 0xfd, &UNK_021C59F4.unk04->unk4DC); + } + } + else + { + + r4 = 1; + if (UNK_021C59F4.unk04 == 0) + { + ErrorHandling(); + } + } + + UNK_021C59F4.unk04->unk65C = 0; + + for (int i = 0; i < 4; i++) + { + UNK_021C59F4.unk04->unk677[i] = 0xff; + } + + if (r4 == 0) + { + FUN_0202F2F0(); + } + + FUN_020312BC(&UNK_021C59F4.unk04->unk5F8); + + if (r4 == 0) + { + u32 res2 = FUN_0200CA60(FUN_0202FB20, 0, 0); + + UNK_021C59F4.unk04->unk548 = res2; + } + + UNK_021C59F4.unk04->unk687 = 0; + + return 1; +} + +THUMB_FUNC void FUN_0202F2F0() +{ + UNK_021C59F4.unk04->unk62C = 0; + UNK_021C59F4.unk04->unk62D = 0; + UNK_021C59F4.unk04->unk67F = 0; + UNK_021C59F4.unk04->unk680 = 0; + + s32 res = FUN_0202D858(FUN_02033534()) + 1; + + MI_CpuFill8(UNK_021C59F4.unk04->unk458, 0, UNK_021C59F4.unk04->unk658 * res); + + int i; + for (i = 0; i < res; i++) + { + FUN_0202D394(&UNK_021C59F4.unk04->unk4E8[i], + UNK_021C59F4.unk04->unk458 + i * UNK_021C59F4.unk04->unk658, + UNK_021C59F4.unk04->unk658); + } + + MI_CpuFill8(UNK_021C59F4.unk04->unk454, 0, UNK_021C59F4.unk04->unk658 * res); + + for (i = 0; i < res; i++) + { + FUN_0202D394(&UNK_021C59F4.unk04->unk47C[i], + UNK_021C59F4.unk04->unk454 + i * UNK_021C59F4.unk04->unk658, + UNK_021C59F4.unk04->unk658); + } + + MI_CpuFill8(&UNK_021C59F4.unk04->unk2D4, 0, 6 << 6); + FUN_0202D394(&UNK_021C59F4.unk04->unk4DC, &UNK_021C59F4.unk04->unk2D4, 6 << 6); + + for (i = 0; i < 0xc0; i++) + { + UNK_021C59F4.unk04->unk154[0][i] = 0xee; + UNK_021C59F4.unk04->unk154[1][i] = 0xee; + } + + MI_CpuFill8(&UNK_021C59F4.unk04->unk04c, 0, 0x42 << 2); + FUN_0202D394(&UNK_021C59F4.unk04->unk464, &UNK_021C59F4.unk04->unk04c, 0x42 << 2); + + UNK_021C59F4.unk04->unk000[0][0] = 0xff; + UNK_021C59F4.unk04->unk000[1][0] = 0xff; + + for (i = 1; i < 0x26; i++) + { + UNK_021C59F4.unk04->unk000[0][i] = 0xee; + UNK_021C59F4.unk04->unk000[1][i] = 0xee; + } + + MI_CpuFill8(UNK_021C59F4.unk04->unk45C, 0, UNK_021C59F4.unk04->unk658 << 1); + + FUN_0202D394( + &UNK_021C59F4.unk04->unk470, UNK_021C59F4.unk04->unk45C, UNK_021C59F4.unk04->unk658 * 2); + + UNK_021C59F4.unk04->unk684 = 0; + UNK_021C59F4.unk04->unk685 = 0; + + for (i = 0; i < 8; i++) + { + UNK_021C59F4.unk04->unk65F[i] = 0; + UNK_021C59F4.unk04->unk667[i] = 1; + UNK_021C59F4.unk04->unk66F[i] = 1; + UNK_021C59F4.unk04->unk610[i] = 0; + + UNK_021C59F4.unk04->unk58C[i].unk0a = 0xee; + UNK_021C59F4.unk04->unk58C[i].unk08 = 0xffff; + UNK_021C59F4.unk04->unk58C[i].unk04 = 0; + UNK_021C59F4.unk04->unk58C[i].unk00 = 0; + + UNK_021C59F4.unk04->unk638[i] = 0; + } + + UNK_021C59F4.unk04->unk634 = 0; + UNK_021C59F4.unk04->unk630 = 1; + UNK_021C59F4.unk04->unk5F6 = 0xee; + UNK_021C59F4.unk04->unk5F4 = 0xffff; + UNK_021C59F4.unk04->unk5F0 = 0; + UNK_021C59F4.unk04->unk5EC = 0; + UNK_021C59F4.unk04->unk682 = 1; + UNK_021C59F4.unk04->unk683 = 1; + + UNK_02105D59 = 4; + UNK_02105D58 = 4; + + FUN_0202D804(UNK_021C59F4.unk04->unk54C); + FUN_0202D804(UNK_021C59F4.unk04->unk56C); + + UNK_021C59F4.unk04->unk688 = 0; +} + +THUMB_FUNC void FUN_0202F5A4() +{ + UNK_021C59F4.unk04->unk62C = 0; + UNK_021C59F4.unk04->unk62D = 0; + + s32 res = FUN_0202D858(FUN_02033534()) + 1; + + MI_CpuFill8(UNK_021C59F4.unk04->unk458, 0, UNK_021C59F4.unk04->unk658 * res); + + int i; + for (i = 0; i < res; i++) + { + FUN_0202D394(&UNK_021C59F4.unk04->unk4E8[i], + UNK_021C59F4.unk04->unk458 + i * UNK_021C59F4.unk04->unk658, + UNK_021C59F4.unk04->unk658); + } + + MI_CpuFill8(UNK_021C59F4.unk04->unk454, 0, UNK_021C59F4.unk04->unk658 * res); + + for (i = 0; i < res; i++) + { + FUN_0202D394(&UNK_021C59F4.unk04->unk47C[i], + UNK_021C59F4.unk04->unk454 + i * UNK_021C59F4.unk04->unk658, + UNK_021C59F4.unk04->unk658); + } + + MI_CpuFill8(&UNK_021C59F4.unk04->unk2D4, 0, 6 << 6); + FUN_0202D394(&UNK_021C59F4.unk04->unk4DC, &UNK_021C59F4.unk04->unk2D4, 6 << 6); + + for (i = 0; i < 0xc0; i++) + { + UNK_021C59F4.unk04->unk154[0][i] = 0xee; + UNK_021C59F4.unk04->unk154[1][i] = 0xee; + } + + MI_CpuFill8(&UNK_021C59F4.unk04->unk04c, 0, 0x42 << 2); + FUN_0202D394(&UNK_021C59F4.unk04->unk464, &UNK_021C59F4.unk04->unk04c, 0x42 << 2); + + UNK_021C59F4.unk04->unk000[0][0] = 0xff; + UNK_021C59F4.unk04->unk000[1][0] = 0xff; + + for (i = 1; i < 0x26; i++) + { + UNK_021C59F4.unk04->unk000[0][i] = 0xee; + UNK_021C59F4.unk04->unk000[1][i] = 0xee; + } + + MI_CpuFill8(UNK_021C59F4.unk04->unk45C, 0, UNK_021C59F4.unk04->unk658 << 1); + FUN_0202D394( + &UNK_021C59F4.unk04->unk470, UNK_021C59F4.unk04->unk45C, UNK_021C59F4.unk04->unk658 * 2); + + UNK_021C59F4.unk04->unk684 = 0; + UNK_021C59F4.unk04->unk685 = 0; + + for (i = 0; i < 8; i++) + { + UNK_021C59F4.unk04->unk65F[i] = 0; + UNK_021C59F4.unk04->unk667[i] = 1; + UNK_021C59F4.unk04->unk66F[i] = 1; + UNK_021C59F4.unk04->unk610[i] = 0; + + UNK_021C59F4.unk04->unk58C[i].unk0a = 0xee; + UNK_021C59F4.unk04->unk58C[i].unk08 = 0xffff; + UNK_021C59F4.unk04->unk58C[i].unk04 = 0; + UNK_021C59F4.unk04->unk58C[i].unk00 = 0; + } + + UNK_021C59F4.unk04->unk630 = 1; + UNK_021C59F4.unk04->unk5F6 = 0xee; + UNK_021C59F4.unk04->unk5F4 = 0xffff; + UNK_021C59F4.unk04->unk5F0 = 0; + UNK_021C59F4.unk04->unk5EC = 0; + UNK_021C59F4.unk04->unk682 = 1; + UNK_021C59F4.unk04->unk683 = 1; + + FUN_0202D804(UNK_021C59F4.unk04->unk54C); + FUN_0202D804(UNK_021C59F4.unk04->unk56C); + + UNK_021C59F4.unk04->unk688 = 0; +} + +THUMB_FUNC void FUN_0202F820(u32 param0) +{ + UNK_021C59F4.unk04->unk65F[param0] = 0; + + UNK_021C59F4.unk04->unk667[param0] = 1; + + UNK_021C59F4.unk04->unk638[param0] = 0; + + UNK_021C59F4.unk04->unk66F[param0] = 1; + + FUN_0202D394(&UNK_021C59F4.unk04->unk47C[param0], + UNK_021C59F4.unk04->unk454 + param0 * UNK_021C59F4.unk04->unk658, + UNK_021C59F4.unk04->unk658); + + FUN_0202D394(&UNK_021C59F4.unk04->unk4E8[param0], + UNK_021C59F4.unk04->unk458 + param0 * UNK_021C59F4.unk04->unk658, + UNK_021C59F4.unk04->unk658); + + UNK_021C59F4.unk04->unk58C[param0].unk0a = 0xee; + UNK_021C59F4.unk04->unk58C[param0].unk08 = 0xffff; + UNK_021C59F4.unk04->unk58C[param0].unk04 = 0; + UNK_021C59F4.unk04->unk58C[param0].unk00 = 0; +} + +extern u8 FUN_02031280(); + +THUMB_FUNC void FUN_0202F8D4() +{ + for (int i = 1; i < 8; i++) + { + if (FUN_02030E7C(i) == 0 && UNK_021C59F4.unk04->unk667[i] == 0 && FUN_02031280() == 0) + { + FUN_0202F820(i); + } + } +} + +THUMB_FUNC void FUN_0202F910(u32 param0) +{ + FUN_0202F820(param0); +} + +extern u32 FUN_0202E5F8(u32 param0, u32 param1, u32 param2); +extern void FUN_0202D330(void (*param0)(u32)); + +THUMB_FUNC u32 FUN_0202F918(u32 param0, u32 param1, u32 param2, u32 param3) +{ + u32 ret = 1; + if (FUN_02033534() < 0x13) + { + ret = FUN_0202E5F8(param0, param1, param3); + FUN_0202D330(FUN_0202F910); + } + + FUN_0202F150(param0, param2); + + return ret; +} + +extern u32 FUN_0202E66C(u32 param0, u32 param1); + +THUMB_FUNC u32 FUN_0202F950(u32 param0, u32 param1, u32 param2) { + u32 ret = 1; + if (FUN_02033534() < 0x13) + { + ret = FUN_0202E66C(param0, param1); + } + + FUN_0202F150(param0, param2); + + UNK_02105D58 = 4; + + return ret; +} + +extern u16 FUN_02031190(); +extern void FUN_02031088(); + + + + + +THUMB_FUNC void FUN_0202F984() { + u32 r4 = 0; + if (FUN_02031190() == 0 ) { + if (UNK_02105D59 != 4) { + return; + } + } else { + if (UNK_02105D58 != 4) { + return; + } + } + + if (UNK_021C59F4.unk04->unk67D == 2) { + UNK_021C59F4.unk04->unk67D = 0; + r4 = 1; + } + + if (UNK_021C59F4.unk04->unk67D == 3) { + UNK_021C59F4.unk04->unk67D = 1; + r4 = 1; + } + + if (r4 != 0) { + FUN_0202F5A4(); + } + FUN_02031088(); +} + + + + +THUMB_FUNC void FUN_0202F9E0(u32 param0) { + u8 r2 = UNK_021C59F4.unk04->unk67D; + if (r2 == 0 && param0 == 1) { + UNK_021C59F4.unk04->unk67D = 3; + } else if (r2 == 1 && param0 == 0) { + UNK_021C59F4.unk04->unk67D = 2; + } +} + + +THUMB_FUNC void FUN_0202FA10() { + FUN_0202F9E0(1); +} + + +THUMB_FUNC void FUN_0202FA1C() { + FUN_0202F9E0(0); +} + + + +THUMB_FUNC u8 FUN_0202FA28() { + u8 ret = UNK_021C59F4.unk04->unk67D; + if (ret == 2){ + return 1; + } else if (ret == 3) { + return 0; + } + + return ret; +} + +THUMB_FUNC u32 FUN_0202FA48() { + if (FUN_0202FA28() == 1) { + return 1; + } + + return 0; +} + +extern void MOD04_021D83C0(); +extern u32 FUN_0202E784(); +extern void FUN_020314D0(); +extern void FUN_0202DBA4(); +extern void FUN_0200CAB4(u32 param0); +extern void FUN_0202D824(u32 *param0); + +THUMB_FUNC void FUN_0202FA5C() { + u32 r4 = 0; + if (UNK_021C59F4.unk04 != 0) { + if (FUN_02033534() >= 0x13) { + MOD04_021D83C0(); + r4 = 1; + } else { + if (FUN_0202E784() != 0) { + r4 = 1; + } + } + } + + if (r4 != 0) { + FUN_020314D0(); + FUN_0202DBA4(); + UNK_021C59F4.unk00 = 0; + + FUN_0200CAB4(UNK_021C59F4.unk04->unk548); + UNK_021C59F4.unk04->unk548 = 0; + FreeToHeap(UNK_021C59F4.unk04->unk45C); + FreeToHeap(UNK_021C59F4.unk04->unk460); + FreeToHeap(UNK_021C59F4.unk04->unk458); + FreeToHeap(UNK_021C59F4.unk04->unk454); + FUN_0202D824(UNK_021C59F4.unk04->unk56C); + FUN_0202D824(UNK_021C59F4.unk04->unk54C); + FreeToHeap(UNK_021C59F4.unk04); + UNK_021C59F4.unk04 = NULL; + } +} + +extern u32 FUN_0202E9E8(u32 param0); + +THUMB_FUNC u32 FUN_0202FB18(u32 param0) { + return FUN_0202E9E8(param0); +} + + +extern void FUN_0203050C(); +extern void FUN_0202FEEC(); +extern u32 FUN_0202F03C(); +extern u32 FUN_0202EE24(); + + + +THUMB_FUNC void FUN_0202FB20() { + if (UNK_021C59F4.unk00 != 0) { + FUN_0203050C(); + if ((FUN_02031190() == 0 && FUN_02030E7C(0) != 0) || FUN_02031280() != 0){ + FUN_0202FEEC(); + } + + UNK_021C59F4.unk00 = 0; + } +} + +THUMB_FUNC void FUN_0202FB58() { + if (FUN_0202F03C() != 0) { + if (FUN_02031190() == 0 ) { + if (FUN_0202EE24() == 0) { + FUN_0202FA5C(); + } + } else { + FUN_0202FA5C(); + } + } +} + +extern void FUN_02031CDC(); +extern void FUN_02030674(); +extern void FUN_0202FCCC(); +extern void FUN_02030DA4(); +extern void FUN_02030074(); +extern void FUN_02030DFC(); +extern void FUN_0202EBD0(u16 param0); +extern void FUN_0202ED70(u32 param0); +extern void FUN_020335F4(u32 param0); +extern void FUN_020315A4(); + + + +THUMB_FUNC u32 FUN_0202FB80() { + FUN_02031CDC(); + + if (UNK_021C59F4.unk04 != NULL) { + if (UNK_021C59F4.unk04->unk68A == 0) { + UNK_021C59F4.unk00 = 0; + FUN_0202F984(); + UNK_021C59F4.unk04->unk628 |= gMain.unk44 & 0x7FFF; + FUN_02030674(); + FUN_0202FCCC(); + + UNK_021C59F4.unk04->unk628 &= 2<<0xe; + if (FUN_0202FA28() == 0) { + FUN_02030DA4(); + } + + if ((FUN_02031190() == 0 && FUN_02030E7C(0) != 0) || FUN_02031280() != 0){ + FUN_02030074(); + } + + if (FUN_02031190() == 0 || FUN_0202FA28() == 1 || FUN_02031280() != 0) { + FUN_02030DFC(); + } + + UNK_021C59F4.unk00 = 1; + } + + + FUN_0202ED70(UNK_021C59F4.unk04->unk65C); + + if (FUN_02031190() == 0) { + FUN_0202F8D4(); + } + + FUN_0202FB58(); + } else { + FUN_0202ED70(0); + } + + + FUN_020335F4(0); + FUN_020315A4(); + + return 1; +} + + +THUMB_FUNC void FUN_0202FC60() { + u8 r4 = UNK_021C59F4.unk00; + + UNK_021C59F4.unk00 = 0; + + if (UNK_021C59F4.unk04 != NULL) { + FUN_0202F2F0(); + } + + UNK_021C59F4.unk00 = r4; +} + + +THUMB_FUNC void FUN_0202FC80() { + u8 r4 = UNK_021C59F4.unk00; + + UNK_021C59F4.unk00 = 0; + + if (UNK_021C59F4.unk04 != NULL) { + UNK_021C59F4.unk04->unk67D = 1; + FUN_0202F2F0(); + } + + UNK_021C59F4.unk00 = r4; +} + + +extern void FUN_0202E538(); + + +THUMB_FUNC void FUN_0202FCA8() { + u8 r4 = UNK_021C59F4.unk00; + + UNK_021C59F4.unk00 = 0; + + if (UNK_021C59F4.unk04 != NULL) { + FUN_0202F2F0(); + FUN_0202E538(); + } + + UNK_021C59F4.unk00 = r4; +} + + +extern u32 MOD04_021D78FC(void *param0, u32 param1); +extern u32 FUN_0202CBD4(); +extern u32 FUN_02030930(u8 *param0); + + + +THUMB_FUNC void FUN_0202FCCC() { + if (UNK_021C59F4.unk04->unk683 != 0 ) { + if (FUN_02033534() >= 0x13) { + if (UNK_021C59F4.unk04->unk687 == 0 || MOD04_021D78FC(UNK_021C59F4.unk04, 0x26) == 0) { + return; + } + + UNK_021C59F4.unk04->unk683 = 0; + return; + } + + if (FUN_0202CBD4() != 4 || FUN_02030E7C(FUN_02031190()) == 0) { + if (FUN_02031280() == 0) { + return; + } + } + + UNK_02105D58 = 0; + FUN_0203050C(); + if (UNK_02105D58 == 0) { + return; + } + + UNK_021C59F4.unk04->unk683 = 0; + return; + } + + + if (FUN_02033534() >= 0x13) { + if (UNK_021C59F4.unk04->unk687 == 0) { + return; + } + + if (UNK_021C59F4.unk04->unk630 != 0){ + if ((int)UNK_021C59F4.unk04->unk634 > 3) { + return; + } + + if (UNK_02105D58 == 4) { + FUN_02030930(UNK_021C59F4.unk04->unk000[0]); + UNK_02105D58 = 2; + } + } else { + if (UNK_02105D58 == 4) { + if (FUN_02030930(UNK_021C59F4.unk04->unk000[0]) == 0) { + return; + } + + UNK_02105D58 = 2; + } + } + + + if (MOD04_021D78FC(UNK_021C59F4.unk04, 0x26) == 0) { + return; + } + + UNK_02105D58 = 4; + UNK_021C59F4.unk04->unk634++; + return; + } + + + if (FUN_0202CBD4() != 4 || FUN_02030E7C(FUN_02031190()) == 0) { + if (FUN_02031280() == 0) { + return; + } + } + + if (UNK_02105D58 != 4) { + return; + } + + + + //nonmatching + if ((int)UNK_021C59F4.unk04->unk634 > 3) { + return; + } + + FUN_02030930(UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F]); + + FUN_02030930(UNK_021C59F4.unk04->unk000[1-UNK_021C59F4.unk04->unk67F]); + + UNK_02105D58 = 0; + FUN_0203050C(); +} + +extern int FUN_02031228(u16 param0); +extern void FUN_0202D4BC(void *param0); +extern int FUN_0202D400(u32 param0, u32 param1, u32 param2); + + + + + +THUMB_FUNC u32 FUN_0202FE2C(int param0); + +#ifdef NONMATCHING +THUMB_FUNC u32 FUN_0202FE2C(int param0) { + + // these 3 variables are shuffled on the stack, everything else matches + int st4 = 0; + int stc = FUN_02031228(FUN_02033534()); + int st8 = FUN_0202D858(FUN_02033534()) + 1; + + + for (int r7 = 0; r7 < st8 ; r7++) { + + FUN_0202D4BC(&UNK_021C59F4.unk04->unk47C[r7]); + + if (FUN_02030E7C(r7) != 0) { + UNK_021C59F4.unk04->unk154[param0][r7*stc] = 0xe; + } + + FUN_0202D400(&UNK_021C59F4.unk04->unk47C[r7], &UNK_021C59F4.unk04->unk154[param0][r7*stc], stc); + + if (UNK_021C59F4.unk04->unk154[param0][r7*stc] == 0xe) { + st4++; + } + } + + if (st4 == st8) { + return 0; + } + + return 1; +} +#else +THUMB_FUNC asm u32 FUN_0202FE2C(int param0) { + push {r3-r7, lr} + sub sp, #0x10 + str r0, [sp, #0x0] + mov r0, #0x0 + str r0, [sp, #0x4] + bl FUN_02033534 + lsl r0, r0, #0x10 + lsr r0, r0, #0x10 + bl FUN_02031228 + str r0, [sp, #0xc] + bl FUN_02033534 + lsl r0, r0, #0x10 + lsr r0, r0, #0x10 + bl FUN_0202D858 + add r0, r0, #0x1 + mov r7, #0x0 + str r0, [sp, #0x8] + cmp r0, #0x0 + ble _0202FED0 + ldr r0, [sp, #0x0] + mov r1, #0xc0 + add r6, r0, #0x0 + add r4, r7, #0x0 + add r5, r7, #0x0 + mul r6, r1 +_0202FE66: + ldr r0, =UNK_021C59F4 + ldr r1, [r0, #0x4] + ldr r0, =0x0000047C + add r0, r1, r0 + add r0, r0, r4 + bl FUN_0202D4BC + lsl r0, r7, #0x10 + lsr r0, r0, #0x10 + bl FUN_02030E7C + cmp r0, #0x0 + beq _0202FE90 + ldr r0, =UNK_021C59F4 + mov r1, #0xe + ldr r0, [r0, #0x4] + add r0, r6, r0 + add r2, r5, r0 + mov r0, #0x55 + lsl r0, r0, #0x2 + strb r1, [r2, r0] +_0202FE90: + ldr r0, =UNK_021C59F4 + mov r2, #0x55 + ldr r1, [r0, #0x4] + ldr r0, =0x0000047C + lsl r2, r2, #0x2 + add r0, r1, r0 + add r1, r1, r2 + add r1, r1, r6 + ldr r2, [sp, #0xc] + add r0, r0, r4 + add r1, r1, r5 + bl FUN_0202D400 + ldr r0, =UNK_021C59F4 + ldr r0, [r0, #0x4] + add r0, r6, r0 + add r1, r5, r0 + mov r0, #0x55 + lsl r0, r0, #0x2 + ldrb r0, [r1, r0] + cmp r0, #0xe + bne _0202FEC2 + ldr r0, [sp, #0x4] + add r0, r0, #0x1 + str r0, [sp, #0x4] +_0202FEC2: + ldr r0, [sp, #0xc] + add r7, r7, #0x1 + add r5, r5, r0 + ldr r0, [sp, #0x8] + add r4, #0xc + cmp r7, r0 + blt _0202FE66 +_0202FED0: + ldr r1, [sp, #0x4] + ldr r0, [sp, #0x8] + cmp r1, r0 + bne _0202FEDE + add sp, #0x10 + mov r0, #0x0 + pop {r3-r7, pc} +_0202FEDE: + mov r0, #0x1 + add sp, #0x10 + pop {r3-r7, pc} +} +#endif + + +extern void FUN_020304F0(u32 param0); +extern u32 FUN_0202D0D0(void *, u16 param1, u32 param2, void (*param3)(u32)); +extern void FUN_0203026C(u32 param0,u8 *param1, u32 param2); + + +THUMB_FUNC void FUN_0202FEEC() { + if (UNK_021C59F4.unk04 == NULL || FUN_02033534() >= 0x13) { + return; + } + + int st0 = FUN_02031228(FUN_02033534()); + int r6 = FUN_0202D858(FUN_02033534())+1; + + if (UNK_02105D59 == 2 || UNK_02105D59 == 0){ + + UNK_02105D59++; + + if (FUN_0202FA28() == 1) { + FUN_0202FE2C(UNK_021C59F4.unk04->unk680); + } + + if (FUN_0202CBD4() == 4 && FUN_02031280() == 0) { + + if (FUN_0202D0D0(UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680], 0xc0, 0xe, FUN_020304F0) == 0) { + UNK_02105D59--; + } + } + + int i; + if (UNK_02105D59 == 1 || UNK_02105D59 == 3) { + for (i = 0; i < r6; i++) { + if (FUN_02030E7C(i) != 0) { + UNK_021C59F4.unk04->unk638[i]++; + } else if (FUN_02031280() != 0 && i == 0) { + UNK_021C59F4.unk04->unk638[i]++; + } + } + + + FUN_0203026C(0, UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680], 0xc0); + + UNK_021C59F4.unk04->unk680 = 1 - UNK_021C59F4.unk04->unk680; + } + + + + for (i = 0; i < r6; i++) { + if (FUN_02030E7C(i) == 0 && FUN_0202FA28() == 1) { + UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680][i *st0] = 0xff; + } + } + + + if (FUN_0202CBD4() != 4 || FUN_02031280() != 0) { + UNK_02105D59++; + } + } +} + + +extern u32 MOD04_021D79B4(void *param0, u32 param1); +extern void FUN_02030A00(u8 *param0); + + + +THUMB_FUNC void FUN_02030074() { + if (UNK_021C59F4.unk04->unk683 != 0) { + if (FUN_02033534() >= 0x13) { + if (FUN_02030E7C(0) != 0 && MOD04_021D79B4(UNK_021C59F4.unk04->unk154, 0x4c) != 0) { + UNK_021C59F4.unk04->unk683 = 0; + return; + } + } else if (FUN_0202CBD4() == 4 || FUN_02031280() != 0) { + FUN_0202FEEC(); + if (UNK_02105D59 == 2) { + UNK_021C59F4.unk04->unk683 = 0; + return; + } + } + } + + if (FUN_02033534() >= 0x13) { + if (FUN_02030E7C(0) != 0) { + if (UNK_021C59F4.unk04->unk630 != 0) { + if ((int)UNK_021C59F4.unk04->unk638[1] > 3 || (int)UNK_021C59F4.unk04->unk638[0] > 3) { + return; + } + + if (UNK_02105D59 == 4) { + if (FUN_0202FA28() == 1) { + FUN_0202FE2C(0); + } + + UNK_02105D59 = 2; + } + } else { + if (UNK_02105D59 == 4 ) { + if (FUN_0202FA28() == 1) { + if (FUN_0202FE2C(0) == 0) { + return; + } + } + } + + + UNK_02105D59 = 2; + } + + + + if (MOD04_021D79B4(UNK_021C59F4.unk04->unk154, 0x4c) == 0) { + return; + } + + UNK_02105D59 = 4; + UNK_021C59F4.unk04->unk638[0]++; + UNK_021C59F4.unk04->unk638[1]++; + } + } else if (FUN_0202CBD4() == 4 || FUN_02031280() != 0) { + if (UNK_02105D59 == 4) { + for (int r4 = 1; r4 < 8; r4++) + { + if (FUN_02030E7C(r4) != 0) { + if ((int)UNK_021C59F4.unk04->unk638[r4] > 3) { + return; + } + } else if (r4 == 0) { + if (FUN_02031280() != 0) { + if ((int)UNK_021C59F4.unk04->unk638[0] > 3) { + return; + } + } + } + } + + + if (FUN_0202FA28() == 0) { + FUN_02030A00(UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680]); + FUN_02030A00(UNK_021C59F4.unk04->unk154[1-UNK_021C59F4.unk04->unk680]); + } + + + UNK_02105D59 = 0; + FUN_0202FEEC(); + } + } +} + + + +THUMB_FUNC void FUN_02030238(u32 param0, void *param1, u32 param2) { + if (UNK_021C59F4.unk04->unk66F[0] != 0) { + UNK_021C59F4.unk04->unk634--; + UNK_021C59F4.unk04->unk66F[0] = 0; + return; + } + + FUN_0203026C(param0, param1, param2); +} + +extern void FUN_0202D3A4(void *param0, u8 *param1, u32 param2, u32 param3); + + + +THUMB_FUNC void FUN_0203026C(u32 param0, u8 *param1, u32 param2) { + UNK_021C59F4.unk04->unk634--; + if (param1 == 0) { + return; + } + + if (param1[0] == 0xb) { + if (FUN_0202FA28() == 1) { + return; + } + param1++; + } else { + if (FUN_0202FA28() == 0) { + return; + } + } + + + if (UNK_021C59F4.unk04->unk682 != 0) { + if ((param1[0] & 1) != 0) { + return; + } + } + + UNK_021C59F4.unk04->unk682 = 0; + if (FUN_0202FA28() == 1) { + int r6 = FUN_02031228(FUN_02033534()); + int st4 = FUN_0202D858(FUN_02033534())+1; + + int r4 = 0; + while (r4 < st4) { + u32 new; + if (param1[0] == 0xff) { + new = UNK_021C59F4.unk04->unk65C & ~(1<unk65C | (1<unk65C = new; + + if (param1[0] == 0xff) { + param1 += r6; + } else if (param1[0] == 0xe){ + param1 += r6; + } else if (UNK_021C59F4.unk04->unk667[r4] != 0 && (param1[0] & 1) != 0) { + param1 += r6; + } else { + param1++; + FUN_0202D3A4(&UNK_021C59F4.unk04->unk4E8[r4], param1, r6-1, 0x5E6); + + param1 += r6-1; + UNK_021C59F4.unk04->unk667[r4] = 0; + } + + + r4++; + } + + return; + } + + + UNK_021C59F4.unk04->unk65C = param1[1]; + UNK_021C59F4.unk04->unk65C = UNK_021C59F4.unk04->unk65C << 8; + + UNK_021C59F4.unk04->unk65C = UNK_021C59F4.unk04->unk65C + param1[2]; + FUN_0202D3A4(&UNK_021C59F4.unk04->unk470, param1+4, param1[3], 0x5FF); +} + +extern void FUN_020303F4(u32 param0, u8 *param1, u16 param2); + + +THUMB_FUNC void FUN_020303BC(u32 param0, u32 param1, u16 param2) { + if (UNK_021C59F4.unk04->unk66F[param0] != 0) { + + UNK_021C59F4.unk04->unk638[param0]--; + UNK_021C59F4.unk04->unk66F[param0] = 0; + return; + } + + FUN_020303F4(param0, param1, param2); +} + +extern u32 FUN_020307E4(u8 *param0, u32 param1); +extern int FUN_0202D498(void *param0); + + + +THUMB_FUNC void FUN_020303F4(u32 param0, u8 *param1, u16 param2) { + UNK_021C59F4.unk04->unk638[param0]--; + if (param1 == 0) { + return; + } + + if (UNK_021C59F4.unk04->unk667[param0] != 0 && (param1[0] & 1) != 0) { + return; + } + + UNK_021C59F4.unk04->unk667[param0] = 0; + if (FUN_0202FA28() == 1) { + int r6 = FUN_02031228(FUN_02033534()); + FUN_0202D858(FUN_02033534()); + + if ((param1[0] & 2) == 0) { + FUN_0202D3A4(&UNK_021C59F4.unk04->unk47C[param0], param1, r6, 0x65E); + } + + UNK_021C59F4.unk04->unk65F[param0]++; + return; + } + + + FUN_020307E4(param1, param0); + + if ((param1[0] & 2) == 0 && FUN_0202D498(&UNK_021C59F4.unk04->unk4E8[param0]) >= 0xb) { + FUN_0202D3A4(&UNK_021C59F4.unk04->unk4E8[param0], param1 +1, 0xb, 0x66E); + } +} + + +THUMB_FUNC void FUN_020304D4(u32 param0) { + if (param0 != 0) { + UNK_02105D58++; + return; + } + + ErrorHandling(); +} + +THUMB_FUNC void FUN_020304F0(u32 param0) { + if (param0 != 0) { + UNK_02105D59++; + return; + } + + ErrorHandling(); +} + +extern u16 FUN_0202CB8C(); + + +THUMB_FUNC void FUN_0203050C() { + if (UNK_021C59F4.unk04 == 0 || FUN_02033534() >= 0x13) { + return; + } + + int r4 = FUN_02031228(FUN_02033534()); + FUN_0202D858(FUN_02033534()); + + if (FUN_02031280() != 0 && (UNK_02105D58 == 2 || UNK_02105D58 == 0)) { + UNK_02105D58++; + FUN_020304D4(1); + + + FUN_020303F4(0, UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4); + + UNK_021C59F4.unk04->unk67F = 1-UNK_021C59F4.unk04->unk67F; + UNK_021C59F4.unk04->unk634++; + return; + } + + if (FUN_0202CBD4() != 4) { + return; + } + + if (FUN_02030E7C(FUN_02031190()) == 0) { + FUN_02031190(); + return; + } + + if (UNK_02105D58 != 2 && UNK_02105D58 != 0) { + return; + } + + + if (FUN_02031190() != 0) { + UNK_02105D58++; + + + if (FUN_0202D0D0(UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4, 0xe, FUN_020304D4) == 0) { + UNK_02105D58--; + return; + } + + UNK_021C59F4.unk04->unk67F = 1 - UNK_021C59F4.unk04->unk67F; + UNK_021C59F4.unk04->unk634++; + return; + } + + + if ((FUN_0202CB8C() & 0xFFFE) != 0) { + UNK_02105D58++; + FUN_020304D4(1); + + + FUN_020303F4(0, UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4); + + UNK_021C59F4.unk04->unk67F = 1-UNK_021C59F4.unk04->unk67F; + UNK_021C59F4.unk04->unk634++; + } +} + +extern s64 _ll_mul(s64, s64); + +#ifdef NONMATCHING +THUMB_FUNC void FUN_02030674() { + u16 r4 = 0; + if (UNK_021C59F4.unk04->unk62C == 0 || (UNK_021C59F4.unk04->unk628 & 0xf0) == 0) { + return; + } + + if (UNK_021C59F4.unk04->unk62C == 2) { + if ((UNK_021C59F4.unk04->unk628 & 0x20) != 0) { + r4 = r4 | 0x10; + } + + if ((UNK_021C59F4.unk04->unk628 & 0x10) != 0) { + r4 = r4 | 0x20; + } + + if ((UNK_021C59F4.unk04->unk628 & 0x40) != 0) { + r4 = r4 | 0x80; + } + + if ((UNK_021C59F4.unk04->unk628 & 0x80) != 0) { + r4 = r4 | 0x40; + } + } else { + if (UNK_021C59F4.unk04->unk62E != 0) { + r4 = UNK_021C59F4.unk04->unk62E; + UNK_021C59F4.unk04->unk62D--; + + if (UNK_021C59F4.unk04->unk62D < 0) { + UNK_021C59F4.unk04->unk62E = 0; + } + + } else { + UNK_021C59F4.unk04->unk5F8[0] = UNK_021C59F4.unk04->unk5F8[1] * UNK_021C59F4.unk04->unk5F8[0] + UNK_021C59F4.unk04->unk5F8[2]; + + switch ((u32)(UNK_021C59F4.unk04->unk5F8[0] >> 0x3E) | (0 << 2)) { + case 0: + r4 = 0x20; + break; + case 1: + r4 = 0x10; + break; + case 2: + r4 = 0x40; + break; + case 3: + r4 = 0x80; + break; + } + + + UNK_021C59F4.unk04->unk5F8[0] = UNK_021C59F4.unk04->unk5F8[2] + UNK_021C59F4.unk04->unk5F8[1] * UNK_021C59F4.unk04->unk5F8[0]; + UNK_021C59F4.unk04->unk62D = UNK_021C59F4.unk04->unk5F8[0]>>0x3c | (0 << 4); + UNK_021C59F4.unk04->unk62E = r4; + } + } + + + UNK_021C59F4.unk04->unk628 &= ~0xf0; + UNK_021C59F4.unk04->unk628 += r4; +} +#else +THUMB_FUNC asm void FUN_02030674() { + push {r3-r7, lr} + ldr r7, =UNK_021C59F4 + mov r6, #0x0 + ldr r5, [r7, #0x4] + ldr r2, =0x0000062C + add r4, r6, #0x0 + ldrb r0, [r5, r2] + cmp r0, #0x0 + beq _02030690 + sub r1, r2, #0x4 + ldrh r1, [r5, r1] + mov r3, #0xf0 + tst r3, r1 + bne _02030692 +_02030690: + b _02030794 +_02030692: + cmp r0, #0x2 + bne _020306D0 + mov r0, #0x20 + tst r0, r1 + beq _020306A4 + mov r0, #0x10 + orr r0, r6 + lsl r0, r0, #0x10 + lsr r4, r0, #0x10 +_020306A4: + mov r0, #0x10 + tst r0, r1 + beq _020306B2 + mov r0, #0x20 + orr r0, r4 + lsl r0, r0, #0x10 + lsr r4, r0, #0x10 +_020306B2: + mov r0, #0x40 + tst r0, r1 + beq _020306C0 + mov r0, #0x80 + orr r0, r4 + lsl r0, r0, #0x10 + lsr r4, r0, #0x10 +_020306C0: + mov r0, #0x80 + tst r0, r1 + beq _0203077E + mov r0, #0x40 + orr r0, r4 + lsl r0, r0, #0x10 + lsr r4, r0, #0x10 + b _0203077E +_020306D0: + add r0, r2, #0x2 + ldrh r0, [r5, r0] + cmp r0, #0x0 + beq _020306F2 + add r4, r0, #0x0 + add r0, r2, #0x1 + ldrsb r0, [r5, r0] + sub r1, r0, #0x1 + add r0, r2, #0x1 + strb r1, [r5, r0] + ldr r1, [r7, #0x4] + ldrsb r0, [r1, r0] + cmp r0, #0x0 + bge _0203077E + add r0, r2, #0x2 + strh r6, [r1, r0] + b _0203077E +_020306F2: + add r0, r2, #0x0 + sub r0, #0x34 + add r6, r5, r0 + sub r2, #0x34 + ldr r0, [r6, #0x8] + ldr r1, [r6, #0xc] + ldr r2, [r5, r2] + ldr r3, [r6, #0x4] + bl _ll_mul + add r3, r0, #0x0 + add r2, r1, #0x0 + ldr r0, [r6, #0x10] + ldr r1, [r6, #0x14] + add r0, r0, r3 + adc r1, r2 + ldr r2, =0x000005F8 + str r0, [r5, r2] + mov r2, #0x0 + str r1, [r6, #0x4] + lsr r0, r1, #0x1e + lsl r1, r2, #0x2 + orr r1, r0 + cmp r1, #0x3 + bhi _02030746 + add r0, r1, r1 + add r0, pc + ldrh r0, [r0, #0x6] + lsl r0, r0, #0x10 + asr r0, r0, #0x10 + add pc, r0 +_02030730: // jump table (using 16-bit offset) + // huge hack to get the correct jump offset. Is there a way to write constants? + lsl r6, r0, #0x0 // case 0 + lsl r2, r1, #0x0 // case 1 + lsl r6, r1, #0x0 // case 2 + lsl r2, r2, #0x0 // case 3 + + // intended jump offset + // .short _02030738 - _02030730 - 2; case 0 + // .short _0203073C - _02030730 - 2; case 1 + // .short _02030740 - _02030730 - 2; case 2 + // .short _02030744 - _02030730 - 2; case 3 +_02030738: + mov r4, #0x20 + b _02030746 +_0203073C: + mov r4, #0x10 + b _02030746 +_02030740: + mov r4, #0x40 + b _02030746 +_02030744: + mov r4, #0x80 +_02030746: + ldr r0, =UNK_021C59F4 + ldr r5, [r0, #0x4] + ldr r0, =0x000005F8 + add r6, r5, r0 + ldr r0, [r6, #0x8] + ldr r1, [r6, #0xc] + ldr r2, [r6, #0x0] + ldr r3, [r6, #0x4] + bl _ll_mul + ldr r3, [r6, #0x10] + ldr r2, [r6, #0x14] + add r0, r3, r0 + adc r2, r1 + ldr r1, =0x000005F8 + mov r3, #0x0 + str r0, [r5, r1] + str r2, [r6, #0x4] + lsr r0, r2, #0x1c + lsl r2, r3, #0x4 + orr r2, r0 + add r0, r1, #0x0 + add r0, #0x35 + strb r2, [r5, r0] + ldr r0, =UNK_021C59F4 + add r1, #0x36 + ldr r0, [r0, #0x4] + strh r4, [r0, r1] +_0203077E: + ldr r2, =UNK_021C59F4 + ldr r1, =0x00000628 + ldr r5, [r2, #0x4] + mov r0, #0xf0 + ldrh r3, [r5, r1] + bic r3, r0 + strh r3, [r5, r1] + ldr r2, [r2, #0x4] + ldrh r0, [r2, r1] + add r0, r0, r4 + strh r0, [r2, r1] +_02030794: + pop {r3-r7, pc} +} +#endif + + +THUMB_FUNC void FUN_020307A8() { + UNK_021C59F4.unk04->unk62C = 1; +} + + +THUMB_FUNC void FUN_020307BC() { + UNK_021C59F4.unk04->unk62C = 2; +} + + +THUMB_FUNC void FUN_020307D0() { + UNK_021C59F4.unk04->unk62C = 0; +} + + + +THUMB_FUNC u32 FUN_020307E4(u8 *param0, u32 param1) { + UNK_021C59F4.unk04->unk610[param1] = 0; + + u32 r7 = param0[0] & 0x10; + if (r7 == 0x10) { + + + u8 r5 = param0[0] & 0xc; + if (r5 == 0) { + UNK_021C59F4.unk04->unk610[param1] |= 0x40; + } else if (r5 == 4) { + UNK_021C59F4.unk04->unk610[param1] |= 0x80; + } else if (r5 == 8) { + UNK_021C59F4.unk04->unk610[param1] |= 0x20; + } else if (r5 == 0xc) { + UNK_021C59F4.unk04->unk610[param1] |= 0x10; + } + + UNK_021C59F4.unk04->unk620[param1] = (param0[0]>>5) & 0x7; + } + + + return 1; +} + +THUMB_FUNC void FUN_0203086C() { +} + +extern u32 FUN_02030FE0(); + + +THUMB_FUNC u32 FUN_02030870(u8 *param0) { + if (UNK_021C59F4.unk04->unk62A != 0){ + return 0; + } + + if (FUN_02030FE0() == 0) { + return 0; + } + + if (UNK_021C59F4.unk04->unk681 != 0) { + UNK_021C59F4.unk04->unk681--; + } + + if ((UNK_021C59F4.unk04->unk628 & 0x40) != 0) { + param0[0] |= 0x10; + UNK_021C59F4.unk04->unk681 = 8; + } else if ((UNK_021C59F4.unk04->unk628 & 0x80) != 0) { + param0[0] |= 0x14; + UNK_021C59F4.unk04->unk681 = 8; + } else if ((UNK_021C59F4.unk04->unk628 & 0x20) != 0) { + param0[0] |= 0x18; + UNK_021C59F4.unk04->unk681 = 8; + } else if ((UNK_021C59F4.unk04->unk628 & 0x10) != 0) { + param0[0] |= 0x1c; + UNK_021C59F4.unk04->unk681 = 8; + } + + + param0[0] |= UNK_021C59F4.unk04->unk62B<<5; + + return 0; +} + + +extern u32 FUN_0202D4E4(u8 *param0); +extern u32 FUN_0202D760(u8 *param0, int *param1, u32 param2); + + +THUMB_FUNC u32 FUN_02030930(u8 *param0) { + int r5 = FUN_02031228(FUN_02033534()); + FUN_0202D858(FUN_02033534()); + + u8 r0; + if (UNK_021C59F4.unk04->unk684 == 0) { + param0[0] = 0; + } else { + param0[0] = 1; + } + + if (FUN_0202FA28() == 0) { + FUN_02030870(param0); + } + + UNK_021C59F4.unk04->unk684 = 0; + + if (FUN_0202D4E4(UNK_021C59F4.unk04->unk54C) != 0) { + param0[0] |= 2; + if (param0[0] == 2) { + return 0; + } + } else { + int st0[2]; + st0[1] = r5-1; + st0[0] = param0+1; + if (FUN_0202D760(UNK_021C59F4.unk04->unk54C, st0, 1) == 0) { + UNK_021C59F4.unk04->unk684 = 1; + } + + + if (FUN_0202FA28() == 1) { + UNK_021C59F4.unk04->unk65E++; + + param0[0] |= UNK_021C59F4.unk04->unk65E<<4 & 0xf0; + } + } + + return 1; + +} + + +THUMB_FUNC void FUN_02030A00(u8 *param0) { + param0[0] = 0xb; + if (UNK_021C59F4.unk04->unk685 == 0) { + param0[1] = 0; + } else { + param0[1] = 1; + } + + u16 res = FUN_0202CB8C(); + param0[2] = res >>8; + param0[3] = res; + + + int st0[2]; + st0[1] = 0xbb; + st0[0] = param0+5; + if (FUN_0202D760(UNK_021C59F4.unk04->unk56C, st0, 0) != 0) { + UNK_021C59F4.unk04->unk685 = 0; + param0[4] = 0xbb - st0[1]; + + return; + } + + UNK_021C59F4.unk04->unk685 = 1; + param0[4] = 0xbb; +} + +extern u32 FUN_0202D684(u8 *param0, u32 param1, u32 param2, u32 param3, u32 param4, u32 param5); +extern void FUN_02031454(); + +THUMB_FUNC u32 FUN_02030A78(u32 param0, u32 param1, u32 param2) { + if (FUN_02030E7C(FUN_02031190()) == 0 && FUN_02031280() == 0) { + return 0; + } + + if (FUN_0202D684(UNK_021C59F4.unk04->unk54C, param0, param1, param2, 1, 0) != 0) { + return 1; + } + + if (FUN_02033534() == 0xa) { + FUN_02031454(); + } + + return 0; +} + + +THUMB_FUNC u32 FUN_02030ADC(u32 param0, u32 param1, u32 param2) { + if (FUN_02030E7C(FUN_02031190()) == 0 && FUN_02031280() == 0) { + return 0; + } + + if (FUN_0202D684(UNK_021C59F4.unk04->unk54C, param0, param1, param2, 1, 1) != 0) { + return 1; + } + + if (FUN_02033534() == 0xa) { + FUN_02031454(); + } + + return 0; +} + + +THUMB_FUNC u32 FUN_02030B3C(u32 param0, u32 param1, u32 param2) { + if (FUN_02031190() != 0) { + ErrorHandling(); + return 0; + } + + + if (FUN_02030E7C(0) == 0 && FUN_02031280() == 0) { + return 0; + } + + if (FUN_0202FA28() == 1) { + return FUN_02030A78(param0, param1, param2); + } + + if (FUN_0202D684(UNK_021C59F4.unk04->unk56C, param0, param1, param2, 1, 0) != 0) { + return 1; + } + + + if (FUN_02033534() == 0xa) { + FUN_02031454(); + } + + return 0; +} + + + +THUMB_FUNC u32 FUN_02030BC4(u32 param0, u32 param1, u32 param2) { + if (FUN_02031190() != 0) { + FUN_02031454(); + return 0; + } + + if (FUN_02030E7C(0) == 0 && FUN_02031280() == 0) { + return 0; + } + + if (FUN_0202FA28() == 1) { + return FUN_02030ADC(param0, param1, param2); + } + + if (FUN_0202D684(UNK_021C59F4.unk04->unk56C, param0, param1, param2, 1, 1) != 0) { + return 1; + } + + + if (FUN_02033534() == 0xa) { + FUN_02031454(); + } + + return 0; +} + + + +THUMB_FUNC u32 FUN_02030C4C(u32 param0, u32 param1) { + return FUN_02030BC4(param0, param1, 0); +} + + +THUMB_FUNC int FUN_02030C58() { + return FUN_0202D498(&UNK_021C59F4.unk04->unk464); +} + +extern void FUN_0202D934(u32 param0, u32 param1, u32 param2, u32 param3); + +THUMB_FUNC void FUN_02030C70(u32 param0, u32 param1, u32 param2, u32 param3, void *param4) { + FUN_0202D934(param0, param1, param2, param3); + + *(u8 *)(param4+0xa) = 0xee; + *(u16 *)(param4+0x8) = 0xffff; + *(u32 *)(param4+0x4) = 0; + *(u32 *)(param4) = 0; +} + + +extern int FUN_0202D478(s16 *param0); +extern u32 FUN_0202D41C(s16 *param0); +extern s16 FUN_0202D9A0(u32 param0); +extern u32 FUN_0202DA04(u32 param0); +extern u32 FUN_0202DA40(u32 param0, u32 param1, u16 param2); + +struct UnkStruct2 { + u32 unk00; + u32 unk04; + u16 unk08; + u8 unk0a; +}; + + + +THUMB_FUNC void FUN_02030C8C(s16 *param0, u32 param1, u32 param2, u32 param3, struct UnkStruct2 *param4) { + while (FUN_0202D478(param0) != 0) { + + + u32 r7 = param4->unk0a; + if (r7 == 0xee) { + r7 = FUN_0202D41C(param0); + if (r7 == 0xee) { + continue; + } + } + + int st10 = param0[2]; + param4->unk0a = r7; + int r4 = param4->unk08; + if (r4 == 0xffff) { + r4 = FUN_0202D9A0(r7); + + if (UNK_021C59F4.unk04->unk689 != 0) { + return; + } + + if (r4 == 0xffff) { + if (FUN_0202D478(param0) < 1) { + param0[2] = st10; + return; + } + + + r4 = FUN_0202D41C(param0) <<8; + r4 += FUN_0202D41C(param0); + + st10 = param0[2]; + } + + param4->unk08 = r4; + } + + + if (FUN_0202DA04(r7) != 0) { + if (param4->unk04 == 0) { + param4->unk04 = FUN_0202DA40(r7, param1, param4->unk08); + } + + int stc = FUN_0202D400(param0, param2, r4 - param4->unk00); + + if (param4->unk04 != 0) { + MI_CpuCopy8(param2, param4->unk04 + param4->unk00, stc); + } + + + if ((int)(param4->unk00 += stc) < (int)r4) { + continue; + } + + FUN_02030C70(param1, r7, r4, param4->unk04, param4); + } else { + if (FUN_0202D478(param0) >= r4) { + FUN_0202D400(param0, param2, r4); + FUN_02030C70(param1, r7, r4, param2, param4); + } else { + param0[2] = st10; + return; + } + } + + } +} + + + +THUMB_FUNC void FUN_02030DA4() { + if (UNK_021C59F4.unk04 != NULL) { + if (UNK_021C59F4.unk04->unk68B == 0) { + FUN_0202D4BC(&UNK_021C59F4.unk04->unk470); + if (FUN_0202D478(&UNK_021C59F4.unk04->unk470) > 0) { + UNK_021C59F4.unk04->unk470; + + + FUN_02030C8C(&UNK_021C59F4.unk04->unk470, 0, UNK_021C59F4.unk04->unk460, 1, (struct UnkStruct2 *)&UNK_021C59F4.unk04->unk5EC); + } + } + } +} + + +THUMB_FUNC void FUN_02030DFC() { + if (UNK_021C59F4.unk04 != NULL) { + if (UNK_021C59F4.unk04->unk68B == 0) { + int r7 = FUN_0202D858(FUN_02033534()) + 1; + int r4; + for (r4 = 0; r4 < r7; r4++) { + FUN_0202D4BC(&UNK_021C59F4.unk04->unk4E8[r4]); + if (FUN_0202D478((s16 *)&UNK_021C59F4.unk04->unk4E8[r4]) > 0) { + + + FUN_02030C8C((s16 *)&UNK_021C59F4.unk04->unk4E8[r4], r4, UNK_021C59F4.unk04->unk460, 0, (struct UnkStruct2 *)&UNK_021C59F4.unk04->unk58C[r4]); + } + } + } + } +} + +extern u32 MOD04_021D8018(); +extern u32 FUN_02030F40(); + + + +THUMB_FUNC u32 FUN_02030E7C(u16 param0) { + if (UNK_021C59F4.unk04 == NULL) { + return 0; + } + + + if (FUN_02033534() >= 0x13) { + if (UNK_021C59F4.unk04->unk687 != 0 && MOD04_021D8018() != 0xffffffff) { + if (param0 == 0) { + return 1; + } + + if (param0 == 1) { + return 1; + } + } + + return 0; + } + + if (FUN_02030F40() == 0) { + return 0; + } + + if (FUN_0202CBD4() != 4) { + return 0; + } + + if (FUN_02031190() == param0) { + return 1; + } + + if (FUN_02031190() == 0) { + u16 r0 = FUN_0202CB8C(); + + if ((r0 & (1<unk65C & (1<= 0x13) { + return 1; + } + + return FUN_0202EDF8(); +} + + + +THUMB_FUNC void FUN_02030F60(u8 param0) { + UNK_021C59F4.unk04->unk62B = param0; +} + + +THUMB_FUNC u8 FUN_02030F74(u32 param0) { + return UNK_021C59F4.unk04->unk620[param0]; +} + + +THUMB_FUNC u32 FUN_02030F88(u32 param0) { + if (UNK_021C59F4.unk04 == NULL) { + return 0; + } + + u32 ret = UNK_021C59F4.unk04->unk610[param0]; + UNK_021C59F4.unk04->unk610[param0] = 0; + + return ret; +} + +THUMB_FUNC void FUN_02030FA8() { + if (UNK_021C59F4.unk04 != NULL) { + UNK_021C59F4.unk04->unk628 |= 0x8000; + } +} + + +THUMB_FUNC void FUN_02030FC8() { + if (UNK_021C59F4.unk04 != NULL) { + UNK_021C59F4.unk04->unk628 = 0; + } +} + + +THUMB_FUNC u32 FUN_02030FE0() { + if (UNK_021C59F4.unk04 != NULL) { + return UNK_021C59F4.unk04->unk628 & 0x8000; + } + + return 1; +} + + + +THUMB_FUNC void FUN_02031000(u32 param0, u32 param1, u32 param2) { + if (FUN_0202FA28() == 1) { + FUN_0202D684(UNK_021C59F4.unk04->unk54C, param0, param1, param2, 1, 0); + return; + } + + + FUN_0202D684(UNK_021C59F4.unk04->unk56C, param0, param1, param2, 1, 0); + +} + + +THUMB_FUNC void FUN_0203105C(u32 param0, u32 param1, u32 param2) { + FUN_0202D684(UNK_021C59F4.unk04->unk54C, param0, param1, param2, 0, 0); +} + + +extern u32 FUN_020311D0(u32 param0, u8 *param1); + + + +THUMB_FUNC void FUN_02031088() { + if (UNK_021C59F4.unk04 != NULL) { + if (UNK_021C59F4.unk04->unk67B != 1) { + if (UNK_021C59F4.unk04->unk67B != 3) { + return; + } + } else { + u32 res; + if (FUN_0202FA28() == 1) { + res = FUN_020311D0(0xb, &UNK_021C59F4.unk04->unk67C); + } else { + res = FUN_02030BC4(0xb, &UNK_021C59F4.unk04->unk67C, 1); + } + + if (res == 0) { + return; + } + UNK_021C59F4.unk04->unk67B = 2; + return; + + + } + + if (FUN_020311D0(0xc, &UNK_021C59F4.unk04->unk67C) != 0) { + FUN_0202F9E0(UNK_021C59F4.unk04->unk67C); + UNK_021C59F4.unk04->unk67B = 0; + } + + } +} + + +THUMB_FUNC void FUN_0203110C(u32 param0, u32 param1, u8 *param2) { + if (FUN_02031190() == 0) { + UNK_021C59F4.unk04->unk67B = 1; + UNK_021C59F4.unk04->unk67C = param2[0]; + } +} + +THUMB_FUNC void FUN_02031134(u32 param0, u32 param1, u8 *param2) { + if (FUN_02031190() != 0) { + UNK_021C59F4.unk04->unk67C = param2[0]; + UNK_021C59F4.unk04->unk67B = 3; + } +} + + +THUMB_FUNC void FUN_0203115C(u32 param0, u32 param1, u8 *param2) { + if (FUN_02031190() == 0 && UNK_021C59F4.unk04->unk67B == 2) { + FUN_0202F9E0(*param2); + UNK_021C59F4.unk04->unk67B = 0; + } +} + + +extern u16 FUN_0202D19C(); + +THUMB_FUNC u16 FUN_02031190() { + if (UNK_021C59F4.unk04 != NULL) { + if (FUN_02033534() >= 0x13) { + u32 res = MOD04_021D8018(); + if (res != 0xffffffff) { + return res; + } + } else { + if (FUN_02031280() != 0) { + return 0; + } + + return FUN_0202D19C(); + } + } + + return 0; +} + + +THUMB_FUNC u32 FUN_020311D0(u32 param0, u8 *param1) { + return FUN_02030ADC(param0, param1, 0); +} + + +THUMB_FUNC u32 FUN_020311DC(u32 param0) { + return FUN_02030ADC(param0, 0, 0); +} + + +THUMB_FUNC u32 FUN_020311E8() { + return FUN_0202EE24(); +} + + +extern void FUN_020334E8(u32 param0, u32 param1); +extern u32 FUN_0202EE60(); + +THUMB_FUNC u32 FUN_020311F0() { + if (FUN_02031280() != 0) { + return 0; + } + + if (UNK_021C59F4.unk04 != NULL && UNK_021C59F4.unk04->unk689 != 0) { + FUN_020334E8(1, 1); + return 1; + } + + return FUN_0202EE60(); +} + + + +THUMB_FUNC int FUN_02031228(u16 param0) { + if (FUN_0202D858(param0) >= 5) { + return 0xc; + } + + if (FUN_0202FA28() == 0) { + return 0xc; + } + + return 0x26; +} + +THUMB_FUNC u32 FUN_02031248(u32 param0) { + return FUN_0202D858(param0) +1; +} + +extern u32 FUN_0202D884(u16 param0); + + + +THUMB_FUNC u32 FUN_02031258(u32 param0) { + return FUN_0202D884(param0) +1; +} + +THUMB_FUNC void FUN_02031268(u8 param0) { + if (UNK_021C59F4.unk04 != NULL) { + UNK_021C59F4.unk04->unk686 = param0; + } +} + +THUMB_FUNC u8 FUN_02031280() { + if (UNK_021C59F4.unk04 != NULL) { + return UNK_021C59F4.unk04->unk686; + } + + return 0; +} + +extern void FUN_0202F05C(); + +THUMB_FUNC void FUN_0203129C() { + if (FUN_0202F03C() == 0 && FUN_02031190() == 0) { + u32 st0; + FUN_02030C4C(2, &st0); + } + + FUN_0202F05C(); +} + +extern void GF_RTC_CopyDateTime(RTCDate *, RTCTime *); + + +#ifdef NONMATCHING +THUMB_FUNC void FUN_020312BC(u32 param0) { + RTCDate st10; + RTCTime st4; + GF_RTC_CopyDateTime(&st10, &st4); + + gMain.unk2C + st4.second; + u32 r6 = st10.year<<4 + st10.month; + u32 r5 = 0<<4 | st10.year>>0x1c; + st4.second; + + u32 st0 = st10.day; + st4.hour; + st4.minute; + + 0x00000000; + (0x00000000 + r5) <<5; + + +} +#else +THUMB_FUNC asm void FUN_020312BC(u32 param0) { + push {r3-r7, lr} + sub sp, #0x20 + add r4, r0, #0x0 + add r0, sp, #0x10 + add r1, sp, #0x4 + bl GF_RTC_CopyDateTime + ldr r0, =gMain + ldr r6, [sp, #0x10] + mov r5, #0x0 + lsr r7, r6, #0x1c + lsl r5, r5, #0x4 + ldr r1, [sp, #0xc] + ldr r0, [r0, #0x2c] + lsl r6, r6, #0x4 + add r3, r1, r0 + ldr r0, [sp, #0x18] + orr r5, r7 + str r0, [sp, #0x0] + ldr r0, [sp, #0x14] + ldr r1, [sp, #0x4] + add r6, r0, r6 + ldr r0, =0x00000000 + ldr r2, [sp, #0x8] + adc r0, r5 + lsr r5, r6, #0x1b + lsl r0, r0, #0x5 + orr r0, r5 + ldr r5, [sp, #0x0] + lsl r6, r6, #0x5 + add r6, r5, r6 + ldr r5, =0x00000000 + adc r5, r0 + lsr r0, r6, #0x1b + lsl r5, r5, #0x5 + orr r5, r0 + lsl r0, r6, #0x5 + add r6, r1, r0 + ldr r1, =0x00000000 + adc r1, r5 + lsr r0, r6, #0x1a + lsl r1, r1, #0x6 + orr r1, r0 + lsl r0, r6, #0x6 + add r5, r2, r0 + ldr r2, =0x00000000 + adc r2, r1 + lsr r0, r5, #0x1a + lsl r1, r2, #0x6 + orr r1, r0 + lsl r0, r5, #0x6 + add r2, r3, r0 + ldr r0, =0x00000000 + str r2, [r4, #0x0] + adc r0, r1 + str r0, [r4, #0x4] + ldr r1, =0x6C078965 + ldr r0, =0x5D588B65 + str r1, [r4, #0x8] + str r0, [r4, #0xc] + ldr r0, =0x00269EC3 + str r0, [r4, #0x10] + mov r0, #0x0 + str r0, [r4, #0x14] + add sp, #0x20 + pop {r3-r7, pc} +} +#endif + +extern void FUN_0202D830(u8 *param0, u32 param1); + +THUMB_FUNC void FUN_02031354(u32 param0) { + FUN_0202D830(UNK_021C59F4.unk04->unk56C, param0); +} + + +THUMB_FUNC u32 FUN_02031370() { + return FUN_0202D4E4(UNK_021C59F4.unk04->unk56C); +} + +THUMB_FUNC u32 FUN_02031388() { + return FUN_0202D4E4(UNK_021C59F4.unk04->unk54C); +} + +THUMB_FUNC void FUN_020313A0(u8 param0) { + UNK_021C59F4.unk04->unk687 = param0; +} + +THUMB_FUNC void FUN_020313B4(u8 param0, u32 param1) { + if (UNK_021C59F4.unk04 != NULL) { + UNK_021C59F4.unk04->unk677[param1] = param0; + } +} + +THUMB_FUNC u32 FUN_020313CC(u32 param0) { + if (UNK_021C59F4.unk04 != NULL) { + if (UNK_021C59F4.unk04->unk677[param0] != 0xff) { + return UNK_021C59F4.unk04->unk677[param0]; + } + } + + return param0; +} + +extern u32 MOD04_021D8624(); + +THUMB_FUNC u32 FUN_020313EC() { + if (FUN_02033534() < 0x13) { + return 0; + } + + return MOD04_021D8624(); +} + +THUMB_FUNC void FUN_02031400(u32 param0) { + if (FUN_02033534() >= 0x13) { + UNK_021C59F4.unk04->unk630 = param0; + if (param0 != 0) { + UNK_021C59F4.unk04->unk634 = 0; + UNK_021C59F4.unk04->unk638[0] = 0; + UNK_021C59F4.unk04->unk638[1] = 0; + } + } +} + + +THUMB_FUNC u32 FUN_02031438() { + if (UNK_021C59F4.unk04->unk681 != 0) { + return 1; + } + + return 0; +} + + +THUMB_FUNC void FUN_02031454() { + UNK_021C59F4.unk04->unk689 = 1; +} + +THUMB_FUNC void FUN_02031468() { + if (UNK_021C59F4.unk04 != NULL) { + UNK_021C59F4.unk04->unk68A = 1; + } +} \ No newline at end of file diff --git a/arm9/src/unk_0202F150_c.c b/arm9/src/unk_0202F150_c.c deleted file mode 100644 index 162761a8..00000000 --- a/arm9/src/unk_0202F150_c.c +++ /dev/null @@ -1,1290 +0,0 @@ -#include "global.h" -#include "MI_memory.h" -#include "heap.h" -#include "main.h" - -struct -{ - u8 unk00; - struct UnkStruct1 *unk04; -} UNK_021C59F4; - -// struct UnkStruct2 { -// u8 unk00; -// u8 unk01; -// }; - -vu8 UNK_02105D58 = 4; -vu8 UNK_02105D59 = 4; - -extern int FUN_02033534(); -extern int FUN_0202D858(u16 param0); -extern void FUN_02031480(u32 param0); -extern void FUN_0202D7D8(u32 *param0, u32 param1, u32 param2); -extern void FUN_0202F2F0(); -extern void FUN_020312BC(u32 param0); -extern void FUN_0202FB20(); - -extern u32 FUN_0200CA60(void (*param0)(), u32 param1, u32 param2); -extern void FUN_0202D394(u32 param0, u32 param1, u32 param2); - -extern void FUN_0202D804(u32 *param0); -extern u32 FUN_02030E7C(u16 param0); - -struct UnkStruct1 -{ - u8 unk000[2][38]; - // u8 unk026[38]; - u8 unk04c[264]; - u8 unk154[2][192]; - // u8 unk214[192]; - u8 unk2D4[384]; - u32 unk454; - u32 unk458; - u32 unk45C; - u32 unk460; - u32 unk464; - u8 unk468[0x8]; - u32 unk470; - u8 unk474[0x8]; - struct - { - u32 unk00; - u32 unk04; - u32 unk08; - } unk47C[8]; - u32 unk4DC; - u8 unk4E0[0x8]; - struct - { - u32 unk00; - u32 unk04; - u32 unk08; - } unk4E8[8]; - u32 unk548; - u8 unk54C[32]; - u8 unk56C[32]; - struct - { - u32 unk00; - u32 unk04; - u16 unk08; - u8 unk0a; - u8 unk0b; - } unk58C[8]; - u32 unk5EC; - u32 unk5F0; - u16 unk5F4; - u8 unk5F6; - u8 unk5F7; - u32 unk5F8; - u8 unk5FC[0x14]; - u16 unk610[8]; - u8 unk620[0x8]; - u16 unk628; - u8 unk62A[0x2]; - u8 unk62C; - u8 unk62D; - u8 unk62E[0x2]; - u32 unk630; - u32 unk634; - u32 unk638[8]; - u32 unk658; - u16 unk65C; - u8 unk65E; - u8 unk65F[8]; - u8 unk667[8]; - u8 unk66F[8]; - u8 unk677[4]; - u8 unk67B[0x2]; - u8 unk67D; - u8 unk67E; - u8 unk67F; - u8 unk680; - u8 unk681; - u8 unk682; - u8 unk683; - u8 unk684; - u8 unk685; - u8 unk686; - u8 unk687; - u8 unk688; - u8 unk689; - u8 unk68A; - u8 unk68B; -}; - -THUMB_FUNC u32 FUN_0202F150(u32 param0, u32 param1) -{ - u32 r4 = 0; - UNK_021C59F4.unk00 = 0; - if (param0 != 0) - { - u32 res = FUN_0202D858(FUN_02033534()) + 1; - - if (UNK_021C59F4.unk04 != 0) - { - return 1; - } - - FUN_02031480(0xf); - struct UnkStruct1 *ptr = (struct UnkStruct1 *)AllocFromHeap(0xf, 0x68C); - UNK_021C59F4.unk04 = ptr; - MI_CpuFill8(ptr, 0, 0x68C); - - UNK_021C59F4.unk04->unk658 = param1 + 0x40; - UNK_021C59F4.unk04->unk67D = 0; - UNK_021C59F4.unk04->unk67E = 0x1b; - - UNK_021C59F4.unk04->unk45C = AllocFromHeap(0xf, UNK_021C59F4.unk04->unk658 << 1); - - UNK_021C59F4.unk04->unk460 = AllocFromHeap(0xf, UNK_021C59F4.unk04->unk658); - - UNK_021C59F4.unk04->unk458 = AllocFromHeap(0xf, res * UNK_021C59F4.unk04->unk658); - - UNK_021C59F4.unk04->unk454 = AllocFromHeap(0xf, res * UNK_021C59F4.unk04->unk658); - - if (FUN_02033534() == 0xa) - { - FUN_0202D7D8(UNK_021C59F4.unk04->unk54C, 0x64, &UNK_021C59F4.unk04->unk464); - FUN_0202D7D8(UNK_021C59F4.unk04->unk56C, 0x32 << 4, &UNK_021C59F4.unk04->unk4DC); - } - else - { - FUN_0202D7D8(UNK_021C59F4.unk04->unk54C, 0x14, &UNK_021C59F4.unk04->unk464); - FUN_0202D7D8(UNK_021C59F4.unk04->unk56C, 0x1b + 0xfd, &UNK_021C59F4.unk04->unk4DC); - } - } - else - { - - r4 = 1; - if (UNK_021C59F4.unk04 == 0) - { - ErrorHandling(); - } - } - - UNK_021C59F4.unk04->unk65C = 0; - - for (int i = 0; i < 4; i++) - { - UNK_021C59F4.unk04->unk677[i] = 0xff; - } - - if (r4 == 0) - { - FUN_0202F2F0(); - } - - FUN_020312BC(&UNK_021C59F4.unk04->unk5F8); - - if (r4 == 0) - { - u32 res2 = FUN_0200CA60(FUN_0202FB20, 0, 0); - - UNK_021C59F4.unk04->unk548 = res2; - } - - UNK_021C59F4.unk04->unk687 = 0; - - return 1; -} - -THUMB_FUNC void FUN_0202F2F0() -{ - UNK_021C59F4.unk04->unk62C = 0; - UNK_021C59F4.unk04->unk62D = 0; - UNK_021C59F4.unk04->unk67F = 0; - UNK_021C59F4.unk04->unk680 = 0; - - s32 res = FUN_0202D858(FUN_02033534()) + 1; - - MI_CpuFill8(UNK_021C59F4.unk04->unk458, 0, UNK_021C59F4.unk04->unk658 * res); - - int i; - for (i = 0; i < res; i++) - { - FUN_0202D394(&UNK_021C59F4.unk04->unk4E8[i], - UNK_021C59F4.unk04->unk458 + i * UNK_021C59F4.unk04->unk658, - UNK_021C59F4.unk04->unk658); - } - - MI_CpuFill8(UNK_021C59F4.unk04->unk454, 0, UNK_021C59F4.unk04->unk658 * res); - - for (i = 0; i < res; i++) - { - FUN_0202D394(&UNK_021C59F4.unk04->unk47C[i], - UNK_021C59F4.unk04->unk454 + i * UNK_021C59F4.unk04->unk658, - UNK_021C59F4.unk04->unk658); - } - - MI_CpuFill8(&UNK_021C59F4.unk04->unk2D4, 0, 6 << 6); - FUN_0202D394(&UNK_021C59F4.unk04->unk4DC, &UNK_021C59F4.unk04->unk2D4, 6 << 6); - - for (i = 0; i < 0xc0; i++) - { - UNK_021C59F4.unk04->unk154[0][i] = 0xee; - UNK_021C59F4.unk04->unk154[1][i] = 0xee; - } - - MI_CpuFill8(&UNK_021C59F4.unk04->unk04c, 0, 0x42 << 2); - FUN_0202D394(&UNK_021C59F4.unk04->unk464, &UNK_021C59F4.unk04->unk04c, 0x42 << 2); - - UNK_021C59F4.unk04->unk000[0][0] = 0xff; - UNK_021C59F4.unk04->unk000[1][0] = 0xff; - - for (i = 1; i < 0x26; i++) - { - UNK_021C59F4.unk04->unk000[0][i] = 0xee; - UNK_021C59F4.unk04->unk000[1][i] = 0xee; - } - - MI_CpuFill8(UNK_021C59F4.unk04->unk45C, 0, UNK_021C59F4.unk04->unk658 << 1); - - FUN_0202D394( - &UNK_021C59F4.unk04->unk470, UNK_021C59F4.unk04->unk45C, UNK_021C59F4.unk04->unk658 * 2); - - UNK_021C59F4.unk04->unk684 = 0; - UNK_021C59F4.unk04->unk685 = 0; - - for (i = 0; i < 8; i++) - { - UNK_021C59F4.unk04->unk65F[i] = 0; - UNK_021C59F4.unk04->unk667[i] = 1; - UNK_021C59F4.unk04->unk66F[i] = 1; - UNK_021C59F4.unk04->unk610[i] = 0; - - UNK_021C59F4.unk04->unk58C[i].unk0a = 0xee; - UNK_021C59F4.unk04->unk58C[i].unk08 = 0xffff; - UNK_021C59F4.unk04->unk58C[i].unk04 = 0; - UNK_021C59F4.unk04->unk58C[i].unk00 = 0; - - UNK_021C59F4.unk04->unk638[i] = 0; - } - - UNK_021C59F4.unk04->unk634 = 0; - UNK_021C59F4.unk04->unk630 = 1; - UNK_021C59F4.unk04->unk5F6 = 0xee; - UNK_021C59F4.unk04->unk5F4 = 0xffff; - UNK_021C59F4.unk04->unk5F0 = 0; - UNK_021C59F4.unk04->unk5EC = 0; - UNK_021C59F4.unk04->unk682 = 1; - UNK_021C59F4.unk04->unk683 = 1; - - UNK_02105D59 = 4; - UNK_02105D58 = 4; - - FUN_0202D804(UNK_021C59F4.unk04->unk54C); - FUN_0202D804(UNK_021C59F4.unk04->unk56C); - - UNK_021C59F4.unk04->unk688 = 0; -} - -THUMB_FUNC void FUN_0202F5A4() -{ - UNK_021C59F4.unk04->unk62C = 0; - UNK_021C59F4.unk04->unk62D = 0; - - s32 res = FUN_0202D858(FUN_02033534()) + 1; - - MI_CpuFill8(UNK_021C59F4.unk04->unk458, 0, UNK_021C59F4.unk04->unk658 * res); - - int i; - for (i = 0; i < res; i++) - { - FUN_0202D394(&UNK_021C59F4.unk04->unk4E8[i], - UNK_021C59F4.unk04->unk458 + i * UNK_021C59F4.unk04->unk658, - UNK_021C59F4.unk04->unk658); - } - - MI_CpuFill8(UNK_021C59F4.unk04->unk454, 0, UNK_021C59F4.unk04->unk658 * res); - - for (i = 0; i < res; i++) - { - FUN_0202D394(&UNK_021C59F4.unk04->unk47C[i], - UNK_021C59F4.unk04->unk454 + i * UNK_021C59F4.unk04->unk658, - UNK_021C59F4.unk04->unk658); - } - - MI_CpuFill8(&UNK_021C59F4.unk04->unk2D4, 0, 6 << 6); - FUN_0202D394(&UNK_021C59F4.unk04->unk4DC, &UNK_021C59F4.unk04->unk2D4, 6 << 6); - - for (i = 0; i < 0xc0; i++) - { - UNK_021C59F4.unk04->unk154[0][i] = 0xee; - UNK_021C59F4.unk04->unk154[1][i] = 0xee; - } - - MI_CpuFill8(&UNK_021C59F4.unk04->unk04c, 0, 0x42 << 2); - FUN_0202D394(&UNK_021C59F4.unk04->unk464, &UNK_021C59F4.unk04->unk04c, 0x42 << 2); - - UNK_021C59F4.unk04->unk000[0][0] = 0xff; - UNK_021C59F4.unk04->unk000[1][0] = 0xff; - - for (i = 1; i < 0x26; i++) - { - UNK_021C59F4.unk04->unk000[0][i] = 0xee; - UNK_021C59F4.unk04->unk000[1][i] = 0xee; - } - - MI_CpuFill8(UNK_021C59F4.unk04->unk45C, 0, UNK_021C59F4.unk04->unk658 << 1); - FUN_0202D394( - &UNK_021C59F4.unk04->unk470, UNK_021C59F4.unk04->unk45C, UNK_021C59F4.unk04->unk658 * 2); - - UNK_021C59F4.unk04->unk684 = 0; - UNK_021C59F4.unk04->unk685 = 0; - - for (i = 0; i < 8; i++) - { - UNK_021C59F4.unk04->unk65F[i] = 0; - UNK_021C59F4.unk04->unk667[i] = 1; - UNK_021C59F4.unk04->unk66F[i] = 1; - UNK_021C59F4.unk04->unk610[i] = 0; - - UNK_021C59F4.unk04->unk58C[i].unk0a = 0xee; - UNK_021C59F4.unk04->unk58C[i].unk08 = 0xffff; - UNK_021C59F4.unk04->unk58C[i].unk04 = 0; - UNK_021C59F4.unk04->unk58C[i].unk00 = 0; - } - - UNK_021C59F4.unk04->unk630 = 1; - UNK_021C59F4.unk04->unk5F6 = 0xee; - UNK_021C59F4.unk04->unk5F4 = 0xffff; - UNK_021C59F4.unk04->unk5F0 = 0; - UNK_021C59F4.unk04->unk5EC = 0; - UNK_021C59F4.unk04->unk682 = 1; - UNK_021C59F4.unk04->unk683 = 1; - - FUN_0202D804(UNK_021C59F4.unk04->unk54C); - FUN_0202D804(UNK_021C59F4.unk04->unk56C); - - UNK_021C59F4.unk04->unk688 = 0; -} - -THUMB_FUNC void FUN_0202F820(u32 param0) -{ - UNK_021C59F4.unk04->unk65F[param0] = 0; - - UNK_021C59F4.unk04->unk667[param0] = 1; - - UNK_021C59F4.unk04->unk638[param0] = 0; - - UNK_021C59F4.unk04->unk66F[param0] = 1; - - FUN_0202D394(&UNK_021C59F4.unk04->unk47C[param0], - UNK_021C59F4.unk04->unk454 + param0 * UNK_021C59F4.unk04->unk658, - UNK_021C59F4.unk04->unk658); - - FUN_0202D394(&UNK_021C59F4.unk04->unk4E8[param0], - UNK_021C59F4.unk04->unk458 + param0 * UNK_021C59F4.unk04->unk658, - UNK_021C59F4.unk04->unk658); - - UNK_021C59F4.unk04->unk58C[param0].unk0a = 0xee; - UNK_021C59F4.unk04->unk58C[param0].unk08 = 0xffff; - UNK_021C59F4.unk04->unk58C[param0].unk04 = 0; - UNK_021C59F4.unk04->unk58C[param0].unk00 = 0; -} - -extern u32 FUN_02031280(); - -THUMB_FUNC void FUN_0202F8D4() -{ - for (int i = 1; i < 8; i++) - { - if (FUN_02030E7C(i) == 0 && UNK_021C59F4.unk04->unk667[i] == 0 && FUN_02031280() == 0) - { - FUN_0202F820(i); - } - } -} - -THUMB_FUNC void FUN_0202F910(u32 param0) -{ - FUN_0202F820(param0); -} - -extern u32 FUN_0202E5F8(u32 param0, u32 param1, u32 param2); -extern void FUN_0202D330(void (*param0)(u32)); - -THUMB_FUNC u32 FUN_0202F918(u32 param0, u32 param1, u32 param2, u32 param3) -{ - u32 ret = 1; - if (FUN_02033534() < 0x13) - { - ret = FUN_0202E5F8(param0, param1, param3); - FUN_0202D330(FUN_0202F910); - } - - FUN_0202F150(param0, param2); - - return ret; -} - -extern u32 FUN_0202E66C(u32 param0, u32 param1); - -THUMB_FUNC u32 FUN_0202F950(u32 param0, u32 param1, u32 param2) { - u32 ret = 1; - if (FUN_02033534() < 0x13) - { - ret = FUN_0202E66C(param0, param1); - } - - FUN_0202F150(param0, param2); - - UNK_02105D58 = 4; - - return ret; -} - -extern u16 FUN_02031190(); -extern void FUN_02031088(); - - - - - -THUMB_FUNC void FUN_0202F984() { - u32 r4 = 0; - if (FUN_02031190() == 0 ) { - if (UNK_02105D59 != 4) { - return; - } - } else { - if (UNK_02105D58 != 4) { - return; - } - } - - if (UNK_021C59F4.unk04->unk67D == 2) { - UNK_021C59F4.unk04->unk67D = 0; - r4 = 1; - } - - if (UNK_021C59F4.unk04->unk67D == 3) { - UNK_021C59F4.unk04->unk67D = 1; - r4 = 1; - } - - if (r4 != 0) { - FUN_0202F5A4(); - } - FUN_02031088(); -} - - - - -THUMB_FUNC void FUN_0202F9E0(u32 param0) { - u8 r2 = UNK_021C59F4.unk04->unk67D; - if (r2 == 0 && param0 == 1) { - UNK_021C59F4.unk04->unk67D = 3; - } else if (r2 == 1 && param0 == 0) { - UNK_021C59F4.unk04->unk67D = 2; - } -} - - -THUMB_FUNC void FUN_0202FA10() { - FUN_0202F9E0(1); -} - - -THUMB_FUNC void FUN_0202FA1C() { - FUN_0202F9E0(0); -} - - - -THUMB_FUNC u8 FUN_0202FA28() { - u8 ret = UNK_021C59F4.unk04->unk67D; - if (ret == 2){ - return 1; - } else if (ret == 3) { - return 0; - } - - return ret; -} - -THUMB_FUNC u32 FUN_0202FA48() { - if (FUN_0202FA28() == 1) { - return 1; - } - - return 0; -} - -extern void MOD04_021D83C0(); -extern u32 FUN_0202E784(); -extern void FUN_020314D0(); -extern void FUN_0202DBA4(); -extern void FUN_0200CAB4(u32 param0); -extern void FUN_0202D824(u32 *param0); - -THUMB_FUNC void FUN_0202FA5C() { - u32 r4 = 0; - if (UNK_021C59F4.unk04 != 0) { - if (FUN_02033534() >= 0x13) { - MOD04_021D83C0(); - r4 = 1; - } else { - if (FUN_0202E784() != 0) { - r4 = 1; - } - } - } - - if (r4 != 0) { - FUN_020314D0(); - FUN_0202DBA4(); - UNK_021C59F4.unk00 = 0; - - FUN_0200CAB4(UNK_021C59F4.unk04->unk548); - UNK_021C59F4.unk04->unk548 = 0; - FreeToHeap(UNK_021C59F4.unk04->unk45C); - FreeToHeap(UNK_021C59F4.unk04->unk460); - FreeToHeap(UNK_021C59F4.unk04->unk458); - FreeToHeap(UNK_021C59F4.unk04->unk454); - FUN_0202D824(UNK_021C59F4.unk04->unk56C); - FUN_0202D824(UNK_021C59F4.unk04->unk54C); - FreeToHeap(UNK_021C59F4.unk04); - UNK_021C59F4.unk04 = NULL; - } -} - -extern u32 FUN_0202E9E8(u32 param0); - -THUMB_FUNC u32 FUN_0202FB18(u32 param0) { - return FUN_0202E9E8(param0); -} - - -extern void FUN_0203050C(); -extern void FUN_0202FEEC(); -extern u32 FUN_0202F03C(); -extern u32 FUN_0202EE24(); - - - -THUMB_FUNC void FUN_0202FB20() { - if (UNK_021C59F4.unk00 != 0) { - FUN_0203050C(); - if ((FUN_02031190() == 0 && FUN_02030E7C(0) != 0) || FUN_02031280() != 0){ - FUN_0202FEEC(); - } - - UNK_021C59F4.unk00 = 0; - } -} - -THUMB_FUNC void FUN_0202FB58() { - if (FUN_0202F03C() != 0) { - if (FUN_02031190() == 0 ) { - if (FUN_0202EE24() == 0) { - FUN_0202FA5C(); - } - } else { - FUN_0202FA5C(); - } - } -} - -extern void FUN_02031CDC(); -extern void FUN_02030674(); -extern void FUN_0202FCCC(); -extern void FUN_02030DA4(); -extern void FUN_02030074(); -extern void FUN_02030DFC(); -extern void FUN_0202EBD0(u16 param0); -extern void FUN_0202ED70(u32 param0); -extern void FUN_020335F4(u32 param0); -extern void FUN_020315A4(); - - - -THUMB_FUNC u32 FUN_0202FB80() { - FUN_02031CDC(); - - if (UNK_021C59F4.unk04 != NULL) { - if (UNK_021C59F4.unk04->unk68A == 0) { - UNK_021C59F4.unk00 = 0; - FUN_0202F984(); - UNK_021C59F4.unk04->unk628 |= gMain.unk44 & 0x7FFF; - FUN_02030674(); - FUN_0202FCCC(); - - UNK_021C59F4.unk04->unk628 &= 2<<0xe; - if (FUN_0202FA28() == 0) { - FUN_02030DA4(); - } - - if ((FUN_02031190() == 0 && FUN_02030E7C(0) != 0) || FUN_02031280() != 0){ - FUN_02030074(); - } - - if (FUN_02031190() == 0 || FUN_0202FA28() == 1 || FUN_02031280() != 0) { - FUN_02030DFC(); - } - - UNK_021C59F4.unk00 = 1; - } - - - FUN_0202ED70(UNK_021C59F4.unk04->unk65C); - - if (FUN_02031190() == 0) { - FUN_0202F8D4(); - } - - FUN_0202FB58(); - } else { - FUN_0202ED70(0); - } - - - FUN_020335F4(0); - FUN_020315A4(); - - return 1; -} - - -THUMB_FUNC void FUN_0202FC60() { - u8 r4 = UNK_021C59F4.unk00; - - UNK_021C59F4.unk00 = 0; - - if (UNK_021C59F4.unk04 != NULL) { - FUN_0202F2F0(); - } - - UNK_021C59F4.unk00 = r4; -} - - -THUMB_FUNC void FUN_0202FC80() { - u8 r4 = UNK_021C59F4.unk00; - - UNK_021C59F4.unk00 = 0; - - if (UNK_021C59F4.unk04 != NULL) { - UNK_021C59F4.unk04->unk67D = 1; - FUN_0202F2F0(); - } - - UNK_021C59F4.unk00 = r4; -} - - -extern void FUN_0202E538(); - - -THUMB_FUNC void FUN_0202FCA8() { - u8 r4 = UNK_021C59F4.unk00; - - UNK_021C59F4.unk00 = 0; - - if (UNK_021C59F4.unk04 != NULL) { - FUN_0202F2F0(); - FUN_0202E538(); - } - - UNK_021C59F4.unk00 = r4; -} - - -extern u32 MOD04_021D78FC(void *param0, u32 param1); -extern u32 FUN_0202CBD4(); -extern u32 FUN_02030930(void *param0); - - - -THUMB_FUNC void FUN_0202FCCC() { - if (UNK_021C59F4.unk04->unk683 != 0 ) { - if (FUN_02033534() >= 0x13) { - if (UNK_021C59F4.unk04->unk687 == 0 || MOD04_021D78FC(UNK_021C59F4.unk04, 0x26) == 0) { - return; - } - - UNK_021C59F4.unk04->unk683 = 0; - return; - } - - if (FUN_0202CBD4() != 4 || FUN_02030E7C(FUN_02031190()) == 0) { - if (FUN_02031280() == 0) { - return; - } - } - - UNK_02105D58 = 0; - FUN_0203050C(); - if (UNK_02105D58 == 0) { - return; - } - - UNK_021C59F4.unk04->unk683 = 0; - return; - } - - - if (FUN_02033534() >= 0x13) { - if (UNK_021C59F4.unk04->unk687 == 0) { - return; - } - - if (UNK_021C59F4.unk04->unk630 != 0){ - if ((int)UNK_021C59F4.unk04->unk634 > 3) { - return; - } - - if (UNK_02105D58 == 4) { - FUN_02030930(UNK_021C59F4.unk04); - UNK_02105D58 = 2; - } - } else { - if (UNK_02105D58 == 4) { - if (FUN_02030930(UNK_021C59F4.unk04) == 0) { - return; - } - - UNK_02105D58 = 2; - } - } - - - if (MOD04_021D78FC(UNK_021C59F4.unk04, 0x26) == 0) { - return; - } - - UNK_02105D58 = 4; - UNK_021C59F4.unk04->unk634++; - return; - } - - - if (FUN_0202CBD4() != 4 || FUN_02030E7C(FUN_02031190()) == 0) { - if (FUN_02031280() == 0) { - return; - } - } - - if (UNK_02105D58 != 4) { - return; - } - - - - //nonmatching - if ((int)UNK_021C59F4.unk04->unk634 > 3) { - return; - } - - FUN_02030930(&UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F]); - - FUN_02030930(&UNK_021C59F4.unk04->unk000[1-UNK_021C59F4.unk04->unk67F]); - - UNK_02105D58 = 0; - FUN_0203050C(); -} - -extern int FUN_02031228(u16 param0); -extern void FUN_0202D4BC(void *param0); -extern int FUN_0202D400(u32 param0, u32 param1, u32 param2); - - - - - -THUMB_FUNC u32 FUN_0202FE2C(int param0); - -#ifdef NONMATCHING -THUMB_FUNC u32 FUN_0202FE2C(int param0) { - - // these 3 variables are shuffled on the stack, everything else matches - int st4 = 0; - int stc = FUN_02031228(FUN_02033534()); - int st8 = FUN_0202D858(FUN_02033534()) + 1; - - - for (int r7 = 0; r7 < st8 ; r7++) { - - FUN_0202D4BC(&UNK_021C59F4.unk04->unk47C[r7]); - - if (FUN_02030E7C(r7) != 0) { - UNK_021C59F4.unk04->unk154[param0][r7*stc] = 0xe; - } - - FUN_0202D400(&UNK_021C59F4.unk04->unk47C[r7], &UNK_021C59F4.unk04->unk154[param0][r7*stc], stc); - - if (UNK_021C59F4.unk04->unk154[param0][r7*stc] == 0xe) { - st4++; - } - } - - if (st4 == st8) { - return 0; - } - - return 1; -} -#else -THUMB_FUNC asm u32 FUN_0202FE2C(int param0) { - push {r3-r7, lr} - sub sp, #0x10 - str r0, [sp, #0x0] - mov r0, #0x0 - str r0, [sp, #0x4] - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_02031228 - str r0, [sp, #0xc] - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D858 - add r0, r0, #0x1 - mov r7, #0x0 - str r0, [sp, #0x8] - cmp r0, #0x0 - ble _0202FED0 - ldr r0, [sp, #0x0] - mov r1, #0xc0 - add r6, r0, #0x0 - add r4, r7, #0x0 - add r5, r7, #0x0 - mul r6, r1 -_0202FE66: - ldr r0, =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, =0x0000047C - add r0, r1, r0 - add r0, r0, r4 - bl FUN_0202D4BC - lsl r0, r7, #0x10 - lsr r0, r0, #0x10 - bl FUN_02030E7C - cmp r0, #0x0 - beq _0202FE90 - ldr r0, =UNK_021C59F4 - mov r1, #0xe - ldr r0, [r0, #0x4] - add r0, r6, r0 - add r2, r5, r0 - mov r0, #0x55 - lsl r0, r0, #0x2 - strb r1, [r2, r0] -_0202FE90: - ldr r0, =UNK_021C59F4 - mov r2, #0x55 - ldr r1, [r0, #0x4] - ldr r0, =0x0000047C - lsl r2, r2, #0x2 - add r0, r1, r0 - add r1, r1, r2 - add r1, r1, r6 - ldr r2, [sp, #0xc] - add r0, r0, r4 - add r1, r1, r5 - bl FUN_0202D400 - ldr r0, =UNK_021C59F4 - ldr r0, [r0, #0x4] - add r0, r6, r0 - add r1, r5, r0 - mov r0, #0x55 - lsl r0, r0, #0x2 - ldrb r0, [r1, r0] - cmp r0, #0xe - bne _0202FEC2 - ldr r0, [sp, #0x4] - add r0, r0, #0x1 - str r0, [sp, #0x4] -_0202FEC2: - ldr r0, [sp, #0xc] - add r7, r7, #0x1 - add r5, r5, r0 - ldr r0, [sp, #0x8] - add r4, #0xc - cmp r7, r0 - blt _0202FE66 -_0202FED0: - ldr r1, [sp, #0x4] - ldr r0, [sp, #0x8] - cmp r1, r0 - bne _0202FEDE - add sp, #0x10 - mov r0, #0x0 - pop {r3-r7, pc} -_0202FEDE: - mov r0, #0x1 - add sp, #0x10 - pop {r3-r7, pc} -} -#endif - - -extern void FUN_020304F0(u32 param0); -extern u32 FUN_0202D0D0(void *, u16 param1, u32 param2, void (*param3)(u32)); -extern void FUN_0203026C(u32 param0,u8 *param1, u32 param2); - - -THUMB_FUNC void FUN_0202FEEC() { - if (UNK_021C59F4.unk04 == NULL || FUN_02033534() >= 0x13) { - return; - } - - int st0 = FUN_02031228(FUN_02033534()); - int r6 = FUN_0202D858(FUN_02033534())+1; - - if (UNK_02105D59 == 2 || UNK_02105D59 == 0){ - - UNK_02105D59++; - - if (FUN_0202FA28() == 1) { - FUN_0202FE2C(UNK_021C59F4.unk04->unk680); - } - - if (FUN_0202CBD4() == 4 && FUN_02031280() == 0) { - - if (FUN_0202D0D0(UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680], 0xc0, 0xe, FUN_020304F0) == 0) { - UNK_02105D59--; - } - } - - int i; - if (UNK_02105D59 == 1 || UNK_02105D59 == 3) { - for (i = 0; i < r6; i++) { - if (FUN_02030E7C(i) != 0) { - UNK_021C59F4.unk04->unk638[i]++; - } else if (FUN_02031280() != 0 && i == 0) { - UNK_021C59F4.unk04->unk638[i]++; - } - } - - - FUN_0203026C(0, UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680], 0xc0); - - UNK_021C59F4.unk04->unk680 = 1 - UNK_021C59F4.unk04->unk680; - } - - - - for (i = 0; i < r6; i++) { - if (FUN_02030E7C(i) == 0 && FUN_0202FA28() == 1) { - UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680][i *st0] = 0xff; - } - } - - - if (FUN_0202CBD4() != 4 || FUN_02031280() != 0) { - UNK_02105D59++; - } - } -} - - -extern u32 MOD04_021D79B4(void *param0, u32 param1); -extern void FUN_02030A00(void *param0); - - - -THUMB_FUNC void FUN_02030074() { - if (UNK_021C59F4.unk04->unk683 != 0) { - if (FUN_02033534() >= 0x13) { - if (FUN_02030E7C(0) != 0 && MOD04_021D79B4(UNK_021C59F4.unk04->unk154, 0x4c) != 0) { - UNK_021C59F4.unk04->unk683 = 0; - return; - } - } else if (FUN_0202CBD4() == 4 || FUN_02031280() != 0) { - FUN_0202FEEC(); - if (UNK_02105D59 == 2) { - UNK_021C59F4.unk04->unk683 = 0; - return; - } - } - } - - if (FUN_02033534() >= 0x13) { - if (FUN_02030E7C(0) != 0) { - if (UNK_021C59F4.unk04->unk630 != 0) { - if ((int)UNK_021C59F4.unk04->unk638[1] > 3 || (int)UNK_021C59F4.unk04->unk638[0] > 3) { - return; - } - - if (UNK_02105D59 == 4) { - if (FUN_0202FA28() == 1) { - FUN_0202FE2C(0); - } - - UNK_02105D59 = 2; - } - } else { - if (UNK_02105D59 == 4 ) { - if (FUN_0202FA28() == 1) { - if (FUN_0202FE2C(0) == 0) { - return; - } - } - } - - - UNK_02105D59 = 2; - } - - - - if (MOD04_021D79B4(UNK_021C59F4.unk04->unk154, 0x4c) == 0) { - return; - } - - UNK_02105D59 = 4; - UNK_021C59F4.unk04->unk638[0]++; - UNK_021C59F4.unk04->unk638[1]++; - } - } else if (FUN_0202CBD4() == 4 || FUN_02031280() != 0) { - if (UNK_02105D59 == 4) { - for (int r4 = 1; r4 < 8; r4++) - { - if (FUN_02030E7C(r4) != 0) { - if ((int)UNK_021C59F4.unk04->unk638[r4] > 3) { - return; - } - } else if (r4 == 0) { - if (FUN_02031280() != 0) { - if ((int)UNK_021C59F4.unk04->unk638[0] > 3) { - return; - } - } - } - } - - - if (FUN_0202FA28() == 0) { - FUN_02030A00(UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680]); - FUN_02030A00(UNK_021C59F4.unk04->unk154[1-UNK_021C59F4.unk04->unk680]); - } - - - UNK_02105D59 = 0; - FUN_0202FEEC(); - } - } -} - - - -THUMB_FUNC void FUN_02030238(u32 param0, void *param1, u32 param2) { - if (UNK_021C59F4.unk04->unk66F[0] != 0) { - UNK_021C59F4.unk04->unk634--; - UNK_021C59F4.unk04->unk66F[0] = 0; - return; - } - - FUN_0203026C(param0, param1, param2); -} - -extern void FUN_0202D3A4(void *param0, u8 *param1, u32 param2, u32 param3); - - - -THUMB_FUNC void FUN_0203026C(u32 param0, u8 *param1, u32 param2) { - UNK_021C59F4.unk04->unk634--; - if (param1 == 0) { - return; - } - - if (param1[0] == 0xb) { - if (FUN_0202FA28() == 1) { - return; - } - param1++; - } else { - if (FUN_0202FA28() == 0) { - return; - } - } - - - if (UNK_021C59F4.unk04->unk682 != 0) { - if ((param1[0] & 1) != 0) { - return; - } - } - - UNK_021C59F4.unk04->unk682 = 0; - if (FUN_0202FA28() == 1) { - int r6 = FUN_02031228(FUN_02033534()); - int st4 = FUN_0202D858(FUN_02033534())+1; - - int r4 = 0; - while (r4 < st4) { - u32 new; - if (param1[0] == 0xff) { - new = UNK_021C59F4.unk04->unk65C & ~(1<unk65C | (1<unk65C = new; - - if (param1[0] == 0xff) { - param1 += r6; - } else if (param1[0] == 0xe){ - param1 += r6; - } else if (UNK_021C59F4.unk04->unk667[r4] != 0 && (param1[0] & 1) != 0) { - param1 += r6; - } else { - param1++; - FUN_0202D3A4(&UNK_021C59F4.unk04->unk4E8[r4], param1, r6-1, 0x5E6); - - param1 += r6-1; - UNK_021C59F4.unk04->unk667[r4] = 0; - } - - - r4++; - } - - return; - } - - - UNK_021C59F4.unk04->unk65C = param1[1]; - UNK_021C59F4.unk04->unk65C = UNK_021C59F4.unk04->unk65C << 8; - - UNK_021C59F4.unk04->unk65C = UNK_021C59F4.unk04->unk65C + param1[2]; - FUN_0202D3A4(&UNK_021C59F4.unk04->unk470, param1+4, param1[3], 0x5FF); -} - -extern void FUN_020303F4(u32 param0, u8 *param1, u16 param2); - - -THUMB_FUNC void FUN_020303BC(u32 param0, u32 param1, u16 param2) { - if (UNK_021C59F4.unk04->unk66F[param0] != 0) { - - UNK_021C59F4.unk04->unk638[param0]--; - UNK_021C59F4.unk04->unk66F[param0] = 0; - return; - } - - FUN_020303F4(param0, param1, param2); -} - -extern void FUN_020307E4(u8 *param0, u32 param1); -extern int FUN_0202D498(void *param0); - - - -THUMB_FUNC void FUN_020303F4(u32 param0, u8 *param1, u16 param2) { - UNK_021C59F4.unk04->unk638[param0]--; - if (param1 == 0) { - return; - } - - if (UNK_021C59F4.unk04->unk667[param0] != 0 && (param1[0] & 1) != 0) { - return; - } - - UNK_021C59F4.unk04->unk667[param0] = 0; - if (FUN_0202FA28() == 1) { - int r6 = FUN_02031228(FUN_02033534()); - FUN_0202D858(FUN_02033534()); - - if ((param1[0] & 2) == 0) { - FUN_0202D3A4(&UNK_021C59F4.unk04->unk47C[param0], param1, r6, 0x65E); - } - - UNK_021C59F4.unk04->unk65F[param0]++; - return; - } - - - FUN_020307E4(param1, param0); - - if ((param1[0] & 2) == 0 && FUN_0202D498(&UNK_021C59F4.unk04->unk4E8[param0]) >= 0xb) { - FUN_0202D3A4(&UNK_021C59F4.unk04->unk4E8[param0], param1 +1, 0xb, 0x66E); - } -} - - -THUMB_FUNC void FUN_020304D4(u32 param0) { - if (param0 != 0) { - UNK_02105D58++; - return; - } - - ErrorHandling(); -} - -THUMB_FUNC void FUN_020304F0(u32 param0) { - if (param0 != 0) { - UNK_02105D59++; - return; - } - - ErrorHandling(); -} - -extern u16 FUN_0202CB8C(); - - -THUMB_FUNC void FUN_0203050C() { - if (UNK_021C59F4.unk04 == 0 || FUN_02033534() >= 0x13) { - return; - } - - int r4 = FUN_02031228(FUN_02033534()); - FUN_0202D858(FUN_02033534()); - - if (FUN_02031280() != 0 && (UNK_02105D58 == 2 || UNK_02105D58 == 0)) { - UNK_02105D58++; - FUN_020304D4(1); - - - FUN_020303F4(0, UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4); - - UNK_021C59F4.unk04->unk67F = 1-UNK_021C59F4.unk04->unk67F; - UNK_021C59F4.unk04->unk634++; - return; - } - - if (FUN_0202CBD4() != 4) { - return; - } - - if (FUN_02030E7C(FUN_02031190()) == 0) { - FUN_02031190(); - return; - } - - if (UNK_02105D58 != 2 && UNK_02105D58 != 0) { - return; - } - - - if (FUN_02031190() != 0) { - UNK_02105D58++; - - - if (FUN_0202D0D0(UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4, 0xe, FUN_020304D4) == 0) { - UNK_02105D58--; - return; - } - - UNK_021C59F4.unk04->unk67F = 1 - UNK_021C59F4.unk04->unk67F; - UNK_021C59F4.unk04->unk634++; - return; - } - - - if ((FUN_0202CB8C() & 0xFFFE) != 0) { - UNK_02105D58++; - FUN_020304D4(1); - - - FUN_020303F4(0, UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4); - - UNK_021C59F4.unk04->unk67F = 1-UNK_021C59F4.unk04->unk67F; - UNK_021C59F4.unk04->unk634++; - } -} \ No newline at end of file -- cgit v1.2.3 From 8e3505c4162c51c3870fbe371fa46c061e6d8b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 10 Apr 2021 17:47:33 +0200 Subject: headers --- arm9/src/unk_0202F150.c | 2011 ++++++++++++++++++++++++----------------------- 1 file changed, 1034 insertions(+), 977 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_0202F150.c b/arm9/src/unk_0202F150.c index dd86b10d..15a67f8d 100644 --- a/arm9/src/unk_0202F150.c +++ b/arm9/src/unk_0202F150.c @@ -1,16 +1,10 @@ -#include "global.h" -#include "MI_memory.h" -#include "heap.h" -#include "main.h" -#include "RTC_api.h" - +#include "unk_0202F150.h" struct { u8 unk00; struct UnkStruct1 *unk04; } UNK_021C59F4; - vu8 UNK_02105D58 = 4; vu8 UNK_02105D59 = 4; @@ -18,97 +12,9 @@ extern int FUN_02033534(); extern u32 FUN_0202D858(u16 param0); extern void FUN_02031480(u32 param0); extern void FUN_0202D7D8(u32 *param0, u32 param1, u32 param2); -extern void FUN_0202F2F0(); -extern void FUN_020312BC(u32 param0); -extern void FUN_0202FB20(); - extern u32 FUN_0200CA60(void (*param0)(), u32 param1, u32 param2); extern void FUN_0202D394(u32 param0, u32 param1, u32 param2); - extern void FUN_0202D804(u32 *param0); -extern u32 FUN_02030E7C(u16 param0); - -struct UnkStruct1 -{ - u8 unk000[2][38]; - u8 unk04c[264]; - u8 unk154[2][192]; - u8 unk2D4[384]; - u32 unk454; - u32 unk458; - u32 unk45C; - u32 unk460; - u32 unk464; - u8 unk468[0x8]; - u32 unk470; - u8 unk474[0x8]; - struct - { - u32 unk00; - u32 unk04; - u32 unk08; - } unk47C[8]; - u32 unk4DC; - u8 unk4E0[0x8]; - struct - { - u32 unk00; - u32 unk04; - u32 unk08; - } unk4E8[8]; - u32 unk548; - u8 unk54C[32]; - u8 unk56C[32]; - struct - { - u32 unk00; - u32 unk04; - u16 unk08; - u8 unk0a; - u8 unk0b; - } unk58C[8]; - u32 unk5EC; - u32 unk5F0; - u16 unk5F4; - u8 unk5F6; - u8 unk5F7; - s64 unk5F8[3]; - u16 unk610[8]; - u8 unk620[0x8]; - u16 unk628; - u8 unk62A; - u8 unk62B; - u8 unk62C; - s8 unk62D; - u16 unk62E; - u32 unk630; - u32 unk634; - u32 unk638[8]; - u32 unk658; - u16 unk65C; - u8 unk65E; - u8 unk65F[8]; - u8 unk667[8]; - u8 unk66F[8]; - u8 unk677[4]; - u8 unk67B; - u8 unk67C; - u8 unk67D; - u8 unk67E; - u8 unk67F; - u8 unk680; - u8 unk681; - u8 unk682; - u8 unk683; - u8 unk684; - u8 unk685; - u8 unk686; - u8 unk687; - u8 unk688; - u8 unk689; - u8 unk68A; - u8 unk68B; -}; THUMB_FUNC u32 FUN_0202F150(u32 param0, u32 param1) { @@ -382,8 +288,6 @@ THUMB_FUNC void FUN_0202F820(u32 param0) UNK_021C59F4.unk04->unk58C[param0].unk00 = 0; } -extern u8 FUN_02031280(); - THUMB_FUNC void FUN_0202F8D4() { for (int i = 1; i < 8; i++) @@ -419,7 +323,8 @@ THUMB_FUNC u32 FUN_0202F918(u32 param0, u32 param1, u32 param2, u32 param3) extern u32 FUN_0202E66C(u32 param0, u32 param1); -THUMB_FUNC u32 FUN_0202F950(u32 param0, u32 param1, u32 param2) { +THUMB_FUNC u32 FUN_0202F950(u32 param0, u32 param1, u32 param2) +{ u32 ret = 1; if (FUN_02033534() < 0x13) { @@ -430,81 +335,88 @@ THUMB_FUNC u32 FUN_0202F950(u32 param0, u32 param1, u32 param2) { UNK_02105D58 = 4; - return ret; + return ret; } -extern u16 FUN_02031190(); -extern void FUN_02031088(); - - - - - -THUMB_FUNC void FUN_0202F984() { +THUMB_FUNC void FUN_0202F984() +{ u32 r4 = 0; - if (FUN_02031190() == 0 ) { - if (UNK_02105D59 != 4) { + if (FUN_02031190() == 0) + { + if (UNK_02105D59 != 4) + { return; } - } else { - if (UNK_02105D58 != 4) { + } + else + { + if (UNK_02105D58 != 4) + { return; } } - if (UNK_021C59F4.unk04->unk67D == 2) { + if (UNK_021C59F4.unk04->unk67D == 2) + { UNK_021C59F4.unk04->unk67D = 0; r4 = 1; } - if (UNK_021C59F4.unk04->unk67D == 3) { + if (UNK_021C59F4.unk04->unk67D == 3) + { UNK_021C59F4.unk04->unk67D = 1; r4 = 1; } - if (r4 != 0) { + if (r4 != 0) + { FUN_0202F5A4(); } FUN_02031088(); } - - - -THUMB_FUNC void FUN_0202F9E0(u32 param0) { +THUMB_FUNC void FUN_0202F9E0(u32 param0) +{ u8 r2 = UNK_021C59F4.unk04->unk67D; - if (r2 == 0 && param0 == 1) { + if (r2 == 0 && param0 == 1) + { UNK_021C59F4.unk04->unk67D = 3; - } else if (r2 == 1 && param0 == 0) { + } + else if (r2 == 1 && param0 == 0) + { UNK_021C59F4.unk04->unk67D = 2; } } - -THUMB_FUNC void FUN_0202FA10() { +THUMB_FUNC void FUN_0202FA10() +{ FUN_0202F9E0(1); } - -THUMB_FUNC void FUN_0202FA1C() { +THUMB_FUNC void FUN_0202FA1C() +{ FUN_0202F9E0(0); } - - -THUMB_FUNC u8 FUN_0202FA28() { +THUMB_FUNC u8 FUN_0202FA28() +{ u8 ret = UNK_021C59F4.unk04->unk67D; - if (ret == 2){ + if (ret == 2) + { return 1; - } else if (ret == 3) { + } + else if (ret == 3) + { return 0; } return ret; } -THUMB_FUNC u32 FUN_0202FA48() { - if (FUN_0202FA28() == 1) { +THUMB_FUNC u32 FUN_0202FA48() +{ + if (FUN_0202FA28() == 1) + { return 1; } @@ -518,20 +430,27 @@ extern void FUN_0202DBA4(); extern void FUN_0200CAB4(u32 param0); extern void FUN_0202D824(u32 *param0); -THUMB_FUNC void FUN_0202FA5C() { +THUMB_FUNC void FUN_0202FA5C() +{ u32 r4 = 0; - if (UNK_021C59F4.unk04 != 0) { - if (FUN_02033534() >= 0x13) { + if (UNK_021C59F4.unk04 != 0) + { + if (FUN_02033534() >= 0x13) + { MOD04_021D83C0(); r4 = 1; - } else { - if (FUN_0202E784() != 0) { + } + else + { + if (FUN_0202E784() != 0) + { r4 = 1; } } } - if (r4 != 0) { + if (r4 != 0) + { FUN_020314D0(); FUN_0202DBA4(); UNK_021C59F4.unk00 = 0; @@ -551,22 +470,21 @@ THUMB_FUNC void FUN_0202FA5C() { extern u32 FUN_0202E9E8(u32 param0); -THUMB_FUNC u32 FUN_0202FB18(u32 param0) { +THUMB_FUNC u32 FUN_0202FB18(u32 param0) +{ return FUN_0202E9E8(param0); } - -extern void FUN_0203050C(); -extern void FUN_0202FEEC(); extern u32 FUN_0202F03C(); extern u32 FUN_0202EE24(); - - -THUMB_FUNC void FUN_0202FB20() { - if (UNK_021C59F4.unk00 != 0) { +THUMB_FUNC void FUN_0202FB20() +{ + if (UNK_021C59F4.unk00 != 0) + { FUN_0203050C(); - if ((FUN_02031190() == 0 && FUN_02030E7C(0) != 0) || FUN_02031280() != 0){ + if ((FUN_02031190() == 0 && FUN_02030E7C(0) != 0) || FUN_02031280() != 0) + { FUN_0202FEEC(); } @@ -574,97 +492,105 @@ THUMB_FUNC void FUN_0202FB20() { } } -THUMB_FUNC void FUN_0202FB58() { - if (FUN_0202F03C() != 0) { - if (FUN_02031190() == 0 ) { - if (FUN_0202EE24() == 0) { +THUMB_FUNC void FUN_0202FB58() +{ + if (FUN_0202F03C() != 0) + { + if (FUN_02031190() == 0) + { + if (FUN_0202EE24() == 0) + { FUN_0202FA5C(); } - } else { + } + else + { FUN_0202FA5C(); } } } extern void FUN_02031CDC(); -extern void FUN_02030674(); -extern void FUN_0202FCCC(); -extern void FUN_02030DA4(); -extern void FUN_02030074(); -extern void FUN_02030DFC(); extern void FUN_0202EBD0(u16 param0); extern void FUN_0202ED70(u32 param0); extern void FUN_020335F4(u32 param0); extern void FUN_020315A4(); - - -THUMB_FUNC u32 FUN_0202FB80() { +THUMB_FUNC u32 FUN_0202FB80() +{ FUN_02031CDC(); - if (UNK_021C59F4.unk04 != NULL) { - if (UNK_021C59F4.unk04->unk68A == 0) { + if (UNK_021C59F4.unk04 != NULL) + { + if (UNK_021C59F4.unk04->unk68A == 0) + { UNK_021C59F4.unk00 = 0; FUN_0202F984(); UNK_021C59F4.unk04->unk628 |= gMain.unk44 & 0x7FFF; FUN_02030674(); FUN_0202FCCC(); - UNK_021C59F4.unk04->unk628 &= 2<<0xe; - if (FUN_0202FA28() == 0) { + UNK_021C59F4.unk04->unk628 &= 2 << 0xe; + if (FUN_0202FA28() == 0) + { FUN_02030DA4(); } - if ((FUN_02031190() == 0 && FUN_02030E7C(0) != 0) || FUN_02031280() != 0){ + if ((FUN_02031190() == 0 && FUN_02030E7C(0) != 0) || FUN_02031280() != 0) + { FUN_02030074(); } - if (FUN_02031190() == 0 || FUN_0202FA28() == 1 || FUN_02031280() != 0) { + if (FUN_02031190() == 0 || FUN_0202FA28() == 1 || FUN_02031280() != 0) + { FUN_02030DFC(); } UNK_021C59F4.unk00 = 1; } - FUN_0202ED70(UNK_021C59F4.unk04->unk65C); - if (FUN_02031190() == 0) { + if (FUN_02031190() == 0) + { FUN_0202F8D4(); } FUN_0202FB58(); - } else { + } + else + { FUN_0202ED70(0); } - FUN_020335F4(0); FUN_020315A4(); return 1; } - -THUMB_FUNC void FUN_0202FC60() { +THUMB_FUNC void FUN_0202FC60() +{ u8 r4 = UNK_021C59F4.unk00; UNK_021C59F4.unk00 = 0; - if (UNK_021C59F4.unk04 != NULL) { + if (UNK_021C59F4.unk04 != NULL) + { FUN_0202F2F0(); } UNK_021C59F4.unk00 = r4; } - -THUMB_FUNC void FUN_0202FC80() { +THUMB_FUNC void FUN_0202FC80() +{ u8 r4 = UNK_021C59F4.unk00; UNK_021C59F4.unk00 = 0; - if (UNK_021C59F4.unk04 != NULL) { + if (UNK_021C59F4.unk04 != NULL) + { UNK_021C59F4.unk04->unk67D = 1; FUN_0202F2F0(); } @@ -672,16 +598,16 @@ THUMB_FUNC void FUN_0202FC80() { UNK_021C59F4.unk00 = r4; } - extern void FUN_0202E538(); - -THUMB_FUNC void FUN_0202FCA8() { +THUMB_FUNC void FUN_0202FCA8() +{ u8 r4 = UNK_021C59F4.unk00; UNK_021C59F4.unk00 = 0; - if (UNK_021C59F4.unk04 != NULL) { + if (UNK_021C59F4.unk04 != NULL) + { FUN_0202F2F0(); FUN_0202E538(); } @@ -689,17 +615,17 @@ THUMB_FUNC void FUN_0202FCA8() { UNK_021C59F4.unk00 = r4; } - extern u32 MOD04_021D78FC(void *param0, u32 param1); extern u32 FUN_0202CBD4(); -extern u32 FUN_02030930(u8 *param0); - - -THUMB_FUNC void FUN_0202FCCC() { - if (UNK_021C59F4.unk04->unk683 != 0 ) { - if (FUN_02033534() >= 0x13) { - if (UNK_021C59F4.unk04->unk687 == 0 || MOD04_021D78FC(UNK_021C59F4.unk04, 0x26) == 0) { +THUMB_FUNC void FUN_0202FCCC() +{ + if (UNK_021C59F4.unk04->unk683 != 0) + { + if (FUN_02033534() >= 0x13) + { + if (UNK_021C59F4.unk04->unk687 == 0 || MOD04_021D78FC(UNK_021C59F4.unk04, 0x26) == 0) + { return; } @@ -707,15 +633,18 @@ THUMB_FUNC void FUN_0202FCCC() { return; } - if (FUN_0202CBD4() != 4 || FUN_02030E7C(FUN_02031190()) == 0) { - if (FUN_02031280() == 0) { + if (FUN_0202CBD4() != 4 || FUN_02030E7C(FUN_02031190()) == 0) + { + if (FUN_02031280() == 0) + { return; } } UNK_02105D58 = 0; FUN_0203050C(); - if (UNK_02105D58 == 0) { + if (UNK_02105D58 == 0) + { return; } @@ -723,24 +652,32 @@ THUMB_FUNC void FUN_0202FCCC() { return; } - - if (FUN_02033534() >= 0x13) { - if (UNK_021C59F4.unk04->unk687 == 0) { + if (FUN_02033534() >= 0x13) + { + if (UNK_021C59F4.unk04->unk687 == 0) + { return; } - if (UNK_021C59F4.unk04->unk630 != 0){ - if ((int)UNK_021C59F4.unk04->unk634 > 3) { + if (UNK_021C59F4.unk04->unk630 != 0) + { + if ((int)UNK_021C59F4.unk04->unk634 > 3) + { return; } - if (UNK_02105D58 == 4) { + if (UNK_02105D58 == 4) + { FUN_02030930(UNK_021C59F4.unk04->unk000[0]); UNK_02105D58 = 2; } - } else { - if (UNK_02105D58 == 4) { - if (FUN_02030930(UNK_021C59F4.unk04->unk000[0]) == 0) { + } + else + { + if (UNK_02105D58 == 4) + { + if (FUN_02030930(UNK_021C59F4.unk04->unk000[0]) == 0) + { return; } @@ -748,8 +685,8 @@ THUMB_FUNC void FUN_0202FCCC() { } } - - if (MOD04_021D78FC(UNK_021C59F4.unk04, 0x26) == 0) { + if (MOD04_021D78FC(UNK_021C59F4.unk04, 0x26) == 0) + { return; } @@ -758,279 +695,291 @@ THUMB_FUNC void FUN_0202FCCC() { return; } - - if (FUN_0202CBD4() != 4 || FUN_02030E7C(FUN_02031190()) == 0) { - if (FUN_02031280() == 0) { - return; + if (FUN_0202CBD4() != 4 || FUN_02030E7C(FUN_02031190()) == 0) + { + if (FUN_02031280() == 0) + { + return; } } - if (UNK_02105D58 != 4) { + if (UNK_02105D58 != 4) + { return; } - - - //nonmatching - if ((int)UNK_021C59F4.unk04->unk634 > 3) { + // nonmatching + if ((int)UNK_021C59F4.unk04->unk634 > 3) + { return; } FUN_02030930(UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F]); - FUN_02030930(UNK_021C59F4.unk04->unk000[1-UNK_021C59F4.unk04->unk67F]); + FUN_02030930(UNK_021C59F4.unk04->unk000[1 - UNK_021C59F4.unk04->unk67F]); UNK_02105D58 = 0; FUN_0203050C(); } -extern int FUN_02031228(u16 param0); extern void FUN_0202D4BC(void *param0); extern int FUN_0202D400(u32 param0, u32 param1, u32 param2); - - - - -THUMB_FUNC u32 FUN_0202FE2C(int param0); - #ifdef NONMATCHING -THUMB_FUNC u32 FUN_0202FE2C(int param0) { +THUMB_FUNC u32 FUN_0202FE2C(int param0) +{ // these 3 variables are shuffled on the stack, everything else matches int st4 = 0; int stc = FUN_02031228(FUN_02033534()); int st8 = FUN_0202D858(FUN_02033534()) + 1; - - for (int r7 = 0; r7 < st8 ; r7++) { + for (int r7 = 0; r7 < st8; r7++) + { FUN_0202D4BC(&UNK_021C59F4.unk04->unk47C[r7]); - if (FUN_02030E7C(r7) != 0) { - UNK_021C59F4.unk04->unk154[param0][r7*stc] = 0xe; + if (FUN_02030E7C(r7) != 0) + { + UNK_021C59F4.unk04->unk154[param0][r7 * stc] = 0xe; } - FUN_0202D400(&UNK_021C59F4.unk04->unk47C[r7], &UNK_021C59F4.unk04->unk154[param0][r7*stc], stc); + FUN_0202D400( + &UNK_021C59F4.unk04->unk47C[r7], &UNK_021C59F4.unk04->unk154[param0][r7 * stc], stc); - if (UNK_021C59F4.unk04->unk154[param0][r7*stc] == 0xe) { + if (UNK_021C59F4.unk04->unk154[param0][r7 * stc] == 0xe) + { st4++; } } - if (st4 == st8) { + if (st4 == st8) + { return 0; } return 1; } #else -THUMB_FUNC asm u32 FUN_0202FE2C(int param0) { - push {r3-r7, lr} - sub sp, #0x10 - str r0, [sp, #0x0] - mov r0, #0x0 - str r0, [sp, #0x4] - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_02031228 - str r0, [sp, #0xc] - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D858 - add r0, r0, #0x1 - mov r7, #0x0 - str r0, [sp, #0x8] - cmp r0, #0x0 - ble _0202FED0 - ldr r0, [sp, #0x0] - mov r1, #0xc0 - add r6, r0, #0x0 - add r4, r7, #0x0 - add r5, r7, #0x0 - mul r6, r1 -_0202FE66: - ldr r0, =UNK_021C59F4 - ldr r1, [r0, #0x4] - ldr r0, =0x0000047C - add r0, r1, r0 - add r0, r0, r4 - bl FUN_0202D4BC - lsl r0, r7, #0x10 - lsr r0, r0, #0x10 - bl FUN_02030E7C - cmp r0, #0x0 - beq _0202FE90 - ldr r0, =UNK_021C59F4 - mov r1, #0xe - ldr r0, [r0, #0x4] - add r0, r6, r0 - add r2, r5, r0 - mov r0, #0x55 - lsl r0, r0, #0x2 - strb r1, [r2, r0] -_0202FE90: - ldr r0, =UNK_021C59F4 - mov r2, #0x55 - ldr r1, [r0, #0x4] - ldr r0, =0x0000047C - lsl r2, r2, #0x2 - add r0, r1, r0 - add r1, r1, r2 - add r1, r1, r6 - ldr r2, [sp, #0xc] - add r0, r0, r4 - add r1, r1, r5 - bl FUN_0202D400 - ldr r0, =UNK_021C59F4 - ldr r0, [r0, #0x4] - add r0, r6, r0 - add r1, r5, r0 - mov r0, #0x55 - lsl r0, r0, #0x2 - ldrb r0, [r1, r0] - cmp r0, #0xe - bne _0202FEC2 - ldr r0, [sp, #0x4] - add r0, r0, #0x1 - str r0, [sp, #0x4] -_0202FEC2: - ldr r0, [sp, #0xc] - add r7, r7, #0x1 - add r5, r5, r0 - ldr r0, [sp, #0x8] - add r4, #0xc - cmp r7, r0 - blt _0202FE66 -_0202FED0: - ldr r1, [sp, #0x4] - ldr r0, [sp, #0x8] - cmp r1, r0 - bne _0202FEDE - add sp, #0x10 - mov r0, #0x0 - pop {r3-r7, pc} -_0202FEDE: - mov r0, #0x1 - add sp, #0x10 - pop {r3-r7, pc} +THUMB_FUNC asm u32 FUN_0202FE2C(int param0) +{ + push{ r3 - r7, lr } sub sp, #0x10 str r0, [ sp, #0x0 ] mov r0, #0x0 str r0, + [ sp, #0x4 ] bl FUN_02033534 lsl r0, r0, #0x10 lsr r0, r0, #0x10 bl FUN_02031228 str r0, + [ sp, #0xc ] bl FUN_02033534 lsl r0, r0, #0x10 lsr r0, r0, #0x10 bl FUN_0202D858 add r0, r0, + #0x1 mov r7, #0x0 str r0, [ sp, #0x8 ] cmp r0, #0x0 ble _0202FED0 ldr r0, + [ sp, #0x0 ] mov r1, #0xc0 add r6, r0, #0x0 add r4, r7, #0x0 add r5, r7, #0x0 mul r6, + r1 _0202FE66 : ldr r0, + = UNK_021C59F4 ldr r1, + [ r0, #0x4 ] ldr r0, + = 0x0000047C add r0, + r1, + r0 add r0, + r0, + r4 bl FUN_0202D4BC lsl r0, + r7, + #0x10 lsr r0, + r0, + #0x10 bl FUN_02030E7C cmp r0, + #0x0 beq _0202FE90 ldr r0, + = UNK_021C59F4 mov r1, + #0xe ldr r0, + [ r0, #0x4 ] add r0, + r6, + r0 add r2, + r5, + r0 mov r0, + #0x55 lsl r0, + r0, + #0x2 strb r1, + [ r2, r0 ] _0202FE90 : ldr r0, + = UNK_021C59F4 mov r2, + #0x55 ldr r1, + [ r0, #0x4 ] ldr r0, + = 0x0000047C lsl r2, + r2, + #0x2 add r0, + r1, + r0 add r1, + r1, + r2 add r1, + r1, + r6 ldr r2, + [ sp, #0xc ] add r0, + r0, + r4 add r1, + r1, + r5 bl FUN_0202D400 ldr r0, + = UNK_021C59F4 ldr r0, + [ r0, #0x4 ] add r0, + r6, + r0 add r1, + r5, + r0 mov r0, + #0x55 lsl r0, + r0, + #0x2 ldrb r0, + [ r1, r0 ] cmp r0, + #0xe bne _0202FEC2 ldr r0, + [ sp, #0x4 ] add r0, + r0, + #0x1 str r0, + [ sp, #0x4 ] _0202FEC2 : ldr r0, + [ sp, #0xc ] add r7, + r7, + #0x1 add r5, + r5, + r0 ldr r0, + [ sp, #0x8 ] add r4, + #0xc cmp r7, + r0 blt _0202FE66 _0202FED0 + : ldr r1, + [ sp, #0x4 ] ldr r0, + [ sp, #0x8 ] cmp r1, + r0 bne _0202FEDE add sp, + #0x10 mov r0, + #0x0 pop{ r3 - r7, pc } _0202FEDE : mov r0, + #0x1 add sp, + #0x10 pop + { + r3 - r7, pc + } } #endif - -extern void FUN_020304F0(u32 param0); extern u32 FUN_0202D0D0(void *, u16 param1, u32 param2, void (*param3)(u32)); -extern void FUN_0203026C(u32 param0,u8 *param1, u32 param2); - -THUMB_FUNC void FUN_0202FEEC() { - if (UNK_021C59F4.unk04 == NULL || FUN_02033534() >= 0x13) { +THUMB_FUNC void FUN_0202FEEC() +{ + if (UNK_021C59F4.unk04 == NULL || FUN_02033534() >= 0x13) + { return; } int st0 = FUN_02031228(FUN_02033534()); - int r6 = FUN_0202D858(FUN_02033534())+1; + int r6 = FUN_0202D858(FUN_02033534()) + 1; - if (UNK_02105D59 == 2 || UNK_02105D59 == 0){ + if (UNK_02105D59 == 2 || UNK_02105D59 == 0) + { UNK_02105D59++; - if (FUN_0202FA28() == 1) { + if (FUN_0202FA28() == 1) + { FUN_0202FE2C(UNK_021C59F4.unk04->unk680); } - if (FUN_0202CBD4() == 4 && FUN_02031280() == 0) { + if (FUN_0202CBD4() == 4 && FUN_02031280() == 0) + { - if (FUN_0202D0D0(UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680], 0xc0, 0xe, FUN_020304F0) == 0) { + if (FUN_0202D0D0(UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680], + 0xc0, + 0xe, + FUN_020304F0) == 0) + { UNK_02105D59--; } } int i; - if (UNK_02105D59 == 1 || UNK_02105D59 == 3) { - for (i = 0; i < r6; i++) { - if (FUN_02030E7C(i) != 0) { + if (UNK_02105D59 == 1 || UNK_02105D59 == 3) + { + for (i = 0; i < r6; i++) + { + if (FUN_02030E7C(i) != 0) + { UNK_021C59F4.unk04->unk638[i]++; - } else if (FUN_02031280() != 0 && i == 0) { + } + else if (FUN_02031280() != 0 && i == 0) + { UNK_021C59F4.unk04->unk638[i]++; } } - FUN_0203026C(0, UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680], 0xc0); UNK_021C59F4.unk04->unk680 = 1 - UNK_021C59F4.unk04->unk680; } - - - for (i = 0; i < r6; i++) { - if (FUN_02030E7C(i) == 0 && FUN_0202FA28() == 1) { - UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680][i *st0] = 0xff; + for (i = 0; i < r6; i++) + { + if (FUN_02030E7C(i) == 0 && FUN_0202FA28() == 1) + { + UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680][i * st0] = 0xff; } } - - if (FUN_0202CBD4() != 4 || FUN_02031280() != 0) { + if (FUN_0202CBD4() != 4 || FUN_02031280() != 0) + { UNK_02105D59++; } } } - extern u32 MOD04_021D79B4(void *param0, u32 param1); -extern void FUN_02030A00(u8 *param0); - - -THUMB_FUNC void FUN_02030074() { - if (UNK_021C59F4.unk04->unk683 != 0) { - if (FUN_02033534() >= 0x13) { - if (FUN_02030E7C(0) != 0 && MOD04_021D79B4(UNK_021C59F4.unk04->unk154, 0x4c) != 0) { +THUMB_FUNC void FUN_02030074() +{ + if (UNK_021C59F4.unk04->unk683 != 0) + { + if (FUN_02033534() >= 0x13) + { + if (FUN_02030E7C(0) != 0 && MOD04_021D79B4(UNK_021C59F4.unk04->unk154, 0x4c) != 0) + { UNK_021C59F4.unk04->unk683 = 0; return; } - } else if (FUN_0202CBD4() == 4 || FUN_02031280() != 0) { + } + else if (FUN_0202CBD4() == 4 || FUN_02031280() != 0) + { FUN_0202FEEC(); - if (UNK_02105D59 == 2) { + if (UNK_02105D59 == 2) + { UNK_021C59F4.unk04->unk683 = 0; return; } } } - if (FUN_02033534() >= 0x13) { - if (FUN_02030E7C(0) != 0) { - if (UNK_021C59F4.unk04->unk630 != 0) { - if ((int)UNK_021C59F4.unk04->unk638[1] > 3 || (int)UNK_021C59F4.unk04->unk638[0] > 3) { + if (FUN_02033534() >= 0x13) + { + if (FUN_02030E7C(0) != 0) + { + if (UNK_021C59F4.unk04->unk630 != 0) + { + if ((int)UNK_021C59F4.unk04->unk638[1] > 3 || + (int)UNK_021C59F4.unk04->unk638[0] > 3) + { return; } - if (UNK_02105D59 == 4) { - if (FUN_0202FA28() == 1) { + if (UNK_02105D59 == 4) + { + if (FUN_0202FA28() == 1) + { FUN_0202FE2C(0); } UNK_02105D59 = 2; } - } else { - if (UNK_02105D59 == 4 ) { - if (FUN_0202FA28() == 1) { - if (FUN_0202FE2C(0) == 0) { + } + else + { + if (UNK_02105D59 == 4) + { + if (FUN_0202FA28() == 1) + { + if (FUN_0202FE2C(0) == 0) + { return; } } } - UNK_02105D59 = 2; } - - - if (MOD04_021D79B4(UNK_021C59F4.unk04->unk154, 0x4c) == 0) { + if (MOD04_021D79B4(UNK_021C59F4.unk04->unk154, 0x4c) == 0) + { return; } @@ -1038,40 +987,48 @@ THUMB_FUNC void FUN_02030074() { UNK_021C59F4.unk04->unk638[0]++; UNK_021C59F4.unk04->unk638[1]++; } - } else if (FUN_0202CBD4() == 4 || FUN_02031280() != 0) { - if (UNK_02105D59 == 4) { + } + else if (FUN_0202CBD4() == 4 || FUN_02031280() != 0) + { + if (UNK_02105D59 == 4) + { for (int r4 = 1; r4 < 8; r4++) { - if (FUN_02030E7C(r4) != 0) { - if ((int)UNK_021C59F4.unk04->unk638[r4] > 3) { + if (FUN_02030E7C(r4) != 0) + { + if ((int)UNK_021C59F4.unk04->unk638[r4] > 3) + { return; } - } else if (r4 == 0) { - if (FUN_02031280() != 0) { - if ((int)UNK_021C59F4.unk04->unk638[0] > 3) { + } + else if (r4 == 0) + { + if (FUN_02031280() != 0) + { + if ((int)UNK_021C59F4.unk04->unk638[0] > 3) + { return; } } } } - - if (FUN_0202FA28() == 0) { + if (FUN_0202FA28() == 0) + { FUN_02030A00(UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680]); - FUN_02030A00(UNK_021C59F4.unk04->unk154[1-UNK_021C59F4.unk04->unk680]); + FUN_02030A00(UNK_021C59F4.unk04->unk154[1 - UNK_021C59F4.unk04->unk680]); } - UNK_02105D59 = 0; FUN_0202FEEC(); } } } - - -THUMB_FUNC void FUN_02030238(u32 param0, void *param1, u32 param2) { - if (UNK_021C59F4.unk04->unk66F[0] != 0) { +THUMB_FUNC void FUN_02030238(u32 param0, void *param1, u32 param2) +{ + if (UNK_021C59F4.unk04->unk66F[0] != 0) + { UNK_021C59F4.unk04->unk634--; UNK_021C59F4.unk04->unk66F[0] = 0; return; @@ -1082,81 +1039,97 @@ THUMB_FUNC void FUN_02030238(u32 param0, void *param1, u32 param2) { extern void FUN_0202D3A4(void *param0, u8 *param1, u32 param2, u32 param3); - - -THUMB_FUNC void FUN_0203026C(u32 param0, u8 *param1, u32 param2) { +THUMB_FUNC void FUN_0203026C(u32 param0, u8 *param1, u32 param2) +{ UNK_021C59F4.unk04->unk634--; - if (param1 == 0) { + if (param1 == 0) + { return; } - if (param1[0] == 0xb) { - if (FUN_0202FA28() == 1) { + if (param1[0] == 0xb) + { + if (FUN_0202FA28() == 1) + { return; } param1++; - } else { - if (FUN_0202FA28() == 0) { + } + else + { + if (FUN_0202FA28() == 0) + { return; } } - - if (UNK_021C59F4.unk04->unk682 != 0) { - if ((param1[0] & 1) != 0) { + if (UNK_021C59F4.unk04->unk682 != 0) + { + if ((param1[0] & 1) != 0) + { return; } } UNK_021C59F4.unk04->unk682 = 0; - if (FUN_0202FA28() == 1) { + if (FUN_0202FA28() == 1) + { int r6 = FUN_02031228(FUN_02033534()); - int st4 = FUN_0202D858(FUN_02033534())+1; + int st4 = FUN_0202D858(FUN_02033534()) + 1; int r4 = 0; - while (r4 < st4) { + while (r4 < st4) + { u32 new; - if (param1[0] == 0xff) { - new = UNK_021C59F4.unk04->unk65C & ~(1<unk65C | (1<unk65C & ~(1 << r4); + } + else + { + new = UNK_021C59F4.unk04->unk65C | (1 << r4); } UNK_021C59F4.unk04->unk65C = new; - if (param1[0] == 0xff) { + if (param1[0] == 0xff) + { param1 += r6; - } else if (param1[0] == 0xe){ + } + else if (param1[0] == 0xe) + { param1 += r6; - } else if (UNK_021C59F4.unk04->unk667[r4] != 0 && (param1[0] & 1) != 0) { + } + else if (UNK_021C59F4.unk04->unk667[r4] != 0 && (param1[0] & 1) != 0) + { param1 += r6; - } else { + } + else + { param1++; - FUN_0202D3A4(&UNK_021C59F4.unk04->unk4E8[r4], param1, r6-1, 0x5E6); + FUN_0202D3A4(&UNK_021C59F4.unk04->unk4E8[r4], param1, r6 - 1, 0x5E6); - param1 += r6-1; + param1 += r6 - 1; UNK_021C59F4.unk04->unk667[r4] = 0; } - r4++; } return; } - UNK_021C59F4.unk04->unk65C = param1[1]; UNK_021C59F4.unk04->unk65C = UNK_021C59F4.unk04->unk65C << 8; UNK_021C59F4.unk04->unk65C = UNK_021C59F4.unk04->unk65C + param1[2]; - FUN_0202D3A4(&UNK_021C59F4.unk04->unk470, param1+4, param1[3], 0x5FF); + FUN_0202D3A4(&UNK_021C59F4.unk04->unk470, param1 + 4, param1[3], 0x5FF); } -extern void FUN_020303F4(u32 param0, u8 *param1, u16 param2); - -THUMB_FUNC void FUN_020303BC(u32 param0, u32 param1, u16 param2) { - if (UNK_021C59F4.unk04->unk66F[param0] != 0) { +THUMB_FUNC void FUN_020303BC(u32 param0, u32 param1, u16 param2) +{ + if (UNK_021C59F4.unk04->unk66F[param0] != 0) + { UNK_021C59F4.unk04->unk638[param0]--; UNK_021C59F4.unk04->unk66F[param0] = 0; @@ -1166,27 +1139,29 @@ THUMB_FUNC void FUN_020303BC(u32 param0, u32 param1, u16 param2) { FUN_020303F4(param0, param1, param2); } -extern u32 FUN_020307E4(u8 *param0, u32 param1); extern int FUN_0202D498(void *param0); - - -THUMB_FUNC void FUN_020303F4(u32 param0, u8 *param1, u16 param2) { +THUMB_FUNC void FUN_020303F4(u32 param0, u8 *param1, u16 param2) +{ UNK_021C59F4.unk04->unk638[param0]--; - if (param1 == 0) { + if (param1 == 0) + { return; } - if (UNK_021C59F4.unk04->unk667[param0] != 0 && (param1[0] & 1) != 0) { + if (UNK_021C59F4.unk04->unk667[param0] != 0 && (param1[0] & 1) != 0) + { return; } UNK_021C59F4.unk04->unk667[param0] = 0; - if (FUN_0202FA28() == 1) { + if (FUN_0202FA28() == 1) + { int r6 = FUN_02031228(FUN_02033534()); FUN_0202D858(FUN_02033534()); - if ((param1[0] & 2) == 0) { + if ((param1[0] & 2) == 0) + { FUN_0202D3A4(&UNK_021C59F4.unk04->unk47C[param0], param1, r6, 0x65E); } @@ -1194,17 +1169,18 @@ THUMB_FUNC void FUN_020303F4(u32 param0, u8 *param1, u16 param2) { return; } - FUN_020307E4(param1, param0); - if ((param1[0] & 2) == 0 && FUN_0202D498(&UNK_021C59F4.unk04->unk4E8[param0]) >= 0xb) { - FUN_0202D3A4(&UNK_021C59F4.unk04->unk4E8[param0], param1 +1, 0xb, 0x66E); + if ((param1[0] & 2) == 0 && FUN_0202D498(&UNK_021C59F4.unk04->unk4E8[param0]) >= 0xb) + { + FUN_0202D3A4(&UNK_021C59F4.unk04->unk4E8[param0], param1 + 1, 0xb, 0x66E); } } - -THUMB_FUNC void FUN_020304D4(u32 param0) { - if (param0 != 0) { +THUMB_FUNC void FUN_020304D4(u32 param0) +{ + if (param0 != 0) + { UNK_02105D58++; return; } @@ -1212,8 +1188,10 @@ THUMB_FUNC void FUN_020304D4(u32 param0) { ErrorHandling(); } -THUMB_FUNC void FUN_020304F0(u32 param0) { - if (param0 != 0) { +THUMB_FUNC void FUN_020304F0(u32 param0) +{ + if (param0 != 0) + { UNK_02105D59++; return; } @@ -1223,46 +1201,51 @@ THUMB_FUNC void FUN_020304F0(u32 param0) { extern u16 FUN_0202CB8C(); - -THUMB_FUNC void FUN_0203050C() { - if (UNK_021C59F4.unk04 == 0 || FUN_02033534() >= 0x13) { +THUMB_FUNC void FUN_0203050C() +{ + if (UNK_021C59F4.unk04 == 0 || FUN_02033534() >= 0x13) + { return; } int r4 = FUN_02031228(FUN_02033534()); FUN_0202D858(FUN_02033534()); - if (FUN_02031280() != 0 && (UNK_02105D58 == 2 || UNK_02105D58 == 0)) { + if (FUN_02031280() != 0 && (UNK_02105D58 == 2 || UNK_02105D58 == 0)) + { UNK_02105D58++; FUN_020304D4(1); - FUN_020303F4(0, UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4); - UNK_021C59F4.unk04->unk67F = 1-UNK_021C59F4.unk04->unk67F; + UNK_021C59F4.unk04->unk67F = 1 - UNK_021C59F4.unk04->unk67F; UNK_021C59F4.unk04->unk634++; return; } - if (FUN_0202CBD4() != 4) { + if (FUN_0202CBD4() != 4) + { return; } - if (FUN_02030E7C(FUN_02031190()) == 0) { + if (FUN_02030E7C(FUN_02031190()) == 0) + { FUN_02031190(); return; } - if (UNK_02105D58 != 2 && UNK_02105D58 != 0) { + if (UNK_02105D58 != 2 && UNK_02105D58 != 0) + { return; } - - if (FUN_02031190() != 0) { + if (FUN_02031190() != 0) + { UNK_02105D58++; - - if (FUN_0202D0D0(UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4, 0xe, FUN_020304D4) == 0) { + if (FUN_0202D0D0( + UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4, 0xe, FUN_020304D4) == 0) + { UNK_02105D58--; return; } @@ -1272,15 +1255,14 @@ THUMB_FUNC void FUN_0203050C() { return; } - - if ((FUN_0202CB8C() & 0xFFFE) != 0) { + if ((FUN_0202CB8C() & 0xFFFE) != 0) + { UNK_02105D58++; FUN_020304D4(1); - FUN_020303F4(0, UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4); - UNK_021C59F4.unk04->unk67F = 1-UNK_021C59F4.unk04->unk67F; + UNK_021C59F4.unk04->unk67F = 1 - UNK_021C59F4.unk04->unk67F; UNK_021C59F4.unk04->unk634++; } } @@ -1288,382 +1270,424 @@ THUMB_FUNC void FUN_0203050C() { extern s64 _ll_mul(s64, s64); #ifdef NONMATCHING -THUMB_FUNC void FUN_02030674() { +THUMB_FUNC void FUN_02030674() +{ u16 r4 = 0; - if (UNK_021C59F4.unk04->unk62C == 0 || (UNK_021C59F4.unk04->unk628 & 0xf0) == 0) { + if (UNK_021C59F4.unk04->unk62C == 0 || (UNK_021C59F4.unk04->unk628 & 0xf0) == 0) + { return; } - if (UNK_021C59F4.unk04->unk62C == 2) { - if ((UNK_021C59F4.unk04->unk628 & 0x20) != 0) { + if (UNK_021C59F4.unk04->unk62C == 2) + { + if ((UNK_021C59F4.unk04->unk628 & 0x20) != 0) + { r4 = r4 | 0x10; } - if ((UNK_021C59F4.unk04->unk628 & 0x10) != 0) { + if ((UNK_021C59F4.unk04->unk628 & 0x10) != 0) + { r4 = r4 | 0x20; } - if ((UNK_021C59F4.unk04->unk628 & 0x40) != 0) { + if ((UNK_021C59F4.unk04->unk628 & 0x40) != 0) + { r4 = r4 | 0x80; } - if ((UNK_021C59F4.unk04->unk628 & 0x80) != 0) { + if ((UNK_021C59F4.unk04->unk628 & 0x80) != 0) + { r4 = r4 | 0x40; } - } else { - if (UNK_021C59F4.unk04->unk62E != 0) { + } + else + { + if (UNK_021C59F4.unk04->unk62E != 0) + { r4 = UNK_021C59F4.unk04->unk62E; UNK_021C59F4.unk04->unk62D--; - if (UNK_021C59F4.unk04->unk62D < 0) { + if (UNK_021C59F4.unk04->unk62D < 0) + { UNK_021C59F4.unk04->unk62E = 0; } + } + else + { + UNK_021C59F4.unk04->unk5F8[0] = + UNK_021C59F4.unk04->unk5F8[1] * UNK_021C59F4.unk04->unk5F8[0] + + UNK_021C59F4.unk04->unk5F8[2]; - } else { - UNK_021C59F4.unk04->unk5F8[0] = UNK_021C59F4.unk04->unk5F8[1] * UNK_021C59F4.unk04->unk5F8[0] + UNK_021C59F4.unk04->unk5F8[2]; - - switch ((u32)(UNK_021C59F4.unk04->unk5F8[0] >> 0x3E) | (0 << 2)) { - case 0: - r4 = 0x20; + switch ((u32)(UNK_021C59F4.unk04->unk5F8[0] >> 0x3E) | (0 << 2)) + { + case 0: + r4 = 0x20; break; - case 1: - r4 = 0x10; + case 1: + r4 = 0x10; break; - case 2: - r4 = 0x40; + case 2: + r4 = 0x40; break; - case 3: - r4 = 0x80; + case 3: + r4 = 0x80; break; } - - UNK_021C59F4.unk04->unk5F8[0] = UNK_021C59F4.unk04->unk5F8[2] + UNK_021C59F4.unk04->unk5F8[1] * UNK_021C59F4.unk04->unk5F8[0]; - UNK_021C59F4.unk04->unk62D = UNK_021C59F4.unk04->unk5F8[0]>>0x3c | (0 << 4); + UNK_021C59F4.unk04->unk5F8[0] = + UNK_021C59F4.unk04->unk5F8[2] + + UNK_021C59F4.unk04->unk5F8[1] * UNK_021C59F4.unk04->unk5F8[0]; + UNK_021C59F4.unk04->unk62D = UNK_021C59F4.unk04->unk5F8[0] >> 0x3c | (0 << 4); UNK_021C59F4.unk04->unk62E = r4; } } - UNK_021C59F4.unk04->unk628 &= ~0xf0; UNK_021C59F4.unk04->unk628 += r4; } #else -THUMB_FUNC asm void FUN_02030674() { - push {r3-r7, lr} - ldr r7, =UNK_021C59F4 - mov r6, #0x0 - ldr r5, [r7, #0x4] - ldr r2, =0x0000062C - add r4, r6, #0x0 - ldrb r0, [r5, r2] - cmp r0, #0x0 - beq _02030690 - sub r1, r2, #0x4 - ldrh r1, [r5, r1] - mov r3, #0xf0 - tst r3, r1 - bne _02030692 -_02030690: - b _02030794 -_02030692: - cmp r0, #0x2 - bne _020306D0 - mov r0, #0x20 - tst r0, r1 - beq _020306A4 - mov r0, #0x10 - orr r0, r6 - lsl r0, r0, #0x10 - lsr r4, r0, #0x10 -_020306A4: - mov r0, #0x10 - tst r0, r1 - beq _020306B2 - mov r0, #0x20 - orr r0, r4 - lsl r0, r0, #0x10 - lsr r4, r0, #0x10 -_020306B2: - mov r0, #0x40 - tst r0, r1 - beq _020306C0 - mov r0, #0x80 - orr r0, r4 - lsl r0, r0, #0x10 - lsr r4, r0, #0x10 -_020306C0: - mov r0, #0x80 - tst r0, r1 - beq _0203077E - mov r0, #0x40 - orr r0, r4 - lsl r0, r0, #0x10 - lsr r4, r0, #0x10 - b _0203077E -_020306D0: - add r0, r2, #0x2 - ldrh r0, [r5, r0] - cmp r0, #0x0 - beq _020306F2 - add r4, r0, #0x0 - add r0, r2, #0x1 - ldrsb r0, [r5, r0] - sub r1, r0, #0x1 - add r0, r2, #0x1 - strb r1, [r5, r0] - ldr r1, [r7, #0x4] - ldrsb r0, [r1, r0] - cmp r0, #0x0 - bge _0203077E - add r0, r2, #0x2 - strh r6, [r1, r0] - b _0203077E -_020306F2: - add r0, r2, #0x0 - sub r0, #0x34 - add r6, r5, r0 - sub r2, #0x34 - ldr r0, [r6, #0x8] - ldr r1, [r6, #0xc] - ldr r2, [r5, r2] - ldr r3, [r6, #0x4] - bl _ll_mul - add r3, r0, #0x0 - add r2, r1, #0x0 - ldr r0, [r6, #0x10] - ldr r1, [r6, #0x14] - add r0, r0, r3 - adc r1, r2 - ldr r2, =0x000005F8 - str r0, [r5, r2] - mov r2, #0x0 - str r1, [r6, #0x4] - lsr r0, r1, #0x1e - lsl r1, r2, #0x2 - orr r1, r0 - cmp r1, #0x3 - bhi _02030746 - add r0, r1, r1 - add r0, pc - ldrh r0, [r0, #0x6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_02030730: // jump table (using 16-bit offset) - // huge hack to get the correct jump offset. Is there a way to write constants? - lsl r6, r0, #0x0 // case 0 - lsl r2, r1, #0x0 // case 1 - lsl r6, r1, #0x0 // case 2 - lsl r2, r2, #0x0 // case 3 - - // intended jump offset - // .short _02030738 - _02030730 - 2; case 0 - // .short _0203073C - _02030730 - 2; case 1 - // .short _02030740 - _02030730 - 2; case 2 - // .short _02030744 - _02030730 - 2; case 3 -_02030738: - mov r4, #0x20 - b _02030746 -_0203073C: - mov r4, #0x10 - b _02030746 -_02030740: - mov r4, #0x40 - b _02030746 -_02030744: - mov r4, #0x80 -_02030746: - ldr r0, =UNK_021C59F4 - ldr r5, [r0, #0x4] - ldr r0, =0x000005F8 - add r6, r5, r0 - ldr r0, [r6, #0x8] - ldr r1, [r6, #0xc] - ldr r2, [r6, #0x0] - ldr r3, [r6, #0x4] - bl _ll_mul - ldr r3, [r6, #0x10] - ldr r2, [r6, #0x14] - add r0, r3, r0 - adc r2, r1 - ldr r1, =0x000005F8 - mov r3, #0x0 - str r0, [r5, r1] - str r2, [r6, #0x4] - lsr r0, r2, #0x1c - lsl r2, r3, #0x4 - orr r2, r0 - add r0, r1, #0x0 - add r0, #0x35 - strb r2, [r5, r0] - ldr r0, =UNK_021C59F4 - add r1, #0x36 - ldr r0, [r0, #0x4] - strh r4, [r0, r1] -_0203077E: - ldr r2, =UNK_021C59F4 - ldr r1, =0x00000628 - ldr r5, [r2, #0x4] - mov r0, #0xf0 - ldrh r3, [r5, r1] - bic r3, r0 - strh r3, [r5, r1] - ldr r2, [r2, #0x4] - ldrh r0, [r2, r1] - add r0, r0, r4 - strh r0, [r2, r1] -_02030794: - pop {r3-r7, pc} +THUMB_FUNC asm void FUN_02030674() +{ + push{ r3 - r7, lr } ldr r7, = UNK_021C59F4 mov r6, #0x0 ldr r5, [ r7, #0x4 ] ldr r2, + = 0x0000062C add r4, r6, #0x0 ldrb r0, [ r5, r2 ] cmp r0, + #0x0 beq _02030690 sub r1, r2, #0x4 ldrh r1, [ r5, r1 ] mov r3, + #0xf0 tst r3, + r1 bne _02030692 _02030690 : b _02030794 _02030692 : cmp r0, + #0x2 bne _020306D0 mov r0, + #0x20 tst r0, + r1 beq _020306A4 mov r0, + #0x10 orr r0, + r6 lsl r0, + r0, + #0x10 lsr r4, + r0, + #0x10 _020306A4 : mov r0, + #0x10 tst r0, + r1 beq _020306B2 mov r0, + #0x20 orr r0, + r4 lsl r0, + r0, + #0x10 lsr r4, + r0, + #0x10 _020306B2 : mov r0, + #0x40 tst r0, + r1 beq _020306C0 mov r0, + #0x80 orr r0, + r4 lsl r0, + r0, + #0x10 lsr r4, + r0, + #0x10 _020306C0 : mov r0, + #0x80 tst r0, + r1 beq _0203077E mov r0, + #0x40 orr r0, + r4 lsl r0, + r0, + #0x10 lsr r4, + r0, + #0x10 b _0203077E _020306D0 : add r0, + r2, + #0x2 ldrh r0, + [ r5, r0 ] cmp r0, + #0x0 beq _020306F2 add r4, + r0, + #0x0 add r0, + r2, + #0x1 ldrsb r0, + [ r5, r0 ] sub r1, + r0, + #0x1 add r0, + r2, + #0x1 strb r1, + [ r5, r0 ] ldr r1, + [ r7, #0x4 ] ldrsb r0, + [ r1, r0 ] cmp r0, + #0x0 bge _0203077E add r0, + r2, + #0x2 strh r6, + [ r1, r0 ] b _0203077E _020306F2 : add r0, + r2, + #0x0 sub r0, + #0x34 add r6, + r5, + r0 sub r2, + #0x34 ldr r0, + [ r6, #0x8 ] ldr r1, + [ r6, #0xc ] ldr r2, + [ r5, r2 ] ldr r3, + [ r6, #0x4 ] bl _ll_mul add r3, + r0, + #0x0 add r2, + r1, + #0x0 ldr r0, + [ r6, #0x10 ] ldr r1, + [ r6, #0x14 ] add r0, + r0, + r3 adc r1, + r2 ldr r2, + = 0x000005F8 str r0, + [ r5, r2 ] mov r2, + #0x0 str r1, + [ r6, #0x4 ] lsr r0, + r1, + #0x1e lsl r1, + r2, + #0x2 orr r1, + r0 cmp r1, + #0x3 bhi _02030746 add r0, + r1, + r1 add r0, + pc ldrh r0, + [ r0, #0x6 ] lsl r0, + r0, + #0x10 asr r0, + r0, + #0x10 add pc, + r0 _02030730 + : // jump table (using 16-bit offset) + // huge hack to get the correct jump offset. Is there a way to write constants? + lsl r6, + r0, + #0x0 // case 0 + lsl r2, + r1, + #0x0 // case 1 + lsl r6, + r1, + #0x0 // case 2 + lsl r2, + r2, + #0x0 // case 3 + + // intended jump offset + // .short _02030738 - _02030730 - 2; case 0 + // .short _0203073C - _02030730 - 2; case 1 + // .short _02030740 - _02030730 - 2; case 2 + // .short _02030744 - _02030730 - 2; case 3 + _02030738 : mov r4, + #0x20 b _02030746 _0203073C : mov r4, + #0x10 b _02030746 _02030740 : mov r4, + #0x40 b _02030746 _02030744 : mov r4, + #0x80 _02030746 : ldr r0, + = UNK_021C59F4 ldr r5, + [ r0, #0x4 ] ldr r0, + = 0x000005F8 add r6, + r5, + r0 ldr r0, + [ r6, #0x8 ] ldr r1, + [ r6, #0xc ] ldr r2, + [ r6, #0x0 ] ldr r3, + [ r6, #0x4 ] bl _ll_mul ldr r3, + [ r6, #0x10 ] ldr r2, + [ r6, #0x14 ] add r0, + r3, + r0 adc r2, + r1 ldr r1, + = 0x000005F8 mov r3, + #0x0 str r0, + [ r5, r1 ] str r2, + [ r6, #0x4 ] lsr r0, + r2, + #0x1c lsl r2, + r3, + #0x4 orr r2, + r0 add r0, + r1, + #0x0 add r0, + #0x35 strb r2, + [ r5, r0 ] ldr r0, + = UNK_021C59F4 add r1, + #0x36 ldr r0, + [ r0, #0x4 ] strh r4, + [ r0, r1 ] _0203077E : ldr r2, + = UNK_021C59F4 ldr r1, + = 0x00000628 ldr r5, + [ r2, #0x4 ] mov r0, + #0xf0 ldrh r3, + [ r5, r1 ] bic r3, + r0 strh r3, + [ r5, r1 ] ldr r2, + [ r2, #0x4 ] ldrh r0, + [ r2, r1 ] add r0, + r0, + r4 strh r0, + [ r2, r1 ] _02030794 : pop + { + r3 - r7, pc + } } #endif - -THUMB_FUNC void FUN_020307A8() { +THUMB_FUNC void FUN_020307A8() +{ UNK_021C59F4.unk04->unk62C = 1; } - -THUMB_FUNC void FUN_020307BC() { +THUMB_FUNC void FUN_020307BC() +{ UNK_021C59F4.unk04->unk62C = 2; } - -THUMB_FUNC void FUN_020307D0() { +THUMB_FUNC void FUN_020307D0() +{ UNK_021C59F4.unk04->unk62C = 0; } - - -THUMB_FUNC u32 FUN_020307E4(u8 *param0, u32 param1) { +THUMB_FUNC u32 FUN_020307E4(u8 *param0, u32 param1) +{ UNK_021C59F4.unk04->unk610[param1] = 0; u32 r7 = param0[0] & 0x10; - if (r7 == 0x10) { - + if (r7 == 0x10) + { u8 r5 = param0[0] & 0xc; - if (r5 == 0) { + if (r5 == 0) + { UNK_021C59F4.unk04->unk610[param1] |= 0x40; - } else if (r5 == 4) { + } + else if (r5 == 4) + { UNK_021C59F4.unk04->unk610[param1] |= 0x80; - } else if (r5 == 8) { + } + else if (r5 == 8) + { UNK_021C59F4.unk04->unk610[param1] |= 0x20; - } else if (r5 == 0xc) { + } + else if (r5 == 0xc) + { UNK_021C59F4.unk04->unk610[param1] |= 0x10; } - UNK_021C59F4.unk04->unk620[param1] = (param0[0]>>5) & 0x7; + UNK_021C59F4.unk04->unk620[param1] = (param0[0] >> 5) & 0x7; } - return 1; } -THUMB_FUNC void FUN_0203086C() { +THUMB_FUNC void FUN_0203086C() +{ } -extern u32 FUN_02030FE0(); - -THUMB_FUNC u32 FUN_02030870(u8 *param0) { - if (UNK_021C59F4.unk04->unk62A != 0){ +THUMB_FUNC u32 FUN_02030870(u8 *param0) +{ + if (UNK_021C59F4.unk04->unk62A != 0) + { return 0; } - if (FUN_02030FE0() == 0) { + if (FUN_02030FE0() == 0) + { return 0; } - if (UNK_021C59F4.unk04->unk681 != 0) { + if (UNK_021C59F4.unk04->unk681 != 0) + { UNK_021C59F4.unk04->unk681--; } - if ((UNK_021C59F4.unk04->unk628 & 0x40) != 0) { + if ((UNK_021C59F4.unk04->unk628 & 0x40) != 0) + { param0[0] |= 0x10; UNK_021C59F4.unk04->unk681 = 8; - } else if ((UNK_021C59F4.unk04->unk628 & 0x80) != 0) { + } + else if ((UNK_021C59F4.unk04->unk628 & 0x80) != 0) + { param0[0] |= 0x14; UNK_021C59F4.unk04->unk681 = 8; - } else if ((UNK_021C59F4.unk04->unk628 & 0x20) != 0) { + } + else if ((UNK_021C59F4.unk04->unk628 & 0x20) != 0) + { param0[0] |= 0x18; UNK_021C59F4.unk04->unk681 = 8; - } else if ((UNK_021C59F4.unk04->unk628 & 0x10) != 0) { + } + else if ((UNK_021C59F4.unk04->unk628 & 0x10) != 0) + { param0[0] |= 0x1c; UNK_021C59F4.unk04->unk681 = 8; } - - param0[0] |= UNK_021C59F4.unk04->unk62B<<5; + param0[0] |= UNK_021C59F4.unk04->unk62B << 5; return 0; } - extern u32 FUN_0202D4E4(u8 *param0); extern u32 FUN_0202D760(u8 *param0, int *param1, u32 param2); - -THUMB_FUNC u32 FUN_02030930(u8 *param0) { +THUMB_FUNC u32 FUN_02030930(u8 *param0) +{ int r5 = FUN_02031228(FUN_02033534()); FUN_0202D858(FUN_02033534()); u8 r0; - if (UNK_021C59F4.unk04->unk684 == 0) { + if (UNK_021C59F4.unk04->unk684 == 0) + { param0[0] = 0; - } else { + } + else + { param0[0] = 1; } - if (FUN_0202FA28() == 0) { + if (FUN_0202FA28() == 0) + { FUN_02030870(param0); } UNK_021C59F4.unk04->unk684 = 0; - if (FUN_0202D4E4(UNK_021C59F4.unk04->unk54C) != 0) { + if (FUN_0202D4E4(UNK_021C59F4.unk04->unk54C) != 0) + { param0[0] |= 2; - if (param0[0] == 2) { + if (param0[0] == 2) + { return 0; } - } else { + } + else + { int st0[2]; - st0[1] = r5-1; - st0[0] = param0+1; - if (FUN_0202D760(UNK_021C59F4.unk04->unk54C, st0, 1) == 0) { + st0[1] = r5 - 1; + st0[0] = param0 + 1; + if (FUN_0202D760(UNK_021C59F4.unk04->unk54C, st0, 1) == 0) + { UNK_021C59F4.unk04->unk684 = 1; } - - if (FUN_0202FA28() == 1) { + if (FUN_0202FA28() == 1) + { UNK_021C59F4.unk04->unk65E++; - param0[0] |= UNK_021C59F4.unk04->unk65E<<4 & 0xf0; + param0[0] |= UNK_021C59F4.unk04->unk65E << 4 & 0xf0; } } return 1; - } - -THUMB_FUNC void FUN_02030A00(u8 *param0) { +THUMB_FUNC void FUN_02030A00(u8 *param0) +{ param0[0] = 0xb; - if (UNK_021C59F4.unk04->unk685 == 0) { + if (UNK_021C59F4.unk04->unk685 == 0) + { param0[1] = 0; - } else { + } + else + { param0[1] = 1; } u16 res = FUN_0202CB8C(); - param0[2] = res >>8; + param0[2] = res >> 8; param0[3] = res; - int st0[2]; st0[1] = 0xbb; - st0[0] = param0+5; - if (FUN_0202D760(UNK_021C59F4.unk04->unk56C, st0, 0) != 0) { + st0[0] = param0 + 5; + if (FUN_0202D760(UNK_021C59F4.unk04->unk56C, st0, 0) != 0) + { UNK_021C59F4.unk04->unk685 = 0; param0[4] = 0xbb - st0[1]; @@ -1675,143 +1699,151 @@ THUMB_FUNC void FUN_02030A00(u8 *param0) { } extern u32 FUN_0202D684(u8 *param0, u32 param1, u32 param2, u32 param3, u32 param4, u32 param5); -extern void FUN_02031454(); -THUMB_FUNC u32 FUN_02030A78(u32 param0, u32 param1, u32 param2) { - if (FUN_02030E7C(FUN_02031190()) == 0 && FUN_02031280() == 0) { +THUMB_FUNC u32 FUN_02030A78(u32 param0, u32 param1, u32 param2) +{ + if (FUN_02030E7C(FUN_02031190()) == 0 && FUN_02031280() == 0) + { return 0; } - if (FUN_0202D684(UNK_021C59F4.unk04->unk54C, param0, param1, param2, 1, 0) != 0) { + if (FUN_0202D684(UNK_021C59F4.unk04->unk54C, param0, param1, param2, 1, 0) != 0) + { return 1; } - if (FUN_02033534() == 0xa) { + if (FUN_02033534() == 0xa) + { FUN_02031454(); } return 0; } - -THUMB_FUNC u32 FUN_02030ADC(u32 param0, u32 param1, u32 param2) { - if (FUN_02030E7C(FUN_02031190()) == 0 && FUN_02031280() == 0) { +THUMB_FUNC u32 FUN_02030ADC(u32 param0, u32 param1, u32 param2) +{ + if (FUN_02030E7C(FUN_02031190()) == 0 && FUN_02031280() == 0) + { return 0; } - if (FUN_0202D684(UNK_021C59F4.unk04->unk54C, param0, param1, param2, 1, 1) != 0) { + if (FUN_0202D684(UNK_021C59F4.unk04->unk54C, param0, param1, param2, 1, 1) != 0) + { return 1; } - if (FUN_02033534() == 0xa) { + if (FUN_02033534() == 0xa) + { FUN_02031454(); } return 0; } - -THUMB_FUNC u32 FUN_02030B3C(u32 param0, u32 param1, u32 param2) { - if (FUN_02031190() != 0) { +THUMB_FUNC u32 FUN_02030B3C(u32 param0, u32 param1, u32 param2) +{ + if (FUN_02031190() != 0) + { ErrorHandling(); return 0; } - - if (FUN_02030E7C(0) == 0 && FUN_02031280() == 0) { + if (FUN_02030E7C(0) == 0 && FUN_02031280() == 0) + { return 0; } - if (FUN_0202FA28() == 1) { + if (FUN_0202FA28() == 1) + { return FUN_02030A78(param0, param1, param2); } - if (FUN_0202D684(UNK_021C59F4.unk04->unk56C, param0, param1, param2, 1, 0) != 0) { + if (FUN_0202D684(UNK_021C59F4.unk04->unk56C, param0, param1, param2, 1, 0) != 0) + { return 1; } - - if (FUN_02033534() == 0xa) { + if (FUN_02033534() == 0xa) + { FUN_02031454(); } return 0; } - - -THUMB_FUNC u32 FUN_02030BC4(u32 param0, u32 param1, u32 param2) { - if (FUN_02031190() != 0) { +THUMB_FUNC u32 FUN_02030BC4(u32 param0, u32 param1, u32 param2) +{ + if (FUN_02031190() != 0) + { FUN_02031454(); return 0; } - if (FUN_02030E7C(0) == 0 && FUN_02031280() == 0) { + if (FUN_02030E7C(0) == 0 && FUN_02031280() == 0) + { return 0; } - if (FUN_0202FA28() == 1) { + if (FUN_0202FA28() == 1) + { return FUN_02030ADC(param0, param1, param2); } - if (FUN_0202D684(UNK_021C59F4.unk04->unk56C, param0, param1, param2, 1, 1) != 0) { + if (FUN_0202D684(UNK_021C59F4.unk04->unk56C, param0, param1, param2, 1, 1) != 0) + { return 1; } - - if (FUN_02033534() == 0xa) { + if (FUN_02033534() == 0xa) + { FUN_02031454(); } return 0; } - - -THUMB_FUNC u32 FUN_02030C4C(u32 param0, u32 param1) { +THUMB_FUNC u32 FUN_02030C4C(u32 param0, u32 param1) +{ return FUN_02030BC4(param0, param1, 0); } - -THUMB_FUNC int FUN_02030C58() { +THUMB_FUNC int FUN_02030C58() +{ return FUN_0202D498(&UNK_021C59F4.unk04->unk464); } extern void FUN_0202D934(u32 param0, u32 param1, u32 param2, u32 param3); -THUMB_FUNC void FUN_02030C70(u32 param0, u32 param1, u32 param2, u32 param3, void *param4) { +THUMB_FUNC void FUN_02030C70(u32 param0, u32 param1, u32 param2, u32 param3, void *param4) +{ FUN_0202D934(param0, param1, param2, param3); - *(u8 *)(param4+0xa) = 0xee; - *(u16 *)(param4+0x8) = 0xffff; - *(u32 *)(param4+0x4) = 0; + *(u8 *)(param4 + 0xa) = 0xee; + *(u16 *)(param4 + 0x8) = 0xffff; + *(u32 *)(param4 + 0x4) = 0; *(u32 *)(param4) = 0; } - extern int FUN_0202D478(s16 *param0); extern u32 FUN_0202D41C(s16 *param0); extern s16 FUN_0202D9A0(u32 param0); extern u32 FUN_0202DA04(u32 param0); extern u32 FUN_0202DA40(u32 param0, u32 param1, u16 param2); -struct UnkStruct2 { - u32 unk00; - u32 unk04; - u16 unk08; - u8 unk0a; -}; - - -THUMB_FUNC void FUN_02030C8C(s16 *param0, u32 param1, u32 param2, u32 param3, struct UnkStruct2 *param4) { - while (FUN_0202D478(param0) != 0) { +THUMB_FUNC void FUN_02030C8C( + s16 *param0, u32 param1, u32 param2, u32 param3, struct UnkStruct2 *param4) +{ + while (FUN_0202D478(param0) != 0) + { u32 r7 = param4->unk0a; - if (r7 == 0xee) { + if (r7 == 0xee) + { r7 = FUN_0202D41C(param0); - if (r7 == 0xee) { + if (r7 == 0xee) + { continue; } } @@ -1819,21 +1851,24 @@ THUMB_FUNC void FUN_02030C8C(s16 *param0, u32 param1, u32 param2, u32 param3, st int st10 = param0[2]; param4->unk0a = r7; int r4 = param4->unk08; - if (r4 == 0xffff) { + if (r4 == 0xffff) + { r4 = FUN_0202D9A0(r7); - if (UNK_021C59F4.unk04->unk689 != 0) { + if (UNK_021C59F4.unk04->unk689 != 0) + { return; } - if (r4 == 0xffff) { - if (FUN_0202D478(param0) < 1) { + if (r4 == 0xffff) + { + if (FUN_0202D478(param0) < 1) + { param0[2] = st10; return; } - - r4 = FUN_0202D41C(param0) <<8; + r4 = FUN_0202D41C(param0) << 8; r4 += FUN_0202D41C(param0); st10 = param0[2]; @@ -1842,65 +1877,83 @@ THUMB_FUNC void FUN_02030C8C(s16 *param0, u32 param1, u32 param2, u32 param3, st param4->unk08 = r4; } - - if (FUN_0202DA04(r7) != 0) { - if (param4->unk04 == 0) { + if (FUN_0202DA04(r7) != 0) + { + if (param4->unk04 == 0) + { param4->unk04 = FUN_0202DA40(r7, param1, param4->unk08); } int stc = FUN_0202D400(param0, param2, r4 - param4->unk00); - if (param4->unk04 != 0) { + if (param4->unk04 != 0) + { MI_CpuCopy8(param2, param4->unk04 + param4->unk00, stc); } - - if ((int)(param4->unk00 += stc) < (int)r4) { + if ((int)(param4->unk00 += stc) < (int)r4) + { continue; } FUN_02030C70(param1, r7, r4, param4->unk04, param4); - } else { - if (FUN_0202D478(param0) >= r4) { + } + else + { + if (FUN_0202D478(param0) >= r4) + { FUN_0202D400(param0, param2, r4); FUN_02030C70(param1, r7, r4, param2, param4); - } else { + } + else + { param0[2] = st10; return; } } - } } - - -THUMB_FUNC void FUN_02030DA4() { - if (UNK_021C59F4.unk04 != NULL) { - if (UNK_021C59F4.unk04->unk68B == 0) { +THUMB_FUNC void FUN_02030DA4() +{ + if (UNK_021C59F4.unk04 != NULL) + { + if (UNK_021C59F4.unk04->unk68B == 0) + { FUN_0202D4BC(&UNK_021C59F4.unk04->unk470); - if (FUN_0202D478(&UNK_021C59F4.unk04->unk470) > 0) { + if (FUN_0202D478(&UNK_021C59F4.unk04->unk470) > 0) + { UNK_021C59F4.unk04->unk470; - - FUN_02030C8C(&UNK_021C59F4.unk04->unk470, 0, UNK_021C59F4.unk04->unk460, 1, (struct UnkStruct2 *)&UNK_021C59F4.unk04->unk5EC); + FUN_02030C8C(&UNK_021C59F4.unk04->unk470, + 0, + UNK_021C59F4.unk04->unk460, + 1, + (struct UnkStruct2 *)&UNK_021C59F4.unk04->unk5EC); } } } } - -THUMB_FUNC void FUN_02030DFC() { - if (UNK_021C59F4.unk04 != NULL) { - if (UNK_021C59F4.unk04->unk68B == 0) { +THUMB_FUNC void FUN_02030DFC() +{ + if (UNK_021C59F4.unk04 != NULL) + { + if (UNK_021C59F4.unk04->unk68B == 0) + { int r7 = FUN_0202D858(FUN_02033534()) + 1; int r4; - for (r4 = 0; r4 < r7; r4++) { + for (r4 = 0; r4 < r7; r4++) + { FUN_0202D4BC(&UNK_021C59F4.unk04->unk4E8[r4]); - if (FUN_0202D478((s16 *)&UNK_021C59F4.unk04->unk4E8[r4]) > 0) { - - - FUN_02030C8C((s16 *)&UNK_021C59F4.unk04->unk4E8[r4], r4, UNK_021C59F4.unk04->unk460, 0, (struct UnkStruct2 *)&UNK_021C59F4.unk04->unk58C[r4]); + if (FUN_0202D478((s16 *)&UNK_021C59F4.unk04->unk4E8[r4]) > 0) + { + + FUN_02030C8C((s16 *)&UNK_021C59F4.unk04->unk4E8[r4], + r4, + UNK_021C59F4.unk04->unk460, + 0, + (struct UnkStruct2 *)&UNK_021C59F4.unk04->unk58C[r4]); } } } @@ -1908,23 +1961,25 @@ THUMB_FUNC void FUN_02030DFC() { } extern u32 MOD04_021D8018(); -extern u32 FUN_02030F40(); - - -THUMB_FUNC u32 FUN_02030E7C(u16 param0) { - if (UNK_021C59F4.unk04 == NULL) { +THUMB_FUNC u32 FUN_02030E7C(u16 param0) +{ + if (UNK_021C59F4.unk04 == NULL) + { return 0; } - - if (FUN_02033534() >= 0x13) { - if (UNK_021C59F4.unk04->unk687 != 0 && MOD04_021D8018() != 0xffffffff) { - if (param0 == 0) { + if (FUN_02033534() >= 0x13) + { + if (UNK_021C59F4.unk04->unk687 != 0 && MOD04_021D8018() != 0xffffffff) + { + if (param0 == 0) + { return 1; } - if (param0 == 1) { + if (param0 == 1) + { return 1; } } @@ -1932,26 +1987,34 @@ THUMB_FUNC u32 FUN_02030E7C(u16 param0) { return 0; } - if (FUN_02030F40() == 0) { + if (FUN_02030F40() == 0) + { return 0; } - if (FUN_0202CBD4() != 4) { + if (FUN_0202CBD4() != 4) + { return 0; } - if (FUN_02031190() == param0) { + if (FUN_02031190() == param0) + { return 1; } - if (FUN_02031190() == 0) { + if (FUN_02031190() == 0) + { u16 r0 = FUN_0202CB8C(); - if ((r0 & (1<unk65C & (1<unk65C & (1 << param0)) != 0) + { return 1; } } @@ -1959,46 +2022,46 @@ THUMB_FUNC u32 FUN_02030E7C(u16 param0) { return 0; } - - -THUMB_FUNC u32 FUN_02030F20() { +THUMB_FUNC u32 FUN_02030F20() +{ u32 r4 = 0; for (int i = 0; i < 8; i++) { - if (FUN_02030E7C(i) != 0) { + if (FUN_02030E7C(i) != 0) + { r4++; } } - return r4; - } extern u32 FUN_0202EDF8(); -THUMB_FUNC u32 FUN_02030F40() { - if (UNK_021C59F4.unk04 != NULL && FUN_02033534() >= 0x13) { - return 1; +THUMB_FUNC u32 FUN_02030F40() +{ + if (UNK_021C59F4.unk04 != NULL && FUN_02033534() >= 0x13) + { + return 1; } return FUN_0202EDF8(); } - - -THUMB_FUNC void FUN_02030F60(u8 param0) { +THUMB_FUNC void FUN_02030F60(u8 param0) +{ UNK_021C59F4.unk04->unk62B = param0; } - -THUMB_FUNC u8 FUN_02030F74(u32 param0) { +THUMB_FUNC u8 FUN_02030F74(u32 param0) +{ return UNK_021C59F4.unk04->unk620[param0]; } - -THUMB_FUNC u32 FUN_02030F88(u32 param0) { - if (UNK_021C59F4.unk04 == NULL) { +THUMB_FUNC u32 FUN_02030F88(u32 param0) +{ + if (UNK_021C59F4.unk04 == NULL) + { return 0; } @@ -2008,117 +2071,133 @@ THUMB_FUNC u32 FUN_02030F88(u32 param0) { return ret; } -THUMB_FUNC void FUN_02030FA8() { - if (UNK_021C59F4.unk04 != NULL) { +THUMB_FUNC void FUN_02030FA8() +{ + if (UNK_021C59F4.unk04 != NULL) + { UNK_021C59F4.unk04->unk628 |= 0x8000; } } - -THUMB_FUNC void FUN_02030FC8() { - if (UNK_021C59F4.unk04 != NULL) { +THUMB_FUNC void FUN_02030FC8() +{ + if (UNK_021C59F4.unk04 != NULL) + { UNK_021C59F4.unk04->unk628 = 0; } } - -THUMB_FUNC u32 FUN_02030FE0() { - if (UNK_021C59F4.unk04 != NULL) { +THUMB_FUNC u32 FUN_02030FE0() +{ + if (UNK_021C59F4.unk04 != NULL) + { return UNK_021C59F4.unk04->unk628 & 0x8000; } return 1; } - - -THUMB_FUNC void FUN_02031000(u32 param0, u32 param1, u32 param2) { - if (FUN_0202FA28() == 1) { +THUMB_FUNC void FUN_02031000(u32 param0, u32 param1, u32 param2) +{ + if (FUN_0202FA28() == 1) + { FUN_0202D684(UNK_021C59F4.unk04->unk54C, param0, param1, param2, 1, 0); return; } - FUN_0202D684(UNK_021C59F4.unk04->unk56C, param0, param1, param2, 1, 0); - } - -THUMB_FUNC void FUN_0203105C(u32 param0, u32 param1, u32 param2) { +THUMB_FUNC void FUN_0203105C(u32 param0, u32 param1, u32 param2) +{ FUN_0202D684(UNK_021C59F4.unk04->unk54C, param0, param1, param2, 0, 0); } -extern u32 FUN_020311D0(u32 param0, u8 *param1); - - - -THUMB_FUNC void FUN_02031088() { - if (UNK_021C59F4.unk04 != NULL) { - if (UNK_021C59F4.unk04->unk67B != 1) { - if (UNK_021C59F4.unk04->unk67B != 3) { +THUMB_FUNC void FUN_02031088() +{ + if (UNK_021C59F4.unk04 != NULL) + { + if (UNK_021C59F4.unk04->unk67B != 1) + { + if (UNK_021C59F4.unk04->unk67B != 3) + { return; } - } else { + } + else + { u32 res; - if (FUN_0202FA28() == 1) { + if (FUN_0202FA28() == 1) + { res = FUN_020311D0(0xb, &UNK_021C59F4.unk04->unk67C); - } else { + } + else + { res = FUN_02030BC4(0xb, &UNK_021C59F4.unk04->unk67C, 1); } - if (res == 0) { + if (res == 0) + { return; } UNK_021C59F4.unk04->unk67B = 2; return; - - } - if (FUN_020311D0(0xc, &UNK_021C59F4.unk04->unk67C) != 0) { + if (FUN_020311D0(0xc, &UNK_021C59F4.unk04->unk67C) != 0) + { FUN_0202F9E0(UNK_021C59F4.unk04->unk67C); UNK_021C59F4.unk04->unk67B = 0; } - } } - -THUMB_FUNC void FUN_0203110C(u32 param0, u32 param1, u8 *param2) { - if (FUN_02031190() == 0) { +THUMB_FUNC void FUN_0203110C(u32 param0, u32 param1, u8 *param2) +{ + if (FUN_02031190() == 0) + { UNK_021C59F4.unk04->unk67B = 1; UNK_021C59F4.unk04->unk67C = param2[0]; } } -THUMB_FUNC void FUN_02031134(u32 param0, u32 param1, u8 *param2) { - if (FUN_02031190() != 0) { +THUMB_FUNC void FUN_02031134(u32 param0, u32 param1, u8 *param2) +{ + if (FUN_02031190() != 0) + { UNK_021C59F4.unk04->unk67C = param2[0]; UNK_021C59F4.unk04->unk67B = 3; - } + } } - -THUMB_FUNC void FUN_0203115C(u32 param0, u32 param1, u8 *param2) { - if (FUN_02031190() == 0 && UNK_021C59F4.unk04->unk67B == 2) { +THUMB_FUNC void FUN_0203115C(u32 param0, u32 param1, u8 *param2) +{ + if (FUN_02031190() == 0 && UNK_021C59F4.unk04->unk67B == 2) + { FUN_0202F9E0(*param2); UNK_021C59F4.unk04->unk67B = 0; } } - extern u16 FUN_0202D19C(); -THUMB_FUNC u16 FUN_02031190() { - if (UNK_021C59F4.unk04 != NULL) { - if (FUN_02033534() >= 0x13) { +THUMB_FUNC u16 FUN_02031190() +{ + if (UNK_021C59F4.unk04 != NULL) + { + if (FUN_02033534() >= 0x13) + { u32 res = MOD04_021D8018(); - if (res != 0xffffffff) { + if (res != 0xffffffff) + { return res; } - } else { - if (FUN_02031280() != 0) { + } + else + { + if (FUN_02031280() != 0) + { return 0; } @@ -2129,31 +2208,33 @@ THUMB_FUNC u16 FUN_02031190() { return 0; } - -THUMB_FUNC u32 FUN_020311D0(u32 param0, u8 *param1) { +THUMB_FUNC u32 FUN_020311D0(u32 param0, u8 *param1) +{ return FUN_02030ADC(param0, param1, 0); } - -THUMB_FUNC u32 FUN_020311DC(u32 param0) { +THUMB_FUNC u32 FUN_020311DC(u32 param0) +{ return FUN_02030ADC(param0, 0, 0); } - -THUMB_FUNC u32 FUN_020311E8() { +THUMB_FUNC u32 FUN_020311E8() +{ return FUN_0202EE24(); } - extern void FUN_020334E8(u32 param0, u32 param1); extern u32 FUN_0202EE60(); -THUMB_FUNC u32 FUN_020311F0() { - if (FUN_02031280() != 0) { +THUMB_FUNC u32 FUN_020311F0() +{ + if (FUN_02031280() != 0) + { return 0; } - if (UNK_021C59F4.unk04 != NULL && UNK_021C59F4.unk04->unk689 != 0) { + if (UNK_021C59F4.unk04 != NULL && UNK_021C59F4.unk04->unk689 != 0) + { FUN_020334E8(1, 1); return 1; } @@ -2161,40 +2242,45 @@ THUMB_FUNC u32 FUN_020311F0() { return FUN_0202EE60(); } - - -THUMB_FUNC int FUN_02031228(u16 param0) { - if (FUN_0202D858(param0) >= 5) { +THUMB_FUNC int FUN_02031228(u16 param0) +{ + if (FUN_0202D858(param0) >= 5) + { return 0xc; } - if (FUN_0202FA28() == 0) { + if (FUN_0202FA28() == 0) + { return 0xc; } return 0x26; } -THUMB_FUNC u32 FUN_02031248(u32 param0) { - return FUN_0202D858(param0) +1; +THUMB_FUNC u32 FUN_02031248(u32 param0) +{ + return FUN_0202D858(param0) + 1; } extern u32 FUN_0202D884(u16 param0); - - -THUMB_FUNC u32 FUN_02031258(u32 param0) { - return FUN_0202D884(param0) +1; +THUMB_FUNC u32 FUN_02031258(u32 param0) +{ + return FUN_0202D884(param0) + 1; } -THUMB_FUNC void FUN_02031268(u8 param0) { - if (UNK_021C59F4.unk04 != NULL) { +THUMB_FUNC void FUN_02031268(u8 param0) +{ + if (UNK_021C59F4.unk04 != NULL) + { UNK_021C59F4.unk04->unk686 = param0; } } -THUMB_FUNC u8 FUN_02031280() { - if (UNK_021C59F4.unk04 != NULL) { +THUMB_FUNC u8 FUN_02031280() +{ + if (UNK_021C59F4.unk04 != NULL) + { return UNK_021C59F4.unk04->unk686; } @@ -2203,8 +2289,10 @@ THUMB_FUNC u8 FUN_02031280() { extern void FUN_0202F05C(); -THUMB_FUNC void FUN_0203129C() { - if (FUN_0202F03C() == 0 && FUN_02031190() == 0) { +THUMB_FUNC void FUN_0203129C() +{ + if (FUN_0202F03C() == 0 && FUN_02031190() == 0) + { u32 st0; FUN_02030C4C(2, &st0); } @@ -2214,16 +2302,16 @@ THUMB_FUNC void FUN_0203129C() { extern void GF_RTC_CopyDateTime(RTCDate *, RTCTime *); - #ifdef NONMATCHING -THUMB_FUNC void FUN_020312BC(u32 param0) { +THUMB_FUNC void FUN_020312BC(u32 param0) +{ RTCDate st10; RTCTime st4; GF_RTC_CopyDateTime(&st10, &st4); gMain.unk2C + st4.second; - u32 r6 = st10.year<<4 + st10.month; - u32 r5 = 0<<4 | st10.year>>0x1c; + u32 r6 = st10.year << 4 + st10.month; + u32 r5 = 0 << 4 | st10.year >> 0x1c; st4.second; u32 st0 = st10.day; @@ -2231,108 +2319,69 @@ THUMB_FUNC void FUN_020312BC(u32 param0) { st4.minute; 0x00000000; - (0x00000000 + r5) <<5; - - + (0x00000000 + r5) << 5; } #else -THUMB_FUNC asm void FUN_020312BC(u32 param0) { - push {r3-r7, lr} - sub sp, #0x20 - add r4, r0, #0x0 - add r0, sp, #0x10 - add r1, sp, #0x4 - bl GF_RTC_CopyDateTime - ldr r0, =gMain - ldr r6, [sp, #0x10] - mov r5, #0x0 - lsr r7, r6, #0x1c - lsl r5, r5, #0x4 - ldr r1, [sp, #0xc] - ldr r0, [r0, #0x2c] - lsl r6, r6, #0x4 - add r3, r1, r0 - ldr r0, [sp, #0x18] - orr r5, r7 - str r0, [sp, #0x0] - ldr r0, [sp, #0x14] - ldr r1, [sp, #0x4] - add r6, r0, r6 - ldr r0, =0x00000000 - ldr r2, [sp, #0x8] - adc r0, r5 - lsr r5, r6, #0x1b - lsl r0, r0, #0x5 - orr r0, r5 - ldr r5, [sp, #0x0] - lsl r6, r6, #0x5 - add r6, r5, r6 - ldr r5, =0x00000000 - adc r5, r0 - lsr r0, r6, #0x1b - lsl r5, r5, #0x5 - orr r5, r0 - lsl r0, r6, #0x5 - add r6, r1, r0 - ldr r1, =0x00000000 - adc r1, r5 - lsr r0, r6, #0x1a - lsl r1, r1, #0x6 - orr r1, r0 - lsl r0, r6, #0x6 - add r5, r2, r0 - ldr r2, =0x00000000 - adc r2, r1 - lsr r0, r5, #0x1a - lsl r1, r2, #0x6 - orr r1, r0 - lsl r0, r5, #0x6 - add r2, r3, r0 - ldr r0, =0x00000000 - str r2, [r4, #0x0] - adc r0, r1 - str r0, [r4, #0x4] - ldr r1, =0x6C078965 - ldr r0, =0x5D588B65 - str r1, [r4, #0x8] - str r0, [r4, #0xc] - ldr r0, =0x00269EC3 - str r0, [r4, #0x10] - mov r0, #0x0 - str r0, [r4, #0x14] - add sp, #0x20 - pop {r3-r7, pc} +THUMB_FUNC asm void FUN_020312BC(u32 param0) +{ + push{ r3 - r7, lr } sub sp, #0x20 add r4, r0, #0x0 add r0, sp, #0x10 add r1, sp, + #0x4 bl GF_RTC_CopyDateTime ldr r0, + = gMain ldr r6, [ sp, #0x10 ] mov r5, #0x0 lsr r7, r6, #0x1c lsl r5, r5, #0x4 ldr r1, + [ sp, #0xc ] ldr r0, [ r0, #0x2c ] lsl r6, r6, #0x4 add r3, r1, r0 ldr r0, + [ sp, #0x18 ] orr r5, r7 str r0, [ sp, #0x0 ] ldr r0, [ sp, #0x14 ] ldr r1, + [ sp, #0x4 ] add r6, r0, + r6 ldr r0, = 0x00000000 ldr r2, [ sp, #0x8 ] adc r0, r5 lsr r5, r6, #0x1b lsl r0, r0, + #0x5 orr r0, r5 ldr r5, [ sp, #0x0 ] lsl r6, r6, #0x5 add r6, r5, r6 ldr r5, + = 0x00000000 adc r5, r0 lsr r0, r6, #0x1b lsl r5, r5, #0x5 orr r5, r0 lsl r0, r6, + #0x5 add r6, r1, r0 ldr r1, = 0x00000000 adc r1, r5 lsr r0, r6, #0x1a lsl r1, r1, + #0x6 orr r1, r0 lsl r0, r6, #0x6 add r5, r2, r0 ldr r2, = 0x00000000 adc r2, + r1 lsr r0, r5, #0x1a lsl r1, r2, #0x6 orr r1, r0 lsl r0, r5, #0x6 add r2, r3, + r0 ldr r0, = 0x00000000 str r2, [ r4, #0x0 ] adc r0, r1 str r0, [ r4, #0x4 ] ldr r1, + = 0x6C078965 ldr r0, = 0x5D588B65 str r1, [ r4, #0x8 ] str r0, [ r4, #0xc ] ldr r0, + = 0x00269EC3 str r0, [ r4, #0x10 ] mov r0, #0x0 str r0, [ r4, #0x14 ] add sp, + #0x20 pop + { + r3 - r7, pc + } } #endif extern void FUN_0202D830(u8 *param0, u32 param1); -THUMB_FUNC void FUN_02031354(u32 param0) { +THUMB_FUNC void FUN_02031354(u32 param0) +{ FUN_0202D830(UNK_021C59F4.unk04->unk56C, param0); } - -THUMB_FUNC u32 FUN_02031370() { +THUMB_FUNC u32 FUN_02031370() +{ return FUN_0202D4E4(UNK_021C59F4.unk04->unk56C); } -THUMB_FUNC u32 FUN_02031388() { +THUMB_FUNC u32 FUN_02031388() +{ return FUN_0202D4E4(UNK_021C59F4.unk04->unk54C); } -THUMB_FUNC void FUN_020313A0(u8 param0) { +THUMB_FUNC void FUN_020313A0(u8 param0) +{ UNK_021C59F4.unk04->unk687 = param0; } -THUMB_FUNC void FUN_020313B4(u8 param0, u32 param1) { - if (UNK_021C59F4.unk04 != NULL) { +THUMB_FUNC void FUN_020313B4(u8 param0, u32 param1) +{ + if (UNK_021C59F4.unk04 != NULL) + { UNK_021C59F4.unk04->unk677[param1] = param0; } } -THUMB_FUNC u32 FUN_020313CC(u32 param0) { - if (UNK_021C59F4.unk04 != NULL) { - if (UNK_021C59F4.unk04->unk677[param0] != 0xff) { +THUMB_FUNC u32 FUN_020313CC(u32 param0) +{ + if (UNK_021C59F4.unk04 != NULL) + { + if (UNK_021C59F4.unk04->unk677[param0] != 0xff) + { return UNK_021C59F4.unk04->unk677[param0]; } } @@ -2342,18 +2391,23 @@ THUMB_FUNC u32 FUN_020313CC(u32 param0) { extern u32 MOD04_021D8624(); -THUMB_FUNC u32 FUN_020313EC() { - if (FUN_02033534() < 0x13) { +THUMB_FUNC u32 FUN_020313EC() +{ + if (FUN_02033534() < 0x13) + { return 0; } return MOD04_021D8624(); } -THUMB_FUNC void FUN_02031400(u32 param0) { - if (FUN_02033534() >= 0x13) { +THUMB_FUNC void FUN_02031400(u32 param0) +{ + if (FUN_02033534() >= 0x13) + { UNK_021C59F4.unk04->unk630 = param0; - if (param0 != 0) { + if (param0 != 0) + { UNK_021C59F4.unk04->unk634 = 0; UNK_021C59F4.unk04->unk638[0] = 0; UNK_021C59F4.unk04->unk638[1] = 0; @@ -2361,22 +2415,25 @@ THUMB_FUNC void FUN_02031400(u32 param0) { } } - -THUMB_FUNC u32 FUN_02031438() { - if (UNK_021C59F4.unk04->unk681 != 0) { +THUMB_FUNC u32 FUN_02031438() +{ + if (UNK_021C59F4.unk04->unk681 != 0) + { return 1; } return 0; } - -THUMB_FUNC void FUN_02031454() { +THUMB_FUNC void FUN_02031454() +{ UNK_021C59F4.unk04->unk689 = 1; } -THUMB_FUNC void FUN_02031468() { - if (UNK_021C59F4.unk04 != NULL) { - UNK_021C59F4.unk04->unk68A = 1; +THUMB_FUNC void FUN_02031468() +{ + if (UNK_021C59F4.unk04 != NULL) + { + UNK_021C59F4.unk04->unk68A = 1; } } \ No newline at end of file -- cgit v1.2.3 From 8e5d36dc053928ecc36028e818c8a3f8fd2cc9a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 10 Apr 2021 17:55:22 +0200 Subject: fix asm functions --- arm9/src/unk_0202F150.c | 597 ++++++++++++++++++++++++++---------------------- 1 file changed, 326 insertions(+), 271 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_0202F150.c b/arm9/src/unk_0202F150.c index 15a67f8d..7973702c 100644 --- a/arm9/src/unk_0202F150.c +++ b/arm9/src/unk_0202F150.c @@ -763,86 +763,98 @@ THUMB_FUNC u32 FUN_0202FE2C(int param0) #else THUMB_FUNC asm u32 FUN_0202FE2C(int param0) { - push{ r3 - r7, lr } sub sp, #0x10 str r0, [ sp, #0x0 ] mov r0, #0x0 str r0, - [ sp, #0x4 ] bl FUN_02033534 lsl r0, r0, #0x10 lsr r0, r0, #0x10 bl FUN_02031228 str r0, - [ sp, #0xc ] bl FUN_02033534 lsl r0, r0, #0x10 lsr r0, r0, #0x10 bl FUN_0202D858 add r0, r0, - #0x1 mov r7, #0x0 str r0, [ sp, #0x8 ] cmp r0, #0x0 ble _0202FED0 ldr r0, - [ sp, #0x0 ] mov r1, #0xc0 add r6, r0, #0x0 add r4, r7, #0x0 add r5, r7, #0x0 mul r6, - r1 _0202FE66 : ldr r0, - = UNK_021C59F4 ldr r1, - [ r0, #0x4 ] ldr r0, - = 0x0000047C add r0, - r1, - r0 add r0, - r0, - r4 bl FUN_0202D4BC lsl r0, - r7, - #0x10 lsr r0, - r0, - #0x10 bl FUN_02030E7C cmp r0, - #0x0 beq _0202FE90 ldr r0, - = UNK_021C59F4 mov r1, - #0xe ldr r0, - [ r0, #0x4 ] add r0, - r6, - r0 add r2, - r5, - r0 mov r0, - #0x55 lsl r0, - r0, - #0x2 strb r1, - [ r2, r0 ] _0202FE90 : ldr r0, - = UNK_021C59F4 mov r2, - #0x55 ldr r1, - [ r0, #0x4 ] ldr r0, - = 0x0000047C lsl r2, - r2, - #0x2 add r0, - r1, - r0 add r1, - r1, - r2 add r1, - r1, - r6 ldr r2, - [ sp, #0xc ] add r0, - r0, - r4 add r1, - r1, - r5 bl FUN_0202D400 ldr r0, - = UNK_021C59F4 ldr r0, - [ r0, #0x4 ] add r0, - r6, - r0 add r1, - r5, - r0 mov r0, - #0x55 lsl r0, - r0, - #0x2 ldrb r0, - [ r1, r0 ] cmp r0, - #0xe bne _0202FEC2 ldr r0, - [ sp, #0x4 ] add r0, - r0, - #0x1 str r0, - [ sp, #0x4 ] _0202FEC2 : ldr r0, - [ sp, #0xc ] add r7, - r7, - #0x1 add r5, - r5, - r0 ldr r0, - [ sp, #0x8 ] add r4, - #0xc cmp r7, - r0 blt _0202FE66 _0202FED0 - : ldr r1, - [ sp, #0x4 ] ldr r0, - [ sp, #0x8 ] cmp r1, - r0 bne _0202FEDE add sp, - #0x10 mov r0, - #0x0 pop{ r3 - r7, pc } _0202FEDE : mov r0, - #0x1 add sp, - #0x10 pop - { - r3 - r7, pc - } + // clang-format off + push {r3-r7, lr} + sub sp, #0x10 + str r0, [sp, #0x0] + mov r0, #0x0 + str r0, [sp, #0x4] + bl FUN_02033534 + lsl r0, r0, #0x10 + lsr r0, r0, #0x10 + bl FUN_02031228 + str r0, [sp, #0xc] + bl FUN_02033534 + lsl r0, r0, #0x10 + lsr r0, r0, #0x10 + bl FUN_0202D858 + add r0, r0, #0x1 + mov r7, #0x0 + str r0, [sp, #0x8] + cmp r0, #0x0 + ble _0202FED0 + ldr r0, [sp, #0x0] + mov r1, #0xc0 + add r6, r0, #0x0 + add r4, r7, #0x0 + add r5, r7, #0x0 + mul r6, r1 +_0202FE66: + ldr r0, =UNK_021C59F4 + ldr r1, [r0, #0x4] + ldr r0, =0x0000047C + add r0, r1, r0 + add r0, r0, r4 + bl FUN_0202D4BC + lsl r0, r7, #0x10 + lsr r0, r0, #0x10 + bl FUN_02030E7C + cmp r0, #0x0 + beq _0202FE90 + ldr r0, =UNK_021C59F4 + mov r1, #0xe + ldr r0, [r0, #0x4] + add r0, r6, r0 + add r2, r5, r0 + mov r0, #0x55 + lsl r0, r0, #0x2 + strb r1, [r2, r0] +_0202FE90: + ldr r0, =UNK_021C59F4 + mov r2, #0x55 + ldr r1, [r0, #0x4] + ldr r0, =0x0000047C + lsl r2, r2, #0x2 + add r0, r1, r0 + add r1, r1, r2 + add r1, r1, r6 + ldr r2, [sp, #0xc] + add r0, r0, r4 + add r1, r1, r5 + bl FUN_0202D400 + ldr r0, =UNK_021C59F4 + ldr r0, [r0, #0x4] + add r0, r6, r0 + add r1, r5, r0 + mov r0, #0x55 + lsl r0, r0, #0x2 + ldrb r0, [r1, r0] + cmp r0, #0xe + bne _0202FEC2 + ldr r0, [sp, #0x4] + add r0, r0, #0x1 + str r0, [sp, #0x4] +_0202FEC2: + ldr r0, [sp, #0xc] + add r7, r7, #0x1 + add r5, r5, r0 + ldr r0, [sp, #0x8] + add r4, #0xc + cmp r7, r0 + blt _0202FE66 +_0202FED0: + ldr r1, [sp, #0x4] + ldr r0, [sp, #0x8] + cmp r1, r0 + bne _0202FEDE + add sp, #0x10 + mov r0, #0x0 + pop {r3-r7, pc} +_0202FEDE: + mov r0, #0x1 + add sp, #0x10 + pop {r3-r7, pc} + // clang-format on } #endif @@ -1125,7 +1137,6 @@ THUMB_FUNC void FUN_0203026C(u32 param0, u8 *param1, u32 param2) FUN_0202D3A4(&UNK_021C59F4.unk04->unk470, param1 + 4, param1[3], 0x5FF); } - THUMB_FUNC void FUN_020303BC(u32 param0, u32 param1, u16 param2) { if (UNK_021C59F4.unk04->unk66F[param0] != 0) @@ -1348,173 +1359,173 @@ THUMB_FUNC void FUN_02030674() #else THUMB_FUNC asm void FUN_02030674() { - push{ r3 - r7, lr } ldr r7, = UNK_021C59F4 mov r6, #0x0 ldr r5, [ r7, #0x4 ] ldr r2, - = 0x0000062C add r4, r6, #0x0 ldrb r0, [ r5, r2 ] cmp r0, - #0x0 beq _02030690 sub r1, r2, #0x4 ldrh r1, [ r5, r1 ] mov r3, - #0xf0 tst r3, - r1 bne _02030692 _02030690 : b _02030794 _02030692 : cmp r0, - #0x2 bne _020306D0 mov r0, - #0x20 tst r0, - r1 beq _020306A4 mov r0, - #0x10 orr r0, - r6 lsl r0, - r0, - #0x10 lsr r4, - r0, - #0x10 _020306A4 : mov r0, - #0x10 tst r0, - r1 beq _020306B2 mov r0, - #0x20 orr r0, - r4 lsl r0, - r0, - #0x10 lsr r4, - r0, - #0x10 _020306B2 : mov r0, - #0x40 tst r0, - r1 beq _020306C0 mov r0, - #0x80 orr r0, - r4 lsl r0, - r0, - #0x10 lsr r4, - r0, - #0x10 _020306C0 : mov r0, - #0x80 tst r0, - r1 beq _0203077E mov r0, - #0x40 orr r0, - r4 lsl r0, - r0, - #0x10 lsr r4, - r0, - #0x10 b _0203077E _020306D0 : add r0, - r2, - #0x2 ldrh r0, - [ r5, r0 ] cmp r0, - #0x0 beq _020306F2 add r4, - r0, - #0x0 add r0, - r2, - #0x1 ldrsb r0, - [ r5, r0 ] sub r1, - r0, - #0x1 add r0, - r2, - #0x1 strb r1, - [ r5, r0 ] ldr r1, - [ r7, #0x4 ] ldrsb r0, - [ r1, r0 ] cmp r0, - #0x0 bge _0203077E add r0, - r2, - #0x2 strh r6, - [ r1, r0 ] b _0203077E _020306F2 : add r0, - r2, - #0x0 sub r0, - #0x34 add r6, - r5, - r0 sub r2, - #0x34 ldr r0, - [ r6, #0x8 ] ldr r1, - [ r6, #0xc ] ldr r2, - [ r5, r2 ] ldr r3, - [ r6, #0x4 ] bl _ll_mul add r3, - r0, - #0x0 add r2, - r1, - #0x0 ldr r0, - [ r6, #0x10 ] ldr r1, - [ r6, #0x14 ] add r0, - r0, - r3 adc r1, - r2 ldr r2, - = 0x000005F8 str r0, - [ r5, r2 ] mov r2, - #0x0 str r1, - [ r6, #0x4 ] lsr r0, - r1, - #0x1e lsl r1, - r2, - #0x2 orr r1, - r0 cmp r1, - #0x3 bhi _02030746 add r0, - r1, - r1 add r0, - pc ldrh r0, - [ r0, #0x6 ] lsl r0, - r0, - #0x10 asr r0, - r0, - #0x10 add pc, - r0 _02030730 - : // jump table (using 16-bit offset) - // huge hack to get the correct jump offset. Is there a way to write constants? - lsl r6, - r0, - #0x0 // case 0 - lsl r2, - r1, - #0x0 // case 1 - lsl r6, - r1, - #0x0 // case 2 - lsl r2, - r2, - #0x0 // case 3 - - // intended jump offset - // .short _02030738 - _02030730 - 2; case 0 - // .short _0203073C - _02030730 - 2; case 1 - // .short _02030740 - _02030730 - 2; case 2 - // .short _02030744 - _02030730 - 2; case 3 - _02030738 : mov r4, - #0x20 b _02030746 _0203073C : mov r4, - #0x10 b _02030746 _02030740 : mov r4, - #0x40 b _02030746 _02030744 : mov r4, - #0x80 _02030746 : ldr r0, - = UNK_021C59F4 ldr r5, - [ r0, #0x4 ] ldr r0, - = 0x000005F8 add r6, - r5, - r0 ldr r0, - [ r6, #0x8 ] ldr r1, - [ r6, #0xc ] ldr r2, - [ r6, #0x0 ] ldr r3, - [ r6, #0x4 ] bl _ll_mul ldr r3, - [ r6, #0x10 ] ldr r2, - [ r6, #0x14 ] add r0, - r3, - r0 adc r2, - r1 ldr r1, - = 0x000005F8 mov r3, - #0x0 str r0, - [ r5, r1 ] str r2, - [ r6, #0x4 ] lsr r0, - r2, - #0x1c lsl r2, - r3, - #0x4 orr r2, - r0 add r0, - r1, - #0x0 add r0, - #0x35 strb r2, - [ r5, r0 ] ldr r0, - = UNK_021C59F4 add r1, - #0x36 ldr r0, - [ r0, #0x4 ] strh r4, - [ r0, r1 ] _0203077E : ldr r2, - = UNK_021C59F4 ldr r1, - = 0x00000628 ldr r5, - [ r2, #0x4 ] mov r0, - #0xf0 ldrh r3, - [ r5, r1 ] bic r3, - r0 strh r3, - [ r5, r1 ] ldr r2, - [ r2, #0x4 ] ldrh r0, - [ r2, r1 ] add r0, - r0, - r4 strh r0, - [ r2, r1 ] _02030794 : pop - { - r3 - r7, pc - } + // clang-format off + push {r3-r7, lr} + ldr r7, =UNK_021C59F4 + mov r6, #0x0 + ldr r5, [r7, #0x4] + ldr r2, =0x0000062C + add r4, r6, #0x0 + ldrb r0, [r5, r2] + cmp r0, #0x0 + beq _02030690 + sub r1, r2, #0x4 + ldrh r1, [r5, r1] + mov r3, #0xf0 + tst r3, r1 + bne _02030692 +_02030690: + b _02030794 +_02030692: + cmp r0, #0x2 + bne _020306D0 + mov r0, #0x20 + tst r0, r1 + beq _020306A4 + mov r0, #0x10 + orr r0, r6 + lsl r0, r0, #0x10 + lsr r4, r0, #0x10 +_020306A4: + mov r0, #0x10 + tst r0, r1 + beq _020306B2 + mov r0, #0x20 + orr r0, r4 + lsl r0, r0, #0x10 + lsr r4, r0, #0x10 +_020306B2: + mov r0, #0x40 + tst r0, r1 + beq _020306C0 + mov r0, #0x80 + orr r0, r4 + lsl r0, r0, #0x10 + lsr r4, r0, #0x10 +_020306C0: + mov r0, #0x80 + tst r0, r1 + beq _0203077E + mov r0, #0x40 + orr r0, r4 + lsl r0, r0, #0x10 + lsr r4, r0, #0x10 + b _0203077E +_020306D0: + add r0, r2, #0x2 + ldrh r0, [r5, r0] + cmp r0, #0x0 + beq _020306F2 + add r4, r0, #0x0 + add r0, r2, #0x1 + ldrsb r0, [r5, r0] + sub r1, r0, #0x1 + add r0, r2, #0x1 + strb r1, [r5, r0] + ldr r1, [r7, #0x4] + ldrsb r0, [r1, r0] + cmp r0, #0x0 + bge _0203077E + add r0, r2, #0x2 + strh r6, [r1, r0] + b _0203077E +_020306F2: + add r0, r2, #0x0 + sub r0, #0x34 + add r6, r5, r0 + sub r2, #0x34 + ldr r0, [r6, #0x8] + ldr r1, [r6, #0xc] + ldr r2, [r5, r2] + ldr r3, [r6, #0x4] + bl _ll_mul + add r3, r0, #0x0 + add r2, r1, #0x0 + ldr r0, [r6, #0x10] + ldr r1, [r6, #0x14] + add r0, r0, r3 + adc r1, r2 + ldr r2, =0x000005F8 + str r0, [r5, r2] + mov r2, #0x0 + str r1, [r6, #0x4] + lsr r0, r1, #0x1e + lsl r1, r2, #0x2 + orr r1, r0 + cmp r1, #0x3 + bhi _02030746 + add r0, r1, r1 + add r0, pc + ldrh r0, [r0, #0x6] + lsl r0, r0, #0x10 + asr r0, r0, #0x10 + add pc, r0 +_02030730: // jump table (using 16-bit offset) + // huge hack to get the correct jump offset. Is there a way to write constants? + lsl r6, r0, #0x0 // case 0 + lsl r2, r1, #0x0 // case 1 + lsl r6, r1, #0x0 // case 2 + lsl r2, r2, #0x0 // case 3 + + // intended jump offset + // .short _02030738 - _02030730 - 2; case 0 + // .short _0203073C - _02030730 - 2; case 1 + // .short _02030740 - _02030730 - 2; case 2 + // .short _02030744 - _02030730 - 2; case 3 +_02030738: + mov r4, #0x20 + b _02030746 +_0203073C: + mov r4, #0x10 + b _02030746 +_02030740: + mov r4, #0x40 + b _02030746 +_02030744: + mov r4, #0x80 +_02030746: + ldr r0, =UNK_021C59F4 + ldr r5, [r0, #0x4] + ldr r0, =0x000005F8 + add r6, r5, r0 + ldr r0, [r6, #0x8] + ldr r1, [r6, #0xc] + ldr r2, [r6, #0x0] + ldr r3, [r6, #0x4] + bl _ll_mul + ldr r3, [r6, #0x10] + ldr r2, [r6, #0x14] + add r0, r3, r0 + adc r2, r1 + ldr r1, =0x000005F8 + mov r3, #0x0 + str r0, [r5, r1] + str r2, [r6, #0x4] + lsr r0, r2, #0x1c + lsl r2, r3, #0x4 + orr r2, r0 + add r0, r1, #0x0 + add r0, #0x35 + strb r2, [r5, r0] + ldr r0, =UNK_021C59F4 + add r1, #0x36 + ldr r0, [r0, #0x4] + strh r4, [r0, r1] +_0203077E: + ldr r2, =UNK_021C59F4 + ldr r1, =0x00000628 + ldr r5, [r2, #0x4] + mov r0, #0xf0 + ldrh r3, [r5, r1] + bic r3, r0 + strh r3, [r5, r1] + ldr r2, [r2, #0x4] + ldrh r0, [r2, r1] + add r0, r0, r4 + strh r0, [r2, r1] +_02030794: + pop {r3-r7, pc} + // clang-format on } #endif @@ -1569,7 +1580,6 @@ THUMB_FUNC void FUN_0203086C() { } - THUMB_FUNC u32 FUN_02030870(u8 *param0) { if (UNK_021C59F4.unk04->unk62A != 0) @@ -1830,8 +1840,6 @@ extern s16 FUN_0202D9A0(u32 param0); extern u32 FUN_0202DA04(u32 param0); extern u32 FUN_0202DA40(u32 param0, u32 param1, u16 param2); - - THUMB_FUNC void FUN_02030C8C( s16 *param0, u32 param1, u32 param2, u32 param3, struct UnkStruct2 *param4) { @@ -2113,7 +2121,6 @@ THUMB_FUNC void FUN_0203105C(u32 param0, u32 param1, u32 param2) FUN_0202D684(UNK_021C59F4.unk04->unk54C, param0, param1, param2, 0, 0); } - THUMB_FUNC void FUN_02031088() { if (UNK_021C59F4.unk04 != NULL) @@ -2324,25 +2331,73 @@ THUMB_FUNC void FUN_020312BC(u32 param0) #else THUMB_FUNC asm void FUN_020312BC(u32 param0) { - push{ r3 - r7, lr } sub sp, #0x20 add r4, r0, #0x0 add r0, sp, #0x10 add r1, sp, - #0x4 bl GF_RTC_CopyDateTime ldr r0, - = gMain ldr r6, [ sp, #0x10 ] mov r5, #0x0 lsr r7, r6, #0x1c lsl r5, r5, #0x4 ldr r1, - [ sp, #0xc ] ldr r0, [ r0, #0x2c ] lsl r6, r6, #0x4 add r3, r1, r0 ldr r0, - [ sp, #0x18 ] orr r5, r7 str r0, [ sp, #0x0 ] ldr r0, [ sp, #0x14 ] ldr r1, - [ sp, #0x4 ] add r6, r0, - r6 ldr r0, = 0x00000000 ldr r2, [ sp, #0x8 ] adc r0, r5 lsr r5, r6, #0x1b lsl r0, r0, - #0x5 orr r0, r5 ldr r5, [ sp, #0x0 ] lsl r6, r6, #0x5 add r6, r5, r6 ldr r5, - = 0x00000000 adc r5, r0 lsr r0, r6, #0x1b lsl r5, r5, #0x5 orr r5, r0 lsl r0, r6, - #0x5 add r6, r1, r0 ldr r1, = 0x00000000 adc r1, r5 lsr r0, r6, #0x1a lsl r1, r1, - #0x6 orr r1, r0 lsl r0, r6, #0x6 add r5, r2, r0 ldr r2, = 0x00000000 adc r2, - r1 lsr r0, r5, #0x1a lsl r1, r2, #0x6 orr r1, r0 lsl r0, r5, #0x6 add r2, r3, - r0 ldr r0, = 0x00000000 str r2, [ r4, #0x0 ] adc r0, r1 str r0, [ r4, #0x4 ] ldr r1, - = 0x6C078965 ldr r0, = 0x5D588B65 str r1, [ r4, #0x8 ] str r0, [ r4, #0xc ] ldr r0, - = 0x00269EC3 str r0, [ r4, #0x10 ] mov r0, #0x0 str r0, [ r4, #0x14 ] add sp, - #0x20 pop - { - r3 - r7, pc - } + // clang-format off + push {r3-r7, lr} + sub sp, #0x20 + add r4, r0, #0x0 + add r0, sp, #0x10 + add r1, sp, #0x4 + bl GF_RTC_CopyDateTime + ldr r0, =gMain + ldr r6, [sp, #0x10] + mov r5, #0x0 + lsr r7, r6, #0x1c + lsl r5, r5, #0x4 + ldr r1, [sp, #0xc] + ldr r0, [r0, #0x2c] + lsl r6, r6, #0x4 + add r3, r1, r0 + ldr r0, [sp, #0x18] + orr r5, r7 + str r0, [sp, #0x0] + ldr r0, [sp, #0x14] + ldr r1, [sp, #0x4] + add r6, r0, r6 + ldr r0, =0x00000000 + ldr r2, [sp, #0x8] + adc r0, r5 + lsr r5, r6, #0x1b + lsl r0, r0, #0x5 + orr r0, r5 + ldr r5, [sp, #0x0] + lsl r6, r6, #0x5 + add r6, r5, r6 + ldr r5, =0x00000000 + adc r5, r0 + lsr r0, r6, #0x1b + lsl r5, r5, #0x5 + orr r5, r0 + lsl r0, r6, #0x5 + add r6, r1, r0 + ldr r1, =0x00000000 + adc r1, r5 + lsr r0, r6, #0x1a + lsl r1, r1, #0x6 + orr r1, r0 + lsl r0, r6, #0x6 + add r5, r2, r0 + ldr r2, =0x00000000 + adc r2, r1 + lsr r0, r5, #0x1a + lsl r1, r2, #0x6 + orr r1, r0 + lsl r0, r5, #0x6 + add r2, r3, r0 + ldr r0, =0x00000000 + str r2, [r4, #0x0] + adc r0, r1 + str r0, [r4, #0x4] + ldr r1, =0x6C078965 + ldr r0, =0x5D588B65 + str r1, [r4, #0x8] + str r0, [r4, #0xc] + ldr r0, =0x00269EC3 + str r0, [r4, #0x10] + mov r0, #0x0 + str r0, [r4, #0x14] + add sp, #0x20 + pop {r3-r7, pc} + // clang-format on } #endif -- cgit v1.2.3 From f85c9d736760dace9ce94560747c9985a3e93ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 10 Apr 2021 19:21:51 +0200 Subject: fix warnings --- arm9/src/unk_0202F150.c | 307 ++++++++++++++++++++++-------------------------- 1 file changed, 142 insertions(+), 165 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_0202F150.c b/arm9/src/unk_0202F150.c index 7973702c..62ae9437 100644 --- a/arm9/src/unk_0202F150.c +++ b/arm9/src/unk_0202F150.c @@ -11,10 +11,57 @@ vu8 UNK_02105D59 = 4; extern int FUN_02033534(); extern u32 FUN_0202D858(u16 param0); extern void FUN_02031480(u32 param0); -extern void FUN_0202D7D8(u32 *param0, u32 param1, u32 param2); +extern void FUN_0202D7D8(u8 *param0, u32 param1, struct UnkStruct3 *param2); extern u32 FUN_0200CA60(void (*param0)(), u32 param1, u32 param2); -extern void FUN_0202D394(u32 param0, u32 param1, u32 param2); -extern void FUN_0202D804(u32 *param0); +extern void FUN_0202D394(struct UnkStruct3 *param0, u8 *param1, u32 param2); +extern void FUN_0202D804(u8 *param0); +extern u32 FUN_0202E5F8(u32 param0, u32 param1, u32 param2); +extern void FUN_0202D330(void (*param0)(int)); +extern u32 FUN_0202E66C(u32 param0, u32 param1); +extern void MOD04_021D83C0(); +extern u32 FUN_0202E784(); +extern void FUN_020314D0(); +extern void FUN_0202DBA4(); +extern void FUN_0200CAB4(u32 param0); +extern void FUN_0202D824(u8 *param0); +extern u32 FUN_0202E9E8(u32 param0); +extern u32 FUN_0202F03C(); +extern u32 FUN_0202EE24(); +extern void FUN_02031CDC(); +extern void FUN_0202EBD0(u16 param0); +extern void FUN_0202ED70(u32 param0); +extern void FUN_020335F4(u32 param0); +extern void FUN_020315A4(); +extern void FUN_0202E538(); +extern u32 MOD04_021D78FC(void *param0, u32 param1); +extern u32 FUN_0202CBD4(); +extern void FUN_0202D4BC(void *param0); +extern int FUN_0202D400(s16 *param0, void *param1, u32 param2); +extern u32 FUN_0202D0D0(u8 *param0, u16 param1, u32 param2, void (*param3)(u32)); +extern u32 MOD04_021D79B4(void *param0, u32 param1); +extern void FUN_0202D3A4(struct UnkStruct3 *param0, u8 *param1, u32 param2, u32 param3); +extern int FUN_0202D498(void *param0); +extern u16 FUN_0202CB8C(); +extern s64 _ll_mul(s64, s64); +extern u32 FUN_0202D4E4(u8 *param0); +extern u32 FUN_0202D760(u8 *param0, int *param1, u32 param2); +extern u32 FUN_0202D684(u8 *param0, u32 param1, u8 *param2, u32 param3, u32 param4, u32 param5); +extern void FUN_0202D934(u32 param0, u32 param1, u32 param2, void *param3); +extern int FUN_0202D478(s16 *param0); +extern u32 FUN_0202D41C(s16 *param0); +extern s16 FUN_0202D9A0(u32 param0); +extern u32 FUN_0202DA04(u32 param0); +extern void *FUN_0202DA40(u32 param0, u32 param1, u16 param2); +extern u32 MOD04_021D8018(); +extern u32 FUN_0202EDF8(); +extern u16 FUN_0202D19C(); +extern void FUN_020334E8(u32 param0, u32 param1); +extern u32 FUN_0202EE60(); +extern u32 FUN_0202D884(u16 param0); +extern void FUN_0202F05C(); +extern void GF_RTC_CopyDateTime(RTCDate *, RTCTime *); +extern void FUN_0202D830(u8 *param0, u32 param1); +extern u32 MOD04_021D8624(); THUMB_FUNC u32 FUN_0202F150(u32 param0, u32 param1) { @@ -22,7 +69,7 @@ THUMB_FUNC u32 FUN_0202F150(u32 param0, u32 param1) UNK_021C59F4.unk00 = 0; if (param0 != 0) { - u32 res = FUN_0202D858(FUN_02033534()) + 1; + u32 res = FUN_0202D858((u16)FUN_02033534()) + 1; if (UNK_021C59F4.unk04 != 0) { @@ -79,7 +126,7 @@ THUMB_FUNC u32 FUN_0202F150(u32 param0, u32 param1) FUN_0202F2F0(); } - FUN_020312BC(&UNK_021C59F4.unk04->unk5F8); + FUN_020312BC(UNK_021C59F4.unk04->unk5F8); if (r4 == 0) { @@ -100,7 +147,7 @@ THUMB_FUNC void FUN_0202F2F0() UNK_021C59F4.unk04->unk67F = 0; UNK_021C59F4.unk04->unk680 = 0; - s32 res = FUN_0202D858(FUN_02033534()) + 1; + int res = (int)FUN_0202D858((u16)FUN_02033534()) + 1; MI_CpuFill8(UNK_021C59F4.unk04->unk458, 0, UNK_021C59F4.unk04->unk658 * res); @@ -122,7 +169,7 @@ THUMB_FUNC void FUN_0202F2F0() } MI_CpuFill8(&UNK_021C59F4.unk04->unk2D4, 0, 6 << 6); - FUN_0202D394(&UNK_021C59F4.unk04->unk4DC, &UNK_021C59F4.unk04->unk2D4, 6 << 6); + FUN_0202D394(&UNK_021C59F4.unk04->unk4DC, UNK_021C59F4.unk04->unk2D4, 6 << 6); for (i = 0; i < 0xc0; i++) { @@ -131,7 +178,7 @@ THUMB_FUNC void FUN_0202F2F0() } MI_CpuFill8(&UNK_021C59F4.unk04->unk04c, 0, 0x42 << 2); - FUN_0202D394(&UNK_021C59F4.unk04->unk464, &UNK_021C59F4.unk04->unk04c, 0x42 << 2); + FUN_0202D394(&UNK_021C59F4.unk04->unk464, UNK_021C59F4.unk04->unk04c, 0x42 << 2); UNK_021C59F4.unk04->unk000[0][0] = 0xff; UNK_021C59F4.unk04->unk000[1][0] = 0xff; @@ -188,7 +235,7 @@ THUMB_FUNC void FUN_0202F5A4() UNK_021C59F4.unk04->unk62C = 0; UNK_021C59F4.unk04->unk62D = 0; - s32 res = FUN_0202D858(FUN_02033534()) + 1; + int res = (int)FUN_0202D858((u16)FUN_02033534()) + 1; MI_CpuFill8(UNK_021C59F4.unk04->unk458, 0, UNK_021C59F4.unk04->unk658 * res); @@ -210,7 +257,7 @@ THUMB_FUNC void FUN_0202F5A4() } MI_CpuFill8(&UNK_021C59F4.unk04->unk2D4, 0, 6 << 6); - FUN_0202D394(&UNK_021C59F4.unk04->unk4DC, &UNK_021C59F4.unk04->unk2D4, 6 << 6); + FUN_0202D394(&UNK_021C59F4.unk04->unk4DC, UNK_021C59F4.unk04->unk2D4, 6 << 6); for (i = 0; i < 0xc0; i++) { @@ -219,7 +266,7 @@ THUMB_FUNC void FUN_0202F5A4() } MI_CpuFill8(&UNK_021C59F4.unk04->unk04c, 0, 0x42 << 2); - FUN_0202D394(&UNK_021C59F4.unk04->unk464, &UNK_021C59F4.unk04->unk04c, 0x42 << 2); + FUN_0202D394(&UNK_021C59F4.unk04->unk464, UNK_021C59F4.unk04->unk04c, 0x42 << 2); UNK_021C59F4.unk04->unk000[0][0] = 0xff; UNK_021C59F4.unk04->unk000[1][0] = 0xff; @@ -264,7 +311,7 @@ THUMB_FUNC void FUN_0202F5A4() UNK_021C59F4.unk04->unk688 = 0; } -THUMB_FUNC void FUN_0202F820(u32 param0) +THUMB_FUNC void FUN_0202F820(int param0) { UNK_021C59F4.unk04->unk65F[param0] = 0; @@ -292,21 +339,18 @@ THUMB_FUNC void FUN_0202F8D4() { for (int i = 1; i < 8; i++) { - if (FUN_02030E7C(i) == 0 && UNK_021C59F4.unk04->unk667[i] == 0 && FUN_02031280() == 0) + if (FUN_02030E7C((u16)i) == 0 && UNK_021C59F4.unk04->unk667[i] == 0 && FUN_02031280() == 0) { FUN_0202F820(i); } } } -THUMB_FUNC void FUN_0202F910(u32 param0) +THUMB_FUNC void FUN_0202F910(int param0) { FUN_0202F820(param0); } -extern u32 FUN_0202E5F8(u32 param0, u32 param1, u32 param2); -extern void FUN_0202D330(void (*param0)(u32)); - THUMB_FUNC u32 FUN_0202F918(u32 param0, u32 param1, u32 param2, u32 param3) { u32 ret = 1; @@ -321,8 +365,6 @@ THUMB_FUNC u32 FUN_0202F918(u32 param0, u32 param1, u32 param2, u32 param3) return ret; } -extern u32 FUN_0202E66C(u32 param0, u32 param1); - THUMB_FUNC u32 FUN_0202F950(u32 param0, u32 param1, u32 param2) { u32 ret = 1; @@ -423,13 +465,6 @@ THUMB_FUNC u32 FUN_0202FA48() return 0; } -extern void MOD04_021D83C0(); -extern u32 FUN_0202E784(); -extern void FUN_020314D0(); -extern void FUN_0202DBA4(); -extern void FUN_0200CAB4(u32 param0); -extern void FUN_0202D824(u32 *param0); - THUMB_FUNC void FUN_0202FA5C() { u32 r4 = 0; @@ -468,16 +503,11 @@ THUMB_FUNC void FUN_0202FA5C() } } -extern u32 FUN_0202E9E8(u32 param0); - THUMB_FUNC u32 FUN_0202FB18(u32 param0) { return FUN_0202E9E8(param0); } -extern u32 FUN_0202F03C(); -extern u32 FUN_0202EE24(); - THUMB_FUNC void FUN_0202FB20() { if (UNK_021C59F4.unk00 != 0) @@ -510,12 +540,6 @@ THUMB_FUNC void FUN_0202FB58() } } -extern void FUN_02031CDC(); -extern void FUN_0202EBD0(u16 param0); -extern void FUN_0202ED70(u32 param0); -extern void FUN_020335F4(u32 param0); -extern void FUN_020315A4(); - THUMB_FUNC u32 FUN_0202FB80() { FUN_02031CDC(); @@ -598,8 +622,6 @@ THUMB_FUNC void FUN_0202FC80() UNK_021C59F4.unk00 = r4; } -extern void FUN_0202E538(); - THUMB_FUNC void FUN_0202FCA8() { u8 r4 = UNK_021C59F4.unk00; @@ -615,9 +637,6 @@ THUMB_FUNC void FUN_0202FCA8() UNK_021C59F4.unk00 = r4; } -extern u32 MOD04_021D78FC(void *param0, u32 param1); -extern u32 FUN_0202CBD4(); - THUMB_FUNC void FUN_0202FCCC() { if (UNK_021C59F4.unk04->unk683 != 0) @@ -722,9 +741,6 @@ THUMB_FUNC void FUN_0202FCCC() FUN_0203050C(); } -extern void FUN_0202D4BC(void *param0); -extern int FUN_0202D400(u32 param0, u32 param1, u32 param2); - #ifdef NONMATCHING THUMB_FUNC u32 FUN_0202FE2C(int param0) { @@ -858,8 +874,6 @@ _0202FEDE: } #endif -extern u32 FUN_0202D0D0(void *, u16 param1, u32 param2, void (*param3)(u32)); - THUMB_FUNC void FUN_0202FEEC() { if (UNK_021C59F4.unk04 == NULL || FUN_02033534() >= 0x13) @@ -867,8 +881,8 @@ THUMB_FUNC void FUN_0202FEEC() return; } - int st0 = FUN_02031228(FUN_02033534()); - int r6 = FUN_0202D858(FUN_02033534()) + 1; + int st0 = FUN_02031228((u16)FUN_02033534()); + int r6 = (int)FUN_0202D858((u16)FUN_02033534()) + 1; if (UNK_02105D59 == 2 || UNK_02105D59 == 0) { @@ -897,7 +911,7 @@ THUMB_FUNC void FUN_0202FEEC() { for (i = 0; i < r6; i++) { - if (FUN_02030E7C(i) != 0) + if (FUN_02030E7C((u16)i) != 0) { UNK_021C59F4.unk04->unk638[i]++; } @@ -909,12 +923,12 @@ THUMB_FUNC void FUN_0202FEEC() FUN_0203026C(0, UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680], 0xc0); - UNK_021C59F4.unk04->unk680 = 1 - UNK_021C59F4.unk04->unk680; + UNK_021C59F4.unk04->unk680 = (u8)(1 - UNK_021C59F4.unk04->unk680); } for (i = 0; i < r6; i++) { - if (FUN_02030E7C(i) == 0 && FUN_0202FA28() == 1) + if (FUN_02030E7C((u16)i) == 0 && FUN_0202FA28() == 1) { UNK_021C59F4.unk04->unk154[UNK_021C59F4.unk04->unk680][i * st0] = 0xff; } @@ -927,8 +941,6 @@ THUMB_FUNC void FUN_0202FEEC() } } -extern u32 MOD04_021D79B4(void *param0, u32 param1); - THUMB_FUNC void FUN_02030074() { if (UNK_021C59F4.unk04->unk683 != 0) @@ -1006,7 +1018,7 @@ THUMB_FUNC void FUN_02030074() { for (int r4 = 1; r4 < 8; r4++) { - if (FUN_02030E7C(r4) != 0) + if (FUN_02030E7C((u16)r4) != 0) { if ((int)UNK_021C59F4.unk04->unk638[r4] > 3) { @@ -1049,10 +1061,10 @@ THUMB_FUNC void FUN_02030238(u32 param0, void *param1, u32 param2) FUN_0203026C(param0, param1, param2); } -extern void FUN_0202D3A4(void *param0, u8 *param1, u32 param2, u32 param3); - THUMB_FUNC void FUN_0203026C(u32 param0, u8 *param1, u32 param2) { +#pragma unused(param0) +#pragma unused(param2) UNK_021C59F4.unk04->unk634--; if (param1 == 0) { @@ -1086,22 +1098,21 @@ THUMB_FUNC void FUN_0203026C(u32 param0, u8 *param1, u32 param2) UNK_021C59F4.unk04->unk682 = 0; if (FUN_0202FA28() == 1) { - int r6 = FUN_02031228(FUN_02033534()); - int st4 = FUN_0202D858(FUN_02033534()) + 1; + int r6 = FUN_02031228((u16)FUN_02033534()); + int st4 = (int)FUN_0202D858((u16)FUN_02033534()) + 1; int r4 = 0; while (r4 < st4) { - u32 new; + if (param1[0] == 0xff) { - new = UNK_021C59F4.unk04->unk65C & ~(1 << r4); + UNK_021C59F4.unk04->unk65C &= ~(1 << r4); } else { - new = UNK_021C59F4.unk04->unk65C | (1 << r4); + UNK_021C59F4.unk04->unk65C |= (1 << r4); } - UNK_021C59F4.unk04->unk65C = new; if (param1[0] == 0xff) { @@ -1118,7 +1129,7 @@ THUMB_FUNC void FUN_0203026C(u32 param0, u8 *param1, u32 param2) else { param1++; - FUN_0202D3A4(&UNK_021C59F4.unk04->unk4E8[r4], param1, r6 - 1, 0x5E6); + FUN_0202D3A4(&UNK_021C59F4.unk04->unk4E8[r4], param1, (u32)(r6 - 1), 0x5E6); param1 += r6 - 1; UNK_021C59F4.unk04->unk667[r4] = 0; @@ -1131,13 +1142,13 @@ THUMB_FUNC void FUN_0203026C(u32 param0, u8 *param1, u32 param2) } UNK_021C59F4.unk04->unk65C = param1[1]; - UNK_021C59F4.unk04->unk65C = UNK_021C59F4.unk04->unk65C << 8; + UNK_021C59F4.unk04->unk65C <<= 8; - UNK_021C59F4.unk04->unk65C = UNK_021C59F4.unk04->unk65C + param1[2]; + UNK_021C59F4.unk04->unk65C += param1[2]; FUN_0202D3A4(&UNK_021C59F4.unk04->unk470, param1 + 4, param1[3], 0x5FF); } -THUMB_FUNC void FUN_020303BC(u32 param0, u32 param1, u16 param2) +THUMB_FUNC void FUN_020303BC(u32 param0, u8 *param1, u16 param2) { if (UNK_021C59F4.unk04->unk66F[param0] != 0) { @@ -1150,10 +1161,9 @@ THUMB_FUNC void FUN_020303BC(u32 param0, u32 param1, u16 param2) FUN_020303F4(param0, param1, param2); } -extern int FUN_0202D498(void *param0); - THUMB_FUNC void FUN_020303F4(u32 param0, u8 *param1, u16 param2) { +#pragma unused(param2) UNK_021C59F4.unk04->unk638[param0]--; if (param1 == 0) { @@ -1168,12 +1178,12 @@ THUMB_FUNC void FUN_020303F4(u32 param0, u8 *param1, u16 param2) UNK_021C59F4.unk04->unk667[param0] = 0; if (FUN_0202FA28() == 1) { - int r6 = FUN_02031228(FUN_02033534()); - FUN_0202D858(FUN_02033534()); + int r6 = FUN_02031228((u16)FUN_02033534()); + FUN_0202D858((u16)FUN_02033534()); if ((param1[0] & 2) == 0) { - FUN_0202D3A4(&UNK_021C59F4.unk04->unk47C[param0], param1, r6, 0x65E); + FUN_0202D3A4(&UNK_021C59F4.unk04->unk47C[param0], param1, (u32)r6, 0x65E); } UNK_021C59F4.unk04->unk65F[param0]++; @@ -1210,8 +1220,6 @@ THUMB_FUNC void FUN_020304F0(u32 param0) ErrorHandling(); } -extern u16 FUN_0202CB8C(); - THUMB_FUNC void FUN_0203050C() { if (UNK_021C59F4.unk04 == 0 || FUN_02033534() >= 0x13) @@ -1219,17 +1227,17 @@ THUMB_FUNC void FUN_0203050C() return; } - int r4 = FUN_02031228(FUN_02033534()); - FUN_0202D858(FUN_02033534()); + int r4 = FUN_02031228((u16)FUN_02033534()); + FUN_0202D858((u16)FUN_02033534()); if (FUN_02031280() != 0 && (UNK_02105D58 == 2 || UNK_02105D58 == 0)) { UNK_02105D58++; FUN_020304D4(1); - FUN_020303F4(0, UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4); + FUN_020303F4(0, UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], (u16)r4); - UNK_021C59F4.unk04->unk67F = 1 - UNK_021C59F4.unk04->unk67F; + UNK_021C59F4.unk04->unk67F = (u8)(1 - UNK_021C59F4.unk04->unk67F); UNK_021C59F4.unk04->unk634++; return; } @@ -1255,13 +1263,13 @@ THUMB_FUNC void FUN_0203050C() UNK_02105D58++; if (FUN_0202D0D0( - UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4, 0xe, FUN_020304D4) == 0) + UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], (u16)r4, 0xe, FUN_020304D4) == 0) { UNK_02105D58--; return; } - UNK_021C59F4.unk04->unk67F = 1 - UNK_021C59F4.unk04->unk67F; + UNK_021C59F4.unk04->unk67F = (u8)(1 - UNK_021C59F4.unk04->unk67F); UNK_021C59F4.unk04->unk634++; return; } @@ -1271,15 +1279,13 @@ THUMB_FUNC void FUN_0203050C() UNK_02105D58++; FUN_020304D4(1); - FUN_020303F4(0, UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], r4); + FUN_020303F4(0, UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], (u16)r4); - UNK_021C59F4.unk04->unk67F = 1 - UNK_021C59F4.unk04->unk67F; + UNK_021C59F4.unk04->unk67F = (u8)(1 - UNK_021C59F4.unk04->unk67F); UNK_021C59F4.unk04->unk634++; } } -extern s64 _ll_mul(s64, s64); - #ifdef NONMATCHING THUMB_FUNC void FUN_02030674() { @@ -1548,11 +1554,11 @@ THUMB_FUNC u32 FUN_020307E4(u8 *param0, u32 param1) { UNK_021C59F4.unk04->unk610[param1] = 0; - u32 r7 = param0[0] & 0x10; + int r7 = param0[0] & 0x10; if (r7 == 0x10) { - u8 r5 = param0[0] & 0xc; + u8 r5 = (u8)(param0[0] & 0xc); if (r5 == 0) { UNK_021C59F4.unk04->unk610[param1] |= 0x40; @@ -1570,7 +1576,7 @@ THUMB_FUNC u32 FUN_020307E4(u8 *param0, u32 param1) UNK_021C59F4.unk04->unk610[param1] |= 0x10; } - UNK_021C59F4.unk04->unk620[param1] = (param0[0] >> 5) & 0x7; + UNK_021C59F4.unk04->unk620[param1] = (u8)((param0[0] >> 5) & 0x7); } return 1; @@ -1623,15 +1629,11 @@ THUMB_FUNC u32 FUN_02030870(u8 *param0) return 0; } -extern u32 FUN_0202D4E4(u8 *param0); -extern u32 FUN_0202D760(u8 *param0, int *param1, u32 param2); - THUMB_FUNC u32 FUN_02030930(u8 *param0) { - int r5 = FUN_02031228(FUN_02033534()); - FUN_0202D858(FUN_02033534()); + int r5 = FUN_02031228((u16)FUN_02033534()); + FUN_0202D858((u16)FUN_02033534()); - u8 r0; if (UNK_021C59F4.unk04->unk684 == 0) { param0[0] = 0; @@ -1660,7 +1662,7 @@ THUMB_FUNC u32 FUN_02030930(u8 *param0) { int st0[2]; st0[1] = r5 - 1; - st0[0] = param0 + 1; + st0[0] = (int)param0 + 1; if (FUN_0202D760(UNK_021C59F4.unk04->unk54C, st0, 1) == 0) { UNK_021C59F4.unk04->unk684 = 1; @@ -1690,16 +1692,16 @@ THUMB_FUNC void FUN_02030A00(u8 *param0) } u16 res = FUN_0202CB8C(); - param0[2] = res >> 8; - param0[3] = res; + param0[2] = (u8)(res >> 8); + param0[3] = (u8)res; int st0[2]; st0[1] = 0xbb; - st0[0] = param0 + 5; + st0[0] = (int)param0 + 5; if (FUN_0202D760(UNK_021C59F4.unk04->unk56C, st0, 0) != 0) { UNK_021C59F4.unk04->unk685 = 0; - param0[4] = 0xbb - st0[1]; + param0[4] = (u8)(0xbb - st0[1]); return; } @@ -1708,9 +1710,7 @@ THUMB_FUNC void FUN_02030A00(u8 *param0) param0[4] = 0xbb; } -extern u32 FUN_0202D684(u8 *param0, u32 param1, u32 param2, u32 param3, u32 param4, u32 param5); - -THUMB_FUNC u32 FUN_02030A78(u32 param0, u32 param1, u32 param2) +THUMB_FUNC u32 FUN_02030A78(u32 param0, u8 *param1, u32 param2) { if (FUN_02030E7C(FUN_02031190()) == 0 && FUN_02031280() == 0) { @@ -1730,7 +1730,7 @@ THUMB_FUNC u32 FUN_02030A78(u32 param0, u32 param1, u32 param2) return 0; } -THUMB_FUNC u32 FUN_02030ADC(u32 param0, u32 param1, u32 param2) +THUMB_FUNC u32 FUN_02030ADC(u32 param0, u8 *param1, u32 param2) { if (FUN_02030E7C(FUN_02031190()) == 0 && FUN_02031280() == 0) { @@ -1750,7 +1750,7 @@ THUMB_FUNC u32 FUN_02030ADC(u32 param0, u32 param1, u32 param2) return 0; } -THUMB_FUNC u32 FUN_02030B3C(u32 param0, u32 param1, u32 param2) +THUMB_FUNC u32 FUN_02030B3C(u32 param0, u8 *param1, u32 param2) { if (FUN_02031190() != 0) { @@ -1781,7 +1781,7 @@ THUMB_FUNC u32 FUN_02030B3C(u32 param0, u32 param1, u32 param2) return 0; } -THUMB_FUNC u32 FUN_02030BC4(u32 param0, u32 param1, u32 param2) +THUMB_FUNC u32 FUN_02030BC4(u32 param0, u8 *param1, u32 param2) { if (FUN_02031190() != 0) { @@ -1812,7 +1812,7 @@ THUMB_FUNC u32 FUN_02030BC4(u32 param0, u32 param1, u32 param2) return 0; } -THUMB_FUNC u32 FUN_02030C4C(u32 param0, u32 param1) +THUMB_FUNC u32 FUN_02030C4C(u32 param0, u8 *param1) { return FUN_02030BC4(param0, param1, 0); } @@ -1822,27 +1822,19 @@ THUMB_FUNC int FUN_02030C58() return FUN_0202D498(&UNK_021C59F4.unk04->unk464); } -extern void FUN_0202D934(u32 param0, u32 param1, u32 param2, u32 param3); - -THUMB_FUNC void FUN_02030C70(u32 param0, u32 param1, u32 param2, u32 param3, void *param4) +THUMB_FUNC void FUN_02030C70(u32 param0, u32 param1, u32 param2, void *param3, struct UnkStruct2 *param4) { FUN_0202D934(param0, param1, param2, param3); - - *(u8 *)(param4 + 0xa) = 0xee; - *(u16 *)(param4 + 0x8) = 0xffff; - *(u32 *)(param4 + 0x4) = 0; - *(u32 *)(param4) = 0; + param4->unk0a = 0xee; + param4->unk08 = 0xffff; + param4->unk04 = 0; + param4->unk00 = 0; } -extern int FUN_0202D478(s16 *param0); -extern u32 FUN_0202D41C(s16 *param0); -extern s16 FUN_0202D9A0(u32 param0); -extern u32 FUN_0202DA04(u32 param0); -extern u32 FUN_0202DA40(u32 param0, u32 param1, u16 param2); - THUMB_FUNC void FUN_02030C8C( - s16 *param0, u32 param1, u32 param2, u32 param3, struct UnkStruct2 *param4) + s16 *param0, u32 param1, void *param2, u32 param3, struct UnkStruct2 *param4) { +#pragma unused(param3) while (FUN_0202D478(param0) != 0) { @@ -1857,7 +1849,7 @@ THUMB_FUNC void FUN_02030C8C( } int st10 = param0[2]; - param4->unk0a = r7; + param4->unk0a = (u8)r7; int r4 = param4->unk08; if (r4 == 0xffff) { @@ -1872,17 +1864,17 @@ THUMB_FUNC void FUN_02030C8C( { if (FUN_0202D478(param0) < 1) { - param0[2] = st10; + param0[2] = (s16)st10; return; } - r4 = FUN_0202D41C(param0) << 8; + r4 = (int)FUN_0202D41C(param0) << 8; r4 += FUN_0202D41C(param0); st10 = param0[2]; } - param4->unk08 = r4; + param4->unk08 = (u16)r4; } if (FUN_0202DA04(r7) != 0) @@ -1896,7 +1888,7 @@ THUMB_FUNC void FUN_02030C8C( if (param4->unk04 != 0) { - MI_CpuCopy8(param2, param4->unk04 + param4->unk00, stc); + MI_CpuCopy8(param2, param4->unk04 + param4->unk00, (u32)stc); } if ((int)(param4->unk00 += stc) < (int)r4) @@ -1904,18 +1896,18 @@ THUMB_FUNC void FUN_02030C8C( continue; } - FUN_02030C70(param1, r7, r4, param4->unk04, param4); + FUN_02030C70(param1, r7, (u32)r4, param4->unk04, param4); } else { if (FUN_0202D478(param0) >= r4) { - FUN_0202D400(param0, param2, r4); - FUN_02030C70(param1, r7, r4, param2, param4); + FUN_0202D400(param0, param2, (u32)r4); + FUN_02030C70(param1, r7, (u32)r4, param2, param4); } else { - param0[2] = st10; + param0[2] = (s16)st10; return; } } @@ -1929,11 +1921,9 @@ THUMB_FUNC void FUN_02030DA4() if (UNK_021C59F4.unk04->unk68B == 0) { FUN_0202D4BC(&UNK_021C59F4.unk04->unk470); - if (FUN_0202D478(&UNK_021C59F4.unk04->unk470) > 0) + if (FUN_0202D478((s16 *)&UNK_021C59F4.unk04->unk470) > 0) { - UNK_021C59F4.unk04->unk470; - - FUN_02030C8C(&UNK_021C59F4.unk04->unk470, + FUN_02030C8C((s16 *)&UNK_021C59F4.unk04->unk470, 0, UNK_021C59F4.unk04->unk460, 1, @@ -1949,7 +1939,7 @@ THUMB_FUNC void FUN_02030DFC() { if (UNK_021C59F4.unk04->unk68B == 0) { - int r7 = FUN_0202D858(FUN_02033534()) + 1; + int r7 = (int)FUN_0202D858((u16)FUN_02033534()) + 1; int r4; for (r4 = 0; r4 < r7; r4++) { @@ -1958,18 +1948,16 @@ THUMB_FUNC void FUN_02030DFC() { FUN_02030C8C((s16 *)&UNK_021C59F4.unk04->unk4E8[r4], - r4, + (u32)r4, UNK_021C59F4.unk04->unk460, 0, - (struct UnkStruct2 *)&UNK_021C59F4.unk04->unk58C[r4]); + &UNK_021C59F4.unk04->unk58C[r4]); } } } } } -extern u32 MOD04_021D8018(); - THUMB_FUNC u32 FUN_02030E7C(u16 param0) { if (UNK_021C59F4.unk04 == NULL) @@ -2035,7 +2023,7 @@ THUMB_FUNC u32 FUN_02030F20() u32 r4 = 0; for (int i = 0; i < 8; i++) { - if (FUN_02030E7C(i) != 0) + if (FUN_02030E7C((u16)i) != 0) { r4++; } @@ -2044,8 +2032,6 @@ THUMB_FUNC u32 FUN_02030F20() return r4; } -extern u32 FUN_0202EDF8(); - THUMB_FUNC u32 FUN_02030F40() { if (UNK_021C59F4.unk04 != NULL && FUN_02033534() >= 0x13) @@ -2099,13 +2085,13 @@ THUMB_FUNC u32 FUN_02030FE0() { if (UNK_021C59F4.unk04 != NULL) { - return UNK_021C59F4.unk04->unk628 & 0x8000; + return (u32)(UNK_021C59F4.unk04->unk628 & 0x8000); } return 1; } -THUMB_FUNC void FUN_02031000(u32 param0, u32 param1, u32 param2) +THUMB_FUNC void FUN_02031000(u32 param0, u8 *param1, u32 param2) { if (FUN_0202FA28() == 1) { @@ -2116,7 +2102,7 @@ THUMB_FUNC void FUN_02031000(u32 param0, u32 param1, u32 param2) FUN_0202D684(UNK_021C59F4.unk04->unk56C, param0, param1, param2, 1, 0); } -THUMB_FUNC void FUN_0203105C(u32 param0, u32 param1, u32 param2) +THUMB_FUNC void FUN_0203105C(u32 param0, u8 *param1, u32 param2) { FUN_0202D684(UNK_021C59F4.unk04->unk54C, param0, param1, param2, 0, 0); } @@ -2162,6 +2148,8 @@ THUMB_FUNC void FUN_02031088() THUMB_FUNC void FUN_0203110C(u32 param0, u32 param1, u8 *param2) { +#pragma unused(param0) +#pragma unused(param1) if (FUN_02031190() == 0) { UNK_021C59F4.unk04->unk67B = 1; @@ -2171,6 +2159,8 @@ THUMB_FUNC void FUN_0203110C(u32 param0, u32 param1, u8 *param2) THUMB_FUNC void FUN_02031134(u32 param0, u32 param1, u8 *param2) { +#pragma unused(param0) +#pragma unused(param1) if (FUN_02031190() != 0) { UNK_021C59F4.unk04->unk67C = param2[0]; @@ -2180,6 +2170,8 @@ THUMB_FUNC void FUN_02031134(u32 param0, u32 param1, u8 *param2) THUMB_FUNC void FUN_0203115C(u32 param0, u32 param1, u8 *param2) { +#pragma unused(param0) +#pragma unused(param1) if (FUN_02031190() == 0 && UNK_021C59F4.unk04->unk67B == 2) { FUN_0202F9E0(*param2); @@ -2187,8 +2179,6 @@ THUMB_FUNC void FUN_0203115C(u32 param0, u32 param1, u8 *param2) } } -extern u16 FUN_0202D19C(); - THUMB_FUNC u16 FUN_02031190() { if (UNK_021C59F4.unk04 != NULL) @@ -2198,7 +2188,7 @@ THUMB_FUNC u16 FUN_02031190() u32 res = MOD04_021D8018(); if (res != 0xffffffff) { - return res; + return (u16)res; } } else @@ -2230,9 +2220,6 @@ THUMB_FUNC u32 FUN_020311E8() return FUN_0202EE24(); } -extern void FUN_020334E8(u32 param0, u32 param1); -extern u32 FUN_0202EE60(); - THUMB_FUNC u32 FUN_020311F0() { if (FUN_02031280() != 0) @@ -2266,14 +2253,12 @@ THUMB_FUNC int FUN_02031228(u16 param0) THUMB_FUNC u32 FUN_02031248(u32 param0) { - return FUN_0202D858(param0) + 1; + return FUN_0202D858((u16)param0) + 1; } -extern u32 FUN_0202D884(u16 param0); - THUMB_FUNC u32 FUN_02031258(u32 param0) { - return FUN_0202D884(param0) + 1; + return FUN_0202D884((u16)param0) + 1; } THUMB_FUNC void FUN_02031268(u8 param0) @@ -2294,23 +2279,19 @@ THUMB_FUNC u8 FUN_02031280() return 0; } -extern void FUN_0202F05C(); - THUMB_FUNC void FUN_0203129C() { if (FUN_0202F03C() == 0 && FUN_02031190() == 0) { - u32 st0; + u8 st0; FUN_02030C4C(2, &st0); } FUN_0202F05C(); } -extern void GF_RTC_CopyDateTime(RTCDate *, RTCTime *); - #ifdef NONMATCHING -THUMB_FUNC void FUN_020312BC(u32 param0) +THUMB_FUNC void FUN_020312BC(s64 *param0) { RTCDate st10; RTCTime st4; @@ -2329,7 +2310,7 @@ THUMB_FUNC void FUN_020312BC(u32 param0) (0x00000000 + r5) << 5; } #else -THUMB_FUNC asm void FUN_020312BC(u32 param0) +THUMB_FUNC asm void FUN_020312BC(s64 *param0) { // clang-format off push {r3-r7, lr} @@ -2401,8 +2382,6 @@ THUMB_FUNC asm void FUN_020312BC(u32 param0) } #endif -extern void FUN_0202D830(u8 *param0, u32 param1); - THUMB_FUNC void FUN_02031354(u32 param0) { FUN_0202D830(UNK_021C59F4.unk04->unk56C, param0); @@ -2444,8 +2423,6 @@ THUMB_FUNC u32 FUN_020313CC(u32 param0) return param0; } -extern u32 MOD04_021D8624(); - THUMB_FUNC u32 FUN_020313EC() { if (FUN_02033534() < 0x13) -- cgit v1.2.3 From f5eabfb0d118057d2533d3bd2558a560bd15a5ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 10 Apr 2021 19:38:22 +0200 Subject: polish struct usage --- arm9/src/unk_0202F150.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_0202F150.c b/arm9/src/unk_0202F150.c index 62ae9437..df7b3d37 100644 --- a/arm9/src/unk_0202F150.c +++ b/arm9/src/unk_0202F150.c @@ -2,7 +2,7 @@ struct { u8 unk00; - struct UnkStruct1 *unk04; + struct UnkStruct0202F150 *unk04; } UNK_021C59F4; vu8 UNK_02105D58 = 4; @@ -11,9 +11,9 @@ vu8 UNK_02105D59 = 4; extern int FUN_02033534(); extern u32 FUN_0202D858(u16 param0); extern void FUN_02031480(u32 param0); -extern void FUN_0202D7D8(u8 *param0, u32 param1, struct UnkStruct3 *param2); +extern void FUN_0202D7D8(u8 *param0, u32 param1, struct UnkStruct0202F150_sub1 *param2); extern u32 FUN_0200CA60(void (*param0)(), u32 param1, u32 param2); -extern void FUN_0202D394(struct UnkStruct3 *param0, u8 *param1, u32 param2); +extern void FUN_0202D394(struct UnkStruct0202F150_sub1 *param0, u8 *param1, u32 param2); extern void FUN_0202D804(u8 *param0); extern u32 FUN_0202E5F8(u32 param0, u32 param1, u32 param2); extern void FUN_0202D330(void (*param0)(int)); @@ -36,10 +36,10 @@ extern void FUN_0202E538(); extern u32 MOD04_021D78FC(void *param0, u32 param1); extern u32 FUN_0202CBD4(); extern void FUN_0202D4BC(void *param0); -extern int FUN_0202D400(s16 *param0, void *param1, u32 param2); +extern int FUN_0202D400(struct UnkStruct0202F150_sub1 *param0, void *param1, u32 param2); extern u32 FUN_0202D0D0(u8 *param0, u16 param1, u32 param2, void (*param3)(u32)); extern u32 MOD04_021D79B4(void *param0, u32 param1); -extern void FUN_0202D3A4(struct UnkStruct3 *param0, u8 *param1, u32 param2, u32 param3); +extern void FUN_0202D3A4(struct UnkStruct0202F150_sub1 *param0, u8 *param1, u32 param2, u32 param3); extern int FUN_0202D498(void *param0); extern u16 FUN_0202CB8C(); extern s64 _ll_mul(s64, s64); @@ -47,8 +47,8 @@ extern u32 FUN_0202D4E4(u8 *param0); extern u32 FUN_0202D760(u8 *param0, int *param1, u32 param2); extern u32 FUN_0202D684(u8 *param0, u32 param1, u8 *param2, u32 param3, u32 param4, u32 param5); extern void FUN_0202D934(u32 param0, u32 param1, u32 param2, void *param3); -extern int FUN_0202D478(s16 *param0); -extern u32 FUN_0202D41C(s16 *param0); +extern int FUN_0202D478(struct UnkStruct0202F150_sub1 *param0); +extern u32 FUN_0202D41C(struct UnkStruct0202F150_sub1 *param0); extern s16 FUN_0202D9A0(u32 param0); extern u32 FUN_0202DA04(u32 param0); extern void *FUN_0202DA40(u32 param0, u32 param1, u16 param2); @@ -77,7 +77,7 @@ THUMB_FUNC u32 FUN_0202F150(u32 param0, u32 param1) } FUN_02031480(0xf); - struct UnkStruct1 *ptr = (struct UnkStruct1 *)AllocFromHeap(0xf, sizeof(struct UnkStruct1)); + struct UnkStruct0202F150 *ptr = (struct UnkStruct0202F150 *)AllocFromHeap(0xf, sizeof(struct UnkStruct0202F150)); UNK_021C59F4.unk04 = ptr; MI_CpuFill8(ptr, 0, 0x68C); @@ -1822,7 +1822,7 @@ THUMB_FUNC int FUN_02030C58() return FUN_0202D498(&UNK_021C59F4.unk04->unk464); } -THUMB_FUNC void FUN_02030C70(u32 param0, u32 param1, u32 param2, void *param3, struct UnkStruct2 *param4) +THUMB_FUNC void FUN_02030C70(u32 param0, u32 param1, u32 param2, void *param3, struct UnkStruct0202F150_sub2 *param4) { FUN_0202D934(param0, param1, param2, param3); param4->unk0a = 0xee; @@ -1832,7 +1832,7 @@ THUMB_FUNC void FUN_02030C70(u32 param0, u32 param1, u32 param2, void *param3, s } THUMB_FUNC void FUN_02030C8C( - s16 *param0, u32 param1, void *param2, u32 param3, struct UnkStruct2 *param4) + struct UnkStruct0202F150_sub1 *param0, u32 param1, void *param2, u32 param3, struct UnkStruct0202F150_sub2 *param4) { #pragma unused(param3) while (FUN_0202D478(param0) != 0) @@ -1848,7 +1848,7 @@ THUMB_FUNC void FUN_02030C8C( } } - int st10 = param0[2]; + int st10 = param0->unk04; param4->unk0a = (u8)r7; int r4 = param4->unk08; if (r4 == 0xffff) @@ -1864,14 +1864,14 @@ THUMB_FUNC void FUN_02030C8C( { if (FUN_0202D478(param0) < 1) { - param0[2] = (s16)st10; + param0->unk04 = (s16)st10; return; } r4 = (int)FUN_0202D41C(param0) << 8; r4 += FUN_0202D41C(param0); - st10 = param0[2]; + st10 = param0->unk04; } param4->unk08 = (u16)r4; @@ -1907,7 +1907,7 @@ THUMB_FUNC void FUN_02030C8C( } else { - param0[2] = (s16)st10; + param0->unk04 = (s16)st10; return; } } @@ -1921,13 +1921,13 @@ THUMB_FUNC void FUN_02030DA4() if (UNK_021C59F4.unk04->unk68B == 0) { FUN_0202D4BC(&UNK_021C59F4.unk04->unk470); - if (FUN_0202D478((s16 *)&UNK_021C59F4.unk04->unk470) > 0) + if (FUN_0202D478(&UNK_021C59F4.unk04->unk470) > 0) { - FUN_02030C8C((s16 *)&UNK_021C59F4.unk04->unk470, + FUN_02030C8C(&UNK_021C59F4.unk04->unk470, 0, UNK_021C59F4.unk04->unk460, 1, - (struct UnkStruct2 *)&UNK_021C59F4.unk04->unk5EC); + (struct UnkStruct0202F150_sub2 *)&UNK_021C59F4.unk04->unk5EC); } } } @@ -1944,10 +1944,10 @@ THUMB_FUNC void FUN_02030DFC() for (r4 = 0; r4 < r7; r4++) { FUN_0202D4BC(&UNK_021C59F4.unk04->unk4E8[r4]); - if (FUN_0202D478((s16 *)&UNK_021C59F4.unk04->unk4E8[r4]) > 0) + if (FUN_0202D478(&UNK_021C59F4.unk04->unk4E8[r4]) > 0) { - FUN_02030C8C((s16 *)&UNK_021C59F4.unk04->unk4E8[r4], + FUN_02030C8C(&UNK_021C59F4.unk04->unk4E8[r4], (u32)r4, UNK_021C59F4.unk04->unk460, 0, -- cgit v1.2.3 From 228f18356cffa8cf51bc7cc655569b50d5e7bf13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 10 Apr 2021 20:57:11 +0200 Subject: fix global.inc --- arm9/global.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'arm9') diff --git a/arm9/global.inc b/arm9/global.inc index cfb7de83..9df9973e 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -8513,4 +8513,7 @@ .extern CARDi_InitCommon .extern MonNotFaintedOrEgg .extern CountAlivePokemon - +.extern FUN_02025484 +.extern FUN_02025490 +.extern FUN_020254A0 +.extern FUN_020254B4 -- cgit v1.2.3 From c34e74ae7cdd91bef14cf5f160329b5cbf3c9504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 10 Apr 2021 23:24:10 +0200 Subject: formatting --- arm9/src/unk_0202F150.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_0202F150.c b/arm9/src/unk_0202F150.c index df7b3d37..23a7de85 100644 --- a/arm9/src/unk_0202F150.c +++ b/arm9/src/unk_0202F150.c @@ -77,7 +77,8 @@ THUMB_FUNC u32 FUN_0202F150(u32 param0, u32 param1) } FUN_02031480(0xf); - struct UnkStruct0202F150 *ptr = (struct UnkStruct0202F150 *)AllocFromHeap(0xf, sizeof(struct UnkStruct0202F150)); + struct UnkStruct0202F150 *ptr = + (struct UnkStruct0202F150 *)AllocFromHeap(0xf, sizeof(struct UnkStruct0202F150)); UNK_021C59F4.unk04 = ptr; MI_CpuFill8(ptr, 0, 0x68C); @@ -1262,8 +1263,10 @@ THUMB_FUNC void FUN_0203050C() { UNK_02105D58++; - if (FUN_0202D0D0( - UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], (u16)r4, 0xe, FUN_020304D4) == 0) + if (FUN_0202D0D0(UNK_021C59F4.unk04->unk000[UNK_021C59F4.unk04->unk67F], + (u16)r4, + 0xe, + FUN_020304D4) == 0) { UNK_02105D58--; return; @@ -1822,7 +1825,8 @@ THUMB_FUNC int FUN_02030C58() return FUN_0202D498(&UNK_021C59F4.unk04->unk464); } -THUMB_FUNC void FUN_02030C70(u32 param0, u32 param1, u32 param2, void *param3, struct UnkStruct0202F150_sub2 *param4) +THUMB_FUNC void FUN_02030C70( + u32 param0, u32 param1, u32 param2, void *param3, struct UnkStruct0202F150_sub2 *param4) { FUN_0202D934(param0, param1, param2, param3); param4->unk0a = 0xee; @@ -1831,8 +1835,11 @@ THUMB_FUNC void FUN_02030C70(u32 param0, u32 param1, u32 param2, void *param3, s param4->unk00 = 0; } -THUMB_FUNC void FUN_02030C8C( - struct UnkStruct0202F150_sub1 *param0, u32 param1, void *param2, u32 param3, struct UnkStruct0202F150_sub2 *param4) +THUMB_FUNC void FUN_02030C8C(struct UnkStruct0202F150_sub1 *param0, + u32 param1, + void *param2, + u32 param3, + struct UnkStruct0202F150_sub2 *param4) { #pragma unused(param3) while (FUN_0202D478(param0) != 0) -- cgit v1.2.3 From 2023f223aa3cfce3d8e17cddf3833dc8510c443e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Fri, 16 Apr 2021 11:57:16 +0200 Subject: decomp unk_0202D858.s --- arm9/asm/unk_0202D858.s | 90 ---------------------------------------------- arm9/src/unk_0202D858.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++++ arm9/src/unk_0202F150.c | 18 +++++----- 3 files changed, 104 insertions(+), 100 deletions(-) delete mode 100644 arm9/asm/unk_0202D858.s create mode 100644 arm9/src/unk_0202D858.c (limited to 'arm9') diff --git a/arm9/asm/unk_0202D858.s b/arm9/asm/unk_0202D858.s deleted file mode 100644 index e678326d..00000000 --- a/arm9/asm/unk_0202D858.s +++ /dev/null @@ -1,90 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .section .rodata - - .global UNK_020EEB04 -UNK_020EEB04: ; 0x020EEB04 - .byte 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x04, 0x03, 0x04, 0x07, 0x03, 0x07, 0x04, 0x01, 0x04 - .byte 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00 - - .global UNK_020EEB1E -UNK_020EEB1E: ; 0x020EEB1E - .byte 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 - .byte 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00 - - .text - - thumb_func_start FUN_0202D858 -FUN_0202D858: ; 0x0202D858 - push {r3-r4, lr} - sub sp, #0x1c - ldr r3, _0202D880 ; =UNK_020EEB04 - add r4, r0, #0x0 - add r2, sp, #0x0 - mov r1, #0x1a -_0202D864: - ldrb r0, [r3, #0x0] - add r3, r3, #0x1 - strb r0, [r2, #0x0] - add r2, r2, #0x1 - sub r1, r1, #0x1 - bne _0202D864 - cmp r4, #0x1a - blo _0202D878 - bl ErrorHandling -_0202D878: - add r0, sp, #0x0 - ldrb r0, [r0, r4] - add sp, #0x1c - pop {r3-r4, pc} - .balign 4 -_0202D880: .word UNK_020EEB04 - - thumb_func_start FUN_0202D884 -FUN_0202D884: ; 0x0202D884 - push {r3-r4, lr} - sub sp, #0x1c - ldr r3, _0202D8AC ; =UNK_020EEB1E - add r4, r0, #0x0 - add r2, sp, #0x0 - mov r1, #0x1a -_0202D890: - ldrb r0, [r3, #0x0] - add r3, r3, #0x1 - strb r0, [r2, #0x0] - add r2, r2, #0x1 - sub r1, r1, #0x1 - bne _0202D890 - cmp r4, #0x1a - blo _0202D8A4 - bl ErrorHandling -_0202D8A4: - add r0, sp, #0x0 - ldrb r0, [r0, r4] - add sp, #0x1c - pop {r3-r4, pc} - .balign 4 -_0202D8AC: .word UNK_020EEB1E - - thumb_func_start FUN_0202D8B0 -FUN_0202D8B0: ; 0x0202D8B0 - cmp r0, #0xd - bgt _0202D8C4 - cmp r0, #0x7 - blt _0202D8CC - beq _0202D8C8 - cmp r0, #0x9 - beq _0202D8C8 - cmp r0, #0xd - beq _0202D8C8 - b _0202D8CC -_0202D8C4: - cmp r0, #0x12 - bne _0202D8CC -_0202D8C8: - mov r0, #0x1 - bx lr -_0202D8CC: - mov r0, #0x0 - bx lr diff --git a/arm9/src/unk_0202D858.c b/arm9/src/unk_0202D858.c new file mode 100644 index 00000000..45c7c776 --- /dev/null +++ b/arm9/src/unk_0202D858.c @@ -0,0 +1,96 @@ +#include "unk_0202D858.h" + +struct UnkStruct_0202D858 +{ + u8 unk00[0x1a]; +}; + +static const struct UnkStruct_0202D858 UNK_020EEB04 = { { + 0x01, + 0x01, + 0x01, + 0x01, + 0x03, + 0x03, + 0x03, + 0x04, + 0x03, + 0x04, + 0x07, + 0x03, + 0x07, + 0x04, + 0x01, + 0x04, + 0x01, + 0x01, + 0x04, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x00, + 0x00, +} }; + +static const struct UnkStruct_0202D858 UNK_020EEB1E = { { + 0x01, + 0x01, + 0x01, + 0x01, + 0x03, + 0x03, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x01, + 0x00, + 0x00, +} }; + +THUMB_FUNC u8 FUN_0202D858(u16 param0) +{ + struct UnkStruct_0202D858 st0 = UNK_020EEB04; + + GF_ASSERT(param0 < 0x1a); + + return st0.unk00[param0]; +} + +THUMB_FUNC u8 FUN_0202D884(u16 param0) +{ + struct UnkStruct_0202D858 st0 = UNK_020EEB1E; + + GF_ASSERT(param0 < 0x1a); + + return st0.unk00[param0]; +} + +THUMB_FUNC u32 FUN_0202D8B0(int param0) +{ + switch (param0) + { + case 0x7: + case 0x9: + case 0xd: + case 0x12: + return 1; + } + + return 0; +} diff --git a/arm9/src/unk_0202F150.c b/arm9/src/unk_0202F150.c index 23a7de85..d36c5794 100644 --- a/arm9/src/unk_0202F150.c +++ b/arm9/src/unk_0202F150.c @@ -9,7 +9,6 @@ vu8 UNK_02105D58 = 4; vu8 UNK_02105D59 = 4; extern int FUN_02033534(); -extern u32 FUN_0202D858(u16 param0); extern void FUN_02031480(u32 param0); extern void FUN_0202D7D8(u8 *param0, u32 param1, struct UnkStruct0202F150_sub1 *param2); extern u32 FUN_0200CA60(void (*param0)(), u32 param1, u32 param2); @@ -57,7 +56,6 @@ extern u32 FUN_0202EDF8(); extern u16 FUN_0202D19C(); extern void FUN_020334E8(u32 param0, u32 param1); extern u32 FUN_0202EE60(); -extern u32 FUN_0202D884(u16 param0); extern void FUN_0202F05C(); extern void GF_RTC_CopyDateTime(RTCDate *, RTCTime *); extern void FUN_0202D830(u8 *param0, u32 param1); @@ -69,7 +67,7 @@ THUMB_FUNC u32 FUN_0202F150(u32 param0, u32 param1) UNK_021C59F4.unk00 = 0; if (param0 != 0) { - u32 res = FUN_0202D858((u16)FUN_02033534()) + 1; + int res = FUN_0202D858((u16)FUN_02033534()) + 1; if (UNK_021C59F4.unk04 != 0) { @@ -148,7 +146,7 @@ THUMB_FUNC void FUN_0202F2F0() UNK_021C59F4.unk04->unk67F = 0; UNK_021C59F4.unk04->unk680 = 0; - int res = (int)FUN_0202D858((u16)FUN_02033534()) + 1; + int res = FUN_0202D858((u16)FUN_02033534()) + 1; MI_CpuFill8(UNK_021C59F4.unk04->unk458, 0, UNK_021C59F4.unk04->unk658 * res); @@ -236,7 +234,7 @@ THUMB_FUNC void FUN_0202F5A4() UNK_021C59F4.unk04->unk62C = 0; UNK_021C59F4.unk04->unk62D = 0; - int res = (int)FUN_0202D858((u16)FUN_02033534()) + 1; + int res = FUN_0202D858((u16)FUN_02033534()) + 1; MI_CpuFill8(UNK_021C59F4.unk04->unk458, 0, UNK_021C59F4.unk04->unk658 * res); @@ -883,7 +881,7 @@ THUMB_FUNC void FUN_0202FEEC() } int st0 = FUN_02031228((u16)FUN_02033534()); - int r6 = (int)FUN_0202D858((u16)FUN_02033534()) + 1; + int r6 = FUN_0202D858((u16)FUN_02033534()) + 1; if (UNK_02105D59 == 2 || UNK_02105D59 == 0) { @@ -1100,7 +1098,7 @@ THUMB_FUNC void FUN_0203026C(u32 param0, u8 *param1, u32 param2) if (FUN_0202FA28() == 1) { int r6 = FUN_02031228((u16)FUN_02033534()); - int st4 = (int)FUN_0202D858((u16)FUN_02033534()) + 1; + int st4 = FUN_0202D858((u16)FUN_02033534()) + 1; int r4 = 0; while (r4 < st4) @@ -1946,7 +1944,7 @@ THUMB_FUNC void FUN_02030DFC() { if (UNK_021C59F4.unk04->unk68B == 0) { - int r7 = (int)FUN_0202D858((u16)FUN_02033534()) + 1; + int r7 = FUN_0202D858((u16)FUN_02033534()) + 1; int r4; for (r4 = 0; r4 < r7; r4++) { @@ -2258,12 +2256,12 @@ THUMB_FUNC int FUN_02031228(u16 param0) return 0x26; } -THUMB_FUNC u32 FUN_02031248(u32 param0) +THUMB_FUNC int FUN_02031248(u32 param0) { return FUN_0202D858((u16)param0) + 1; } -THUMB_FUNC u32 FUN_02031258(u32 param0) +THUMB_FUNC int FUN_02031258(u32 param0) { return FUN_0202D884((u16)param0) + 1; } -- cgit v1.2.3 From dcb4eea28034cb3be345736dbc9bb223f3ace92a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Fri, 16 Apr 2021 15:19:40 +0200 Subject: decompile unk_02031480.s --- arm9/asm/unk_02031480.s | 405 ------------------------------------------------ arm9/src/unk_02031480.c | 213 +++++++++++++++++++++++++ 2 files changed, 213 insertions(+), 405 deletions(-) delete mode 100644 arm9/asm/unk_02031480.s create mode 100644 arm9/src/unk_02031480.c (limited to 'arm9') diff --git a/arm9/asm/unk_02031480.s b/arm9/asm/unk_02031480.s deleted file mode 100644 index 58ff4996..00000000 --- a/arm9/asm/unk_02031480.s +++ /dev/null @@ -1,405 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .section .bss - - .global UNK_021C59FC -UNK_021C59FC: ; 0x021C59FC - .space 0x4 - - .text - - thumb_func_start FUN_02031480 -FUN_02031480: ; 0x02031480 - push {r4, lr} - ldr r1, _020314C8 ; =UNK_021C59FC - ldr r1, [r1, #0x0] - cmp r1, #0x0 - bne _0203149C - ldr r1, _020314CC ; =0x00000253 - bl AllocFromHeap - ldr r1, _020314C8 ; =UNK_021C59FC - ldr r2, _020314CC ; =0x00000253 - str r0, [r1, #0x0] - mov r1, #0x0 - bl MI_CpuFill8 -_0203149C: - ldr r1, _020314C8 ; =UNK_021C59FC - mov r3, #0x0 - mov r0, #0xff -_020314A2: - ldr r2, [r1, #0x0] - add r2, r2, r3 - add r3, r3, #0x1 - strb r0, [r2, #0x10] - cmp r3, #0x8 - blt _020314A2 - ldr r3, _020314C8 ; =UNK_021C59FC - mov r1, #0x25 - ldr r2, [r3, #0x0] - lsl r1, r1, #0x4 - strb r0, [r2, r1] - ldr r4, [r3, #0x0] - add r2, r1, #0x1 - strb r0, [r4, r2] - ldr r2, [r3, #0x0] - mov r4, #0x0 - add r0, r1, #0x2 - strb r4, [r2, r0] - pop {r4, pc} - .balign 4 -_020314C8: .word UNK_021C59FC -_020314CC: .word 0x00000253 - - thumb_func_start FUN_020314D0 -FUN_020314D0: ; 0x020314D0 - push {r3, lr} - ldr r0, _020314E4 ; =UNK_021C59FC - ldr r0, [r0, #0x0] - bl FreeToHeap - ldr r0, _020314E4 ; =UNK_021C59FC - mov r1, #0x0 - str r1, [r0, #0x0] - pop {r3, pc} - nop -_020314E4: .word UNK_021C59FC - - thumb_func_start FUN_020314E8 -FUN_020314E8: ; 0x020314E8 - ldr r0, _020314F8 ; =UNK_021C59FC - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _020314F4 - mov r0, #0x1 - bx lr -_020314F4: - mov r0, #0x0 - bx lr - .balign 4 -_020314F8: .word UNK_021C59FC - - thumb_func_start FUN_020314FC -FUN_020314FC: ; 0x020314FC - push {r3-r6, lr} - sub sp, #0x4 - ldrb r1, [r2, #0x0] - add r5, r0, #0x0 - add r0, sp, #0x0 - strb r1, [r0, #0x0] - bl FUN_02031190 - cmp r0, #0x0 - bne _02031556 - add r0, sp, #0x0 - strb r5, [r0, #0x1] - ldrb r1, [r0, #0x0] - strb r1, [r0, #0x2] - add r1, sp, #0x0 - mov r0, #0x12 - add r1, #0x1 - bl FUN_02030C4C - ldr r6, _0203155C ; =UNK_021C59FC - add r4, sp, #0x0 - ldr r0, [r6, #0x0] - ldrb r1, [r4, #0x0] - add r0, r0, r5 - mov r5, #0x0 - strb r1, [r0, #0x10] -_02031530: - lsl r0, r5, #0x10 - lsr r0, r0, #0x10 - bl FUN_02030E7C - cmp r0, #0x0 - beq _02031548 - ldr r0, [r6, #0x0] - ldrb r1, [r4, #0x0] - add r0, r0, r5 - ldrb r0, [r0, #0x10] - cmp r1, r0 - bne _02031556 -_02031548: - add r5, r5, #0x1 - cmp r5, #0x8 - blt _02031530 - mov r0, #0x11 - add r1, sp, #0x0 - bl FUN_02030C4C -_02031556: - add sp, #0x4 - pop {r3-r6, pc} - nop -_0203155C: .word UNK_021C59FC - - thumb_func_start FUN_02031560 -FUN_02031560: ; 0x02031560 - ldr r0, _02031570 ; =UNK_021C59FC - ldrb r3, [r2, #0x1] - ldr r1, [r0, #0x0] - ldrb r0, [r2, #0x0] - add r0, r1, r0 - strb r3, [r0, #0x10] - bx lr - nop -_02031570: .word UNK_021C59FC - - thumb_func_start FUN_02031574 -FUN_02031574: ; 0x02031574 - ldr r0, _02031584 ; =UNK_021C59FC - ldrb r2, [r2, #0x0] - ldr r1, [r0, #0x0] - mov r0, #0x25 - lsl r0, r0, #0x4 - strb r2, [r1, r0] - bx lr - nop -_02031584: .word UNK_021C59FC - - thumb_func_start FUN_02031588 -FUN_02031588: ; 0x02031588 - ldr r2, _0203159C ; =UNK_021C59FC - ldr r1, _020315A0 ; =0x00000251 - ldr r3, [r2, #0x0] - strb r0, [r3, r1] - ldr r2, [r2, #0x0] - mov r3, #0x1 - add r0, r1, #0x1 - strb r3, [r2, r0] - bx lr - nop -_0203159C: .word UNK_021C59FC -_020315A0: .word 0x00000251 - - thumb_func_start FUN_020315A4 -FUN_020315A4: ; 0x020315A4 - push {r3, lr} - ldr r0, _020315D0 ; =UNK_021C59FC - ldr r2, [r0, #0x0] - cmp r2, #0x0 - beq _020315CE - ldr r1, _020315D4 ; =0x00000252 - ldrb r0, [r2, r1] - cmp r0, #0x0 - beq _020315CE - sub r1, r1, #0x1 - mov r0, #0x10 - add r1, r2, r1 - bl FUN_020311D0 - cmp r0, #0x0 - beq _020315CE - ldr r0, _020315D0 ; =UNK_021C59FC - mov r2, #0x0 - ldr r1, [r0, #0x0] - ldr r0, _020315D4 ; =0x00000252 - strb r2, [r1, r0] -_020315CE: - pop {r3, pc} - .balign 4 -_020315D0: .word UNK_021C59FC -_020315D4: .word 0x00000252 - - thumb_func_start FUN_020315D8 -FUN_020315D8: ; 0x020315D8 - ldr r1, _020315F8 ; =UNK_021C59FC - ldr r2, [r1, #0x0] - cmp r2, #0x0 - bne _020315E4 - mov r0, #0x1 - bx lr -_020315E4: - mov r1, #0x25 - lsl r1, r1, #0x4 - ldrb r1, [r2, r1] - cmp r1, r0 - bne _020315F2 - mov r0, #0x1 - bx lr -_020315F2: - mov r0, #0x0 - bx lr - nop -_020315F8: .word UNK_021C59FC - - thumb_func_start FUN_020315FC -FUN_020315FC: ; 0x020315FC - ldr r1, _02031608 ; =UNK_021C59FC - ldr r1, [r1, #0x0] - add r0, r1, r0 - ldrb r0, [r0, #0x10] - bx lr - nop -_02031608: .word UNK_021C59FC - - thumb_func_start FUN_0203160C -FUN_0203160C: ; 0x0203160C - push {r3-r4} - lsl r4, r0, #0x1 - ldr r0, _02031624 ; =UNK_021C59FC - ldrb r3, [r2, #0x0] - ldr r1, [r0, #0x0] - strb r3, [r1, r4] - ldr r0, [r0, #0x0] - ldrb r1, [r2, #0x1] - add r0, r0, r4 - strb r1, [r0, #0x1] - pop {r3-r4} - bx lr - .balign 4 -_02031624: .word UNK_021C59FC - - thumb_func_start FUN_02031628 -FUN_02031628: ; 0x02031628 - mov r0, #0x2 - bx lr - - thumb_func_start FUN_0203162C -FUN_0203162C: ; 0x0203162C - push {r3, lr} - add r2, sp, #0x0 - strb r0, [r2, #0x0] - strb r1, [r2, #0x1] - mov r0, #0x13 - add r1, sp, #0x0 - bl FUN_020311D0 - pop {r3, pc} - .balign 4 - - thumb_func_start FUN_02031640 -FUN_02031640: ; 0x02031640 - ldr r2, _02031664 ; =UNK_021C59FC - ldr r3, [r2, #0x0] - cmp r3, #0x0 - bne _0203164E - mov r0, #0x0 - mvn r0, r0 - bx lr -_0203164E: - lsl r2, r0, #0x1 - ldrb r0, [r3, r2] - cmp r1, r0 - bne _0203165C - add r0, r3, r2 - ldrb r0, [r0, #0x1] - bx lr -_0203165C: - mov r0, #0x0 - mvn r0, r0 - bx lr - nop -_02031664: .word UNK_021C59FC - - thumb_func_start FUN_02031668 -FUN_02031668: ; 0x02031668 - push {r3-r7, lr} - mov r4, #0x0 - ldr r6, _02031688 ; =UNK_021C59FC - add r5, r4, #0x0 - add r7, r4, #0x0 -_02031672: - ldr r0, [r6, #0x0] - add r1, r7, #0x0 - add r0, r0, r5 - mov r2, #0x2 - bl MI_CpuFill8 - add r4, r4, #0x1 - add r5, r5, #0x2 - cmp r4, #0x8 - blt _02031672 - pop {r3-r7, pc} - .balign 4 -_02031688: .word UNK_021C59FC - - thumb_func_start FUN_0203168C -FUN_0203168C: ; 0x0203168C - push {r3-r4} - mov r4, #0x0 - mov r0, #0x92 - ldr r1, _020316A8 ; =UNK_021C59FC - add r3, r4, #0x0 - lsl r0, r0, #0x2 -_02031698: - ldr r2, [r1, #0x0] - add r2, r2, r4 - add r4, r4, #0x1 - strb r3, [r2, r0] - cmp r4, #0x8 - blt _02031698 - pop {r3-r4} - bx lr - .balign 4 -_020316A8: .word UNK_021C59FC - - thumb_func_start FUN_020316AC -FUN_020316AC: ; 0x020316AC - push {r4, lr} - ldr r2, _020316DC ; =UNK_021C59FC - ldr r3, [r2, #0x0] - cmp r3, #0x0 - beq _020316D8 - add r4, r0, #0x0 - mov r2, #0x46 - mul r4, r2 - add r3, #0x18 - add r0, r1, #0x0 - add r1, r3, r4 - bl MI_CpuCopy8 - ldr r1, _020316DC ; =UNK_021C59FC - mov r0, #0x14 - ldr r1, [r1, #0x0] - add r1, #0x18 - add r1, r1, r4 - bl FUN_020311D0 - mov r0, #0x1 - pop {r4, pc} -_020316D8: - mov r0, #0x0 - pop {r4, pc} - .balign 4 -_020316DC: .word UNK_021C59FC - - thumb_func_start FUN_020316E0 -FUN_020316E0: ; 0x020316E0 - ldr r1, _02031700 ; =UNK_021C59FC - ldr r3, [r1, #0x0] - mov r1, #0x92 - add r2, r3, r0 - lsl r1, r1, #0x2 - ldrb r1, [r2, r1] - cmp r1, #0x0 - beq _020316FA - mov r1, #0x46 - add r3, #0x18 - mul r1, r0 - add r0, r3, r1 - bx lr -_020316FA: - mov r0, #0x0 - bx lr - nop -_02031700: .word UNK_021C59FC - - thumb_func_start FUN_02031704 -FUN_02031704: ; 0x02031704 - push {r3-r5, lr} - ldr r3, _0203172C ; =UNK_021C59FC - add r1, r0, #0x0 - ldr r0, [r3, #0x0] - mov r5, #0x1 - add r4, r0, r1 - mov r0, #0x92 - lsl r0, r0, #0x2 - strb r5, [r4, r0] - ldr r4, [r3, #0x0] - add r0, r2, #0x0 - mov r2, #0x46 - add r3, r1, #0x0 - add r4, #0x18 - mul r3, r2 - add r1, r4, r3 - bl MI_CpuCopy8 - pop {r3-r5, pc} - nop -_0203172C: .word UNK_021C59FC - - thumb_func_start FUN_02031730 -FUN_02031730: ; 0x02031730 - mov r0, #0x46 - bx lr diff --git a/arm9/src/unk_02031480.c b/arm9/src/unk_02031480.c new file mode 100644 index 00000000..a8ce6474 --- /dev/null +++ b/arm9/src/unk_02031480.c @@ -0,0 +1,213 @@ +#include "unk_02031480.h" + +struct UnkStruct_02031480 +{ + u8 unk000[8][2]; + u8 unk010[8]; + u8 unk018[8][70]; + u8 unk248[8]; + u8 unk250; + u8 unk251; + u8 unk252; +}; + +static struct UnkStruct_02031480 *UNK_021C59FC; + +THUMB_FUNC void FUN_02031480(u32 heap_id) +{ + if (UNK_021C59FC == NULL) + { + UNK_021C59FC = AllocFromHeap(heap_id, sizeof(struct UnkStruct_02031480)); + MI_CpuFill8(UNK_021C59FC, 0, sizeof(struct UnkStruct_02031480)); + } + + for (int i = 0; i < 8; i++) + { + UNK_021C59FC->unk010[i] = 0xff; + } + UNK_021C59FC->unk250 = 0xff; + UNK_021C59FC->unk251 = 0xff; + UNK_021C59FC->unk252 = 0x00; +} + +THUMB_FUNC void FUN_020314D0() +{ + FreeToHeap(UNK_021C59FC); + UNK_021C59FC = NULL; +} + +THUMB_FUNC BOOL FUN_020314E8() +{ + if (UNK_021C59FC != NULL) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC void FUN_020314FC(u8 param0, u32 unused, u8 *param2) +{ +#pragma unused(unused) + u8 st0[3]; + + st0[0] = param2[0]; + + if (FUN_02031190() == 0) + { + + st0[1] = param0; + st0[2] = st0[0]; + + FUN_02030C4C(0x12, &st0[1]); + + UNK_021C59FC->unk010[param0] = st0[0]; + + for (int i = 0; i < 8; i++) + { + if (FUN_02030E7C((u16)i) != 0) + { + if (st0[0] != UNK_021C59FC->unk010[i]) + { + return; + } + } + } + + FUN_02030C4C(0x11, &st0[0]); + } +} + +THUMB_FUNC void FUN_02031560(u32 unused1, u32 unused2, u8 *param2) +{ +#pragma unused(unused1) +#pragma unused(unused2) + UNK_021C59FC->unk010[param2[0]] = param2[1]; +} + +THUMB_FUNC void FUN_02031574(u32 unused1, u32 unused2, u8 *param2) +{ +#pragma unused(unused1) +#pragma unused(unused2) + UNK_021C59FC->unk250 = *param2; +} + +THUMB_FUNC void FUN_02031588(u8 param0) +{ + UNK_021C59FC->unk251 = param0; + UNK_021C59FC->unk252 = 1; +} + +THUMB_FUNC void FUN_020315A4() +{ + if (UNK_021C59FC != NULL && UNK_021C59FC->unk252 != 0 && + FUN_020311D0(0x10, &UNK_021C59FC->unk251)) + { + UNK_021C59FC->unk252 = 0; + } +} + +THUMB_FUNC BOOL FUN_020315D8(u8 param0) +{ + if (UNK_021C59FC == NULL) + { + return TRUE; + } + + if (UNK_021C59FC->unk250 == param0) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC u8 FUN_020315FC(u8 index) +{ + return UNK_021C59FC->unk010[index]; +} + +THUMB_FUNC void FUN_0203160C(u32 param0, u32 unused, u8 *param2) +{ +#pragma unused(unused) + UNK_021C59FC->unk000[param0][0] = param2[0]; + UNK_021C59FC->unk000[param0][1] = param2[1]; +} + +THUMB_FUNC u32 FUN_02031628() +{ + return 2; +} + +THUMB_FUNC void FUN_0203162C(u8 param0, u8 param1) +{ + u8 st0[2] = { param0, param1 }; + + FUN_020311D0(0x13, st0); +} + +THUMB_FUNC int FUN_02031640(u32 param0, u8 param1) +{ + if (UNK_021C59FC == NULL) + { + return -1; + } + + if (UNK_021C59FC->unk000[param0][0] == param1) + { + return UNK_021C59FC->unk000[param0][1]; + } + + return -1; +} + +THUMB_FUNC void FUN_02031668() +{ + for (int i = 0; i < 8; i++) + { + MI_CpuFill8(UNK_021C59FC->unk000[i], 0, 2); + } +} + +THUMB_FUNC void FUN_0203168C() +{ + for (int i = 0; i < 8; i++) + { + UNK_021C59FC->unk248[i] = 0; + } +} + +THUMB_FUNC BOOL FUN_020316AC(u32 param0, void *param1) +{ + if (UNK_021C59FC != NULL) + { + MI_CpuCopy8(param1, UNK_021C59FC->unk018[param0], 0x46); + FUN_020311D0(0x14, UNK_021C59FC->unk018[param0]); + + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC u8 *FUN_020316E0(u32 param0) +{ + if (UNK_021C59FC->unk248[param0] != 0) + { + return UNK_021C59FC->unk018[param0]; + } + + return NULL; +} + +THUMB_FUNC void FUN_02031704(u32 param0, u32 unused, void *param2) +{ +#pragma unused(unused) + UNK_021C59FC->unk248[param0] = 1; + MI_CpuCopy8(param2, UNK_021C59FC->unk018[param0], 0x46); +} + +THUMB_FUNC u32 FUN_02031730() +{ + return 0x46; +} -- cgit v1.2.3 From 61b2d69a68e03e39aaa97ae39969987b52c08c28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Mon, 19 Apr 2021 19:10:37 +0200 Subject: update externs --- arm9/src/unk_0202F150.c | 4 +--- arm9/src/unk_02031480.c | 2 +- arm9/src/unk_0205FA2C.c | 12 +++++------- 3 files changed, 7 insertions(+), 11 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_0202F150.c b/arm9/src/unk_0202F150.c index d36c5794..c728ddf1 100644 --- a/arm9/src/unk_0202F150.c +++ b/arm9/src/unk_0202F150.c @@ -1,4 +1,5 @@ #include "unk_0202F150.h" +#include "unk_02031480.h" struct { u8 unk00; @@ -9,7 +10,6 @@ vu8 UNK_02105D58 = 4; vu8 UNK_02105D59 = 4; extern int FUN_02033534(); -extern void FUN_02031480(u32 param0); extern void FUN_0202D7D8(u8 *param0, u32 param1, struct UnkStruct0202F150_sub1 *param2); extern u32 FUN_0200CA60(void (*param0)(), u32 param1, u32 param2); extern void FUN_0202D394(struct UnkStruct0202F150_sub1 *param0, u8 *param1, u32 param2); @@ -19,7 +19,6 @@ extern void FUN_0202D330(void (*param0)(int)); extern u32 FUN_0202E66C(u32 param0, u32 param1); extern void MOD04_021D83C0(); extern u32 FUN_0202E784(); -extern void FUN_020314D0(); extern void FUN_0202DBA4(); extern void FUN_0200CAB4(u32 param0); extern void FUN_0202D824(u8 *param0); @@ -30,7 +29,6 @@ extern void FUN_02031CDC(); extern void FUN_0202EBD0(u16 param0); extern void FUN_0202ED70(u32 param0); extern void FUN_020335F4(u32 param0); -extern void FUN_020315A4(); extern void FUN_0202E538(); extern u32 MOD04_021D78FC(void *param0, u32 param1); extern u32 FUN_0202CBD4(); diff --git a/arm9/src/unk_02031480.c b/arm9/src/unk_02031480.c index a8ce6474..9639cd74 100644 --- a/arm9/src/unk_02031480.c +++ b/arm9/src/unk_02031480.c @@ -190,7 +190,7 @@ THUMB_FUNC BOOL FUN_020316AC(u32 param0, void *param1) return FALSE; } -THUMB_FUNC u8 *FUN_020316E0(u32 param0) +THUMB_FUNC u8 *FUN_020316E0(int param0) { if (UNK_021C59FC->unk248[param0] != 0) { diff --git a/arm9/src/unk_0205FA2C.c b/arm9/src/unk_0205FA2C.c index 7bcdf950..9c4d7c8f 100644 --- a/arm9/src/unk_0205FA2C.c +++ b/arm9/src/unk_0205FA2C.c @@ -8,11 +8,9 @@ extern void FUN_0207C2A4(struct UnkPlayerStruct2_0205FA2C *ptr, struct PlayerDat extern u32 FUN_0203384C(u32 *param0); extern u32 *FUN_02038790(struct UnkStruct_0204639C *param0, u16 param1, u16 param2); extern u16 *GetVarPointer(struct UnkSavStruct80 *arg, u16); -extern u32 FUN_02031190(); -extern u32 FUN_020316E0(u32 param0); -extern u16 MOD06_02244660(struct UnkStruct_0204639C *param0, u32 param1); -extern u16 MOD06_022446BC(struct UnkStruct_0204639C *param0, u32 param1); -extern u16 MOD06_022446E0(struct UnkStruct_0204639C *param0, u32 param1); +extern u16 MOD06_02244660(struct UnkStruct_0204639C *param0, u8 *param1); +extern u16 MOD06_022446BC(struct UnkStruct_0204639C *param0, u8 *param1); +extern u16 MOD06_022446E0(struct UnkStruct_0204639C *param0, u8 *param1); extern void FUN_0202A5CC(u32 param0, u32 param1); extern u32 FUN_0202A5D0(u32 param0); extern u32 FUN_0202A150(struct UnkStruct_02029FB0 *param0, u32 param1); @@ -282,8 +280,8 @@ THUMB_FUNC int FUN_0205FD70(struct UnkStruct_0204639C *param0) { struct UnkStruct_0204639C *res = FUN_02046528(param0); u16 *res2 = (u16 *)FUN_0204652C(param0); - u32 res3 = FUN_020316E0(1 - FUN_02031190()); - if (res3 == 0) + u8 *res3 = FUN_020316E0(1 - FUN_02031190()); + if (res3 == NULL) { return 0; } -- cgit v1.2.3 From 88aa75fe3e94f1aac0368b6dbcfaf75614066a8a Mon Sep 17 00:00:00 2001 From: tgsm Date: Thu, 29 Apr 2021 07:31:45 -0400 Subject: Decompile unk_0204B0A0 --- arm9/asm/unk_0204B0A0.s | 302 ------------------------------------------------ arm9/src/unk_0204B0A0.c | 198 +++++++++++++++++++++++++++++++ 2 files changed, 198 insertions(+), 302 deletions(-) delete mode 100644 arm9/asm/unk_0204B0A0.s create mode 100644 arm9/src/unk_0204B0A0.c (limited to 'arm9') diff --git a/arm9/asm/unk_0204B0A0.s b/arm9/asm/unk_0204B0A0.s deleted file mode 100644 index a78c13d0..00000000 --- a/arm9/asm/unk_0204B0A0.s +++ /dev/null @@ -1,302 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_0204B0F8 -FUN_0204B0F8: ; 0x0204B0F8 - push {r4-r5, lr} - sub sp, #0x1c - add r5, r0, #0x0 - ldr r0, [r5, #0xc] - bl Sav2_SysInfo_RTC_get - add r4, r0, #0x0 - ldr r0, [r4, #0x0] - cmp r0, #0x0 - beq _0204B12A - add r0, sp, #0xc - add r1, sp, #0x0 - bl GF_RTC_CopyDateTime - add r0, r5, #0x0 - add r1, r4, #0x0 - add r2, sp, #0xc - bl FUN_0204B130 - add r0, r5, #0x0 - add r1, r4, #0x0 - add r2, sp, #0xc - add r3, sp, #0x0 - bl FUN_0204B158 -_0204B12A: - add sp, #0x1c - pop {r4-r5, pc} - .balign 4 - - thumb_func_start FUN_0204B130 -FUN_0204B130: ; 0x0204B130 - push {r4-r6, lr} - add r6, r0, #0x0 - add r5, r1, #0x0 - add r0, r2, #0x0 - bl RTC_ConvertDateToDay - ldr r1, [r5, #0x20] - add r4, r0, #0x0 - cmp r4, r1 - bhs _0204B148 - str r4, [r5, #0x20] - pop {r4-r6, pc} -_0204B148: - cmp r4, r1 - bls _0204B156 - add r0, r6, #0x0 - sub r1, r4, r1 - bl FUN_0204B1DC - str r4, [r5, #0x20] -_0204B156: - pop {r4-r6, pc} - - thumb_func_start FUN_0204B158 -FUN_0204B158: ; 0x0204B158 - push {r4-r7, lr} - sub sp, #0xc - add r4, r2, #0x0 - str r0, [sp, #0x0] - add r6, r3, #0x0 - add r5, r1, #0x0 - add r0, r4, #0x0 - add r1, r6, #0x0 - bl RTC_ConvertDateTimeToSecond - str r1, [sp, #0x8] - add r1, r5, #0x0 - add r7, r0, #0x0 - add r0, r5, #0x4 - add r1, #0x14 - bl RTC_ConvertDateTimeToSecond - add r2, r1, #0x0 - sub r1, r7, r0 - ldr r1, [sp, #0x8] - sbc r1, r2 - bge _0204B19C - add r2, r5, #0x4 - ldmia r4!, {r0-r1} - stmia r2!, {r0-r1} - ldmia r4!, {r0-r1} - stmia r2!, {r0-r1} - ldmia r6!, {r0-r1} - add r5, #0x14 - stmia r5!, {r0-r1} - ldr r0, [r6, #0x0] - add sp, #0xc - str r0, [r5, #0x0] - pop {r4-r7, pc} -_0204B19C: - ldr r1, [sp, #0x8] - sub r0, r7, r0 - sbc r1, r2 - mov r2, #0x3c - mov r3, #0x0 - str r1, [sp, #0x8] - bl _ll_sdiv - add r7, r0, #0x0 - cmp r7, #0x0 - ble _0204B1D8 - add r0, r5, #0x0 - add r1, r7, #0x0 - bl FUN_02023884 - ldr r0, [sp, #0x0] - add r1, r7, #0x0 - add r2, r6, #0x0 - bl FUN_0204B270 - add r2, r5, #0x4 - ldmia r4!, {r0-r1} - stmia r2!, {r0-r1} - ldmia r4!, {r0-r1} - stmia r2!, {r0-r1} - ldmia r6!, {r0-r1} - add r5, #0x14 - stmia r5!, {r0-r1} - ldr r0, [r6, #0x0] - str r0, [r5, #0x0] -_0204B1D8: - add sp, #0xc - pop {r4-r7, pc} - - thumb_func_start FUN_0204B1DC -FUN_0204B1DC: ; 0x0204B1DC - push {r4-r6, lr} - add r4, r1, #0x0 - add r5, r0, #0x0 - bl ScriptEnvironment_GetSav2Ptr - add r1, r4, #0x0 - bl FUN_02025A60 - add r0, r5, #0x0 - bl FUN_0203959C - ldr r0, [r5, #0xc] - add r1, r4, #0x0 - bl FUN_02060344 - ldr r0, [r5, #0xc] - bl FUN_0202881C - add r1, r4, #0x0 - bl FUN_02028754 - ldr r0, [r5, #0xc] - bl FUN_0202A9B0 - add r6, r0, #0x0 - ldr r0, [r5, #0xc] - bl FUN_0202881C - bl FUN_020287A4 - add r1, r0, #0x0 - add r0, r6, #0x0 - bl FUN_0202A988 - ldr r0, [r5, #0xc] - bl SavArray_PlayerParty_get - add r1, r4, #0x0 - bl Party_UpdatePokerus - ldr r0, [r5, #0xc] - bl SavArray_Flags_get - add r6, r0, #0x0 - bl FUN_0205F594 - cmp r0, r4 - ble _0204B244 - sub r0, r0, r4 - lsl r0, r0, #0x10 - lsr r1, r0, #0x10 - b _0204B246 -_0204B244: - mov r1, #0x0 -_0204B246: - add r0, r6, #0x0 - bl FUN_0205F5A4 - lsl r1, r4, #0x10 - ldr r0, [r5, #0xc] - lsr r1, r1, #0x10 - bl FUN_0205F618 - ldr r0, [r5, #0xc] - bl FUN_0205F668 - ldr r0, [r5, #0xc] - bl FUN_0206007C - ldr r0, [r5, #0xc] - bl FUN_02029AFC - bl FUN_02029C08 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_0204B270 -FUN_0204B270: ; 0x0204B270 - push {r4-r6, lr} - add r5, r0, #0x0 - add r4, r1, #0x0 - add r6, r2, #0x0 - bl FUN_0204B3D0 - ldr r0, [r5, #0xc] - add r1, r4, #0x0 - bl FUN_0202A9D0 - add r0, r5, #0x0 - bl FUN_0204B33C - add r2, r0, #0x0 - ldr r0, [r5, #0xc] - add r1, r4, #0x0 - bl FUN_02025B60 - ldr r0, [r5, #0xc] - bl FUN_02022504 - ldr r2, [r6, #0x4] - add r1, r4, #0x0 - bl FUN_0202B3C4 - pop {r4-r6, pc} - - thumb_func_start Script_GetTimeOfDay -Script_GetTimeOfDay: ; 0x0204B2A4 - push {r3, lr} - ldr r0, [r0, #0xc] - bl Sav2_SysInfo_RTC_get - ldr r0, [r0, #0x14] - bl GF_RTC_GetTimeOfDayByHour - pop {r3, pc} - - thumb_func_start Script_GetMonth -Script_GetMonth: ; 0x0204B2B4 - push {r3, lr} - ldr r0, [r0, #0xc] - bl Sav2_SysInfo_RTC_get - ldr r0, [r0, #0x8] - pop {r3, pc} - - thumb_func_start Script_GetDay -Script_GetDay: ; 0x0204B2C0 - push {r3, lr} - ldr r0, [r0, #0xc] - bl Sav2_SysInfo_RTC_get - ldr r0, [r0, #0xc] - pop {r3, pc} - - thumb_func_start Script_GetWeekday -Script_GetWeekday: ; 0x0204B2CC - push {r3, lr} - ldr r0, [r0, #0xc] - bl Sav2_SysInfo_RTC_get - ldr r0, [r0, #0x10] - pop {r3, pc} - - thumb_func_start Script_GetHour -Script_GetHour: ; 0x0204B2D8 - push {r3, lr} - ldr r0, [r0, #0xc] - bl Sav2_SysInfo_RTC_get - ldr r0, [r0, #0x14] - pop {r3, pc} - - thumb_func_start Script_GetMinute -Script_GetMinute: ; 0x0204B2E4 - push {r3, lr} - ldr r0, [r0, #0xc] - bl Sav2_SysInfo_RTC_get - ldr r0, [r0, #0x18] - pop {r3, pc} - - thumb_func_start Script_SavRTC_x24toDateTime -Script_SavRTC_x24toDateTime: ; 0x0204B2F0 - push {r3-r5, lr} - ldr r0, [r0, #0xc] - add r5, r1, #0x0 - add r4, r2, #0x0 - bl Sav2_SysInfo_RTC_get - add r3, r0, #0x0 - ldr r2, [r3, #0x24] - ldr r3, [r3, #0x28] - add r0, r5, #0x0 - add r1, r4, #0x0 - bl RTC_ConvertSecondToDateTime - pop {r3-r5, pc} - - thumb_func_start Script_SavRTC_x2CtoDateTime -Script_SavRTC_x2CtoDateTime: ; 0x0204B30C - push {r3-r5, lr} - ldr r0, [r0, #0xc] - add r5, r1, #0x0 - add r4, r2, #0x0 - bl Sav2_SysInfo_RTC_get - add r3, r0, #0x0 - ldr r2, [r3, #0x2c] - ldr r3, [r3, #0x30] - add r0, r5, #0x0 - add r1, r4, #0x0 - bl RTC_ConvertSecondToDateTime - pop {r3-r5, pc} - - thumb_func_start Script_SavRTC_DateTimeTox2C -Script_SavRTC_DateTimeTox2C: ; 0x0204B328 - push {r4, lr} - ldr r0, [r0, #0xc] - bl Sav2_SysInfo_RTC_get - add r4, r0, #0x0 - bl GF_RTC_DateTimeToSec - str r0, [r4, #0x2c] - str r1, [r4, #0x30] - pop {r4, pc} - - thumb_func_start FUN_0204B33C -FUN_0204B33C: ; 0x0204B33C - push {r3, lr} - ldr r0, [r0, #0xc] - bl Sav2_SysInfo_RTC_get - bl FUN_02023874 - pop {r3, pc} - .balign 4 diff --git a/arm9/src/unk_0204B0A0.c b/arm9/src/unk_0204B0A0.c new file mode 100644 index 00000000..15a9111d --- /dev/null +++ b/arm9/src/unk_0204B0A0.c @@ -0,0 +1,198 @@ +#include "global.h" +#include "event_data.h" +#include "unk_0204B0A0.h" +#include "unk_0205FA2C.h" + +extern void GF_RTC_CopyDateTime(struct RTCDate* date, struct RTCTime* time); +extern void FUN_02029C08(void*); +extern void FUN_0202B3C4(void*, s32, u32); +extern u8 GF_RTC_GetTimeOfDayByHour(u32 hour); +extern s64 GF_RTC_DateTimeToSec(void); +extern void* FUN_02029AFC(struct SaveBlock2* sav2); +extern void* FUN_02022504(struct SaveBlock2* sav2); +extern void FUN_02025B60(struct SaveBlock2* sav2, s32, BOOL); +extern BOOL FUN_0205F668(struct SaveBlock2* sav2); +extern void FUN_0202A9D0(struct SaveBlock2* sav2, s32); +extern BOOL FUN_0205F618(struct SaveBlock2* sav2, u16); +extern void FUN_0204B3D0(struct UnkSavStruct80*, s32); +extern void FUN_0205F5A4(struct ScriptState* state, u16); +extern s32 FUN_0205F594(struct ScriptState* state); +extern void FUN_0202A988(void*, u32); +extern void* FUN_0202A9B0(struct SaveBlock2* sav2); +extern void FUN_02060344(struct SaveBlock2* sav2, s32); +extern void FUN_0203959C(struct UnkSavStruct80*); +extern void FUN_02025A60(struct SaveBlock2* sav2, s32); +extern struct SaveBlock2* ScriptEnvironment_GetSav2Ptr(struct UnkSavStruct80*); + +THUMB_FUNC void FUN_0204B0F8(struct UnkSavStruct80* unk) +{ + RTCDate date; + RTCTime time; + + struct UnkSaveStruct_0202376C_sub* rtc_info = Sav2_SysInfo_RTC_get(unk->saveBlock2); + if (rtc_info->field_00 != 0) + { + GF_RTC_CopyDateTime(&date, &time); + FUN_0204B130(unk, rtc_info, &date); + FUN_0204B158(unk, rtc_info, &date, &time); + } +} + +THUMB_FUNC void FUN_0204B130(struct UnkSavStruct80* unk, struct UnkSaveStruct_0202376C_sub* rtc_info, struct RTCDate* date) +{ + u32 days = (u32)RTC_ConvertDateToDay(date); + u32 days_since_nitro_epoch = (u32)rtc_info->daysSinceNitroEpoch; + + if (days < days_since_nitro_epoch) + { + rtc_info->daysSinceNitroEpoch = (s32)days; + } + else if (days > days_since_nitro_epoch) + { + FUN_0204B1DC(unk, (s32)(days - days_since_nitro_epoch)); + rtc_info->daysSinceNitroEpoch = (s32)days; + } +} + +THUMB_FUNC void FUN_0204B158(struct UnkSavStruct80* unk, struct UnkSaveStruct_0202376C_sub* rtc_info, struct RTCDate* date, struct RTCTime* time) +{ + s64 unk1 = RTC_ConvertDateTimeToSecond(date, time); + s64 unk2 = RTC_ConvertDateTimeToSecond(&rtc_info->date, &rtc_info->time); + + if (unk2 > unk1) + { + rtc_info->date = *date; + rtc_info->time = *time; + return; + } + + s32 minutes = (s32)((unk1 - unk2) / 60); + if (minutes > 0) + { + FUN_02023884(rtc_info, (u32)minutes); + FUN_0204B270(unk, minutes, time); + + rtc_info->date = *date; + rtc_info->time = *time; + } +} + +THUMB_FUNC void FUN_0204B1DC(struct UnkSavStruct80* unk, s32 a1) +{ + struct SaveBlock2* sav2 = ScriptEnvironment_GetSav2Ptr(unk); + FUN_02025A60(sav2, a1); + FUN_0203959C(unk); + FUN_02060344(unk->saveBlock2, a1); + + void* unk_sav_ptr1 = FUN_0202881C(unk->saveBlock2); + FUN_02028754(unk_sav_ptr1, (u32)a1); + + void* unk_sav_ptr2 = FUN_0202A9B0(unk->saveBlock2); + unk_sav_ptr1 = FUN_0202881C(unk->saveBlock2); + u32 unk1 = FUN_020287A4(unk_sav_ptr1); + FUN_0202A988(unk_sav_ptr2, unk1); + + struct PlayerParty* party = SavArray_PlayerParty_get(unk->saveBlock2); + Party_UpdatePokerus(party, a1); + + struct ScriptState* state = SavArray_Flags_get(unk->saveBlock2); + s32 unk2 = FUN_0205F594(state); + + u16 unk3; + if (unk2 > a1) + { + unk3 = (u16)(unk2 - a1); + } + else + { + unk3 = 0; + } + + FUN_0205F5A4(state, unk3); + FUN_0205F618(unk->saveBlock2, (u16)a1); + FUN_0205F668(unk->saveBlock2); + FUN_0206007C(unk->saveBlock2); + + void* unk_sav_ptr3 = FUN_02029AFC(unk->saveBlock2); + FUN_02029C08(unk_sav_ptr3); +} + +THUMB_FUNC void FUN_0204B270(struct UnkSavStruct80* unk, s32 a1, struct RTCTime* time) +{ + FUN_0204B3D0(unk, a1); + FUN_0202A9D0(unk->saveBlock2, a1); + BOOL unk_bool = FUN_0204B33C(unk); + FUN_02025B60(unk->saveBlock2, a1, unk_bool); + void* unk_sav_ptr = FUN_02022504(unk->saveBlock2); + FUN_0202B3C4(unk_sav_ptr, a1, time->minute); +} + +THUMB_FUNC u32 Script_GetTimeOfDay(struct UnkSavStruct80* unk) +{ + struct UnkSaveStruct_0202376C_sub* rtc_info = Sav2_SysInfo_RTC_get(unk->saveBlock2); + + return GF_RTC_GetTimeOfDayByHour(rtc_info->time.hour); +} + +THUMB_FUNC u32 Script_GetMonth(struct UnkSavStruct80* unk) +{ + struct UnkSaveStruct_0202376C_sub* rtc_info = Sav2_SysInfo_RTC_get(unk->saveBlock2); + + return rtc_info->date.month; +} + +THUMB_FUNC u32 Script_GetDay(struct UnkSavStruct80* unk) +{ + struct UnkSaveStruct_0202376C_sub* rtc_info = Sav2_SysInfo_RTC_get(unk->saveBlock2); + + return rtc_info->date.day; +} + +THUMB_FUNC RTCWeek Script_GetWeekday(struct UnkSavStruct80* unk) +{ + struct UnkSaveStruct_0202376C_sub* rtc_info = Sav2_SysInfo_RTC_get(unk->saveBlock2); + + return rtc_info->date.week; +} + +THUMB_FUNC u32 Script_GetHour(struct UnkSavStruct80* unk) +{ + struct UnkSaveStruct_0202376C_sub* rtc_info = Sav2_SysInfo_RTC_get(unk->saveBlock2); + + return rtc_info->time.hour; +} + +THUMB_FUNC u32 Script_GetMinute(struct UnkSavStruct80* unk) +{ + struct UnkSaveStruct_0202376C_sub* rtc_info = Sav2_SysInfo_RTC_get(unk->saveBlock2); + + return rtc_info->time.minute; +} + +THUMB_FUNC void Script_SavRTC_x24toDateTime(struct UnkSavStruct80* unk, struct RTCDate* date, struct RTCTime* time) +{ + struct UnkSaveStruct_0202376C_sub* rtc_info = Sav2_SysInfo_RTC_get(unk->saveBlock2); + + RTC_ConvertSecondToDateTime(date, time, rtc_info->secondsSinceNitroEpoch); +} + +THUMB_FUNC void Script_SavRTC_x2CtoDateTime(struct UnkSavStruct80* unk, struct RTCDate* date, struct RTCTime* time) +{ + struct UnkSaveStruct_0202376C_sub* rtc_info = Sav2_SysInfo_RTC_get(unk->saveBlock2); + + RTC_ConvertSecondToDateTime(date, time, rtc_info->field_2C); +} + +THUMB_FUNC void Script_SavRTC_DateTimeTox2C(struct UnkSavStruct80* unk) +{ + struct UnkSaveStruct_0202376C_sub* rtc_info = Sav2_SysInfo_RTC_get(unk->saveBlock2); + + rtc_info->field_2C = GF_RTC_DateTimeToSec(); +} + +THUMB_FUNC BOOL FUN_0204B33C(struct UnkSavStruct80* unk) +{ + struct UnkSaveStruct_0202376C_sub* rtc_info = Sav2_SysInfo_RTC_get(unk->saveBlock2); + + return FUN_02023874(rtc_info); +} -- cgit v1.2.3 From cf188406f006750ec7206e3dd2a6818c767729eb Mon Sep 17 00:00:00 2001 From: tgsm Date: Fri, 30 Apr 2021 04:30:27 -0400 Subject: Fix a bunch of function signatures A bunch of functions were thought to be returning/taking in an unk_204639c but they actually return/take an unksavstruct80. This fixes that, and also changes a couple of struct members, so this might be useful for scrcmd. --- arm9/src/unk_0204639C.c | 11 +++++------ arm9/src/unk_0204AEA8.c | 4 ++-- arm9/src/unk_0205FA2C.c | 46 ++++++++++++++++++++++------------------------ 3 files changed, 29 insertions(+), 32 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_0204639C.c b/arm9/src/unk_0204639C.c index 50aae8fa..c8291f5a 100644 --- a/arm9/src/unk_0204639C.c +++ b/arm9/src/unk_0204639C.c @@ -4,7 +4,7 @@ #pragma thumb on -struct UnkStruct_0204639C * FUN_0204639C(struct UnkStruct_0204639C * r5, UnkStruct_0204639C_cb r6, u32 * r7) +struct UnkStruct_0204639C * FUN_0204639C(struct UnkSavStruct80 * r5, UnkStruct_0204639C_cb r6, u32 * r7) { struct UnkStruct_0204639C * ret = AllocFromHeapAtEnd(32, sizeof(struct UnkStruct_0204639C)); ret->unk0 = 0; @@ -18,10 +18,9 @@ struct UnkStruct_0204639C * FUN_0204639C(struct UnkStruct_0204639C * r5, UnkStru return ret; } -void FUN_020463CC(struct UnkStruct_0204639C * r5, UnkStruct_0204639C_cb r4, u32 * r6) +void FUN_020463CC(struct UnkSavStruct80 * r5, UnkStruct_0204639C_cb r4, u32 * r6) { - if (r5->unk10 != NULL) - ErrorHandling(); + GF_ASSERT(r5->unk10 == NULL); r5->unk10 = FUN_0204639C(r5, r4, r6); } @@ -85,7 +84,7 @@ BOOL FUN_020464A4(void * r0) BOOL FUN_020464B8(struct UnkStruct_0204639C * r4) { - struct UnkStruct_0204639C * r5 = FUN_02046528(r4); + struct UnkSavStruct80 * r5 = FUN_02046528(r4); u32 * r4_2 = FUN_0204652C(r4); switch (r4_2[0]) { @@ -113,7 +112,7 @@ void FUN_02046500(struct UnkStruct_0204639C * r6, u32 r5, u32 r4) FUN_0204640C(r6, FUN_020464B8, r2); } -struct UnkStruct_0204639C * FUN_02046528(struct UnkStruct_0204639C * r0) +struct UnkSavStruct80 * FUN_02046528(struct UnkStruct_0204639C * r0) { return r0->unk18; } diff --git a/arm9/src/unk_0204AEA8.c b/arm9/src/unk_0204AEA8.c index 9c572a8e..a2b2dd71 100644 --- a/arm9/src/unk_0204AEA8.c +++ b/arm9/src/unk_0204AEA8.c @@ -3,12 +3,12 @@ #include "unk_0204639C.h" #include "unk_0204AEA8.h" -extern void MOD05_021E3444(u32, struct UnkStruct_0204639C *, u32); +extern void MOD05_021E3444(u32, struct UnkSavStruct80 *, u32); extern void FUN_0200433C(u32, u16, u32); THUMB_FUNC BOOL FUN_0204AEA8(struct UnkStruct_0204639C *a0) { - struct UnkStruct_0204639C *v0 = FUN_02046528(a0); + struct UnkSavStruct80 *v0 = FUN_02046528(a0); u32 *v1 = FUN_0204652C(a0); switch (v1[0]) diff --git a/arm9/src/unk_0205FA2C.c b/arm9/src/unk_0205FA2C.c index 9c4d7c8f..9aa4460f 100644 --- a/arm9/src/unk_0205FA2C.c +++ b/arm9/src/unk_0205FA2C.c @@ -5,12 +5,12 @@ extern void *UNK_020FA6E8; extern u32 FUN_02079C70(struct SaveBlock2 *sav2); extern void FUN_0207B000(struct UnkPlayerStruct2_0205FA2C *ptr, const u8 param1[12]); extern void FUN_0207C2A4(struct UnkPlayerStruct2_0205FA2C *ptr, struct PlayerData *player_data); -extern u32 FUN_0203384C(u32 *param0); -extern u32 *FUN_02038790(struct UnkStruct_0204639C *param0, u16 param1, u16 param2); +extern u32 FUN_0203384C(struct SaveBlock2 *sav2); +extern u32 *FUN_02038790(struct UnkSavStruct80 *param0, u16 param1, u16 param2); extern u16 *GetVarPointer(struct UnkSavStruct80 *arg, u16); -extern u16 MOD06_02244660(struct UnkStruct_0204639C *param0, u8 *param1); -extern u16 MOD06_022446BC(struct UnkStruct_0204639C *param0, u8 *param1); -extern u16 MOD06_022446E0(struct UnkStruct_0204639C *param0, u8 *param1); +extern u16 MOD06_02244660(struct UnkSavStruct80 *param0, u8 *param1); +extern u16 MOD06_022446BC(struct UnkSavStruct80 *param0, u8 *param1); +extern u16 MOD06_022446E0(struct UnkSavStruct80 *param0, u8 *param1); extern void FUN_0202A5CC(u32 param0, u32 param1); extern u32 FUN_0202A5D0(u32 param0); extern u32 FUN_0202A150(struct UnkStruct_02029FB0 *param0, u32 param1); @@ -36,12 +36,12 @@ const u8 UNK_020F7454[] = { }; THUMB_FUNC u32 FUN_0205FA2C( - struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1, u32 heap_id) + struct UnkCallbackStruct1_0205FA2C *param0, struct UnkSavStruct80 *param1, u32 heap_id) { struct UnkPlayerStruct1_0205FA2C *ptr = (struct UnkPlayerStruct1_0205FA2C *)AllocFromHeapAtEnd( heap_id, sizeof(struct UnkPlayerStruct1_0205FA2C)); - struct SaveBlock2 *sav2 = (struct SaveBlock2 *)(param1->unkC); + struct SaveBlock2 *sav2 = param1->saveBlock2; MI_CpuFill8(ptr, 0, sizeof(struct UnkPlayerStruct1_0205FA2C)); ptr->options = Sav2_PlayerData_GetOptionsAddr(sav2); @@ -70,7 +70,7 @@ THUMB_FUNC u32 FUN_0205FA2C( } THUMB_FUNC u32 FUN_0205FAD8( - struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1) + struct UnkCallbackStruct1_0205FA2C *param0, struct UnkSavStruct80 *param1) { if (FUN_0204647C(param1)) { @@ -105,9 +105,9 @@ THUMB_FUNC u32 FUN_0205FAD8( } THUMB_FUNC u32 FUN_0205FB34( - struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1, u32 heap_id) + struct UnkCallbackStruct1_0205FA2C *param0, struct UnkSavStruct80 *param1, u32 heap_id) { - struct SaveBlock2 *sav2 = (struct SaveBlock2 *)(param1->unkC); + struct SaveBlock2 *sav2 = param1->saveBlock2; struct UnkPlayerStruct2_0205FA2C *ptr = (struct UnkPlayerStruct2_0205FA2C *)AllocFromHeapAtEnd( heap_id, sizeof(struct UnkPlayerStruct2_0205FA2C)); @@ -140,7 +140,7 @@ THUMB_FUNC u32 FUN_0205FB34( } THUMB_FUNC u32 FUN_0205FBC0( - struct UnkCallbackStruct1_0205FA2C *param0, struct UnkStruct_0204639C *param1) + struct UnkCallbackStruct1_0205FA2C *param0, struct UnkSavStruct80 *param1) { if (FUN_0204647C(param1)) { @@ -158,7 +158,7 @@ THUMB_FUNC u32 FUN_0205FBC0( THUMB_FUNC int FUN_0205FBE8(struct UnkStruct_0204639C *param0) { - struct UnkStruct_0204639C *res = FUN_02046528(param0); + struct UnkSavStruct80 *res = FUN_02046528(param0); struct UnkCallbackStruct1_0205FA2C *res2 = (struct UnkCallbackStruct1_0205FA2C *)FUN_0204652C(param0); switch (res2->unk04) @@ -192,7 +192,7 @@ THUMB_FUNC void FUN_0205FC50(struct UnkStruct_0204639C *param0, u8 param6, u8 param7) { - struct UnkStruct_0204639C *res = FUN_02046528(param0); + struct UnkSavStruct80 *res = FUN_02046528(param0); struct UnkCallbackStruct1_0205FA2C *ptr = (struct UnkCallbackStruct1_0205FA2C *)AllocFromHeap( 0xb, sizeof(struct UnkCallbackStruct1_0205FA2C)); @@ -210,9 +210,9 @@ THUMB_FUNC void FUN_0205FC50(struct UnkStruct_0204639C *param0, } THUMB_FUNC u32 FUN_0205FC9C( - struct UnkCallbackStruct2_0205FA2C *param0, struct UnkStruct_0204639C *param1) + struct UnkCallbackStruct2_0205FA2C *param0, struct UnkSavStruct80 *param1) { - if (FUN_0203384C(param1->unkC)) + if (FUN_0203384C(param1->saveBlock2)) { param0->unk08 = FUN_02038790(param1, param0->unk12, param0->unk14); @@ -224,7 +224,7 @@ THUMB_FUNC u32 FUN_0205FC9C( } THUMB_FUNC u32 FUN_0205FCC4( - struct UnkCallbackStruct2_0205FA2C *param0, struct UnkStruct_0204639C *param1) + struct UnkCallbackStruct2_0205FA2C *param0, struct UnkSavStruct80 *param1) { if (FUN_0204647C(param1)) { @@ -239,7 +239,7 @@ THUMB_FUNC u32 FUN_0205FCC4( THUMB_FUNC int FUN_0205FCE8(struct UnkStruct_0204639C *param0) { - struct UnkStruct_0204639C *res = FUN_02046528(param0); + struct UnkSavStruct80 *res = FUN_02046528(param0); struct UnkCallbackStruct2_0205FA2C *res2 = (struct UnkCallbackStruct2_0205FA2C *)FUN_0204652C(param0); @@ -252,7 +252,7 @@ THUMB_FUNC int FUN_0205FCE8(struct UnkStruct_0204639C *param0) res2->unk04 = FUN_0205FCC4(res2, res); break; case 2: - u16 *var = GetVarPointer((struct UnkSavStruct80 *)res, res2->unk10); + u16 *var = GetVarPointer(res, res2->unk10); *var = (u16)res2->unk00; FreeToHeap(res2); @@ -264,7 +264,7 @@ THUMB_FUNC int FUN_0205FCE8(struct UnkStruct_0204639C *param0) THUMB_FUNC void FUN_0205FD38(struct UnkStruct_0204639C *param0, u16 param1, u16 param2, u16 param3) { - struct UnkStruct_0204639C *res = FUN_02046528(param0); + struct UnkSavStruct80 *res = FUN_02046528(param0); struct UnkCallbackStruct2_0205FA2C *ptr = (struct UnkCallbackStruct2_0205FA2C *)AllocFromHeap( 0xb, sizeof(struct UnkCallbackStruct2_0205FA2C)); MI_CpuFill8(ptr, 0, sizeof(struct UnkCallbackStruct2_0205FA2C)); @@ -278,7 +278,7 @@ THUMB_FUNC void FUN_0205FD38(struct UnkStruct_0204639C *param0, u16 param1, u16 THUMB_FUNC int FUN_0205FD70(struct UnkStruct_0204639C *param0) { - struct UnkStruct_0204639C *res = FUN_02046528(param0); + struct UnkSavStruct80 *res = FUN_02046528(param0); u16 *res2 = (u16 *)FUN_0204652C(param0); u8 *res3 = FUN_020316E0(1 - FUN_02031190()); if (res3 == NULL) @@ -286,7 +286,7 @@ THUMB_FUNC int FUN_0205FD70(struct UnkStruct_0204639C *param0) return 0; } - u16 *var = GetVarPointer((struct UnkSavStruct80 *)res, res2[1]); + u16 *var = GetVarPointer(res, res2[1]); switch (res2[0]) { case 0: @@ -294,11 +294,9 @@ THUMB_FUNC int FUN_0205FD70(struct UnkStruct_0204639C *param0) break; case 1: *var = MOD06_022446BC(res, res3); - break; case 2: *var = MOD06_022446E0(res, res3); - break; } @@ -309,7 +307,7 @@ THUMB_FUNC int FUN_0205FD70(struct UnkStruct_0204639C *param0) THUMB_FUNC void FUN_0205FDDC(struct UnkStruct_0204639C *param0, u16 param1, u16 param2) { - struct UnkStruct_0204639C *res = FUN_02046528(param0); + struct UnkSavStruct80 *res = FUN_02046528(param0); u16 *ptr = AllocFromHeap(0xb, 2 * sizeof(u16)); MI_CpuFill8(ptr, 0, 2 * sizeof(u16)); -- cgit v1.2.3 From 6b6c7eab5f18fb21b6ca40795b1042d3bcf85ff3 Mon Sep 17 00:00:00 2001 From: fyren Date: Sat, 1 May 2021 12:09:14 +0200 Subject: decompile unk_0206015C --- arm9/asm/unk_0206015C.s | 233 ------------------------------------------------ arm9/global.inc | 1 + arm9/src/unk_0206015C.c | 113 +++++++++++++++++++++++ 3 files changed, 114 insertions(+), 233 deletions(-) delete mode 100644 arm9/asm/unk_0206015C.s create mode 100644 arm9/src/unk_0206015C.c (limited to 'arm9') diff --git a/arm9/asm/unk_0206015C.s b/arm9/asm/unk_0206015C.s deleted file mode 100644 index 296e65c5..00000000 --- a/arm9/asm/unk_0206015C.s +++ /dev/null @@ -1,233 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .extern gMain - - .text - - thumb_func_start FUN_0206015C -FUN_0206015C: ; 0x0206015C - push {r3-r5, lr} - add r5, r0, #0x0 - mov r0, #0xb - mov r1, #0x10 - bl AllocFromHeapAtEnd - add r4, r0, #0x0 - mov r0, #0xb - bl MOD06_02244DB0 - str r0, [r4, #0x0] - mov r0, #0xb - add r1, r5, #0x0 - bl MOD06_02245114 - str r0, [r4, #0x4] - mov r0, #0x0 - strb r0, [r4, #0xc] - strb r0, [r4, #0xd] - ldr r0, [r5, #0x10] - ldr r1, _02060190 ; =FUN_02060194 - add r2, r4, #0x0 - bl FUN_0204640C - pop {r3-r5, pc} - nop -_02060190: .word FUN_02060194 - - thumb_func_start FUN_02060194 -FUN_02060194: ; 0x02060194 - push {r3-r7, lr} - sub sp, #0x10 - add r5, r0, #0x0 - bl FUN_02046528 - add r6, r0, #0x0 - add r0, r5, #0x0 - bl FUN_0204652C - add r4, r0, #0x0 - ldrb r0, [r4, #0xc] - cmp r0, #0x8 - bls _020601B0 - b _02060332 -_020601B0: - add r0, r0, r0 - add r0, pc - ldrh r0, [r0, #0x6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_020601BC: ; jump table (using 16-bit offset) - .short _020601CE - _020601BC - 2; case 0 - .short _020601F2 - _020601BC - 2; case 1 - .short _020601FE - _020601BC - 2; case 2 - .short _02060226 - _020601BC - 2; case 3 - .short _02060232 - _020601BC - 2; case 4 - .short _020602A2 - _020601BC - 2; case 5 - .short _020602F0 - _020601BC - 2; case 6 - .short _020602FC - _020601BC - 2; case 7 - .short _02060312 - _020601BC - 2; case 8 -_020601CE: - add r0, r6, #0x0 - mov r1, #0x1 - bl FUN_0206367C - ldrb r0, [r4, #0xd] - ldr r1, [r4, #0x4] - bl MOD06_02245198 - ldr r0, [r4, #0x4] - bl MOD06_022451F0 - str r0, [r4, #0x8] - add r0, r5, #0x0 - bl FUN_0204AFC8 - mov r0, #0x1 - strb r0, [r4, #0xc] - b _02060332 -_020601F2: - add r0, r5, #0x0 - bl FUN_0204AF3C - mov r0, #0x2 - strb r0, [r4, #0xc] - b _02060332 -_020601FE: - ldr r0, [r6, #0xc] - bl SavArray_Flags_get - ldrb r1, [r4, #0xd] - cmp r1, #0x0 - bne _02060210 - bl FUN_0205F1C4 - b _02060218 -_02060210: - cmp r1, #0x5 - bne _02060218 - bl FUN_0205F1D4 -_02060218: - ldr r1, [r4, #0x8] - add r0, r5, #0x0 - bl FUN_02049160 - mov r0, #0x3 - strb r0, [r4, #0xc] - b _02060332 -_02060226: - add r0, r5, #0x0 - bl FUN_0204AF84 - mov r0, #0x4 - strb r0, [r4, #0xc] - b _02060332 -_02060232: - ldr r0, [r6, #0x38] - bl FUN_020553A0 - ldrb r1, [r4, #0xd] - add r7, r0, #0x0 - add r1, r1, #0x1 - strb r1, [r4, #0xd] - ldrb r1, [r4, #0xd] - cmp r1, #0x5 - bhi _02060290 - add r0, r6, #0x0 - bl MOD06_02245088 - add r6, r0, #0x0 - add r0, r7, #0x0 - mov r1, #0x1 - bl FUN_0205889C - ldr r0, [r4, #0x0] - add r1, r6, #0x0 - bl MOD06_02244DC4 - ldr r0, [r4, #0x0] - bl MOD06_02244EF8 - mov r0, #0x0 - strb r0, [r4, #0xe] - ldr r0, _02060338 ; =0x00000679 - bl FUN_020054C8 - mov r0, #0x0 - str r0, [sp, #0x0] - mov r0, #0x6 - str r0, [sp, #0x4] - mov r0, #0x1 - str r0, [sp, #0x8] - mov r0, #0xb - str r0, [sp, #0xc] - ldr r3, _0206033C ; =0x0000FFFF - add r0, r5, #0x0 - mov r1, #0x3 - mov r2, #0x11 - bl FUN_0204C1B4 - mov r0, #0x5 - strb r0, [r4, #0xc] - b _02060332 -_02060290: - mov r1, #0x0 - bl FUN_0205889C - add r0, r5, #0x0 - bl FUN_0204B00C - mov r0, #0x8 - strb r0, [r4, #0xc] - b _02060332 -_020602A2: - ldrb r0, [r4, #0xe] - add r0, r0, #0x1 - strb r0, [r4, #0xe] - ldrb r0, [r4, #0xe] - cmp r0, #0x3c - bhs _020602B8 - ldr r0, _02060340 ; =gMain - ldr r1, [r0, #0x48] - mov r0, #0x1 - tst r0, r1 - beq _02060332 -_020602B8: - ldrb r0, [r4, #0xd] - ldr r1, [r4, #0x4] - bl MOD06_02245198 - ldr r0, [r4, #0x4] - bl MOD06_022451F0 - str r0, [r4, #0x8] - ldr r0, _02060338 ; =0x00000679 - bl FUN_020054C8 - mov r0, #0x0 - str r0, [sp, #0x0] - mov r0, #0x6 - str r0, [sp, #0x4] - mov r0, #0x1 - str r0, [sp, #0x8] - mov r0, #0xb - str r0, [sp, #0xc] - ldr r3, _0206033C ; =0x0000FFFF - add r0, r5, #0x0 - mov r1, #0x3 - mov r2, #0x10 - bl FUN_0204C1B4 - mov r0, #0x6 - strb r0, [r4, #0xc] - b _02060332 -_020602F0: - ldr r0, [r4, #0x0] - bl MOD06_02244F18 - mov r0, #0x7 - strb r0, [r4, #0xc] - b _02060332 -_020602FC: - ldr r0, [r4, #0x0] - bl MOD06_02244F24 - cmp r0, #0x0 - beq _02060332 - ldr r0, [r4, #0x0] - bl MOD06_02244F2C - mov r0, #0x1 - strb r0, [r4, #0xc] - b _02060332 -_02060312: - add r0, r6, #0x0 - mov r1, #0x0 - bl FUN_0206367C - ldr r0, [r4, #0x4] - bl MOD06_02245190 - ldr r0, [r4, #0x0] - bl MOD06_02244DBC - add r0, r4, #0x0 - bl FreeToHeap - add sp, #0x10 - mov r0, #0x1 - pop {r3-r7, pc} -_02060332: - mov r0, #0x0 - add sp, #0x10 - pop {r3-r7, pc} - .balign 4 -_02060338: .word 0x00000679 -_0206033C: .word 0x0000FFFF -_02060340: .word gMain diff --git a/arm9/global.inc b/arm9/global.inc index 9df9973e..a944a1b1 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -4633,6 +4633,7 @@ .extern FUN_020600DC .extern FUN_02060144 .extern FUN_0206015C +.extern FUN_02060194 .extern FUN_02060344 .extern FUN_020603B0 .extern FUN_020603C8 diff --git a/arm9/src/unk_0206015C.c b/arm9/src/unk_0206015C.c new file mode 100644 index 00000000..07076506 --- /dev/null +++ b/arm9/src/unk_0206015C.c @@ -0,0 +1,113 @@ +#include "unk_0206015C.h" + +THUMB_FUNC void FUN_0206015C(struct UnkSavStruct80 *savStruct) +{ + struct UnkStruct_0206015C *unkStruct = AllocFromHeapAtEnd(0xb, 0x10); + unkStruct->unk0 = MOD06_02244DB0(0xb); + unkStruct->unk4 = MOD06_02245114(0xb, savStruct); + unkStruct->unkC = 0; + unkStruct->unkD = 0; + + FUN_0204640C(savStruct->unk10, FUN_02060194, (u32 *)unkStruct); +} + +THUMB_FUNC BOOL FUN_02060194(struct UnkStruct_0204639C *unkStruct0) +{ + struct UnkSavStruct80 *savStruct = FUN_02046528(unkStruct0); + struct UnkStruct_0204652C *unkStruct1 = (struct UnkStruct_0204652C *)FUN_0204652C(unkStruct0); + + switch (unkStruct1->action) + { + case 0: + FUN_0206367C(savStruct, 1); + MOD06_02245198(unkStruct1->unkD, unkStruct1->unk4); + unkStruct1->unk8 = MOD06_022451F0(unkStruct1->unk4); + FUN_0204AFC8(unkStruct0); + unkStruct1->action = 1; + break; + + case 1: + FUN_0204AF3C(unkStruct0); + unkStruct1->action = 2; + break; + + case 2: + struct ScriptState *scrState = SavArray_Flags_get(savStruct->saveBlock2); + u8 unkD = unkStruct1->unkD; + if (unkD == 0) + { + FUN_0205F1C4(scrState); + } + else if (unkD == 5) + { + FUN_0205F1D4(scrState); + } + FUN_02049160(unkStruct0, unkStruct1->unk8); + unkStruct1->action = 3; + break; + + case 3: + FUN_0204AF84(unkStruct0); + unkStruct1->action = 4; + break; + + case 4: + u32 unk0 = FUN_020553A0(savStruct->unk38); + unkStruct1->unkD += 1; + if (unkStruct1->unkD <= 5) + { + void *unkAddr = MOD06_02245088(savStruct); + FUN_0205889C(unk0, 1); + MOD06_02244DC4(unkStruct1->unk0, unkAddr); + MOD06_02244EF8(unkStruct1->unk0); + unkStruct1->unkE = 0; + FUN_020054C8(1657); + FUN_0204C1B4(unkStruct0, 0x3, 0x11, 0x0000FFFF, 0, 6, 1, 0xb); + unkStruct1->action = 5; + } + else + { + FUN_0205889C(unk0, 0); + FUN_0204B00C(unkStruct0); + unkStruct1->action = 8; + } + break; + + case 5: + unkStruct1->unkE += 1; + if (unkStruct1->unkE < 0x3c && !(gMain.unk48 & 1)) + break; + + MOD06_02245198(unkStruct1->unkD, unkStruct1->unk4); + unkStruct1->unk8 = MOD06_022451F0(unkStruct1->unk4); + + FUN_020054C8(1657); + FUN_0204C1B4(unkStruct0, 0x3, 0x10, 0x0000FFFF, 0, 6, 1, 0xb); + unkStruct1->action = 6; + break; + + case 6: + MOD06_02244F18(unkStruct1->unk0); + unkStruct1->action = 7; + break; + + case 7: + if (MOD06_02244F24(unkStruct1->unk0)) + { + MOD06_02244F2C(unkStruct1->unk0); + unkStruct1->action = 1; + } + break; + + case 8: + FUN_0206367C(savStruct, 0); + MOD06_02245190(unkStruct1->unk4); + MOD06_02244DBC(unkStruct1->unk0); + FreeToHeap(unkStruct1); + return 1; + + default: + break; + } + return 0; +} \ No newline at end of file -- cgit v1.2.3 From ce5a50546d48ebe03adee670db617ec0deb30060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 1 May 2021 12:59:57 +0200 Subject: decompile unk_02031734.s --- arm9/asm/unk_02031734.s | 4136 ----------------------------------------------- arm9/src/unk_02031734.c | 2365 +++++++++++++++++++++++++++ 2 files changed, 2365 insertions(+), 4136 deletions(-) delete mode 100644 arm9/asm/unk_02031734.s create mode 100644 arm9/src/unk_02031734.c (limited to 'arm9') diff --git a/arm9/asm/unk_02031734.s b/arm9/asm/unk_02031734.s deleted file mode 100644 index 5a054d51..00000000 --- a/arm9/asm/unk_02031734.s +++ /dev/null @@ -1,4136 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .extern gMain - .section .rodata - .global UNK_020EEC48 -UNK_020EEC48: ; 0x020EEC48 - .word FUN_02032B84, 0x00000000 - - .global UNK_020EEC50 -UNK_020EEC50: ; 0x020EEC50 - .word FUN_0203213C, FUN_02032138, 0x00000000 - - .global UNK_020EEC5C -UNK_020EEC5C: ; 0x020EEC5C - .word FUN_02032234, FUN_0203234C, 0x00000000 - - .section .data - - .balign 4 - .global UNK_02105D5C -UNK_02105D5C: ; 0x02105D5C - .asciz "FREAK" - - .balign 4 - .global UNK_02105D64 -UNK_02105D64: ; 0x02105D64 - .asciz " FULL" - - .balign 4 - .global UNK_02105D6C -UNK_02105D6C: ; 0x02105D6C - .asciz " GAME" - - .section .bss - - .global UNK_021C5A00 -UNK_021C5A00: ; 0x021C5A00 - .space 0x4 - - .text - - thumb_func_start FUN_02031734 -FUN_02031734: ; 0x02031734 - push {r3-r5, lr} - add r5, r0, #0x0 - ldr r0, _020317BC ; =UNK_021C5A00 - add r4, r1, #0x0 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - bne _020317B8 - bl FUN_0202E49C - mov r0, #0xf - mov r1, #0x50 - bl AllocFromHeap - ldr r1, _020317BC ; =UNK_021C5A00 - mov r2, #0x50 - str r0, [r1, #0x0] - mov r1, #0x0 - bl MI_CpuFill8 - ldr r0, _020317BC ; =UNK_021C5A00 - mov r2, #0x32 - ldr r1, [r0, #0x0] - strh r2, [r1, #0x3a] - ldr r1, [r0, #0x0] - mov r2, #0x1 - add r1, #0x43 - strb r2, [r1, #0x0] - ldr r0, [r0, #0x0] - str r5, [r0, #0x28] - add r0, r5, #0x0 - bl Sav2_PlayerData_GetProfileAddr - ldr r1, _020317BC ; =UNK_021C5A00 - ldr r2, [r1, #0x0] - str r0, [r2, #0x2c] - ldr r0, [r1, #0x0] - mov r2, #0x2 - add r0, #0x3c - strb r2, [r0, #0x0] - ldr r0, [r1, #0x0] - mov r2, #0x0 - add r0, #0x3d - strb r2, [r0, #0x0] - ldr r0, [r1, #0x0] - add r0, #0x48 - strb r2, [r0, #0x0] - ldr r0, [r1, #0x0] - add r0, #0x3f - strb r4, [r0, #0x0] - ldr r0, [r1, #0x0] - add r0, #0xc - bl FUN_020312BC - mov r0, #0x0 - add r1, r0, #0x0 - add r2, r0, #0x0 - bl FUN_0202D8D0 - cmp r4, #0x9 - beq _020317B8 - cmp r4, #0x11 - beq _020317B8 - cmp r4, #0xf - beq _020317B8 - bl FUN_02033E74 -_020317B8: - pop {r3-r5, pc} - nop -_020317BC: .word UNK_021C5A00 - - thumb_func_start FUN_020317C0 -FUN_020317C0: ; 0x020317C0 - push {r3, lr} - ldr r0, _0203180C ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _0203180A - bl FUN_0202D918 - ldr r0, _0203180C ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _020317DC - bl FreeToHeap -_020317DC: - ldr r0, _0203180C ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x3f - ldrb r0, [r0, #0x0] - cmp r0, #0x13 - blo _020317EE - mov r0, #0x31 - bl FUN_020168D0 -_020317EE: - bl FUN_02033ED0 - bl FUN_0202E4F0 - ldr r0, _0203180C ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - bl FreeToHeap - mov r0, #0xf - bl FUN_020168D0 - ldr r0, _0203180C ; =UNK_021C5A00 - mov r1, #0x0 - str r1, [r0, #0x0] -_0203180A: - pop {r3, pc} - .balign 4 -_0203180C: .word UNK_021C5A00 - - thumb_func_start FUN_02031810 -FUN_02031810: ; 0x02031810 - ldr r0, _02031820 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _0203181C - mov r0, #0x1 - bx lr -_0203181C: - mov r0, #0x0 - bx lr - .balign 4 -_02031820: .word UNK_021C5A00 - - thumb_func_start FUN_02031824 -FUN_02031824: ; 0x02031824 - push {r4, lr} - add r4, r0, #0x0 - ldr r0, _02031858 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - bne _02031856 - mov r2, #0xe - mov r0, #0x3 - mov r1, #0xf - lsl r2, r2, #0xc - bl FUN_02016828 - add r0, r4, #0x0 - mov r1, #0xa - bl FUN_02031734 - ldr r0, _02031858 ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - add r0, #0x40 - strb r1, [r0, #0x0] - ldr r0, _0203185C ; =FUN_02031D30 - mov r1, #0x32 - bl FUN_02031D20 -_02031856: - pop {r4, pc} - .balign 4 -_02031858: .word UNK_021C5A00 -_0203185C: .word FUN_02031D30 - - thumb_func_start FUN_02031860 -FUN_02031860: ; 0x02031860 - push {r3, lr} - ldr r0, _02031878 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _02031876 - bl FUN_02031468 - ldr r0, _0203187C ; =FUN_020323CC - mov r1, #0x0 - bl FUN_02031D20 -_02031876: - pop {r3, pc} - .balign 4 -_02031878: .word UNK_021C5A00 -_0203187C: .word FUN_020323CC - - thumb_func_start FUN_02031880 -FUN_02031880: ; 0x02031880 - push {r3, lr} - bl FUN_0202FC60 - bl FUN_02031190 - ldr r1, _0203189C ; =UNK_021C5A00 - ldr r1, [r1, #0x0] - strh r0, [r1, #0x38] - ldr r0, _020318A0 ; =FUN_020321B8 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} - nop -_0203189C: .word UNK_021C5A00 -_020318A0: .word FUN_020321B8 - - thumb_func_start FUN_020318A4 -FUN_020318A4: ; 0x020318A4 - ldr r1, _020318B0 ; =UNK_021C5A00 - ldr r1, [r1, #0x0] - add r1, #0x4f - strb r0, [r1, #0x0] - bx lr - nop -_020318B0: .word UNK_021C5A00 - - thumb_func_start FUN_020318B4 -FUN_020318B4: ; 0x020318B4 - ldr r3, _020318BC ; =FUN_02031D20 - ldr r0, _020318C0 ; =FUN_02032028 - mov r1, #0x0 - bx r3 - .balign 4 -_020318BC: .word FUN_02031D20 -_020318C0: .word FUN_02032028 - - thumb_func_start FUN_020318C4 -FUN_020318C4: ; 0x020318C4 - push {r4} - sub sp, #0xc - ldr r4, _0203190C ; =UNK_020EEC50 - add r3, sp, #0x0 - ldmia r4!, {r0-r1} - add r2, r3, #0x0 - stmia r3!, {r0-r1} - ldr r0, [r4, #0x0] - str r0, [r3, #0x0] - ldr r0, _02031910 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r1, [r0, #0x24] - cmp r0, #0x0 - bne _020318E8 - add sp, #0xc - mov r0, #0x0 - pop {r4} - bx lr -_020318E8: - ldr r0, [sp, #0x0] - cmp r0, #0x0 - beq _02031904 -_020318EE: - ldr r0, [r2, #0x0] - cmp r1, r0 - bne _020318FC - add sp, #0xc - mov r0, #0x1 - pop {r4} - bx lr -_020318FC: - add r2, r2, #0x4 - ldr r0, [r2, #0x0] - cmp r0, #0x0 - bne _020318EE -_02031904: - mov r0, #0x0 - add sp, #0xc - pop {r4} - bx lr - .balign 4 -_0203190C: .word UNK_020EEC50 -_02031910: .word UNK_021C5A00 - - thumb_func_start FUN_02031914 -FUN_02031914: ; 0x02031914 - ldr r3, _0203191C ; =FUN_02031D20 - ldr r0, _02031920 ; =FUN_02032178 - mov r1, #0x0 - bx r3 - .balign 4 -_0203191C: .word FUN_02031D20 -_02031920: .word FUN_02032178 - - thumb_func_start FUN_02031924 -FUN_02031924: ; 0x02031924 - ldr r0, _02031930 ; =UNK_021C5A00 - mov r1, #0x1 - ldr r0, [r0, #0x0] - add r0, #0x4c - strb r1, [r0, #0x0] - bx lr - .balign 4 -_02031930: .word UNK_021C5A00 - - thumb_func_start FUN_02031934 -FUN_02031934: ; 0x02031934 - push {r3, lr} - bl FUN_0202E49C - ldr r0, _02031944 ; =FUN_02032194 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} - .balign 4 -_02031944: .word FUN_02032194 - - thumb_func_start FUN_02031948 -FUN_02031948: ; 0x02031948 - push {r3-r7, lr} - add r6, r0, #0x0 - add r7, r1, #0x0 - add r5, r2, #0x0 - add r4, r3, #0x0 - bl FUN_02030F40 - cmp r0, #0x0 - bne _02031980 - ldr r2, _02031984 ; =0x00007080 - mov r0, #0x3 - mov r1, #0xf - bl FUN_02016828 - add r0, r6, #0x0 - add r1, r7, #0x0 - bl FUN_02031734 - ldr r0, _02031988 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - add r1, #0x40 - strb r5, [r1, #0x0] - ldr r0, [r0, #0x0] - mov r1, #0x0 - str r4, [r0, #0x30] - ldr r0, _0203198C ; =FUN_020321D0 - bl FUN_02031D20 -_02031980: - pop {r3-r7, pc} - nop -_02031984: .word 0x00007080 -_02031988: .word UNK_021C5A00 -_0203198C: .word FUN_020321D0 - - thumb_func_start FUN_02031990 -FUN_02031990: ; 0x02031990 - push {r3-r7, lr} - add r6, r0, #0x0 - add r7, r1, #0x0 - add r5, r2, #0x0 - add r4, r3, #0x0 - bl FUN_02030F40 - cmp r0, #0x0 - bne _020319C8 - ldr r2, _020319CC ; =0x00007080 - mov r0, #0x3 - mov r1, #0xf - bl FUN_02016828 - add r0, r6, #0x0 - add r1, r7, #0x0 - bl FUN_02031734 - ldr r0, _020319D0 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - add r1, #0x40 - strb r5, [r1, #0x0] - ldr r0, [r0, #0x0] - mov r1, #0x0 - str r4, [r0, #0x30] - ldr r0, _020319D4 ; =FUN_0203224C - bl FUN_02031D20 -_020319C8: - pop {r3-r7, pc} - nop -_020319CC: .word 0x00007080 -_020319D0: .word UNK_021C5A00 -_020319D4: .word FUN_0203224C - - thumb_func_start FUN_020319D8 -FUN_020319D8: ; 0x020319D8 - ldr r1, _020319E8 ; =UNK_021C5A00 - ldr r3, _020319EC ; =FUN_02031D20 - ldr r1, [r1, #0x0] - add r1, #0x3e - strb r0, [r1, #0x0] - ldr r0, _020319F0 ; =FUN_02032298 - mov r1, #0x0 - bx r3 - .balign 4 -_020319E8: .word UNK_021C5A00 -_020319EC: .word FUN_02031D20 -_020319F0: .word FUN_02032298 - - thumb_func_start FUN_020319F4 -FUN_020319F4: ; 0x020319F4 - push {r3, lr} - bl FUN_0202FCA8 - ldr r0, _02031A04 ; =FUN_02032364 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} - .balign 4 -_02031A04: .word FUN_02032364 - - thumb_func_start FUN_02031A08 -FUN_02031A08: ; 0x02031A08 - push {r3, lr} - ldr r0, _02031A1C ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _02031A1A - ldr r0, _02031A20 ; =FUN_02032440 - mov r1, #0x5 - bl FUN_02031D20 -_02031A1A: - pop {r3, pc} - .balign 4 -_02031A1C: .word UNK_021C5A00 -_02031A20: .word FUN_02032440 - - thumb_func_start FUN_02031A24 -FUN_02031A24: ; 0x02031A24 - ldr r3, _02031A28 ; =FUN_0202D298 - bx r3 - .balign 4 -_02031A28: .word FUN_0202D298 - - thumb_func_start FUN_02031A2C -FUN_02031A2C: ; 0x02031A2C - push {r4} - sub sp, #0xc - ldr r4, _02031A74 ; =UNK_020EEC5C - add r3, sp, #0x0 - ldmia r4!, {r0-r1} - add r2, r3, #0x0 - stmia r3!, {r0-r1} - ldr r0, [r4, #0x0] - str r0, [r3, #0x0] - ldr r0, _02031A78 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r1, [r0, #0x24] - cmp r0, #0x0 - bne _02031A50 - add sp, #0xc - mov r0, #0x0 - pop {r4} - bx lr -_02031A50: - ldr r0, [sp, #0x0] - cmp r0, #0x0 - beq _02031A6C -_02031A56: - ldr r0, [r2, #0x0] - cmp r1, r0 - bne _02031A64 - add sp, #0xc - mov r0, #0x1 - pop {r4} - bx lr -_02031A64: - add r2, r2, #0x4 - ldr r0, [r2, #0x0] - cmp r0, #0x0 - bne _02031A56 -_02031A6C: - mov r0, #0x0 - add sp, #0xc - pop {r4} - bx lr - .balign 4 -_02031A74: .word UNK_020EEC5C -_02031A78: .word UNK_021C5A00 - - thumb_func_start FUN_02031A7C -FUN_02031A7C: ; 0x02031A7C - push {r4, lr} - add r4, r0, #0x0 - ldr r0, _02031ABC ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - bne _02031ABA - ldr r2, _02031AC0 ; =0x00007080 - mov r0, #0x3 - mov r1, #0xf - bl FUN_02016828 - cmp r0, #0x0 - bne _02031A9A - bl FUN_020335E0 -_02031A9A: - add r0, r4, #0x0 - mov r1, #0x9 - bl FUN_02031734 - ldr r0, _02031ABC ; =UNK_021C5A00 - mov r2, #0x9 - ldr r1, [r0, #0x0] - add r1, #0x3f - strb r2, [r1, #0x0] - ldr r0, [r0, #0x0] - mov r1, #0x0 - add r0, #0x40 - strb r1, [r0, #0x0] - ldr r0, _02031AC4 ; =FUN_02032478 - bl FUN_02031D20 -_02031ABA: - pop {r4, pc} - .balign 4 -_02031ABC: .word UNK_021C5A00 -_02031AC0: .word 0x00007080 -_02031AC4: .word FUN_02032478 - - thumb_func_start FUN_02031AC8 -FUN_02031AC8: ; 0x02031AC8 - push {r3, lr} - ldr r1, _02031AEC ; =UNK_021C5A00 - ldr r2, [r1, #0x0] - add r2, #0x3e - strb r0, [r2, #0x0] - ldr r0, [r1, #0x0] - mov r2, #0x3 - strh r2, [r0, #0x38] - mov r0, #0x1 - bl FUN_0202D344 - bl FUN_02033E74 - ldr r0, _02031AF0 ; =FUN_02032628 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} - .balign 4 -_02031AEC: .word UNK_021C5A00 -_02031AF0: .word FUN_02032628 - - thumb_func_start FUN_02031AF4 -FUN_02031AF4: ; 0x02031AF4 - ldr r0, _02031B20 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - bne _02031B02 - mov r0, #0x0 - mvn r0, r0 - bx lr -_02031B02: - ldr r1, [r0, #0x24] - ldr r0, _02031B24 ; =FUN_0203279C - cmp r1, r0 - bne _02031B0E - mov r0, #0x1 - bx lr -_02031B0E: - ldr r0, _02031B28 ; =FUN_020327B4 - cmp r1, r0 - bne _02031B18 - mov r0, #0x1 - b _02031B1A -_02031B18: - mov r0, #0x0 -_02031B1A: - neg r0, r0 - bx lr - nop -_02031B20: .word UNK_021C5A00 -_02031B24: .word FUN_0203279C -_02031B28: .word FUN_020327B4 - - thumb_func_start FUN_02031B2C -FUN_02031B2C: ; 0x02031B2C - ldr r0, _02031B48 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - bne _02031B38 - mov r0, #0x0 - bx lr -_02031B38: - ldr r1, [r0, #0x24] - ldr r0, _02031B4C ; =FUN_020327FC - cmp r1, r0 - bne _02031B44 - mov r0, #0x1 - bx lr -_02031B44: - mov r0, #0x0 - bx lr - .balign 4 -_02031B48: .word UNK_021C5A00 -_02031B4C: .word FUN_020327FC - - thumb_func_start FUN_02031B50 -FUN_02031B50: ; 0x02031B50 - push {r3, lr} - mov r0, #0x0 - bl FUN_0202D344 - ldr r0, _02031BC4 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - add r0, r1, #0x0 - add r0, #0x44 - ldrb r0, [r0, #0x0] - cmp r0, #0x1 - bne _02031B78 - add r0, r1, #0x0 - add r0, #0x45 - ldrb r0, [r0, #0x0] - cmp r0, #0x1 - bne _02031B78 - add r1, #0x3f - ldrb r0, [r1, #0x0] - cmp r0, #0x9 - bne _02031B80 -_02031B78: - mov r0, #0x0 - add r1, r0, #0x0 - bl FUN_020334E8 -_02031B80: - bl FUN_02033ED0 - ldr r0, _02031BC4 ; =UNK_021C5A00 - mov r2, #0x9 - ldr r1, [r0, #0x0] - add r1, #0x3f - strb r2, [r1, #0x0] - ldr r1, [r0, #0x0] - mov r2, #0x0 - add r1, #0x48 - strb r2, [r1, #0x0] - ldr r0, [r0, #0x0] - add r0, #0x3c - ldrb r0, [r0, #0x0] - bl FUN_0202D1B0 - bl FUN_02031190 - cmp r0, #0x0 - bne _02031BB8 - mov r0, #0x1 - bl FUN_0202D36C - ldr r0, _02031BC8 ; =FUN_020323DC - mov r1, #0xf - bl FUN_02031D20 - pop {r3, pc} -_02031BB8: - ldr r0, _02031BCC ; =FUN_02032424 - mov r1, #0x5 - bl FUN_02031D20 - pop {r3, pc} - nop -_02031BC4: .word UNK_021C5A00 -_02031BC8: .word FUN_020323DC -_02031BCC: .word FUN_02032424 - - thumb_func_start FUN_02031BD0 -FUN_02031BD0: ; 0x02031BD0 - ldr r0, _02031BEC ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - bne _02031BDC - mov r0, #0x1 - bx lr -_02031BDC: - ldr r1, [r0, #0x24] - ldr r0, _02031BF0 ; =FUN_020324F8 - cmp r1, r0 - beq _02031BE8 - mov r0, #0x1 - bx lr -_02031BE8: - mov r0, #0x0 - bx lr - .balign 4 -_02031BEC: .word UNK_021C5A00 -_02031BF0: .word FUN_020324F8 - - thumb_func_start FUN_02031BF4 -FUN_02031BF4: ; 0x02031BF4 - push {r3, lr} - ldr r0, _02031C08 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _02031C06 - ldr r0, _02031C0C ; =FUN_02032440 - mov r1, #0x5 - bl FUN_02031D20 -_02031C06: - pop {r3, pc} - .balign 4 -_02031C08: .word UNK_021C5A00 -_02031C0C: .word FUN_02032440 - - thumb_func_start FUN_02031C10 -FUN_02031C10: ; 0x02031C10 - push {r3, lr} - ldr r0, _02031C28 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - cmp r1, #0x0 - beq _02031C24 - mov r0, #0x1 - add r1, #0x48 - strb r0, [r1, #0x0] - bl FUN_0202D344 -_02031C24: - pop {r3, pc} - nop -_02031C28: .word UNK_021C5A00 - - thumb_func_start FUN_02031C2C -FUN_02031C2C: ; 0x02031C2C - push {r3, lr} - ldr r0, _02031C4C ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - cmp r1, #0x0 - beq _02031C48 - mov r0, #0x1 - add r1, #0x48 - strb r0, [r1, #0x0] - bl FUN_0202D344 - ldr r0, _02031C50 ; =FUN_02032850 - mov r1, #0x0 - bl FUN_02031D20 -_02031C48: - pop {r3, pc} - nop -_02031C4C: .word UNK_021C5A00 -_02031C50: .word FUN_02032850 - - thumb_func_start FUN_02031C54 -FUN_02031C54: ; 0x02031C54 - ldr r0, _02031C60 ; =UNK_021C5A00 - mov r1, #0x12 - ldr r0, [r0, #0x0] - add r0, #0x3f - strb r1, [r0, #0x0] - bx lr - .balign 4 -_02031C60: .word UNK_021C5A00 - - thumb_func_start FUN_02031C64 -FUN_02031C64: ; 0x02031C64 - ldr r0, _02031C70 ; =UNK_021C5A00 - mov r1, #0x9 - ldr r0, [r0, #0x0] - add r0, #0x3f - strb r1, [r0, #0x0] - bx lr - .balign 4 -_02031C70: .word UNK_021C5A00 - - thumb_func_start FUN_02031C74 -FUN_02031C74: ; 0x02031C74 - push {r3-r5, lr} - add r5, r0, #0x0 - add r4, r1, #0x0 - bl FUN_02030F40 - cmp r0, #0x0 - bne _02031C9C - ldr r2, _02031CA0 ; =0x00007080 - mov r0, #0x3 - mov r1, #0xf - bl FUN_02016828 - add r0, r5, #0x0 - add r1, r4, #0x0 - bl FUN_02031734 - ldr r0, _02031CA4 ; =FUN_02032E00 - mov r1, #0x0 - bl FUN_02031D20 -_02031C9C: - pop {r3-r5, pc} - nop -_02031CA0: .word 0x00007080 -_02031CA4: .word FUN_02032E00 - - thumb_func_start FUN_02031CA8 -FUN_02031CA8: ; 0x02031CA8 - push {r3-r5, lr} - add r5, r0, #0x0 - add r4, r1, #0x0 - bl FUN_02030F40 - cmp r0, #0x0 - bne _02031CD0 - ldr r2, _02031CD4 ; =0x00007080 - mov r0, #0x3 - mov r1, #0xf - bl FUN_02016828 - add r0, r5, #0x0 - add r1, r4, #0x0 - bl FUN_02031734 - ldr r0, _02031CD8 ; =FUN_02032E48 - mov r1, #0x0 - bl FUN_02031D20 -_02031CD0: - pop {r3-r5, pc} - nop -_02031CD4: .word 0x00007080 -_02031CD8: .word FUN_02032E48 - - thumb_func_start FUN_02031CDC -FUN_02031CDC: ; 0x02031CDC - push {r3, lr} - ldr r0, _02031D1C ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _02031CEE - ldr r0, [r0, #0x24] - cmp r0, #0x0 - beq _02031CEE - blx r0 -_02031CEE: - bl FUN_02033590 - cmp r0, #0x0 - beq _02031D04 - bl MOD04_021DDB08 - mov r1, #0x3 - sub r0, r1, r0 - bl FUN_02033EEC - pop {r3, pc} -_02031D04: - bl FUN_0202EDF8 - cmp r0, #0x0 - beq _02031D18 - bl WM_GetLinkLevel - mov r1, #0x3 - sub r0, r1, r0 - bl FUN_02033EEC -_02031D18: - pop {r3, pc} - nop -_02031D1C: .word UNK_021C5A00 - - thumb_func_start FUN_02031D20 -FUN_02031D20: ; 0x02031D20 - ldr r2, _02031D2C ; =UNK_021C5A00 - ldr r3, [r2, #0x0] - str r0, [r3, #0x24] - ldr r0, [r2, #0x0] - strh r1, [r0, #0x3a] - bx lr - .balign 4 -_02031D2C: .word UNK_021C5A00 - - thumb_func_start FUN_02031D30 -FUN_02031D30: ; 0x02031D30 - push {r3-r5, lr} - ldr r0, _02031DF8 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - beq _02031D42 - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] - pop {r3-r5, pc} -_02031D42: - bl FUN_0202E4C8 - cmp r0, #0x0 - beq _02031DF6 - ldr r0, _02031DF8 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x2c] - bl FUN_0202E29C - ldr r0, _02031DF8 ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x28] - bl FUN_0202DB14 - mov r0, #0x1 - bl FUN_02031268 - bl FUN_02030FA8 - ldr r0, _02031DF8 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - add r0, r1, #0x0 - add r0, #0x4a - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - beq _02031DC8 - add r1, #0x43 - ldrb r1, [r1, #0x0] - mov r0, #0x1 - mov r2, #0x7d - lsl r2, r2, #0x2 - add r3, r0, #0x0 - bl FUN_0202F918 - cmp r0, #0x0 - beq _02031DF6 - ldr r0, _02031DF8 ; =UNK_021C5A00 - ldr r5, [r0, #0x0] - add r4, r5, #0x0 - add r4, #0xc - ldr r0, [r4, #0x8] - ldr r1, [r4, #0xc] - ldr r2, [r5, #0xc] - ldr r3, [r4, #0x4] - bl _ll_mul - ldr r2, [r4, #0x10] - ldr r3, [r4, #0x14] - add r0, r2, r0 - adc r3, r1 - str r0, [r5, #0xc] - str r3, [r4, #0x4] - add r0, r3, #0x0 - mov r1, #0x0 - mov r2, #0x14 - mov r3, #0x0 - bl _ll_mul - mov r0, #0x0 - add r5, #0x43 - strb r0, [r5, #0x0] - ldr r0, _02031DFC ; =FUN_020320C4 - add r1, #0x14 - bl FUN_02031D20 - pop {r3-r5, pc} -_02031DC8: - mov r0, #0x1 - mov r2, #0x7d - add r1, r0, #0x0 - lsl r2, r2, #0x2 - bl FUN_0202F950 - cmp r0, #0x0 - beq _02031DF6 - ldr r0, _02031DF8 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x4c - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - beq _02031DEE - ldr r0, _02031E00 ; =FUN_020323B8 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3-r5, pc} -_02031DEE: - ldr r0, _02031E04 ; =FUN_02031EE0 - mov r1, #0x40 - bl FUN_02031D20 -_02031DF6: - pop {r3-r5, pc} - .balign 4 -_02031DF8: .word UNK_021C5A00 -_02031DFC: .word FUN_020320C4 -_02031E00: .word FUN_020323B8 -_02031E04: .word FUN_02031EE0 - - thumb_func_start FUN_02031E08 -FUN_02031E08: ; 0x02031E08 - push {r3-r5, lr} - bl FUN_0202EE0C - cmp r0, #0x0 - beq _02031E7C - mov r0, #0x1 - bl FUN_02031268 - bl FUN_02030FA8 - ldr r0, _02031E80 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x4a - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - beq _02031E32 - ldr r0, _02031E84 ; =FUN_02032058 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3-r5, pc} -_02031E32: - mov r2, #0x7d - mov r0, #0x0 - mov r1, #0x1 - lsl r2, r2, #0x2 - bl FUN_0202F950 - cmp r0, #0x0 - beq _02031E7C - ldr r0, _02031E80 ; =UNK_021C5A00 - ldr r5, [r0, #0x0] - add r4, r5, #0x0 - add r4, #0xc - ldr r0, [r4, #0x8] - ldr r1, [r4, #0xc] - ldr r2, [r5, #0xc] - ldr r3, [r4, #0x4] - bl _ll_mul - ldr r2, [r4, #0x10] - ldr r3, [r4, #0x14] - add r0, r2, r0 - adc r3, r1 - str r0, [r5, #0xc] - mov r1, #0x0 - str r3, [r4, #0x4] - lsr r0, r3, #0x1a - lsl r1, r1, #0x6 - orr r1, r0 - ldrh r0, [r5, #0x38] - cmp r0, #0x0 - beq _02031E76 - lsl r1, r0, #0x6 - mov r0, #0x0 - strh r0, [r5, #0x38] -_02031E76: - ldr r0, _02031E88 ; =FUN_02031EE0 - bl FUN_02031D20 -_02031E7C: - pop {r3-r5, pc} - nop -_02031E80: .word UNK_021C5A00 -_02031E84: .word FUN_02032058 -_02031E88: .word FUN_02031EE0 - - thumb_func_start FUN_02031E8C -FUN_02031E8C: ; 0x02031E8C - push {r3-r5, lr} - bl FUN_0202EE0C - cmp r0, #0x0 - beq _02031ED6 - mov r0, #0x0 - mov r2, #0x7d - add r1, r0, #0x0 - lsl r2, r2, #0x2 - bl FUN_0202F950 - cmp r0, #0x0 - beq _02031ED6 - ldr r0, _02031ED8 ; =UNK_021C5A00 - ldr r4, [r0, #0x0] - add r5, r4, #0x0 - add r5, #0xc - ldr r0, [r5, #0x8] - ldr r1, [r5, #0xc] - ldr r2, [r4, #0xc] - ldr r3, [r5, #0x4] - bl _ll_mul - ldr r2, [r5, #0x10] - ldr r3, [r5, #0x14] - add r0, r2, r0 - adc r3, r1 - str r0, [r4, #0xc] - mov r1, #0x0 - lsr r2, r3, #0x1b - lsl r1, r1, #0x5 - orr r1, r2 - ldr r0, _02031EDC ; =FUN_02031EE0 - add r1, #0x10 - str r3, [r5, #0x4] - bl FUN_02031D20 -_02031ED6: - pop {r3-r5, pc} - .balign 4 -_02031ED8: .word UNK_021C5A00 -_02031EDC: .word FUN_02031EE0 - - thumb_func_start FUN_02031EE0 -FUN_02031EE0: ; 0x02031EE0 - push {r3, lr} - bl FUN_0202EA54 - ldr r0, _02031F54 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - add r0, r1, #0x0 - add r0, #0x4f - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - bne _02031F50 - add r1, #0x4b - ldrb r0, [r1, #0x0] - cmp r0, #0x0 - bne _02031F50 - bl FUN_0202E8F4 - mov r1, #0x0 - mvn r1, r1 - cmp r0, r1 - beq _02031F1A - ldr r1, _02031F54 ; =UNK_021C5A00 - ldr r1, [r1, #0x0] - add r1, #0x3e - strb r0, [r1, #0x0] - ldr r0, _02031F58 ; =FUN_02031F60 - mov r1, #0x20 - bl FUN_02031D20 - pop {r3, pc} -_02031F1A: - ldr r0, _02031F54 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - beq _02031F2A - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] - pop {r3, pc} -_02031F2A: - bl FUN_0202E950 - mov r1, #0x0 - mvn r1, r1 - cmp r0, r1 - beq _02031F48 - ldr r1, _02031F54 ; =UNK_021C5A00 - ldr r1, [r1, #0x0] - add r1, #0x3e - strb r0, [r1, #0x0] - ldr r0, _02031F58 ; =FUN_02031F60 - mov r1, #0x20 - bl FUN_02031D20 - pop {r3, pc} -_02031F48: - ldr r0, _02031F5C ; =FUN_02032028 - mov r1, #0x0 - bl FUN_02031D20 -_02031F50: - pop {r3, pc} - nop -_02031F54: .word UNK_021C5A00 -_02031F58: .word FUN_02031F60 -_02031F5C: .word FUN_02032028 - - thumb_func_start FUN_02031F60 -FUN_02031F60: ; 0x02031F60 - push {r3, lr} - bl FUN_0202EA54 - ldr r0, _02031FBC ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x3e - ldrb r0, [r0, #0x0] - bl FUN_0202E8A0 - cmp r0, #0x0 - beq _02031F90 - ldr r0, _02031FBC ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x3e - ldrb r0, [r0, #0x0] - bl FUN_0202FB18 - cmp r0, #0x0 - beq _02031F90 - ldr r0, _02031FC0 ; =FUN_02031FC8 - mov r1, #0x64 - bl FUN_02031D20 - pop {r3, pc} -_02031F90: - bl FUN_020311F0 - cmp r0, #0x0 - beq _02031FA2 - ldr r0, _02031FC4 ; =FUN_02032028 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02031FA2: - ldr r0, _02031FBC ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - beq _02031FB2 - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] - pop {r3, pc} -_02031FB2: - ldr r0, _02031FC4 ; =FUN_02032028 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} - .balign 4 -_02031FBC: .word UNK_021C5A00 -_02031FC0: .word FUN_02031FC8 -_02031FC4: .word FUN_02032028 - - thumb_func_start FUN_02031FC8 -FUN_02031FC8: ; 0x02031FC8 - push {r3, lr} - bl FUN_02031190 - bl FUN_02030E7C - cmp r0, #0x0 - beq _02031FEE - bl FUN_0202FC60 - mov r0, #0x0 - bl FUN_02031268 - bl FUN_02030FA8 - ldr r0, _0203201C ; =FUN_0203213C - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02031FEE: - bl FUN_020311F0 - cmp r0, #0x0 - beq _02032000 - ldr r0, _02032020 ; =FUN_02032028 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032000: - ldr r0, _02032024 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - beq _02032010 - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] - pop {r3, pc} -_02032010: - ldr r0, _02032020 ; =FUN_02032028 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} - nop -_0203201C: .word FUN_0203213C -_02032020: .word FUN_02032028 -_02032024: .word UNK_021C5A00 - - thumb_func_start FUN_02032028 -FUN_02032028: ; 0x02032028 - push {r3, lr} - bl FUN_0202E6F0 - cmp r0, #0x0 - beq _0203203A - ldr r0, _0203203C ; =FUN_02032058 - mov r1, #0x0 - bl FUN_02031D20 -_0203203A: - pop {r3, pc} - .balign 4 -_0203203C: .word FUN_02032058 - - thumb_func_start FUN_02032040 -FUN_02032040: ; 0x02032040 - push {r3, lr} - bl FUN_0202E6F0 - cmp r0, #0x0 - beq _02032052 - ldr r0, _02032054 ; =FUN_02031E8C - mov r1, #0x0 - bl FUN_02031D20 -_02032052: - pop {r3, pc} - .balign 4 -_02032054: .word FUN_02031E8C - - thumb_func_start FUN_02032058 -FUN_02032058: ; 0x02032058 - push {r3-r5, lr} - bl FUN_0202EE0C - cmp r0, #0x0 - beq _020320BA - mov r0, #0x1 - bl FUN_02031268 - ldr r1, _020320BC ; =UNK_021C5A00 - mov r2, #0x7d - ldr r1, [r1, #0x0] - mov r0, #0x0 - add r1, #0x43 - ldrb r1, [r1, #0x0] - lsl r2, r2, #0x2 - mov r3, #0x1 - bl FUN_0202F918 - cmp r0, #0x0 - beq _020320BA - ldr r0, _020320BC ; =UNK_021C5A00 - ldr r5, [r0, #0x0] - add r4, r5, #0x0 - add r4, #0xc - ldr r0, [r4, #0x8] - ldr r1, [r4, #0xc] - ldr r2, [r5, #0xc] - ldr r3, [r4, #0x4] - bl _ll_mul - ldr r2, [r4, #0x10] - ldr r3, [r4, #0x14] - add r0, r2, r0 - adc r3, r1 - str r0, [r5, #0xc] - str r3, [r4, #0x4] - add r0, r3, #0x0 - mov r1, #0x0 - mov r2, #0x14 - mov r3, #0x0 - bl _ll_mul - mov r0, #0x0 - add r5, #0x43 - strb r0, [r5, #0x0] - ldr r0, _020320C0 ; =FUN_020320C4 - add r1, #0x14 - bl FUN_02031D20 -_020320BA: - pop {r3-r5, pc} - .balign 4 -_020320BC: .word UNK_021C5A00 -_020320C0: .word FUN_020320C4 - - thumb_func_start FUN_020320C4 -FUN_020320C4: ; 0x020320C4 - push {r3, lr} - bl FUN_020311E8 - cmp r0, #0x0 - beq _020320E2 - ldr r0, _0203210C ; =UNK_021C5A00 - mov r1, #0x1 - ldr r0, [r0, #0x0] - add r0, #0x43 - strb r1, [r0, #0x0] - ldr r0, _02032110 ; =FUN_02032118 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_020320E2: - ldr r0, _0203210C ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - beq _020320F2 - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] - pop {r3, pc} -_020320F2: - add r1, #0x4a - ldrb r0, [r1, #0x0] - cmp r0, #0x0 - bne _0203210A - bl FUN_0202E6F0 - cmp r0, #0x0 - beq _0203210A - ldr r0, _02032114 ; =FUN_02032040 - mov r1, #0x2 - bl FUN_02031D20 -_0203210A: - pop {r3, pc} - .balign 4 -_0203210C: .word UNK_021C5A00 -_02032110: .word FUN_02032118 -_02032114: .word FUN_02032040 - - thumb_func_start FUN_02032118 -FUN_02032118: ; 0x02032118 - push {r3, lr} - mov r0, #0x0 - bl FUN_02031268 - mov r0, #0x1 - bl FUN_0202EE84 - bl FUN_02030FA8 - ldr r0, _02032134 ; =FUN_02032138 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} - .balign 4 -_02032134: .word FUN_02032138 - - thumb_func_start FUN_02032138 -FUN_02032138: ; 0x02032138 - bx lr - .balign 4 - - thumb_func_start FUN_0203213C -FUN_0203213C: ; 0x0203213C - bx lr - .balign 4 - - thumb_func_start FUN_02032140 -FUN_02032140: ; 0x02032140 - push {r3, lr} - ldr r0, _02032170 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x3f - ldrb r0, [r0, #0x0] - cmp r0, #0x13 - bhs _02032166 - bl FUN_0202EE0C - cmp r0, #0x0 - beq _0203216E - mov r0, #0x1 - bl FUN_02031268 - bl FUN_02030FA8 - mov r0, #0x1 - bl FUN_0202E7B0 -_02032166: - ldr r0, _02032174 ; =FUN_020323B8 - mov r1, #0x0 - bl FUN_02031D20 -_0203216E: - pop {r3, pc} - .balign 4 -_02032170: .word UNK_021C5A00 -_02032174: .word FUN_020323B8 - - thumb_func_start FUN_02032178 -FUN_02032178: ; 0x02032178 - push {r3, lr} - bl FUN_0202E6F0 - cmp r0, #0x0 - beq _0203218E - bl FUN_0202FC60 - ldr r0, _02032190 ; =FUN_02032140 - mov r1, #0x0 - bl FUN_02031D20 -_0203218E: - pop {r3, pc} - .balign 4 -_02032190: .word FUN_02032140 - - thumb_func_start FUN_02032194 -FUN_02032194: ; 0x02032194 - push {r3, lr} - bl FUN_0202E4C8 - cmp r0, #0x0 - beq _020321B0 - mov r0, #0x0 - bl FUN_0202E7B0 - bl FUN_0202FC60 - ldr r0, _020321B4 ; =FUN_02031E08 - mov r1, #0x0 - bl FUN_02031D20 -_020321B0: - pop {r3, pc} - nop -_020321B4: .word FUN_02031E08 - - thumb_func_start FUN_020321B8 -FUN_020321B8: ; 0x020321B8 - push {r3, lr} - bl FUN_0202E6F0 - cmp r0, #0x0 - beq _020321CA - ldr r0, _020321CC ; =FUN_02031E08 - mov r1, #0x0 - bl FUN_02031D20 -_020321CA: - pop {r3, pc} - .balign 4 -_020321CC: .word FUN_02031E08 - - thumb_func_start FUN_020321D0 -FUN_020321D0: ; 0x020321D0 - push {r3, lr} - bl FUN_0202E4C8 - cmp r0, #0x0 - beq _0203220C - ldr r0, _02032210 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x2c] - bl FUN_0202E29C - ldr r0, _02032210 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldr r0, [r1, #0x28] - ldr r1, [r1, #0x30] - bl FUN_0202DB14 - mov r0, #0x1 - add r1, r0, #0x0 - lsl r2, r0, #0x9 - add r3, r0, #0x0 - bl FUN_0202F918 - cmp r0, #0x0 - beq _0203220C - bl FUN_0202FA10 - ldr r0, _02032214 ; =FUN_02032218 - mov r1, #0x0 - bl FUN_02031D20 -_0203220C: - pop {r3, pc} - nop -_02032210: .word UNK_021C5A00 -_02032214: .word FUN_02032218 - - thumb_func_start FUN_02032218 -FUN_02032218: ; 0x02032218 - push {r3, lr} - bl FUN_02031190 - bl FUN_02030E7C - cmp r0, #0x0 - beq _0203222E - ldr r0, _02032230 ; =FUN_02032234 - mov r1, #0x0 - bl FUN_02031D20 -_0203222E: - pop {r3, pc} - .balign 4 -_02032230: .word FUN_02032234 - - thumb_func_start FUN_02032234 -FUN_02032234: ; 0x02032234 - push {r3, lr} - bl FUN_02030F40 - cmp r0, #0x0 - bne _02032246 - ldr r0, _02032248 ; =FUN_020323BC - mov r1, #0x0 - bl FUN_02031D20 -_02032246: - pop {r3, pc} - .balign 4 -_02032248: .word FUN_020323BC - - thumb_func_start FUN_0203224C -FUN_0203224C: ; 0x0203224C - push {r3, lr} - bl FUN_0202E4C8 - cmp r0, #0x0 - beq _02032286 - ldr r0, _02032288 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x2c] - bl FUN_0202E29C - ldr r0, _02032288 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldr r0, [r1, #0x28] - ldr r1, [r1, #0x30] - bl FUN_0202DB14 - mov r0, #0x1 - add r1, r0, #0x0 - lsl r2, r0, #0x9 - bl FUN_0202F950 - cmp r0, #0x0 - beq _02032286 - bl FUN_0202FA10 - ldr r0, _0203228C ; =FUN_02032290 - mov r1, #0x0 - bl FUN_02031D20 -_02032286: - pop {r3, pc} - .balign 4 -_02032288: .word UNK_021C5A00 -_0203228C: .word FUN_02032290 - - thumb_func_start FUN_02032290 -FUN_02032290: ; 0x02032290 - ldr r3, _02032294 ; =FUN_0202EA54 - bx r3 - .balign 4 -_02032294: .word FUN_0202EA54 - - thumb_func_start FUN_02032298 -FUN_02032298: ; 0x02032298 - push {r3, lr} - bl FUN_0202EA54 - ldr r0, _020322B8 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x3e - ldrb r0, [r0, #0x0] - bl FUN_0202FB18 - cmp r0, #0x0 - beq _020322B6 - ldr r0, _020322BC ; =FUN_020322C0 - mov r1, #0xa - bl FUN_02031D20 -_020322B6: - pop {r3, pc} - .balign 4 -_020322B8: .word UNK_021C5A00 -_020322BC: .word FUN_020322C0 - - thumb_func_start FUN_020322C0 -FUN_020322C0: ; 0x020322C0 - push {r3, lr} - bl FUN_020311F0 - cmp r0, #0x0 - beq _020322D2 - ldr r0, _020322F0 ; =FUN_020322F8 - mov r1, #0x0 - bl FUN_02031D20 -_020322D2: - bl FUN_02031190 - bl FUN_02030E7C - cmp r0, #0x0 - beq _020322EE - bl FUN_02031190 - cmp r0, #0x0 - beq _020322EE - ldr r0, _020322F4 ; =FUN_0203234C - mov r1, #0x0 - bl FUN_02031D20 -_020322EE: - pop {r3, pc} - .balign 4 -_020322F0: .word FUN_020322F8 -_020322F4: .word FUN_0203234C - - thumb_func_start FUN_020322F8 -FUN_020322F8: ; 0x020322F8 - push {r3, lr} - bl FUN_0202E6F0 - ldr r0, _02032308 ; =FUN_0203230C - mov r1, #0x2 - bl FUN_02031D20 - pop {r3, pc} - .balign 4 -_02032308: .word FUN_0203230C - - thumb_func_start FUN_0203230C -FUN_0203230C: ; 0x0203230C - push {r3, lr} - ldr r0, _02032344 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - beq _0203231E - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] - pop {r3, pc} -_0203231E: - bl FUN_0202EE0C - cmp r0, #0x0 - beq _02032340 - mov r1, #0x1 - mov r0, #0x0 - lsl r2, r1, #0x9 - bl FUN_0202F950 - cmp r0, #0x0 - beq _02032340 - bl FUN_0202FA10 - ldr r0, _02032348 ; =FUN_02032298 - mov r1, #0xa - bl FUN_02031D20 -_02032340: - pop {r3, pc} - nop -_02032344: .word UNK_021C5A00 -_02032348: .word FUN_02032298 - - thumb_func_start FUN_0203234C -FUN_0203234C: ; 0x0203234C - push {r3, lr} - bl FUN_02030F40 - cmp r0, #0x0 - bne _0203235E - ldr r0, _02032360 ; =FUN_020323BC - mov r1, #0x0 - bl FUN_02031D20 -_0203235E: - pop {r3, pc} - .balign 4 -_02032360: .word FUN_020323BC - - thumb_func_start FUN_02032364 -FUN_02032364: ; 0x02032364 - push {r3, lr} - bl FUN_0202E6F0 - ldr r0, _02032374 ; =FUN_02032378 - mov r1, #0x2 - bl FUN_02031D20 - pop {r3, pc} - .balign 4 -_02032374: .word FUN_02032378 - - thumb_func_start FUN_02032378 -FUN_02032378: ; 0x02032378 - push {r3, lr} - ldr r0, _020323B0 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - beq _0203238A - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] - pop {r3, pc} -_0203238A: - bl FUN_0202EE0C - cmp r0, #0x0 - beq _020323AC - mov r1, #0x1 - mov r0, #0x0 - lsl r2, r1, #0x9 - bl FUN_0202F950 - cmp r0, #0x0 - beq _020323AC - bl FUN_0202FA10 - ldr r0, _020323B4 ; =FUN_02032290 - mov r1, #0xa - bl FUN_02031D20 -_020323AC: - pop {r3, pc} - nop -_020323B0: .word UNK_021C5A00 -_020323B4: .word FUN_02032290 - - thumb_func_start FUN_020323B8 -FUN_020323B8: ; 0x020323B8 - bx lr - .balign 4 - - thumb_func_start FUN_020323BC -FUN_020323BC: ; 0x020323BC - push {r3, lr} - bl FUN_02030F40 - cmp r0, #0x0 - bne _020323CA - bl FUN_020317C0 -_020323CA: - pop {r3, pc} - - thumb_func_start FUN_020323CC -FUN_020323CC: ; 0x020323CC - ldr r3, _020323D4 ; =FUN_02031D20 - ldr r0, _020323D8 ; =FUN_02032440 - mov r1, #0x5 - bx r3 - .balign 4 -_020323D4: .word FUN_02031D20 -_020323D8: .word FUN_02032440 - - thumb_func_start FUN_020323DC -FUN_020323DC: ; 0x020323DC - push {r3, lr} - bl FUN_02030F20 - cmp r0, #0x1 - bgt _020323F8 - mov r0, #0x0 - bl FUN_0202D36C - bl FUN_0202FC80 - ldr r0, _0203241C ; =FUN_020324F8 - mov r1, #0x0 - bl FUN_02031D20 -_020323F8: - ldr r0, _02032420 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - beq _02032408 - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] - pop {r3, pc} -_02032408: - mov r0, #0x0 - bl FUN_0202D36C - bl FUN_0202FC80 - ldr r0, _0203241C ; =FUN_020324F8 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} - .balign 4 -_0203241C: .word FUN_020324F8 -_02032420: .word UNK_021C5A00 - - thumb_func_start FUN_02032424 -FUN_02032424: ; 0x02032424 - push {r3, lr} - bl FUN_0202E6F0 - cmp r0, #0x0 - beq _0203243A - bl FUN_0202FC60 - ldr r0, _0203243C ; =FUN_020324F8 - mov r1, #0x0 - bl FUN_02031D20 -_0203243A: - pop {r3, pc} - .balign 4 -_0203243C: .word FUN_020324F8 - - thumb_func_start FUN_02032440 -FUN_02032440: ; 0x02032440 - push {r3, lr} - ldr r0, _02032470 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - beq _02032450 - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] -_02032450: - bl FUN_0202E6F0 - cmp r0, #0x0 - beq _0203246E - ldr r0, _02032470 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldrh r0, [r0, #0x3a] - cmp r0, #0x0 - bne _0203246E - bl FUN_0202FA5C - ldr r0, _02032474 ; =FUN_020323BC - mov r1, #0x0 - bl FUN_02031D20 -_0203246E: - pop {r3, pc} - .balign 4 -_02032470: .word UNK_021C5A00 -_02032474: .word FUN_020323BC - - thumb_func_start FUN_02032478 -FUN_02032478: ; 0x02032478 - push {r3, lr} - bl FUN_0202E4C8 - cmp r0, #0x0 - beq _020324BE - ldr r0, _020324C0 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x2c] - bl FUN_0202E29C - ldr r0, _020324C0 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x3c - ldrb r0, [r0, #0x0] - bl FUN_0202D1B0 - ldr r0, _020324C0 ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x28] - bl FUN_0202DB14 - mov r0, #0x1 - add r1, r0, #0x0 - lsl r2, r0, #0x9 - bl FUN_0202F950 - cmp r0, #0x0 - beq _020324BE - bl FUN_0202FA10 - ldr r0, _020324C4 ; =FUN_020324C8 - mov r1, #0x40 - bl FUN_02031D20 -_020324BE: - pop {r3, pc} - .balign 4 -_020324C0: .word UNK_021C5A00 -_020324C4: .word FUN_020324C8 - - thumb_func_start FUN_020324C8 -FUN_020324C8: ; 0x020324C8 - push {r3, lr} - bl FUN_0202EA54 - ldr r0, _020324F0 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - beq _020324DE - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] - pop {r3, pc} -_020324DE: - bl FUN_0202E6F0 - cmp r0, #0x0 - beq _020324EE - ldr r0, _020324F4 ; =FUN_02032510 - mov r1, #0x0 - bl FUN_02031D20 -_020324EE: - pop {r3, pc} - .balign 4 -_020324F0: .word UNK_021C5A00 -_020324F4: .word FUN_02032510 - - thumb_func_start FUN_020324F8 -FUN_020324F8: ; 0x020324F8 - push {r3, lr} - bl FUN_0202E6F0 - cmp r0, #0x0 - beq _0203250A - ldr r0, _0203250C ; =FUN_02032510 - mov r1, #0x0 - bl FUN_02031D20 -_0203250A: - pop {r3, pc} - .balign 4 -_0203250C: .word FUN_02032510 - - thumb_func_start FUN_02032510 -FUN_02032510: ; 0x02032510 - push {r3-r5, lr} - bl FUN_0202EE0C - cmp r0, #0x0 - beq _02032568 - ldr r1, _0203256C ; =UNK_021C5A00 - mov r2, #0x2 - ldr r1, [r1, #0x0] - mov r0, #0x0 - add r1, #0x43 - ldrb r1, [r1, #0x0] - lsl r2, r2, #0x8 - mov r3, #0x1 - bl FUN_0202F918 - cmp r0, #0x0 - beq _02032568 - ldr r0, _0203256C ; =UNK_021C5A00 - ldr r4, [r0, #0x0] - add r5, r4, #0x0 - add r5, #0xc - ldr r0, [r5, #0x8] - ldr r1, [r5, #0xc] - ldr r2, [r4, #0xc] - ldr r3, [r5, #0x4] - bl _ll_mul - ldr r2, [r5, #0x10] - ldr r3, [r5, #0x14] - add r0, r2, r0 - adc r3, r1 - str r0, [r4, #0xc] - str r3, [r5, #0x4] - bl FUN_0202FA10 - ldr r0, _0203256C ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - add r0, #0x43 - strb r1, [r0, #0x0] - ldr r0, _02032570 ; =FUN_02032578 - ldr r1, _02032574 ; =0x00002710 - bl FUN_02031D20 -_02032568: - pop {r3-r5, pc} - nop -_0203256C: .word UNK_021C5A00 -_02032570: .word FUN_02032578 -_02032574: .word 0x00002710 - - thumb_func_start FUN_02032578 -FUN_02032578: ; 0x02032578 - push {r3, lr} - bl FUN_0202F104 - cmp r0, #0x0 - bne _020325B2 - bl FUN_020311E8 - cmp r0, #0x0 - beq _020325A2 - ldr r0, _020325C4 ; =UNK_021C5A00 - mov r1, #0x1 - ldr r0, [r0, #0x0] - add r0, #0x43 - strb r1, [r0, #0x0] - bl FUN_02033E74 - ldr r0, _020325C8 ; =FUN_020327FC - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_020325A2: - ldr r0, _020325C4 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - beq _020325B2 - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] - pop {r3, pc} -_020325B2: - bl FUN_0202E6F0 - cmp r0, #0x0 - beq _020325C2 - ldr r0, _020325CC ; =FUN_020325D0 - mov r1, #0x0 - bl FUN_02031D20 -_020325C2: - pop {r3, pc} - .balign 4 -_020325C4: .word UNK_021C5A00 -_020325C8: .word FUN_020327FC -_020325CC: .word FUN_020325D0 - - thumb_func_start FUN_020325D0 -FUN_020325D0: ; 0x020325D0 - push {r3-r5, lr} - bl FUN_0202EE0C - cmp r0, #0x0 - beq _0203261C - mov r0, #0x0 - mov r2, #0x2 - add r1, r0, #0x0 - lsl r2, r2, #0x8 - bl FUN_0202F950 - cmp r0, #0x0 - beq _0203261C - bl FUN_0202FA10 - ldr r0, _02032620 ; =UNK_021C5A00 - ldr r4, [r0, #0x0] - add r5, r4, #0x0 - add r5, #0xc - ldr r0, [r5, #0x8] - ldr r1, [r5, #0xc] - ldr r2, [r4, #0xc] - ldr r3, [r5, #0x4] - bl _ll_mul - ldr r2, [r5, #0x10] - ldr r3, [r5, #0x14] - add r0, r2, r0 - adc r3, r1 - str r0, [r4, #0xc] - mov r1, #0x0 - ldr r0, _02032624 ; =FUN_020324C8 - lsr r2, r3, #0x1b - lsl r1, r1, #0x5 - orr r1, r2 - str r3, [r5, #0x4] - bl FUN_02031D20 -_0203261C: - pop {r3-r5, pc} - nop -_02032620: .word UNK_021C5A00 -_02032624: .word FUN_020324C8 - - thumb_func_start FUN_02032628 -FUN_02032628: ; 0x02032628 - push {r3, lr} - bl FUN_0202E6F0 - cmp r0, #0x0 - beq _0203263A - ldr r0, _0203263C ; =FUN_02032640 - mov r1, #0x0 - bl FUN_02031D20 -_0203263A: - pop {r3, pc} - .balign 4 -_0203263C: .word FUN_02032640 - - thumb_func_start FUN_02032640 -FUN_02032640: ; 0x02032640 - push {r3, lr} - bl FUN_0202EE0C - cmp r0, #0x0 - beq _02032666 - mov r0, #0x0 - mov r2, #0x2 - add r1, r0, #0x0 - lsl r2, r2, #0x8 - bl FUN_0202F950 - cmp r0, #0x0 - beq _02032666 - bl FUN_0202FA10 - ldr r0, _02032668 ; =FUN_0203266C - mov r1, #0x64 - bl FUN_02031D20 -_02032666: - pop {r3, pc} - .balign 4 -_02032668: .word FUN_0203266C - - thumb_func_start FUN_0203266C -FUN_0203266C: ; 0x0203266C - push {r3, lr} - ldr r0, _020326C4 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x3e - ldrb r0, [r0, #0x0] - bl FUN_0202E8A0 - cmp r0, #0x0 - beq _02032698 - ldr r0, _020326C4 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x3e - ldrb r0, [r0, #0x0] - bl FUN_0202FB18 - cmp r0, #0x0 - beq _02032698 - ldr r0, _020326C8 ; =FUN_020326D0 - mov r1, #0x64 - bl FUN_02031D20 - pop {r3, pc} -_02032698: - bl FUN_020311F0 - cmp r0, #0x0 - beq _020326AA - ldr r0, _020326CC ; =FUN_020327B8 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_020326AA: - ldr r0, _020326C4 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - beq _020326BA - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] - pop {r3, pc} -_020326BA: - ldr r0, _020326CC ; =FUN_020327B8 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} - .balign 4 -_020326C4: .word UNK_021C5A00 -_020326C8: .word FUN_020326D0 -_020326CC: .word FUN_020327B8 - - thumb_func_start FUN_020326D0 -FUN_020326D0: ; 0x020326D0 - push {r3, lr} - bl FUN_020311F0 - cmp r0, #0x0 - beq _020326E4 - ldr r0, _02032728 ; =FUN_020327B8 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_020326E4: - bl FUN_02031190 - bl FUN_02030E7C - cmp r0, #0x0 - beq _0203270C - ldr r0, _0203272C ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - add r0, #0x3d - strb r1, [r0, #0x0] - ldr r1, _02032730 ; =UNK_02105D5C - mov r0, #0x6 - bl FUN_020311D0 - ldr r0, _02032734 ; =FUN_02032738 - mov r1, #0x78 - bl FUN_02031D20 - pop {r3, pc} -_0203270C: - ldr r0, _0203272C ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - beq _0203271C - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] - pop {r3, pc} -_0203271C: - ldr r0, _02032728 ; =FUN_020327B8 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} - nop -_02032728: .word FUN_020327B8 -_0203272C: .word UNK_021C5A00 -_02032730: .word UNK_02105D5C -_02032734: .word FUN_02032738 - - thumb_func_start FUN_02032738 -FUN_02032738: ; 0x02032738 - push {r3, lr} - bl FUN_020311F0 - cmp r0, #0x0 - beq _0203274C - ldr r0, _0203278C ; =FUN_020327B8 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_0203274C: - ldr r0, _02032790 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - add r0, r1, #0x0 - add r0, #0x3d - ldrb r0, [r0, #0x0] - cmp r0, #0x2 - bne _02032764 - ldr r0, _02032794 ; =FUN_020327B4 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032764: - cmp r0, #0x1 - bne _02032776 - bl FUN_0202DBE0 - ldr r0, _02032798 ; =FUN_0203279C - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032776: - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - beq _02032782 - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] - pop {r3, pc} -_02032782: - ldr r0, _0203278C ; =FUN_020327B8 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} - .balign 4 -_0203278C: .word FUN_020327B8 -_02032790: .word UNK_021C5A00 -_02032794: .word FUN_020327B4 -_02032798: .word FUN_0203279C - - thumb_func_start FUN_0203279C -FUN_0203279C: ; 0x0203279C - push {r3, lr} - bl FUN_020311F0 - cmp r0, #0x0 - beq _020327AE - ldr r0, _020327B0 ; =FUN_020327B8 - mov r1, #0x0 - bl FUN_02031D20 -_020327AE: - pop {r3, pc} - .balign 4 -_020327B0: .word FUN_020327B8 - - thumb_func_start FUN_020327B4 -FUN_020327B4: ; 0x020327B4 - bx lr - .balign 4 - - thumb_func_start FUN_020327B8 -FUN_020327B8: ; 0x020327B8 - push {r3, lr} - ldr r0, _020327F0 ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - add r0, #0x3d - strb r1, [r0, #0x0] - bl FUN_0202E6F0 - cmp r0, #0x0 - beq _020327EC - ldr r0, _020327F0 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x38] - cmp r0, #0x0 - beq _020327E4 - sub r0, r0, #0x1 - strh r0, [r1, #0x38] - ldr r0, _020327F4 ; =FUN_02032640 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_020327E4: - ldr r0, _020327F8 ; =FUN_020327B4 - mov r1, #0x0 - bl FUN_02031D20 -_020327EC: - pop {r3, pc} - nop -_020327F0: .word UNK_021C5A00 -_020327F4: .word FUN_02032640 -_020327F8: .word FUN_020327B4 - - thumb_func_start FUN_020327FC -FUN_020327FC: ; 0x020327FC - push {r3, lr} - bl FUN_020311E8 - cmp r0, #0x0 - bne _02032820 - bl FUN_02033510 - cmp r0, #0x0 - bne _0203282C - bl FUN_0202E6F0 - cmp r0, #0x0 - beq _0203282C - ldr r0, _02032848 ; =FUN_020325D0 - mov r1, #0x0 - bl FUN_02031D20 - b _0203282C -_02032820: - bl FUN_02031190 - cmp r0, #0x0 - bne _0203282C - bl FUN_0202DDE8 -_0203282C: - bl FUN_020311F0 - cmp r0, #0x0 - beq _02032844 - bl FUN_02033510 - cmp r0, #0x0 - bne _02032844 - ldr r0, _0203284C ; =FUN_020327B8 - mov r1, #0x0 - bl FUN_02031D20 -_02032844: - pop {r3, pc} - nop -_02032848: .word FUN_020325D0 -_0203284C: .word FUN_020327B8 - - thumb_func_start FUN_02032850 -FUN_02032850: ; 0x02032850 - push {r3, lr} - bl FUN_0202EE0C - cmp r0, #0x0 - beq _0203287E - ldr r1, _02032880 ; =UNK_021C5A00 - mov r0, #0x0 - ldr r1, [r1, #0x0] - mov r2, #0x2 - add r1, #0x43 - ldrb r1, [r1, #0x0] - lsl r2, r2, #0x8 - add r3, r0, #0x0 - bl FUN_0202F918 - cmp r0, #0x0 - beq _0203287E - bl FUN_0202FA10 - ldr r0, _02032884 ; =FUN_020323B8 - mov r1, #0x0 - bl FUN_02031D20 -_0203287E: - pop {r3, pc} - .balign 4 -_02032880: .word UNK_021C5A00 -_02032884: .word FUN_020323B8 - - thumb_func_start FUN_02032888 -FUN_02032888: ; 0x02032888 - push {r3, lr} - ldr r0, _020328BC ; =UNK_021C5A00 - mov r1, #0xd - ldr r0, [r0, #0x0] - add r0, #0x3f - strb r1, [r0, #0x0] - bl FUN_02031190 - cmp r0, #0x0 - add r0, sp, #0x0 - bne _020328AE - mov r1, #0x0 - strb r1, [r0, #0x1] - add r1, sp, #0x0 - mov r0, #0xa - add r1, #0x1 - bl FUN_020311D0 - pop {r3, pc} -_020328AE: - mov r1, #0x0 - strb r1, [r0, #0x0] - mov r0, #0xa - add r1, sp, #0x0 - bl FUN_020311D0 - pop {r3, pc} - .balign 4 -_020328BC: .word UNK_021C5A00 - - thumb_func_start FUN_020328C0 -FUN_020328C0: ; 0x020328C0 - ldr r1, _020328D8 ; =UNK_021C5A00 - ldr r3, _020328DC ; =FUN_02031D20 - ldr r2, [r1, #0x0] - add r2, #0x3e - strb r0, [r2, #0x0] - ldr r0, [r1, #0x0] - mov r2, #0x3 - strh r2, [r0, #0x38] - ldr r0, _020328E0 ; =FUN_02032924 - mov r1, #0x0 - bx r3 - nop -_020328D8: .word UNK_021C5A00 -_020328DC: .word FUN_02031D20 -_020328E0: .word FUN_02032924 - - thumb_func_start FUN_020328E4 -FUN_020328E4: ; 0x020328E4 - ldr r0, _020328F0 ; =UNK_021C5A00 - mov r1, #0x7 - ldr r0, [r0, #0x0] - add r0, #0x3f - strb r1, [r0, #0x0] - bx lr - .balign 4 -_020328F0: .word UNK_021C5A00 - - thumb_func_start FUN_020328F4 -FUN_020328F4: ; 0x020328F4 - push {r3, lr} - ldr r1, _0203291C ; =UNK_021C5A00 - ldr r2, [r1, #0x0] - add r2, #0x3e - strb r0, [r2, #0x0] - ldr r0, [r1, #0x0] - mov r2, #0x7 - add r0, #0x3f - strb r2, [r0, #0x0] - ldr r0, [r1, #0x0] - mov r2, #0x3 - strh r2, [r0, #0x38] - bl FUN_02033E74 - ldr r0, _02032920 ; =FUN_02032628 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} - nop -_0203291C: .word UNK_021C5A00 -_02032920: .word FUN_02032628 - - thumb_func_start FUN_02032924 -FUN_02032924: ; 0x02032924 - push {r3, lr} - bl FUN_0202E6F0 - cmp r0, #0x0 - beq _02032936 - ldr r0, _02032938 ; =FUN_0203293C - mov r1, #0x0 - bl FUN_02031D20 -_02032936: - pop {r3, pc} - .balign 4 -_02032938: .word FUN_0203293C - - thumb_func_start FUN_0203293C -FUN_0203293C: ; 0x0203293C - push {r3, lr} - bl FUN_0202EE0C - cmp r0, #0x0 - beq _0203296C - ldr r0, _02032970 ; =UNK_021C5A00 - mov r2, #0x2 - ldr r0, [r0, #0x0] - mov r1, #0xd - add r0, #0x3f - strb r1, [r0, #0x0] - mov r0, #0x0 - add r1, r0, #0x0 - lsl r2, r2, #0x8 - bl FUN_0202F950 - cmp r0, #0x0 - beq _0203296C - bl FUN_0202FA1C - ldr r0, _02032974 ; =FUN_02032978 - mov r1, #0x64 - bl FUN_02031D20 -_0203296C: - pop {r3, pc} - nop -_02032970: .word UNK_021C5A00 -_02032974: .word FUN_02032978 - - thumb_func_start FUN_02032978 -FUN_02032978: ; 0x02032978 - push {r3, lr} - ldr r0, _020329E4 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x3e - ldrb r0, [r0, #0x0] - bl FUN_0202E8A0 - cmp r0, #0x0 - beq _020329A4 - ldr r0, _020329E4 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x3e - ldrb r0, [r0, #0x0] - bl FUN_0202FB18 - cmp r0, #0x0 - beq _020329A4 - ldr r0, _020329E8 ; =FUN_020329F4 - mov r1, #0x64 - bl FUN_02031D20 - pop {r3, pc} -_020329A4: - bl FUN_020311F0 - cmp r0, #0x0 - bne _020329B6 - ldr r0, _020329E4 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x0 - bne _020329DC -_020329B6: - ldr r0, _020329E4 ; =UNK_021C5A00 - ldr r2, [r0, #0x0] - ldrh r1, [r2, #0x38] - sub r1, r1, #0x1 - strh r1, [r2, #0x38] - ldr r0, [r0, #0x0] - ldrh r0, [r0, #0x38] - cmp r0, #0x0 - bne _020329D2 - ldr r0, _020329EC ; =FUN_020327B4 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_020329D2: - ldr r0, _020329F0 ; =FUN_02032924 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_020329DC: - beq _020329E2 - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] -_020329E2: - pop {r3, pc} - .balign 4 -_020329E4: .word UNK_021C5A00 -_020329E8: .word FUN_020329F4 -_020329EC: .word FUN_020327B4 -_020329F0: .word FUN_02032924 - - thumb_func_start FUN_020329F4 -FUN_020329F4: ; 0x020329F4 - push {r3, lr} - ldr r0, _02032A7C ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - ldrh r0, [r1, #0x3a] - cmp r0, #0x5a - bls _02032A06 - sub r0, r0, #0x1 - strh r0, [r1, #0x3a] - pop {r3, pc} -_02032A06: - bl FUN_020311F0 - cmp r0, #0x0 - beq _02032A34 - ldr r0, _02032A7C ; =UNK_021C5A00 - ldr r2, [r0, #0x0] - ldrh r1, [r2, #0x38] - sub r1, r1, #0x1 - strh r1, [r2, #0x38] - ldr r0, [r0, #0x0] - ldrh r0, [r0, #0x38] - cmp r0, #0x0 - bne _02032A2A - ldr r0, _02032A80 ; =FUN_020327B4 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032A2A: - ldr r0, _02032A84 ; =FUN_02032924 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032A34: - bl FUN_02031190 - bl FUN_02030E7C - cmp r0, #0x0 - beq _02032A4A - ldr r0, _02032A88 ; =FUN_0203279C - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032A4A: - ldr r0, _02032A7C ; =UNK_021C5A00 - ldr r2, [r0, #0x0] - ldrh r1, [r2, #0x3a] - cmp r1, #0x0 - beq _02032A5A - sub r0, r1, #0x1 - strh r0, [r2, #0x3a] - pop {r3, pc} -_02032A5A: - ldrh r1, [r2, #0x38] - sub r1, r1, #0x1 - strh r1, [r2, #0x38] - ldr r0, [r0, #0x0] - ldrh r0, [r0, #0x38] - cmp r0, #0x0 - bne _02032A72 - ldr r0, _02032A80 ; =FUN_020327B4 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032A72: - ldr r0, _02032A84 ; =FUN_02032924 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} - .balign 4 -_02032A7C: .word UNK_021C5A00 -_02032A80: .word FUN_020327B4 -_02032A84: .word FUN_02032924 -_02032A88: .word FUN_0203279C - - thumb_func_start FUN_02032A8C -FUN_02032A8C: ; 0x02032A8C - push {r4-r6, lr} - add r5, r0, #0x0 - add r4, r2, #0x0 - bl FUN_02031190 - cmp r0, #0x0 - bne _02032ADA - ldr r6, _02032ADC ; =UNK_02105D5C - mov r3, #0x1 - mov r2, #0x0 -_02032AA0: - ldrb r1, [r6, #0x0] - ldrb r0, [r4, r2] - cmp r1, r0 - beq _02032AAC - mov r3, #0x0 - b _02032AB4 -_02032AAC: - add r2, r2, #0x1 - add r6, r6, #0x1 - cmp r2, #0x6 - blo _02032AA0 -_02032AB4: - cmp r3, #0x0 - beq _02032AD0 - ldr r0, _02032AE0 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x48 - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - bne _02032AD0 - ldr r1, _02032AE4 ; =UNK_02105D6C - mov r0, #0x7 - strb r5, [r1, #0x0] - bl FUN_02030C4C - pop {r4-r6, pc} -_02032AD0: - ldr r1, _02032AE8 ; =UNK_02105D64 - mov r0, #0x7 - strb r5, [r1, #0x0] - bl FUN_02030C4C -_02032ADA: - pop {r4-r6, pc} - .balign 4 -_02032ADC: .word UNK_02105D5C -_02032AE0: .word UNK_021C5A00 -_02032AE4: .word UNK_02105D6C -_02032AE8: .word UNK_02105D64 - - thumb_func_start FUN_02032AEC -FUN_02032AEC: ; 0x02032AEC - push {r3-r5, lr} - mov r4, #0x1 - ldr r5, _02032B5C ; =UNK_02105D6C + 1 - add r3, r4, #0x0 -_02032AF4: - ldrb r1, [r5, #0x0] - ldrb r0, [r2, r3] - cmp r1, r0 - beq _02032B00 - mov r4, #0x0 - b _02032B08 -_02032B00: - add r3, r3, #0x1 - add r5, r5, #0x1 - cmp r3, #0x6 - blo _02032AF4 -_02032B08: - cmp r4, #0x0 - beq _02032B22 - ldrb r4, [r2, #0x0] - bl FUN_02031190 - cmp r4, r0 - bne _02032B58 - ldr r0, _02032B60 ; =UNK_021C5A00 - mov r1, #0x1 - ldr r0, [r0, #0x0] - add r0, #0x3d - strb r1, [r0, #0x0] - pop {r3-r5, pc} -_02032B22: - mov r4, #0x1 - ldr r3, _02032B64 ; =UNK_02105D64 + 1 - add r5, r4, #0x0 -_02032B28: - ldrb r1, [r3, #0x0] - ldrb r0, [r2, r5] - cmp r1, r0 - beq _02032B34 - mov r4, #0x0 - b _02032B3C -_02032B34: - add r5, r5, #0x1 - add r3, r3, #0x1 - cmp r5, #0x6 - blo _02032B28 -_02032B3C: - cmp r4, #0x0 - beq _02032B58 - ldrb r4, [r2, #0x0] - bl FUN_02031190 - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - cmp r4, r0 - bne _02032B58 - ldr r0, _02032B60 ; =UNK_021C5A00 - mov r1, #0x2 - ldr r0, [r0, #0x0] - add r0, #0x3d - strb r1, [r0, #0x0] -_02032B58: - pop {r3-r5, pc} - nop -_02032B5C: .word UNK_02105D6C + 1 -_02032B60: .word UNK_021C5A00 -_02032B64: .word UNK_02105D64 + 1 - - thumb_func_start FUN_02032B68 -FUN_02032B68: ; 0x02032B68 - mov r0, #0x6 - bx lr - - thumb_func_start FUN_02032B6C -FUN_02032B6C: ; 0x02032B6C - push {r3, lr} - ldr r1, _02032B80 ; =UNK_021C5A00 - ldr r1, [r1, #0x0] - cmp r1, #0x0 - beq _02032B7E - add r1, #0x3c - strb r0, [r1, #0x0] - bl FUN_0202D1B0 -_02032B7E: - pop {r3, pc} - .balign 4 -_02032B80: .word UNK_021C5A00 - - thumb_func_start FUN_02032B84 -FUN_02032B84: ; 0x02032B84 - ldr r3, _02032B88 ; =FUN_0202EA54 - bx r3 - .balign 4 -_02032B88: .word FUN_0202EA54 - - thumb_func_start FUN_02032B8C -FUN_02032B8C: ; 0x02032B8C - push {r3, lr} - bl FUN_0202E4C8 - cmp r0, #0x0 - beq _02032BC6 - ldr r0, _02032BC8 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x2c] - bl FUN_0202E29C - ldr r0, _02032BC8 ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x28] - bl FUN_0202DB14 - mov r0, #0x1 - add r1, r0, #0x0 - mov r2, #0x20 - bl FUN_0202F950 - cmp r0, #0x0 - beq _02032BC6 - bl FUN_0202FA10 - ldr r0, _02032BCC ; =FUN_02032B84 - mov r1, #0x0 - bl FUN_02031D20 -_02032BC6: - pop {r3, pc} - .balign 4 -_02032BC8: .word UNK_021C5A00 -_02032BCC: .word FUN_02032B84 - - thumb_func_start FUN_02032BD0 -FUN_02032BD0: ; 0x02032BD0 - push {r4, lr} - add r4, r0, #0x0 - bl FUN_02030F40 - cmp r0, #0x0 - bne _02032C00 - mov r2, #0x7 - mov r0, #0x3 - mov r1, #0xf - lsl r2, r2, #0xc - bl FUN_02016828 - add r0, r4, #0x0 - mov r1, #0xe - bl FUN_02031734 - ldr r0, _02032C04 ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - add r0, #0x40 - strb r1, [r0, #0x0] - ldr r0, _02032C08 ; =FUN_02032B8C - bl FUN_02031D20 -_02032C00: - pop {r4, pc} - nop -_02032C04: .word UNK_021C5A00 -_02032C08: .word FUN_02032B8C - - thumb_func_start FUN_02032C0C -FUN_02032C0C: ; 0x02032C0C - push {r3, lr} - ldr r0, _02032C20 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _02032C1E - ldr r0, _02032C24 ; =FUN_02032440 - mov r1, #0x5 - bl FUN_02031D20 -_02032C1E: - pop {r3, pc} - .balign 4 -_02032C20: .word UNK_021C5A00 -_02032C24: .word FUN_02032440 - - thumb_func_start FUN_02032C28 -FUN_02032C28: ; 0x02032C28 - sub sp, #0x8 - ldr r1, _02032C64 ; =UNK_020EEC48 - add r0, sp, #0x0 - ldr r2, [r1, #0x0] - ldr r1, [r1, #0x4] - str r2, [sp, #0x0] - str r1, [sp, #0x4] - ldr r1, _02032C68 ; =UNK_021C5A00 - ldr r1, [r1, #0x0] - ldr r3, [r1, #0x24] - cmp r1, #0x0 - bne _02032C46 - mov r0, #0x0 - add sp, #0x8 - bx lr -_02032C46: - cmp r2, #0x0 - beq _02032C5E -_02032C4A: - ldr r1, [r0, #0x0] - cmp r3, r1 - bne _02032C56 - mov r0, #0x1 - add sp, #0x8 - bx lr -_02032C56: - add r0, r0, #0x4 - ldr r1, [r0, #0x0] - cmp r1, #0x0 - bne _02032C4A -_02032C5E: - mov r0, #0x0 - add sp, #0x8 - bx lr - .balign 4 -_02032C64: .word UNK_020EEC48 -_02032C68: .word UNK_021C5A00 - - thumb_func_start FUN_02032C6C -FUN_02032C6C: ; 0x02032C6C - ldr r2, _02032CE4 ; =0x00400131 - cmp r0, r2 - bhi _02032C7C - bhs _02032CBA - ldr r2, _02032CE8 ; =0x00000333 - cmp r0, r2 - beq _02032C8E - bx lr -_02032C7C: - ldr r1, _02032CEC ; =0x00400286 - cmp r0, r1 - bhi _02032C86 - beq _02032CCE - bx lr -_02032C86: - add r1, #0x92 - cmp r0, r1 - beq _02032CA6 - bx lr -_02032C8E: - cmp r1, #0xf - bne _02032CE0 - ldr r0, _02032CF0 ; =UNK_021C5A00 - ldr r2, [r0, #0x0] - add r0, r2, #0x0 - add r0, #0x49 - ldrb r1, [r0, #0x0] - mov r0, #0x1 - add r2, #0x49 - orr r0, r1 - strb r0, [r2, #0x0] - bx lr -_02032CA6: - ldr r0, _02032CF0 ; =UNK_021C5A00 - ldr r2, [r0, #0x0] - add r0, r2, #0x0 - add r0, #0x49 - ldrb r1, [r0, #0x0] - mov r0, #0x1 - add r2, #0x49 - orr r0, r1 - strb r0, [r2, #0x0] - bx lr -_02032CBA: - ldr r0, _02032CF0 ; =UNK_021C5A00 - ldr r2, [r0, #0x0] - add r0, r2, #0x0 - add r0, #0x49 - ldrb r1, [r0, #0x0] - mov r0, #0x2 - add r2, #0x49 - orr r0, r1 - strb r0, [r2, #0x0] - bx lr -_02032CCE: - ldr r0, _02032CF0 ; =UNK_021C5A00 - ldr r2, [r0, #0x0] - add r0, r2, #0x0 - add r0, #0x49 - ldrb r1, [r0, #0x0] - mov r0, #0x4 - add r2, #0x49 - orr r0, r1 - strb r0, [r2, #0x0] -_02032CE0: - bx lr - nop -_02032CE4: .word 0x00400131 -_02032CE8: .word 0x00000333 -_02032CEC: .word 0x00400286 -_02032CF0: .word UNK_021C5A00 - - thumb_func_start FUN_02032CF4 -FUN_02032CF4: ; 0x02032CF4 - push {r3, lr} - bl FUN_0202E4C8 - cmp r0, #0x0 - beq _02032D34 - ldr r0, _02032D38 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x2c] - bl FUN_0202E29C - ldr r0, _02032D38 ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x28] - bl FUN_0202DB14 - ldr r0, _02032D3C ; =FUN_02032C6C - bl FUN_0202D308 - mov r0, #0x1 - add r1, r0, #0x0 - mov r2, #0x20 - bl FUN_0202F950 - cmp r0, #0x0 - beq _02032D34 - bl FUN_0202FA10 - ldr r0, _02032D40 ; =FUN_02032B84 - mov r1, #0x0 - bl FUN_02031D20 -_02032D34: - pop {r3, pc} - nop -_02032D38: .word UNK_021C5A00 -_02032D3C: .word FUN_02032C6C -_02032D40: .word FUN_02032B84 - - thumb_func_start FUN_02032D44 -FUN_02032D44: ; 0x02032D44 - push {r4, lr} - add r4, r0, #0x0 - bl FUN_02030F40 - cmp r0, #0x0 - bne _02032D74 - mov r2, #0x7 - mov r0, #0x3 - mov r1, #0xf - lsl r2, r2, #0xc - bl FUN_02016828 - add r0, r4, #0x0 - mov r1, #0x11 - bl FUN_02031734 - ldr r0, _02032D78 ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - add r0, #0x40 - strb r1, [r0, #0x0] - ldr r0, _02032D7C ; =FUN_02032CF4 - bl FUN_02031D20 -_02032D74: - pop {r4, pc} - nop -_02032D78: .word UNK_021C5A00 -_02032D7C: .word FUN_02032CF4 - - thumb_func_start FUN_02032D80 -FUN_02032D80: ; 0x02032D80 - push {r3, lr} - ldr r0, _02032D94 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _02032D92 - ldr r0, _02032D98 ; =FUN_02032440 - mov r1, #0x5 - bl FUN_02031D20 -_02032D92: - pop {r3, pc} - .balign 4 -_02032D94: .word UNK_021C5A00 -_02032D98: .word FUN_02032440 - - thumb_func_start FUN_02032D9C -FUN_02032D9C: ; 0x02032D9C - ldr r0, _02032DA8 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x49 - ldrb r0, [r0, #0x0] - bx lr - nop -_02032DA8: .word UNK_021C5A00 - - thumb_func_start FUN_02032DAC -FUN_02032DAC: ; 0x02032DAC - push {r3, lr} - bl FUN_02031468 - ldr r0, _02032DF4 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - bne _02032DBE - mov r0, #0x1 - pop {r3, pc} -_02032DBE: - add r0, #0x3f - ldrb r0, [r0, #0x0] - add r0, #0xe8 - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - cmp r0, #0x1 - bhi _02032DD4 - bl MOD04_021D83C0 - mov r0, #0x1 - pop {r3, pc} -_02032DD4: - bl FUN_02033590 - cmp r0, #0x0 - beq _02032DE6 - ldr r0, _02032DF8 ; =FUN_0203318C - mov r1, #0x0 - bl FUN_02031D20 - b _02032DEE -_02032DE6: - ldr r0, _02032DFC ; =FUN_02032178 - mov r1, #0x0 - bl FUN_02031D20 -_02032DEE: - mov r0, #0x0 - pop {r3, pc} - nop -_02032DF4: .word UNK_021C5A00 -_02032DF8: .word FUN_0203318C -_02032DFC: .word FUN_02032178 - - thumb_func_start FUN_02032E00 -FUN_02032E00: ; 0x02032E00 - push {r3, lr} - bl FUN_0202E4C8 - cmp r0, #0x0 - beq _02032E3C - ldr r0, _02032E40 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x2c] - bl FUN_0202E29C - ldr r0, _02032E40 ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x28] - bl FUN_0202DB14 - mov r0, #0x1 - add r1, r0, #0x0 - lsl r2, r0, #0x9 - add r3, r0, #0x0 - bl FUN_0202F918 - cmp r0, #0x0 - beq _02032E3C - bl FUN_0202FA10 - ldr r0, _02032E44 ; =FUN_02032218 - mov r1, #0x0 - bl FUN_02031D20 -_02032E3C: - pop {r3, pc} - nop -_02032E40: .word UNK_021C5A00 -_02032E44: .word FUN_02032218 - - thumb_func_start FUN_02032E48 -FUN_02032E48: ; 0x02032E48 - push {r3, lr} - bl FUN_0202E4C8 - cmp r0, #0x0 - beq _02032E82 - ldr r0, _02032E84 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x2c] - bl FUN_0202E29C - ldr r0, _02032E84 ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x28] - bl FUN_0202DB14 - mov r0, #0x1 - add r1, r0, #0x0 - lsl r2, r0, #0x9 - bl FUN_0202F950 - cmp r0, #0x0 - beq _02032E82 - bl FUN_0202FA10 - ldr r0, _02032E88 ; =FUN_02032290 - mov r1, #0x0 - bl FUN_02031D20 -_02032E82: - pop {r3, pc} - .balign 4 -_02032E84: .word UNK_021C5A00 -_02032E88: .word FUN_02032290 - - thumb_func_start FUN_02032E8C -FUN_02032E8C: ; 0x02032E8C - bx lr - .balign 4 - - thumb_func_start FUN_02032E90 -FUN_02032E90: ; 0x02032E90 - push {r3, lr} - bl MOD04_021D7F8C - cmp r0, #0x0 - bge _02032EA2 - ldr r0, _02032EA4 ; =FUN_02032E8C - mov r1, #0x0 - bl FUN_02031D20 -_02032EA2: - pop {r3, pc} - .balign 4 -_02032EA4: .word FUN_02032E8C - - thumb_func_start FUN_02032EA8 -FUN_02032EA8: ; 0x02032EA8 - bx lr - .balign 4 - - thumb_func_start FUN_02032EAC -FUN_02032EAC: ; 0x02032EAC - bx lr - .balign 4 - - thumb_func_start FUN_02032EB0 -FUN_02032EB0: ; 0x02032EB0 - push {r3, lr} - mov r0, #0x1 - bl FUN_020313A0 - bl MOD04_021D7F8C - cmp r0, #0xa - blt _02032ECA - ldr r0, _02032F0C ; =FUN_02032EAC - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032ECA: - cmp r0, #0x0 - bge _02032ED8 - ldr r0, _02032F10 ; =FUN_02032E8C - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032ED8: - cmp r0, #0x1 - bne _02032EE6 - ldr r0, _02032F14 ; =FUN_02032E90 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032EE6: - cmp r0, #0x2 - bne _02032F08 - ldr r0, _02032F18 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x44 - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - beq _02032F00 - ldr r0, _02032F10 ; =FUN_02032E8C - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032F00: - ldr r0, _02032F1C ; =FUN_02032EA8 - mov r1, #0x0 - bl FUN_02031D20 -_02032F08: - pop {r3, pc} - nop -_02032F0C: .word FUN_02032EAC -_02032F10: .word FUN_02032E8C -_02032F14: .word FUN_02032E90 -_02032F18: .word UNK_021C5A00 -_02032F1C: .word FUN_02032EA8 - - thumb_func_start FUN_02032F20 -FUN_02032F20: ; 0x02032F20 - add r1, r0, #0x2 - cmp r1, #0x1 - bls _02032F28 - neg r0, r0 -_02032F28: - ldr r1, _02032F30 ; =UNK_021C5A00 - ldr r1, [r1, #0x0] - str r0, [r1, #0x34] - bx lr - .balign 4 -_02032F30: .word UNK_021C5A00 - - thumb_func_start FUN_02032F34 -FUN_02032F34: ; 0x02032F34 - push {r3, lr} - mov r0, #0x0 - bl MOD04_021D7800 - cmp r0, #0xa - blt _02032F4A - ldr r0, _02032F88 ; =FUN_02032EAC - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032F4A: - cmp r0, #0x0 - bge _02032F5C - bl FUN_02032F20 - ldr r0, _02032F8C ; =FUN_02032E8C - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032F5C: - cmp r0, #0x1 - bne _02032F6A - ldr r0, _02032F90 ; =FUN_02032EB0 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032F6A: - cmp r0, #0x2 - bne _02032F78 - ldr r0, _02032F94 ; =FUN_02032EA8 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032F78: - cmp r0, #0x3 - bne _02032F84 - ldr r0, _02032F88 ; =FUN_02032EAC - mov r1, #0x0 - bl FUN_02031D20 -_02032F84: - pop {r3, pc} - nop -_02032F88: .word FUN_02032EAC -_02032F8C: .word FUN_02032E8C -_02032F90: .word FUN_02032EB0 -_02032F94: .word FUN_02032EA8 - - thumb_func_start FUN_02032F98 -FUN_02032F98: ; 0x02032F98 - push {r3, lr} - mov r0, #0x1 - bl MOD04_021D7800 - cmp r0, #0x0 - bge _02032FB2 - bl FUN_02032F20 - ldr r0, _02032FD0 ; =FUN_02032E8C - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02032FB2: - ldr r0, _02032FD4 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x42 - ldrb r0, [r0, #0x0] - bl MOD04_021D8494 - cmp r0, #0x0 - beq _02032FCE - bl FUN_0202FC60 - ldr r0, _02032FD8 ; =FUN_02032F34 - mov r1, #0x0 - bl FUN_02031D20 -_02032FCE: - pop {r3, pc} - .balign 4 -_02032FD0: .word FUN_02032E8C -_02032FD4: .word UNK_021C5A00 -_02032FD8: .word FUN_02032F34 - - thumb_func_start FUN_02032FDC -FUN_02032FDC: ; 0x02032FDC - push {r4, lr} - add r4, r0, #0x0 - ldr r0, _02032FFC ; =FUN_020303BC - ldr r1, _02033000 ; =FUN_02030238 - bl MOD04_021D77C4 - ldr r0, _02033004 ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - add r0, #0x42 - strb r4, [r0, #0x0] - ldr r0, _02033008 ; =FUN_02032F98 - bl FUN_02031D20 - mov r0, #0x1 - pop {r4, pc} - .balign 4 -_02032FFC: .word FUN_020303BC -_02033000: .word FUN_02030238 -_02033004: .word UNK_021C5A00 -_02033008: .word FUN_02032F98 - - thumb_func_start FUN_0203300C -FUN_0203300C: ; 0x0203300C - ldr r0, _02033048 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r1, [r0, #0x24] - ldr r0, _0203304C ; =FUN_02032F34 - cmp r1, r0 - bne _0203301C - mov r0, #0x0 - bx lr -_0203301C: - ldr r0, _02033050 ; =FUN_02032EB0 - cmp r1, r0 - bne _02033026 - mov r0, #0x1 - bx lr -_02033026: - ldr r0, _02033054 ; =FUN_02032E90 - cmp r1, r0 - bne _02033030 - mov r0, #0x3 - bx lr -_02033030: - ldr r0, _02033058 ; =FUN_02032EA8 - cmp r1, r0 - bne _0203303A - mov r0, #0x4 - bx lr -_0203303A: - ldr r0, _0203305C ; =FUN_02032EAC - cmp r1, r0 - bne _02033044 - mov r0, #0x5 - bx lr -_02033044: - mov r0, #0x2 - bx lr - .balign 4 -_02033048: .word UNK_021C5A00 -_0203304C: .word FUN_02032F34 -_02033050: .word FUN_02032EB0 -_02033054: .word FUN_02032E90 -_02033058: .word FUN_02032EA8 -_0203305C: .word FUN_02032EAC - - thumb_func_start FUN_02033060 -FUN_02033060: ; 0x02033060 - push {r3, lr} - ldr r0, _02033090 ; =FUN_020303BC - ldr r1, _02033094 ; =FUN_02030238 - bl MOD04_021D77C4 - mov r0, #0x0 - mvn r0, r0 - bl MOD04_021D8494 - cmp r0, #0x0 - beq _0203308C - ldr r0, _02033098 ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - add r0, #0x4d - strb r1, [r0, #0x0] - bl FUN_0202FC60 - ldr r0, _0203309C ; =FUN_02032F34 - mov r1, #0x0 - bl FUN_02031D20 -_0203308C: - pop {r3, pc} - nop -_02033090: .word FUN_020303BC -_02033094: .word FUN_02030238 -_02033098: .word UNK_021C5A00 -_0203309C: .word FUN_02032F34 - - thumb_func_start FUN_020330A0 -FUN_020330A0: ; 0x020330A0 - push {r3, lr} - mov r0, #0x0 - bl FUN_020313A0 - ldr r0, _020330D8 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x41 - ldrb r0, [r0, #0x0] - bl MOD04_021D82BC - cmp r0, #0x0 - beq _020330C6 - bl MOD04_021D836C - ldr r0, _020330DC ; =FUN_02033060 - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_020330C6: - bl MOD04_021D7F8C - cmp r0, #0x0 - bge _020330D6 - ldr r0, _020330E0 ; =FUN_02032E8C - mov r1, #0x0 - bl FUN_02031D20 -_020330D6: - pop {r3, pc} - .balign 4 -_020330D8: .word UNK_021C5A00 -_020330DC: .word FUN_02033060 -_020330E0: .word FUN_02032E8C - - thumb_func_start FUN_020330E4 -FUN_020330E4: ; 0x020330E4 - push {r3, lr} - bl FUN_02031190 - cmp r0, #0x0 - bne _02033100 - ldr r0, _02033120 ; =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - add r0, #0x41 - strb r1, [r0, #0x0] - ldr r0, _02033124 ; =FUN_020330A0 - bl FUN_02031D20 - b _02033112 -_02033100: - ldr r0, _02033120 ; =UNK_021C5A00 - mov r1, #0x1 - ldr r0, [r0, #0x0] - add r0, #0x41 - strb r1, [r0, #0x0] - ldr r0, _02033124 ; =FUN_020330A0 - mov r1, #0x0 - bl FUN_02031D20 -_02033112: - ldr r0, _02033120 ; =UNK_021C5A00 - mov r1, #0x1 - ldr r0, [r0, #0x0] - add r0, #0x4d - strb r1, [r0, #0x0] - pop {r3, pc} - nop -_02033120: .word UNK_021C5A00 -_02033124: .word FUN_020330A0 - - thumb_func_start FUN_02033128 -FUN_02033128: ; 0x02033128 - ldr r0, _02033134 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x4d - ldrb r0, [r0, #0x0] - bx lr - nop -_02033134: .word UNK_021C5A00 - - thumb_func_start FUN_02033138 -FUN_02033138: ; 0x02033138 - ldr r0, _0203314C ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r1, [r0, #0x24] - ldr r0, _02033150 ; =FUN_02033060 - cmp r1, r0 - bne _02033148 - mov r0, #0x1 - bx lr -_02033148: - mov r0, #0x0 - bx lr - .balign 4 -_0203314C: .word UNK_021C5A00 -_02033150: .word FUN_02033060 - - thumb_func_start FUN_02033154 -FUN_02033154: ; 0x02033154 - ldr r0, _02033174 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r1, [r0, #0x24] - ldr r0, _02033178 ; =FUN_02032F34 - cmp r1, r0 - bne _02033164 - mov r0, #0x1 - bx lr -_02033164: - ldr r0, _0203317C ; =FUN_02033060 - cmp r1, r0 - bne _0203316E - mov r0, #0x1 - bx lr -_0203316E: - mov r0, #0x0 - bx lr - nop -_02033174: .word UNK_021C5A00 -_02033178: .word FUN_02032F34 -_0203317C: .word FUN_02033060 - - thumb_func_start FUN_02033180 -FUN_02033180: ; 0x02033180 - ldr r0, _02033188 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x34] - bx lr - .balign 4 -_02033188: .word UNK_021C5A00 - - thumb_func_start FUN_0203318C -FUN_0203318C: ; 0x0203318C - push {r3, lr} - mov r0, #0x0 - bl FUN_020313A0 - mov r0, #0x0 - bl MOD04_021D82BC - cmp r0, #0x0 - beq _020331AA - bl MOD04_021D836C - ldr r0, _020331BC ; =FUN_02032440 - mov r1, #0x0 - bl FUN_02031D20 -_020331AA: - bl MOD04_021D7F8C - cmp r0, #0x0 - bge _020331BA - ldr r0, _020331C0 ; =FUN_02032E8C - mov r1, #0x0 - bl FUN_02031D20 -_020331BA: - pop {r3, pc} - .balign 4 -_020331BC: .word FUN_02032440 -_020331C0: .word FUN_02032E8C - - thumb_func_start FUN_020331C4 -FUN_020331C4: ; 0x020331C4 - push {r3, lr} - ldr r0, _020331E0 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _020331DC - mov r0, #0x1 - bl FUN_020166B8 - ldr r0, _020331E4 ; =FUN_02032440 - mov r1, #0x5 - bl FUN_02031D20 -_020331DC: - pop {r3, pc} - nop -_020331E0: .word UNK_021C5A00 -_020331E4: .word FUN_02032440 - - thumb_func_start FUN_020331E8 -FUN_020331E8: ; 0x020331E8 - push {r3, lr} - ldr r0, _02033200 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _020331FE - mov r1, #0x0 - add r0, #0x41 - strb r1, [r0, #0x0] - ldr r0, _02033204 ; =FUN_020330A0 - bl FUN_02031D20 -_020331FE: - pop {r3, pc} - .balign 4 -_02033200: .word UNK_021C5A00 -_02033204: .word FUN_020330A0 - - thumb_func_start FUN_02033208 -FUN_02033208: ; 0x02033208 - push {r3, lr} - ldr r0, _02033234 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _02033232 - bl FUN_02031190 - cmp r0, #0x0 - bne _02033220 - mov r1, #0x0 - ldr r0, _02033234 ; =UNK_021C5A00 - b _02033224 -_02033220: - ldr r0, _02033234 ; =UNK_021C5A00 - mov r1, #0x1 -_02033224: - ldr r0, [r0, #0x0] - add r0, #0x41 - strb r1, [r0, #0x0] - ldr r0, _02033238 ; =FUN_020330A0 - mov r1, #0x0 - bl FUN_02031D20 -_02033232: - pop {r3, pc} - .balign 4 -_02033234: .word UNK_021C5A00 -_02033238: .word FUN_020330A0 - - thumb_func_start FUN_0203323C -FUN_0203323C: ; 0x0203323C - push {r3, lr} - bl FUN_02031190 - add r1, sp, #0x0 - strb r0, [r1, #0x0] - mov r0, #0x15 - add r1, sp, #0x0 - bl FUN_020311D0 - pop {r3, pc} - - thumb_func_start FUN_02033250 -FUN_02033250: ; 0x02033250 - ldr r0, _0203327C ; =UNK_021C5A00 - ldr r2, [r0, #0x0] - cmp r2, #0x0 - beq _02033276 - ldr r1, [r2, #0x24] - ldr r0, _02033280 ; =FUN_02032E8C - cmp r1, r0 - bne _02033264 - mov r0, #0x1 - bx lr -_02033264: - ldr r0, _02033284 ; =FUN_02032E90 - cmp r1, r0 - bne _02033276 - add r2, #0x44 - ldrb r0, [r2, #0x0] - cmp r0, #0x0 - beq _02033276 - mov r0, #0x1 - bx lr -_02033276: - mov r0, #0x0 - bx lr - nop -_0203327C: .word UNK_021C5A00 -_02033280: .word FUN_02032E8C -_02033284: .word FUN_02032E90 - - thumb_func_start FUN_02033288 -FUN_02033288: ; 0x02033288 - push {r4, lr} - add r4, r0, #0x0 - ldr r0, _020332D8 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - bne _020332D6 - mov r1, #0xf - add r2, r1, #0x0 - mov r0, #0x3 - add r2, #0xf1 - bl FUN_02016828 - mov r0, #0xf - mov r1, #0x50 - bl AllocFromHeap - ldr r1, _020332D8 ; =UNK_021C5A00 - mov r2, #0x50 - str r0, [r1, #0x0] - mov r1, #0x0 - bl MI_CpuFill8 - ldr r0, _020332D8 ; =UNK_021C5A00 - mov r2, #0x18 - ldr r1, [r0, #0x0] - add r1, #0x3f - strb r2, [r1, #0x0] - ldr r2, [r0, #0x0] - mov r1, #0x1 - add r2, #0x46 - strb r1, [r2, #0x0] - ldr r0, [r0, #0x0] - str r4, [r0, #0x28] - mov r0, #0x0 - bl FUN_020334E8 - mov r0, #0x1 - bl FUN_020166A8 -_020332D6: - pop {r4, pc} - .balign 4 -_020332D8: .word UNK_021C5A00 - - thumb_func_start FUN_020332DC -FUN_020332DC: ; 0x020332DC - push {r3, lr} - ldr r0, _0203330C ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _02033308 - mov r0, #0x1 - bl FUN_020166B8 - mov r0, #0x0 - add r1, r0, #0x0 - bl FUN_020334E8 - ldr r0, _0203330C ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - bl FreeToHeap - ldr r0, _0203330C ; =UNK_021C5A00 - mov r1, #0x0 - str r1, [r0, #0x0] - mov r0, #0xf - bl FUN_020168D0 -_02033308: - pop {r3, pc} - nop -_0203330C: .word UNK_021C5A00 - - thumb_func_start FUN_02033310 -FUN_02033310: ; 0x02033310 - push {r4, lr} - add r4, r0, #0x0 - ldr r0, _02033360 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - bne _0203335E - mov r1, #0xf - add r2, r1, #0x0 - mov r0, #0x3 - add r2, #0xf1 - bl FUN_02016828 - mov r0, #0xf - mov r1, #0x50 - bl AllocFromHeap - ldr r1, _02033360 ; =UNK_021C5A00 - mov r2, #0x50 - str r0, [r1, #0x0] - mov r1, #0x0 - bl MI_CpuFill8 - ldr r0, _02033360 ; =UNK_021C5A00 - mov r2, #0x19 - ldr r1, [r0, #0x0] - add r1, #0x3f - strb r2, [r1, #0x0] - ldr r2, [r0, #0x0] - mov r1, #0x1 - add r2, #0x46 - strb r1, [r2, #0x0] - ldr r0, [r0, #0x0] - str r4, [r0, #0x28] - mov r0, #0x0 - bl FUN_020334E8 - mov r0, #0x1 - bl FUN_020166A8 -_0203335E: - pop {r4, pc} - .balign 4 -_02033360: .word UNK_021C5A00 - - thumb_func_start FUN_02033364 -FUN_02033364: ; 0x02033364 - push {r3, lr} - ldr r0, _02033394 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _02033390 - mov r0, #0x1 - bl FUN_020166B8 - mov r0, #0x0 - add r1, r0, #0x0 - bl FUN_020334E8 - ldr r0, _02033394 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - bl FreeToHeap - ldr r0, _02033394 ; =UNK_021C5A00 - mov r1, #0x0 - str r1, [r0, #0x0] - mov r0, #0xf - bl FUN_020168D0 -_02033390: - pop {r3, pc} - nop -_02033394: .word UNK_021C5A00 - - thumb_func_start FUN_02033398 -FUN_02033398: ; 0x02033398 - push {r3, lr} - sub sp, #0x8 - ldr r0, _020333EC ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - bne _020333AA - add sp, #0x8 - mov r0, #0x0 - pop {r3, pc} -_020333AA: - add r0, #0x3f - ldrb r0, [r0, #0x0] - cmp r0, #0x18 - bne _020333C8 - add r0, sp, #0x4 - add r1, sp, #0x0 - bl MOD04_021DD718 - cmp r0, #0x0 - beq _020333E4 - bl MOD04_021DD6F0 - add sp, #0x8 - mov r0, #0x1 - pop {r3, pc} -_020333C8: - cmp r0, #0x19 - bne _020333E4 - add r0, sp, #0x4 - add r1, sp, #0x0 - bl MOD04_021DD718 - cmp r0, #0x0 - beq _020333E4 - ldr r0, [sp, #0x0] - cmp r0, #0x7 - bne _020333E4 - add sp, #0x8 - mov r0, #0x1 - pop {r3, pc} -_020333E4: - mov r0, #0x0 - add sp, #0x8 - pop {r3, pc} - nop -_020333EC: .word UNK_021C5A00 - - thumb_func_start FUN_020333F0 -FUN_020333F0: ; 0x020333F0 - push {r3, lr} - bl MOD04_021D76AC - cmp r0, #0x0 - bge _02033408 - bl FUN_02032F20 - ldr r0, _02033414 ; =FUN_02032E8C - mov r1, #0x0 - bl FUN_02031D20 - pop {r3, pc} -_02033408: - ble _02033412 - ldr r0, _02033418 ; =FUN_02033060 - mov r1, #0x0 - bl FUN_02031D20 -_02033412: - pop {r3, pc} - .balign 4 -_02033414: .word FUN_02032E8C -_02033418: .word FUN_02033060 - - thumb_func_start FUN_0203341C -FUN_0203341C: ; 0x0203341C - push {r3, lr} - bl FUN_0202E4C8 - cmp r0, #0x0 - beq _0203345E - mov r1, #0x31 - mov r0, #0x3 - lsl r2, r1, #0xc - bl FUN_02016828 - mov r0, #0x1 - add r1, r0, #0x0 - lsl r2, r0, #0x9 - add r3, r0, #0x0 - bl FUN_0202F918 - cmp r0, #0x0 - beq _0203345E - ldr r0, _02033460 ; =UNK_021C5A00 - mov r1, #0x31 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x28] - bl MOD05_021D74E0 - ldr r0, _02033464 ; =FUN_020335D0 - bl MOD04_021D83A8 - bl FUN_0202FA10 - ldr r0, _02033468 ; =FUN_020333F0 - mov r1, #0x0 - bl FUN_02031D20 -_0203345E: - pop {r3, pc} - .balign 4 -_02033460: .word UNK_021C5A00 -_02033464: .word FUN_020335D0 -_02033468: .word FUN_020333F0 - - thumb_func_start FUN_0203346C -FUN_0203346C: ; 0x0203346C - push {r3-r5, lr} - add r5, r0, #0x0 - add r4, r1, #0x0 - bl Sav2_PlayerData_GetProfileAddr - bl FUN_02030F40 - cmp r0, #0x0 - beq _02033482 - mov r0, #0x0 - pop {r3-r5, pc} -_02033482: - mov r0, #0x1 - bl FUN_020166A8 - ldr r2, _020334D0 ; =0x00007080 - mov r0, #0x3 - mov r1, #0xf - bl FUN_02016828 - add r0, r5, #0x0 - mov r1, #0x17 - bl FUN_02031734 - mov r0, #0xf - add r1, r4, #0x0 - bl AllocFromHeap - ldr r1, _020334D4 ; =UNK_021C5A00 - ldr r2, [r1, #0x0] - str r0, [r2, #0x0] - ldr r0, [r1, #0x0] - mov r1, #0x0 - ldr r0, [r0, #0x0] - add r2, r4, #0x0 - bl MI_CpuFill8 - ldr r0, _020334D4 ; =UNK_021C5A00 - mov r1, #0x0 - ldr r2, [r0, #0x0] - add r2, #0x40 - strb r1, [r2, #0x0] - ldr r0, [r0, #0x0] - str r5, [r0, #0x28] - ldr r0, _020334D8 ; =FUN_0203341C - bl FUN_02031D20 - ldr r0, _020334D4 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x0] - pop {r3-r5, pc} - .balign 4 -_020334D0: .word 0x00007080 -_020334D4: .word UNK_021C5A00 -_020334D8: .word FUN_0203341C - - thumb_func_start FUN_020334DC -FUN_020334DC: ; 0x020334DC - ldr r0, _020334E4 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x0] - bx lr - .balign 4 -_020334E4: .word UNK_021C5A00 - - thumb_func_start FUN_020334E8 -FUN_020334E8: ; 0x020334E8 - push {r4, lr} - add r4, r0, #0x0 - ldr r0, _0203350C ; =UNK_021C5A00 - ldr r2, [r0, #0x0] - cmp r2, #0x0 - beq _020334FE - add r2, #0x44 - strb r4, [r2, #0x0] - ldr r0, [r0, #0x0] - add r0, #0x45 - strb r1, [r0, #0x0] -_020334FE: - add r0, r4, #0x0 - bl FUN_0202EE84 - add r0, r4, #0x0 - bl FUN_0202EEB0 - pop {r4, pc} - .balign 4 -_0203350C: .word UNK_021C5A00 - - thumb_func_start FUN_02033510 -FUN_02033510: ; 0x02033510 - ldr r0, _02033530 ; =UNK_021C5A00 - ldr r1, [r0, #0x0] - cmp r1, #0x0 - beq _0203352C - add r0, r1, #0x0 - add r0, #0x4e - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - beq _02033526 - mov r0, #0x1 - bx lr -_02033526: - add r1, #0x45 - ldrb r0, [r1, #0x0] - bx lr -_0203352C: - mov r0, #0x0 - bx lr - .balign 4 -_02033530: .word UNK_021C5A00 - - thumb_func_start FUN_02033534 -FUN_02033534: ; 0x02033534 - ldr r0, _02033548 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _02033542 - add r0, #0x3f - ldrb r0, [r0, #0x0] - bx lr -_02033542: - mov r0, #0x1 - bx lr - nop -_02033548: .word UNK_021C5A00 - - thumb_func_start FUN_0203354C -FUN_0203354C: ; 0x0203354C - ldr r0, _02033560 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _0203355A - add r0, #0x40 - ldrb r0, [r0, #0x0] - bx lr -_0203355A: - mov r0, #0x0 - bx lr - nop -_02033560: .word UNK_021C5A00 - - thumb_func_start FUN_02033564 -FUN_02033564: ; 0x02033564 - ldr r1, _02033570 ; =UNK_021C5A00 - ldr r3, _02033574 ; =MI_CpuCopy8 - ldr r1, [r1, #0x0] - mov r2, #0x6 - add r1, r1, #0x4 - bx r3 - .balign 4 -_02033570: .word UNK_021C5A00 -_02033574: .word MI_CpuCopy8 - - thumb_func_start FUN_02033578 -FUN_02033578: ; 0x02033578 - add r1, r0, #0x0 - ldr r0, _02033588 ; =UNK_021C5A00 - ldr r3, _0203358C ; =MI_CpuCopy8 - ldr r0, [r0, #0x0] - mov r2, #0x6 - add r0, r0, #0x4 - bx r3 - nop -_02033588: .word UNK_021C5A00 -_0203358C: .word MI_CpuCopy8 - - thumb_func_start FUN_02033590 -FUN_02033590: ; 0x02033590 - push {r3, lr} - bl FUN_02033534 - cmp r0, #0x13 - blt _0203359E - mov r0, #0x1 - pop {r3, pc} -_0203359E: - mov r0, #0x0 - pop {r3, pc} - .balign 4 - - thumb_func_start FUN_020335A4 -FUN_020335A4: ; 0x020335A4 - ldr r1, _020335B4 ; =UNK_021C5A00 - ldr r1, [r1, #0x0] - cmp r1, #0x0 - beq _020335B0 - add r1, #0x47 - strb r0, [r1, #0x0] -_020335B0: - bx lr - nop -_020335B4: .word UNK_021C5A00 - - thumb_func_start FUN_020335B8 -FUN_020335B8: ; 0x020335B8 - ldr r0, _020335CC ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - cmp r0, #0x0 - beq _020335C6 - add r0, #0x47 - ldrb r0, [r0, #0x0] - bx lr -_020335C6: - mov r0, #0x0 - bx lr - nop -_020335CC: .word UNK_021C5A00 - - thumb_func_start FUN_020335D0 -FUN_020335D0: ; 0x020335D0 - push {r3, lr} - add r2, r0, #0x0 - mov r0, #0x0 - mov r1, #0x1 - bl FUN_02033F70 -_020335DC: - b _020335DC - .balign 4 - - thumb_func_start FUN_020335E0 -FUN_020335E0: ; 0x020335E0 - push {r3, lr} - mov r0, #0x0 - mov r1, #0x4 - add r2, r0, #0x0 - bl FUN_02033F70 -_020335EC: - b _020335EC - .balign 4 - - thumb_func_start FUN_020335F0 -FUN_020335F0: ; 0x020335F0 - bx lr - .balign 4 - - thumb_func_start FUN_020335F4 -FUN_020335F4: ; 0x020335F4 - push {r3, lr} - bl FUN_02033510 - cmp r0, #0x0 - beq _0203366C - bl FUN_020311F0 - cmp r0, #0x0 - bne _02033622 - bl FUN_02033250 - cmp r0, #0x0 - bne _02033622 - bl FUN_02033398 - cmp r0, #0x0 - bne _02033622 - ldr r0, _02033670 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - add r0, #0x4e - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - beq _0203366C -_02033622: - bl FUN_020335B8 - cmp r0, #0x0 - bne _0203366C - bl FUN_0200541C - ldr r0, _02033670 ; =UNK_021C5A00 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0x28] - bl FUN_0202287C - ldr r1, _02033674 ; =gMain + 0x60 - mov r0, #0x1 - strb r0, [r1, #0x4] - ldr r1, _02033670 ; =UNK_021C5A00 - ldr r2, [r1, #0x0] - add r1, r2, #0x0 - add r1, #0x4e - ldrb r1, [r1, #0x0] - cmp r1, #0x3 - bne _02033654 - mov r0, #0x3 - bl FUN_020335A4 - pop {r3, pc} -_02033654: - add r2, #0x3f - ldrb r1, [r2, #0x0] - cmp r1, #0x19 - beq _02033660 - cmp r1, #0xf - bne _02033668 -_02033660: - mov r0, #0x2 - bl FUN_020335A4 - pop {r3, pc} -_02033668: - bl FUN_020335A4 -_0203366C: - pop {r3, pc} - nop -_02033670: .word UNK_021C5A00 -_02033674: .word gMain + 0x60 - - thumb_func_start FUN_02033678 -FUN_02033678: ; 0x02033678 - push {r3, lr} - bl FUN_0202EDD8 - cmp r0, #0x0 - bne _0203368A - bl FUN_02031810 - cmp r0, #0x0 - bne _0203368E -_0203368A: - mov r0, #0x1 - pop {r3, pc} -_0203368E: - bl FUN_0202E344 - cmp r0, #0x0 - bne _0203369A - mov r0, #0x1 - pop {r3, pc} -_0203369A: - mov r0, #0x0 - pop {r3, pc} - .balign 4 - - thumb_func_start FUN_020336A0 -FUN_020336A0: ; 0x020336A0 - push {r3, lr} - ldr r1, _020336BC ; =UNK_021C5A00 - ldr r1, [r1, #0x0] - cmp r1, #0x0 - beq _020336B6 - add r1, #0x4e - strb r0, [r1, #0x0] - bl FUN_02031468 - mov r0, #0x1 - pop {r3, pc} -_020336B6: - mov r0, #0x0 - pop {r3, pc} - nop -_020336BC: .word UNK_021C5A00 diff --git a/arm9/src/unk_02031734.c b/arm9/src/unk_02031734.c new file mode 100644 index 00000000..21dfad41 --- /dev/null +++ b/arm9/src/unk_02031734.c @@ -0,0 +1,2365 @@ +#include "unk_02031734.h" + +const struct UnkStruct_02031734_const2 UNK_020EEC48 = { { (u32)FUN_02032B84, 0 } }; + +const struct UnkStruct_02031734_const1 UNK_020EEC50 = { { (u32)FUN_0203213C, (u32)FUN_02032138, 0 } }; + +const struct UnkStruct_02031734_const1 UNK_020EEC5C = { { (u32)FUN_02032234, (u32)FUN_0203234C, 0 } }; + +char UNK_02105D5C[] = "FREAK"; + +char UNK_02105D6C[] = " GAME"; + +char UNK_02105D64[] = " FULL"; + +struct UnkStruct_02031734 *UNK_021C5A00; + +extern void FUN_0202E49C(); +extern void FUN_0202D8D0(u32 param0, u32 param1, u32 param2); +extern void FUN_02033E74(); +extern void FUN_0202D918(); +extern void FUN_02033ED0(); +extern void FUN_0202E4F0(); +extern void FUN_0202D298(); +extern void FUN_0202D344(u32 param0); +extern void FUN_0202D1B0(u8 param0); +extern void FUN_0202D36C(u32 param0); +extern u32 MOD04_021DDB08(); +extern void FUN_02033EEC(u32 param0); +extern u32 FUN_0202EDF8(); +extern u32 WM_GetLinkLevel(); +extern u32 FUN_0202E4C8(); +extern void FUN_0202E29C(struct PlayerData *player_data); +extern void FUN_0202DB14(struct SaveBlock2 *sav2, u32 param1); +extern s64 _ll_mul(s64, s64); +extern u32 FUN_0202EE0C(); +extern void FUN_0202EA54(); +extern s32 FUN_0202E8F4(); +extern s32 FUN_0202E950(); +extern u32 FUN_0202E8A0(u8 param0); +extern u32 FUN_0202E6F0(); +extern void FUN_0202EE84(u8 param0); +extern void FUN_0202E7B0(u32 param0); +extern u32 FUN_0202F104(); +extern void FUN_0202DBE0(); +extern void FUN_0202DDE8(); +extern void FUN_0202D308(void (*param0)(u32, u32)); +extern void MOD04_021D83C0(); +extern s32 MOD04_021D7F8C(); +extern s32 MOD04_021D7800(u32 param0); +extern u32 MOD04_021D8494(s32 param0); +extern void MOD04_021D77C4(void (*param0)(u32, u8 *, u16), void (*param1)(u32, void *, u32)); +extern u32 MOD04_021D82BC(u8 param0); +extern void MOD04_021D836C(); +extern u32 MOD04_021DD718(u32 *param0, u32 *param1); +extern void MOD04_021DD6F0(); +extern s32 MOD04_021D76AC(); +extern MOD05_021D74E0(struct SaveBlock2 *sav2, u32 param1); +extern void MOD04_021D83A8(void (*param0)(s32)); +extern void FUN_0202EEB0(u8 param0); +extern void FUN_02033F70(int, int, int); +extern void FUN_0200541C(); +extern u32 FUN_0202EDD8(); +extern u32 FUN_0202E344(); + +THUMB_FUNC void FUN_02031734(struct SaveBlock2 *sav2, u8 param1) +{ + if (UNK_021C5A00 == NULL) + { + FUN_0202E49C(); + struct UnkStruct_02031734 *ptr = AllocFromHeap(0xf, sizeof(struct UnkStruct_02031734)); + UNK_021C5A00 = ptr; + MI_CpuFill8(ptr, 0, sizeof(struct UnkStruct_02031734)); + + UNK_021C5A00->unk3A = 0x32; + UNK_021C5A00->unk43 = 1; + UNK_021C5A00->unk28 = sav2; + + UNK_021C5A00->unk2C = Sav2_PlayerData_GetProfileAddr(sav2); + + UNK_021C5A00->unk3C = 2; + UNK_021C5A00->unk3D = 0; + UNK_021C5A00->unk48 = 0; + UNK_021C5A00->unk3F = param1; + + FUN_020312BC(&UNK_021C5A00->unk0C); + FUN_0202D8D0(0, 0, 0); + + if (param1 != 9 && param1 != 0x11 && param1 != 0xf) + { + FUN_02033E74(); + } + } +} + +THUMB_FUNC void FUN_020317C0() +{ + if (UNK_021C5A00 != NULL) + { + FUN_0202D918(); + if (UNK_021C5A00->unk00 != NULL) + { + FreeToHeap(UNK_021C5A00->unk00); + } + + if (UNK_021C5A00->unk3F >= 0x13) + { + FUN_020168D0(0x31); + } + + FUN_02033ED0(); + FUN_0202E4F0(); + + FreeToHeap(UNK_021C5A00); + FUN_020168D0(0xf); + + UNK_021C5A00 = NULL; + } +} + +THUMB_FUNC BOOL FUN_02031810() +{ + if (UNK_021C5A00 != NULL) + { + return TRUE; + } + return FALSE; +} + +THUMB_FUNC void FUN_02031824(struct SaveBlock2 *sav2) +{ + if (UNK_021C5A00 == NULL) + { + FUN_02016828(3, 0xf, 0xe000); + FUN_02031734(sav2, 0xa); + + UNK_021C5A00->unk40 = 0; + FUN_02031D20(FUN_02031D30, 0x32); + } +} + +THUMB_FUNC void FUN_02031860() +{ + if (UNK_021C5A00 != NULL) + { + FUN_02031468(); + FUN_02031D20(FUN_020323CC, 0); + } +} + +THUMB_FUNC void FUN_02031880() +{ + FUN_0202FC60(); + UNK_021C5A00->unk38 = FUN_02031190(); + + FUN_02031D20(FUN_020321B8, 0); +} + +THUMB_FUNC void FUN_020318A4(u8 param0) +{ + UNK_021C5A00->unk4F = param0; +} + +THUMB_FUNC void FUN_020318B4() +{ + FUN_02031D20(FUN_02032028, 0); +} + +THUMB_FUNC BOOL FUN_020318C4() +{ + struct UnkStruct_02031734_const1 st0 = UNK_020EEC50; + + u32 r1 = (u32)UNK_021C5A00->unk24; + + if (UNK_021C5A00 == NULL) + { + return FALSE; + } + + for (u32 i = 0; st0.unk00[i] != 0; i++) + { + + if (r1 == st0.unk00[i]) + { + return TRUE; + } + } + + return FALSE; +} + +THUMB_FUNC void FUN_02031914() +{ + FUN_02031D20(FUN_02032178, 0); +} + +THUMB_FUNC void FUN_02031924() +{ + UNK_021C5A00->unk4C = 1; +} + +THUMB_FUNC void FUN_02031934() +{ + FUN_0202E49C(); + FUN_02031D20(FUN_02032194, 0); +} + +THUMB_FUNC void FUN_02031948(struct SaveBlock2 *sav2, u8 param1, u8 param2, u32 param3) +{ + if (FUN_02030F40() == 0) + { + FUN_02016828(3, 0xf, 0x7080); + FUN_02031734(sav2, param1); + UNK_021C5A00->unk40 = param2; + UNK_021C5A00->unk30 = param3; + FUN_02031D20(FUN_020321D0, 0); + } +} + +THUMB_FUNC void FUN_02031990(struct SaveBlock2 *sav2, u8 param1, u8 param2, u32 param3) +{ + if (FUN_02030F40() == 0) + { + FUN_02016828(3, 0xf, 0x7080); + FUN_02031734(sav2, param1); + UNK_021C5A00->unk40 = param2; + UNK_021C5A00->unk30 = param3; + FUN_02031D20(FUN_0203224C, 0); + } +} + +THUMB_FUNC void FUN_020319D8(u8 param0) +{ + UNK_021C5A00->unk3E = param0; + FUN_02031D20(FUN_02032298, 0); +} + +THUMB_FUNC void FUN_020319F4() +{ + FUN_0202FCA8(); + FUN_02031D20(FUN_02032364, 0); +} + +THUMB_FUNC void FUN_02031A08() +{ + if (UNK_021C5A00 != NULL) + { + FUN_02031D20(FUN_02032440, 5); + } +} + +THUMB_FUNC void FUN_02031A24() +{ + FUN_0202D298(); +} + +THUMB_FUNC BOOL FUN_02031A2C() +{ + struct UnkStruct_02031734_const1 st0 = UNK_020EEC5C; + + u32 r1 = (u32)UNK_021C5A00->unk24; + + if (UNK_021C5A00 == NULL) + { + return FALSE; + } + + for (u32 i = 0; st0.unk00[i] != 0; i++) + { + + if (r1 == st0.unk00[i]) + { + return TRUE; + } + } + + return FALSE; +} + +THUMB_FUNC void FUN_02031A7C(struct SaveBlock2 *sav2) +{ + if (UNK_021C5A00 == NULL) + { + if (FUN_02016828(3, 0xf, 0x7080) == 0) + { + FUN_020335E0(); + } + + FUN_02031734(sav2, 9); + UNK_021C5A00->unk3F = 9; + UNK_021C5A00->unk40 = 0; + FUN_02031D20(FUN_02032478, 0); + } +} + +THUMB_FUNC void FUN_02031AC8(u8 param0) +{ + UNK_021C5A00->unk3E = param0; + UNK_021C5A00->unk38 = 3; + FUN_0202D344(1); + FUN_02033E74(); + FUN_02031D20(FUN_02032628, 0); +} + +THUMB_FUNC s32 FUN_02031AF4() +{ + if (UNK_021C5A00 == NULL) + { + return -1; + } + if (UNK_021C5A00->unk24 == FUN_0203279C) + { + return 1; + } + + if (UNK_021C5A00->unk24 == FUN_020327B4) + { + return -1; + } + + return 0; +} + +THUMB_FUNC BOOL FUN_02031B2C() +{ + if (UNK_021C5A00 == NULL) + { + return FALSE; + } + if (UNK_021C5A00->unk24 == FUN_020327FC) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC void FUN_02031B50() +{ + FUN_0202D344(0); + if (UNK_021C5A00->unk44 != 1 || UNK_021C5A00->unk45 != 1 || UNK_021C5A00->unk3F == 9) + { + FUN_020334E8(0, 0); + } + + FUN_02033ED0(); + UNK_021C5A00->unk3F = 9; + UNK_021C5A00->unk48 = 0; + FUN_0202D1B0(UNK_021C5A00->unk3C); + + if (FUN_02031190() == 0) + { + FUN_0202D36C(1); + FUN_02031D20(FUN_020323DC, 0xf); + return; + } + + FUN_02031D20(FUN_02032424, 5); +} + +THUMB_FUNC u32 FUN_02031BD0() +{ + if (UNK_021C5A00 == NULL) + { + return 1; + } + + if (UNK_021C5A00->unk24 != FUN_020324F8) + { + return 1; + } + + return 0; +} + +THUMB_FUNC void FUN_02031BF4() +{ + if (UNK_021C5A00 != NULL) + { + FUN_02031D20(FUN_02032440, 5); + } +} + +THUMB_FUNC void FUN_02031C10() +{ + if (UNK_021C5A00 != NULL) + { + UNK_021C5A00->unk48 = 1; + FUN_0202D344(1); + } +} + +THUMB_FUNC void FUN_02031C2C() +{ + if (UNK_021C5A00 != NULL) + { + UNK_021C5A00->unk48 = 1; + FUN_0202D344(1); + FUN_02031D20(FUN_02032850, 0); + } +} + +THUMB_FUNC void FUN_02031C54() +{ + UNK_021C5A00->unk3F = 0x12; +} + +THUMB_FUNC void FUN_02031C64() +{ + UNK_021C5A00->unk3F = 0x9; +} + +THUMB_FUNC void FUN_02031C74(struct SaveBlock2 *sav2, u8 param1) +{ + if (FUN_02030F40() == 0) + { + FUN_02016828(3, 0xf, 0x7080); + FUN_02031734(sav2, param1); + FUN_02031D20(FUN_02032E00, 0); + } +} + +THUMB_FUNC void FUN_02031CA8(struct SaveBlock2 *sav2, u8 param1) +{ + if (FUN_02030F40() == 0) + { + FUN_02016828(3, 0xf, 0x7080); + FUN_02031734(sav2, param1); + FUN_02031D20(FUN_02032E48, 0); + } +} + +THUMB_FUNC void FUN_02031CDC() +{ + if (UNK_021C5A00 != NULL && UNK_021C5A00->unk24 != 0) + { + ((void (*)(void))(UNK_021C5A00->unk24))(); + } + if (FUN_02033590() != 0) + { + FUN_02033EEC(3 - MOD04_021DDB08()); + return; + } + + if (FUN_0202EDF8() != 0) + { + FUN_02033EEC(3 - WM_GetLinkLevel()); + } +} + +THUMB_FUNC void FUN_02031D20(void (*param0)(), u16 param1) +{ + UNK_021C5A00->unk24 = param0; + UNK_021C5A00->unk3A = param1; +} + +THUMB_FUNC void FUN_02031D30() +{ + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } + + if (FUN_0202E4C8() == 0) + { + return; + } + + FUN_0202E29C(UNK_021C5A00->unk2C); + FUN_0202DB14(UNK_021C5A00->unk28, 0); + FUN_02031268(1); + FUN_02030FA8(); + + if (UNK_021C5A00->unk4A != 0) + { + if (FUN_0202F918(1, UNK_021C5A00->unk43, 0x1F4, 1) == 0) + { + return; + } + +#ifdef NONMATCHING + UNK_021C5A00->unk0C = UNK_021C5A00->unk0C * UNK_021C5A00->unk14 + UNK_021C5A00->unk1C; + u32 r1 = ((s64)((u64)(UNK_021C5A00->unk0C) >> 32) * 0x14) >> 32; + + UNK_021C5A00->unk43 = 0; + FUN_02031D20(FUN_020320C4, r1 + 0x14); +#else + asm( + // clang-format off + ldr r0, =UNK_021C5A00 + ldr r5, [r0, #0x0] + add r4, r5, #0x0 + add r4, #0xc + ldr r0, [r4, #0x8] + ldr r1, [r4, #0xc] + ldr r2, [r5, #0xc] + ldr r3, [r4, #0x4] + bl _ll_mul + ldr r2, [r4, #0x10] + ldr r3, [r4, #0x14] + add r0, r2, r0 + adc r3, r1 + str r0, [r5, #0xc] + str r3, [r4, #0x4] + add r0, r3, #0x0 + mov r1, #0x0 + mov r2, #0x14 + mov r3, #0x0 + bl _ll_mul + mov r0, #0x0 + add r5, #0x43 + strb r0, [r5, #0x0] + ldr r0, =FUN_020320C4 + add r1, #0x14 + bl FUN_02031D20 + pop {r3-r5, pc} // clang-format on + ); +#endif + } + + if (FUN_0202F950(1, 1, 0x1F4) != 0) + { + if (UNK_021C5A00->unk4C != 0) + { + FUN_02031D20(FUN_020323B8, 0); + } + else + { + FUN_02031D20(FUN_02031EE0, 0x40); + } + } +} + +THUMB_FUNC void FUN_02031E08() +{ + if (FUN_0202EE0C() != 0) + { + FUN_02031268(1); + FUN_02030FA8(); + + if (UNK_021C5A00->unk4A != 0) + { + FUN_02031D20(FUN_02032058, 0); + return; + } + + if (FUN_0202F950(0, 1, 0x1F4) != 0) + { + +#ifdef NONMATCHING + UNK_021C5A00->unk0C = UNK_021C5A00->unk0C * UNK_021C5A00->unk14 + UNK_021C5A00->unk1C; + u32 r1 = ((s64)((u64)(UNK_021C5A00->unk0C) >> 32) * 0x40) >> 32; + + if (UNK_021C5A00->unk38 != 0) + { + r1 = UNK_021C5A00->unk38 << 6; + UNK_021C5A00->unk38 = 0; + } + FUN_02031D20(FUN_02031EE0, r1); +#else + asm( + // clang-format off + ldr r0, =UNK_021C5A00 + ldr r5, [r0, #0x0] + add r4, r5, #0x0 + add r4, #0xc + ldr r0, [r4, #0x8] + ldr r1, [r4, #0xc] + ldr r2, [r5, #0xc] + ldr r3, [r4, #0x4] + bl _ll_mul + ldr r2, [r4, #0x10] + ldr r3, [r4, #0x14] + add r0, r2, r0 + adc r3, r1 + str r0, [r5, #0xc] + mov r1, #0x0 + str r3, [r4, #0x4] + lsr r0, r3, #0x1a + lsl r1, r1, #0x6 + orr r1, r0 + ldrh r0, [r5, #0x38] + cmp r0, #0x0 + beq _02031E76 + lsl r1, r0, #0x6 + mov r0, #0x0 + strh r0, [r5, #0x38] + _02031E76: + ldr r0, =FUN_02031EE0 + bl FUN_02031D20 + // clang-format on + ); +#endif + } + } +} + +THUMB_FUNC void FUN_02031E8C() +{ + if (FUN_0202EE0C() != 0) + { + if (FUN_0202F950(0, 0, 0x1F4) != 0) + { + +#ifdef NONMATCHING + UNK_021C5A00->unk0C = UNK_021C5A00->unk0C * UNK_021C5A00->unk14 + UNK_021C5A00->unk1C; + u32 r1 = ((s64)((u64)(UNK_021C5A00->unk0C) >> 32) * 0x20) >> 32; + + FUN_02031D20(FUN_02031EE0, r1 + 0x10); +#else + asm( + // clang-format off + ldr r0, =UNK_021C5A00 + ldr r4, [r0, #0x0] + add r5, r4, #0x0 + add r5, #0xc + ldr r0, [r5, #0x8] + ldr r1, [r5, #0xc] + ldr r2, [r4, #0xc] + ldr r3, [r5, #0x4] + bl _ll_mul + ldr r2, [r5, #0x10] + ldr r3, [r5, #0x14] + add r0, r2, r0 + adc r3, r1 + str r0, [r4, #0xc] + mov r1, #0x0 + lsr r2, r3, #0x1b + lsl r1, r1, #0x5 + orr r1, r2 + ldr r0, =FUN_02031EE0 + add r1, #0x10 + str r3, [r5, #0x4] + bl FUN_02031D20 + // clang-format on + ); +#endif + } + } +} + +THUMB_FUNC void FUN_02031EE0() +{ + FUN_0202EA54(); + if (UNK_021C5A00->unk4F == 0 && UNK_021C5A00->unk4B == 0) + { + s32 r0 = FUN_0202E8F4(); + if (r0 != -1) + { + UNK_021C5A00->unk3E = (u8)r0; + FUN_02031D20(FUN_02031F60, 0x20); + return; + } + + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } + + r0 = FUN_0202E950(); + if (r0 != -1) + { + UNK_021C5A00->unk3E = (u8)r0; + FUN_02031D20(FUN_02031F60, 0x20); + return; + } + + FUN_02031D20(FUN_02032028, 0); + } +} + +THUMB_FUNC void FUN_02031F60() +{ + FUN_0202EA54(); + if (FUN_0202E8A0(UNK_021C5A00->unk3E) != 0 && FUN_0202FB18(UNK_021C5A00->unk3E) != 0) + { + FUN_02031D20(FUN_02031FC8, 0x64); + return; + } + + if (FUN_020311F0() != 0) + { + FUN_02031D20(FUN_02032028, 0); + return; + } + + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } + + FUN_02031D20(FUN_02032028, 0); +} + +THUMB_FUNC void FUN_02031FC8() +{ + if (FUN_02030E7C(FUN_02031190()) != 0) + { + FUN_0202FC60(); + FUN_02031268(0); + FUN_02030FA8(); + FUN_02031D20(FUN_0203213C, 0); + return; + } + + if (FUN_020311F0() != 0) + { + FUN_02031D20(FUN_02032028, 0); + return; + } + + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } + + FUN_02031D20(FUN_02032028, 0); +} + +THUMB_FUNC void FUN_02032028() +{ + if (FUN_0202E6F0() != 0) + { + FUN_02031D20(FUN_02032058, 0); + } +} + +THUMB_FUNC void FUN_02032040() +{ + if (FUN_0202E6F0() != 0) + { + FUN_02031D20(FUN_02031E8C, 0); + } +} + +THUMB_FUNC void FUN_02032058() +{ + if (FUN_0202EE0C() != 0) + { + FUN_02031268(1); + if (FUN_0202F918(0, UNK_021C5A00->unk43, 0x1F4, 1) != 0) + { +#ifdef NONMATCHING + UNK_021C5A00->unk0C = UNK_021C5A00->unk0C * UNK_021C5A00->unk14 + UNK_021C5A00->unk1C; + u32 r1 = ((s64)((u64)(UNK_021C5A00->unk0C) >> 32) * 0x14) >> 32; + + UNK_021C5A00->unk43 = 0; + FUN_02031D20(FUN_020320C4, r1 + 0x14); +#else + asm( + // clang-format off + ldr r0, =UNK_021C5A00 + ldr r5, [r0, #0x0] + add r4, r5, #0x0 + add r4, #0xc + ldr r0, [r4, #0x8] + ldr r1, [r4, #0xc] + ldr r2, [r5, #0xc] + ldr r3, [r4, #0x4] + bl _ll_mul + ldr r2, [r4, #0x10] + ldr r3, [r4, #0x14] + add r0, r2, r0 + adc r3, r1 + str r0, [r5, #0xc] + str r3, [r4, #0x4] + add r0, r3, #0x0 + mov r1, #0x0 + mov r2, #0x14 + mov r3, #0x0 + bl _ll_mul + mov r0, #0x0 + add r5, #0x43 + strb r0, [r5, #0x0] + ldr r0, =FUN_020320C4 + add r1, #0x14 + bl FUN_02031D20 + // clang-format on + ); +#endif + } + } +} + +THUMB_FUNC void FUN_020320C4() +{ + if (FUN_020311E8() != 0) + { + UNK_021C5A00->unk43 = 1; + FUN_02031D20(FUN_02032118, 0); + return; + } + + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } + + if (UNK_021C5A00->unk4A == 0 && FUN_0202E6F0() != 0) + { + FUN_02031D20(FUN_02032040, 2); + } +} + +THUMB_FUNC void FUN_02032118() +{ + FUN_02031268(0); + FUN_0202EE84(1); + FUN_02030FA8(); + FUN_02031D20(FUN_02032138, 0); +} + +THUMB_FUNC void FUN_02032138() +{ +} +THUMB_FUNC void FUN_0203213C() +{ +} + +THUMB_FUNC void FUN_02032140() +{ + if (UNK_021C5A00->unk3F < 0x13) + { + if (FUN_0202EE0C() == 0) + { + return; + } + + FUN_02031268(1); + FUN_02030FA8(); + FUN_0202E7B0(1); + } + + FUN_02031D20(FUN_020323B8, 0); +} + +THUMB_FUNC void FUN_02032178() +{ + if (FUN_0202E6F0() != 0) + { + FUN_0202FC60(); + FUN_02031D20(FUN_02032140, 0); + } +} + +THUMB_FUNC void FUN_02032194() +{ + if (FUN_0202E4C8() != 0) + { + FUN_0202E7B0(0); + FUN_0202FC60(); + FUN_02031D20(FUN_02031E08, 0); + } +} + +THUMB_FUNC void FUN_020321B8() +{ + if (FUN_0202E6F0() != 0) + { + FUN_02031D20(FUN_02031E08, 0); + } +} + +THUMB_FUNC void FUN_020321D0() +{ + if (FUN_0202E4C8() != 0) + { + FUN_0202E29C(UNK_021C5A00->unk2C); + FUN_0202DB14(UNK_021C5A00->unk28, UNK_021C5A00->unk30); + if (FUN_0202F918(1, 1, 0x200, 1) != 0) + { + FUN_0202FA10(); + FUN_02031D20(FUN_02032218, 0); + } + } +} + +THUMB_FUNC void FUN_02032218() +{ + if (FUN_02030E7C(FUN_02031190()) != 0) + { + FUN_02031D20(FUN_02032234, 0); + } +} + +THUMB_FUNC void FUN_02032234() +{ + if (FUN_02030F40() == 0) + { + FUN_02031D20(FUN_020323BC, 0); + } +} + +THUMB_FUNC void FUN_0203224C() +{ + if (FUN_0202E4C8() != 0) + { + FUN_0202E29C(UNK_021C5A00->unk2C); + FUN_0202DB14(UNK_021C5A00->unk28, UNK_021C5A00->unk30); + if (FUN_0202F950(1, 1, 0x200) != 0) + { + FUN_0202FA10(); + FUN_02031D20(FUN_02032290, 0); + } + } +} + +THUMB_FUNC void FUN_02032290() +{ + FUN_0202EA54(); +} + +THUMB_FUNC void FUN_02032298() +{ + FUN_0202EA54(); + if (FUN_0202FB18(UNK_021C5A00->unk3E) != 0) + { + FUN_02031D20(FUN_020322C0, 0xa); + } +} + +THUMB_FUNC void FUN_020322C0() +{ + if (FUN_020311F0() != 0) + { + FUN_02031D20(FUN_020322F8, 0); + } + + if (FUN_02030E7C(FUN_02031190()) != 0 && FUN_02031190() != 0) + { + FUN_02031D20(FUN_0203234C, 0); + } +} + +THUMB_FUNC void FUN_020322F8() +{ + FUN_0202E6F0(); + FUN_02031D20(FUN_0203230C, 2); +} + +THUMB_FUNC void FUN_0203230C() +{ + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } + + if (FUN_0202EE0C() != 0 && FUN_0202F950(0, 1, 0x200) != 0) + { + FUN_0202FA10(); + FUN_02031D20(FUN_02032298, 0xa); + } +} + +THUMB_FUNC void FUN_0203234C() +{ + if (FUN_02030F40() == 0) + { + FUN_02031D20(FUN_020323BC, 0); + } +} + +THUMB_FUNC void FUN_02032364() +{ + FUN_0202E6F0(); + FUN_02031D20(FUN_02032378, 2); +} + +THUMB_FUNC void FUN_02032378() +{ + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } + + if (FUN_0202EE0C() != 0 && FUN_0202F950(0, 1, 0x200) != 0) + { + FUN_0202FA10(); + FUN_02031D20(FUN_02032290, 0xa); + } +} + +THUMB_FUNC void FUN_020323B8() +{ +} + +THUMB_FUNC void FUN_020323BC() +{ + if (FUN_02030F40() == 0) + { + FUN_020317C0(); + } +} + +THUMB_FUNC void FUN_020323CC() +{ + FUN_02031D20(FUN_02032440, 5); +} + +THUMB_FUNC void FUN_020323DC() +{ + if (FUN_02030F20() <= 1) + { + FUN_0202D36C(0); + FUN_0202FC80(); + FUN_02031D20(FUN_020324F8, 0); + } + + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } + + FUN_0202D36C(0); + FUN_0202FC80(); + FUN_02031D20(FUN_020324F8, 0); +} + +THUMB_FUNC void FUN_02032424() +{ + if (FUN_0202E6F0() != 0) + { + FUN_0202FC60(); + FUN_02031D20(FUN_020324F8, 0); + } +} + +THUMB_FUNC void FUN_02032440() +{ + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + } + + if (FUN_0202E6F0() != 0 && UNK_021C5A00->unk3A == 0) + { + FUN_0202FA5C(); + FUN_02031D20(FUN_020323BC, 0); + } +} + +THUMB_FUNC void FUN_02032478() +{ + if (FUN_0202E4C8() != 0) + { + FUN_0202E29C(UNK_021C5A00->unk2C); + FUN_0202D1B0(UNK_021C5A00->unk3C); + FUN_0202DB14(UNK_021C5A00->unk28, 0); + if (FUN_0202F950(1, 1, 0x200) != 0) + { + FUN_0202FA10(); + FUN_02031D20(FUN_020324C8, 0x40); + } + } +} + +THUMB_FUNC void FUN_020324C8() +{ + FUN_0202EA54(); + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } + + if (FUN_0202E6F0() != 0) + { + FUN_02031D20(FUN_02032510, 0); + } +} + +THUMB_FUNC void FUN_020324F8() +{ + if (FUN_0202E6F0() != 0) + { + FUN_02031D20(FUN_02032510, 0); + } +} + +THUMB_FUNC void FUN_02032510() +{ + if (FUN_0202EE0C() != 0 && FUN_0202F918(0, UNK_021C5A00->unk43, 0x200, 1) != 0) + { +#ifdef NONMATCHING + UNK_021C5A00->unk0C = UNK_021C5A00->unk0C * UNK_021C5A00->unk14 + UNK_021C5A00->unk1C; + FUN_0202FA10(); + UNK_021C5A00->unk43 = 0; +#else + asm( + // clang-format off + ldr r0, =UNK_021C5A00 + ldr r4, [r0, #0x0] + add r5, r4, #0x0 + add r5, #0xc + ldr r0, [r5, #0x8] + ldr r1, [r5, #0xc] + ldr r2, [r4, #0xc] + ldr r3, [r5, #0x4] + bl _ll_mul + ldr r2, [r5, #0x10] + ldr r3, [r5, #0x14] + add r0, r2, r0 + adc r3, r1 + str r0, [r4, #0xc] + str r3, [r5, #0x4] + bl FUN_0202FA10 + ldr r0, =UNK_021C5A00 + mov r1, #0x0 + ldr r0, [r0, #0x0] + add r0, #0x43 + strb r1, [r0, #0x0] + // clang-format on + ); +#endif + + FUN_02031D20(FUN_02032578, 0x2710); + } +} + +THUMB_FUNC void FUN_02032578() +{ + if (FUN_0202F104() == 0) + { + if (FUN_020311E8() != 0) + { + UNK_021C5A00->unk43 = 1; + FUN_02033E74(); + FUN_02031D20(FUN_020327FC, 0); + return; + } + + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } + } + + if (FUN_0202E6F0() != 0) + { + FUN_02031D20(FUN_020325D0, 0); + } +} + +THUMB_FUNC void FUN_020325D0() +{ + if (FUN_0202EE0C() != 0 && FUN_0202F950(0, 0, 0x200) != 0) + { + FUN_0202FA10(); + +#ifdef NONMATCHING + UNK_021C5A00->unk0C = UNK_021C5A00->unk0C * UNK_021C5A00->unk14 + UNK_021C5A00->unk1C; + u32 r1 = ((s64)((u64)(UNK_021C5A00->unk0C) >> 32) * 0x20) >> 32; + + FUN_02031D20(FUN_020324C8, r1); +#else + asm( + // clang-format off + ldr r0, =UNK_021C5A00 + ldr r4, [r0, #0x0] + add r5, r4, #0x0 + add r5, #0xc + ldr r0, [r5, #0x8] + ldr r1, [r5, #0xc] + ldr r2, [r4, #0xc] + ldr r3, [r5, #0x4] + bl _ll_mul + ldr r2, [r5, #0x10] + ldr r3, [r5, #0x14] + add r0, r2, r0 + adc r3, r1 + str r0, [r4, #0xc] + mov r1, #0x0 + ldr r0, =FUN_020324C8 + lsr r2, r3, #0x1b + lsl r1, r1, #0x5 + orr r1, r2 + str r3, [r5, #0x4] + bl FUN_02031D20 + // clang-format on + ); +#endif + } +} + +THUMB_FUNC void FUN_02032628() +{ + if (FUN_0202E6F0() != 0) + { + FUN_02031D20(FUN_02032640, 0); + } +} + +THUMB_FUNC void FUN_02032640() +{ + if (FUN_0202EE0C() != 0 && FUN_0202F950(0, 0, 0x200)) + { + FUN_0202FA10(); + FUN_02031D20(FUN_0203266C, 0x64); + } +} + +THUMB_FUNC void FUN_0203266C() +{ + if (FUN_0202E8A0(UNK_021C5A00->unk3E) != 0 && FUN_0202FB18(UNK_021C5A00->unk3E) != 0) + { + FUN_02031D20(FUN_020326D0, 0x64); + return; + } + + if (FUN_020311F0() != 0) + { + FUN_02031D20(FUN_020327B8, 0); + return; + } + + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } + + FUN_02031D20(FUN_020327B8, 0); +} + +THUMB_FUNC void FUN_020326D0() +{ + if (FUN_020311F0() != 0) + { + FUN_02031D20(FUN_020327B8, 0); + return; + } + + if (FUN_02030E7C(FUN_02031190()) != 0) + { + UNK_021C5A00->unk3D = 0; + FUN_020311D0(6, UNK_02105D5C); + FUN_02031D20(FUN_02032738, 0x78); + return; + } + + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } + + FUN_02031D20(FUN_020327B8, 0); +} + +THUMB_FUNC void FUN_02032738() +{ + if (FUN_020311F0() != 0) + { + FUN_02031D20(FUN_020327B8, 0); + return; + } + + if (UNK_021C5A00->unk3D == 2) + { + FUN_02031D20(FUN_020327B4, 0); + return; + } + else if (UNK_021C5A00->unk3D == 1) + { + FUN_0202DBE0(); + FUN_02031D20(FUN_0203279C, 0); + return; + } + + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } + + FUN_02031D20(FUN_020327B8, 0); +} + +THUMB_FUNC void FUN_0203279C() +{ + if (FUN_020311F0() != 0) + { + FUN_02031D20(FUN_020327B8, 0); + } +} + +THUMB_FUNC void FUN_020327B4() +{ +} + +THUMB_FUNC void FUN_020327B8() +{ + UNK_021C5A00->unk3D = 0; + if (FUN_0202E6F0() != 0) + { + if (UNK_021C5A00->unk38 != 0) + { + UNK_021C5A00->unk38--; + FUN_02031D20(FUN_02032640, 0); + return; + } + + FUN_02031D20(FUN_020327B4, 0); + } +} + +THUMB_FUNC void FUN_020327FC() +{ + if (FUN_020311E8() == 0) + { + if (FUN_02033510() == 0 && FUN_0202E6F0() != 0) + { + FUN_02031D20(FUN_020325D0, 0); + } + } + else if (FUN_02031190() == 0) + { + FUN_0202DDE8(); + } + + if (FUN_020311F0() != 0 && FUN_02033510() == 0) + { + FUN_02031D20(FUN_020327B8, 0); + } +} + +THUMB_FUNC void FUN_02032850() +{ + if (FUN_0202EE0C() != 0) + { + if (FUN_0202F918(0, UNK_021C5A00->unk43, 0x200, 0) != 0) + { + FUN_0202FA10(); + FUN_02031D20(FUN_020323B8, 0); + } + } +} + +THUMB_FUNC void FUN_02032888() +{ + u8 st0[4]; + UNK_021C5A00->unk3F = 0xd; + if (FUN_02031190() == 0) + { + st0[1] = 0; + FUN_020311D0(0xa, &st0[1]); + return; + } + + st0[0] = 0; + FUN_020311D0(0xa, st0); +} + +THUMB_FUNC void FUN_020328C0(u8 param0) +{ + UNK_021C5A00->unk3E = param0; + UNK_021C5A00->unk38 = 3; + FUN_02031D20(FUN_02032924, 0); +} + +THUMB_FUNC void FUN_020328E4() +{ + UNK_021C5A00->unk3F = 7; +} + +THUMB_FUNC void FUN_020328F4(u8 param0) +{ + UNK_021C5A00->unk3E = param0; + UNK_021C5A00->unk3F = 7; + UNK_021C5A00->unk38 = 3; + FUN_02033E74(); + FUN_02031D20(FUN_02032628, 0); +} + +THUMB_FUNC void FUN_02032924() +{ + if (FUN_0202E6F0() != 0) + { + FUN_02031D20(FUN_0203293C, 0); + } +} + +THUMB_FUNC void FUN_0203293C() +{ + if (FUN_0202EE0C() != 0) + { + UNK_021C5A00->unk3F = 0xd; + if (FUN_0202F950(0, 0, 0x200) != 0) + { + FUN_0202FA1C(); + FUN_02031D20(FUN_02032978, 0x64); + } + } +} + +THUMB_FUNC void FUN_02032978() +{ + if (FUN_0202E8A0(UNK_021C5A00->unk3E) != 0 && FUN_0202FB18(UNK_021C5A00->unk3E) != 0) + { + FUN_02031D20(FUN_020329F4, 0x64); + return; + } + + if (FUN_020311F0() != 0 || UNK_021C5A00->unk3A == 0) + { + UNK_021C5A00->unk38--; + if (UNK_021C5A00->unk38 == 0) + { + FUN_02031D20(FUN_020327B4, 0); + return; + } + + FUN_02031D20(FUN_02032924, 0); + return; + } + + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } +} + +THUMB_FUNC void FUN_020329F4() +{ + if (UNK_021C5A00->unk3A > 0x5a) + { + UNK_021C5A00->unk3A--; + return; + } + + if (FUN_020311F0() != 0) + { + UNK_021C5A00->unk38--; + if (UNK_021C5A00->unk38 == 0) + { + FUN_02031D20(FUN_020327B4, 0); + return; + } + + FUN_02031D20(FUN_02032924, 0); + return; + } + + if (FUN_02030E7C(FUN_02031190()) != 0) + { + FUN_02031D20(FUN_0203279C, 0); + return; + } + + if (UNK_021C5A00->unk3A != 0) + { + UNK_021C5A00->unk3A--; + return; + } + + UNK_021C5A00->unk38--; + if (UNK_021C5A00->unk38 == 0) + { + FUN_02031D20(FUN_020327B4, 0); + return; + } + + FUN_02031D20(FUN_02032924, 0); +} + +THUMB_FUNC void FUN_02032A8C(u8 param0, u32 param1, u8 *param2) +{ +#pragma unused(param1) + if (FUN_02031190() == 0) + { + + u32 i; + BOOL r3 = TRUE; + for (i = 0; i < 6; i++) + { + if (UNK_02105D5C[i] != param2[i]) + { + r3 = FALSE; + break; + } + } + + if (r3 && UNK_021C5A00->unk48 == 0) + { + UNK_02105D6C[0] = param0; + FUN_02030C4C(7, UNK_02105D6C); + return; + } + + UNK_02105D64[0] = param0; + FUN_02030C4C(7, UNK_02105D64); + } +} + +THUMB_FUNC void FUN_02032AEC(u32 param0, u32 param1, u8 *param2) +{ +#pragma unused(param0) +#pragma unused(param1) + u32 i; + BOOL r4 = TRUE; + for (i = 1; i < 6; i++) + { + if (param2[i] != UNK_02105D6C[i]) + { + r4 = FALSE; + break; + } + } + + if (r4) + { + u8 first = param2[0]; + if (first != FUN_02031190()) + { + return; + } + + UNK_021C5A00->unk3D = 1; + return; + } + + r4 = TRUE; + for (i = 1; i < 6; i++) + { + if (param2[i] != UNK_02105D64[i]) + { + r4 = FALSE; + break; + } + } + + if (r4) + { + u8 first = param2[0]; + if (first != (u8)FUN_02031190()) + { + return; + } + + UNK_021C5A00->unk3D = 2; + } +} + +THUMB_FUNC u32 FUN_02032B68() +{ + return 6; +} + +THUMB_FUNC void FUN_02032B6C(u8 param0) +{ + if (UNK_021C5A00 != NULL) + { + UNK_021C5A00->unk3C = param0; + FUN_0202D1B0(param0); + } +} + +THUMB_FUNC void FUN_02032B84() +{ + FUN_0202EA54(); +} + +THUMB_FUNC void FUN_02032B8C() +{ + if (FUN_0202E4C8() != 0) + { + FUN_0202E29C(UNK_021C5A00->unk2C); + FUN_0202DB14(UNK_021C5A00->unk28, 0); + if (FUN_0202F950(1, 1, 0x20) != 0) + { + FUN_0202FA10(); + FUN_02031D20(FUN_02032B84, 0); + } + } +} + +THUMB_FUNC void FUN_02032BD0(struct SaveBlock2 *sav2) +{ + if (FUN_02030F40() == 0) + { + FUN_02016828(3, 0xf, 0x7000); + FUN_02031734(sav2, 0xe); + UNK_021C5A00->unk40 = 0; + FUN_02031D20(FUN_02032B8C, 0); + } +} + +THUMB_FUNC void FUN_02032C0C() +{ + if (UNK_021C5A00 != NULL) + { + FUN_02031D20(FUN_02032440, 5); + } +} + +THUMB_FUNC u32 FUN_02032C28() +{ + struct UnkStruct_02031734_const2 st0 = UNK_020EEC48; + + u32 fun = (u32)UNK_021C5A00->unk24; + if (UNK_021C5A00 == NULL) + { + return 0; + } + + u32 i = 0; + while (st0.unk00[i] != 0) + { + if (st0.unk00[i] == fun) + { + return 1; + } + + i++; + } + + return 0; +} + +THUMB_FUNC void FUN_02032C6C(u32 param0, u32 param1) +{ + switch (param0) + { + case 0x333: + if (param1 != 0xf) + { + return; + } + UNK_021C5A00->unk49 |= 1; + break; + case 0x400318: + + UNK_021C5A00->unk49 |= 1; + break; + + case 0x400131: + + UNK_021C5A00->unk49 |= 2; + break; + + case 0x400286: + + UNK_021C5A00->unk49 |= 4; + break; + } +} + +THUMB_FUNC void FUN_02032CF4() +{ + if (FUN_0202E4C8() != 0) + { + FUN_0202E29C(UNK_021C5A00->unk2C); + FUN_0202DB14(UNK_021C5A00->unk28, 0); + FUN_0202D308(FUN_02032C6C); + if (FUN_0202F950(1, 1, 0x20) != 0) + { + FUN_0202FA10(); + FUN_02031D20(FUN_02032B84, 0); + } + } +} + +THUMB_FUNC void FUN_02032D44(struct SaveBlock2 *sav2) +{ + if (FUN_02030F40() == 0) + { + FUN_02016828(3, 0xf, 0x7000); + FUN_02031734(sav2, 0x11); + UNK_021C5A00->unk40 = 0; + FUN_02031D20(FUN_02032CF4, 0); + } +} + +THUMB_FUNC void FUN_02032D80() +{ + if (UNK_021C5A00 != NULL) + { + FUN_02031D20(FUN_02032440, 5); + } +} + +THUMB_FUNC u8 FUN_02032D9C() +{ + return UNK_021C5A00->unk49; +} + +THUMB_FUNC BOOL FUN_02032DAC() +{ + FUN_02031468(); + + if (UNK_021C5A00 == NULL) + { + return TRUE; + } + + if ((u8)(UNK_021C5A00->unk3F + 0xe8) <= 1) + { + MOD04_021D83C0(); + return TRUE; + }; + + if (FUN_02033590() != 0) + { + FUN_02031D20(FUN_0203318C, 0); + } + else + { + FUN_02031D20(FUN_02032178, 0); + } + + return FALSE; +} + +THUMB_FUNC void FUN_02032E00() +{ + if (FUN_0202E4C8() != 0) + { + FUN_0202E29C(UNK_021C5A00->unk2C); + FUN_0202DB14(UNK_021C5A00->unk28, 0); + if (FUN_0202F918(1, 1, 0x200, 1) != 0) + { + FUN_0202FA10(); + FUN_02031D20(FUN_02032218, 0); + } + } +} + +THUMB_FUNC void FUN_02032E48() +{ + if (FUN_0202E4C8() != 0) + { + FUN_0202E29C(UNK_021C5A00->unk2C); + FUN_0202DB14(UNK_021C5A00->unk28, 0); + if (FUN_0202F950(1, 1, 0x200) != 0) + { + FUN_0202FA10(); + FUN_02031D20(FUN_02032290, 0); + } + } +} + +THUMB_FUNC void FUN_02032E8C() +{ +} + +THUMB_FUNC void FUN_02032E90() +{ + if (MOD04_021D7F8C() < 0) + { + FUN_02031D20(FUN_02032E8C, 0); + } +} + +THUMB_FUNC void FUN_02032EA8() +{ +} + +THUMB_FUNC void FUN_02032EAC() +{ +} + +THUMB_FUNC void FUN_02032EB0() +{ + FUN_020313A0(1); + + s32 res = MOD04_021D7F8C(); + if (res >= 0xa) + { + FUN_02031D20(FUN_02032EAC, 0); + return; + } + + if (res < 0) + { + FUN_02031D20(FUN_02032E8C, 0); + return; + } + + if (res == 1) + { + FUN_02031D20(FUN_02032E90, 0); + return; + } + + if (res == 2) + { + if (UNK_021C5A00->unk44 != 0) + { + FUN_02031D20(FUN_02032E8C, 0); + return; + } + FUN_02031D20(FUN_02032EA8, 0); + return; + } +} + +THUMB_FUNC void FUN_02032F20(u32 param0) +{ + if (param0 + 2 > 1) + { + param0 = -param0; + } + + UNK_021C5A00->unk34 = param0; +} + +THUMB_FUNC void FUN_02032F34() +{ + s32 res = MOD04_021D7800(0); + if (res >= 0xa) + { + FUN_02031D20(FUN_02032EAC, 0); + return; + } + + if (res < 0) + { + FUN_02032F20((u32)res); + FUN_02031D20(FUN_02032E8C, 0); + return; + } + + if (res == 1) + { + FUN_02031D20(FUN_02032EB0, 0); + return; + } + + if (res == 2) + { + FUN_02031D20(FUN_02032EA8, 0); + return; + } + + if (res == 3) + { + FUN_02031D20(FUN_02032EAC, 0); + return; + } +} + +THUMB_FUNC void FUN_02032F98() +{ + s32 res = MOD04_021D7800(1); + if (res < 0) + { + FUN_02032F20((u32)res); + FUN_02031D20(FUN_02032E8C, 0); + return; + } + + if (MOD04_021D8494(UNK_021C5A00->unk42) != 0) + { + FUN_0202FC60(); + FUN_02031D20(FUN_02032F34, 0); + } +} + +THUMB_FUNC u32 FUN_02032FDC(u8 param0) +{ + MOD04_021D77C4(FUN_020303BC, FUN_02030238); + UNK_021C5A00->unk42 = param0; + FUN_02031D20(FUN_02032F98, 0); + + return 1; +} + +THUMB_FUNC u32 FUN_0203300C() +{ + if (UNK_021C5A00->unk24 == FUN_02032F34) + { + return 0; + } + + if (UNK_021C5A00->unk24 == FUN_02032EB0) + { + return 1; + } + + if (UNK_021C5A00->unk24 == FUN_02032E90) + { + return 3; + } + + if (UNK_021C5A00->unk24 == FUN_02032EA8) + { + return 4; + } + + if (UNK_021C5A00->unk24 == FUN_02032EAC) + { + return 5; + } + + return 2; +} + +THUMB_FUNC void FUN_02033060() +{ + MOD04_021D77C4(FUN_020303BC, FUN_02030238); + if (MOD04_021D8494(-1) != 0) + { + UNK_021C5A00->unk4D = 0; + FUN_0202FC60(); + FUN_02031D20(FUN_02032F34, 0); + } +} + +THUMB_FUNC void FUN_020330A0() +{ + FUN_020313A0(0); + if (MOD04_021D82BC(UNK_021C5A00->unk41) != 0) + { + MOD04_021D836C(); + FUN_02031D20(FUN_02033060, 0); + return; + } + + if (MOD04_021D7F8C() < 0) + { + FUN_02031D20(FUN_02032E8C, 0); + } +} + +THUMB_FUNC void FUN_020330E4() +{ + if (FUN_02031190() == 0) + { + UNK_021C5A00->unk41 = 0; + FUN_02031D20(FUN_020330A0, 0); + } + else + { + UNK_021C5A00->unk41 = 1; + FUN_02031D20(FUN_020330A0, 0); + } + + UNK_021C5A00->unk4D = 1; +} + +THUMB_FUNC u8 FUN_02033128() +{ + return UNK_021C5A00->unk4D; +} + +THUMB_FUNC u32 FUN_02033138() +{ + if (UNK_021C5A00->unk24 == FUN_02033060) + { + return 1; + } + + return 0; +} + +THUMB_FUNC u32 FUN_02033154() +{ + if (UNK_021C5A00->unk24 == FUN_02032F34) + { + return 1; + } + + if (UNK_021C5A00->unk24 == FUN_02033060) + { + return 1; + } + + return 0; +} + +THUMB_FUNC u32 FUN_02033180() +{ + return UNK_021C5A00->unk34; +} + +THUMB_FUNC void FUN_0203318C() +{ + FUN_020313A0(0); + if (MOD04_021D82BC(0) != 0) + { + MOD04_021D836C(); + FUN_02031D20(FUN_02032440, 0); + } + + if (MOD04_021D7F8C() < 0) + { + FUN_02031D20(FUN_02032E8C, 0); + } +} + +THUMB_FUNC void FUN_020331C4() +{ + if (UNK_021C5A00 != NULL) + { + FUN_020166B8(1); + FUN_02031D20(FUN_02032440, 5); + } +} + +THUMB_FUNC void FUN_020331E8() +{ + if (UNK_021C5A00 != NULL) + { + UNK_021C5A00->unk41 = 0; + FUN_02031D20(FUN_020330A0, 0); + } +} + +THUMB_FUNC void FUN_02033208() +{ + if (UNK_021C5A00 != NULL) + { + if (FUN_02031190() == 0) + { + UNK_021C5A00->unk41 = 0; + } + else + { + UNK_021C5A00->unk41 = 1; + } + + FUN_02031D20(FUN_020330A0, 0); + } +} + +THUMB_FUNC void FUN_0203323C() +{ + u8 res = (u8)FUN_02031190(); + FUN_020311D0(0x15, &res); +} + +THUMB_FUNC u32 FUN_02033250() +{ + if (UNK_021C5A00 != NULL) + { + if (UNK_021C5A00->unk24 == FUN_02032E8C) + { + return 1; + } + + if (UNK_021C5A00->unk24 == FUN_02032E90 && UNK_021C5A00->unk44 != 0) + { + return 1; + } + } + + return 0; +} + +THUMB_FUNC void FUN_02033288(struct SaveBlock2 *sav2) +{ + if (UNK_021C5A00 == NULL) + { + FUN_02016828(3, 0xf, 0x100); + UNK_021C5A00 = (struct UnkStruct_02031734 *)AllocFromHeap(0xf, sizeof(struct UnkStruct_02031734)); + MI_CpuFill8(UNK_021C5A00, 0, sizeof(struct UnkStruct_02031734)); + + UNK_021C5A00->unk3F = 0x18; + UNK_021C5A00->unk46 = 1; + UNK_021C5A00->unk28 = sav2; + FUN_020334E8(0, 1); + FUN_020166A8(1); + } +} + +THUMB_FUNC void FUN_020332DC() +{ + if (UNK_021C5A00 != 0) + { + FUN_020166B8(1); + FUN_020334E8(0, 0); + FreeToHeap(UNK_021C5A00); + UNK_021C5A00 = NULL; + FUN_020168D0(0xf); + } +} + +THUMB_FUNC void FUN_02033310(struct SaveBlock2 *sav2) +{ + if (UNK_021C5A00 == NULL) + { + FUN_02016828(3, 0xf, 0x100); + UNK_021C5A00 = (struct UnkStruct_02031734 *)AllocFromHeap(0xf, sizeof(struct UnkStruct_02031734)); + MI_CpuFill8(UNK_021C5A00, 0, sizeof(struct UnkStruct_02031734)); + UNK_021C5A00->unk3F = 0x19; + UNK_021C5A00->unk46 = 1; + UNK_021C5A00->unk28 = sav2; + FUN_020334E8(0, 1); + FUN_020166A8(1); + } +} + +THUMB_FUNC void FUN_02033364() +{ + if (UNK_021C5A00 != 0) + { + FUN_020166B8(1); + FUN_020334E8(0, 0); + FreeToHeap(UNK_021C5A00); + UNK_021C5A00 = NULL; + FUN_020168D0(0xf); + } +} + +THUMB_FUNC u32 FUN_02033398() +{ + u32 st4; + u32 st0; + if (UNK_021C5A00 == NULL) + { + return 0; + } + + if (UNK_021C5A00->unk3F == 0x18) + { + if (MOD04_021DD718(&st4, &st0) != 0) + { + MOD04_021DD6F0(); + return 1; + } + } + else if (UNK_021C5A00->unk3F == 0x19) + { + if (MOD04_021DD718(&st4, &st0) != 0 && st0 == 7) + { + return 1; + } + } + + return 0; +} + +THUMB_FUNC void FUN_020333F0() +{ + s32 res = MOD04_021D76AC(); + if (res < 0) + { + FUN_02032F20((u32)res); + FUN_02031D20(FUN_02032E8C, 0); + return; + } + else if (res > 0) + { + FUN_02031D20(FUN_02033060, 0); + } +} + +THUMB_FUNC void FUN_0203341C() +{ + if (FUN_0202E4C8() != 0) + { + FUN_02016828(3, 0x31, 0x31000); + if (FUN_0202F918(1, 1, 0x200, 1) != 0) + { + MOD05_021D74E0(UNK_021C5A00->unk28, 0x31); + MOD04_021D83A8(FUN_020335D0); + FUN_0202FA10(); + FUN_02031D20(FUN_020333F0, 0); + } + } +} + +THUMB_FUNC void *FUN_0203346C(struct SaveBlock2 *sav2, u32 param1) +{ + Sav2_PlayerData_GetProfileAddr(sav2); + if (FUN_02030F40() != 0) + { + return 0; + } + + FUN_020166A8(1); + FUN_02016828(3, 0xf, 0x7080); + FUN_02031734(sav2, 0x17); + UNK_021C5A00->unk00 = AllocFromHeap(0xf, param1); + MI_CpuFill8(UNK_021C5A00->unk00, 0, param1); + + UNK_021C5A00->unk40 = 0; + UNK_021C5A00->unk28 = sav2; + FUN_02031D20(FUN_0203341C, 0); + + return UNK_021C5A00->unk00; +} + +THUMB_FUNC void *FUN_020334DC() +{ + return UNK_021C5A00->unk00; +} + +THUMB_FUNC void FUN_020334E8(u8 param0, u8 param1) +{ + if (UNK_021C5A00 != NULL) + { + UNK_021C5A00->unk44 = param0; + UNK_021C5A00->unk45 = param1; + } + + FUN_0202EE84(param0); + FUN_0202EEB0(param0); +} + +THUMB_FUNC u8 FUN_02033510() +{ + if (UNK_021C5A00 != NULL) + { + if (UNK_021C5A00->unk4E != 0) + { + return 1; + } + + return UNK_021C5A00->unk45; + } + + return 0; +} + +THUMB_FUNC s32 FUN_02033534() +{ + if (UNK_021C5A00 != NULL) + { + return UNK_021C5A00->unk3F; + } + + return 1; +} + +THUMB_FUNC u8 FUN_0203354C() +{ + if (UNK_021C5A00 != NULL) + { + return UNK_021C5A00->unk40; + } + + return 0; +} + +THUMB_FUNC void FUN_02033564(void *src) +{ + MI_CpuCopy8(src, UNK_021C5A00->unk04, 0x6); +} + +THUMB_FUNC void FUN_02033578(void *dst) +{ + MI_CpuCopy8(UNK_021C5A00->unk04, dst, 0x6); +} + +THUMB_FUNC u32 FUN_02033590() +{ + if (FUN_02033534() >= 0x13) + { + return 1; + } + + return 0; +} + +THUMB_FUNC void FUN_020335A4(u8 param0) +{ + if (UNK_021C5A00 != NULL) + { + UNK_021C5A00->unk47 = param0; + } +} + +THUMB_FUNC u8 FUN_020335B8() +{ + if (UNK_021C5A00 != NULL) + { + return UNK_021C5A00->unk47; + } + + return 0; +} + +THUMB_FUNC void FUN_020335D0(s32 param0) +{ + FUN_02033F70(0, 1, param0); + while (1) + { + } +} + +THUMB_FUNC void FUN_020335E0() +{ + FUN_02033F70(0, 4, 0); + while (1) + { + } +} + +THUMB_FUNC void FUN_020335F0() +{ +} + +THUMB_FUNC void FUN_020335F4() +{ + if (FUN_02033510() != 0) + { + if (FUN_020311F0() == 0 && FUN_02033250() == 0 && FUN_02033398() == 0) + { + if (UNK_021C5A00->unk4E == 0) + { + return; + } + } + + if (FUN_020335B8() != 0) + { + return; + } + + FUN_0200541C(); + FUN_0202287C(UNK_021C5A00->unk28); + gMain.unk64 = 1; + if (UNK_021C5A00->unk4E == 3) + { + FUN_020335A4(3); + return; + } + + if (UNK_021C5A00->unk3F == 0x19 || UNK_021C5A00->unk3F == 0xf) + { + FUN_020335A4(2); + } + else + { + FUN_020335A4(1); + } + } +} + +THUMB_FUNC BOOL FUN_02033678() +{ + if (FUN_0202EDD8() != 0 || !FUN_02031810()) + { + return TRUE; + } + + if (FUN_0202E344() == 0) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC u32 FUN_020336A0(u8 param0) +{ + if (UNK_021C5A00 != NULL) + { + UNK_021C5A00->unk4E = param0; + FUN_02031468(); + return 1; + } + + return 0; +} \ No newline at end of file -- cgit v1.2.3 From 56e5d2eac8ed953e9f52b5ae760fcfa72cc6a91e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 1 May 2021 13:00:21 +0200 Subject: remove obsolete externs --- arm9/modules/11/src/module_11_sinit.c | 3 ++- arm9/src/error_handling.c | 3 ++- arm9/src/error_message_reset.c | 7 ++++--- arm9/src/heap.c | 3 ++- arm9/src/main.c | 8 ++++---- arm9/src/unk_0202F150.c | 12 +++++------- 6 files changed, 19 insertions(+), 17 deletions(-) (limited to 'arm9') diff --git a/arm9/modules/11/src/module_11_sinit.c b/arm9/modules/11/src/module_11_sinit.c index 977c4fde..8bf5f6f6 100644 --- a/arm9/modules/11/src/module_11_sinit.c +++ b/arm9/modules/11/src/module_11_sinit.c @@ -1,8 +1,9 @@ #include "global.h" #include "poke_overlay.h" #include "FS_overlay.h" +#include "unk_02031734.h" + -extern u32 FUN_02033590(void); FS_EXTERN_OVERLAY(MODULE_16); THUMB_FUNC static void MOD11_0222F284(void) diff --git a/arm9/src/error_handling.c b/arm9/src/error_handling.c index a01894f6..7f006039 100644 --- a/arm9/src/error_handling.c +++ b/arm9/src/error_handling.c @@ -1,8 +1,9 @@ #include "global.h" #include "error_handling.h" #include "error_message_reset.h" +#include "unk_02031734.h" + -extern u32 FUN_02031810(void); THUMB_FUNC void ErrorHandling(void) { diff --git a/arm9/src/error_message_reset.c b/arm9/src/error_message_reset.c index 3a727924..f70fec0f 100644 --- a/arm9/src/error_message_reset.c +++ b/arm9/src/error_message_reset.c @@ -1,5 +1,9 @@ #include "error_message_reset.h" #include "GX_layers.h" +#include "unk_02031734.h" +#include "unk_0202F150.h" + + const u32 UNK_020FF49C[2] = { 0x1a030300, 0x00230112 }; @@ -27,9 +31,6 @@ extern void FUN_020196F4(u32 *, u8, u16, u16, u16, u16); extern void FUN_0200CCA4(u32 *param0, u32 param1, u32 param2, u32 param3); extern void FUN_0200E394(u32 param0); extern void FUN_0200A274(u32 param0, u32 param1, u32 param2); -extern BOOL FUN_02032DAC(void); -extern BOOL FUN_0202FB80(void); -extern BOOL FUN_02033678(void); extern void FUN_02019178(u32 *param0); THUMB_FUNC void VBlankHandler() diff --git a/arm9/src/heap.c b/arm9/src/heap.c index 84abc834..895ce808 100644 --- a/arm9/src/heap.c +++ b/arm9/src/heap.c @@ -1,11 +1,12 @@ #include "heap.h" #include "error_message_reset.h" +#include "unk_02031734.h" + extern void *tempName_NNS_FndCreateExpHeapEx(void *param0, u32 param1, u32 param2); extern void *tempName_NNS_FndAllocFromExpHeapEx(void *param0, u32 param1, s32 param2); extern void thunk_FUN_020adc8c(); extern void FUN_020ADDF0(void *ptr1, void *ptr2); -extern u32 FUN_02031810(void); extern u32 FUN_020ADDC8(void *param0); extern void FUN_020AE82C(u32 param0, void *param1, u32 param2); extern u32 FUN_020ADDC0(void *param0); diff --git a/arm9/src/main.c b/arm9/src/main.c index c50fbaff..f7bcf7f0 100644 --- a/arm9/src/main.c +++ b/arm9/src/main.c @@ -12,6 +12,10 @@ #include "player_data.h" #include "sound.h" #include "timer3.h" +#include "unk_02031734.h" +#include "unk_0202F150.h" + + FS_EXTERN_OVERLAY(MODULE_52); FS_EXTERN_OVERLAY(MODULE_63); @@ -23,9 +27,6 @@ struct Unk2106FA0 gBacklightTop; extern BOOL OverlayManager_new(struct Unk21DBE18 *, s32 *, int); extern BOOL OverlayManager_Run(int); extern void OverlayManager_delete(int); -extern BOOL FUN_02033678(void); -extern u32 FUN_020335B8(void); -extern BOOL FUN_0202FB80(void); extern void InitSystemForTheGame(void); extern void InitGraphicMemory(void); @@ -218,7 +219,6 @@ THUMB_FUNC void FUN_02000EE8(void) } extern void FUN_0200E3A0(PMLCDTarget, int); -extern BOOL FUN_02032DAC(void); // No Return THUMB_FUNC void DoSoftReset(u32 parameter) diff --git a/arm9/src/unk_0202F150.c b/arm9/src/unk_0202F150.c index c728ddf1..02980c02 100644 --- a/arm9/src/unk_0202F150.c +++ b/arm9/src/unk_0202F150.c @@ -1,5 +1,7 @@ #include "unk_0202F150.h" #include "unk_02031480.h" +#include "unk_02031734.h" + struct { u8 unk00; @@ -9,7 +11,6 @@ struct vu8 UNK_02105D58 = 4; vu8 UNK_02105D59 = 4; -extern int FUN_02033534(); extern void FUN_0202D7D8(u8 *param0, u32 param1, struct UnkStruct0202F150_sub1 *param2); extern u32 FUN_0200CA60(void (*param0)(), u32 param1, u32 param2); extern void FUN_0202D394(struct UnkStruct0202F150_sub1 *param0, u8 *param1, u32 param2); @@ -25,10 +26,8 @@ extern void FUN_0202D824(u8 *param0); extern u32 FUN_0202E9E8(u32 param0); extern u32 FUN_0202F03C(); extern u32 FUN_0202EE24(); -extern void FUN_02031CDC(); extern void FUN_0202EBD0(u16 param0); extern void FUN_0202ED70(u32 param0); -extern void FUN_020335F4(u32 param0); extern void FUN_0202E538(); extern u32 MOD04_021D78FC(void *param0, u32 param1); extern u32 FUN_0202CBD4(); @@ -52,7 +51,6 @@ extern void *FUN_0202DA40(u32 param0, u32 param1, u16 param2); extern u32 MOD04_021D8018(); extern u32 FUN_0202EDF8(); extern u16 FUN_0202D19C(); -extern void FUN_020334E8(u32 param0, u32 param1); extern u32 FUN_0202EE60(); extern void FUN_0202F05C(); extern void GF_RTC_CopyDateTime(RTCDate *, RTCTime *); @@ -537,7 +535,7 @@ THUMB_FUNC void FUN_0202FB58() } } -THUMB_FUNC u32 FUN_0202FB80() +THUMB_FUNC BOOL FUN_0202FB80() { FUN_02031CDC(); @@ -2021,9 +2019,9 @@ THUMB_FUNC u32 FUN_02030E7C(u16 param0) return 0; } -THUMB_FUNC u32 FUN_02030F20() +THUMB_FUNC s32 FUN_02030F20() { - u32 r4 = 0; + s32 r4 = 0; for (int i = 0; i < 8; i++) { if (FUN_02030E7C((u16)i) != 0) -- cgit v1.2.3 From f447c9f02c12d2434f48ccf82cedfab0ea16b5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 1 May 2021 13:04:52 +0200 Subject: formatting --- arm9/src/unk_02031734.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_02031734.c b/arm9/src/unk_02031734.c index 21dfad41..8c4c644c 100644 --- a/arm9/src/unk_02031734.c +++ b/arm9/src/unk_02031734.c @@ -2,9 +2,13 @@ const struct UnkStruct_02031734_const2 UNK_020EEC48 = { { (u32)FUN_02032B84, 0 } }; -const struct UnkStruct_02031734_const1 UNK_020EEC50 = { { (u32)FUN_0203213C, (u32)FUN_02032138, 0 } }; +const struct UnkStruct_02031734_const1 UNK_020EEC50 = { + { (u32)FUN_0203213C, (u32)FUN_02032138, 0 } +}; -const struct UnkStruct_02031734_const1 UNK_020EEC5C = { { (u32)FUN_02032234, (u32)FUN_0203234C, 0 } }; +const struct UnkStruct_02031734_const1 UNK_020EEC5C = { + { (u32)FUN_02032234, (u32)FUN_0203234C, 0 } +}; char UNK_02105D5C[] = "FREAK"; @@ -2061,7 +2065,8 @@ THUMB_FUNC void FUN_02033288(struct SaveBlock2 *sav2) if (UNK_021C5A00 == NULL) { FUN_02016828(3, 0xf, 0x100); - UNK_021C5A00 = (struct UnkStruct_02031734 *)AllocFromHeap(0xf, sizeof(struct UnkStruct_02031734)); + UNK_021C5A00 = + (struct UnkStruct_02031734 *)AllocFromHeap(0xf, sizeof(struct UnkStruct_02031734)); MI_CpuFill8(UNK_021C5A00, 0, sizeof(struct UnkStruct_02031734)); UNK_021C5A00->unk3F = 0x18; @@ -2089,7 +2094,8 @@ THUMB_FUNC void FUN_02033310(struct SaveBlock2 *sav2) if (UNK_021C5A00 == NULL) { FUN_02016828(3, 0xf, 0x100); - UNK_021C5A00 = (struct UnkStruct_02031734 *)AllocFromHeap(0xf, sizeof(struct UnkStruct_02031734)); + UNK_021C5A00 = + (struct UnkStruct_02031734 *)AllocFromHeap(0xf, sizeof(struct UnkStruct_02031734)); MI_CpuFill8(UNK_021C5A00, 0, sizeof(struct UnkStruct_02031734)); UNK_021C5A00->unk3F = 0x19; UNK_021C5A00->unk46 = 1; -- cgit v1.2.3 From 5780e0c18c86e3eab6cc71695b4fe6629e43a32e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 1 May 2021 13:10:36 +0200 Subject: BOOL usage --- arm9/src/unk_0202F150.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arm9') diff --git a/arm9/src/unk_0202F150.c b/arm9/src/unk_0202F150.c index 02980c02..b8a42687 100644 --- a/arm9/src/unk_0202F150.c +++ b/arm9/src/unk_0202F150.c @@ -585,7 +585,7 @@ THUMB_FUNC BOOL FUN_0202FB80() FUN_020335F4(0); FUN_020315A4(); - return 1; + return TRUE; } THUMB_FUNC void FUN_0202FC60() -- cgit v1.2.3 From 62f567932f7e0eee6e8e354cde7e83472cb51887 Mon Sep 17 00:00:00 2001 From: fyren Date: Sat, 1 May 2021 23:07:29 +0200 Subject: fixing small issues in unk_0206015C --- arm9/src/unk_0206015C.c | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_0206015C.c b/arm9/src/unk_0206015C.c index 07076506..3d295156 100644 --- a/arm9/src/unk_0206015C.c +++ b/arm9/src/unk_0206015C.c @@ -1,5 +1,41 @@ #include "unk_0206015C.h" +#include "heap.h" +#include "event_data.h" +#include "main.h" + +/* Note to future reader, there might be some errors + in the return type / parameters. They are right for this code + but they might not be for every code, please do not blindly + trust these prototypes if you are decompiling these functions. */ +extern THUMB_FUNC u32 MOD06_02244DB0(u32); +extern THUMB_FUNC void MOD06_02244DBC(void*); +extern THUMB_FUNC void MOD06_02244DC4(void*, void*); +extern THUMB_FUNC void MOD06_02244EF8(void*); +extern THUMB_FUNC void MOD06_02244F18(void*); +extern THUMB_FUNC BOOL MOD06_02244F24(void*); +extern THUMB_FUNC void MOD06_02244F2C(void*); +extern THUMB_FUNC void* MOD06_02245088(struct UnkSavStruct80 * savStruct); +extern THUMB_FUNC u32 MOD06_02245114(u32, struct UnkSavStruct80*); +extern THUMB_FUNC void MOD06_02245190(u32); +extern THUMB_FUNC void MOD06_02245198(u8, u32); +extern THUMB_FUNC u32 MOD06_022451F0(u32); + +extern THUMB_FUNC void FUN_020054C8(u32); +extern THUMB_FUNC void FUN_02049160(struct UnkStruct_0204639C*, u32); +extern THUMB_FUNC void FUN_0204AF84(struct UnkStruct_0204639C*); +extern THUMB_FUNC void FUN_0204AF3C(struct UnkStruct_0204639C *); +extern THUMB_FUNC void FUN_0204AFC8(struct UnkStruct_0204639C *); +extern THUMB_FUNC void FUN_0204B00C(struct UnkStruct_0204639C *); +extern THUMB_FUNC void FUN_0204C1B4(struct UnkStruct_0204639C*, u32,u32,u32,u32,u32,u32,u32); +extern THUMB_FUNC u32 FUN_020553A0(u32); +extern THUMB_FUNC void FUN_0205889C(u32, u32); +extern THUMB_FUNC void FUN_0205F1C4(struct ScriptState *); +extern THUMB_FUNC void FUN_0205F1D4(struct ScriptState *); +extern THUMB_FUNC void FUN_0206367C(struct UnkSavStruct80 *, u32); + + + THUMB_FUNC void FUN_0206015C(struct UnkSavStruct80 *savStruct) { struct UnkStruct_0206015C *unkStruct = AllocFromHeapAtEnd(0xb, 0x10); @@ -104,10 +140,10 @@ THUMB_FUNC BOOL FUN_02060194(struct UnkStruct_0204639C *unkStruct0) MOD06_02245190(unkStruct1->unk4); MOD06_02244DBC(unkStruct1->unk0); FreeToHeap(unkStruct1); - return 1; + return TRUE; default: break; } - return 0; -} \ No newline at end of file + return FALSE; +} -- cgit v1.2.3 From aaaa27e731b1a39fbb35e21ff88f4944d74c9f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sun, 2 May 2021 09:54:51 +0200 Subject: replace nonmatchings with an inline function --- arm9/src/unk_02031734.c | 215 ++++-------------------------------------------- 1 file changed, 14 insertions(+), 201 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_02031734.c b/arm9/src/unk_02031734.c index 8c4c644c..01d85ffb 100644 --- a/arm9/src/unk_02031734.c +++ b/arm9/src/unk_02031734.c @@ -86,7 +86,7 @@ THUMB_FUNC void FUN_02031734(struct SaveBlock2 *sav2, u8 param1) UNK_021C5A00->unk48 = 0; UNK_021C5A00->unk3F = param1; - FUN_020312BC(&UNK_021C5A00->unk0C); + FUN_020312BC(UNK_021C5A00->unk0C); FUN_0202D8D0(0, 0, 0); if (param1 != 9 && param1 != 0x11 && param1 != 0xf) @@ -451,10 +451,10 @@ THUMB_FUNC void FUN_02031CDC() } } -THUMB_FUNC void FUN_02031D20(void (*param0)(), u16 param1) +THUMB_FUNC void FUN_02031D20(void (*param0)(), u32 param1) { UNK_021C5A00->unk24 = param0; - UNK_021C5A00->unk3A = param1; + UNK_021C5A00->unk3A = (u16)param1; } THUMB_FUNC void FUN_02031D30() @@ -482,44 +482,11 @@ THUMB_FUNC void FUN_02031D30() return; } -#ifdef NONMATCHING - UNK_021C5A00->unk0C = UNK_021C5A00->unk0C * UNK_021C5A00->unk14 + UNK_021C5A00->unk1C; - u32 r1 = ((s64)((u64)(UNK_021C5A00->unk0C) >> 32) * 0x14) >> 32; + u32 r1 = compute(UNK_021C5A00->unk0C, 0x14); UNK_021C5A00->unk43 = 0; FUN_02031D20(FUN_020320C4, r1 + 0x14); -#else - asm( - // clang-format off - ldr r0, =UNK_021C5A00 - ldr r5, [r0, #0x0] - add r4, r5, #0x0 - add r4, #0xc - ldr r0, [r4, #0x8] - ldr r1, [r4, #0xc] - ldr r2, [r5, #0xc] - ldr r3, [r4, #0x4] - bl _ll_mul - ldr r2, [r4, #0x10] - ldr r3, [r4, #0x14] - add r0, r2, r0 - adc r3, r1 - str r0, [r5, #0xc] - str r3, [r4, #0x4] - add r0, r3, #0x0 - mov r1, #0x0 - mov r2, #0x14 - mov r3, #0x0 - bl _ll_mul - mov r0, #0x0 - add r5, #0x43 - strb r0, [r5, #0x0] - ldr r0, =FUN_020320C4 - add r1, #0x14 - bl FUN_02031D20 - pop {r3-r5, pc} // clang-format on - ); -#endif + return; } if (FUN_0202F950(1, 1, 0x1F4) != 0) @@ -551,50 +518,14 @@ THUMB_FUNC void FUN_02031E08() if (FUN_0202F950(0, 1, 0x1F4) != 0) { -#ifdef NONMATCHING - UNK_021C5A00->unk0C = UNK_021C5A00->unk0C * UNK_021C5A00->unk14 + UNK_021C5A00->unk1C; - u32 r1 = ((s64)((u64)(UNK_021C5A00->unk0C) >> 32) * 0x40) >> 32; + u32 r1 = compute(UNK_021C5A00->unk0C, 0x40); if (UNK_021C5A00->unk38 != 0) { - r1 = UNK_021C5A00->unk38 << 6; + r1 = (u32)(UNK_021C5A00->unk38 << 6); UNK_021C5A00->unk38 = 0; } FUN_02031D20(FUN_02031EE0, r1); -#else - asm( - // clang-format off - ldr r0, =UNK_021C5A00 - ldr r5, [r0, #0x0] - add r4, r5, #0x0 - add r4, #0xc - ldr r0, [r4, #0x8] - ldr r1, [r4, #0xc] - ldr r2, [r5, #0xc] - ldr r3, [r4, #0x4] - bl _ll_mul - ldr r2, [r4, #0x10] - ldr r3, [r4, #0x14] - add r0, r2, r0 - adc r3, r1 - str r0, [r5, #0xc] - mov r1, #0x0 - str r3, [r4, #0x4] - lsr r0, r3, #0x1a - lsl r1, r1, #0x6 - orr r1, r0 - ldrh r0, [r5, #0x38] - cmp r0, #0x0 - beq _02031E76 - lsl r1, r0, #0x6 - mov r0, #0x0 - strh r0, [r5, #0x38] - _02031E76: - ldr r0, =FUN_02031EE0 - bl FUN_02031D20 - // clang-format on - ); -#endif } } } @@ -606,39 +537,9 @@ THUMB_FUNC void FUN_02031E8C() if (FUN_0202F950(0, 0, 0x1F4) != 0) { -#ifdef NONMATCHING - UNK_021C5A00->unk0C = UNK_021C5A00->unk0C * UNK_021C5A00->unk14 + UNK_021C5A00->unk1C; - u32 r1 = ((s64)((u64)(UNK_021C5A00->unk0C) >> 32) * 0x20) >> 32; + u32 r1 = compute(UNK_021C5A00->unk0C, 0x20); FUN_02031D20(FUN_02031EE0, r1 + 0x10); -#else - asm( - // clang-format off - ldr r0, =UNK_021C5A00 - ldr r4, [r0, #0x0] - add r5, r4, #0x0 - add r5, #0xc - ldr r0, [r5, #0x8] - ldr r1, [r5, #0xc] - ldr r2, [r4, #0xc] - ldr r3, [r5, #0x4] - bl _ll_mul - ldr r2, [r5, #0x10] - ldr r3, [r5, #0x14] - add r0, r2, r0 - adc r3, r1 - str r0, [r4, #0xc] - mov r1, #0x0 - lsr r2, r3, #0x1b - lsl r1, r1, #0x5 - orr r1, r2 - ldr r0, =FUN_02031EE0 - add r1, #0x10 - str r3, [r5, #0x4] - bl FUN_02031D20 - // clang-format on - ); -#endif } } } @@ -747,44 +648,10 @@ THUMB_FUNC void FUN_02032058() FUN_02031268(1); if (FUN_0202F918(0, UNK_021C5A00->unk43, 0x1F4, 1) != 0) { -#ifdef NONMATCHING - UNK_021C5A00->unk0C = UNK_021C5A00->unk0C * UNK_021C5A00->unk14 + UNK_021C5A00->unk1C; - u32 r1 = ((s64)((u64)(UNK_021C5A00->unk0C) >> 32) * 0x14) >> 32; + u32 r1 = compute(UNK_021C5A00->unk0C, 0x14); UNK_021C5A00->unk43 = 0; FUN_02031D20(FUN_020320C4, r1 + 0x14); -#else - asm( - // clang-format off - ldr r0, =UNK_021C5A00 - ldr r5, [r0, #0x0] - add r4, r5, #0x0 - add r4, #0xc - ldr r0, [r4, #0x8] - ldr r1, [r4, #0xc] - ldr r2, [r5, #0xc] - ldr r3, [r4, #0x4] - bl _ll_mul - ldr r2, [r4, #0x10] - ldr r3, [r4, #0x14] - add r0, r2, r0 - adc r3, r1 - str r0, [r5, #0xc] - str r3, [r4, #0x4] - add r0, r3, #0x0 - mov r1, #0x0 - mov r2, #0x14 - mov r3, #0x0 - bl _ll_mul - mov r0, #0x0 - add r5, #0x43 - strb r0, [r5, #0x0] - ldr r0, =FUN_020320C4 - add r1, #0x14 - bl FUN_02031D20 - // clang-format on - ); -#endif } } } @@ -1092,37 +959,12 @@ THUMB_FUNC void FUN_02032510() { if (FUN_0202EE0C() != 0 && FUN_0202F918(0, UNK_021C5A00->unk43, 0x200, 1) != 0) { -#ifdef NONMATCHING - UNK_021C5A00->unk0C = UNK_021C5A00->unk0C * UNK_021C5A00->unk14 + UNK_021C5A00->unk1C; + // the compiler optimizes away the result of this function because it's not used, so any + // second parameter value matches + compute(UNK_021C5A00->unk0C, 0); + FUN_0202FA10(); UNK_021C5A00->unk43 = 0; -#else - asm( - // clang-format off - ldr r0, =UNK_021C5A00 - ldr r4, [r0, #0x0] - add r5, r4, #0x0 - add r5, #0xc - ldr r0, [r5, #0x8] - ldr r1, [r5, #0xc] - ldr r2, [r4, #0xc] - ldr r3, [r5, #0x4] - bl _ll_mul - ldr r2, [r5, #0x10] - ldr r3, [r5, #0x14] - add r0, r2, r0 - adc r3, r1 - str r0, [r4, #0xc] - str r3, [r5, #0x4] - bl FUN_0202FA10 - ldr r0, =UNK_021C5A00 - mov r1, #0x0 - ldr r0, [r0, #0x0] - add r0, #0x43 - strb r1, [r0, #0x0] - // clang-format on - ); -#endif FUN_02031D20(FUN_02032578, 0x2710); } @@ -1159,38 +1001,9 @@ THUMB_FUNC void FUN_020325D0() { FUN_0202FA10(); -#ifdef NONMATCHING - UNK_021C5A00->unk0C = UNK_021C5A00->unk0C * UNK_021C5A00->unk14 + UNK_021C5A00->unk1C; - u32 r1 = ((s64)((u64)(UNK_021C5A00->unk0C) >> 32) * 0x20) >> 32; + u32 r1 = compute(UNK_021C5A00->unk0C, 0x20); FUN_02031D20(FUN_020324C8, r1); -#else - asm( - // clang-format off - ldr r0, =UNK_021C5A00 - ldr r4, [r0, #0x0] - add r5, r4, #0x0 - add r5, #0xc - ldr r0, [r5, #0x8] - ldr r1, [r5, #0xc] - ldr r2, [r4, #0xc] - ldr r3, [r5, #0x4] - bl _ll_mul - ldr r2, [r5, #0x10] - ldr r3, [r5, #0x14] - add r0, r2, r0 - adc r3, r1 - str r0, [r4, #0xc] - mov r1, #0x0 - ldr r0, =FUN_020324C8 - lsr r2, r3, #0x1b - lsl r1, r1, #0x5 - orr r1, r2 - str r3, [r5, #0x4] - bl FUN_02031D20 - // clang-format on - ); -#endif } } -- cgit v1.2.3 From 5618acfd092460c1acb38ed0a56ae161911cdac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sun, 2 May 2021 09:55:35 +0200 Subject: use boolean in while loops --- arm9/src/unk_02031734.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_02031734.c b/arm9/src/unk_02031734.c index 01d85ffb..a9470c49 100644 --- a/arm9/src/unk_02031734.c +++ b/arm9/src/unk_02031734.c @@ -2102,7 +2102,7 @@ THUMB_FUNC u8 FUN_020335B8() THUMB_FUNC void FUN_020335D0(s32 param0) { FUN_02033F70(0, 1, param0); - while (1) + while (TRUE) { } } @@ -2110,7 +2110,7 @@ THUMB_FUNC void FUN_020335D0(s32 param0) THUMB_FUNC void FUN_020335E0() { FUN_02033F70(0, 4, 0); - while (1) + while (TRUE) { } } -- cgit v1.2.3 From a036306c5554d2d7088c07ea0c08c7b718a6508a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sun, 2 May 2021 10:04:55 +0200 Subject: fix line endings --- arm9/src/unk_02031734.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arm9') diff --git a/arm9/src/unk_02031734.c b/arm9/src/unk_02031734.c index a9470c49..ee24af39 100644 --- a/arm9/src/unk_02031734.c +++ b/arm9/src/unk_02031734.c @@ -2181,4 +2181,4 @@ THUMB_FUNC u32 FUN_020336A0(u8 param0) } return 0; -} \ No newline at end of file +} -- cgit v1.2.3 From fe7f18002c7987ef744b5024151ca0903e4317fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sun, 2 May 2021 10:14:04 +0200 Subject: cleanup header --- arm9/src/unk_02031734.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'arm9') diff --git a/arm9/src/unk_02031734.c b/arm9/src/unk_02031734.c index ee24af39..3222232c 100644 --- a/arm9/src/unk_02031734.c +++ b/arm9/src/unk_02031734.c @@ -1,4 +1,10 @@ +#include "global.h" #include "unk_02031734.h" +#include "MI_memory.h" +#include "game_init.h" +#include "heap.h" +#include "player_data.h" +#include "unk_0202F150.h" const struct UnkStruct_02031734_const2 UNK_020EEC48 = { { (u32)FUN_02032B84, 0 } }; -- cgit v1.2.3 From 6120ebe7e78f500432708631891feb32bc974be2 Mon Sep 17 00:00:00 2001 From: tgsm Date: Mon, 3 May 2021 08:19:11 -0400 Subject: Decompile scrcmd_21 -> scrcmd_flags --- arm9/arm9.lsf | 2 +- arm9/asm/scrcmd_21.s | 465 ------------------------------------------------ arm9/asm/unk_02038C78.s | 40 ++--- arm9/global.inc | 40 ++--- arm9/src/scrcmd_flags.c | 284 +++++++++++++++++++++++++++++ 5 files changed, 325 insertions(+), 506 deletions(-) delete mode 100644 arm9/asm/scrcmd_21.s create mode 100644 arm9/src/scrcmd_flags.c (limited to 'arm9') diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index dee43fd0..1abf5a52 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -173,7 +173,7 @@ Static arm9 Object scrcmd_18.o Object scrcmd_19.o Object scrcmd_20.o - Object scrcmd_21.o + Object scrcmd_flags.o Object scrcmd_items.o Object scrcmd_23.o Object scrcmd_24.o diff --git a/arm9/asm/scrcmd_21.s b/arm9/asm/scrcmd_21.s deleted file mode 100644 index e1f03c4a..00000000 --- a/arm9/asm/scrcmd_21.s +++ /dev/null @@ -1,465 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .section .rodata - - .global UNK_020F4574 -UNK_020F4574: ; 0x020F4574 - .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 - - .text - - thumb_func_start FUN_020453F4 -FUN_020453F4: ; 0x020453F4 - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Sav2_Pokedex_get - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - add r0, r4, #0x0 - bl Pokedex_GetSinnohDexFlag - strh r0, [r5, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_02045424 -FUN_02045424: ; 0x02045424 - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Sav2_Pokedex_get - bl Pokedex_SetSinnohDexFlag - mov r0, #0x0 - pop {r3, pc} - - thumb_func_start FUN_02045438 -FUN_02045438: ; 0x02045438 - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r4, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl FUN_02034E30 - bl FUN_02034E20 - bl FUN_02055474 - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_02045468 -FUN_02045468: ; 0x02045468 - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl FUN_02034E30 - bl FUN_02034E20 - mov r1, #0x1 - bl FUN_02055488 - mov r0, #0x0 - pop {r3, pc} - .balign 4 - - thumb_func_start FUN_02045484 -FUN_02045484: ; 0x02045484 - push {r4-r6, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r4, r0, #0x0 - add r0, r5, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r6, r0, #0x0 - cmp r4, #0x8 - blo _020454B6 - bl ErrorHandling -_020454B6: - add r5, #0x80 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl Sav2_PlayerData_GetProfileAddr - add r1, r4, #0x0 - bl PlayerProfile_TestBadgeFlag - strh r0, [r6, #0x0] - mov r0, #0x0 - pop {r4-r6, pc} - - thumb_func_start FUN_020454CC -FUN_020454CC: ; 0x020454CC - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r4, r0, #0x0 - cmp r4, #0x8 - blo _020454EA - bl ErrorHandling -_020454EA: - add r5, #0x80 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl Sav2_PlayerData_GetProfileAddr - add r1, r4, #0x0 - bl PlayerProfile_SetBadgeFlag - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_02045500 -FUN_02045500: ; 0x02045500 - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r4, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - bl FUN_0205ECE0 - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_0204552C -FUN_0204552C: ; 0x0204552C - push {r3-r7, lr} - add r6, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r6, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - mov r4, #0x0 - ldr r7, _02045578 ; =UNK_020F4574 - str r0, [sp, #0x0] - add r5, r4, #0x0 -_02045548: - add r0, r6, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Sav2_PlayerData_GetProfileAddr - ldrb r1, [r7, r4] - bl PlayerProfile_TestBadgeFlag - cmp r0, #0x1 - bne _02045564 - add r0, r5, #0x1 - lsl r0, r0, #0x10 - lsr r5, r0, #0x10 -_02045564: - add r0, r4, #0x1 - lsl r0, r0, #0x10 - lsr r4, r0, #0x10 - cmp r4, #0x8 - blo _02045548 - ldr r0, [sp, #0x0] - strh r5, [r0, #0x0] - mov r0, #0x0 - pop {r3-r7, pc} - nop -_02045578: .word UNK_020F4574 - - thumb_func_start FUN_0204557C -FUN_0204557C: ; 0x0204557C - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - bl FUN_0205ECD4 - mov r0, #0x0 - pop {r3, pc} - - thumb_func_start FUN_02045590 -FUN_02045590: ; 0x02045590 - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r4, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - bl FUN_0205ED3C - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_020455BC -FUN_020455BC: ; 0x020455BC - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - bl FUN_0205ED1C - mov r0, #0x0 - pop {r3, pc} - - thumb_func_start FUN_020455D0 -FUN_020455D0: ; 0x020455D0 - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - bl FUN_0205ED2C - mov r0, #0x0 - pop {r3, pc} - - thumb_func_start FUN_020455E4 -FUN_020455E4: ; 0x020455E4 - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r4, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - bl FUN_0205ED6C - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_02045610 -FUN_02045610: ; 0x02045610 - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - bl FUN_0205ED4C - mov r0, #0x0 - pop {r3, pc} - - thumb_func_start FUN_02045624 -FUN_02045624: ; 0x02045624 - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - bl FUN_0205ED5C - mov r0, #0x0 - pop {r3, pc} - - thumb_func_start FUN_02045638 -FUN_02045638: ; 0x02045638 - push {r3-r5, lr} - add r5, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r5, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r5, #0x80 - add r4, r0, #0x0 - ldr r0, [r5, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - bl FUN_0205ED0C - strh r0, [r4, #0x0] - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_02045664 -FUN_02045664: ; 0x02045664 - push {r3, lr} - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - bl FUN_0205ECFC - mov r0, #0x0 - pop {r3, pc} - - thumb_func_start FUN_02045678 -FUN_02045678: ; 0x02045678 - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - ldr r2, [r5, #0x8] - add r4, r0, #0x0 - add r1, r2, #0x1 - str r1, [r5, #0x8] - ldrb r1, [r2, #0x0] - cmp r1, #0x0 - beq _020456A6 - cmp r1, #0x1 - beq _0204569E - cmp r1, #0x2 - beq _020456AE - b _020456CC -_0204569E: - mov r1, #0x1 - bl FUN_0205F264 - b _020456D0 -_020456A6: - mov r1, #0x0 - bl FUN_0205F264 - b _020456D0 -_020456AE: - add r0, r5, #0x0 - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - add r0, r4, #0x0 - mov r1, #0x2 - bl FUN_0205F264 - strh r0, [r5, #0x0] - b _020456D0 -_020456CC: - bl ErrorHandling -_020456D0: - mov r0, #0x0 - pop {r3-r5, pc} - - thumb_func_start FUN_020456D4 -FUN_020456D4: ; 0x020456D4 - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - ldr r2, [r5, #0x8] - add r4, r0, #0x0 - add r1, r2, #0x1 - str r1, [r5, #0x8] - ldrb r1, [r2, #0x0] - cmp r1, #0x0 - beq _02045700 - cmp r1, #0x1 - beq _020456FA - cmp r1, #0x2 - beq _02045706 - b _02045722 -_020456FA: - bl FUN_0205F274 - b _02045726 -_02045700: - bl FUN_0205F284 - b _02045726 -_02045706: - add r0, r5, #0x0 - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - add r0, r4, #0x0 - bl FUN_0205F294 - strh r0, [r5, #0x0] - b _02045726 -_02045722: - bl ErrorHandling -_02045726: - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_0204572C -FUN_0204572C: ; 0x0204572C - push {r3-r5, lr} - add r5, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl SavArray_Flags_get - ldr r2, [r5, #0x8] - add r4, r0, #0x0 - add r1, r2, #0x1 - str r1, [r5, #0x8] - ldrb r1, [r2, #0x0] - cmp r1, #0x0 - beq _02045758 - cmp r1, #0x1 - beq _02045752 - cmp r1, #0x2 - beq _0204575E - b _0204577A -_02045752: - bl FUN_0205F2A4 - b _0204577E -_02045758: - bl FUN_0205F2B4 - b _0204577E -_0204575E: - add r0, r5, #0x0 - bl ScriptReadHalfword - add r5, #0x80 - add r1, r0, #0x0 - ldr r0, [r5, #0x0] - bl GetVarPointer - add r5, r0, #0x0 - add r0, r4, #0x0 - bl FUN_0205F2C4 - strh r0, [r5, #0x0] - b _0204577E -_0204577A: - bl ErrorHandling -_0204577E: - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index 08416fc7..98ec9e95 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -492,23 +492,23 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203D738 .word FUN_0203D774 .word FUN_0203D834 - .word FUN_020453F4 - .word FUN_02045424 - .word FUN_02045438 - .word FUN_02045468 - .word FUN_02045484 - .word FUN_020454CC - .word FUN_0204552C - .word FUN_02045500 - .word FUN_0204557C - .word FUN_02045590 - .word FUN_020455BC - .word FUN_020455D0 - .word FUN_020455E4 - .word FUN_02045610 - .word FUN_02045624 - .word FUN_02045638 - .word FUN_02045664 + .word ScrCmd_HasSinnohDex + .word ScrCmd_GiveSinnohDex + .word ScrCmd_Unk0159 + .word ScrCmd_Unk015A + .word ScrCmd_HasBadge + .word ScrCmd_GiveBadge + .word ScrCmd_GetTotalEarnedBadges + .word ScrCmd_Unk015E + .word ScrCmd_Unk015F + .word ScrCmd_Unk0160 + .word ScrCmd_Unk0161 + .word ScrCmd_Unk0162 + .word ScrCmd_Unk0163 + .word ScrCmd_Unk0164 + .word ScrCmd_Unk0165 + .word ScrCmd_Unk0166 + .word ScrCmd_Unk0167 .word FUN_0203DC00 .word FUN_0203DC58 .word FUN_0203DC70 @@ -612,9 +612,9 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203E138 .word FUN_0203E168 .word FUN_0203E254 - .word FUN_02045678 - .word FUN_020456D4 - .word FUN_0204572C + .word ScrCmd_Unk01CF + .word ScrCmd_Unk01D0 + .word ScrCmd_Unk01D1 .word FUN_0203E258 .word FUN_0203E29C .word FUN_0203E2F8 diff --git a/arm9/global.inc b/arm9/global.inc index a944a1b1..8768830d 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -3358,26 +3358,26 @@ .extern ScrCmd_Unk01F2 .extern ScrCmd_Unk01F3 .extern ScrCmd_Unk02A6 -.extern FUN_020453F4 -.extern FUN_02045424 -.extern FUN_02045438 -.extern FUN_02045468 -.extern FUN_02045484 -.extern FUN_020454CC -.extern FUN_02045500 -.extern FUN_0204552C -.extern FUN_0204557C -.extern FUN_02045590 -.extern FUN_020455BC -.extern FUN_020455D0 -.extern FUN_020455E4 -.extern FUN_02045610 -.extern FUN_02045624 -.extern FUN_02045638 -.extern FUN_02045664 -.extern FUN_02045678 -.extern FUN_020456D4 -.extern FUN_0204572C +.extern ScrCmd_HasSinnohDex +.extern ScrCmd_GiveSinnohDex +.extern ScrCmd_Unk0159 +.extern ScrCmd_Unk015A +.extern ScrCmd_HasBadge +.extern ScrCmd_GiveBadge +.extern ScrCmd_Unk015E +.extern ScrCmd_GetTotalEarnedBadges +.extern ScrCmd_Unk015F +.extern ScrCmd_Unk0160 +.extern ScrCmd_Unk0161 +.extern ScrCmd_Unk0162 +.extern ScrCmd_Unk0163 +.extern ScrCmd_Unk0164 +.extern ScrCmd_Unk0165 +.extern ScrCmd_Unk0166 +.extern ScrCmd_Unk0167 +.extern ScrCmd_Unk01CF +.extern ScrCmd_Unk01D0 +.extern ScrCmd_Unk01D1 .extern ScrCmd_GiveItem .extern ScrCmd_TakeItem .extern ScrCmd_HasSpaceForItem diff --git a/arm9/src/scrcmd_flags.c b/arm9/src/scrcmd_flags.c new file mode 100644 index 00000000..c0f6a519 --- /dev/null +++ b/arm9/src/scrcmd_flags.c @@ -0,0 +1,284 @@ +#include "scrcmd.h" +#include "event_data.h" +#include "pokedex.h" + +extern void* FUN_02034E20(void*); +extern void* FUN_02034E30(void*); +extern BOOL FUN_02055474(void*); +extern void FUN_02055488(void*, u32); +extern void FUN_0205ECD4(struct ScriptState* state); +extern BOOL FUN_0205ECE0(struct ScriptState* state); +extern void FUN_0205ECFC(struct ScriptState* state); +extern BOOL FUN_0205ED0C(struct ScriptState* state); +extern void FUN_0205ED1C(struct ScriptState* state); +extern void FUN_0205ED2C(struct ScriptState* state); +extern BOOL FUN_0205ED3C(struct ScriptState* state); +extern void FUN_0205ED4C(struct ScriptState* state); +extern void FUN_0205ED5C(struct ScriptState* state); +extern BOOL FUN_0205ED6C(struct ScriptState* state); +extern BOOL FUN_0205F264(struct ScriptState* state, u32); +extern void FUN_0205F274(struct ScriptState* state); +extern void FUN_0205F284(struct ScriptState* state); +extern BOOL FUN_0205F294(struct ScriptState* state); +extern void FUN_0205F2A4(struct ScriptState* state); +extern void FUN_0205F2B4(struct ScriptState* state); +extern BOOL FUN_0205F2C4(struct ScriptState* state); + +const u8 UNK_020F457F[8] = { + 0, 1, 2, 3, 4, 5, 6, 7, +}; + +THUMB_FUNC BOOL ScrCmd_HasSinnohDex(struct ScriptContext* ctx) +{ + struct Pokedex* pokedex = Sav2_Pokedex_get(ctx->unk80->saveBlock2); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + *ret_ptr = (u16)Pokedex_GetSinnohDexFlag(pokedex); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GiveSinnohDex(struct ScriptContext* ctx) +{ + struct Pokedex* pokedex = Sav2_Pokedex_get(ctx->unk80->saveBlock2); + + Pokedex_SetSinnohDexFlag(pokedex); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0159(struct ScriptContext* ctx) +{ + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + void* unk_sav_ptr = FUN_02034E30(ctx->unk80->saveBlock2); + void* unk = FUN_02034E20(unk_sav_ptr); + + *ret_ptr = (u16)FUN_02055474(unk); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk015A(struct ScriptContext* ctx) +{ + void* unk_sav_ptr = FUN_02034E30(ctx->unk80->saveBlock2); + void* unk = FUN_02034E20(unk_sav_ptr); + + FUN_02055488(unk, 1); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_HasBadge(struct ScriptContext* ctx) +{ + u16 badge_no = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + GF_ASSERT(badge_no < 8); + struct PlayerData* player = Sav2_PlayerData_GetProfileAddr(ctx->unk80->saveBlock2); + + *ret_ptr = (u16)PlayerProfile_TestBadgeFlag(player, badge_no); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GiveBadge(struct ScriptContext* ctx) +{ + u16 badge_no = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + GF_ASSERT(badge_no < 8); + struct PlayerData* player = Sav2_PlayerData_GetProfileAddr(ctx->unk80->saveBlock2); + + PlayerProfile_SetBadgeFlag(player, badge_no); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk015E(struct ScriptContext* ctx) +{ + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + + *ret_ptr = (u16)FUN_0205ECE0(state); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetTotalEarnedBadges(struct ScriptContext* ctx) +{ + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + u16 i; + u16 badges; + for (i = 0, badges = 0; i < 8; i++) + { + struct PlayerData* player = Sav2_PlayerData_GetProfileAddr(ctx->unk80->saveBlock2); + BOOL has_badge = PlayerProfile_TestBadgeFlag(player, UNK_020F457F[i]); + if (has_badge == TRUE) + { + badges++; + } + } + + *ret_ptr = badges; + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk015F(struct ScriptContext* ctx) +{ + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + + FUN_0205ECD4(state); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0160(struct ScriptContext* ctx) +{ + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + + *ret_ptr = (u16)FUN_0205ED3C(state); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0161(struct ScriptContext* ctx) +{ + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + + FUN_0205ED1C(state); + + return 0; +} + +THUMB_FUNC BOOL ScrCmd_Unk0162(struct ScriptContext* ctx) +{ + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + + FUN_0205ED2C(state); + + return 0; +} + +THUMB_FUNC BOOL ScrCmd_Unk0163(struct ScriptContext* ctx) +{ + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + + *ret_ptr = (u16)FUN_0205ED6C(state); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0164(struct ScriptContext* ctx) +{ + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + + FUN_0205ED4C(state); + + return 0; +} + +THUMB_FUNC BOOL ScrCmd_Unk0165(struct ScriptContext* ctx) +{ + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + + FUN_0205ED5C(state); + + return 0; +} + +THUMB_FUNC BOOL ScrCmd_Unk0166(struct ScriptContext* ctx) +{ + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + + *ret_ptr = (u16)FUN_0205ED0C(state); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0167(struct ScriptContext* ctx) +{ + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + + FUN_0205ECFC(state); + + return 0; +} + +THUMB_FUNC BOOL ScrCmd_Unk01CF(struct ScriptContext* ctx) +{ + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + u8 unk = ScriptReadByte(ctx); + u16* ret_ptr; + + switch (unk) + { + case 1: + FUN_0205F264(state, 1); + break; + case 0: + FUN_0205F264(state, 0); + break; + case 2: + ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + *ret_ptr = (u16)FUN_0205F264(state, 2); + break; + default: + GF_ASSERT(FALSE); + break; + } + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01D0(struct ScriptContext* ctx) +{ + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + u8 unk = ScriptReadByte(ctx); + u16* ret_ptr; + + switch (unk) + { + case 1: + FUN_0205F274(state); + break; + case 0: + FUN_0205F284(state); + break; + case 2: + ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + *ret_ptr = (u16)FUN_0205F294(state); + break; + default: + GF_ASSERT(FALSE); + break; + } + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01D1(struct ScriptContext* ctx) +{ + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + u8 unk = ScriptReadByte(ctx); + u16* ret_ptr; + + switch (unk) + { + case 1: + FUN_0205F2A4(state); + break; + case 0: + FUN_0205F2B4(state); + break; + case 2: + ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + *ret_ptr = (u16)FUN_0205F2C4(state); + break; + default: + GF_ASSERT(FALSE); + break; + } + + return FALSE; +} -- cgit v1.2.3 From fead56db333c9eb3024ad4483c26a11a66ffe9f1 Mon Sep 17 00:00:00 2001 From: tgsm Date: Wed, 5 May 2021 14:10:45 -0400 Subject: Decompile unk_0208890C --- arm9/asm/unk_0208890C.s | 73 ------------------------------------------------- arm9/src/unk_0208890C.c | 53 +++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 73 deletions(-) delete mode 100644 arm9/asm/unk_0208890C.s create mode 100644 arm9/src/unk_0208890C.c (limited to 'arm9') diff --git a/arm9/asm/unk_0208890C.s b/arm9/asm/unk_0208890C.s deleted file mode 100644 index d27130c9..00000000 --- a/arm9/asm/unk_0208890C.s +++ /dev/null @@ -1,73 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .section .rodata - - .global UNK_020FD6E4 -UNK_020FD6E4: ; 0x020FD6E4 - .word FUN_020889B0, FUN_02088A00, FUN_02088A78, 0xFFFFFFFF - - .text - - thumb_func_start FUN_0208890C -FUN_0208890C: ; 0x0208890C - push {r3-r7, lr} - add r6, r0, #0x0 - add r5, r1, #0x0 - add r0, r2, #0x0 - mov r1, #0x20 - add r7, r3, #0x0 - bl AllocFromHeap - add r4, r0, #0x0 - mov r1, #0x0 - mov r2, #0x20 - bl MI_CpuFill8 - str r5, [r4, #0xc] - add r0, r5, #0x0 - bl FUN_02028048 - str r0, [r4, #0x8] - add r0, r5, #0x0 - bl Sav2_PlayerData_GetProfileAddr - str r0, [r4, #0x10] - add r0, r5, #0x0 - bl Sav2_Bag_get - str r0, [r4, #0x14] - add r0, r5, #0x0 - bl Sav2_PlayerData_GetOptionsAddr - str r0, [r4, #0x18] - str r7, [r4, #0x1c] - str r6, [r4, #0x4] - add r0, r4, #0x0 - pop {r3-r7, pc} - - thumb_func_start FUN_02088950 -FUN_02088950: ; 0x02088950 - ldr r3, _02088958 ; =FUN_020373D4 - add r2, r1, #0x0 - ldr r1, _0208895C ; =UNK_020FD6E4 - bx r3 - .balign 4 -_02088958: .word FUN_020373D4 -_0208895C: .word UNK_020FD6E4 - - thumb_func_start FUN_02088960 -FUN_02088960: ; 0x02088960 - push {r4-r6, lr} - add r5, r0, #0x0 - add r4, r1, #0x0 - add r6, r2, #0x0 - bl ScriptEnvironment_GetSav2Ptr - add r3, r5, #0x0 - add r3, #0x98 - add r1, r0, #0x0 - ldr r3, [r3, #0x0] - add r0, r4, #0x0 - add r2, r6, #0x0 - bl FUN_0208890C - add r4, r0, #0x0 - add r0, r5, #0x0 - add r1, r4, #0x0 - bl FUN_02088950 - add r0, r4, #0x0 - pop {r4-r6, pc} - .balign 4 diff --git a/arm9/src/unk_0208890C.c b/arm9/src/unk_0208890C.c new file mode 100644 index 00000000..0bc8803f --- /dev/null +++ b/arm9/src/unk_0208890C.c @@ -0,0 +1,53 @@ +#include "global.h" +#include "bag.h" +#include "heap.h" +#include "main.h" +#include "MI_memory.h" +#include "player_data.h" +#include "script.h" +#include "unk_0208890C.h" + +extern struct SaveBlock2* ScriptEnvironment_GetSav2Ptr(struct UnkSavStruct80*); +extern void* FUN_02028048(struct SaveBlock2* sav2); +extern void FUN_020373D4(struct UnkSavStruct80*, struct Unk21DBE18*, void*); +extern BOOL FUN_020889B0(struct UnkStruct_02006234*, u32*); +extern BOOL FUN_02088A00(struct UnkStruct_02006234*, u32*); +extern BOOL FUN_02088A78(struct UnkStruct_02006234*, u32*); + +const struct Unk21DBE18 UNK_020FD6E4 = { + FUN_020889B0, + FUN_02088A00, + FUN_02088A78, + 0xFFFFFFFF, +}; + +THUMB_FUNC struct UnkStruct_0208890C* FUN_0208890C(void* a0, struct SaveBlock2* sav2, u32 heap_id, void* a3) +{ + struct UnkStruct_0208890C* ret = AllocFromHeap(heap_id, sizeof(struct UnkStruct_0208890C)); + MI_CpuFill8(ret, 0, sizeof(struct UnkStruct_0208890C)); + + ret->sav2 = sav2; + ret->unk8 = FUN_02028048(sav2); + ret->player = Sav2_PlayerData_GetProfileAddr(sav2); + ret->bag = Sav2_Bag_get(sav2); + ret->options = Sav2_PlayerData_GetOptionsAddr(sav2); + ret->unk1C = a3; + ret->unk4 = a0; + + return ret; +} + +THUMB_FUNC void FUN_02088950(struct UnkSavStruct80* unk, struct UnkStruct_0208890C* unk2) +{ + FUN_020373D4(unk, (struct Unk21DBE18*)&UNK_020FD6E4, unk2); +} + +THUMB_FUNC struct UnkStruct_0208890C* FUN_02088960(struct UnkSavStruct80* unk, void* a1, u32 heap_id) +{ + struct SaveBlock2* sav2 = ScriptEnvironment_GetSav2Ptr(unk); + struct UnkStruct_0208890C* ret = FUN_0208890C(a1, sav2, heap_id, unk->unk98); + + FUN_02088950(unk, ret); + + return ret; +} -- cgit v1.2.3 From 5cdb95f4e0fb866fdbf219ab112d69be21c59a2e Mon Sep 17 00:00:00 2001 From: tgsm Date: Fri, 7 May 2021 13:32:25 -0400 Subject: Decompile scrcmd_8 --- arm9/asm/scrcmd_8.s | 234 ------------------------------------------------ arm9/asm/unk_02038C78.s | 2 +- arm9/global.inc | 2 +- arm9/src/scrcmd_8.c | 87 ++++++++++++++++++ arm9/src/unk_020286F8.c | 9 +- 5 files changed, 93 insertions(+), 241 deletions(-) delete mode 100644 arm9/asm/scrcmd_8.s create mode 100644 arm9/src/scrcmd_8.c (limited to 'arm9') diff --git a/arm9/asm/scrcmd_8.s b/arm9/asm/scrcmd_8.s deleted file mode 100644 index fbb5b223..00000000 --- a/arm9/asm/scrcmd_8.s +++ /dev/null @@ -1,234 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .text - - thumb_func_start FUN_02041C38 -FUN_02041C38: ; 0x02041C38 - push {r4-r7, lr} - sub sp, #0xc - add r4, r0, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - mov r1, #0xf - bl FUN_02039438 - add r6, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl FUN_0202881C - add r5, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r7, [r0, #0xc] - add r0, r4, #0x0 - bl ScriptReadHalfword - cmp r0, #0x6 - bls _02041C6C - b _02041E38 -_02041C6C: - add r0, r0, r0 - add r0, pc - ldrh r0, [r0, #0x6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_02041C78: ; jump table (using 16-bit offset) - .short _02041C86 - _02041C78 - 2; case 0 - .short _02041CBC - _02041C78 - 2; case 1 - .short _02041CF2 - _02041C78 - 2; case 2 - .short _02041D28 - _02041C78 - 2; case 3 - .short _02041D5E - _02041C78 - 2; case 4 - .short _02041D94 - _02041C78 - 2; case 5 - .short _02041DCE - _02041C78 - 2; case 6 -_02041C86: - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r6, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - add r4, r0, #0x0 - add r0, r5, #0x0 - add r1, r6, #0x0 - bl FUN_02028828 - strh r0, [r4, #0x0] - add sp, #0xc - mov r0, #0x0 - pop {r4-r7, pc} -_02041CBC: - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r6, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl GetVarPointer - add r4, r0, #0x0 - add r0, r5, #0x0 - add r1, r6, #0x0 - bl FUN_02028840 - strh r0, [r4, #0x0] - add sp, #0xc - mov r0, #0x0 - pop {r4-r7, pc} -_02041CF2: - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r5, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl VarGet - add r3, r0, #0x0 - mov r0, #0x0 - str r0, [sp, #0x0] - ldr r0, [r6, #0x0] - add r1, r7, #0x0 - add r2, r5, #0x0 - bl BufferEasyChatWord - b _02041E38 -_02041D28: - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r5, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r4, #0x80 - add r1, r0, #0x0 - ldr r0, [r4, #0x0] - bl VarGet - add r3, r0, #0x0 - mov r0, #0x1 - str r0, [sp, #0x0] - ldr r0, [r6, #0x0] - add r1, r7, #0x0 - add r2, r5, #0x0 - bl BufferEasyChatWord - b _02041E38 -_02041D5E: - mov r1, #0x0 - add r0, r5, #0x0 - add r2, r1, #0x0 - bl FUN_020287A8 - add r5, r0, #0x0 - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - mov r2, #0x0 - str r2, [sp, #0x0] - str r5, [sp, #0x4] - str r0, [sp, #0x8] - ldr r0, [r4, #0x74] - mov r1, #0x5 - mov r3, #0x7 - bl FUN_020385CC - add sp, #0xc - mov r0, #0x1 - pop {r4-r7, pc} -_02041D94: - add r0, r4, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl VarGet - add r7, r0, #0x0 - add r0, r5, #0x0 - mov r1, #0x1 - bl FUN_02028828 - add r6, r0, #0x0 - add r0, r5, #0x0 - add r1, r7, #0x0 - mov r2, #0x1 - bl FUN_02028700 - cmp r6, #0x0 - beq _02041DC8 - add r4, #0x80 - ldr r0, [r4, #0x0] - bl FUN_020612F8 -_02041DC8: - add sp, #0xc - mov r0, #0x0 - pop {r4-r7, pc} -_02041DCE: - mov r0, #0x40 - mov r1, #0x20 - bl String_ctor - add r6, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - ldr r0, [r0, #0xc] - bl Sav2_PlayerData_GetProfileAddr - add r1, r6, #0x0 - add r7, r0, #0x0 - bl PlayerName_FlatToString - add r0, r5, #0x0 - mov r1, #0x0 - mov r2, #0x1 - add r3, r6, #0x0 - bl FUN_020287C0 - add r0, r7, #0x0 - bl PlayerProfile_GetTrainerGender - add r2, r0, #0x0 - add r0, r5, #0x0 - mov r1, #0x0 - bl FUN_020287EC - add r0, r5, #0x0 - mov r1, #0x0 - mov r2, #0x2 - bl FUN_02028810 - bl MTRandom - add r2, r0, #0x0 - add r0, r5, #0x0 - mov r1, #0x0 - bl FUN_02028788 - add r0, r6, #0x0 - bl String_dtor - add r0, r5, #0x0 - mov r1, #0x0 - mov r2, #0x1 - bl FUN_02028700 - add r4, #0x80 - ldr r0, [r4, #0x0] - bl FUN_020612EC -_02041E38: - mov r0, #0x0 - add sp, #0xc - pop {r4-r7, pc} - .balign 4 diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index 98ec9e95..a43768aa 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -690,7 +690,7 @@ gScriptCmdTable: ; 0x020F355C .word FUN_0203E81C .word FUN_0203E848 .word FUN_0203E858 - .word FUN_02041C38 + .word ScrCmd_Unk021D .word FUN_02045E1C .word FUN_02045E20 .word FUN_02045EE0 diff --git a/arm9/global.inc b/arm9/global.inc index 8768830d..05ba01a7 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -3238,7 +3238,7 @@ .extern FUN_02041B9C .extern FUN_02041BC4 .extern FUN_02041BF0 -.extern FUN_02041C38 +.extern ScrCmd_Unk021D .extern FUN_02041E40 .extern FUN_02041FDC .extern FUN_02042000 diff --git a/arm9/src/scrcmd_8.c b/arm9/src/scrcmd_8.c new file mode 100644 index 00000000..ba35b302 --- /dev/null +++ b/arm9/src/scrcmd_8.c @@ -0,0 +1,87 @@ +#include "scrcmd.h" +#include "math_util.h" +#include "unk_020286F8.h" + +extern void* FUN_02039438(struct UnkSavStruct80*, u8 idx); + +extern void FUN_020385CC(struct UnkStruct_0204639C*, u32, u32, u32, u32, u16*, u16* ret_ptr); +extern BOOL FUN_020612EC(struct UnkSavStruct80*); +extern BOOL FUN_020612F8(struct UnkSavStruct80*); + +THUMB_FUNC BOOL ScrCmd_Unk021D(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + struct UnkSaveStruct_020286F8* unk_sav_ptr = FUN_0202881C(ctx->unk80->saveBlock2); + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + + u16 unk = ScriptReadHalfword(ctx); + switch (unk) + { + case 0: { + u16 unk_var = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + *ret_ptr = (u16)FUN_02028828(unk_sav_ptr, unk_var); + return FALSE; + } + case 1: { + u16 unk_var = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + *ret_ptr = (u16)FUN_02028840(unk_sav_ptr, unk_var); + return FALSE; + } + case 2: { + u16 unk_var = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferEasyChatWord(*mgr, sav2, unk_var, idx, 0); + break; + } + case 3: { + u16 unk_var = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferEasyChatWord(*mgr, sav2, unk_var, idx, 1); + break; + } + case 4: { + u16* unk_str_ptr = FUN_020287A8(unk_sav_ptr, 0, 0); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + FUN_020385CC(ctx->unk74, 5, 0, 7, 0, unk_str_ptr, ret_ptr); + return TRUE; + } + case 5: { + u16 src_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + BOOL unk_bool = FUN_02028828(unk_sav_ptr, 1); + + FUN_02028700(unk_sav_ptr, src_idx, 1); + if (unk_bool != FALSE) + { + FUN_020612F8(ctx->unk80); + } + + return FALSE; + } + case 6: { + struct String* player_name = String_ctor(64, 32); + struct PlayerData* player = Sav2_PlayerData_GetProfileAddr(ctx->unk80->saveBlock2); + + PlayerName_FlatToString(player, player_name); + FUN_020287C0(unk_sav_ptr, 0, 1, player_name); + FUN_020287EC(unk_sav_ptr, 0, PlayerProfile_GetTrainerGender(player)); + FUN_02028810(unk_sav_ptr, 0, 2); + FUN_02028788(unk_sav_ptr, 0, MTRandom()); + + String_dtor(player_name); + + FUN_02028700(unk_sav_ptr, 0, 1); + FUN_020612EC(ctx->unk80); + + break; + } + } + + return FALSE; +} diff --git a/arm9/src/unk_020286F8.c b/arm9/src/unk_020286F8.c index f54d1e2e..a23a94ff 100644 --- a/arm9/src/unk_020286F8.c +++ b/arm9/src/unk_020286F8.c @@ -75,9 +75,9 @@ void FUN_020287C0(struct UnkSaveStruct_020286F8 * ptr, u32 i, u32 j, struct Stri CopyStringToU16Array(k, ptr[i].unk_10, 8); } -void FUN_020287EC(struct UnkSaveStruct_020286F8 * ptr, u32 i, u8 j) +void FUN_020287EC(struct UnkSaveStruct_020286F8 * ptr, u32 i, u32 j) { - ptr[i].unk_20 = j; + ptr[i].unk_20 = (u8)j; } u8 FUN_020287F8(struct UnkSaveStruct_020286F8 * ptr, u32 i) @@ -90,10 +90,9 @@ u8 FUN_02028804(struct UnkSaveStruct_020286F8 * ptr, u32 i) return ptr[i].unk_21; } - -void FUN_02028810(struct UnkSaveStruct_020286F8 * ptr, u32 i, u8 j) +void FUN_02028810(struct UnkSaveStruct_020286F8 * ptr, u32 i, u32 j) { - ptr[i].unk_21 = j; + ptr[i].unk_21 = (u8)j; } struct UnkSaveStruct_020286F8 * FUN_0202881C(struct SaveBlock2 * sav2) -- cgit v1.2.3 From 0d99c3cbc17514149081de794f2d5ec55e7ab88b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 8 May 2021 12:04:27 +0200 Subject: decompile unk_0202E29C.s --- arm9/asm/unk_0202E29C.s | 1970 ----------------------------------------------- arm9/src/unk_0202E29C.c | 1110 ++++++++++++++++++++++++++ arm9/src/unk_0202F150.c | 8 +- arm9/src/unk_02031734.c | 2 +- 4 files changed, 1115 insertions(+), 1975 deletions(-) delete mode 100644 arm9/asm/unk_0202E29C.s create mode 100644 arm9/src/unk_0202E29C.c (limited to 'arm9') diff --git a/arm9/asm/unk_0202E29C.s b/arm9/asm/unk_0202E29C.s deleted file mode 100644 index 4bb83bc8..00000000 --- a/arm9/asm/unk_0202E29C.s +++ /dev/null @@ -1,1970 +0,0 @@ - .include "asm/macros.inc" - .include "global.inc" - - .section .rodata - - .global UNK_020EEC40 -UNK_020EEC40: ; 0x020EEC40 - .byte 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF - - .section .bss - - .global UNK_021C59E8 -UNK_021C59E8: ; 0x021C59E8 - .space 0xc - - .text - - thumb_func_start FUN_0202E29C -FUN_0202E29C: ; 0x0202E29C - push {r4, lr} - add r4, r0, #0x0 - ldr r0, _0202E334 ; =UNK_021C59E8 - ldr r0, [r0, #0x8] - cmp r0, #0x0 - bne _0202E332 - mov r1, #0xdb - mov r0, #0xf - lsl r1, r1, #0x4 - bl AllocFromHeap - ldr r1, _0202E334 ; =UNK_021C59E8 - mov r2, #0xdb - str r0, [r1, #0x8] - mov r1, #0x0 - lsl r2, r2, #0x4 - bl MI_CpuFill8 - bl FUN_0202CEEC - add r1, r0, #0x0 - mov r0, #0xf - bl AllocFromHeap - ldr r1, _0202E334 ; =UNK_021C59E8 - ldr r2, [r1, #0x8] - ldr r1, _0202E338 ; =0x00000CA4 - str r0, [r2, r1] - bl FUN_0202CEEC - add r2, r0, #0x0 - ldr r0, _0202E334 ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202E338 ; =0x00000CA4 - ldr r0, [r1, r0] - mov r1, #0x0 - bl MI_CpuFill8 - bl FUN_02023AC4 - add r1, r0, #0x0 - mov r0, #0xf - bl AllocFromHeap - ldr r1, _0202E334 ; =UNK_021C59E8 - ldr r2, [r1, #0x8] - ldr r1, _0202E33C ; =0x00000CBC - str r0, [r2, r1] - bl FUN_02023AC4 - add r2, r0, #0x0 - ldr r0, _0202E334 ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202E33C ; =0x00000CBC - ldr r0, [r1, r0] - mov r1, #0x0 - bl MI_CpuFill8 - ldr r2, _0202E334 ; =UNK_021C59E8 - mov r1, #0x33 - ldr r3, _0202E340 ; =0x00000333 - ldr r0, [r2, #0x8] - lsl r1, r1, #0x6 - str r3, [r0, r1] - add r0, r1, #0x0 - ldr r3, [r2, #0x8] - sub r0, #0x8 - str r4, [r3, r0] - ldr r0, [r2, #0x8] - sub r1, #0x18 - add r0, r0, r1 - bl MailMsg_init - bl FUN_0202E500 -_0202E332: - pop {r4, pc} - .balign 4 -_0202E334: .word UNK_021C59E8 -_0202E338: .word 0x00000CA4 -_0202E33C: .word 0x00000CBC -_0202E340: .word 0x00000333 - - thumb_func_start FUN_0202E344 -FUN_0202E344: ; 0x0202E344 - ldr r0, _0202E354 ; =UNK_021C59E8 - ldr r0, [r0, #0x8] - cmp r0, #0x0 - beq _0202E350 - mov r0, #0x1 - bx lr -_0202E350: - mov r0, #0x0 - bx lr - .balign 4 -_0202E354: .word UNK_021C59E8 - - thumb_func_start FUN_0202E358 -FUN_0202E358: ; 0x0202E358 - push {r4-r5} - mov r5, #0x0 - cmp r2, #0x0 - ble _0202E378 -_0202E360: - ldrb r4, [r0, #0x0] - ldrb r3, [r1, #0x0] - cmp r4, r3 - beq _0202E36E - mov r0, #0x0 - pop {r4-r5} - bx lr -_0202E36E: - add r5, r5, #0x1 - add r0, r0, #0x1 - add r1, r1, #0x1 - cmp r5, r2 - blt _0202E360 -_0202E378: - mov r0, #0x1 - pop {r4-r5} - bx lr - .balign 4 - - thumb_func_start FUN_0202E380 -FUN_0202E380: ; 0x0202E380 - push {r3-r7, lr} - add r7, r0, #0x0 - bl FUN_02033534 - add r5, r0, #0x0 - bl FUN_0203354C - add r4, r7, #0x0 - add r6, r0, #0x0 - add r4, #0x50 - cmp r5, #0xe - beq _0202E3C2 - ldrb r0, [r4, #0x4] - bl FUN_0202D8B0 - cmp r0, #0x0 - beq _0202E3AC - add r0, r5, #0x0 - bl FUN_0202D8B0 - cmp r0, #0x0 - bne _0202E3C2 -_0202E3AC: - add r0, r4, #0x0 - add r0, #0x54 - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - beq _0202E3BC - ldrb r0, [r4, #0x4] - cmp r0, #0xa - beq _0202E460 -_0202E3BC: - ldrb r0, [r4, #0x4] - cmp r0, r5 - bne _0202E460 -_0202E3C2: - cmp r5, #0xe - beq _0202E3CC - ldrb r0, [r4, #0x5] - cmp r0, r6 - bne _0202E460 -_0202E3CC: - mov r6, #0x0 - add r4, r6, #0x0 - add r5, r6, #0x0 -_0202E3D2: - ldr r0, _0202E464 ; =UNK_021C59E8 - ldr r1, _0202E468 ; =0x00000C84 - ldr r0, [r0, #0x8] - add r2, r0, r4 - ldrh r1, [r2, r1] - cmp r1, #0x0 - beq _0202E412 - add r0, #0x58 - add r0, r0, r5 - add r1, r7, #0x4 - mov r2, #0x6 - bl FUN_0202E358 - cmp r0, #0x0 - beq _0202E412 - ldr r2, _0202E464 ; =UNK_021C59E8 - lsl r1, r6, #0x1 - ldr r3, [r2, #0x8] - mov r0, #0x96 - add r3, r3, r1 - ldr r1, _0202E468 ; =0x00000C84 - strh r0, [r3, r1] - ldr r3, [r2, #0x8] - mov r2, #0xc0 - add r1, r6, #0x0 - add r3, #0x54 - mul r1, r2 - add r0, r7, #0x0 - add r1, r3, r1 - bl MI_CpuCopy8 - pop {r3-r7, pc} -_0202E412: - add r6, r6, #0x1 - add r4, r4, #0x2 - add r5, #0xc0 - cmp r6, #0x10 - blt _0202E3D2 - ldr r0, _0202E464 ; =UNK_021C59E8 - ldr r2, _0202E468 ; =0x00000C84 - ldr r0, [r0, #0x8] - mov r1, #0x0 - add r4, r0, #0x0 -_0202E426: - ldrh r3, [r4, r2] - cmp r3, #0x0 - beq _0202E434 - add r1, r1, #0x1 - add r4, r4, #0x2 - cmp r1, #0x10 - blt _0202E426 -_0202E434: - cmp r1, #0x10 - bge _0202E460 - lsl r2, r1, #0x1 - add r2, r0, r2 - ldr r0, _0202E468 ; =0x00000C84 - mov r3, #0x96 - strh r3, [r2, r0] - ldr r2, _0202E464 ; =UNK_021C59E8 - add r3, r1, #0x0 - ldr r4, [r2, #0x8] - mov r2, #0xc0 - add r4, #0x54 - mul r3, r2 - add r0, r7, #0x0 - add r1, r4, r3 - bl MI_CpuCopy8 - ldr r0, _0202E464 ; =UNK_021C59E8 - mov r2, #0x1 - ldr r1, [r0, #0x8] - ldr r0, _0202E46C ; =0x00000CB4 - strb r2, [r1, r0] -_0202E460: - pop {r3-r7, pc} - nop -_0202E464: .word UNK_021C59E8 -_0202E468: .word 0x00000C84 -_0202E46C: .word 0x00000CB4 - - thumb_func_start FUN_0202E470 -FUN_0202E470: ; 0x0202E470 - push {r3, lr} - cmp r1, #0x0 - beq _0202E47A - bl OS_Terminate -_0202E47A: - ldr r0, _0202E484 ; =UNK_021C59E8 - mov r1, #0x2 - str r1, [r0, #0x4] - pop {r3, pc} - nop -_0202E484: .word UNK_021C59E8 - - thumb_func_start FUN_0202E488 -FUN_0202E488: ; 0x0202E488 - ldr r0, _0202E494 ; =UNK_021C59E8 - mov r1, #0x0 - str r1, [r0, #0x4] - ldr r3, _0202E498 ; =FUN_02016454 - mov r0, #0x4 - bx r3 - .balign 4 -_0202E494: .word UNK_021C59E8 -_0202E498: .word FUN_02016454 - - thumb_func_start FUN_0202E49C -FUN_0202E49C: ; 0x0202E49C - push {r3, lr} - mov r0, #0x4 - bl FUN_02016444 - ldr r0, _0202E4C0 ; =UNK_021C59E8 - mov r1, #0x1 - str r1, [r0, #0x4] - ldr r1, _0202E4C4 ; =FUN_0202E470 - mov r0, #0x8 - mov r2, #0x0 - bl FUN_02090DB8 - cmp r0, #0x1 - beq _0202E4BC - bl OS_Terminate -_0202E4BC: - pop {r3, pc} - nop -_0202E4C0: .word UNK_021C59E8 -_0202E4C4: .word FUN_0202E470 - - thumb_func_start FUN_0202E4C8 -FUN_0202E4C8: ; 0x0202E4C8 - ldr r0, _0202E4D8 ; =UNK_021C59E8 - ldr r0, [r0, #0x4] - cmp r0, #0x2 - bne _0202E4D4 - mov r0, #0x1 - bx lr -_0202E4D4: - mov r0, #0x0 - bx lr - .balign 4 -_0202E4D8: .word UNK_021C59E8 - - thumb_func_start FUN_0202E4DC -FUN_0202E4DC: ; 0x0202E4DC - ldr r0, _0202E4EC ; =UNK_021C59E8 - ldr r0, [r0, #0x4] - cmp r0, #0x0 - beq _0202E4E8 - mov r0, #0x1 - bx lr -_0202E4E8: - mov r0, #0x0 - bx lr - .balign 4 -_0202E4EC: .word UNK_021C59E8 - - thumb_func_start FUN_0202E4F0 -FUN_0202E4F0: ; 0x0202E4F0 - ldr r3, _0202E4F8 ; =FUN_02090CC8 - ldr r0, _0202E4FC ; =FUN_0202E488 - mov r1, #0x0 - bx r3 - .balign 4 -_0202E4F8: .word FUN_02090CC8 -_0202E4FC: .word FUN_0202E488 - - thumb_func_start FUN_0202E500 -FUN_0202E500: ; 0x0202E500 - push {r3, lr} - ldr r1, _0202E534 ; =UNK_021C59E8 - mov r0, #0xcb - ldr r2, [r1, #0x8] - mov r3, #0x0 - lsl r0, r0, #0x4 - str r3, [r2, r0] - ldr r1, [r1, #0x8] - sub r0, #0xc - ldr r2, [r1, r0] - mov r0, #0x1f - add r1, r2, #0x0 - and r1, r0 - mov r0, #0x20 - sub r0, r0, r1 - add r0, r2, r0 - bl FUN_0202CE64 - ldr r0, _0202E534 ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - mov r0, #0x33 - lsl r0, r0, #0x6 - ldr r0, [r1, r0] - bl FUN_0202CB70 - pop {r3, pc} - .balign 4 -_0202E534: .word UNK_021C59E8 - - thumb_func_start FUN_0202E538 -FUN_0202E538: ; 0x0202E538 - push {r3-r5, lr} - mov r4, #0x0 - ldr r2, _0202E564 ; =UNK_021C59E8 - ldr r0, _0202E568 ; =0x00000C84 - add r5, r4, #0x0 - add r1, r4, #0x0 -_0202E544: - ldr r3, [r2, #0x8] - add r4, r4, #0x1 - add r3, r3, r5 - add r5, r5, #0x2 - strh r1, [r3, r0] - cmp r4, #0x10 - blt _0202E544 - ldr r0, _0202E564 ; =UNK_021C59E8 - mov r2, #0x3 - ldr r0, [r0, #0x8] - lsl r2, r2, #0xa - add r0, #0x54 - bl MI_CpuFill8 - pop {r3-r5, pc} - nop -_0202E564: .word UNK_021C59E8 -_0202E568: .word 0x00000C84 - - thumb_func_start FUN_0202E56C -FUN_0202E56C: ; 0x0202E56C - push {r3-r4} - ldr r1, _0202E58C ; =UNK_021C59E8 - lsl r0, r0, #0x18 - ldr r2, [r1, #0x8] - ldr r4, _0202E590 ; =0x00000DAD - lsr r0, r0, #0x18 - ldrb r1, [r2, r4] - mov r3, #0x8 - lsl r0, r0, #0x1f - bic r1, r3 - lsr r0, r0, #0x1c - orr r0, r1 - strb r0, [r2, r4] - pop {r3-r4} - bx lr - nop -_0202E58C: .word UNK_021C59E8 -_0202E590: .word 0x00000DAD - - thumb_func_start FUN_0202E594 -FUN_0202E594: ; 0x0202E594 - push {r4-r5} - ldr r1, _0202E5F0 ; =UNK_021C59E8 - ldr r0, _0202E5F4 ; =0x00000CB4 - ldr r3, [r1, #0x8] - mov r2, #0x0 - strb r2, [r3, r0] - add r3, r0, #0x0 - ldr r5, [r1, #0x8] - add r3, #0xf9 - ldrb r4, [r5, r3] - mov r3, #0x1 - bic r4, r3 - add r3, r0, #0x0 - add r3, #0xf9 - strb r4, [r5, r3] - add r3, r0, #0x0 - ldr r5, [r1, #0x8] - add r3, #0xf9 - ldrb r4, [r5, r3] - mov r3, #0x4 - bic r4, r3 - add r3, r0, #0x0 - add r3, #0xf9 - strb r4, [r5, r3] - add r3, r0, #0x0 - ldr r4, [r1, #0x8] - add r3, #0xf6 - strb r2, [r4, r3] - add r3, r0, #0x0 - ldr r5, [r1, #0x8] - add r3, #0xf9 - ldrb r4, [r5, r3] - mov r3, #0x10 - bic r4, r3 - add r3, r0, #0x0 - add r3, #0xf9 - strb r4, [r5, r3] - add r3, r0, #0x0 - ldr r4, [r1, #0x8] - add r3, #0xf8 - strb r2, [r4, r3] - ldr r1, [r1, #0x8] - add r0, #0xf7 - strb r2, [r1, r0] - pop {r4-r5} - bx lr - .balign 4 -_0202E5F0: .word UNK_021C59E8 -_0202E5F4: .word 0x00000CB4 - - thumb_func_start FUN_0202E5F8 -FUN_0202E5F8: ; 0x0202E5F8 - push {r3-r5, lr} - add r5, r1, #0x0 - add r4, r2, #0x0 - bl FUN_0202E594 - add r0, r5, #0x0 - bl FUN_0202E56C - bl FUN_0202D2F4 - ldr r0, _0202E65C ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202E660 ; =0x00000DAB - ldrb r0, [r1, r0] - cmp r0, #0x0 - bne _0202E62A - ldr r0, _0202E664 ; =FUN_020303BC - mov r1, #0xe - bl FUN_0202D0A0 - ldr r0, _0202E65C ; =UNK_021C59E8 - mov r2, #0x1 - ldr r1, [r0, #0x8] - ldr r0, _0202E660 ; =0x00000DAB - strb r2, [r1, r0] -_0202E62A: - ldr r0, _0202E65C ; =UNK_021C59E8 - ldr r3, _0202E668 ; =0x00000DAD - ldr r1, [r0, #0x8] - mov r2, #0x20 - ldrb r0, [r1, r3] - bic r0, r2 - lsl r2, r4, #0x18 - lsr r2, r2, #0x18 - lsl r2, r2, #0x1f - lsr r2, r2, #0x1a - orr r0, r2 - strb r0, [r1, r3] - bl FUN_0202CBD4 - cmp r0, #0x1 - bne _0202E656 - bl FUN_0202CBFC - cmp r0, #0x0 - beq _0202E656 - mov r0, #0x1 - pop {r3-r5, pc} -_0202E656: - mov r0, #0x0 - pop {r3-r5, pc} - nop -_0202E65C: .word UNK_021C59E8 -_0202E660: .word 0x00000DAB -_0202E664: .word FUN_020303BC -_0202E668: .word 0x00000DAD - - thumb_func_start FUN_0202E66C -FUN_0202E66C: ; 0x0202E66C - push {r4, lr} - sub sp, #0x8 - add r4, r1, #0x0 - bl FUN_0202E594 - cmp r4, #0x0 - beq _0202E67E - bl FUN_0202E538 -_0202E67E: - ldr r0, _0202E6DC ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202E6E0 ; =0x00000DAB - ldrb r0, [r1, r0] - cmp r0, #0x0 - bne _0202E69C - ldr r0, _0202E6E4 ; =FUN_02030238 - mov r1, #0xe - bl FUN_0202D0A0 - ldr r0, _0202E6DC ; =UNK_021C59E8 - mov r2, #0x1 - ldr r1, [r0, #0x8] - ldr r0, _0202E6E0 ; =0x00000DAB - strb r2, [r1, r0] -_0202E69C: - bl FUN_0202CBD4 - cmp r0, #0x1 - bne _0202E6D4 - ldr r2, _0202E6E8 ; =UNK_020EEC40 - add r0, sp, #0x0 - ldrb r3, [r2, #0x0] - add r1, sp, #0x0 - strb r3, [r0, #0x0] - ldrb r3, [r2, #0x1] - strb r3, [r0, #0x1] - ldrb r3, [r2, #0x2] - strb r3, [r0, #0x2] - ldrb r3, [r2, #0x3] - strb r3, [r0, #0x3] - ldrb r3, [r2, #0x4] - ldrb r2, [r2, #0x5] - strb r3, [r0, #0x4] - strb r2, [r0, #0x5] - ldr r0, _0202E6EC ; =FUN_0202E380 - mov r2, #0x0 - bl FUN_0202C570 - cmp r0, #0x0 - beq _0202E6D4 - add sp, #0x8 - mov r0, #0x1 - pop {r4, pc} -_0202E6D4: - mov r0, #0x0 - add sp, #0x8 - pop {r4, pc} - nop -_0202E6DC: .word UNK_021C59E8 -_0202E6E0: .word 0x00000DAB -_0202E6E4: .word FUN_02030238 -_0202E6E8: .word UNK_020EEC40 -_0202E6EC: .word FUN_0202E380 - - thumb_func_start FUN_0202E6F0 -FUN_0202E6F0: ; 0x0202E6F0 - push {r3, lr} - ldr r0, _0202E77C ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - cmp r1, #0x0 - bne _0202E6FE - mov r0, #0x1 - pop {r3, pc} -_0202E6FE: - ldr r0, _0202E780 ; =0x00000DAC - ldrb r0, [r1, r0] - cmp r0, #0x0 - beq _0202E710 - cmp r0, #0x1 - beq _0202E740 - cmp r0, #0x2 - beq _0202E758 - b _0202E776 -_0202E710: - bl FUN_0202D21C - cmp r0, #0x0 - beq _0202E728 - bl FUN_0202C770 - ldr r0, _0202E77C ; =UNK_021C59E8 - mov r2, #0x1 - ldr r1, [r0, #0x8] - ldr r0, _0202E780 ; =0x00000DAC - strb r2, [r1, r0] - b _0202E776 -_0202E728: - bl FUN_0202D1E4 - cmp r0, #0x0 - bne _0202E776 - bl FUN_0202D100 - ldr r0, _0202E77C ; =UNK_021C59E8 - mov r2, #0x2 - ldr r1, [r0, #0x8] - ldr r0, _0202E780 ; =0x00000DAC - strb r2, [r1, r0] - b _0202E776 -_0202E740: - bl FUN_0202D1E4 - cmp r0, #0x0 - bne _0202E776 - bl FUN_0202D100 - ldr r0, _0202E77C ; =UNK_021C59E8 - mov r2, #0x2 - ldr r1, [r0, #0x8] - ldr r0, _0202E780 ; =0x00000DAC - strb r2, [r1, r0] - b _0202E776 -_0202E758: - bl FUN_0202D1C8 - cmp r0, #0x0 - beq _0202E764 - mov r0, #0x1 - pop {r3, pc} -_0202E764: - bl FUN_0202D200 - cmp r0, #0x0 - beq _0202E776 - ldr r0, _0202E77C ; =UNK_021C59E8 - mov r2, #0x1 - ldr r1, [r0, #0x8] - ldr r0, _0202E780 ; =0x00000DAC - strb r2, [r1, r0] -_0202E776: - mov r0, #0x0 - pop {r3, pc} - nop -_0202E77C: .word UNK_021C59E8 -_0202E780: .word 0x00000DAC - - thumb_func_start FUN_0202E784 -FUN_0202E784: ; 0x0202E784 - push {r3, lr} - ldr r0, _0202E7A8 ; =UNK_021C59E8 - ldr r2, [r0, #0x8] - cmp r2, #0x0 - beq _0202E7A2 - ldr r0, _0202E7AC ; =0x00000DAA - ldrb r1, [r2, r0] - cmp r1, #0x0 - bne _0202E7A2 - mov r1, #0x1 - strb r1, [r2, r0] - bl FUN_0202D100 - mov r0, #0x1 - pop {r3, pc} -_0202E7A2: - mov r0, #0x0 - pop {r3, pc} - nop -_0202E7A8: .word UNK_021C59E8 -_0202E7AC: .word 0x00000DAA - - thumb_func_start FUN_0202E7B0 -FUN_0202E7B0: ; 0x0202E7B0 - push {r3, lr} - ldr r1, _0202E7D0 ; =UNK_021C59E8 - ldr r2, [r1, #0x8] - cmp r2, #0x0 - beq _0202E7CE - cmp r0, #0x0 - ldr r0, _0202E7D4 ; =0x00000DAA - beq _0202E7C6 - mov r1, #0x2 - strb r1, [r2, r0] - pop {r3, pc} -_0202E7C6: - mov r1, #0x0 - strb r1, [r2, r0] - bl FUN_0202E500 -_0202E7CE: - pop {r3, pc} - .balign 4 -_0202E7D0: .word UNK_021C59E8 -_0202E7D4: .word 0x00000DAA - - thumb_func_start FUN_0202E7D8 -FUN_0202E7D8: ; 0x0202E7D8 - push {r3, lr} - ldr r0, _0202E804 ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202E808 ; =0x00000CBC - ldr r0, [r1, r0] - bl FreeToHeap - ldr r0, _0202E804 ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202E80C ; =0x00000CA4 - ldr r0, [r1, r0] - bl FreeToHeap - ldr r0, _0202E804 ; =UNK_021C59E8 - ldr r0, [r0, #0x8] - bl FreeToHeap - ldr r0, _0202E804 ; =UNK_021C59E8 - mov r1, #0x0 - str r1, [r0, #0x8] - pop {r3, pc} - nop -_0202E804: .word UNK_021C59E8 -_0202E808: .word 0x00000CBC -_0202E80C: .word 0x00000CA4 - - thumb_func_start FUN_0202E810 -FUN_0202E810: ; 0x0202E810 - push {r4, lr} - bl FUN_02030F40 - cmp r0, #0x0 - bne _0202E81E - mov r0, #0x0 - pop {r4, pc} -_0202E81E: - ldr r1, _0202E83C ; =UNK_021C59E8 - mov r0, #0x0 - ldr r4, [r1, #0x8] - ldr r1, _0202E840 ; =0x00000C84 - add r3, r0, #0x0 -_0202E828: - ldrh r2, [r4, r1] - cmp r2, #0x0 - beq _0202E830 - add r0, r0, #0x1 -_0202E830: - add r3, r3, #0x1 - add r4, r4, #0x2 - cmp r3, #0x10 - blt _0202E828 - pop {r4, pc} - nop -_0202E83C: .word UNK_021C59E8 -_0202E840: .word 0x00000C84 - - thumb_func_start FUN_0202E844 -FUN_0202E844: ; 0x0202E844 - push {r3-r5, lr} - ldr r1, _0202E870 ; =UNK_021C59E8 - mov r4, #0x0 - ldr r5, [r1, #0x8] - ldr r1, _0202E874 ; =0x00000C84 - add r3, r4, #0x0 -_0202E850: - ldrh r2, [r5, r1] - cmp r2, #0x0 - beq _0202E860 - cmp r4, r0 - bne _0202E85E - add r0, r3, #0x0 - pop {r3-r5, pc} -_0202E85E: - add r4, r4, #0x1 -_0202E860: - add r3, r3, #0x1 - add r5, r5, #0x2 - cmp r3, #0x10 - blt _0202E850 - bl ErrorHandling - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 -_0202E870: .word UNK_021C59E8 -_0202E874: .word 0x00000C84 - - thumb_func_start FUN_0202E878 -FUN_0202E878: ; 0x0202E878 - ldr r0, _0202E884 ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202E888 ; =0x00000CB4 - ldrb r0, [r1, r0] - bx lr - nop -_0202E884: .word UNK_021C59E8 -_0202E888: .word 0x00000CB4 - - thumb_func_start FUN_0202E88C -FUN_0202E88C: ; 0x0202E88C - ldr r0, _0202E898 ; =UNK_021C59E8 - mov r2, #0x0 - ldr r1, [r0, #0x8] - ldr r0, _0202E89C ; =0x00000CB4 - strb r2, [r1, r0] - bx lr - .balign 4 -_0202E898: .word UNK_021C59E8 -_0202E89C: .word 0x00000CB4 - - thumb_func_start FUN_0202E8A0 -FUN_0202E8A0: ; 0x0202E8A0 - ldr r1, _0202E8C8 ; =UNK_021C59E8 - ldr r3, [r1, #0x8] - lsl r1, r0, #0x1 - add r2, r3, r1 - ldr r1, _0202E8CC ; =0x00000C84 - ldrh r1, [r2, r1] - cmp r1, #0x0 - beq _0202E8C2 - mov r1, #0xc0 - mul r1, r0 - add r0, r3, r1 - add r0, #0xaa - ldrb r0, [r0, #0x0] - cmp r0, #0x0 - bne _0202E8C4 - mov r0, #0x1 - bx lr -_0202E8C2: - mov r0, #0x0 -_0202E8C4: - bx lr - nop -_0202E8C8: .word UNK_021C59E8 -_0202E8CC: .word 0x00000C84 - - thumb_func_start FUN_0202E8D0 -FUN_0202E8D0: ; 0x0202E8D0 - push {r3-r5, lr} - add r5, r0, #0x0 - mov r4, #0xf -_0202E8D6: - add r0, r4, #0x0 - bl FUN_0202E8A0 - cmp r0, r5 - ble _0202E8E8 - cmp r0, #0x8 - bge _0202E8E8 - add r0, r4, #0x0 - pop {r3-r5, pc} -_0202E8E8: - sub r4, r4, #0x1 - bpl _0202E8D6 - mov r0, #0x0 - mvn r0, r0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_0202E8F4 -FUN_0202E8F4: ; 0x0202E8F4 - push {r3-r7, lr} - bl FUN_0202E810 - cmp r0, #0x0 - bne _0202E904 - mov r0, #0x0 - mvn r0, r0 - pop {r3-r7, pc} -_0202E904: - mov r5, #0x2d - ldr r7, _0202E948 ; =UNK_021C59E8 - mov r6, #0xf - mov r4, #0x1e - lsl r5, r5, #0x6 -_0202E90E: - ldr r0, [r7, #0x8] - ldr r1, _0202E94C ; =0x00000C84 - add r2, r0, r4 - ldrh r1, [r2, r1] - cmp r1, #0x0 - beq _0202E938 - add r0, #0x58 - add r0, r0, r5 - bl FUN_0202EFE4 - cmp r0, #0x0 - beq _0202E938 - add r0, r6, #0x0 - bl FUN_0202E8A0 - cmp r0, #0x1 - ble _0202E938 - cmp r0, #0x8 - bge _0202E938 - add r0, r6, #0x0 - pop {r3-r7, pc} -_0202E938: - sub r4, r4, #0x2 - sub r5, #0xc0 - sub r6, r6, #0x1 - bpl _0202E90E - mov r0, #0x0 - mvn r0, r0 - pop {r3-r7, pc} - nop -_0202E948: .word UNK_021C59E8 -_0202E94C: .word 0x00000C84 - - thumb_func_start FUN_0202E950 -FUN_0202E950: ; 0x0202E950 - push {r3-r7, lr} - bl FUN_0202E810 - cmp r0, #0x0 - bne _0202E960 - mov r0, #0x0 - mvn r0, r0 - pop {r3-r7, pc} -_0202E960: - mov r5, #0x2d - ldr r7, _0202E9A4 ; =UNK_021C59E8 - mov r6, #0xf - mov r4, #0x1e - lsl r5, r5, #0x6 -_0202E96A: - ldr r0, [r7, #0x8] - ldr r1, _0202E9A8 ; =0x00000C84 - add r2, r0, r4 - ldrh r1, [r2, r1] - cmp r1, #0x0 - beq _0202E986 - add r0, #0x58 - add r0, r0, r5 - bl FUN_0202EFE4 - cmp r0, #0x0 - beq _0202E986 - add r0, r6, #0x0 - pop {r3-r7, pc} -_0202E986: - sub r4, r4, #0x2 - sub r5, #0xc0 - sub r6, r6, #0x1 - bpl _0202E96A - mov r0, #0x1 - bl FUN_0202E8D0 - mov r1, #0x0 - mvn r1, r1 - cmp r0, r1 - bne _0202E9A2 - mov r0, #0x0 - bl FUN_0202E8D0 -_0202E9A2: - pop {r3-r7, pc} - .balign 4 -_0202E9A4: .word UNK_021C59E8 -_0202E9A8: .word 0x00000C84 - - thumb_func_start FUN_0202E9AC -FUN_0202E9AC: ; 0x0202E9AC - push {r4-r6, lr} - add r4, r1, #0x0 - ldr r1, _0202E9E0 ; =UNK_021C59E8 - mov r5, #0x0 - ldr r6, [r1, #0x8] - ldr r1, _0202E9E4 ; =0x00000C84 - add r3, r5, #0x0 -_0202E9BA: - ldrh r2, [r6, r1] - cmp r2, #0x0 - beq _0202E9D4 - cmp r0, r5 - bne _0202E9D2 - add r0, r3, #0x0 - bl FUN_0202EF84 - add r1, r4, #0x0 - bl PlayerProfile_Copy - pop {r4-r6, pc} -_0202E9D2: - add r5, r5, #0x1 -_0202E9D4: - add r3, r3, #0x1 - add r6, r6, #0x2 - cmp r3, #0x10 - blt _0202E9BA - pop {r4-r6, pc} - nop -_0202E9E0: .word UNK_021C59E8 -_0202E9E4: .word 0x00000C84 - - thumb_func_start FUN_0202E9E8 -FUN_0202E9E8: ; 0x0202E9E8 - push {r3-r5, lr} - add r5, r0, #0x0 - bl FUN_0202CBD4 - cmp r0, #0x2 - bne _0202E9FC - bl FUN_0202C770 - mov r0, #0x0 - pop {r3-r5, pc} -_0202E9FC: - bl FUN_0202CBD4 - cmp r0, #0x1 - bne _0202EA48 - bl FUN_02033534 - mov r1, #0xc0 - add r4, r5, #0x0 - mul r4, r1 - ldr r1, _0202EA4C ; =UNK_021C59E8 - ldr r3, [r1, #0x8] - add r1, r3, r4 - add r1, #0x8a - ldrh r2, [r1, #0x0] - ldr r1, _0202EA50 ; =0x00000DA8 - strb r2, [r3, r1] - bl FUN_0202D8B0 - cmp r0, #0x0 - beq _0202EA36 - ldr r1, _0202EA4C ; =UNK_021C59E8 - mov r0, #0x1 - ldr r1, [r1, #0x8] - mov r2, #0x0 - add r1, #0x58 - add r1, r1, r4 - bl FUN_0202C4D8 - b _0202EA44 -_0202EA36: - ldr r1, _0202EA4C ; =UNK_021C59E8 - mov r0, #0x1 - ldr r1, [r1, #0x8] - add r1, #0x54 - add r1, r1, r4 - bl FUN_0202D034 -_0202EA44: - mov r0, #0x1 - pop {r3-r5, pc} -_0202EA48: - mov r0, #0x0 - pop {r3-r5, pc} - .balign 4 -_0202EA4C: .word UNK_021C59E8 -_0202EA50: .word 0x00000DA8 - - thumb_func_start FUN_0202EA54 -FUN_0202EA54: ; 0x0202EA54 - push {r4-r7} - mov r4, #0x0 - ldr r1, _0202EA90 ; =UNK_021C59E8 - ldr r0, _0202EA94 ; =0x00000C84 - add r5, r4, #0x0 - mov r2, #0x1 -_0202EA60: - ldr r3, [r1, #0x8] - add r3, r3, r5 - ldrh r6, [r3, r0] - cmp r6, #0x0 - beq _0202EA84 - beq _0202EA84 - ldr r6, _0202EA94 ; =0x00000C84 - ldrh r6, [r3, r6] - sub r7, r6, #0x1 - ldr r6, _0202EA94 ; =0x00000C84 - strh r7, [r3, r6] - ldr r3, [r1, #0x8] - add r7, r3, r5 - ldrh r6, [r7, r6] - cmp r6, #0x0 - bne _0202EA84 - ldr r6, _0202EA98 ; =0x00000CB4 - strb r2, [r3, r6] -_0202EA84: - add r4, r4, #0x1 - add r5, r5, #0x2 - cmp r4, #0x10 - blt _0202EA60 - pop {r4-r7} - bx lr - .balign 4 -_0202EA90: .word UNK_021C59E8 -_0202EA94: .word 0x00000C84 -_0202EA98: .word 0x00000CB4 - - thumb_func_start FUN_0202EA9C -FUN_0202EA9C: ; 0x0202EA9C - push {r3-r5, lr} - bl FUN_02033534 - add r5, r0, #0x0 - bl FUN_0202EF70 - add r4, r0, #0x0 - cmp r5, #0xf - beq _0202EB24 - ldr r0, _0202EB6C ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202EB70 ; =0x00000CC4 - add r5, r1, r0 - bl FUN_02023AC4 - cmp r0, #0x20 - ble _0202EAC2 - bl ErrorHandling -_0202EAC2: - bl PlayerProfile_sizeof - cmp r0, #0x20 - beq _0202EACE - bl ErrorHandling -_0202EACE: - bl PlayerProfile_sizeof - add r1, r5, #0x0 - add r2, r0, #0x0 - add r0, r4, #0x0 - add r1, #0x10 - bl MI_CpuCopy8 - bl FUN_02023AC4 - add r2, r0, #0x0 - ldr r0, _0202EB6C ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202EB74 ; =0x00000CBC - ldr r0, [r1, r0] - add r1, r5, #0x0 - add r1, #0x30 - bl MI_CpuCopy8 - add r0, r4, #0x0 - bl PlayerProfile_GetTrainerID - str r0, [r5, #0x0] - bl FUN_02033534 - strb r0, [r5, #0x4] - bl FUN_0203354C - strb r0, [r5, #0x5] - ldr r0, _0202EB6C ; =UNK_021C59E8 - mov r2, #0x8 - ldr r1, [r0, #0x8] - ldr r0, _0202EB78 ; =0x00000CA8 - add r0, r1, r0 - add r1, r5, #0x0 - add r1, #0x8 - bl MI_CpuCopy8 - bl FUN_0202D358 - add r5, #0x54 - strb r0, [r5, #0x0] - b _0202EB4E -_0202EB24: - ldr r1, _0202EB6C ; =UNK_021C59E8 - ldr r4, [r1, #0x8] - ldr r1, _0202EB70 ; =0x00000CC4 - add r5, r4, r1 - bl PlayerProfile_GetTrainerID - ldr r1, _0202EB70 ; =0x00000CC4 - str r0, [r4, r1] - bl FUN_02033534 - strb r0, [r5, #0x4] - bl FUN_0203354C - strb r0, [r5, #0x5] - ldr r0, _0202EB6C ; =UNK_021C59E8 - add r5, #0x8 - ldr r0, [r0, #0x8] - add r1, r5, #0x0 - mov r2, #0x54 - bl MI_CpuCopy8 -_0202EB4E: - ldr r0, _0202EB6C ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202EB70 ; =0x00000CC4 - add r0, r1, r0 - mov r1, #0x5c - bl DC_FlushRange - ldr r0, _0202EB6C ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202EB70 ; =0x00000CC4 - add r0, r1, r0 - mov r1, #0x5c - bl FUN_0202CB7C - pop {r3-r5, pc} - .balign 4 -_0202EB6C: .word UNK_021C59E8 -_0202EB70: .word 0x00000CC4 -_0202EB74: .word 0x00000CBC -_0202EB78: .word 0x00000CA8 - - thumb_func_start FUN_0202EB7C -FUN_0202EB7C: ; 0x0202EB7C - push {r4, lr} - ldr r0, _0202EBC8 ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202EBCC ; =0x00000CC4 - add r4, r1, r0 - bl FUN_0202EDB8 - ldrb r1, [r4, #0x6] - cmp r1, r0 - beq _0202EBC6 - bl FUN_0202EDB8 - strb r0, [r4, #0x6] - ldr r0, _0202EBC8 ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202EBCC ; =0x00000CC4 - add r0, r1, r0 - mov r1, #0x5c - bl DC_FlushRange - ldr r0, _0202EBC8 ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202EBCC ; =0x00000CC4 - add r0, r1, r0 - mov r1, #0x5c - bl FUN_0202CB7C - ldr r3, _0202EBC8 ; =UNK_021C59E8 - ldr r2, _0202EBCC ; =0x00000CC4 - ldr r4, [r3, #0x8] - ldrh r3, [r3, #0x0] - add r0, r4, r2 - sub r2, r2, #0x4 - ldr r2, [r4, r2] - mov r1, #0x5c - bl FUN_0202D240 -_0202EBC6: - pop {r4, pc} - .balign 4 -_0202EBC8: .word UNK_021C59E8 -_0202EBCC: .word 0x00000CC4 - - thumb_func_start FUN_0202EBD0 -FUN_0202EBD0: ; 0x0202EBD0 - push {r3-r5, lr} - sub sp, #0x8 - add r4, r0, #0x0 - bl FUN_0202CBD4 - add r5, r0, #0x0 - bl FUN_0202DF54 - bl FUN_0202EB7C - bl FUN_0202D19C - cmp r0, #0x0 - bne _0202EC0C - bl FUN_0202EE24 - cmp r0, #0x0 - bne _0202EC0C - ldr r0, _0202ED50 ; =UNK_021C59E8 - ldr r2, [r0, #0x8] - ldr r0, _0202ED54 ; =0x00000DAD - ldrb r1, [r2, r0] - lsl r3, r1, #0x1d - lsr r3, r3, #0x1f - beq _0202EC0C - mov r3, #0x1 - bic r1, r3 - mov r3, #0x1 - orr r1, r3 - strb r1, [r2, r0] -_0202EC0C: - ldr r0, _0202ED50 ; =UNK_021C59E8 - ldr r1, _0202ED58 ; =0x0000FFFF - ldr r3, [r0, #0x8] - ldr r0, _0202ED5C ; =0x00000DA6 - ldrh r2, [r3, r0] - cmp r2, r1 - bne _0202EC1C - strh r4, [r3, r0] -_0202EC1C: - ldr r0, _0202ED50 ; =UNK_021C59E8 - ldr r2, [r0, #0x8] - ldr r0, _0202ED54 ; =0x00000DAD - ldrb r1, [r2, r0] - lsl r3, r1, #0x1e - lsr r3, r3, #0x1f - beq _0202EC3C - sub r3, r0, #0x7 - ldrh r3, [r2, r3] - cmp r3, r4 - bls _0202EC3C - mov r3, #0x1 - bic r1, r3 - mov r3, #0x1 - orr r1, r3 - strb r1, [r2, r0] -_0202EC3C: - bl FUN_0202CBE8 - cmp r0, #0x19 - bne _0202EC4A - mov r0, #0x0 - bl FUN_020335D0 -_0202EC4A: - cmp r5, #0x9 - bhi _0202ED4C - add r0, r5, r5 - add r0, pc - ldrh r0, [r0, #0x6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_0202EC5A: ; jump table (using 16-bit offset) - .short _0202EC6E - _0202EC5A - 2; case 0 - .short _0202EC8E - _0202EC5A - 2; case 1 - .short _0202ED4C - _0202EC5A - 2; case 2 - .short _0202ED4C - _0202EC5A - 2; case 3 - .short _0202ED4C - _0202EC5A - 2; case 4 - .short _0202ED4C - _0202EC5A - 2; case 5 - .short _0202ED4C - _0202EC5A - 2; case 6 - .short _0202ECD2 - _0202EC5A - 2; case 7 - .short _0202ECB8 - _0202EC5A - 2; case 8 - .short _0202ECB8 - _0202EC5A - 2; case 9 -_0202EC6E: - ldr r0, _0202ED50 ; =UNK_021C59E8 - ldr r2, [r0, #0x8] - ldr r0, _0202ED60 ; =0x00000DAA - ldrb r1, [r2, r0] - cmp r1, #0x1 - bne _0202EC82 - bl FUN_0202E7D8 - add sp, #0x8 - pop {r3-r5, pc} -_0202EC82: - cmp r1, #0x2 - bne _0202ED4C - mov r1, #0x3 - strb r1, [r2, r0] - add sp, #0x8 - pop {r3-r5, pc} -_0202EC8E: - ldr r0, _0202ED50 ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202ED60 ; =0x00000DAA - ldrb r0, [r1, r0] - cmp r0, #0x1 - bne _0202ECA2 - bl FUN_0202D178 - cmp r0, #0x0 - bne _0202ED4C -_0202ECA2: - ldr r0, _0202ED50 ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202ED60 ; =0x00000DAA - ldrb r0, [r1, r0] - cmp r0, #0x2 - bne _0202ED4C - bl FUN_0202D178 - add sp, #0x8 - cmp r0, #0x0 - pop {r3-r5, pc} -_0202ECB8: - ldr r0, _0202ED50 ; =UNK_021C59E8 - ldr r3, [r0, #0x8] - cmp r3, #0x0 - beq _0202ED4C - ldr r1, _0202ED54 ; =0x00000DAD - mov r0, #0x1 - ldrb r2, [r3, r1] - add sp, #0x8 - bic r2, r0 - mov r0, #0x1 - orr r0, r2 - strb r0, [r3, r1] - pop {r3-r5, pc} -_0202ECD2: - bl FUN_0202CDA4 - ldr r3, _0202ED50 ; =UNK_021C59E8 - ldr r2, _0202ED64 ; =0x00000DA9 - ldr r4, [r3, #0x8] - ldrb r1, [r4, r2] - cmp r1, #0x0 - bne _0202ECEE - sub r1, r2, #0x5 - strh r0, [r4, r1] - ldr r0, [r3, #0x8] - mov r1, #0x5 - strb r1, [r0, r2] - b _0202ECF2 -_0202ECEE: - sub r0, r1, #0x1 - strb r0, [r4, r2] -_0202ECF2: - ldr r1, _0202ED50 ; =UNK_021C59E8 - ldr r0, _0202ED68 ; =0x00000DA4 - ldr r2, [r1, #0x8] - ldrh r5, [r2, r0] - add r0, #0x9 - ldrb r0, [r2, r0] - lsl r0, r0, #0x1c - lsr r0, r0, #0x1f - beq _0202ED0A - ldrh r0, [r1, #0x0] - add r0, r0, #0x1 - strh r0, [r1, #0x0] -_0202ED0A: - bl FUN_0202EA9C - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202D858 - add r4, r0, #0x0 - bl FUN_02033534 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202EEE8 - str r0, [sp, #0x0] - ldr r1, _0202ED50 ; =UNK_021C59E8 - ldr r0, _0202ED54 ; =0x00000DAD - ldr r2, [r1, #0x8] - add r3, r4, #0x0 - ldrb r0, [r2, r0] - add r2, r5, #0x0 - lsl r0, r0, #0x1a - lsr r0, r0, #0x1f - str r0, [sp, #0x4] - ldrh r1, [r1, #0x0] - mov r0, #0x0 - bl FUN_0202CF84 - ldr r0, _0202ED50 ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202ED6C ; =0x00000DA8 - strb r5, [r1, r0] -_0202ED4C: - add sp, #0x8 - pop {r3-r5, pc} - .balign 4 -_0202ED50: .word UNK_021C59E8 -_0202ED54: .word 0x00000DAD -_0202ED58: .word 0x0000FFFF -_0202ED5C: .word 0x00000DA6 -_0202ED60: .word 0x00000DAA -_0202ED64: .word 0x00000DA9 -_0202ED68: .word 0x00000DA4 -_0202ED6C: .word 0x00000DA8 - - thumb_func_start FUN_0202ED70 -FUN_0202ED70: ; 0x0202ED70 - push {r3, lr} - ldr r1, _0202ED80 ; =UNK_021C59E8 - ldr r1, [r1, #0x8] - cmp r1, #0x0 - beq _0202ED7E - bl FUN_0202EBD0 -_0202ED7E: - pop {r3, pc} - .balign 4 -_0202ED80: .word UNK_021C59E8 - - thumb_func_start FUN_0202ED84 -FUN_0202ED84: ; 0x0202ED84 - push {r4, lr} - add r4, r0, #0x0 - ldr r0, _0202EDB4 ; =UNK_021C59E8 - ldr r0, [r0, #0x8] - cmp r0, #0x0 - bne _0202ED94 - mov r0, #0x0 - pop {r4, pc} -_0202ED94: - bl FUN_0202CBD4 - cmp r0, #0x4 - beq _0202EDA0 - mov r0, #0x0 - pop {r4, pc} -_0202EDA0: - bl FUN_0202CB8C - mov r2, #0x1 - add r1, r2, #0x0 - lsl r1, r4 - tst r0, r1 - bne _0202EDB0 - mov r2, #0x0 -_0202EDB0: - add r0, r2, #0x0 - pop {r4, pc} - .balign 4 -_0202EDB4: .word UNK_021C59E8 - - thumb_func_start FUN_0202EDB8 -FUN_0202EDB8: ; 0x0202EDB8 - push {r3-r5, lr} - mov r4, #0x0 - add r5, r4, #0x0 -_0202EDBE: - lsl r0, r5, #0x10 - lsr r0, r0, #0x10 - bl FUN_0202ED84 - cmp r0, #0x0 - beq _0202EDCC - add r4, r4, #0x1 -_0202EDCC: - add r5, r5, #0x1 - cmp r5, #0x8 - blt _0202EDBE - add r0, r4, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_0202EDD8 -FUN_0202EDD8: ; 0x0202EDD8 - ldr r0, _0202EDF0 ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - cmp r1, #0x0 - beq _0202EDEC - ldr r0, _0202EDF4 ; =0x00000DAA - ldrb r0, [r1, r0] - cmp r0, #0x3 - bne _0202EDEC - mov r0, #0x1 - bx lr -_0202EDEC: - mov r0, #0x0 - bx lr - .balign 4 -_0202EDF0: .word UNK_021C59E8 -_0202EDF4: .word 0x00000DAA - - thumb_func_start FUN_0202EDF8 -FUN_0202EDF8: ; 0x0202EDF8 - ldr r0, _0202EE08 ; =UNK_021C59E8 - ldr r0, [r0, #0x8] - cmp r0, #0x0 - beq _0202EE04 - mov r0, #0x1 - bx lr -_0202EE04: - mov r0, #0x0 - bx lr - .balign 4 -_0202EE08: .word UNK_021C59E8 - - thumb_func_start FUN_0202EE0C -FUN_0202EE0C: ; 0x0202EE0C - push {r3, lr} - ldr r0, _0202EE20 ; =UNK_021C59E8 - ldr r0, [r0, #0x8] - cmp r0, #0x0 - beq _0202EE1C - bl FUN_0202D1C8 - pop {r3, pc} -_0202EE1C: - mov r0, #0x1 - pop {r3, pc} - .balign 4 -_0202EE20: .word UNK_021C59E8 - - thumb_func_start FUN_0202EE24 -FUN_0202EE24: ; 0x0202EE24 - push {r3, lr} - ldr r0, _0202EE3C ; =UNK_021C59E8 - ldr r0, [r0, #0x8] - cmp r0, #0x0 - beq _0202EE38 - bl FUN_0202CB8C - ldr r1, _0202EE40 ; =0x0000FFFE - and r0, r1 - pop {r3, pc} -_0202EE38: - mov r0, #0x0 - pop {r3, pc} - .balign 4 -_0202EE3C: .word UNK_021C59E8 -_0202EE40: .word 0x0000FFFE - - thumb_func_start FUN_0202EE44 -FUN_0202EE44: ; 0x0202EE44 - push {r3, lr} - bl FUN_0202EE60 - cmp r0, #0x0 - beq _0202EE5A - bl FUN_0202CBE8 - cmp r0, #0x14 - bne _0202EE5A - mov r0, #0x1 - pop {r3, pc} -_0202EE5A: - mov r0, #0x0 - pop {r3, pc} - .balign 4 - - thumb_func_start FUN_0202EE60 -FUN_0202EE60: ; 0x0202EE60 - ldr r0, _0202EE7C ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - cmp r1, #0x0 - beq _0202EE76 - ldr r0, _0202EE80 ; =0x00000DAD - ldrb r0, [r1, r0] - lsl r0, r0, #0x1f - lsr r0, r0, #0x1f - beq _0202EE76 - mov r0, #0x1 - bx lr -_0202EE76: - mov r0, #0x0 - bx lr - nop -_0202EE7C: .word UNK_021C59E8 -_0202EE80: .word 0x00000DAD - - thumb_func_start FUN_0202EE84 -FUN_0202EE84: ; 0x0202EE84 - push {r3-r4} - ldr r1, _0202EEA8 ; =UNK_021C59E8 - ldr r2, [r1, #0x8] - cmp r2, #0x0 - beq _0202EEA2 - ldr r4, _0202EEAC ; =0x00000DAD - lsl r0, r0, #0x18 - ldrb r1, [r2, r4] - lsr r0, r0, #0x18 - mov r3, #0x4 - lsl r0, r0, #0x1f - bic r1, r3 - lsr r0, r0, #0x1d - orr r0, r1 - strb r0, [r2, r4] -_0202EEA2: - pop {r3-r4} - bx lr - nop -_0202EEA8: .word UNK_021C59E8 -_0202EEAC: .word 0x00000DAD - - thumb_func_start FUN_0202EEB0 -FUN_0202EEB0: ; 0x0202EEB0 - push {r4-r5} - ldr r5, _0202EEDC ; =UNK_021C59E8 - ldr r2, [r5, #0x8] - cmp r2, #0x0 - beq _0202EED6 - ldr r4, _0202EEE0 ; =0x00000DAD - lsl r0, r0, #0x18 - ldrb r1, [r2, r4] - lsr r0, r0, #0x18 - mov r3, #0x2 - lsl r0, r0, #0x1f - bic r1, r3 - lsr r0, r0, #0x1e - orr r0, r1 - strb r0, [r2, r4] - ldr r2, _0202EEE4 ; =0x0000FFFF - ldr r1, [r5, #0x8] - sub r0, r4, #0x7 - strh r2, [r1, r0] -_0202EED6: - pop {r4-r5} - bx lr - nop -_0202EEDC: .word UNK_021C59E8 -_0202EEE0: .word 0x00000DAD -_0202EEE4: .word 0x0000FFFF - - thumb_func_start FUN_0202EEE8 -FUN_0202EEE8: ; 0x0202EEE8 - push {r3-r5, lr} - add r5, r0, #0x0 - bl WM_GetDispersionBeaconPeriod - add r4, r0, #0x0 - cmp r5, #0x1a - blo _0202EEFA - bl ErrorHandling -_0202EEFA: - cmp r5, #0xa - bne _0202EF04 - lsl r0, r4, #0xe - lsr r0, r0, #0x10 - pop {r3-r5, pc} -_0202EF04: - cmp r5, #0x9 - beq _0202EF0C - cmp r5, #0xd - bne _0202EF12 -_0202EF0C: - lsl r0, r4, #0xe - lsr r0, r0, #0x10 - pop {r3-r5, pc} -_0202EF12: - add r0, r4, #0x0 - pop {r3-r5, pc} - .balign 4 - - thumb_func_start FUN_0202EF18 -FUN_0202EF18: ; 0x0202EF18 - ldr r1, _0202EF3C ; =UNK_021C59E8 - ldr r3, [r1, #0x8] - cmp r3, #0x0 - beq _0202EF36 - lsl r1, r0, #0x1 - add r2, r3, r1 - ldr r1, _0202EF40 ; =0x00000C84 - ldrh r1, [r2, r1] - cmp r1, #0x0 - beq _0202EF36 - mov r1, #0xc0 - add r3, #0x54 - mul r1, r0 - add r0, r3, r1 - bx lr -_0202EF36: - mov r0, #0x0 - bx lr - nop -_0202EF3C: .word UNK_021C59E8 -_0202EF40: .word 0x00000C84 - - thumb_func_start FUN_0202EF44 -FUN_0202EF44: ; 0x0202EF44 - ldr r1, _0202EF68 ; =UNK_021C59E8 - ldr r3, [r1, #0x8] - cmp r3, #0x0 - beq _0202EF62 - lsl r1, r0, #0x1 - add r2, r3, r1 - ldr r1, _0202EF6C ; =0x00000C84 - ldrh r1, [r2, r1] - cmp r1, #0x0 - beq _0202EF62 - mov r1, #0xc0 - add r3, #0xa4 - mul r1, r0 - add r0, r3, r1 - bx lr -_0202EF62: - mov r0, #0x0 - bx lr - nop -_0202EF68: .word UNK_021C59E8 -_0202EF6C: .word 0x00000C84 - - thumb_func_start FUN_0202EF70 -FUN_0202EF70: ; 0x0202EF70 - ldr r0, _0202EF7C ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - ldr r0, _0202EF80 ; =0x00000CB8 - ldr r0, [r1, r0] - bx lr - nop -_0202EF7C: .word UNK_021C59E8 -_0202EF80: .word 0x00000CB8 - - thumb_func_start FUN_0202EF84 -FUN_0202EF84: ; 0x0202EF84 - ldr r1, _0202EFA4 ; =UNK_021C59E8 - ldr r3, [r1, #0x8] - lsl r1, r0, #0x1 - add r2, r3, r1 - ldr r1, _0202EFA8 ; =0x00000C84 - ldrh r1, [r2, r1] - cmp r1, #0x0 - bne _0202EF98 - mov r0, #0x0 - bx lr -_0202EF98: - mov r1, #0xc0 - add r3, #0xa4 - mul r1, r0 - add r0, r3, r1 - add r0, #0x10 - bx lr - .balign 4 -_0202EFA4: .word UNK_021C59E8 -_0202EFA8: .word 0x00000C84 - - thumb_func_start FUN_0202EFAC -FUN_0202EFAC: ; 0x0202EFAC - push {r3-r5, lr} - add r5, r0, #0x0 - ldr r0, _0202EFDC ; =UNK_021C59E8 - add r4, r1, #0x0 - ldr r0, [r0, #0x8] - cmp r0, #0x0 - beq _0202EFD8 - cmp r4, #0x8 - blt _0202EFC2 - bl ErrorHandling -_0202EFC2: - ldr r1, _0202EFDC ; =UNK_021C59E8 - add r0, r5, #0x0 - ldr r2, [r1, #0x8] - ldr r1, _0202EFE0 ; =0x00000C54 - add r3, r2, r1 - mov r2, #0x6 - add r1, r4, #0x0 - mul r1, r2 - add r1, r3, r1 - bl MI_CpuCopy8 -_0202EFD8: - pop {r3-r5, pc} - nop -_0202EFDC: .word UNK_021C59E8 -_0202EFE0: .word 0x00000C54 - - thumb_func_start FUN_0202EFE4 -FUN_0202EFE4: ; 0x0202EFE4 - push {r4-r5} - ldr r2, _0202F034 ; =UNK_021C59E8 - mov r1, #0x0 - ldr r3, [r2, #0x8] - ldr r2, _0202F038 ; =0x00000C54 - add r2, r3, r2 - ldrb r3, [r0, #0x0] -_0202EFF2: - ldrb r4, [r2, #0x0] - cmp r4, r3 - bne _0202F026 - ldrb r5, [r2, #0x1] - ldrb r4, [r0, #0x1] - cmp r5, r4 - bne _0202F026 - ldrb r5, [r2, #0x2] - ldrb r4, [r0, #0x2] - cmp r5, r4 - bne _0202F026 - ldrb r5, [r2, #0x3] - ldrb r4, [r0, #0x3] - cmp r5, r4 - bne _0202F026 - ldrb r5, [r2, #0x4] - ldrb r4, [r0, #0x4] - cmp r5, r4 - bne _0202F026 - ldrb r5, [r2, #0x5] - ldrb r4, [r0, #0x5] - cmp r5, r4 - bne _0202F026 - mov r0, #0x1 - pop {r4-r5} - bx lr -_0202F026: - add r1, r1, #0x1 - add r2, r2, #0x6 - cmp r1, #0x8 - blt _0202EFF2 - mov r0, #0x0 - pop {r4-r5} - bx lr - .balign 4 -_0202F034: .word UNK_021C59E8 -_0202F038: .word 0x00000C54 - - thumb_func_start FUN_0202F03C -FUN_0202F03C: ; 0x0202F03C - ldr r0, _0202F054 ; =UNK_021C59E8 - ldr r1, [r0, #0x8] - cmp r1, #0x0 - beq _0202F04E - ldr r0, _0202F058 ; =0x00000DAD - ldrb r0, [r1, r0] - lsl r0, r0, #0x1b - lsr r0, r0, #0x1f - bx lr -_0202F04E: - mov r0, #0x0 - bx lr - nop -_0202F054: .word UNK_021C59E8 -_0202F058: .word 0x00000DAD - - thumb_func_start FUN_0202F05C -FUN_0202F05C: ; 0x0202F05C - ldr r0, _0202F070 ; =UNK_021C59E8 - ldr r3, [r0, #0x8] - cmp r3, #0x0 - beq _0202F06E - ldr r1, _0202F074 ; =0x00000DAD - mov r0, #0x10 - ldrb r2, [r3, r1] - orr r0, r2 - strb r0, [r3, r1] -_0202F06E: - bx lr - .balign 4 -_0202F070: .word UNK_021C59E8 -_0202F074: .word 0x00000DAD - - thumb_func_start FUN_0202F078 -FUN_0202F078: ; 0x0202F078 - ldr r1, _0202F088 ; =UNK_021C59E8 - ldr r3, _0202F08C ; =MI_CpuCopy8 - ldr r2, [r1, #0x8] - ldr r1, _0202F090 ; =0x00000CA8 - add r1, r2, r1 - mov r2, #0x8 - bx r3 - nop -_0202F088: .word UNK_021C59E8 -_0202F08C: .word MI_CpuCopy8 -_0202F090: .word 0x00000CA8 - - thumb_func_start FUN_0202F094 -FUN_0202F094: ; 0x0202F094 - push {r4, lr} - add r4, r0, #0x0 - bl FUN_02023AC4 - ldr r1, _0202F0B0 ; =UNK_021C59E8 - add r2, r0, #0x0 - ldr r3, [r1, #0x8] - ldr r1, _0202F0B4 ; =0x00000CBC - add r0, r4, #0x0 - ldr r1, [r3, r1] - bl MI_CpuCopy8 - pop {r4, pc} - nop -_0202F0B0: .word UNK_021C59E8 -_0202F0B4: .word 0x00000CBC - - thumb_func_start FUN_0202F0B8 -FUN_0202F0B8: ; 0x0202F0B8 - push {r4, lr} - bl FUN_0202EA9C - ldr r3, _0202F0D4 ; =UNK_021C59E8 - ldr r2, _0202F0D8 ; =0x00000CC4 - ldr r4, [r3, #0x8] - ldrh r3, [r3, #0x0] - add r0, r4, r2 - sub r2, r2, #0x4 - ldr r2, [r4, r2] - mov r1, #0x5c - bl FUN_0202D240 - pop {r4, pc} - .balign 4 -_0202F0D4: .word UNK_021C59E8 -_0202F0D8: .word 0x00000CC4 - - thumb_func_start FUN_0202F0DC -FUN_0202F0DC: ; 0x0202F0DC - push {r4-r6, lr} - mov r5, #0x0 - add r6, r0, #0x0 - add r4, r5, #0x0 -_0202F0E4: - add r0, r4, #0x0 - bl FUN_0202EF44 - cmp r0, #0x0 - beq _0202F0F8 - ldrb r1, [r0, #0x4] - cmp r1, r6 - bne _0202F0F8 - ldrb r0, [r0, #0x6] - add r5, r5, r0 -_0202F0F8: - add r4, r4, #0x1 - cmp r4, #0x10 - blt _0202F0E4 - add r0, r5, #0x0 - pop {r4-r6, pc} - .balign 4 - - thumb_func_start FUN_0202F104 -FUN_0202F104: ; 0x0202F104 - ldr r3, _0202F108 ; =FUN_0202D2D0 - bx r3 - .balign 4 -_0202F108: .word FUN_0202D2D0 - - thumb_func_start FUN_0202F10C -FUN_0202F10C: ; 0x0202F10C - push {r3, lr} - ldr r1, _0202F120 ; =UNK_021C59E8 - mov r2, #0x54 - ldr r1, [r1, #0x8] - bl MI_CpuCopy8 - bl FUN_0202F0B8 - pop {r3, pc} - nop -_0202F120: .word UNK_021C59E8 - - thumb_func_start FUN_0202F124 -FUN_0202F124: ; 0x0202F124 - ldr r1, _0202F148 ; =UNK_021C59E8 - ldr r3, [r1, #0x8] - cmp r3, #0x0 - beq _0202F144 - lsl r1, r0, #0x1 - add r2, r3, r1 - ldr r1, _0202F14C ; =0x00000C84 - ldrh r1, [r2, r1] - cmp r1, #0x0 - beq _0202F144 - mov r1, #0xc0 - add r3, #0xa4 - mul r1, r0 - add r0, r3, r1 - add r0, #0x8 - bx lr -_0202F144: - mov r0, #0x0 - bx lr - .balign 4 -_0202F148: .word UNK_021C59E8 -_0202F14C: .word 0x00000C84 diff --git a/arm9/src/unk_0202E29C.c b/arm9/src/unk_0202E29C.c new file mode 100644 index 00000000..678f6fe3 --- /dev/null +++ b/arm9/src/unk_0202E29C.c @@ -0,0 +1,1110 @@ +#include "global.h" +#include "unk_0202E29C.h" +#include "MI_memory.h" +#include "OS_cache.h" +#include "game_init.h" +#include "heap.h" +#include "mail_message.h" +#include "player_data.h" +#include "unk_0202D858.h" +#include "unk_0202F150.h" +#include "unk_02031734.h" + +struct UnkStruct_const +{ + u8 unk0[6]; +}; + +const struct UnkStruct_const UNK_020EEC40 = { { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } }; + +struct +{ + u16 unk0; + u32 unk4; + struct UnkStruct2 *unk8; + +} UNK_021C59E8; + +extern u32 FUN_0202CEEC(); +extern u32 FUN_02023AC4(); +extern u32 FUN_02090DB8(u32 param0, void (*param1)(u32, u32), u32 param2); +extern void FUN_02090CC8(void (*param0)(), u32 param1); +extern void FUN_0202CE64(void *param0); +extern void FUN_0202CB70(u32 param0); +extern void FUN_0202D2F4(); +extern void FUN_0202D0A0(void (*param0)(u32, u8 *, u32), u32 param1); +extern u32 FUN_0202CBD4(); +extern u32 FUN_0202CBFC(); +extern u32 FUN_0202C570(void (*param0)(struct UnkStruct2_sub *, u32), u8 *param1, u32 param2); +extern u32 FUN_0202D21C(); +extern void FUN_0202C770(); +extern u32 FUN_0202D1E4(); +extern void FUN_0202D100(); +extern u32 FUN_0202D1C8(); +extern u32 FUN_0202D200(); +extern void FUN_0202C4D8(u32 param0, u8 *param1, u32 param2); +extern void FUN_0202D034(u32 param0, struct UnkStruct2_sub *param1); +extern u32 FUN_0202D358(); +extern void FUN_0202CB7C(void *param0, u32 param1); +extern void FUN_0202D240(void *param0, u32 size, u32 param2, u32 param3); +extern void FUN_0202DF54(); +extern u16 FUN_0202D19C(); +extern u32 FUN_0202CBE8(); +extern u32 FUN_0202D178(); +extern u16 FUN_0202CDA4(); +extern void FUN_0202CF84(u32 param0, u16 param1, u16 param2, u32 param3, u32 param4, u32 param5); +extern u32 FUN_0202CB8C(); +extern u16 WM_GetDispersionBeaconPeriod(); +extern BOOL FUN_0202D2D0(); + +THUMB_FUNC void FUN_0202E29C(struct PlayerData *player_data) +{ + if (UNK_021C59E8.unk8 == NULL) + { + UNK_021C59E8.unk8 = AllocFromHeap(0xf, sizeof(struct UnkStruct2)); + MI_CpuFill8(UNK_021C59E8.unk8, 0, sizeof(struct UnkStruct2)); + + UNK_021C59E8.unk8->unkCA4 = AllocFromHeap(0xf, FUN_0202CEEC()); + MI_CpuFill8(UNK_021C59E8.unk8->unkCA4, 0, FUN_0202CEEC()); + + UNK_021C59E8.unk8->unkCBC = AllocFromHeap(0xf, FUN_02023AC4()); + MI_CpuFill8(UNK_021C59E8.unk8->unkCBC, 0, FUN_02023AC4()); + + UNK_021C59E8.unk8->unkCC0 = 0x333; + UNK_021C59E8.unk8->unkCB8 = player_data; + + MailMsg_init(&UNK_021C59E8.unk8->unkCA8); + FUN_0202E500(); + } +} + +THUMB_FUNC BOOL FUN_0202E344() +{ + if (UNK_021C59E8.unk8 != NULL) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC BOOL FUN_0202E358(u8 *param0, u8 *param1, s32 param2) +{ + int i = 0; + while (i < param2) + { + if (*param0 != *param1) + { + return FALSE; + } + + i++; + param0++; + param1++; + } + + return TRUE; +} + +THUMB_FUNC void FUN_0202E380(struct UnkStruct2_sub *param0, u32 param1) +{ +#pragma unused(param1) + s32 r5 = FUN_02033534(); + u8 r6 = FUN_0203354C(); + struct UnkStruct2_sub4 *r4 = ¶m0->unk50; + + if (r5 != 0xe) + { + if (FUN_0202D8B0(r4->unk04) == 0 || FUN_0202D8B0(r5) == 0) + { + if (r4->unk30[0x24] != 0) + { + if (r4->unk04 == 0xa) + { + return; + } + } + + if (r4->unk04 != r5) + { + return; + } + } + } + + if (r5 != 0xe) + { + if (r4->unk05 != r6) + { + return; + } + } + + for (int i = 0; i < 0x10; i++) + { + if (UNK_021C59E8.unk8->unkC84[i] == 0) + { + continue; + } + + if (!FUN_0202E358(UNK_021C59E8.unk8->unk054[i].unk04, param0->unk04, 6)) + { + continue; + } + + UNK_021C59E8.unk8->unkC84[i] = 0x96; + + MI_CpuCopy8(param0, &UNK_021C59E8.unk8->unk054[i], sizeof(struct UnkStruct2_sub)); + return; + } + + int i; + for (i = 0; i < 0x10; i++) + { + if (UNK_021C59E8.unk8->unkC84[i] == 0) + { + break; + } + } + + if (i < 0x10) + { + UNK_021C59E8.unk8->unkC84[i] = 0x96; + MI_CpuCopy8(param0, &UNK_021C59E8.unk8->unk054[i], sizeof(struct UnkStruct2_sub)); + UNK_021C59E8.unk8->unkCB4 = 1; + } +} + +THUMB_FUNC void FUN_0202E470(u32 param0, u32 param1) +{ +#pragma unused(param0) + if (param1 != 0) + { + OS_Terminate(); + } + + UNK_021C59E8.unk4 = 2; +} + +THUMB_FUNC void FUN_0202E488() +{ + UNK_021C59E8.unk4 = 0; + FUN_02016454(4); +} + +THUMB_FUNC void FUN_0202E49C() +{ + FUN_02016444(4); + UNK_021C59E8.unk4 = 1; + if (FUN_02090DB8(8, FUN_0202E470, 0) != 1) + { + OS_Terminate(); + } +} + +THUMB_FUNC BOOL FUN_0202E4C8() +{ + if (UNK_021C59E8.unk4 == 2) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC BOOL FUN_0202E4DC() +{ + if (UNK_021C59E8.unk4 != 0) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC void FUN_0202E4F0() +{ + FUN_02090CC8(FUN_0202E488, 0); +} + +THUMB_FUNC void FUN_0202E500() +{ + UNK_021C59E8.unk8->unkCB0 = 0; + FUN_0202CE64(UNK_021C59E8.unk8->unkCA4 + (32 - (u32)(UNK_021C59E8.unk8->unkCA4) % 32)); + + FUN_0202CB70(UNK_021C59E8.unk8->unkCC0); +} + +THUMB_FUNC void FUN_0202E538() +{ + for (int i = 0; i < 0x10; i++) + { + UNK_021C59E8.unk8->unkC84[i] = 0; + } + + MI_CpuFill8(UNK_021C59E8.unk8->unk054, 0, 0xC00); +} + +THUMB_FUNC void FUN_0202E56C(u32 param0) +{ + UNK_021C59E8.unk8->unkDAD = + (UNK_021C59E8.unk8->unkDAD & ~8 | (u32)((u8)param0 << 0x1f) >> 0x1c); +} + +THUMB_FUNC void FUN_0202E594() +{ + UNK_021C59E8.unk8->unkCB4 = 0; + + UNK_021C59E8.unk8->unkDAD &= ~1; + + UNK_021C59E8.unk8->unkDAD &= ~4; + + UNK_021C59E8.unk8->unkDAA = 0; + + UNK_021C59E8.unk8->unkDAD &= ~0x10; + + UNK_021C59E8.unk8->unkDAC = 0; + + UNK_021C59E8.unk8->unkDAB = 0; +} + +THUMB_FUNC BOOL FUN_0202E5F8(u32 param0, u32 param1, u32 param2) +{ +#pragma unused(param0) + FUN_0202E594(); + FUN_0202E56C(param1); + FUN_0202D2F4(); + + if (UNK_021C59E8.unk8->unkDAB == 0) + { + FUN_0202D0A0(FUN_020303BC, 0xe); + UNK_021C59E8.unk8->unkDAB = 1; + } + + UNK_021C59E8.unk8->unkDAD = + (UNK_021C59E8.unk8->unkDAD & ~0x20 | (u32)((u8)param2 << 0x1f) >> 0x1a); + if (FUN_0202CBD4() == 1 && FUN_0202CBFC() != 0) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC u32 FUN_0202E66C(u32 param0, u32 param1) +{ +#pragma unused(param0) + FUN_0202E594(); + if (param1 != 0) + { + FUN_0202E538(); + } + + if (UNK_021C59E8.unk8->unkDAB == 0) + { + FUN_0202D0A0(FUN_02030238, 0xe); + UNK_021C59E8.unk8->unkDAB = 1; + } + + if (FUN_0202CBD4() == 1) + { + struct UnkStruct_const st0 = UNK_020EEC40; + + if (FUN_0202C570(FUN_0202E380, st0.unk0, 0) != 0) + { + return 1; + } + } + + return 0; +} + +THUMB_FUNC u32 FUN_0202E6F0() +{ + if (UNK_021C59E8.unk8 == NULL) + { + return 1; + } + + switch (UNK_021C59E8.unk8->unkDAC) + { + case 0: + if (FUN_0202D21C() != 0) + { + FUN_0202C770(); + UNK_021C59E8.unk8->unkDAC = 1; + } + else if (FUN_0202D1E4() == 0) + { + FUN_0202D100(); + UNK_021C59E8.unk8->unkDAC = 2; + } + break; + + case 1: + if (FUN_0202D1E4() == 0) + { + FUN_0202D100(); + UNK_021C59E8.unk8->unkDAC = 2; + } + break; + case 2: + if (FUN_0202D1C8() != 0) + { + return 1; + } + + if (FUN_0202D200() != 0) + { + UNK_021C59E8.unk8->unkDAC = 1; + } + break; + } + + return 0; +} + +THUMB_FUNC BOOL FUN_0202E784() +{ + if (UNK_021C59E8.unk8 != NULL && UNK_021C59E8.unk8->unkDAA == 0) + { + UNK_021C59E8.unk8->unkDAA = 1; + FUN_0202D100(); + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC void FUN_0202E7B0(u32 param0) +{ + if (UNK_021C59E8.unk8 != NULL) + { + if (param0 != 0) + { + UNK_021C59E8.unk8->unkDAA = 2; + return; + } + + UNK_021C59E8.unk8->unkDAA = 0; + FUN_0202E500(); + } +} + +THUMB_FUNC void FUN_0202E7D8() +{ + FreeToHeap(UNK_021C59E8.unk8->unkCBC); + FreeToHeap(UNK_021C59E8.unk8->unkCA4); + FreeToHeap(UNK_021C59E8.unk8); + + UNK_021C59E8.unk8 = NULL; +} + +THUMB_FUNC u32 FUN_0202E810() +{ + if (FUN_02030F40() == 0) + { + return 0; + } + + u32 count = 0; + for (int i = 0; i < 0x10; i++) + { + if (UNK_021C59E8.unk8->unkC84[i] != 0) + { + count++; + } + } + + return count; +} + +THUMB_FUNC s32 FUN_0202E844(u32 param0) +{ + int i; + u32 count = 0; + for (i = 0; i < 0x10; i++) + { + if (UNK_021C59E8.unk8->unkC84[i] == 0) + { + continue; + } + + if (count == param0) + { + return i; + } + + count++; + } + + ErrorHandling(); + return 0; +} + +THUMB_FUNC u8 FUN_0202E878() +{ + return UNK_021C59E8.unk8->unkCB4; +} + +THUMB_FUNC void FUN_0202E88C() +{ + UNK_021C59E8.unk8->unkCB4 = 0; +} + +THUMB_FUNC s32 FUN_0202E8A0(s32 param0) +{ + if (UNK_021C59E8.unk8->unkC84[param0] != 0) + { + if (UNK_021C59E8.unk8->unk054[param0].unk50.unk06 == 0) + { + return 1; + } + else + { + return UNK_021C59E8.unk8->unk054[param0].unk50.unk06; + } + } + + return 0; +} + +THUMB_FUNC s32 FUN_0202E8D0(s32 param0) +{ + for (int i = 0xf; i >= 0; i--) + { + s32 ret = FUN_0202E8A0(i); + if (ret > param0 && 8 > ret) + { + return i; + } + } + + return -1; +} + +THUMB_FUNC s32 FUN_0202E8F4() +{ + if (FUN_0202E810() == 0) + { + return -1; + } + + for (int i = 0xf; i >= 0; i--) + { + if (UNK_021C59E8.unk8->unkC84[i] != 0 && FUN_0202EFE4(UNK_021C59E8.unk8->unk054[i].unk04)) + { + s32 ret2 = FUN_0202E8A0(i); + if (ret2 > 1 && ret2 < 8) + { + return i; + } + } + } + + return -1; +} + +THUMB_FUNC s32 FUN_0202E950() +{ + if (FUN_0202E810() == 0) + { + return -1; + } + + for (int i = 0xf; i >= 0; i--) + { + if (UNK_021C59E8.unk8->unkC84[i] != 0 && FUN_0202EFE4(UNK_021C59E8.unk8->unk054[i].unk04)) + { + + return i; + } + } + + s32 ret = FUN_0202E8D0(1); + if (ret == -1) + { + return FUN_0202E8D0(0); + } + + return ret; +} + +THUMB_FUNC void FUN_0202E9AC(u32 param0, struct PlayerData *player_data) +{ + int i; + u32 count = 0; + for (i = 0; i < 0x10; i++) + { + if (UNK_021C59E8.unk8->unkC84[i] == 0) + { + continue; + } + + if (param0 == count) + { + + PlayerProfile_Copy(FUN_0202EF84(i), player_data); + return; + } + + count++; + } +} + +THUMB_FUNC u32 FUN_0202E9E8(u32 param0) +{ + if (FUN_0202CBD4() == 2) + { + FUN_0202C770(); + return 0; + } + + if (FUN_0202CBD4() == 1) + { + s32 ret = FUN_02033534(); + UNK_021C59E8.unk8->unkDA8 = (u8)UNK_021C59E8.unk8->unk054[param0].unk36; + if (FUN_0202D8B0(ret) != 0) + { + FUN_0202C4D8(1, UNK_021C59E8.unk8->unk054[param0].unk04, 0); + } + else + { + FUN_0202D034(1, &UNK_021C59E8.unk8->unk054[param0]); + } + + return 1; + } + + return 0; +} + +THUMB_FUNC void FUN_0202EA54() +{ + for (int i = 0; i < 0x10; i++) + { + if (UNK_021C59E8.unk8->unkC84[i] == 0) + { + continue; + } + if (UNK_021C59E8.unk8->unkC84[i] == 0) + { + continue; + } + + UNK_021C59E8.unk8->unkC84[i]--; + + if (UNK_021C59E8.unk8->unkC84[i] == 0) + { + UNK_021C59E8.unk8->unkCB4 = 1; + } + } +} + +THUMB_FUNC void FUN_0202EA9C() +{ + s32 res = FUN_02033534(); + struct PlayerData *player_data = FUN_0202EF70(); + + if (res != 0xf) + { + struct UnkStruct2_sub2 *res = &UNK_021C59E8.unk8->unkCC4; + GF_ASSERT((s32)FUN_02023AC4() <= 0x20); + GF_ASSERT(PlayerProfile_sizeof() == 0x20); + + MI_CpuCopy8(player_data, &res->unk08.unk08, PlayerProfile_sizeof()); + + MI_CpuCopy8(UNK_021C59E8.unk8->unkCBC, res->unk08.unk28, FUN_02023AC4()); + + res->unk00 = PlayerProfile_GetTrainerID(player_data); + res->unk04 = (u8)FUN_02033534(); + res->unk05 = FUN_0203354C(); + + MI_CpuCopy8(&UNK_021C59E8.unk8->unkCA8, &res->unk08.unk00, sizeof(struct MailMessage)); + res->unk08.unk4C = (u8)FUN_0202D358(); + } + else + { + struct UnkStruct2_sub2 *res = &UNK_021C59E8.unk8->unkCC4; + res->unk00 = PlayerProfile_GetTrainerID(player_data); + res->unk04 = (u8)FUN_02033534(); + res->unk05 = FUN_0203354C(); + + MI_CpuCopy8(&UNK_021C59E8.unk8->unk000, &res->unk08, sizeof(struct UnkStruct2_sub3)); + } + + DC_FlushRange(&UNK_021C59E8.unk8->unkCC4, sizeof(struct UnkStruct2_sub2)); + FUN_0202CB7C(&UNK_021C59E8.unk8->unkCC4, sizeof(struct UnkStruct2_sub2)); +} + +THUMB_FUNC void FUN_0202EB7C() +{ + struct UnkStruct2_sub2 *r4 = &UNK_021C59E8.unk8->unkCC4; + if (r4->unk06 != FUN_0202EDB8()) + { + r4->unk06 = (u8)FUN_0202EDB8(); + DC_FlushRange(&UNK_021C59E8.unk8->unkCC4, sizeof(struct UnkStruct2_sub2)); + FUN_0202CB7C(&UNK_021C59E8.unk8->unkCC4, sizeof(struct UnkStruct2_sub2)); + + FUN_0202D240(&UNK_021C59E8.unk8->unkCC4, + sizeof(struct UnkStruct2_sub2), + UNK_021C59E8.unk8->unkCC0, + UNK_021C59E8.unk0); + } +} + +THUMB_FUNC void FUN_0202EBD0(u16 param0) +{ + u32 r5 = FUN_0202CBD4(); + FUN_0202DF54(); + FUN_0202EB7C(); + + if (FUN_0202D19C() == 0 && FUN_0202EE24() == 0 && + ((u32)(UNK_021C59E8.unk8->unkDAD << 0x1d) >> 0x1f) != 0) + { + UNK_021C59E8.unk8->unkDAD = (UNK_021C59E8.unk8->unkDAD & ~1) | 1; + } + + if (UNK_021C59E8.unk8->unkDA6 == 0xFFFF) + { + UNK_021C59E8.unk8->unkDA6 = param0; + } + + if (((u32)(UNK_021C59E8.unk8->unkDAD << 0x1e) >> 0x1f) != 0 && + UNK_021C59E8.unk8->unkDA6 > param0) + { + UNK_021C59E8.unk8->unkDAD = (UNK_021C59E8.unk8->unkDAD & ~1) | 1; + } + + if (FUN_0202CBE8() == 25) + { + FUN_020335D0(0); + } + + switch (r5) + { + case 0: + if (UNK_021C59E8.unk8->unkDAA == 1) + { + FUN_0202E7D8(); + return; + } + else if (UNK_021C59E8.unk8->unkDAA == 2) + { + UNK_021C59E8.unk8->unkDAA = 3; + } + break; + + case 1: + if (UNK_021C59E8.unk8->unkDAA == 1 && FUN_0202D178() != 0) + { + return; + } + + if (UNK_021C59E8.unk8->unkDAA == 2 && FUN_0202D178() != 0) + { + return; + } + + break; + + case 8: + case 9: + + if (UNK_021C59E8.unk8 != NULL) + { + UNK_021C59E8.unk8->unkDAD = (UNK_021C59E8.unk8->unkDAD & ~1) | 1; + return; + } + break; + + case 7: + u16 r0 = FUN_0202CDA4(); + if (UNK_021C59E8.unk8->unkDA9 == 0) + { + UNK_021C59E8.unk8->unkDA4 = r0; + UNK_021C59E8.unk8->unkDA9 = 5; + } + else + { + UNK_021C59E8.unk8->unkDA9--; + } + + u16 r5 = UNK_021C59E8.unk8->unkDA4; + if ((u32)(UNK_021C59E8.unk8->unkDAD << 0x1c) >> 0x1f != 0) + { + UNK_021C59E8.unk0++; + } + + FUN_0202EA9C(); + + FUN_0202CF84(0, + UNK_021C59E8.unk0, + r5, + FUN_0202D858((u16)FUN_02033534()), + FUN_0202EEE8((u16)FUN_02033534()), + (u32)(UNK_021C59E8.unk8->unkDAD << 0x1a) >> 0x1f); + + UNK_021C59E8.unk8->unkDA8 = (u8)r5; + + break; + } +} + +THUMB_FUNC void FUN_0202ED70(u16 param0) +{ + if (UNK_021C59E8.unk8 != NULL) + { + FUN_0202EBD0(param0); + } +} + +THUMB_FUNC u32 FUN_0202ED84(u16 param0) +{ + if (UNK_021C59E8.unk8 == NULL) + { + return 0; + } + + if (FUN_0202CBD4() != 4) + { + return 0; + } + + if ((FUN_0202CB8C() & (1 << param0)) == 0) + { + return 0; + } + + return 1; +} + +THUMB_FUNC u32 FUN_0202EDB8() +{ + u32 count = 0; + for (int i = 0; i < 8; i++) + { + if (FUN_0202ED84((u16)i) != 0) + { + count++; + } + } + + return count; +} + +THUMB_FUNC BOOL FUN_0202EDD8() +{ + if (UNK_021C59E8.unk8 != NULL) + { + if (UNK_021C59E8.unk8->unkDAA == 3) + { + return TRUE; + } + } + + return FALSE; +} + +THUMB_FUNC BOOL FUN_0202EDF8() +{ + if (UNK_021C59E8.unk8 != NULL) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC u32 FUN_0202EE0C() +{ + if (UNK_021C59E8.unk8 != NULL) + { + return FUN_0202D1C8(); + } + + return 1; +} + +THUMB_FUNC u32 FUN_0202EE24() +{ + if (UNK_021C59E8.unk8 != NULL) + { + return FUN_0202CB8C() & 0xFFFE; + } + + return 0; +} + +THUMB_FUNC BOOL FUN_0202EE44() +{ + if (FUN_0202EE60() && FUN_0202CBE8() == 0x14) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC BOOL FUN_0202EE60() +{ + if (UNK_021C59E8.unk8 != NULL && (u32)(UNK_021C59E8.unk8->unkDAD << 0x1f) >> 0x1f != 0) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC void FUN_0202EE84(u32 param0) +{ + if (UNK_021C59E8.unk8 != NULL) + { + UNK_021C59E8.unk8->unkDAD = + (UNK_021C59E8.unk8->unkDAD & ~4) | (u32)((u8)param0 << 0x1f) >> 0x1d; + } +} + +THUMB_FUNC void FUN_0202EEB0(u32 param0) +{ + if (UNK_021C59E8.unk8 != NULL) + { + UNK_021C59E8.unk8->unkDAD = + (UNK_021C59E8.unk8->unkDAD & ~2) | (u32)((u8)param0 << 0x1f) >> 0x1e; + + UNK_021C59E8.unk8->unkDA6 = 0xFFFF; + } +} + +THUMB_FUNC u32 FUN_0202EEE8(u16 param0) +{ + u16 r4 = WM_GetDispersionBeaconPeriod(); + GF_ASSERT(param0 < 0x1a); + + if (param0 == 0xa) + { + return (u32)(r4 << 0xe) >> 0x10; + } + + if (param0 == 9 || param0 == 0xd) + { + return (u32)(r4 << 0xe) >> 0x10; + } + + return r4; +} + +THUMB_FUNC struct UnkStruct2_sub *FUN_0202EF18(u32 param0) +{ + if (UNK_021C59E8.unk8 != NULL) + { + if (UNK_021C59E8.unk8->unkC84[param0] != 0) + { + return &UNK_021C59E8.unk8->unk054[param0]; + } + } + + return NULL; +} + +THUMB_FUNC struct UnkStruct2_sub4 *FUN_0202EF44(s32 param0) +{ + if (UNK_021C59E8.unk8 != NULL) + { + if (UNK_021C59E8.unk8->unkC84[param0] != 0) + { + return &UNK_021C59E8.unk8->unk054[param0].unk50; + } + } + + return NULL; +} + +THUMB_FUNC struct PlayerData *FUN_0202EF70() +{ + return UNK_021C59E8.unk8->unkCB8; +} + +THUMB_FUNC struct PlayerData *FUN_0202EF84(int param0) +{ + if (UNK_021C59E8.unk8->unkC84[param0] == 0) + { + return NULL; + } + + struct UnkStruct2_sub4 *r0 = &UNK_021C59E8.unk8->unk054[param0].unk50; + + return &r0->unk10; +} + +THUMB_FUNC void FUN_0202EFAC(u8 *param0, s32 param1) +{ + if (UNK_021C59E8.unk8 != NULL) + { + GF_ASSERT(param1 < 8); + + MI_CpuCopy8(param0, UNK_021C59E8.unk8->unkC54[param1], 6); + } +} + +#ifdef NONMATCHING +THUMB_FUNC BOOL FUN_0202EFE4(u8 *param0) +{ + + for (int i = 0; i < 8; i++) + { + if (UNK_021C59E8.unk8->unkC54[i][0] != param0[0]) + { + continue; + } + + if (UNK_021C59E8.unk8->unkC54[i][1] != param0[1]) + { + continue; + } + if (UNK_021C59E8.unk8->unkC54[i][2] != param0[2]) + { + continue; + } + if (UNK_021C59E8.unk8->unkC54[i][3] != param0[3]) + { + continue; + } + if (UNK_021C59E8.unk8->unkC54[i][4] != param0[4]) + { + continue; + } + if (UNK_021C59E8.unk8->unkC54[i][5] != param0[5]) + { + continue; + } + + return TRUE; + } + + return FALSE; +} +#else +THUMB_FUNC asm BOOL FUN_0202EFE4(u8 *param0) +{ + // clang-format off + push {r4-r5} + ldr r2, =UNK_021C59E8 + mov r1, #0x0 + ldr r3, [r2, #0x8] + ldr r2, =0x00000C54 + add r2, r3, r2 + ldrb r3, [r0, #0x0] +_0202EFF2: + ldrb r4, [r2, #0x0] + cmp r4, r3 + bne _0202F026 + ldrb r5, [r2, #0x1] + ldrb r4, [r0, #0x1] + cmp r5, r4 + bne _0202F026 + ldrb r5, [r2, #0x2] + ldrb r4, [r0, #0x2] + cmp r5, r4 + bne _0202F026 + ldrb r5, [r2, #0x3] + ldrb r4, [r0, #0x3] + cmp r5, r4 + bne _0202F026 + ldrb r5, [r2, #0x4] + ldrb r4, [r0, #0x4] + cmp r5, r4 + bne _0202F026 + ldrb r5, [r2, #0x5] + ldrb r4, [r0, #0x5] + cmp r5, r4 + bne _0202F026 + mov r0, #0x1 + pop {r4-r5} + bx lr +_0202F026: + add r1, r1, #0x1 + add r2, r2, #0x6 + cmp r1, #0x8 + blt _0202EFF2 + mov r0, #0x0 + pop {r4-r5} + bx lr + // clang-format on +} +#endif + +THUMB_FUNC u32 FUN_0202F03C() +{ + if (UNK_021C59E8.unk8 != NULL) + { + return (u32)(UNK_021C59E8.unk8->unkDAD << 0x1b) >> 0x1f; + } + + return 0; +} + +THUMB_FUNC void FUN_0202F05C() +{ + if (UNK_021C59E8.unk8 != NULL) + { + UNK_021C59E8.unk8->unkDAD |= 0x10; + } +} + +THUMB_FUNC void FUN_0202F078(struct MailMessage *mail_message) +{ + MI_CpuCopy8(mail_message, &UNK_021C59E8.unk8->unkCA8, sizeof(struct MailMessage)); +} + +THUMB_FUNC void FUN_0202F094(void *param0) +{ + MI_CpuCopy8(param0, UNK_021C59E8.unk8->unkCBC, FUN_02023AC4()); +} + +THUMB_FUNC void FUN_0202F0B8() +{ + FUN_0202EA9C(); + FUN_0202D240(&UNK_021C59E8.unk8->unkCC4, + sizeof(struct UnkStruct2_sub2), + UNK_021C59E8.unk8->unkCC0, + UNK_021C59E8.unk0); +} + +THUMB_FUNC u32 FUN_0202F0DC(u8 param0) +{ + int i; + u32 r5 = 0; + for (i = 0; i < 0x10; i++) + { + struct UnkStruct2_sub4 *res = FUN_0202EF44(i); + if (res != 0 && res->unk04 == param0) + { + r5 += res->unk06; + } + } + + return r5; +} + +THUMB_FUNC BOOL FUN_0202F104() +{ + return FUN_0202D2D0(); +} + +THUMB_FUNC void FUN_0202F10C(struct UnkStruct2_sub3 *param0) +{ + MI_CpuCopy8(param0, &UNK_021C59E8.unk8->unk000, sizeof(struct UnkStruct2_sub3)); + FUN_0202F0B8(); +} + +THUMB_FUNC u8 *FUN_0202F124(u32 param0) +{ + if (UNK_021C59E8.unk8 != NULL && UNK_021C59E8.unk8->unkC84[param0] != 0) + { + struct UnkStruct2_sub4 *r0 = &UNK_021C59E8.unk8->unk054[param0].unk50; + return r0->unk08; + } + + return NULL; +} diff --git a/arm9/src/unk_0202F150.c b/arm9/src/unk_0202F150.c index b8a42687..a7f69f3c 100644 --- a/arm9/src/unk_0202F150.c +++ b/arm9/src/unk_0202F150.c @@ -1044,7 +1044,7 @@ THUMB_FUNC void FUN_02030074() } } -THUMB_FUNC void FUN_02030238(u32 param0, void *param1, u32 param2) +THUMB_FUNC void FUN_02030238(u32 param0, u8 *param1, u32 param2) { if (UNK_021C59F4.unk04->unk66F[0] != 0) { @@ -1143,7 +1143,7 @@ THUMB_FUNC void FUN_0203026C(u32 param0, u8 *param1, u32 param2) FUN_0202D3A4(&UNK_021C59F4.unk04->unk470, param1 + 4, param1[3], 0x5FF); } -THUMB_FUNC void FUN_020303BC(u32 param0, u8 *param1, u16 param2) +THUMB_FUNC void FUN_020303BC(u32 param0, u8 *param1, u32 param2) { if (UNK_021C59F4.unk04->unk66F[param0] != 0) { @@ -1156,7 +1156,7 @@ THUMB_FUNC void FUN_020303BC(u32 param0, u8 *param1, u16 param2) FUN_020303F4(param0, param1, param2); } -THUMB_FUNC void FUN_020303F4(u32 param0, u8 *param1, u16 param2) +THUMB_FUNC void FUN_020303F4(u32 param0, u8 *param1, u32 param2) { #pragma unused(param2) UNK_021C59F4.unk04->unk638[param0]--; @@ -2469,4 +2469,4 @@ THUMB_FUNC void FUN_02031468() { UNK_021C59F4.unk04->unk68A = 1; } -} \ No newline at end of file +} diff --git a/arm9/src/unk_02031734.c b/arm9/src/unk_02031734.c index 3222232c..78bfd90a 100644 --- a/arm9/src/unk_02031734.c +++ b/arm9/src/unk_02031734.c @@ -58,7 +58,7 @@ extern void MOD04_021D83C0(); extern s32 MOD04_021D7F8C(); extern s32 MOD04_021D7800(u32 param0); extern u32 MOD04_021D8494(s32 param0); -extern void MOD04_021D77C4(void (*param0)(u32, u8 *, u16), void (*param1)(u32, void *, u32)); +extern void MOD04_021D77C4(void (*param0)(u32, u8 *, u32), void (*param1)(u32, u8 *, u32)); extern u32 MOD04_021D82BC(u8 param0); extern void MOD04_021D836C(); extern u32 MOD04_021DD718(u32 *param0, u32 *param1); -- cgit v1.2.3 From 0a89ace18db732440c498c1684e287e164b6d76d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 8 May 2021 12:28:24 +0200 Subject: externs cleanup --- arm9/src/unk_0202F150.c | 26 ++++++++------------------ arm9/src/unk_02031734.c | 47 ++++++++++++++++------------------------------- 2 files changed, 24 insertions(+), 49 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_0202F150.c b/arm9/src/unk_0202F150.c index a7f69f3c..d52857c1 100644 --- a/arm9/src/unk_0202F150.c +++ b/arm9/src/unk_0202F150.c @@ -1,6 +1,8 @@ #include "unk_0202F150.h" #include "unk_02031480.h" #include "unk_02031734.h" +#include "unk_0202E29C.h" + struct { @@ -15,20 +17,11 @@ extern void FUN_0202D7D8(u8 *param0, u32 param1, struct UnkStruct0202F150_sub1 * extern u32 FUN_0200CA60(void (*param0)(), u32 param1, u32 param2); extern void FUN_0202D394(struct UnkStruct0202F150_sub1 *param0, u8 *param1, u32 param2); extern void FUN_0202D804(u8 *param0); -extern u32 FUN_0202E5F8(u32 param0, u32 param1, u32 param2); extern void FUN_0202D330(void (*param0)(int)); -extern u32 FUN_0202E66C(u32 param0, u32 param1); extern void MOD04_021D83C0(); -extern u32 FUN_0202E784(); extern void FUN_0202DBA4(); extern void FUN_0200CAB4(u32 param0); extern void FUN_0202D824(u8 *param0); -extern u32 FUN_0202E9E8(u32 param0); -extern u32 FUN_0202F03C(); -extern u32 FUN_0202EE24(); -extern void FUN_0202EBD0(u16 param0); -extern void FUN_0202ED70(u32 param0); -extern void FUN_0202E538(); extern u32 MOD04_021D78FC(void *param0, u32 param1); extern u32 FUN_0202CBD4(); extern void FUN_0202D4BC(void *param0); @@ -49,10 +42,7 @@ extern s16 FUN_0202D9A0(u32 param0); extern u32 FUN_0202DA04(u32 param0); extern void *FUN_0202DA40(u32 param0, u32 param1, u16 param2); extern u32 MOD04_021D8018(); -extern u32 FUN_0202EDF8(); extern u16 FUN_0202D19C(); -extern u32 FUN_0202EE60(); -extern void FUN_0202F05C(); extern void GF_RTC_CopyDateTime(RTCDate *, RTCTime *); extern void FUN_0202D830(u8 *param0, u32 param1); extern u32 MOD04_021D8624(); @@ -472,7 +462,7 @@ THUMB_FUNC void FUN_0202FA5C() } else { - if (FUN_0202E784() != 0) + if (FUN_0202E784()) { r4 = 1; } @@ -2033,11 +2023,11 @@ THUMB_FUNC s32 FUN_02030F20() return r4; } -THUMB_FUNC u32 FUN_02030F40() +THUMB_FUNC BOOL FUN_02030F40() { if (UNK_021C59F4.unk04 != NULL && FUN_02033534() >= 0x13) { - return 1; + return TRUE; } return FUN_0202EDF8(); @@ -2221,17 +2211,17 @@ THUMB_FUNC u32 FUN_020311E8() return FUN_0202EE24(); } -THUMB_FUNC u32 FUN_020311F0() +THUMB_FUNC BOOL FUN_020311F0() { if (FUN_02031280() != 0) { - return 0; + return FALSE; } if (UNK_021C59F4.unk04 != NULL && UNK_021C59F4.unk04->unk689 != 0) { FUN_020334E8(1, 1); - return 1; + return TRUE; } return FUN_0202EE60(); diff --git a/arm9/src/unk_02031734.c b/arm9/src/unk_02031734.c index 78bfd90a..65ed3bc4 100644 --- a/arm9/src/unk_02031734.c +++ b/arm9/src/unk_02031734.c @@ -5,6 +5,8 @@ #include "heap.h" #include "player_data.h" #include "unk_0202F150.h" +#include "unk_0202E29C.h" + const struct UnkStruct_02031734_const2 UNK_020EEC48 = { { (u32)FUN_02032B84, 0 } }; @@ -24,33 +26,19 @@ char UNK_02105D64[] = " FULL"; struct UnkStruct_02031734 *UNK_021C5A00; -extern void FUN_0202E49C(); extern void FUN_0202D8D0(u32 param0, u32 param1, u32 param2); extern void FUN_02033E74(); extern void FUN_0202D918(); extern void FUN_02033ED0(); -extern void FUN_0202E4F0(); extern void FUN_0202D298(); extern void FUN_0202D344(u32 param0); extern void FUN_0202D1B0(u8 param0); extern void FUN_0202D36C(u32 param0); extern u32 MOD04_021DDB08(); extern void FUN_02033EEC(u32 param0); -extern u32 FUN_0202EDF8(); extern u32 WM_GetLinkLevel(); -extern u32 FUN_0202E4C8(); -extern void FUN_0202E29C(struct PlayerData *player_data); extern void FUN_0202DB14(struct SaveBlock2 *sav2, u32 param1); extern s64 _ll_mul(s64, s64); -extern u32 FUN_0202EE0C(); -extern void FUN_0202EA54(); -extern s32 FUN_0202E8F4(); -extern s32 FUN_0202E950(); -extern u32 FUN_0202E8A0(u8 param0); -extern u32 FUN_0202E6F0(); -extern void FUN_0202EE84(u8 param0); -extern void FUN_0202E7B0(u32 param0); -extern u32 FUN_0202F104(); extern void FUN_0202DBE0(); extern void FUN_0202DDE8(); extern void FUN_0202D308(void (*param0)(u32, u32)); @@ -66,11 +54,8 @@ extern void MOD04_021DD6F0(); extern s32 MOD04_021D76AC(); extern MOD05_021D74E0(struct SaveBlock2 *sav2, u32 param1); extern void MOD04_021D83A8(void (*param0)(s32)); -extern void FUN_0202EEB0(u8 param0); extern void FUN_02033F70(int, int, int); extern void FUN_0200541C(); -extern u32 FUN_0202EDD8(); -extern u32 FUN_0202E344(); THUMB_FUNC void FUN_02031734(struct SaveBlock2 *sav2, u8 param1) { @@ -451,7 +436,7 @@ THUMB_FUNC void FUN_02031CDC() return; } - if (FUN_0202EDF8() != 0) + if (FUN_0202EDF8()) { FUN_02033EEC(3 - WM_GetLinkLevel()); } @@ -471,7 +456,7 @@ THUMB_FUNC void FUN_02031D30() return; } - if (FUN_0202E4C8() == 0) + if (!FUN_0202E4C8()) { return; } @@ -726,7 +711,7 @@ THUMB_FUNC void FUN_02032178() THUMB_FUNC void FUN_02032194() { - if (FUN_0202E4C8() != 0) + if (FUN_0202E4C8()) { FUN_0202E7B0(0); FUN_0202FC60(); @@ -744,7 +729,7 @@ THUMB_FUNC void FUN_020321B8() THUMB_FUNC void FUN_020321D0() { - if (FUN_0202E4C8() != 0) + if (FUN_0202E4C8()) { FUN_0202E29C(UNK_021C5A00->unk2C); FUN_0202DB14(UNK_021C5A00->unk28, UNK_021C5A00->unk30); @@ -774,7 +759,7 @@ THUMB_FUNC void FUN_02032234() THUMB_FUNC void FUN_0203224C() { - if (FUN_0202E4C8() != 0) + if (FUN_0202E4C8()) { FUN_0202E29C(UNK_021C5A00->unk2C); FUN_0202DB14(UNK_021C5A00->unk28, UNK_021C5A00->unk30); @@ -925,7 +910,7 @@ THUMB_FUNC void FUN_02032440() THUMB_FUNC void FUN_02032478() { - if (FUN_0202E4C8() != 0) + if (FUN_0202E4C8()) { FUN_0202E29C(UNK_021C5A00->unk2C); FUN_0202D1B0(UNK_021C5A00->unk3C); @@ -978,7 +963,7 @@ THUMB_FUNC void FUN_02032510() THUMB_FUNC void FUN_02032578() { - if (FUN_0202F104() == 0) + if (!FUN_0202F104()) { if (FUN_020311E8() != 0) { @@ -1394,7 +1379,7 @@ THUMB_FUNC void FUN_02032B84() THUMB_FUNC void FUN_02032B8C() { - if (FUN_0202E4C8() != 0) + if (FUN_0202E4C8()) { FUN_0202E29C(UNK_021C5A00->unk2C); FUN_0202DB14(UNK_021C5A00->unk28, 0); @@ -1479,7 +1464,7 @@ THUMB_FUNC void FUN_02032C6C(u32 param0, u32 param1) THUMB_FUNC void FUN_02032CF4() { - if (FUN_0202E4C8() != 0) + if (FUN_0202E4C8()) { FUN_0202E29C(UNK_021C5A00->unk2C); FUN_0202DB14(UNK_021C5A00->unk28, 0); @@ -1545,7 +1530,7 @@ THUMB_FUNC BOOL FUN_02032DAC() THUMB_FUNC void FUN_02032E00() { - if (FUN_0202E4C8() != 0) + if (FUN_0202E4C8()) { FUN_0202E29C(UNK_021C5A00->unk2C); FUN_0202DB14(UNK_021C5A00->unk28, 0); @@ -1559,7 +1544,7 @@ THUMB_FUNC void FUN_02032E00() THUMB_FUNC void FUN_02032E48() { - if (FUN_0202E4C8() != 0) + if (FUN_0202E4C8()) { FUN_0202E29C(UNK_021C5A00->unk2C); FUN_0202DB14(UNK_021C5A00->unk28, 0); @@ -1981,7 +1966,7 @@ THUMB_FUNC void FUN_020333F0() THUMB_FUNC void FUN_0203341C() { - if (FUN_0202E4C8() != 0) + if (FUN_0202E4C8()) { FUN_02016828(3, 0x31, 0x31000); if (FUN_0202F918(1, 1, 0x200, 1) != 0) @@ -2164,12 +2149,12 @@ THUMB_FUNC void FUN_020335F4() THUMB_FUNC BOOL FUN_02033678() { - if (FUN_0202EDD8() != 0 || !FUN_02031810()) + if (FUN_0202EDD8() || !FUN_02031810()) { return TRUE; } - if (FUN_0202E344() == 0) + if (!FUN_0202E344()) { return TRUE; } -- cgit v1.2.3 From 5f893fd3ce282c293c42a3e5421aa8256972f90d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Calixte?= Date: Sat, 8 May 2021 12:31:19 +0200 Subject: better struct names --- arm9/src/unk_0202E29C.c | 58 ++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'arm9') diff --git a/arm9/src/unk_0202E29C.c b/arm9/src/unk_0202E29C.c index 678f6fe3..36c18b16 100644 --- a/arm9/src/unk_0202E29C.c +++ b/arm9/src/unk_0202E29C.c @@ -10,18 +10,18 @@ #include "unk_0202F150.h" #include "unk_02031734.h" -struct UnkStruct_const +struct UnkStruct_0202E29C_const { u8 unk0[6]; }; -const struct UnkStruct_const UNK_020EEC40 = { { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } }; +const struct UnkStruct_0202E29C_const UNK_020EEC40 = { { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } }; struct { u16 unk0; u32 unk4; - struct UnkStruct2 *unk8; + struct UnkStruct_0202E29C *unk8; } UNK_021C59E8; @@ -35,7 +35,7 @@ extern void FUN_0202D2F4(); extern void FUN_0202D0A0(void (*param0)(u32, u8 *, u32), u32 param1); extern u32 FUN_0202CBD4(); extern u32 FUN_0202CBFC(); -extern u32 FUN_0202C570(void (*param0)(struct UnkStruct2_sub *, u32), u8 *param1, u32 param2); +extern u32 FUN_0202C570(void (*param0)(struct UnkStruct_0202E29C_sub *, u32), u8 *param1, u32 param2); extern u32 FUN_0202D21C(); extern void FUN_0202C770(); extern u32 FUN_0202D1E4(); @@ -43,7 +43,7 @@ extern void FUN_0202D100(); extern u32 FUN_0202D1C8(); extern u32 FUN_0202D200(); extern void FUN_0202C4D8(u32 param0, u8 *param1, u32 param2); -extern void FUN_0202D034(u32 param0, struct UnkStruct2_sub *param1); +extern void FUN_0202D034(u32 param0, struct UnkStruct_0202E29C_sub *param1); extern u32 FUN_0202D358(); extern void FUN_0202CB7C(void *param0, u32 param1); extern void FUN_0202D240(void *param0, u32 size, u32 param2, u32 param3); @@ -61,8 +61,8 @@ THUMB_FUNC void FUN_0202E29C(struct PlayerData *player_data) { if (UNK_021C59E8.unk8 == NULL) { - UNK_021C59E8.unk8 = AllocFromHeap(0xf, sizeof(struct UnkStruct2)); - MI_CpuFill8(UNK_021C59E8.unk8, 0, sizeof(struct UnkStruct2)); + UNK_021C59E8.unk8 = AllocFromHeap(0xf, sizeof(struct UnkStruct_0202E29C)); + MI_CpuFill8(UNK_021C59E8.unk8, 0, sizeof(struct UnkStruct_0202E29C)); UNK_021C59E8.unk8->unkCA4 = AllocFromHeap(0xf, FUN_0202CEEC()); MI_CpuFill8(UNK_021C59E8.unk8->unkCA4, 0, FUN_0202CEEC()); @@ -106,12 +106,12 @@ THUMB_FUNC BOOL FUN_0202E358(u8 *param0, u8 *param1, s32 param2) return TRUE; } -THUMB_FUNC void FUN_0202E380(struct UnkStruct2_sub *param0, u32 param1) +THUMB_FUNC void FUN_0202E380(struct UnkStruct_0202E29C_sub *param0, u32 param1) { #pragma unused(param1) s32 r5 = FUN_02033534(); u8 r6 = FUN_0203354C(); - struct UnkStruct2_sub4 *r4 = ¶m0->unk50; + struct UnkStruct_0202E29C_sub4 *r4 = ¶m0->unk50; if (r5 != 0xe) { @@ -154,7 +154,7 @@ THUMB_FUNC void FUN_0202E380(struct UnkStruct2_sub *param0, u32 param1) UNK_021C59E8.unk8->unkC84[i] = 0x96; - MI_CpuCopy8(param0, &UNK_021C59E8.unk8->unk054[i], sizeof(struct UnkStruct2_sub)); + MI_CpuCopy8(param0, &UNK_021C59E8.unk8->unk054[i], sizeof(struct UnkStruct_0202E29C_sub)); return; } @@ -170,7 +170,7 @@ THUMB_FUNC void FUN_0202E380(struct UnkStruct2_sub *param0, u32 param1) if (i < 0x10) { UNK_021C59E8.unk8->unkC84[i] = 0x96; - MI_CpuCopy8(param0, &UNK_021C59E8.unk8->unk054[i], sizeof(struct UnkStruct2_sub)); + MI_CpuCopy8(param0, &UNK_021C59E8.unk8->unk054[i], sizeof(struct UnkStruct_0202E29C_sub)); UNK_021C59E8.unk8->unkCB4 = 1; } } @@ -308,7 +308,7 @@ THUMB_FUNC u32 FUN_0202E66C(u32 param0, u32 param1) if (FUN_0202CBD4() == 1) { - struct UnkStruct_const st0 = UNK_020EEC40; + struct UnkStruct_0202E29C_const st0 = UNK_020EEC40; if (FUN_0202C570(FUN_0202E380, st0.unk0, 0) != 0) { @@ -608,7 +608,7 @@ THUMB_FUNC void FUN_0202EA9C() if (res != 0xf) { - struct UnkStruct2_sub2 *res = &UNK_021C59E8.unk8->unkCC4; + struct UnkStruct_0202E29C_sub2 *res = &UNK_021C59E8.unk8->unkCC4; GF_ASSERT((s32)FUN_02023AC4() <= 0x20); GF_ASSERT(PlayerProfile_sizeof() == 0x20); @@ -625,29 +625,29 @@ THUMB_FUNC void FUN_0202EA9C() } else { - struct UnkStruct2_sub2 *res = &UNK_021C59E8.unk8->unkCC4; + struct UnkStruct_0202E29C_sub2 *res = &UNK_021C59E8.unk8->unkCC4; res->unk00 = PlayerProfile_GetTrainerID(player_data); res->unk04 = (u8)FUN_02033534(); res->unk05 = FUN_0203354C(); - MI_CpuCopy8(&UNK_021C59E8.unk8->unk000, &res->unk08, sizeof(struct UnkStruct2_sub3)); + MI_CpuCopy8(&UNK_021C59E8.unk8->unk000, &res->unk08, sizeof(struct UnkStruct_0202E29C_sub3)); } - DC_FlushRange(&UNK_021C59E8.unk8->unkCC4, sizeof(struct UnkStruct2_sub2)); - FUN_0202CB7C(&UNK_021C59E8.unk8->unkCC4, sizeof(struct UnkStruct2_sub2)); + DC_FlushRange(&UNK_021C59E8.unk8->unkCC4, sizeof(struct UnkStruct_0202E29C_sub2)); + FUN_0202CB7C(&UNK_021C59E8.unk8->unkCC4, sizeof(struct UnkStruct_0202E29C_sub2)); } THUMB_FUNC void FUN_0202EB7C() { - struct UnkStruct2_sub2 *r4 = &UNK_021C59E8.unk8->unkCC4; + struct UnkStruct_0202E29C_sub2 *r4 = &UNK_021C59E8.unk8->unkCC4; if (r4->unk06 != FUN_0202EDB8()) { r4->unk06 = (u8)FUN_0202EDB8(); - DC_FlushRange(&UNK_021C59E8.unk8->unkCC4, sizeof(struct UnkStruct2_sub2)); - FUN_0202CB7C(&UNK_021C59E8.unk8->unkCC4, sizeof(struct UnkStruct2_sub2)); + DC_FlushRange(&UNK_021C59E8.unk8->unkCC4, sizeof(struct UnkStruct_0202E29C_sub2)); + FUN_0202CB7C(&UNK_021C59E8.unk8->unkCC4, sizeof(struct UnkStruct_0202E29C_sub2)); FUN_0202D240(&UNK_021C59E8.unk8->unkCC4, - sizeof(struct UnkStruct2_sub2), + sizeof(struct UnkStruct_0202E29C_sub2), UNK_021C59E8.unk8->unkCC0, UNK_021C59E8.unk0); } @@ -894,7 +894,7 @@ THUMB_FUNC u32 FUN_0202EEE8(u16 param0) return r4; } -THUMB_FUNC struct UnkStruct2_sub *FUN_0202EF18(u32 param0) +THUMB_FUNC struct UnkStruct_0202E29C_sub *FUN_0202EF18(u32 param0) { if (UNK_021C59E8.unk8 != NULL) { @@ -907,7 +907,7 @@ THUMB_FUNC struct UnkStruct2_sub *FUN_0202EF18(u32 param0) return NULL; } -THUMB_FUNC struct UnkStruct2_sub4 *FUN_0202EF44(s32 param0) +THUMB_FUNC struct UnkStruct_0202E29C_sub4 *FUN_0202EF44(s32 param0) { if (UNK_021C59E8.unk8 != NULL) { @@ -932,7 +932,7 @@ THUMB_FUNC struct PlayerData *FUN_0202EF84(int param0) return NULL; } - struct UnkStruct2_sub4 *r0 = &UNK_021C59E8.unk8->unk054[param0].unk50; + struct UnkStruct_0202E29C_sub4 *r0 = &UNK_021C59E8.unk8->unk054[param0].unk50; return &r0->unk10; } @@ -1066,7 +1066,7 @@ THUMB_FUNC void FUN_0202F0B8() { FUN_0202EA9C(); FUN_0202D240(&UNK_021C59E8.unk8->unkCC4, - sizeof(struct UnkStruct2_sub2), + sizeof(struct UnkStruct_0202E29C_sub2), UNK_021C59E8.unk8->unkCC0, UNK_021C59E8.unk0); } @@ -1077,7 +1077,7 @@ THUMB_FUNC u32 FUN_0202F0DC(u8 param0) u32 r5 = 0; for (i = 0; i < 0x10; i++) { - struct UnkStruct2_sub4 *res = FUN_0202EF44(i); + struct UnkStruct_0202E29C_sub4 *res = FUN_0202EF44(i); if (res != 0 && res->unk04 == param0) { r5 += res->unk06; @@ -1092,9 +1092,9 @@ THUMB_FUNC BOOL FUN_0202F104() return FUN_0202D2D0(); } -THUMB_FUNC void FUN_0202F10C(struct UnkStruct2_sub3 *param0) +THUMB_FUNC void FUN_0202F10C(struct UnkStruct_0202E29C_sub3 *param0) { - MI_CpuCopy8(param0, &UNK_021C59E8.unk8->unk000, sizeof(struct UnkStruct2_sub3)); + MI_CpuCopy8(param0, &UNK_021C59E8.unk8->unk000, sizeof(struct UnkStruct_0202E29C_sub3)); FUN_0202F0B8(); } @@ -1102,7 +1102,7 @@ THUMB_FUNC u8 *FUN_0202F124(u32 param0) { if (UNK_021C59E8.unk8 != NULL && UNK_021C59E8.unk8->unkC84[param0] != 0) { - struct UnkStruct2_sub4 *r0 = &UNK_021C59E8.unk8->unk054[param0].unk50; + struct UnkStruct_0202E29C_sub4 *r0 = &UNK_021C59E8.unk8->unk054[param0].unk50; return r0->unk08; } -- cgit v1.2.3