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.watchTable, &QTableWidget::currentItemChanged, this, &CheatManagerDialog::watchCurrentItemChanged);
|
||||||
connect(m_ui.scanTable, &QTableWidget::itemChanged, this, &CheatManagerDialog::scanItemChanged);
|
connect(m_ui.scanTable, &QTableWidget::itemChanged, this, &CheatManagerDialog::scanItemChanged);
|
||||||
connect(m_ui.watchTable, &QTableWidget::itemChanged, this, &CheatManagerDialog::watchItemChanged);
|
connect(m_ui.watchTable, &QTableWidget::itemChanged, this, &CheatManagerDialog::watchItemChanged);
|
||||||
|
|
||||||
|
connect(QtHostInterface::GetInstance(), &QtHostInterface::cheatEnabled, this, &CheatManagerDialog::setCheatCheckState);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheatManagerDialog::showEvent(QShowEvent* event)
|
void CheatManagerDialog::showEvent(QShowEvent* event)
|
||||||
|
@ -488,12 +490,7 @@ void CheatManagerDialog::activateCheat(u32 index)
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool new_enabled = !cc.enabled;
|
const bool new_enabled = !cc.enabled;
|
||||||
QTreeWidgetItem* item = getItemForCheatIndex(index);
|
setCheatCheckState(index, new_enabled);
|
||||||
if (item)
|
|
||||||
{
|
|
||||||
QSignalBlocker sb(m_ui.cheatList);
|
|
||||||
item->setCheckState(0, new_enabled ? Qt::Checked : Qt::Unchecked);
|
|
||||||
}
|
|
||||||
|
|
||||||
QtHostInterface::GetInstance()->executeOnEmulationThread([index, new_enabled]() {
|
QtHostInterface::GetInstance()->executeOnEmulationThread([index, new_enabled]() {
|
||||||
System::GetCheatList()->SetCodeEnabled(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()
|
void CheatManagerDialog::newCategoryClicked()
|
||||||
{
|
{
|
||||||
QString group_name = QInputDialog::getText(this, tr("Add Group"), tr("Group Name:"));
|
QString group_name = QInputDialog::getText(this, tr("Add Group"), tr("Group Name:"));
|
||||||
|
|
|
@ -31,6 +31,7 @@ private Q_SLOTS:
|
||||||
void cheatListItemActivated(QTreeWidgetItem* item);
|
void cheatListItemActivated(QTreeWidgetItem* item);
|
||||||
void cheatListItemChanged(QTreeWidgetItem* item, int column);
|
void cheatListItemChanged(QTreeWidgetItem* item, int column);
|
||||||
void activateCheat(u32 index);
|
void activateCheat(u32 index);
|
||||||
|
void setCheatCheckState(u32 index, bool checked);
|
||||||
void newCategoryClicked();
|
void newCategoryClicked();
|
||||||
void addCodeClicked();
|
void addCodeClicked();
|
||||||
void editCodeClicked();
|
void editCodeClicked();
|
||||||
|
|
|
@ -1279,6 +1279,7 @@ void QtHostInterface::setCheatEnabled(quint32 index, bool enabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCheatCodeState(index, enabled, g_settings.auto_load_cheats);
|
SetCheatCodeState(index, enabled, g_settings.auto_load_cheats);
|
||||||
|
emit cheatEnabled(index, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtHostInterface::applyCheat(quint32 index)
|
void QtHostInterface::applyCheat(quint32 index)
|
||||||
|
|
|
@ -148,6 +148,7 @@ Q_SIGNALS:
|
||||||
void inputProfileLoaded();
|
void inputProfileLoaded();
|
||||||
void mouseModeRequested(bool relative, bool hide_cursor);
|
void mouseModeRequested(bool relative, bool hide_cursor);
|
||||||
void achievementsLoaded(quint32 id, const QString& game_info_string, quint32 total, quint32 points);
|
void achievementsLoaded(quint32 id, const QString& game_info_string, quint32 total, quint32 points);
|
||||||
|
void cheatEnabled(quint32 index, bool enabled);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void setDefaultSettings();
|
void setDefaultSettings();
|
||||||
|
|
|
@ -3891,6 +3891,8 @@ void CommonHostInterface::SetCheatCodeState(u32 index, bool enabled, bool save_t
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cc.enabled = enabled;
|
cc.enabled = enabled;
|
||||||
|
if (!enabled)
|
||||||
|
cc.ApplyOnDisable();
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue