mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
sub_800F1E0
This commit is contained in:
parent
5b526906e1
commit
cfb0e233ee
319
asm/link_rfu.s
319
asm/link_rfu.s
@ -5,325 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_800F1E0
|
||||
sub_800F1E0: @ 800F1E0
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x8
|
||||
ldr r0, =gUnknown_03005000
|
||||
ldrh r1, [r0, 0x4]
|
||||
adds r6, r0, 0
|
||||
cmp r1, 0x13
|
||||
bhi _0800F1F8
|
||||
b _0800F45A
|
||||
_0800F1F8:
|
||||
ldrb r0, [r6, 0xE]
|
||||
cmp r0, 0x1
|
||||
beq _0800F200
|
||||
b _0800F45A
|
||||
_0800F200:
|
||||
bl rfu_waitREQComplete
|
||||
ldr r0, =0x00000cdb
|
||||
adds r2, r6, r0
|
||||
ldrb r0, [r2]
|
||||
cmp r0, 0
|
||||
bne _0800F220
|
||||
adds r1, r6, 0
|
||||
adds r1, 0xEE
|
||||
_0800F212:
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0
|
||||
beq _0800F21A
|
||||
b _0800F480
|
||||
_0800F21A:
|
||||
ldrb r0, [r2]
|
||||
cmp r0, 0
|
||||
beq _0800F212
|
||||
_0800F220:
|
||||
bl rfu_REQ_recvData
|
||||
bl rfu_waitREQComplete
|
||||
ldr r2, =gUnknown_03004140
|
||||
ldr r4, =gUnknown_03005000
|
||||
ldr r1, =0x00000ce2
|
||||
adds r0, r4, r1
|
||||
ldrb r1, [r2, 0x3]
|
||||
ldrb r0, [r0]
|
||||
ands r1, r0
|
||||
cmp r1, r0
|
||||
beq _0800F23C
|
||||
b _0800F444
|
||||
_0800F23C:
|
||||
ldr r6, =0x00000cdc
|
||||
adds r1, r4, r6
|
||||
ldrb r0, [r1]
|
||||
movs r0, 0
|
||||
strb r0, [r1]
|
||||
ldr r1, =gUnknown_02022B44
|
||||
ldrh r0, [r1, 0x6]
|
||||
adds r0, 0x1
|
||||
strh r0, [r1, 0x6]
|
||||
ldrb r7, [r2]
|
||||
movs r5, 0
|
||||
_0800F252:
|
||||
movs r0, 0x1
|
||||
ands r0, r7
|
||||
lsrs r1, r7, 1
|
||||
str r1, [sp, 0x4]
|
||||
adds r2, r5, 0x1
|
||||
str r2, [sp]
|
||||
cmp r0, 0
|
||||
bne _0800F264
|
||||
b _0800F364
|
||||
_0800F264:
|
||||
ldr r1, =gUnknown_03005000
|
||||
lsls r2, r5, 3
|
||||
subs r0, r2, r5
|
||||
lsls r4, r0, 1
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x15
|
||||
adds r0, r4, r0
|
||||
ldrb r0, [r0]
|
||||
adds r6, r1, 0
|
||||
adds r3, r2, 0
|
||||
lsls r1, r5, 24
|
||||
mov r10, r1
|
||||
cmp r0, 0
|
||||
beq _0800F35C
|
||||
ldr r2, =0x00000cee
|
||||
adds r0, r6, r2
|
||||
adds r1, r5, r0
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0xFF
|
||||
beq _0800F2E0
|
||||
adds r0, r6, 0
|
||||
adds r0, 0x14
|
||||
adds r0, r4, r0
|
||||
ldrb r2, [r0]
|
||||
lsrs r2, 5
|
||||
ldrb r0, [r1]
|
||||
adds r0, 0x1
|
||||
movs r1, 0x7
|
||||
ands r0, r1
|
||||
cmp r2, r0
|
||||
beq _0800F2E0
|
||||
ldr r0, =0x00000cea
|
||||
adds r1, r6, r0
|
||||
adds r1, r5, r1
|
||||
ldrb r0, [r1]
|
||||
adds r0, 0x1
|
||||
strb r0, [r1]
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x4
|
||||
bls _0800F35C
|
||||
movs r0, 0x81
|
||||
lsls r0, 8
|
||||
bl sub_8011170
|
||||
b _0800F35C
|
||||
.pool
|
||||
_0800F2E0:
|
||||
ldr r2, =gUnknown_03005000
|
||||
ldr r6, =0x00000cee
|
||||
adds r1, r2, r6
|
||||
adds r1, r5, r1
|
||||
subs r3, r5
|
||||
lsls r3, 1
|
||||
adds r4, r2, 0
|
||||
adds r4, 0x14
|
||||
adds r2, r3, r4
|
||||
ldrb r0, [r2]
|
||||
lsrs r0, 5
|
||||
strb r0, [r1]
|
||||
ldr r1, =gUnknown_03005000
|
||||
subs r6, 0x4
|
||||
adds r0, r1, r6
|
||||
adds r0, r5, r0
|
||||
movs r1, 0
|
||||
strb r1, [r0]
|
||||
ldrb r1, [r2]
|
||||
movs r0, 0x1F
|
||||
ands r0, r1
|
||||
strb r0, [r2]
|
||||
ldr r2, =gUnknown_03005000+0xCDE
|
||||
adds r0, r5, r2
|
||||
ldrb r0, [r0]
|
||||
movs r6, 0
|
||||
lsls r1, r5, 24
|
||||
mov r10, r1
|
||||
lsrs r2, r7, 1
|
||||
str r2, [sp, 0x4]
|
||||
adds r5, 0x1
|
||||
str r5, [sp]
|
||||
ldr r1, =gRecvCmds
|
||||
mov r9, r1
|
||||
adds r5, r3, 0
|
||||
adds r7, r4, 0
|
||||
lsls r0, 4
|
||||
mov r8, r0
|
||||
adds r2, r5, 0x1
|
||||
mov r12, r2
|
||||
_0800F330:
|
||||
lsls r1, r6, 1
|
||||
mov r0, r8
|
||||
adds r4, r1, r0
|
||||
add r4, r9
|
||||
mov r2, r12
|
||||
adds r3, r1, r2
|
||||
adds r3, r7
|
||||
ldrb r2, [r3]
|
||||
lsls r2, 8
|
||||
adds r1, r5
|
||||
adds r1, r7
|
||||
ldrb r0, [r1]
|
||||
orrs r0, r2
|
||||
strh r0, [r4]
|
||||
movs r0, 0
|
||||
strb r0, [r3]
|
||||
strb r0, [r1]
|
||||
adds r0, r6, 0x1
|
||||
lsls r0, 16
|
||||
lsrs r6, r0, 16
|
||||
cmp r6, 0x6
|
||||
bls _0800F330
|
||||
_0800F35C:
|
||||
mov r1, r10
|
||||
lsrs r0, r1, 24
|
||||
bl rfu_UNI_clearRecvNewDataFlag
|
||||
_0800F364:
|
||||
ldr r2, [sp, 0x4]
|
||||
lsls r0, r2, 16
|
||||
lsrs r7, r0, 16
|
||||
ldr r6, [sp]
|
||||
lsls r0, r6, 16
|
||||
lsrs r5, r0, 16
|
||||
cmp r5, 0x3
|
||||
bhi _0800F376
|
||||
b _0800F252
|
||||
_0800F376:
|
||||
bl sub_800F014
|
||||
movs r0, 0
|
||||
bl sub_800F86C
|
||||
bl sub_8010528
|
||||
ldr r4, =gUnknown_03005000
|
||||
ldr r1, =0x00000ce5
|
||||
adds r0, r4, r1
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _0800F452
|
||||
ldr r2, =0x00000cd9
|
||||
adds r0, r4, r2
|
||||
ldrb r2, [r0]
|
||||
cmp r2, 0
|
||||
bne _0800F452
|
||||
ldr r0, =gUnknown_02022B44
|
||||
ldrb r1, [r0, 0xE]
|
||||
strb r2, [r0, 0xE]
|
||||
ldr r6, =0x00000cda
|
||||
adds r0, r4, r6
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x3
|
||||
bl rfu_clearSlot
|
||||
movs r5, 0
|
||||
adds r7, r4, 0
|
||||
adds r7, 0x14
|
||||
_0800F3B2:
|
||||
ldr r0, =0x00000ce5
|
||||
adds r6, r4, r0
|
||||
ldrb r0, [r6]
|
||||
asrs r0, r5
|
||||
movs r1, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0800F3D6
|
||||
lsls r1, r5, 24
|
||||
lsrs r1, 24
|
||||
lsls r2, r5, 3
|
||||
subs r2, r5
|
||||
lsls r2, 1
|
||||
adds r2, r7
|
||||
movs r0, 0x10
|
||||
movs r3, 0xE
|
||||
bl rfu_setRecvBuffer
|
||||
_0800F3D6:
|
||||
adds r0, r5, 0x1
|
||||
lsls r0, 16
|
||||
lsrs r5, r0, 16
|
||||
cmp r5, 0x3
|
||||
bls _0800F3B2
|
||||
subs r4, r6, 0x3
|
||||
ldrb r0, [r4]
|
||||
ldrb r2, [r6]
|
||||
adds r1, r0, 0
|
||||
orrs r1, r2
|
||||
bl sub_800E88C
|
||||
ldrb r1, [r6]
|
||||
movs r2, 0
|
||||
strb r1, [r6, 0x4]
|
||||
ldrb r0, [r4]
|
||||
orrs r0, r1
|
||||
strb r0, [r4]
|
||||
strb r2, [r6]
|
||||
ldrb r0, [r4]
|
||||
adds r1, r6, 0
|
||||
subs r1, 0x5E
|
||||
movs r2, 0x46
|
||||
bl rfu_UNI_setSendData
|
||||
ldrb r0, [r4]
|
||||
bl sub_800E87C
|
||||
adds r1, r6, 0
|
||||
subs r1, 0xB
|
||||
strb r0, [r1]
|
||||
ldr r0, =sub_8010AAC
|
||||
movs r1, 0
|
||||
bl CreateTask
|
||||
b _0800F452
|
||||
.pool
|
||||
_0800F444:
|
||||
ldr r2, =0x00000cdc
|
||||
adds r1, r4, r2
|
||||
ldrb r0, [r1]
|
||||
movs r2, 0
|
||||
movs r0, 0x1
|
||||
strb r0, [r1]
|
||||
strb r2, [r4, 0xE]
|
||||
_0800F452:
|
||||
ldr r1, =gUnknown_03005000
|
||||
movs r0, 0
|
||||
strb r0, [r1, 0xE]
|
||||
adds r6, r1, 0
|
||||
_0800F45A:
|
||||
ldr r1, =0x00000cdc
|
||||
adds r0, r6, r1
|
||||
ldrb r0, [r0]
|
||||
adds r1, r0, 0
|
||||
ldr r0, =gUnknown_03007890
|
||||
ldr r0, [r0]
|
||||
ldrb r0, [r0, 0x6]
|
||||
cmp r0, 0
|
||||
beq _0800F484
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
b _0800F486
|
||||
.pool
|
||||
_0800F480:
|
||||
movs r0, 0
|
||||
b _0800F486
|
||||
_0800F484:
|
||||
movs r0, 0
|
||||
_0800F486:
|
||||
add sp, 0x8
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_800F1E0
|
||||
|
||||
thumb_func_start sub_800F498
|
||||
sub_800F498: @ 800F498
|
||||
push {r4,r5,lr}
|
||||
|
@ -44,7 +44,8 @@ struct UnkLinkRfuStruct_02022B44
|
||||
{
|
||||
u8 fill_00[6];
|
||||
u16 unk_06;
|
||||
u8 fill_08[7];
|
||||
u8 fill_08[6];
|
||||
vu8 unk_0e;
|
||||
u8 unk_0f;
|
||||
u8 fill_10[0xcc];
|
||||
};
|
||||
@ -164,7 +165,8 @@ struct UnkRfuStruct_2 {
|
||||
/* 0xccd */ u8 unk_ccd;
|
||||
/* 0xcce */ u8 filler_cce[2];
|
||||
/* 0xcd0 */ vu8 unk_cd0;
|
||||
/* 0xcd1 */ u8 filler_cd1[9];
|
||||
/* 0xcd1 */ u8 filler_cd1[8];
|
||||
/* 0xcd9 */ u8 unk_cd9;
|
||||
/* 0xcda */ u8 unk_cda;
|
||||
/* 0xcdb */ vu8 unk_cdb;
|
||||
/* 0xcdc */ vu8 unk_cdc;
|
||||
@ -173,10 +175,13 @@ struct UnkRfuStruct_2 {
|
||||
/* 0xce2 */ u8 unk_ce2;
|
||||
/* 0xce2 */ u8 unk_ce3;
|
||||
/* 0xce4 */ u8 unk_ce4;
|
||||
/* 0xce5 */ u8 filler_ce5[2];
|
||||
/* 0xce5 */ u8 unk_ce5;
|
||||
/* 0xce5 */ u8 unk_ce6;
|
||||
/* 0xce7 */ u8 unk_ce7;
|
||||
/* 0xce8 */ u8 unk_ce8;
|
||||
/* 0xce9 */ u8 filler_ce9[11];
|
||||
/* 0xce9 */ u8 unk_ce9;
|
||||
/* 0xcea */ u8 unk_cea[4];
|
||||
/* 0xcee */ u8 unk_cee[4];
|
||||
}; // size = 0xcf4
|
||||
|
||||
// Exported RAM declarations
|
||||
|
@ -54,8 +54,10 @@ void sub_800ED34(u16 unused);
|
||||
static void sub_800EDBC(u16 unused);
|
||||
static void sub_800F048(void);
|
||||
struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void);
|
||||
void sub_800F86C(u8 a0);
|
||||
void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data);
|
||||
bool32 sub_8010454(u16 a0);
|
||||
void sub_8010528(void);
|
||||
void sub_8010750(void);
|
||||
int sub_80107A0(void);
|
||||
void sub_801084C(u8 taskId);
|
||||
@ -3033,3 +3035,91 @@ bool32 sub_800F0F8(void)
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 sub_800F1E0(void)
|
||||
{
|
||||
u16 i;
|
||||
u16 flags;
|
||||
u8 r0;
|
||||
u16 j;
|
||||
u8 retval;
|
||||
|
||||
if (gUnknown_03005000.unk_04 >= 20 && gUnknown_03005000.unk_0e == 1)
|
||||
{
|
||||
rfu_waitREQComplete();
|
||||
while (gUnknown_03005000.unk_cdb == 0)
|
||||
{
|
||||
if (gUnknown_03005000.unk_ee != 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
rfu_REQ_recvData();
|
||||
rfu_waitREQComplete();
|
||||
if ((gUnknown_03004140.unk_03 & gUnknown_03005000.unk_ce2) == gUnknown_03005000.unk_ce2)
|
||||
{
|
||||
gUnknown_03005000.unk_cdc = 0;
|
||||
gUnknown_02022B44.unk_06++;
|
||||
flags = gUnknown_03004140.unk_00;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (flags & 1)
|
||||
{
|
||||
if (gUnknown_03005000.unk_14[i][1])
|
||||
{
|
||||
if (gUnknown_03005000.unk_cee[i] != 0xff && (gUnknown_03005000.unk_14[i][0] >> 5) != ((gUnknown_03005000.unk_cee[i] + 1) & 7))
|
||||
{
|
||||
if (++gUnknown_03005000.unk_cea[i] > 4)
|
||||
sub_8011170(0x8100);
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_03005000.unk_cee[i] = gUnknown_03005000.unk_14[i][0] / 32;
|
||||
gUnknown_03005000.unk_cea[i] = 0;
|
||||
gUnknown_03005000.unk_14[i][0] &= 0x1f;
|
||||
r0 = gUnknown_03005000.unk_cde[i];
|
||||
for (j = 0; j < 7; j++)
|
||||
{
|
||||
gRecvCmds[r0][j] = (gUnknown_03005000.unk_14[i][(j << 1) + 1] << 8) | gUnknown_03005000.unk_14[i][(j << 1) + 0];
|
||||
gUnknown_03005000.unk_14[i][(j << 1) + 1] = 0;
|
||||
gUnknown_03005000.unk_14[i][(j << 1) + 0] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
rfu_UNI_clearRecvNewDataFlag(i);
|
||||
}
|
||||
flags >>= 1;
|
||||
}
|
||||
sub_800F014();
|
||||
sub_800F86C(0);
|
||||
sub_8010528();
|
||||
if (gUnknown_03005000.unk_ce5 && !gUnknown_03005000.unk_cd9)
|
||||
{
|
||||
gUnknown_02022B44.unk_0e = 0;
|
||||
rfu_clearSlot(3, gUnknown_03005000.unk_cda);
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if ((gUnknown_03005000.unk_ce5 >> i) & 1)
|
||||
{
|
||||
rfu_setRecvBuffer(0x10, i, gUnknown_03005000.unk_14[i], 14);
|
||||
}
|
||||
}
|
||||
sub_800E88C(gUnknown_03005000.unk_ce2, gUnknown_03005000.unk_ce2 | gUnknown_03005000.unk_ce5);
|
||||
gUnknown_03005000.unk_ce9 = gUnknown_03005000.unk_ce5;
|
||||
gUnknown_03005000.unk_ce2 |= gUnknown_03005000.unk_ce5;
|
||||
gUnknown_03005000.unk_ce5 = 0;
|
||||
rfu_UNI_setSendData(gUnknown_03005000.unk_ce2, gUnknown_03005000.unk_c87, 70);
|
||||
gUnknown_03005000.unk_cda = sub_800E87C(gUnknown_03005000.unk_ce2);
|
||||
CreateTask(sub_8010AAC, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_03005000.unk_cdc = 1;
|
||||
gUnknown_03005000.unk_0e = 0;
|
||||
}
|
||||
gUnknown_03005000.unk_0e = 0;
|
||||
}
|
||||
retval = gUnknown_03005000.unk_cdc;
|
||||
return gUnknown_03007890->unk_06 ? retval & 1 : FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user