A few more functions decompiled

This commit is contained in:
Phlosioneer 2019-03-15 02:33:55 -04:00
parent 31ded7cc6f
commit a71c563b10
2 changed files with 87 additions and 179 deletions

View file

@ -5,179 +5,6 @@
.text
thumb_func_start sub_81C87F0
sub_81C87F0: @ 81C87F0
push {r4,lr}
movs r0, 0x11
bl GetSubstructPtr
adds r4, r0, 0
ldr r0, =0x0000089c
adds r1, r4, r0
movs r0, 0
str r0, [r1]
ldr r0, =sub_81C8A28
movs r1, 0x6
bl sub_81C7078
movs r1, 0x8A
lsls r1, 4
adds r4, r1
str r0, [r4]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C87F0
thumb_func_start sub_81C8820
sub_81C8820: @ 81C8820
push {lr}
movs r0, 0x11
bl GetSubstructPtr
movs r1, 0x8A
lsls r1, 4
adds r0, r1
ldr r0, [r0]
bl sub_81C70D8
pop {r1}
bx r1
thumb_func_end sub_81C8820
thumb_func_start sub_81C8838
sub_81C8838: @ 81C8838
push {r4,lr}
movs r0, 0x11
bl GetSubstructPtr
adds r4, r0, 0
ldr r0, =0x00000888
adds r2, r4, r0
ldrh r0, [r4, 0x8]
ldrh r1, [r2]
ldrh r3, [r2, 0x6]
adds r1, r3
ldrh r2, [r4, 0xA]
adds r2, r3
movs r3, 0xF
ands r2, r3
ldr r3, [r4, 0x38]
bl _call_via_r3
ldrb r0, [r4, 0x8]
movs r1, 0x1
bl CopyWindowToVram
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C8838
thumb_func_start sub_81C8870
sub_81C8870: @ 81C8870
push {r4,r5,lr}
adds r5, r0, 0
movs r0, 0x11
bl GetSubstructPtr
adds r4, r0, 0
cmp r5, 0x4
bhi _081C894C
lsls r0, r5, 2
ldr r1, =_081C8890
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081C8890:
.4byte _081C88A4
.4byte _081C88AC
.4byte _081C88D8
.4byte _081C8918
.4byte _081C8938
_081C88A4:
adds r0, r4, 0
movs r1, 0x1
bl sub_81C9008
_081C88AC:
ldr r0, =0x0000089c
adds r5, r4, r0
ldr r1, =0x0000088e
adds r0, r4, r1
ldr r1, [r5]
ldrh r0, [r0]
cmp r1, r0
beq _081C88C4
adds r0, r4, 0
movs r2, 0x1
bl sub_81C8B70
_081C88C4:
ldr r0, [r5]
adds r0, 0x1
str r0, [r5]
_081C88CA:
movs r0, 0
b _081C894E
.pool
_081C88D8:
bl IsDma3ManagerBusyWithBgCopy
lsls r0, 24
cmp r0, 0
bne _081C8942
ldr r2, =0x0000089c
adds r0, r4, r2
subs r2, 0xC
adds r1, r4, r2
ldr r3, [r0]
ldrh r1, [r1]
cmp r3, r1
beq _081C88FC
movs r0, 0x6
b _081C894E
.pool
_081C88FC:
ldr r0, =0x0000088e
adds r1, r4, r0
ldrh r0, [r1]
cmp r0, 0
beq _081C88CA
adds r2, r0, 0
adds r0, r4, 0
adds r1, r3, 0
bl sub_81C8B70
b _081C88CA
.pool
_081C8918:
bl IsDma3ManagerBusyWithBgCopy
lsls r0, 24
cmp r0, 0
bne _081C8942
ldr r2, =0x0000088e
adds r1, r4, r2
ldrh r0, [r1]
cmp r0, 0
beq _081C894C
movs r1, 0
bl sub_81C84E8
b _081C88CA
.pool
_081C8938:
bl sub_81C8630
adds r1, r0, 0
cmp r1, 0
beq _081C8946
_081C8942:
movs r0, 0x2
b _081C894E
_081C8946:
ldr r2, =0x0000088e
adds r0, r4, r2
strh r1, [r0]
_081C894C:
movs r0, 0x4
_081C894E:
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_81C8870
thumb_func_start sub_81C8958
sub_81C8958: @ 81C8958
push {r4,r5,lr}

View file

