Genesis Game Genie dialog - implement Always on Top and Floating window and refactor code
This commit is contained in:
parent
01b5c44d5c
commit
8654303b59
|
@ -486,10 +486,8 @@ namespace BizHawk.Client.Common
|
|||
|
||||
|
||||
// GEN Game Genie Encoder/Decoder
|
||||
public bool GENGGAutoload = false;
|
||||
public bool GENGGSaveWindowPosition = true;
|
||||
public int GENGGWndx = -1;
|
||||
public int GENGGWndy = -1;
|
||||
public ToolDialogSettings GenGGSettings = new ToolDialogSettings();
|
||||
public bool GenGGAutoload = false;
|
||||
|
||||
// Movie Settings
|
||||
public RecentFiles RecentMovies = new RecentFiles(8);
|
||||
|
|
|
@ -28,288 +28,309 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.menuStrip1 = new MenuStripEx();
|
||||
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.GGCodeMaskBox = new System.Windows.Forms.MaskedTextBox();
|
||||
this.addcheatbt = new System.Windows.Forms.Button();
|
||||
this.GameGenieCodeBox = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.ValueBox = new BizHawk.Client.EmuHawk.HexTextBox();
|
||||
this.AddressBox = new BizHawk.Client.EmuHawk.HexTextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.ClearBT = new System.Windows.Forms.Button();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.cheatname = new System.Windows.Forms.TextBox();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.GameGenieCodeBox.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.ClickThrough = true;
|
||||
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.autoloadToolStripMenuItem,
|
||||
this.saveWindowPositionToolStripMenuItem,
|
||||
this.menuStrip1 = new MenuStripEx();
|
||||
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.AutoloadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.GGCodeMaskBox = new System.Windows.Forms.MaskedTextBox();
|
||||
this.AddCheatButton = new System.Windows.Forms.Button();
|
||||
this.GameGenieCodeBox = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.ValueBox = new BizHawk.Client.EmuHawk.HexTextBox();
|
||||
this.AddressBox = new BizHawk.Client.EmuHawk.HexTextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.ClearButton = new System.Windows.Forms.Button();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.cheatname = new System.Windows.Forms.TextBox();
|
||||
this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.GameGenieCodeBox.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.ClickThrough = true;
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.OptionsSubMenu});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(292, 24);
|
||||
this.menuStrip1.TabIndex = 8;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// OptionsSubMenu
|
||||
//
|
||||
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.AutoloadMenuItem,
|
||||
this.SaveWindowPositionMenuItem,
|
||||
this.AlwaysOnTopMenuItem,
|
||||
this.FloatingWindowMenuItem,
|
||||
this.toolStripSeparator1,
|
||||
this.exitToolStripMenuItem});
|
||||
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
||||
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
||||
this.optionsToolStripMenuItem.Text = "&Options";
|
||||
//
|
||||
// autoloadToolStripMenuItem
|
||||
//
|
||||
this.autoloadToolStripMenuItem.Name = "autoloadToolStripMenuItem";
|
||||
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(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(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(191, 22);
|
||||
this.exitToolStripMenuItem.Text = "E&xit";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||
//
|
||||
// GGCodeMaskBox
|
||||
//
|
||||
this.GGCodeMaskBox.Location = new System.Drawing.Point(18, 30);
|
||||
this.GGCodeMaskBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.GGCodeMaskBox.Mask = ">AAAA-AAAA";
|
||||
this.GGCodeMaskBox.Name = "GGCodeMaskBox";
|
||||
this.GGCodeMaskBox.Size = new System.Drawing.Size(76, 20);
|
||||
this.GGCodeMaskBox.TabIndex = 9;
|
||||
this.GGCodeMaskBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.GGCodeMaskBox.TextMaskFormat = System.Windows.Forms.MaskFormat.ExcludePromptAndLiterals;
|
||||
this.GGCodeMaskBox.TextChanged += new System.EventHandler(this.GGCodeMaskBox_TextChanged);
|
||||
this.GGCodeMaskBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.GGCodeMaskBox_KeyPress);
|
||||
//
|
||||
// addcheatbt
|
||||
//
|
||||
this.addcheatbt.Enabled = false;
|
||||
this.addcheatbt.Location = new System.Drawing.Point(156, 117);
|
||||
this.addcheatbt.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.addcheatbt.Name = "addcheatbt";
|
||||
this.addcheatbt.Size = new System.Drawing.Size(72, 26);
|
||||
this.addcheatbt.TabIndex = 10;
|
||||
this.addcheatbt.Text = "&Add Cheat";
|
||||
this.addcheatbt.UseVisualStyleBackColor = true;
|
||||
this.addcheatbt.Click += new System.EventHandler(this.addcheatbt_Click);
|
||||
//
|
||||
// GameGenieCodeBox
|
||||
//
|
||||
this.GameGenieCodeBox.Controls.Add(this.GGCodeMaskBox);
|
||||
this.GameGenieCodeBox.Location = new System.Drawing.Point(20, 35);
|
||||
this.GameGenieCodeBox.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||
this.GameGenieCodeBox.Name = "GameGenieCodeBox";
|
||||
this.GameGenieCodeBox.Padding = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||
this.GameGenieCodeBox.Size = new System.Drawing.Size(116, 69);
|
||||
this.GameGenieCodeBox.TabIndex = 11;
|
||||
this.GameGenieCodeBox.TabStop = false;
|
||||
this.GameGenieCodeBox.Text = "Game Genie Code";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.groupBox1.Controls.Add(this.ValueBox);
|
||||
this.groupBox1.Controls.Add(this.AddressBox);
|
||||
this.groupBox1.Controls.Add(this.label6);
|
||||
this.groupBox1.Controls.Add(this.label4);
|
||||
this.groupBox1.Controls.Add(this.label3);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Location = new System.Drawing.Point(156, 35);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||
this.groupBox1.Size = new System.Drawing.Size(136, 69);
|
||||
this.groupBox1.TabIndex = 12;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Decoded Value";
|
||||
//
|
||||
// ValueBox
|
||||
//
|
||||
this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.ValueBox.Location = new System.Drawing.Point(92, 43);
|
||||
this.ValueBox.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||
this.ValueBox.MaxLength = 4;
|
||||
this.ValueBox.Name = "ValueBox";
|
||||
this.ValueBox.Nullable = true;
|
||||
this.ValueBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.ValueBox.Size = new System.Drawing.Size(40, 20);
|
||||
this.ValueBox.TabIndex = 23;
|
||||
this.ValueBox.TextChanged += new System.EventHandler(this.ValueBox_TextChanged);
|
||||
//
|
||||
// AddressBox
|
||||
//
|
||||
this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.AddressBox.Location = new System.Drawing.Point(72, 20);
|
||||
this.AddressBox.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||
this.AddressBox.MaxLength = 6;
|
||||
this.AddressBox.Name = "AddressBox";
|
||||
this.AddressBox.Nullable = true;
|
||||
this.AddressBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.AddressBox.Size = new System.Drawing.Size(60, 20);
|
||||
this.AddressBox.TabIndex = 22;
|
||||
this.AddressBox.TextChanged += new System.EventHandler(this.AddressBox_TextChanged);
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(68, 46);
|
||||
this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(18, 13);
|
||||
this.label6.TabIndex = 9;
|
||||
this.label6.Text = "0x";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(52, 24);
|
||||
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(18, 13);
|
||||
this.label4.TabIndex = 7;
|
||||
this.label4.Text = "0x";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(8, 46);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(34, 13);
|
||||
this.label3.TabIndex = 5;
|
||||
this.label3.Text = "Value";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(8, 24);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(45, 13);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Address";
|
||||
//
|
||||
// ClearBT
|
||||
//
|
||||
this.ClearBT.Location = new System.Drawing.Point(66, 117);
|
||||
this.ClearBT.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.ClearBT.Name = "ClearBT";
|
||||
this.ClearBT.Size = new System.Drawing.Size(68, 26);
|
||||
this.ClearBT.TabIndex = 13;
|
||||
this.ClearBT.Text = "&Clear";
|
||||
this.ClearBT.UseVisualStyleBackColor = true;
|
||||
this.ClearBT.Click += new System.EventHandler(this.ClearBT_Click);
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.cheatname);
|
||||
this.groupBox2.Location = new System.Drawing.Point(20, 154);
|
||||
this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.groupBox2.Size = new System.Drawing.Size(266, 50);
|
||||
this.groupBox2.TabIndex = 14;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Cheat Title (Uses GG code if left empty)";
|
||||
//
|
||||
// cheatname
|
||||
//
|
||||
this.cheatname.Location = new System.Drawing.Point(18, 24);
|
||||
this.cheatname.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.cheatname.Name = "cheatname";
|
||||
this.cheatname.Size = new System.Drawing.Size(228, 20);
|
||||
this.cheatname.TabIndex = 0;
|
||||
//
|
||||
// GenGameGenie
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(302, 218);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.ClearBT);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.GameGenieCodeBox);
|
||||
this.Controls.Add(this.addcheatbt);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(312, 293);
|
||||
this.MinimumSize = new System.Drawing.Size(312, 250);
|
||||
this.Name = "GenGameGenie";
|
||||
this.ShowIcon = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Genesis Game Genie Encoder / Decoder";
|
||||
this.Load += new System.EventHandler(this.GENGameGenie_Load);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.GameGenieCodeBox.ResumeLayout(false);
|
||||
this.GameGenieCodeBox.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
this.ExitMenuItem});
|
||||
this.OptionsSubMenu.Name = "OptionsSubMenu";
|
||||
this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
|
||||
this.OptionsSubMenu.Text = "&Options";
|
||||
this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened);
|
||||
//
|
||||
// AutoloadMenuItem
|
||||
//
|
||||
this.AutoloadMenuItem.Name = "AutoloadMenuItem";
|
||||
this.AutoloadMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||
this.AutoloadMenuItem.Text = "Autoload";
|
||||
this.AutoloadMenuItem.Click += new System.EventHandler(this.AutoloadMenuItem_Click);
|
||||
//
|
||||
// SaveWindowPositionMenuItem
|
||||
//
|
||||
this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem";
|
||||
this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||
this.SaveWindowPositionMenuItem.Text = "Save Window Position";
|
||||
this.SaveWindowPositionMenuItem.Click += new System.EventHandler(this.SaveWindowPositionMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(188, 6);
|
||||
//
|
||||
// ExitMenuItem
|
||||
//
|
||||
this.ExitMenuItem.Name = "ExitMenuItem";
|
||||
this.ExitMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
|
||||
this.ExitMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||
this.ExitMenuItem.Text = "E&xit";
|
||||
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
|
||||
//
|
||||
// GGCodeMaskBox
|
||||
//
|
||||
this.GGCodeMaskBox.Location = new System.Drawing.Point(18, 30);
|
||||
this.GGCodeMaskBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.GGCodeMaskBox.Mask = ">AAAA-AAAA";
|
||||
this.GGCodeMaskBox.Name = "GGCodeMaskBox";
|
||||
this.GGCodeMaskBox.Size = new System.Drawing.Size(76, 20);
|
||||
this.GGCodeMaskBox.TabIndex = 9;
|
||||
this.GGCodeMaskBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.GGCodeMaskBox.TextMaskFormat = System.Windows.Forms.MaskFormat.ExcludePromptAndLiterals;
|
||||
this.GGCodeMaskBox.TextChanged += new System.EventHandler(this.GGCodeMaskBox_TextChanged);
|
||||
this.GGCodeMaskBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.GGCodeMaskBox_KeyPress);
|
||||
//
|
||||
// AddCheatButton
|
||||
//
|
||||
this.AddCheatButton.Enabled = false;
|
||||
this.AddCheatButton.Location = new System.Drawing.Point(156, 117);
|
||||
this.AddCheatButton.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.AddCheatButton.Name = "AddCheatButton";
|
||||
this.AddCheatButton.Size = new System.Drawing.Size(72, 26);
|
||||
this.AddCheatButton.TabIndex = 10;
|
||||
this.AddCheatButton.Text = "&Add Cheat";
|
||||
this.AddCheatButton.UseVisualStyleBackColor = true;
|
||||
this.AddCheatButton.Click += new System.EventHandler(this.AddCheatButton_Click);
|
||||
//
|
||||
// GameGenieCodeBox
|
||||
//
|
||||
this.GameGenieCodeBox.Controls.Add(this.GGCodeMaskBox);
|
||||
this.GameGenieCodeBox.Location = new System.Drawing.Point(20, 35);
|
||||
this.GameGenieCodeBox.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||
this.GameGenieCodeBox.Name = "GameGenieCodeBox";
|
||||
this.GameGenieCodeBox.Padding = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||
this.GameGenieCodeBox.Size = new System.Drawing.Size(116, 69);
|
||||
this.GameGenieCodeBox.TabIndex = 11;
|
||||
this.GameGenieCodeBox.TabStop = false;
|
||||
this.GameGenieCodeBox.Text = "Game Genie Code";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.groupBox1.Controls.Add(this.ValueBox);
|
||||
this.groupBox1.Controls.Add(this.AddressBox);
|
||||
this.groupBox1.Controls.Add(this.label6);
|
||||
this.groupBox1.Controls.Add(this.label4);
|
||||
this.groupBox1.Controls.Add(this.label3);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Location = new System.Drawing.Point(156, 35);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||
this.groupBox1.Size = new System.Drawing.Size(136, 69);
|
||||
this.groupBox1.TabIndex = 12;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Decoded Value";
|
||||
//
|
||||
// ValueBox
|
||||
//
|
||||
this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.ValueBox.Location = new System.Drawing.Point(92, 43);
|
||||
this.ValueBox.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||
this.ValueBox.MaxLength = 4;
|
||||
this.ValueBox.Name = "ValueBox";
|
||||
this.ValueBox.Nullable = true;
|
||||
this.ValueBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.ValueBox.Size = new System.Drawing.Size(40, 20);
|
||||
this.ValueBox.TabIndex = 23;
|
||||
this.ValueBox.TextChanged += new System.EventHandler(this.ValueBox_TextChanged);
|
||||
//
|
||||
// AddressBox
|
||||
//
|
||||
this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.AddressBox.Location = new System.Drawing.Point(72, 20);
|
||||
this.AddressBox.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||
this.AddressBox.MaxLength = 6;
|
||||
this.AddressBox.Name = "AddressBox";
|
||||
this.AddressBox.Nullable = true;
|
||||
this.AddressBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.AddressBox.Size = new System.Drawing.Size(60, 20);
|
||||
this.AddressBox.TabIndex = 22;
|
||||
this.AddressBox.TextChanged += new System.EventHandler(this.AddressBox_TextChanged);
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(68, 46);
|
||||
this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(18, 13);
|
||||
this.label6.TabIndex = 9;
|
||||
this.label6.Text = "0x";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(52, 24);
|
||||
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(18, 13);
|
||||
this.label4.TabIndex = 7;
|
||||
this.label4.Text = "0x";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(8, 46);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(34, 13);
|
||||
this.label3.TabIndex = 5;
|
||||
this.label3.Text = "Value";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(8, 24);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(45, 13);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Address";
|
||||
//
|
||||
// ClearButton
|
||||
//
|
||||
this.ClearButton.Location = new System.Drawing.Point(66, 117);
|
||||
this.ClearButton.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.ClearButton.Name = "ClearButton";
|
||||
this.ClearButton.Size = new System.Drawing.Size(68, 26);
|
||||
this.ClearButton.TabIndex = 13;
|
||||
this.ClearButton.Text = "&Clear";
|
||||
this.ClearButton.UseVisualStyleBackColor = true;
|
||||
this.ClearButton.Click += new System.EventHandler(this.ClearButton_Click);
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.cheatname);
|
||||
this.groupBox2.Location = new System.Drawing.Point(20, 154);
|
||||
this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.groupBox2.Size = new System.Drawing.Size(266, 50);
|
||||
this.groupBox2.TabIndex = 14;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Cheat Title (Uses GG code if left empty)";
|
||||
//
|
||||
// cheatname
|
||||
//
|
||||
this.cheatname.Location = new System.Drawing.Point(18, 24);
|
||||
this.cheatname.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.cheatname.Name = "cheatname";
|
||||
this.cheatname.Size = new System.Drawing.Size(228, 20);
|
||||
this.cheatname.TabIndex = 0;
|
||||
//
|
||||
// AlwaysOnTopMenuItem
|
||||
//
|
||||
this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem";
|
||||
this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||
this.AlwaysOnTopMenuItem.Text = "Always On Top";
|
||||
this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click);
|
||||
//
|
||||
// FloatingWindowMenuItem
|
||||
//
|
||||
this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem";
|
||||
this.FloatingWindowMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||
this.FloatingWindowMenuItem.Text = "Floating Window";
|
||||
this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click);
|
||||
//
|
||||
// GenGameGenie
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(292, 218);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.ClearButton);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.GameGenieCodeBox);
|
||||
this.Controls.Add(this.AddCheatButton);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(312, 293);
|
||||
this.MinimumSize = new System.Drawing.Size(312, 250);
|
||||
this.Name = "GenGameGenie";
|
||||
this.ShowIcon = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Genesis Game Genie Encoder / Decoder";
|
||||
this.Load += new System.EventHandler(this.GenGameGenie_Load);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.GameGenieCodeBox.ResumeLayout(false);
|
||||
this.GameGenieCodeBox.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStripEx menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem autoloadToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem OptionsSubMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem AutoloadMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SaveWindowPositionMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ExitMenuItem;
|
||||
private System.Windows.Forms.MaskedTextBox GGCodeMaskBox;
|
||||
private System.Windows.Forms.Button addcheatbt;
|
||||
private System.Windows.Forms.Button AddCheatButton;
|
||||
private System.Windows.Forms.GroupBox GameGenieCodeBox;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button ClearBT;
|
||||
private System.Windows.Forms.Button ClearButton;
|
||||
private HexTextBox ValueBox;
|
||||
private HexTextBox AddressBox;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.TextBox cheatname;
|
||||
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
|
||||
}
|
||||
}
|
|
@ -1,12 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
//using BizHawk.Emulation.Cores.Sega.Genesis;
|
||||
|
||||
#pragma warning disable 675 //TOOD: fix the potential problem this is masking
|
||||
|
||||
|
@ -14,21 +12,69 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public partial class GenGameGenie : Form, IToolForm
|
||||
{
|
||||
bool _processing;
|
||||
private readonly Dictionary<char, int> GameGenieTable = new Dictionary<char, int>();
|
||||
private readonly Dictionary<char, int> _gameGenieTable = new Dictionary<char, int>
|
||||
{
|
||||
{ 'A', 0 },
|
||||
{ 'B', 1 },
|
||||
{ 'C', 2 },
|
||||
{ 'D', 3 },
|
||||
{ 'E', 4 },
|
||||
{ 'F', 5 },
|
||||
{ 'G', 6 },
|
||||
{ 'H', 7 },
|
||||
{ 'J', 8 },
|
||||
{ 'K', 9 },
|
||||
{ 'L', 10 },
|
||||
{ 'M', 11 },
|
||||
{ 'N', 12 },
|
||||
{ 'P', 13 },
|
||||
{ 'R', 14 },
|
||||
{ 'S', 15 },
|
||||
{ 'T', 16 },
|
||||
{ 'V', 17 },
|
||||
{ 'W', 18 },
|
||||
{ 'X', 19 },
|
||||
{ 'Y', 20 },
|
||||
{ 'Z', 21 },
|
||||
{ '0', 22 },
|
||||
{ '1', 23 },
|
||||
{ '2', 24 },
|
||||
{ '3', 25 },
|
||||
{ '4', 26 },
|
||||
{ '5', 27 },
|
||||
{ '6', 28 },
|
||||
{ '7', 29 },
|
||||
{ '8', 30 },
|
||||
{ '9', 31 }
|
||||
};
|
||||
|
||||
private bool _processing;
|
||||
|
||||
private void GenGameGenie_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (Global.Config.GenGGSettings.UseWindowPosition)
|
||||
{
|
||||
Location = Global.Config.GenGGSettings.WindowPosition;
|
||||
}
|
||||
}
|
||||
|
||||
#region Public API
|
||||
|
||||
public bool AskSave() { return true; }
|
||||
|
||||
public bool UpdateBefore { get { return false; } }
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
if (!(Global.Emulator.SystemId == "GEN"))
|
||||
if (Global.Emulator.SystemId != "GEN")
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateValues()
|
||||
{
|
||||
if (!(Global.Emulator.SystemId == "GEN"))
|
||||
if (Global.Emulator.SystemId != "GEN")
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
@ -38,101 +84,123 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
InitializeComponent();
|
||||
Closing += (o, e) => SaveConfigSettings();
|
||||
|
||||
GameGenieTable.Add('A', 0);
|
||||
GameGenieTable.Add('B', 1);
|
||||
GameGenieTable.Add('C', 2);
|
||||
GameGenieTable.Add('D', 3);
|
||||
GameGenieTable.Add('E', 4);
|
||||
GameGenieTable.Add('F', 5);
|
||||
GameGenieTable.Add('G', 6);
|
||||
GameGenieTable.Add('H', 7);
|
||||
GameGenieTable.Add('J', 8);
|
||||
GameGenieTable.Add('K', 9);
|
||||
GameGenieTable.Add('L', 10);
|
||||
GameGenieTable.Add('M', 11);
|
||||
GameGenieTable.Add('N', 12);
|
||||
GameGenieTable.Add('P', 13);
|
||||
GameGenieTable.Add('R', 14);
|
||||
GameGenieTable.Add('S', 15);
|
||||
GameGenieTable.Add('T', 16);
|
||||
GameGenieTable.Add('V', 17);
|
||||
GameGenieTable.Add('W', 18);
|
||||
GameGenieTable.Add('X', 19);
|
||||
GameGenieTable.Add('Y', 20);
|
||||
GameGenieTable.Add('Z', 21);
|
||||
GameGenieTable.Add('0', 22);
|
||||
GameGenieTable.Add('1', 23);
|
||||
GameGenieTable.Add('2', 24);
|
||||
GameGenieTable.Add('3', 25);
|
||||
GameGenieTable.Add('4', 26);
|
||||
GameGenieTable.Add('5', 27);
|
||||
GameGenieTable.Add('6', 28);
|
||||
GameGenieTable.Add('7', 29);
|
||||
GameGenieTable.Add('8', 30);
|
||||
GameGenieTable.Add('9', 31);
|
||||
TopMost = Global.Config.GenGGSettings.TopMost;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// code is code to be converted, val is pointer to value, add is pointer to address
|
||||
private void GenGGDecode(string code, ref int val, ref int add)
|
||||
{
|
||||
long hexcode = 0;
|
||||
long decoded = 0;
|
||||
int y = 0;
|
||||
|
||||
//convert code to a long binary string
|
||||
foreach (char t in code)
|
||||
// convert code to a long binary string
|
||||
foreach (var t in code)
|
||||
{
|
||||
hexcode <<= 5;
|
||||
GameGenieTable.TryGetValue(t, out y);
|
||||
int y;
|
||||
_gameGenieTable.TryGetValue(t, out y);
|
||||
hexcode |= y;
|
||||
}
|
||||
|
||||
decoded = ((hexcode & 0xFF00000000) >> 32);
|
||||
decoded |= (hexcode & 0x00FF000000);
|
||||
decoded |= ((hexcode & 0x0000FF0000) << 16 );
|
||||
decoded |= ((hexcode & 0x00000000700) << 5);
|
||||
decoded |= ((hexcode & 0x000000F800) >> 3);
|
||||
decoded |= ((hexcode & 0x00000000FF) << 16);
|
||||
long decoded = (hexcode & 0xFF00000000) >> 32;
|
||||
decoded |= hexcode & 0x00FF000000;
|
||||
decoded |= (hexcode & 0x0000FF0000) << 16;
|
||||
decoded |= (hexcode & 0x00000000700) << 5;
|
||||
decoded |= (hexcode & 0x000000F800) >> 3;
|
||||
decoded |= (hexcode & 0x00000000FF) << 16;
|
||||
|
||||
val = (int)(decoded & 0x000000FFFF);
|
||||
add = (int)((decoded & 0xFFFFFF0000) >> 16);
|
||||
|
||||
}
|
||||
|
||||
private string GenGGEncode(int val, int add)
|
||||
private static string GenGGEncode(int val, int add)
|
||||
{
|
||||
long encoded = 0;
|
||||
long encoded;
|
||||
string code = null;
|
||||
|
||||
encoded = ((long)(val & 0x00FF) << 32);
|
||||
encoded |= ((val & 0xE000) >> 5);
|
||||
encoded |= ((val & 0x1F00) << 3);
|
||||
encoded |= (add & 0xFF0000);
|
||||
encoded |= ((add & 0x00FF00) << 16);
|
||||
encoded |= (add & 0x0000FF);
|
||||
encoded = (long)(val & 0x00FF) << 32;
|
||||
encoded |= (val & 0xE000) >> 5;
|
||||
encoded |= (val & 0x1F00) << 3;
|
||||
encoded |= add & 0xFF0000;
|
||||
encoded |= (add & 0x00FF00) << 16;
|
||||
encoded |= add & 0x0000FF;
|
||||
|
||||
char[] letters = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
||||
for (int x = 0; x < 8; x++)
|
||||
for (var i = 0; i < 8; i++)
|
||||
{
|
||||
int chr = 0;
|
||||
chr = (int)(encoded & 0x1F);
|
||||
var chr = (int)(encoded & 0x1F);
|
||||
code += letters[chr];
|
||||
encoded >>= 5;
|
||||
}
|
||||
//reverse string, as its build backward
|
||||
char[] array = code.ToCharArray();
|
||||
Array.Reverse(array);
|
||||
return (new string(array));
|
||||
|
||||
// reverse string, as its build backward
|
||||
var array = code.ToCharArray();
|
||||
Array.Reverse(array);
|
||||
return new string(array);
|
||||
}
|
||||
|
||||
private void SaveConfigSettings()
|
||||
{
|
||||
Global.Config.GenGGSettings.Wndx = Location.X;
|
||||
Global.Config.GenGGSettings.Wndy = Location.Y;
|
||||
}
|
||||
|
||||
private void RefreshFloatingWindowControl()
|
||||
{
|
||||
Owner = Global.Config.GenGGSettings.FloatingWindow ? null : GlobalWin.MainForm;
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
#region Menu
|
||||
|
||||
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
AutoloadMenuItem.Checked = Global.Config.GenGGAutoload;
|
||||
SaveWindowPositionMenuItem.Checked = Global.Config.GenGGSettings.SaveWindowPosition;
|
||||
AlwaysOnTopMenuItem.Checked = Global.Config.GenGGSettings.TopMost;
|
||||
FloatingWindowMenuItem.Checked = Global.Config.GenGGSettings.FloatingWindow;
|
||||
}
|
||||
|
||||
private void AutoloadMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.GenGGAutoload ^= true;
|
||||
}
|
||||
|
||||
private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.GenGGSettings.SaveWindowPosition ^= true;
|
||||
}
|
||||
|
||||
private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.GenGGSettings.TopMost ^= true;
|
||||
TopMost = Global.Config.GenGGSettings.TopMost;
|
||||
}
|
||||
|
||||
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.GenGGSettings.FloatingWindow ^= true;
|
||||
RefreshFloatingWindowControl();
|
||||
}
|
||||
|
||||
private void ExitMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dialog and Controls
|
||||
|
||||
private void GGCodeMaskBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
//ignore I O Q U
|
||||
// ignore I O Q U
|
||||
if ((e.KeyChar == 73) || (e.KeyChar == 79) || (e.KeyChar == 81) || (e.KeyChar == 85) ||
|
||||
(e.KeyChar == 105) || (e.KeyChar == 111) || (e.KeyChar == 113) || (e.KeyChar == 117))
|
||||
{
|
||||
e.KeyChar = '\n' ;
|
||||
e.KeyChar = '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,67 +209,67 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (_processing == false)
|
||||
{
|
||||
_processing = true;
|
||||
//remove Invalid I O Q P if pasted
|
||||
|
||||
// remove Invalid I O Q P if pasted
|
||||
GGCodeMaskBox.Text = GGCodeMaskBox.Text.Replace("I", string.Empty);
|
||||
GGCodeMaskBox.Text = GGCodeMaskBox.Text.Replace("O", string.Empty);
|
||||
GGCodeMaskBox.Text = GGCodeMaskBox.Text.Replace("Q", string.Empty);
|
||||
GGCodeMaskBox.Text = GGCodeMaskBox.Text.Replace("U", string.Empty);
|
||||
|
||||
|
||||
if (GGCodeMaskBox.Text.Length > 0)
|
||||
{
|
||||
int val = 0;
|
||||
int add = 0;
|
||||
GenGGDecode(GGCodeMaskBox.Text, ref val, ref add);
|
||||
AddressBox.Text = String.Format("{0:X6}", add);
|
||||
ValueBox.Text = String.Format("{0:X4}", val);
|
||||
addcheatbt.Enabled = true;
|
||||
AddressBox.Text = string.Format("{0:X6}", add);
|
||||
ValueBox.Text = string.Format("{0:X4}", val);
|
||||
AddCheatButton.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
AddressBox.Text = "";
|
||||
ValueBox.Text = "";
|
||||
addcheatbt.Enabled = false;
|
||||
AddressBox.Text = string.Empty;
|
||||
ValueBox.Text = string.Empty;
|
||||
AddCheatButton.Enabled = false;
|
||||
}
|
||||
|
||||
_processing = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearBT_Click(object sender, EventArgs e)
|
||||
{
|
||||
AddressBox.Text = "";
|
||||
ValueBox.Text = "";
|
||||
GGCodeMaskBox.Text = "";
|
||||
addcheatbt.Enabled = false;
|
||||
}
|
||||
|
||||
private void AddressBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
//remove invalid character when pasted
|
||||
// remove invalid character when pasted
|
||||
if (_processing == false)
|
||||
{
|
||||
_processing = true;
|
||||
if (Regex.IsMatch(AddressBox.Text, @"[^a-fA-F0-9]"))
|
||||
{
|
||||
string temp = Regex.Replace(AddressBox.Text, @"[^a-fA-F0-9]", string.Empty);
|
||||
AddressBox.Text = temp;
|
||||
AddressBox.Text = Regex.Replace(AddressBox.Text, @"[^a-fA-F0-9]", string.Empty);
|
||||
}
|
||||
|
||||
if ((AddressBox.Text.Length > 0) || (ValueBox.Text.Length > 0))
|
||||
{
|
||||
int val = 0;
|
||||
int add = 0;
|
||||
if (ValueBox.Text.Length > 0)
|
||||
{
|
||||
val = int.Parse(ValueBox.Text, NumberStyles.HexNumber);
|
||||
}
|
||||
|
||||
if (AddressBox.Text.Length > 0)
|
||||
{
|
||||
add = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
||||
}
|
||||
|
||||
GGCodeMaskBox.Text = GenGGEncode(val, add);
|
||||
addcheatbt.Enabled = true;
|
||||
AddCheatButton.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
GGCodeMaskBox.Text = "";
|
||||
addcheatbt.Enabled = false;
|
||||
GGCodeMaskBox.Text = string.Empty;
|
||||
AddCheatButton.Enabled = false;
|
||||
}
|
||||
|
||||
_processing = false;
|
||||
}
|
||||
}
|
||||
|
@ -211,106 +279,100 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (_processing == false)
|
||||
{
|
||||
_processing = true;
|
||||
//remove invalid character when pasted
|
||||
|
||||
// remove invalid character when pasted
|
||||
if (Regex.IsMatch(ValueBox.Text, @"[^a-fA-F0-9]"))
|
||||
{
|
||||
string temp = Regex.Replace(ValueBox.Text, @"[^a-fA-F0-9]", string.Empty);
|
||||
ValueBox.Text = temp;
|
||||
ValueBox.Text = Regex.Replace(ValueBox.Text, @"[^a-fA-F0-9]", string.Empty);
|
||||
}
|
||||
|
||||
if ((AddressBox.Text.Length > 0) || (ValueBox.Text.Length > 0))
|
||||
{
|
||||
int val = 0;
|
||||
int add = 0;
|
||||
if (ValueBox.Text.Length > 0)
|
||||
{
|
||||
val = int.Parse(ValueBox.Text, NumberStyles.HexNumber);
|
||||
if (AddressBox.Text.Length > 0)
|
||||
add = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
||||
GGCodeMaskBox.Text = GenGGEncode(val, add);
|
||||
addcheatbt.Enabled = true;
|
||||
}
|
||||
|
||||
if (AddressBox.Text.Length > 0)
|
||||
{
|
||||
add = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
||||
}
|
||||
|
||||
GGCodeMaskBox.Text = GenGGEncode(val, add);
|
||||
AddCheatButton.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
GGCodeMaskBox.Text = "";
|
||||
addcheatbt.Enabled = false;
|
||||
GGCodeMaskBox.Text = string.Empty;
|
||||
AddCheatButton.Enabled = false;
|
||||
}
|
||||
|
||||
_processing = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void addcheatbt_Click(object sender, EventArgs e)
|
||||
private void ClearButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string NAME;
|
||||
int ADDRESS = 0;
|
||||
int VALUE = 0;
|
||||
AddressBox.Text = string.Empty;
|
||||
ValueBox.Text = string.Empty;
|
||||
GGCodeMaskBox.Text = string.Empty;
|
||||
AddCheatButton.Enabled = false;
|
||||
}
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(cheatname.Text))
|
||||
private void AddCheatButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string name;
|
||||
var address = 0;
|
||||
var value = 0;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(cheatname.Text))
|
||||
{
|
||||
NAME = cheatname.Text;
|
||||
name = cheatname.Text;
|
||||
}
|
||||
else
|
||||
{
|
||||
_processing = true;
|
||||
GGCodeMaskBox.TextMaskFormat = MaskFormat.IncludeLiterals;
|
||||
NAME = GGCodeMaskBox.Text;
|
||||
name = GGCodeMaskBox.Text;
|
||||
GGCodeMaskBox.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
|
||||
_processing = false;
|
||||
}
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(AddressBox.Text))
|
||||
if (!string.IsNullOrWhiteSpace(AddressBox.Text))
|
||||
{
|
||||
ADDRESS = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
||||
address = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
||||
}
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(ValueBox.Text))
|
||||
if (!string.IsNullOrWhiteSpace(ValueBox.Text))
|
||||
{
|
||||
VALUE = ValueBox.ToRawInt().Value;
|
||||
value = ValueBox.ToRawInt() ?? 0;
|
||||
}
|
||||
|
||||
Watch watch = Watch.GenerateWatch(
|
||||
var watch = Watch.GenerateWatch(
|
||||
Global.Emulator.MemoryDomains["MD CART"],
|
||||
ADDRESS,
|
||||
address,
|
||||
Watch.WatchSize.Word,
|
||||
Watch.DisplayType.Hex,
|
||||
NAME, true
|
||||
name,
|
||||
true
|
||||
);
|
||||
|
||||
Global.CheatList.Add(new Cheat(
|
||||
watch,
|
||||
VALUE
|
||||
value
|
||||
));
|
||||
}
|
||||
|
||||
private void autoloadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
Global.Config.GENGGAutoload ^= true;
|
||||
RefreshFloatingWindowControl();
|
||||
base.OnShown(e);
|
||||
}
|
||||
|
||||
private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.GENGGSaveWindowPosition ^= true;
|
||||
}
|
||||
|
||||
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void GENGameGenie_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (Global.Config.GENGGSaveWindowPosition && Global.Config.GENGGWndx >= 0 && Global.Config.GENGGWndy >= 0)
|
||||
{
|
||||
Location = new Point(Global.Config.GENGGWndx, Global.Config.GENGGWndy);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveConfigSettings()
|
||||
{
|
||||
Global.Config.GENGGWndx = Location.X;
|
||||
Global.Config.GENGGWndy = Location.Y;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue