Savestate: Save state that was missing from several modules

sceMpeg's AVC resource flag, whether the VSH is running, sceReg's handle
counter, sceNet's pending apctl events and product code block, and the
save dialog's copy of the original request (without which the first
Update after a load reloaded the request and lost its results).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-28 11:32:07 -06:00
1 parent 52299a5e17
commit 8663ce2a33
5 files changed
+79 -13

No files matched your search

+17 -5
View File
@@ -471,6 +471,9 @@ struct SceKernelSMOption {
static int actionAfterModule;
static std::set<SceUID> loadedModules;
// Set once we've seen a PSP_MODULE_VSH_MODE module load (i.e. we're booting the VSH rather
// than a game), and reset on the next __KernelLoadExec. See ShouldHLEModuleForLoad below.
static bool g_runningVSH = false;
// STATE END
//////////////////////////////////////////////////////////////////////////
@@ -479,7 +482,7 @@ static void __KernelModuleInit() {
}
void __KernelModuleDoState(PointerWrap &p) {
auto s = p.Section("sceKernelModule", 1, 2);
auto s = p.Section("sceKernelModule", 1, 3);
if (!s)
return;
@@ -491,6 +494,19 @@ void __KernelModuleDoState(PointerWrap &p) {
if (s >= 2) {
Do(p, loadedModules);
}
if (s >= 3) {
Do(p, g_runningVSH);
} else if (p.mode == p.MODE_READ) {
// Derive it the way the loader sets it.
g_runningVSH = false;
for (SceUID moduleId : loadedModules) {
u32 error;
PSPModule *module = kernelObjects.Get<PSPModule>(moduleId, error);
if (module && ((module->nm.attribute & PSP_MODULE_VSH_MODE) != 0 || equals(module->nm.name, "vsh_module"))) {
g_runningVSH = true;
}
}
}
if (p.mode == p.MODE_READ) {
u32 error;
@@ -1120,10 +1136,6 @@ enum : u32 {
ELF_MAGIC = 0x464c457f,
};
// Set once we've seen a PSP_MODULE_VSH_MODE module load (i.e. we're booting the VSH rather
// than a game), and reset on the next __KernelLoadExec. See ShouldHLEModuleForLoad below.
static bool g_runningVSH = false;
// A few flash0 modules (VSH's own bridge/UI/utility libraries) should only ever be genuinely
// loaded - rather than faked via any HLE implementation we may have for them - once we know
// we're actually running the VSH. A regular game never legitimately loads these, so this only