through sub_800AD10

This commit is contained in:
PikalaxALT 2017-11-12 22:24:15 -05:00
parent ccf6599b40
commit 6fe7b33ae1
2 changed files with 59 additions and 99 deletions

View File

@ -5,104 +5,6 @@
.text
thumb_func_start sub_800AC80
sub_800AC80: @ 800AC80
push {lr}
ldr r0, =gUnknown_03004130
ldrb r0, [r0]
cmp r0, 0
bne _0800AC96
ldr r0, =0x00005fff
bl BuildSendCmd
ldr r1, =gLinkCallback
ldr r0, =sub_800ACAC
str r0, [r1]
_0800AC96:
pop {r0}
bx r0
.pool
thumb_func_end sub_800AC80
thumb_func_start sub_800ACAC
sub_800ACAC: @ 800ACAC
push {r4,lr}
bl GetLinkPlayerCount
lsls r0, 24
lsrs r2, r0, 24
movs r3, 0
movs r1, 0
cmp r3, r2
bge _0800ACD0
ldr r4, =gUnknown_030030F0
_0800ACC0:
adds r0, r1, r4
ldrb r0, [r0]
cmp r0, 0
beq _0800ACCA
adds r3, 0x1
_0800ACCA:
adds r1, 0x1
cmp r1, r2
blt _0800ACC0
_0800ACD0:
cmp r3, r2
bne _0800ACF4
ldr r2, =gBattleTypeFlags
ldr r0, [r2]
movs r1, 0x21
negs r1, r1
ands r0, r1
str r0, [r2]
ldr r0, =gLinkVSyncDisabled
movs r4, 0x1
strb r4, [r0]
bl CloseLink
ldr r1, =gLinkCallback
movs r0, 0
str r0, [r1]
ldr r0, =gUnknown_030030E4
strb r4, [r0]
_0800ACF4:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_800ACAC
thumb_func_start sub_800AD10
sub_800AD10: @ 800AD10
push {lr}
ldr r0, =gSerialIsRFU
ldrb r0, [r0]
cmp r0, 0x1
bne _0800AD24
bl task_add_05_task_del_08FA224_when_no_RfuFunc
b _0800AD4C
.pool
_0800AD24:
ldr r2, =gLinkCallback
ldr r1, [r2]
cmp r1, 0
beq _0800AD40
ldr r1, =gUnknown_02022B08
ldrh r0, [r1]
adds r0, 0x1
strh r0, [r1]
b _0800AD4C
.pool
_0800AD40:
ldr r0, =sub_800AD5C
str r0, [r2]
ldr r0, =gUnknown_030030E4
strb r1, [r0]
ldr r0, =gUnknown_030030F4
strh r1, [r0]
_0800AD4C:
pop {r0}
bx r0
.pool
thumb_func_end sub_800AD10
thumb_func_start sub_800AD5C
sub_800AD5C: @ 800AD5C
push {lr}

View File

@ -16,6 +16,7 @@
#include "palette.h"
#include "task.h"
#include "trade.h"
#include "battle.h"
#include "link_rfu.h"
#include "link.h"
@ -131,7 +132,9 @@ static u16 LinkTestCalcBlockChecksum(const u16 *src, u16 size);
static void LinkTest_prnthex(u32 pos, u8 a0, u8 a1, u8 a2);
static void LinkCB_RequestPlayerDataExchange(void);
static void Task_PrintTestData(u8 taskId);
void sub_800AC80(void);
static void sub_800AC80(void);
static void sub_800ACAC(void);
void sub_800AD5C(void);
void sub_800AEB4(void);
u8 sub_800B2F8(void);
void sub_800B4A4(void);
@ -1427,3 +1430,58 @@ void sub_800AC34(void)
}
}
}
static void sub_800AC80(void)
{
if (gUnknown_03004130 == 0)
{
BuildSendCmd(0x5fff);
gLinkCallback = sub_800ACAC;
}
}
static void sub_800ACAC(void)
{
int i;
unsigned count;
u8 linkPlayerCount;
linkPlayerCount = GetLinkPlayerCount();
count = 0;
for (i = 0; i < linkPlayerCount; i ++)
{
if (gUnknown_030030F0[i])
{
count ++;
}
}
if (count == linkPlayerCount)
{
gBattleTypeFlags &= ~BATTLE_TYPE_20;
gLinkVSyncDisabled = TRUE;
CloseLink();
gLinkCallback = NULL;
gUnknown_030030E4 = 1;
}
}
void sub_800AD10(void)
{
if (gSerialIsRFU == TRUE)
{
task_add_05_task_del_08FA224_when_no_RfuFunc();
}
else
{
if (gLinkCallback != NULL)
{
gUnknown_02022B08 ++;
}
else
{
gLinkCallback = sub_800AD5C;
gUnknown_030030E4 = 0;
gUnknown_030030F4 = 0;
}
}
}