NES Game Genie Encoder/Decoder - fix button order to match game genie (oops), fix tab stops, fix add cheat button from crashing

This commit is contained in:
andres.delikat 2011-06-11 15:55:06 +00:00
parent d70121bc04
commit 5f3cfb46da
2 changed files with 807 additions and 805 deletions

View File

@ -28,470 +28,470 @@
/// </summary>
private void InitializeComponent()
{
this.GameGenieCode = new System.Windows.Forms.TextBox();
this.GameGenieCodeBox = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.CompareBox = new System.Windows.Forms.TextBox();
this.ValueBox = new System.Windows.Forms.TextBox();
this.AddressBox = new System.Windows.Forms.TextBox();
this.AddCheat = new System.Windows.Forms.Button();
this.ButtonPanel = new System.Windows.Forms.Panel();
this.N = new System.Windows.Forms.Button();
this.V = new System.Windows.Forms.Button();
this.S = new System.Windows.Forms.Button();
this.K = new System.Windows.Forms.Button();
this.U = new System.Windows.Forms.Button();
this.X = new System.Windows.Forms.Button();
this.O = new System.Windows.Forms.Button();
this.E = new System.Windows.Forms.Button();
this.Y = new System.Windows.Forms.Button();
this.T = new System.Windows.Forms.Button();
this.I = new System.Windows.Forms.Button();
this.G = new System.Windows.Forms.Button();
this.L = new System.Windows.Forms.Button();
this.Z = new System.Windows.Forms.Button();
this.P = new System.Windows.Forms.Button();
this.A = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.Encoding = new System.Windows.Forms.CheckBox();
this.ClearButton = new System.Windows.Forms.Button();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.GameGenieCodeBox.SuspendLayout();
this.ButtonPanel.SuspendLayout();
this.groupBox1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// GameGenieCode
//
this.GameGenieCode.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.GameGenieCode.Location = new System.Drawing.Point(6, 19);
this.GameGenieCode.MaxLength = 8;
this.GameGenieCode.Name = "GameGenieCode";
this.GameGenieCode.Size = new System.Drawing.Size(86, 20);
this.GameGenieCode.TabIndex = 0;
this.GameGenieCode.TextChanged += new System.EventHandler(this.GameGenieCode_TextChanged);
this.GameGenieCode.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.GameGenieCode_KeyPress);
//
// GameGenieCodeBox
//
this.GameGenieCodeBox.Controls.Add(this.GameGenieCode);
this.GameGenieCodeBox.Location = new System.Drawing.Point(31, 103);
this.GameGenieCodeBox.Name = "GameGenieCodeBox";
this.GameGenieCodeBox.Size = new System.Drawing.Size(115, 54);
this.GameGenieCodeBox.TabIndex = 1;
this.GameGenieCodeBox.TabStop = false;
this.GameGenieCodeBox.Text = "Game Genie Code";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(8, 68);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(34, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Value";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(8, 42);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(49, 13);
this.label2.TabIndex = 4;
this.label2.Text = "Compare";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(45, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Address";
//
// CompareBox
//
this.CompareBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.CompareBox.Location = new System.Drawing.Point(87, 39);
this.CompareBox.MaxLength = 2;
this.CompareBox.Name = "CompareBox";
this.CompareBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.CompareBox.Size = new System.Drawing.Size(27, 20);
this.CompareBox.TabIndex = 2;
this.CompareBox.TextChanged += new System.EventHandler(this.CompareBox_TextChanged);
this.CompareBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CompareBox_KeyPress);
//
// ValueBox
//
this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.ValueBox.Location = new System.Drawing.Point(87, 65);
this.ValueBox.MaxLength = 2;
this.ValueBox.Name = "ValueBox";
this.ValueBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.ValueBox.Size = new System.Drawing.Size(27, 20);
this.ValueBox.TabIndex = 1;
this.ValueBox.TextChanged += new System.EventHandler(this.ValueBox_TextChanged);
this.ValueBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ValueBox_KeyPress);
//
// AddressBox
//
this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.AddressBox.Location = new System.Drawing.Point(75, 13);
this.AddressBox.MaxLength = 4;
this.AddressBox.Name = "AddressBox";
this.AddressBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.AddressBox.Size = new System.Drawing.Size(39, 20);
this.AddressBox.TabIndex = 0;
this.AddressBox.TextChanged += new System.EventHandler(this.AddressBox_TextChanged);
this.AddressBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.AddressBox_KeyPress);
//
// AddCheat
//
this.AddCheat.Location = new System.Drawing.Point(202, 235);
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
//
this.ButtonPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.ButtonPanel.Controls.Add(this.N);
this.ButtonPanel.Controls.Add(this.V);
this.ButtonPanel.Controls.Add(this.S);
this.ButtonPanel.Controls.Add(this.K);
this.ButtonPanel.Controls.Add(this.U);
this.ButtonPanel.Controls.Add(this.X);
this.ButtonPanel.Controls.Add(this.O);
this.ButtonPanel.Controls.Add(this.E);
this.ButtonPanel.Controls.Add(this.Y);
this.ButtonPanel.Controls.Add(this.T);
this.ButtonPanel.Controls.Add(this.I);
this.ButtonPanel.Controls.Add(this.G);
this.ButtonPanel.Controls.Add(this.L);
this.ButtonPanel.Controls.Add(this.Z);
this.ButtonPanel.Controls.Add(this.P);
this.ButtonPanel.Controls.Add(this.A);
this.ButtonPanel.Location = new System.Drawing.Point(31, 30);
this.ButtonPanel.Name = "ButtonPanel";
this.ButtonPanel.Size = new System.Drawing.Size(240, 67);
this.ButtonPanel.TabIndex = 4;
//
// N
//
this.N.Location = new System.Drawing.Point(206, 35);
this.N.Name = "N";
this.N.Size = new System.Drawing.Size(26, 23);
this.N.TabIndex = 15;
this.N.Text = "N";
this.N.UseVisualStyleBackColor = true;
this.N.Click += new System.EventHandler(this.Keypad_Click);
//
// V
//
this.V.Location = new System.Drawing.Point(178, 35);
this.V.Name = "V";
this.V.Size = new System.Drawing.Size(26, 23);
this.V.TabIndex = 14;
this.V.Text = "V";
this.V.UseVisualStyleBackColor = true;
this.V.Click += new System.EventHandler(this.Keypad_Click);
//
// S
//
this.S.Location = new System.Drawing.Point(149, 35);
this.S.Name = "S";
this.S.Size = new System.Drawing.Size(26, 23);
this.S.TabIndex = 13;
this.S.Text = "S";
this.S.UseVisualStyleBackColor = true;
this.S.Click += new System.EventHandler(this.Keypad_Click);
//
// K
//
this.K.Location = new System.Drawing.Point(121, 35);
this.K.Name = "K";
this.K.Size = new System.Drawing.Size(26, 23);
this.K.TabIndex = 12;
this.K.Text = "K";
this.K.UseVisualStyleBackColor = true;
this.K.Click += new System.EventHandler(this.Keypad_Click);
//
// U
//
this.U.Location = new System.Drawing.Point(91, 35);
this.U.Name = "U";
this.U.Size = new System.Drawing.Size(26, 23);
this.U.TabIndex = 11;
this.U.Text = "U";
this.U.UseVisualStyleBackColor = true;
this.U.Click += new System.EventHandler(this.Keypad_Click);
//
// X
//
this.X.Location = new System.Drawing.Point(63, 35);
this.X.Name = "X";
this.X.Size = new System.Drawing.Size(26, 23);
this.X.TabIndex = 10;
this.X.Text = "X";
this.X.UseVisualStyleBackColor = true;
this.X.Click += new System.EventHandler(this.Keypad_Click);
//
// O
//
this.O.Location = new System.Drawing.Point(34, 35);
this.O.Name = "O";
this.O.Size = new System.Drawing.Size(26, 23);
this.O.TabIndex = 9;
this.O.Text = "O";
this.O.UseVisualStyleBackColor = true;
this.O.Click += new System.EventHandler(this.Keypad_Click);
//
// E
//
this.E.Location = new System.Drawing.Point(6, 35);
this.E.Name = "E";
this.E.Size = new System.Drawing.Size(26, 23);
this.E.TabIndex = 8;
this.E.Text = "E";
this.E.UseVisualStyleBackColor = true;
this.E.Click += new System.EventHandler(this.Keypad_Click);
//
// Y
//
this.Y.Location = new System.Drawing.Point(206, 5);
this.Y.Name = "Y";
this.Y.Size = new System.Drawing.Size(26, 23);
this.Y.TabIndex = 7;
this.Y.Text = "Y";
this.Y.UseVisualStyleBackColor = true;
this.Y.Click += new System.EventHandler(this.Keypad_Click);
//
// T
//
this.T.Location = new System.Drawing.Point(178, 5);
this.T.Name = "T";
this.T.Size = new System.Drawing.Size(26, 23);
this.T.TabIndex = 6;
this.T.Text = "T";
this.T.UseVisualStyleBackColor = true;
this.T.Click += new System.EventHandler(this.Keypad_Click);
//
// I
//
this.I.Location = new System.Drawing.Point(149, 5);
this.I.Name = "I";
this.I.Size = new System.Drawing.Size(26, 23);
this.I.TabIndex = 5;
this.I.Text = "I";
this.I.UseVisualStyleBackColor = true;
this.I.Click += new System.EventHandler(this.Keypad_Click);
//
// G
//
this.G.Location = new System.Drawing.Point(121, 5);
this.G.Name = "G";
this.G.Size = new System.Drawing.Size(26, 23);
this.G.TabIndex = 4;
this.G.Text = "G";
this.G.UseVisualStyleBackColor = true;
this.G.Click += new System.EventHandler(this.Keypad_Click);
//
// L
//
this.L.Location = new System.Drawing.Point(91, 5);
this.L.Name = "L";
this.L.Size = new System.Drawing.Size(26, 23);
this.L.TabIndex = 3;
this.L.Text = "L";
this.L.UseVisualStyleBackColor = true;
this.L.Click += new System.EventHandler(this.Keypad_Click);
//
// Z
//
this.Z.Location = new System.Drawing.Point(63, 5);
this.Z.Name = "Z";
this.Z.Size = new System.Drawing.Size(26, 23);
this.Z.TabIndex = 2;
this.Z.Text = "Z";
this.Z.UseVisualStyleBackColor = true;
this.Z.Click += new System.EventHandler(this.Keypad_Click);
//
// P
//
this.P.Location = new System.Drawing.Point(34, 5);
this.P.Name = "P";
this.P.Size = new System.Drawing.Size(26, 23);
this.P.TabIndex = 1;
this.P.Text = "P";
this.P.UseVisualStyleBackColor = true;
this.P.Click += new System.EventHandler(this.Keypad_Click);
//
// A
//
this.A.Location = new System.Drawing.Point(6, 5);
this.A.Name = "A";
this.A.Size = new System.Drawing.Size(26, 23);
this.A.TabIndex = 0;
this.A.Text = "A";
this.A.UseVisualStyleBackColor = true;
this.A.Click += new System.EventHandler(this.Keypad_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.AddressBox);
this.groupBox1.Controls.Add(this.ValueBox);
this.groupBox1.Controls.Add(this.CompareBox);
this.groupBox1.Location = new System.Drawing.Point(31, 163);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(126, 93);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(69, 69);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(18, 13);
this.label6.TabIndex = 9;
this.label6.Text = "0x";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(69, 42);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(18, 13);
this.label5.TabIndex = 8;
this.label5.Text = "0x";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(57, 16);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(18, 13);
this.label4.TabIndex = 7;
this.label4.Text = "0x";
//
// Encoding
//
this.Encoding.Appearance = System.Windows.Forms.Appearance.Button;
this.Encoding.AutoSize = true;
this.Encoding.Location = new System.Drawing.Point(217, 119);
this.Encoding.Name = "Encoding";
this.Encoding.Size = new System.Drawing.Size(54, 23);
this.Encoding.TabIndex = 6;
this.Encoding.Text = "Encode";
this.Encoding.UseVisualStyleBackColor = true;
//
// ClearButton
//
this.ClearButton.Location = new System.Drawing.Point(217, 148);
this.ClearButton.Name = "ClearButton";
this.ClearButton.Size = new System.Drawing.Size(54, 23);
this.ClearButton.TabIndex = 7;
this.ClearButton.Text = "&Clear";
this.ClearButton.UseVisualStyleBackColor = true;
this.ClearButton.Click += new System.EventHandler(this.ClearButton_Click);
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.GameGenieCode = new System.Windows.Forms.TextBox();
this.GameGenieCodeBox = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.CompareBox = new System.Windows.Forms.TextBox();
this.ValueBox = new System.Windows.Forms.TextBox();
this.AddressBox = new System.Windows.Forms.TextBox();
this.AddCheat = new System.Windows.Forms.Button();
this.ButtonPanel = new System.Windows.Forms.Panel();
this.N = new System.Windows.Forms.Button();
this.V = new System.Windows.Forms.Button();
this.S = new System.Windows.Forms.Button();
this.K = new System.Windows.Forms.Button();
this.U = new System.Windows.Forms.Button();
this.X = new System.Windows.Forms.Button();
this.O = new System.Windows.Forms.Button();
this.E = new System.Windows.Forms.Button();
this.Y = new System.Windows.Forms.Button();
this.T = new System.Windows.Forms.Button();
this.I = new System.Windows.Forms.Button();
this.G = new System.Windows.Forms.Button();
this.L = new System.Windows.Forms.Button();
this.Z = new System.Windows.Forms.Button();
this.P = new System.Windows.Forms.Button();
this.A = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.Encoding = new System.Windows.Forms.CheckBox();
this.ClearButton = new System.Windows.Forms.Button();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.GameGenieCodeBox.SuspendLayout();
this.ButtonPanel.SuspendLayout();
this.groupBox1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// GameGenieCode
//
this.GameGenieCode.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.GameGenieCode.Location = new System.Drawing.Point(6, 19);
this.GameGenieCode.MaxLength = 8;
this.GameGenieCode.Name = "GameGenieCode";
this.GameGenieCode.Size = new System.Drawing.Size(86, 20);
this.GameGenieCode.TabIndex = 20;
this.GameGenieCode.TextChanged += new System.EventHandler(this.GameGenieCode_TextChanged);
this.GameGenieCode.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.GameGenieCode_KeyPress);
//
// GameGenieCodeBox
//
this.GameGenieCodeBox.Controls.Add(this.GameGenieCode);
this.GameGenieCodeBox.Location = new System.Drawing.Point(31, 103);
this.GameGenieCodeBox.Name = "GameGenieCodeBox";
this.GameGenieCodeBox.Size = new System.Drawing.Size(115, 54);
this.GameGenieCodeBox.TabIndex = 1;
this.GameGenieCodeBox.TabStop = false;
this.GameGenieCodeBox.Text = "Game Genie Code";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(8, 68);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(34, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Value";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(8, 42);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(49, 13);
this.label2.TabIndex = 4;
this.label2.Text = "Compare";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(45, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Address";
//
// CompareBox
//
this.CompareBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.CompareBox.Location = new System.Drawing.Point(87, 39);
this.CompareBox.MaxLength = 2;
this.CompareBox.Name = "CompareBox";
this.CompareBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.CompareBox.Size = new System.Drawing.Size(27, 20);
this.CompareBox.TabIndex = 22;
this.CompareBox.TextChanged += new System.EventHandler(this.CompareBox_TextChanged);
this.CompareBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CompareBox_KeyPress);
//
// ValueBox
//
this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.ValueBox.Location = new System.Drawing.Point(87, 65);
this.ValueBox.MaxLength = 2;
this.ValueBox.Name = "ValueBox";
this.ValueBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.ValueBox.Size = new System.Drawing.Size(27, 20);
this.ValueBox.TabIndex = 23;
this.ValueBox.TextChanged += new System.EventHandler(this.ValueBox_TextChanged);
this.ValueBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ValueBox_KeyPress);
//
// AddressBox
//
this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.AddressBox.Location = new System.Drawing.Point(75, 13);
this.AddressBox.MaxLength = 4;
this.AddressBox.Name = "AddressBox";
this.AddressBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.AddressBox.Size = new System.Drawing.Size(39, 20);
this.AddressBox.TabIndex = 21;
this.AddressBox.TextChanged += new System.EventHandler(this.AddressBox_TextChanged);
this.AddressBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.AddressBox_KeyPress);
//
// AddCheat
//
this.AddCheat.Location = new System.Drawing.Point(202, 235);
this.AddCheat.Name = "AddCheat";
this.AddCheat.Size = new System.Drawing.Size(69, 21);
this.AddCheat.TabIndex = 33;
this.AddCheat.Text = "Add Cheat";
this.AddCheat.UseVisualStyleBackColor = true;
this.AddCheat.Click += new System.EventHandler(this.AddCheat_Click);
//
// ButtonPanel
//
this.ButtonPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.ButtonPanel.Controls.Add(this.N);
this.ButtonPanel.Controls.Add(this.V);
this.ButtonPanel.Controls.Add(this.S);
this.ButtonPanel.Controls.Add(this.K);
this.ButtonPanel.Controls.Add(this.U);
this.ButtonPanel.Controls.Add(this.X);
this.ButtonPanel.Controls.Add(this.O);
this.ButtonPanel.Controls.Add(this.Y);
this.ButtonPanel.Controls.Add(this.L);
this.ButtonPanel.Controls.Add(this.E);
this.ButtonPanel.Controls.Add(this.T);
this.ButtonPanel.Controls.Add(this.I);
this.ButtonPanel.Controls.Add(this.G);
this.ButtonPanel.Controls.Add(this.Z);
this.ButtonPanel.Controls.Add(this.P);
this.ButtonPanel.Controls.Add(this.A);
this.ButtonPanel.Location = new System.Drawing.Point(31, 30);
this.ButtonPanel.Name = "ButtonPanel";
this.ButtonPanel.Size = new System.Drawing.Size(240, 67);
this.ButtonPanel.TabIndex = 4;
//
// N
//
this.N.Location = new System.Drawing.Point(206, 35);
this.N.Name = "N";
this.N.Size = new System.Drawing.Size(26, 23);
this.N.TabIndex = 16;
this.N.Text = "N";
this.N.UseVisualStyleBackColor = true;
this.N.Click += new System.EventHandler(this.Keypad_Click);
//
// V
//
this.V.Location = new System.Drawing.Point(149, 35);
this.V.Name = "V";
this.V.Size = new System.Drawing.Size(26, 23);
this.V.TabIndex = 14;
this.V.Text = "V";
this.V.UseVisualStyleBackColor = true;
this.V.Click += new System.EventHandler(this.Keypad_Click);
//
// S
//
this.S.Location = new System.Drawing.Point(91, 35);
this.S.Name = "S";
this.S.Size = new System.Drawing.Size(26, 23);
this.S.TabIndex = 12;
this.S.Text = "S";
this.S.UseVisualStyleBackColor = true;
this.S.Click += new System.EventHandler(this.Keypad_Click);
//
// K
//
this.K.Location = new System.Drawing.Point(34, 35);
this.K.Name = "K";
this.K.Size = new System.Drawing.Size(26, 23);
this.K.TabIndex = 10;
this.K.Text = "K";
this.K.UseVisualStyleBackColor = true;
this.K.Click += new System.EventHandler(this.Keypad_Click);
//
// U
//
this.U.Location = new System.Drawing.Point(206, 5);
this.U.Name = "U";
this.U.Size = new System.Drawing.Size(26, 23);
this.U.TabIndex = 8;
this.U.Text = "U";
this.U.UseVisualStyleBackColor = true;
this.U.Click += new System.EventHandler(this.Keypad_Click);
//
// X
//
this.X.Location = new System.Drawing.Point(149, 6);
this.X.Name = "X";
this.X.Size = new System.Drawing.Size(26, 23);
this.X.TabIndex = 6;
this.X.Text = "X";
this.X.UseVisualStyleBackColor = true;
this.X.Click += new System.EventHandler(this.Keypad_Click);
//
// O
//
this.O.Location = new System.Drawing.Point(91, 6);
this.O.Name = "O";
this.O.Size = new System.Drawing.Size(26, 23);
this.O.TabIndex = 4;
this.O.Text = "O";
this.O.UseVisualStyleBackColor = true;
this.O.Click += new System.EventHandler(this.Keypad_Click);
//
// E
//
this.E.Location = new System.Drawing.Point(34, 6);
this.E.Name = "E";
this.E.Size = new System.Drawing.Size(26, 23);
this.E.TabIndex = 2;
this.E.Text = "E";
this.E.UseVisualStyleBackColor = true;
this.E.Click += new System.EventHandler(this.Keypad_Click);
//
// Y
//
this.Y.Location = new System.Drawing.Point(178, 35);
this.Y.Name = "Y";
this.Y.Size = new System.Drawing.Size(26, 23);
this.Y.TabIndex = 15;
this.Y.Text = "Y";
this.Y.UseVisualStyleBackColor = true;
this.Y.Click += new System.EventHandler(this.Keypad_Click);
//
// T
//
this.T.Location = new System.Drawing.Point(121, 35);
this.T.Name = "T";
this.T.Size = new System.Drawing.Size(26, 23);
this.T.TabIndex = 13;
this.T.Text = "T";
this.T.UseVisualStyleBackColor = true;
this.T.Click += new System.EventHandler(this.Keypad_Click);
//
// I
//
this.I.Location = new System.Drawing.Point(63, 35);
this.I.Name = "I";
this.I.Size = new System.Drawing.Size(26, 23);
this.I.TabIndex = 11;
this.I.Text = "I";
this.I.UseVisualStyleBackColor = true;
this.I.Click += new System.EventHandler(this.Keypad_Click);
//
// G
//
this.G.Location = new System.Drawing.Point(6, 35);
this.G.Name = "G";
this.G.Size = new System.Drawing.Size(26, 23);
this.G.TabIndex = 9;
this.G.Text = "G";
this.G.UseVisualStyleBackColor = true;
this.G.Click += new System.EventHandler(this.Keypad_Click);
//
// L
//
this.L.Location = new System.Drawing.Point(178, 5);
this.L.Name = "L";
this.L.Size = new System.Drawing.Size(26, 23);
this.L.TabIndex = 7;
this.L.Text = "L";
this.L.UseVisualStyleBackColor = true;
this.L.Click += new System.EventHandler(this.Keypad_Click);
//
// Z
//
this.Z.Location = new System.Drawing.Point(121, 6);
this.Z.Name = "Z";
this.Z.Size = new System.Drawing.Size(26, 23);
this.Z.TabIndex = 5;
this.Z.Text = "Z";
this.Z.UseVisualStyleBackColor = true;
this.Z.Click += new System.EventHandler(this.Keypad_Click);
//
// P
//
this.P.Location = new System.Drawing.Point(63, 6);
this.P.Name = "P";
this.P.Size = new System.Drawing.Size(26, 23);
this.P.TabIndex = 3;
this.P.Text = "P";
this.P.UseVisualStyleBackColor = true;
this.P.Click += new System.EventHandler(this.Keypad_Click);
//
// A
//
this.A.Location = new System.Drawing.Point(6, 5);
this.A.Name = "A";
this.A.Size = new System.Drawing.Size(26, 23);
this.A.TabIndex = 1;
this.A.Text = "A";
this.A.UseVisualStyleBackColor = true;
this.A.Click += new System.EventHandler(this.Keypad_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.AddressBox);
this.groupBox1.Controls.Add(this.ValueBox);
this.groupBox1.Controls.Add(this.CompareBox);
this.groupBox1.Location = new System.Drawing.Point(31, 163);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(126, 93);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(69, 69);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(18, 13);
this.label6.TabIndex = 9;
this.label6.Text = "0x";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(69, 42);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(18, 13);
this.label5.TabIndex = 8;
this.label5.Text = "0x";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(57, 16);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(18, 13);
this.label4.TabIndex = 7;
this.label4.Text = "0x";
//
// Encoding
//
this.Encoding.Appearance = System.Windows.Forms.Appearance.Button;
this.Encoding.AutoSize = true;
this.Encoding.Location = new System.Drawing.Point(217, 119);
this.Encoding.Name = "Encoding";
this.Encoding.Size = new System.Drawing.Size(54, 23);
this.Encoding.TabIndex = 31;
this.Encoding.Text = "Encode";
this.Encoding.UseVisualStyleBackColor = true;
//
// ClearButton
//
this.ClearButton.Location = new System.Drawing.Point(217, 148);
this.ClearButton.Name = "ClearButton";
this.ClearButton.Size = new System.Drawing.Size(54, 23);
this.ClearButton.TabIndex = 32;
this.ClearButton.Text = "&Clear";
this.ClearButton.UseVisualStyleBackColor = true;
this.ClearButton.Click += new System.EventHandler(this.ClearButton_Click);
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.optionsToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(302, 24);
this.menuStrip1.TabIndex = 8;
this.menuStrip1.Text = "menuStrip1";
//
// optionsToolStripMenuItem
//
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(302, 24);
this.menuStrip1.TabIndex = 8;
this.menuStrip1.Text = "menuStrip1";
//
// optionsToolStripMenuItem
//
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.autoloadToolStripMenuItem,
this.saveWindowPositionToolStripMenuItem,
this.toolStripSeparator1,
this.exitToolStripMenuItem});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 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.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.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);
//
// 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.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// NESGameGenie
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(302, 266);
this.Controls.Add(this.ClearButton);
this.Controls.Add(this.Encoding);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.ButtonPanel);
this.Controls.Add(this.AddCheat);
this.Controls.Add(this.GameGenieCodeBox);
this.Controls.Add(this.menuStrip1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MainMenuStrip = this.menuStrip1;
this.MaximizeBox = false;
this.Name = "NESGameGenie";
this.ShowIcon = false;
this.Text = "Game Genie Encoder / Decoder";
this.Load += new System.EventHandler(this.NESGameGenie_Load);
this.GameGenieCodeBox.ResumeLayout(false);
this.GameGenieCodeBox.PerformLayout();
this.ButtonPanel.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 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.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.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);
//
// 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.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// NESGameGenie
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(302, 266);
this.Controls.Add(this.ClearButton);
this.Controls.Add(this.Encoding);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.ButtonPanel);
this.Controls.Add(this.AddCheat);
this.Controls.Add(this.GameGenieCodeBox);
this.Controls.Add(this.menuStrip1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MainMenuStrip = this.menuStrip1;
this.MaximizeBox = false;
this.Name = "NESGameGenie";
this.ShowIcon = false;
this.Text = "Game Genie Encoder / Decoder";
this.Load += new System.EventHandler(this.NESGameGenie_Load);
this.GameGenieCodeBox.ResumeLayout(false);
this.GameGenieCodeBox.PerformLayout();
this.ButtonPanel.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}

