Cheats - when editing a cheat's domain, if the address is out of range, don't update, rather than create a separator, fixes #539

This commit is contained in:
adelikat 2016-11-12 09:00:11 -06:00
parent 175862a5f3
commit 0213755d16
2 changed files with 46 additions and 44 deletions

View File

@ -309,9 +309,7 @@ namespace BizHawk.Client.EmuHawk
get { return _cheat; } get { return _cheat; }
} }
public Cheat Cheat public Cheat GetCheat()
{
get
{ {
Cheat.COMPARISONTYPE comparisonType = Cheat.COMPARISONTYPE.NONE; Cheat.COMPARISONTYPE comparisonType = Cheat.COMPARISONTYPE.NONE;
var domain = MemoryDomains[DomainDropDown.SelectedItem.ToString()]; var domain = MemoryDomains[DomainDropDown.SelectedItem.ToString()];
@ -357,7 +355,6 @@ namespace BizHawk.Client.EmuHawk
return Cheat.Separator; return Cheat.Separator;
} }
} }
}
public void SetAddEvent(Action addCallback) public void SetAddEvent(Action addCallback)
{ {

View File

@ -177,17 +177,22 @@ namespace BizHawk.Client.EmuHawk
private void AddCheat() private void AddCheat()
{ {
Global.CheatList.Add(CheatEditor.Cheat); Global.CheatList.Add(CheatEditor.GetCheat());
UpdateDialog(); UpdateDialog();
UpdateMessageLabel(); UpdateMessageLabel();
} }
private void EditCheat() private void EditCheat()
{ {
Global.CheatList.Exchange(CheatEditor.OriginalCheat, CheatEditor.Cheat); var newCheat = CheatEditor.GetCheat();
if (!newCheat.IsSeparator) // If a separator comes from the cheat editor something must have been invalid
{
Global.CheatList.Exchange(CheatEditor.OriginalCheat, newCheat);
UpdateDialog(); UpdateDialog();
UpdateMessageLabel(); UpdateMessageLabel();
} }
}
public void SaveConfigSettings() public void SaveConfigSettings()
{ {