mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #4161 from unknownbrackets/savestates
Fix savestates, one more shutdown glitch
This commit is contained in:
commit
78b48f75f7
5 changed files with 22 additions and 9 deletions
|
@ -515,14 +515,22 @@ void MetaFileSystem::DoState(PointerWrap &p)
|
|||
|
||||
u32 n = (u32) fileSystems.size();
|
||||
p.Do(n);
|
||||
bool skipPfat0 = false;
|
||||
if (n != (u32) fileSystems.size())
|
||||
{
|
||||
p.SetError(p.ERROR_FAILURE);
|
||||
ERROR_LOG(FILESYS, "Savestate failure: number of filesystems doesn't match.");
|
||||
return;
|
||||
if (n == (u32) fileSystems.size() - 1) {
|
||||
skipPfat0 = true;
|
||||
} else {
|
||||
p.SetError(p.ERROR_FAILURE);
|
||||
ERROR_LOG(FILESYS, "Savestate failure: number of filesystems doesn't match.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < n; ++i)
|
||||
fileSystems[i].system->DoState(p);
|
||||
for (u32 i = 0; i < n; ++i) {
|
||||
if (!skipPfat0 || fileSystems[i].prefix != "pfat0:") {
|
||||
fileSystems[i].system->DoState(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -257,6 +257,10 @@ void CPU_RunLoop() {
|
|||
coreState = CORE_POWERDOWN;
|
||||
}
|
||||
|
||||
// Let's make sure the gpu has already cleaned up before we start freeing memory.
|
||||
gpu->FinishEventLoop();
|
||||
gpu->SyncThread(true);
|
||||
|
||||
CPU_Shutdown();
|
||||
CPU_SetState(CPU_THREAD_NOT_RUNNING);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,8 @@ struct ThreadEventQueue : public B {
|
|||
} while (CoreTiming::GetTicks() < globalticks);
|
||||
}
|
||||
|
||||
void SyncThread() {
|
||||
// Force ignores coreState.
|
||||
void SyncThread(bool force = false) {
|
||||
if (!threadEnabled_) {
|
||||
return;
|
||||
}
|
||||
|
@ -98,7 +99,7 @@ struct ThreadEventQueue : public B {
|
|||
// While processing the last event, HasEvents() will be false even while not done.
|
||||
// So we schedule a nothing event and wait for that to finish.
|
||||
ScheduleEvent(EVENT_SYNC);
|
||||
while (HasEvents() && coreState == CORE_RUNNING) {
|
||||
while (HasEvents() && (force || coreState == CORE_RUNNING)) {
|
||||
eventsDrain_.wait_for(eventsLock_, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ void FramebufferManager::CompileDraw2DProgram() {
|
|||
// user shader experiments.
|
||||
ERROR_LOG(G3D, "Failed to build post-processing program from %s and %s!\n%s", shaderInfo->vertexShaderFile.c_str(), shaderInfo->fragmentShaderFile.c_str(), errorString.c_str());
|
||||
// let's show the first line of the error string as an OSM.
|
||||
for (int i = 0; i < errorString.size(); i++) {
|
||||
for (size_t i = 0; i < errorString.size(); i++) {
|
||||
if (errorString[i] == '\n') {
|
||||
errorString = errorString.substr(0, i);
|
||||
break;
|
||||
|
|
|
@ -231,7 +231,7 @@ public:
|
|||
|
||||
virtual void DeviceLost() = 0;
|
||||
virtual void ReapplyGfxState() = 0;
|
||||
virtual void SyncThread() = 0;
|
||||
virtual void SyncThread(bool force = false) = 0;
|
||||
virtual u64 GetTickEstimate() = 0;
|
||||
virtual void DoState(PointerWrap &p) = 0;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue