diff --git a/GUI.NET/Config/CheatInfo.cs b/GUI.NET/Config/CheatInfo.cs index 0064efd2..208289ec 100644 --- a/GUI.NET/Config/CheatInfo.cs +++ b/GUI.NET/Config/CheatInfo.cs @@ -25,15 +25,16 @@ namespace Mesen.GUI.Config public UInt32 Address; public Byte Value; public Byte CompareValue; + public bool UseCompareValue; public bool IsRelativeAddress; public override string ToString() { switch(CheatType) { case CheatType.Custom: - return (!IsRelativeAddress ? "!" : "") + string.Format("{0:X4}:{1:X2}:{2:X2}", Address, Value, CompareValue); + return (!IsRelativeAddress ? "#" : "") + string.Format("{0:X4}:{1:X2}" + (UseCompareValue ? ":{2:X2}" : ""), Address, Value, CompareValue); case Config.CheatType.GameGenie: - return "GG: " + GameGenieCode; + return "GG: " + GameGenieCode.ToUpperInvariant(); case Config.CheatType.ProActionRocky: return "PRA: " + ProActionRockyCode.ToString("X"); } @@ -44,7 +45,7 @@ namespace Mesen.GUI.Config { switch(CheatType) { case CheatType.Custom: - InteropEmu.CheatAddCustom(Address, Value, CompareValue, IsRelativeAddress); + InteropEmu.CheatAddCustom(Address, Value, UseCompareValue ? CompareValue : -1, IsRelativeAddress); break; case Config.CheatType.GameGenie: diff --git a/GUI.NET/Forms/Cheats/frmCheat.Designer.cs b/GUI.NET/Forms/Cheats/frmCheat.Designer.cs index 81b24289..92f4e2d8 100644 --- a/GUI.NET/Forms/Cheats/frmCheat.Designer.cs +++ b/GUI.NET/Forms/Cheats/frmCheat.Designer.cs @@ -42,12 +42,12 @@ this.lblAddress = new System.Windows.Forms.Label(); this.txtAddress = new System.Windows.Forms.TextBox(); this.lblNewValue = new System.Windows.Forms.Label(); - this.lblCompare = new System.Windows.Forms.Label(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.radRelativeAddress = new System.Windows.Forms.RadioButton(); this.radAbsoluteAddress = new System.Windows.Forms.RadioButton(); this.txtValue = new System.Windows.Forms.TextBox(); this.txtCompare = new System.Windows.Forms.TextBox(); + this.chkCompareValue = new System.Windows.Forms.CheckBox(); this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); this.txtGameName = new System.Windows.Forms.TextBox(); this.btnBrowse = new System.Windows.Forms.Button(); @@ -60,6 +60,11 @@ this.flowLayoutPanel3.SuspendLayout(); this.SuspendLayout(); // + // baseConfigPanel + // + this.baseConfigPanel.Location = new System.Drawing.Point(0, 265); + this.baseConfigPanel.Size = new System.Drawing.Size(385, 29); + // // tableLayoutPanel2 // this.tableLayoutPanel2.ColumnCount = 2; @@ -79,7 +84,7 @@ this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(385, 264); + this.tableLayoutPanel2.Size = new System.Drawing.Size(385, 265); this.tableLayoutPanel2.TabIndex = 3; // // label2 @@ -118,7 +123,7 @@ this.grpCode.Dock = System.Windows.Forms.DockStyle.Fill; this.grpCode.Location = new System.Drawing.Point(3, 78); this.grpCode.Name = "grpCode"; - this.grpCode.Size = new System.Drawing.Size(379, 183); + this.grpCode.Size = new System.Drawing.Size(379, 184); this.grpCode.TabIndex = 3; this.grpCode.TabStop = false; this.grpCode.Text = "Code"; @@ -141,7 +146,7 @@ this.tlpAdd.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tlpAdd.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tlpAdd.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tlpAdd.Size = new System.Drawing.Size(373, 164); + this.tlpAdd.Size = new System.Drawing.Size(373, 165); this.tlpAdd.TabIndex = 0; // // radCustom @@ -202,10 +207,10 @@ this.tlpCustom.Controls.Add(this.lblAddress, 0, 0); this.tlpCustom.Controls.Add(this.txtAddress, 1, 0); this.tlpCustom.Controls.Add(this.lblNewValue, 0, 2); - this.tlpCustom.Controls.Add(this.lblCompare, 0, 3); this.tlpCustom.Controls.Add(this.flowLayoutPanel2, 1, 1); this.tlpCustom.Controls.Add(this.txtValue, 1, 2); this.tlpCustom.Controls.Add(this.txtCompare, 1, 3); + this.tlpCustom.Controls.Add(this.chkCompareValue, 0, 3); this.tlpCustom.Dock = System.Windows.Forms.DockStyle.Fill; this.tlpCustom.Location = new System.Drawing.Point(120, 55); this.tlpCustom.Name = "tlpCustom"; @@ -215,7 +220,7 @@ this.tlpCustom.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tlpCustom.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tlpCustom.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tlpCustom.Size = new System.Drawing.Size(250, 106); + this.tlpCustom.Size = new System.Drawing.Size(250, 107); this.tlpCustom.TabIndex = 4; // // lblAddress @@ -230,7 +235,7 @@ // // txtAddress // - this.txtAddress.Location = new System.Drawing.Point(91, 3); + this.txtAddress.Location = new System.Drawing.Point(107, 3); this.txtAddress.MaxLength = 8; this.txtAddress.Name = "txtAddress"; this.txtAddress.Size = new System.Drawing.Size(69, 20); @@ -247,24 +252,15 @@ this.lblNewValue.TabIndex = 3; this.lblNewValue.Text = "New Value:"; // - // lblCompare - // - this.lblCompare.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.lblCompare.AutoSize = true; - this.lblCompare.Location = new System.Drawing.Point(3, 85); - this.lblCompare.Name = "lblCompare"; - this.lblCompare.Size = new System.Drawing.Size(82, 13); - this.lblCompare.TabIndex = 2; - this.lblCompare.Text = "Compare Value:"; - // // flowLayoutPanel2 // + this.tlpCustom.SetColumnSpan(this.flowLayoutPanel2, 2); this.flowLayoutPanel2.Controls.Add(this.radRelativeAddress); this.flowLayoutPanel2.Controls.Add(this.radAbsoluteAddress); - this.flowLayoutPanel2.Location = new System.Drawing.Point(88, 26); + this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 26); this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Size = new System.Drawing.Size(159, 27); + this.flowLayoutPanel2.Size = new System.Drawing.Size(250, 27); this.flowLayoutPanel2.TabIndex = 4; // // radRelativeAddress @@ -293,7 +289,7 @@ // // txtValue // - this.txtValue.Location = new System.Drawing.Point(91, 56); + this.txtValue.Location = new System.Drawing.Point(107, 56); this.txtValue.MaxLength = 2; this.txtValue.Name = "txtValue"; this.txtValue.Size = new System.Drawing.Size(30, 20); @@ -302,12 +298,26 @@ // // txtCompare // - this.txtCompare.Location = new System.Drawing.Point(91, 82); + this.txtCompare.Enabled = false; + this.txtCompare.Location = new System.Drawing.Point(107, 82); this.txtCompare.MaxLength = 2; this.txtCompare.Name = "txtCompare"; this.txtCompare.Size = new System.Drawing.Size(30, 20); this.txtCompare.TabIndex = 6; // + // chkCompareValue + // + this.chkCompareValue.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.chkCompareValue.AutoSize = true; + this.chkCompareValue.Location = new System.Drawing.Point(3, 86); + this.chkCompareValue.Margin = new System.Windows.Forms.Padding(3, 6, 3, 3); + this.chkCompareValue.Name = "chkCompareValue"; + this.chkCompareValue.Size = new System.Drawing.Size(98, 17); + this.chkCompareValue.TabIndex = 7; + this.chkCompareValue.Text = "Compare Value"; + this.chkCompareValue.UseVisualStyleBackColor = true; + this.chkCompareValue.CheckedChanged += new System.EventHandler(this.chkCompareValue_CheckedChanged); + // // flowLayoutPanel3 // this.flowLayoutPanel3.Controls.Add(this.txtGameName); @@ -358,6 +368,7 @@ this.Name = "frmCheat"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Edit Cheat"; + this.Controls.SetChildIndex(this.baseConfigPanel, 0); this.Controls.SetChildIndex(this.tableLayoutPanel2, 0); this.tableLayoutPanel2.ResumeLayout(false); this.tableLayoutPanel2.PerformLayout(); @@ -391,7 +402,6 @@ private System.Windows.Forms.Label lblAddress; private System.Windows.Forms.TextBox txtAddress; private System.Windows.Forms.Label lblNewValue; - private System.Windows.Forms.Label lblCompare; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; private System.Windows.Forms.RadioButton radRelativeAddress; private System.Windows.Forms.RadioButton radAbsoluteAddress; @@ -401,6 +411,7 @@ private System.Windows.Forms.TextBox txtGameName; private System.Windows.Forms.Button btnBrowse; private System.Windows.Forms.CheckBox chkEnabled; + private System.Windows.Forms.CheckBox chkCompareValue; } diff --git a/GUI.NET/Forms/Cheats/frmCheat.cs b/GUI.NET/Forms/Cheats/frmCheat.cs index aec99709..fa47ac33 100644 --- a/GUI.NET/Forms/Cheats/frmCheat.cs +++ b/GUI.NET/Forms/Cheats/frmCheat.cs @@ -43,10 +43,9 @@ namespace Mesen.GUI.Forms.Cheats AddBinding("ProActionRockyCode", txtProActionRocky); AddBinding("Address", txtAddress); AddBinding("Value", txtValue); + AddBinding("UseCompareValue", chkCompareValue); AddBinding("CompareValue", txtCompare); AddBinding("IsRelativeAddress", radRelativeAddress.Parent); - - UpdateOKButton(); } protected override Type BindedType @@ -65,11 +64,6 @@ namespace Mesen.GUI.Forms.Cheats ((CheatInfo)Entity).GameHash = _gameHash; } - private void UpdateOKButton() - { - btnOK.Enabled = true; //this.IsValidInput(); - } - private void btnBrowse_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); @@ -78,7 +72,6 @@ namespace Mesen.GUI.Forms.Cheats _gameHash = MD5Helper.GetMD5Hash(ofd.FileName); if(_gameHash != null) { txtGameName.Text = Path.GetFileNameWithoutExtension(ofd.FileName); - UpdateOKButton(); } } } @@ -147,5 +140,10 @@ namespace Mesen.GUI.Forms.Cheats { radCustom.Checked = true; } + + private void chkCompareValue_CheckedChanged(object sender, EventArgs e) + { + txtCompare.Enabled = chkCompareValue.Checked; + } } }