This commit is contained in:
adelikat 2020-02-29 10:09:57 -06:00
parent 82bfeaf61c
commit 5b3a93c25c
1 changed files with 12 additions and 10 deletions

View File

@ -2341,19 +2341,14 @@ namespace BizHawk.Client.EmuHawk
{
if (cheat.Length != 6 && cheat.Length != 8)
{
MessageBox.Show("Game Genie codes need to be six or eight characters in length.", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
InputError("Game Genie codes need to be six or eight characters in length.");
}
var description = Description(cheat);
var decoder = new NesGameGenieDecoder(cheat);
try
{
var description = cheat;
if (!string.IsNullOrWhiteSpace(txtDescription.Text))
{
description = txtDescription.Text;
}
var watch = Watch.GenerateWatch(MemoryDomains["System Bus"], decoder.Address, WatchSize.Byte, Common.DisplayType.Hex, false, description);
Global.CheatList.Add(
decoder.Compare.HasValue
@ -2447,13 +2442,13 @@ namespace BizHawk.Client.EmuHawk
// Address: 0D10BA
// Value: 0009
// Remove first two octets
var _parseString = cheat.Remove(0, 2);
var parseString = cheat.Remove(0, 2);
// Get RAM Address
_ramAddress = _parseString.Remove(6, 5);
_ramAddress = parseString.Remove(6, 5);
// Get RAM Value
_ramValue = _parseString.Remove(0, 7);
_ramValue = parseString.Remove(0, 7);
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.
@ -2623,5 +2618,12 @@ namespace BizHawk.Client.EmuHawk
{
MessageBox.Show(message, "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
private string Description(string cheat)
{
return !string.IsNullOrWhiteSpace(txtDescription.Text)
? txtDescription.Text
: cheat;
}
}
}