diff --git a/src/duckstation-qt/gamecheatsettingswidget.cpp b/src/duckstation-qt/gamecheatsettingswidget.cpp index 136ca1f85..9c3070664 100644 --- a/src/duckstation-qt/gamecheatsettingswidget.cpp +++ b/src/duckstation-qt/gamecheatsettingswidget.cpp @@ -288,6 +288,9 @@ void GameCheatSettingsWidget::onCheatListItemChanged(QTreeWidgetItem* item, int if (current_enabled == current_checked) return; + if (current_checked) + checkForMasterDisable(); + setCheatEnabled(std::move(cheat_name), current_checked, true); } @@ -337,6 +340,33 @@ bool GameCheatSettingsWidget::shouldLoadFromDatabase() const return m_dialog->getSettingsInterface()->GetBoolValue("Cheats", "LoadCheatsFromDatabase", true); } +void GameCheatSettingsWidget::checkForMasterDisable() +{ + if (m_dialog->getSettingsInterface()->GetBoolValue("Cheats", "EnableCheats", false) || m_master_enable_ignored) + return; + + QMessageBox mbox; + 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")); + 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() { const QList selected = m_ui.cheatList->selectedItems(); diff --git a/src/duckstation-qt/gamecheatsettingswidget.h b/src/duckstation-qt/gamecheatsettingswidget.h index 81964e7df..aad1d6367 100644 --- a/src/duckstation-qt/gamecheatsettingswidget.h +++ b/src/duckstation-qt/gamecheatsettingswidget.h @@ -60,6 +60,7 @@ private Q_SLOTS: private: bool shouldLoadFromDatabase() const; + void checkForMasterDisable(); Cheats::CodeInfo* getSelectedCode(); QTreeWidgetItem* getTreeWidgetParent(const std::string_view parent); @@ -78,6 +79,8 @@ private: UnorderedStringMap m_parent_map; Cheats::CodeInfoList m_codes; std::vector m_enabled_codes; + + bool m_master_enable_ignored = false; }; class CheatCodeEditorDialog : public QDialog