More fixes to the cheats system

This commit is contained in:
adelikat 2013-10-14 02:26:06 +00:00
parent 0a0b8ac173
commit 0e934d5454
3 changed files with 20 additions and 13 deletions

View File

@ -217,6 +217,7 @@ namespace BizHawk.MultiClient
if (!IsSeparator) if (!IsSeparator)
{ {
_val++; _val++;
Pulse();
} }
} }
@ -225,6 +226,7 @@ namespace BizHawk.MultiClient
if (!IsSeparator) if (!IsSeparator)
{ {
_val--; _val--;
Pulse();
} }
} }

View File

@ -94,25 +94,30 @@ namespace BizHawk.MultiClient
{ {
if (_cheatList.Any(x => x.Domain == c.Domain && x.Address == c.Address)) if (_cheatList.Any(x => x.Domain == c.Domain && x.Address == c.Address))
{ {
var cheat = _cheatList.FirstOrDefault(x => x.Domain == c.Domain && x.Address == c.Address); _cheatList.FirstOrDefault(x => x.Domain == c.Domain && x.Address == c.Address).Enable();
cheat.Enable();
} }
else else
{ {
_changes = true;
_cheatList.Add(c); _cheatList.Add(c);
ToolHelpers.UpdateCheatRelatedTools();
} }
_changes = true;
ToolHelpers.UpdateCheatRelatedTools();
} }
public void Insert(int index, Cheat c) public void Insert(int index, Cheat c)
{ {
if (!_cheatList.Any(x => x.Domain == c.Domain && x.Address == c.Address)) if (_cheatList.Any(x => x.Domain == c.Domain && x.Address == c.Address))
{ {
_changes = true; _cheatList.FirstOrDefault(x => x.Domain == c.Domain && x.Address == c.Address).Enable();
_cheatList.Insert(index, c);
ToolHelpers.UpdateCheatRelatedTools();
} }
else
{
_cheatList.Insert(index, c);
}
_changes = true;
ToolHelpers.UpdateCheatRelatedTools();
} }
public void Remove(Cheat c) public void Remove(Cheat c)
@ -545,7 +550,7 @@ namespace BizHawk.MultiClient
sb sb
.Append(cheat.AddressStr).Append('\t') .Append(cheat.AddressStr).Append('\t')
.Append(cheat.ValueStr).Append('\t') .Append(cheat.ValueStr).Append('\t')
.Append(cheat.Compare.HasValue ? cheat.Compare.Value : 'N').Append('\t') .Append(cheat.Compare.HasValue ? cheat.Compare.Value.ToString() : "N").Append('\t')
.Append(cheat.Domain != null ? cheat.Domain.Name : String.Empty).Append('\t') .Append(cheat.Domain != null ? cheat.Domain.Name : String.Empty).Append('\t')
.Append(cheat.Enabled ? '1' : '0').Append('\t') .Append(cheat.Enabled ? '1' : '0').Append('\t')
.Append(cheat.Name).Append('\t') .Append(cheat.Name).Append('\t')

View File

@ -1692,8 +1692,8 @@ namespace BizHawk.MultiClient
{ {
if (Global.CheatList.IsActive(Domain, address)) if (Global.CheatList.IsActive(Domain, address))
{ {
var cheat = Global.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address); Global.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address).Increment();
cheat.Increment(); Global.CheatList.FlagChanges();
} }
else else
{ {
@ -1730,8 +1730,8 @@ namespace BizHawk.MultiClient
{ {
if (Global.CheatList.IsActive(Domain, address)) if (Global.CheatList.IsActive(Domain, address))
{ {
var cheat = Global.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address); Global.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address).Decrement();
cheat.Decrement(); Global.CheatList.FlagChanges();
} }
else else
{ {