Ram Watch - add/edit watch - support 32 bit domains

This commit is contained in:
adelikat 2015-01-18 19:50:31 +00:00
parent ac4e197e22
commit f647f16592
2 changed files with 22 additions and 2 deletions

View File

@ -137,6 +137,26 @@ namespace BizHawk.Client.EmuHawk
{
Text = val.HasValue ? string.Format(_addressFormatStr, val) : string.Empty;
}
public void SetFromLong(long val)
{
Text = string.Format(_addressFormatStr, val);
}
public long? ToLong()
{
if (string.IsNullOrWhiteSpace(Text))
{
if (Nullable)
{
return null;
}
return 0;
}
return long.Parse(Text, NumberStyles.HexNumber);
}
}
public class UnsignedIntegerBox : TextBox, INumberBox

View File

@ -84,7 +84,7 @@ namespace BizHawk.Client.EmuHawk
else
{
NotesBox.Text = _watchList[0].Notes;
AddressBox.SetFromRawInt((int)(_watchList[0].Address ?? 0)); // int to long todo
AddressBox.SetFromLong(_watchList[0].Address ?? 0);
}
SetBigEndianCheckBox();
@ -213,7 +213,7 @@ namespace BizHawk.Client.EmuHawk
default:
case Mode.New:
var domain = MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString());
var address = AddressBox.ToRawInt() ?? 0;
var address = AddressBox.ToLong() ?? 0;
var notes = NotesBox.Text;
var type = Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString());
var bigendian = BigEndianCheckBox.Checked;