Keep game running after CPU crash (when Dev Mode is enabled)
This commit is contained in:
parent
134a2a07e5
commit
757054798b
5 changed files with 17 additions and 1 deletions
|
@ -83,6 +83,7 @@ void CPU::Reset(bool softReset, NesModel model)
|
|||
|
||||
_dmcCounter = -1;
|
||||
_dmcDmaRunning = false;
|
||||
_warnOnCrash = true;
|
||||
|
||||
//Used by NSF code to disable Frame Counter & DMC interrupts
|
||||
_irqMask = 0xFF;
|
||||
|
@ -232,13 +233,18 @@ uint16_t CPU::FetchOperand()
|
|||
}
|
||||
|
||||
#ifndef LIBRETRO
|
||||
if(_warnOnCrash && _console->GetSettings()->CheckFlag(EmulationFlags::DeveloperMode)) {
|
||||
MessageManager::DisplayMessage("Error", "GameCrash", "Invalid OP code - CPU crashed.");
|
||||
_warnOnCrash = false;
|
||||
}
|
||||
|
||||
_console->BreakIfDebugging();
|
||||
|
||||
if(NsfMapper::GetInstance()) {
|
||||
//Don't stop emulation on CPU crash when playing NSFs, reset cpu instead
|
||||
_console->Reset(true);
|
||||
return 0;
|
||||
} else if(!_console->GetDebugger(false)) {
|
||||
} else if(!_console->GetDebugger(false) && !_console->GetSettings()->CheckFlag(EmulationFlags::DeveloperMode)) {
|
||||
//Throw an error and stop emulation core (if debugger is not enabled)
|
||||
throw std::runtime_error("Invalid OP code - CPU crashed");
|
||||
} else {
|
||||
|
|
|
@ -60,6 +60,8 @@ private:
|
|||
bool _prevRunIrq = false;
|
||||
bool _runIrq = false;
|
||||
|
||||
bool _warnOnCrash = true;
|
||||
|
||||
void IncCycleCount();
|
||||
uint16_t FetchOperand();
|
||||
void IRQ();
|
||||
|
|
|
@ -22,6 +22,9 @@ enum EmulationFlags : uint64_t
|
|||
DisableDynamicSampleRate = 0x80,
|
||||
|
||||
PauseOnMovieEnd = 0x0100,
|
||||
|
||||
DeveloperMode = 0x0200,
|
||||
|
||||
AllowBackgroundInput = 0x0400,
|
||||
ReduceSoundInBackground = 0x0800,
|
||||
MuteSoundInBackground = 0x1000,
|
||||
|
|
|
@ -180,6 +180,8 @@ namespace Mesen.GUI.Config
|
|||
InteropEmu.SetOsdState(!preferenceInfo.DisableOsd);
|
||||
InteropEmu.SetGameDatabaseState(!preferenceInfo.DisableGameDatabase);
|
||||
|
||||
InteropEmu.SetFlag(EmulationFlags.DeveloperMode, preferenceInfo.DeveloperMode);
|
||||
|
||||
InteropEmu.SetFlag(EmulationFlags.AllowInvalidInput, preferenceInfo.AllowInvalidInput);
|
||||
InteropEmu.SetFlag(EmulationFlags.RemoveSpriteLimit, preferenceInfo.RemoveSpriteLimit);
|
||||
InteropEmu.SetFlag(EmulationFlags.FdsAutoLoadDisk, preferenceInfo.FdsAutoLoadDisk);
|
||||
|
|
|
@ -1559,6 +1559,9 @@ namespace Mesen.GUI
|
|||
DisableDynamicSampleRate = 0x80,
|
||||
|
||||
PauseOnMovieEnd = 0x0100,
|
||||
|
||||
DeveloperMode = 0x0200,
|
||||
|
||||
AllowBackgroundInput = 0x0400,
|
||||
ReduceSoundInBackground = 0x0800,
|
||||
MuteSoundInBackground = 0x1000,
|
||||
|
|
Loading…
Add table
Reference in a new issue