GB Game Genie - convert to IToolFormAutoConfig

This commit is contained in:
adelikat 2015-01-01 19:07:57 +00:00
parent bb5b20cc33
commit 5bba86e23a
3 changed files with 3 additions and 160 deletions

View File

@ -341,10 +341,6 @@ namespace BizHawk.Client.Common
// TAStudio
public TasStateManagerSettings DefaultTasProjSettings = new TasStateManagerSettings();
// GB/GG Game Genie Encoder/Decoder
public ToolDialogSettings GbGGSettings = new ToolDialogSettings();
public bool GBGGAutoload = false;
// Movie Settings
public RecentFiles RecentMovies = new RecentFiles(8);
public string DefaultAuthor = "default user";

View File

@ -60,20 +60,11 @@
this.label4 = new System.Windows.Forms.Label();
this.ClearButton = new System.Windows.Forms.Button();
this.menuStrip1 = new MenuStripEx();
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.AutoloadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.cheatname = new System.Windows.Forms.TextBox();
this.GameGenieCodeBox.SuspendLayout();
this.ButtonPanel.SuspendLayout();
this.groupBox1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
@ -419,75 +410,12 @@
// 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(322, 24);
this.menuStrip1.TabIndex = 8;
this.menuStrip1.Text = "menuStrip1";
//
// OptionsSubMenu
//
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.AutoloadMenuItem,
this.toolStripSeparator2,
this.SaveWindowPositionMenuItem,
this.AlwaysOnTopMenuItem,
this.FloatingWindowMenuItem,
this.toolStripSeparator1,
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 = "Auto-load";
this.AutoloadMenuItem.Click += new System.EventHandler(this.AutoloadMenuItem_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(188, 6);
//
// 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);
//
// 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);
//
// 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);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.cheatname);
@ -535,8 +463,6 @@
this.ButtonPanel.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
@ -573,20 +499,12 @@
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button ClearButton;
private MenuStripEx menuStrip1;
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 ExitMenuItem;
private MenuStripEx menuStrip1;
private System.Windows.Forms.MaskedTextBox GGCodeMaskBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox cheatname;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label5;
private HexTextBox CompareBox;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
}
}

View File

@ -10,7 +10,7 @@ using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class GBGameGenie : Form, IToolForm
public partial class GBGameGenie : Form, IToolFormAutoConfig
{
// TODO: fix the use of Global.Game.System and Emulator.SystemId
[RequiredService]
@ -24,8 +24,6 @@ namespace BizHawk.Client.EmuHawk
private readonly Dictionary<char, int> _gameGenieTable = new Dictionary<char, int>();
private bool _processing;
#region Public
public bool AskSaveChanges() { return true; }
public bool UpdateBefore { get { return false; } }
@ -54,8 +52,6 @@ namespace BizHawk.Client.EmuHawk
public GBGameGenie()
{
InitializeComponent();
Closing += (o, e) => SaveConfigSettings();
TopMost = Global.Config.GbGGSettings.TopMost;
_gameGenieTable.Add('0', 0); // 0000
_gameGenieTable.Add('1', 1); // 0001
@ -144,8 +140,6 @@ namespace BizHawk.Client.EmuHawk
}
}
#endregion
private string GBGGEncode(int val, int add, int cmp)
{
char[] letters = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
@ -191,11 +185,6 @@ namespace BizHawk.Client.EmuHawk
{
addcheatbt.Enabled = false;
if (Global.Config.GbGGSettings.UseWindowPosition)
{
Location = Global.Config.GbGGSettings.WindowPosition;
}
//"Game Boy/Game Gear Game Genie Encoder / Decoder"
if (Emulator.SystemId == "GB")
{
@ -207,59 +196,7 @@ namespace BizHawk.Client.EmuHawk
}
}
private void SaveConfigSettings()
{
Global.Config.GbGGSettings.Wndx = Location.X;
Global.Config.GbGGSettings.Wndy = Location.Y;
}
private void RefreshFloatingWindowControl()
{
Owner = Global.Config.GbGGSettings.FloatingWindow ? null : GlobalWin.MainForm;
}
#region Events
#region Menu
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
{
AutoloadMenuItem.Checked = Global.Config.GBGGAutoload;
SaveWindowPositionMenuItem.Checked = Global.Config.GbGGSettings.SaveWindowPosition;
AlwaysOnTopMenuItem.Checked = Global.Config.GbGGSettings.TopMost;
FloatingWindowMenuItem.Checked = Global.Config.GbGGSettings.FloatingWindow;
}
private void AutoloadMenuItem_Click(object sender, EventArgs e)
{
Global.Config.GBGGAutoload ^= true;
}
private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e)
{
Global.Config.GbGGSettings.SaveWindowPosition ^= true;
}
private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e)
{
Global.Config.GbGGSettings.TopMost ^= true;
TopMost = Global.Config.GbGGSettings.TopMost;
}
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
{
Global.Config.GbGGSettings.FloatingWindow ^= true;
RefreshFloatingWindowControl();
}
private void ExitMenuItem_Click(object sender, EventArgs e)
{
Close();
}
#endregion
#region Dialog and Controls
#region Dialog and Control Events
private void AddCheatClick(object sender, EventArgs e)
{
@ -552,14 +489,6 @@ namespace BizHawk.Client.EmuHawk
}
}
protected override void OnShown(EventArgs e)
{
RefreshFloatingWindowControl();
base.OnShown(e);
}
#endregion
#endregion
}
}