diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c index 9fd1d0a35..3125716e2 100644 --- a/src/main.c +++ b/src/main.c @@ -23,6 +23,7 @@ #include "intro.h" #include "main.h" #include "trainer_hill.h" +#include "constants/rgb.h" static void VBlankIntr(void); static void HBlankIntr(void); @@ -75,7 +76,7 @@ static EWRAM_DATA u16 gTrainerId = 0; static void UpdateLinkAndCallCallbacks(void); static void InitMainCallbacks(void); static void CallCallbacks(void); -//static void SeedRngWithRtc(void); +static void SeedRngWithRtc(void); static void ReadKeys(void); void InitIntrHandlers(void); static void WaitForVBlank(void); @@ -90,7 +91,7 @@ void AgbMain() #if !MODERN RegisterRamReset(RESET_ALL); #endif //MODERN - *(vu16 *)BG_PLTT = 0x7FFF; + *(vu16 *)BG_PLTT = RGB_WHITE; // Set the backdrop to white on startup InitGpuRegManager(); REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | WAITCNT_WS0_S_1 | WAITCNT_WS0_N_3; InitKeys(); @@ -102,7 +103,9 @@ void AgbMain() CheckForFlashMemory(); InitMainCallbacks(); InitMapMusic(); - //SeedRngWithRtc(); see comment at SeedRngWithRtc declaration below +#ifdef BUGFIX + SeedRngWithRtc(); // see comment at SeedRngWithRtc definition below +#endif ClearDma3Requests(); ResetBgs(); SetDefaultFontsPointer(); @@ -129,7 +132,7 @@ void AgbMain() DoSoftReset(); } - if (sub_8087634() == 1) + if (Overworld_SendKeysToLinkIsRunning() == TRUE) { gLinkTransferringData = TRUE; UpdateLinkAndCallCallbacks(); @@ -140,7 +143,7 @@ void AgbMain() gLinkTransferringData = FALSE; UpdateLinkAndCallCallbacks(); - if (sub_80875C8() == 1) + if (Overworld_RecvKeysFromLinkIsRunning() == TRUE) { gMain.newKeys = 0; ClearSpriteCopyRequests(); @@ -213,13 +216,15 @@ void EnableVCountIntrAtLine150(void) EnableInterrupts(INTR_FLAG_VCOUNT); } -// oops! FRLG commented this out to remove RTC, however Emerald didnt undo this! -//static void SeedRngWithRtc(void) -//{ -// u32 seed = RtcGetMinuteCount(); -// seed = (seed >> 16) ^ (seed & 0xFFFF); -// SeedRng(seed); -//} +// FRLG commented this out to remove RTC, however Emerald didn't undo this! +#ifdef BUGFIX +static void SeedRngWithRtc(void) +{ + u32 seed = RtcGetMinuteCount(); + seed = (seed >> 16) ^ (seed & 0xFFFF); + SeedRng(seed); +} +#endif void InitKeys(void) { @@ -294,7 +299,7 @@ void InitIntrHandlers(void) REG_IME = 1; - EnableInterrupts(0x1); + EnableInterrupts(INTR_FLAG_VBLANK); } void SetVBlankCallback(IntrCallback callback) @@ -346,7 +351,7 @@ static void VBlankIntr(void) gPcmDmaCounter = gSoundInfo.pcmDmaCounter; m4aSoundMain(); - sub_8033648(); + TryReceiveLinkBattleData(); if (!gMain.inBattle || !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_RECORDED))) Random(); |