SaveState: Fixes from a review of the IO and dialog savestates

- Savedata list entries lost their directory across a load. Confirming a
  delete in a list dialog loaded from a state failed with "delete failed"
  and deleted nothing. LISTALLDELETE can't rebuild it from the names, so
  it's saved now, with the broken flag.
- Registry values the game wrote (CLANNAD's font plugin registers its font
  there) weren't saved, and a state without a sceReg section wiped them.
- Slots sharing the "no save" icon came back as separate images of one
  texture, which Clear() then freed once per slot.
- Old directory states left a file opened with TRUNCATE due for truncation,
  so it read as empty and was truncated on close. Old async IO states were
  loaded on top of this session's results.
- From a broken or crafted state: OSK keyboard and Korean composition
  indices, gamedata install file counts, font ownership modes (an internal
  font could be deleted) and FontLib's per-font vector sizes.

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-10-20 00:20:24 +02:00
1 parent 43f7674f9c
commit d40137a007
9 files changed
+93 -2

No files matched your search

+3
View File
@@ -1136,6 +1136,9 @@ void DirectoryFileSystem::DoState(PointerWrap &p) {
}
if (s >= 2) {
Do(p, entry.hFile.needsTrunc_);
} else {
// Open() set it up for a file opened with TRUNCATE, which was truncated long before the save.
entry.hFile.needsTrunc_ = -1;
}
// Let's hope that things don't go that badly with the file mysteriously auto-closed.
// Better than not loading the save state at all, hopefully.