Ram Search - Searching based on Equal to Address implemented

This commit is contained in:
andres.delikat 2011-02-20 20:05:48 +00:00
parent aabc34c6c9
commit 86f3538800
3 changed files with 77 additions and 8 deletions

View File

@ -95,6 +95,7 @@
this.LessThanRadio = new System.Windows.Forms.RadioButton();
this.AutoSearchCheckBox = new System.Windows.Forms.CheckBox();
this.MemDomainLabel = new System.Windows.Forms.Label();
this.OutputLabel = new System.Windows.Forms.Label();
this.SearchtoolStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
@ -213,7 +214,7 @@
this.SearchListView.Location = new System.Drawing.Point(9, 58);
this.SearchListView.Name = "SearchListView";
this.SearchListView.selectedItem = -1;
this.SearchListView.Size = new System.Drawing.Size(223, 391);
this.SearchListView.Size = new System.Drawing.Size(223, 365);
this.SearchListView.TabIndex = 3;
this.SearchListView.UseCompatibleStateImageBehavior = false;
this.SearchListView.View = System.Windows.Forms.View.Details;
@ -434,6 +435,7 @@
this.byteToolStripMenuItem,
this.bytesToolStripMenuItem,
this.bytesToolStripMenuItem1});
this.DataSizetoolStripSplitButton1.Enabled = false;
this.DataSizetoolStripSplitButton1.Image = ((System.Drawing.Image)(resources.GetObject("DataSizetoolStripSplitButton1.Image")));
this.DataSizetoolStripSplitButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.DataSizetoolStripSplitButton1.Name = "DataSizetoolStripSplitButton1";
@ -760,11 +762,21 @@
this.MemDomainLabel.TabIndex = 8;
this.MemDomainLabel.Text = "Main Memory";
//
// OutputLabel
//
this.OutputLabel.AutoSize = true;
this.OutputLabel.Location = new System.Drawing.Point(9, 436);
this.OutputLabel.Name = "OutputLabel";
this.OutputLabel.Size = new System.Drawing.Size(85, 13);
this.OutputLabel.TabIndex = 9;
this.OutputLabel.Text = " ";
//
// RamSearch
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(472, 461);
this.Controls.Add(this.OutputLabel);
this.Controls.Add(this.MemDomainLabel);
this.Controls.Add(this.AutoSearchCheckBox);
this.Controls.Add(this.ComparisonBox);
@ -869,5 +881,6 @@
private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.Label MemDomainLabel;
private System.Windows.Forms.Label OutputLabel;
}
}

View File

@ -6,6 +6,8 @@ using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Globalization;
namespace BizHawk.MultiClient
{
@ -20,7 +22,7 @@ namespace BizHawk.MultiClient
string systemID = "NULL";
List<Watch> searchList = new List<Watch>();
List<Watch> undoList = new List<Watch>();
List<Watch> newSearchList = new List<Watch>(); //When addresses are weeded out, the new list goes here, before going into searchList
List<Watch> weedOutList = new List<Watch>(); //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 };
@ -381,9 +383,21 @@ namespace BizHawk.MultiClient
DoUndo();
}
private void ReplaceSearchListWithWeedOutList()
{
//TODO: if weedoutlist = 0, prompt user then reset search? Think about this
searchList = new List<Watch>(weedOutList);
weedOutList.Clear();
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
GenerateNewSearchList();
GenerateWeedOutList();
SaveUndo();
OutputLabel.Text = (searchList.Count - weedOutList.Count).ToString() + " addresses removed"; //TODO: address if only 1
ReplaceSearchListWithWeedOutList();
DisplaySearchList();
}
/// <summary>
@ -427,7 +441,7 @@ namespace BizHawk.MultiClient
return SOperator.LESS; //Just in case
}
private void GenerateNewSearchList()
private void GenerateWeedOutList()
{
//Switch based on user criteria
//Generate search list
@ -459,14 +473,56 @@ namespace BizHawk.MultiClient
}
private int GetSpecificAddress()
{
bool i = InputValidate.IsValidHexNumber(SpecificAddressBox.Text);
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;
}
private void DoSpecificAddress()
{
int address = GetSpecificAddress();
if (address < 0)
{
MessageBox.Show("Missing or invalid address", "Invalid address", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
switch (GetOperator())
{
case SOperator.LESS:
break;
case SOperator.GREATER:
break;
case SOperator.LESSEQUAL:
break;
case SOperator.GREATEREQUAL:
break;
case SOperator.EQUAL:
for (int x = 0; x < searchList.Count; x++)
{
if (searchList[x].address == address)
weedOutList.Add(searchList[x]);
}
break;
case SOperator.NOTEQUAL:
break;
case SOperator.DIFFBY:
break;
case SOperator.MODULUS:
break;
}
}
private void DoNumberOfChanges()
{
}
private void signedToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -171,6 +171,9 @@
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>259, 17</value>
</metadata>
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>358, 17</value>
</metadata>
<data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@ -202,9 +205,6 @@
s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC
</value>
</data>
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>358, 17</value>
</metadata>
<data name="DataSizetoolStripSplitButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8