From 80f15cd75b893740db734d47c218737059a8fab9 Mon Sep 17 00:00:00 2001 From: Henny022p Date: Tue, 16 Feb 2021 18:09:14 +0100 Subject: [PATCH] nonmatch sub_0807D1D8 --- asm/code_0807CC3C.s | 32 ---------------- .../code_0807CC3C/sub_0807D1D8.inc | 37 +++++++++++++++++++ .../code_0807CC3C/sub_0807D20C.inc | 3 -- src/code_0807CC3C.c | 7 +++- 4 files changed, 42 insertions(+), 37 deletions(-) create mode 100644 asm/non_matching/code_0807CC3C/sub_0807D1D8.inc diff --git a/asm/code_0807CC3C.s b/asm/code_0807CC3C.s index 11b495f8..32a1fc91 100644 --- a/asm/code_0807CC3C.s +++ b/asm/code_0807CC3C.s @@ -323,35 +323,3 @@ sub_0807D1C4: @ 0x0807D1C4 .align 2, 0 _0807D1D4: .4byte gUnk_0811E4BC - thumb_func_start sub_0807D1D8 -sub_0807D1D8: @ 0x0807D1D8 - push {r4, r5, r6, lr} - adds r5, r0, #0 - adds r6, r1, #0 - lsrs r4, r2, #3 - adds r0, r4, #0 - lsrs r5, r5, #3 - b _0807D200 -_0807D1E6: - lsls r0, r5, #0x10 - lsrs r0, r0, #0x10 - adds r1, r6, #0 - bl sub_080B15E8 - lsls r0, r0, #0x10 - cmp r0, #0 - beq _0807D1FA - movs r0, #0 - b _0807D208 -_0807D1FA: - adds r5, #1 - adds r6, #8 - adds r0, r4, #0 -_0807D200: - subs r4, #1 - cmp r0, #0 - bne _0807D1E6 - movs r0, #1 -_0807D208: - pop {r4, r5, r6, pc} - .align 2, 0 - diff --git a/asm/non_matching/code_0807CC3C/sub_0807D1D8.inc b/asm/non_matching/code_0807CC3C/sub_0807D1D8.inc new file mode 100644 index 00000000..f96b3810 --- /dev/null +++ b/asm/non_matching/code_0807CC3C/sub_0807D1D8.inc @@ -0,0 +1,37 @@ + .include "asm/macros.inc" + + .include "constants/constants.inc" + + .syntax unified + + .text + + push {r4, r5, r6, lr} + adds r5, r0, #0 + adds r6, r1, #0 + lsrs r4, r2, #3 + adds r0, r4, #0 + lsrs r5, r5, #3 + b _0807D200 +_0807D1E6: + lsls r0, r5, #0x10 + lsrs r0, r0, #0x10 + adds r1, r6, #0 + bl sub_080B15E8 + lsls r0, r0, #0x10 + cmp r0, #0 + beq _0807D1FA + movs r0, #0 + b _0807D208 +_0807D1FA: + adds r5, #1 + adds r6, #8 + adds r0, r4, #0 +_0807D200: + subs r4, #1 + cmp r0, #0 + bne _0807D1E6 + movs r0, #1 +_0807D208: + pop {r4, r5, r6, pc} + .align 2, 0 diff --git a/asm/non_matching/code_0807CC3C/sub_0807D20C.inc b/asm/non_matching/code_0807CC3C/sub_0807D20C.inc index 31a81d5b..e1822fc3 100644 --- a/asm/non_matching/code_0807CC3C/sub_0807D20C.inc +++ b/asm/non_matching/code_0807CC3C/sub_0807D20C.inc @@ -1,6 +1,3 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" .syntax unified diff --git a/src/code_0807CC3C.c b/src/code_0807CC3C.c index 69c81441..ef470d10 100644 --- a/src/code_0807CC3C.c +++ b/src/code_0807CC3C.c @@ -25,9 +25,12 @@ extern u16 sub_080B18DC(u16, const char*); void sub_0807DB88(ScriptExecutionContext* context, u32 unk1); void sub_0807DAF0(Entity* entity, ScriptExecutionContext* context, u32 unk1); +// these three are basically the same and wrong by basically one instruction in the wrong place +NONMATCH("asm/non_matching/code_0807CC3C/sub_0807D1D8.inc", u32 sub_0807D1D8(u32 unk_1, const char* unk_2, u32 unk_3)) { +} +END_NONMATCH -// this is wrong by basically one instruction in the wrong place -NONMATCH("asm/non_matching/code_0807CC3C/sub_0807D20C.inc",u32 sub_0807D20C(u32 unk_1, const char* unk_2, u32 unk_3)) { +NONMATCH("asm/non_matching/code_0807CC3C/sub_0807D20C.inc", u32 sub_0807D20C(u32 unk_1, const char* unk_2, u32 unk_3)) { unk_3 >>= 3; unk_1 >>= 3; while (unk_3-- > 0) {