NES - Game Genie Encoder/Decoder - implement auto-load & window position saving

This commit is contained in:
andres.delikat 2011-03-19 01:10:03 +00:00
parent 3061c8ead8
commit f821ff8f50
5 changed files with 121 additions and 11 deletions

View File

@ -104,6 +104,12 @@
public int CheatsDomainWidth = -1; public int CheatsDomainWidth = -1;
public int CheatsOnWidth = -1; public int CheatsOnWidth = -1;
// NES Game Genie Encoder/Decoder
public bool NESGGAutoload = false;
public bool NESGGSaveWindowPosition = true;
public int NESGGWndx = -1;
public int NESGGWndy = -1;
//Movie Settings //Movie Settings
public RecentFiles RecentMovies = new RecentFiles(8); public RecentFiles RecentMovies = new RecentFiles(8);

View File

@ -143,6 +143,8 @@ namespace BizHawk.MultiClient
LoadCheatsWindow(); LoadCheatsWindow();
if (Global.Config.AutoLoadNESPPU && Global.Emulator is NES) if (Global.Config.AutoLoadNESPPU && Global.Emulator is NES)
LoadNESPPU(); LoadNESPPU();
if (Global.Config.NESGGAutoload && Global.Emulator is NES)
LoadGameGenieEC();
if (Global.Config.MainWndx >= 0 && Global.Config.MainWndy >= 0 && Global.Config.SaveWindowPosition) if (Global.Config.MainWndx >= 0 && Global.Config.MainWndy >= 0 && Global.Config.SaveWindowPosition)
this.Location = new Point(Global.Config.MainWndx, Global.Config.MainWndy); this.Location = new Point(Global.Config.MainWndx, Global.Config.MainWndy);
@ -997,6 +999,12 @@ namespace BizHawk.MultiClient
RamSearch1.Focus(); RamSearch1.Focus();
} }
public void LoadGameGenieEC()
{
NESGameGenie gg = new NESGameGenie();
gg.Show();
}
public void LoadHexEditor() public void LoadHexEditor()
{ {
if (!HexEditor1.IsHandleCreated || HexEditor1.IsDisposed) if (!HexEditor1.IsHandleCreated || HexEditor1.IsDisposed)
@ -1254,8 +1262,7 @@ namespace BizHawk.MultiClient
private void gameGenieCodesToolStripMenuItem_Click(object sender, EventArgs e) private void gameGenieCodesToolStripMenuItem_Click(object sender, EventArgs e)
{ {
NESGameGenie g = new NESGameGenie(); LoadGameGenieEC();
g.Show();
} }
private void cheatsToolStripMenuItem_Click(object sender, EventArgs e) private void cheatsToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -60,9 +60,16 @@
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.Encoding = new System.Windows.Forms.CheckBox(); this.Encoding = new System.Windows.Forms.CheckBox();
this.ClearButton = new System.Windows.Forms.Button(); 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.GameGenieCodeBox.SuspendLayout();
this.ButtonPanel.SuspendLayout(); this.ButtonPanel.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// GameGenieCode // GameGenieCode
@ -79,7 +86,7 @@
// GameGenieCodeBox // GameGenieCodeBox
// //
this.GameGenieCodeBox.Controls.Add(this.GameGenieCode); this.GameGenieCodeBox.Controls.Add(this.GameGenieCode);
this.GameGenieCodeBox.Location = new System.Drawing.Point(31, 85); this.GameGenieCodeBox.Location = new System.Drawing.Point(31, 103);
this.GameGenieCodeBox.Name = "GameGenieCodeBox"; this.GameGenieCodeBox.Name = "GameGenieCodeBox";
this.GameGenieCodeBox.Size = new System.Drawing.Size(115, 54); this.GameGenieCodeBox.Size = new System.Drawing.Size(115, 54);
this.GameGenieCodeBox.TabIndex = 1; this.GameGenieCodeBox.TabIndex = 1;
@ -151,7 +158,7 @@
// //
// AddCheat // AddCheat
// //
this.AddCheat.Location = new System.Drawing.Point(202, 217); this.AddCheat.Location = new System.Drawing.Point(202, 235);
this.AddCheat.Name = "AddCheat"; this.AddCheat.Name = "AddCheat";
this.AddCheat.Size = new System.Drawing.Size(69, 21); this.AddCheat.Size = new System.Drawing.Size(69, 21);
this.AddCheat.TabIndex = 3; this.AddCheat.TabIndex = 3;
@ -178,7 +185,7 @@
this.ButtonPanel.Controls.Add(this.Z); this.ButtonPanel.Controls.Add(this.Z);
this.ButtonPanel.Controls.Add(this.P); this.ButtonPanel.Controls.Add(this.P);
this.ButtonPanel.Controls.Add(this.A); this.ButtonPanel.Controls.Add(this.A);
this.ButtonPanel.Location = new System.Drawing.Point(31, 12); this.ButtonPanel.Location = new System.Drawing.Point(31, 30);
this.ButtonPanel.Name = "ButtonPanel"; this.ButtonPanel.Name = "ButtonPanel";
this.ButtonPanel.Size = new System.Drawing.Size(240, 67); this.ButtonPanel.Size = new System.Drawing.Size(240, 67);
this.ButtonPanel.TabIndex = 4; this.ButtonPanel.TabIndex = 4;
@ -354,7 +361,7 @@
this.groupBox1.Controls.Add(this.AddressBox); this.groupBox1.Controls.Add(this.AddressBox);
this.groupBox1.Controls.Add(this.ValueBox); this.groupBox1.Controls.Add(this.ValueBox);
this.groupBox1.Controls.Add(this.CompareBox); this.groupBox1.Controls.Add(this.CompareBox);
this.groupBox1.Location = new System.Drawing.Point(31, 145); this.groupBox1.Location = new System.Drawing.Point(31, 163);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(126, 93); this.groupBox1.Size = new System.Drawing.Size(126, 93);
this.groupBox1.TabIndex = 5; this.groupBox1.TabIndex = 5;
@ -391,7 +398,7 @@
// //
this.Encoding.Appearance = System.Windows.Forms.Appearance.Button; this.Encoding.Appearance = System.Windows.Forms.Appearance.Button;
this.Encoding.AutoSize = true; this.Encoding.AutoSize = true;
this.Encoding.Location = new System.Drawing.Point(217, 101); this.Encoding.Location = new System.Drawing.Point(217, 119);
this.Encoding.Name = "Encoding"; this.Encoding.Name = "Encoding";
this.Encoding.Size = new System.Drawing.Size(54, 23); this.Encoding.Size = new System.Drawing.Size(54, 23);
this.Encoding.TabIndex = 6; this.Encoding.TabIndex = 6;
@ -400,7 +407,7 @@
// //
// ClearButton // ClearButton
// //
this.ClearButton.Location = new System.Drawing.Point(217, 130); this.ClearButton.Location = new System.Drawing.Point(217, 148);
this.ClearButton.Name = "ClearButton"; this.ClearButton.Name = "ClearButton";
this.ClearButton.Size = new System.Drawing.Size(54, 23); this.ClearButton.Size = new System.Drawing.Size(54, 23);
this.ClearButton.TabIndex = 7; this.ClearButton.TabIndex = 7;
@ -408,6 +415,55 @@
this.ClearButton.UseVisualStyleBackColor = true; this.ClearButton.UseVisualStyleBackColor = true;
this.ClearButton.Click += new System.EventHandler(this.ClearButton_Click); 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.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 // NESGameGenie
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -419,7 +475,9 @@
this.Controls.Add(this.ButtonPanel); this.Controls.Add(this.ButtonPanel);
this.Controls.Add(this.AddCheat); this.Controls.Add(this.AddCheat);
this.Controls.Add(this.GameGenieCodeBox); this.Controls.Add(this.GameGenieCodeBox);
this.Controls.Add(this.menuStrip1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MainMenuStrip = this.menuStrip1;
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "NESGameGenie"; this.Name = "NESGameGenie";
this.ShowIcon = false; this.ShowIcon = false;
@ -430,6 +488,8 @@
this.ButtonPanel.ResumeLayout(false); this.ButtonPanel.ResumeLayout(false);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -469,5 +529,11 @@
private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button ClearButton; private System.Windows.Forms.Button ClearButton;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem autoloadToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
} }
} }

