SaveState: Allow loading save state in exception.

And allow saving as well, since we can maybe resume.
This commit is contained in:
Unknown W. Brackets 2021-08-08 23:15:27 -07:00
parent eb8a239616
commit 32c7ff8436
3 changed files with 19 additions and 4 deletions

View file

@ -86,7 +86,7 @@ void Core_ListenLifecycle(CoreLifecycleFunc func) {
void Core_NotifyLifecycle(CoreLifecycle stage) {
if (stage == CoreLifecycle::STARTING) {
g_exceptionInfo.type = ExceptionType::NONE;
Core_ResetException();
}
for (auto func : lifecycleFuncs) {
@ -99,7 +99,7 @@ void Core_ListenStopRequest(CoreStopRequestFunc func) {
}
void Core_Stop() {
g_exceptionInfo.type = ExceptionType::NONE;
Core_ResetException();
Core_UpdateState(CORE_POWERDOWN);
for (auto func : stopFuncs) {
func();
@ -267,7 +267,7 @@ void Core_UpdateSingleStep() {
}
void Core_SingleStep() {
g_exceptionInfo.type = ExceptionType::NONE;
Core_ResetException();
currentMIPS->SingleStep();
if (coreState == CORE_STEPPING)
steppingCounter++;
@ -366,7 +366,7 @@ void Core_EnableStepping(bool step) {
} else {
host->SetDebugMode(false);
// Clear the exception if we resume.
g_exceptionInfo.type = ExceptionType::NONE;
Core_ResetException();
coreState = CORE_RUNNING;
coreStatePending = false;
m_StepCond.notify_all();
@ -489,6 +489,10 @@ void Core_Break() {
}
}
void Core_ResetException() {
g_exceptionInfo.type = ExceptionType::NONE;
}
const ExceptionInfo &Core_GetExceptionInfo() {
return g_exceptionInfo;
}