diff --git a/BizHawk.Client.Common/tools/CheatList.cs b/BizHawk.Client.Common/tools/CheatList.cs index 74f28a0c2b..ac029dddaf 100644 --- a/BizHawk.Client.Common/tools/CheatList.cs +++ b/BizHawk.Client.Common/tools/CheatList.cs @@ -164,6 +164,18 @@ namespace BizHawk.Client.Common Changes = true; } + public bool Exchange(Cheat oldCheat, Cheat newCheat) + { + int index = _cheatList.IndexOf(oldCheat); + if (index == -1) + return false; + + _cheatList[index] = newCheat; + Changes = true; + + return true; + } + public bool Remove(Cheat c) { var result = _cheatList.Remove(c); diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs index 5103fa18c2..c05f14fe22 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs @@ -178,8 +178,9 @@ namespace BizHawk.Client.EmuHawk private void EditCheat() { - Global.CheatList.Remove(CheatEditor.OriginalCheat); - AddCheat(); + Global.CheatList.Exchange(CheatEditor.OriginalCheat, CheatEditor.Cheat); + UpdateDialog(); + UpdateMessageLabel(); } public void SaveConfigSettings()