From 172a48f8a1e9f86fb8c708609814c8f811a2893c Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Sun, 20 Feb 2011 04:54:41 +0000 Subject: [PATCH] Ram Search - Start the groundwork for the search button --- .../tools/RamSearch.Designer.cs | 1 + BizHawk.MultiClient/tools/RamSearch.cs | 94 ++++++++++++++++++- 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/BizHawk.MultiClient/tools/RamSearch.Designer.cs b/BizHawk.MultiClient/tools/RamSearch.Designer.cs index c444ba8d96..af7c0d1753 100644 --- a/BizHawk.MultiClient/tools/RamSearch.Designer.cs +++ b/BizHawk.MultiClient/tools/RamSearch.Designer.cs @@ -390,6 +390,7 @@ this.toolStripButton1.Name = "toolStripButton1"; this.toolStripButton1.Size = new System.Drawing.Size(23, 22); this.toolStripButton1.Text = "toolStripButton1"; + this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click); // // ClearChangeCountstoolStripButton // diff --git a/BizHawk.MultiClient/tools/RamSearch.cs b/BizHawk.MultiClient/tools/RamSearch.cs index 9828e38553..022ac1a15b 100644 --- a/BizHawk.MultiClient/tools/RamSearch.cs +++ b/BizHawk.MultiClient/tools/RamSearch.cs @@ -20,6 +20,10 @@ namespace BizHawk.MultiClient string systemID = "NULL"; List searchList = new List(); List undoList = new List(); + List newSearchList = new List(); //When addresses are weeded out, the new list goes here, before going into searchList + + public enum SCompareTo { PREV, VALUE, ADDRESS, CHANGES }; + public enum SOperator { LESS, GREATER, LESSEQUAL, GREATEREQUAL, EQUAL, NOTEQUAL, DIFFBY, MODULUS }; //Reset window position item int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired @@ -61,7 +65,7 @@ namespace BizHawk.MultiClient bigEndianToolStripMenuItem.Checked = false; littleEndianToolStripMenuItem.Checked = true; } - + StartNewSearch(); if (Global.Config.RamSearchWndx >= 0 && Global.Config.RamSearchWndy >= 0) @@ -374,5 +378,93 @@ namespace BizHawk.MultiClient { DoUndo(); } + + private void toolStripButton1_Click(object sender, EventArgs e) + { + GenerateNewSearchList(); + } + + /// + /// Generates the new search list based on user criteria + /// Does not replace the old list + /// + + private SCompareTo GetCompareTo() + { + if (PreviousValueRadio.Checked) + return SCompareTo.PREV; + if (SpecificValueRadio.Checked) + return SCompareTo.VALUE; + if (SpecificAddressRadio.Checked) + return SCompareTo.ADDRESS; + if (NumberOfChangesRadio.Checked) + return SCompareTo.CHANGES; + + return SCompareTo.PREV; //Just in case + } + + private SOperator GetOperator() + { + if (LessThanRadio.Checked) + return SOperator.LESS; + if (GreaterThanRadio.Checked) + return SOperator.GREATER; + if (LessThanOrEqualToRadio.Checked) + return SOperator.LESSEQUAL; + if (GreaterThanOrEqualToRadio.Checked) + return SOperator.GREATEREQUAL; + if (EqualToRadio.Checked) + return SOperator.EQUAL; + if (NotEqualToRadio.Checked) + return SOperator.NOTEQUAL; + if (DifferentByRadio.Checked) + return SOperator.DIFFBY; + if (ModuloRadio.Checked) + return SOperator.MODULUS; + + return SOperator.LESS; //Just in case + } + + private void GenerateNewSearchList() + { + //Switch based on user criteria + //Generate search list + //Use search list to generate a list of flagged address (for displaying pink) + switch (GetCompareTo()) + { + case SCompareTo.PREV: + DoPreviousValue(); + break; + case SCompareTo.VALUE: + DoSpecificValue(); + break; + case SCompareTo.ADDRESS: + DoSpecificAddress(); + break; + case SCompareTo.CHANGES: + DoNumberOfChanges(); + break; + } + } + + private void DoPreviousValue() + { + + } + + private void DoSpecificValue() + { + + } + + private void DoSpecificAddress() + { + + } + + private void DoNumberOfChanges() + { + + } } }