From d5547a3744104140bc8a3e5390f13a9bc903d249 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 7 Nov 2017 23:53:30 -0500 Subject: main.c common syms --- src/main.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 665a4dd84..80993f0d0 100644 --- a/src/main.c +++ b/src/main.c @@ -38,7 +38,6 @@ extern u8 gHeap[]; extern struct SaveBlock2 gSaveblock2; extern struct PokemonStorage gPokemonStorage; extern u32 gBattleTypeFlags; -extern u8 gUnknown_03002748; extern u32 *gUnknown_0203CF5C; void Timer3Intr(void); @@ -79,19 +78,19 @@ const IntrFunc gIntrTableTemplate[] = static u16 gUnknown_03000000; -extern u16 gKeyRepeatStartDelay; -extern u8 gUnknown_030022B4; -extern struct Main gMain; -extern u16 gKeyRepeatContinueDelay; -extern u8 gSoftResetDisabled; -extern IntrFunc gIntrTable[INTR_COUNT]; -extern bool8 gLinkVSyncDisabled; -extern u32 IntrMain_Buffer[0x200]; -extern u8 gPcmDmaCounter; +u16 gKeyRepeatStartDelay; +u8 gUnknown_030022B4; +struct Main gMain; +u16 gKeyRepeatContinueDelay; +bool8 gSoftResetDisabled; +IntrFunc gIntrTable[INTR_COUNT]; +u8 gUnknown_03002748; +u32 IntrMain_Buffer[0x200]; +u8 gPcmDmaCounter; -extern u16 gTrainerId; +static EWRAM_DATA u16 gTrainerId = 0; -EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL; +//EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL; static void UpdateLinkAndCallCallbacks(void); static void InitMainCallbacks(void); -- cgit v1.2.3 From e68dbd62765b2784af8ec0f788d049ca5bafad25 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 8 Nov 2017 19:29:37 -0500 Subject: through sub_8009818 --- src/main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 80993f0d0..b7758f1f9 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,6 @@ #include "global.h" #include "main.h" +#include "link.h" #include "m4a.h" #include "rtc.h" #include "rng.h" -- cgit v1.2.3 From 1523d5c01e1745ad2f7c627c5701ab65de375f12 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 9 Nov 2017 21:48:27 -0500 Subject: sub_8009D90 --- src/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index b7758f1f9..b90dc3837 100644 --- a/src/main.c +++ b/src/main.c @@ -80,7 +80,7 @@ const IntrFunc gIntrTableTemplate[] = static u16 gUnknown_03000000; u16 gKeyRepeatStartDelay; -u8 gUnknown_030022B4; +bool8 gUnknown_030022B4; struct Main gMain; u16 gKeyRepeatContinueDelay; bool8 gSoftResetDisabled; @@ -129,7 +129,7 @@ void AgbMain() if (gFlashMemoryPresent != TRUE) SetMainCallback2(NULL); - gUnknown_030022B4 = 0; + gUnknown_030022B4 = FALSE; gUnknown_03000000 = 0xFC0; for (;;) @@ -147,22 +147,22 @@ void AgbMain() if (sub_8087634() == 1) { - gUnknown_030022B4 = 1; + gUnknown_030022B4 = TRUE; UpdateLinkAndCallCallbacks(); - gUnknown_030022B4 = 0; + gUnknown_030022B4 = FALSE; } else { - gUnknown_030022B4 = 0; + gUnknown_030022B4 = FALSE; UpdateLinkAndCallCallbacks(); if (sub_80875C8() == 1) { gMain.newKeys = 0; ClearSpriteCopyRequests(); - gUnknown_030022B4 = 1; + gUnknown_030022B4 = TRUE; UpdateLinkAndCallCallbacks(); - gUnknown_030022B4 = 0; + gUnknown_030022B4 = FALSE; } } -- cgit v1.2.3 From 27c0dc0fd59f4e71f09313613a1a03bd48e6209d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 22:08:17 -0500 Subject: through sub_800A588 --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index b90dc3837..61f6f60a4 100644 --- a/src/main.c +++ b/src/main.c @@ -336,7 +336,7 @@ extern void ProcessDma3Requests(void); static void VBlankIntr(void) { - if (gLinkVSyncDisabled != FALSE) + if (gSerialIsRFU != FALSE) LinkVSync(); else if (gUnknown_03002748 == FALSE) sub_800B9B8(); -- cgit v1.2.3 From e874cbd9d952f9cb893885c04c61908910cc7791 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 11 Nov 2017 00:05:44 -0500 Subject: Rename functions in link.c --- src/main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 61f6f60a4..a67bed035 100644 --- a/src/main.c +++ b/src/main.c @@ -80,12 +80,12 @@ const IntrFunc gIntrTableTemplate[] = static u16 gUnknown_03000000; u16 gKeyRepeatStartDelay; -bool8 gUnknown_030022B4; +bool8 gLinkTransferringData; struct Main gMain; u16 gKeyRepeatContinueDelay; bool8 gSoftResetDisabled; IntrFunc gIntrTable[INTR_COUNT]; -u8 gUnknown_03002748; +u8 gLinkVSyncDisabled; u32 IntrMain_Buffer[0x200]; u8 gPcmDmaCounter; @@ -129,7 +129,7 @@ void AgbMain() if (gFlashMemoryPresent != TRUE) SetMainCallback2(NULL); - gUnknown_030022B4 = FALSE; + gLinkTransferringData = FALSE; gUnknown_03000000 = 0xFC0; for (;;) @@ -147,22 +147,22 @@ void AgbMain() if (sub_8087634() == 1) { - gUnknown_030022B4 = TRUE; + gLinkTransferringData = TRUE; UpdateLinkAndCallCallbacks(); - gUnknown_030022B4 = FALSE; + gLinkTransferringData = FALSE; } else { - gUnknown_030022B4 = FALSE; + gLinkTransferringData = FALSE; UpdateLinkAndCallCallbacks(); if (sub_80875C8() == 1) { gMain.newKeys = 0; ClearSpriteCopyRequests(); - gUnknown_030022B4 = TRUE; + gLinkTransferringData = TRUE; UpdateLinkAndCallCallbacks(); - gUnknown_030022B4 = FALSE; + gLinkTransferringData = FALSE; } } @@ -338,7 +338,7 @@ static void VBlankIntr(void) { if (gSerialIsRFU != FALSE) LinkVSync(); - else if (gUnknown_03002748 == FALSE) + else if (gLinkVSyncDisabled == FALSE) sub_800B9B8(); gMain.vblankCounter1++; -- cgit v1.2.3 From f21c5ebea50685982daf1f81cda4c535615a6ef8 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 12 Nov 2017 23:58:05 -0500 Subject: through sub_800B1A0 --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index a67bed035..c2baa23af 100644 --- a/src/main.c +++ b/src/main.c @@ -336,7 +336,7 @@ extern void ProcessDma3Requests(void); static void VBlankIntr(void) { - if (gSerialIsRFU != FALSE) + if (gWirelessCommType != FALSE) LinkVSync(); else if (gLinkVSyncDisabled == FALSE) sub_800B9B8(); -- cgit v1.2.3 From 7e4cb5f332de1d72fc57be82f4eca0ecd5db5f8d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 13 Nov 2017 01:01:27 -0500 Subject: HandleLinkConnection --- src/main.c | 52 ++++++++++++++++------------------------------------ 1 file changed, 16 insertions(+), 36 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index c2baa23af..00dd99dc3 100644 --- a/src/main.c +++ b/src/main.c @@ -1,50 +1,30 @@ #include "global.h" -#include "main.h" +#include "crt0.h" +#include "malloc.h" #include "link.h" +#include "link_rfu.h" +#include "librfu.h" #include "m4a.h" +#include "bg.h" #include "rtc.h" +#include "unknown_task.h" #include "rng.h" +#include "overworld.h" +#include "play_time.h" #include "dma3.h" #include "gba/flash_internal.h" +#include "load_save.h" +#include "gpu_regs.h" +#include "agb_flash.h" +#include "sound.h" #include "battle.h" +#include "battle_controllers.h" +#include "text.h" +#include "intro.h" +#include "main.h" -extern u16 GetGpuReg(u8); -extern void SetGpuReg(u8, u16); -extern void LinkVSync(void); -extern void sub_800E174(void); -extern void sub_800B9B8(void); -extern void InitGpuRegManager(void); -extern void sub_800E6D0(void); -extern void CheckForFlashMemory(void); -extern void InitMapMusic(void); -extern void ResetBgs(void); -extern void SetDefaultFontsPointer(void); -extern void InitHeap(void *heapStart, u32 heapSize); // malloc.h -extern void rfu_REQ_stopMode(void); -extern void rfu_waitREQComplete(void); -extern bool32 sub_8087634(void); -extern bool32 sub_80875C8(void); -extern void ClearSpriteCopyRequests(void); -extern void PlayTimeCounter_Update(void); -extern void MapMusicMain(void); -extern void EnableInterrupts(u16); -extern void sub_8033648(void); -extern u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(void)); -extern void remove_some_task(void); - -extern struct SoundInfo gSoundInfo; -extern u32 gFlashMemoryPresent; -extern u32 IntrMain[]; -extern u8 gHeap[]; -extern struct SaveBlock2 gSaveblock2; -extern struct PokemonStorage gPokemonStorage; -extern u32 gBattleTypeFlags; extern u32 *gUnknown_0203CF5C; -void Timer3Intr(void); -bool8 HandleLinkConnection(void); -void c2_copyright_1(void); - static void VBlankIntr(void); static void HBlankIntr(void); static void VCountIntr(void); -- cgit v1.2.3 From 3bb450645b65fee8a901521d148ab87f81f8f20b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 14 Nov 2017 08:44:32 -0500 Subject: LinkVSync --- src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 00dd99dc3..09ab3f5e4 100644 --- a/src/main.c +++ b/src/main.c @@ -316,10 +316,10 @@ extern void ProcessDma3Requests(void); static void VBlankIntr(void) { - if (gWirelessCommType != FALSE) - LinkVSync(); + if (gWirelessCommType != 0) + RfuVSync(); else if (gLinkVSyncDisabled == FALSE) - sub_800B9B8(); + LinkVSync(); gMain.vblankCounter1++; -- cgit v1.2.3