From b6b939cb5c035236437861c693ab794cefaf9dd2 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 23 Sep 2012 21:07:36 +0000 Subject: [PATCH] NES Game Genie Encoder/Decoder - pressing enter in the code box will add the cheat --- .../NEStools/NESGameGenie.Designer.cs | 13 +++++++------ BizHawk.MultiClient/NEStools/NESGameGenie.cs | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/BizHawk.MultiClient/NEStools/NESGameGenie.Designer.cs b/BizHawk.MultiClient/NEStools/NESGameGenie.Designer.cs index 8c86a3622e..fecd8f33e2 100644 --- a/BizHawk.MultiClient/NEStools/NESGameGenie.Designer.cs +++ b/BizHawk.MultiClient/NEStools/NESGameGenie.Designer.cs @@ -81,6 +81,7 @@ this.GameGenieCode.Size = new System.Drawing.Size(86, 20); this.GameGenieCode.TabIndex = 20; this.GameGenieCode.TextChanged += new System.EventHandler(this.GameGenieCode_TextChanged); + this.GameGenieCode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GameGenieCode_KeyDown); this.GameGenieCode.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.GameGenieCode_KeyPress); // // GameGenieCodeBox @@ -437,34 +438,34 @@ this.toolStripSeparator1, this.exitToolStripMenuItem}); this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; - this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20); + this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20); this.optionsToolStripMenuItem.Text = "&Options"; this.optionsToolStripMenuItem.DropDownOpened += new System.EventHandler(this.optionsToolStripMenuItem_DropDownOpened); // // autoloadToolStripMenuItem // this.autoloadToolStripMenuItem.Name = "autoloadToolStripMenuItem"; - this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(191, 22); this.autoloadToolStripMenuItem.Text = "Auto-load"; this.autoloadToolStripMenuItem.Click += new System.EventHandler(this.autoloadToolStripMenuItem_Click); // // saveWindowPositionToolStripMenuItem // this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem"; - this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(191, 22); this.saveWindowPositionToolStripMenuItem.Text = "Save Window Position"; this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(187, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(188, 6); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); - this.exitToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(191, 22); this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -472,7 +473,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(302, 266); + this.ClientSize = new System.Drawing.Size(302, 263); this.Controls.Add(this.ClearButton); this.Controls.Add(this.Encoding); this.Controls.Add(this.groupBox1); diff --git a/BizHawk.MultiClient/NEStools/NESGameGenie.cs b/BizHawk.MultiClient/NEStools/NESGameGenie.cs index f97b4c60cc..b6ee43258c 100644 --- a/BizHawk.MultiClient/NEStools/NESGameGenie.cs +++ b/BizHawk.MultiClient/NEStools/NESGameGenie.cs @@ -385,6 +385,11 @@ namespace BizHawk.MultiClient } private void AddCheat_Click(object sender, EventArgs e) + { + AddCheatClick(); + } + + private void AddCheatClick() { Cheat c = new Cheat(); c.name = GameGenieCode.Text; @@ -442,5 +447,16 @@ namespace BizHawk.MultiClient autoloadToolStripMenuItem.Checked = Global.Config.NESGGAutoload; saveWindowPositionToolStripMenuItem.Checked = Global.Config.NESGGSaveWindowPosition; } + + private void GameGenieCode_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyData == Keys.Enter) + { + if (AddCheat.Enabled) + { + AddCheatClick(); + } + } + } } }