Refactoring of Watch object and related tools, add domain into Watch object. No functionality changes in this commit
This commit is contained in:
parent
0a60a37705
commit
1f454af2c3
|
@ -593,21 +593,21 @@ namespace BizHawk.MultiClient
|
|||
private Watch MakeWatch(int address)
|
||||
{
|
||||
Watch w = new Watch();
|
||||
w.address = address;
|
||||
w.bigendian = BigEndian;
|
||||
w.signed = asigned.HEX;
|
||||
w.Address = address;
|
||||
w.BigEndian = BigEndian;
|
||||
w.Signed = Watch.DISPTYPE.HEX;
|
||||
|
||||
switch (DataSize)
|
||||
{
|
||||
default:
|
||||
case 1:
|
||||
w.type = atype.BYTE;
|
||||
w.Type = Watch.TYPE.BYTE;
|
||||
break;
|
||||
case 2:
|
||||
w.type = atype.WORD;
|
||||
w.Type = Watch.TYPE.WORD;
|
||||
break;
|
||||
case 4:
|
||||
w.type = atype.DWORD;
|
||||
w.Type = Watch.TYPE.DWORD;
|
||||
break;
|
||||
}
|
||||
return w;
|
||||
|
@ -649,22 +649,22 @@ namespace BizHawk.MultiClient
|
|||
if (p >= 0)
|
||||
{
|
||||
Watch w = new Watch();
|
||||
w.address = p;
|
||||
w.value = MakeValue(p);
|
||||
w.bigendian = BigEndian;
|
||||
w.signed = asigned.HEX;
|
||||
w.Address = p;
|
||||
w.Value = MakeValue(p);
|
||||
w.BigEndian = BigEndian;
|
||||
w.Signed = Watch.DISPTYPE.HEX;
|
||||
|
||||
switch (DataSize)
|
||||
{
|
||||
default:
|
||||
case 1:
|
||||
w.type = atype.BYTE;
|
||||
w.Type = Watch.TYPE.BYTE;
|
||||
break;
|
||||
case 2:
|
||||
w.type = atype.WORD;
|
||||
w.Type = Watch.TYPE.WORD;
|
||||
break;
|
||||
case 4:
|
||||
w.type = atype.DWORD;
|
||||
w.Type = Watch.TYPE.DWORD;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,19 +32,27 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void RamPoke_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (watch.address == 0)
|
||||
if (watch.Address == 0)
|
||||
PopulateMemoryDomainComboBox();
|
||||
SetTypeRadio(watch.type);
|
||||
SetSignedRadio(watch.signed);
|
||||
if (watch.signed == asigned.HEX)
|
||||
SetTypeRadio(watch.Type);
|
||||
SetSignedRadio(watch.Signed);
|
||||
if (watch.Signed == Watch.DISPTYPE.HEX)
|
||||
{
|
||||
ValueHexLabel.Text = "0x";
|
||||
}
|
||||
else
|
||||
{
|
||||
ValueHexLabel.Text = "";
|
||||
}
|
||||
|
||||
if (watch.bigendian == true)
|
||||
if (watch.BigEndian == true)
|
||||
{
|
||||
BigEndianRadio.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LittleEndianRadio.Checked = true;
|
||||
}
|
||||
|
||||
SetValueBox();
|
||||
SetAddressBox();
|
||||
|
@ -63,15 +71,15 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (HexRadio.Checked)
|
||||
ValueBox.Text = String.Format("{0:X" +
|
||||
GetValueNumDigits() + "}", watch.value);
|
||||
GetValueNumDigits() + "}", watch.Value);
|
||||
else
|
||||
ValueBox.Text = watch.value.ToString();
|
||||
ValueBox.Text = watch.Value.ToString();
|
||||
}
|
||||
|
||||
private void SetAddressBox()
|
||||
{
|
||||
AddressBox.Text = String.Format("{0:X" +
|
||||
GetNumDigits(watch.address) + "}", watch.address);
|
||||
GetNumDigits(watch.Address) + "}", watch.Address);
|
||||
}
|
||||
|
||||
private void UpdateTitleText()
|
||||
|
@ -79,17 +87,17 @@ namespace BizHawk.MultiClient
|
|||
Text = "Ram Poke - " + domain.ToString();
|
||||
}
|
||||
|
||||
private void SetTypeRadio(atype a)
|
||||
private void SetTypeRadio(Watch.TYPE a)
|
||||
{
|
||||
switch (a)
|
||||
{
|
||||
case atype.BYTE:
|
||||
case Watch.TYPE.BYTE:
|
||||
Byte1Radio.Checked = true;
|
||||
break;
|
||||
case atype.WORD:
|
||||
case Watch.TYPE.WORD:
|
||||
Byte2Radio.Checked = true;
|
||||
break;
|
||||
case atype.DWORD:
|
||||
case Watch.TYPE.DWORD:
|
||||
Byte4Radio.Checked = true;
|
||||
break;
|
||||
default:
|
||||
|
@ -97,17 +105,17 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private void SetSignedRadio(asigned a)
|
||||
private void SetSignedRadio(Watch.DISPTYPE a)
|
||||
{
|
||||
switch (a)
|
||||
{
|
||||
case asigned.SIGNED:
|
||||
case Watch.DISPTYPE.SIGNED:
|
||||
SignedRadio.Checked = true;
|
||||
break;
|
||||
case asigned.UNSIGNED:
|
||||
case Watch.DISPTYPE.UNSIGNED:
|
||||
UnsignedRadio.Checked = true;
|
||||
break;
|
||||
case asigned.HEX:
|
||||
case Watch.DISPTYPE.HEX:
|
||||
HexRadio.Checked = true;
|
||||
break;
|
||||
default:
|
||||
|
@ -125,7 +133,7 @@ namespace BizHawk.MultiClient
|
|||
//Put user settings in the watch file
|
||||
|
||||
if (InputValidate.IsValidHexNumber(AddressBox.Text))
|
||||
watch.address = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
||||
watch.Address = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Invalid Address, must be a valid hex number", "Invalid Address", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
@ -135,25 +143,41 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
|
||||
if (SignedRadio.Checked)
|
||||
watch.signed = asigned.SIGNED;
|
||||
{
|
||||
watch.Signed = Watch.DISPTYPE.SIGNED;
|
||||
}
|
||||
else if (UnsignedRadio.Checked)
|
||||
watch.signed = asigned.UNSIGNED;
|
||||
{
|
||||
watch.Signed = Watch.DISPTYPE.UNSIGNED;
|
||||
}
|
||||
else if (HexRadio.Checked)
|
||||
watch.signed = asigned.HEX;
|
||||
{
|
||||
watch.Signed = Watch.DISPTYPE.HEX;
|
||||
}
|
||||
|
||||
if (Byte1Radio.Checked)
|
||||
watch.type = atype.BYTE;
|
||||
{
|
||||
watch.Type = Watch.TYPE.BYTE;
|
||||
}
|
||||
else if (Byte2Radio.Checked)
|
||||
watch.type = atype.WORD;
|
||||
{
|
||||
watch.Type = Watch.TYPE.WORD;
|
||||
}
|
||||
else if (Byte4Radio.Checked)
|
||||
watch.type = atype.DWORD;
|
||||
{
|
||||
watch.Type = Watch.TYPE.DWORD;
|
||||
}
|
||||
|
||||
if (BigEndianRadio.Checked)
|
||||
watch.bigendian = true;
|
||||
{
|
||||
watch.BigEndian = true;
|
||||
}
|
||||
else if (LittleEndianRadio.Checked)
|
||||
watch.bigendian = false;
|
||||
{
|
||||
watch.BigEndian = false;
|
||||
}
|
||||
|
||||
int x = GetSpecificValue();
|
||||
int x = GetSpecificValue(); //TODO: use a nullable int instead of this crap
|
||||
if (x == -99999999)
|
||||
{
|
||||
MessageBox.Show("Missing or invalid value", "Invalid Value", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
@ -162,17 +186,19 @@ namespace BizHawk.MultiClient
|
|||
return;
|
||||
}
|
||||
else
|
||||
watch.value = int.Parse(ValueBox.Text);
|
||||
{
|
||||
watch.Value = int.Parse(ValueBox.Text);
|
||||
}
|
||||
|
||||
watch.PokeAddress(domain);
|
||||
|
||||
string value;
|
||||
if (HexRadio.Checked)
|
||||
value = "0x" + String.Format("{0:X" + GetValueNumDigits() + "}", watch.value);
|
||||
value = "0x" + String.Format("{0:X" + GetValueNumDigits() + "}", watch.Value);
|
||||
else
|
||||
value = watch.value.ToString();
|
||||
value = watch.Value.ToString();
|
||||
string address = String.Format("{0:X" + GetNumDigits(domain.Size).ToString()
|
||||
+ "}", watch.address);
|
||||
+ "}", watch.Address);
|
||||
|
||||
|
||||
OutputLabel.Text = value + " written to " + address;
|
||||
|
@ -202,16 +228,24 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private asigned GetDataType()
|
||||
private Watch.DISPTYPE GetDataType()
|
||||
{
|
||||
if (SignedRadio.Checked)
|
||||
return asigned.SIGNED;
|
||||
{
|
||||
return Watch.DISPTYPE.SIGNED;
|
||||
}
|
||||
if (UnsignedRadio.Checked)
|
||||
return asigned.UNSIGNED;
|
||||
{
|
||||
return Watch.DISPTYPE.UNSIGNED;
|
||||
}
|
||||
if (HexRadio.Checked)
|
||||
return asigned.HEX;
|
||||
|
||||
return asigned.UNSIGNED; //Just in case
|
||||
{
|
||||
return Watch.DISPTYPE.HEX;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Watch.DISPTYPE.UNSIGNED; //Just in case
|
||||
}
|
||||
}
|
||||
|
||||
private void AddressBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||
|
@ -228,48 +262,62 @@ namespace BizHawk.MultiClient
|
|||
|
||||
switch (GetDataType())
|
||||
{
|
||||
case asigned.UNSIGNED:
|
||||
case Watch.DISPTYPE.UNSIGNED:
|
||||
if (!InputValidate.IsValidUnsignedNumber(e.KeyChar))
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
break;
|
||||
case asigned.SIGNED:
|
||||
case Watch.DISPTYPE.SIGNED:
|
||||
if (!InputValidate.IsValidSignedNumber(e.KeyChar))
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
break;
|
||||
case asigned.HEX:
|
||||
case Watch.DISPTYPE.HEX:
|
||||
if (!InputValidate.IsValidHexNumber(e.KeyChar))
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private atype GetDataSize()
|
||||
private Watch.TYPE GetDataSize()
|
||||
{
|
||||
if (Byte1Radio.Checked)
|
||||
return atype.BYTE;
|
||||
if (Byte2Radio.Checked)
|
||||
return atype.WORD;
|
||||
if (Byte4Radio.Checked)
|
||||
return atype.DWORD;
|
||||
|
||||
return atype.BYTE;
|
||||
{
|
||||
return Watch.TYPE.BYTE;
|
||||
}
|
||||
else if (Byte2Radio.Checked)
|
||||
{
|
||||
return Watch.TYPE.WORD;
|
||||
}
|
||||
else if (Byte4Radio.Checked)
|
||||
{
|
||||
return Watch.TYPE.DWORD;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Watch.TYPE.BYTE;
|
||||
}
|
||||
}
|
||||
|
||||
private int GetSpecificValue()
|
||||
private int GetSpecificValue() //TODO: don't use -99999999 use nullable int instead
|
||||
{
|
||||
if (ValueBox.Text == "" || ValueBox.Text == "-") return 0;
|
||||
bool i = false;
|
||||
switch (GetDataType())
|
||||
{
|
||||
case asigned.UNSIGNED:
|
||||
case Watch.DISPTYPE.UNSIGNED:
|
||||
i = InputValidate.IsValidUnsignedNumber(ValueBox.Text);
|
||||
if (!i) return -99999999;
|
||||
return (int)Int64.Parse(ValueBox.Text); //Note: 64 to be safe
|
||||
case asigned.SIGNED:
|
||||
case Watch.DISPTYPE.SIGNED:
|
||||
i = InputValidate.IsValidSignedNumber(ValueBox.Text);
|
||||
if (!i) return -99999999;
|
||||
return (int)Int64.Parse(ValueBox.Text);
|
||||
case asigned.HEX:
|
||||
case Watch.DISPTYPE.HEX:
|
||||
i = InputValidate.IsValidHexNumber(ValueBox.Text);
|
||||
if (!i) return -99999999;
|
||||
return (int)Int64.Parse(ValueBox.Text, NumberStyles.HexNumber);
|
||||
|
@ -300,15 +348,15 @@ namespace BizHawk.MultiClient
|
|||
switch (GetDataSize())
|
||||
{
|
||||
default:
|
||||
case atype.BYTE:
|
||||
case Watch.TYPE.BYTE:
|
||||
if (HexRadio.Checked) return 2;
|
||||
else if (UnsignedRadio.Checked) return 3;
|
||||
else return 4;
|
||||
case atype.WORD:
|
||||
case Watch.TYPE.WORD:
|
||||
if (HexRadio.Checked) return 4;
|
||||
else if (UnsignedRadio.Checked) return 5;
|
||||
else return 6;
|
||||
case atype.DWORD:
|
||||
case Watch.TYPE.DWORD:
|
||||
if (HexRadio.Checked) return 8;
|
||||
else if (UnsignedRadio.Checked) return 10;
|
||||
else return 11;
|
||||
|
@ -343,8 +391,8 @@ namespace BizHawk.MultiClient
|
|||
domain = Global.Emulator.MemoryDomains[DomainComboBox.SelectedIndex];
|
||||
UpdateTitleText();
|
||||
int x = GetNumDigits(domain.Size);
|
||||
watch.address = 0;
|
||||
watch.value = 0;
|
||||
watch.Address = 0;
|
||||
watch.Value = 0;
|
||||
SetAddressBox();
|
||||
SetValueBox();
|
||||
AddressBox.MaxLength = GetNumDigits(domain.Size);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -33,7 +33,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
string systemID = "NULL";
|
||||
MemoryDomain Domain = new MemoryDomain("NULL", 1, Endian.Little, addr => 0, (a, v) => { });
|
||||
List<Watch> watchList = new List<Watch>();
|
||||
List<Watch> Watches = new List<Watch>();
|
||||
string currentFile = "";
|
||||
bool changes = false;
|
||||
List<ToolStripMenuItem> domainMenuItems = new List<ToolStripMenuItem>();
|
||||
|
@ -62,15 +62,15 @@ namespace BizHawk.MultiClient
|
|||
public List<Watch> GetRamWatchList()
|
||||
{
|
||||
List<Watch> w = new List<Watch>();
|
||||
for (int x = 0; x < watchList.Count; x++)
|
||||
w.Add(new Watch(watchList[x]));
|
||||
for (int x = 0; x < Watches.Count; x++)
|
||||
w.Add(new Watch(Watches[x]));
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
public void DisplayWatchList()
|
||||
{
|
||||
WatchListView.ItemCount = watchList.Count;
|
||||
WatchListView.ItemCount = Watches.Count;
|
||||
}
|
||||
|
||||
public void UpdateValues()
|
||||
|
@ -80,17 +80,17 @@ namespace BizHawk.MultiClient
|
|||
return;
|
||||
}
|
||||
|
||||
for (int x = 0; x < watchList.Count; x++)
|
||||
for (int x = 0; x < Watches.Count; x++)
|
||||
{
|
||||
watchList[x].PeekAddress(Domain);
|
||||
Watches[x].PeekAddress(Domain);
|
||||
}
|
||||
|
||||
if (Global.Config.DisplayRamWatch)
|
||||
{
|
||||
for (int x = 0; x < watchList.Count; x++)
|
||||
for (int x = 0; x < Watches.Count; x++)
|
||||
{
|
||||
bool alert = Global.CheatList.IsActiveCheat(Domain, watchList[x].address);
|
||||
Global.OSD.AddGUIText(watchList[x].ToString(),
|
||||
bool alert = Global.CheatList.IsActiveCheat(Domain, Watches[x].Address);
|
||||
Global.OSD.AddGUIText(Watches[x].ToString(),
|
||||
Global.Config.DispRamWatchx, (Global.Config.DispRamWatchy + (x * 14)), alert, Color.Black, Color.White, 0);
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void AddWatch(Watch w)
|
||||
{
|
||||
watchList.Add(w);
|
||||
Watches.Add(w);
|
||||
Changes();
|
||||
UpdateValues();
|
||||
DisplayWatchList();
|
||||
|
@ -186,80 +186,72 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void WatchListView_QueryItemBkColor(int index, int column, ref Color color)
|
||||
{
|
||||
if (index >= watchList.Count)
|
||||
if (index >= Watches.Count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (column == 0)
|
||||
{
|
||||
if (watchList[index].type == atype.SEPARATOR)
|
||||
if (Watches[index].Type == Watch.TYPE.SEPARATOR)
|
||||
{
|
||||
color = this.BackColor;
|
||||
if (Global.CheatList.IsActiveCheat(Domain, watchList[index].address))
|
||||
}
|
||||
if (Global.CheatList.IsActiveCheat(Domain, Watches[index].Address))
|
||||
{
|
||||
color = Color.LightCyan;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WatchListView_QueryItemText(int index, int column, out string text)
|
||||
{
|
||||
text = "";
|
||||
if (index >= watchList.Count)
|
||||
|
||||
if (Watches[index].Type == Watch.TYPE.SEPARATOR || index >= Watches.Count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (column == 0) //Address
|
||||
{
|
||||
if (watchList[index].type != atype.SEPARATOR)
|
||||
{
|
||||
text = watchList[index].address.ToString(addressFormatStr);
|
||||
}
|
||||
text = Watches[index].Address.ToString(addressFormatStr);
|
||||
}
|
||||
if (column == 1) //Value
|
||||
{
|
||||
text = watchList[index].ValueToString();
|
||||
text = Watches[index].ValueString;
|
||||
}
|
||||
if (column == 2) //Prev
|
||||
{
|
||||
if (watchList[index].type != atype.SEPARATOR)
|
||||
switch(Global.Config.RamWatchPrev_Type)
|
||||
{
|
||||
switch(Global.Config.RamWatchPrev_Type)
|
||||
{
|
||||
case 1:
|
||||
text = watchList[index].PrevToString();
|
||||
break;
|
||||
case 2:
|
||||
text = watchList[index].LastChangeToString();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
text = Watches[index].PrevString;
|
||||
break;
|
||||
case 2:
|
||||
text = Watches[index].LastChangeString;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (column == 3) //Change Counts
|
||||
{
|
||||
if (watchList[index].type != atype.SEPARATOR)
|
||||
text = watchList[index].changecount.ToString();
|
||||
text = Watches[index].Changecount.ToString();
|
||||
}
|
||||
if (column == 4) //Diff
|
||||
{
|
||||
if (watchList[index].type != atype.SEPARATOR)
|
||||
switch(Global.Config.RamWatchPrev_Type)
|
||||
{
|
||||
switch(Global.Config.RamWatchPrev_Type)
|
||||
{
|
||||
case 1:
|
||||
text = watchList[index].DiffToString(watchList[index].diffPrev);
|
||||
break;
|
||||
case 2:
|
||||
text = watchList[index].DiffToString(watchList[index].diffLastChange);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
text = Watches[index].DiffToString(Watches[index].DiffPrev);
|
||||
break;
|
||||
case 2:
|
||||
text = Watches[index].DiffToString(Watches[index].DiffLastChange);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (column == 5) //Notes
|
||||
{
|
||||
if (watchList[index].type == atype.SEPARATOR)
|
||||
text = "";
|
||||
else
|
||||
text = watchList[index].notes;
|
||||
text = Watches[index].Notes;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,7 +311,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
if (result == true || suppressAsk)
|
||||
{
|
||||
watchList.Clear();
|
||||
Watches.Clear();
|
||||
DisplayWatchList();
|
||||
UpdateWatchCount();
|
||||
currentFile = "";
|
||||
|
@ -332,15 +324,15 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private bool SaveWatchFile(string path)
|
||||
{
|
||||
return WatchCommon.SaveWchFile(path, Domain.Name, watchList);
|
||||
return WatchCommon.SaveWchFile(path, Domain.Name, Watches);
|
||||
}
|
||||
|
||||
private void UpdateWatchCount()
|
||||
{
|
||||
int count = 0;
|
||||
foreach (Watch w in watchList)
|
||||
foreach (Watch w in Watches)
|
||||
{
|
||||
if (!(w.type == atype.SEPARATOR))
|
||||
if (!(w.Type == Watch.TYPE.SEPARATOR))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
@ -352,11 +344,11 @@ namespace BizHawk.MultiClient
|
|||
public bool LoadWatchFile(string path, bool append)
|
||||
{
|
||||
string domain = "";
|
||||
bool result = WatchCommon.LoadWatchFile(path, append, watchList, out domain);
|
||||
bool result = WatchCommon.LoadWatchFile(path, append, Watches, out domain);
|
||||
|
||||
if (result)
|
||||
{
|
||||
foreach (Watch w in watchList)
|
||||
foreach (Watch w in Watches)
|
||||
{
|
||||
InitializeAddress(w);
|
||||
}
|
||||
|
@ -396,7 +388,7 @@ namespace BizHawk.MultiClient
|
|||
if (r.userSelected == true)
|
||||
{
|
||||
InitializeAddress(r.watch);
|
||||
watchList.Add(r.watch);
|
||||
Watches.Add(r.watch);
|
||||
Changes();
|
||||
UpdateWatchCount();
|
||||
DisplayWatchList();
|
||||
|
@ -406,11 +398,11 @@ namespace BizHawk.MultiClient
|
|||
private void InitializeAddress(Watch w)
|
||||
{
|
||||
w.PeekAddress(Domain);
|
||||
w.prev = w.value;
|
||||
w.original = w.value;
|
||||
w.lastchange = w.value;
|
||||
w.lastsearch = w.value;
|
||||
w.changecount = 0;
|
||||
w.Prev = w.Value;
|
||||
w.Original = w.Value;
|
||||
w.LastChange = w.Value;
|
||||
w.LastSearch = w.Value;
|
||||
w.Changecount = 0;
|
||||
}
|
||||
|
||||
void Changes()
|
||||
|
@ -423,7 +415,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
RamWatchNewWatch r = new RamWatchNewWatch();
|
||||
r.location = GetPromptPoint();
|
||||
r.SetToEditWatch(watchList[pos], "Edit Watch");
|
||||
r.SetToEditWatch(Watches[pos], "Edit Watch");
|
||||
Global.Sound.StopSound();
|
||||
r.ShowDialog();
|
||||
Global.Sound.StartSound();
|
||||
|
@ -431,7 +423,7 @@ namespace BizHawk.MultiClient
|
|||
if (r.userSelected == true)
|
||||
{
|
||||
Changes();
|
||||
watchList[pos] = r.watch;
|
||||
Watches[pos] = r.watch;
|
||||
DisplayWatchList();
|
||||
}
|
||||
}
|
||||
|
@ -452,7 +444,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
foreach (int index in indexes)
|
||||
{
|
||||
watchList.Remove(watchList[indexes[0]]); //index[0] used since each iteration will make this the correct list index
|
||||
Watches.Remove(Watches[indexes[0]]); //index[0] used since each iteration will make this the correct list index
|
||||
}
|
||||
indexes.Clear();
|
||||
DisplayWatchList();
|
||||
|
@ -469,7 +461,7 @@ namespace BizHawk.MultiClient
|
|||
RamWatchNewWatch r = new RamWatchNewWatch();
|
||||
r.location = GetPromptPoint();
|
||||
int x = indexes[0];
|
||||
r.SetToEditWatch(watchList[x], "Duplicate Watch");
|
||||
r.SetToEditWatch(Watches[x], "Duplicate Watch");
|
||||
|
||||
Global.Sound.StopSound();
|
||||
r.ShowDialog();
|
||||
|
@ -479,7 +471,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
InitializeAddress(r.watch);
|
||||
Changes();
|
||||
watchList.Add(r.watch);
|
||||
Watches.Add(r.watch);
|
||||
DisplayWatchList();
|
||||
}
|
||||
}
|
||||
|
@ -498,9 +490,9 @@ namespace BizHawk.MultiClient
|
|||
if (indexes.Count == 0) return;
|
||||
foreach (int index in indexes)
|
||||
{
|
||||
temp = watchList[index];
|
||||
watchList.Remove(watchList[index]);
|
||||
watchList.Insert(index - 1, temp);
|
||||
temp = Watches[index];
|
||||
Watches.Remove(Watches[index]);
|
||||
Watches.Insert(index - 1, temp);
|
||||
|
||||
//Note: here it will get flagged many times redundantly potentially,
|
||||
//but this avoids it being flagged falsely when the user did not select an index
|
||||
|
@ -525,13 +517,13 @@ namespace BizHawk.MultiClient
|
|||
if (indexes.Count == 0) return;
|
||||
foreach (int index in indexes)
|
||||
{
|
||||
temp = watchList[index];
|
||||
temp = Watches[index];
|
||||
|
||||
if (index < watchList.Count - 1)
|
||||
if (index < Watches.Count - 1)
|
||||
{
|
||||
|
||||
watchList.Remove(watchList[index]);
|
||||
watchList.Insert(index + 1, temp);
|
||||
Watches.Remove(Watches[index]);
|
||||
Watches.Insert(index + 1, temp);
|
||||
|
||||
}
|
||||
|
||||
|
@ -754,13 +746,13 @@ namespace BizHawk.MultiClient
|
|||
|
||||
if (InputValidate.IsValidHexNumber(Str))
|
||||
{
|
||||
watchList[e.Item].address = int.Parse(Str, NumberStyles.HexNumber);
|
||||
Watches[e.Item].Address = int.Parse(Str, NumberStyles.HexNumber);
|
||||
EditWatchObject(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Invalid number!"); //TODO: More parameters and better message
|
||||
WatchListView.Items[index].Text = watchList[index].address.ToString(); //TODO: Why doesn't the list view update to the new value? It won't until something else changes
|
||||
WatchListView.Items[index].Text = Watches[index].Address.ToString(); //TODO: Why doesn't the list view update to the new value? It won't until something else changes
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -817,7 +809,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
Changes();
|
||||
Watch w = new Watch();
|
||||
w.type = atype.SEPARATOR;
|
||||
w.Type = Watch.TYPE.SEPARATOR;
|
||||
|
||||
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
|
||||
int x;
|
||||
|
@ -825,10 +817,10 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
x = indexes[0];
|
||||
if (indexes[0] > 0)
|
||||
watchList.Insert(indexes[0], w);
|
||||
Watches.Insert(indexes[0], w);
|
||||
}
|
||||
else
|
||||
watchList.Add(w);
|
||||
Watches.Add(w);
|
||||
DisplayWatchList();
|
||||
}
|
||||
|
||||
|
@ -884,7 +876,7 @@ namespace BizHawk.MultiClient
|
|||
RamPoke p = new RamPoke();
|
||||
Global.Sound.StartSound();
|
||||
if (indexes.Count > 0)
|
||||
p.SetWatchObject(watchList[indexes[0]], Domain);
|
||||
p.SetWatchObject(Watches[indexes[0]], Domain);
|
||||
p.location = GetPromptPoint();
|
||||
p.ShowDialog();
|
||||
UpdateValues();
|
||||
|
@ -979,7 +971,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
if (indexes.Count == 1)
|
||||
{
|
||||
if (Global.CheatList.IsActiveCheat(Domain, watchList[indexes[0]].address))
|
||||
if (Global.CheatList.IsActiveCheat(Domain, Watches[indexes[0]].Address))
|
||||
{
|
||||
contextMenuStrip1.Items[4].Text = "&Unfreeze address";
|
||||
contextMenuStrip1.Items[4].Image =
|
||||
|
@ -1036,8 +1028,8 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void ClearChangeCounts()
|
||||
{
|
||||
for (int x = 0; x < watchList.Count; x++)
|
||||
watchList[x].changecount = 0;
|
||||
for (int x = 0; x < Watches.Count; x++)
|
||||
Watches[x].Changecount = 0;
|
||||
DisplayWatchList();
|
||||
MessageLabel.Text = "Change counts cleared";
|
||||
}
|
||||
|
@ -1108,7 +1100,7 @@ namespace BizHawk.MultiClient
|
|||
if (indexes.Count > 0)
|
||||
{
|
||||
Global.MainForm.LoadHexEditor();
|
||||
Global.MainForm.HexEditor1.GoToAddress(watchList[indexes[0]].address);
|
||||
Global.MainForm.HexEditor1.GoToAddress(Watches[indexes[0]].Address);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1148,20 +1140,20 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
for (int i = 0; i < indexes.Count; i++)
|
||||
{
|
||||
switch (watchList[indexes[i]].type)
|
||||
switch (Watches[indexes[i]].Type)
|
||||
{
|
||||
case atype.BYTE:
|
||||
Cheat c = new Cheat("", watchList[indexes[i]].address, (byte)watchList[indexes[i]].value,
|
||||
case Watch.TYPE.BYTE:
|
||||
Cheat c = new Cheat("", Watches[indexes[i]].Address, (byte)Watches[indexes[i]].Value,
|
||||
true, Domain);
|
||||
Global.MainForm.Cheats1.AddCheat(c);
|
||||
break;
|
||||
case atype.WORD:
|
||||
case Watch.TYPE.WORD:
|
||||
{
|
||||
byte low = (byte)(watchList[indexes[i]].value / 256);
|
||||
byte high = (byte)(watchList[indexes[i]].value);
|
||||
int a1 = watchList[indexes[i]].address;
|
||||
int a2 = watchList[indexes[i]].address + 1;
|
||||
if (watchList[indexes[i]].bigendian)
|
||||
byte low = (byte)(Watches[indexes[i]].Value / 256);
|
||||
byte high = (byte)(Watches[indexes[i]].Value);
|
||||
int a1 = Watches[indexes[i]].Address;
|
||||
int a2 = Watches[indexes[i]].Address + 1;
|
||||
if (Watches[indexes[i]].BigEndian)
|
||||
{
|
||||
Cheat c1 = new Cheat("", a1, low, true, Domain);
|
||||
Cheat c2 = new Cheat("", a2, high, true, Domain);
|
||||
|
@ -1177,17 +1169,17 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
break;
|
||||
case atype.DWORD:
|
||||
case Watch.TYPE.DWORD:
|
||||
{
|
||||
byte HIWORDhigh = (byte)(watchList[indexes[i]].value / 0x1000000);
|
||||
byte HIWORDlow = (byte)(watchList[indexes[i]].value / 0x10000);
|
||||
byte LOWORDhigh = (byte)(watchList[indexes[i]].value / 0x100);
|
||||
byte LOWORDlow = (byte)(watchList[indexes[i]].value);
|
||||
int a1 = watchList[indexes[i]].address;
|
||||
int a2 = watchList[indexes[i]].address + 1;
|
||||
int a3 = watchList[indexes[i]].address + 2;
|
||||
int a4 = watchList[indexes[i]].address + 3;
|
||||
if (watchList[indexes[i]].bigendian)
|
||||
byte HIWORDhigh = (byte)(Watches[indexes[i]].Value / 0x1000000);
|
||||
byte HIWORDlow = (byte)(Watches[indexes[i]].Value / 0x10000);
|
||||
byte LOWORDhigh = (byte)(Watches[indexes[i]].Value / 0x100);
|
||||
byte LOWORDlow = (byte)(Watches[indexes[i]].Value);
|
||||
int a1 = Watches[indexes[i]].Address;
|
||||
int a2 = Watches[indexes[i]].Address + 1;
|
||||
int a3 = Watches[indexes[i]].Address + 2;
|
||||
int a4 = Watches[indexes[i]].Address + 3;
|
||||
if (Watches[indexes[i]].BigEndian)
|
||||
{
|
||||
Cheat c1 = new Cheat("", a1, HIWORDhigh, true, Domain);
|
||||
Cheat c2 = new Cheat("", a2, HIWORDlow, true, Domain);
|
||||
|
@ -1223,20 +1215,20 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
for (int i = 0; i < indexes.Count; i++)
|
||||
{
|
||||
switch (watchList[indexes[i]].type)
|
||||
switch (Watches[indexes[i]].Type)
|
||||
{
|
||||
case atype.BYTE:
|
||||
Global.CheatList.Remove(Domain, watchList[indexes[i]].address);
|
||||
case Watch.TYPE.BYTE:
|
||||
Global.CheatList.Remove(Domain, Watches[indexes[i]].Address);
|
||||
break;
|
||||
case atype.WORD:
|
||||
Global.CheatList.Remove(Domain, watchList[indexes[i]].address);
|
||||
Global.CheatList.Remove(Domain, watchList[indexes[i]].address + 1);
|
||||
case Watch.TYPE.WORD:
|
||||
Global.CheatList.Remove(Domain, Watches[indexes[i]].Address);
|
||||
Global.CheatList.Remove(Domain, Watches[indexes[i]].Address + 1);
|
||||
break;
|
||||
case atype.DWORD:
|
||||
Global.CheatList.Remove(Domain, watchList[indexes[i]].address);
|
||||
Global.CheatList.Remove(Domain, watchList[indexes[i]].address + 1);
|
||||
Global.CheatList.Remove(Domain, watchList[indexes[i]].address + 2);
|
||||
Global.CheatList.Remove(Domain, watchList[indexes[i]].address + 3);
|
||||
case Watch.TYPE.DWORD:
|
||||
Global.CheatList.Remove(Domain, Watches[indexes[i]].Address);
|
||||
Global.CheatList.Remove(Domain, Watches[indexes[i]].Address + 1);
|
||||
Global.CheatList.Remove(Domain, Watches[indexes[i]].Address + 2);
|
||||
Global.CheatList.Remove(Domain, Watches[indexes[i]].Address + 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1398,7 +1390,7 @@ namespace BizHawk.MultiClient
|
|||
string columnName = WatchListView.Columns[columnToOrder].Text;
|
||||
if (sortedCol.CompareTo(columnName) != 0)
|
||||
sortReverse = false;
|
||||
watchList.Sort((x, y) => x.CompareTo(y, columnName, Global.Config.RamWatchPrev_Type == 1 ? prevDef.LASTFRAME : prevDef.LASTCHANGE) * (sortReverse ? -1 : 1));
|
||||
Watches.Sort((x, y) => x.CompareTo(y, columnName, Global.Config.RamWatchPrev_Type == 1 ? Watch.PREVDEF.LASTFRAME : Watch.PREVDEF.LASTCHANGE) * (sortReverse ? -1 : 1));
|
||||
sortedCol = columnName;
|
||||
sortReverse = !(sortReverse);
|
||||
WatchListView.Refresh();
|
||||
|
@ -1426,7 +1418,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void SelectAll()
|
||||
{
|
||||
for (int x = 0; x < watchList.Count; x++)
|
||||
for (int x = 0; x < Watches.Count; x++)
|
||||
WatchListView.SelectItem(x, true);
|
||||
}
|
||||
|
||||
|
@ -1453,7 +1445,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
else if (e.KeyCode == Keys.A && e.Control && !e.Alt && !e.Shift) //Select All
|
||||
{
|
||||
for (int x = 0; x < watchList.Count; x++)
|
||||
for (int x = 0; x < Watches.Count; x++)
|
||||
{
|
||||
WatchListView.SelectItem(x, true);
|
||||
}
|
||||
|
|
|
@ -22,17 +22,17 @@ namespace BizHawk.MultiClient
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void SetTypeRadio(atype a)
|
||||
private void SetTypeRadio(Watch.TYPE a)
|
||||
{
|
||||
switch (a)
|
||||
{
|
||||
case atype.BYTE:
|
||||
case Watch.TYPE.BYTE:
|
||||
Byte1Radio.Checked = true;
|
||||
break;
|
||||
case atype.WORD:
|
||||
case Watch.TYPE.WORD:
|
||||
Byte2Radio.Checked = true;
|
||||
break;
|
||||
case atype.DWORD:
|
||||
case Watch.TYPE.DWORD:
|
||||
Byte4Radio.Checked = true;
|
||||
break;
|
||||
default:
|
||||
|
@ -40,17 +40,17 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private void SetSignedRadio(asigned a)
|
||||
private void SetSignedRadio(Watch.DISPTYPE a)
|
||||
{
|
||||
switch (a)
|
||||
{
|
||||
case asigned.SIGNED:
|
||||
case Watch.DISPTYPE.SIGNED:
|
||||
SignedRadio.Checked = true;
|
||||
break;
|
||||
case asigned.UNSIGNED:
|
||||
case Watch.DISPTYPE.UNSIGNED:
|
||||
UnsignedRadio.Checked = true;
|
||||
break;
|
||||
case asigned.HEX:
|
||||
case Watch.DISPTYPE.HEX:
|
||||
HexRadio.Checked = true;
|
||||
break;
|
||||
default:
|
||||
|
@ -64,13 +64,13 @@ namespace BizHawk.MultiClient
|
|||
this.Text = message;
|
||||
customSetup = true;
|
||||
|
||||
AddressBox.Text = string.Format("{0:X4}", w.address);
|
||||
NotesBox.Text = w.notes;
|
||||
AddressBox.Text = string.Format("{0:X4}", w.Address);
|
||||
NotesBox.Text = w.Notes;
|
||||
|
||||
SetTypeRadio(w.type);
|
||||
SetSignedRadio(w.signed);
|
||||
SetTypeRadio(w.Type);
|
||||
SetSignedRadio(w.Signed);
|
||||
|
||||
if (w.bigendian == true)
|
||||
if (w.BigEndian == true)
|
||||
BigEndianRadio.Checked = true;
|
||||
else
|
||||
LittleEndianRadio.Checked = true;
|
||||
|
@ -93,8 +93,8 @@ namespace BizHawk.MultiClient
|
|||
if (!customSetup)
|
||||
{
|
||||
Watch w = new Watch();
|
||||
SetTypeRadio(w.type);
|
||||
SetSignedRadio(w.signed);
|
||||
SetTypeRadio(w.Type);
|
||||
SetSignedRadio(w.Signed);
|
||||
AddressBox.Text = "0000";
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,9 @@ namespace BizHawk.MultiClient
|
|||
//Put user settings in the watch file
|
||||
userSelected = true;
|
||||
if (InputValidate.IsValidHexNumber(AddressBox.Text))
|
||||
watch.address = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
||||
{
|
||||
watch.Address = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Not a valid address (enter a valid Hex number)", "Invalid Address", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
@ -124,25 +126,41 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
|
||||
if (SignedRadio.Checked)
|
||||
watch.signed = asigned.SIGNED;
|
||||
{
|
||||
watch.Signed = Watch.DISPTYPE.SIGNED;
|
||||
}
|
||||
else if (UnsignedRadio.Checked)
|
||||
watch.signed = asigned.UNSIGNED;
|
||||
{
|
||||
watch.Signed = Watch.DISPTYPE.UNSIGNED;
|
||||
}
|
||||
else if (HexRadio.Checked)
|
||||
watch.signed = asigned.HEX;
|
||||
{
|
||||
watch.Signed = Watch.DISPTYPE.HEX;
|
||||
}
|
||||
|
||||
if (Byte1Radio.Checked)
|
||||
watch.type = atype.BYTE;
|
||||
{
|
||||
watch.Type = Watch.TYPE.BYTE;
|
||||
}
|
||||
else if (Byte2Radio.Checked)
|
||||
watch.type = atype.WORD;
|
||||
{
|
||||
watch.Type = Watch.TYPE.WORD;
|
||||
}
|
||||
else if (Byte4Radio.Checked)
|
||||
watch.type = atype.DWORD;
|
||||
{
|
||||
watch.Type = Watch.TYPE.DWORD;
|
||||
}
|
||||
|
||||
if (BigEndianRadio.Checked)
|
||||
watch.bigendian = true;
|
||||
{
|
||||
watch.BigEndian = true;
|
||||
}
|
||||
else if (LittleEndianRadio.Checked)
|
||||
watch.bigendian = false;
|
||||
{
|
||||
watch.BigEndian = false;
|
||||
}
|
||||
|
||||
watch.notes = NotesBox.Text;
|
||||
watch.Notes = NotesBox.Text;
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
|
|
@ -5,254 +5,338 @@ using System.Text;
|
|||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
public enum atype { BYTE, WORD, DWORD, SEPARATOR }; //TODO: more custom types too like 12.4 and 24.12 fixed point
|
||||
public enum asigned { SIGNED, UNSIGNED, HEX };
|
||||
public enum prevDef { LASTSEARCH, ORIGINAL, LASTFRAME, LASTCHANGE };
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// An object that represent a ram address and related properties
|
||||
/// </summary>
|
||||
public class Watch
|
||||
{
|
||||
public enum TYPE { BYTE, WORD, DWORD, SEPARATOR };
|
||||
public enum DISPTYPE { SIGNED, UNSIGNED, HEX };
|
||||
public enum PREVDEF { LASTSEARCH, ORIGINAL, LASTFRAME, LASTCHANGE };
|
||||
|
||||
#region Constructors
|
||||
|
||||
public Watch()
|
||||
{
|
||||
address = 0;
|
||||
value = 0;
|
||||
type = atype.BYTE;
|
||||
signed = asigned.UNSIGNED;
|
||||
bigendian = true;
|
||||
notes = "";
|
||||
changecount = 0;
|
||||
prev = 0;
|
||||
original = 0;
|
||||
lastchange = 0;
|
||||
lastsearch = 0;
|
||||
deleted = false;
|
||||
Address = 0;
|
||||
Value = 0;
|
||||
Type = TYPE.BYTE;
|
||||
Signed = DISPTYPE.UNSIGNED;
|
||||
BigEndian = true;
|
||||
Notes = "";
|
||||
Changecount = 0;
|
||||
Prev = 0;
|
||||
Original = 0;
|
||||
LastChange = 0;
|
||||
LastSearch = 0;
|
||||
Deleted = false;
|
||||
Domain = Global.Emulator.MainMemory;
|
||||
}
|
||||
|
||||
public Watch(Watch w)
|
||||
{
|
||||
address = w.address;
|
||||
value = w.value;
|
||||
type = w.type;
|
||||
signed = w.signed;
|
||||
bigendian = w.bigendian;
|
||||
notes = w.notes;
|
||||
changecount = w.changecount;
|
||||
prev = w.prev;
|
||||
original = w.original;
|
||||
lastchange = w.lastchange;
|
||||
lastsearch = w.lastsearch;
|
||||
deleted = w.deleted;
|
||||
Address = w.Address;
|
||||
Value = w.Value;
|
||||
Type = w.Type;
|
||||
Signed = w.Signed;
|
||||
BigEndian = w.BigEndian;
|
||||
Notes = w.Notes;
|
||||
Changecount = w.Changecount;
|
||||
Prev = w.Prev;
|
||||
Original = w.Original;
|
||||
LastChange = w.LastChange;
|
||||
LastSearch = w.LastSearch;
|
||||
Deleted = w.Deleted;
|
||||
}
|
||||
|
||||
public Watch(int Address, int Value, atype Type, asigned Signed, bool BigEndian, string Notes)
|
||||
public Watch(MemoryDomain _domain, int _address, int _value, TYPE _type, DISPTYPE _disptype, bool _bigendian, string _notes)
|
||||
{
|
||||
address = Address;
|
||||
value = Value;
|
||||
type = Type;
|
||||
signed = Signed;
|
||||
bigendian = BigEndian;
|
||||
notes = Notes;
|
||||
changecount = 0;
|
||||
prev = Value;
|
||||
original = Value;
|
||||
lastchange = Value;
|
||||
lastsearch = Value;
|
||||
Domain = _domain;
|
||||
Address = _address;
|
||||
Value = _value;
|
||||
Type = _type;
|
||||
Signed = _disptype;
|
||||
BigEndian = _bigendian;
|
||||
Notes = _notes;
|
||||
Changecount = 0;
|
||||
Prev = _value;
|
||||
Original = _value;
|
||||
LastChange = _value;
|
||||
LastSearch = _value;
|
||||
}
|
||||
public int address { get; set; }
|
||||
public int value { get; set; } //Current value
|
||||
public int prev { get; set; }
|
||||
public int original { get; set; }
|
||||
public int lastchange { get; set; }
|
||||
public int lastsearch { get; set; }
|
||||
public int diffPrev { get { return value - prev; } }
|
||||
public int diffOriginal { get { return value - original; } }
|
||||
public int diffLastChange { get { return value - lastchange; } }
|
||||
public int diffLastSearch { get { return value - lastsearch; } }
|
||||
public atype type { get; set; } //Address type (byte, word, dword, etc
|
||||
public asigned signed { get; set; } //Signed/Unsigned?
|
||||
public bool bigendian { get; set; }
|
||||
public string notes { get; set; } //User notes
|
||||
public int changecount { get; set; }
|
||||
public bool deleted { get; set; } //For weeding out addresses in things like ram search, without actually removing them from the list (in order to preview, undo, etc)
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public MemoryDomain Domain;
|
||||
public int Address;
|
||||
public int Value;
|
||||
public int Prev;
|
||||
public int Original;
|
||||
public int LastChange;
|
||||
public int LastSearch;
|
||||
public TYPE Type;
|
||||
public DISPTYPE Signed;
|
||||
public bool BigEndian;
|
||||
public string Notes;
|
||||
public int Changecount;
|
||||
public bool Deleted;
|
||||
|
||||
public int DiffPrev
|
||||
{
|
||||
get
|
||||
{
|
||||
return Value - Prev;
|
||||
}
|
||||
}
|
||||
|
||||
public int DiffOriginal
|
||||
{
|
||||
get
|
||||
{
|
||||
return Value - Original;
|
||||
}
|
||||
}
|
||||
|
||||
public int DiffLastChange
|
||||
{
|
||||
get
|
||||
{
|
||||
return Value - LastChange;
|
||||
}
|
||||
}
|
||||
|
||||
public int DiffLastSearch
|
||||
{
|
||||
get
|
||||
{
|
||||
return Value - LastSearch;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public string ValueString
|
||||
{
|
||||
get
|
||||
{
|
||||
return ValToString(Value);
|
||||
}
|
||||
}
|
||||
|
||||
public string PrevString
|
||||
{
|
||||
get
|
||||
{
|
||||
return ValToString(Prev);
|
||||
}
|
||||
}
|
||||
|
||||
public string OriginalString
|
||||
{
|
||||
get
|
||||
{
|
||||
return ValToString(Original);
|
||||
}
|
||||
}
|
||||
|
||||
public string LastChangeString
|
||||
{
|
||||
get
|
||||
{
|
||||
return ValToString(LastChange);
|
||||
}
|
||||
}
|
||||
|
||||
public string LastSearchString
|
||||
{
|
||||
get
|
||||
{
|
||||
return ValToString(LastSearch);
|
||||
}
|
||||
}
|
||||
|
||||
public string DiffPrevString
|
||||
{
|
||||
get
|
||||
{
|
||||
return DiffToString(Prev);
|
||||
}
|
||||
}
|
||||
|
||||
public string DiffOriginalString
|
||||
{
|
||||
get
|
||||
{
|
||||
return DiffToString(Original);
|
||||
}
|
||||
}
|
||||
|
||||
public string DiffLastChangeString
|
||||
{
|
||||
get
|
||||
{
|
||||
return DiffToString(LastChange);
|
||||
}
|
||||
}
|
||||
|
||||
public string DiffLastSearchString
|
||||
{
|
||||
get
|
||||
{
|
||||
return DiffToString(LastSearch);
|
||||
}
|
||||
}
|
||||
|
||||
public char TypeChar
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case TYPE.BYTE:
|
||||
return 'b';
|
||||
case TYPE.WORD:
|
||||
return 'w';
|
||||
case TYPE.DWORD:
|
||||
return 'd';
|
||||
case TYPE.SEPARATOR:
|
||||
return 'S';
|
||||
default:
|
||||
return 'b'; //Just in case
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public char SignedChar
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (Signed)
|
||||
{
|
||||
case DISPTYPE.SIGNED:
|
||||
return 's';
|
||||
case DISPTYPE.UNSIGNED:
|
||||
return 'u';
|
||||
case DISPTYPE.HEX:
|
||||
return 'h';
|
||||
default:
|
||||
return 's'; //Just in case
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public bool SetTypeByChar(char c) //b = byte, w = word, d = dword
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'b':
|
||||
type = atype.BYTE;
|
||||
Type = TYPE.BYTE;
|
||||
return true;
|
||||
case 'w':
|
||||
type = atype.WORD;
|
||||
Type = TYPE.WORD;
|
||||
return true;
|
||||
case 'd':
|
||||
type = atype.DWORD;
|
||||
Type = TYPE.DWORD;
|
||||
return true;
|
||||
case 'S':
|
||||
type = atype.SEPARATOR;
|
||||
Type = TYPE.SEPARATOR;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public char GetTypeByChar()
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case atype.BYTE:
|
||||
return 'b';
|
||||
case atype.WORD:
|
||||
return 'w';
|
||||
case atype.DWORD:
|
||||
return 'd';
|
||||
case atype.SEPARATOR:
|
||||
return 'S';
|
||||
default:
|
||||
return 'b'; //Just in case
|
||||
}
|
||||
}
|
||||
|
||||
public bool SetSignedByChar(char c) //s = signed, u = unsigned, h = hex
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 's':
|
||||
signed = asigned.SIGNED;
|
||||
Signed = DISPTYPE.SIGNED;
|
||||
return true;
|
||||
case 'u':
|
||||
signed = asigned.UNSIGNED;
|
||||
Signed = DISPTYPE.UNSIGNED;
|
||||
return true;
|
||||
case 'h':
|
||||
signed = asigned.HEX;
|
||||
Signed = DISPTYPE.HEX;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public char GetSignedByChar()
|
||||
{
|
||||
switch (signed)
|
||||
{
|
||||
case asigned.SIGNED:
|
||||
return 's';
|
||||
case asigned.UNSIGNED:
|
||||
return 'u';
|
||||
case asigned.HEX:
|
||||
return 'h';
|
||||
default:
|
||||
return 's'; //Just in case
|
||||
}
|
||||
}
|
||||
|
||||
public void PeekAddress(MemoryDomain domain)
|
||||
{
|
||||
if (type == atype.SEPARATOR)
|
||||
if (Type == TYPE.SEPARATOR)
|
||||
return;
|
||||
|
||||
prev = value;
|
||||
Prev = Value;
|
||||
|
||||
switch (type)
|
||||
switch (Type)
|
||||
{
|
||||
case atype.BYTE:
|
||||
value = domain.PeekByte(address);
|
||||
case TYPE.BYTE:
|
||||
Value = domain.PeekByte(Address);
|
||||
break;
|
||||
case atype.WORD:
|
||||
if (bigendian)
|
||||
case TYPE.WORD:
|
||||
if (BigEndian)
|
||||
{
|
||||
value = 0;
|
||||
value |= domain.PeekByte(address) << 8;
|
||||
value |= domain.PeekByte(address + 1);
|
||||
Value = 0;
|
||||
Value |= domain.PeekByte(Address) << 8;
|
||||
Value |= domain.PeekByte(Address + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = 0;
|
||||
value |= domain.PeekByte(address);
|
||||
value |= domain.PeekByte(address + 1) << 8;
|
||||
Value = 0;
|
||||
Value |= domain.PeekByte(Address);
|
||||
Value |= domain.PeekByte(Address + 1) << 8;
|
||||
}
|
||||
break;
|
||||
case atype.DWORD:
|
||||
if (bigendian)
|
||||
case TYPE.DWORD:
|
||||
if (BigEndian)
|
||||
{
|
||||
value = 0;
|
||||
value |= domain.PeekByte(address) << 24;
|
||||
value |= domain.PeekByte(address + 1) << 16;
|
||||
value |= domain.PeekByte(address + 2) << 8;
|
||||
value |= domain.PeekByte(address + 3) << 0;
|
||||
Value = 0;
|
||||
Value |= domain.PeekByte(Address) << 24;
|
||||
Value |= domain.PeekByte(Address + 1) << 16;
|
||||
Value |= domain.PeekByte(Address + 2) << 8;
|
||||
Value |= domain.PeekByte(Address + 3) << 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = 0;
|
||||
value |= domain.PeekByte(address) << 0;
|
||||
value |= domain.PeekByte(address + 1) << 8;
|
||||
value |= domain.PeekByte(address + 2) << 16;
|
||||
value |= domain.PeekByte(address + 3) << 24;
|
||||
Value = 0;
|
||||
Value |= domain.PeekByte(Address) << 0;
|
||||
Value |= domain.PeekByte(Address + 1) << 8;
|
||||
Value |= domain.PeekByte(Address + 2) << 16;
|
||||
Value |= domain.PeekByte(Address + 3) << 24;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (value != prev)
|
||||
if (Value != Prev)
|
||||
{
|
||||
lastchange = prev;
|
||||
changecount++;
|
||||
}
|
||||
}
|
||||
|
||||
private void PokeByte(MemoryDomain domain)
|
||||
{
|
||||
domain.PokeByte(address, (byte)value);
|
||||
}
|
||||
|
||||
private void PokeWord(MemoryDomain domain)
|
||||
{
|
||||
if (bigendian)
|
||||
{
|
||||
domain.PokeByte(address + 0, (byte)(value >> 8));
|
||||
domain.PokeByte(address + 1, (byte)(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
domain.PokeByte(address + 0, (byte)(value));
|
||||
domain.PokeByte(address + 1, (byte)(value >> 8));
|
||||
}
|
||||
}
|
||||
|
||||
private void PokeDWord(MemoryDomain domain)
|
||||
{
|
||||
if (bigendian)
|
||||
{
|
||||
domain.PokeByte(address + 0, (byte)(value << 24));
|
||||
domain.PokeByte(address + 1, (byte)(value << 16));
|
||||
domain.PokeByte(address + 2, (byte)(value << 8));
|
||||
domain.PokeByte(address + 3, (byte)(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
domain.PokeByte(address + 0, (byte)(value));
|
||||
domain.PokeByte(address + 1, (byte)(value << 8));
|
||||
domain.PokeByte(address + 2, (byte)(value << 16));
|
||||
domain.PokeByte(address + 3, (byte)(value << 24));
|
||||
LastChange = Prev;
|
||||
Changecount++;
|
||||
}
|
||||
}
|
||||
|
||||
public void PokeAddress(MemoryDomain domain)
|
||||
{
|
||||
if (type == atype.SEPARATOR)
|
||||
if (Type == TYPE.SEPARATOR)
|
||||
return;
|
||||
|
||||
switch (type)
|
||||
switch (Type)
|
||||
{
|
||||
case atype.BYTE:
|
||||
case TYPE.BYTE:
|
||||
PokeByte(domain);
|
||||
break;
|
||||
case atype.WORD:
|
||||
case TYPE.WORD:
|
||||
PokeWord(domain);
|
||||
break;
|
||||
case atype.DWORD:
|
||||
case TYPE.DWORD:
|
||||
PokeDWord(domain);
|
||||
break;
|
||||
}
|
||||
|
@ -260,11 +344,11 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public uint UnsignedVal(int val)
|
||||
{
|
||||
switch (type)
|
||||
switch (Type)
|
||||
{
|
||||
case atype.BYTE:
|
||||
case TYPE.BYTE:
|
||||
return (uint)(byte)val;
|
||||
case atype.WORD:
|
||||
case TYPE.WORD:
|
||||
return (uint)(ushort)val;
|
||||
}
|
||||
return (uint)val;
|
||||
|
@ -272,11 +356,11 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public int SignedVal(int val)
|
||||
{
|
||||
switch (type)
|
||||
switch (Type)
|
||||
{
|
||||
case atype.BYTE:
|
||||
case TYPE.BYTE:
|
||||
return (int)(sbyte)val;
|
||||
case atype.WORD:
|
||||
case TYPE.WORD:
|
||||
return (int)(short)val;
|
||||
}
|
||||
return val;
|
||||
|
@ -284,37 +368,41 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
if (type == atype.SEPARATOR)
|
||||
if (Type == TYPE.SEPARATOR)
|
||||
{
|
||||
return "----";
|
||||
}
|
||||
|
||||
StringBuilder str = new StringBuilder(notes);
|
||||
StringBuilder str = new StringBuilder(Notes);
|
||||
str.Append(": ");
|
||||
str.Append(ValToString(value));
|
||||
str.Append(ValToString(Value));
|
||||
return str.ToString();
|
||||
}
|
||||
|
||||
public string ValToString(int val)
|
||||
{
|
||||
if (type == atype.SEPARATOR)
|
||||
if (Type == TYPE.SEPARATOR)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (signed)
|
||||
switch (Signed)
|
||||
{
|
||||
default:
|
||||
case asigned.UNSIGNED:
|
||||
case DISPTYPE.UNSIGNED:
|
||||
return UnsignedVal(val).ToString();
|
||||
case asigned.SIGNED:
|
||||
case DISPTYPE.SIGNED:
|
||||
return SignedVal(val).ToString();
|
||||
case asigned.HEX:
|
||||
switch (type)
|
||||
case DISPTYPE.HEX:
|
||||
switch (Type)
|
||||
{
|
||||
default:
|
||||
case atype.BYTE:
|
||||
case TYPE.BYTE:
|
||||
return String.Format("{0:X2}", val);
|
||||
case atype.WORD:
|
||||
case TYPE.WORD:
|
||||
return String.Format("{0:X4}", val);
|
||||
case atype.DWORD:
|
||||
case TYPE.DWORD:
|
||||
return String.Format("{0:X8}", val);
|
||||
}
|
||||
}
|
||||
|
@ -329,88 +417,88 @@ namespace BizHawk.MultiClient
|
|||
return converted;
|
||||
}
|
||||
|
||||
public string ValueToString()
|
||||
#endregion
|
||||
|
||||
#region Helpers
|
||||
|
||||
private void PokeByte(MemoryDomain domain)
|
||||
{
|
||||
return ValToString(value);
|
||||
domain.PokeByte(Address, (byte)Value);
|
||||
}
|
||||
|
||||
public string PrevToString()
|
||||
private void PokeWord(MemoryDomain domain)
|
||||
{
|
||||
return ValToString(prev);
|
||||
if (BigEndian)
|
||||
{
|
||||
domain.PokeByte(Address + 0, (byte)(Value >> 8));
|
||||
domain.PokeByte(Address + 1, (byte)(Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
domain.PokeByte(Address + 0, (byte)(Value));
|
||||
domain.PokeByte(Address + 1, (byte)(Value >> 8));
|
||||
}
|
||||
}
|
||||
|
||||
public string OriginalToString()
|
||||
private void PokeDWord(MemoryDomain domain)
|
||||
{
|
||||
return ValToString(original);
|
||||
if (BigEndian)
|
||||
{
|
||||
domain.PokeByte(Address + 0, (byte)(Value << 24));
|
||||
domain.PokeByte(Address + 1, (byte)(Value << 16));
|
||||
domain.PokeByte(Address + 2, (byte)(Value << 8));
|
||||
domain.PokeByte(Address + 3, (byte)(Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
domain.PokeByte(Address + 0, (byte)(Value));
|
||||
domain.PokeByte(Address + 1, (byte)(Value << 8));
|
||||
domain.PokeByte(Address + 2, (byte)(Value << 16));
|
||||
domain.PokeByte(Address + 3, (byte)(Value << 24));
|
||||
}
|
||||
}
|
||||
|
||||
public string LastChangeToString()
|
||||
{
|
||||
return ValToString(lastchange);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public string LastSearchToString()
|
||||
{
|
||||
return ValToString(lastsearch);
|
||||
}
|
||||
#region Compare Methods
|
||||
|
||||
public string DiffPrevToString()
|
||||
{
|
||||
return DiffToString(prev);
|
||||
}
|
||||
|
||||
public string DiffOriginalToString()
|
||||
{
|
||||
return DiffToString(original);
|
||||
}
|
||||
|
||||
public string DiffLastChangeToString()
|
||||
{
|
||||
return DiffToString(lastchange);
|
||||
}
|
||||
|
||||
public string DiffLastSearchToString()
|
||||
{
|
||||
return DiffToString(lastsearch);
|
||||
}
|
||||
|
||||
private int ComparePrevious(Watch Other, prevDef previous)
|
||||
private int ComparePrevious(Watch Other, PREVDEF previous)
|
||||
{
|
||||
switch (previous)
|
||||
{
|
||||
case prevDef.LASTSEARCH:
|
||||
case PREVDEF.LASTSEARCH:
|
||||
return CompareLastSearch(Other);
|
||||
case prevDef.ORIGINAL:
|
||||
case PREVDEF.ORIGINAL:
|
||||
return CompareOriginal(Other);
|
||||
default:
|
||||
case prevDef.LASTFRAME:
|
||||
case PREVDEF.LASTFRAME:
|
||||
return ComparePrev(Other);
|
||||
case prevDef.LASTCHANGE:
|
||||
case PREVDEF.LASTCHANGE:
|
||||
return CompareLastChange(Other);
|
||||
}
|
||||
}
|
||||
|
||||
private int CompareDiff(Watch Other, prevDef previous)
|
||||
private int CompareDiff(Watch Other, PREVDEF previous)
|
||||
{
|
||||
switch (previous)
|
||||
{
|
||||
case prevDef.LASTSEARCH:
|
||||
case PREVDEF.LASTSEARCH:
|
||||
return CompareDiffLastSearch(Other);
|
||||
case prevDef.ORIGINAL:
|
||||
case PREVDEF.ORIGINAL:
|
||||
return CompareDiffOriginal(Other);
|
||||
default:
|
||||
case prevDef.LASTFRAME:
|
||||
case PREVDEF.LASTFRAME:
|
||||
return CompareDiffPrev(Other);
|
||||
case prevDef.LASTCHANGE:
|
||||
case PREVDEF.LASTCHANGE:
|
||||
return CompareDiffLastChange(Other);
|
||||
}
|
||||
}
|
||||
|
||||
private int CompareAddress(Watch Other)
|
||||
{
|
||||
if (this.address < Other.address)
|
||||
if (this.Address < Other.Address)
|
||||
return -1;
|
||||
else if (this.address > Other.address)
|
||||
else if (this.Address > Other.Address)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -418,18 +506,18 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private int CompareValue(Watch Other)
|
||||
{
|
||||
if (signed == asigned.SIGNED)
|
||||
if (Signed == DISPTYPE.SIGNED)
|
||||
{
|
||||
if (SignedVal(this.value) < SignedVal(Other.value))
|
||||
if (SignedVal(this.Value) < SignedVal(Other.Value))
|
||||
return -1;
|
||||
else if (SignedVal(this.value) > SignedVal(Other.value))
|
||||
else if (SignedVal(this.Value) > SignedVal(Other.Value))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
if (UnsignedVal(this.value) < UnsignedVal(Other.value))
|
||||
if (UnsignedVal(this.Value) < UnsignedVal(Other.Value))
|
||||
return -1;
|
||||
else if (UnsignedVal(this.value) > UnsignedVal(Other.value))
|
||||
else if (UnsignedVal(this.Value) > UnsignedVal(Other.Value))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -437,18 +525,18 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private int ComparePrev(Watch Other)
|
||||
{
|
||||
if (signed == asigned.SIGNED)
|
||||
if (Signed == DISPTYPE.SIGNED)
|
||||
{
|
||||
if (SignedVal(this.prev) < SignedVal(Other.prev))
|
||||
if (SignedVal(this.Prev) < SignedVal(Other.Prev))
|
||||
return -1;
|
||||
else if (SignedVal(this.prev) > SignedVal(Other.prev))
|
||||
else if (SignedVal(this.Prev) > SignedVal(Other.Prev))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
if (UnsignedVal(this.prev) < UnsignedVal(Other.prev))
|
||||
if (UnsignedVal(this.Prev) < UnsignedVal(Other.Prev))
|
||||
return -1;
|
||||
else if (UnsignedVal(this.prev) > UnsignedVal(Other.prev))
|
||||
else if (UnsignedVal(this.Prev) > UnsignedVal(Other.Prev))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -456,18 +544,18 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private int CompareOriginal(Watch Other)
|
||||
{
|
||||
if (signed == asigned.SIGNED)
|
||||
if (Signed == DISPTYPE.SIGNED)
|
||||
{
|
||||
if (SignedVal(this.original) < SignedVal(Other.original))
|
||||
if (SignedVal(this.Original) < SignedVal(Other.Original))
|
||||
return -1;
|
||||
else if (SignedVal(this.original) > SignedVal(Other.original))
|
||||
else if (SignedVal(this.Original) > SignedVal(Other.Original))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
if (UnsignedVal(this.original) < UnsignedVal(Other.original))
|
||||
if (UnsignedVal(this.Original) < UnsignedVal(Other.Original))
|
||||
return -1;
|
||||
else if (UnsignedVal(this.original) > UnsignedVal(Other.original))
|
||||
else if (UnsignedVal(this.Original) > UnsignedVal(Other.Original))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -475,18 +563,18 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private int CompareLastChange(Watch Other)
|
||||
{
|
||||
if (signed == asigned.SIGNED)
|
||||
if (Signed == DISPTYPE.SIGNED)
|
||||
{
|
||||
if (SignedVal(this.lastchange) < SignedVal(Other.lastchange))
|
||||
if (SignedVal(this.LastChange) < SignedVal(Other.LastChange))
|
||||
return -1;
|
||||
else if (SignedVal(this.lastchange) > SignedVal(Other.lastchange))
|
||||
else if (SignedVal(this.LastChange) > SignedVal(Other.LastChange))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
if (UnsignedVal(this.lastchange) < UnsignedVal(Other.lastchange))
|
||||
if (UnsignedVal(this.LastChange) < UnsignedVal(Other.LastChange))
|
||||
return -1;
|
||||
else if (UnsignedVal(this.lastchange) > UnsignedVal(Other.lastchange))
|
||||
else if (UnsignedVal(this.LastChange) > UnsignedVal(Other.LastChange))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -494,18 +582,18 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private int CompareLastSearch(Watch Other)
|
||||
{
|
||||
if (signed == asigned.SIGNED)
|
||||
if (Signed == DISPTYPE.SIGNED)
|
||||
{
|
||||
if (SignedVal(this.lastsearch) < SignedVal(Other.lastsearch))
|
||||
if (SignedVal(this.LastSearch) < SignedVal(Other.LastSearch))
|
||||
return -1;
|
||||
else if (SignedVal(this.lastsearch) > SignedVal(Other.lastsearch))
|
||||
else if (SignedVal(this.LastSearch) > SignedVal(Other.LastSearch))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
if (UnsignedVal(this.lastsearch) < UnsignedVal(Other.lastsearch))
|
||||
if (UnsignedVal(this.LastSearch) < UnsignedVal(Other.LastSearch))
|
||||
return -1;
|
||||
else if (UnsignedVal(this.lastsearch) > UnsignedVal(Other.lastsearch))
|
||||
else if (UnsignedVal(this.LastSearch) > UnsignedVal(Other.LastSearch))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -513,9 +601,9 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private int CompareDiffPrev(Watch Other)
|
||||
{
|
||||
if (this.diffPrev < Other.diffPrev)
|
||||
if (this.DiffPrev < Other.DiffPrev)
|
||||
return -1;
|
||||
else if (this.diffPrev > Other.diffPrev)
|
||||
else if (this.DiffPrev > Other.DiffPrev)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -523,9 +611,9 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private int CompareDiffOriginal(Watch Other)
|
||||
{
|
||||
if (this.diffOriginal < Other.diffOriginal)
|
||||
if (this.DiffOriginal < Other.DiffOriginal)
|
||||
return -1;
|
||||
else if (this.diffOriginal > Other.diffOriginal)
|
||||
else if (this.DiffOriginal > Other.DiffOriginal)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -533,9 +621,9 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private int CompareDiffLastChange(Watch Other)
|
||||
{
|
||||
if (this.diffLastChange < Other.diffLastChange)
|
||||
if (this.DiffLastChange < Other.DiffLastChange)
|
||||
return -1;
|
||||
else if (this.diffLastChange > Other.diffLastChange)
|
||||
else if (this.DiffLastChange > Other.DiffLastChange)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -543,9 +631,9 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private int CompareDiffLastSearch(Watch Other)
|
||||
{
|
||||
if (this.diffLastSearch < Other.diffLastSearch)
|
||||
if (this.DiffLastSearch < Other.DiffLastSearch)
|
||||
return -1;
|
||||
else if (this.diffLastSearch > Other.diffLastSearch)
|
||||
else if (this.DiffLastSearch > Other.DiffLastSearch)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -553,9 +641,9 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private int CompareChanges(Watch Other)
|
||||
{
|
||||
if (this.changecount < Other.changecount)
|
||||
if (this.Changecount < Other.Changecount)
|
||||
return -1;
|
||||
else if (this.changecount > Other.changecount)
|
||||
else if (this.Changecount > Other.Changecount)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -563,17 +651,17 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private int CompareNotes(Watch Other)
|
||||
{
|
||||
if (this.notes == null & Other.notes == null)
|
||||
if (this.Notes == null & Other.Notes == null)
|
||||
return 0;
|
||||
else if (this.notes == null)
|
||||
else if (this.Notes == null)
|
||||
return -1;
|
||||
else if (Other.notes == null)
|
||||
else if (Other.Notes == null)
|
||||
return 1;
|
||||
else
|
||||
return this.notes.CompareTo(Other.notes);
|
||||
return this.Notes.CompareTo(Other.Notes);
|
||||
}
|
||||
|
||||
public int CompareTo(Watch Other, string parameter, prevDef previous)
|
||||
public int CompareTo(Watch Other, string parameter, PREVDEF previous)
|
||||
{
|
||||
int compare = 0;
|
||||
if (parameter == "Address")
|
||||
|
@ -716,5 +804,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
return compare;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,16 +25,20 @@ namespace BizHawk.MultiClient
|
|||
|
||||
for (int x = 0; x < watchList.Count; x++)
|
||||
{
|
||||
str.Append(string.Format("{0:X4}", watchList[x].address) + "\t");
|
||||
str.Append(watchList[x].GetTypeByChar().ToString() + "\t");
|
||||
str.Append(watchList[x].GetSignedByChar().ToString() + "\t");
|
||||
str.Append(string.Format("{0:X4}", watchList[x].Address) + "\t");
|
||||
str.Append(watchList[x].TypeChar.ToString() + "\t");
|
||||
str.Append(watchList[x].SignedChar.ToString() + "\t");
|
||||
|
||||
if (watchList[x].bigendian == true)
|
||||
if (watchList[x].BigEndian == true)
|
||||
{
|
||||
str.Append("1\t");
|
||||
}
|
||||
else
|
||||
{
|
||||
str.Append("0\t");
|
||||
}
|
||||
|
||||
str.Append(watchList[x].notes + "\n");
|
||||
str.Append(watchList[x].Notes + "\n");
|
||||
}
|
||||
|
||||
sw.WriteLine(str.ToString());
|
||||
|
@ -87,7 +91,7 @@ namespace BizHawk.MultiClient
|
|||
temp = s.Substring(0, s.IndexOf('\t'));
|
||||
try
|
||||
{
|
||||
w.address = int.Parse(temp, NumberStyles.HexNumber);
|
||||
w.Address = int.Parse(temp, NumberStyles.HexNumber);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -114,11 +118,11 @@ namespace BizHawk.MultiClient
|
|||
continue;
|
||||
}
|
||||
if (y == 0)
|
||||
w.bigendian = false;
|
||||
w.BigEndian = false;
|
||||
else
|
||||
w.bigendian = true;
|
||||
w.BigEndian = true;
|
||||
|
||||
w.notes = s.Substring(2, s.Length - 2); //User notes
|
||||
w.Notes = s.Substring(2, s.Length - 2); //User notes
|
||||
|
||||
watchList.Add(w);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue