diff --git a/Core/System.cpp b/Core/System.cpp index 437b1f6716..375068f532 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -315,9 +315,10 @@ void System_Wake() { static bool pspIsInited = false; static bool pspIsIniting = false; +static bool pspIsQuiting = false; bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string) { - if (pspIsIniting) { + if (pspIsIniting || pspIsQuiting) { return false; } @@ -394,12 +395,12 @@ bool PSP_IsIniting() { } bool PSP_IsInited() { - return pspIsInited; + return pspIsInited && !pspIsQuiting; } void PSP_Shutdown() { // Do nothing if we never inited. - if (!pspIsInited && !pspIsIniting) { + if (!pspIsInited && !pspIsIniting && !pspIsQuiting) { return; } @@ -409,6 +410,8 @@ void PSP_Shutdown() { } #endif + // Make sure things know right away that PSP memory, etc. is going away. + pspIsQuiting = true; if (coreState == CORE_RUNNING) Core_UpdateState(CORE_ERROR); Core_NotifyShutdown(); @@ -426,6 +429,7 @@ void PSP_Shutdown() { currentMIPS = 0; pspIsInited = false; pspIsIniting = false; + pspIsQuiting = false; } void PSP_RunLoopUntil(u64 globalticks) {