Wx: Fix widescreen patch loading

This commit is contained in:
Connor McLaughlin 2022-04-15 23:07:20 +10:00 committed by refractionpcsx2
parent 0e9dcf74b2
commit ecdbe17fba
2 changed files with 8 additions and 3 deletions

View File

@ -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<int>(name.size()), name.data());
const std::optional<std::string> 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<int>(name.size()), name.data());
}

View File

@ -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);