sub_800C7B4

This commit is contained in:
PikalaxALT 2017-11-21 09:14:43 -05:00
parent 035c0b0ecd
commit 7a38a43f81
4 changed files with 377 additions and 856 deletions

View File

@ -5,860 +5,6 @@
.text
thumb_func_start sub_800C7B4
sub_800C7B4: @ 800C7B4
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x4
lsls r0, 16
lsrs r0, 16
mov r8, r0
lsls r1, 16
lsrs r6, r1, 16
ldr r0, =gUnknown_03004140
ldrb r1, [r0, 0xE]
adds r7, r0, 0
cmp r1, 0
bne _0800C7D2
b _0800CC98
_0800C7D2:
movs r0, 0
strb r0, [r7, 0xE]
mov r0, r8
subs r0, 0x10
cmp r0, 0x2D
bls _0800C7E0
b _0800CC8A
_0800C7E0:
lsls r0, 2
ldr r1, =_0800C7F4
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_0800C7F4:
.4byte _0800C8AC
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800C8D8
.4byte _0800C8C4
.4byte _0800CC8A
.4byte _0800C8EC
.4byte _0800C8FC
.4byte _0800C920
.4byte _0800C940
.4byte _0800C960
.4byte _0800C9D0
.4byte _0800CA02
.4byte _0800CA18
.4byte _0800CA60
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CBD8
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CAD0
.4byte _0800CB1C
.4byte _0800CB64
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC8A
.4byte _0800CC78
_0800C8AC:
cmp r6, 0
beq _0800C8B2
b _0800CC8A
_0800C8B2:
ldr r0, =gUnknown_03004140
ldrb r1, [r0, 0x5]
strb r1, [r0, 0x4]
movs r1, 0x4
strb r1, [r0, 0x5]
b _0800CC8A
.pool
_0800C8C4:
cmp r6, 0
beq _0800C8CA
b _0800CC8A
_0800C8CA:
ldr r0, =gUnknown_03004140
ldrb r1, [r0, 0x5]
strb r1, [r0, 0x4]
strb r6, [r0, 0x5]
b _0800CC8A
.pool
_0800C8D8:
cmp r6, 0
beq _0800C8DE
b _0800CC8A
_0800C8DE:
ldr r0, =gUnknown_03004140
strb r6, [r0, 0x5]
strb r6, [r0, 0x4]
movs r0, 0
b _0800CBF6
.pool
_0800C8EC:
cmp r6, 0
beq _0800C8F2
b _0800CC8A
_0800C8F2:
ldr r1, =gUnknown_03004140
movs r0, 0x6
b _0800CA0C
.pool
_0800C8FC:
ldr r1, =gUnknown_03004140
ldrh r0, [r1, 0x1A]
cmp r0, 0
bne _0800C906
b _0800CC8A
_0800C906:
subs r0, 0x1
strh r0, [r1, 0x1A]
lsls r0, 16
cmp r0, 0
beq _0800C912
b _0800CC8A
_0800C912:
movs r0, 0x7
strb r0, [r1, 0x4]
movs r0, 0x8
strb r0, [r1, 0x5]
b _0800CC8A
.pool
_0800C920:
cmp r6, 0
beq _0800C926
b _0800CC8A
_0800C926:
ldr r0, =gUnknown_03004140
ldrb r1, [r0, 0x5]
strb r1, [r0, 0x4]
strb r6, [r0, 0x5]
ldrb r0, [r0, 0x7]
cmp r0, 0
beq _0800C936
b _0800CC8A
_0800C936:
movs r0, 0x13
b _0800CBF6
.pool
_0800C940:
cmp r6, 0
beq _0800C946
b _0800CC8A
_0800C946:
ldrb r0, [r7, 0xB]
cmp r0, 0x1
bne _0800C956
ldrh r0, [r7, 0x1A]
cmp r0, 0x1
bls _0800C956
subs r0, 0x1
strh r0, [r7, 0x1A]
_0800C956:
ldr r1, =gUnknown_03004140
movs r0, 0xA
b _0800CA0C
.pool
_0800C960:
cmp r6, 0
bne _0800C9A6
bl sub_800D294
lsls r0, 24
lsrs r0, 24
mov r1, sp
strb r0, [r1]
ldr r4, =gUnknown_03004140
strh r0, [r4, 0x14]
cmp r0, 0
beq _0800C980
movs r0, 0x20
movs r1, 0x1
bl sub_800D30C
_0800C980:
ldrb r0, [r4, 0xB]
cmp r0, 0
beq _0800C9A6
ldrh r0, [r4, 0x1A]
cmp r0, 0x1
beq _0800C9A6
ldr r0, =gUnknown_03007890
ldr r0, [r0]
ldrb r0, [r0, 0x8]
cmp r0, 0x4
bne _0800C9A6
bl rfu_REQ_endSearchParent
bl rfu_waitREQComplete
movs r0, 0x9
strb r0, [r4, 0x4]
movs r0, 0x1
strb r0, [r4, 0xB]
_0800C9A6:
ldr r1, =gUnknown_03004140
ldrh r0, [r1, 0x1A]
cmp r0, 0
bne _0800C9B0
b _0800CC8A
_0800C9B0:
subs r0, 0x1
strh r0, [r1, 0x1A]
lsls r0, 16
cmp r0, 0
beq _0800C9BC
b _0800CC8A
_0800C9BC:
movs r0, 0xB
strb r0, [r1, 0x4]
movs r0, 0
strb r0, [r1, 0x5]
b _0800CC8A
.pool
_0800C9D0:
cmp r6, 0
beq _0800C9D6
b _0800CC8A
_0800C9D6:
ldr r2, =gUnknown_03004140
ldrb r0, [r2, 0x5]
strb r0, [r2, 0x4]
ldrb r1, [r2, 0x7]
cmp r1, 0
bne _0800C9F4
lsls r0, 24
cmp r0, 0
beq _0800C9EA
b _0800CC8A
_0800C9EA:
movs r0, 0x21
b _0800CBF6
.pool
_0800C9F4:
cmp r1, 0x7
bne _0800C9FA
b _0800CC8A
_0800C9FA:
movs r0, 0x5
strb r0, [r2, 0x4]
strb r0, [r2, 0x7]
b _0800CC8A
_0800CA02:
cmp r6, 0
beq _0800CA08
b _0800CC8A
_0800CA08:
ldr r1, =gUnknown_03004140
movs r0, 0xD
_0800CA0C:
strb r0, [r1, 0x5]
strb r0, [r1, 0x4]
b _0800CC8A
.pool
_0800CA18:
cmp r6, 0
bne _0800CA3C
ldr r4, =gUnknown_03004140+0x10
mov r0, sp
adds r1, r4, 0
bl rfu_getConnectParentStatus
lsls r0, 16
cmp r0, 0
bne _0800CA3C
mov r0, sp
ldrb r0, [r0]
cmp r0, 0
bne _0800CA3C
adds r1, r4, 0
subs r1, 0x10
movs r0, 0xE
strb r0, [r1, 0x4]
_0800CA3C:
ldr r1, =gUnknown_03004140
ldrh r0, [r1, 0x1A]
cmp r0, 0
bne _0800CA46
b _0800CC8A
_0800CA46:
subs r0, 0x1
strh r0, [r1, 0x1A]
lsls r0, 16
cmp r0, 0
beq _0800CA52
b _0800CC8A
_0800CA52:
movs r0, 0xE
strb r0, [r1, 0x4]
b _0800CC8A
.pool
_0800CA60:
cmp r6, 0
beq _0800CA66
b _0800CC8A
_0800CA66:
ldr r4, =gUnknown_03004140+0x10
mov r0, sp
adds r1, r4, 0
bl rfu_getConnectParentStatus
lsls r0, 16
cmp r0, 0
beq _0800CA78
b _0800CC8A
_0800CA78:
mov r0, sp
ldrb r0, [r0]
cmp r0, 0
bne _0800CA9C
adds r1, r4, 0
subs r1, 0x10
movs r0, 0x13
strb r0, [r1, 0x4]
movs r0, 0xF
strb r0, [r1, 0x5]
movs r0, 0x22
strh r0, [r1, 0x1E]
ldrb r0, [r1, 0x10]
strh r0, [r1, 0x14]
b _0800CABC
.pool
_0800CA9C:
adds r1, r4, 0
subs r1, 0x10
strb r6, [r1, 0x5]
strb r6, [r1, 0x4]
movs r0, 0x23
strh r0, [r1, 0x1E]
mov r0, sp
ldrb r0, [r0]
strh r0, [r1, 0x14]
ldrb r0, [r1, 0x7]
cmp r0, 0
beq _0800CABC
movs r0, 0x3
strb r0, [r1, 0x7]
movs r0, 0x9
strb r0, [r1, 0x4]
_0800CABC:
ldr r4, =gUnknown_03004140
ldrb r0, [r4, 0x1E]
movs r1, 0x1
bl sub_800D30C
movs r0, 0
strh r0, [r4, 0x1E]
b _0800CC8A
.pool
_0800CAD0:
cmp r6, 0
beq _0800CAD6
b _0800CC8A
_0800CAD6:
ldr r2, =gUnknown_03007890
ldr r3, [r2]
ldrb r0, [r3, 0x3]
movs r1, 0
strh r0, [r7, 0x14]
movs r0, 0x11
strb r0, [r7, 0x5]
strb r0, [r7, 0x4]
strb r1, [r7, 0x10]
ldrb r0, [r3, 0x3]
movs r1, 0x1
ands r0, r1
cmp r0, 0
beq _0800CAF4
b _0800CC8A
_0800CAF4:
adds r1, r7, 0
movs r3, 0x1
_0800CAF8:
ldrb r0, [r1, 0x10]
adds r0, 0x1
strb r0, [r1, 0x10]
lsls r0, 24
lsrs r0, 24
cmp r0, 0x3
bls _0800CB08
b _0800CC8A
_0800CB08:
ldr r0, [r2]
ldrb r0, [r0, 0x3]
ldrb r4, [r7, 0x10]
asrs r0, r4
ands r0, r3
cmp r0, 0
beq _0800CAF8
b _0800CC8A
.pool
_0800CB1C:
cmp r6, 0
bne _0800CB3A
mov r0, sp
bl rfu_CHILD_getConnectRecoveryStatus
lsls r0, 16
cmp r0, 0
bne _0800CB3A
mov r0, sp
ldrb r0, [r0]
cmp r0, 0x1
bhi _0800CB3A
ldr r1, =gUnknown_03004140
movs r0, 0x12
strb r0, [r1, 0x4]
_0800CB3A:
ldr r2, =gUnknown_03004140
ldrb r0, [r2, 0x10]
lsls r0, 1
adds r1, r2, 0
adds r1, 0x34
adds r1, r0, r1
ldrh r0, [r1]
cmp r0, 0
bne _0800CB4E
b _0800CC8A
_0800CB4E:
subs r0, 0x1
strh r0, [r1]
lsls r0, 16
cmp r0, 0
beq _0800CB5A
b _0800CC8A
_0800CB5A:
movs r0, 0x12
strb r0, [r2, 0x4]
b _0800CC8A
.pool
_0800CB64:
cmp r6, 0
beq _0800CB6A
b _0800CC8A
_0800CB6A:
mov r0, sp
bl rfu_CHILD_getConnectRecoveryStatus
lsls r0, 16
cmp r0, 0
beq _0800CB78
b _0800CC8A
_0800CB78:
mov r0, sp
ldrb r0, [r0]
cmp r0, 0
bne _0800CB94
ldr r1, =gUnknown_03004140
movs r0, 0x13
strb r0, [r1, 0x4]
movs r0, 0x16
strb r0, [r1, 0x5]
movs r0, 0x32
strh r0, [r1, 0x1E]
b _0800CBA8
.pool
_0800CB94:
ldr r4, =gUnknown_03004140
strb r6, [r4, 0x5]
strb r6, [r4, 0x4]
ldr r0, =gUnknown_03007890
ldr r0, [r0]
ldrb r0, [r0, 0x3]
bl sub_800D334
movs r0, 0x33
strh r0, [r4, 0x1E]
_0800CBA8:
ldr r5, =gUnknown_03004140
ldrb r0, [r5, 0x10]
lsls r0, 1
adds r1, r5, 0
adds r1, 0x34
adds r0, r1
movs r1, 0
movs r4, 0
strh r4, [r0]
adds r0, r5, 0
adds r0, 0x30
strb r1, [r0]
strb r1, [r5, 0xA]
ldrb r0, [r5, 0x1E]
movs r1, 0x1
bl sub_800D30C
strh r4, [r5, 0x1E]
b _0800CC8A
.pool
_0800CBD8:
cmp r6, 0
bne _0800CC8A
ldr r5, =gUnknown_03004140
ldrb r1, [r5, 0x5]
adds r0, r1, 0
cmp r0, 0x16
bne _0800CC04
ldrb r0, [r5, 0x11]
strb r0, [r5, 0x4]
ldrb r0, [r5, 0x12]
strb r0, [r5, 0x5]
ldrb r0, [r5, 0x2]
movs r0, 0x1
strb r0, [r5, 0x2]
movs r0, 0x41
_0800CBF6:
movs r1, 0
bl sub_800D30C
b _0800CC8A
.pool
_0800CC04:
cmp r0, 0xF
bne _0800CC8A
strb r1, [r5, 0x4]
ldrb r0, [r5, 0x2]
movs r4, 0x1
strb r4, [r5, 0x2]
movs r0, 0x41
movs r1, 0
bl sub_800D30C
adds r1, r5, 0
adds r1, 0x24
ldrb r0, [r5, 0x10]
lsls r4, r0
ldrb r0, [r1]
orrs r4, r0
strb r4, [r1]
ldrb r0, [r5, 0x10]
lsls r0, 1
adds r1, 0x4
adds r0, r1
ldrh r1, [r5, 0x26]
movs r7, 0
strh r1, [r0]
ldrb r1, [r5, 0x10]
movs r0, 0x4
bl rfu_clearSlot
mov r4, sp
ldrb r0, [r5, 0x10]
movs r1, 0xE
bl rfu_NI_CHILD_setSendGameName
strb r0, [r4]
lsls r0, 24
cmp r0, 0
beq _0800CC8A
strb r7, [r5, 0x5]
strb r7, [r5, 0x4]
bl sub_800D610
ldr r0, =gUnknown_03007890
ldr r0, [r0]
ldrb r1, [r0, 0x2]
ldrb r0, [r0, 0x3]
orrs r0, r1
bl sub_800D334
mov r0, sp
ldrb r0, [r0]
strh r0, [r5, 0x14]
movs r0, 0x25
movs r1, 0x1
bl sub_800D30C
b _0800CC8A
.pool
_0800CC78:
cmp r6, 0
bne _0800CC8A
ldr r0, =gUnknown_03004140
strb r6, [r0, 0x5]
strb r6, [r0, 0x4]
movs r0, 0x42
movs r1, 0
bl sub_800D30C
_0800CC8A:
ldr r1, =gUnknown_03004140
movs r0, 0x1
strb r0, [r1, 0xE]
b _0800CCE6
.pool
_0800CC98:
cmp r6, 0x3
bne _0800CCE6
ldrb r0, [r7, 0xF]
cmp r0, 0
beq _0800CCE6
mov r3, r8
cmp r3, 0x24
beq _0800CCB0
cmp r3, 0x26
beq _0800CCB0
cmp r3, 0x27
bne _0800CCE6
_0800CCB0:
bl rfu_REQ_RFUStatus
bl rfu_waitREQComplete
mov r0, sp
bl rfu_getRFUStatus
mov r0, sp
ldrb r0, [r0]
cmp r0, 0
bne _0800CCE6
ldr r4, =gUnknown_03007890
ldr r0, [r4]
ldrb r0, [r0]
cmp r0, 0
bne _0800CCE6
bl rfu_getSTWIRecvBuffer
ldr r1, [r4]
ldrb r1, [r1, 0x2]
strb r1, [r0, 0x4]
movs r1, 0x1
strb r1, [r0, 0x5]
movs r0, 0x29
bl sub_800C36C
movs r6, 0
_0800CCE6:
mov r4, r8
cmp r4, 0x26
bne _0800CCEE
b _0800CE02
_0800CCEE:
cmp r4, 0x26
bgt _0800CD00
cmp r4, 0x10
bne _0800CCF8
b _0800CE20
_0800CCF8:
b _0800CE3E
.pool
_0800CD00:
mov r0, r8
cmp r0, 0x30
beq _0800CD0E
cmp r0, 0x3D
bne _0800CD0C
b _0800CE20
_0800CD0C:
b _0800CE3E
_0800CD0E:
cmp r6, 0
beq _0800CD14
b _0800CE42
_0800CD14:
bl rfu_getSTWIRecvBuffer
ldr r4, =gUnknown_03004140
ldrb r0, [r0, 0x8]
strh r0, [r4, 0x14]
bl sub_800D358
adds r2, r4, 0
adds r2, 0x30
ldrb r1, [r2]
cmp r1, 0
beq _0800CD6A
ldrb r0, [r4, 0x14]
adds r3, r1, 0
bics r3, r0
adds r0, r3, 0
strb r0, [r2]
movs r3, 0
adds r7, r4, 0
adds r1, r7, 0
movs r5, 0x1
adds r4, r1, 0
adds r4, 0x34
movs r2, 0
_0800CD44:
ldrh r0, [r1, 0x14]
asrs r0, r3
ands r0, r5
cmp r0, 0
beq _0800CD54
lsls r0, r3, 1
adds r0, r4
strh r2, [r0]
_0800CD54:
adds r0, r3, 0x1
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0x3
bls _0800CD44
ldr r1, =gUnknown_03004140
ldrb r0, [r1, 0x6]
cmp r0, 0
bne _0800CD6A
strb r0, [r1, 0x5]
strb r0, [r1, 0x4]
_0800CD6A:
mov r3, sp
ldr r1, =gUnknown_03004140
ldrb r2, [r1]
ldrb r0, [r1, 0x14]
ands r0, r2
strb r0, [r3]
movs r3, 0
adds r7, r1, 0
ldr r2, =gUnknown_03007890
mov r1, sp
movs r5, 0x1
adds r4, r7, 0
_0800CD82:
ldrb r0, [r1]
asrs r0, r3
ands r0, r5
cmp r0, 0
beq _0800CD96
ldrb r0, [r4, 0x1]
cmp r0, 0
beq _0800CD96
subs r0, 0x1
strb r0, [r7, 0x1]
_0800CD96:
adds r0, r3, 0x1
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0x3
bls _0800CD82
ldrb r1, [r7, 0x14]
ldrb r0, [r7]
bics r0, r1
strb r0, [r7]
ldrb r1, [r7, 0x7]
cmp r1, 0
beq _0800CDE0
ldr r0, [r2]
ldrb r0, [r0]
cmp r0, 0xFF
bne _0800CDF2
cmp r1, 0x8
bne _0800CDCC
ldrh r0, [r7, 0x1C]
strh r0, [r7, 0x1A]
movs r0, 0x6
strb r0, [r7, 0x7]
b _0800CDDE
.pool
_0800CDCC:
ldrb r0, [r7, 0x4]
subs r0, 0x6
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bls _0800CDE0
movs r0, 0x1
strb r0, [r7, 0x7]
movs r0, 0x5
_0800CDDE:
strb r0, [r7, 0x4]
_0800CDE0:
ldr r0, [r2]
ldrb r0, [r0]
cmp r0, 0xFF
bne _0800CDF2
ldrb r0, [r7, 0x4]
cmp r0, 0
bne _0800CDF2
movs r0, 0xFF
strb r0, [r7, 0x6]
_0800CDF2:
ldrb r0, [r7, 0xE]
cmp r0, 0
bne _0800CE3E
movs r0, 0x40
movs r1, 0x1
bl sub_800D30C
b _0800CE3E
_0800CE02:
bl sub_800D20C
ldr r0, =gUnknown_03007890
ldr r0, [r0]
ldrb r0, [r0]
cmp r0, 0xFF
beq _0800CE3E
movs r0, 0x50
movs r1, 0
bl sub_800D30C
b _0800CE3E
.pool
_0800CE20:
cmp r6, 0
bne _0800CE42
ldr r0, =gUnknown_03004140
strb r6, [r0, 0xD]
strb r6, [r0, 0x1]
strb r6, [r0]
movs r1, 0xFF
strb r1, [r0, 0x6]
bl sub_800D610
mov r4, r8
cmp r4, 0x3D
bne _0800CE3E
bl sub_800BFA0
_0800CE3E:
cmp r6, 0
beq _0800CE92
_0800CE42:
ldr r7, =gUnknown_03004140
mov r0, r8
cmp r0, 0x1C
bne _0800CE74
cmp r6, 0
beq _0800CE74
ldrb r0, [r7, 0x7]
cmp r0, 0x4
bne _0800CE74
ldr r2, =gUnknown_03007890
ldr r1, [r2]
movs r0, 0x1
strb r0, [r1]
ldr r1, [r2]
movs r0, 0xF
strb r0, [r1, 0x2]
bl sub_800D334
bl rfu_waitREQComplete
b _0800CEA4
.pool
_0800CE74:
movs r1, 0
mov r3, r8
strh r3, [r7, 0x14]
strh r6, [r7, 0x16]
ldrb r0, [r7, 0xE]
cmp r0, 0
beq _0800CE86
strb r1, [r7, 0x5]
strb r1, [r7, 0x4]
_0800CE86:
movs r0, 0xF0
movs r1, 0x2
bl sub_800D30C
bl sub_800D610
_0800CE92:
mov r4, r8
cmp r4, 0xFF
bne _0800CEA4
movs r0, 0xF2
movs r1, 0
bl sub_800D30C
bl sub_800D610
_0800CEA4:
add sp, 0x4
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_800C7B4
thumb_func_start sub_800CEB0
sub_800CEB0: @ 800CEB0
push {r4-r7,lr}

