From 9c625df425270e6cc486920ff1684f23825d81d9 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Sun, 20 Feb 2011 20:37:50 +0000 Subject: [PATCH] Ram Search - misc fix ups --- .../tools/RamSearch.Designer.cs | 2 + BizHawk.MultiClient/tools/RamSearch.cs | 47 +++++++++++++------ BizHawk.MultiClient/tools/RamSearch.resx | 6 +-- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/BizHawk.MultiClient/tools/RamSearch.Designer.cs b/BizHawk.MultiClient/tools/RamSearch.Designer.cs index 0141cd3337..3e990c175a 100644 --- a/BizHawk.MultiClient/tools/RamSearch.Designer.cs +++ b/BizHawk.MultiClient/tools/RamSearch.Designer.cs @@ -660,6 +660,7 @@ // ModuloRadio // this.ModuloRadio.AutoSize = true; + this.ModuloRadio.Enabled = false; this.ModuloRadio.Location = new System.Drawing.Point(7, 153); this.ModuloRadio.Name = "ModuloRadio"; this.ModuloRadio.Size = new System.Drawing.Size(60, 17); @@ -672,6 +673,7 @@ // DifferentByRadio // this.DifferentByRadio.AutoSize = true; + this.DifferentByRadio.Enabled = false; this.DifferentByRadio.Location = new System.Drawing.Point(7, 134); this.DifferentByRadio.Name = "DifferentByRadio"; this.DifferentByRadio.Size = new System.Drawing.Size(83, 17); diff --git a/BizHawk.MultiClient/tools/RamSearch.cs b/BizHawk.MultiClient/tools/RamSearch.cs index 8791ee472d..0b198b21d6 100644 --- a/BizHawk.MultiClient/tools/RamSearch.cs +++ b/BizHawk.MultiClient/tools/RamSearch.cs @@ -22,7 +22,7 @@ namespace BizHawk.MultiClient string systemID = "NULL"; List searchList = new List(); List undoList = new List(); - List weedOutList = new List(); //When addresses are weeded out, the new list goes here, before going into searchList + List weededList = 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 }; @@ -238,6 +238,7 @@ namespace BizHawk.MultiClient searchList[x].address = x + startaddress; searchList[x].prev = searchList[x].value = Global.Emulator.MainMemory.PeekByte(x); } + OutputLabel.Text = "New search started"; DisplaySearchList(); } @@ -385,9 +386,8 @@ namespace BizHawk.MultiClient private void ReplaceSearchListWithWeedOutList() { - //TODO: if weedoutlist = 0, prompt user then reset search? Think about this - searchList = new List(weedOutList); - weedOutList.Clear(); + searchList = new List(weededList); + weededList.Clear(); } private void toolStripButton1_Click(object sender, EventArgs e) @@ -395,7 +395,7 @@ namespace BizHawk.MultiClient if (GenerateWeedOutList()) { SaveUndo(); - OutputLabel.Text = (searchList.Count - weedOutList.Count).ToString() + " addresses removed"; //TODO: address if only 1 + OutputLabel.Text = (searchList.Count - weededList.Count).ToString() + " addresses removed"; //TODO: address if only 1 ReplaceSearchListWithWeedOutList(); DisplaySearchList(); } @@ -403,11 +403,6 @@ namespace BizHawk.MultiClient } - /// - /// Generates the new search list based on user criteria - /// Does not replace the old list - /// - private SCompareTo GetCompareTo() { if (PreviousValueRadio.Checked) @@ -480,8 +475,6 @@ namespace BizHawk.MultiClient if (!i) return -1; int x = int.Parse(SpecificAddressBox.Text.ToUpper().Trim(), NumberStyles.HexNumber); - if (x < searchList[0].address || x > searchList[searchList.Count - 1].address) return -1; - return x; } @@ -498,26 +491,52 @@ namespace BizHawk.MultiClient switch (GetOperator()) { case SOperator.LESS: - + for (int x = 0; x < searchList.Count; x++) + { + if (searchList[x].address < address) + weededList.Add(searchList[x]); + } break; case SOperator.GREATER: + for (int x = 0; x < searchList.Count; x++) + { + if (searchList[x].address > address) + weededList.Add(searchList[x]); + } break; case SOperator.LESSEQUAL: + for (int x = 0; x < searchList.Count; x++) + { + if (searchList[x].address <= address) + weededList.Add(searchList[x]); + } break; case SOperator.GREATEREQUAL: + for (int x = 0; x < searchList.Count; x++) + { + if (searchList[x].address >= address) + weededList.Add(searchList[x]); + } break; case SOperator.EQUAL: for (int x = 0; x < searchList.Count; x++) { if (searchList[x].address == address) - weedOutList.Add(searchList[x]); + weededList.Add(searchList[x]); } break; case SOperator.NOTEQUAL: + for (int x = 0; x < searchList.Count; x++) + { + if (searchList[x].address != address) + weededList.Add(searchList[x]); + } break; case SOperator.DIFFBY: + //TODO break; case SOperator.MODULUS: + //TODO break; } return true; diff --git a/BizHawk.MultiClient/tools/RamSearch.resx b/BizHawk.MultiClient/tools/RamSearch.resx index 5597b9c11f..70c8b2fa77 100644 --- a/BizHawk.MultiClient/tools/RamSearch.resx +++ b/BizHawk.MultiClient/tools/RamSearch.resx @@ -171,9 +171,6 @@ 259, 17 - - 358, 17 - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 @@ -205,6 +202,9 @@ s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC + + 358, 17 + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8