mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-18 06:25:37 +00:00
Merge pull request #2555 from CookiePLMonster/cheat-list-fixes
Cheat list fixes
This commit is contained in:
commit
81ec359229
|
@ -179,6 +179,8 @@ void CheatManagerDialog::connectUi()
|
|||
connect(m_ui.watchTable, &QTableWidget::currentItemChanged, this, &CheatManagerDialog::watchCurrentItemChanged);
|
||||
connect(m_ui.scanTable, &QTableWidget::itemChanged, this, &CheatManagerDialog::scanItemChanged);
|
||||
connect(m_ui.watchTable, &QTableWidget::itemChanged, this, &CheatManagerDialog::watchItemChanged);
|
||||
|
||||
connect(QtHostInterface::GetInstance(), &QtHostInterface::cheatEnabled, this, &CheatManagerDialog::setCheatCheckState);
|
||||
}
|
||||
|
||||
void CheatManagerDialog::showEvent(QShowEvent* event)
|
||||
|
@ -488,12 +490,7 @@ void CheatManagerDialog::activateCheat(u32 index)
|
|||
}
|
||||
|
||||
const bool new_enabled = !cc.enabled;
|
||||
QTreeWidgetItem* item = getItemForCheatIndex(index);
|
||||
if (item)
|
||||
{
|
||||
QSignalBlocker sb(m_ui.cheatList);
|
||||
item->setCheckState(0, new_enabled ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
setCheatCheckState(index, new_enabled);
|
||||
|
||||
QtHostInterface::GetInstance()->executeOnEmulationThread([index, new_enabled]() {
|
||||
System::GetCheatList()->SetCodeEnabled(index, new_enabled);
|
||||
|
@ -501,6 +498,16 @@ void CheatManagerDialog::activateCheat(u32 index)
|
|||
});
|
||||
}
|
||||
|
||||
void CheatManagerDialog::setCheatCheckState(u32 index, bool checked)
|
||||
{
|
||||
QTreeWidgetItem* item = getItemForCheatIndex(index);
|
||||
if (item)
|
||||
{
|
||||
QSignalBlocker sb(m_ui.cheatList);
|
||||
item->setCheckState(0, checked ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
}
|
||||
|
||||
void CheatManagerDialog::newCategoryClicked()
|
||||
{
|
||||
QString group_name = QInputDialog::getText(this, tr("Add Group"), tr("Group Name:"));
|
||||
|
|
|
@ -31,6 +31,7 @@ private Q_SLOTS:
|
|||
void cheatListItemActivated(QTreeWidgetItem* item);
|
||||
void cheatListItemChanged(QTreeWidgetItem* item, int column);
|
||||
void activateCheat(u32 index);
|
||||
void setCheatCheckState(u32 index, bool checked);
|
||||
void newCategoryClicked();
|
||||
void addCodeClicked();
|
||||
void editCodeClicked();
|
||||
|
|
|
@ -1279,6 +1279,7 @@ void QtHostInterface::setCheatEnabled(quint32 index, bool enabled)
|
|||
}
|
||||
|
||||
SetCheatCodeState(index, enabled, g_settings.auto_load_cheats);
|
||||
emit cheatEnabled(index, enabled);
|
||||
}
|
||||
|
||||
void QtHostInterface::applyCheat(quint32 index)
|
||||
|
|
|
@ -148,6 +148,7 @@ Q_SIGNALS:
|
|||
void inputProfileLoaded();
|
||||
void mouseModeRequested(bool relative, bool hide_cursor);
|
||||
void achievementsLoaded(quint32 id, const QString& game_info_string, quint32 total, quint32 points);
|
||||
void cheatEnabled(quint32 index, bool enabled);
|
||||
|
||||
public Q_SLOTS:
|
||||
void setDefaultSettings();
|
||||
|
|
|
@ -3891,6 +3891,8 @@ void CommonHostInterface::SetCheatCodeState(u32 index, bool enabled, bool save_t
|
|||
return;
|
||||
|
||||
cc.enabled = enabled;
|
||||
if (!enabled)
|
||||
cc.ApplyOnDisable();
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue