From cb4c2a56d13fc217215f6d1eec7aa7d5a90a32f2 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Tue, 20 Sep 2011 23:27:55 +0000 Subject: [PATCH] NES Game Genie Encoder/Decoder - fix so that the A key works in the code text box, have buttons insert rather than append --- BizHawk.Emulation/BizHawk.Emulation.csproj | 1 + .../NEStools/NESGameGenie.Designer.cs | 2 +- BizHawk.MultiClient/NEStools/NESGameGenie.cs | 39 +++++++++++-------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj index 86ebe82b11..57947b9ed4 100644 --- a/BizHawk.Emulation/BizHawk.Emulation.csproj +++ b/BizHawk.Emulation/BizHawk.Emulation.csproj @@ -117,6 +117,7 @@ + Code diff --git a/BizHawk.MultiClient/NEStools/NESGameGenie.Designer.cs b/BizHawk.MultiClient/NEStools/NESGameGenie.Designer.cs index db85bb0c83..8c86a3622e 100644 --- a/BizHawk.MultiClient/NEStools/NESGameGenie.Designer.cs +++ b/BizHawk.MultiClient/NEStools/NESGameGenie.Designer.cs @@ -163,7 +163,7 @@ this.AddCheat.Name = "AddCheat"; this.AddCheat.Size = new System.Drawing.Size(69, 21); this.AddCheat.TabIndex = 33; - this.AddCheat.Text = "Add Cheat"; + this.AddCheat.Text = "&Add Cheat"; this.AddCheat.UseVisualStyleBackColor = true; this.AddCheat.Click += new System.EventHandler(this.AddCheat_Click); // diff --git a/BizHawk.MultiClient/NEStools/NESGameGenie.cs b/BizHawk.MultiClient/NEStools/NESGameGenie.cs index eb7a64899c..2b0821269f 100644 --- a/BizHawk.MultiClient/NEStools/NESGameGenie.cs +++ b/BizHawk.MultiClient/NEStools/NESGameGenie.cs @@ -58,7 +58,7 @@ namespace BizHawk.MultiClient private void GameGenieCode_KeyPress(object sender, KeyPressEventArgs e) { //Make uppercase - if (e.KeyChar > 97 && e.KeyChar < 123) + if (e.KeyChar >= 97 && e.KeyChar < 123) e.KeyChar -= (char)32; if (!(GameGenieTable.ContainsKey(e.KeyChar))) @@ -203,22 +203,27 @@ namespace BizHawk.MultiClient { if (GameGenieCode.Text.Length < 8) { - if (sender == A) GameGenieCode.Text += "A"; - if (sender == P) GameGenieCode.Text += "P"; - if (sender == Z) GameGenieCode.Text += "Z"; - if (sender == L) GameGenieCode.Text += "L"; - if (sender == G) GameGenieCode.Text += "G"; - if (sender == I) GameGenieCode.Text += "I"; - if (sender == T) GameGenieCode.Text += "T"; - if (sender == Y) GameGenieCode.Text += "Y"; - if (sender == E) GameGenieCode.Text += "E"; - if (sender == O) GameGenieCode.Text += "O"; - if (sender == X) GameGenieCode.Text += "X"; - if (sender == U) GameGenieCode.Text += "U"; - if (sender == K) GameGenieCode.Text += "K"; - if (sender == S) GameGenieCode.Text += "S"; - if (sender == V) GameGenieCode.Text += "V"; - if (sender == N) GameGenieCode.Text += "N"; + string code = ""; + if (sender == A) code = "A"; + if (sender == P) code += "P"; + if (sender == Z) code += "Z"; + if (sender == L) code += "L"; + if (sender == G) code += "G"; + if (sender == I) code += "I"; + if (sender == T) code += "T"; + if (sender == Y) code += "Y"; + if (sender == E) code += "E"; + if (sender == O) code += "O"; + if (sender == X) code += "X"; + if (sender == U) code += "U"; + if (sender == K) code += "K"; + if (sender == S) code += "S"; + if (sender == V) code += "V"; + if (sender == N) code += "N"; + + int x = GameGenieCode.SelectionStart; + GameGenieCode.Text = GameGenieCode.Text.Insert(x, code); + GameGenieCode.SelectionStart = x; Encoding.Checked = false; } }