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();
|
||||
#endif
|
||||
GetValidDrive(drive);
|
||||
if (drive.empty())
|
||||
return -1;
|
||||
|
||||
// open device file
|
||||
try
|
||||
|
|
|
@ -41,23 +41,19 @@ void GetValidDrive(std::wstring& drive)
|
|||
auto drives = GetOpticalDriveList();
|
||||
if (drives.empty())
|
||||
{
|
||||
drive = {};
|
||||
}
|
||||
else
|
||||
{
|
||||
drive = drives.front();
|
||||
drive.clear();
|
||||
return;
|
||||
}
|
||||
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
|
||||
// has to be in the form "\\.\X:"
|
||||
drive.pop_back();
|
||||
drive.insert(0, L"\\\\.\\");
|
||||
}
|
||||
}
|
||||
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
|
||||
// has to be in the form "\\.\X:"
|
||||
drive.pop_back();
|
||||
drive.insert(0, L"\\\\.\\");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue