From 448d61f262ebd30506a37b0b12ee437e844391ec Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Sat, 29 Nov 2025 11:36:40 -0800 Subject: [PATCH] Windows/DirectIOFile: Don't request DELETE access for read-only Open Aside from being unnecessary, on Windows the flag prevents two instances of Dolphin (one instance from before 2509-371 when the flag was introduced and the other after) from running the same ROM simultaneously. Attempting to do so generated the false error `"[Rom]" is an invalid GCM/ISO file, or is not a GC/Wii ISO.` followed by `Failed to init core` and emulation shutdown on the second instance to start the game. Fixing the incorrect error message is a task I'm deferring to another PR. The problem didn't happen when both instances were 2509-371 or later, but I ran into it while bisecting an issue and it'd be nice to avoid that problem in the future. --- Source/Core/Common/DirectIOFile.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/Core/Common/DirectIOFile.cpp b/Source/Core/Common/DirectIOFile.cpp index d72e98fa3bb..bfe598dc48e 100644 --- a/Source/Core/Common/DirectIOFile.cpp +++ b/Source/Core/Common/DirectIOFile.cpp @@ -86,8 +86,11 @@ bool DirectIOFile::Open(const std::string& path, AccessMode access_mode, OpenMod else if (access_mode == AccessMode::Write) desired_access = GENERIC_WRITE; - // Allow deleting and renaming through our handle. - desired_access |= DELETE; + if (access_mode != AccessMode::Read) + { + // Allow deleting and renaming through our handle. + desired_access |= DELETE; + } // All sharing is allowed to more closely match default behavior on other OSes. constexpr DWORD share_mode = FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE;