sMapTilesBackup as pointer to free up EWRAM

This commit is contained in:
cawtds
2024-06-24 13:59:46 +02:00
parent dd64773263
commit a0675f17c6
2 changed files with 5 additions and 3 deletions

View File

@@ -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

View File

@@ -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)