diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index 5e1bd9ba81..29836b0b15 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -101,6 +101,7 @@ // Cheats Dialog public bool AutoLoadCheats = false; public bool CheatsSaveWindowPosition = true; + public bool DisableCheatsOnLoad = false; public RecentFiles RecentCheats = new RecentFiles(8); public int CheatsWndx = -1; public int CheatsWndy = -1; diff --git a/BizHawk.MultiClient/tools/Cheats.Designer.cs b/BizHawk.MultiClient/tools/Cheats.Designer.cs index 44278d696e..2fd81d6cc5 100644 --- a/BizHawk.MultiClient/tools/Cheats.Designer.cs +++ b/BizHawk.MultiClient/tools/Cheats.Designer.cs @@ -54,7 +54,7 @@ this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.findAndLoadCheatFileByGameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.autoTurnOnCheatsOnLoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.CheatsOnOffLoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); @@ -177,24 +177,24 @@ // noneToolStripMenuItem // this.noneToolStripMenuItem.Name = "noneToolStripMenuItem"; - this.noneToolStripMenuItem.Size = new System.Drawing.Size(132, 22); + this.noneToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.noneToolStripMenuItem.Text = "None"; // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(129, 6); + this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6); // // clearToolStripMenuItem // this.clearToolStripMenuItem.Name = "clearToolStripMenuItem"; - this.clearToolStripMenuItem.Size = new System.Drawing.Size(132, 22); + this.clearToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.clearToolStripMenuItem.Text = "Clear"; // // autoLoadToolStripMenuItem // this.autoLoadToolStripMenuItem.Name = "autoLoadToolStripMenuItem"; - this.autoLoadToolStripMenuItem.Size = new System.Drawing.Size(132, 22); + this.autoLoadToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.autoLoadToolStripMenuItem.Text = "Auto-load"; // // toolStripSeparator1 @@ -281,7 +281,7 @@ this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.saveWindowPositionToolStripMenuItem, this.findAndLoadCheatFileByGameToolStripMenuItem, - this.autoTurnOnCheatsOnLoadToolStripMenuItem, + this.CheatsOnOffLoadToolStripMenuItem, this.toolStripSeparator5, this.restoreWindowSizeToolStripMenuItem}); this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; @@ -302,11 +302,12 @@ this.findAndLoadCheatFileByGameToolStripMenuItem.Size = new System.Drawing.Size(248, 22); this.findAndLoadCheatFileByGameToolStripMenuItem.Text = "Find and Load Cheat File by Game"; // - // autoTurnOnCheatsOnLoadToolStripMenuItem + // CheatsOnOffLoadToolStripMenuItem // - this.autoTurnOnCheatsOnLoadToolStripMenuItem.Name = "autoTurnOnCheatsOnLoadToolStripMenuItem"; - this.autoTurnOnCheatsOnLoadToolStripMenuItem.Size = new System.Drawing.Size(248, 22); - this.autoTurnOnCheatsOnLoadToolStripMenuItem.Text = "Auto Turn on Cheats on Load"; + this.CheatsOnOffLoadToolStripMenuItem.Name = "CheatsOnOffLoadToolStripMenuItem"; + this.CheatsOnOffLoadToolStripMenuItem.Size = new System.Drawing.Size(248, 22); + this.CheatsOnOffLoadToolStripMenuItem.Text = "Disable Cheats on Load"; + this.CheatsOnOffLoadToolStripMenuItem.Click += new System.EventHandler(this.CheatsOnOffLoadToolStripMenuItem_Click); // // toolStripSeparator5 // @@ -706,7 +707,7 @@ private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem findAndLoadCheatFileByGameToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem autoTurnOnCheatsOnLoadToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem CheatsOnOffLoadToolStripMenuItem; private System.Windows.Forms.GroupBox AddCheatGroup; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label2; diff --git a/BizHawk.MultiClient/tools/Cheats.cs b/BizHawk.MultiClient/tools/Cheats.cs index 7b9ff8275c..9d990be706 100644 --- a/BizHawk.MultiClient/tools/Cheats.cs +++ b/BizHawk.MultiClient/tools/Cheats.cs @@ -16,6 +16,7 @@ namespace BizHawk.MultiClient //Implement Options menu settings //Implement Freeze functions in all memory domains //Restore Window Size should restore column order as well + //Disable all cheats menu & context menu item int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired int defaultHeight; @@ -44,7 +45,8 @@ namespace BizHawk.MultiClient AddressBox.Text = ""; ValueBox.Text = ""; PopulateMemoryDomainComboBox(); - AddressBox.MaxLength = GetNumDigits(Global.Emulator.MainMemory.Size - 1); + //AddressBox.MaxLength = GetNumDigits(Global.Emulator.MainMemory.Size - 1); + //TODO: use currently selected memory domain! } public void Restart() @@ -560,6 +562,11 @@ namespace BizHawk.MultiClient UpdateNumberOfCheats(); } + if (Global.Config.DisableCheatsOnLoad) + { + for (int x = 0; x < cheatList.Count; x++) + cheatList[x].Disable(); + } return true; //TODO } @@ -691,6 +698,7 @@ namespace BizHawk.MultiClient private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e) { saveWindowPositionToolStripMenuItem.Checked = Global.Config.CheatsSaveWindowPosition; + CheatsOnOffLoadToolStripMenuItem.Checked = Global.Config.DisableCheatsOnLoad; } private void DuplicateCheat() @@ -869,5 +877,10 @@ namespace BizHawk.MultiClient saveToolStripMenuItem.Enabled = true; } } + + private void CheatsOnOffLoadToolStripMenuItem_Click(object sender, EventArgs e) + { + Global.Config.DisableCheatsOnLoad ^= true; + } } }