Debugger: Fix game.reset by adding a reboot status.

We don't want EmuScreen to auto-exit, and we don't want to double-lock the
debugger lifecycle lock.  Let's just handle reboot specifically.
This commit is contained in:
Unknown W. Brackets committed 2022-10-01 18:13:22 -07:00
1 parent f12a5101e6
commit 753ac95307
6 files changed
+31 -6

No files matched your search

+22 -2
View File
@@ -114,6 +114,7 @@ static std::string gpuBackendDevice;
static volatile bool pspIsInited = false;
static volatile bool pspIsIniting = false;
static volatile bool pspIsQuitting = false;
static volatile bool pspIsRebooting = false;
void ResetUIState() {
globalUIState = UISTATE_MENU;
@@ -448,6 +449,7 @@ bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string) {
bool success = !g_CoreParameter.fileToStart.empty();
if (!success) {
Core_NotifyLifecycle(CoreLifecycle::START_COMPLETE);
pspIsRebooting = false;
// In this case, we must call shutdown since the caller won't know to.
// It must've partially started since CPU_Init returned true.
PSP_Shutdown();
@@ -475,6 +477,7 @@ bool PSP_InitUpdate(std::string *error_string) {
}
}
if (!success) {
pspIsRebooting = false;
PSP_Shutdown();
return true;
}
@@ -483,6 +486,7 @@ bool PSP_InitUpdate(std::string *error_string) {
pspIsIniting = !pspIsInited;
if (pspIsInited) {
Core_NotifyLifecycle(CoreLifecycle::START_COMPLETE);
pspIsRebooting = false;
}
return pspIsInited;
}
@@ -501,7 +505,11 @@ bool PSP_IsIniting() {
}
bool PSP_IsInited() {
return pspIsInited && !pspIsQuitting;
return pspIsInited && !pspIsQuitting && !pspIsRebooting;
}
bool PSP_IsRebooting() {
return pspIsRebooting;
}
bool PSP_IsQuitting() {
@@ -515,7 +523,7 @@ void PSP_Shutdown() {
}
// Make sure things know right away that PSP memory, etc. is going away.
pspIsQuitting = true;
pspIsQuitting = !pspIsRebooting;
if (coreState == CORE_RUNNING)
Core_Stop();
@@ -540,6 +548,18 @@ void PSP_Shutdown() {
Core_NotifyLifecycle(CoreLifecycle::STOPPED);
}
bool PSP_Reboot(std::string *error_string) {
if (!pspIsInited || pspIsQuitting)
return false;
pspIsRebooting = true;
Core_Stop();
Core_WaitInactive();
PSP_Shutdown();
std::string resetError;
return PSP_Init(PSP_CoreParameter(), error_string);
}
void PSP_BeginHostFrame() {
// Reapply the graphics state of the PSP
if (gpu) {