View File

@ -13,9 +13,6 @@ namespace BizHawk.MultiClient
{ {
public partial class NESGameGenie : Form public partial class NESGameGenie : Form
{ {
//TODO
//Autoload
//Save Window Position
int address = -1; int address = -1;
int value = -1; int value = -1;
int compare = -1; int compare = -1;
@ -24,6 +21,7 @@ namespace BizHawk.MultiClient
public NESGameGenie() public NESGameGenie()
{ {
InitializeComponent(); InitializeComponent();
Closing += (o, e) => SaveConfigSettings();
} }
private void NESGameGenie_Load(object sender, EventArgs e) private void NESGameGenie_Load(object sender, EventArgs e)
@ -46,6 +44,15 @@ namespace BizHawk.MultiClient
GameGenieTable.Add('N', 15); //1111 GameGenieTable.Add('N', 15); //1111
AddCheat.Enabled = false; AddCheat.Enabled = false;
if (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 GameGenieCode_KeyPress(object sender, KeyPressEventArgs e) private void GameGenieCode_KeyPress(object sender, KeyPressEventArgs e)
@ -376,5 +383,26 @@ namespace BizHawk.MultiClient
c.Enable(); c.Enable();
Global.MainForm.Cheats1.AddCheat(c); 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;
}
} }
} }

View File

@ -117,4 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>