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

+2 -1
View File
@@ -1093,7 +1093,8 @@ void DirectoryFileSystem::DoState(PointerWrap &p) {
Do(p, entry.guestFilename);
Do(p, entry.access);
u32 err;
bool opened = entry.hFile.Open(basePath, entry.guestFilename, entry.access, err);
// The original open created the file, so an exclusive create would fail now.
bool opened = entry.hFile.Open(basePath, entry.guestFilename, (FileAccess)(entry.access & ~FILEACCESS_EXCL), err);
bool brokenFile = !opened;
if (!opened) {
ERROR_LOG(Log::FileSystem, "Failed to reopen file while loading state: %s", entry.guestFilename.c_str());