From 4edd3feb3e9087e733fcf1562cf9fbb1b30f2f0f Mon Sep 17 00:00:00 2001 From: Luke Usher Date: Fri, 8 Jul 2022 20:37:32 +0100 Subject: [PATCH] emufile: fix multi-xbe titles when running through xbox-iso-vfs Prior to this commit, the relaunch path would become corrupted when running a game mounted with xbox-iso-vfs. --- src/core/kernel/support/EmuFile.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/kernel/support/EmuFile.cpp b/src/core/kernel/support/EmuFile.cpp index 3f79a18a8..1977385ee 100644 --- a/src/core/kernel/support/EmuFile.cpp +++ b/src/core/kernel/support/EmuFile.cpp @@ -797,9 +797,10 @@ std::string CxbxConvertXboxToHostPath(const std::string_view XboxDevicePath) // If the rootDirectoryHandle is not null, we have a relative path // We need to prepend the path of the root directory to get a full DOS path if (rootDirectoryHandle != nullptr) { - char directoryPathBuffer[MAX_PATH]; - GetFinalPathNameByHandle(rootDirectoryHandle, directoryPathBuffer, MAX_PATH, VOLUME_NAME_DOS); - XbePath = directoryPathBuffer + std::string("\\") + XbePath; + WCHAR directoryPathBuffer[MAX_PATH]; + GetFinalPathNameByHandleW(rootDirectoryHandle, directoryPathBuffer, MAX_PATH, VOLUME_NAME_DOS); + std::string directoryPath = utf16_to_ascii(directoryPathBuffer); + XbePath = directoryPath + std::string("\\") + XbePath; } return XbePath;