CDVD: Warn the user when a selected game image is on a removable drive.

This commit is contained in:
Ty Lamontagne 2022-12-21 15:15:42 -05:00 committed by refractionpcsx2
parent 70982f6969
commit cc391e1a9e
1 changed files with 16 additions and 0 deletions

View File

@ -37,6 +37,7 @@
#include "DebugTools/SymbolMap.h"
#include "Config.h"
#include "Host.h"
#include "IconsFontAwesome5.h"
CDVD_API* CDVD = NULL;
@ -303,6 +304,21 @@ static CDVD_SourceType m_CurrentSourceType = CDVD_SourceType::NoDisc;
void CDVDsys_SetFile(CDVD_SourceType srctype, std::string newfile)
{
#ifdef WIN32
if (Path::IsAbsolute(newfile))
{
const auto splitPath = Path::SplitNativePath(newfile);
// GetDriveType() Requires trailing backslashes
const auto root = fmt::format("{}\\", splitPath.at(0));
const auto driveType = GetDriveType(StringUtil::UTF8StringToWideString(root).c_str());
if (driveType == DRIVE_REMOVABLE)
{
Host::AddIconOSDMessage("RemovableDriveWarning", ICON_FA_EXCLAMATION_TRIANGLE, "Game disc location is on a removable drive, performance issues such as jittering and freezing may occur.", Host::OSD_WARNING_DURATION);
}
}
#endif
m_SourceFilename[enum_cast(srctype)] = std::move(newfile);
// look for symbol file