remove CheatList logic in Watch.Poke() methods. These were only happening 1) during CheatList.Pulse() which is uber bad, or 2) Ram poke tool in 1 place, which is easily done there instead

This commit is contained in:
adelikat 2020-05-30 11:11:47 -05:00
parent 0085fee935
commit 377567e2ba
4 changed files with 17 additions and 31 deletions

View File

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.Common;
@ -126,16 +125,6 @@ namespace BizHawk.Client.Common
break;
}
if (Global.CheatList.Contains(Domain, Address))
{
var cheat = Global.CheatList.FirstOrDefault(c => c.Address == Address && c.Domain == Domain);
if (cheat != (Cheat)null)
{
cheat.PokeValue(val);
}
}
PokeByte(val);
return true;
}

View File

@ -152,15 +152,6 @@ namespace BizHawk.Client.Common
break;
}
if (Global.CheatList.Contains(Domain, Address))
{
var cheat = Global.CheatList.FirstOrDefault(c => c.Address == Address && c.Domain == Domain);
if (cheat != (Cheat)null)
{
cheat.PokeValue((int)val);
}
}
PokeDWord(val);
return true;
}

View File

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.Common;
@ -135,15 +134,6 @@ namespace BizHawk.Client.Common
break;
}
if (Global.CheatList.Contains(Domain, Address))
{
var cheat = Global.CheatList.FirstOrDefault(c => c.Address == Address && c.Domain == Domain);
if (cheat != (Cheat)null)
{
cheat.PokeValue(val);
}
}
PokeWord(val);
return true;
}

View File

@ -91,7 +91,23 @@ namespace BizHawk.Client.EmuHawk
private void Ok_Click(object sender, EventArgs e)
{
var success = _watchList.All(watch => watch.Poke(ValueBox.Text));
var success = true;
foreach (var watch in _watchList)
{
var result = watch.Poke(ValueBox.Text);
if (result)
{
var cheat = Global.CheatList.FirstOrDefault(c => c.Address == watch.Address && c.Domain == watch.Domain);
if (cheat != (Cheat)null)
{
cheat.PokeValue(watch.Value);
}
}
else
{
success = false;
}
}
ParentTool?.UpdateValues(ToolFormUpdateType.General);