diff --git a/src/xenia/base/memory_posix.cc b/src/xenia/base/memory_posix.cc index 8da6d9a1b..81020d094 100644 --- a/src/xenia/base/memory_posix.cc +++ b/src/xenia/base/memory_posix.cc @@ -88,7 +88,8 @@ FileMappingHandle CreateFileMappingHandle(const std::filesystem::path& path, } oflag |= O_CREAT; - int ret = shm_open(path.c_str(), oflag, 0777); + auto full_path = "/" / path; + int ret = shm_open(full_path.c_str(), oflag, 0777); if (ret > 0) { ftruncate64(ret, length); } diff --git a/src/xenia/base/memory_win.cc b/src/xenia/base/memory_win.cc index 13b78a411..ed39e1028 100644 --- a/src/xenia/base/memory_win.cc +++ b/src/xenia/base/memory_win.cc @@ -147,9 +147,10 @@ FileMappingHandle CreateFileMappingHandle(const std::filesystem::path& path, bool commit) { DWORD protect = ToWin32ProtectFlags(access) | (commit ? SEC_COMMIT : SEC_RESERVE); + auto full_path = "Local" / path; return CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, protect, static_cast(length >> 32), - static_cast(length), path.c_str()); + static_cast(length), full_path.c_str()); } void CloseFileMappingHandle(FileMappingHandle handle) { CloseHandle(handle); } diff --git a/src/xenia/base/testing/memory_test.cc b/src/xenia/base/testing/memory_test.cc index 66a365c8f..1fe2184fa 100644 --- a/src/xenia/base/testing/memory_test.cc +++ b/src/xenia/base/testing/memory_test.cc @@ -418,7 +418,7 @@ TEST_CASE("copy_and_swap_16_in_32_unaligned", "Copy and Swap") { } TEST_CASE("create_and_close_file_mapping", "Virtual Memory Mapping") { - auto path = fmt::format("Local\\xenia_test_{}", Clock::QueryHostTickCount()); + auto path = fmt::format("xenia_test_{}", Clock::QueryHostTickCount()); auto memory = xe::memory::CreateFileMappingHandle( path, 0x100, xe::memory::PageAccess::kReadWrite, true); REQUIRE(memory); @@ -426,7 +426,7 @@ TEST_CASE("create_and_close_file_mapping", "Virtual Memory Mapping") { } TEST_CASE("map_view", "Virtual Memory Mapping") { - auto path = fmt::format("Local\\xenia_test_{}", Clock::QueryHostTickCount()); + auto path = fmt::format("xenia_test_{}", Clock::QueryHostTickCount()); const size_t length = 0x100; auto memory = xe::memory::CreateFileMappingHandle( path, length, xe::memory::PageAccess::kReadWrite, true); @@ -444,7 +444,7 @@ TEST_CASE("map_view", "Virtual Memory Mapping") { TEST_CASE("read_write_view", "Virtual Memory Mapping") { const size_t length = 0x100; - auto path = fmt::format("Local\\xenia_test_{}", Clock::QueryHostTickCount()); + auto path = fmt::format("xenia_test_{}", Clock::QueryHostTickCount()); auto memory = xe::memory::CreateFileMappingHandle( path, length, xe::memory::PageAccess::kReadWrite, true); REQUIRE(memory); diff --git a/src/xenia/cpu/backend/x64/x64_code_cache.cc b/src/xenia/cpu/backend/x64/x64_code_cache.cc index 8f9b433dd..6ea280908 100644 --- a/src/xenia/cpu/backend/x64/x64_code_cache.cc +++ b/src/xenia/cpu/backend/x64/x64_code_cache.cc @@ -63,8 +63,7 @@ bool X64CodeCache::Initialize() { } // Create mmap file. This allows us to share the code cache with the debugger. - file_name_ = - fmt::format("Local\\xenia_code_cache_{}", Clock::QueryHostTickCount()); + file_name_ = fmt::format("xenia_code_cache_{}", Clock::QueryHostTickCount()); mapping_ = xe::memory::CreateFileMappingHandle( file_name_, kGeneratedCodeSize, xe::memory::PageAccess::kExecuteReadWrite, false); diff --git a/src/xenia/memory.cc b/src/xenia/memory.cc index 7e60797f5..8f20a79af 100644 --- a/src/xenia/memory.cc +++ b/src/xenia/memory.cc @@ -125,8 +125,7 @@ Memory::~Memory() { } bool Memory::Initialize() { - file_name_ = - fmt::format("Local\\xenia_memory_{}", Clock::QueryHostTickCount()); + file_name_ = fmt::format("xenia_memory_{}", Clock::QueryHostTickCount()); // Create main page file-backed mapping. This is all reserved but // uncommitted (so it shouldn't expand page file).