diff --git a/pcsx2-qt/Settings/GameCheatSettingsWidget.cpp b/pcsx2-qt/Settings/GameCheatSettingsWidget.cpp index c0d39e18c6..9dd2854dc8 100644 --- a/pcsx2-qt/Settings/GameCheatSettingsWidget.cpp +++ b/pcsx2-qt/Settings/GameCheatSettingsWidget.cpp @@ -23,6 +23,7 @@ GameCheatSettingsWidget::GameCheatSettingsWidget(SettingsWindow* dialog, QWidget SettingsInterface* sif = m_dialog->getSettingsInterface(); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableCheats, "EmuCore", "EnableCheats", false); + SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.allCRCsCheckbox, "EmuCore", "ShowCheatsForAllCRCs", false); updateListEnabled(); connect(m_ui.enableCheats, &QCheckBox::stateChanged, this, &GameCheatSettingsWidget::updateListEnabled); @@ -31,6 +32,7 @@ GameCheatSettingsWidget::GameCheatSettingsWidget(SettingsWindow* dialog, QWidget connect(m_ui.reloadCheats, &QPushButton::clicked, this, &GameCheatSettingsWidget::onReloadClicked); connect(m_ui.enableAll, &QPushButton::clicked, this, [this]() { setStateForAll(true); }); connect(m_ui.disableAll, &QPushButton::clicked, this, [this]() { setStateForAll(false); }); + connect(m_ui.allCRCsCheckbox, &QCheckBox::stateChanged, this, &GameCheatSettingsWidget::onReloadClicked); } GameCheatSettingsWidget::~GameCheatSettingsWidget() = default; @@ -78,6 +80,7 @@ void GameCheatSettingsWidget::updateListEnabled() m_ui.enableAll->setEnabled(cheats_enabled); m_ui.disableAll->setEnabled(cheats_enabled); m_ui.reloadCheats->setEnabled(cheats_enabled); + m_ui.allCRCsCheckbox->setEnabled(cheats_enabled); } void GameCheatSettingsWidget::disableAllCheats() @@ -145,7 +148,8 @@ void GameCheatSettingsWidget::setStateRecursively(QTreeWidgetItem* parent, bool void GameCheatSettingsWidget::reloadList() { u32 num_unlabelled_codes = 0; - m_patches = Patch::GetPatchInfo(m_dialog->getSerial(), m_dialog->getDiscCRC(), true, &num_unlabelled_codes); + bool showAllCRCS = m_ui.allCRCsCheckbox->isChecked(); + m_patches = Patch::GetPatchInfo(m_dialog->getSerial(), m_dialog->getDiscCRC(), true, showAllCRCS, & num_unlabelled_codes); m_enabled_patches = m_dialog->getSettingsInterface()->GetStringList(Patch::CHEATS_CONFIG_SECTION, Patch::PATCH_ENABLE_CONFIG_KEY); diff --git a/pcsx2-qt/Settings/GameCheatSettingsWidget.ui b/pcsx2-qt/Settings/GameCheatSettingsWidget.ui index a1f46535e6..495e6409dc 100644 --- a/pcsx2-qt/Settings/GameCheatSettingsWidget.ui +++ b/pcsx2-qt/Settings/GameCheatSettingsWidget.ui @@ -84,6 +84,16 @@ + + + + All CRCs + + + true + + + diff --git a/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp b/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp index 4503db49d1..0ef7bd7277 100644 --- a/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp +++ b/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp @@ -5,6 +5,7 @@ #include "QtHost.h" #include "QtUtils.h" #include "Settings/GamePatchSettingsWidget.h" +#include "SettingWidgetBinder.h" #include "Settings/SettingsWindow.h" #include "pcsx2/GameList.h" @@ -57,6 +58,9 @@ GamePatchSettingsWidget::GamePatchSettingsWidget(SettingsWindow* dialog, QWidget setUnlabeledPatchesWarningVisibility(false); connect(m_ui.reload, &QPushButton::clicked, this, &GamePatchSettingsWidget::onReloadClicked); + connect(m_ui.allCRCsCheckbox, &QCheckBox::stateChanged, this, &GamePatchSettingsWidget::onReloadClicked); + SettingsInterface* sif = m_dialog->getSettingsInterface(); + SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.allCRCsCheckbox, "EmuCore", "ShowPatchesForAllCRCs", false); reloadList(); } @@ -82,7 +86,8 @@ void GamePatchSettingsWidget::reloadList() { // Patches shouldn't have any unlabelled patch groups, because they're new. u32 number_of_unlabeled_patches = 0; - std::vector patches = Patch::GetPatchInfo(m_dialog->getSerial(), m_dialog->getDiscCRC(), false, &number_of_unlabeled_patches); + bool showAllCRCS = m_ui.allCRCsCheckbox->isChecked(); + std::vector patches = Patch::GetPatchInfo(m_dialog->getSerial(), m_dialog->getDiscCRC(), false, showAllCRCS, &number_of_unlabeled_patches); std::vector enabled_list = m_dialog->getSettingsInterface()->GetStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_ENABLE_CONFIG_KEY); diff --git a/pcsx2-qt/Settings/GamePatchSettingsWidget.ui b/pcsx2-qt/Settings/GamePatchSettingsWidget.ui index 3b00055279..39871b89d5 100644 --- a/pcsx2-qt/Settings/GamePatchSettingsWidget.ui +++ b/pcsx2-qt/Settings/GamePatchSettingsWidget.ui @@ -52,6 +52,19 @@ + + + + true + + + All CRCs + + + true + + + diff --git a/pcsx2/ImGui/FullscreenUI.cpp b/pcsx2/ImGui/FullscreenUI.cpp index 04fcd44217..acdd258326 100644 --- a/pcsx2/ImGui/FullscreenUI.cpp +++ b/pcsx2/ImGui/FullscreenUI.cpp @@ -2414,9 +2414,9 @@ void FullscreenUI::PopulatePatchesAndCheatsList(const std::string_view& serial, std::sort(list.begin(), list.end(), [](const Patch::PatchInfo& lhs, const Patch::PatchInfo& rhs) { return lhs.name < rhs.name; }); }; - s_game_patch_list = Patch::GetPatchInfo(serial, crc, false, nullptr); + s_game_patch_list = Patch::GetPatchInfo(serial, crc, false, true, nullptr); sort_patches(s_game_patch_list); - s_game_cheats_list = Patch::GetPatchInfo(serial, crc, true, &s_game_cheat_unlabelled_count); + s_game_cheats_list = Patch::GetPatchInfo(serial, crc, true, true, &s_game_cheat_unlabelled_count); sort_patches(s_game_cheats_list); pxAssert(s_game_settings_interface); diff --git a/pcsx2/Patch.cpp b/pcsx2/Patch.cpp index 4fdbaaee6d..a2957b11ab 100644 --- a/pcsx2/Patch.cpp +++ b/pcsx2/Patch.cpp @@ -518,14 +518,14 @@ std::string_view Patch::PatchInfo::GetNameParentPart() const return ret; } -Patch::PatchInfoList Patch::GetPatchInfo(const std::string_view& serial, u32 crc, bool cheats, u32* num_unlabelled_patches) +Patch::PatchInfoList Patch::GetPatchInfo(const std::string_view& serial, u32 crc, bool cheats, bool showAllCRCS, u32* num_unlabelled_patches) { PatchInfoList ret; if (num_unlabelled_patches) *num_unlabelled_patches = 0; - EnumeratePnachFiles(serial, crc, cheats, true, + EnumeratePnachFiles(serial, crc, cheats, showAllCRCS, [&ret, num_unlabelled_patches](const std::string& filename, const std::string& pnach_data) { ExtractPatchInfo(&ret, pnach_data, num_unlabelled_patches); }); diff --git a/pcsx2/Patch.h b/pcsx2/Patch.h index ebcc4aad85..e99ff26b70 100644 --- a/pcsx2/Patch.h +++ b/pcsx2/Patch.h @@ -81,7 +81,7 @@ namespace Patch extern const char* CHEATS_CONFIG_SECTION; extern const char* PATCH_ENABLE_CONFIG_KEY; - extern PatchInfoList GetPatchInfo(const std::string_view& serial, u32 crc, bool cheats, u32* num_unlabelled_patches); + extern PatchInfoList GetPatchInfo(const std::string_view& serial, u32 crc, bool cheats, bool showAllCRCS, u32* num_unlabelled_patches); /// Returns the path to a new cheat/patch pnach for the specified serial and CRC. extern std::string GetPnachFilename(const std::string_view& serial, u32 crc, bool cheats);