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:
commit
6c530fbf86
|
@ -43,7 +43,6 @@
|
||||||
#include "common\EmuEEPROM.h" // For EEPROM
|
#include "common\EmuEEPROM.h" // For EEPROM
|
||||||
#include "devices\Xbox.h" // For g_SMBus, SMBUS_ADDRESS_SYSTEM_MICRO_CONTROLLER
|
#include "devices\Xbox.h" // For g_SMBus, SMBUS_ADDRESS_SYSTEM_MICRO_CONTROLLER
|
||||||
#include "devices\SMCDevice.h" // For SMC_COMMAND_SCRATCH
|
#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 "core\kernel\memory-manager\VMManager.h"
|
||||||
|
|
||||||
#include <algorithm> // for std::replace
|
#include <algorithm> // for std::replace
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include <ntstatus.h>
|
#include <ntstatus.h>
|
||||||
#pragma warning(default:4005)
|
#pragma warning(default:4005)
|
||||||
#include "Logging.h"
|
#include "Logging.h"
|
||||||
#include "common/util/strConverter.hpp" // utf16_to_ascii
|
|
||||||
#include "common/util/cliConfig.hpp"
|
#include "common/util/cliConfig.hpp"
|
||||||
#include "common/CxbxDebugger.h"
|
#include "common/CxbxDebugger.h"
|
||||||
#include "EmuShared.h"
|
#include "EmuShared.h"
|
||||||
|
@ -790,20 +789,21 @@ std::string CxbxConvertXboxToHostPath(const std::string_view XboxDevicePath)
|
||||||
std::wstring wXbePath;
|
std::wstring wXbePath;
|
||||||
// We pretend to come from NtCreateFile to force symbolic link resolution
|
// We pretend to come from NtCreateFile to force symbolic link resolution
|
||||||
CxbxConvertFilePath(XboxDevicePath.data(), wXbePath, &rootDirectoryHandle, "NtCreateFile");
|
CxbxConvertFilePath(XboxDevicePath.data(), wXbePath, &rootDirectoryHandle, "NtCreateFile");
|
||||||
|
std::filesystem::path XbePath;
|
||||||
// Convert Wide String as returned by above to a string, for XbePath
|
|
||||||
std::string XbePath = utf16_to_ascii(wXbePath.c_str());
|
|
||||||
|
|
||||||
// If the rootDirectoryHandle is not null, we have a relative path
|
// 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
|
// We need to prepend the path of the root directory to get a full DOS path
|
||||||
if (rootDirectoryHandle != nullptr) {
|
if (rootDirectoryHandle != nullptr) {
|
||||||
WCHAR directoryPathBuffer[MAX_PATH];
|
WCHAR directoryPathBuffer[MAX_PATH];
|
||||||
GetFinalPathNameByHandleW(rootDirectoryHandle, directoryPathBuffer, MAX_PATH, VOLUME_NAME_DOS);
|
GetFinalPathNameByHandleW(rootDirectoryHandle, directoryPathBuffer, MAX_PATH, VOLUME_NAME_DOS);
|
||||||
std::string directoryPath = utf16_to_ascii(directoryPathBuffer);
|
XbePath = directoryPathBuffer;
|
||||||
XbePath = directoryPath + std::string("\\") + XbePath;
|
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)
|
int CxbxRegisterDeviceHostPath(const std::string_view XboxDevicePath, std::string HostDevicePath, bool IsFile, std::size_t size)
|
||||||
|
|
Loading…
Reference in New Issue