2017-09-16 03:12:45 +01:00
|
|
|
#include "global.h"
|
|
|
|
#include "main.h"
|
2024-01-02 14:24:52 +00:00
|
|
|
#include "crt0.h"
|
2017-09-16 03:12:45 +01:00
|
|
|
#include "gpu_regs.h"
|
|
|
|
#include "m4a.h"
|
|
|
|
#include "load_save.h"
|
|
|
|
#include "save.h"
|
|
|
|
#include "new_game.h"
|
2017-10-12 08:06:19 +01:00
|
|
|
#include "overworld.h"
|
2019-09-09 02:07:54 +01:00
|
|
|
#include "malloc.h"
|
2017-09-16 03:12:45 +01:00
|
|
|
|
2021-08-15 23:26:09 +01:00
|
|
|
// Reloads the game, continuing from the point of the last save
|
|
|
|
// Used to gracefully exit after a link connection error
|
|
|
|
void ReloadSave(void)
|
2017-09-16 03:12:45 +01:00
|
|
|
{
|
2021-08-15 23:26:09 +01:00
|
|
|
u16 imeBackup = REG_IME;
|
2017-09-16 03:12:45 +01:00
|
|
|
REG_IME = 0;
|
2019-06-26 21:23:00 +01:00
|
|
|
RegisterRamReset(RESET_EWRAM);
|
2024-01-02 14:24:52 +00:00
|
|
|
ReInitializeEWRAM();
|
2018-02-07 23:00:25 +00:00
|
|
|
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_FORCED_BLANK);
|
2017-09-16 03:12:45 +01:00
|
|
|
REG_IME = imeBackup;
|
|
|
|
gMain.inBattle = FALSE;
|
2021-08-15 23:26:09 +01:00
|
|
|
SetSaveBlocksPointers(GetSaveBlocksPointersBaseOffset());
|
2019-02-10 02:07:07 +00:00
|
|
|
ResetMenuAndMonGlobals();
|
2018-02-15 22:54:34 +00:00
|
|
|
Save_ResetSaveCounters();
|
2021-10-29 03:54:41 +01:00
|
|
|
LoadGameSave(SAVE_NORMAL);
|
2020-01-12 20:27:37 +00:00
|
|
|
if (gSaveFileStatus == SAVE_STATUS_EMPTY || gSaveFileStatus == SAVE_STATUS_CORRUPT)
|
2017-09-16 03:12:45 +01:00
|
|
|
Sav2_ClearSetDefault();
|
|
|
|
SetPokemonCryStereo(gSaveBlock2Ptr->optionsSound);
|
2018-01-06 06:35:48 +00:00
|
|
|
InitHeap(gHeap, HEAP_SIZE);
|
2018-02-13 23:58:22 +00:00
|
|
|
SetMainCallback2(CB2_ContinueSavedGame);
|
2017-09-16 03:12:45 +01:00
|
|
|
}
|