mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
SaveState: Delay restart handling until end frame.
Otherwise, we end up having unmatched pushbuffer map/unmap.
This commit is contained in:
parent
e326971a96
commit
8c655750fe
@ -248,6 +248,7 @@ namespace SaveState
|
||||
};
|
||||
|
||||
static bool needsProcess = false;
|
||||
static bool needsRestart = false;
|
||||
static std::vector<Operation> pending;
|
||||
static std::mutex mutex;
|
||||
static int screenshotFailures = 0;
|
||||
@ -662,17 +663,9 @@ namespace SaveState
|
||||
}
|
||||
|
||||
// We tried, our only remaining option is to reset the game.
|
||||
PSP_Shutdown();
|
||||
std::string resetError;
|
||||
if (!PSP_Init(PSP_CoreParameter(), &resetError))
|
||||
{
|
||||
ERROR_LOG(BOOT, "Error resetting: %s", resetError.c_str());
|
||||
// TODO: This probably doesn't clean up well enough.
|
||||
Core_Stop();
|
||||
return false;
|
||||
}
|
||||
host->BootDone();
|
||||
host->UpdateDisassembly();
|
||||
needsRestart = true;
|
||||
// Make sure we don't proceed to run anything yet.
|
||||
coreState = CORE_NEXTFRAME;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -899,6 +892,22 @@ namespace SaveState
|
||||
}
|
||||
}
|
||||
|
||||
void Cleanup() {
|
||||
if (needsRestart) {
|
||||
PSP_Shutdown();
|
||||
std::string resetError;
|
||||
if (!PSP_Init(PSP_CoreParameter(), &resetError)) {
|
||||
ERROR_LOG(BOOT, "Error resetting: %s", resetError.c_str());
|
||||
// TODO: This probably doesn't clean up well enough.
|
||||
Core_Stop();
|
||||
return;
|
||||
}
|
||||
host->BootDone();
|
||||
host->UpdateDisassembly();
|
||||
needsRestart = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
// Make sure there's a directory for save slots
|
||||
|
@ -93,4 +93,7 @@ namespace SaveState
|
||||
|
||||
// Check if there's any save stating needing to be done. Normally called once per frame.
|
||||
void Process();
|
||||
|
||||
// Cleanup by triggering a restart if needed.
|
||||
void Cleanup();
|
||||
};
|
||||
|
@ -525,6 +525,7 @@ void PSP_EndHostFrame() {
|
||||
if (gpu) {
|
||||
gpu->EndHostFrame();
|
||||
}
|
||||
SaveState::Cleanup();
|
||||
}
|
||||
|
||||
void PSP_RunLoopWhileState() {
|
||||
|
Loading…
Reference in New Issue
Block a user