New Ram Search - Implement Difference compare to type, and some UI cleanup
This commit is contained in:
parent
7e1565f5fb
commit
69db2d4a73
|
@ -136,9 +136,10 @@
|
|||
this.LessThanOrEqualToRadio = new System.Windows.Forms.RadioButton();
|
||||
this.GreaterThanRadio = new System.Windows.Forms.RadioButton();
|
||||
this.LessThanRadio = new System.Windows.Forms.RadioButton();
|
||||
this.SpecificValueBox = new BizHawk.MultiClient.WatchValueBox();
|
||||
this.PokeAddressToolBarItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.FreezeAddressToolBarItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.DifferenceBox = new BizHawk.UnsignedIntegerBox();
|
||||
this.SpecificValueBox = new BizHawk.MultiClient.WatchValueBox();
|
||||
SearchMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
|
@ -789,6 +790,7 @@
|
|||
// CompareToBox
|
||||
//
|
||||
this.CompareToBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.CompareToBox.Controls.Add(this.DifferenceBox);
|
||||
this.CompareToBox.Controls.Add(this.DifferenceRadio);
|
||||
this.CompareToBox.Controls.Add(this.label1);
|
||||
this.CompareToBox.Controls.Add(this.NumberOfChangesBox);
|
||||
|
@ -1100,19 +1102,6 @@
|
|||
this.LessThanRadio.UseVisualStyleBackColor = true;
|
||||
this.LessThanRadio.Click += new System.EventHandler(this.LessThanRadio_Click);
|
||||
//
|
||||
// SpecificValueBox
|
||||
//
|
||||
this.SpecificValueBox.ByteSize = BizHawk.MultiClient.Watch.WatchSize.Byte;
|
||||
this.SpecificValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.SpecificValueBox.Enabled = false;
|
||||
this.SpecificValueBox.Location = new System.Drawing.Point(135, 38);
|
||||
this.SpecificValueBox.MaxLength = 2;
|
||||
this.SpecificValueBox.Name = "SpecificValueBox";
|
||||
this.SpecificValueBox.Size = new System.Drawing.Size(65, 20);
|
||||
this.SpecificValueBox.TabIndex = 24;
|
||||
this.SpecificValueBox.Type = BizHawk.MultiClient.Watch.DisplayType.Hex;
|
||||
this.SpecificValueBox.TextChanged += new System.EventHandler(this.CompareToValue_TextChanged);
|
||||
//
|
||||
// PokeAddressToolBarItem
|
||||
//
|
||||
this.PokeAddressToolBarItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
|
@ -1135,6 +1124,30 @@
|
|||
this.FreezeAddressToolBarItem.Text = "Freeze";
|
||||
this.FreezeAddressToolBarItem.Click += new System.EventHandler(this.FreezeAddressMenuItem_Click);
|
||||
//
|
||||
// DifferenceBox
|
||||
//
|
||||
this.DifferenceBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.DifferenceBox.Enabled = false;
|
||||
this.DifferenceBox.Location = new System.Drawing.Point(135, 98);
|
||||
this.DifferenceBox.MaxLength = 8;
|
||||
this.DifferenceBox.Name = "DifferenceBox";
|
||||
this.DifferenceBox.Size = new System.Drawing.Size(65, 20);
|
||||
this.DifferenceBox.TabIndex = 30;
|
||||
this.DifferenceBox.TextChanged += new System.EventHandler(this.CompareToValue_TextChanged);
|
||||
//
|
||||
// SpecificValueBox
|
||||
//
|
||||
this.SpecificValueBox.ByteSize = BizHawk.MultiClient.Watch.WatchSize.Byte;
|
||||
this.SpecificValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.SpecificValueBox.Enabled = false;
|
||||
this.SpecificValueBox.Location = new System.Drawing.Point(135, 38);
|
||||
this.SpecificValueBox.MaxLength = 2;
|
||||
this.SpecificValueBox.Name = "SpecificValueBox";
|
||||
this.SpecificValueBox.Size = new System.Drawing.Size(65, 20);
|
||||
this.SpecificValueBox.TabIndex = 24;
|
||||
this.SpecificValueBox.Type = BizHawk.MultiClient.Watch.DisplayType.Hex;
|
||||
this.SpecificValueBox.TextChanged += new System.EventHandler(this.CompareToValue_TextChanged);
|
||||
//
|
||||
// NewRamSearch
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
|
@ -1279,5 +1292,6 @@
|
|||
private System.Windows.Forms.ToolStripButton AddToRamWatchToolBarItem;
|
||||
private System.Windows.Forms.ToolStripButton PokeAddressToolBarItem;
|
||||
private System.Windows.Forms.ToolStripButton FreezeAddressToolBarItem;
|
||||
private UnsignedIntegerBox DifferenceBox;
|
||||
}
|
||||
}
|
|
@ -299,8 +299,6 @@ namespace BizHawk.MultiClient
|
|||
NumberOfChangesRadio.Enabled = false;
|
||||
NumberOfChangesBox.Enabled = false;
|
||||
NumberOfChangesBox.Text = String.Empty;
|
||||
DifferenceRadio.Enabled = false;
|
||||
DifferentByBox.Enabled = false;
|
||||
ClearChangeCountsToolBarItem.Enabled = false;
|
||||
|
||||
if (NumberOfChangesRadio.Checked || DifferenceRadio.Checked)
|
||||
|
@ -707,14 +705,17 @@ namespace BizHawk.MultiClient
|
|||
SpecificValueBox.Enabled = false;
|
||||
SpecificAddressBox.Enabled = false;
|
||||
NumberOfChangesBox.Enabled = false;
|
||||
DifferenceBox.Enabled = false;
|
||||
SetCompareTo(RamSearchEngine.Compare.Previous);
|
||||
}
|
||||
|
||||
private void SpecificValueRadio_Click(object sender, EventArgs e)
|
||||
{
|
||||
SpecificValueBox.Enabled = true;
|
||||
SpecificValueBox.Focus();
|
||||
SpecificAddressBox.Enabled = false;
|
||||
NumberOfChangesBox.Enabled = false;
|
||||
DifferenceBox.Enabled = false;
|
||||
SetCompareTo(RamSearchEngine.Compare.SpecificValue);
|
||||
}
|
||||
|
||||
|
@ -722,7 +723,9 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
SpecificValueBox.Enabled = false;
|
||||
SpecificAddressBox.Enabled = true;
|
||||
SpecificAddressBox.Focus();
|
||||
NumberOfChangesBox.Enabled = false;
|
||||
DifferenceBox.Enabled = false;
|
||||
SetCompareTo(RamSearchEngine.Compare.SpecificAddress);
|
||||
}
|
||||
|
||||
|
@ -731,6 +734,8 @@ namespace BizHawk.MultiClient
|
|||
SpecificValueBox.Enabled = false;
|
||||
SpecificAddressBox.Enabled = false;
|
||||
NumberOfChangesBox.Enabled = true;
|
||||
NumberOfChangesBox.Focus();
|
||||
DifferenceBox.Enabled = false;
|
||||
SetCompareTo(RamSearchEngine.Compare.Changes);
|
||||
}
|
||||
|
||||
|
@ -739,6 +744,8 @@ namespace BizHawk.MultiClient
|
|||
SpecificValueBox.Enabled = false;
|
||||
SpecificAddressBox.Enabled = false;
|
||||
NumberOfChangesBox.Enabled = false;
|
||||
DifferenceBox.Enabled = true;
|
||||
DifferenceBox.Focus();
|
||||
SetCompareTo(RamSearchEngine.Compare.Difference);
|
||||
}
|
||||
|
||||
|
|
|
@ -404,42 +404,42 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
case ComparisonOperator.Equal:
|
||||
_watchList = _watchList
|
||||
.Cast<IWatchDetails>()
|
||||
.Cast<IMiniWatchDetails>()
|
||||
.Where(x => x.ChangeCount == CompareValue.Value)
|
||||
.Cast<IMiniWatch>()
|
||||
.ToList();
|
||||
break;
|
||||
case ComparisonOperator.NotEqual:
|
||||
_watchList = _watchList
|
||||
.Cast<IWatchDetails>()
|
||||
.Cast<IMiniWatchDetails>()
|
||||
.Where(x => x.ChangeCount != CompareValue.Value)
|
||||
.Cast<IMiniWatch>()
|
||||
.ToList();
|
||||
break;
|
||||
case ComparisonOperator.GreaterThan:
|
||||
_watchList = _watchList
|
||||
.Cast<IWatchDetails>()
|
||||
.Cast<IMiniWatchDetails>()
|
||||
.Where(x => x.ChangeCount > CompareValue.Value)
|
||||
.Cast<IMiniWatch>()
|
||||
.ToList();
|
||||
break;
|
||||
case ComparisonOperator.GreaterThanEqual:
|
||||
_watchList = _watchList
|
||||
.Cast<IWatchDetails>()
|
||||
.Cast<IMiniWatchDetails>()
|
||||
.Where(x => x.ChangeCount >= CompareValue.Value)
|
||||
.Cast<IMiniWatch>()
|
||||
.ToList();
|
||||
break;
|
||||
case ComparisonOperator.LessThan:
|
||||
_watchList = _watchList
|
||||
.Cast<IWatchDetails>()
|
||||
.Cast<IMiniWatchDetails>()
|
||||
.Where(x => x.ChangeCount < CompareValue.Value)
|
||||
.Cast<IMiniWatch>()
|
||||
.ToList();
|
||||
break;
|
||||
case ComparisonOperator.LessThanEqual:
|
||||
_watchList = _watchList
|
||||
.Cast<IWatchDetails>()
|
||||
.Cast<IMiniWatchDetails>()
|
||||
.Where(x => x.ChangeCount <= CompareValue.Value)
|
||||
.Cast<IMiniWatch>()
|
||||
.ToList();
|
||||
|
@ -448,7 +448,7 @@ namespace BizHawk.MultiClient
|
|||
if (DifferentBy.HasValue)
|
||||
{
|
||||
_watchList = _watchList
|
||||
.Cast<IWatchDetails>()
|
||||
.Cast<IMiniWatchDetails>()
|
||||
.Where(x => (x.ChangeCount + DifferentBy.Value == CompareValue.Value) || (x.ChangeCount - DifferentBy.Value == CompareValue.Value))
|
||||
.Cast<IMiniWatch>()
|
||||
.ToList();
|
||||
|
@ -468,7 +468,44 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void CompareDifference()
|
||||
{
|
||||
|
||||
if (CompareValue.HasValue)
|
||||
{
|
||||
switch (Operator)
|
||||
{
|
||||
case ComparisonOperator.Equal:
|
||||
_watchList = _watchList.Where(x => (GetValue(x.Address) - x.Previous) == CompareValue.Value).ToList();
|
||||
break;
|
||||
case ComparisonOperator.NotEqual:
|
||||
_watchList = _watchList.Where(x => (GetValue(x.Address) - x.Previous) != CompareValue.Value).ToList();
|
||||
break;
|
||||
case ComparisonOperator.GreaterThan:
|
||||
_watchList = _watchList.Where(x => (GetValue(x.Address) - x.Previous) > CompareValue.Value).ToList();
|
||||
break;
|
||||
case ComparisonOperator.GreaterThanEqual:
|
||||
_watchList = _watchList.Where(x => (GetValue(x.Address) - x.Previous) >= CompareValue.Value).ToList();
|
||||
break;
|
||||
case ComparisonOperator.LessThan:
|
||||
_watchList = _watchList.Where(x => (GetValue(x.Address) - x.Previous) < CompareValue.Value).ToList();
|
||||
break;
|
||||
case ComparisonOperator.LessThanEqual:
|
||||
_watchList = _watchList.Where(x => (GetValue(x.Address) - x.Previous) <= CompareValue.Value).ToList();
|
||||
break;
|
||||
case ComparisonOperator.DifferentBy:
|
||||
if (DifferentBy.HasValue)
|
||||
{
|
||||
_watchList = _watchList.Where(x => (GetValue(x.Address) - x.Previous + DifferentBy.Value == CompareValue) || (GetValue(x.Address) - x.Previous - DifferentBy.Value == x.Previous)).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidCastException();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -510,6 +547,7 @@ namespace BizHawk.MultiClient
|
|||
private interface IMiniWatchDetails
|
||||
{
|
||||
int ChangeCount { get; }
|
||||
|
||||
void ClearChangeCount();
|
||||
void Update(Watch.PreviousType type, MemoryDomain domain);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue