sub_800AC34

This commit is contained in:
PikalaxALT 2017-11-12 22:09:11 -05:00
parent b346bac98b
commit ccf6599b40
12 changed files with 75 additions and 117 deletions

View File

@ -426,7 +426,7 @@ sub_80B2688: @ 80B2688
adds r4, r0, r1 adds r4, r0, r1
movs r0, 0 movs r0, 0
strh r0, [r4, 0xE] strh r0, [r4, 0xE]
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
@ -1645,7 +1645,7 @@ sub_80B3194: @ 80B3194
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
bls _080B31DA bls _080B31DA
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
@ -2786,7 +2786,7 @@ _080B3B68:
lsls r0, 24 lsls r0, 24
cmp r4, r0 cmp r4, r0
bcc _080B3BB8 bcc _080B3BB8
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _080B3B96 beq _080B3B96

View File

@ -5,100 +5,6 @@
.text .text
thumb_func_start sub_800ABBC
sub_800ABBC: @ 800ABBC
push {lr}
ldr r0, =gSerialIsRFU
ldrb r0, [r0]
cmp r0, 0
bne _0800ABDC
ldr r0, =gLinkStatus
ldr r0, [r0]
lsrs r0, 5
movs r1, 0x1
ands r0, r1
b _0800ABE4
.pool
_0800ABDC:
bl sub_8011AB0
lsls r0, 24
lsrs r0, 24
_0800ABE4:
pop {r1}
bx r1
thumb_func_end sub_800ABBC
thumb_func_start sub_800ABE8
sub_800ABE8: @ 800ABE8
ldr r0, =gUnknown_03000D58
ldrb r0, [r0]
bx lr
.pool
thumb_func_end sub_800ABE8
thumb_func_start sub_800ABF4
sub_800ABF4: @ 800ABF4
push {lr}
lsls r0, 16
lsrs r3, r0, 16
ldr r0, =gSerialIsRFU
ldrb r0, [r0]
cmp r0, 0x1
bne _0800AC0C
bl task_add_05_task_del_08FA224_when_no_RfuFunc
b _0800AC20
.pool
_0800AC0C:
ldr r2, =gLinkCallback
ldr r1, [r2]
cmp r1, 0
bne _0800AC20
ldr r0, =sub_800AC80
str r0, [r2]
ldr r0, =gUnknown_030030E4
strb r1, [r0]
ldr r0, =gUnknown_030030F4
strh r3, [r0]
_0800AC20:
pop {r0}
bx r0
.pool
thumb_func_end sub_800ABF4
thumb_func_start sub_800AC34
sub_800AC34: @ 800AC34
push {lr}
ldr r0, =gSerialIsRFU
ldrb r0, [r0]
cmp r0, 0x1
bne _0800AC48
bl task_add_05_task_del_08FA224_when_no_RfuFunc
b _0800AC70
.pool
_0800AC48:
ldr r2, =gLinkCallback
ldr r1, [r2]
cmp r1, 0
beq _0800AC64
ldr r1, =gUnknown_02022B08
ldrh r0, [r1]
adds r0, 0x1
strh r0, [r1]
b _0800AC70
.pool
_0800AC64:
ldr r0, =sub_800AC80
str r0, [r2]
ldr r0, =gUnknown_030030E4
strb r1, [r0]
ldr r0, =gUnknown_030030F4
strh r1, [r0]
_0800AC70:
pop {r0}
bx r0
.pool
thumb_func_end sub_800AC34
thumb_func_start sub_800AC80 thumb_func_start sub_800AC80
sub_800AC80: @ 800AC80 sub_800AC80: @ 800AC80
push {lr} push {lr}

View File

@ -7537,13 +7537,13 @@ sub_8011A9C: @ 8011A9C
.pool .pool
thumb_func_end sub_8011A9C thumb_func_end sub_8011A9C
thumb_func_start sub_8011AB0 thumb_func_start Rfu_IsMaster
sub_8011AB0: @ 8011AB0 Rfu_IsMaster: @ 8011AB0
ldr r0, =gUnknown_03005000 ldr r0, =gUnknown_03005000
ldrb r0, [r0, 0xC] ldrb r0, [r0, 0xC]
bx lr bx lr
.pool .pool
thumb_func_end sub_8011AB0 thumb_func_end Rfu_IsMaster
thumb_func_start LinkVSync thumb_func_start LinkVSync
LinkVSync: @ 8011ABC LinkVSync: @ 8011ABC

View File

@ -566,7 +566,7 @@ _08178E58:
ands r0, r1 ands r0, r1
cmp r0, 0 cmp r0, 0
beq _08178E98 beq _08178E98
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
bne _08178E98 bne _08178E98

View File

@ -28128,7 +28128,7 @@ _081D4EBA:
thumb_func_start sub_81D4EC0 thumb_func_start sub_81D4EC0
sub_81D4EC0: @ 81D4EC0 sub_81D4EC0: @ 81D4EC0
push {lr} push {lr}
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _081D4EDC beq _081D4EDC
@ -28186,7 +28186,7 @@ _081D4F20:
.4byte _081D4FEC .4byte _081D4FEC
.4byte _081D4FF8 .4byte _081D4FF8
_081D4F38: _081D4F38:
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _081D4F88 beq _081D4F88

View File

@ -768,7 +768,7 @@ _080E73B8:
bl GetLinkPlayerCount_2 bl GetLinkPlayerCount_2
lsls r0, 24 lsls r0, 24
lsrs r4, r0, 24 lsrs r4, r0, 24
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1

View File

@ -473,7 +473,7 @@ _0807758C:
bcs _080775A0 bcs _080775A0
b _08077B46 b _08077B46
_080775A0: _080775A0:
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
beq _080775D8 beq _080775D8
@ -7367,7 +7367,7 @@ _0807AFAC:
b _0807B0E4 b _0807B0E4
.pool .pool
_0807AFBC: _0807AFBC:
bl sub_800ABBC bl IsLinkMaster
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
bne _0807AFC8 bne _0807AFC8

View File

@ -205,7 +205,7 @@ 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_800ABBC(void); u8 IsLinkMaster(void);
void sub_800AC34(void); void sub_800AC34(void);
void SetLinkDebugValues(u32 seed, u32 flags); void SetLinkDebugValues(u32 seed, u32 flags);

View File

@ -21,5 +21,7 @@ u8 sub_80104F4(void);
u8 rfu_get_multiplayer_id(void); u8 rfu_get_multiplayer_id(void);
bool8 sub_8010100(u8 a0); bool8 sub_8010100(u8 a0);
bool8 sub_8010500(void); bool8 sub_8010500(void);
bool8 Rfu_IsMaster(void);
void task_add_05_task_del_08FA224_when_no_RfuFunc(void);
#endif //GUARD_LINK_RFU_H #endif //GUARD_LINK_RFU_H

View File

@ -793,7 +793,7 @@ static void Task_HandleSendLinkBuffersData(u8 taskId)
if (GetLinkPlayerCount_2() >= var) if (GetLinkPlayerCount_2() >= var)
{ {
if (sub_800ABBC()) if (IsLinkMaster())
{ {
sub_800A620(); sub_800A620();
gTasks[taskId].data[11]++; gTasks[taskId].data[11]++;

View File

@ -107,6 +107,12 @@ EWRAM_DATA u16 gLinkTimeOutCounter = 0;
EWRAM_DATA struct LinkPlayer gLocalLinkPlayer = {}; EWRAM_DATA struct LinkPlayer gLocalLinkPlayer = {};
EWRAM_DATA struct LinkPlayer gLinkPlayers[MAX_RFU_PLAYERS] = {}; EWRAM_DATA struct LinkPlayer gLinkPlayers[MAX_RFU_PLAYERS] = {};
EWRAM_DATA struct LinkPlayer gSavedLinkPlayers[MAX_RFU_PLAYERS] = {}; EWRAM_DATA struct LinkPlayer gSavedLinkPlayers[MAX_RFU_PLAYERS] = {};
EWRAM_DATA struct {
u32 status;
u8 unk_04;
} gUnknown_02022B00 = {};
EWRAM_DATA u16 gUnknown_02022B08 = 0;
EWRAM_DATA void *gUnknown_02022B0C = NULL;
// Static ROM declarations // Static ROM declarations
@ -125,6 +131,7 @@ static u16 LinkTestCalcBlockChecksum(const u16 *src, u16 size);
static void LinkTest_prnthex(u32 pos, u8 a0, u8 a1, u8 a2); static void LinkTest_prnthex(u32 pos, u8 a0, u8 a1, u8 a2);
static void LinkCB_RequestPlayerDataExchange(void); static void LinkCB_RequestPlayerDataExchange(void);
static void Task_PrintTestData(u8 taskId); static void Task_PrintTestData(u8 taskId);
void sub_800AC80(void);
void sub_800AEB4(void); void sub_800AEB4(void);
u8 sub_800B2F8(void); u8 sub_800B2F8(void);
void sub_800B4A4(void); void sub_800B4A4(void);
@ -1368,3 +1375,55 @@ u8 GetLinkPlayerCount_2(void)
{ {
return EXTRACT_PLAYER_COUNT(gLinkStatus); return EXTRACT_PLAYER_COUNT(gLinkStatus);
} }
bool8 IsLinkMaster(void)
{
if (gSerialIsRFU)
{
return Rfu_IsMaster();
}
return EXTRACT_MASTER(gLinkStatus);
}
u8 sub_800ABE8(void)
{
return gUnknown_03000D58;
}
void sub_800ABF4(u16 a0)
{
if (gSerialIsRFU == TRUE)
{
task_add_05_task_del_08FA224_when_no_RfuFunc();
}
else
{
if (gLinkCallback == NULL)
{
gLinkCallback = sub_800AC80;
gUnknown_030030E4 = 0;
gUnknown_030030F4 = a0;
}
}
}
void sub_800AC34(void)
{
if (gSerialIsRFU == TRUE)
{
task_add_05_task_del_08FA224_when_no_RfuFunc();
}
else
{
if (gLinkCallback != NULL)
{
gUnknown_02022B08 ++;
}
else
{
gLinkCallback = sub_800AC80;
gUnknown_030030E4 = 0;
gUnknown_030030F4 = 0;
}
}
}

View File

@ -20,15 +20,6 @@ gStringVar4: @ 2021FC4
.include "src/string_util.o" .include "src/string_util.o"
.include "src/link.o" .include "src/link.o"
gUnknown_02022B00: @ 2022B00
.space 0x8
gUnknown_02022B08: @ 2022B08
.space 0x4
gUnknown_02022B0C: @ 2022B0C
.space 0x4
gUnknown_02022B10: @ 2022B10 gUnknown_02022B10: @ 2022B10
.space 0x4 .space 0x4