View File

@ -130,7 +130,8 @@ struct RfuUnk3
struct RfuUnk5
{
u8 unk_00;
u8 filler_01[2];
u8 unk_01;
u8 unk_02;
u8 unk_03;
u8 unk_04[4];
u8 unk_08;
@ -175,3 +176,10 @@ void rfu_REQ_CHILD_startConnectRecovery(u8);
void rfu_REQ_CHILD_pollConnectRecovery(void);
void rfu_REQ_CHILD_endConnectRecovery(void);
void rfu_REQ_changeMasterSlave(void);
void rfu_REQ_RFUStatus(void);
void rfu_getRFUStatus(u8 *status);
u8 *rfu_getSTWIRecvBuffer(void);
u8 rfu_NI_CHILD_setSendGameName(u8 a0, u8 a1);
void rfu_clearSlot(u8 a0, u8 a1);
bool16 rfu_CHILD_getConnectRecoveryStatus(u8 *status);
bool16 rfu_getConnectParentStatus(u8 *status, u8 *a1);

View File

@ -40,7 +40,7 @@ struct UnkLinkRfuStruct_02022B2C
struct UnkRfuStruct_1 {
/* 0x000 */ u8 unk_00;
/* 0x001 */ u8 unk_01;
/* 0x002 */ u8 unk_02;
/* 0x002 */ vu8 unk_02;
/* 0x003 */ vu8 unk_03;
/* 0x004 */ u8 unk_04;
/* 0x005 */ u8 unk_05;

View File

@ -32,7 +32,10 @@ void sub_800D610(void);
void sub_800C744(u32 a0);
void sub_800CF34(void);
void sub_800D158(void);
void sub_800D20C(void);
void sub_800D268(void);
u8 sub_800D294(void);
void sub_800D358(void);
void sub_800D434(void);
// .rodata
@ -609,3 +612,367 @@ void sub_800C744(u32 a0)
gUnknown_03004140.unk_04 = 9;
}
}
void sub_800C7B4(u16 r8, u16 r6)
{
u8 sp0;
register u8 *stwiRecvBuffer asm("r0");
u8 *tmp;
u8 i;
if (gUnknown_03004140.unk_0e != 0)
{
gUnknown_03004140.unk_0e = 0;
switch (r8)
{
case 16:
if (r6 == 0)
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05;
gUnknown_03004140.unk_05 = 4;
}
break;
case 23:
if (r6 == 0)
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05;
gUnknown_03004140.unk_05 = 0;
}
break;
case 22:
if (r6 == 0)
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0;
sub_800D30C(0x00, 0x00);
}
break;
case 25:
if (r6 == 0)
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 6;
}
break;
case 26:
if (gUnknown_03004140.unk_1a && --gUnknown_03004140.unk_1a == 0)
{
gUnknown_03004140.unk_04 = 7;
gUnknown_03004140.unk_05 = 8;
}
break;
case 27:
if (r6 == 0)
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05;
gUnknown_03004140.unk_05 = 0;
if (gUnknown_03004140.unk_07 == 0)
{
sub_800D30C(0x13, 0x00);
}
}
break;
case 28:
if (r6 == 0)
{
if (gUnknown_03004140.unk_0b == 1 && gUnknown_03004140.unk_1a > 1)
{
gUnknown_03004140.unk_1a--;
}
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 10;
}
break;
case 29:
if (r6 == 0)
{
sp0 = sub_800D294();
gUnknown_03004140.unk_14 = sp0;
if (sp0)
{
sub_800D30C(0x20, 0x01);
}
if (gUnknown_03004140.unk_0b && gUnknown_03004140.unk_1a != 1 && gUnknown_03007890->unk_08 == 4)
{
rfu_REQ_endSearchParent();
rfu_waitREQComplete();
gUnknown_03004140.unk_04 = 9;
gUnknown_03004140.unk_0b = 1;
}
}
if (gUnknown_03004140.unk_1a && --gUnknown_03004140.unk_1a == 0)
{
gUnknown_03004140.unk_04 = 11;
gUnknown_03004140.unk_05 = 0;
}
break;
case 30:
if (r6 == 0)
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05;
if (gUnknown_03004140.unk_07 == 0)
{
if (gUnknown_03004140.unk_04 == 0)
{
sub_800D30C(0x21, 0x00);
}
}
else if (gUnknown_03004140.unk_07 != 7)
{
gUnknown_03004140.unk_04 = 5;
gUnknown_03004140.unk_07 = 5;
}
}
break;
case 31:
if (r6 == 0)
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 13;
}
break;
case 32:
if (r6 == 0 && !rfu_getConnectParentStatus(&sp0, &gUnknown_03004140.unk_10) && !sp0)
{
gUnknown_03004140.unk_04 = 14;
}
if (gUnknown_03004140.unk_1a && --gUnknown_03004140.unk_1a == 0)
{
gUnknown_03004140.unk_04 = 14;
}
break;
case 33:
if (r6 == 0 && !rfu_getConnectParentStatus(&sp0, &gUnknown_03004140.unk_10))
{
if (!sp0)
{
gUnknown_03004140.unk_04 = 19;
gUnknown_03004140.unk_05 = 15;
gUnknown_03004140.unk_1e = 0x22;
gUnknown_03004140.unk_14 = gUnknown_03004140.unk_10;
}
else
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0;
gUnknown_03004140.unk_1e = 0x23;
gUnknown_03004140.unk_14 = sp0;
if (gUnknown_03004140.unk_07)
{
gUnknown_03004140.unk_07 = 3;
gUnknown_03004140.unk_04 = 9;
}
}
sub_800D30C(gUnknown_03004140.unk_1e, 0x01);
gUnknown_03004140.unk_1e = 0;
}
break;
case 50:
if (r6 == 0)
{
gUnknown_03004140.unk_14 = gUnknown_03007890->unk_03;
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 17;
for (gUnknown_03004140.unk_10 = 0; gUnknown_03004140.unk_10 < 4; gUnknown_03004140.unk_10 ++)
{
if ((gUnknown_03007890->unk_03 >> gUnknown_03004140.unk_10) & 1)
{
break;
}
}
}
break;
case 51:
if (r6 == 0 && !rfu_CHILD_getConnectRecoveryStatus(&sp0) && sp0 < 2)
{
gUnknown_03004140.unk_04 = 18;
}
if (gUnknown_03004140.unk_34[gUnknown_03004140.unk_10] && --gUnknown_03004140.unk_34[gUnknown_03004140.unk_10] == 0)
{
gUnknown_03004140.unk_04 = 18;
}
break;
case 52:
if (r6 == 0 && !rfu_CHILD_getConnectRecoveryStatus(&sp0))
{
if (!sp0)
{
gUnknown_03004140.unk_04 = 19;
gUnknown_03004140.unk_05 = 22;
gUnknown_03004140.unk_1e = 0x32;
}
else
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0;
sub_800D334(gUnknown_03007890->unk_03);
gUnknown_03004140.unk_1e = 0x33;
}
gUnknown_03004140.unk_34[gUnknown_03004140.unk_10] = 0;
gUnknown_03004140.unk_30 = 0;
gUnknown_03004140.unk_0a = 0;
sub_800D30C(gUnknown_03004140.unk_1e, 0x01);
gUnknown_03004140.unk_1e = 0;
}
break;
case 39:
if (r6 == 0)
{
if (gUnknown_03004140.unk_05 == 22)
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_11;
gUnknown_03004140.unk_05 = gUnknown_03004140.unk_12;
gUnknown_03004140.unk_02 = 1;
sub_800D30C(0x41, 0x00);
}
else if (gUnknown_03004140.unk_05 == 15)
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05;
gUnknown_03004140.unk_02 = 1;
sub_800D30C(0x41, 0x00);
gUnknown_03004140.unk_24 |= 1 << gUnknown_03004140.unk_10;
gUnknown_03004140.unk_28[gUnknown_03004140.unk_10] = gUnknown_03004140.unk_26;
rfu_clearSlot(4, gUnknown_03004140.unk_10);
tmp = &sp0;
*tmp = rfu_NI_CHILD_setSendGameName(gUnknown_03004140.unk_10, 0x0e);
if (*tmp)
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0;
sub_800D610();
sub_800D334(gUnknown_03007890->unk_02 | gUnknown_03007890->unk_03);
gUnknown_03004140.unk_14 = sp0;
sub_800D30C(0x25, 0x01);
}
}
}
break;
case 61:
if (r6 == 0)
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0;
sub_800D30C(0x42, 0x00);
}
break;
}
gUnknown_03004140.unk_0e = 1;
}
else if (r6 == 3 && gUnknown_03004140.unk_0f && (r8 == 0x24 || r8 == 0x26 || r8 == 0x27))
{
rfu_REQ_RFUStatus();
rfu_waitREQComplete();
rfu_getRFUStatus(&sp0);
if (sp0 == 0 && gUnknown_03007890->unk_00 == 0)
{
stwiRecvBuffer = rfu_getSTWIRecvBuffer();
stwiRecvBuffer[4] = gUnknown_03007890->unk_02;
stwiRecvBuffer[5] = 1;
sub_800C36C(0x29);
r6 = 0;
}
}
switch (r8)
{
case 48:
if (r6 == 0)
{
stwiRecvBuffer = rfu_getSTWIRecvBuffer();
gUnknown_03004140.unk_14 = stwiRecvBuffer[8];
sub_800D358();
if (gUnknown_03004140.unk_30)
{
gUnknown_03004140.unk_30 &= ~gUnknown_03004140.unk_14;
for (i = 0; i < 4; i++)
{
if ((gUnknown_03004140.unk_14 >> i) & 1)
{
gUnknown_03004140.unk_34[i] = 0;
}
}
if (gUnknown_03004140.unk_06 == 0)
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0;
}
}
sp0 = gUnknown_03004140.unk_00 & gUnknown_03004140.unk_14;
for (i = 0; i < 4; i++)
{
if ((sp0 >> i) & 1 && gUnknown_03004140.unk_01)
{
gUnknown_03004140.unk_01--;
}
}
gUnknown_03004140.unk_00 &= ~gUnknown_03004140.unk_14;
if (gUnknown_03004140.unk_07)
{
if (gUnknown_03007890->unk_00 == 0xFF)
{
if (gUnknown_03004140.unk_07 == 8)
{
gUnknown_03004140.unk_1a = gUnknown_03004140.unk_1c;
gUnknown_03004140.unk_07 = 6;
gUnknown_03004140.unk_04 = 6;
}
else if (gUnknown_03004140.unk_04 != 6 && gUnknown_03004140.unk_04 != 7)
{
gUnknown_03004140.unk_07 = 1;
gUnknown_03004140.unk_04 = 5;
}
}
}
if (gUnknown_03007890->unk_00 == 0xFF)
{
if (gUnknown_03004140.unk_04 == 0)
{
gUnknown_03004140.unk_06 = -1;
}
}
if (gUnknown_03004140.unk_0e == 0)
{
sub_800D30C(0x40, 0x01);
}
}
break;
case 38:
sub_800D20C();
if (gUnknown_03007890->unk_00 != 0xFF)
{
sub_800D30C(0x50, 0x00);
}
break;
case 16:
case 61:
if (r6 == 0)
{
gUnknown_03004140.unk_0d = 0;
gUnknown_03004140.unk_01 = 0;
gUnknown_03004140.unk_00 = 0;;
gUnknown_03004140.unk_06 = -1;
sub_800D610();
if (r8 == 61)
{
sub_800BFA0();
}
}
break;
}
if (r6 != 0)
{
if (r8 == 28 && r6 != 0 && gUnknown_03004140.unk_07 == 4)
{
gUnknown_03007890->unk_00 = 1;
gUnknown_03007890->unk_02 = 15;
sub_800D334(15);
rfu_waitREQComplete();
return;
}
else
{
gUnknown_03004140.unk_14 = r8;
gUnknown_03004140.unk_16 = r6;
if (gUnknown_03004140.unk_0e)
{
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0;
}
sub_800D30C(0xf0, 0x02);
sub_800D610();
}
}
if (r8 == 0xFF)
{
sub_800D30C(0xf2, 0x00);
sub_800D610();
}
}