Skip to content

Commit

Permalink
Settings: Clearing settings disables Cheats/Patches
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Daniel-McCarthy authored and refractionpcsx2 committed Jan 4, 2024
1 parent 85c3a41 commit 6f0aef3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pcsx2-qt/Settings/GameCheatSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions pcsx2-qt/Settings/GameCheatSettingsWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class GameCheatSettingsWidget : public QWidget

public:
GameCheatSettingsWidget(SettingsWindow* dialog, QWidget* parent);
void disableAllCheats();
~GameCheatSettingsWidget();

private Q_SLOTS:
Expand Down
7 changes: 7 additions & 0 deletions pcsx2-qt/Settings/GamePatchSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions pcsx2-qt/Settings/GamePatchSettingsWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class GamePatchSettingsWidget : public QWidget

public:
GamePatchSettingsWidget(SettingsWindow* dialog, QWidget* parent);
void disableAllPatches();
~GamePatchSettingsWidget();

private Q_SLOTS:
Expand Down
3 changes: 3 additions & 0 deletions pcsx2-qt/Settings/SettingsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 6f0aef3

Please sign in to comment.