From 1a3c01154ac2d13d14166221bf0fcad946d3a216 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sun, 7 Mar 2021 21:42:38 +0100 Subject: [PATCH] make from_hdd0_game check lowercase --- rpcs3/Emu/System.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index b9a3fdbca6..123c8159d3 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -1197,9 +1197,19 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool // Detect boot location constexpr usz game_dir_size = 8; // size of PS3_GAME and PS3_GMXX - const std::string hdd0_game = vfs::get("/dev_hdd0/game/"); - const std::string hdd0_disc = vfs::get("/dev_hdd0/disc/"); - const bool from_hdd0_game = m_path.find(hdd0_game) != umax; + const std::string hdd0_game = vfs::get("/dev_hdd0/game/"); + const std::string hdd0_disc = vfs::get("/dev_hdd0/disc/"); + const bool from_hdd0_game = m_path.starts_with(hdd0_game); + +#ifdef _WIN32 + // m_path might be passed from command line with differences in uppercase/lowercase on windows. + if (!from_hdd0_game && fmt::to_lower(m_path).starts_with(fmt::to_lower(hdd0_game))) + { + // Let's just abort to prevent errors down the line. + sys_log.error("The boot path seems to contain incorrectly cased characters. Please adjust the path and try again."); + return game_boot_result::invalid_file_or_folder; + } +#endif // Mount /dev_bdvd/ if necessary if (bdvd_dir.empty() && disc.empty())