Skip to content

Commit

Permalink
Cheats: Retain enabled state when updating existing cheat.
Browse files Browse the repository at this point in the history
Fix inverted logic in Qt cheat window.
  • Loading branch information
bearoso committed May 19, 2024
1 parent 8f41776 commit 738e539
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cheats2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,14 @@ int S9xModifyCheatGroup(uint32 num, const std::string &name, const std::string &
if (num >= Cheat.group.size())
return -1;

bool enabled = Cheat.group[num].enabled;
S9xDisableCheatGroup(num);

Cheat.group[num] = S9xCreateCheatGroup(name, cheat);

if (enabled)
S9xEnableCheatGroup(num);

return num;
}

Expand Down
2 changes: 1 addition & 1 deletion qt/src/CheatsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void CheatsDialog::addCode()
if (description.empty())
description = tr("No description").toStdString();

if (app->addCheat(description, code))
if (!app->addCheat(description, code))
{
QMessageBox::information(this, tr("Invalid Cheat"), tr("The cheat you entered was not valid."));
return;
Expand Down

0 comments on commit 738e539

Please sign in to comment.