From ecdbe17fba931af474095d28c2a483f1aa7d8223 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 15 Apr 2022 23:07:20 +1000 Subject: [PATCH] Wx: Fix widescreen patch loading --- pcsx2/Patch.cpp | 7 ++++++- pcsx2/gui/AppCoreThread.cpp | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pcsx2/Patch.cpp b/pcsx2/Patch.cpp index 2b9d9e55db..3b19f89f82 100644 --- a/pcsx2/Patch.cpp +++ b/pcsx2/Patch.cpp @@ -174,7 +174,7 @@ int LoadPatchesFromDir(const std::string& crc, const wxDirName& folder, const ch } FileSystem::FindResultsArray files; - FileSystem::FindFiles(folder.ToUTF8(), StringUtil::StdStringFromFormat("%s*.pnach", crc.c_str()).c_str(), + FileSystem::FindFiles(folder.ToUTF8(), StringUtil::StdStringFromFormat("*.pnach", crc.c_str()).c_str(), FILESYSTEM_FIND_FILES | FILESYSTEM_FIND_HIDDEN_FILES, &files); if (show_error_when_missing && files.empty()) @@ -188,6 +188,9 @@ int LoadPatchesFromDir(const std::string& crc, const wxDirName& folder, const ch for (const FILESYSTEM_FIND_DATA& fd : files) { const std::string_view name(FileSystem::GetFileNameFromPath(fd.FileName)); + if (name.length() < crc.length() || StringUtil::Strncasecmp(name.data(), crc.c_str(), crc.size()) != 0) + continue; + PatchesCon->WriteLn(Color_Green, "Found %s file: '%.*s'", friendly_name, static_cast(name.size()), name.data()); const std::optional pnach_data(FileSystem::ReadFileToString(fd.FileName.c_str())); @@ -195,6 +198,8 @@ int LoadPatchesFromDir(const std::string& crc, const wxDirName& folder, const ch continue; const int loaded = LoadPatchesFromString(pnach_data.value()); + total_loaded += loaded; + PatchesCon->WriteLn((loaded ? Color_Green : Color_Gray), "Loaded %d %s from '%.*s'.", loaded, friendly_name, static_cast(name.size()), name.data()); } diff --git a/pcsx2/gui/AppCoreThread.cpp b/pcsx2/gui/AppCoreThread.cpp index 53930854a4..8ca6c4179f 100644 --- a/pcsx2/gui/AppCoreThread.cpp +++ b/pcsx2/gui/AppCoreThread.cpp @@ -364,7 +364,7 @@ static void _ApplySettings(const Pcsx2Config& src, Pcsx2Config& fixup) // settings as if the game is already running (title, loadeding patches, etc). bool ingame = (ElfCRC && (g_GameLoading || g_GameStarted)); if (ingame) - GameInfo::gameCRC.Printf(L"%8.8x", ElfCRC); + GameInfo::gameCRC.Printf(L"%8.8X", ElfCRC); else GameInfo::gameCRC = L""; // Needs to be reset when rebooting otherwise previously loaded patches may load @@ -465,7 +465,7 @@ static void _ApplySettings(const Pcsx2Config& src, Pcsx2Config& fixup) // to most users - with region, version, etc, so don't overwrite it with patch info. That's OK. Those // users which want to know the status of the patches at the bios can check the console content. wxString consoleTitle = GameInfo::gameName + L" [" + GameInfo::gameSerial + L"]"; - consoleTitle += L" [" + GameInfo::gameCRC.MakeUpper() + L"]" + gameCompat + gameFixes + gamePatch + gameCheats + gameWsHacks; + consoleTitle += L" [" + GameInfo::gameCRC + L"]" + gameCompat + gameFixes + gamePatch + gameCheats + gameWsHacks; if (ingame) Console.SetTitle(consoleTitle);