From f8cd1d3d92a806b53e43266dbf1bdf7c12600763 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 25 Apr 2025 15:54:34 +1000 Subject: [PATCH] Qt: Warn on cheat enable if gamesettings disabled --- .../gamecheatsettingswidget.cpp | 73 ++++++++++++++----- 1 file changed, 55 insertions(+), 18 deletions(-) diff --git a/src/duckstation-qt/gamecheatsettingswidget.cpp b/src/duckstation-qt/gamecheatsettingswidget.cpp index 15748a34a..c31227565 100644 --- a/src/duckstation-qt/gamecheatsettingswidget.cpp +++ b/src/duckstation-qt/gamecheatsettingswidget.cpp @@ -386,29 +386,66 @@ bool GameCheatSettingsWidget::shouldLoadFromDatabase() const void GameCheatSettingsWidget::checkForMasterDisable() { - if (m_dialog->getSettingsInterface()->GetBoolValue("Cheats", "EnableCheats", false) || m_master_enable_ignored) + const bool game_settings_enabled = Host::GetBaseBoolSettingValue("Main", "ApplyGameSettings", true); + const bool cheats_enabled = m_dialog->getSettingsInterface()->GetBoolValue("Cheats", "EnableCheats", false); + if (m_master_enable_ignored || (game_settings_enabled && cheats_enabled)) return; - QMessageBox mbox(this); - mbox.setIcon(QMessageBox::Warning); - mbox.setWindowTitle(tr("Confirm Cheat Enable")); - mbox.setWindowIcon(QtHost::GetAppIcon()); - mbox.setTextFormat(Qt::RichText); - mbox.setText(tr("

Cheats are not currently enabled for this game.

Enabling this cheat will not have any " - "effect until cheats are enabled for this game. Do you want to do this now?")); + if (!game_settings_enabled) + { + QMessageBox mbox(this); + mbox.setIcon(QMessageBox::Warning); + mbox.setWindowTitle(tr("Confirm Game Settings Enable")); + mbox.setWindowIcon(QtHost::GetAppIcon()); + mbox.setTextFormat(Qt::RichText); + mbox.setText( + tr("

Game settings are currently disabled.

This is not the default. Enabling this " + "cheat will not have any effect until game settings are enabled. Do you want to do this now?")); - mbox.addButton(QMessageBox::Yes); - mbox.addButton(QMessageBox::No); + mbox.addButton(QMessageBox::Yes); + mbox.addButton(QMessageBox::No); - QCheckBox* cb = new QCheckBox(&mbox); - cb->setText(tr("Do not show again")); - mbox.setCheckBox(cb); + QCheckBox* cb = new QCheckBox(&mbox); + cb->setText(tr("Do not show again")); + mbox.setCheckBox(cb); - const int res = mbox.exec(); - if (res == QMessageBox::No) - m_master_enable_ignored = cb->isChecked(); - else - m_ui.enableCheats->setChecked(true); + const int res = mbox.exec(); + if (res == QMessageBox::No) + { + m_master_enable_ignored = cb->isChecked(); + } + else + { + Host::SetBaseBoolSettingValue("Main", "ApplyGameSettings", true); + Host::CommitBaseSettingChanges(); + g_emu_thread->applySettings(false); + } + } + + if (!cheats_enabled) + { + QMessageBox mbox(this); + mbox.setIcon(QMessageBox::Warning); + mbox.setWindowTitle(tr("Confirm Cheat Enable")); + mbox.setWindowIcon(QtHost::GetAppIcon()); + mbox.setTextFormat(Qt::RichText); + mbox.setText(tr("

Cheats are not currently enabled for this game.

Enabling this cheat will not have any " + "effect until cheats are enabled for this game. Do you want to do this now?")); + + mbox.addButton(QMessageBox::Yes); + mbox.addButton(QMessageBox::No); + + QCheckBox* cb = new QCheckBox(&mbox); + cb->setText(tr("Do not show again")); + cb->setChecked(m_master_enable_ignored); + mbox.setCheckBox(cb); + + const int res = mbox.exec(); + if (res == QMessageBox::No) + m_master_enable_ignored = cb->isChecked(); + else + m_ui.enableCheats->setChecked(true); + } } Cheats::CodeInfo* GameCheatSettingsWidget::getSelectedCode()