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') 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