pokefirered/src/reload_save.c
2024-11-19 19:27:35 +01:00

33 lines
857 B
C

#include "global.h"
#include "gpu_regs.h"
#include "malloc.h"
#include "crt0.h"
#include "load_save.h"
#include "m4a.h"
#include "main.h"
#include "new_game.h"
#include "overworld.h"
#include "save.h"
void ReloadSave(void)
{
u16 imeBackup = REG_IME;
REG_IME = 0;
RegisterRamReset(RESET_EWRAM);
ReInitializeEWRAM();
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_FORCED_BLANK);
REG_IME = imeBackup;
gMain.inBattle = FALSE;
SetSaveBlocksPointers(GetSaveBlocksPointersBaseOffset());
ResetMenuAndMonGlobals();
Save_ResetSaveCounters();
LoadGameSave(SAVE_NORMAL);
if (gSaveFileStatus == SAVE_STATUS_EMPTY || gSaveFileStatus == SAVE_STATUS_INVALID)
Sav2_ClearSetDefault();
SetPokemonCryStereo(gSaveBlock2Ptr->optionsSound);
InitHeap(gHeap, HEAP_SIZE);
SetMainCallback2(CB2_ContinueSavedGame);
}