From 986486589ad9e0a92160b238bfc753eea7dd38ca Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 5 Jun 2021 20:40:01 -0400 Subject: Match ScrCmd_Unk01C7 --- arm9/src/scrcmd_24.c | 46 +++++----------------------------------------- 1 file changed, 5 insertions(+), 41 deletions(-) (limited to 'arm9/src/scrcmd_24.c') diff --git a/arm9/src/scrcmd_24.c b/arm9/src/scrcmd_24.c index 9c8f8d4b..394dfb58 100644 --- a/arm9/src/scrcmd_24.c +++ b/arm9/src/scrcmd_24.c @@ -25,11 +25,13 @@ THUMB_FUNC BOOL ScrCmd_Unk01C6(struct ScriptContext* ctx) return TRUE; } -#ifdef NONMATCHING THUMB_FUNC BOOL ScrCmd_Unk01C7(struct ScriptContext* ctx) { - u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); - struct UnkStruct_02037CF0** unk_ptr = FUN_02039438(ctx->unk80, 19); + struct UnkStruct_02037CF0** unk_ptr; + u16* ret_ptr; + + ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + unk_ptr = FUN_02039438(ctx->unk80, 19); GF_ASSERT(*unk_ptr != NULL); *ret_ptr = FUN_02037D5C(*unk_ptr); @@ -42,44 +44,6 @@ THUMB_FUNC BOOL ScrCmd_Unk01C7(struct ScriptContext* ctx) *unk_ptr = NULL; return FALSE; } -#else -THUMB_FUNC asm BOOL ScrCmd_Unk01C7(struct ScriptContext* ctx) -{ - push {r3-r5, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r4, #0x80 - add r5, r0, #0x0 - ldr r0, [r4, #0x0] - mov r1, #0x13 - bl FUN_02039438 - add r4, r0, #0x0 - ldr r0, [r4, #0x0] - cmp r0, #0x0 - bne _02045DFC - bl GF_AssertFail -_02045DFC: - ldr r0, [r4, #0x0] - bl FUN_02037D5C - strh r0, [r5, #0x0] - ldrh r0, [r5, #0x0] - cmp r0, #0x4 - bne _02045E0E - mov r0, #0xff - strh r0, [r5, #0x0] -_02045E0E: - ldr r0, [r4, #0x0] - bl FreeToHeap - mov r0, #0x0 - str r0, [r4, #0x0] - pop {r3-r5, pc} -} -#endif THUMB_FUNC BOOL ScrCmd_Unk021E(struct ScriptContext* ctx) { -- cgit v1.2.3 From 5ffe803f6ca5eace9b7c5c825ea19f90c4bd6528 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 5 Jun 2021 20:45:54 -0400 Subject: Fix nonmatching routines in scrcmd_24.c --- arm9/src/scrcmd_24.c | 94 ++++++++-------------------------------------------- 1 file changed, 14 insertions(+), 80 deletions(-) (limited to 'arm9/src/scrcmd_24.c') diff --git a/arm9/src/scrcmd_24.c b/arm9/src/scrcmd_24.c index 394dfb58..b38ed05a 100644 --- a/arm9/src/scrcmd_24.c +++ b/arm9/src/scrcmd_24.c @@ -123,12 +123,15 @@ THUMB_FUNC BOOL ScrCmd_Unk0222(struct ScriptContext* ctx) return FALSE; } -#ifdef NONMATCHING THUMB_FUNC BOOL ScrCmd_Unk0223(struct ScriptContext* ctx) { - u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); - struct UnkStruct_02037CF0** unk = FUN_02039438(ctx->unk80, 19); - struct UnkStruct_02037CF0* unk_sub = *unk; + struct UnkStruct_02037CF0** unk; + struct UnkStruct_02037CF0* unk_sub; + u16* ret_ptr; + + ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + unk = FUN_02039438(ctx->unk80, 19); + unk_sub = *unk; GF_ASSERT(unk_sub != NULL); @@ -144,49 +147,16 @@ THUMB_FUNC BOOL ScrCmd_Unk0223(struct ScriptContext* ctx) FUN_02088DF0(unk_sub); return FALSE; } -#else -THUMB_FUNC asm BOOL ScrCmd_Unk0223(struct ScriptContext* ctx) -{ - push {r3-r5, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r4, #0x80 - add r5, r0, #0x0 - ldr r0, [r4, #0x0] - mov r1, #0x13 - bl FUN_02039438 - ldr r4, [r0, #0x0] - cmp r4, #0x0 - bne _02045FB2 - bl GF_AssertFail -_02045FB2: - ldrb r0, [r4, #0x16] - cmp r0, #0x0 - bne _02045FBC - mov r0, #0x0 - b _02045FBE -_02045FBC: - mov r0, #0xff -_02045FBE: - strh r0, [r5, #0x0] - add r0, r4, #0x0 - bl FUN_02088DF0 - mov r0, #0x0 - pop {r3-r5, pc} -} -#endif -#ifdef NONMATCHING THUMB_FUNC BOOL ScrCmd_Unk0225(struct ScriptContext* ctx) { - u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); - struct UnkStruct_02037CF0** unk = FUN_02039438(ctx->unk80, 19); - struct UnkStruct_02037CF0* unk_sub = *unk; + struct UnkStruct_02037CF0** unk; + struct UnkStruct_02037CF0* unk_sub; + u16* ret_ptr; + + ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + unk = FUN_02039438(ctx->unk80, 19); + unk_sub = *unk; GF_ASSERT(unk_sub != NULL); @@ -202,39 +172,3 @@ THUMB_FUNC BOOL ScrCmd_Unk0225(struct ScriptContext* ctx) FUN_02088DF0(unk_sub); return FALSE; } -#else -THUMB_FUNC asm BOOL ScrCmd_Unk0225(struct ScriptContext* ctx) -{ - push {r3-r5, lr} - add r4, r0, #0x0 - bl ScriptReadHalfword - add r1, r0, #0x0 - add r0, r4, #0x0 - add r0, #0x80 - ldr r0, [r0, #0x0] - bl GetVarPointer - add r4, #0x80 - add r5, r0, #0x0 - ldr r0, [r4, #0x0] - mov r1, #0x13 - bl FUN_02039438 - ldr r4, [r0, #0x0] - cmp r4, #0x0 - bne _02045FB2 - bl GF_AssertFail -_02045FB2: - ldrb r0, [r4, #0x16] - cmp r0, #0x0 - bne _02045FBC - mov r0, #0x0 - b _02045FBE -_02045FBC: - mov r0, #0xff -_02045FBE: - strh r0, [r5, #0x0] - add r0, r4, #0x0 - bl FUN_02088DF0 - mov r0, #0x0 - pop {r3-r5, pc} -} -#endif -- cgit v1.2.3