through sub_801084C

This commit is contained in:
PikalaxALT 2018-01-20 16:38:44 -05:00
parent a8e8bfb4c8
commit 95d77c25f3
4 changed files with 112 additions and 283 deletions

View File

@ -5,286 +5,6 @@
.text
thumb_func_start sub_80107A0
sub_80107A0: @ 80107A0
push {r4,r5,lr}
movs r4, 0
ldr r1, =gUnknown_03005000
ldr r2, =0x00000c85
adds r0, r1, r2
ldrb r0, [r0]
cmp r0, 0x8
bne _080107DA
ldr r2, =gUnknown_03007880
ldr r0, =0x00000c3e
adds r1, r0
ldrb r0, [r1]
lsls r0, 2
adds r0, r2
ldr r0, [r0]
ldrh r0, [r0]
cmp r0, 0x26
beq _080107D2
ldrb r0, [r1]
lsls r0, 2
adds r0, r2
ldr r0, [r0]
ldrh r0, [r0]
cmp r0, 0x27
bne _080107DA
_080107D2:
ldrb r1, [r1]
movs r0, 0x4
bl rfu_clearSlot
_080107DA:
ldr r2, =gUnknown_03007880
ldr r5, =gUnknown_03005000
ldr r0, =0x00000c3e
adds r1, r5, r0
ldrb r0, [r1]
lsls r0, 2
adds r0, r2
ldr r0, [r0]
ldrh r0, [r0, 0x34]
cmp r0, 0x46
beq _080107FE
ldrb r0, [r1]
lsls r0, 2
adds r0, r2
ldr r0, [r0]
ldrh r0, [r0, 0x34]
cmp r0, 0x48
bne _0801082C
_080107FE:
ldrb r1, [r1]
movs r0, 0x8
bl rfu_clearSlot
ldr r2, =0x00000c86
adds r4, r5, r2
ldrb r0, [r4]
movs r1, 0
bl sub_8011A64
ldrb r4, [r4]
b _08010844
.pool
_0801082C:
ldrb r0, [r1]
lsls r0, 2
adds r0, r2
ldr r0, [r0]
ldrh r0, [r0, 0x34]
cmp r0, 0x47
bne _08010844
ldrb r1, [r1]
movs r0, 0x8
bl rfu_clearSlot
movs r4, 0x6
_08010844:
adds r0, r4, 0
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_80107A0
thumb_func_start sub_801084C
sub_801084C: @ 801084C
push {r4-r7,lr}
lsls r0, 24
lsrs r6, r0, 24
ldr r5, =gUnknown_03005000
adds r0, r5, 0
adds r0, 0xF1
ldrb r0, [r0]
subs r0, 0x1
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bhi _08010872
ldr r0, =0x00000ce8
adds r1, r5, r0
movs r0, 0
strb r0, [r1]
adds r0, r6, 0
bl DestroyTask
_08010872:
ldr r2, =gTasks
lsls r1, r6, 2
adds r0, r1, r6
lsls r0, 3
adds r4, r0, r2
movs r2, 0x8
ldrsh r0, [r4, r2]
adds r7, r1, 0
cmp r0, 0x3
beq _0801091C
cmp r0, 0x3
bgt _080108A4
cmp r0, 0x1
beq _080108CC
cmp r0, 0x1
bgt _08010918
cmp r0, 0
beq _080108B6
b _080109D2
.pool
_080108A4:
cmp r0, 0x5
beq _08010950
cmp r0, 0x5
blt _0801093E
cmp r0, 0x6
beq _08010984
cmp r0, 0x65
beq _08010904
b _080109D2
_080108B6:
bl sub_800FC60
lsls r0, 24
cmp r0, 0
bne _080108C2
b _080109D2
_080108C2:
bl ResetBlockReceivedFlags
bl sub_800B348
b _08010948
_080108CC:
ldrb r0, [r5, 0xC]
cmp r0, 0x1
bne _0801090C
ldr r0, =gReceivedRemoteLinkPlayers
ldrb r0, [r0]
cmp r0, 0
beq _080108E8
movs r0, 0xF0
lsls r0, 7
bl sub_800FD14
b _080108F0
.pool
_080108E8:
movs r0, 0xEE
lsls r0, 7
bl sub_800FD14
_080108F0:
ldr r0, =gTasks
adds r1, r7, r6
lsls r1, 3
adds r1, r0
movs r0, 0x65
strh r0, [r1, 0x8]
b _080109D2
.pool
_08010904:
ldr r0, =gSendCmd
ldrh r0, [r0]
cmp r0, 0
bne _080109D2
_0801090C:
movs r0, 0x2
strh r0, [r4, 0x8]
b _080109D2
.pool
_08010918:
ldrb r0, [r5, 0xD]
b _08010944
_0801091C:
ldrb r0, [r5, 0xC]
cmp r0, 0x1
bne _08010948
bl sub_800FC60
lsls r0, 24
cmp r0, 0
beq _080109D2
adds r1, r5, 0
adds r1, 0x5A
movs r0, 0
strb r0, [r1]
movs r0, 0xA1
lsls r0, 8
bl sub_800FD14
b _08010948
_0801093E:
bl sub_800FC88
lsls r0, 24
_08010944:
cmp r0, 0
beq _080109D2
_08010948:
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
b _080109D2
_08010950:
movs r4, 0
ldrb r0, [r5, 0xD]
cmp r4, r0
bge _0801096E
_08010958:
adds r0, r4, 0
bl sub_800B3A4
lsls r0, r4, 24
lsrs r0, 24
bl sub_800F728
adds r4, 0x1
ldrb r2, [r5, 0xD]
cmp r4, r2
blt _08010958
_0801096E:
ldr r0, =gTasks
adds r1, r7, r6
lsls r1, 3
adds r1, r0
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
b _080109D2
.pool
_08010984:
adds r0, r6, 0
bl DestroyTask
ldr r1, =gReceivedRemoteLinkPlayers
movs r0, 0x1
strb r0, [r1]
ldr r0, =0x00000ce8
adds r1, r5, r0
movs r0, 0
strb r0, [r1]
movs r1, 0x96
lsls r1, 2
movs r0, 0x1
bl sub_800D550
ldr r2, =0x00000ce6
adds r1, r5, r2
ldrb r0, [r1]
cmp r0, 0
beq _080109D2
movs r4, 0
adds r2, r1, 0
movs r3, 0x1
ldr r0, =0x00000ce5
adds r5, r0
_080109B6:
ldrb r0, [r2]
asrs r0, r4
ands r0, r3
cmp r0, 0
beq _080109CC
adds r0, r3, 0
lsls r0, r4
strb r0, [r5]
ldrb r1, [r2]
eors r0, r1
strb r0, [r2]
_080109CC:
adds r4, 0x1
cmp r4, 0x3
ble _080109B6
_080109D2:
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_801084C
thumb_func_start sub_80109E8
sub_80109E8: @ 80109E8
push {r4,r5,lr}

View File

@ -249,6 +249,8 @@ void SetSuppressLinkErrorMessage(bool8 flag);
void sub_800B524(struct LinkPlayer *linkPlayer);
u8 GetSioMultiSI(void);
void sub_800AAF4(void);
void sub_800B348(void);
void sub_800B3A4(u32 who);
extern u16 gLinkPartnersHeldKeys[6];
extern u32 gLinkDebugSeed;

View File

@ -1812,13 +1812,14 @@ void sub_800B348(void)
memcpy(gBlockSendBuffer, block, sizeof(*block));
}
void sub_800B3A4(u8 who)
void sub_800B3A4(u32 who)
{
u8 who_ = who;
struct LinkPlayerBlock *block;
struct LinkPlayer *player;
block = (struct LinkPlayerBlock *)gBlockRecvBuffer[who];
player = &gLinkPlayers[who];
block = (struct LinkPlayerBlock *)gBlockRecvBuffer[who_];
player = &gLinkPlayers[who_];
*player = block->linkPlayer;
sub_800B524(player);
if (strcmp(block->magic1, gASCIIGameFreakInc) != 0 || strcmp(block->magic2, gASCIIGameFreakInc) != 0)

View File

@ -4174,3 +4174,109 @@ void sub_8010750(void)
}
}
}
int sub_80107A0(void)
{
int retval = 0;
if (gUnknown_03005000.unk_c85 == 8)
{
if (gUnknown_03007880[gUnknown_03005000.unk_c3e]->unk_0 == 0x26 || gUnknown_03007880[gUnknown_03005000.unk_c3e]->unk_0 == 0x27)
rfu_clearSlot(4, gUnknown_03005000.unk_c3e);
}
if (gUnknown_03007880[gUnknown_03005000.unk_c3e]->unk_34 == 0x46 || gUnknown_03007880[gUnknown_03005000.unk_c3e]->unk_34 == 0x48)
{
rfu_clearSlot(8, gUnknown_03005000.unk_c3e);
sub_8011A64(gUnknown_03005000.unk_c86, 0);
retval = gUnknown_03005000.unk_c86;
}
else if (gUnknown_03007880[gUnknown_03005000.unk_c3e]->unk_34 == 0x47)
{
rfu_clearSlot(8, gUnknown_03005000.unk_c3e);
retval = 6;
}
return retval;
}
void sub_801084C(u8 taskId)
{
int i;
if (gUnknown_03005000.unk_f1 == 1 || gUnknown_03005000.unk_f1 == 2)
{
gUnknown_03005000.unk_ce8 = 0;
DestroyTask(taskId);
}
switch (gTasks[taskId].data[0])
{
case 0:
if (sub_800FC60())
{
ResetBlockReceivedFlags();
sub_800B348();
gTasks[taskId].data[0]++;
}
break;
case 1:
if (gUnknown_03005000.unk_0c == 1)
{
if (gReceivedRemoteLinkPlayers)
sub_800FD14(0x7800);
else
sub_800FD14(0x7700);
gTasks[taskId].data[0] = 101;
}
else
gTasks[taskId].data[0] = 2;
break;
case 101:
if (gSendCmd[0] == 0)
gTasks[taskId].data[0] = 2;
break;
case 2:
if (gUnknown_03005000.playerCount)
gTasks[taskId].data[0]++;
break;
case 3:
if (gUnknown_03005000.unk_0c == 1)
{
if (sub_800FC60())
{
gUnknown_03005000.unk_5a = 0;
sub_800FD14(0xa100);
gTasks[taskId].data[0]++;
}
}
else
gTasks[taskId].data[0]++;
break;
case 4:
if (sub_800FC88())
gTasks[taskId].data[0]++;
break;
case 5:
for (i = 0; i < gUnknown_03005000.playerCount; i++)
{
sub_800B3A4(i);
sub_800F728(i);
}
gTasks[taskId].data[0]++;
break;
case 6:
DestroyTask(taskId);
gReceivedRemoteLinkPlayers = 1;
gUnknown_03005000.unk_ce8 = 0;
sub_800D550(1, 0x258);
if (gUnknown_03005000.unk_ce6)
{
for (i = 0; i < 4; i++)
{
if ((gUnknown_03005000.unk_ce6 >> i) & 1)
{
gUnknown_03005000.unk_ce5 = 1 << i;
gUnknown_03005000.unk_ce6 ^= (1 << i);
}
}
}
break;
}
}