through sub_800D358

This commit is contained in:
PikalaxALT 2017-11-30 00:19:44 -05:00
parent c906978692
commit a781a6d5fd
4 changed files with 85 additions and 176 deletions

View File

@ -5,159 +5,6 @@
.text
thumb_func_start sub_800D30C
sub_800D30C: @ 800D30C
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 24
lsrs r1, 24
ldr r4, =gUnknown_03004140
ldr r2, [r4, 0x40]
cmp r2, 0
beq _0800D322
bl _call_via_r2
_0800D322:
movs r0, 0
strh r0, [r4, 0x16]
strh r0, [r4, 0x14]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_800D30C
thumb_func_start sub_800D334
sub_800D334: @ 800D334
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r4, =gUnknown_03004140
ldrb r5, [r4, 0xE]
movs r1, 0x1
strb r1, [r4, 0xE]
bl rfu_REQ_disconnect
bl rfu_waitREQComplete
strb r5, [r4, 0xE]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_800D334
thumb_func_start sub_800D358
sub_800D358: @ 800D358
push {r4-r7,lr}
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gUnknown_03007890
ldr r0, [r0]
ldrb r0, [r0, 0x4]
cmp r0, 0
beq _0800D3A0
movs r4, 0
_0800D36A:
ldr r1, =gUnknown_03007880
lsls r0, r4, 2
adds r0, r1
ldr r2, [r0]
ldrh r0, [r2]
movs r3, 0x80
lsls r3, 8
adds r1, r3, 0
ands r0, r1
cmp r0, 0
beq _0800D396
ldrb r1, [r2, 0x1A]
adds r0, r5, 0
ands r0, r1
cmp r0, 0
beq _0800D396
adds r2, r1, 0
bics r2, r5
movs r0, 0x20
adds r1, r4, 0
bl rfu_changeSendTarget
_0800D396:
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x3
bls _0800D36A
_0800D3A0:
ldr r0, =gUnknown_03007890
ldr r0, [r0]
ldrb r0, [r0, 0x5]
cmp r0, 0
beq _0800D3DE
movs r4, 0
_0800D3AC:
ldr r1, =gUnknown_03007880
lsls r0, r4, 2
adds r0, r1
ldr r2, [r0]
ldrh r0, [r2, 0x34]
movs r3, 0x80
lsls r3, 8
adds r1, r3, 0
ands r0, r1
cmp r0, 0
beq _0800D3D4
adds r0, r2, 0
adds r0, 0x4E
ldrb r0, [r0]
ands r0, r5
cmp r0, 0
beq _0800D3D4
adds r0, r4, 0
bl rfu_NI_stopReceivingData
_0800D3D4:
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x3
bls _0800D3AC
_0800D3DE:
ldr r0, =gUnknown_03007890
ldr r3, [r0]
ldrb r2, [r3, 0x6]
cmp r2, 0
beq _0800D41C
mvns r1, r5
adds r0, r1, 0
ands r0, r2
strb r0, [r3, 0x6]
movs r4, 0
ldr r7, =gUnknown_03007870
ldr r6, =0x00008024
_0800D3F6:
lsls r0, r4, 2
adds r0, r7
ldr r2, [r0]
ldrh r0, [r2]
cmp r0, r6
bne _0800D412
ldrb r3, [r2, 0x3]
adds r0, r5, 0
ands r0, r3
cmp r0, 0
beq _0800D412
adds r0, r1, 0
ands r0, r3
strb r0, [r2, 0x3]
_0800D412:
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x3
bls _0800D3F6
_0800D41C:
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_800D358
thumb_func_start sub_800D434
sub_800D434: @ 800D434
push {r4-r7,lr}

View File

