New Ram Search - some fixes

This commit is contained in:
adelikat 2013-09-28 00:10:06 +00:00
parent 130b83d920
commit 71b654c4b4
4 changed files with 106 additions and 26 deletions

View File

@ -1122,6 +1122,10 @@ namespace BizHawk.MultiClient
private void SpecificValueRadio_Click(object sender, EventArgs e) private void SpecificValueRadio_Click(object sender, EventArgs e)
{ {
SpecificValueBox.Enabled = true; SpecificValueBox.Enabled = true;
if (String.IsNullOrWhiteSpace(SpecificValueBox.Text))
{
SpecificValueBox.Text = "0";
}
SpecificValueBox.Focus(); SpecificValueBox.Focus();
SpecificAddressBox.Enabled = false; SpecificAddressBox.Enabled = false;
NumberOfChangesBox.Enabled = false; NumberOfChangesBox.Enabled = false;
@ -1133,6 +1137,10 @@ namespace BizHawk.MultiClient
{ {
SpecificValueBox.Enabled = false; SpecificValueBox.Enabled = false;
SpecificAddressBox.Enabled = true; SpecificAddressBox.Enabled = true;
if (String.IsNullOrWhiteSpace(SpecificAddressBox.Text))
{
SpecificAddressBox.Text = "0";
}
SpecificAddressBox.Focus(); SpecificAddressBox.Focus();
NumberOfChangesBox.Enabled = false; NumberOfChangesBox.Enabled = false;
DifferenceBox.Enabled = false; DifferenceBox.Enabled = false;
@ -1144,6 +1152,10 @@ namespace BizHawk.MultiClient
SpecificValueBox.Enabled = false; SpecificValueBox.Enabled = false;
SpecificAddressBox.Enabled = false; SpecificAddressBox.Enabled = false;
NumberOfChangesBox.Enabled = true; NumberOfChangesBox.Enabled = true;
if (String.IsNullOrWhiteSpace(NumberOfChangesBox.Text))
{
NumberOfChangesBox.Text = "0";
}
NumberOfChangesBox.Focus(); NumberOfChangesBox.Focus();
DifferenceBox.Enabled = false; DifferenceBox.Enabled = false;
SetCompareTo(RamSearchEngine.Compare.Changes); SetCompareTo(RamSearchEngine.Compare.Changes);
@ -1155,6 +1167,10 @@ namespace BizHawk.MultiClient
SpecificAddressBox.Enabled = false; SpecificAddressBox.Enabled = false;
NumberOfChangesBox.Enabled = false; NumberOfChangesBox.Enabled = false;
DifferenceBox.Enabled = true; DifferenceBox.Enabled = true;
if (String.IsNullOrWhiteSpace(DifferenceBox.Text))
{
DifferenceBox.Text = "0";
}
DifferenceBox.Focus(); DifferenceBox.Focus();
SetCompareTo(RamSearchEngine.Compare.Difference); SetCompareTo(RamSearchEngine.Compare.Difference);
} }

View File

@ -618,11 +618,14 @@ namespace BizHawk.MultiClient
{ {
default: default:
case Watch.WatchSize.Byte: case Watch.WatchSize.Byte:
return _settings.Domain.PeekByte(addr); var theByte = _settings.Domain.PeekByte(addr);
return theByte;
case Watch.WatchSize.Word: case Watch.WatchSize.Word:
return _settings.Domain.PeekWord(addr, _settings.BigEndian ? Endian.Big : Endian.Little); var theWord = _settings.Domain.PeekWord(addr, _settings.BigEndian ? Endian.Big : Endian.Little);
return theWord;
case Watch.WatchSize.DWord: case Watch.WatchSize.DWord:
return (int)_settings.Domain.PeekDWord(addr, _settings.BigEndian ? Endian.Big : Endian.Little); var theDWord = _settings.Domain.PeekDWord(addr, _settings.BigEndian ? Endian.Big : Endian.Little);
return (int)theDWord;
} }
} }

View File

@ -177,23 +177,39 @@ namespace BizHawk.MultiClient
{ {
if (e.KeyCode == Keys.Up) if (e.KeyCode == Keys.Up)
{ {
//if (InputValidate.IsValidHexNumber(Text)) int val = ToInt();
//{ val++;
// int val = ToInt();
// val++; switch (_type)
// string formatstr = "{0:X" + MaxLength.ToString() + "}"; {
// Text = String.Format(formatstr, val); default:
//} Text = val.ToString();
break;
case Watch.DisplayType.Binary:
throw new NotImplementedException();
case Watch.DisplayType.Hex:
string formatstr = "{0:X" + MaxLength.ToString() + "}";
Text = String.Format(formatstr, val);
break;
}
} }
else if (e.KeyCode == Keys.Down) else if (e.KeyCode == Keys.Down)
{ {
//if (InputValidate.IsValidHexNumber(Text)) int val = ToInt();
//{ val--;
// int val = ToInt();
// val--; switch (_type)
// string formatstr = "{0:X" + MaxLength.ToString() + "}"; {
// Text = String.Format(formatstr, val); default:
//} Text = val.ToString();
break;
case Watch.DisplayType.Binary:
throw new NotImplementedException();
case Watch.DisplayType.Hex:
string formatstr = "{0:X" + MaxLength.ToString() + "}";
Text = String.Format(formatstr, val);
break;
}
} }
else else
{ {
@ -201,16 +217,31 @@ namespace BizHawk.MultiClient
} }
} }
protected override void OnTextChanged(EventArgs e)
{
if (String.IsNullOrWhiteSpace(Text))
{
Text = "0";
}
}
public int ToInt() public int ToInt()
{ {
switch (_type) if (String.IsNullOrWhiteSpace(Text))
{ {
default: return 0;
return int.Parse(Text); }
case Watch.DisplayType.Binary: else
return Convert.ToInt32(Text, 2); {
case Watch.DisplayType.Hex: switch (_type)
return int.Parse(Text, NumberStyles.HexNumber); {
default:
return int.Parse(Text);
case Watch.DisplayType.Binary:
return Convert.ToInt32(Text, 2);
case Watch.DisplayType.Hex:
return int.Parse(Text, NumberStyles.HexNumber);
}
} }
} }
} }

View File

@ -56,9 +56,24 @@ namespace BizHawk
} }
} }
protected override void OnTextChanged(EventArgs e)
{
if (String.IsNullOrWhiteSpace(Text))
{
Text = "0";
}
}
public int ToInt() public int ToInt()
{ {
return int.Parse(Text, NumberStyles.HexNumber); if (String.IsNullOrWhiteSpace(Text))
{
return 0;
}
else
{
return int.Parse(Text, NumberStyles.HexNumber);
}
} }
} }
@ -107,9 +122,24 @@ namespace BizHawk
} }
} }
protected override void OnTextChanged(EventArgs e)
{
if (String.IsNullOrWhiteSpace(Text))
{
Text = "0";
}
}
public int ToInt() public int ToInt()
{ {
return int.Parse(Text); if (String.IsNullOrWhiteSpace(Text))
{
return 0;
}
else
{
return int.Parse(Text);
}
} }
} }
} }