mirror of https://github.com/PCSX2/pcsx2.git
cdvd:windows: Fix disc path
The disc path was not always in the correct format. Fixes a regression from the CDVD merge.
This commit is contained in:
parent
33d8290fd4
commit
7f8ca17752
|
@ -189,6 +189,8 @@ s32 CALLBACK DISCopen(const char* pTitle)
|
||||||
std::string drive = g_Conf->Folders.RunDisc.GetPath().ToStdString();
|
std::string drive = g_Conf->Folders.RunDisc.GetPath().ToStdString();
|
||||||
#endif
|
#endif
|
||||||
GetValidDrive(drive);
|
GetValidDrive(drive);
|
||||||
|
if (drive.empty())
|
||||||
|
return -1;
|
||||||
|
|
||||||
// open device file
|
// open device file
|
||||||
try
|
try
|
||||||
|
|
|
@ -41,23 +41,19 @@ void GetValidDrive(std::wstring& drive)
|
||||||
auto drives = GetOpticalDriveList();
|
auto drives = GetOpticalDriveList();
|
||||||
if (drives.empty())
|
if (drives.empty())
|
||||||
{
|
{
|
||||||
drive = {};
|
drive.clear();
|
||||||
}
|
return;
|
||||||
else
|
|
||||||
{
|
|
||||||
drive = drives.front();
|
|
||||||
}
|
}
|
||||||
|
drive = drives.front();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
int size = WideCharToMultiByte(CP_UTF8, 0, drive.c_str(), -1, nullptr, 0, nullptr, nullptr);
|
|
||||||
std::vector<char> converted_string(size);
|
|
||||||
WideCharToMultiByte(CP_UTF8, 0, drive.c_str(), -1, converted_string.data(), converted_string.size(), nullptr, nullptr);
|
|
||||||
printf(" * CDVD: Opening drive '%s'...\n", converted_string.data());
|
|
||||||
|
|
||||||
// The drive string has the form "X:\", but to open the drive, the string
|
int size = WideCharToMultiByte(CP_UTF8, 0, drive.c_str(), -1, nullptr, 0, nullptr, nullptr);
|
||||||
// has to be in the form "\\.\X:"
|
std::vector<char> converted_string(size);
|
||||||
drive.pop_back();
|
WideCharToMultiByte(CP_UTF8, 0, drive.c_str(), -1, converted_string.data(), converted_string.size(), nullptr, nullptr);
|
||||||
drive.insert(0, L"\\\\.\\");
|
printf(" * CDVD: Opening drive '%s'...\n", converted_string.data());
|
||||||
}
|
|
||||||
}
|
// The drive string has the form "X:\", but to open the drive, the string
|
||||||
|
// has to be in the form "\\.\X:"
|
||||||
|
drive.pop_back();
|
||||||
|
drive.insert(0, L"\\\\.\\");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue