From a0675f17c6d4d82c7db82b2410947f4a79d288c2 Mon Sep 17 00:00:00 2001 From: cawtds <38510667+cawtds@users.noreply.github.com> Date: Mon, 24 Jun 2024 13:59:46 +0200 Subject: [PATCH] sMapTilesBackup as pointer to free up EWRAM --- include/config/debug.h | 4 ++-- src/help_system_util.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/config/debug.h b/include/config/debug.h index da4ddabca..2446b9360 100644 --- a/include/config/debug.h +++ b/include/config/debug.h @@ -8,10 +8,10 @@ #define DEBUG_OVERWORLD_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (above Pokédex). // Battle Debug Menu -#define DEBUG_BATTLE_MENU FALSE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button. +#define DEBUG_BATTLE_MENU TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button. #define DEBUG_AI_DELAY_TIMER FALSE // If set to TRUE, displays the number of frames it takes for the AI to choose a move. Replaces the "What will PKMN do" text. Useful for devs or anyone who modifies the AI code and wants to see if it doesn't take too long to run. // Pokémon Debug -#define DEBUG_POKEMON_SPRITE_VISUALIZER FALSE // Enables a debug menu for Pokémon sprites and icons, accessed by pressing Select in the summary screen. +#define DEBUG_POKEMON_SPRITE_VISUALIZER TRUE // Enables a debug menu for Pokémon sprites and icons, accessed by pressing Select in the summary screen. #endif // GUARD_CONFIG_DEBUG_H diff --git a/src/help_system_util.c b/src/help_system_util.c index 546fda934..f167a92a1 100644 --- a/src/help_system_util.c +++ b/src/help_system_util.c @@ -25,7 +25,7 @@ struct HelpSystemVideoState /*0x15*/ u8 state; }; -static EWRAM_DATA u8 sMapTilesBackup[BG_CHAR_SIZE] = {0}; +static EWRAM_DATA u8 (*sMapTilesBackup)[BG_CHAR_SIZE] = NULL; EWRAM_DATA u8 gDisableHelpSystemVolumeReduce = 0; EWRAM_DATA bool8 gHelpSystemToggleWithRButtonDisabled = FALSE; static EWRAM_DATA u8 sDelayTimer = 0; @@ -161,6 +161,7 @@ void SaveMapGPURegs(void) void SaveMapTiles(void) { + sMapTilesBackup = Alloc(BG_CHAR_SIZE); RequestDma3Copy((void *)BG_CHAR_ADDR(3), sMapTilesBackup, BG_CHAR_SIZE, DMA3_16BIT); } @@ -191,6 +192,7 @@ void RestoreGPURegs(void) void RestoreMapTiles(void) { RequestDma3Copy(sMapTilesBackup, (void *)BG_CHAR_ADDR(3), BG_CHAR_SIZE, DMA3_16BIT); + Free(sMapTilesBackup); } void RestoreMapTextColors(void)