diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index b67922fbb5..08a72e6145 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -613,6 +613,10 @@ void DoState(PointerWrap &p) { std::lock_guard lk(externalEventSection); + auto s = p.Section("CoreTiming", 1); + if (!s) + return; + int n = (int) event_types.size(); p.Do(n); // These (should) be filled in later by the modules. @@ -625,7 +629,6 @@ void DoState(PointerWrap &p) p.Do(slicelength); p.Do(globalTimer); p.Do(idledCycles); - p.DoMarker("CoreTiming"); } } // namespace diff --git a/Core/Dialog/PSPDialog.cpp b/Core/Dialog/PSPDialog.cpp index db2d8b2032..9277153e84 100644 --- a/Core/Dialog/PSPDialog.cpp +++ b/Core/Dialog/PSPDialog.cpp @@ -105,6 +105,10 @@ int PSPDialog::Update() void PSPDialog::DoState(PointerWrap &p) { + auto s = p.Section("PSPDialog", 1); + if (!s) + return; + p.Do(status); p.Do(lastButtons); p.Do(buttons); @@ -116,7 +120,6 @@ void PSPDialog::DoState(PointerWrap &p) p.Do(cancelButtonImg); p.Do(okButtonFlag); p.Do(cancelButtonFlag); - p.DoMarker("PSPDialog"); } pspUtilityDialogCommon *PSPDialog::GetCommonParam() diff --git a/Core/Dialog/PSPMsgDialog.cpp b/Core/Dialog/PSPMsgDialog.cpp index 8704203f88..0ee03b45e8 100755 --- a/Core/Dialog/PSPMsgDialog.cpp +++ b/Core/Dialog/PSPMsgDialog.cpp @@ -296,12 +296,16 @@ int PSPMsgDialog::Shutdown(bool force) void PSPMsgDialog::DoState(PointerWrap &p) { PSPDialog::DoState(p); + + auto s = p.Section("PSPMsgDialog", 1); + if (!s) + return; + p.Do(flag); p.Do(messageDialog); p.Do(messageDialogAddr); p.DoArray(msgText, sizeof(msgText)); p.Do(yesnoChoice); - p.DoMarker("PSPMsgDialog"); } pspUtilityDialogCommon *PSPMsgDialog::GetCommonParam() diff --git a/Core/Dialog/PSPOskDialog.cpp b/Core/Dialog/PSPOskDialog.cpp index 00b573f4dc..6651e37318 100755 --- a/Core/Dialog/PSPOskDialog.cpp +++ b/Core/Dialog/PSPOskDialog.cpp @@ -971,13 +971,17 @@ int PSPOskDialog::Shutdown(bool force) void PSPOskDialog::DoState(PointerWrap &p) { PSPDialog::DoState(p); + + auto s = p.Section("PSPOskDialog", 1); + if (!s) + return; + p.Do(oskParams); p.Do(oskDesc); p.Do(oskIntext); p.Do(oskOuttext); p.Do(selectedChar); p.Do(inputChars); - p.DoMarker("PSPOskDialog"); } pspUtilityDialogCommon *PSPOskDialog::GetCommonParam() diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index a370f69c2d..4e2db2b45d 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -996,6 +996,11 @@ int PSPSaveDialog::Shutdown(bool force) void PSPSaveDialog::DoState(PointerWrap &p) { PSPDialog::DoState(p); + + auto s = p.Section("PSPSaveDialog", 1); + if (!s) + return; + p.Do(display); param.DoState(p); p.Do(request); @@ -1007,7 +1012,6 @@ void PSPSaveDialog::DoState(PointerWrap &p) p.Do(requestAddr); p.Do(currentSelectedSave); p.Do(yesnoChoice); - p.DoMarker("PSPSaveDialog"); } pspUtilityDialogCommon *PSPSaveDialog::GetCommonParam() diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index e3e7459be2..c535b19e09 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -1372,6 +1372,10 @@ int SavedataParam::GetLastEmptySave() void SavedataParam::DoState(PointerWrap &p) { + auto s = p.Section("SavedataParam", 1); + if (!s) + return; + // pspParam is handled in PSPSaveDialog. p.Do(selectedSave); p.Do(saveDataListCount); @@ -1390,7 +1394,6 @@ void SavedataParam::DoState(PointerWrap &p) } else p.DoArray(saveDataList, saveDataListCount); - p.DoMarker("SavedataParam"); } bool SavedataParam::IsSaveEncrypted(SceUtilitySavedataParam* param, const std::string &saveDirName) diff --git a/Core/Dialog/SavedataParam.h b/Core/Dialog/SavedataParam.h index 07c5798314..1b52cae668 100644 --- a/Core/Dialog/SavedataParam.h +++ b/Core/Dialog/SavedataParam.h @@ -256,6 +256,10 @@ struct SaveFileInfo void DoState(PointerWrap &p) { + auto s = p.Section("SaveFileInfo", 1); + if (!s) + return; + p.Do(size); p.Do(saveName); p.Do(idx); diff --git a/Core/FileSystems/FileSystem.h b/Core/FileSystems/FileSystem.h index b5b578bf93..a36f05fa52 100644 --- a/Core/FileSystems/FileSystem.h +++ b/Core/FileSystems/FileSystem.h @@ -66,6 +66,10 @@ struct PSPFileInfo void DoState(PointerWrap &p) { + auto s = p.Section("PSPFileInfo", 1); + if (!s) + return; + p.Do(name); p.Do(size); p.Do(access); @@ -78,7 +82,6 @@ struct PSPFileInfo p.Do(startSector); p.Do(numSectors); p.Do(sectorSize); - p.DoMarker("PSPFileInfo"); } std::string name; diff --git a/Core/FileSystems/ISOFileSystem.cpp b/Core/FileSystems/ISOFileSystem.cpp index 312ab36a77..c3a2a7af3f 100644 --- a/Core/FileSystems/ISOFileSystem.cpp +++ b/Core/FileSystems/ISOFileSystem.cpp @@ -654,6 +654,10 @@ std::string ISOFileSystem::EntryFullPath(TreeEntry *e) void ISOFileSystem::DoState(PointerWrap &p) { + auto s = p.Section("ISOFileSystem", 1); + if (!s) + return; + int n = (int) entries.size(); p.Do(n); @@ -706,5 +710,4 @@ void ISOFileSystem::DoState(PointerWrap &p) } } } - p.DoMarker("ISOFileSystem"); } diff --git a/Core/FileSystems/MetaFileSystem.cpp b/Core/FileSystems/MetaFileSystem.cpp index 20e0ac0853..d8d6513fbb 100644 --- a/Core/FileSystems/MetaFileSystem.cpp +++ b/Core/FileSystems/MetaFileSystem.cpp @@ -491,6 +491,11 @@ size_t MetaFileSystem::SeekFile(u32 handle, s32 position, FileMove type) 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 @@ -507,7 +512,5 @@ void MetaFileSystem::DoState(PointerWrap &p) for (u32 i = 0; i < n; ++i) fileSystems[i].system->DoState(p); - - p.DoMarker("MetaFileSystem"); } diff --git a/Core/FileSystems/VirtualDiscFileSystem.cpp b/Core/FileSystems/VirtualDiscFileSystem.cpp index ce4e42befe..d30cfcc1c4 100644 --- a/Core/FileSystems/VirtualDiscFileSystem.cpp +++ b/Core/FileSystems/VirtualDiscFileSystem.cpp @@ -146,6 +146,10 @@ void VirtualDiscFileSystem::LoadFileListIndex() { void VirtualDiscFileSystem::DoState(PointerWrap &p) { + auto s = p.Section("VirtualDiscFileSystem", 1); + if (!s) + return; + int fileListSize = (int)fileList.size(); int entryCount = (int)entries.size(); @@ -214,8 +218,6 @@ void VirtualDiscFileSystem::DoState(PointerWrap &p) } // We don't savestate handlers (loaded on fs load), but if they change, it may not load properly. - - p.DoMarker("VirtualDiscFileSystem"); } std::string VirtualDiscFileSystem::GetLocalPath(std::string localpath) { diff --git a/Core/Font/PGF.cpp b/Core/Font/PGF.cpp index 964c932ca1..d50fb59c10 100644 --- a/Core/Font/PGF.cpp +++ b/Core/Font/PGF.cpp @@ -66,6 +66,10 @@ PGF::~PGF() { } void PGF::DoState(PointerWrap &p) { + auto s = p.Section("PGF", 1); + if (!s) + return; + p.Do(header); p.Do(rev3extra); @@ -98,8 +102,6 @@ void PGF::DoState(PointerWrap &p) { p.Do(glyphs); p.Do(shadowGlyphs); p.Do(firstGlyph); - - p.DoMarker("PGF"); } void PGF::ReadPtr(const u8 *ptr, size_t dataSize) { diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index b50573cb05..9682f88095 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -85,9 +85,12 @@ void HLEInit() void HLEDoState(PointerWrap &p) { + auto s = p.Section("HLE", 1); + if (!s) + return; + p.Do(delayedResultEvent); CoreTiming::RestoreRegisterEvent(delayedResultEvent, "HLEDelayedResult", hleDelayResultFinish); - p.DoMarker("HLE"); } void HLEShutdown() diff --git a/Core/HLE/__sceAudio.cpp b/Core/HLE/__sceAudio.cpp index 421fc09237..10f05c7519 100644 --- a/Core/HLE/__sceAudio.cpp +++ b/Core/HLE/__sceAudio.cpp @@ -111,6 +111,10 @@ void __AudioInit() { } void __AudioDoState(PointerWrap &p) { + auto s = p.Section("sceAudio", 1); + if (!s) + return; + p.Do(eventAudioUpdate); CoreTiming::RestoreRegisterEvent(eventAudioUpdate, "AudioUpdate", &hleAudioUpdate); p.Do(eventHostAudioUpdate); @@ -132,8 +136,6 @@ void __AudioDoState(PointerWrap &p) { } for (int i = 0; i < chanCount; ++i) chans[i].DoState(p); - - p.DoMarker("sceAudio"); } void __AudioShutdown() { diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index 8732a10467..7b6859ffd6 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -150,6 +150,10 @@ struct Atrac { } void DoState(PointerWrap &p) { + auto s = p.Section("Atrac", 1); + if (!s) + return; + p.Do(atracChannels); p.Do(atracOutputChannels); @@ -189,8 +193,6 @@ struct Atrac { p.Do(loopNum); p.Do(atracContext); - - p.DoMarker("Atrac"); } int Analyze(); @@ -311,6 +313,10 @@ void __AtracInit() { } void __AtracDoState(PointerWrap &p) { + auto s = p.Section("sceAtrac", 1); + if (!s) + return; + p.Do(atracInited); for (int i = 0; i < PSP_NUM_ATRAC_IDS; ++i) { bool valid = atracIDs[i] != NULL; @@ -323,8 +329,6 @@ void __AtracDoState(PointerWrap &p) { } } p.DoArray(atracIDTypes, PSP_NUM_ATRAC_IDS); - - p.DoMarker("sceAtrac"); } void __AtracShutdown() { diff --git a/Core/HLE/sceAudio.cpp b/Core/HLE/sceAudio.cpp index 04ec6a1cc4..965cd75532 100644 --- a/Core/HLE/sceAudio.cpp +++ b/Core/HLE/sceAudio.cpp @@ -29,6 +29,10 @@ const int PSP_AUDIO_ERROR_SRC_FORMAT_4 = 0x80000003; void AudioChannel::DoState(PointerWrap &p) { + auto s = p.Section("AudioChannel", 1); + if (!s) + return; + p.Do(reserved); p.Do(sampleAddress); p.Do(sampleCount); @@ -37,7 +41,6 @@ void AudioChannel::DoState(PointerWrap &p) p.Do(format); p.Do(waitingThreads); sampleQueue.DoState(p); - p.DoMarker("AudioChannel"); } void AudioChannel::reset() diff --git a/Core/HLE/sceCcc.cpp b/Core/HLE/sceCcc.cpp index ebd41a6b61..a73690d7b0 100644 --- a/Core/HLE/sceCcc.cpp +++ b/Core/HLE/sceCcc.cpp @@ -44,12 +44,15 @@ void __CccInit() void __CccDoState(PointerWrap &p) { + auto s = p.Section("sceCcc", 1); + if (!s) + return; + p.Do(errorUTF8); p.Do(errorUTF16); p.Do(errorSJIS); p.Do(ucs2jisTable); p.Do(jis2ucsTable); - p.DoMarker("sceCcc"); } u32 __CccUCStoJIS(u32 c, u32 alt) diff --git a/Core/HLE/sceCtrl.cpp b/Core/HLE/sceCtrl.cpp index c77f63b100..eeb95f19f2 100644 --- a/Core/HLE/sceCtrl.cpp +++ b/Core/HLE/sceCtrl.cpp @@ -320,6 +320,10 @@ void __CtrlInit() void __CtrlDoState(PointerWrap &p) { std::lock_guard guard(ctrlMutex); + + auto s = p.Section("sceCtrl", 1); + if (!s) + return; p.Do(analogEnabled); p.Do(ctrlLatchBufs); @@ -341,7 +345,6 @@ void __CtrlDoState(PointerWrap &p) p.Do(ctrlTimer); CoreTiming::RestoreRegisterEvent(ctrlTimer, "CtrlSampleTimer", __CtrlTimerUpdate); - p.DoMarker("sceCtrl"); } void __CtrlShutdown() diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index f66ca0b251..b1980bff82 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -56,6 +56,10 @@ struct WaitVBlankInfo void DoState(PointerWrap &p) { + auto s = p.Section("WaitVBlankInfo", 1); + if (!s) + return; + p.Do(threadID); p.Do(vcountUnblock); } @@ -175,6 +179,10 @@ void __DisplayInit() { } void __DisplayDoState(PointerWrap &p) { + auto s = p.Section("sceDisplay", 1); + if (!s) + return; + p.Do(framebuf); p.Do(latchedFramebuf); p.Do(framebufIsLatched); @@ -212,8 +220,6 @@ void __DisplayDoState(PointerWrap &p) { } gpu->SetDisplayFramebuffer(framebuf.topaddr, framebuf.pspFramebufLinesize, framebuf.pspFramebufFormat); } - - p.DoMarker("sceDisplay"); } void __DisplayShutdown() { diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index 8d415f3c53..cd1816af71 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -200,9 +200,12 @@ public: PGF *GetPGF() { return &pgf_; } void DoState(PointerWrap &p) { + auto s = p.Section("Font", 1); + if (!s) + return; + p.Do(pgf_); p.Do(style_); - p.DoMarker("Font"); } private: @@ -233,6 +236,10 @@ public: } void DoState(PointerWrap &p) { + auto s = p.Section("LoadedFont", 1); + if (!s) + return; + int numInternalFonts = (int)internalFonts.size(); p.Do(numInternalFonts); if (numInternalFonts != (int)internalFonts.size()) { @@ -249,7 +256,6 @@ public: font_ = internalFonts[internalFont]; } p.Do(handle_); - p.DoMarker("LoadedFont"); } private: @@ -263,7 +269,13 @@ class PostAllocCallback : public Action { public: PostAllocCallback() {} static Action *Create() { return new PostAllocCallback(); } - void DoState(PointerWrap &p) { p.Do(fontLibID_); p.DoMarker("PostAllocCallback"); } + void DoState(PointerWrap &p) { + auto s = p.Section("PostAllocCallback", 1); + if (!s) + return; + + p.Do(fontLibID_); + } void run(MipsCall &call); void SetFontLib(u32 fontLibID) { fontLibID_ = fontLibID; } @@ -275,7 +287,13 @@ class PostOpenCallback : public Action { public: PostOpenCallback() {} static Action *Create() { return new PostOpenCallback(); } - void DoState(PointerWrap &p) { p.Do(fontLibID_); p.DoMarker("PostOpenCallback"); } + void DoState(PointerWrap &p) { + auto s = p.Section("PostOpenCallback", 1); + if (!s) + return; + + p.Do(fontLibID_); + } void run(MipsCall &call); void SetFontLib(u32 fontLibID) { fontLibID_ = fontLibID; } @@ -381,6 +399,10 @@ public: } void DoState(PointerWrap &p) { + auto s = p.Section("FontLib", 1); + if (!s) + return; + p.Do(fonts_); p.Do(isfontopen_); p.Do(params_); @@ -389,7 +411,6 @@ public: p.Do(fileFontHandle_); p.Do(handle_); p.Do(altCharCode_); - p.DoMarker("FontLib"); } void SetFileFontHandle(u32 handle) { @@ -552,6 +573,10 @@ void __FontShutdown() { } void __FontDoState(PointerWrap &p) { + auto s = p.Section("sceFont", 1); + if (!s) + return; + __LoadInternalFonts(); p.Do(fontLibList); @@ -562,7 +587,6 @@ void __FontDoState(PointerWrap &p) { __KernelRestoreActionType(actionPostAllocCallback, PostAllocCallback::Create); p.Do(actionPostOpenCallback); __KernelRestoreActionType(actionPostOpenCallback, PostOpenCallback::Create); - p.DoMarker("sceFont"); } u32 sceFontNewLib(u32 paramPtr, u32 errorCodePtr) { diff --git a/Core/HLE/sceGe.cpp b/Core/HLE/sceGe.cpp index 9487701471..27c33d0846 100644 --- a/Core/HLE/sceGe.cpp +++ b/Core/HLE/sceGe.cpp @@ -221,6 +221,10 @@ void __GeInit() void __GeDoState(PointerWrap &p) { + auto s = p.Section("sceGe", 1); + if (!s) + return; + p.DoArray(ge_callback_data, ARRAY_SIZE(ge_callback_data)); p.DoArray(ge_used_callbacks, ARRAY_SIZE(ge_used_callbacks)); p.Do(ge_pending_cb); @@ -236,7 +240,6 @@ void __GeDoState(PointerWrap &p) p.Do(drawWaitingThreads); // Everything else is done in sceDisplay. - p.DoMarker("sceGe"); } void __GeShutdown() diff --git a/Core/HLE/sceHeap.cpp b/Core/HLE/sceHeap.cpp index 17632c1419..984dafae46 100644 --- a/Core/HLE/sceHeap.cpp +++ b/Core/HLE/sceHeap.cpp @@ -20,7 +20,9 @@ #include "Core/HLE/sceHeap.h" void __HeapDoState(PointerWrap &p) { - p.DoMarker("sceHeap"); + auto s = p.Section("sceHeap", 1); + if (!s) + return; } int sceHeapReallocHeapMemory(u32 heapPtr, u32 memPtr, int memSize) { diff --git a/Core/HLE/sceImpose.cpp b/Core/HLE/sceImpose.cpp index 8f8f8fc628..75f39ee000 100644 --- a/Core/HLE/sceImpose.cpp +++ b/Core/HLE/sceImpose.cpp @@ -44,11 +44,14 @@ void __ImposeInit() void __ImposeDoState(PointerWrap &p) { + auto s = p.Section("sceImpose", 1); + if (!s) + return; + p.Do(language); p.Do(buttonValue); p.Do(umdPopup); p.Do(backlightOffTime); - p.DoMarker("sceImpose"); } u32 sceImposeGetBatteryIconStatus(u32 chargingPtr, u32 iconStatusPtr) diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index e253a2e924..e54c648941 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -176,6 +176,10 @@ public: int GetIDType() const { return PPSSPP_KERNEL_TMID_File; } virtual void DoState(PointerWrap &p) { + auto s = p.Section("FileNode", 1); + if (!s) + return; + p.Do(fullpath); p.Do(handle); p.Do(callbackID); @@ -204,8 +208,6 @@ public: p.Do(waitingThreads); p.Do(pausedWaits); - - p.DoMarker("File"); } std::string fullpath; @@ -463,6 +465,10 @@ void __IoInit() { } void __IoDoState(PointerWrap &p) { + auto s = p.Section("sceIo", 1); + if (!s) + return; + ioManager.DoState(p); p.DoArray(fds, ARRAY_SIZE(fds)); p.Do(asyncNotifyEvent); @@ -471,7 +477,6 @@ void __IoDoState(PointerWrap &p) { CoreTiming::RestoreRegisterEvent(syncNotifyEvent, "IoSyncNotify", __IoSyncNotify); p.Do(memStickCallbacks); p.Do(memStickFatCallbacks); - p.DoMarker("sceIo"); } void __IoShutdown() { @@ -1753,6 +1758,10 @@ public: int GetIDType() const { return PPSSPP_KERNEL_TMID_DirList; } virtual void DoState(PointerWrap &p) { + auto s = p.Section("DirListing", 1); + if (!s) + return; + p.Do(name); p.Do(index); @@ -1763,7 +1772,6 @@ public: for (int i = 0; i < count; ++i) { listing[i].DoState(p); } - p.DoMarker("DirListing"); } std::string name; diff --git a/Core/HLE/sceJpeg.cpp b/Core/HLE/sceJpeg.cpp index 038505ca18..f80d79e647 100644 --- a/Core/HLE/sceJpeg.cpp +++ b/Core/HLE/sceJpeg.cpp @@ -29,9 +29,12 @@ void __JpegInit() { } void __JpegDoState(PointerWrap &p) { + auto s = p.Section("sceJpeg", 1); + if (!s) + return; + p.Do(mjpegWidth); p.Do(mjpegHeight); - p.DoMarker("sceJpeg"); } //Uncomment if you want to dump JPEGs loaded through sceJpeg to a file diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 7167c9e401..e5e47814c5 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -184,53 +184,76 @@ void __KernelShutdown() void __KernelDoState(PointerWrap &p) { - p.Do(kernelRunning); - kernelObjects.DoState(p); - p.DoMarker("KernelObjects"); + { + auto s = p.Section("Kernel", 1); + if (!s) + return; - __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); - __KernelMsgPipeDoState(p); - __KernelMutexDoState(p); - __KernelSemaDoState(p); - __KernelTimeDoState(p); + p.Do(kernelRunning); + kernelObjects.DoState(p); + } - __AtracDoState(p); - __AudioDoState(p); - __CccDoState(p); - __CtrlDoState(p); - __DisplayDoState(p); - __FontDoState(p); - __GeDoState(p); - __ImposeDoState(p); - __IoDoState(p); - __JpegDoState(p); - __MpegDoState(p); - __NetDoState(p); - __NetAdhocDoState(p); - __PowerDoState(p); - __PsmfDoState(p); - __PsmfPlayerDoState(p); - __RtcDoState(p); - __SasDoState(p); - __SslDoState(p); - __UmdDoState(p); - __UtilityDoState(p); - __UsbDoState(p); - __VaudioDoState(p); - __HeapDoState(p); + { + auto s = p.Section("Kernel Modules", 1); + if (!s) + return; - __PPGeDoState(p); + __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); + __KernelMsgPipeDoState(p); + __KernelMutexDoState(p); + __KernelSemaDoState(p); + __KernelTimeDoState(p); + } - __InterruptsDoStateLate(p); - __KernelThreadingDoStateLate(p); + { + auto s = p.Section("HLE Modules", 1); + if (!s) + return; + + __AtracDoState(p); + __AudioDoState(p); + __CccDoState(p); + __CtrlDoState(p); + __DisplayDoState(p); + __FontDoState(p); + __GeDoState(p); + __ImposeDoState(p); + __IoDoState(p); + __JpegDoState(p); + __MpegDoState(p); + __NetDoState(p); + __NetAdhocDoState(p); + __PowerDoState(p); + __PsmfDoState(p); + __PsmfPlayerDoState(p); + __RtcDoState(p); + __SasDoState(p); + __SslDoState(p); + __UmdDoState(p); + __UtilityDoState(p); + __UsbDoState(p); + __VaudioDoState(p); + __HeapDoState(p); + + __PPGeDoState(p); + } + + { + auto s = p.Section("Kernel Cleanup", 1); + if (!s) + return; + + __InterruptsDoStateLate(p); + __KernelThreadingDoStateLate(p); + } } bool __KernelIsRunning() { @@ -488,6 +511,10 @@ int KernelObjectPool::GetCount() void KernelObjectPool::DoState(PointerWrap &p) { + auto s = p.Section("KernelObjectPool", 1); + if (!s) + return; + int _maxCount = maxCount; p.Do(_maxCount); @@ -530,7 +557,6 @@ void KernelObjectPool::DoState(PointerWrap &p) } pool[i]->DoState(p); } - p.DoMarker("KernelObjectPool"); } KernelObject *KernelObjectPool::CreateByIDType(int type) diff --git a/Core/HLE/sceKernelAlarm.cpp b/Core/HLE/sceKernelAlarm.cpp index cd33d61f51..7c0ede0280 100644 --- a/Core/HLE/sceKernelAlarm.cpp +++ b/Core/HLE/sceKernelAlarm.cpp @@ -45,8 +45,11 @@ struct Alarm : public KernelObject virtual void DoState(PointerWrap &p) { + auto s = p.Section("Alarm", 1); + if (!s) + return; + p.Do(alm); - p.DoMarker("Alarm"); } NativeAlarm alm; @@ -130,10 +133,13 @@ void __KernelAlarmInit() void __KernelAlarmDoState(PointerWrap &p) { + auto s = p.Section("sceKernelAlarm", 1); + if (!s) + return; + p.Do(alarmTimer); p.Do(triggeredAlarm); CoreTiming::RestoreRegisterEvent(alarmTimer, "Alarm", __KernelTriggerAlarm); - p.DoMarker("sceKernelAlarm"); } KernelObject *__KernelAlarmObject() diff --git a/Core/HLE/sceKernelEventFlag.cpp b/Core/HLE/sceKernelEventFlag.cpp index b48f7f2acb..59584b5fed 100644 --- a/Core/HLE/sceKernelEventFlag.cpp +++ b/Core/HLE/sceKernelEventFlag.cpp @@ -75,11 +75,14 @@ public: virtual void DoState(PointerWrap &p) { + auto s = p.Section("EventFlag", 1); + if (!s) + return; + p.Do(nef); EventFlagTh eft = {0}; p.Do(waitingThreads, eft); p.Do(pausedWaits); - p.DoMarker("EventFlag"); } NativeEventFlag nef; @@ -124,9 +127,12 @@ void __KernelEventFlagInit() void __KernelEventFlagDoState(PointerWrap &p) { + auto s = p.Section("sceKernelEventFlag", 1); + if (!s) + return; + p.Do(eventFlagWaitTimer); CoreTiming::RestoreRegisterEvent(eventFlagWaitTimer, "EventFlagTimeout", __KernelEventFlagTimeout); - p.DoMarker("sceKernelEventFlag"); } KernelObject *__KernelEventFlagObject() diff --git a/Core/HLE/sceKernelInterrupt.cpp b/Core/HLE/sceKernelInterrupt.cpp index 94b3bd7a91..48c7e06ee9 100644 --- a/Core/HLE/sceKernelInterrupt.cpp +++ b/Core/HLE/sceKernelInterrupt.cpp @@ -47,8 +47,11 @@ public: void DoState(PointerWrap &p) { + auto s = p.Section("InterruptState", 1); + if (!s) + return; + p.Do(savedCpu); - p.DoMarker("InterruptState"); } ThreadContext savedCpu; @@ -200,16 +203,22 @@ void IntrHandler::queueUp(int subintr) void IntrHandler::DoState(PointerWrap &p) { + auto s = p.Section("IntrHandler", 1); + if (!s) + return; + p.Do(intrNumber); p.Do(subIntrHandlers); - p.DoMarker("IntrHandler"); } void PendingInterrupt::DoState(PointerWrap &p) { + auto s = p.Section("PendingInterrupt", 1); + if (!s) + return; + p.Do(intr); p.Do(subintr); - p.DoMarker("PendingInterrupt"); } void __InterruptsInit() @@ -224,6 +233,10 @@ void __InterruptsInit() void __InterruptsDoState(PointerWrap &p) { + auto s = p.Section("sceKernelInterrupt", 1); + if (!s) + return; + int numInterrupts = PSP_NUMBER_INTERRUPTS; p.Do(numInterrupts); if (numInterrupts != PSP_NUMBER_INTERRUPTS) @@ -239,7 +252,6 @@ void __InterruptsDoState(PointerWrap &p) p.Do(interruptsEnabled); p.Do(inInterrupt); p.Do(threadBeforeInterrupt); - p.DoMarker("sceKernelInterrupt"); } void __InterruptsDoStateLate(PointerWrap &p) diff --git a/Core/HLE/sceKernelMbx.cpp b/Core/HLE/sceKernelMbx.cpp index e8e3e57cc8..ef1f418db9 100644 --- a/Core/HLE/sceKernelMbx.cpp +++ b/Core/HLE/sceKernelMbx.cpp @@ -175,11 +175,14 @@ struct Mbx : public KernelObject virtual void DoState(PointerWrap &p) { + auto s = p.Section("Mbx", 1); + if (!s) + return; + p.Do(nmb); MbxWaitingThread mwt = {0}; p.Do(waitingThreads, mwt); p.Do(pausedWaits); - p.DoMarker("Mbx"); } NativeMbx nmb; @@ -200,9 +203,12 @@ void __KernelMbxInit() void __KernelMbxDoState(PointerWrap &p) { + auto s = p.Section("sceKernelMbx", 1); + if (!s) + return; + p.Do(mbxWaitTimer); CoreTiming::RestoreRegisterEvent(mbxWaitTimer, "MbxTimeout", __KernelMbxTimeout); - p.DoMarker("sceKernelMbx"); } KernelObject *__KernelMbxObject() diff --git a/Core/HLE/sceKernelMemory.cpp b/Core/HLE/sceKernelMemory.cpp index 808396424e..531d4449b3 100644 --- a/Core/HLE/sceKernelMemory.cpp +++ b/Core/HLE/sceKernelMemory.cpp @@ -118,6 +118,10 @@ struct FPL : public KernelObject virtual void DoState(PointerWrap &p) { + auto s = p.Section("FPL", 1); + if (!s) + return; + p.Do(nf); if (p.mode == p.MODE_READ) blocks = new bool[nf.numBlocks]; @@ -128,7 +132,6 @@ struct FPL : public KernelObject FplWaitingThread dv = {0}; p.Do(waitingThreads, dv); p.Do(pausedWaits); - p.DoMarker("FPL"); } NativeFPL nf; @@ -175,13 +178,16 @@ struct VPL : public KernelObject virtual void DoState(PointerWrap &p) { + auto s = p.Section("VPL", 1); + if (!s) + return; + p.Do(nv); p.Do(address); VplWaitingThread dv = {0}; p.Do(waitingThreads, dv); alloc.DoState(p); p.Do(pausedWaits); - p.DoMarker("VPL"); } SceKernelVplInfo nv; @@ -220,6 +226,10 @@ void __KernelMemoryInit() void __KernelMemoryDoState(PointerWrap &p) { + auto s = p.Section("sceKernelMemory", 1); + if (!s) + return; + kernelMemory.DoState(p); userMemory.DoState(p); @@ -231,7 +241,6 @@ void __KernelMemoryDoState(PointerWrap &p) p.Do(sdkVersion_); p.Do(compilerVersion_); p.DoArray(tlsUsedIndexes, ARRAY_SIZE(tlsUsedIndexes)); - p.DoMarker("sceKernelMemory"); } void __KernelMemoryShutdown() @@ -708,9 +717,12 @@ public: virtual void DoState(PointerWrap &p) { + auto s = p.Section("PMB", 1); + if (!s) + return; + p.Do(address); p.DoArray(name, sizeof(name)); - p.DoMarker("PMB"); } u32 address; @@ -1597,12 +1609,15 @@ struct TLS : public KernelObject virtual void DoState(PointerWrap &p) { + auto s = p.Section("TLS", 1); + if (!s) + return; + p.Do(ntls); p.Do(address); p.Do(waitingThreads); p.Do(next); p.Do(usage); - p.DoMarker("TLS"); } NativeTls ntls; diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 35a5bdfe5b..f36e2eb1c4 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -221,6 +221,10 @@ public: virtual void DoState(PointerWrap &p) { + auto s = p.Section("Module", 1); + if (!s) + return; + p.Do(nm); p.Do(memoryBlockAddr); p.Do(memoryBlockSize); @@ -237,7 +241,6 @@ public: VarSymbolImport vsi = {0}; p.Do(importedVars, vsi); RebuildImpExpModuleNames(); - p.DoMarker("Module"); } // We don't do this in the destructor to avoid annoying messages on game shutdown. @@ -328,9 +331,12 @@ public: u32 retValAddr; virtual void run(MipsCall &call); virtual void DoState(PointerWrap &p) { + auto s = p.Section("AfterModuleEntryCall", 1); + if (!s) + return; + p.Do(moduleID_); p.Do(retValAddr); - p.DoMarker("AfterModuleEntryCall"); } static Action *Create() { return new AfterModuleEntryCall; @@ -386,9 +392,12 @@ void __KernelModuleInit() void __KernelModuleDoState(PointerWrap &p) { + auto s = p.Section("sceKernelModule", 1); + if (!s) + return; + p.Do(actionAfterModule); __KernelRestoreActionType(actionAfterModule, AfterModuleEntryCall::Create); - p.DoMarker("sceKernelModule"); } void __KernelModuleShutdown() diff --git a/Core/HLE/sceKernelMsgPipe.cpp b/Core/HLE/sceKernelMsgPipe.cpp index 8eff9b277f..6a75df6815 100644 --- a/Core/HLE/sceKernelMsgPipe.cpp +++ b/Core/HLE/sceKernelMsgPipe.cpp @@ -271,6 +271,10 @@ struct MsgPipe : public KernelObject virtual void DoState(PointerWrap &p) { + auto s = p.Section("MsgPipe", 1); + if (!s) + return; + p.Do(nmp); MsgPipeWaitingThread mpwt1 = {0}, mpwt2 = {0}; p.Do(sendWaitingThreads, mpwt1); @@ -278,7 +282,6 @@ struct MsgPipe : public KernelObject p.Do(pausedSendWaits); p.Do(pausedReceiveWaits); p.Do(buffer); - p.DoMarker("MsgPipe"); } NativeMsgPipe nmp; @@ -651,9 +654,12 @@ void __KernelMsgPipeInit() void __KernelMsgPipeDoState(PointerWrap &p) { + auto s = p.Section("sceKernelMsgPipe", 1); + if (!s) + return; + p.Do(waitTimer); CoreTiming::RestoreRegisterEvent(waitTimer, "MsgPipeTimeout", __KernelMsgPipeTimeout); - p.DoMarker("sceKernelMsgPipe"); } int sceKernelCreateMsgPipe(const char *name, int partition, u32 attr, u32 size, u32 optionsPtr) diff --git a/Core/HLE/sceKernelMutex.cpp b/Core/HLE/sceKernelMutex.cpp index b90efe2c56..ef0f0d3187 100644 --- a/Core/HLE/sceKernelMutex.cpp +++ b/Core/HLE/sceKernelMutex.cpp @@ -70,11 +70,14 @@ struct Mutex : public KernelObject virtual void DoState(PointerWrap &p) { + auto s = p.Section("Mutex", 1); + if (!s) + return; + p.Do(nm); SceUID dv = 0; p.Do(waitingThreads, dv); p.Do(pausedWaits); - p.DoMarker("Mutex"); } NativeMutex nm; @@ -132,11 +135,14 @@ struct LwMutex : public KernelObject virtual void DoState(PointerWrap &p) { + auto s = p.Section("LwMutex", 1); + if (!s) + return; + p.Do(nm); SceUID dv = 0; p.Do(waitingThreads, dv); p.Do(pausedWaits); - p.DoMarker("LwMutex"); } NativeLwMutex nm; @@ -168,12 +174,15 @@ void __KernelMutexInit() void __KernelMutexDoState(PointerWrap &p) { + auto s = p.Section("sceKernelMutex", 1); + if (!s) + return; + p.Do(mutexWaitTimer); CoreTiming::RestoreRegisterEvent(mutexWaitTimer, "MutexTimeout", __KernelMutexTimeout); p.Do(lwMutexWaitTimer); CoreTiming::RestoreRegisterEvent(lwMutexWaitTimer, "LwMutexTimeout", __KernelLwMutexTimeout); p.Do(mutexHeldLocks); - p.DoMarker("sceKernelMutex"); } KernelObject *__KernelMutexObject() diff --git a/Core/HLE/sceKernelSemaphore.cpp b/Core/HLE/sceKernelSemaphore.cpp index 152de6a44e..2c00884895 100644 --- a/Core/HLE/sceKernelSemaphore.cpp +++ b/Core/HLE/sceKernelSemaphore.cpp @@ -63,11 +63,14 @@ struct Semaphore : public KernelObject virtual void DoState(PointerWrap &p) { + auto s = p.Section("Semaphore", 1); + if (!s) + return; + p.Do(ns); SceUID dv = 0; p.Do(waitingThreads, dv); p.Do(pausedWaits); - p.DoMarker("Semaphore"); } NativeSemaphore ns; @@ -89,9 +92,12 @@ void __KernelSemaInit() void __KernelSemaDoState(PointerWrap &p) { + auto s = p.Section("sceKernelSema", 1); + if (!s) + return; + p.Do(semaWaitTimer); CoreTiming::RestoreRegisterEvent(semaWaitTimer, "SemaphoreTimeout", __KernelSemaTimeout); - p.DoMarker("sceKernelSema"); } KernelObject *__KernelSemaphoreObject() diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index fb54695ffd..429c2c848a 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -141,13 +141,16 @@ public: virtual void DoState(PointerWrap &p) { + auto s = p.Section("Callback", 1); + if (!s) + return; + p.Do(nc); p.Do(savedPC); p.Do(savedRA); p.Do(savedV0); p.Do(savedV1); p.Do(savedIdRegister); - p.DoMarker("Callback"); } NativeCallback nc; @@ -260,9 +263,12 @@ public: } void DoState(PointerWrap &p) { + auto s = p.Section("MipsCallManager", 1); + if (!s) + return; + p.Do(calls_); p.Do(idGen_); - p.DoMarker("MipsCallManager"); } private: @@ -289,6 +295,10 @@ public: virtual void DoState(PointerWrap &p) { + auto s = p.Section("ActionAfterMipsCall", 1); + if (!s) + return; + p.Do(threadID); p.Do(status); p.Do(waitType); @@ -297,8 +307,6 @@ public: p.Do(isProcessingCallbacks); p.Do(currentCallbackId); - p.DoMarker("ActionAfterMipsCall"); - int chainedActionType = 0; if (chainedAction != NULL) chainedActionType = chainedAction->actionTypeID; @@ -343,8 +351,11 @@ public: void DoState(PointerWrap &p) { + auto s = p.Section("ActionAfterCallback", 1); + if (!s) + return; + p.Do(cbId); - p.DoMarker("ActionAfterCallback"); } SceUID cbId; @@ -502,6 +513,10 @@ public: virtual void DoState(PointerWrap &p) { + auto s = p.Section("Thread", 1); + if (!s) + return; + p.Do(nt); p.Do(waitInfo); p.Do(moduleId); @@ -515,8 +530,6 @@ public: p.Do(pendingMipsCalls); p.Do(pushedStacks); p.Do(currentStack); - - p.DoMarker("Thread"); } NativeThread nt; @@ -688,6 +701,10 @@ struct ThreadQueueList void DoState(PointerWrap &p) { + auto s = p.Section("ThreadQueueList", 1); + if (!s) + return; + int numQueues = NUM_QUEUES; p.Do(numQueues); if (numQueues != NUM_QUEUES) @@ -721,8 +738,6 @@ struct ThreadQueueList if (size != 0) p.DoArray(&cur->data[cur->first], size); } - - p.DoMarker("ThreadQueueList"); } private: @@ -870,6 +885,10 @@ Action *__KernelCreateAction(int actionType) void MipsCall::DoState(PointerWrap &p) { + auto s = p.Section("MipsCall", 1); + if (!s) + return; + p.Do(entryPoint); p.Do(cbId); p.DoArray(args, ARRAY_SIZE(args)); @@ -883,8 +902,6 @@ void MipsCall::DoState(PointerWrap &p) p.Do(savedId); p.Do(reschedAfter); - p.DoMarker("MipsCall"); - int actionTypeID = 0; if (doAfter != NULL) actionTypeID = doAfter->actionTypeID; @@ -1129,6 +1146,10 @@ void __KernelThreadingInit() void __KernelThreadingDoState(PointerWrap &p) { + auto s = p.Section("sceKernelThread", 1); + if (!s) + return; + p.Do(g_inCbCount); p.Do(currentCallbackThreadID); p.Do(readyCallbacksCount); @@ -1160,8 +1181,6 @@ void __KernelThreadingDoState(PointerWrap &p) hleCurrentThreadName = __KernelGetThreadName(currentThread); lastSwitchCycles = CoreTiming::GetTicks(); - - p.DoMarker("sceKernelThread"); } void __KernelThreadingDoStateLate(PointerWrap &p) diff --git a/Core/HLE/sceKernelTime.cpp b/Core/HLE/sceKernelTime.cpp index 0f5c1cdcae..28a95502d0 100644 --- a/Core/HLE/sceKernelTime.cpp +++ b/Core/HLE/sceKernelTime.cpp @@ -41,8 +41,11 @@ void __KernelTimeInit() void __KernelTimeDoState(PointerWrap &p) { + auto s = p.Section("sceKernelTime", 1); + if (!s) + return; + p.Do(start_time); - p.DoMarker("sceKernelTime"); } int sceKernelGetSystemTime(u32 sysclockPtr) diff --git a/Core/HLE/sceKernelVTimer.cpp b/Core/HLE/sceKernelVTimer.cpp index 6b6c45bb30..9438372270 100644 --- a/Core/HLE/sceKernelVTimer.cpp +++ b/Core/HLE/sceKernelVTimer.cpp @@ -46,9 +46,12 @@ struct VTimer : public KernelObject { int GetIDType() const { return SCE_KERNEL_TMID_VTimer; } virtual void DoState(PointerWrap &p) { + auto s = p.Section("VTimer", 1); + if (!s) + return; + p.Do(nvt); p.Do(memoryPtr); - p.DoMarker("VTimer"); } NativeVTimer nvt; @@ -161,10 +164,13 @@ void __KernelTriggerVTimer(u64 userdata, int cyclesLate) { } void __KernelVTimerDoState(PointerWrap &p) { + auto s = p.Section("sceKernelVTimer", 1); + if (!s) + return; + p.Do(vtimerTimer); p.Do(vtimers); CoreTiming::RestoreRegisterEvent(vtimerTimer, "VTimer", __KernelTriggerVTimer); - p.DoMarker("sceKernelVTimer"); } void __KernelVTimerInit() { diff --git a/Core/HLE/sceMp3.cpp b/Core/HLE/sceMp3.cpp index 4e150d506f..a1e7d89efb 100644 --- a/Core/HLE/sceMp3.cpp +++ b/Core/HLE/sceMp3.cpp @@ -46,6 +46,10 @@ static const int MP3_BITRATES[] = {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, struct Mp3Context { void DoState(PointerWrap &p) { + auto s = p.Section("Mp3Context", 1); + if (!s) + return; + p.Do(mp3StreamStart); p.Do(mp3StreamEnd); p.Do(mp3Buf); @@ -60,7 +64,6 @@ struct Mp3Context { p.Do(mp3SamplingRate); p.Do(mp3Version); p.DoClass(mediaengine); - p.DoMarker("Mp3Context"); } int mp3StreamStart; diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 9da99c0299..f37ca48526 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -126,6 +126,10 @@ struct MpegContext { } void DoState(PointerWrap &p) { + auto s = p.Section("MpegContext", 1); + if (!s) + return; + p.DoArray(mpegheader, 2048); p.Do(defaultFrameWidth); p.Do(videoFrameCount); @@ -155,7 +159,6 @@ struct MpegContext { p.Do(isAnalyzed); p.Do(streamMap); p.DoClass(mediaengine); - p.DoMarker("MpegContext"); } u8 mpegheader[2048]; @@ -298,7 +301,13 @@ public: PostPutAction() {} void setRingAddr(u32 ringAddr) { ringAddr_ = ringAddr; } static Action *Create() { return new PostPutAction; } - void DoState(PointerWrap &p) { p.Do(ringAddr_); p.DoMarker("PostPutAction"); } + void DoState(PointerWrap &p) { + auto s = p.Section("PostPutAction", 1); + if (!s) + return; + + p.Do(ringAddr_); + } void run(MipsCall &call); private: u32 ringAddr_; @@ -318,6 +327,10 @@ void __MpegInit() { } void __MpegDoState(PointerWrap &p) { + auto s = p.Section("sceMpeg", 1); + if (!s) + return; + p.Do(lastMpegHandle); p.Do(streamIdGen); p.Do(isCurrentMpegAnalyzed); @@ -326,8 +339,6 @@ void __MpegDoState(PointerWrap &p) { __KernelRestoreActionType(actionPostPut, PostPutAction::Create); p.Do(mpegMap); - - p.DoMarker("sceMpeg"); } void __MpegShutdown() { diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index ff33258ac9..2a15e42e64 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -100,12 +100,15 @@ void __UpdateApctlHandlers(int oldState, int newState, int flag, int error) { // This feels like a dubious proposition, mostly... void __NetDoState(PointerWrap &p) { + auto s = p.Section("sceNet", 1); + if (!s) + return; + p.Do(netInited); p.Do(netInetInited); p.Do(netApctlInited); p.Do(apctlHandlers); p.Do(netMallocStat); - p.DoMarker("net"); } // TODO: should that struct actually be initialized here? diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index 370a235712..852b29b6d3 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -103,11 +103,14 @@ void __NetAdhocShutdown() { } void __NetAdhocDoState(PointerWrap &p) { + auto s = p.Section("sceNetAdhoc", 1); + if (!s) + return; + p.Do(netAdhocInited); p.Do(netAdhocctlInited); p.Do(netAdhocMatchingInited); p.Do(adhocctlHandlers); - p.DoMarker("netadhoc"); } void __UpdateAdhocctlHandlers(int flag, int error) { diff --git a/Core/HLE/scePower.cpp b/Core/HLE/scePower.cpp index 0cc8426f10..607a669c92 100644 --- a/Core/HLE/scePower.cpp +++ b/Core/HLE/scePower.cpp @@ -72,10 +72,13 @@ void __PowerInit() { } void __PowerDoState(PointerWrap &p) { + auto s = p.Section("scePower", 1); + if (!s) + return; + p.DoArray(powerCbSlots, ARRAY_SIZE(powerCbSlots)); p.Do(volatileMemLocked); p.Do(volatileWaitingThreads); - p.DoMarker("scePower"); } int scePowerGetBatteryLifePercent() { diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index d7f9e12643..a6e7233f6e 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -220,6 +220,10 @@ public: } void DoState(PointerWrap &p) { + auto s = p.Section("PsmfStream", 1); + if (!s) + return; + p.Do(type); p.Do(channel); } @@ -289,6 +293,10 @@ PsmfPlayer::PsmfPlayer(u32 data) { } void Psmf::DoState(PointerWrap &p) { + auto s = p.Section("Psmf", 1); + if (!s) + return; + p.Do(magic); p.Do(version); p.Do(streamOffset); @@ -313,11 +321,13 @@ void Psmf::DoState(PointerWrap &p) { p.Do(audioFrequency); p.Do(streamMap); - - p.DoMarker("Psmf"); } void PsmfPlayer::DoState(PointerWrap &p) { + auto s = p.Section("PsmfPlayer", 1); + if (!s) + return; + p.Do(videoCodec); p.Do(videoStreamNum); p.Do(audioCodec); @@ -338,8 +348,6 @@ void PsmfPlayer::DoState(PointerWrap &p) { p.Do(status); p.Do(psmfPlayerAvcAu); - - p.DoMarker("PsmfPlayer"); } void Psmf::setStreamNum(int num) { @@ -412,18 +420,22 @@ void __PsmfInit() void __PsmfDoState(PointerWrap &p) { - p.Do(psmfMap); + auto s = p.Section("scePsmf", 1); + if (!s) + return; - p.DoMarker("scePsmf"); + p.Do(psmfMap); } void __PsmfPlayerDoState(PointerWrap &p) { + auto s = p.Section("scePsmfPlayer", 1); + if (!s) + return; + p.Do(psmfPlayerMap); p.Do(videoPixelMode); p.Do(videoLoopStatus); - - p.DoMarker("scePsmfPlayer"); } void __PsmfShutdown() diff --git a/Core/HLE/sceRtc.cpp b/Core/HLE/sceRtc.cpp index a7103a965a..940b45aad5 100644 --- a/Core/HLE/sceRtc.cpp +++ b/Core/HLE/sceRtc.cpp @@ -120,11 +120,13 @@ void __RtcInit() void __RtcDoState(PointerWrap &p) { + auto s = p.Section("sceRtc", 1); + if (!s) + return; + p.Do(rtcBaseTime); // Update the precalc, pointless to savestate this as it's just based on the other value. rtcBaseTicks = 1000000ULL * rtcBaseTime.tv_sec + rtcBaseTime.tv_usec + rtcMagicOffset; - - p.DoMarker("sceRtc"); } void __RtcTimeOfDay(PSPTimeval *tv) diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index d04e392209..96193da23b 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -59,8 +59,11 @@ void __SasInit() { } void __SasDoState(PointerWrap &p) { + auto s = p.Section("sceSas", 1); + if (!s) + return; + p.DoClass(sas); - p.DoMarker("sceSas"); } void __SasShutdown() { diff --git a/Core/HLE/sceSsl.cpp b/Core/HLE/sceSsl.cpp index f40f316a81..413db1b2ed 100644 --- a/Core/HLE/sceSsl.cpp +++ b/Core/HLE/sceSsl.cpp @@ -38,10 +38,13 @@ void __SslInit() void __SslDoState(PointerWrap &p) { + auto s = p.Section("sceSsl", 1); + if (!s) + return; + p.Do(isSslInit); p.Do(maxMemSize); p.Do(currentMemSize); - p.DoMarker("sceSsl"); } int sceSslInit(int heapSize) diff --git a/Core/HLE/sceUmd.cpp b/Core/HLE/sceUmd.cpp index 2dd8bbe634..42748bf259 100644 --- a/Core/HLE/sceUmd.cpp +++ b/Core/HLE/sceUmd.cpp @@ -60,6 +60,10 @@ void __UmdInit() void __UmdDoState(PointerWrap &p) { + auto s = p.Section("sceUmd", 1); + if (!s) + return; + p.Do(umdActivated); p.Do(umdStatus); p.Do(umdErrorStat); @@ -70,7 +74,6 @@ void __UmdDoState(PointerWrap &p) CoreTiming::RestoreRegisterEvent(umdStatChangeEvent, "UmdChange", __UmdStatChange); p.Do(umdWaitingThreads); p.Do(umdPausedWaits); - p.DoMarker("sceUmd"); } u8 __KernelUmdGetState() diff --git a/Core/HLE/sceUsb.cpp b/Core/HLE/sceUsb.cpp index 975dd9b2f9..7f6eb912ef 100644 --- a/Core/HLE/sceUsb.cpp +++ b/Core/HLE/sceUsb.cpp @@ -30,8 +30,11 @@ void __UsbInit() void __UsbDoState(PointerWrap &p) { + auto s = p.Section("sceUsb", 1); + if (!s) + return; + p.Do(usbActivated); - p.DoMarker("sceUsb"); } u32 sceUsbActivate() { diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index 50aaf21c3c..e735b8e6a4 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -68,6 +68,10 @@ void __UtilityInit() void __UtilityDoState(PointerWrap &p) { + auto s = p.Section("sceUtility", 1); + if (!s) + return; + p.Do(currentDialogType); p.Do(currentDialogActive); saveDialog.DoState(p); @@ -76,7 +80,6 @@ void __UtilityDoState(PointerWrap &p) netDialog.DoState(p); screenshotDialog.DoState(p); p.Do(currentlyLoadedModules); - p.DoMarker("sceUtility"); } void __UtilityShutdown() diff --git a/Core/HLE/sceVaudio.cpp b/Core/HLE/sceVaudio.cpp index 59c495aea6..b182179bd9 100644 --- a/Core/HLE/sceVaudio.cpp +++ b/Core/HLE/sceVaudio.cpp @@ -31,8 +31,11 @@ void __VaudioInit() { } void __VaudioDoState(PointerWrap &p) { + auto s = p.Section("sceVaudio", 1); + if (!s) + return; + p.Do(vaudioReserved); - p.DoMarker("sceVaudio"); } u32 sceVaudioChReserve(int sampleCount, int freq, int format) { diff --git a/Core/HW/AsyncIOManager.cpp b/Core/HW/AsyncIOManager.cpp index d599bda70d..53b72308c9 100644 --- a/Core/HW/AsyncIOManager.cpp +++ b/Core/HW/AsyncIOManager.cpp @@ -89,9 +89,12 @@ void AsyncIOManager::EventResult(u32 handle, AsyncIOResult result) { } void AsyncIOManager::DoState(PointerWrap &p) { + auto s = p.Section("AsyncIoManager", 1); + if (!s) + return; + SyncThread(); lock_guard guard(resultsLock_); p.Do(resultsPending_); p.Do(results_); - p.DoMarker("AsyncIOManager"); } diff --git a/Core/HW/MediaEngine.cpp b/Core/HW/MediaEngine.cpp index b7d5cad447..2151b8c709 100644 --- a/Core/HW/MediaEngine.cpp +++ b/Core/HW/MediaEngine.cpp @@ -141,6 +141,10 @@ void MediaEngine::closeMedia() { } void MediaEngine::DoState(PointerWrap &p){ + auto s = p.Section("MediaEngine", 1); + if (!s) + return; + p.Do(m_videoStream); p.Do(m_audioStream); @@ -166,7 +170,6 @@ void MediaEngine::DoState(PointerWrap &p){ p.Do(m_isVideoEnd); p.Do(m_noAudioData); - p.DoMarker("MediaEngine"); } int _MpegReadbuffer(void *opaque, uint8_t *buf, int buf_size) diff --git a/Core/HW/MemoryStick.cpp b/Core/HW/MemoryStick.cpp index 22a4569922..1029d9770b 100644 --- a/Core/HW/MemoryStick.cpp +++ b/Core/HW/MemoryStick.cpp @@ -7,9 +7,12 @@ static MemStickFatState memStickFatState = PSP_FAT_MEMORYSTICK_STATE_ASSIGNED; void MemoryStick_DoState(PointerWrap &p) { + auto s = p.Section("MemoryStick", 1); + if (!s) + return; + p.Do(memStickState); p.Do(memStickFatState); - p.DoMarker("MemoryStick"); } MemStickState MemoryStick_State() diff --git a/Core/HW/MpegDemux.h b/Core/HW/MpegDemux.h index 5e068ee7e3..5506797632 100644 --- a/Core/HW/MpegDemux.h +++ b/Core/HW/MpegDemux.h @@ -54,6 +54,10 @@ private: int demuxStream(bool bdemux, int startCode, int channel); public: void DoState(PointerWrap &p) { + auto s = p.Section("MpegDemux", 1); + if (!s) + return; + p.Do(m_index); p.Do(m_len); p.Do(m_audioChannel); diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index 2f9fe1b657..72dbef5608 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -137,6 +137,10 @@ void VagDecoder::GetSamples(s16 *outSamples, int numSamples) { void VagDecoder::DoState(PointerWrap &p) { + auto s = p.Section("VagDecoder", 1); + if (!s) + return; + p.DoArray(samples, ARRAY_SIZE(samples)); p.Do(curSample); @@ -190,6 +194,10 @@ int SasAtrac3::addStreamData(u8* buf, u32 addbytes) { } void SasAtrac3::DoState(PointerWrap &p) { + auto s = p.Section("SasAtrac3", 1); + if (!s) + return; + p.Do(contextAddr); p.Do(atracID); if (p.mode == p.MODE_READ && atracID >= 0 && !sampleQueue) { @@ -492,6 +500,10 @@ void SasInstance::Mix(u32 outAddr, u32 inAddr, int leftVol, int rightVol) { } void SasInstance::DoState(PointerWrap &p) { + auto s = p.Section("SasInstance", 1); + if (!s) + return; + p.Do(grainSize); if (p.mode == p.MODE_READ) { if (grainSize > 0) { @@ -525,8 +537,6 @@ void SasInstance::DoState(PointerWrap &p) { } p.DoArray(voices, ARRAY_SIZE(voices)); p.Do(waveformEffect); - - p.DoMarker("SasInstance"); } void SasVoice::Reset() { @@ -569,6 +579,10 @@ void SasVoice::ChangedParams(bool changedVag) { void SasVoice::DoState(PointerWrap &p) { + auto s = p.Section("SasVoice", 1); + if (!s) + return; + p.Do(playing); p.Do(paused); p.Do(on); @@ -596,8 +610,6 @@ void SasVoice::DoState(PointerWrap &p) p.Do(effectRight); p.DoArray(resampleHist, ARRAY_SIZE(resampleHist)); - p.DoMarker("SasVoice"); - envelope.DoState(p); vag.DoState(p); atrac3.DoState(p); @@ -789,6 +801,10 @@ void ADSREnvelope::KeyOff() { } void ADSREnvelope::DoState(PointerWrap &p) { + auto s = p.Section("ADSREnvelope", 1); + if (!s) + return; + p.Do(attackRate); p.Do(decayRate); p.Do(sustainRate); @@ -801,5 +817,4 @@ void ADSREnvelope::DoState(PointerWrap &p) { p.Do(state_); p.Do(steps_); p.Do(height_); - p.DoMarker("ADSREnvelope"); } diff --git a/Core/MIPS/ARM/ArmJit.cpp b/Core/MIPS/ARM/ArmJit.cpp index 1eba1a2cac..0c32131b66 100644 --- a/Core/MIPS/ARM/ArmJit.cpp +++ b/Core/MIPS/ARM/ArmJit.cpp @@ -72,16 +72,22 @@ Jit::Jit(MIPSState *mips) : blocks(mips, this), gpr(mips, &jo), fpr(mips), mips_ void Jit::DoState(PointerWrap &p) { + auto s = p.Section("Jit", 1); + if (!s) + return; + p.Do(js.startDefaultPrefix); - p.DoMarker("Jit"); } // This is here so the savestate matches between jit and non-jit. void Jit::DoDummyState(PointerWrap &p) { + auto s = p.Section("Jit", 1); + if (!s) + return; + bool dummy = false; p.Do(dummy); - p.DoMarker("Jit"); } void Jit::FlushAll() diff --git a/Core/MIPS/MIPS.cpp b/Core/MIPS/MIPS.cpp index 0dd81699cf..f1a4214e1f 100644 --- a/Core/MIPS/MIPS.cpp +++ b/Core/MIPS/MIPS.cpp @@ -147,6 +147,10 @@ void MIPSState::Reset() } void MIPSState::DoState(PointerWrap &p) { + auto s = p.Section("MIPSState", 1); + if (!s) + return; + // Reset the jit if we're loading. if (p.mode == p.MODE_READ) Reset(); @@ -172,7 +176,6 @@ void MIPSState::DoState(PointerWrap &p) { p.Do(inDelaySlot); p.Do(llBit); p.Do(debugCount); - p.DoMarker("MIPSState"); } void MIPSState::SingleStep() diff --git a/Core/MIPS/PPC/PpcJit.h b/Core/MIPS/PPC/PpcJit.h index c80020d55a..7a1227e2d9 100644 --- a/Core/MIPS/PPC/PpcJit.h +++ b/Core/MIPS/PPC/PpcJit.h @@ -144,9 +144,17 @@ namespace MIPSComp public: Jit(MIPSState *mips); void DoState(PointerWrap &p) { + auto s = p.Section("Jit", 1); + if (!s) + return; + // Do nothing } static void DoDummyState(PointerWrap &p) { + auto s = p.Section("Jit", 1); + if (!s) + return; + // Do nothing } diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index 83fc067b25..3d0f6bc366 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -123,16 +123,22 @@ Jit::Jit(MIPSState *mips) : blocks(mips, this), mips_(mips) void Jit::DoState(PointerWrap &p) { + auto s = p.Section("Jit", 1); + if (!s) + return; + p.Do(js.startDefaultPrefix); - p.DoMarker("Jit"); } // This is here so the savestate matches between jit and non-jit. void Jit::DoDummyState(PointerWrap &p) { + auto s = p.Section("Jit", 1); + if (!s) + return; + bool dummy = false; p.Do(dummy); - p.DoMarker("Jit"); } diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index 2cdfd1bde4..541bd6b885 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -98,6 +98,10 @@ void Init() void DoState(PointerWrap &p) { + auto s = p.Section("Memory", 1); + if (!s) + return; + p.DoArray(m_pRAM, g_MemorySize); p.DoMarker("RAM"); p.DoArray(m_pVRAM, VRAM_SIZE); diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index 83282f5e4e..030147363b 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -66,6 +66,10 @@ namespace SaveState void SaveStart::DoState(PointerWrap &p) { + auto s = p.Section("SaveStart", 1); + if (!s) + return; + // Gotta do CoreTiming first since we'll restore into it. CoreTiming::DoState(p); diff --git a/Core/Util/BlockAllocator.cpp b/Core/Util/BlockAllocator.cpp index 0128d1b2b8..19b19e0c1d 100644 --- a/Core/Util/BlockAllocator.cpp +++ b/Core/Util/BlockAllocator.cpp @@ -419,6 +419,10 @@ u32 BlockAllocator::GetTotalFreeBytes() const void BlockAllocator::DoState(PointerWrap &p) { + auto s = p.Section("BlockAllocator", 1); + if (!s) + return; + int count = 0; if (p.mode == p.MODE_READ) @@ -458,14 +462,16 @@ void BlockAllocator::DoState(PointerWrap &p) p.Do(rangeStart_); p.Do(rangeSize_); p.Do(grain_); - p.DoMarker("BlockAllocator"); } void BlockAllocator::Block::DoState(PointerWrap &p) { + auto s = p.Section("Block", 1); + if (!s) + return; + p.Do(start); p.Do(size); p.Do(taken); p.DoArray(tag, sizeof(tag)); - p.DoMarker("Block"); } diff --git a/Core/Util/PPGeDraw.cpp b/Core/Util/PPGeDraw.cpp index 22589274c4..3a17715d9c 100644 --- a/Core/Util/PPGeDraw.cpp +++ b/Core/Util/PPGeDraw.cpp @@ -187,6 +187,10 @@ void __PPGeInit() void __PPGeDoState(PointerWrap &p) { + auto s = p.Section("PPGeDraw", 1); + if (!s) + return; + p.Do(atlasPtr); p.Do(atlasWidth); p.Do(atlasHeight); @@ -208,8 +212,6 @@ void __PPGeDoState(PointerWrap &p) p.Do(char_lines); p.Do(char_lines_metrics); - - p.DoMarker("PPGeDraw"); } void __PPGeShutdown() diff --git a/GPU/GLES/GLES_GPU.cpp b/GPU/GLES/GLES_GPU.cpp index df2c7f7e67..2c3d342c6f 100644 --- a/GPU/GLES/GLES_GPU.cpp +++ b/GPU/GLES/GLES_GPU.cpp @@ -1450,5 +1450,6 @@ void GLES_GPU::DoState(PointerWrap &p) { gstate_c.textureChanged = true; framebufferManager_.DestroyAllFBOs(); + // TODO: This one at least definitely shouldn't be necessary. shaderManager_->ClearCache(true); } diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 8b4c406850..5efba66466 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -859,6 +859,10 @@ void GPUCommon::ExecuteOp(u32 op, u32 diff) { void GPUCommon::DoState(PointerWrap &p) { easy_guard guard(listLock); + auto s = p.Section("GPUCommon", 1); + if (!s) + return; + p.Do(dlQueue); p.DoArray(dls, ARRAY_SIZE(dls)); int currentID = 0; @@ -877,7 +881,6 @@ void GPUCommon::DoState(PointerWrap &p) { p.Do(isbreak); p.Do(drawCompleteTicks); p.Do(busyTicks); - p.DoMarker("GPUCommon"); } void GPUCommon::InterruptStart(int listid) {