@ -36,8 +36,7 @@ struct UnknownSubSubStruct_0203CF40 {
u8 unk4;
u8 unk5;
u16 unk6;
u8 windowId;
u8 unk9;
u16 windowId;
u16 unkA;
u16 unkC;
u16 unkE;
@ -173,18 +172,21 @@ extern u32 sub_81C91AC(struct UnknownSubStruct_81C81D4 *a0, const void *a1, void
extern u32 sub_81C9160(struct UnknownSubSubStruct_81C81D4 *a0, void *a1);
extern void sub_81C8ED0(void);
extern void sub_81C8EF8(struct UnknownSubSubStruct_81C81D4 *a0, struct UnknownSubSubStruct_0203CF40 *a1);
extern u32 sub_81C8870(s32 a0);
extern u32 sub_81C8958(s32 a0);
extern u32 sub_81C8A28(s32 a0);
extern void sub_81C8B70(struct UnknownSubSubStruct_0203CF40 *a0, u32 a1, u32 a2);
extern void sub_81C9008(struct UnknownSubStruct_81C81D4 *a0, u32 a1);
u32 sub_81C85A0(s32);
u32 sub_81C8870(s32 a0);
u32 sub_81C85A0(s32 a0);
void sub_81C8568(s32 a0, struct UnknownSubStruct_81C81D4 *a1);
u32 sub_81C83F0(s32);
u32 sub_81C83F0(s32 a0);
bool32 sub_81C83E0(void);
void sub_81C83AC(u32 a0, u32 a1, u32 a2, u32 a3, u32 a4, struct UnknownSubStruct_81C81D4 *a5);
void sub_81C837C(struct UnknownSubSubStruct_81C81D4 *a0, struct UnknownSubStruct_81C81D4 *a1);
void sub_81C835C(struct UnknownSubSubStruct_0203CF40 *a0);
void sub_81C82E4(struct UnknownSubStruct_81C81D4 *a0);
u32 sub_81C8254(s32);
u32 sub_81C8254(s32 a0);
u32 sub_81C791C(s32 a0);
bool32 sub_81C756C(u32 a0);
bool32 sub_81C76C4(void);
@ -2027,4 +2029,83 @@ void sub_81C87AC(u16 a0)
structPtr->unk888.unk0 = temp;
structPtr->unk89C = 0;
structPtr->unk8A0 = sub_81C7078(sub_81C8958, 6);
}
void sub_81C87F0(void)
{
struct UnknownSubStruct_81C81D4 *structPtr;
structPtr = GetSubstructPtr(0x11);
structPtr->unk89C = 0;
structPtr->unk8A0 = sub_81C7078(sub_81C8A28, 6);
}
bool32 sub_81C8820(void)
{
struct UnknownSubStruct_81C81D4 *structPtr;
structPtr = GetSubstructPtr(0x11);
return sub_81C70D8(structPtr->unk8A0);
}
void sub_81C8838(void)
{
struct UnknownSubStruct_81C81D4 *structPtr;
struct UnknownSubSubStruct_81C81D4 *subStr;
structPtr = GetSubstructPtr(0x11);
subStr = &structPtr->unk888;
structPtr->unk38(structPtr->unk0.windowId, subStr->unk0 + subStr->unk6, (structPtr->unk0.unkA + subStr->unk6) & 0xF);
CopyWindowToVram(structPtr->unk0.windowId, 1);
}
u32 sub_81C8870(s32 a0)
{
struct UnknownSubStruct_81C81D4 *structPtr;
u16 v1;
u32 v2;
// Needed to fix a register renaming issue.
register u16* temp asm("r1");
structPtr = GetSubstructPtr(0x11);
switch (a0)
{
case 0:
sub_81C9008(structPtr, 1);
// fall-through
case 1:
if (structPtr->unk89C != structPtr->unk888.unk6)
sub_81C8B70(&structPtr->unk0, structPtr->unk89C, 1);
structPtr->unk89C++;
return 0;
case 2:
if (IsDma3ManagerBusyWithBgCopy())
return 2;
if (structPtr->unk89C != structPtr->unk888.unk8)
return 6;
if (structPtr->unk888.unk6 != 0)
sub_81C8B70(&structPtr->unk0, structPtr->unk89C, structPtr->unk888.unk6);
return 0;
case 3:
if (IsDma3ManagerBusyWithBgCopy())
return 2;
temp = &structPtr->unk888.unk6;
v1 = *temp;
if (v1 == 0)
return 4;
sub_81C84E8(v1, 0);
return 0;
case 4:
v2 = sub_81C8630();
if (v2)
return 2;
structPtr->unk888.unk6 = v2;
return 4;
default:
return 4;
}
}