Savestate: Fix reopening files on load

Drop an ISO handle whose file isn't in the loaded image instead of keeping
a null file, and don't reopen a directory file with exclusive create.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-28 11:32:07 -06:00
1 parent cd94e414cd
commit fc32d79596
2 files changed
+8 -1

No files matched your search

+6
View File
@@ -857,6 +857,12 @@ void ISOFileSystem::DoState(PointerWrap &p) {
std::string path;
Do(p, path);
of.file = GetFromPath(path);
if (!of.file) {
// Loaded against a different image. Like a file that's gone from a directory,
// drop the handle rather than keep one that points at nothing.
ERROR_LOG(Log::FileSystem, "Failed to reopen file while loading state: %s", path.c_str());
continue;
}
} else {
of.file = NULL;
}