@ -105,7 +105,10 @@ struct RfuIntrStruct
struct RfuUnk1
{
u8 unk_0[0x14];
u16 unk_0;
u8 unk_2;
u8 unk_3;
u8 fill_4[0x10];
u32 unk_14;
u32 unk_18;
struct RfuIntrStruct unk_1c;
@ -114,9 +117,13 @@ struct RfuUnk1
struct RfuUnk2
{
u16 unk_0;
u8 fill_2[0x32];
u8 fill_2[0x18];
u8 unk_1a;
u8 fill_1b[0x19];
u16 unk_34;
u8 fill_36[0x2b];
u8 fill_36[0x18];
u8 unk_4e;
u8 fill_4f[0x12];
u8 unk_61;
u8 fill_62[6];
u32 unk_68;
@ -132,14 +139,6 @@ struct RfuUnk3
u32 unk_dc;
};
struct RfuUnkSub
{
u16 unk_00;
u8 unk_02;
u16 unk_04;
u8 filler_06[26];
};
struct RfuUnk5
{
u8 unk_00;
@ -152,7 +151,12 @@ struct RfuUnk5
u8 unk_07;
u8 unk_08;
u8 filler_09[11];
struct RfuUnkSub unk_14[4];
struct RfuUnk5Sub {
u16 unk_00;
u8 unk_02;
u16 unk_04;
u8 filler_06[26];
} unk_14[4];
};
extern struct RfuStruct *gRfuState;
@ -199,3 +203,6 @@ void rfu_clearSlot(u8 a0, u8 a1);
bool16 rfu_CHILD_getConnectRecoveryStatus(u8 *status);
bool16 rfu_getConnectParentStatus(u8 *status, u8 *a1);
bool16 rfu_UNI_PARENT_getDRAC_ACK(u8 *a0);
void rfu_REQ_disconnect(u8 who);
void rfu_changeSendTarget(u8 a0, u8 who, u8 a2);
void rfu_NI_stopReceivingData(u8 who);

View File

@ -73,7 +73,7 @@ struct UnkRfuStruct_1 {
/* 0x032 */ u16 unk_32;
/* 0x034 */ u16 unk_34[4];
/* 0x03c */ struct UnkLinkRfuStruct_02022B2C *unk_3c;
/* 0x040 */ void (*unk_40)(u8);
/* 0x040 */ void (*unk_40)(u8, u8);
/* 0x044 */ void (*unk_44)(u16);
/* 0x048 */ u8 filler_48[0xe78];
};

View File

@ -24,20 +24,20 @@ EWRAM_DATA struct UnkLinkRfuStruct_02022B2C gUnknown_02022B2C = {};
// Static ROM declarations
static void sub_800C000(void);
void sub_800CEB0(u16 r6);
void sub_800C7B4(u16 r8, u16 r6);
void sub_800D30C(u8 a0, u8 a1);
void sub_800D334(u8 a0);
void sub_800D610(void);
void sub_800D630(void);
static void sub_800C7B4(u16 r8, u16 r6);
static void sub_800C744(u32 a0);
void sub_800CEB0(u16 r6);
static void sub_800CF34(void);
static void sub_800D158(void);
static void sub_800D20C(void);
static void sub_800D268(void);
static u8 sub_800D294(void);
void sub_800D358(void);
void sub_800D30C(u8 a0, u8 a1);
static void sub_800D334(u8 a0);
static void sub_800D358(u8 a0);
void sub_800D434(void);
void sub_800D610(void);
void sub_800D630(void);
// .rodata
@ -85,7 +85,7 @@ void rfu_REQ_sendData_wrapper(u8 r2)
rfu_REQ_sendData(r2);
}
int sub_800BF4C(void (*func1)(u8), void (*func2)(u16))
int sub_800BF4C(void (*func1)(u8, u8), void (*func2)(u16))
{
if (func1 == NULL)
{
@ -613,7 +613,7 @@ static void sub_800C744(u32 a0)
}
}
void sub_800C7B4(u16 r8, u16 r6)
static void sub_800C7B4(u16 r8, u16 r6)
{
u8 sp0;
register u8 *stwiRecvBuffer asm("r0");
@ -870,7 +870,7 @@ void sub_800C7B4(u16 r8, u16 r6)
{
stwiRecvBuffer = rfu_getSTWIRecvBuffer();
gUnknown_03004140.unk_14 = stwiRecvBuffer[8];
sub_800D358();
sub_800D358(gUnknown_03004140.unk_14);
if (gUnknown_03004140.unk_30)
{
gUnknown_03004140.unk_30 &= ~gUnknown_03004140.unk_14;
@ -1208,3 +1208,58 @@ static u8 sub_800D294(void)
}
return flags;
}
void sub_800D30C(u8 a0, u8 a1)
{
if (gUnknown_03004140.unk_40 != NULL)
{
gUnknown_03004140.unk_40(a0, a1);
}
gUnknown_03004140.unk_14 = gUnknown_03004140.unk_16 = 0;
}
static void sub_800D334(u8 a0)
{
u8 unk_0e_bak = gUnknown_03004140.unk_0e;
gUnknown_03004140.unk_0e = 1;
rfu_REQ_disconnect(a0);
rfu_waitREQComplete();
gUnknown_03004140.unk_0e = unk_0e_bak;
}
static void sub_800D358(u8 a0)
{
u8 i;
if (gUnknown_03007890->unk_04)
{
for (i = 0; i < 4; i++)
{
if (gUnknown_03007880[i]->unk_0 & 0x8000 && gUnknown_03007880[i]->unk_1a & a0)
{
rfu_changeSendTarget(0x20, i, gUnknown_03007880[i]->unk_1a & ~a0);
}
}
}
if (gUnknown_03007890->unk_05)
{
for (i = 0; i < 4; i++)
{
if (gUnknown_03007880[i]->unk_34 & 0x8000 && gUnknown_03007880[i]->unk_4e & a0)
{
rfu_NI_stopReceivingData(i);
}
}
}
if (gUnknown_03007890->unk_06)
{
gUnknown_03007890->unk_06 &= ~a0;
for (i = 0; i < 4; i++)
{
if (gUnknown_03007870[i]->unk_0 == 0x8024 && a0 & gUnknown_03007870[i]->unk_3)
{
gUnknown_03007870[i]->unk_3 &= ~a0;
}
}
}
}