From 4ff2e248046f4936e22fc4f9da4c0736bce0fae2 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Sun, 20 Feb 2011 20:50:41 +0000 Subject: [PATCH] Ram Search - implemented Diff By Specific Address (yeah, that one is really pointless, but might as well) --- .../tools/RamSearch.Designer.cs | 1 - BizHawk.MultiClient/tools/RamSearch.cs | 27 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/BizHawk.MultiClient/tools/RamSearch.Designer.cs b/BizHawk.MultiClient/tools/RamSearch.Designer.cs index 3e990c175a..33126eb016 100644 --- a/BizHawk.MultiClient/tools/RamSearch.Designer.cs +++ b/BizHawk.MultiClient/tools/RamSearch.Designer.cs @@ -673,7 +673,6 @@ // 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 0b198b21d6..1455e95c26 100644 --- a/BizHawk.MultiClient/tools/RamSearch.cs +++ b/BizHawk.MultiClient/tools/RamSearch.cs @@ -474,8 +474,15 @@ namespace BizHawk.MultiClient bool i = InputValidate.IsValidHexNumber(SpecificAddressBox.Text); if (!i) return -1; - int x = int.Parse(SpecificAddressBox.Text.ToUpper().Trim(), NumberStyles.HexNumber); - return x; + return int.Parse(SpecificAddressBox.Text.ToUpper().Trim(), NumberStyles.HexNumber); + } + + private int GetDifferentBy() + { + bool i = InputValidate.IsValidUnsignedNumber(DifferentByBox.Text); + if (!i) return -1; + + return int.Parse(DifferentByBox.Text.ToUpper().Trim()); } private bool DoSpecificAddress() @@ -533,7 +540,21 @@ namespace BizHawk.MultiClient } break; case SOperator.DIFFBY: - //TODO + { + int diff = GetDifferentBy(); + if (diff < 0) + { + MessageBox.Show("Missing or invalid Different By value", "Invalid value", MessageBoxButtons.OK, MessageBoxIcon.Error); + DifferentByBox.Focus(); + DifferentByBox.SelectAll(); + return false; + } + for (int x = 0; x < searchList.Count; x++) + { + if (searchList[x].address == address + diff || searchList[x].address == address - diff) + weededList.Add(searchList[x]); + } + } break; case SOperator.MODULUS: //TODO