View File

@ -11,398 +11,400 @@ using BizHawk;
namespace BizHawk.MultiClient
{
public partial class NESGameGenie : Form
{
int address = -1;
int value = -1;
int compare = -1;
Dictionary<char, int> GameGenieTable = new Dictionary<char, int>();
public partial class NESGameGenie : Form
{
int address = -1;
int value = -1;
int compare = -1;
Dictionary<char, int> GameGenieTable = new Dictionary<char, int>();
public NESGameGenie()
{
InitializeComponent();
Closing += (o, e) => SaveConfigSettings();
}
public NESGameGenie()
{
InitializeComponent();
Closing += (o, e) => SaveConfigSettings();
}
private void NESGameGenie_Load(object sender, EventArgs e)
{
GameGenieTable.Add('A', 0); //0000
GameGenieTable.Add('P', 1); //0001
GameGenieTable.Add('Z', 2); //0010
GameGenieTable.Add('L', 3); //0011
GameGenieTable.Add('G', 4); //0100
GameGenieTable.Add('I', 5); //0101
GameGenieTable.Add('T', 6); //0110
GameGenieTable.Add('Y', 7); //0111
GameGenieTable.Add('E', 8); //1000
GameGenieTable.Add('O', 9); //1001
GameGenieTable.Add('X', 10); //1010
GameGenieTable.Add('U', 11); //1011
GameGenieTable.Add('K', 12); //1100
GameGenieTable.Add('S', 13); //1101
GameGenieTable.Add('V', 14); //1110
GameGenieTable.Add('N', 15); //1111
private void NESGameGenie_Load(object sender, EventArgs e)
{
GameGenieTable.Add('A', 0); //0000
GameGenieTable.Add('P', 1); //0001
GameGenieTable.Add('Z', 2); //0010
GameGenieTable.Add('L', 3); //0011
GameGenieTable.Add('G', 4); //0100
GameGenieTable.Add('I', 5); //0101
GameGenieTable.Add('T', 6); //0110
GameGenieTable.Add('Y', 7); //0111
GameGenieTable.Add('E', 8); //1000
GameGenieTable.Add('O', 9); //1001
GameGenieTable.Add('X', 10); //1010
GameGenieTable.Add('U', 11); //1011
GameGenieTable.Add('K', 12); //1100
GameGenieTable.Add('S', 13); //1101
GameGenieTable.Add('V', 14); //1110
GameGenieTable.Add('N', 15); //1111
AddCheat.Enabled = false;
AddCheat.Enabled = false;
if (Global.Config.NESGGSaveWindowPosition && Global.Config.NESGGWndx >= 0 && Global.Config.NESGGWndy >= 0)
Location = new Point(Global.Config.NESGGWndx, Global.Config.NESGGWndy);
}
if (Global.Config.NESGGSaveWindowPosition && Global.Config.NESGGWndx >= 0 && Global.Config.NESGGWndy >= 0)
Location = new Point(Global.Config.NESGGWndx, Global.Config.NESGGWndy);
}
private void SaveConfigSettings()
{
Global.Config.NESGGWndx = this.Location.X;
Global.Config.NESGGWndy = this.Location.Y;
}
private void SaveConfigSettings()
{
Global.Config.NESGGWndx = this.Location.X;
Global.Config.NESGGWndy = this.Location.Y;
}
private void GameGenieCode_KeyPress(object sender, KeyPressEventArgs e)
{
//Make uppercase
if (e.KeyChar > 97 && e.KeyChar < 123)
e.KeyChar -= (char)32;
private void GameGenieCode_KeyPress(object sender, KeyPressEventArgs e)
{
//Make uppercase
if (e.KeyChar > 97 && e.KeyChar < 123)
e.KeyChar -= (char)32;
if (!(GameGenieTable.ContainsKey(e.KeyChar)))
{
if (!(e.KeyChar == (char)Keys.Back)) //Allow backspace
e.Handled = true;
}
else
{
Encoding.Checked = false;
}
}
if (!(GameGenieTable.ContainsKey(e.KeyChar)))
{
if (!(e.KeyChar == (char)Keys.Back)) //Allow backspace
e.Handled = true;
}
else
{
Encoding.Checked = false;
}
}
private int GetBit(int value, int bit)
{
return (value >> bit) & 1;
}
private int GetBit(int value, int bit)
{
return (value >> bit) & 1;
}
private void DecodeGameGenieCode(string code)
{
//char 3 bit 3 denotes the code length.
if (code.Length == 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|
//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;
address = 0x8000;
int x;
private void DecodeGameGenieCode(string code)
{
//char 3 bit 3 denotes the code length.
if (code.Length == 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|
//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;
address = 0x8000;
int x;
GameGenieTable.TryGetValue(code[0], out x);
value |= (x & 0x07);
value |= (x & 0x08) << 4;
GameGenieTable.TryGetValue(code[0], out x);
value |= (x & 0x07);
value |= (x & 0x08) << 4;
GameGenieTable.TryGetValue(code[1], out x);
value |= (x & 0x07) << 4;
address |= (x & 0x08) << 4;
GameGenieTable.TryGetValue(code[2], out x);
address |= (x & 0x07) << 4;
GameGenieTable.TryGetValue(code[1], out x);
value |= (x & 0x07) << 4;
address |= (x & 0x08) << 4;
GameGenieTable.TryGetValue(code[3], out x);
address |= (x & 0x07) << 12;
address |= (x & 0x08);
GameGenieTable.TryGetValue(code[2], out x);
address |= (x & 0x07) << 4;
GameGenieTable.TryGetValue(code[4], out x);
address |= (x & 0x07);
address |= (x & 0x08) << 8;
GameGenieTable.TryGetValue(code[5], out x);
address |= (x & 0x07) << 8;
value |= (x & 0x08);
GameGenieTable.TryGetValue(code[3], out x);
address |= (x & 0x07) << 12;
address |= (x & 0x08);
SetProperties();
GameGenieTable.TryGetValue(code[4], out x);
address |= (x & 0x07);
address |= (x & 0x08) << 8;
}
else if (code.Length == 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|
//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;
address = 0x8000;
compare = 0;
int x;
GameGenieTable.TryGetValue(code[5], out x);
address |= (x & 0x07) << 8;
value |= (x & 0x08);
GameGenieTable.TryGetValue(code[0], out x);
value |= (x & 0x07);
value |= (x & 0x08) << 4;
SetProperties();
GameGenieTable.TryGetValue(code[1], out x);
value |= (x & 0x07) << 4;
address |= (x & 0x08) << 4;
}
else if (code.Length == 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|
//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;
address = 0x8000;
compare = 0;
int x;
GameGenieTable.TryGetValue(code[2], out x);
address |= (x & 0x07) << 4;
GameGenieTable.TryGetValue(code[0], out x);
value |= (x & 0x07);
value |= (x & 0x08) << 4;
GameGenieTable.TryGetValue(code[3], out x);
address |= (x & 0x07) << 12;
address |= (x & 0x08);
GameGenieTable.TryGetValue(code[1], out x);
value |= (x & 0x07) << 4;
address |= (x & 0x08) << 4;
GameGenieTable.TryGetValue(code[4], out x);
address |= (x & 0x07);
address |= (x & 0x08) << 8;
GameGenieTable.TryGetValue(code[2], out x);
address |= (x & 0x07) << 4;
GameGenieTable.TryGetValue(code[5], out x);
address |= (x & 0x07) << 8;
compare |= (x & 0x08);
GameGenieTable.TryGetValue(code[3], out x);
address |= (x & 0x07) << 12;
address |= (x & 0x08);
GameGenieTable.TryGetValue(code[6], out x);
compare |= (x & 0x07);
compare |= (x & 0x08) << 4;
GameGenieTable.TryGetValue(code[4], out x);
address |= (x & 0x07);
address |= (x & 0x08) << 8;
GameGenieTable.TryGetValue(code[7], out x);
compare |= (x & 0x07) << 4;
value |= (x & 0x08);
SetProperties();
}
}
GameGenieTable.TryGetValue(code[5], out x);
address |= (x & 0x07) << 8;
compare |= (x & 0x08);
private void SetProperties()
{
if (address >= 0)
AddressBox.Text = String.Format("{0:X4}", address);
else
AddressBox.Text = "";
GameGenieTable.TryGetValue(code[6], out x);
compare |= (x & 0x07);
compare |= (x & 0x08) << 4;
if (compare >= 0)
CompareBox.Text = String.Format("{0:X2}", compare);
else
CompareBox.Text = "";
GameGenieTable.TryGetValue(code[7], out x);
compare |= (x & 0x07) << 4;
value |= (x & 0x08);
SetProperties();
}
}
if (value >= 0)
ValueBox.Text = String.Format("{0:X2}", value);
private void SetProperties()
{
if (address >= 0)
AddressBox.Text = String.Format("{0:X4}", address);
else
AddressBox.Text = "";
}
if (compare >= 0)
CompareBox.Text = String.Format("{0:X2}", compare);
else
CompareBox.Text = "";
private void ClearProperties()
{
address = -1;
value = -1;
compare = -1;
AddressBox.Text = "";
CompareBox.Text = "";
ValueBox.Text = "";
AddCheat.Enabled = false;
}
if (value >= 0)
ValueBox.Text = String.Format("{0:X2}", value);
private void GameGenieCode_TextChanged(object sender, EventArgs e)
{
if (Encoding.Checked == false)
{
if (GameGenieCode.Text.Length == 6 || GameGenieCode.Text.Length == 8)
DecodeGameGenieCode(GameGenieCode.Text);
else
ClearProperties();
}
TryEnableAddCheat();
}
}
private void Keypad_Click(object sender, EventArgs e)
{
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";
Encoding.Checked = false;
}
}
private void ClearProperties()
{
address = -1;
value = -1;
compare = -1;
AddressBox.Text = "";
CompareBox.Text = "";
ValueBox.Text = "";
AddCheat.Enabled = false;
}
private void AddressBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(e.KeyChar == (char)Keys.Back)) //Allow backspace
{
if (InputValidate.IsValidHexNumber(e.KeyChar))
{
Encoding.Checked = true;
}
else
e.Handled = true;
}
else
Encoding.Checked = true;
}
private void GameGenieCode_TextChanged(object sender, EventArgs e)
{
if (Encoding.Checked == false)
{
if (GameGenieCode.Text.Length == 6 || GameGenieCode.Text.Length == 8)
DecodeGameGenieCode(GameGenieCode.Text);
else
ClearProperties();
}
TryEnableAddCheat();
}
private void CompareBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(e.KeyChar == (char)Keys.Back)) //Allow backspace
{
if (InputValidate.IsValidHexNumber(e.KeyChar))
{
private void Keypad_Click(object sender, EventArgs e)
{
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";
Encoding.Checked = false;
}
}
Encoding.Checked = true;
}
else
e.Handled = true;
}
else
Encoding.Checked = true;
}
private void AddressBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(e.KeyChar == (char)Keys.Back)) //Allow backspace
{
if (InputValidate.IsValidHexNumber(e.KeyChar))
{
Encoding.Checked = true;
}
else
e.Handled = true;
}
else
Encoding.Checked = true;
}
private void ValueBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(e.KeyChar == (char)Keys.Back)) //Allow backspace
{
if (InputValidate.IsValidHexNumber(e.KeyChar))
{
private void CompareBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(e.KeyChar == (char)Keys.Back)) //Allow backspace
{
if (InputValidate.IsValidHexNumber(e.KeyChar))
{
Encoding.Checked = true;
}
else
e.Handled = true;
}
else
Encoding.Checked = true;
}
Encoding.Checked = true;
}
else
e.Handled = true;
}
else
Encoding.Checked = true;
}
private void AddressBox_TextChanged(object sender, EventArgs e)
{
if (Encoding.Checked && AddressBox.Text.Length > 0)
{
int a = int.Parse(AddressBox.Text, NumberStyles.HexNumber); //TODO: try/catch just in case?
if (ValueBox.Text.Length > 0)
{
address = a;
EncodeGameGenie();
}
}
TryEnableAddCheat();
}
private void ValueBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(e.KeyChar == (char)Keys.Back)) //Allow backspace
{
if (InputValidate.IsValidHexNumber(e.KeyChar))
{
private void CompareBox_TextChanged(object sender, EventArgs e)
{
if (Encoding.Checked)
{
if (CompareBox.Text.Length > 0)
{
int c = int.Parse(CompareBox.Text, NumberStyles.HexNumber);
if (c > 0 && c < 0x100)
{
if (ValueBox.Text.Length > 0 && AddressBox.Text.Length > 0)
{
compare = c;
EncodeGameGenie();
}
}
}
else
{
compare = -1;
EncodeGameGenie();
}
}
TryEnableAddCheat();
}
Encoding.Checked = true;
}
else
e.Handled = true;
}
else
Encoding.Checked = true;
}
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 AddressBox_TextChanged(object sender, EventArgs e)
{
if (Encoding.Checked && AddressBox.Text.Length > 0)
{
int a = int.Parse(AddressBox.Text, NumberStyles.HexNumber); //TODO: try/catch just in case?
if (ValueBox.Text.Length > 0)
{
address = a;
EncodeGameGenie();
}
}
TryEnableAddCheat();
}
private void ValueBox_TextChanged(object sender, EventArgs e)
{
if (Encoding.Checked && ValueBox.Text.Length > 0)
{
int v = int.Parse(ValueBox.Text, NumberStyles.HexNumber);
if (v > 0 && v < 0x100)
{
if (AddressBox.Text.Length > 0)
{
value = v;
EncodeGameGenie();
}
}
}
private void CompareBox_TextChanged(object sender, EventArgs e)
{
if (Encoding.Checked)
{
if (CompareBox.Text.Length > 0)
{
int c = int.Parse(CompareBox.Text, NumberStyles.HexNumber);
if (c > 0 && c < 0x100)
{
if (ValueBox.Text.Length > 0 && AddressBox.Text.Length > 0)
{
compare = c;
EncodeGameGenie();
}
}
}
else
{
compare = -1;
EncodeGameGenie();
}
}
TryEnableAddCheat();
}
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 EncodeGameGenie()
{
char[] letters = {'A','P','Z','L','G','I','T','Y','E','O','X','U','K','S','V','N'};
if (address >= 0x8000)
address -= 0x8000;
GameGenieCode.Text = "";
byte[] num = {0, 0, 0, 0, 0, 0, 0, 0};
num[0] = (byte)((value & 7) + ((value >> 4) & 8));
num[1] = (byte)(((value >> 4) & 7) + ((address >> 4) & 8));
num[2] = (byte)(((address >> 4) & 7));
num[3] = (byte)((address >> 12) + (address & 8));
num[4] = (byte)((address & 7) + ((address >> 8) & 8));
num[5] = (byte)(((address >> 8) & 7));
private void ValueBox_TextChanged(object sender, EventArgs e)
{
if (Encoding.Checked && ValueBox.Text.Length > 0)
{
int v = int.Parse(ValueBox.Text, NumberStyles.HexNumber);
if (v > 0 && v < 0x100)
{
if (AddressBox.Text.Length > 0)
{
value = v;
EncodeGameGenie();
}
}
}
if (compare < 0 || CompareBox.Text.Length == 0)
{
num[5] += (byte)(value & 8);
for (int x = 0; x < 6; x++)
GameGenieCode.Text += letters[num[x]];
}
else
{
num[2] += 8;
num[5] += (byte)(compare & 8);
num[6] = (byte)((compare & 7) + ((compare >> 4) & 8));
num[7] = (byte)(((compare >> 4) & 7) + (value & 8));
for (int x = 0; x < 8; x++)
GameGenieCode.Text += letters[num[x]];
}
}
TryEnableAddCheat();
}
private void ClearButton_Click(object sender, EventArgs e)
{
ClearProperties();
GameGenieCode.Text = "";
Encoding.Checked = false;
}
private void EncodeGameGenie()
{
char[] letters = { 'A', 'P', 'Z', 'L', 'G', 'I', 'T', 'Y', 'E', 'O', 'X', 'U', 'K', 'S', 'V', 'N' };
if (address >= 0x8000)
address -= 0x8000;
GameGenieCode.Text = "";
byte[] num = { 0, 0, 0, 0, 0, 0, 0, 0 };
num[0] = (byte)((value & 7) + ((value >> 4) & 8));
num[1] = (byte)(((value >> 4) & 7) + ((address >> 4) & 8));
num[2] = (byte)(((address >> 4) & 7));
num[3] = (byte)((address >> 12) + (address & 8));
num[4] = (byte)((address & 7) + ((address >> 8) & 8));
num[5] = (byte)(((address >> 8) & 7));
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);
}
if (compare < 0 || CompareBox.Text.Length == 0)
{
num[5] += (byte)(value & 8);
for (int x = 0; x < 6; x++)
GameGenieCode.Text += letters[num[x]];
}
else
{
num[2] += 8;
num[5] += (byte)(compare & 8);
num[6] = (byte)((compare & 7) + ((compare >> 4) & 8));
num[7] = (byte)(((compare >> 4) & 7) + (value & 8));
for (int x = 0; x < 8; x++)
GameGenieCode.Text += letters[num[x]];
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
}
private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.NESGGSaveWindowPosition ^= true;
}
private void ClearButton_Click(object sender, EventArgs e)
{
ClearProperties();
GameGenieCode.Text = "";
Encoding.Checked = false;
}
private void autoloadToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.NESGGAutoload ^= true;
}
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.domain = Global.Emulator.MemoryDomains[1];
c.Enable();
private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
autoloadToolStripMenuItem.Checked = Global.Config.NESGGAutoload;
saveWindowPositionToolStripMenuItem.Checked = Global.Config.NESGGSaveWindowPosition;
}
}
Global.MainForm.Cheats1.AddCheat(c);
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.NESGGSaveWindowPosition ^= true;
}
private void autoloadToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.NESGGAutoload ^= true;
}
private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
autoloadToolStripMenuItem.Checked = Global.Config.NESGGAutoload;
saveWindowPositionToolStripMenuItem.Checked = Global.Config.NESGGSaveWindowPosition;
}
}
}