summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTal Hayon <talhayon1@gmail.com>2022-08-03 17:09:14 +0300
committerTal Hayon <talhayon1@gmail.com>2022-08-03 17:09:14 +0300
commitd4eec7fdcbcd82639b1bfcc524d886ba7f0ccb6a (patch)
tree0d161c7f0f668c3496e5b442fcd83b3d14253bfe
parent76634df376948b03825fbdcf770ce8351dbe3bd0 (diff)
Match sub_0807C69C
-rw-r--r--asm/non_matching/playerUtils/sub_0807C69C.inc92
-rw-r--r--src/playerUtils.c36
2 files changed, 35 insertions, 93 deletions
diff --git a/asm/non_matching/playerUtils/sub_0807C69C.inc b/asm/non_matching/playerUtils/sub_0807C69C.inc
deleted file mode 100644
index e5a39eba..00000000
--- a/asm/non_matching/playerUtils/sub_0807C69C.inc
+++ /dev/null
@@ -1,92 +0,0 @@
- .syntax unified
- push {r4, r5, r6, r7, lr}
- mov r7, sb
- mov r6, r8
- push {r6, r7}
- mov sb, r0
- adds r6, r1, #0
- mov r8, r2
- mov r0, r8
- muls r0, r6, r0
- add r0, sb
- subs r2, r0, #1
- mov r0, r8
- subs r0, #1
- lsls r0, r0, #6
- add r0, sb
- subs r1, r6, #1
- adds r4, r0, r1
- movs r5, #0
- cmp r5, r8
- bhs _0807C6EA
-_0807C6C4:
- movs r3, #0
- adds r7, r4, #0
- subs r7, #0x40
- subs r0, r2, r6
- mov ip, r0
- cmp r3, r6
- bhs _0807C6E0
-_0807C6D2:
- subs r0, r4, r3
- subs r1, r2, r3
- ldrb r1, [r1]
- strb r1, [r0]
- adds r3, #1
- cmp r3, r6
- blo _0807C6D2
-_0807C6E0:
- adds r4, r7, #0
- mov r2, ip
- adds r5, #1
- cmp r5, r8
- blo _0807C6C4
-_0807C6EA:
- movs r0, #0x40
- subs r7, r0, r6
- movs r5, #0
- mov r1, r8
- lsls r2, r1, #6
- mov r0, sb
- adds r1, r0, r6
-_0807C6F8:
- lsls r0, r5, #6
- adds r4, r1, r0
- movs r3, #0
- adds r6, r5, #1
- cmp r3, r7
- bhs _0807C710
- movs r5, #0
-_0807C706:
- adds r0, r4, r3
- strb r5, [r0]
- adds r3, #1
- cmp r3, r7
- blo _0807C706
-_0807C710:
- adds r5, r6, #0
- cmp r5, #0x3f
- bls _0807C6F8
- movs r0, #0x40
- mov r1, r8
- subs r7, r0, r1
- mov r0, sb
- adds r4, r0, r2
- movs r5, #0
- cmp r5, r7
- bhs _0807C736
-_0807C726:
- adds r0, r4, #0
- movs r1, #0x40
- bl MemClear
- adds r4, #0x40
- adds r5, #1
- cmp r5, r7
- blo _0807C726
-_0807C736:
- pop {r3, r4}
- mov r8, r3
- mov sb, r4
- pop {r4, r5, r6, r7, pc}
- .align 2, 0
- .syntax divided
diff --git a/src/playerUtils.c b/src/playerUtils.c
index 87c1b326..f4438dbf 100644
--- a/src/playerUtils.c
+++ b/src/playerUtils.c
@@ -3255,7 +3255,41 @@ NONMATCH("asm/non_matching/playerUtils/sub_0807C5F4.inc", void sub_0807C5F4(u16*
}
END_NONMATCH
-ASM_FUNC("asm/non_matching/playerUtils/sub_0807C69C.inc", void sub_0807C69C(u8* a, u32 b, u32 c))
+void sub_0807C69C(u8* data, u32 width, u32 height) {
+ u8* ptr1;
+ u8* ptr2;
+ u32 index;
+ u32 innerIndex;
+ u32 tmp1;
+
+ ptr2 = data + width * height - 1;
+ ptr1 = data + (height - 1) * 0x40 - 1 + width;
+
+ for (index = 0; index < height; index++) {
+ for (innerIndex = 0; innerIndex < width; innerIndex++) {
+ ptr1[-innerIndex] = ptr2[-innerIndex];
+ }
+ ptr1 -= 0x40;
+ ptr2 -= width;
+ }
+
+ tmp1 = 0x40 - width;
+
+ for (index = 0; index < 0x40; index++) {
+ ptr1 = data + width + (index * 0x40);
+ for (innerIndex = 0; innerIndex < tmp1; innerIndex++) {
+ ptr1[innerIndex] = 0;
+ }
+ }
+
+ tmp1 = 0x40 - height;
+ ptr1 = data + height * 0x40;
+
+ for (index = 0; index < tmp1; index++) {
+ MemClear(ptr1, 0x40);
+ ptr1 += 0x40;
+ }
+}
NONMATCH("asm/non_matching/playerUtils/sub_0807C740.inc", void InitializeCamera()) {
s32 targetX;