savestate: dynamic section count; refuse cross-mod-config loads; tex_pack section

The file header's section count was HARDCODED to 16, so ANY appended
section made the loader stop early and poisoned every later section - the
long-standing "adding a section breaks a later one" trap. BsOut now counts
sections and backpatches the header (file via fseek, memory in place).

New BS_SEC_MODSET rides FIRST: the resolved mod-plan fingerprint. A load
whose fingerprint differs from the running plan is refused before any state
is applied, with a message naming both plans - previously such loads
half-applied and died at a null PC. Old saves without the section still
load (best effort), matching the skip-unknown policy.

BS_SEC_TEXPACK (dormant since the count trap) is enabled: tracked-upload
rects+hashes persist, pixels rebuilt from restored VRAM and hash-verified,
so HD texture substitution survives savestate loads. Full save->load->run
roundtrip verified live.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
tetrisgm
2026-08-18 13:53:46 -07:00
parent bd3f900213
commit 18272616a1
4 changed files with 92 additions and 1 deletions
+4
View File
@@ -1295,6 +1295,10 @@ const std::string& mod_runtime_fingerprint() {
return state().plan.fingerprint;
}
extern "C" const char* psx_mod_runtime_fingerprint_cstr(void) {
return state().plan.fingerprint.c_str();
}
const std::filesystem::path& mod_runtime_effective_disc_path() {
return state().effective_disc_path;
}