mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 19:24:16 +01:00
resolve questionable file boundary decision
This commit is contained in:
parent
648f3245c1
commit
f25cdb4837
@ -5,8 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
// RFU; bss indicates that no file boundary exists here
|
||||
|
||||
thumb_func_start sub_800C12C
|
||||
sub_800C12C: @ 800C12C
|
||||
push {r4-r7,lr}
|
||||
|
@ -52,6 +52,7 @@ SECTIONS {
|
||||
src/sprite.o(.text);
|
||||
src/string_util.o(.text);
|
||||
src/link.o(.text);
|
||||
src/link_rfu.o(.text);
|
||||
asm/link.o(.text);
|
||||
asm/link_rfu.o(.text);
|
||||
asm/rom_8011DC0.o(.text);
|
||||
|
169
src/link.c
169
src/link.c
@ -66,7 +66,6 @@ IWRAM_DATA u16 sSendNonzeroCheck;
|
||||
IWRAM_DATA u16 sRecvNonzeroCheck;
|
||||
IWRAM_DATA u8 sChecksumAvailable;
|
||||
IWRAM_DATA u8 sHandshakePlayerCount;
|
||||
IWRAM_DATA u8 gUnknown_03000D74;
|
||||
|
||||
u16 gLinkPartnersHeldKeys[6];
|
||||
u32 gLinkDebugSeed;
|
||||
@ -169,13 +168,6 @@ static void DoSend(void);
|
||||
static void StopTimer(void);
|
||||
static void SendRecvDone(void);
|
||||
|
||||
void sub_800D610(void);
|
||||
void sub_800CEB0(u16 unk0);
|
||||
void sub_800C7B4(u16 unk0, u16 unk1);
|
||||
void sub_800C000(void);
|
||||
|
||||
void sub_800D30C(u8 a0, u8 a1);
|
||||
|
||||
// .rodata
|
||||
|
||||
ALIGNED(4) const u16 gWirelessLinkDisplayPal[] = INCBIN_U16("graphics/interface/wireless_link_display.gbapal");
|
||||
@ -2448,164 +2440,3 @@ void ResetRecvBuffer(void)
|
||||
}
|
||||
|
||||
// rfu
|
||||
|
||||
u32 sub_800BEC0(void)
|
||||
{
|
||||
u32 r4;
|
||||
|
||||
r4 = rfu_REQBN_softReset_and_checkID();
|
||||
if (r4 == 0x8001)
|
||||
{
|
||||
gUnknown_03004140.unk_08 = 1;
|
||||
}
|
||||
if (gUnknown_03004140.unk_04 != 0x17 && gUnknown_03004140.unk_04 != 0x01)
|
||||
{
|
||||
gUnknown_03004140.unk_05 = 0;
|
||||
gUnknown_03004140.unk_04 = 0;
|
||||
}
|
||||
gUnknown_03004140.unk_07 = 0;
|
||||
gUnknown_03004140.unk_0d = 0;
|
||||
gUnknown_03004140.unk_01 = 0;
|
||||
gUnknown_03004140.unk_00 = 0;
|
||||
gUnknown_03004140.unk_06 = -1;
|
||||
sub_800D610();
|
||||
return r4;
|
||||
}
|
||||
|
||||
void rfu_REQ_sendData_wrapper(u8 r2)
|
||||
{
|
||||
u8 val;
|
||||
if (!gUnknown_03007890->unk_00)
|
||||
{
|
||||
val = gUnknown_03004140.unk_02;
|
||||
r2 = 0;
|
||||
if (val == 1)
|
||||
{
|
||||
r2 = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_03004140.unk_03 = 0;
|
||||
}
|
||||
rfu_REQ_sendData(r2);
|
||||
}
|
||||
|
||||
int sub_800BF4C(void (*func1)(u8), void (*func2)(void))
|
||||
{
|
||||
if (func1 == NULL)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
CpuFill16(0, &gUnknown_03004140, sizeof(gUnknown_03004140));
|
||||
gUnknown_03004140.unk_06 = -1;
|
||||
gUnknown_03004140.unk_40 = func1;
|
||||
gUnknown_03004140.unk_44 = func2;
|
||||
rfu_setMSCCallback(sub_800CEB0);
|
||||
rfu_setREQCallback(sub_800C7B4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_800BFA0(void)
|
||||
{
|
||||
CpuFill16(0, &gUnknown_03004140, sizeof(gUnknown_03004140) - 2 * sizeof(void *));
|
||||
gUnknown_03004140.unk_06 = -1;
|
||||
}
|
||||
|
||||
void sub_800BFCC(struct UnkLinkRfuStruct_02022B2C *unk0)
|
||||
{
|
||||
sub_800C000();
|
||||
gUnknown_03004140.unk_04 = 1;
|
||||
gUnknown_03004140.unk_05 = 2;
|
||||
gUnknown_03004140.unk_3c = unk0;
|
||||
gUnknown_03004140.unk_09 = unk0->unk_11;
|
||||
gUnknown_03004140.unk_32 = unk0->unk_12;
|
||||
gUnknown_03004140.unk_18 = unk0->unk_14;
|
||||
if (unk0->unk_10)
|
||||
{
|
||||
gUnknown_03004140.unk_0b = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_800C000(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
gUnknown_03004140.unk_05 = 0;
|
||||
gUnknown_03004140.unk_04 = 0;
|
||||
gUnknown_03004140.unk_06 = -1;
|
||||
gUnknown_03004140.unk_07 = 0;
|
||||
gUnknown_03004140.unk_10 = 0;
|
||||
gUnknown_03004140.unk_0c = 0;
|
||||
gUnknown_03004140.unk_24 = 0;
|
||||
gUnknown_03004140.unk_30 = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
gUnknown_03004140.unk_28[i] = 0;
|
||||
gUnknown_03004140.unk_34[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_800C048(void)
|
||||
{
|
||||
gUnknown_03004140.unk_04 = 0x15;
|
||||
}
|
||||
|
||||
u8 sub_800C054(u8 r5, u16 r7, u16 r8, u16 *r6)
|
||||
{
|
||||
u8 i;
|
||||
u16 *buffer;
|
||||
|
||||
if (gUnknown_03004140.unk_04 != 0 && (gUnknown_03004140.unk_04 != 0x08 || r5 != 1))
|
||||
{
|
||||
gUnknown_03004140.unk_14 = 1;
|
||||
sub_800D30C(0xf3, 0x01);
|
||||
return 1;
|
||||
}
|
||||
if (!rfu_getMasterSlave())
|
||||
{
|
||||
gUnknown_03004140.unk_14 = 2;
|
||||
sub_800D30C(0xf3, 0x01);
|
||||
return 2;
|
||||
}
|
||||
for (i = 0, buffer = r6; i < 16; i++)
|
||||
{
|
||||
if (*buffer++ == 0xFFFF)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == 16)
|
||||
{
|
||||
gUnknown_03004140.unk_14 = 4;
|
||||
sub_800D30C(0xf3, 0x01);
|
||||
return 4;
|
||||
}
|
||||
if (r5 > 1)
|
||||
{
|
||||
gUnknown_03004140.unk_07 = 1;
|
||||
r5 = 1;
|
||||
r7 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_03004140.unk_07 = 0;
|
||||
}
|
||||
if (r5 != 0)
|
||||
{
|
||||
gUnknown_03004140.unk_04 = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_03004140.unk_04 = 9;
|
||||
if (gUnknown_03004140.unk_0b)
|
||||
{
|
||||
gUnknown_03004140.unk_0b = 2;
|
||||
}
|
||||
}
|
||||
gUnknown_03004140.unk_06 = r5;
|
||||
gUnknown_03004140.unk_1a = r7;
|
||||
gUnknown_03004140.unk_26 = r8;
|
||||
gUnknown_03004140.unk_20 = r6;
|
||||
return 0;
|
||||
}
|
||||
|
171
src/link_rfu.c
171
src/link_rfu.c
@ -2,6 +2,7 @@
|
||||
// Includes
|
||||
#include "global.h"
|
||||
#include "link.h"
|
||||
#include "librfu.h"
|
||||
#include "link_rfu.h"
|
||||
|
||||
// Static type declarations
|
||||
@ -9,12 +10,180 @@
|
||||
struct UnkRfuStruct_1 gUnknown_03004140;
|
||||
|
||||
// Static RAM declarations
|
||||
IWRAM_DATA u8 gUnknown_03000D78[8];
|
||||
IWRAM_DATA u8 gUnknown_03000D74;
|
||||
ALIGNED(4) IWRAM_DATA u8 gUnknown_03000D78[8];
|
||||
IWRAM_DATA u8 gUnknown_03000D80[16];
|
||||
IWRAM_DATA u16 gUnknown_03000D90[8];
|
||||
|
||||
// Static ROM declarations
|
||||
|
||||
void sub_800C000(void);
|
||||
void sub_800CEB0(u16 unk0);
|
||||
void sub_800C7B4(u16 unk0, u16 unk1);
|
||||
void sub_800D30C(u8 a0, u8 a1);
|
||||
void sub_800D610(void);
|
||||
|
||||
// .rodata
|
||||
|
||||
// .text
|
||||
|
||||
u32 sub_800BEC0(void)
|
||||
{
|
||||
u32 r4;
|
||||
|
||||
r4 = rfu_REQBN_softReset_and_checkID();
|
||||
if (r4 == 0x8001)
|
||||
{
|
||||
gUnknown_03004140.unk_08 = 1;
|
||||
}
|
||||
if (gUnknown_03004140.unk_04 != 0x17 && gUnknown_03004140.unk_04 != 0x01)
|
||||
{
|
||||
gUnknown_03004140.unk_05 = 0;
|
||||
gUnknown_03004140.unk_04 = 0;
|
||||
}
|
||||
gUnknown_03004140.unk_07 = 0;
|
||||
gUnknown_03004140.unk_0d = 0;
|
||||
gUnknown_03004140.unk_01 = 0;
|
||||
gUnknown_03004140.unk_00 = 0;
|
||||
gUnknown_03004140.unk_06 = -1;
|
||||
sub_800D610();
|
||||
return r4;
|
||||
}
|
||||
|
||||
void rfu_REQ_sendData_wrapper(u8 r2)
|
||||
{
|
||||
u8 val;
|
||||
if (!gUnknown_03007890->unk_00)
|
||||
{
|
||||
val = gUnknown_03004140.unk_02;
|
||||
r2 = 0;
|
||||
if (val == 1)
|
||||
{
|
||||
r2 = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_03004140.unk_03 = 0;
|
||||
}
|
||||
rfu_REQ_sendData(r2);
|
||||
}
|
||||
|
||||
int sub_800BF4C(void (*func1)(u8), void (*func2)(void))
|
||||
{
|
||||
if (func1 == NULL)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
CpuFill16(0, &gUnknown_03004140, sizeof(gUnknown_03004140));
|
||||
gUnknown_03004140.unk_06 = -1;
|
||||
gUnknown_03004140.unk_40 = func1;
|
||||
gUnknown_03004140.unk_44 = func2;
|
||||
rfu_setMSCCallback(sub_800CEB0);
|
||||
rfu_setREQCallback(sub_800C7B4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_800BFA0(void)
|
||||
{
|
||||
CpuFill16(0, &gUnknown_03004140, sizeof(gUnknown_03004140) - 2 * sizeof(void *));
|
||||
gUnknown_03004140.unk_06 = -1;
|
||||
}
|
||||
|
||||
void sub_800BFCC(struct UnkLinkRfuStruct_02022B2C *unk0)
|
||||
{
|
||||
sub_800C000();
|
||||
gUnknown_03004140.unk_04 = 1;
|
||||
gUnknown_03004140.unk_05 = 2;
|
||||
gUnknown_03004140.unk_3c = unk0;
|
||||
gUnknown_03004140.unk_09 = unk0->unk_11;
|
||||
gUnknown_03004140.unk_32 = unk0->unk_12;
|
||||
gUnknown_03004140.unk_18 = unk0->unk_14;
|
||||
if (unk0->unk_10)
|
||||
{
|
||||
gUnknown_03004140.unk_0b = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_800C000(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
gUnknown_03004140.unk_05 = 0;
|
||||
gUnknown_03004140.unk_04 = 0;
|
||||
gUnknown_03004140.unk_06 = -1;
|
||||
gUnknown_03004140.unk_07 = 0;
|
||||
gUnknown_03004140.unk_10 = 0;
|
||||
gUnknown_03004140.unk_0c = 0;
|
||||
gUnknown_03004140.unk_24 = 0;
|
||||
gUnknown_03004140.unk_30 = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
gUnknown_03004140.unk_28[i] = 0;
|
||||
gUnknown_03004140.unk_34[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_800C048(void)
|
||||
{
|
||||
gUnknown_03004140.unk_04 = 0x15;
|
||||
}
|
||||
|
||||
u8 sub_800C054(u8 r5, u16 r7, u16 r8, u16 *r6)
|
||||
{
|
||||
u8 i;
|
||||
u16 *buffer;
|
||||
|
||||
if (gUnknown_03004140.unk_04 != 0 && (gUnknown_03004140.unk_04 != 0x08 || r5 != 1))
|
||||
{
|
||||
gUnknown_03004140.unk_14 = 1;
|
||||
sub_800D30C(0xf3, 0x01);
|
||||
return 1;
|
||||
}
|
||||
if (!rfu_getMasterSlave())
|
||||
{
|
||||
gUnknown_03004140.unk_14 = 2;
|
||||
sub_800D30C(0xf3, 0x01);
|
||||
return 2;
|
||||
}
|
||||
for (i = 0, buffer = r6; i < 16; i++)
|
||||
{
|
||||
if (*buffer++ == 0xFFFF)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == 16)
|
||||
{
|
||||
gUnknown_03004140.unk_14 = 4;
|
||||
sub_800D30C(0xf3, 0x01);
|
||||
return 4;
|
||||
}
|
||||
if (r5 > 1)
|
||||
{
|
||||
gUnknown_03004140.unk_07 = 1;
|
||||
r5 = 1;
|
||||
r7 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_03004140.unk_07 = 0;
|
||||
}
|
||||
if (r5 != 0)
|
||||
{
|
||||
gUnknown_03004140.unk_04 = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_03004140.unk_04 = 9;
|
||||
if (gUnknown_03004140.unk_0b)
|
||||
{
|
||||
gUnknown_03004140.unk_0b = 2;
|
||||
}
|
||||
}
|
||||
gUnknown_03004140.unk_06 = r5;
|
||||
gUnknown_03004140.unk_1a = r7;
|
||||
gUnknown_03004140.unk_26 = r8;
|
||||
gUnknown_03004140.unk_20 = r6;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user