through GetLinkPlayerCount_2

This commit is contained in:
PikalaxALT 2017-11-12 21:31:08 -05:00
parent 5ec0fc9aa0
commit b346bac98b
10 changed files with 42 additions and 54 deletions

View File

@ -178,7 +178,7 @@ _080B24C8:
b _080B24F2 b _080B24F2
_080B24CC: _080B24CC:
ldr r4, =gStringVar1 ldr r4, =gStringVar1
bl sub_800ABAC bl GetLinkPlayerCount_2
adds r1, r0, 0 adds r1, r0, 0
lsls r1, 24 lsls r1, 24
lsrs r1, 24 lsrs r1, 24
@ -404,7 +404,7 @@ sub_80B2688: @ 80B2688
push {r4,r5,lr} push {r4,r5,lr}
lsls r0, 24 lsls r0, 24
lsrs r4, r0, 24 lsrs r4, r0, 24
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r5, r0, 24 lsrs r5, r0, 24
adds r0, r4, 0 adds r0, r4, 0
@ -506,7 +506,7 @@ sub_80B275C: @ 80B275C
mov r9, r0 mov r9, r0
mov r7, r8 mov r7, r8
add r7, r9 add r7, r9
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r5, r0, 24 lsrs r5, r0, 24
adds r0, r4, 0 adds r0, r4, 0
@ -585,7 +585,7 @@ sub_80B2804: @ 80B2804
bne _080B2898 bne _080B2898
bl sub_800AA48 bl sub_800AA48
adds r4, r0, 0 adds r4, r0, 0
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r4, 24 lsls r4, 24
lsls r0, 24 lsls r0, 24
cmp r4, r0 cmp r4, r0
@ -652,7 +652,7 @@ sub_80B28A8: @ 80B28A8
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
beq _080B290A beq _080B290A
bl sub_800ABAC bl GetLinkPlayerCount_2
adds r4, r0, 0 adds r4, r0, 0
bl sub_800AA48 bl sub_800AA48
lsls r4, 24 lsls r4, 24
@ -735,7 +735,7 @@ _080B2984:
b _080B29E4 b _080B29E4
.pool .pool
_080B2994: _080B2994:
bl sub_800ABAC bl GetLinkPlayerCount_2
ldr r4, =gUnknown_03005DB8 ldr r4, =gUnknown_03005DB8
strb r0, [r4] strb r0, [r4]
bl GetMultiplayerId bl GetMultiplayerId
@ -825,7 +825,7 @@ _080B2A4E:
b _080B2ACE b _080B2ACE
.pool .pool
_080B2A6C: _080B2A6C:
bl sub_800ABAC bl GetLinkPlayerCount_2
ldr r4, =gUnknown_03005DB8 ldr r4, =gUnknown_03005DB8
strb r0, [r4] strb r0, [r4]
bl GetMultiplayerId bl GetMultiplayerId
@ -1640,7 +1640,7 @@ sub_80B3194: @ 80B3194
lsls r0, 24 lsls r0, 24
lsrs r4, r0, 24 lsrs r4, r0, 24
adds r5, r4, 0 adds r5, r4, 0
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
@ -1681,7 +1681,7 @@ sub_80B31E8: @ 80B31E8
lsrs r5, r0, 24 lsrs r5, r0, 24
bl sub_800AA48 bl sub_800AA48
adds r4, r0, 0 adds r4, r0, 0
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r4, 24 lsls r4, 24
lsls r0, 24 lsls r0, 24
cmp r4, r0 cmp r4, r0
@ -2779,7 +2779,7 @@ _080B3B54:
strh r0, [r5, 0x2] strh r0, [r5, 0x2]
b _080B3B96 b _080B3B96
_080B3B68: _080B3B68:
bl sub_800ABAC bl GetLinkPlayerCount_2
adds r4, r0, 0 adds r4, r0, 0
bl sub_800AA48 bl sub_800AA48
lsls r4, 24 lsls r4, 24

View File

@ -5,28 +5,6 @@
.text .text
thumb_func_start sub_800AB98
sub_800AB98: @ 800AB98
ldr r0, =gSavedLinkPlayerCount
movs r1, 0
strb r1, [r0]
ldr r0, =gUnknown_03003120
strb r1, [r0]
bx lr
.pool
thumb_func_end sub_800AB98
thumb_func_start sub_800ABAC
sub_800ABAC: @ 800ABAC
ldr r0, =gLinkStatus
ldr r0, [r0]
movs r1, 0x1C
ands r0, r1
lsrs r0, 2
bx lr
.pool
thumb_func_end sub_800ABAC
thumb_func_start sub_800ABBC thumb_func_start sub_800ABBC
sub_800ABBC: @ 800ABBC sub_800ABBC: @ 800ABBC
push {lr} push {lr}

View File

@ -282,7 +282,7 @@ _08178BCC:
_08178BDA: _08178BDA:
b _08178E34 b _08178E34
_08178BDC: _08178BDC:
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r2, r0, 24 lsrs r2, r0, 24
cmp r2, 0x2 cmp r2, 0x2

View File

@ -28132,7 +28132,7 @@ sub_81D4EC0: @ 81D4EC0
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _081D4EDC beq _081D4EDC
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x2 cmp r0, 0x2
@ -28190,7 +28190,7 @@ _081D4F38:
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _081D4F88 beq _081D4F88
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
@ -28212,7 +28212,7 @@ _081D4F54:
strb r0, [r4] strb r0, [r4]
b _081D500C b _081D500C
_081D4F6C: _081D4F6C:
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x2 cmp r0, 0x2
@ -28506,7 +28506,7 @@ _081D51D0:
b _081D535A b _081D535A
.pool .pool
_081D51F4: _081D51F4:
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1

View File

@ -765,7 +765,7 @@ _080E73B0:
movs r0, 0x65 movs r0, 0x65
b _080E7564 b _080E7564
_080E73B8: _080E73B8:
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r4, r0, 24 lsrs r4, r0, 24
bl sub_800ABBC bl sub_800ABBC
@ -796,7 +796,7 @@ _080E73EA:
_080E73F8: _080E73F8:
bl sub_800AA48 bl sub_800AA48
adds r4, r0, 0 adds r4, r0, 0
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r4, 24 lsls r4, 24
lsls r0, 24 lsls r0, 24
cmp r4, r0 cmp r4, r0
@ -808,7 +808,7 @@ _080E740C:
strh r4, [r5, 0x20] strh r4, [r5, 0x20]
lsls r4, 16 lsls r4, 16
asrs r4, 16 asrs r4, 16
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
lsls r1, r0, 4 lsls r1, r0, 4
@ -824,7 +824,7 @@ _080E742A:
_080E7432: _080E7432:
bl sub_800AA48 bl sub_800AA48
adds r4, r0, 0 adds r4, r0, 0
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r4, 24 lsls r4, 24
lsls r0, 24 lsls r0, 24
cmp r4, r0 cmp r4, r0
@ -868,7 +868,7 @@ _080E746E:
b _080E7564 b _080E7564
.pool .pool
_080E7490: _080E7490:
bl sub_800ABAC bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
movs r1, 0 movs r1, 0

View File

@ -464,7 +464,7 @@ _0807757A:
b _08077B22 b _08077B22
.pool .pool
_0807758C: _0807758C:
bl sub_800ABAC bl GetLinkPlayerCount_2
adds r4, r0, 0 adds r4, r0, 0
bl sub_800AA48 bl sub_800AA48
lsls r4, 24 lsls r4, 24
@ -7373,7 +7373,7 @@ _0807AFBC:
bne _0807AFC8 bne _0807AFC8
b _0807B0DC b _0807B0DC
_0807AFC8: _0807AFC8:
bl sub_800ABAC bl GetLinkPlayerCount_2
adds r4, r0, 0 adds r4, r0, 0
bl sub_800AA48 bl sub_800AA48
lsls r4, 24 lsls r4, 24

View File

@ -19,7 +19,7 @@ gSuppressLinkErrorMessage
gSerialIsRFU gSerialIsRFU
gSavedLinkPlayerCount gSavedLinkPlayerCount
gSendCmd gSendCmd
gUnknown_03003120 gSavedMultiplayerId
gReceivedRemoteLinkPlayers gReceivedRemoteLinkPlayers
gLinkTestBGInfo gLinkTestBGInfo
gLinkCallback gLinkCallback

View File

@ -205,7 +205,6 @@ void sub_800ADF8(void);
void sub_800B488(void); void sub_800B488(void);
void sub_800A620(void); void sub_800A620(void);
void sub_8011BD0(void); void sub_8011BD0(void);
u8 sub_800ABAC(void);
u8 sub_800ABBC(void); u8 sub_800ABBC(void);
void sub_800AC34(void); void sub_800AC34(void);
@ -234,7 +233,7 @@ extern u16 gUnknown_030030F4;
extern u8 gSuppressLinkErrorMessage; extern u8 gSuppressLinkErrorMessage;
extern bool8 gSerialIsRFU; extern bool8 gSerialIsRFU;
extern bool8 gSavedLinkPlayerCount; extern bool8 gSavedLinkPlayerCount;
extern u8 gUnknown_03003120; extern u8 gSavedMultiplayerId;
extern struct LinkTestBGInfo gLinkTestBGInfo; extern struct LinkTestBGInfo gLinkTestBGInfo;
extern void (*gLinkCallback)(void); extern void (*gLinkCallback)(void);
extern bool8 gShouldAdvanceLinkState; extern bool8 gShouldAdvanceLinkState;

View File

@ -791,7 +791,7 @@ static void Task_HandleSendLinkBuffersData(u8 taskId)
else else
var = (gBattleTypeFlags & BATTLE_TYPE_MULTI) ? 4 : 2; var = (gBattleTypeFlags & BATTLE_TYPE_MULTI) ? 4 : 2;
if (sub_800ABAC() >= var) if (GetLinkPlayerCount_2() >= var)
{ {
if (sub_800ABBC()) if (sub_800ABBC())
{ {

View File

@ -79,7 +79,7 @@ u8 gSuppressLinkErrorMessage;
bool8 gSerialIsRFU; bool8 gSerialIsRFU;
bool8 gSavedLinkPlayerCount; bool8 gSavedLinkPlayerCount;
u16 gSendCmd[8]; u16 gSendCmd[8];
u8 gUnknown_03003120; u8 gSavedMultiplayerId;
bool8 gReceivedRemoteLinkPlayers; bool8 gReceivedRemoteLinkPlayers;
struct LinkTestBGInfo gLinkTestBGInfo; struct LinkTestBGInfo gLinkTestBGInfo;
void (*gLinkCallback)(void); void (*gLinkCallback)(void);
@ -468,7 +468,7 @@ void HandleReceiveRemoteLinkPlayer(u8 who)
count = 0; count = 0;
gUnknown_03003078[who] = FALSE; gUnknown_03003078[who] = FALSE;
for (i = 0; i < sub_800ABAC(); i ++) for (i = 0; i < GetLinkPlayerCount_2(); i ++)
{ {
count += gUnknown_03003078[i]; count += gUnknown_03003078[i];
} }
@ -800,7 +800,7 @@ u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper)
count = 0; count = 0;
if (gReceivedRemoteLinkPlayers == TRUE) if (gReceivedRemoteLinkPlayers == TRUE)
{ {
cmpVal = sub_800ABAC(); cmpVal = GetLinkPlayerCount_2();
if (lower > cmpVal || cmpVal > upper) if (lower > cmpVal || cmpVal > upper)
{ {
sPlayerDataExchangeStatus = EXCHANGE_STAT_6; sPlayerDataExchangeStatus = EXCHANGE_STAT_6;
@ -1282,7 +1282,7 @@ void sub_800AA04(u8 a0)
int i; int i;
gSavedLinkPlayerCount = a0; gSavedLinkPlayerCount = a0;
gUnknown_03003120 = GetMultiplayerId(); gSavedMultiplayerId = GetMultiplayerId();
for (i = 0; i < MAX_RFU_PLAYERS; i ++) for (i = 0; i < MAX_RFU_PLAYERS; i ++)
{ {
gSavedLinkPlayers[i] = gLinkPlayers[i]; gSavedLinkPlayers[i] = gLinkPlayers[i];
@ -1296,7 +1296,7 @@ u8 sub_800AA48(void)
u8 sub_800AA54(void) u8 sub_800AA54(void)
{ {
return gUnknown_03003120; return gSavedMultiplayerId;
} }
bool8 sub_800AA60(void) bool8 sub_800AA60(void)
@ -1324,7 +1324,7 @@ bool8 sub_800AA60(void)
} }
if (count == gSavedLinkPlayerCount) if (count == gSavedLinkPlayerCount)
{ {
if (sub_800ABAC() == gSavedLinkPlayerCount) if (GetLinkPlayerCount_2() == gSavedLinkPlayerCount)
{ {
return TRUE; return TRUE;
} }
@ -1357,3 +1357,14 @@ void sub_800AB18(void)
} }
} }
} }
void sub_800AB98(void)
{
gSavedLinkPlayerCount = 0;
gSavedMultiplayerId = 0;
}
u8 GetLinkPlayerCount_2(void)
{
return EXTRACT_PLAYER_COUNT(gLinkStatus);
}