From 996d97a05e68b3a4aedeff615ec5f3537af13038 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 22 Jan 2014 01:06:59 -0800 Subject: [PATCH] Properly savestate loaded modules. May fix savestates in games that use modules heavily, like Yu-Gi-Oh, Metal Gear Solid, Tales of Radiant Mythology, and Valkyrie Profile. --- Core/HLE/sceKernelModule.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 5b3d7a16d9..b7f0625419 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -232,7 +232,7 @@ public: virtual void DoState(PointerWrap &p) { - auto s = p.Section("Module", 1, 2); + auto s = p.Section("Module", 1, 3); if (!s) return; @@ -250,6 +250,11 @@ public: nm.status = MODULE_STATUS_STOPPED; } + if (s >= 3) { + p.Do(textStart); + p.Do(textEnd); + } + ModuleWaitingThread mwt = {0}; p.Do(waitingThreads, mwt); FuncSymbolExport fsx = {{0}}; @@ -415,12 +420,16 @@ void __KernelModuleInit() void __KernelModuleDoState(PointerWrap &p) { - auto s = p.Section("sceKernelModule", 1); + auto s = p.Section("sceKernelModule", 1, 2); if (!s) return; p.Do(actionAfterModule); __KernelRestoreActionType(actionAfterModule, AfterModuleEntryCall::Create); + + if (s >= 2) { + p.Do(loadedModules); + } } void __KernelModuleShutdown()