mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-25 23:29:55 -06:00
hook up pause and reset, w/ relevant hotkeys
This commit is contained in:
@ -50,6 +50,11 @@ void Init_ROM()
|
||||
memset(PrevSRAMPath[ROMSlot_GBA], 0, 1024);
|
||||
}
|
||||
|
||||
// TODO: currently, when failing to load a ROM for whatever reason, we attempt
|
||||
// to revert to the previous state and resume execution; this may not be a very
|
||||
// good thing, depending on what state the core was left in.
|
||||
// should we do a better state revert (via the savestate system)? completely stop?
|
||||
|
||||
void SetupSRAMPath(int slot)
|
||||
{
|
||||
strncpy(SRAMPath[slot], ROMPath[slot], 1023);
|
||||
@ -184,7 +189,7 @@ int LoadROM(const char* file, int slot)
|
||||
}
|
||||
else if (slot == ROMSlot_GBA && NDS::LoadGBAROM(ROMPath[slot], SRAMPath[slot]))
|
||||
{
|
||||
SavestateLoaded = false;
|
||||
SavestateLoaded = false; // checkme??
|
||||
|
||||
strncpy(PrevSRAMPath[slot], SRAMPath[slot], 1024); // safety
|
||||
return Load_OK;
|
||||
@ -197,6 +202,46 @@ int LoadROM(const char* file, int slot)
|
||||
}
|
||||
}
|
||||
|
||||
int Reset()
|
||||
{
|
||||
int res;
|
||||
bool directboot = Config::DirectBoot != 0;
|
||||
|
||||
res = VerifyDSBIOS();
|
||||
if (res != Load_OK) return res;
|
||||
|
||||
res = VerifyDSFirmware();
|
||||
if (res != Load_OK)
|
||||
{
|
||||
if (res == Load_FirmwareNotBootable)
|
||||
directboot = true;
|
||||
else
|
||||
return res;
|
||||
}
|
||||
|
||||
SavestateLoaded = false;
|
||||
|
||||
if (ROMPath[ROMSlot_NDS][0] == '\0')
|
||||
{
|
||||
NDS::LoadBIOS();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetupSRAMPath(0);
|
||||
if (!NDS::LoadROM(ROMPath[ROMSlot_NDS], SRAMPath[ROMSlot_NDS], directboot))
|
||||
return Load_ROMLoadError;
|
||||
}
|
||||
|
||||
if (ROMPath[ROMSlot_GBA][0] != '\0')
|
||||
{
|
||||
SetupSRAMPath(1);
|
||||
if (!NDS::LoadGBAROM(ROMPath[ROMSlot_GBA], SRAMPath[ROMSlot_GBA]))
|
||||
return Load_ROMLoadError;
|
||||
}
|
||||
|
||||
return Load_OK;
|
||||
}
|
||||
|
||||
|
||||
// SAVESTATE TODO
|
||||
// * configurable paths. not everyone wants their ROM directory to be polluted, I guess.
|
||||
|
Reference in New Issue
Block a user