Cheats: Retain enabled state when updating existing cheat.

Fix inverted logic in Qt cheat window.
This commit is contained in:
BearOso 2024-05-18 19:25:33 -05:00
parent 8f41776532
commit 738e53989e
2 changed files with 5 additions and 1 deletions

View File

@ -518,10 +518,14 @@ int S9xModifyCheatGroup(uint32 num, const std::string &name, const std::string &
if (num >= Cheat.group.size()) if (num >= Cheat.group.size())
return -1; return -1;
bool enabled = Cheat.group[num].enabled;
S9xDisableCheatGroup(num); S9xDisableCheatGroup(num);
Cheat.group[num] = S9xCreateCheatGroup(name, cheat); Cheat.group[num] = S9xCreateCheatGroup(name, cheat);
if (enabled)
S9xEnableCheatGroup(num);
return num; return num;
} }

View File

@ -63,7 +63,7 @@ void CheatsDialog::addCode()
if (description.empty()) if (description.empty())
description = tr("No description").toStdString(); 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.")); QMessageBox::information(this, tr("Invalid Cheat"), tr("The cheat you entered was not valid."));
return; return;