sub_800AB18

This commit is contained in:
PikalaxALT 2017-11-12 21:26:11 -05:00
parent 2e95c5575f
commit 5ec0fc9aa0
2 changed files with 26 additions and 79 deletions

View File

@ -5,85 +5,6 @@
.text
thumb_func_start sub_800AAF4
sub_800AAF4: @ 800AAF4
push {r4,r5,lr}
ldr r5, =gSavedLinkPlayers
movs r4, 0x3
_0800AAFA:
adds r0, r5, 0
movs r1, 0
movs r2, 0x1C
bl CpuSet
adds r5, 0x1C
subs r4, 0x1
cmp r4, 0
bge _0800AAFA
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_800AAF4
thumb_func_start sub_800AB18
sub_800AB18: @ 800AB18
push {r4-r7,lr}
mov r7, r8
push {r7}
movs r4, 0
ldr r0, =gSavedLinkPlayerCount
ldrb r0, [r0]
cmp r4, r0
bcs _0800AB78
ldr r6, =gSavedLinkPlayers
ldr r5, =gLinkPlayers
movs r0, 0x8
adds r0, r6
mov r8, r0
adds r7, r5, 0
adds r7, 0x8
_0800AB36:
lsls r0, r4, 3
subs r0, r4
lsls r2, r0, 2
adds r1, r6, 0x4
adds r1, r2, r1
adds r0, r5, 0x4
adds r0, r2, r0
ldr r1, [r1]
ldr r0, [r0]
cmp r1, r0
bne _0800AB5A
mov r1, r8
adds r0, r2, r1
adds r1, r2, r7
bl StringCompare
cmp r0, 0
beq _0800AB6A
_0800AB5A:
ldr r1, =gLinkErrorOccurred
movs r0, 0x1
strb r0, [r1]
bl CloseLink
ldr r0, =CB2_LinkError
bl SetMainCallback2
_0800AB6A:
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gSavedLinkPlayerCount
ldrb r0, [r0]
cmp r4, r0
bcc _0800AB36
_0800AB78:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_800AB18
thumb_func_start sub_800AB98
sub_800AB98: @ 800AB98
ldr r0, =gSavedLinkPlayerCount

View File

@ -1331,3 +1331,29 @@ bool8 sub_800AA60(void)
}
return FALSE;
}
void sub_800AAF4(void)
{
int i;
// Clearly not what was meant to be written, but here it is anyway.
for (i = 0; i < 4; i ++)
{
CpuSet(&gSavedLinkPlayers[i], NULL, sizeof(struct LinkPlayer));
}
}
void sub_800AB18(void)
{
u8 i;
for (i = 0; i < gSavedLinkPlayerCount; i ++)
{
if (gSavedLinkPlayers[i].trainerId != gLinkPlayers[i].trainerId || StringCompare(gSavedLinkPlayers[i].name, gLinkPlayers[i].name) != 0)
{
gLinkErrorOccurred = TRUE;
CloseLink();
SetMainCallback2(CB2_LinkError);
}
}
}