sub_800F4F0

This commit is contained in:
scnorton 2018-01-18 17:38:51 -05:00
parent 090f70dd5b
commit 68e9b5719c
4 changed files with 49 additions and 146 deletions

View File

@ -5,151 +5,6 @@
.text
thumb_func_start sub_800F4F0
sub_800F4F0: @ 800F4F0
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x58
ldr r0, =gUnknown_03005000+0x124
mov r1, sp
bl sub_800D934
movs r1, 0
ldr r0, =gRecvCmds
mov r12, r0
_0800F506:
movs r4, 0
lsls r0, r1, 3
adds r2, r1, 0x1
mov r8, r2
lsls r6, r1, 4
subs r0, r1
lsls r5, r0, 1
_0800F514:
lsls r1, r4, 1
adds r3, r1, r6
add r3, r12
adds r1, r5, r1
adds r0, r1, 0x1
add r0, sp
ldrb r2, [r0]
lsls r2, 8
mov r7, sp
adds r0, r7, r1
ldrb r0, [r0]
orrs r0, r2
strh r0, [r3]
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x6
bls _0800F514
mov r1, r8
lsls r0, r1, 24
lsrs r1, r0, 24
cmp r1, 0x4
bls _0800F506
movs r0, 0
bl sub_800F86C
ldr r0, =gUnknown_03004140
ldrb r0, [r0, 0x2]
cmp r0, 0
bne _0800F5C0
ldr r0, =gUnknown_03005000
ldr r2, =0x00000ce4
adds r0, r2
ldrb r0, [r0]
cmp r0, 0
beq _0800F5C0
ldr r0, =gUnknown_03007890
ldr r0, [r0]
ldrb r1, [r0, 0x2]
ldrb r0, [r0, 0x3]
orrs r0, r1
bl rfu_REQ_disconnect
bl rfu_waitREQComplete
bl sub_8011A74
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _0800F58C
cmp r0, 0x6
beq _0800F58C
cmp r0, 0x9
beq _0800F58C
movs r1, 0x90
lsls r1, 8
movs r0, 0x2
bl sub_8011A64
_0800F58C:
bl rfu_clearAllSlot
ldr r1, =gReceivedRemoteLinkPlayers
movs r0, 0
strb r0, [r1]
ldr r0, =gUnknown_03005000
movs r5, 0
str r5, [r0]
ldr r7, =0x00000ce4
adds r6, r0, r7
ldrb r0, [r6]
cmp r0, 0x1
bne _0800F5B8
movs r4, 0x90
lsls r4, 8
movs r0, 0x2
adds r1, r4, 0
bl sub_8011A64
adds r0, r4, 0
bl sub_8011170
_0800F5B8:
ldr r0, =gUnknown_03004140
strb r5, [r0, 0x5]
strb r5, [r0, 0x4]
strb r5, [r6]
_0800F5C0:
ldr r6, =gUnknown_03005000
movs r0, 0xCD
lsls r0, 4
adds r2, r6, r0
ldrb r0, [r2]
cmp r0, 0
beq _0800F604
ldrb r0, [r2]
subs r0, 0x1
ldrb r1, [r2]
strb r0, [r2]
bl sub_8010528
ldr r5, =gSendCmd
add r4, sp, 0x48
adds r0, r5, 0
adds r1, r4, 0
bl sub_800F498
ldr r1, =0x000009e8
adds r0, r6, r1
adds r1, r4, 0
bl sub_800D888
movs r1, 0
movs r2, 0
_0800F5F4:
lsls r0, r1, 1
adds r0, r5
strh r2, [r0]
adds r0, r1, 0x1
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0x6
bls _0800F5F4
_0800F604:
bl sub_800F0B8
add sp, 0x58
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
.pool
thumb_func_end sub_800F4F0
thumb_func_start sub_800F638
sub_800F638: @ 800F638
push {r4-r7,lr}

View File

@ -208,6 +208,7 @@ 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);
void rfu_clearAllSlot(void);
bool16 rfu_CHILD_getConnectRecoveryStatus(u8 *status);
bool16 rfu_getConnectParentStatus(u8 *status, u8 *a1);
bool16 rfu_UNI_PARENT_getDRAC_ACK(u8 *a0);

View File

@ -136,7 +136,7 @@ struct UnkRfuStruct_Sub_Unused {
};
struct UnkRfuStruct_2 {
/* 0x000 */ u8 filler_00[4];
/* 0x000 */ u32 unk_00;
/* 0x004 */ u16 unk_04;
/* 0x006 */ u8 filler_06[6];
/* 0x00c */ u8 unk_0c;

View File

@ -3144,3 +3144,50 @@ void sub_800F498(u16 *a0, u8 *a1)
a1[i] = 0;
}
}
bool32 sub_800F4F0(void)
{
u8 i;
u8 j;
u8 sp00[MAX_RFU_PLAYERS * (2 * (CMD_LENGTH - 1))];
u8 sp48[2 * (CMD_LENGTH - 1)];
u8 switchval;
sub_800D934(&gUnknown_03005000.unk_124, sp00);
for (i = 0; i < MAX_RFU_PLAYERS; i++)
{
for (j = 0; j < CMD_LENGTH - 1; j++)
{
gRecvCmds[i][j] = (sp00[i * 14 + (j << 1) + 1] << 8) | sp00[i * 14 + (j << 1) + 0];
}
}
sub_800F86C(0);
if (gUnknown_03004140.unk_02 == 0 && gUnknown_03005000.unk_ce4)
{
rfu_REQ_disconnect(gUnknown_03007890->unk_02 | gUnknown_03007890->unk_03);
rfu_waitREQComplete();
switchval = sub_8011A74();
if (switchval != 1 && switchval != 6 && switchval != 9)
sub_8011A64(2, 0x9000);
rfu_clearAllSlot();
gReceivedRemoteLinkPlayers = FALSE;
gUnknown_03005000.unk_00 = 0;
if (gUnknown_03005000.unk_ce4 == 1)
{
sub_8011A64(2, 0x9000);
sub_8011170(0x9000);
}
gUnknown_03004140.unk_04 = gUnknown_03004140.unk_05 = 0;
gUnknown_03005000.unk_ce4 = 0;
}
if (gUnknown_03005000.unk_cd0)
{
gUnknown_03005000.unk_cd0--;
sub_8010528();
sub_800F498(gSendCmd, sp48);
sub_800D888(&gUnknown_03005000.unk_9e8, sp48);
for (i = 0; i < CMD_LENGTH - 1; i++)
gSendCmd[i] = 0;
}
return sub_800F0B8();
}