void MetaFileSystem::DoState(PointerWrap &p) { lock_guard guard(lock); auto s = p.Section("MetaFileSystem", 1); if (!s) return; p.Do(current); // Save/load per-thread current directory map p.Do(currentDir); u32 n = (u32) fileSystems.size(); p.Do(n); bool skipPfat0 = false; if (n != (u32) fileSystems.size()) { 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) { if (!skipPfat0 || fileSystems[i].prefix != "pfat0:") { fileSystems[i].system->DoState(p); } } }
void __KernelDoState(PointerWrap &p) { std::string git_version = PPSSPP_GIT_VERSION; p.Do(git_version); if (git_version != PPSSPP_GIT_VERSION) { p.SetError(p.ERROR_WARNING); WARN_LOG(HLE, "Warning: this savestate was generated by a different version of PPSSPP. It may not load properly."); } p.Do(kernelRunning); kernelObjects.DoState(p); p.DoMarker("KernelObjects"); __InterruptsDoState(p); // Memory needs to be after kernel objects, which may free kernel memory. __KernelMemoryDoState(p); __KernelThreadingDoState(p); __KernelAlarmDoState(p); __KernelVTimerDoState(p); __KernelEventFlagDoState(p); __KernelMbxDoState(p); __KernelModuleDoState(p); __KernelMutexDoState(p); __KernelSemaDoState(p); __KernelTimeDoState(p); __AtracDoState(p); __AudioDoState(p); __CtrlDoState(p); __DisplayDoState(p); __FontDoState(p); __GeDoState(p); __ImposeDoState(p); __IoDoState(p); __MpegDoState(p); __NetDoState(p); __PowerDoState(p); __PsmfDoState(p); __PsmfPlayerDoState(p); __RtcDoState(p); __SasDoState(p); __SslDoState(p); __UmdDoState(p); __UtilityDoState(p); __UsbDoState(p); __VaudioDoState(p); __PPGeDoState(p); __InterruptsDoStateLate(p); __KernelThreadingDoStateLate(p); }
void KernelObjectPool::DoState(PointerWrap &p) { auto s = p.Section("KernelObjectPool", 1); if (!s) return; int _maxCount = maxCount; p.Do(_maxCount); if (_maxCount != maxCount) { p.SetError(p.ERROR_FAILURE); ERROR_LOG(SCEKERNEL, "Unable to load state: different kernel object storage."); return; } if (p.mode == p.MODE_READ) { hleCurrentThreadName = NULL; kernelObjects.Clear(); } p.Do(nextID); p.DoArray(occupied, maxCount); for (int i = 0; i < maxCount; ++i) { if (!occupied[i]) continue; int type; if (p.mode == p.MODE_READ) { p.Do(type); pool[i] = CreateByIDType(type); // Already logged an error. if (pool[i] == NULL) return; pool[i]->uid = i + handleOffset; } else { type = pool[i]->GetIDType(); p.Do(type); } pool[i]->DoState(p); if (p.error >= p.ERROR_FAILURE) break; } }
void VFSFileSystem::DoState(PointerWrap &p) { // Note: used interchangeably with DirectoryFileSystem for flash0:, so we use the same name. auto s = p.Section("DirectoryFileSystem", 0, 2); if (!s) return; u32 num = (u32) entries.size(); p.Do(num); if (num != 0) { p.SetError(p.ERROR_WARNING); ERROR_LOG(FILESYS, "FIXME: Open files during savestate, could go badly."); } }
void __InterruptsDoState(PointerWrap &p) { int numInterrupts = PSP_NUMBER_INTERRUPTS; p.Do(numInterrupts); if (numInterrupts != PSP_NUMBER_INTERRUPTS) { p.SetError(p.ERROR_FAILURE); ERROR_LOG(HLE, "Savestate failure: wrong number of interrupts, can't load."); return; } intState.DoState(p); PendingInterrupt pi(0, 0); p.Do(pendingInterrupts, pi); p.Do(interruptsEnabled); p.Do(inInterrupt); p.Do(threadBeforeInterrupt); p.DoMarker("sceKernelInterrupt"); }
void MetaFileSystem::DoState(PointerWrap &p) { p.Do(current); // Save/load per-thread current directory map p.Do(currentDir); u32 n = (u32) fileSystems.size(); p.Do(n); if (n != (u32) fileSystems.size()) { 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); p.DoMarker("MetaFileSystem"); }
void VFSFileSystem::DoState(PointerWrap &p) { if (!entries.empty()) { p.SetError(p.ERROR_WARNING); ERROR_LOG(FILESYS, "FIXME: Open files during savestate, could go badly."); } }