From 6f0aef33449d2b33038c7578ebcbf8a7e7ba1c29 Mon Sep 17 00:00:00 2001 From: Dan McCarthy Date: Sun, 31 Dec 2023 20:40:14 -0600 Subject: [PATCH] Settings: Clearing settings disables Cheats/Patches The 'Clear Settings' button will now disable all cheats and patches from the configuration. This will allow quickly resetting to having no game altering pnach patches/cheats. --- pcsx2-qt/Settings/GameCheatSettingsWidget.cpp | 7 +++++++ pcsx2-qt/Settings/GameCheatSettingsWidget.h | 1 + pcsx2-qt/Settings/GamePatchSettingsWidget.cpp | 7 +++++++ pcsx2-qt/Settings/GamePatchSettingsWidget.h | 1 + pcsx2-qt/Settings/SettingsWindow.cpp | 3 +++ 5 files changed, 19 insertions(+) diff --git a/pcsx2-qt/Settings/GameCheatSettingsWidget.cpp b/pcsx2-qt/Settings/GameCheatSettingsWidget.cpp index e9ac456ab2762..c0d39e18c6d8f 100644 --- a/pcsx2-qt/Settings/GameCheatSettingsWidget.cpp +++ b/pcsx2-qt/Settings/GameCheatSettingsWidget.cpp @@ -80,6 +80,13 @@ void GameCheatSettingsWidget::updateListEnabled() m_ui.reloadCheats->setEnabled(cheats_enabled); } +void GameCheatSettingsWidget::disableAllCheats() +{ + SettingsInterface* si = m_dialog->getSettingsInterface(); + si->ClearSection(Patch::CHEATS_CONFIG_SECTION); + si->Save(); +} + void GameCheatSettingsWidget::setCheatEnabled(std::string name, bool enabled, bool save_and_reload_settings) { SettingsInterface* si = m_dialog->getSettingsInterface(); diff --git a/pcsx2-qt/Settings/GameCheatSettingsWidget.h b/pcsx2-qt/Settings/GameCheatSettingsWidget.h index d683fcab66d08..24b220dc76652 100644 --- a/pcsx2-qt/Settings/GameCheatSettingsWidget.h +++ b/pcsx2-qt/Settings/GameCheatSettingsWidget.h @@ -28,6 +28,7 @@ class GameCheatSettingsWidget : public QWidget public: GameCheatSettingsWidget(SettingsWindow* dialog, QWidget* parent); + void disableAllCheats(); ~GameCheatSettingsWidget(); private Q_SLOTS: diff --git a/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp b/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp index b20478177b20c..4503db49d183e 100644 --- a/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp +++ b/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp @@ -71,6 +71,13 @@ void GamePatchSettingsWidget::onReloadClicked() g_emu_thread->reloadPatches(); } +void GamePatchSettingsWidget::disableAllPatches() +{ + SettingsInterface* si = m_dialog->getSettingsInterface(); + si->ClearSection(Patch::PATCHES_CONFIG_SECTION); + si->Save(); +} + void GamePatchSettingsWidget::reloadList() { // Patches shouldn't have any unlabelled patch groups, because they're new. diff --git a/pcsx2-qt/Settings/GamePatchSettingsWidget.h b/pcsx2-qt/Settings/GamePatchSettingsWidget.h index bd00c65f75fef..dab179be33301 100644 --- a/pcsx2-qt/Settings/GamePatchSettingsWidget.h +++ b/pcsx2-qt/Settings/GamePatchSettingsWidget.h @@ -41,6 +41,7 @@ class GamePatchSettingsWidget : public QWidget public: GamePatchSettingsWidget(SettingsWindow* dialog, QWidget* parent); + void disableAllPatches(); ~GamePatchSettingsWidget(); private Q_SLOTS: diff --git a/pcsx2-qt/Settings/SettingsWindow.cpp b/pcsx2-qt/Settings/SettingsWindow.cpp index 4939cc1b32189..f2dd5e1b26705 100644 --- a/pcsx2-qt/Settings/SettingsWindow.cpp +++ b/pcsx2-qt/Settings/SettingsWindow.cpp @@ -314,6 +314,9 @@ void SettingsWindow::onClearSettingsClicked() return; } + m_game_cheat_settings_widget->disableAllCheats(); + m_game_patch_settings_widget->disableAllPatches(); + Pcsx2Config::ClearConfiguration(m_sif.get()); m_sif->Save(); g_emu_thread->reloadGameSettings();