From 640c1231f3b12c93a407dc84e07a100a201599e4 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 5 Jul 2014 17:09:03 -0700 Subject: [PATCH] Improve a crash in disassembly on game shutdown. --- Core/System.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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) {