From 3321548956e2c7311bedb5bdfc4693c2010467f2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 11 Nov 2017 00:25:05 -0500 Subject: [PATCH] Link common syms --- asm/link.s | 10 ----- common_syms/link.txt | 36 ++++++++++++++++++ include/link.h | 24 ++++++++---- src/link.c | 30 +++++++++++---- sym_common.txt | 91 +------------------------------------------- 5 files changed, 75 insertions(+), 116 deletions(-) diff --git a/asm/link.s b/asm/link.s index b3b2d77c2..9f9a04d49 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,16 +5,6 @@ .text - thumb_func_start SetLinkDebugValues -SetLinkDebugValues: @ 800A994 - ldr r2, =gUnknown_0300302C - str r0, [r2] - ldr r0, =gUnknown_03003070 - str r1, [r0] - bx lr - .pool - thumb_func_end SetLinkDebugValues - thumb_func_start sub_800A9A8 sub_800A9A8: @ 800A9A8 push {r4,lr} diff --git a/common_syms/link.txt b/common_syms/link.txt index 69a66331a..150e93e88 100644 --- a/common_syms/link.txt +++ b/common_syms/link.txt @@ -1 +1,37 @@ +gUnknown_03003020 +gLinkDebugSeed +gLocalLinkPlayerBlock +gLinkErrorOccurred +gLinkDebugFlags +gUnknown_03003074 +gUnknown_03003078 +gUnknown_0300307C +gFiller_03003080 +gLinkHeldKeys +gRecvCmds +gLinkStatus +gUnknown_030030E4 +gUnknown_030030E8 +gUnknown_030030EC +gUnknown_030030F0 +gUnknown_030030F4 +gSuppressLinkErrorMessage +gSerialIsRFU +gUnknown_03003100 +gSendCmd +gUnknown_03003120 +gReceivedRemoteLinkPlayers gLinkTestBGInfo +gLinkCallback +gShouldAdvanceLinkState +gLinkTestBlockChecksums +gBlockRequestType +gFiller_03003154 +gFiller_03003158 +gFiller_0300315c +gUnknown_03003160 +gLink +gUnknown_03004130 +gUnknown_03004134 +gFiller_03004138 +gFiller_0300413C diff --git a/include/link.h b/include/link.h index 917331c34..283e13aa1 100644 --- a/include/link.h +++ b/include/link.h @@ -149,7 +149,7 @@ struct BlockRequest extern const struct BlockRequest sBlockRequestLookupTable[5]; extern struct Link gLink; -extern u16 gRecvCmds[MAX_LINK_PLAYERS][CMD_LENGTH]; +extern u16 gRecvCmds[MAX_RFU_PLAYERS][CMD_LENGTH]; extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE]; // gBlockSendBuffer extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE]; extern u16 gLinkType; @@ -218,18 +218,18 @@ u8 sub_800B320(void); u8 sub_800B33C(void); extern u16 gUnknown_03003020[6]; -extern u32 gUnknown_0300302C; +extern u32 gLinkDebugSeed; extern struct LinkPlayerBlock gLocalLinkPlayerBlock; extern bool8 gLinkErrorOccurred; -extern u32 gUnknown_03003070; -extern bool8 gUnknown_03003078[4]; -extern u8 gUnknown_0300307C[4]; +extern u32 gLinkDebugFlags; +extern bool8 gUnknown_03003078[MAX_LINK_PLAYERS]; +extern u8 gUnknown_0300307C[MAX_LINK_PLAYERS]; extern u16 gLinkHeldKeys; extern u32 gLinkStatus; extern u8 gUnknown_030030E4; extern u8 gUnknown_030030E8; -extern u8 gUnknown_030030EC[4]; -extern u8 gUnknown_030030F0[4]; +extern u8 gUnknown_030030EC[MAX_LINK_PLAYERS]; +extern u8 gUnknown_030030F0[MAX_LINK_PLAYERS]; extern u16 gUnknown_030030F4; extern u8 gSuppressLinkErrorMessage; extern bool8 gSerialIsRFU; @@ -238,9 +238,17 @@ extern u8 gUnknown_03003120; extern struct LinkTestBGInfo gLinkTestBGInfo; extern void (*gLinkCallback)(void); extern bool8 gShouldAdvanceLinkState; -extern u16 gLinkTestBlockChecksums[4]; +extern u16 gLinkTestBlockChecksums[MAX_LINK_PLAYERS]; extern u8 gBlockRequestType; extern u8 gUnknown_03003160; extern u8 gUnknown_03004130; +extern u16 gUnknown_03004134; +extern u32 gUnknown_03003074; +extern u32 gFiller_03003154; +extern u32 gFiller_03003158; +extern u32 gFiller_0300315c; +extern u32 gFiller_03004138; +extern u32 gFiller_0300413C; +extern u32 gFiller_03003080; #endif // GUARD_LINK_H diff --git a/src/link.c b/src/link.c index 07598bc1f..d5fc890ca 100644 --- a/src/link.c +++ b/src/link.c @@ -67,14 +67,16 @@ IWRAM_DATA void *gUnknown_03000DAC; IWRAM_DATA bool32 gUnknown_03000DB0; u16 gUnknown_03003020[6]; -u32 gUnknown_0300302C; +u32 gLinkDebugSeed; struct LinkPlayerBlock gLocalLinkPlayerBlock; bool8 gLinkErrorOccurred; -u32 gUnknown_03003070; +u32 gLinkDebugFlags; +u32 gUnknown_03003074; bool8 gUnknown_03003078[MAX_LINK_PLAYERS]; u8 gUnknown_0300307C[MAX_LINK_PLAYERS]; +u32 gFiller_03003080; u16 gLinkHeldKeys; -u16 gRecvCmds[MAX_LINK_PLAYERS][8]; +u16 gRecvCmds[MAX_RFU_PLAYERS][8]; u32 gLinkStatus; u8 gUnknown_030030E4; bool8 gUnknown_030030E8; @@ -92,9 +94,15 @@ void (*gLinkCallback)(void); bool8 gShouldAdvanceLinkState; u16 gLinkTestBlockChecksums[MAX_LINK_PLAYERS]; u8 gBlockRequestType; +u32 gFiller_03003154; +u32 gFiller_03003158; +u32 gFiller_0300315c; u8 gUnknown_03003160; struct Link gLink; u8 gUnknown_03004130; +u16 gUnknown_03004134; +u32 gFiller_03004138; +u32 gFiller_0300413C; EWRAM_DATA u8 gLinkTestDebugValuesEnabled = 0; EWRAM_DATA u8 gUnknown_020223BD = 0; @@ -124,7 +132,7 @@ static void SetBlockReceivedFlag(u8 who); 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 task00_link_test(u8 taskId); +static void Task_PrintTestData(u8 taskId); void sub_800AEB4(void); u8 sub_800B2F8(void); void sub_800B4A4(void); @@ -260,7 +268,7 @@ void LinkTestScreen(void) UpdatePaletteFade(); gUnknown_03000D60 = 0; InitLocalLinkPlayer(); - CreateTask(task00_link_test, 0); + CreateTask(Task_PrintTestData, 0); SetMainCallback2(CB2_LinkTest); } @@ -1218,7 +1226,7 @@ static void LinkCB_RequestPlayerDataExchange(void) gLinkCallback = NULL; } -static void task00_link_test(u8 taskId) +static void Task_PrintTestData(u8 taskId) { char sp[32]; int i; @@ -1233,8 +1241,8 @@ static void task00_link_test(u8 taskId) LinkTest_prnthex(gUnknown_03003160, 25, 1, 2); LinkTest_prnthex(gUnknown_03004130, 25, 2, 2); LinkTest_prnthex(GetBlockReceivedStatus(), 15, 5, 2); - LinkTest_prnthex(gUnknown_0300302C, 2, 12, 8); - LinkTest_prnthex(gUnknown_03003070, 2, 13, 8); + LinkTest_prnthex(gLinkDebugSeed, 2, 12, 8); + LinkTest_prnthex(gLinkDebugFlags, 2, 13, 8); LinkTest_prnthex(sub_800B2E8(), 25, 5, 1); LinkTest_prnthex(sub_800B2F8(), 25, 6, 1); LinkTest_prnthex(sub_800B320(), 25, 7, 1); @@ -1244,3 +1252,9 @@ static void task00_link_test(u8 taskId) LinkTest_prnthex(gLinkTestBlockChecksums[i], 10, 4 + i, 4); } } + +void SetLinkDebugValues(u32 seed, u32 flags) +{ + gLinkDebugSeed = seed; + gLinkDebugFlags = flags; +} diff --git a/sym_common.txt b/sym_common.txt index 13eb9e604..298c4470e 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -11,96 +11,7 @@ gUnknown_03002F70: @ 3002F70 .include "text.o" .include "sprite.o" - -gUnknown_03003020: @ 3003020 - .space 0xC - -gUnknown_0300302C: @ 300302C - .space 0x4 - -gLocalLinkPlayerBlock: @ 3003030 - .space 0x3C - -gLinkErrorOccurred: @ 300306C - .space 0x4 - -gUnknown_03003070: @ 3003070 - .space 0x8 - -gUnknown_03003078: @ 3003078 - .space 0x4 - -gUnknown_0300307C: @ 300307C - .space 0x8 - -gLinkHeldKeys: @ 3003084 - .space 0xC - -gRecvCmds: @ 3003090 - .space 0x50 - -gLinkStatus: @ 30030E0 - .space 0x4 - -gUnknown_030030E4: @ 30030E4 - .space 0x4 - -gUnknown_030030E8: @ 30030E8 - .space 0x4 - -gUnknown_030030EC: @ 30030EC - .space 0x4 - -gUnknown_030030F0: @ 30030F0 - .space 0x4 - -gUnknown_030030F4: @ 30030F4 - .space 0x4 - -gSuppressLinkErrorMessage: @ 30030F8 - .space 0x4 - -gSerialIsRFU: @ 30030FC - .space 0x4 - -gUnknown_03003100: @ 3003100 - .space 0x10 - -gSendCmd: @ 3003110 - .space 0x10 - -gUnknown_03003120: @ 3003120 - .space 0x4 - -gReceivedRemoteLinkPlayers: @ 3003124 - .space 0xC - -gLinkTestBGInfo: @ 3003130 - .space 0x10 - -gLinkCallback: @ 3003140 - .space 0x4 - -gShouldAdvanceLinkState: @ 3003144 - .space 0x4 - -gLinkTestBlockChecksums: @ 3003148 - .space 0x8 - -gBlockRequestType: @ 3003150 - .space 0x10 - -gUnknown_03003160: @ 3003160 - .space 0x10 - -gLink: @ 3003170 - .space 0xFC0 - -gUnknown_03004130: @ 3004130 - .space 0x4 - -gUnknown_03004134: @ 3004134 - .space 0xC + .include "link.o" gUnknown_03004140: @ 3004140 .space 0x10