mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-20 18:34:58 +00:00
Merge pull request #502 from Borchev/ROMappedFileWorkaround
Workaround for readonly memory mapping of files issue
This commit is contained in:
commit
83bcced16c
4 changed files with 26 additions and 12 deletions
|
@ -217,7 +217,7 @@ void IOFile::Close() {
|
|||
file = nullptr;
|
||||
|
||||
#ifdef _WIN64
|
||||
if (file_mapping) {
|
||||
if (file_mapping && file_access_mode == FileAccessMode::ReadWrite) {
|
||||
CloseHandle(std::bit_cast<HANDLE>(file_mapping));
|
||||
}
|
||||
#endif
|
||||
|
@ -259,8 +259,7 @@ uintptr_t IOFile::GetFileMapping() {
|
|||
mapping = CreateFileMapping2(hfile, NULL, FILE_MAP_WRITE, PAGE_READWRITE, SEC_COMMIT, 0,
|
||||
NULL, NULL, 0);
|
||||
} else {
|
||||
mapping = CreateFileMapping2(hfile, NULL, FILE_MAP_READ, PAGE_READONLY, SEC_COMMIT, 0, NULL,
|
||||
NULL, 0);
|
||||
mapping = hfile;
|
||||
}
|
||||
|
||||
file_mapping = std::bit_cast<uintptr_t>(mapping);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue