NES Game Genie - implement Add Cheat button
This commit is contained in:
parent
851b350cd9
commit
3061c8ead8
|
@ -151,13 +151,13 @@
|
|||
//
|
||||
// AddCheat
|
||||
//
|
||||
this.AddCheat.Enabled = false;
|
||||
this.AddCheat.Location = new System.Drawing.Point(202, 217);
|
||||
this.AddCheat.Name = "AddCheat";
|
||||
this.AddCheat.Size = new System.Drawing.Size(69, 21);
|
||||
this.AddCheat.TabIndex = 3;
|
||||
this.AddCheat.Text = "Add Cheat";
|
||||
this.AddCheat.UseVisualStyleBackColor = true;
|
||||
this.AddCheat.Click += new System.EventHandler(this.AddCheat_Click);
|
||||
//
|
||||
// ButtonPanel
|
||||
//
|
||||
|
|
|
@ -13,7 +13,9 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
public partial class NESGameGenie : Form
|
||||
{
|
||||
//TODO: Encoding: Backspace on textboxes should trigger encoding
|
||||
//TODO
|
||||
//Autoload
|
||||
//Save Window Position
|
||||
int address = -1;
|
||||
int value = -1;
|
||||
int compare = -1;
|
||||
|
@ -42,6 +44,8 @@ namespace BizHawk.MultiClient
|
|||
GameGenieTable.Add('S', 13); //1101
|
||||
GameGenieTable.Add('V', 14); //1110
|
||||
GameGenieTable.Add('N', 15); //1111
|
||||
|
||||
AddCheat.Enabled = false;
|
||||
}
|
||||
|
||||
private void GameGenieCode_KeyPress(object sender, KeyPressEventArgs e)
|
||||
|
@ -173,6 +177,7 @@ namespace BizHawk.MultiClient
|
|||
AddressBox.Text = "";
|
||||
CompareBox.Text = "";
|
||||
ValueBox.Text = "";
|
||||
AddCheat.Enabled = false;
|
||||
}
|
||||
|
||||
private void GameGenieCode_TextChanged(object sender, EventArgs e)
|
||||
|
@ -184,6 +189,7 @@ namespace BizHawk.MultiClient
|
|||
else
|
||||
ClearProperties();
|
||||
}
|
||||
TryEnableAddCheat();
|
||||
}
|
||||
|
||||
private void Keypad_Click(object sender, EventArgs e)
|
||||
|
@ -268,6 +274,7 @@ namespace BizHawk.MultiClient
|
|||
EncodeGameGenie();
|
||||
}
|
||||
}
|
||||
TryEnableAddCheat();
|
||||
}
|
||||
|
||||
private void CompareBox_TextChanged(object sender, EventArgs e)
|
||||
|
@ -292,6 +299,15 @@ namespace BizHawk.MultiClient
|
|||
EncodeGameGenie();
|
||||
}
|
||||
}
|
||||
TryEnableAddCheat();
|
||||
}
|
||||
|
||||
private void TryEnableAddCheat()
|
||||
{
|
||||
if (AddressBox.Text.Length > 0 && ValueBox.Text.Length > 0 && GameGenieCode.Text.Length > 0)
|
||||
AddCheat.Enabled = true;
|
||||
else
|
||||
AddCheat.Enabled = false;
|
||||
}
|
||||
|
||||
private void ValueBox_TextChanged(object sender, EventArgs e)
|
||||
|
@ -308,6 +324,8 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
TryEnableAddCheat();
|
||||
}
|
||||
|
||||
private void EncodeGameGenie()
|
||||
|
@ -348,5 +366,15 @@ namespace BizHawk.MultiClient
|
|||
GameGenieCode.Text = "";
|
||||
Encoding.Checked = false;
|
||||
}
|
||||
|
||||
private void AddCheat_Click(object sender, EventArgs e)
|
||||
{
|
||||
Cheat c = new Cheat();
|
||||
c.name = GameGenieCode.Text;
|
||||
c.address = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
||||
c.value = byte.Parse(ValueBox.Text, NumberStyles.HexNumber);
|
||||
c.Enable();
|
||||
Global.MainForm.Cheats1.AddCheat(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
public class Cheat
|
||||
{
|
||||
//TODO: compare value (for NES)
|
||||
public string name { get; set; }
|
||||
public int address { get; set; }
|
||||
public byte value { get; set; }
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace BizHawk.MultiClient
|
|||
//Implement Options menu settings
|
||||
//Implement Freeze/Unfreeze on enabled changed in Cheat object
|
||||
//Save - implement (should default to SaveAs if no cheats file)
|
||||
//Restore Window Size should restore column order as well
|
||||
|
||||
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
|
||||
int defaultHeight;
|
||||
|
|
Loading…
Reference in New Issue