diff --git a/BizHawk.MultiClient/BizHawk.MultiClient_v4.5.csproj b/BizHawk.MultiClient/BizHawk.MultiClient_v4.5.csproj index f91ee798be..280d5d6f4f 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient_v4.5.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient_v4.5.csproj @@ -818,6 +818,9 @@ Resources.resx True + + NewCheatForm.cs + HexColor.cs diff --git a/BizHawk.MultiClient/SATTools/SaturnPrefs.Designer.cs b/BizHawk.MultiClient/SATTools/SaturnPrefs.Designer.cs index c8e4afb1f6..14482f5486 100644 --- a/BizHawk.MultiClient/SATTools/SaturnPrefs.Designer.cs +++ b/BizHawk.MultiClient/SATTools/SaturnPrefs.Designer.cs @@ -29,22 +29,22 @@ private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.radioButtonSoft = new System.Windows.Forms.RadioButton(); this.radioButtonGL = new System.Windows.Forms.RadioButton(); + this.radioButtonSoft = new System.Windows.Forms.RadioButton(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.radioButtonFactor = new System.Windows.Forms.RadioButton(); - this.radioButtonFree = new System.Windows.Forms.RadioButton(); - this.numericUpDownFactor = new System.Windows.Forms.NumericUpDown(); - this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); - this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); this.label1 = new System.Windows.Forms.Label(); + this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownFactor = new System.Windows.Forms.NumericUpDown(); + this.radioButtonFree = new System.Windows.Forms.RadioButton(); + this.radioButtonFactor = new System.Windows.Forms.RadioButton(); this.buttonOK = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFactor)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFactor)).BeginInit(); this.SuspendLayout(); // // groupBox1 @@ -58,6 +58,17 @@ this.groupBox1.TabStop = false; this.groupBox1.Text = "Render Type"; // + // radioButtonGL + // + this.radioButtonGL.AutoSize = true; + this.radioButtonGL.Location = new System.Drawing.Point(6, 42); + this.radioButtonGL.Name = "radioButtonGL"; + this.radioButtonGL.Size = new System.Drawing.Size(68, 17); + this.radioButtonGL.TabIndex = 1; + this.radioButtonGL.TabStop = true; + this.radioButtonGL.Text = "Open GL"; + this.radioButtonGL.UseVisualStyleBackColor = true; + // // radioButtonSoft // this.radioButtonSoft.AutoSize = true; @@ -70,17 +81,6 @@ this.radioButtonSoft.UseVisualStyleBackColor = true; this.radioButtonSoft.CheckedChanged += new System.EventHandler(this.radioButtonSoft_CheckedChanged); // - // radioButtonGL - // - this.radioButtonGL.AutoSize = true; - this.radioButtonGL.Location = new System.Drawing.Point(6, 42); - this.radioButtonGL.Name = "radioButtonGL"; - this.radioButtonGL.Size = new System.Drawing.Size(68, 17); - this.radioButtonGL.TabIndex = 1; - this.radioButtonGL.TabStop = true; - this.radioButtonGL.Text = "Open GL"; - this.radioButtonGL.UseVisualStyleBackColor = true; - // // groupBox2 // this.groupBox2.Controls.Add(this.label1); @@ -91,33 +91,73 @@ this.groupBox2.Controls.Add(this.radioButtonFactor); this.groupBox2.Location = new System.Drawing.Point(129, 12); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(254, 100); + this.groupBox2.Size = new System.Drawing.Size(215, 100); this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; this.groupBox2.Text = "Render Resolution"; // - // radioButtonFactor + // label1 // - this.radioButtonFactor.AutoSize = true; - this.radioButtonFactor.Location = new System.Drawing.Point(6, 19); - this.radioButtonFactor.Name = "radioButtonFactor"; - this.radioButtonFactor.Size = new System.Drawing.Size(107, 17); - this.radioButtonFactor.TabIndex = 0; - this.radioButtonFactor.TabStop = true; - this.radioButtonFactor.Text = "Multiple of Native"; - this.radioButtonFactor.UseVisualStyleBackColor = true; - this.radioButtonFactor.CheckedChanged += new System.EventHandler(this.radioButtonFactor_CheckedChanged); + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(134, 48); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(14, 13); + this.label1.TabIndex = 5; + this.label1.Text = "X"; // - // radioButtonFree + // numericUpDown2 // - this.radioButtonFree.AutoSize = true; - this.radioButtonFree.Location = new System.Drawing.Point(6, 42); - this.radioButtonFree.Name = "radioButtonFree"; - this.radioButtonFree.Size = new System.Drawing.Size(63, 17); - this.radioButtonFree.TabIndex = 1; - this.radioButtonFree.TabStop = true; - this.radioButtonFree.Text = "Specific"; - this.radioButtonFree.UseVisualStyleBackColor = true; + this.numericUpDown2.Increment = new decimal(new int[] { + 8, + 0, + 0, + 0}); + this.numericUpDown2.Location = new System.Drawing.Point(154, 44); + this.numericUpDown2.Maximum = new decimal(new int[] { + 1024, + 0, + 0, + 0}); + this.numericUpDown2.Minimum = new decimal(new int[] { + 224, + 0, + 0, + 0}); + this.numericUpDown2.Name = "numericUpDown2"; + this.numericUpDown2.Size = new System.Drawing.Size(53, 20); + this.numericUpDown2.TabIndex = 4; + this.numericUpDown2.Value = new decimal(new int[] { + 224, + 0, + 0, + 0}); + // + // numericUpDown1 + // + this.numericUpDown1.Increment = new decimal(new int[] { + 8, + 0, + 0, + 0}); + this.numericUpDown1.Location = new System.Drawing.Point(75, 44); + this.numericUpDown1.Maximum = new decimal(new int[] { + 2048, + 0, + 0, + 0}); + this.numericUpDown1.Minimum = new decimal(new int[] { + 320, + 0, + 0, + 0}); + this.numericUpDown1.Name = "numericUpDown1"; + this.numericUpDown1.Size = new System.Drawing.Size(53, 20); + this.numericUpDown1.TabIndex = 3; + this.numericUpDown1.Value = new decimal(new int[] { + 320, + 0, + 0, + 0}); // // numericUpDownFactor // @@ -141,73 +181,34 @@ 0, 0}); // - // numericUpDown1 + // radioButtonFree // - this.numericUpDown1.Increment = new decimal(new int[] { - 8, - 0, - 0, - 0}); - this.numericUpDown1.Location = new System.Drawing.Point(75, 42); - this.numericUpDown1.Maximum = new decimal(new int[] { - 2048, - 0, - 0, - 0}); - this.numericUpDown1.Minimum = new decimal(new int[] { - 320, - 0, - 0, - 0}); - this.numericUpDown1.Name = "numericUpDown1"; - this.numericUpDown1.Size = new System.Drawing.Size(67, 20); - this.numericUpDown1.TabIndex = 3; - this.numericUpDown1.Value = new decimal(new int[] { - 320, - 0, - 0, - 0}); + this.radioButtonFree.AutoSize = true; + this.radioButtonFree.Location = new System.Drawing.Point(6, 46); + this.radioButtonFree.Name = "radioButtonFree"; + this.radioButtonFree.Size = new System.Drawing.Size(63, 17); + this.radioButtonFree.TabIndex = 1; + this.radioButtonFree.TabStop = true; + this.radioButtonFree.Text = "Specific"; + this.radioButtonFree.UseVisualStyleBackColor = true; // - // numericUpDown2 + // radioButtonFactor // - this.numericUpDown2.Increment = new decimal(new int[] { - 8, - 0, - 0, - 0}); - this.numericUpDown2.Location = new System.Drawing.Point(166, 42); - this.numericUpDown2.Maximum = new decimal(new int[] { - 1024, - 0, - 0, - 0}); - this.numericUpDown2.Minimum = new decimal(new int[] { - 224, - 0, - 0, - 0}); - this.numericUpDown2.Name = "numericUpDown2"; - this.numericUpDown2.Size = new System.Drawing.Size(76, 20); - this.numericUpDown2.TabIndex = 4; - this.numericUpDown2.Value = new decimal(new int[] { - 224, - 0, - 0, - 0}); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(148, 49); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(14, 13); - this.label1.TabIndex = 5; - this.label1.Text = "X"; + this.radioButtonFactor.AutoSize = true; + this.radioButtonFactor.Location = new System.Drawing.Point(6, 19); + this.radioButtonFactor.Name = "radioButtonFactor"; + this.radioButtonFactor.Size = new System.Drawing.Size(107, 17); + this.radioButtonFactor.TabIndex = 0; + this.radioButtonFactor.TabStop = true; + this.radioButtonFactor.Text = "Multiple of Native"; + this.radioButtonFactor.UseVisualStyleBackColor = true; + this.radioButtonFactor.CheckedChanged += new System.EventHandler(this.radioButtonFactor_CheckedChanged); // // buttonOK // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.buttonOK.Location = new System.Drawing.Point(101, 118); + this.buttonOK.Location = new System.Drawing.Point(187, 120); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(75, 23); this.buttonOK.TabIndex = 2; @@ -217,8 +218,9 @@ // // buttonCancel // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Location = new System.Drawing.Point(216, 118); + this.buttonCancel.Location = new System.Drawing.Point(268, 120); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.TabIndex = 3; @@ -229,20 +231,21 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(395, 273); + this.ClientSize = new System.Drawing.Size(355, 155); this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonOK); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Name = "SaturnPrefs"; - this.Text = "SaturnPrefs"; + this.ShowIcon = false; + this.Text = "Preferences"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFactor)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFactor)).EndInit(); this.ResumeLayout(false); } diff --git a/BizHawk.MultiClient/tools/Cheats/CheatList.cs b/BizHawk.MultiClient/tools/Cheats/CheatList.cs index 3077320b5a..66a31277e8 100644 --- a/BizHawk.MultiClient/tools/Cheats/CheatList.cs +++ b/BizHawk.MultiClient/tools/Cheats/CheatList.cs @@ -1,8 +1,9 @@ using System; using System.Collections.Generic; +using System.Globalization; +using System.IO; using System.Linq; using System.Text; -using System.IO; using System.Windows.Forms; namespace BizHawk.MultiClient @@ -76,13 +77,13 @@ namespace BizHawk.MultiClient public void DisableAll() { _changes = true; - _cheatList.ForEach(x => x.Enabled = false); + _cheatList.ForEach(x => x.Disable()); } public void EnableAll() { _changes = true; - _cheatList.ForEach(x => x.Enabled = true); + _cheatList.ForEach(x => x.Enable()); } public bool IsActive(MemoryDomain domain, int address) @@ -169,7 +170,20 @@ namespace BizHawk.MultiClient { try { + int ADDR, VALUE, COMPARE; + MemoryDomain DOMAIN; + bool ENABLED; + string NAME; + if (s.Length < 6) continue; + //NewCheat c = new NewCheat( + string[] vals = s.Split('\t'); + ADDR = Int32.Parse(vals[0], NumberStyles.HexNumber); + VALUE = Int32.Parse(vals[1], NumberStyles.HexNumber); + COMPARE = Int32.Parse(vals[2], NumberStyles.HexNumber); + DOMAIN = ToolHelpers.DomainByName(vals[3]); + ENABLED = vals[4] == "1"; + NAME = vals[5]; } catch { diff --git a/BizHawk.MultiClient/tools/Cheats/NewCheat.cs b/BizHawk.MultiClient/tools/Cheats/NewCheat.cs index 1b66d437d7..fc0162315c 100644 --- a/BizHawk.MultiClient/tools/Cheats/NewCheat.cs +++ b/BizHawk.MultiClient/tools/Cheats/NewCheat.cs @@ -37,7 +37,6 @@ namespace BizHawk.MultiClient public bool Enabled { get { if (IsSeparator) return false; else return _enabled; } - set { if (!IsSeparator) { _enabled = value; } } } public int? Address @@ -76,9 +75,25 @@ namespace BizHawk.MultiClient #region Actions + public void Enable() + { + if (!IsSeparator) + { + _enabled = true; + } + } + + public void Disable() + { + if (!IsSeparator) + { + _enabled = false; + } + } + public void Pulse() { - if (!_watch.IsSeparator && _enabled) + if (!IsSeparator && _enabled) { if (_compare.HasValue) { diff --git a/BizHawk.MultiClient/tools/ToolHelpers.cs b/BizHawk.MultiClient/tools/ToolHelpers.cs index c9a5daf185..848d85a407 100644 --- a/BizHawk.MultiClient/tools/ToolHelpers.cs +++ b/BizHawk.MultiClient/tools/ToolHelpers.cs @@ -132,5 +132,19 @@ namespace BizHawk.MultiClient Global.MainForm.HexEditor1.SetDomain(domain); Global.MainForm.HexEditor1.SetToAddresses(addresses.ToList()); } + + public static MemoryDomain DomainByName(string name) + { + //Attempts to find the memory domain by name, if it fails, it defaults to index 0 + foreach (MemoryDomain domain in Global.Emulator.MemoryDomains) + { + if (domain.Name == name) + { + return domain; + } + } + + return Global.Emulator.MainMemory; + } } }