From 9959d619495a85fd2325dc1c9ad85dcb03b533e6 Mon Sep 17 00:00:00 2001 From: Adam Sturge Date: Tue, 2 Feb 2016 20:32:46 -0800 Subject: [PATCH 01/10] Added comparison type dropdown. Updated Cheat model to contain reference to comparison type --- BizHawk.Client.Common/tools/Cheat.cs | 25 +++++- .../tools/Cheats/CheatEdit.Designer.cs | 58 ++++++++++--- .../tools/Cheats/CheatEdit.cs | 37 ++++++-- .../tools/Cheats/Cheats.Designer.cs | 86 +++++++++---------- 4 files changed, 145 insertions(+), 61 deletions(-) diff --git a/BizHawk.Client.Common/tools/Cheat.cs b/BizHawk.Client.Common/tools/Cheat.cs index 2b5c4a971d..8540667d02 100644 --- a/BizHawk.Client.Common/tools/Cheat.cs +++ b/BizHawk.Client.Common/tools/Cheat.cs @@ -6,10 +6,14 @@ namespace BizHawk.Client.Common { public class Cheat { + public enum ComparisonType { EQUAL, GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL, NOT_EQUAL}; + private readonly Watch _watch; private int? _compare; private int _val; private bool _enabled; + private ComparisonType _comparisonType; + public Cheat(Watch watch, int value, int? compare = null, bool enabled = true) { @@ -21,6 +25,25 @@ namespace BizHawk.Client.Common Pulse(); } + /// + /// Adding second constructor for comparison type because I fear updating the method signiture for something in the Common namespace + /// + /// + /// + /// + /// + /// + public Cheat(Watch watch, int value, ComparisonType comparisonType, int compare, bool enabled = true) + { + _enabled = enabled; + _watch = watch; + _compare = compare; + _val = value; + _comparisonType = comparisonType; + + Pulse(); + } + public Cheat(Cheat cheat) { if (cheat.IsSeparator) @@ -217,7 +240,7 @@ namespace BizHawk.Client.Common { if (_compare.HasValue) { - if (_compare.Value == _watch.ValueNoFreeze) + if (_compare.Value == _watch.ValueNoFreeze) // NOTE : THIS IS THE PLACE TO ADD DIFFERENT COMPARISON TYPES { _watch.Poke(GetStringForPulse(_val)); } diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.Designer.cs b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.Designer.cs index dbc4872689..9feacf2848 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.Designer.cs @@ -48,6 +48,8 @@ this.EditButton = new System.Windows.Forms.Button(); this.CompareBox = new BizHawk.Client.EmuHawk.WatchValueBox(); this.ValueBox = new BizHawk.Client.EmuHawk.WatchValueBox(); + this.CompareTypeDropDown = new System.Windows.Forms.ComboBox(); + this.CompareTypeLabel = new System.Windows.Forms.Label(); this.SuspendLayout(); // // NameBox @@ -124,7 +126,7 @@ // CompareLabel // this.CompareLabel.AutoSize = true; - this.CompareLabel.Location = new System.Drawing.Point(18, 95); + this.CompareLabel.Location = new System.Drawing.Point(24, 95); this.CompareLabel.Name = "CompareLabel"; this.CompareLabel.Size = new System.Drawing.Size(49, 13); this.CompareLabel.TabIndex = 13; @@ -133,7 +135,7 @@ // DomainLabel // this.DomainLabel.AutoSize = true; - this.DomainLabel.Location = new System.Drawing.Point(24, 124); + this.DomainLabel.Location = new System.Drawing.Point(24, 158); this.DomainLabel.Name = "DomainLabel"; this.DomainLabel.Size = new System.Drawing.Size(43, 13); this.DomainLabel.TabIndex = 16; @@ -143,7 +145,7 @@ // this.DomainDropDown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.DomainDropDown.FormattingEnabled = true; - this.DomainDropDown.Location = new System.Drawing.Point(78, 118); + this.DomainDropDown.Location = new System.Drawing.Point(78, 154); this.DomainDropDown.Name = "DomainDropDown"; this.DomainDropDown.Size = new System.Drawing.Size(100, 21); this.DomainDropDown.TabIndex = 17; @@ -152,7 +154,7 @@ // SizeLabel // this.SizeLabel.AutoSize = true; - this.SizeLabel.Location = new System.Drawing.Point(40, 150); + this.SizeLabel.Location = new System.Drawing.Point(40, 190); this.SizeLabel.Name = "SizeLabel"; this.SizeLabel.Size = new System.Drawing.Size(27, 13); this.SizeLabel.TabIndex = 18; @@ -166,7 +168,7 @@ "1 Byte", "2 Byte", "4 Byte"}); - this.SizeDropDown.Location = new System.Drawing.Point(78, 144); + this.SizeDropDown.Location = new System.Drawing.Point(78, 184); this.SizeDropDown.Name = "SizeDropDown"; this.SizeDropDown.Size = new System.Drawing.Size(100, 21); this.SizeDropDown.TabIndex = 19; @@ -175,7 +177,7 @@ // DisplayTypeLael // this.DisplayTypeLael.AutoSize = true; - this.DisplayTypeLael.Location = new System.Drawing.Point(11, 176); + this.DisplayTypeLael.Location = new System.Drawing.Point(11, 219); this.DisplayTypeLael.Name = "DisplayTypeLael"; this.DisplayTypeLael.Size = new System.Drawing.Size(56, 13); this.DisplayTypeLael.TabIndex = 20; @@ -189,7 +191,7 @@ "1 Byte", "2 Byte", "4 Byte"}); - this.DisplayTypeDropDown.Location = new System.Drawing.Point(78, 170); + this.DisplayTypeDropDown.Location = new System.Drawing.Point(78, 213); this.DisplayTypeDropDown.Name = "DisplayTypeDropDown"; this.DisplayTypeDropDown.Size = new System.Drawing.Size(100, 21); this.DisplayTypeDropDown.TabIndex = 21; @@ -198,7 +200,7 @@ // BigEndianCheckBox // this.BigEndianCheckBox.AutoSize = true; - this.BigEndianCheckBox.Location = new System.Drawing.Point(101, 196); + this.BigEndianCheckBox.Location = new System.Drawing.Point(101, 242); this.BigEndianCheckBox.Name = "BigEndianCheckBox"; this.BigEndianCheckBox.Size = new System.Drawing.Size(77, 17); this.BigEndianCheckBox.TabIndex = 22; @@ -209,7 +211,7 @@ // this.AddButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.AddButton.Enabled = false; - this.AddButton.Location = new System.Drawing.Point(7, 220); + this.AddButton.Location = new System.Drawing.Point(7, 265); this.AddButton.Name = "AddButton"; this.AddButton.Size = new System.Drawing.Size(65, 23); this.AddButton.TabIndex = 23; @@ -221,7 +223,7 @@ // this.EditButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.EditButton.Enabled = false; - this.EditButton.Location = new System.Drawing.Point(113, 220); + this.EditButton.Location = new System.Drawing.Point(113, 265); this.EditButton.Name = "EditButton"; this.EditButton.Size = new System.Drawing.Size(65, 23); this.EditButton.TabIndex = 24; @@ -254,9 +256,41 @@ this.ValueBox.Text = "00"; this.ValueBox.Type = BizHawk.Client.Common.DisplayType.Hex; // + // CompareTypeDropDown + // + this.CompareTypeDropDown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CompareTypeDropDown.FormattingEnabled = true; + this.CompareTypeDropDown.Location = new System.Drawing.Point(113, 122); + this.CompareTypeDropDown.Name = "CompareTypeDropDown"; + this.CompareTypeDropDown.Size = new System.Drawing.Size(65, 21); + this.CompareTypeDropDown.TabIndex = 26; + this.CompareTypeDropDown.Items.AddRange( + new object[] { + "=", + ">", + ">=", + "<", + "<=", + "!=" + } + ); + this.CompareTypeDropDown.SelectedIndex = 0; + // + // CompareTypeLabel + // + this.CompareTypeLabel.AutoSize = true; + this.CompareTypeLabel.Location = new System.Drawing.Point(24, 125); + this.CompareTypeLabel.Name = "CompareTypeLabel"; + this.CompareTypeLabel.Size = new System.Drawing.Size(76, 13); + this.CompareTypeLabel.TabIndex = 25; + this.CompareTypeLabel.Text = "Compare Type"; + this.CompareTypeLabel.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // // CheatEdit // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; + this.Controls.Add(this.CompareTypeDropDown); + this.Controls.Add(this.CompareTypeLabel); this.Controls.Add(this.EditButton); this.Controls.Add(this.AddButton); this.Controls.Add(this.BigEndianCheckBox); @@ -278,7 +312,7 @@ this.Controls.Add(this.NameBox); this.Controls.Add(this.NameLabel); this.Name = "CheatEdit"; - this.Size = new System.Drawing.Size(191, 253); + this.Size = new System.Drawing.Size(191, 298); this.Load += new System.EventHandler(this.CheatEdit_Load); this.ResumeLayout(false); this.PerformLayout(); @@ -307,5 +341,7 @@ private System.Windows.Forms.CheckBox BigEndianCheckBox; private System.Windows.Forms.Button AddButton; private System.Windows.Forms.Button EditButton; + private System.Windows.Forms.ComboBox CompareTypeDropDown; + private System.Windows.Forms.Label CompareTypeLabel; } } diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs index 9cc5351bfa..d4b903ef2c 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs @@ -303,8 +303,9 @@ namespace BizHawk.Client.EmuHawk { get { + Cheat.ComparisonType comparisonType = Cheat.ComparisonType.EQUAL; var domain = MemoryDomains[DomainDropDown.SelectedItem.ToString()]; - var address = AddressBox.ToRawInt().Value; + var address = AddressBox.ToRawInt().Value; if (address < domain.Size) { var watch = Watch.GenerateWatch( @@ -316,11 +317,35 @@ namespace BizHawk.Client.EmuHawk NameBox.Text ); - return new Cheat( - watch, - ValueBox.ToRawInt().Value, - CompareBox.ToRawInt() - ); + if(CompareBox.ToRawInt() == null) + { + return new Cheat( + watch, + ValueBox.ToRawInt().Value + ); + } + else + { + switch (CompareTypeDropDown.SelectedText) + { + case "=" : comparisonType = Cheat.ComparisonType.EQUAL; break; + case ">" : comparisonType = Cheat.ComparisonType.GREATER_THAN; break; + case ">=" : comparisonType = Cheat.ComparisonType.GREATER_THAN_OR_EQUAL; break; + case "<" : comparisonType = Cheat.ComparisonType.LESS_THAN; break; + case "<=" : comparisonType = Cheat.ComparisonType.LESS_THAN_OR_EQUAL; break; + case "!=" : comparisonType = Cheat.ComparisonType.NOT_EQUAL; break; + default : comparisonType = Cheat.ComparisonType.EQUAL; break; + } + + return new Cheat( + watch, + ValueBox.ToRawInt().Value, + comparisonType, + CompareBox.ToRawInt().Value + ); + } + + } else { diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs index de352c16eb..e025aa331b 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs @@ -123,7 +123,7 @@ this.CheatListView.Name = "CheatListView"; this.CheatListView.SelectAllInProgress = false; this.CheatListView.selectedItem = -1; - this.CheatListView.Size = new System.Drawing.Size(414, 278); + this.CheatListView.Size = new System.Drawing.Size(414, 315); this.CheatListView.TabIndex = 1; this.CheatListView.UseCompatibleStateImageBehavior = false; this.CheatListView.UseCustomBackground = true; @@ -174,7 +174,7 @@ this.DisableAllContextMenuItem, this.ViewInHexEditorContextMenuItem}); this.CheatsContextMenu.Name = "contextMenuStrip1"; - this.CheatsContextMenu.Size = new System.Drawing.Size(161, 92); + this.CheatsContextMenu.Size = new System.Drawing.Size(170, 92); this.CheatsContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.CheatsContextMenu_Opening); // // ToggleContextMenuItem @@ -182,7 +182,7 @@ this.ToggleContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Refresh1; this.ToggleContextMenuItem.Name = "ToggleContextMenuItem"; this.ToggleContextMenuItem.ShortcutKeyDisplayString = "Enter"; - this.ToggleContextMenuItem.Size = new System.Drawing.Size(160, 22); + this.ToggleContextMenuItem.Size = new System.Drawing.Size(169, 22); this.ToggleContextMenuItem.Text = "&Toggle"; this.ToggleContextMenuItem.Click += new System.EventHandler(this.ToggleMenuItem_Click); // @@ -191,7 +191,7 @@ this.RemoveContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete; this.RemoveContextMenuItem.Name = "RemoveContextMenuItem"; this.RemoveContextMenuItem.ShortcutKeyDisplayString = "Delete"; - this.RemoveContextMenuItem.Size = new System.Drawing.Size(160, 22); + this.RemoveContextMenuItem.Size = new System.Drawing.Size(169, 22); this.RemoveContextMenuItem.Text = "&Remove"; this.RemoveContextMenuItem.Click += new System.EventHandler(this.RemoveCheatMenuItem_Click); // @@ -199,14 +199,14 @@ // this.DisableAllContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Stop; this.DisableAllContextMenuItem.Name = "DisableAllContextMenuItem"; - this.DisableAllContextMenuItem.Size = new System.Drawing.Size(160, 22); + this.DisableAllContextMenuItem.Size = new System.Drawing.Size(169, 22); this.DisableAllContextMenuItem.Text = "&Disable All"; this.DisableAllContextMenuItem.Click += new System.EventHandler(this.DisableAllCheatsMenuItem_Click); // // ViewInHexEditorContextMenuItem // this.ViewInHexEditorContextMenuItem.Name = "ViewInHexEditorContextMenuItem"; - this.ViewInHexEditorContextMenuItem.Size = new System.Drawing.Size(160, 22); + this.ViewInHexEditorContextMenuItem.Size = new System.Drawing.Size(169, 22); this.ViewInHexEditorContextMenuItem.Text = "View in Hex Editor"; this.ViewInHexEditorContextMenuItem.Click += new System.EventHandler(this.ViewInHexEditorContextMenuItem_Click); // @@ -235,7 +235,7 @@ this.toolStripSeparator1, this.ExitMenuItem}); this.FileSubMenu.Name = "FileSubMenu"; - this.FileSubMenu.Size = new System.Drawing.Size(35, 20); + this.FileSubMenu.Size = new System.Drawing.Size(37, 20); this.FileSubMenu.Text = "&File"; this.FileSubMenu.DropDownOpened += new System.EventHandler(this.FileSubMenu_DropDownOpened); // @@ -244,7 +244,7 @@ this.NewMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.NewFile; this.NewMenuItem.Name = "NewMenuItem"; this.NewMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); - this.NewMenuItem.Size = new System.Drawing.Size(193, 22); + this.NewMenuItem.Size = new System.Drawing.Size(195, 22); this.NewMenuItem.Text = "&New"; this.NewMenuItem.Click += new System.EventHandler(this.NewMenuItem_Click); // @@ -253,7 +253,7 @@ this.OpenMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.OpenFile; this.OpenMenuItem.Name = "OpenMenuItem"; this.OpenMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.OpenMenuItem.Size = new System.Drawing.Size(193, 22); + this.OpenMenuItem.Size = new System.Drawing.Size(195, 22); this.OpenMenuItem.Text = "&Open..."; this.OpenMenuItem.Click += new System.EventHandler(this.OpenMenuItem_Click); // @@ -262,7 +262,7 @@ this.SaveMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs; this.SaveMenuItem.Name = "SaveMenuItem"; this.SaveMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.SaveMenuItem.Size = new System.Drawing.Size(193, 22); + this.SaveMenuItem.Size = new System.Drawing.Size(195, 22); this.SaveMenuItem.Text = "&Save"; this.SaveMenuItem.Click += new System.EventHandler(this.SaveMenuItem_Click); // @@ -271,14 +271,14 @@ this.SaveAsMenuItem.Name = "SaveAsMenuItem"; this.SaveAsMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.S))); - this.SaveAsMenuItem.Size = new System.Drawing.Size(193, 22); + this.SaveAsMenuItem.Size = new System.Drawing.Size(195, 22); this.SaveAsMenuItem.Text = "Save &As..."; this.SaveAsMenuItem.Click += new System.EventHandler(this.SaveAsMenuItem_Click); // // AppendMenuItem // this.AppendMenuItem.Name = "AppendMenuItem"; - this.AppendMenuItem.Size = new System.Drawing.Size(193, 22); + this.AppendMenuItem.Size = new System.Drawing.Size(195, 22); this.AppendMenuItem.Text = "Append File"; // // RecentSubMenu @@ -287,7 +287,7 @@ this.toolStripSeparator4}); this.RecentSubMenu.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Recent; this.RecentSubMenu.Name = "RecentSubMenu"; - this.RecentSubMenu.Size = new System.Drawing.Size(193, 22); + this.RecentSubMenu.Size = new System.Drawing.Size(195, 22); this.RecentSubMenu.Text = "Recent"; this.RecentSubMenu.DropDownOpened += new System.EventHandler(this.RecentSubMenu_DropDownOpened); // @@ -299,13 +299,13 @@ // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(190, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(192, 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(193, 22); + this.ExitMenuItem.Size = new System.Drawing.Size(195, 22); this.ExitMenuItem.Text = "E&xit"; this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click); // @@ -324,7 +324,7 @@ this.GameGenieSeparator, this.OpenGameGenieEncoderDecoderMenuItem}); this.CheatsSubMenu.Name = "CheatsSubMenu"; - this.CheatsSubMenu.Size = new System.Drawing.Size(53, 20); + this.CheatsSubMenu.Size = new System.Drawing.Size(55, 20); this.CheatsSubMenu.Text = "&Cheats"; this.CheatsSubMenu.DropDownOpened += new System.EventHandler(this.CheatsSubMenu_DropDownOpened); // @@ -333,7 +333,7 @@ this.RemoveCheatMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete; this.RemoveCheatMenuItem.Name = "RemoveCheatMenuItem"; this.RemoveCheatMenuItem.ShortcutKeyDisplayString = "Delete"; - this.RemoveCheatMenuItem.Size = new System.Drawing.Size(217, 22); + this.RemoveCheatMenuItem.Size = new System.Drawing.Size(233, 22); this.RemoveCheatMenuItem.Text = "&Remove Cheat"; this.RemoveCheatMenuItem.Click += new System.EventHandler(this.RemoveCheatMenuItem_Click); // @@ -342,21 +342,21 @@ this.InsertSeparatorMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.InsertSeparator; this.InsertSeparatorMenuItem.Name = "InsertSeparatorMenuItem"; this.InsertSeparatorMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I))); - this.InsertSeparatorMenuItem.Size = new System.Drawing.Size(217, 22); + this.InsertSeparatorMenuItem.Size = new System.Drawing.Size(233, 22); this.InsertSeparatorMenuItem.Text = "Insert Separator"; this.InsertSeparatorMenuItem.Click += new System.EventHandler(this.InsertSeparatorMenuItem_Click); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(214, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(230, 6); // // MoveUpMenuItem // this.MoveUpMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MoveUp; this.MoveUpMenuItem.Name = "MoveUpMenuItem"; this.MoveUpMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.U))); - this.MoveUpMenuItem.Size = new System.Drawing.Size(217, 22); + this.MoveUpMenuItem.Size = new System.Drawing.Size(233, 22); this.MoveUpMenuItem.Text = "Move &Up"; this.MoveUpMenuItem.Click += new System.EventHandler(this.MoveUpMenuItem_Click); // @@ -365,7 +365,7 @@ this.MoveDownMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MoveDown; this.MoveDownMenuItem.Name = "MoveDownMenuItem"; this.MoveDownMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D))); - this.MoveDownMenuItem.Size = new System.Drawing.Size(217, 22); + this.MoveDownMenuItem.Size = new System.Drawing.Size(233, 22); this.MoveDownMenuItem.Text = "Move &Down"; this.MoveDownMenuItem.Click += new System.EventHandler(this.MoveDownMenuItem_Click); // @@ -373,21 +373,21 @@ // this.SelectAllMenuItem.Name = "SelectAllMenuItem"; this.SelectAllMenuItem.ShortcutKeyDisplayString = "Ctrl+A"; - this.SelectAllMenuItem.Size = new System.Drawing.Size(217, 22); + this.SelectAllMenuItem.Size = new System.Drawing.Size(233, 22); this.SelectAllMenuItem.Text = "Select &All"; this.SelectAllMenuItem.Click += new System.EventHandler(this.SelectAllMenuItem_Click); // // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(214, 6); + this.toolStripSeparator6.Size = new System.Drawing.Size(230, 6); // // ToggleMenuItem // this.ToggleMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Refresh1; this.ToggleMenuItem.Name = "ToggleMenuItem"; this.ToggleMenuItem.ShortcutKeyDisplayString = "Enter"; - this.ToggleMenuItem.Size = new System.Drawing.Size(217, 22); + this.ToggleMenuItem.Size = new System.Drawing.Size(233, 22); this.ToggleMenuItem.Text = "&Toggle"; this.ToggleMenuItem.Click += new System.EventHandler(this.ToggleMenuItem_Click); // @@ -395,19 +395,19 @@ // this.DisableAllCheatsMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Stop; this.DisableAllCheatsMenuItem.Name = "DisableAllCheatsMenuItem"; - this.DisableAllCheatsMenuItem.Size = new System.Drawing.Size(217, 22); + this.DisableAllCheatsMenuItem.Size = new System.Drawing.Size(233, 22); this.DisableAllCheatsMenuItem.Text = "Disable all"; this.DisableAllCheatsMenuItem.Click += new System.EventHandler(this.DisableAllCheatsMenuItem_Click); // // GameGenieSeparator // this.GameGenieSeparator.Name = "GameGenieSeparator"; - this.GameGenieSeparator.Size = new System.Drawing.Size(214, 6); + this.GameGenieSeparator.Size = new System.Drawing.Size(230, 6); // // OpenGameGenieEncoderDecoderMenuItem // this.OpenGameGenieEncoderDecoderMenuItem.Name = "OpenGameGenieEncoderDecoderMenuItem"; - this.OpenGameGenieEncoderDecoderMenuItem.Size = new System.Drawing.Size(217, 22); + this.OpenGameGenieEncoderDecoderMenuItem.Size = new System.Drawing.Size(233, 22); this.OpenGameGenieEncoderDecoderMenuItem.Text = "Game Genie Encoder/Decoder"; this.OpenGameGenieEncoderDecoderMenuItem.Click += new System.EventHandler(this.OpenGameGenieEncoderDecoderMenuItem_Click); // @@ -425,73 +425,73 @@ this.toolStripSeparator5, this.RestoreWindowSizeMenuItem}); this.OptionsSubMenu.Name = "OptionsSubMenu"; - this.OptionsSubMenu.Size = new System.Drawing.Size(56, 20); + this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20); this.OptionsSubMenu.Text = "&Options"; this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened); // // AlwaysLoadCheatsMenuItem // this.AlwaysLoadCheatsMenuItem.Name = "AlwaysLoadCheatsMenuItem"; - this.AlwaysLoadCheatsMenuItem.Size = new System.Drawing.Size(192, 22); + this.AlwaysLoadCheatsMenuItem.Size = new System.Drawing.Size(199, 22); this.AlwaysLoadCheatsMenuItem.Text = "Always load cheats"; this.AlwaysLoadCheatsMenuItem.Click += new System.EventHandler(this.AlwaysLoadCheatsMenuItem_Click); // // AutoSaveCheatsMenuItem // this.AutoSaveCheatsMenuItem.Name = "AutoSaveCheatsMenuItem"; - this.AutoSaveCheatsMenuItem.Size = new System.Drawing.Size(192, 22); + this.AutoSaveCheatsMenuItem.Size = new System.Drawing.Size(199, 22); this.AutoSaveCheatsMenuItem.Text = "Autosave cheats"; this.AutoSaveCheatsMenuItem.Click += new System.EventHandler(this.AutoSaveCheatsMenuItem_Click); // // DisableCheatsOnLoadMenuItem // this.DisableCheatsOnLoadMenuItem.Name = "DisableCheatsOnLoadMenuItem"; - this.DisableCheatsOnLoadMenuItem.Size = new System.Drawing.Size(192, 22); + this.DisableCheatsOnLoadMenuItem.Size = new System.Drawing.Size(199, 22); this.DisableCheatsOnLoadMenuItem.Text = "Disable Cheats on Load"; this.DisableCheatsOnLoadMenuItem.Click += new System.EventHandler(this.CheatsOnOffLoadMenuItem_Click); // // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; - this.toolStripSeparator7.Size = new System.Drawing.Size(189, 6); + this.toolStripSeparator7.Size = new System.Drawing.Size(196, 6); // // AutoloadMenuItem // this.AutoloadMenuItem.Name = "AutoloadMenuItem"; - this.AutoloadMenuItem.Size = new System.Drawing.Size(192, 22); + this.AutoloadMenuItem.Size = new System.Drawing.Size(199, 22); this.AutoloadMenuItem.Text = "Autoload"; this.AutoloadMenuItem.Click += new System.EventHandler(this.AutoloadMenuItem_Click); // // SaveWindowPositionMenuItem // this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem"; - this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(192, 22); + this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(199, 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(192, 22); + this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(199, 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(192, 22); + this.FloatingWindowMenuItem.Size = new System.Drawing.Size(199, 22); this.FloatingWindowMenuItem.Text = "Floating Window"; this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click); // // toolStripSeparator5 // this.toolStripSeparator5.Name = "toolStripSeparator5"; - this.toolStripSeparator5.Size = new System.Drawing.Size(189, 6); + this.toolStripSeparator5.Size = new System.Drawing.Size(196, 6); // // RestoreWindowSizeMenuItem // this.RestoreWindowSizeMenuItem.Name = "RestoreWindowSizeMenuItem"; - this.RestoreWindowSizeMenuItem.Size = new System.Drawing.Size(192, 22); + this.RestoreWindowSizeMenuItem.Size = new System.Drawing.Size(199, 22); this.RestoreWindowSizeMenuItem.Text = "Restore Default Settings"; this.RestoreWindowSizeMenuItem.Click += new System.EventHandler(this.RestoreDefaultsMenuItem_Click); // @@ -607,7 +607,7 @@ this.LoadGameGenieToolbarItem.Image = ((System.Drawing.Image)(resources.GetObject("LoadGameGenieToolbarItem.Image"))); this.LoadGameGenieToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.LoadGameGenieToolbarItem.Name = "LoadGameGenieToolbarItem"; - this.LoadGameGenieToolbarItem.Size = new System.Drawing.Size(68, 22); + this.LoadGameGenieToolbarItem.Size = new System.Drawing.Size(75, 22); this.LoadGameGenieToolbarItem.Text = "Game Genie"; this.LoadGameGenieToolbarItem.ToolTipText = "Open the Game Genie Encoder/Decoder"; this.LoadGameGenieToolbarItem.Click += new System.EventHandler(this.OpenGameGenieEncoderDecoderMenuItem_Click); @@ -625,7 +625,7 @@ // this.MessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.MessageLabel.AutoSize = true; - this.MessageLabel.Location = new System.Drawing.Point(13, 354); + this.MessageLabel.Location = new System.Drawing.Point(13, 391); this.MessageLabel.Name = "MessageLabel"; this.MessageLabel.Size = new System.Drawing.Size(31, 13); this.MessageLabel.TabIndex = 7; @@ -638,7 +638,7 @@ this.CheatGroupBox.Controls.Add(this.CheatEditor); this.CheatGroupBox.Location = new System.Drawing.Point(432, 66); this.CheatGroupBox.Name = "CheatGroupBox"; - this.CheatGroupBox.Size = new System.Drawing.Size(202, 284); + this.CheatGroupBox.Size = new System.Drawing.Size(202, 321); this.CheatGroupBox.TabIndex = 8; this.CheatGroupBox.TabStop = false; this.CheatGroupBox.Text = "New Cheat"; @@ -651,14 +651,14 @@ this.CheatEditor.Location = new System.Drawing.Point(6, 14); this.CheatEditor.MemoryDomains = null; this.CheatEditor.Name = "CheatEditor"; - this.CheatEditor.Size = new System.Drawing.Size(190, 264); + this.CheatEditor.Size = new System.Drawing.Size(190, 301); this.CheatEditor.TabIndex = 0; // // Cheats // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(646, 370); + this.ClientSize = new System.Drawing.Size(646, 407); this.Controls.Add(this.CheatGroupBox); this.Controls.Add(this.MessageLabel); this.Controls.Add(this.TotalLabel); From c9dd10e8c07aa8bc1957bf8e179f190316c9e168 Mon Sep 17 00:00:00 2001 From: Adam Sturge Date: Wed, 3 Feb 2016 21:37:08 -0800 Subject: [PATCH 02/10] Added comparison type column. Tied to debug issue where the column disappears from settings before being added to UI, couldn't figure it out without removing the [ConfigPersist] attribute from the Settings variable --- .../tools/Cheats/Cheats.Designer.cs | 150 ++++++++++-------- BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs | 15 +- .../tools/Cheats/Cheats.resx | 8 +- 3 files changed, 98 insertions(+), 75 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs index e025aa331b..604395e6d8 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs @@ -34,6 +34,7 @@ this.CheatName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.Address = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.Value = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.ComparisonType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.Compare = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.On = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.Domain = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -111,6 +112,7 @@ this.CheatName, this.Address, this.Value, + this.ComparisonType, this.Compare, this.On, this.Domain}); @@ -119,11 +121,12 @@ this.CheatListView.GridLines = true; this.CheatListView.HideSelection = false; this.CheatListView.ItemCount = 0; - this.CheatListView.Location = new System.Drawing.Point(12, 72); + this.CheatListView.Location = new System.Drawing.Point(24, 138); + this.CheatListView.Margin = new System.Windows.Forms.Padding(6); this.CheatListView.Name = "CheatListView"; this.CheatListView.SelectAllInProgress = false; this.CheatListView.selectedItem = -1; - this.CheatListView.Size = new System.Drawing.Size(414, 315); + this.CheatListView.Size = new System.Drawing.Size(824, 602); this.CheatListView.TabIndex = 1; this.CheatListView.UseCompatibleStateImageBehavior = false; this.CheatListView.UseCustomBackground = true; @@ -151,6 +154,11 @@ this.Value.Text = "Value"; this.Value.Width = 40; // + // ComparisonType + // + this.ComparisonType.Text = "Comparison Type"; + this.ComparisonType.Width = 194; + // // Compare // this.Compare.Text = "Compare"; @@ -168,13 +176,14 @@ // // CheatsContextMenu // + this.CheatsContextMenu.ImageScalingSize = new System.Drawing.Size(32, 32); this.CheatsContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.ToggleContextMenuItem, this.RemoveContextMenuItem, this.DisableAllContextMenuItem, this.ViewInHexEditorContextMenuItem}); this.CheatsContextMenu.Name = "contextMenuStrip1"; - this.CheatsContextMenu.Size = new System.Drawing.Size(170, 92); + this.CheatsContextMenu.Size = new System.Drawing.Size(311, 156); this.CheatsContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.CheatsContextMenu_Opening); // // ToggleContextMenuItem @@ -182,7 +191,7 @@ this.ToggleContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Refresh1; this.ToggleContextMenuItem.Name = "ToggleContextMenuItem"; this.ToggleContextMenuItem.ShortcutKeyDisplayString = "Enter"; - this.ToggleContextMenuItem.Size = new System.Drawing.Size(169, 22); + this.ToggleContextMenuItem.Size = new System.Drawing.Size(310, 38); this.ToggleContextMenuItem.Text = "&Toggle"; this.ToggleContextMenuItem.Click += new System.EventHandler(this.ToggleMenuItem_Click); // @@ -191,7 +200,7 @@ this.RemoveContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete; this.RemoveContextMenuItem.Name = "RemoveContextMenuItem"; this.RemoveContextMenuItem.ShortcutKeyDisplayString = "Delete"; - this.RemoveContextMenuItem.Size = new System.Drawing.Size(169, 22); + this.RemoveContextMenuItem.Size = new System.Drawing.Size(310, 38); this.RemoveContextMenuItem.Text = "&Remove"; this.RemoveContextMenuItem.Click += new System.EventHandler(this.RemoveCheatMenuItem_Click); // @@ -199,27 +208,29 @@ // this.DisableAllContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Stop; this.DisableAllContextMenuItem.Name = "DisableAllContextMenuItem"; - this.DisableAllContextMenuItem.Size = new System.Drawing.Size(169, 22); + this.DisableAllContextMenuItem.Size = new System.Drawing.Size(310, 38); this.DisableAllContextMenuItem.Text = "&Disable All"; this.DisableAllContextMenuItem.Click += new System.EventHandler(this.DisableAllCheatsMenuItem_Click); // // ViewInHexEditorContextMenuItem // this.ViewInHexEditorContextMenuItem.Name = "ViewInHexEditorContextMenuItem"; - this.ViewInHexEditorContextMenuItem.Size = new System.Drawing.Size(169, 22); + this.ViewInHexEditorContextMenuItem.Size = new System.Drawing.Size(310, 38); this.ViewInHexEditorContextMenuItem.Text = "View in Hex Editor"; this.ViewInHexEditorContextMenuItem.Click += new System.EventHandler(this.ViewInHexEditorContextMenuItem_Click); // // CheatsMenu // this.CheatsMenu.ClickThrough = true; + this.CheatsMenu.ImageScalingSize = new System.Drawing.Size(32, 32); this.CheatsMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.FileSubMenu, this.CheatsSubMenu, this.OptionsSubMenu}); this.CheatsMenu.Location = new System.Drawing.Point(0, 0); this.CheatsMenu.Name = "CheatsMenu"; - this.CheatsMenu.Size = new System.Drawing.Size(646, 24); + this.CheatsMenu.Padding = new System.Windows.Forms.Padding(12, 4, 0, 4); + this.CheatsMenu.Size = new System.Drawing.Size(1292, 46); this.CheatsMenu.TabIndex = 2; this.CheatsMenu.Text = "menuStrip1"; // @@ -235,7 +246,7 @@ this.toolStripSeparator1, this.ExitMenuItem}); this.FileSubMenu.Name = "FileSubMenu"; - this.FileSubMenu.Size = new System.Drawing.Size(37, 20); + this.FileSubMenu.Size = new System.Drawing.Size(64, 38); this.FileSubMenu.Text = "&File"; this.FileSubMenu.DropDownOpened += new System.EventHandler(this.FileSubMenu_DropDownOpened); // @@ -244,7 +255,7 @@ this.NewMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.NewFile; this.NewMenuItem.Name = "NewMenuItem"; this.NewMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); - this.NewMenuItem.Size = new System.Drawing.Size(195, 22); + this.NewMenuItem.Size = new System.Drawing.Size(358, 38); this.NewMenuItem.Text = "&New"; this.NewMenuItem.Click += new System.EventHandler(this.NewMenuItem_Click); // @@ -253,7 +264,7 @@ this.OpenMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.OpenFile; this.OpenMenuItem.Name = "OpenMenuItem"; this.OpenMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.OpenMenuItem.Size = new System.Drawing.Size(195, 22); + this.OpenMenuItem.Size = new System.Drawing.Size(358, 38); this.OpenMenuItem.Text = "&Open..."; this.OpenMenuItem.Click += new System.EventHandler(this.OpenMenuItem_Click); // @@ -262,7 +273,7 @@ this.SaveMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs; this.SaveMenuItem.Name = "SaveMenuItem"; this.SaveMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.SaveMenuItem.Size = new System.Drawing.Size(195, 22); + this.SaveMenuItem.Size = new System.Drawing.Size(358, 38); this.SaveMenuItem.Text = "&Save"; this.SaveMenuItem.Click += new System.EventHandler(this.SaveMenuItem_Click); // @@ -271,14 +282,14 @@ this.SaveAsMenuItem.Name = "SaveAsMenuItem"; this.SaveAsMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.S))); - this.SaveAsMenuItem.Size = new System.Drawing.Size(195, 22); + this.SaveAsMenuItem.Size = new System.Drawing.Size(358, 38); this.SaveAsMenuItem.Text = "Save &As..."; this.SaveAsMenuItem.Click += new System.EventHandler(this.SaveAsMenuItem_Click); // // AppendMenuItem // this.AppendMenuItem.Name = "AppendMenuItem"; - this.AppendMenuItem.Size = new System.Drawing.Size(195, 22); + this.AppendMenuItem.Size = new System.Drawing.Size(358, 38); this.AppendMenuItem.Text = "Append File"; // // RecentSubMenu @@ -287,25 +298,25 @@ this.toolStripSeparator4}); this.RecentSubMenu.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Recent; this.RecentSubMenu.Name = "RecentSubMenu"; - this.RecentSubMenu.Size = new System.Drawing.Size(195, 22); + this.RecentSubMenu.Size = new System.Drawing.Size(358, 38); this.RecentSubMenu.Text = "Recent"; this.RecentSubMenu.DropDownOpened += new System.EventHandler(this.RecentSubMenu_DropDownOpened); // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(57, 6); + this.toolStripSeparator4.Size = new System.Drawing.Size(82, 6); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(192, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(355, 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(195, 22); + this.ExitMenuItem.Size = new System.Drawing.Size(358, 38); this.ExitMenuItem.Text = "E&xit"; this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click); // @@ -324,7 +335,7 @@ this.GameGenieSeparator, this.OpenGameGenieEncoderDecoderMenuItem}); this.CheatsSubMenu.Name = "CheatsSubMenu"; - this.CheatsSubMenu.Size = new System.Drawing.Size(55, 20); + this.CheatsSubMenu.Size = new System.Drawing.Size(99, 38); this.CheatsSubMenu.Text = "&Cheats"; this.CheatsSubMenu.DropDownOpened += new System.EventHandler(this.CheatsSubMenu_DropDownOpened); // @@ -333,7 +344,7 @@ this.RemoveCheatMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete; this.RemoveCheatMenuItem.Name = "RemoveCheatMenuItem"; this.RemoveCheatMenuItem.ShortcutKeyDisplayString = "Delete"; - this.RemoveCheatMenuItem.Size = new System.Drawing.Size(233, 22); + this.RemoveCheatMenuItem.Size = new System.Drawing.Size(438, 38); this.RemoveCheatMenuItem.Text = "&Remove Cheat"; this.RemoveCheatMenuItem.Click += new System.EventHandler(this.RemoveCheatMenuItem_Click); // @@ -342,21 +353,21 @@ this.InsertSeparatorMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.InsertSeparator; this.InsertSeparatorMenuItem.Name = "InsertSeparatorMenuItem"; this.InsertSeparatorMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I))); - this.InsertSeparatorMenuItem.Size = new System.Drawing.Size(233, 22); + this.InsertSeparatorMenuItem.Size = new System.Drawing.Size(438, 38); this.InsertSeparatorMenuItem.Text = "Insert Separator"; this.InsertSeparatorMenuItem.Click += new System.EventHandler(this.InsertSeparatorMenuItem_Click); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(230, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(435, 6); // // MoveUpMenuItem // this.MoveUpMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MoveUp; this.MoveUpMenuItem.Name = "MoveUpMenuItem"; this.MoveUpMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.U))); - this.MoveUpMenuItem.Size = new System.Drawing.Size(233, 22); + this.MoveUpMenuItem.Size = new System.Drawing.Size(438, 38); this.MoveUpMenuItem.Text = "Move &Up"; this.MoveUpMenuItem.Click += new System.EventHandler(this.MoveUpMenuItem_Click); // @@ -365,7 +376,7 @@ this.MoveDownMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MoveDown; this.MoveDownMenuItem.Name = "MoveDownMenuItem"; this.MoveDownMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D))); - this.MoveDownMenuItem.Size = new System.Drawing.Size(233, 22); + this.MoveDownMenuItem.Size = new System.Drawing.Size(438, 38); this.MoveDownMenuItem.Text = "Move &Down"; this.MoveDownMenuItem.Click += new System.EventHandler(this.MoveDownMenuItem_Click); // @@ -373,21 +384,21 @@ // this.SelectAllMenuItem.Name = "SelectAllMenuItem"; this.SelectAllMenuItem.ShortcutKeyDisplayString = "Ctrl+A"; - this.SelectAllMenuItem.Size = new System.Drawing.Size(233, 22); + this.SelectAllMenuItem.Size = new System.Drawing.Size(438, 38); this.SelectAllMenuItem.Text = "Select &All"; this.SelectAllMenuItem.Click += new System.EventHandler(this.SelectAllMenuItem_Click); // // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(230, 6); + this.toolStripSeparator6.Size = new System.Drawing.Size(435, 6); // // ToggleMenuItem // this.ToggleMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Refresh1; this.ToggleMenuItem.Name = "ToggleMenuItem"; this.ToggleMenuItem.ShortcutKeyDisplayString = "Enter"; - this.ToggleMenuItem.Size = new System.Drawing.Size(233, 22); + this.ToggleMenuItem.Size = new System.Drawing.Size(438, 38); this.ToggleMenuItem.Text = "&Toggle"; this.ToggleMenuItem.Click += new System.EventHandler(this.ToggleMenuItem_Click); // @@ -395,19 +406,19 @@ // this.DisableAllCheatsMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Stop; this.DisableAllCheatsMenuItem.Name = "DisableAllCheatsMenuItem"; - this.DisableAllCheatsMenuItem.Size = new System.Drawing.Size(233, 22); + this.DisableAllCheatsMenuItem.Size = new System.Drawing.Size(438, 38); this.DisableAllCheatsMenuItem.Text = "Disable all"; this.DisableAllCheatsMenuItem.Click += new System.EventHandler(this.DisableAllCheatsMenuItem_Click); // // GameGenieSeparator // this.GameGenieSeparator.Name = "GameGenieSeparator"; - this.GameGenieSeparator.Size = new System.Drawing.Size(230, 6); + this.GameGenieSeparator.Size = new System.Drawing.Size(435, 6); // // OpenGameGenieEncoderDecoderMenuItem // this.OpenGameGenieEncoderDecoderMenuItem.Name = "OpenGameGenieEncoderDecoderMenuItem"; - this.OpenGameGenieEncoderDecoderMenuItem.Size = new System.Drawing.Size(233, 22); + this.OpenGameGenieEncoderDecoderMenuItem.Size = new System.Drawing.Size(438, 38); this.OpenGameGenieEncoderDecoderMenuItem.Text = "Game Genie Encoder/Decoder"; this.OpenGameGenieEncoderDecoderMenuItem.Click += new System.EventHandler(this.OpenGameGenieEncoderDecoderMenuItem_Click); // @@ -425,79 +436,80 @@ this.toolStripSeparator5, this.RestoreWindowSizeMenuItem}); this.OptionsSubMenu.Name = "OptionsSubMenu"; - this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20); + this.OptionsSubMenu.Size = new System.Drawing.Size(111, 38); this.OptionsSubMenu.Text = "&Options"; this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened); // // AlwaysLoadCheatsMenuItem // this.AlwaysLoadCheatsMenuItem.Name = "AlwaysLoadCheatsMenuItem"; - this.AlwaysLoadCheatsMenuItem.Size = new System.Drawing.Size(199, 22); + this.AlwaysLoadCheatsMenuItem.Size = new System.Drawing.Size(372, 38); this.AlwaysLoadCheatsMenuItem.Text = "Always load cheats"; this.AlwaysLoadCheatsMenuItem.Click += new System.EventHandler(this.AlwaysLoadCheatsMenuItem_Click); // // AutoSaveCheatsMenuItem // this.AutoSaveCheatsMenuItem.Name = "AutoSaveCheatsMenuItem"; - this.AutoSaveCheatsMenuItem.Size = new System.Drawing.Size(199, 22); + this.AutoSaveCheatsMenuItem.Size = new System.Drawing.Size(372, 38); this.AutoSaveCheatsMenuItem.Text = "Autosave cheats"; this.AutoSaveCheatsMenuItem.Click += new System.EventHandler(this.AutoSaveCheatsMenuItem_Click); // // DisableCheatsOnLoadMenuItem // this.DisableCheatsOnLoadMenuItem.Name = "DisableCheatsOnLoadMenuItem"; - this.DisableCheatsOnLoadMenuItem.Size = new System.Drawing.Size(199, 22); + this.DisableCheatsOnLoadMenuItem.Size = new System.Drawing.Size(372, 38); this.DisableCheatsOnLoadMenuItem.Text = "Disable Cheats on Load"; this.DisableCheatsOnLoadMenuItem.Click += new System.EventHandler(this.CheatsOnOffLoadMenuItem_Click); // // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; - this.toolStripSeparator7.Size = new System.Drawing.Size(196, 6); + this.toolStripSeparator7.Size = new System.Drawing.Size(369, 6); // // AutoloadMenuItem // this.AutoloadMenuItem.Name = "AutoloadMenuItem"; - this.AutoloadMenuItem.Size = new System.Drawing.Size(199, 22); + this.AutoloadMenuItem.Size = new System.Drawing.Size(372, 38); this.AutoloadMenuItem.Text = "Autoload"; this.AutoloadMenuItem.Click += new System.EventHandler(this.AutoloadMenuItem_Click); // // SaveWindowPositionMenuItem // this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem"; - this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(199, 22); + this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(372, 38); 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(199, 22); + this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(372, 38); 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(199, 22); + this.FloatingWindowMenuItem.Size = new System.Drawing.Size(372, 38); this.FloatingWindowMenuItem.Text = "Floating Window"; this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click); // // toolStripSeparator5 // this.toolStripSeparator5.Name = "toolStripSeparator5"; - this.toolStripSeparator5.Size = new System.Drawing.Size(196, 6); + this.toolStripSeparator5.Size = new System.Drawing.Size(369, 6); // // RestoreWindowSizeMenuItem // this.RestoreWindowSizeMenuItem.Name = "RestoreWindowSizeMenuItem"; - this.RestoreWindowSizeMenuItem.Size = new System.Drawing.Size(199, 22); + this.RestoreWindowSizeMenuItem.Size = new System.Drawing.Size(372, 38); this.RestoreWindowSizeMenuItem.Text = "Restore Default Settings"; this.RestoreWindowSizeMenuItem.Click += new System.EventHandler(this.RestoreDefaultsMenuItem_Click); // // toolStrip1 // this.toolStrip1.ClickThrough = true; + this.toolStrip1.ImageScalingSize = new System.Drawing.Size(32, 32); this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.NewToolBarItem, this.OpenToolBarItem, @@ -510,9 +522,10 @@ this.MoveDownToolbarItem, this.GameGenieToolbarSeparator, this.LoadGameGenieToolbarItem}); - this.toolStrip1.Location = new System.Drawing.Point(0, 24); + this.toolStrip1.Location = new System.Drawing.Point(0, 46); this.toolStrip1.Name = "toolStrip1"; - this.toolStrip1.Size = new System.Drawing.Size(646, 25); + this.toolStrip1.Padding = new System.Windows.Forms.Padding(0, 0, 2, 0); + this.toolStrip1.Size = new System.Drawing.Size(1292, 39); this.toolStrip1.TabIndex = 3; this.toolStrip1.Text = "toolStrip1"; // @@ -522,7 +535,7 @@ this.NewToolBarItem.Image = ((System.Drawing.Image)(resources.GetObject("NewToolBarItem.Image"))); this.NewToolBarItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.NewToolBarItem.Name = "NewToolBarItem"; - this.NewToolBarItem.Size = new System.Drawing.Size(23, 22); + this.NewToolBarItem.Size = new System.Drawing.Size(36, 36); this.NewToolBarItem.Text = "&New"; this.NewToolBarItem.Click += new System.EventHandler(this.NewMenuItem_Click); // @@ -532,7 +545,7 @@ this.OpenToolBarItem.Image = ((System.Drawing.Image)(resources.GetObject("OpenToolBarItem.Image"))); this.OpenToolBarItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.OpenToolBarItem.Name = "OpenToolBarItem"; - this.OpenToolBarItem.Size = new System.Drawing.Size(23, 22); + this.OpenToolBarItem.Size = new System.Drawing.Size(36, 36); this.OpenToolBarItem.Text = "&Open"; this.OpenToolBarItem.Click += new System.EventHandler(this.OpenMenuItem_Click); // @@ -542,14 +555,14 @@ this.SaveToolBarItem.Image = ((System.Drawing.Image)(resources.GetObject("SaveToolBarItem.Image"))); this.SaveToolBarItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.SaveToolBarItem.Name = "SaveToolBarItem"; - this.SaveToolBarItem.Size = new System.Drawing.Size(23, 22); + this.SaveToolBarItem.Size = new System.Drawing.Size(36, 36); this.SaveToolBarItem.Text = "&Save"; this.SaveToolBarItem.Click += new System.EventHandler(this.SaveMenuItem_Click); // // toolStripSeparator // this.toolStripSeparator.Name = "toolStripSeparator"; - this.toolStripSeparator.Size = new System.Drawing.Size(6, 25); + this.toolStripSeparator.Size = new System.Drawing.Size(6, 39); // // RemoveToolbarItem // @@ -557,7 +570,7 @@ this.RemoveToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete; this.RemoveToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.RemoveToolbarItem.Name = "RemoveToolbarItem"; - this.RemoveToolbarItem.Size = new System.Drawing.Size(23, 22); + this.RemoveToolbarItem.Size = new System.Drawing.Size(36, 36); this.RemoveToolbarItem.Text = "&Remove"; this.RemoveToolbarItem.Click += new System.EventHandler(this.RemoveCheatMenuItem_Click); // @@ -567,14 +580,14 @@ this.SeparatorToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.InsertSeparator; this.SeparatorToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.SeparatorToolbarItem.Name = "SeparatorToolbarItem"; - this.SeparatorToolbarItem.Size = new System.Drawing.Size(23, 22); + this.SeparatorToolbarItem.Size = new System.Drawing.Size(36, 36); this.SeparatorToolbarItem.Text = "Insert Separator"; this.SeparatorToolbarItem.Click += new System.EventHandler(this.InsertSeparatorMenuItem_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25); + this.toolStripSeparator2.Size = new System.Drawing.Size(6, 39); // // MoveUpToolbarItem // @@ -582,7 +595,7 @@ this.MoveUpToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MoveUp; this.MoveUpToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.MoveUpToolbarItem.Name = "MoveUpToolbarItem"; - this.MoveUpToolbarItem.Size = new System.Drawing.Size(23, 22); + this.MoveUpToolbarItem.Size = new System.Drawing.Size(36, 36); this.MoveUpToolbarItem.Text = "Move Up"; this.MoveUpToolbarItem.Click += new System.EventHandler(this.MoveUpMenuItem_Click); // @@ -592,14 +605,14 @@ this.MoveDownToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MoveDown; this.MoveDownToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.MoveDownToolbarItem.Name = "MoveDownToolbarItem"; - this.MoveDownToolbarItem.Size = new System.Drawing.Size(23, 22); + this.MoveDownToolbarItem.Size = new System.Drawing.Size(36, 36); this.MoveDownToolbarItem.Text = "Move Down"; this.MoveDownToolbarItem.Click += new System.EventHandler(this.MoveDownMenuItem_Click); // // GameGenieToolbarSeparator // this.GameGenieToolbarSeparator.Name = "GameGenieToolbarSeparator"; - this.GameGenieToolbarSeparator.Size = new System.Drawing.Size(6, 25); + this.GameGenieToolbarSeparator.Size = new System.Drawing.Size(6, 39); // // LoadGameGenieToolbarItem // @@ -607,7 +620,7 @@ this.LoadGameGenieToolbarItem.Image = ((System.Drawing.Image)(resources.GetObject("LoadGameGenieToolbarItem.Image"))); this.LoadGameGenieToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.LoadGameGenieToolbarItem.Name = "LoadGameGenieToolbarItem"; - this.LoadGameGenieToolbarItem.Size = new System.Drawing.Size(75, 22); + this.LoadGameGenieToolbarItem.Size = new System.Drawing.Size(150, 36); this.LoadGameGenieToolbarItem.Text = "Game Genie"; this.LoadGameGenieToolbarItem.ToolTipText = "Open the Game Genie Encoder/Decoder"; this.LoadGameGenieToolbarItem.Click += new System.EventHandler(this.OpenGameGenieEncoderDecoderMenuItem_Click); @@ -615,9 +628,10 @@ // TotalLabel // this.TotalLabel.AutoSize = true; - this.TotalLabel.Location = new System.Drawing.Point(9, 52); + this.TotalLabel.Location = new System.Drawing.Point(18, 100); + this.TotalLabel.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); this.TotalLabel.Name = "TotalLabel"; - this.TotalLabel.Size = new System.Drawing.Size(49, 13); + this.TotalLabel.Size = new System.Drawing.Size(98, 25); this.TotalLabel.TabIndex = 6; this.TotalLabel.Text = "0 Cheats"; // @@ -625,9 +639,10 @@ // this.MessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.MessageLabel.AutoSize = true; - this.MessageLabel.Location = new System.Drawing.Point(13, 391); + this.MessageLabel.Location = new System.Drawing.Point(26, 752); + this.MessageLabel.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); this.MessageLabel.Name = "MessageLabel"; - this.MessageLabel.Size = new System.Drawing.Size(31, 13); + this.MessageLabel.Size = new System.Drawing.Size(60, 25); this.MessageLabel.TabIndex = 7; this.MessageLabel.Text = " "; // @@ -636,9 +651,11 @@ this.CheatGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.CheatGroupBox.Controls.Add(this.CheatEditor); - this.CheatGroupBox.Location = new System.Drawing.Point(432, 66); + this.CheatGroupBox.Location = new System.Drawing.Point(864, 127); + this.CheatGroupBox.Margin = new System.Windows.Forms.Padding(6); this.CheatGroupBox.Name = "CheatGroupBox"; - this.CheatGroupBox.Size = new System.Drawing.Size(202, 321); + this.CheatGroupBox.Padding = new System.Windows.Forms.Padding(6); + this.CheatGroupBox.Size = new System.Drawing.Size(404, 617); this.CheatGroupBox.TabIndex = 8; this.CheatGroupBox.TabStop = false; this.CheatGroupBox.Text = "New Cheat"; @@ -648,17 +665,18 @@ this.CheatEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.CheatEditor.Location = new System.Drawing.Point(6, 14); + this.CheatEditor.Location = new System.Drawing.Point(12, 27); + this.CheatEditor.Margin = new System.Windows.Forms.Padding(6); this.CheatEditor.MemoryDomains = null; this.CheatEditor.Name = "CheatEditor"; - this.CheatEditor.Size = new System.Drawing.Size(190, 301); + this.CheatEditor.Size = new System.Drawing.Size(380, 579); this.CheatEditor.TabIndex = 0; // // Cheats // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(646, 407); + this.ClientSize = new System.Drawing.Size(1292, 783); this.Controls.Add(this.CheatGroupBox); this.Controls.Add(this.MessageLabel); this.Controls.Add(this.TotalLabel); @@ -666,7 +684,8 @@ this.Controls.Add(this.CheatsMenu); this.Controls.Add(this.CheatListView); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MinimumSize = new System.Drawing.Size(285, 384); + this.Margin = new System.Windows.Forms.Padding(6); + this.MinimumSize = new System.Drawing.Size(544, 673); this.Name = "Cheats"; this.Text = "Cheats"; this.Load += new System.EventHandler(this.Cheats_Load); @@ -689,6 +708,7 @@ private System.Windows.Forms.ColumnHeader CheatName; private System.Windows.Forms.ColumnHeader Address; private System.Windows.Forms.ColumnHeader Value; + private System.Windows.Forms.ColumnHeader ComparisonType; private System.Windows.Forms.ColumnHeader Compare; private System.Windows.Forms.ColumnHeader On; private System.Windows.Forms.ColumnHeader Domain; diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs index 464abb28c3..a4cc3db78c 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs @@ -24,6 +24,7 @@ namespace BizHawk.Client.EmuHawk private const string SIZE = "SizeColumn"; private const string ENDIAN = "EndianColumn"; private const string TYPE = "DisplayTypeColumn"; + private const string COMPARISONTYPE = "ComparisonTypeColumn"; private int _defaultWidth; private int _defaultHeight; @@ -51,7 +52,8 @@ namespace BizHawk.Client.EmuHawk [RequiredService] private IMemoryDomains Core { get; set; } - [ConfigPersist] + // Adam Sturge : I commented this out because it was causing me issues by removing the comparison type column + //[ConfigPersist] public CheatsSettings Settings { get; set; } public bool UpdateBefore { get { return false; } } @@ -699,11 +701,12 @@ namespace BizHawk.Client.EmuHawk new Column { Name = ADDRESS, Visible = true, Index = 1, Width = 60 }, new Column { Name = VALUE, Visible = true, Index = 2, Width = 59 }, new Column { Name = COMPARE, Visible = true, Index = 3, Width = 59 }, - new Column { Name = ON, Visible = false, Index = 4, Width = 28 }, - new Column { Name = DOMAIN, Visible = true, Index = 5, Width = 55 }, - new Column { Name = SIZE, Visible = true, Index = 6, Width = 55 }, - new Column { Name = ENDIAN, Visible = false, Index = 7, Width = 55 }, - new Column { Name = TYPE, Visible = false, Index = 8, Width = 55 } + new Column { Name = COMPARISONTYPE, Visible = true, Index = 4, Width = 60 }, + new Column { Name = ON, Visible = false, Index = 5, Width = 28 }, + new Column { Name = DOMAIN, Visible = true, Index = 6, Width = 55 }, + new Column { Name = SIZE, Visible = true, Index = 7, Width = 55 }, + new Column { Name = ENDIAN, Visible = false, Index = 8, Width = 55 }, + new Column { Name = TYPE, Visible = false, Index = 9, Width = 55 } }; } diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.resx b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.resx index 1631505e05..b76cd42ef3 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.resx +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.resx @@ -130,7 +130,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAERSURBVDhPrZDbSgJRGIXnpewd6jXsjSQvIrwoI0RQMChU + YQUAAAAJcEhZcwAAHYcAAB2HAY/l8WUAAAERSURBVDhPrZDbSgJRGIXnpewd6jXsjSQvIrwoI0RQMChU 0iiDPCGiE3ZCRkvR8VzTeBhnyR5/ccaZNnPhB4t9sdf6Ln5hb8QeathNJFVFKF5C8DqL4ksDVHWGDf7j LHyPg6NjviSaFqlu5yQYR+KpupaIkrMknCxT3Y7v/NYYb0ITK1c3BarbWWhLQ7IR0cTKReyZ6lZ0XYei ztHpK4bAc+h1FgQijzSxMptrGIxVSO0xX3AaStFki7bUMVFmaMm/eJMGfIH/MkGzLep0AXn4h/r3CJV3 @@ -141,7 +141,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJHSURBVDhPxZBdSNNhFMb/F110ZZEVhVBgeeHNICiiuggp + YQUAAAAJcEhZcwAAHYcAAB2HAY/l8WUAAAJHSURBVDhPxZBdSNNhFMb/F110ZZEVhVBgeeHNICiiuggp olAUyyxI0oSaH1QYC3N+tKnp5ubm1JUua5uuqdNKMwr7kApFItTUkWZqVhSVYmao5Nevvy7UoYR3HXh4 4XCe33nOKyy3lAY7l9RWMo0O/raWXxEyo5spVYTNvOGyfIRPfW+ptOkXqaPl6T83hcRmExSdgzAz3NVm YWyoYla/B+1M9JtxWLPpaH22JORIjI6gKAMB0jyEimIdo4OlbuaprwVMOOMovammpDADc34qppwUrmnl @@ -157,7 +157,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIySURBVDhPrZLfS5NRGMfff6H7boIuuq2pMZyL1eAt11CW + YQUAAAAJcEhZcwAAHYcAAB2HAY/l8WUAAAIySURBVDhPrZLfS5NRGMfff6H7boIuuq2pMZyL1eAt11CW DcOKsB9vpFmaLtNExco0av6CbIVLJ61Wk3BSkT/AFCkRZSpZmrmiJQ41xSaCwdfznL15XEUX0Reem5f3 8znnec4j/Zc8fxYGla91CS3eRTx0z6OpMYS7jmnU1X6B/VYA18snUVoyjsKCt8jLHcH5c36ouCQR2NUJ 1Nas4G9ZXlmFKbULh1Kf8lJxSfI+WeCCyopv6q+/h+DQ/DJ2WV5Ao1FgPegRAveDOS4oLfmq/h6dn/DH @@ -173,7 +173,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YQUAAAAJcEhZcwAAHYcAAB2HAY/l8WUAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc From 092b5da974cf110ce36b8a1db2ae922b406c5ccd Mon Sep 17 00:00:00 2001 From: Adam Sturge Date: Fri, 5 Feb 2016 19:33:31 -0800 Subject: [PATCH 03/10] restored [ConfigPerist]. --- BizHawk.Client.Common/tools/Cheat.cs | 11 +- .../tools/Cheats/CheatEdit.cs | 16 +-- .../tools/Cheats/Cheats.Designer.cs | 119 ++++++++---------- BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs | 6 +- .../tools/Cheats/Cheats.resx | 8 +- 5 files changed, 79 insertions(+), 81 deletions(-) diff --git a/BizHawk.Client.Common/tools/Cheat.cs b/BizHawk.Client.Common/tools/Cheat.cs index 8540667d02..f73e9b4afe 100644 --- a/BizHawk.Client.Common/tools/Cheat.cs +++ b/BizHawk.Client.Common/tools/Cheat.cs @@ -6,13 +6,13 @@ namespace BizHawk.Client.Common { public class Cheat { - public enum ComparisonType { EQUAL, GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL, NOT_EQUAL}; + public enum COMPARISONTYPE { EQUAL, GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL, NOT_EQUAL}; private readonly Watch _watch; private int? _compare; private int _val; private bool _enabled; - private ComparisonType _comparisonType; + private COMPARISONTYPE _comparisonType; public Cheat(Watch watch, int value, int? compare = null, bool enabled = true) @@ -33,7 +33,7 @@ namespace BizHawk.Client.Common /// /// /// - public Cheat(Watch watch, int value, ComparisonType comparisonType, int compare, bool enabled = true) + public Cheat(Watch watch, int value, COMPARISONTYPE comparisonType, int compare, bool enabled = true) { _enabled = enabled; _watch = watch; @@ -186,6 +186,11 @@ namespace BizHawk.Client.Common } } + public COMPARISONTYPE ComparisonType + { + get { return _comparisonType; } + } + public void Enable(bool handleChange = true) { if (!IsSeparator) diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs index d4b903ef2c..56c0907099 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs @@ -303,7 +303,7 @@ namespace BizHawk.Client.EmuHawk { get { - Cheat.ComparisonType comparisonType = Cheat.ComparisonType.EQUAL; + Cheat.COMPARISONTYPE comparisonType = Cheat.COMPARISONTYPE.EQUAL; var domain = MemoryDomains[DomainDropDown.SelectedItem.ToString()]; var address = AddressBox.ToRawInt().Value; if (address < domain.Size) @@ -328,13 +328,13 @@ namespace BizHawk.Client.EmuHawk { switch (CompareTypeDropDown.SelectedText) { - case "=" : comparisonType = Cheat.ComparisonType.EQUAL; break; - case ">" : comparisonType = Cheat.ComparisonType.GREATER_THAN; break; - case ">=" : comparisonType = Cheat.ComparisonType.GREATER_THAN_OR_EQUAL; break; - case "<" : comparisonType = Cheat.ComparisonType.LESS_THAN; break; - case "<=" : comparisonType = Cheat.ComparisonType.LESS_THAN_OR_EQUAL; break; - case "!=" : comparisonType = Cheat.ComparisonType.NOT_EQUAL; break; - default : comparisonType = Cheat.ComparisonType.EQUAL; break; + case "=" : comparisonType = Cheat.COMPARISONTYPE.EQUAL; break; + case ">" : comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN; break; + case ">=" : comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN_OR_EQUAL; break; + case "<" : comparisonType = Cheat.COMPARISONTYPE.LESS_THAN; break; + case "<=" : comparisonType = Cheat.COMPARISONTYPE.LESS_THAN_OR_EQUAL; break; + case "!=" : comparisonType = Cheat.COMPARISONTYPE.NOT_EQUAL; break; + default : comparisonType = Cheat.COMPARISONTYPE.EQUAL; break; } return new Cheat( diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs index 604395e6d8..8170360f19 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs @@ -121,12 +121,11 @@ this.CheatListView.GridLines = true; this.CheatListView.HideSelection = false; this.CheatListView.ItemCount = 0; - this.CheatListView.Location = new System.Drawing.Point(24, 138); - this.CheatListView.Margin = new System.Windows.Forms.Padding(6); + this.CheatListView.Location = new System.Drawing.Point(12, 72); this.CheatListView.Name = "CheatListView"; this.CheatListView.SelectAllInProgress = false; this.CheatListView.selectedItem = -1; - this.CheatListView.Size = new System.Drawing.Size(824, 602); + this.CheatListView.Size = new System.Drawing.Size(414, 315); this.CheatListView.TabIndex = 1; this.CheatListView.UseCompatibleStateImageBehavior = false; this.CheatListView.UseCustomBackground = true; @@ -183,7 +182,7 @@ this.DisableAllContextMenuItem, this.ViewInHexEditorContextMenuItem}); this.CheatsContextMenu.Name = "contextMenuStrip1"; - this.CheatsContextMenu.Size = new System.Drawing.Size(311, 156); + this.CheatsContextMenu.Size = new System.Drawing.Size(186, 156); this.CheatsContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.CheatsContextMenu_Opening); // // ToggleContextMenuItem @@ -191,7 +190,7 @@ this.ToggleContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Refresh1; this.ToggleContextMenuItem.Name = "ToggleContextMenuItem"; this.ToggleContextMenuItem.ShortcutKeyDisplayString = "Enter"; - this.ToggleContextMenuItem.Size = new System.Drawing.Size(310, 38); + this.ToggleContextMenuItem.Size = new System.Drawing.Size(185, 38); this.ToggleContextMenuItem.Text = "&Toggle"; this.ToggleContextMenuItem.Click += new System.EventHandler(this.ToggleMenuItem_Click); // @@ -200,7 +199,7 @@ this.RemoveContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete; this.RemoveContextMenuItem.Name = "RemoveContextMenuItem"; this.RemoveContextMenuItem.ShortcutKeyDisplayString = "Delete"; - this.RemoveContextMenuItem.Size = new System.Drawing.Size(310, 38); + this.RemoveContextMenuItem.Size = new System.Drawing.Size(185, 38); this.RemoveContextMenuItem.Text = "&Remove"; this.RemoveContextMenuItem.Click += new System.EventHandler(this.RemoveCheatMenuItem_Click); // @@ -208,14 +207,14 @@ // this.DisableAllContextMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Stop; this.DisableAllContextMenuItem.Name = "DisableAllContextMenuItem"; - this.DisableAllContextMenuItem.Size = new System.Drawing.Size(310, 38); + this.DisableAllContextMenuItem.Size = new System.Drawing.Size(185, 38); this.DisableAllContextMenuItem.Text = "&Disable All"; this.DisableAllContextMenuItem.Click += new System.EventHandler(this.DisableAllCheatsMenuItem_Click); // // ViewInHexEditorContextMenuItem // this.ViewInHexEditorContextMenuItem.Name = "ViewInHexEditorContextMenuItem"; - this.ViewInHexEditorContextMenuItem.Size = new System.Drawing.Size(310, 38); + this.ViewInHexEditorContextMenuItem.Size = new System.Drawing.Size(185, 38); this.ViewInHexEditorContextMenuItem.Text = "View in Hex Editor"; this.ViewInHexEditorContextMenuItem.Click += new System.EventHandler(this.ViewInHexEditorContextMenuItem_Click); // @@ -229,8 +228,7 @@ this.OptionsSubMenu}); this.CheatsMenu.Location = new System.Drawing.Point(0, 0); this.CheatsMenu.Name = "CheatsMenu"; - this.CheatsMenu.Padding = new System.Windows.Forms.Padding(12, 4, 0, 4); - this.CheatsMenu.Size = new System.Drawing.Size(1292, 46); + this.CheatsMenu.Size = new System.Drawing.Size(646, 24); this.CheatsMenu.TabIndex = 2; this.CheatsMenu.Text = "menuStrip1"; // @@ -246,7 +244,7 @@ this.toolStripSeparator1, this.ExitMenuItem}); this.FileSubMenu.Name = "FileSubMenu"; - this.FileSubMenu.Size = new System.Drawing.Size(64, 38); + this.FileSubMenu.Size = new System.Drawing.Size(37, 20); this.FileSubMenu.Text = "&File"; this.FileSubMenu.DropDownOpened += new System.EventHandler(this.FileSubMenu_DropDownOpened); // @@ -255,7 +253,7 @@ this.NewMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.NewFile; this.NewMenuItem.Name = "NewMenuItem"; this.NewMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); - this.NewMenuItem.Size = new System.Drawing.Size(358, 38); + this.NewMenuItem.Size = new System.Drawing.Size(195, 22); this.NewMenuItem.Text = "&New"; this.NewMenuItem.Click += new System.EventHandler(this.NewMenuItem_Click); // @@ -264,7 +262,7 @@ this.OpenMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.OpenFile; this.OpenMenuItem.Name = "OpenMenuItem"; this.OpenMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.OpenMenuItem.Size = new System.Drawing.Size(358, 38); + this.OpenMenuItem.Size = new System.Drawing.Size(195, 22); this.OpenMenuItem.Text = "&Open..."; this.OpenMenuItem.Click += new System.EventHandler(this.OpenMenuItem_Click); // @@ -273,7 +271,7 @@ this.SaveMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs; this.SaveMenuItem.Name = "SaveMenuItem"; this.SaveMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.SaveMenuItem.Size = new System.Drawing.Size(358, 38); + this.SaveMenuItem.Size = new System.Drawing.Size(195, 22); this.SaveMenuItem.Text = "&Save"; this.SaveMenuItem.Click += new System.EventHandler(this.SaveMenuItem_Click); // @@ -282,14 +280,14 @@ this.SaveAsMenuItem.Name = "SaveAsMenuItem"; this.SaveAsMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.S))); - this.SaveAsMenuItem.Size = new System.Drawing.Size(358, 38); + this.SaveAsMenuItem.Size = new System.Drawing.Size(195, 22); this.SaveAsMenuItem.Text = "Save &As..."; this.SaveAsMenuItem.Click += new System.EventHandler(this.SaveAsMenuItem_Click); // // AppendMenuItem // this.AppendMenuItem.Name = "AppendMenuItem"; - this.AppendMenuItem.Size = new System.Drawing.Size(358, 38); + this.AppendMenuItem.Size = new System.Drawing.Size(195, 22); this.AppendMenuItem.Text = "Append File"; // // RecentSubMenu @@ -298,25 +296,25 @@ this.toolStripSeparator4}); this.RecentSubMenu.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Recent; this.RecentSubMenu.Name = "RecentSubMenu"; - this.RecentSubMenu.Size = new System.Drawing.Size(358, 38); + this.RecentSubMenu.Size = new System.Drawing.Size(195, 22); this.RecentSubMenu.Text = "Recent"; this.RecentSubMenu.DropDownOpened += new System.EventHandler(this.RecentSubMenu_DropDownOpened); // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(82, 6); + this.toolStripSeparator4.Size = new System.Drawing.Size(57, 6); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(355, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(192, 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(358, 38); + this.ExitMenuItem.Size = new System.Drawing.Size(195, 22); this.ExitMenuItem.Text = "E&xit"; this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click); // @@ -335,7 +333,7 @@ this.GameGenieSeparator, this.OpenGameGenieEncoderDecoderMenuItem}); this.CheatsSubMenu.Name = "CheatsSubMenu"; - this.CheatsSubMenu.Size = new System.Drawing.Size(99, 38); + this.CheatsSubMenu.Size = new System.Drawing.Size(55, 20); this.CheatsSubMenu.Text = "&Cheats"; this.CheatsSubMenu.DropDownOpened += new System.EventHandler(this.CheatsSubMenu_DropDownOpened); // @@ -344,7 +342,7 @@ this.RemoveCheatMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Delete; this.RemoveCheatMenuItem.Name = "RemoveCheatMenuItem"; this.RemoveCheatMenuItem.ShortcutKeyDisplayString = "Delete"; - this.RemoveCheatMenuItem.Size = new System.Drawing.Size(438, 38); + this.RemoveCheatMenuItem.Size = new System.Drawing.Size(233, 22); this.RemoveCheatMenuItem.Text = "&Remove Cheat"; this.RemoveCheatMenuItem.Click += new System.EventHandler(this.RemoveCheatMenuItem_Click); // @@ -353,21 +351,21 @@ this.InsertSeparatorMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.InsertSeparator; this.InsertSeparatorMenuItem.Name = "InsertSeparatorMenuItem"; this.InsertSeparatorMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I))); - this.InsertSeparatorMenuItem.Size = new System.Drawing.Size(438, 38); + this.InsertSeparatorMenuItem.Size = new System.Drawing.Size(233, 22); this.InsertSeparatorMenuItem.Text = "Insert Separator"; this.InsertSeparatorMenuItem.Click += new System.EventHandler(this.InsertSeparatorMenuItem_Click); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(435, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(230, 6); // // MoveUpMenuItem // this.MoveUpMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MoveUp; this.MoveUpMenuItem.Name = "MoveUpMenuItem"; this.MoveUpMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.U))); - this.MoveUpMenuItem.Size = new System.Drawing.Size(438, 38); + this.MoveUpMenuItem.Size = new System.Drawing.Size(233, 22); this.MoveUpMenuItem.Text = "Move &Up"; this.MoveUpMenuItem.Click += new System.EventHandler(this.MoveUpMenuItem_Click); // @@ -376,7 +374,7 @@ this.MoveDownMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MoveDown; this.MoveDownMenuItem.Name = "MoveDownMenuItem"; this.MoveDownMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D))); - this.MoveDownMenuItem.Size = new System.Drawing.Size(438, 38); + this.MoveDownMenuItem.Size = new System.Drawing.Size(233, 22); this.MoveDownMenuItem.Text = "Move &Down"; this.MoveDownMenuItem.Click += new System.EventHandler(this.MoveDownMenuItem_Click); // @@ -384,21 +382,21 @@ // this.SelectAllMenuItem.Name = "SelectAllMenuItem"; this.SelectAllMenuItem.ShortcutKeyDisplayString = "Ctrl+A"; - this.SelectAllMenuItem.Size = new System.Drawing.Size(438, 38); + this.SelectAllMenuItem.Size = new System.Drawing.Size(233, 22); this.SelectAllMenuItem.Text = "Select &All"; this.SelectAllMenuItem.Click += new System.EventHandler(this.SelectAllMenuItem_Click); // // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(435, 6); + this.toolStripSeparator6.Size = new System.Drawing.Size(230, 6); // // ToggleMenuItem // this.ToggleMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Refresh1; this.ToggleMenuItem.Name = "ToggleMenuItem"; this.ToggleMenuItem.ShortcutKeyDisplayString = "Enter"; - this.ToggleMenuItem.Size = new System.Drawing.Size(438, 38); + this.ToggleMenuItem.Size = new System.Drawing.Size(233, 22); this.ToggleMenuItem.Text = "&Toggle"; this.ToggleMenuItem.Click += new System.EventHandler(this.ToggleMenuItem_Click); // @@ -406,19 +404,19 @@ // this.DisableAllCheatsMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Stop; this.DisableAllCheatsMenuItem.Name = "DisableAllCheatsMenuItem"; - this.DisableAllCheatsMenuItem.Size = new System.Drawing.Size(438, 38); + this.DisableAllCheatsMenuItem.Size = new System.Drawing.Size(233, 22); this.DisableAllCheatsMenuItem.Text = "Disable all"; this.DisableAllCheatsMenuItem.Click += new System.EventHandler(this.DisableAllCheatsMenuItem_Click); // // GameGenieSeparator // this.GameGenieSeparator.Name = "GameGenieSeparator"; - this.GameGenieSeparator.Size = new System.Drawing.Size(435, 6); + this.GameGenieSeparator.Size = new System.Drawing.Size(230, 6); // // OpenGameGenieEncoderDecoderMenuItem // this.OpenGameGenieEncoderDecoderMenuItem.Name = "OpenGameGenieEncoderDecoderMenuItem"; - this.OpenGameGenieEncoderDecoderMenuItem.Size = new System.Drawing.Size(438, 38); + this.OpenGameGenieEncoderDecoderMenuItem.Size = new System.Drawing.Size(233, 22); this.OpenGameGenieEncoderDecoderMenuItem.Text = "Game Genie Encoder/Decoder"; this.OpenGameGenieEncoderDecoderMenuItem.Click += new System.EventHandler(this.OpenGameGenieEncoderDecoderMenuItem_Click); // @@ -436,73 +434,73 @@ this.toolStripSeparator5, this.RestoreWindowSizeMenuItem}); this.OptionsSubMenu.Name = "OptionsSubMenu"; - this.OptionsSubMenu.Size = new System.Drawing.Size(111, 38); + this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20); this.OptionsSubMenu.Text = "&Options"; this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened); // // AlwaysLoadCheatsMenuItem // this.AlwaysLoadCheatsMenuItem.Name = "AlwaysLoadCheatsMenuItem"; - this.AlwaysLoadCheatsMenuItem.Size = new System.Drawing.Size(372, 38); + this.AlwaysLoadCheatsMenuItem.Size = new System.Drawing.Size(199, 22); this.AlwaysLoadCheatsMenuItem.Text = "Always load cheats"; this.AlwaysLoadCheatsMenuItem.Click += new System.EventHandler(this.AlwaysLoadCheatsMenuItem_Click); // // AutoSaveCheatsMenuItem // this.AutoSaveCheatsMenuItem.Name = "AutoSaveCheatsMenuItem"; - this.AutoSaveCheatsMenuItem.Size = new System.Drawing.Size(372, 38); + this.AutoSaveCheatsMenuItem.Size = new System.Drawing.Size(199, 22); this.AutoSaveCheatsMenuItem.Text = "Autosave cheats"; this.AutoSaveCheatsMenuItem.Click += new System.EventHandler(this.AutoSaveCheatsMenuItem_Click); // // DisableCheatsOnLoadMenuItem // this.DisableCheatsOnLoadMenuItem.Name = "DisableCheatsOnLoadMenuItem"; - this.DisableCheatsOnLoadMenuItem.Size = new System.Drawing.Size(372, 38); + this.DisableCheatsOnLoadMenuItem.Size = new System.Drawing.Size(199, 22); this.DisableCheatsOnLoadMenuItem.Text = "Disable Cheats on Load"; this.DisableCheatsOnLoadMenuItem.Click += new System.EventHandler(this.CheatsOnOffLoadMenuItem_Click); // // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; - this.toolStripSeparator7.Size = new System.Drawing.Size(369, 6); + this.toolStripSeparator7.Size = new System.Drawing.Size(196, 6); // // AutoloadMenuItem // this.AutoloadMenuItem.Name = "AutoloadMenuItem"; - this.AutoloadMenuItem.Size = new System.Drawing.Size(372, 38); + this.AutoloadMenuItem.Size = new System.Drawing.Size(199, 22); this.AutoloadMenuItem.Text = "Autoload"; this.AutoloadMenuItem.Click += new System.EventHandler(this.AutoloadMenuItem_Click); // // SaveWindowPositionMenuItem // this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem"; - this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(372, 38); + this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(199, 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(372, 38); + this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(199, 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(372, 38); + this.FloatingWindowMenuItem.Size = new System.Drawing.Size(199, 22); this.FloatingWindowMenuItem.Text = "Floating Window"; this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click); // // toolStripSeparator5 // this.toolStripSeparator5.Name = "toolStripSeparator5"; - this.toolStripSeparator5.Size = new System.Drawing.Size(369, 6); + this.toolStripSeparator5.Size = new System.Drawing.Size(196, 6); // // RestoreWindowSizeMenuItem // this.RestoreWindowSizeMenuItem.Name = "RestoreWindowSizeMenuItem"; - this.RestoreWindowSizeMenuItem.Size = new System.Drawing.Size(372, 38); + this.RestoreWindowSizeMenuItem.Size = new System.Drawing.Size(199, 22); this.RestoreWindowSizeMenuItem.Text = "Restore Default Settings"; this.RestoreWindowSizeMenuItem.Click += new System.EventHandler(this.RestoreDefaultsMenuItem_Click); // @@ -522,10 +520,9 @@ this.MoveDownToolbarItem, this.GameGenieToolbarSeparator, this.LoadGameGenieToolbarItem}); - this.toolStrip1.Location = new System.Drawing.Point(0, 46); + this.toolStrip1.Location = new System.Drawing.Point(0, 24); this.toolStrip1.Name = "toolStrip1"; - this.toolStrip1.Padding = new System.Windows.Forms.Padding(0, 0, 2, 0); - this.toolStrip1.Size = new System.Drawing.Size(1292, 39); + this.toolStrip1.Size = new System.Drawing.Size(646, 39); this.toolStrip1.TabIndex = 3; this.toolStrip1.Text = "toolStrip1"; // @@ -620,7 +617,7 @@ this.LoadGameGenieToolbarItem.Image = ((System.Drawing.Image)(resources.GetObject("LoadGameGenieToolbarItem.Image"))); this.LoadGameGenieToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.LoadGameGenieToolbarItem.Name = "LoadGameGenieToolbarItem"; - this.LoadGameGenieToolbarItem.Size = new System.Drawing.Size(150, 36); + this.LoadGameGenieToolbarItem.Size = new System.Drawing.Size(75, 36); this.LoadGameGenieToolbarItem.Text = "Game Genie"; this.LoadGameGenieToolbarItem.ToolTipText = "Open the Game Genie Encoder/Decoder"; this.LoadGameGenieToolbarItem.Click += new System.EventHandler(this.OpenGameGenieEncoderDecoderMenuItem_Click); @@ -628,10 +625,9 @@ // TotalLabel // this.TotalLabel.AutoSize = true; - this.TotalLabel.Location = new System.Drawing.Point(18, 100); - this.TotalLabel.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.TotalLabel.Location = new System.Drawing.Point(9, 52); this.TotalLabel.Name = "TotalLabel"; - this.TotalLabel.Size = new System.Drawing.Size(98, 25); + this.TotalLabel.Size = new System.Drawing.Size(49, 13); this.TotalLabel.TabIndex = 6; this.TotalLabel.Text = "0 Cheats"; // @@ -639,10 +635,9 @@ // this.MessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.MessageLabel.AutoSize = true; - this.MessageLabel.Location = new System.Drawing.Point(26, 752); - this.MessageLabel.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.MessageLabel.Location = new System.Drawing.Point(13, 391); this.MessageLabel.Name = "MessageLabel"; - this.MessageLabel.Size = new System.Drawing.Size(60, 25); + this.MessageLabel.Size = new System.Drawing.Size(31, 13); this.MessageLabel.TabIndex = 7; this.MessageLabel.Text = " "; // @@ -651,11 +646,9 @@ this.CheatGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.CheatGroupBox.Controls.Add(this.CheatEditor); - this.CheatGroupBox.Location = new System.Drawing.Point(864, 127); - this.CheatGroupBox.Margin = new System.Windows.Forms.Padding(6); + this.CheatGroupBox.Location = new System.Drawing.Point(432, 66); this.CheatGroupBox.Name = "CheatGroupBox"; - this.CheatGroupBox.Padding = new System.Windows.Forms.Padding(6); - this.CheatGroupBox.Size = new System.Drawing.Size(404, 617); + this.CheatGroupBox.Size = new System.Drawing.Size(202, 321); this.CheatGroupBox.TabIndex = 8; this.CheatGroupBox.TabStop = false; this.CheatGroupBox.Text = "New Cheat"; @@ -665,18 +658,17 @@ this.CheatEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.CheatEditor.Location = new System.Drawing.Point(12, 27); - this.CheatEditor.Margin = new System.Windows.Forms.Padding(6); + this.CheatEditor.Location = new System.Drawing.Point(6, 14); this.CheatEditor.MemoryDomains = null; this.CheatEditor.Name = "CheatEditor"; - this.CheatEditor.Size = new System.Drawing.Size(380, 579); + this.CheatEditor.Size = new System.Drawing.Size(190, 307); this.CheatEditor.TabIndex = 0; // // Cheats // - this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1292, 783); + this.ClientSize = new System.Drawing.Size(646, 407); this.Controls.Add(this.CheatGroupBox); this.Controls.Add(this.MessageLabel); this.Controls.Add(this.TotalLabel); @@ -684,8 +676,7 @@ this.Controls.Add(this.CheatsMenu); this.Controls.Add(this.CheatListView); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(6); - this.MinimumSize = new System.Drawing.Size(544, 673); + this.MinimumSize = new System.Drawing.Size(280, 369); this.Name = "Cheats"; this.Text = "Cheats"; this.Load += new System.EventHandler(this.Cheats_Load); diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs index a4cc3db78c..f123017f24 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs @@ -52,8 +52,7 @@ namespace BizHawk.Client.EmuHawk [RequiredService] private IMemoryDomains Core { get; set; } - // Adam Sturge : I commented this out because it was causing me issues by removing the comparison type column - //[ConfigPersist] + [ConfigPersist] public CheatsSettings Settings { get; set; } public bool UpdateBefore { get { return false; } } @@ -264,6 +263,9 @@ namespace BizHawk.Client.EmuHawk case TYPE: text = Watch.DisplayTypeToString(Global.CheatList[index].Type); break; + case COMPARISONTYPE: + text = Global.CheatList[index].ComparisonType.ToString(); + break; } } diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.resx b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.resx index b76cd42ef3..1631505e05 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.resx +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.resx @@ -130,7 +130,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAAHYcAAB2HAY/l8WUAAAERSURBVDhPrZDbSgJRGIXnpewd6jXsjSQvIrwoI0RQMChU + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAERSURBVDhPrZDbSgJRGIXnpewd6jXsjSQvIrwoI0RQMChU 0iiDPCGiE3ZCRkvR8VzTeBhnyR5/ccaZNnPhB4t9sdf6Ln5hb8QeathNJFVFKF5C8DqL4ksDVHWGDf7j LHyPg6NjviSaFqlu5yQYR+KpupaIkrMknCxT3Y7v/NYYb0ITK1c3BarbWWhLQ7IR0cTKReyZ6lZ0XYei ztHpK4bAc+h1FgQijzSxMptrGIxVSO0xX3AaStFki7bUMVFmaMm/eJMGfIH/MkGzLep0AXn4h/r3CJV3 @@ -141,7 +141,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAAHYcAAB2HAY/l8WUAAAJHSURBVDhPxZBdSNNhFMb/F110ZZEVhVBgeeHNICiiuggp + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJHSURBVDhPxZBdSNNhFMb/F110ZZEVhVBgeeHNICiiuggp olAUyyxI0oSaH1QYC3N+tKnp5ubm1JUua5uuqdNKMwr7kApFItTUkWZqVhSVYmao5Nevvy7UoYR3HXh4 4XCe33nOKyy3lAY7l9RWMo0O/raWXxEyo5spVYTNvOGyfIRPfW+ptOkXqaPl6T83hcRmExSdgzAz3NVm YWyoYla/B+1M9JtxWLPpaH22JORIjI6gKAMB0jyEimIdo4OlbuaprwVMOOMovammpDADc34qppwUrmnl @@ -157,7 +157,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAAHYcAAB2HAY/l8WUAAAIySURBVDhPrZLfS5NRGMfff6H7boIuuq2pMZyL1eAt11CW + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIySURBVDhPrZLfS5NRGMfff6H7boIuuq2pMZyL1eAt11CW DcOKsB9vpFmaLtNExco0av6CbIVLJ61Wk3BSkT/AFCkRZSpZmrmiJQ41xSaCwdfznL15XEUX0Reem5f3 8znnec4j/Zc8fxYGla91CS3eRTx0z6OpMYS7jmnU1X6B/VYA18snUVoyjsKCt8jLHcH5c36ouCQR2NUJ 1Nas4G9ZXlmFKbULh1Kf8lJxSfI+WeCCyopv6q+/h+DQ/DJ2WV5Ao1FgPegRAveDOS4oLfmq/h6dn/DH @@ -173,7 +173,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAAHYcAAB2HAY/l8WUAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc From f19333dd111335f882f8de81b7b132244e2a978b Mon Sep 17 00:00:00 2001 From: Adam Sturge Date: Fri, 5 Feb 2016 20:33:21 -0800 Subject: [PATCH 04/10] Prettied up display of comparison type in cheats table --- BizHawk.Client.Common/tools/Cheat.cs | 10 +++++++++- BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs | 2 +- BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs | 13 ++++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/BizHawk.Client.Common/tools/Cheat.cs b/BizHawk.Client.Common/tools/Cheat.cs index f73e9b4afe..4cee5a343b 100644 --- a/BizHawk.Client.Common/tools/Cheat.cs +++ b/BizHawk.Client.Common/tools/Cheat.cs @@ -6,7 +6,15 @@ namespace BizHawk.Client.Common { public class Cheat { - public enum COMPARISONTYPE { EQUAL, GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL, NOT_EQUAL}; + public enum COMPARISONTYPE + { + EQUAL, + GREATER_THAN, + GREATER_THAN_OR_EQUAL, + LESS_THAN, + LESS_THAN_OR_EQUAL, + NOT_EQUAL + }; private readonly Watch _watch; private int? _compare; diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs index 56c0907099..0d421ec904 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs @@ -326,7 +326,7 @@ namespace BizHawk.Client.EmuHawk } else { - switch (CompareTypeDropDown.SelectedText) + switch (CompareTypeDropDown.SelectedItem.ToString()) { case "=" : comparisonType = Cheat.COMPARISONTYPE.EQUAL; break; case ">" : comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN; break; diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs index f123017f24..b735031805 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs @@ -10,6 +10,7 @@ using BizHawk.Emulation.Common; using BizHawk.Client.Common; using BizHawk.Client.EmuHawk.ToolExtensions; using BizHawk.Client.EmuHawk.WinFormExtensions; +using System.Diagnostics; namespace BizHawk.Client.EmuHawk { @@ -264,7 +265,17 @@ namespace BizHawk.Client.EmuHawk text = Watch.DisplayTypeToString(Global.CheatList[index].Type); break; case COMPARISONTYPE: - text = Global.CheatList[index].ComparisonType.ToString(); + switch (Global.CheatList[index].ComparisonType) + { + case Cheat.COMPARISONTYPE.EQUAL : text = "="; break; + case Cheat.COMPARISONTYPE.GREATER_THAN : text = ">"; break; + case Cheat.COMPARISONTYPE.GREATER_THAN_OR_EQUAL : text = ">="; break; + case Cheat.COMPARISONTYPE.LESS_THAN : text = "<"; break; + case Cheat.COMPARISONTYPE.LESS_THAN_OR_EQUAL : text = "<="; break; + case Cheat.COMPARISONTYPE.NOT_EQUAL : text = "!="; break; + default : break; + } + break; } } From 992acd9e96edd1366991f10888225e97767d3d12 Mon Sep 17 00:00:00 2001 From: Adam Sturge Date: Sun, 7 Feb 2016 20:56:40 -0800 Subject: [PATCH 05/10] Added code to sort by comparison type. Added code to compare based on comparison type selected --- BizHawk.Client.Common/tools/Cheat.cs | 48 ++++++++++++++++++- BizHawk.Client.Common/tools/CheatList.cs | 20 ++++++++ .../tools/Cheats/Cheats.Designer.cs | 6 +-- 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/BizHawk.Client.Common/tools/Cheat.cs b/BizHawk.Client.Common/tools/Cheat.cs index 4cee5a343b..fb37a8fd08 100644 --- a/BizHawk.Client.Common/tools/Cheat.cs +++ b/BizHawk.Client.Common/tools/Cheat.cs @@ -253,10 +253,54 @@ namespace BizHawk.Client.Common { if (_compare.HasValue) { - if (_compare.Value == _watch.ValueNoFreeze) // NOTE : THIS IS THE PLACE TO ADD DIFFERENT COMPARISON TYPES + switch (_comparisonType) { - _watch.Poke(GetStringForPulse(_val)); + case Cheat.COMPARISONTYPE.EQUAL: + if (_compare.Value == _watch.ValueNoFreeze) + { + _watch.Poke(GetStringForPulse(_val)); + } + break; + case Cheat.COMPARISONTYPE.GREATER_THAN: + if (_compare.Value > _watch.ValueNoFreeze) + { + _watch.Poke(GetStringForPulse(_val)); + } + break; + case Cheat.COMPARISONTYPE.GREATER_THAN_OR_EQUAL: + if (_compare.Value >= _watch.ValueNoFreeze) + { + _watch.Poke(GetStringForPulse(_val)); + } + break; + case Cheat.COMPARISONTYPE.LESS_THAN: + if (_compare.Value < _watch.ValueNoFreeze) + { + _watch.Poke(GetStringForPulse(_val)); + } + break; + case Cheat.COMPARISONTYPE.LESS_THAN_OR_EQUAL: + if (_compare.Value <= _watch.ValueNoFreeze) + { + _watch.Poke(GetStringForPulse(_val)); + } + break; + case Cheat.COMPARISONTYPE.NOT_EQUAL: + if (_compare.Value != _watch.ValueNoFreeze) + { + _watch.Poke(GetStringForPulse(_val)); + } + break; + default : + if (_compare.Value == _watch.ValueNoFreeze) + { + _watch.Poke(GetStringForPulse(_val)); + } + break; + } + + } else { diff --git a/BizHawk.Client.Common/tools/CheatList.cs b/BizHawk.Client.Common/tools/CheatList.cs index 626fc91c77..114c9d644f 100644 --- a/BizHawk.Client.Common/tools/CheatList.cs +++ b/BizHawk.Client.Common/tools/CheatList.cs @@ -673,6 +673,25 @@ namespace BizHawk.Client.Common .ToList(); } + break; + case COMPARISONTYPE: + if (reverse) + { + _cheatList = _cheatList + .OrderByDescending(x => x.ComparisonType) + .ThenBy(x => x.Name) + .ThenBy(x => x.Address ?? 0) + .ToList(); + } + else + { + _cheatList = _cheatList + .OrderBy(x => x.ComparisonType) + .ThenBy(x => x.Name) + .ThenBy(x => x.Address ?? 0) + .ToList(); + } + break; } } @@ -706,5 +725,6 @@ namespace BizHawk.Client.Common public const string SIZE = "SizeColumn"; public const string ENDIAN = "EndianColumn"; public const string TYPE = "DisplayTypeColumn"; + private const string COMPARISONTYPE = "ComparisonTypeColumn"; } } diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs index 8170360f19..a16911fb78 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.Designer.cs @@ -111,10 +111,10 @@ this.CheatListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.CheatName, this.Address, - this.Value, - this.ComparisonType, + this.Value, this.Compare, - this.On, + this.ComparisonType, + this.On, this.Domain}); this.CheatListView.ContextMenuStrip = this.CheatsContextMenu; this.CheatListView.FullRowSelect = true; From 52c587d712c9ffadf357e7ab78a701d5768b995b Mon Sep 17 00:00:00 2001 From: Adam Sturge Date: Sun, 7 Feb 2016 21:40:14 -0800 Subject: [PATCH 06/10] Save/Load cheats now accounts for comparison type column --- BizHawk.Client.Common/tools/Cheat.cs | 25 +---------- BizHawk.Client.Common/tools/CheatList.cs | 13 +++++- .../tools/Cheats/CheatEdit.cs | 43 ++++++++----------- 3 files changed, 32 insertions(+), 49 deletions(-) diff --git a/BizHawk.Client.Common/tools/Cheat.cs b/BizHawk.Client.Common/tools/Cheat.cs index fb37a8fd08..48bac55d7c 100644 --- a/BizHawk.Client.Common/tools/Cheat.cs +++ b/BizHawk.Client.Common/tools/Cheat.cs @@ -23,25 +23,7 @@ namespace BizHawk.Client.Common private COMPARISONTYPE _comparisonType; - public Cheat(Watch watch, int value, int? compare = null, bool enabled = true) - { - _enabled = enabled; - _watch = watch; - _compare = compare; - _val = value; - - Pulse(); - } - - /// - /// Adding second constructor for comparison type because I fear updating the method signiture for something in the Common namespace - /// - /// - /// - /// - /// - /// - public Cheat(Watch watch, int value, COMPARISONTYPE comparisonType, int compare, bool enabled = true) + public Cheat(Watch watch, int value, int? compare = null, bool enabled = true, COMPARISONTYPE comparisonType = COMPARISONTYPE.EQUAL) { _enabled = enabled; _watch = watch; @@ -297,10 +279,7 @@ namespace BizHawk.Client.Common _watch.Poke(GetStringForPulse(_val)); } break; - - } - - + } } else { diff --git a/BizHawk.Client.Common/tools/CheatList.cs b/BizHawk.Client.Common/tools/CheatList.cs index 114c9d644f..d18bf10679 100644 --- a/BizHawk.Client.Common/tools/CheatList.cs +++ b/BizHawk.Client.Common/tools/CheatList.cs @@ -397,6 +397,7 @@ namespace BizHawk.Client.Common .Append(cheat.SizeAsChar).Append('\t') .Append(cheat.TypeAsChar).Append('\t') .Append((cheat.BigEndian ?? false) ? '1' : '0').Append('\t') + .Append(cheat.ComparisonType.ToString()).Append('\t') .AppendLine(); } } @@ -450,6 +451,7 @@ namespace BizHawk.Client.Common var size = WatchSize.Byte; var type = DisplayType.Hex; var bigendian = false; + Cheat.COMPARISONTYPE comparisonType = Cheat.COMPARISONTYPE.EQUAL; if (s.Length < 6) { @@ -480,6 +482,15 @@ namespace BizHawk.Client.Common type = Watch.DisplayTypeFromChar(vals[7][0]); bigendian = vals[8] == "1"; } + + // For backwards compatibility, don't assume these values exist + if (vals.Length > 8) + { + if(!Enum.TryParse(vals[9], out comparisonType)) + { + continue; //Not sure if this is the best answer, could just resort to == + } + } var watch = Watch.GenerateWatch( domain, @@ -489,7 +500,7 @@ namespace BizHawk.Client.Common bigendian, name); - Add(new Cheat(watch, value, compare, !Global.Config.DisableCheatsOnLoad && enabled)); + Add(new Cheat(watch, value, compare, !Global.Config.DisableCheatsOnLoad && enabled, comparisonType)); } } catch diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs index 0d421ec904..2d1879ce3b 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs @@ -317,34 +317,27 @@ namespace BizHawk.Client.EmuHawk NameBox.Text ); - if(CompareBox.ToRawInt() == null) + switch (CompareTypeDropDown.SelectedItem.ToString()) { - return new Cheat( - watch, - ValueBox.ToRawInt().Value - ); - } - else - { - switch (CompareTypeDropDown.SelectedItem.ToString()) - { - case "=" : comparisonType = Cheat.COMPARISONTYPE.EQUAL; break; - case ">" : comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN; break; - case ">=" : comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN_OR_EQUAL; break; - case "<" : comparisonType = Cheat.COMPARISONTYPE.LESS_THAN; break; - case "<=" : comparisonType = Cheat.COMPARISONTYPE.LESS_THAN_OR_EQUAL; break; - case "!=" : comparisonType = Cheat.COMPARISONTYPE.NOT_EQUAL; break; - default : comparisonType = Cheat.COMPARISONTYPE.EQUAL; break; - } - - return new Cheat( - watch, - ValueBox.ToRawInt().Value, - comparisonType, - CompareBox.ToRawInt().Value - ); + case "=": comparisonType = Cheat.COMPARISONTYPE.EQUAL; break; + case ">": comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN; break; + case ">=": comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN_OR_EQUAL; break; + case "<": comparisonType = Cheat.COMPARISONTYPE.LESS_THAN; break; + case "<=": comparisonType = Cheat.COMPARISONTYPE.LESS_THAN_OR_EQUAL; break; + case "!=": comparisonType = Cheat.COMPARISONTYPE.NOT_EQUAL; break; + default: comparisonType = Cheat.COMPARISONTYPE.EQUAL; break; } + int? c = CompareBox.ToRawInt() == null ? null : (int?)CompareBox.ToRawInt().Value; + + + return new Cheat( + watch, + ValueBox.ToRawInt().Value, + CompareBox.ToRawInt() == null ? null : (int?)CompareBox.ToRawInt().Value, + true, + comparisonType + ); } else From 5dc31d3eb9f350f09dda9eb23e7b853388e3b33c Mon Sep 17 00:00:00 2001 From: Adam Sturge Date: Sun, 7 Feb 2016 21:54:45 -0800 Subject: [PATCH 07/10] Fixed index bug for comparison type in Load() in CheatList --- BizHawk.Client.Common/tools/CheatList.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BizHawk.Client.Common/tools/CheatList.cs b/BizHawk.Client.Common/tools/CheatList.cs index d18bf10679..e735afb3f0 100644 --- a/BizHawk.Client.Common/tools/CheatList.cs +++ b/BizHawk.Client.Common/tools/CheatList.cs @@ -484,7 +484,7 @@ namespace BizHawk.Client.Common } // For backwards compatibility, don't assume these values exist - if (vals.Length > 8) + if (vals.Length > 9) { if(!Enum.TryParse(vals[9], out comparisonType)) { From c59f1c17613caa6436d5e19241f7778035993a8a Mon Sep 17 00:00:00 2001 From: Adam Sturge Date: Mon, 8 Feb 2016 20:56:11 -0800 Subject: [PATCH 08/10] Comparison type can be set if and only if comparison field is non-empty --- .../tools/Cheats/CheatEdit.Designer.cs | 52 ++++++++----------- .../tools/Cheats/CheatEdit.cs | 36 +++++++++++++ 2 files changed, 57 insertions(+), 31 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.Designer.cs b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.Designer.cs index 9feacf2848..bbe4059b7e 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.Designer.cs @@ -56,7 +56,7 @@ // this.NameBox.Location = new System.Drawing.Point(70, 12); this.NameBox.Name = "NameBox"; - this.NameBox.Size = new System.Drawing.Size(108, 20); + this.NameBox.Size = new System.Drawing.Size(108, 31); this.NameBox.TabIndex = 5; // // NameLabel @@ -64,7 +64,7 @@ this.NameLabel.AutoSize = true; this.NameLabel.Location = new System.Drawing.Point(32, 16); this.NameLabel.Name = "NameLabel"; - this.NameLabel.Size = new System.Drawing.Size(35, 13); + this.NameLabel.Size = new System.Drawing.Size(68, 25); this.NameLabel.TabIndex = 4; this.NameLabel.Text = "Name"; // @@ -73,7 +73,7 @@ this.AddressLabel.AutoSize = true; this.AddressLabel.Location = new System.Drawing.Point(22, 43); this.AddressLabel.Name = "AddressLabel"; - this.AddressLabel.Size = new System.Drawing.Size(45, 13); + this.AddressLabel.Size = new System.Drawing.Size(91, 25); this.AddressLabel.TabIndex = 6; this.AddressLabel.Text = "Address"; // @@ -82,7 +82,7 @@ this.AddressHexIndLabel.AutoSize = true; this.AddressHexIndLabel.Location = new System.Drawing.Point(92, 43); this.AddressHexIndLabel.Name = "AddressHexIndLabel"; - this.AddressHexIndLabel.Size = new System.Drawing.Size(18, 13); + this.AddressHexIndLabel.Size = new System.Drawing.Size(35, 25); this.AddressHexIndLabel.TabIndex = 8; this.AddressHexIndLabel.Text = "0x"; // @@ -93,7 +93,7 @@ this.AddressBox.MaxLength = 8; this.AddressBox.Name = "AddressBox"; this.AddressBox.Nullable = true; - this.AddressBox.Size = new System.Drawing.Size(65, 20); + this.AddressBox.Size = new System.Drawing.Size(65, 31); this.AddressBox.TabIndex = 9; // // ValueHexIndLabel @@ -101,7 +101,7 @@ this.ValueHexIndLabel.AutoSize = true; this.ValueHexIndLabel.Location = new System.Drawing.Point(92, 69); this.ValueHexIndLabel.Name = "ValueHexIndLabel"; - this.ValueHexIndLabel.Size = new System.Drawing.Size(18, 13); + this.ValueHexIndLabel.Size = new System.Drawing.Size(35, 25); this.ValueHexIndLabel.TabIndex = 11; this.ValueHexIndLabel.Text = "0x"; // @@ -110,7 +110,7 @@ this.ValueLabel.AutoSize = true; this.ValueLabel.Location = new System.Drawing.Point(33, 69); this.ValueLabel.Name = "ValueLabel"; - this.ValueLabel.Size = new System.Drawing.Size(34, 13); + this.ValueLabel.Size = new System.Drawing.Size(67, 25); this.ValueLabel.TabIndex = 10; this.ValueLabel.Text = "Value"; // @@ -119,7 +119,7 @@ this.CompareHexIndLabel.AutoSize = true; this.CompareHexIndLabel.Location = new System.Drawing.Point(92, 95); this.CompareHexIndLabel.Name = "CompareHexIndLabel"; - this.CompareHexIndLabel.Size = new System.Drawing.Size(18, 13); + this.CompareHexIndLabel.Size = new System.Drawing.Size(35, 25); this.CompareHexIndLabel.TabIndex = 14; this.CompareHexIndLabel.Text = "0x"; // @@ -128,7 +128,7 @@ this.CompareLabel.AutoSize = true; this.CompareLabel.Location = new System.Drawing.Point(24, 95); this.CompareLabel.Name = "CompareLabel"; - this.CompareLabel.Size = new System.Drawing.Size(49, 13); + this.CompareLabel.Size = new System.Drawing.Size(99, 25); this.CompareLabel.TabIndex = 13; this.CompareLabel.Text = "Compare"; // @@ -137,7 +137,7 @@ this.DomainLabel.AutoSize = true; this.DomainLabel.Location = new System.Drawing.Point(24, 158); this.DomainLabel.Name = "DomainLabel"; - this.DomainLabel.Size = new System.Drawing.Size(43, 13); + this.DomainLabel.Size = new System.Drawing.Size(85, 25); this.DomainLabel.TabIndex = 16; this.DomainLabel.Text = "Domain"; // @@ -147,7 +147,7 @@ this.DomainDropDown.FormattingEnabled = true; this.DomainDropDown.Location = new System.Drawing.Point(78, 154); this.DomainDropDown.Name = "DomainDropDown"; - this.DomainDropDown.Size = new System.Drawing.Size(100, 21); + this.DomainDropDown.Size = new System.Drawing.Size(100, 33); this.DomainDropDown.TabIndex = 17; this.DomainDropDown.SelectedIndexChanged += new System.EventHandler(this.DomainDropDown_SelectedIndexChanged); // @@ -156,7 +156,7 @@ this.SizeLabel.AutoSize = true; this.SizeLabel.Location = new System.Drawing.Point(40, 190); this.SizeLabel.Name = "SizeLabel"; - this.SizeLabel.Size = new System.Drawing.Size(27, 13); + this.SizeLabel.Size = new System.Drawing.Size(54, 25); this.SizeLabel.TabIndex = 18; this.SizeLabel.Text = "Size"; // @@ -170,7 +170,7 @@ "4 Byte"}); this.SizeDropDown.Location = new System.Drawing.Point(78, 184); this.SizeDropDown.Name = "SizeDropDown"; - this.SizeDropDown.Size = new System.Drawing.Size(100, 21); + this.SizeDropDown.Size = new System.Drawing.Size(100, 33); this.SizeDropDown.TabIndex = 19; this.SizeDropDown.SelectedIndexChanged += new System.EventHandler(this.SizeDropDown_SelectedIndexChanged); // @@ -179,7 +179,7 @@ this.DisplayTypeLael.AutoSize = true; this.DisplayTypeLael.Location = new System.Drawing.Point(11, 219); this.DisplayTypeLael.Name = "DisplayTypeLael"; - this.DisplayTypeLael.Size = new System.Drawing.Size(56, 13); + this.DisplayTypeLael.Size = new System.Drawing.Size(114, 25); this.DisplayTypeLael.TabIndex = 20; this.DisplayTypeLael.Text = "Display As"; // @@ -193,7 +193,7 @@ "4 Byte"}); this.DisplayTypeDropDown.Location = new System.Drawing.Point(78, 213); this.DisplayTypeDropDown.Name = "DisplayTypeDropDown"; - this.DisplayTypeDropDown.Size = new System.Drawing.Size(100, 21); + this.DisplayTypeDropDown.Size = new System.Drawing.Size(100, 33); this.DisplayTypeDropDown.TabIndex = 21; this.DisplayTypeDropDown.SelectedIndexChanged += new System.EventHandler(this.DisplayTypeDropDown_SelectedIndexChanged); // @@ -202,7 +202,7 @@ this.BigEndianCheckBox.AutoSize = true; this.BigEndianCheckBox.Location = new System.Drawing.Point(101, 242); this.BigEndianCheckBox.Name = "BigEndianCheckBox"; - this.BigEndianCheckBox.Size = new System.Drawing.Size(77, 17); + this.BigEndianCheckBox.Size = new System.Drawing.Size(148, 29); this.BigEndianCheckBox.TabIndex = 22; this.BigEndianCheckBox.Text = "Big Endian"; this.BigEndianCheckBox.UseVisualStyleBackColor = true; @@ -239,9 +239,10 @@ this.CompareBox.MaxLength = 2; this.CompareBox.Name = "CompareBox"; this.CompareBox.Nullable = true; - this.CompareBox.Size = new System.Drawing.Size(65, 20); + this.CompareBox.Size = new System.Drawing.Size(65, 31); this.CompareBox.TabIndex = 15; this.CompareBox.Type = BizHawk.Client.Common.DisplayType.Hex; + this.CompareBox.TextChanged += new System.EventHandler(this.CompareBox_TextChanged); // // ValueBox // @@ -251,7 +252,7 @@ this.ValueBox.MaxLength = 2; this.ValueBox.Name = "ValueBox"; this.ValueBox.Nullable = true; - this.ValueBox.Size = new System.Drawing.Size(65, 20); + this.ValueBox.Size = new System.Drawing.Size(65, 31); this.ValueBox.TabIndex = 12; this.ValueBox.Text = "00"; this.ValueBox.Type = BizHawk.Client.Common.DisplayType.Hex; @@ -262,26 +263,15 @@ this.CompareTypeDropDown.FormattingEnabled = true; this.CompareTypeDropDown.Location = new System.Drawing.Point(113, 122); this.CompareTypeDropDown.Name = "CompareTypeDropDown"; - this.CompareTypeDropDown.Size = new System.Drawing.Size(65, 21); + this.CompareTypeDropDown.Size = new System.Drawing.Size(65, 33); this.CompareTypeDropDown.TabIndex = 26; - this.CompareTypeDropDown.Items.AddRange( - new object[] { - "=", - ">", - ">=", - "<", - "<=", - "!=" - } - ); - this.CompareTypeDropDown.SelectedIndex = 0; // // CompareTypeLabel // this.CompareTypeLabel.AutoSize = true; this.CompareTypeLabel.Location = new System.Drawing.Point(24, 125); this.CompareTypeLabel.Name = "CompareTypeLabel"; - this.CompareTypeLabel.Size = new System.Drawing.Size(76, 13); + this.CompareTypeLabel.Size = new System.Drawing.Size(153, 25); this.CompareTypeLabel.TabIndex = 25; this.CompareTypeLabel.Text = "Compare Type"; this.CompareTypeLabel.TextAlign = System.Drawing.ContentAlignment.BottomLeft; diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs index 2d1879ce3b..3b0e9c4626 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs @@ -359,5 +359,41 @@ namespace BizHawk.Client.EmuHawk } #endregion + + private void CompareBox_TextChanged(object sender, EventArgs e) + { + WatchValueBox compareBox = (WatchValueBox)sender; + + PopulateComparisonTypeBox(String.IsNullOrWhiteSpace(compareBox.Text)); + } + + /// + /// Populates the comparison type drop down + /// + /// True if drop down should be left empty + private void PopulateComparisonTypeBox(bool empty = false) + { + + // Don't need to do anything in this case + if (!empty && this.CompareTypeDropDown.Items.Count > 0) + { + return; + } + + this.CompareTypeDropDown.Items.Clear(); + + if (!empty) + { + this.CompareTypeDropDown.Items.AddRange(new object[] { + "=", + ">", + ">=", + "<", + "<=", + "!=" + }); + } + + } } } From 447d312a5cac3f2b07f7ef9b2ffc9886a5007f88 Mon Sep 17 00:00:00 2001 From: Adam Sturge Date: Mon, 8 Feb 2016 21:06:13 -0800 Subject: [PATCH 09/10] Highlighting a cheat now updates the comparison type drop down to reflect the appropriate value --- BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs index 3b0e9c4626..ba0e32939e 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs @@ -87,6 +87,7 @@ namespace BizHawk.Client.EmuHawk AddressBox.Text = _cheat.AddressStr; ValueBox.Text = _cheat.ValueStr; CompareBox.Text = _cheat.Compare.HasValue ? _cheat.CompareStr : String.Empty; + CompareTypeDropDown.SelectedIndex = (int)_cheat.ComparisonType; CheckFormState(); if (!_cheat.Compare.HasValue) From c82f70763e8a59a7f80e5e1f78ca996d710da08b Mon Sep 17 00:00:00 2001 From: Adam Sturge Date: Tue, 9 Feb 2016 20:33:44 -0800 Subject: [PATCH 10/10] Fixed bug where having no comparison type would throw exception --- BizHawk.Client.Common/tools/Cheat.cs | 11 +++--- BizHawk.Client.Common/tools/CheatList.cs | 2 +- .../tools/Cheats/CheatEdit.Designer.cs | 4 +++ .../tools/Cheats/CheatEdit.cs | 36 +++++++++++++++---- BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs | 3 +- 5 files changed, 42 insertions(+), 14 deletions(-) diff --git a/BizHawk.Client.Common/tools/Cheat.cs b/BizHawk.Client.Common/tools/Cheat.cs index 48bac55d7c..e98a77fa02 100644 --- a/BizHawk.Client.Common/tools/Cheat.cs +++ b/BizHawk.Client.Common/tools/Cheat.cs @@ -8,7 +8,8 @@ namespace BizHawk.Client.Common { public enum COMPARISONTYPE { - EQUAL, + NONE, + EQUAL, GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, @@ -23,7 +24,7 @@ namespace BizHawk.Client.Common private COMPARISONTYPE _comparisonType; - public Cheat(Watch watch, int value, int? compare = null, bool enabled = true, COMPARISONTYPE comparisonType = COMPARISONTYPE.EQUAL) + public Cheat(Watch watch, int value, int? compare = null, bool enabled = true, COMPARISONTYPE comparisonType = COMPARISONTYPE.NONE) { _enabled = enabled; _watch = watch; @@ -237,6 +238,8 @@ namespace BizHawk.Client.Common { switch (_comparisonType) { + case Cheat.COMPARISONTYPE.NONE: // This should never happen, but it's here just in case + break; case Cheat.COMPARISONTYPE.EQUAL: if (_compare.Value == _watch.ValueNoFreeze) { @@ -274,10 +277,6 @@ namespace BizHawk.Client.Common } break; default : - if (_compare.Value == _watch.ValueNoFreeze) - { - _watch.Poke(GetStringForPulse(_val)); - } break; } } diff --git a/BizHawk.Client.Common/tools/CheatList.cs b/BizHawk.Client.Common/tools/CheatList.cs index e735afb3f0..54fcbb9ddc 100644 --- a/BizHawk.Client.Common/tools/CheatList.cs +++ b/BizHawk.Client.Common/tools/CheatList.cs @@ -451,7 +451,7 @@ namespace BizHawk.Client.Common var size = WatchSize.Byte; var type = DisplayType.Hex; var bigendian = false; - Cheat.COMPARISONTYPE comparisonType = Cheat.COMPARISONTYPE.EQUAL; + Cheat.COMPARISONTYPE comparisonType = Cheat.COMPARISONTYPE.NONE; if (s.Length < 6) { diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.Designer.cs b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.Designer.cs index bbe4059b7e..1e115271d4 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.Designer.cs @@ -265,6 +265,10 @@ this.CompareTypeDropDown.Name = "CompareTypeDropDown"; this.CompareTypeDropDown.Size = new System.Drawing.Size(65, 33); this.CompareTypeDropDown.TabIndex = 26; + this.CompareTypeDropDown.Items.AddRange(new object[] { + "" + }); + this.CompareTypeDropDown.SelectedIndex = 0; // // CompareTypeLabel // diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs index ba0e32939e..7f4003ff52 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/CheatEdit.cs @@ -87,7 +87,16 @@ namespace BizHawk.Client.EmuHawk AddressBox.Text = _cheat.AddressStr; ValueBox.Text = _cheat.ValueStr; CompareBox.Text = _cheat.Compare.HasValue ? _cheat.CompareStr : String.Empty; - CompareTypeDropDown.SelectedIndex = (int)_cheat.ComparisonType; + + if (_cheat.ComparisonType.Equals(Cheat.COMPARISONTYPE.NONE)) + { + CompareTypeDropDown.SelectedIndex = 0; + } + else + { + CompareTypeDropDown.SelectedIndex = ((int)_cheat.ComparisonType - 1); + } + CheckFormState(); if (!_cheat.Compare.HasValue) @@ -304,7 +313,7 @@ namespace BizHawk.Client.EmuHawk { get { - Cheat.COMPARISONTYPE comparisonType = Cheat.COMPARISONTYPE.EQUAL; + Cheat.COMPARISONTYPE comparisonType = Cheat.COMPARISONTYPE.NONE; var domain = MemoryDomains[DomainDropDown.SelectedItem.ToString()]; var address = AddressBox.ToRawInt().Value; if (address < domain.Size) @@ -320,13 +329,14 @@ namespace BizHawk.Client.EmuHawk switch (CompareTypeDropDown.SelectedItem.ToString()) { + case "": comparisonType = Cheat.COMPARISONTYPE.NONE; break; case "=": comparisonType = Cheat.COMPARISONTYPE.EQUAL; break; case ">": comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN; break; case ">=": comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN_OR_EQUAL; break; case "<": comparisonType = Cheat.COMPARISONTYPE.LESS_THAN; break; case "<=": comparisonType = Cheat.COMPARISONTYPE.LESS_THAN_OR_EQUAL; break; case "!=": comparisonType = Cheat.COMPARISONTYPE.NOT_EQUAL; break; - default: comparisonType = Cheat.COMPARISONTYPE.EQUAL; break; + default: comparisonType = Cheat.COMPARISONTYPE.NONE; break; } int? c = CompareBox.ToRawInt() == null ? null : (int?)CompareBox.ToRawInt().Value; @@ -376,14 +386,26 @@ namespace BizHawk.Client.EmuHawk { // Don't need to do anything in this case - if (!empty && this.CompareTypeDropDown.Items.Count > 0) + if(empty && this.CompareTypeDropDown.Items.Count == 1) + { + return; + } + + // Don't need to do anything in this case + if (!empty && this.CompareTypeDropDown.Items.Count == 6) { return; } this.CompareTypeDropDown.Items.Clear(); - if (!empty) + if (empty) + { + this.CompareTypeDropDown.Items.AddRange(new object[] { + "" + }); + } + else { this.CompareTypeDropDown.Items.AddRange(new object[] { "=", @@ -394,7 +416,9 @@ namespace BizHawk.Client.EmuHawk "!=" }); } - + + this.CompareTypeDropDown.SelectedIndex = 0; + } } } diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs index b735031805..fe8f93e877 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs @@ -267,13 +267,14 @@ namespace BizHawk.Client.EmuHawk case COMPARISONTYPE: switch (Global.CheatList[index].ComparisonType) { + case Cheat.COMPARISONTYPE.NONE : text = ""; break; case Cheat.COMPARISONTYPE.EQUAL : text = "="; break; case Cheat.COMPARISONTYPE.GREATER_THAN : text = ">"; break; case Cheat.COMPARISONTYPE.GREATER_THAN_OR_EQUAL : text = ">="; break; case Cheat.COMPARISONTYPE.LESS_THAN : text = "<"; break; case Cheat.COMPARISONTYPE.LESS_THAN_OR_EQUAL : text = "<="; break; case Cheat.COMPARISONTYPE.NOT_EQUAL : text = "!="; break; - default : break; + default : text = ""; break; } break;