sub_800AA60

This commit is contained in:
PikalaxALT 2017-11-12 20:57:21 -05:00
parent d0578ca9e0
commit 2e95c5575f
4 changed files with 46 additions and 86 deletions

View File

@ -5,83 +5,10 @@
.text
thumb_func_start sub_800AA60
sub_800AA60: @ 800AA60
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
movs r3, 0
ldr r0, =gUnknown_03003100
ldrb r1, [r0]
mov r9, r0
cmp r3, r1
bge _0800AAB4
ldr r0, =gLinkPlayers
mov r12, r0
ldr r0, =gUnknown_02022A74
ldr r2, =0x00002288
mov r8, r2
ldr r7, =gLinkType
mov r6, r12
adds r6, 0x14
adds r5, r0, 0x4
movs r4, 0
adds r2, r1, 0
_0800AA8A:
mov r0, r12
adds r0, 0x4
adds r0, r4, r0
ldr r1, [r0]
ldr r0, [r5]
cmp r1, r0
bne _0800AAA8
ldrh r0, [r7]
cmp r0, r8
bne _0800AAA6
adds r1, r0, 0
ldr r0, [r6]
cmp r1, r0
bne _0800AAA8
_0800AAA6:
adds r3, 0x1
_0800AAA8:
adds r6, 0x1C
adds r5, 0x1C
adds r4, 0x1C
subs r2, 0x1
cmp r2, 0
bne _0800AA8A
_0800AAB4:
mov r0, r9
ldrb r0, [r0]
cmp r3, r0
bne _0800AAE4
bl sub_800ABAC
lsls r0, 24
lsrs r0, 24
mov r1, r9
ldrb r1, [r1]
cmp r0, r1
bne _0800AAE4
movs r0, 0x1
b _0800AAE6
.pool
_0800AAE4:
movs r0, 0
_0800AAE6:
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_800AA60
thumb_func_start sub_800AAF4
sub_800AAF4: @ 800AAF4
push {r4,r5,lr}
ldr r5, =gUnknown_02022A74
ldr r5, =gSavedLinkPlayers
movs r4, 0x3
_0800AAFA:
adds r0, r5, 0
@ -104,11 +31,11 @@ sub_800AB18: @ 800AB18
mov r7, r8
push {r7}
movs r4, 0
ldr r0, =gUnknown_03003100
ldr r0, =gSavedLinkPlayerCount
ldrb r0, [r0]
cmp r4, r0
bcs _0800AB78
ldr r6, =gUnknown_02022A74
ldr r6, =gSavedLinkPlayers
ldr r5, =gLinkPlayers
movs r0, 0x8
adds r0, r6
@ -144,7 +71,7 @@ _0800AB6A:
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gUnknown_03003100
ldr r0, =gSavedLinkPlayerCount
ldrb r0, [r0]
cmp r4, r0
bcc _0800AB36
@ -159,7 +86,7 @@ _0800AB78:
thumb_func_start sub_800AB98
sub_800AB98: @ 800AB98
ldr r0, =gUnknown_03003100
ldr r0, =gSavedLinkPlayerCount
movs r1, 0
strb r1, [r0]
ldr r0, =gUnknown_03003120

View File

@ -17,7 +17,7 @@ gUnknown_030030F0
gUnknown_030030F4
gSuppressLinkErrorMessage
gSerialIsRFU
gUnknown_03003100
gSavedLinkPlayerCount
gSendCmd
gUnknown_03003120
gReceivedRemoteLinkPlayers

View File

@ -233,7 +233,7 @@ extern u8 gUnknown_030030F0[MAX_LINK_PLAYERS];
extern u16 gUnknown_030030F4;
extern u8 gSuppressLinkErrorMessage;
extern bool8 gSerialIsRFU;
extern bool8 gUnknown_03003100;
extern bool8 gSavedLinkPlayerCount;
extern u8 gUnknown_03003120;
extern struct LinkTestBGInfo gLinkTestBGInfo;
extern void (*gLinkCallback)(void);

View File

@ -77,7 +77,7 @@ u8 gUnknown_030030F0[MAX_LINK_PLAYERS];
u16 gUnknown_030030F4;
u8 gSuppressLinkErrorMessage;
bool8 gSerialIsRFU;
bool8 gUnknown_03003100;
bool8 gSavedLinkPlayerCount;
u16 gSendCmd[8];
u8 gUnknown_03003120;
bool8 gReceivedRemoteLinkPlayers;
@ -106,7 +106,7 @@ EWRAM_DATA u16 gLinkType = 0;
EWRAM_DATA u16 gLinkTimeOutCounter = 0;
EWRAM_DATA struct LinkPlayer gLocalLinkPlayer = {};
EWRAM_DATA struct LinkPlayer gLinkPlayers[MAX_RFU_PLAYERS] = {};
EWRAM_DATA struct LinkPlayer gUnknown_02022A74[MAX_RFU_PLAYERS] = {};
EWRAM_DATA struct LinkPlayer gSavedLinkPlayers[MAX_RFU_PLAYERS] = {};
// Static ROM declarations
@ -1257,7 +1257,7 @@ u8 sub_800A9A8(void)
u8 flags;
flags = 0;
for (i = 0; i < gUnknown_03003100; i ++)
for (i = 0; i < gSavedLinkPlayerCount; i ++)
{
flags |= (1 << i);
}
@ -1281,20 +1281,53 @@ void sub_800AA04(u8 a0)
{
int i;
gUnknown_03003100 = a0;
gSavedLinkPlayerCount = a0;
gUnknown_03003120 = GetMultiplayerId();
for (i = 0; i < MAX_RFU_PLAYERS; i ++)
{
gUnknown_02022A74[i] = gLinkPlayers[i];
gSavedLinkPlayers[i] = gLinkPlayers[i];
}
}
u8 sub_800AA48(void)
{
return gUnknown_03003100;
return gSavedLinkPlayerCount;
}
u8 sub_800AA54(void)
{
return gUnknown_03003120;
}
bool8 sub_800AA60(void)
{
int i;
unsigned count;
count = 0;
for (i = 0; i < gSavedLinkPlayerCount; i ++)
{
if (gLinkPlayers[i].trainerId == gSavedLinkPlayers[i].trainerId)
{
if (gLinkType == 0x2288)
{
if (gLinkType == gLinkPlayers[i].linkType)
{
count ++;
}
}
else
{
count ++;
}
}
}
if (count == gSavedLinkPlayerCount)
{
if (sub_800ABAC() == gSavedLinkPlayerCount)
{
return TRUE;
}
}
return FALSE;
}