From 155bb03f469d6183fc8bac015da35d563b3bea45 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 18 Nov 2017 21:09:42 -0500 Subject: [PATCH] sub_800C210 --- asm/link_rfu.s | 56 ------------------------------------------------ include/librfu.h | 2 +- src/link_rfu.c | 27 ++++++++++++++++++++++- 3 files changed, 27 insertions(+), 58 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index 7d8c8b2b18..5354304ee5 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,62 +5,6 @@ .text - thumb_func_start sub_800C210 -sub_800C210: @ 800C210 - push {r4-r7,lr} - lsls r0, 24 - lsrs r1, r0, 24 - ldr r6, =gUnknown_03004140 - adds r3, r6, 0 - adds r3, 0x30 - ldrb r2, [r3] - adds r0, r1, 0 - ands r0, r2 - cmp r0, 0 - beq _0800C26C - adds r0, r2, 0 - bics r0, r1 - strb r0, [r3] - movs r4, 0 - ldr r7, =gUnknown_03007890 - movs r5, 0x1 - adds r3, 0x4 - movs r2, 0 -_0800C236: - adds r0, r1, 0 - asrs r0, r4 - ands r0, r5 - cmp r0, 0 - beq _0800C246 - lsls r0, r4, 1 - adds r0, r3 - strh r2, [r0] -_0800C246: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0800C236 - ldr r0, [r7] - ldrb r4, [r0, 0x3] - ands r4, r1 - cmp r4, 0 - beq _0800C260 - adds r0, r4, 0 - bl sub_800D334 -_0800C260: - ldr r0, =gUnknown_03004140 - strh r4, [r0, 0x14] - movs r0, 0x33 - adds r1, r4, 0 - bl sub_800D30C -_0800C26C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800C210 - thumb_func_start sub_800C27C sub_800C27C: @ 800C27C push {r4,r5,lr} diff --git a/include/librfu.h b/include/librfu.h index 481845f095..292b144064 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -132,7 +132,7 @@ struct RfuUnk5 u8 unk_00; u8 filler_01[2]; u8 unk_03; - u8 filler_04[4]; + u8 unk_04[4]; u8 unk_08; u8 filler_09[11]; u16 unk_14; diff --git a/src/link_rfu.c b/src/link_rfu.c index 8d81cddc4d..32365debb5 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -25,6 +25,7 @@ void sub_800C000(void); void sub_800CEB0(u16 unk0); void sub_800C7B4(u16 unk0, u16 unk1); void sub_800D30C(u8 a0, u8 a1); +void sub_800D334(u8 a0); void sub_800D610(void); // .rodata @@ -209,7 +210,7 @@ u8 sub_800C12C(u16 r6, u16 r8) sub_800D30C(0xF3, 0x01); return 2; } - for (i = 0; i < gUnknown_03007890->unk_08; i ++) + for (i = 0; i < gUnknown_03007890->unk_08; i++) { tmp = &gUnknown_03007890[i]; if (tmp->unk_14 == r6) @@ -241,3 +242,27 @@ u8 sub_800C12C(u16 r6, u16 r8) } return 0; } + +void sub_800C210(u8 a0) +{ + u8 i; + + if (a0 & gUnknown_03004140.unk_30) + { + gUnknown_03004140.unk_30 &= ~a0; + for (i = 0; i < 4; i++) + { + if ((a0 >> i) & 1) + { + gUnknown_03004140.unk_34[i] = 0; + } + } + i = gUnknown_03007890->unk_03 & a0; + if (i) + { + sub_800D334(i); + } + gUnknown_03004140.unk_14 = i; + sub_800D30C(0x33, i); + } +}