Merge pull request #2418 from RadWolfie/fix-reboot-non-ansii-path

kernel: fix non-ansii file path conversion for reboot process
This commit is contained in:
Luke Usher 2023-03-13 12:41:17 +00:00 committed by GitHub
commit 6c530fbf86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View File

@ -43,7 +43,6 @@
#include "common\EmuEEPROM.h" // For EEPROM
#include "devices\Xbox.h" // For g_SMBus, SMBUS_ADDRESS_SYSTEM_MICRO_CONTROLLER
#include "devices\SMCDevice.h" // For SMC_COMMAND_SCRATCH
#include "common/util/strConverter.hpp" // for utf16_to_ascii
#include "core\kernel\memory-manager\VMManager.h"
#include <algorithm> // for std::replace

View File

@ -40,7 +40,6 @@
#include <ntstatus.h>
#pragma warning(default:4005)
#include "Logging.h"
#include "common/util/strConverter.hpp" // utf16_to_ascii
#include "common/util/cliConfig.hpp"
#include "common/CxbxDebugger.h"
#include "EmuShared.h"
@ -790,20 +789,21 @@ std::string CxbxConvertXboxToHostPath(const std::string_view XboxDevicePath)
std::wstring wXbePath;
// We pretend to come from NtCreateFile to force symbolic link resolution
CxbxConvertFilePath(XboxDevicePath.data(), wXbePath, &rootDirectoryHandle, "NtCreateFile");
// Convert Wide String as returned by above to a string, for XbePath
std::string XbePath = utf16_to_ascii(wXbePath.c_str());
std::filesystem::path XbePath;
// 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) {
WCHAR directoryPathBuffer[MAX_PATH];
GetFinalPathNameByHandleW(rootDirectoryHandle, directoryPathBuffer, MAX_PATH, VOLUME_NAME_DOS);
std::string directoryPath = utf16_to_ascii(directoryPathBuffer);
XbePath = directoryPath + std::string("\\") + XbePath;
XbePath = directoryPathBuffer;
XbePath /= wXbePath;
}
else {
XbePath = wXbePath;
}
return XbePath;
return XbePath.string();
}
int CxbxRegisterDeviceHostPath(const std::string_view XboxDevicePath, std::string HostDevicePath, bool IsFile, std::size_t size)