Refactor Lua and NES Game Genie to use new cheat system
This commit is contained in:
parent
5a0c075270
commit
a76dcd62b7
|
@ -127,6 +127,7 @@
|
||||||
this.CompareBox.Location = new System.Drawing.Point(87, 39);
|
this.CompareBox.Location = new System.Drawing.Point(87, 39);
|
||||||
this.CompareBox.MaxLength = 2;
|
this.CompareBox.MaxLength = 2;
|
||||||
this.CompareBox.Name = "CompareBox";
|
this.CompareBox.Name = "CompareBox";
|
||||||
|
this.CompareBox.Nullable = true;
|
||||||
this.CompareBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
this.CompareBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||||
this.CompareBox.Size = new System.Drawing.Size(27, 20);
|
this.CompareBox.Size = new System.Drawing.Size(27, 20);
|
||||||
this.CompareBox.TabIndex = 22;
|
this.CompareBox.TabIndex = 22;
|
||||||
|
@ -138,6 +139,7 @@
|
||||||
this.ValueBox.Location = new System.Drawing.Point(87, 65);
|
this.ValueBox.Location = new System.Drawing.Point(87, 65);
|
||||||
this.ValueBox.MaxLength = 2;
|
this.ValueBox.MaxLength = 2;
|
||||||
this.ValueBox.Name = "ValueBox";
|
this.ValueBox.Name = "ValueBox";
|
||||||
|
this.ValueBox.Nullable = true;
|
||||||
this.ValueBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
this.ValueBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||||
this.ValueBox.Size = new System.Drawing.Size(27, 20);
|
this.ValueBox.Size = new System.Drawing.Size(27, 20);
|
||||||
this.ValueBox.TabIndex = 23;
|
this.ValueBox.TabIndex = 23;
|
||||||
|
@ -149,6 +151,7 @@
|
||||||
this.AddressBox.Location = new System.Drawing.Point(75, 13);
|
this.AddressBox.Location = new System.Drawing.Point(75, 13);
|
||||||
this.AddressBox.MaxLength = 4;
|
this.AddressBox.MaxLength = 4;
|
||||||
this.AddressBox.Name = "AddressBox";
|
this.AddressBox.Name = "AddressBox";
|
||||||
|
this.AddressBox.Nullable = true;
|
||||||
this.AddressBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
this.AddressBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||||
this.AddressBox.Size = new System.Drawing.Size(39, 20);
|
this.AddressBox.Size = new System.Drawing.Size(39, 20);
|
||||||
this.AddressBox.TabIndex = 21;
|
this.AddressBox.TabIndex = 21;
|
||||||
|
@ -157,7 +160,7 @@
|
||||||
// AddCheat
|
// AddCheat
|
||||||
//
|
//
|
||||||
this.AddCheat.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.AddCheat.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.AddCheat.Location = new System.Drawing.Point(202, 235);
|
this.AddCheat.Location = new System.Drawing.Point(202, 230);
|
||||||
this.AddCheat.Name = "AddCheat";
|
this.AddCheat.Name = "AddCheat";
|
||||||
this.AddCheat.Size = new System.Drawing.Size(69, 21);
|
this.AddCheat.Size = new System.Drawing.Size(69, 21);
|
||||||
this.AddCheat.TabIndex = 33;
|
this.AddCheat.TabIndex = 33;
|
||||||
|
@ -361,7 +364,7 @@
|
||||||
this.groupBox1.Controls.Add(this.AddressBox);
|
this.groupBox1.Controls.Add(this.AddressBox);
|
||||||
this.groupBox1.Controls.Add(this.ValueBox);
|
this.groupBox1.Controls.Add(this.ValueBox);
|
||||||
this.groupBox1.Controls.Add(this.CompareBox);
|
this.groupBox1.Controls.Add(this.CompareBox);
|
||||||
this.groupBox1.Location = new System.Drawing.Point(31, 163);
|
this.groupBox1.Location = new System.Drawing.Point(31, 158);
|
||||||
this.groupBox1.Name = "groupBox1";
|
this.groupBox1.Name = "groupBox1";
|
||||||
this.groupBox1.Size = new System.Drawing.Size(126, 93);
|
this.groupBox1.Size = new System.Drawing.Size(126, 93);
|
||||||
this.groupBox1.TabIndex = 5;
|
this.groupBox1.TabIndex = 5;
|
||||||
|
@ -419,11 +422,12 @@
|
||||||
//
|
//
|
||||||
// menuStrip1
|
// menuStrip1
|
||||||
//
|
//
|
||||||
|
this.menuStrip1.ClickThrough = true;
|
||||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.optionsToolStripMenuItem});
|
this.optionsToolStripMenuItem});
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(302, 24);
|
this.menuStrip1.Size = new System.Drawing.Size(292, 24);
|
||||||
this.menuStrip1.TabIndex = 8;
|
this.menuStrip1.TabIndex = 8;
|
||||||
this.menuStrip1.Text = "menuStrip1";
|
this.menuStrip1.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
|
@ -470,7 +474,7 @@
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(302, 262);
|
this.ClientSize = new System.Drawing.Size(292, 260);
|
||||||
this.Controls.Add(this.ClearButton);
|
this.Controls.Add(this.ClearButton);
|
||||||
this.Controls.Add(this.Encoding);
|
this.Controls.Add(this.Encoding);
|
||||||
this.Controls.Add(this.groupBox1);
|
this.Controls.Add(this.groupBox1);
|
||||||
|
@ -481,7 +485,7 @@
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
|
||||||
this.MainMenuStrip = this.menuStrip1;
|
this.MainMenuStrip = this.menuStrip1;
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MaximumSize = new System.Drawing.Size(312, 295);
|
this.MaximumSize = new System.Drawing.Size(312, 302);
|
||||||
this.MinimumSize = new System.Drawing.Size(312, 295);
|
this.MinimumSize = new System.Drawing.Size(312, 295);
|
||||||
this.Name = "NESGameGenie";
|
this.Name = "NESGameGenie";
|
||||||
this.ShowIcon = false;
|
this.ShowIcon = false;
|
||||||
|
|
|
@ -9,11 +9,15 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
public partial class NESGameGenie : Form
|
public partial class NESGameGenie : Form
|
||||||
{
|
{
|
||||||
public int Address = -1;
|
public int? _address = null;
|
||||||
public int Value = -1;
|
public int? _value = null;
|
||||||
public int Compare = -1;
|
public int? _compare = null;
|
||||||
private readonly Dictionary<char, int> GameGenieTable = new Dictionary<char, int>();
|
private readonly Dictionary<char, int> GameGenieTable = new Dictionary<char, int>();
|
||||||
|
|
||||||
|
public int? Address { get { return _address; } }
|
||||||
|
public int? Value { get { return _value; } }
|
||||||
|
public int? Compare { get { return _compare; } }
|
||||||
|
|
||||||
public NESGameGenie()
|
public NESGameGenie()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
@ -42,7 +46,9 @@ namespace BizHawk.MultiClient
|
||||||
AddCheat.Enabled = false;
|
AddCheat.Enabled = false;
|
||||||
|
|
||||||
if (Global.Config.NESGGSaveWindowPosition && Global.Config.NESGGWndx >= 0 && Global.Config.NESGGWndy >= 0)
|
if (Global.Config.NESGGSaveWindowPosition && Global.Config.NESGGWndx >= 0 && Global.Config.NESGGWndy >= 0)
|
||||||
|
{
|
||||||
Location = new Point(Global.Config.NESGGWndx, Global.Config.NESGGWndy);
|
Location = new Point(Global.Config.NESGGWndx, Global.Config.NESGGWndy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveConfigSettings()
|
private void SaveConfigSettings()
|
||||||
|
@ -78,105 +84,118 @@ namespace BizHawk.MultiClient
|
||||||
//Char # | 1 | 2 | 3 | 4 | 5 | 6 |
|
//Char # | 1 | 2 | 3 | 4 | 5 | 6 |
|
||||||
//Bit # |3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|
|
//Bit # |3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|
|
||||||
//maps to|1|6|7|8|H|2|3|4|-|I|J|K|L|A|B|C|D|M|N|O|5|E|F|G|
|
//maps to|1|6|7|8|H|2|3|4|-|I|J|K|L|A|B|C|D|M|N|O|5|E|F|G|
|
||||||
Value = 0;
|
_value = 0;
|
||||||
Address = 0x8000;
|
_address = 0x8000;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
GameGenieTable.TryGetValue(code[0], out x);
|
GameGenieTable.TryGetValue(code[0], out x);
|
||||||
Value |= (x & 0x07);
|
_value |= (x & 0x07);
|
||||||
Value |= (x & 0x08) << 4;
|
_value |= (x & 0x08) << 4;
|
||||||
|
|
||||||
GameGenieTable.TryGetValue(code[1], out x);
|
GameGenieTable.TryGetValue(code[1], out x);
|
||||||
Value |= (x & 0x07) << 4;
|
_value |= (x & 0x07) << 4;
|
||||||
Address |= (x & 0x08) << 4;
|
_address |= (x & 0x08) << 4;
|
||||||
|
|
||||||
GameGenieTable.TryGetValue(code[2], out x);
|
GameGenieTable.TryGetValue(code[2], out x);
|
||||||
Address |= (x & 0x07) << 4;
|
_address |= (x & 0x07) << 4;
|
||||||
|
|
||||||
GameGenieTable.TryGetValue(code[3], out x);
|
GameGenieTable.TryGetValue(code[3], out x);
|
||||||
Address |= (x & 0x07) << 12;
|
_address |= (x & 0x07) << 12;
|
||||||
Address |= (x & 0x08);
|
_address |= (x & 0x08);
|
||||||
|
|
||||||
GameGenieTable.TryGetValue(code[4], out x);
|
GameGenieTable.TryGetValue(code[4], out x);
|
||||||
Address |= (x & 0x07);
|
_address |= (x & 0x07);
|
||||||
Address |= (x & 0x08) << 8;
|
_address |= (x & 0x08) << 8;
|
||||||
|
|
||||||
GameGenieTable.TryGetValue(code[5], out x);
|
GameGenieTable.TryGetValue(code[5], out x);
|
||||||
Address |= (x & 0x07) << 8;
|
_address |= (x & 0x07) << 8;
|
||||||
Value |= (x & 0x08);
|
_value |= (x & 0x08);
|
||||||
|
|
||||||
SetProperties();
|
SetProperties();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (code.Length == 8)
|
else if (code.Length == 8)
|
||||||
{
|
{
|
||||||
//Char # | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|
//Char # | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|
||||||
//Bit # |3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|
|
//Bit # |3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|
|
||||||
//maps to|1|6|7|8|H|2|3|4|-|I|J|K|L|A|B|C|D|M|N|O|%|E|F|G|!|^|&|*|5|@|#|$|
|
//maps to|1|6|7|8|H|2|3|4|-|I|J|K|L|A|B|C|D|M|N|O|%|E|F|G|!|^|&|*|5|@|#|$|
|
||||||
Value = 0;
|
_value = 0;
|
||||||
Address = 0x8000;
|
_address = 0x8000;
|
||||||
Compare = 0;
|
_compare = 0;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
GameGenieTable.TryGetValue(code[0], out x);
|
GameGenieTable.TryGetValue(code[0], out x);
|
||||||
Value |= (x & 0x07);
|
_value |= (x & 0x07);
|
||||||
Value |= (x & 0x08) << 4;
|
_value |= (x & 0x08) << 4;
|
||||||
|
|
||||||
GameGenieTable.TryGetValue(code[1], out x);
|
GameGenieTable.TryGetValue(code[1], out x);
|
||||||
Value |= (x & 0x07) << 4;
|
_value |= (x & 0x07) << 4;
|
||||||
Address |= (x & 0x08) << 4;
|
_address |= (x & 0x08) << 4;
|
||||||
|
|
||||||
GameGenieTable.TryGetValue(code[2], out x);
|
GameGenieTable.TryGetValue(code[2], out x);
|
||||||
Address |= (x & 0x07) << 4;
|
_address |= (x & 0x07) << 4;
|
||||||
|
|
||||||
GameGenieTable.TryGetValue(code[3], out x);
|
GameGenieTable.TryGetValue(code[3], out x);
|
||||||
Address |= (x & 0x07) << 12;
|
_address |= (x & 0x07) << 12;
|
||||||
Address |= (x & 0x08);
|
_address |= (x & 0x08);
|
||||||
|
|
||||||
GameGenieTable.TryGetValue(code[4], out x);
|
GameGenieTable.TryGetValue(code[4], out x);
|
||||||
Address |= (x & 0x07);
|
_address |= (x & 0x07);
|
||||||
Address |= (x & 0x08) << 8;
|
_address |= (x & 0x08) << 8;
|
||||||
|
|
||||||
GameGenieTable.TryGetValue(code[5], out x);
|
GameGenieTable.TryGetValue(code[5], out x);
|
||||||
Address |= (x & 0x07) << 8;
|
_address |= (x & 0x07) << 8;
|
||||||
Compare |= (x & 0x08);
|
_compare |= (x & 0x08);
|
||||||
|
|
||||||
GameGenieTable.TryGetValue(code[6], out x);
|
GameGenieTable.TryGetValue(code[6], out x);
|
||||||
Compare |= (x & 0x07);
|
_compare |= (x & 0x07);
|
||||||
Compare |= (x & 0x08) << 4;
|
_compare |= (x & 0x08) << 4;
|
||||||
|
|
||||||
GameGenieTable.TryGetValue(code[7], out x);
|
GameGenieTable.TryGetValue(code[7], out x);
|
||||||
Compare |= (x & 0x07) << 4;
|
_compare |= (x & 0x07) << 4;
|
||||||
Value |= (x & 0x08);
|
_value |= (x & 0x08);
|
||||||
SetProperties();
|
SetProperties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetProperties()
|
private void SetProperties()
|
||||||
{
|
{
|
||||||
if (Address >= 0)
|
if (_address.HasValue)
|
||||||
AddressBox.Text = String.Format("{0:X4}", Address);
|
{
|
||||||
|
AddressBox.SetFromRawInt(_address.Value);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
AddressBox.Text = "";
|
{
|
||||||
|
AddressBox.ResetText();
|
||||||
|
}
|
||||||
|
|
||||||
if (Compare >= 0)
|
if (_compare.HasValue)
|
||||||
CompareBox.Text = String.Format("{0:X2}", Compare);
|
{
|
||||||
|
CompareBox.SetFromRawInt(_compare.Value);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
CompareBox.Text = "";
|
{
|
||||||
|
CompareBox.ResetText();
|
||||||
if (Value >= 0)
|
}
|
||||||
ValueBox.Text = String.Format("{0:X2}", Value);
|
|
||||||
|
|
||||||
|
if (_value.HasValue)
|
||||||
|
{
|
||||||
|
ValueBox.SetFromRawInt(_value.Value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ValueBox.ResetText();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClearProperties()
|
private void ClearProperties()
|
||||||
{
|
{
|
||||||
Address = -1;
|
_address = _value = _compare = null;
|
||||||
Value = -1;
|
|
||||||
Compare = -1;
|
AddressBox.Text =
|
||||||
AddressBox.Text = "";
|
CompareBox.Text =
|
||||||
CompareBox.Text = "";
|
ValueBox.Text =
|
||||||
ValueBox.Text = "";
|
String.Empty;
|
||||||
|
|
||||||
AddCheat.Enabled = false;
|
AddCheat.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +247,7 @@ namespace BizHawk.MultiClient
|
||||||
int a = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
int a = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
||||||
if (ValueBox.Text.Length > 0)
|
if (ValueBox.Text.Length > 0)
|
||||||
{
|
{
|
||||||
Address = a;
|
_address = a;
|
||||||
EncodeGameGenie();
|
EncodeGameGenie();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,14 +265,14 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
if (ValueBox.Text.Length > 0 && AddressBox.Text.Length > 0)
|
if (ValueBox.Text.Length > 0 && AddressBox.Text.Length > 0)
|
||||||
{
|
{
|
||||||
Compare = c;
|
_compare = c;
|
||||||
EncodeGameGenie();
|
EncodeGameGenie();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Compare = -1;
|
_compare = -1;
|
||||||
EncodeGameGenie();
|
EncodeGameGenie();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,7 +296,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
if (AddressBox.Text.Length > 0)
|
if (AddressBox.Text.Length > 0)
|
||||||
{
|
{
|
||||||
Value = v;
|
_value = v;
|
||||||
EncodeGameGenie();
|
EncodeGameGenie();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,29 +308,29 @@ namespace BizHawk.MultiClient
|
||||||
private void EncodeGameGenie()
|
private void EncodeGameGenie()
|
||||||
{
|
{
|
||||||
char[] letters = { 'A', 'P', 'Z', 'L', 'G', 'I', 'T', 'Y', 'E', 'O', 'X', 'U', 'K', 'S', 'V', 'N' };
|
char[] letters = { 'A', 'P', 'Z', 'L', 'G', 'I', 'T', 'Y', 'E', 'O', 'X', 'U', 'K', 'S', 'V', 'N' };
|
||||||
if (Address >= 0x8000)
|
if (_address >= 0x8000)
|
||||||
Address -= 0x8000;
|
_address -= 0x8000;
|
||||||
GameGenieCode.Text = "";
|
GameGenieCode.Text = "";
|
||||||
byte[] num = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
byte[] num = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
num[0] = (byte)((Value & 7) + ((Value >> 4) & 8));
|
num[0] = (byte)((_value & 7) + ((_value >> 4) & 8));
|
||||||
num[1] = (byte)(((Value >> 4) & 7) + ((Address >> 4) & 8));
|
num[1] = (byte)(((_value >> 4) & 7) + ((_address >> 4) & 8));
|
||||||
num[2] = (byte)(((Address >> 4) & 7));
|
num[2] = (byte)(((_address >> 4) & 7));
|
||||||
num[3] = (byte)((Address >> 12) + (Address & 8));
|
num[3] = (byte)((_address >> 12) + (_address & 8));
|
||||||
num[4] = (byte)((Address & 7) + ((Address >> 8) & 8));
|
num[4] = (byte)((_address & 7) + ((_address >> 8) & 8));
|
||||||
num[5] = (byte)(((Address >> 8) & 7));
|
num[5] = (byte)(((_address >> 8) & 7));
|
||||||
|
|
||||||
if (Compare < 0 || CompareBox.Text.Length == 0)
|
if (_compare < 0 || CompareBox.Text.Length == 0)
|
||||||
{
|
{
|
||||||
num[5] += (byte)(Value & 8);
|
num[5] += (byte)(_value & 8);
|
||||||
for (int x = 0; x < 6; x++)
|
for (int x = 0; x < 6; x++)
|
||||||
GameGenieCode.Text += letters[num[x]];
|
GameGenieCode.Text += letters[num[x]];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
num[2] += 8;
|
num[2] += 8;
|
||||||
num[5] += (byte)(Compare & 8);
|
num[5] += (byte)(_compare & 8);
|
||||||
num[6] = (byte)((Compare & 7) + ((Compare >> 4) & 8));
|
num[6] = (byte)((_compare & 7) + ((_compare >> 4) & 8));
|
||||||
num[7] = (byte)(((Compare >> 4) & 7) + (Value & 8));
|
num[7] = (byte)(((_compare >> 4) & 7) + (_value & 8));
|
||||||
for (int x = 0; x < 8; x++)
|
for (int x = 0; x < 8; x++)
|
||||||
GameGenieCode.Text += letters[num[x]];
|
GameGenieCode.Text += letters[num[x]];
|
||||||
}
|
}
|
||||||
|
@ -334,39 +353,26 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
if (Global.Emulator is NES)
|
if (Global.Emulator is NES)
|
||||||
{
|
{
|
||||||
LegacyCheat c = new LegacyCheat { Name = GameGenieCode.Text };
|
if (String.IsNullOrWhiteSpace(AddressBox.Text) || (String.IsNullOrWhiteSpace(ValueBox.Text)))
|
||||||
|
|
||||||
if (String.IsNullOrWhiteSpace(AddressBox.Text))
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (String.IsNullOrWhiteSpace(ValueBox.Text))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
c.Address = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
|
||||||
c.Value = byte.Parse(ValueBox.Text, NumberStyles.HexNumber);
|
|
||||||
|
|
||||||
|
Watch watch = Watch.GenerateWatch(
|
||||||
|
Global.Emulator.MemoryDomains[1], /*System Bus*/
|
||||||
|
AddressBox.ToRawInt(),
|
||||||
|
Watch.WatchSize.Byte,
|
||||||
|
Watch.DisplayType.Hex,
|
||||||
|
String.Empty,
|
||||||
|
false);
|
||||||
|
|
||||||
|
int? compare = null;
|
||||||
if (!String.IsNullOrWhiteSpace(CompareBox.Text))
|
if (!String.IsNullOrWhiteSpace(CompareBox.Text))
|
||||||
{
|
{
|
||||||
try
|
compare = CompareBox.ToRawInt();
|
||||||
{
|
|
||||||
c.Compare = byte.Parse(CompareBox.Text, NumberStyles.HexNumber);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
c.Compare = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
c.Compare = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Domain = Global.Emulator.MemoryDomains[1]; //System Bus only
|
Global.CheatList.Add(new Cheat(watch, compare, enabled: true));
|
||||||
c.Enable();
|
|
||||||
|
|
||||||
Global.CheatList_Legacy.Add(c);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3008,21 +3008,17 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
NESGameGenie gg = new NESGameGenie();
|
NESGameGenie gg = new NESGameGenie();
|
||||||
gg.DecodeGameGenieCode(code);
|
gg.DecodeGameGenieCode(code);
|
||||||
if (gg.Address > 0 && gg.Value > 0)
|
if (gg.Address.HasValue && gg.Value.HasValue)
|
||||||
{
|
{
|
||||||
LegacyCheat c = new LegacyCheat
|
Watch watch = Watch.GenerateWatch(
|
||||||
{
|
Global.Emulator.MemoryDomains[1],
|
||||||
Name = code,
|
gg.Address.Value,
|
||||||
Domain = Global.Emulator.MemoryDomains[1],
|
Watch.WatchSize.Byte,
|
||||||
Address = gg.Address,
|
Watch.DisplayType.Hex,
|
||||||
Value = (byte) gg.Value
|
code,
|
||||||
};
|
false);
|
||||||
if (gg.Compare != -1)
|
|
||||||
{
|
Global.CheatList.Add(new Cheat(watch, gg._compare, enabled: true));
|
||||||
c.Compare = (byte)gg.Compare;
|
|
||||||
}
|
|
||||||
c.Enable();
|
|
||||||
Global.CheatList_Legacy.Add(c);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3033,20 +3029,10 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
NESGameGenie gg = new NESGameGenie();
|
NESGameGenie gg = new NESGameGenie();
|
||||||
gg.DecodeGameGenieCode(code);
|
gg.DecodeGameGenieCode(code);
|
||||||
if (gg.Address > 0 && gg.Value > 0)
|
if (gg.Address.HasValue && gg.Value.HasValue)
|
||||||
{
|
{
|
||||||
LegacyCheat c = new LegacyCheat
|
var cheats = Global.CheatList.Where(x => x.Address == gg._address);
|
||||||
{
|
Global.CheatList.RemoveRange(cheats);
|
||||||
Name = code,
|
|
||||||
Domain = Global.Emulator.MemoryDomains[1],
|
|
||||||
Address = gg.Address,
|
|
||||||
Value = (byte) gg.Value
|
|
||||||
};
|
|
||||||
if (gg.Compare != -1)
|
|
||||||
{
|
|
||||||
c.Compare = (byte)gg.Compare;
|
|
||||||
}
|
|
||||||
Global.CheatList_Legacy.Remove(Global.Emulator.MemoryDomains[1], c.Address);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue