This commit is contained in:
adelikat 2020-02-29 11:48:43 -06:00
parent 7771b968c9
commit 1e9b7555ac
2 changed files with 24 additions and 35 deletions

View File

@ -17,8 +17,7 @@ namespace BizHawk.Client.Common.cheats
public int Address { get; private set; }
public int Value { get; private set; }
// TODO: WatchSize
public int ByteSize { get; private set; } = 1;
public WatchSize Size { get; private set; } = WatchSize.Word;
// 30XXXXXX 00YY
public void Decode()
@ -39,26 +38,26 @@ namespace BizHawk.Client.Common.cheats
}
var type = _code.Substring(0, 2);
ByteSize = type switch
Size = type switch
{
"10" => 2,
"11" => 2,
"20" => 1,
"21" => 1,
"30" => 1,
"80" => 2,
"D0" => 2,
"D1" => 2,
"D2" => 2,
"D3" => 2,
"D4" => 2,
"D5" => 2,
"D6" => 2,
"E0" => 1,
"E1" => 1,
"E2" => 1,
"E3" => 1,
_ => 1
"10" => WatchSize.Word,
"11" => WatchSize.Word,
"20" => WatchSize.Byte,
"21" => WatchSize.Byte,
"30" => WatchSize.Byte,
"80" => WatchSize.Word,
"D0" => WatchSize.Word,
"D1" => WatchSize.Word,
"D2" => WatchSize.Word,
"D3" => WatchSize.Word,
"D4" => WatchSize.Word,
"D5" => WatchSize.Word,
"D6" => WatchSize.Word,
"E0" => WatchSize.Byte,
"E1" => WatchSize.Byte,
"E2" => WatchSize.Byte,
"E3" => WatchSize.Byte,
_ => WatchSize.Byte
};
var s = _code.Remove(0, 2);

View File

@ -2418,23 +2418,13 @@ namespace BizHawk.Client.EmuHawk
return;
}
var decoder = new PsxGameSharkDecoder(cheat);
try
{
// A Watch needs to be generated so we can make a cheat out of that. This is due to how the Cheat engine works.
// System Bus Domain, The Address to Watch, Byte size (Word), Hex Display, Description. Big Endian.
var decoder = new PsxGameSharkDecoder(cheat);
// My Concern is that Work RAM High may be incorrect?
if (decoder.ByteSize == 1)
{
var watch = Watch.GenerateWatch(MemoryDomains["MainRAM"], decoder.Address, WatchSize.Byte, Common.DisplayType.Hex, false, txtDescription.Text);
Global.CheatList.Add(new Cheat(watch, decoder.Value));
}
else
{
var watch = Watch.GenerateWatch(MemoryDomains["MainRAM"], decoder.Address, WatchSize.Word, Common.DisplayType.Hex, false, txtDescription.Text);
Global.CheatList.Add(new Cheat(watch, decoder.Value));
}
var watch = Watch.GenerateWatch(MemoryDomains["MainRAM"], decoder.Address, decoder.Size, Common.DisplayType.Hex, false, txtDescription.Text);
Global.CheatList.Add(new Cheat(watch, decoder.Value));
}
catch (Exception ex)
{