Refactor the Watch object to remove the notion of detailed vs fast. The original intent of this distinction was for ram search, but ram search internally does not use the Watch object.
This commit is contained in:
parent
9a32145f82
commit
9b6738b6b5
|
@ -731,7 +731,7 @@ namespace BizHawk.MultiClient
|
||||||
var Watches = new List<Watch>();
|
var Watches = new List<Watch>();
|
||||||
foreach (var address in addresses)
|
foreach (var address in addresses)
|
||||||
{
|
{
|
||||||
Watch w = Watch.GenerateWatch(Domain, address, (Watch.WatchSize)DataSize, false);
|
Watch w = Watch.GenerateWatch(Domain, address, (Watch.WatchSize)DataSize);
|
||||||
w.Type = Watch.DisplayType.Hex;
|
w.Type = Watch.DisplayType.Hex;
|
||||||
|
|
||||||
Watches.Add(w);
|
Watches.Add(w);
|
||||||
|
|
|
@ -132,16 +132,10 @@ namespace BizHawk.MultiClient
|
||||||
text = Searches[index].PreviousStr;
|
text = Searches[index].PreviousStr;
|
||||||
break;
|
break;
|
||||||
case CHANGES:
|
case CHANGES:
|
||||||
if (Searches[index] is IWatchDetails)
|
text = Searches[index].ChangeCount.ToString();
|
||||||
{
|
|
||||||
text = (Searches[index] as IWatchDetails).ChangeCount.ToString();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case DIFF:
|
case DIFF:
|
||||||
if (Searches[index] is IWatchDetails)
|
text = Searches[index].Diff;
|
||||||
{
|
|
||||||
text = (Searches[index] as IWatchDetails).Diff;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -492,7 +486,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
|
|
||||||
WatchList watches = new WatchList(Settings.Domain);
|
WatchList watches = new WatchList(Settings.Domain);
|
||||||
watches.Load(file.FullName, false, append);
|
watches.Load(file.FullName, append);
|
||||||
List<int> addresses = watches.Where(x => !x.IsSeparator).Select(x => x.Address.Value).ToList();
|
List<int> addresses = watches.Where(x => !x.IsSeparator).Select(x => x.Address.Value).ToList();
|
||||||
|
|
||||||
if (truncate)
|
if (truncate)
|
||||||
|
@ -613,9 +607,9 @@ namespace BizHawk.MultiClient
|
||||||
case PREV:
|
case PREV:
|
||||||
return Searches[index].PreviousStr;
|
return Searches[index].PreviousStr;
|
||||||
case CHANGES:
|
case CHANGES:
|
||||||
return (Searches[index] as IWatchDetails).ChangeCount.ToString();
|
return Searches[index].ChangeCount.ToString();
|
||||||
case DIFF:
|
case DIFF:
|
||||||
return (Searches[index] as IWatchDetails).Diff;
|
return Searches[index].Diff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
Watches.Load(file.FullName, true, append);
|
Watches.Load(file.FullName, append);
|
||||||
DisplayWatches();
|
DisplayWatches();
|
||||||
UpdateMessageLabel();
|
UpdateMessageLabel();
|
||||||
UpdateWatchCount();
|
UpdateWatchCount();
|
||||||
|
@ -298,25 +298,19 @@ namespace BizHawk.MultiClient
|
||||||
text = Watches[index].PreviousStr;
|
text = Watches[index].PreviousStr;
|
||||||
break;
|
break;
|
||||||
case CHANGES:
|
case CHANGES:
|
||||||
if (Watches[index] is IWatchDetails)
|
if (!Watches[index].IsSeparator)
|
||||||
{
|
{
|
||||||
text = (Watches[index] as IWatchDetails).ChangeCount.ToString();
|
text = Watches[index].ChangeCount.ToString();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DIFF:
|
case DIFF:
|
||||||
if (Watches[index] is IWatchDetails)
|
text = Watches[index].Diff;
|
||||||
{
|
|
||||||
text = (Watches[index] as IWatchDetails).Diff;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case DOMAIN:
|
case DOMAIN:
|
||||||
text = Watches[index].Domain.Name;
|
text = Watches[index].Domain.Name;
|
||||||
break;
|
break;
|
||||||
case NOTES:
|
case NOTES:
|
||||||
if (Watches[index] is IWatchDetails)
|
text = Watches[index].Notes;
|
||||||
{
|
|
||||||
text = (Watches[index] as IWatchDetails).Notes;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,7 +359,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
if (ask_result)
|
if (ask_result)
|
||||||
{
|
{
|
||||||
bool load_result = Watches.Load(path, details: true, append: false);
|
bool load_result = Watches.Load(path, append: false);
|
||||||
if (!load_result)
|
if (!load_result)
|
||||||
{
|
{
|
||||||
Global.Config.RecentWatches.HandleLoadError(path);
|
Global.Config.RecentWatches.HandleLoadError(path);
|
||||||
|
@ -717,13 +711,13 @@ namespace BizHawk.MultiClient
|
||||||
case PREV:
|
case PREV:
|
||||||
return Watches[index].PreviousStr;
|
return Watches[index].PreviousStr;
|
||||||
case CHANGES:
|
case CHANGES:
|
||||||
return (Watches[index] as IWatchDetails).ChangeCount.ToString();
|
return Watches[index].ChangeCount.ToString();
|
||||||
case DIFF:
|
case DIFF:
|
||||||
return (Watches[index] as IWatchDetails).Diff;
|
return Watches[index].Diff;
|
||||||
case DOMAIN:
|
case DOMAIN:
|
||||||
return Watches[index].Domain.Name;
|
return Watches[index].Domain.Name;
|
||||||
case NOTES:
|
case NOTES:
|
||||||
return (Watches[index] as IWatchDetails).Notes;
|
return Watches[index].Notes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,7 +782,7 @@ namespace BizHawk.MultiClient
|
||||||
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
if (Path.GetExtension(filePaths[0]) == (".wch"))
|
if (Path.GetExtension(filePaths[0]) == (".wch"))
|
||||||
{
|
{
|
||||||
Watches.Load(filePaths[0], true, false);
|
Watches.Load(filePaths[0], append:false);
|
||||||
DisplayWatches();
|
DisplayWatches();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,8 @@ namespace BizHawk.MultiClient
|
||||||
protected MemoryDomain _domain;
|
protected MemoryDomain _domain;
|
||||||
protected DisplayType _type;
|
protected DisplayType _type;
|
||||||
protected bool _bigEndian;
|
protected bool _bigEndian;
|
||||||
|
protected int _changecount;
|
||||||
|
protected string _notes = String.Empty;
|
||||||
|
|
||||||
public abstract int? Value { get; }
|
public abstract int? Value { get; }
|
||||||
public abstract string ValueString { get; }
|
public abstract string ValueString { get; }
|
||||||
|
@ -193,7 +195,12 @@ namespace BizHawk.MultiClient
|
||||||
_domain.PokeDWord(_address, val, _bigEndian ? Endian.Big : Endian.Little);
|
_domain.PokeDWord(_address, val, _bigEndian ? Endian.Big : Endian.Little);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Watch GenerateWatch(MemoryDomain domain, int address, WatchSize size, bool details)
|
public void ClearChangeCount() { _changecount = 0; }
|
||||||
|
|
||||||
|
public string Notes { get { return _notes; } set { _notes = value; } }
|
||||||
|
|
||||||
|
//TODO: delete me
|
||||||
|
public static Watch GenerateWatch(MemoryDomain domain, int address, WatchSize size)
|
||||||
{
|
{
|
||||||
switch (size)
|
switch (size)
|
||||||
{
|
{
|
||||||
|
@ -201,32 +208,11 @@ namespace BizHawk.MultiClient
|
||||||
case WatchSize.Separator:
|
case WatchSize.Separator:
|
||||||
return new SeparatorWatch();
|
return new SeparatorWatch();
|
||||||
case WatchSize.Byte:
|
case WatchSize.Byte:
|
||||||
if (details)
|
return new ByteWatch(domain, address);
|
||||||
{
|
|
||||||
return new DetailedByteWatch(domain, address);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new ByteWatch(domain, address);
|
|
||||||
}
|
|
||||||
case WatchSize.Word:
|
case WatchSize.Word:
|
||||||
if (details)
|
return new WordWatch(domain, address);
|
||||||
{
|
|
||||||
return new DetailedWordWatch(domain, address);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new WordWatch(domain, address);
|
|
||||||
}
|
|
||||||
case WatchSize.DWord:
|
case WatchSize.DWord:
|
||||||
if (details)
|
return new DWordWatch(domain, address);
|
||||||
{
|
|
||||||
return new DetailedDWordWatch(domain, address);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new DWordWatch(domain, address);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,11 +224,11 @@ namespace BizHawk.MultiClient
|
||||||
case WatchSize.Separator:
|
case WatchSize.Separator:
|
||||||
return new SeparatorWatch();
|
return new SeparatorWatch();
|
||||||
case WatchSize.Byte:
|
case WatchSize.Byte:
|
||||||
return new DetailedByteWatch(domain, address, type, bigendian, (byte)prev, changecount);
|
return new ByteWatch(domain, address, type, bigendian, (byte)prev, changecount);
|
||||||
case WatchSize.Word:
|
case WatchSize.Word:
|
||||||
return new DetailedWordWatch(domain, address, type, bigendian, (ushort)prev, changecount);
|
return new WordWatch(domain, address, type, bigendian, (ushort)prev, changecount);
|
||||||
case WatchSize.DWord:
|
case WatchSize.DWord:
|
||||||
return new DetailedDWordWatch(domain, address, type, bigendian, (uint)prev, changecount);
|
return new DWordWatch(domain, address, type, bigendian, (uint)prev, changecount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,18 +247,15 @@ namespace BizHawk.MultiClient
|
||||||
return DWordWatch.ValidTypes;
|
return DWordWatch.ValidTypes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int ChangeCount { get { return _changecount; } }
|
||||||
|
|
||||||
|
public abstract string Diff { get; }
|
||||||
|
|
||||||
|
public abstract void Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IWatchDetails
|
public sealed class SeparatorWatch : Watch
|
||||||
{
|
|
||||||
int ChangeCount { get; }
|
|
||||||
void ClearChangeCount();
|
|
||||||
string Diff { get; }
|
|
||||||
string Notes { get; set; }
|
|
||||||
void Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class SeparatorWatch : Watch
|
|
||||||
{
|
{
|
||||||
public static SeparatorWatch Instance
|
public static SeparatorWatch Instance
|
||||||
{
|
{
|
||||||
|
@ -343,17 +326,32 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string Diff { get { return String.Empty; } }
|
||||||
|
|
||||||
|
public override void Update() { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ByteWatch : Watch
|
public sealed class ByteWatch : Watch
|
||||||
{
|
{
|
||||||
protected byte _previous;
|
private byte _previous;
|
||||||
|
private byte _value;
|
||||||
|
|
||||||
public ByteWatch(MemoryDomain domain, int address)
|
public ByteWatch(MemoryDomain domain, int address)
|
||||||
{
|
{
|
||||||
_address = address;
|
_address = address;
|
||||||
_domain = domain;
|
_domain = domain;
|
||||||
_previous = GetByte();
|
_value = _previous = GetByte();
|
||||||
|
Notes = String.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ByteWatch(MemoryDomain domain, int address, DisplayType type, bool bigEndian, byte prev, int changeCount)
|
||||||
|
: this(domain, address)
|
||||||
|
{
|
||||||
|
_previous = prev;
|
||||||
|
_changecount = changeCount;
|
||||||
|
_type = type;
|
||||||
|
_bigEndian = bigEndian;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int? Address
|
public override int? Address
|
||||||
|
@ -388,7 +386,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return AddressString + ": " + ValueString;
|
return Notes + ": " + ValueString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsSeparator
|
public override bool IsSeparator
|
||||||
|
@ -412,7 +410,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected string FormatValue(byte val)
|
private string FormatValue(byte val)
|
||||||
{
|
{
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
|
@ -485,37 +483,8 @@ namespace BizHawk.MultiClient
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class DetailedByteWatch : ByteWatch, IWatchDetails
|
public override string Diff
|
||||||
{
|
|
||||||
private byte _value;
|
|
||||||
|
|
||||||
public DetailedByteWatch(MemoryDomain domain, int address)
|
|
||||||
: base(domain, address)
|
|
||||||
{
|
|
||||||
Notes = String.Empty;
|
|
||||||
_value = GetByte();
|
|
||||||
}
|
|
||||||
|
|
||||||
public DetailedByteWatch(MemoryDomain domain, int address, DisplayType type, bool bigEndian, byte prev, int changeCount)
|
|
||||||
: this(domain, address)
|
|
||||||
{
|
|
||||||
_previous = prev;
|
|
||||||
ChangeCount = changeCount;
|
|
||||||
_type = type;
|
|
||||||
_bigEndian = bigEndian;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Notes + ": " + ValueString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int ChangeCount { get; private set; }
|
|
||||||
public void ClearChangeCount() { ChangeCount = 0; }
|
|
||||||
|
|
||||||
public string Diff
|
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -533,23 +502,19 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Notes { get; set; }
|
public override void Update()
|
||||||
|
|
||||||
public void Update()
|
|
||||||
{
|
{
|
||||||
switch (Global.Config.RamWatchDefinePrevious)
|
switch (Global.Config.RamWatchDefinePrevious)
|
||||||
{
|
{
|
||||||
case PreviousType.LastSearch: //TODO
|
|
||||||
case PreviousType.Original:
|
case PreviousType.Original:
|
||||||
/*Do Nothing*/
|
return;
|
||||||
break;
|
|
||||||
case PreviousType.LastChange:
|
case PreviousType.LastChange:
|
||||||
var temp = _value;
|
var temp = _value;
|
||||||
_value = GetByte();
|
_value = GetByte();
|
||||||
if (_value != temp)
|
if (_value != temp)
|
||||||
{
|
{
|
||||||
_previous = _value;
|
_previous = _value;
|
||||||
ChangeCount++;
|
_changecount++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PreviousType.LastFrame:
|
case PreviousType.LastFrame:
|
||||||
|
@ -557,22 +522,33 @@ namespace BizHawk.MultiClient
|
||||||
_value = GetByte();
|
_value = GetByte();
|
||||||
if (_value != Previous)
|
if (_value != Previous)
|
||||||
{
|
{
|
||||||
ChangeCount++;
|
_changecount++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WordWatch : Watch
|
public sealed class WordWatch : Watch
|
||||||
{
|
{
|
||||||
protected ushort _previous;
|
private ushort _previous;
|
||||||
|
private ushort _value;
|
||||||
|
|
||||||
public WordWatch(MemoryDomain domain, int address)
|
public WordWatch(MemoryDomain domain, int address)
|
||||||
{
|
{
|
||||||
_domain = domain;
|
_domain = domain;
|
||||||
_address = address;
|
_address = address;
|
||||||
_previous = GetWord();
|
_value = _previous = GetWord();
|
||||||
|
Notes = String.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WordWatch(MemoryDomain domain, int address, DisplayType type, bool bigEndian, ushort prev, int changeCount)
|
||||||
|
: this(domain, address)
|
||||||
|
{
|
||||||
|
_previous = prev;
|
||||||
|
_changecount = changeCount;
|
||||||
|
_type = type;
|
||||||
|
_bigEndian = bigEndian;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int? Value
|
public override int? Value
|
||||||
|
@ -618,10 +594,10 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return AddressString + ": " + ValueString;
|
return Notes + ": " + ValueString;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected string FormatValue(ushort val)
|
private string FormatValue(ushort val)
|
||||||
{
|
{
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
|
@ -704,51 +680,18 @@ namespace BizHawk.MultiClient
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class DetailedWordWatch : WordWatch, IWatchDetails
|
public override string Diff
|
||||||
{
|
|
||||||
private ushort _value;
|
|
||||||
|
|
||||||
public DetailedWordWatch(MemoryDomain domain, int address)
|
|
||||||
: base(domain, address)
|
|
||||||
{
|
|
||||||
Notes = String.Empty;
|
|
||||||
_value = GetWord();
|
|
||||||
}
|
|
||||||
|
|
||||||
public DetailedWordWatch(MemoryDomain domain, int address, DisplayType type, bool bigEndian, ushort prev, int changeCount)
|
|
||||||
: this(domain, address)
|
|
||||||
{
|
|
||||||
_previous = prev;
|
|
||||||
ChangeCount = changeCount;
|
|
||||||
_type = type;
|
|
||||||
_bigEndian = bigEndian;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Notes + ": " + ValueString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int ChangeCount { get; private set; }
|
|
||||||
public void ClearChangeCount() { ChangeCount = 0; }
|
|
||||||
|
|
||||||
public string Diff
|
|
||||||
{
|
{
|
||||||
get { return FormatValue((ushort)(_previous - _value)); }
|
get { return FormatValue((ushort)(_previous - _value)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Notes { get; set; }
|
public override void Update()
|
||||||
|
|
||||||
public void Update()
|
|
||||||
{
|
{
|
||||||
switch (Global.Config.RamWatchDefinePrevious)
|
switch (Global.Config.RamWatchDefinePrevious)
|
||||||
{
|
{
|
||||||
case PreviousType.LastSearch: //TODO
|
|
||||||
case PreviousType.Original:
|
case PreviousType.Original:
|
||||||
/*Do Nothing*/
|
return;
|
||||||
break;
|
|
||||||
case PreviousType.LastChange:
|
case PreviousType.LastChange:
|
||||||
var temp = _value;
|
var temp = _value;
|
||||||
_value = GetWord();
|
_value = GetWord();
|
||||||
|
@ -756,7 +699,7 @@ namespace BizHawk.MultiClient
|
||||||
if (_value != temp)
|
if (_value != temp)
|
||||||
{
|
{
|
||||||
_previous = temp;
|
_previous = temp;
|
||||||
ChangeCount++;
|
_changecount++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PreviousType.LastFrame:
|
case PreviousType.LastFrame:
|
||||||
|
@ -764,22 +707,33 @@ namespace BizHawk.MultiClient
|
||||||
_value = GetWord();
|
_value = GetWord();
|
||||||
if (_value != Previous)
|
if (_value != Previous)
|
||||||
{
|
{
|
||||||
ChangeCount++;
|
_changecount++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DWordWatch : Watch
|
public sealed class DWordWatch : Watch
|
||||||
{
|
{
|
||||||
protected uint _previous;
|
private uint _value;
|
||||||
|
private uint _previous;
|
||||||
|
|
||||||
public DWordWatch(MemoryDomain domain, int address)
|
public DWordWatch(MemoryDomain domain, int address)
|
||||||
{
|
{
|
||||||
_domain = domain;
|
_domain = domain;
|
||||||
_address = address;
|
_address = address;
|
||||||
_previous = GetDWord();
|
_value = _previous = GetDWord();
|
||||||
|
Notes = String.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DWordWatch(MemoryDomain domain, int address, DisplayType type, bool bigEndian, uint prev, int changeCount)
|
||||||
|
: this(domain, address)
|
||||||
|
{
|
||||||
|
_previous = prev;
|
||||||
|
_changecount = changeCount;
|
||||||
|
_type = type;
|
||||||
|
_bigEndian = bigEndian;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int? Value
|
public override int? Value
|
||||||
|
@ -825,10 +779,10 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return AddressString + ": " + ValueString;
|
return Notes + ": " + ValueString;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected string FormatValue(uint val)
|
private string FormatValue(uint val)
|
||||||
{
|
{
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
|
@ -912,57 +866,25 @@ namespace BizHawk.MultiClient
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class DetailedDWordWatch : DWordWatch, IWatchDetails
|
public override string Diff
|
||||||
{
|
|
||||||
private uint _value;
|
|
||||||
|
|
||||||
public DetailedDWordWatch(MemoryDomain domain, int address)
|
|
||||||
: base(domain, address)
|
|
||||||
{
|
|
||||||
Notes = String.Empty;
|
|
||||||
_value = GetDWord();
|
|
||||||
}
|
|
||||||
|
|
||||||
public DetailedDWordWatch(MemoryDomain domain, int address, DisplayType type, bool bigEndian, uint prev, int changeCount)
|
|
||||||
: this(domain, address)
|
|
||||||
{
|
|
||||||
_previous = prev;
|
|
||||||
ChangeCount = changeCount;
|
|
||||||
_type = type;
|
|
||||||
_bigEndian = bigEndian;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Notes + ": " + ValueString;
|
|
||||||
}
|
|
||||||
public int ChangeCount { get; private set; }
|
|
||||||
public void ClearChangeCount() { ChangeCount = 0; }
|
|
||||||
|
|
||||||
public string Diff
|
|
||||||
{
|
{
|
||||||
get { return FormatValue(_previous - _value); }
|
get { return FormatValue(_previous - _value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Notes { get; set; }
|
public override void Update()
|
||||||
|
|
||||||
public void Update()
|
|
||||||
{
|
{
|
||||||
switch (Global.Config.RamWatchDefinePrevious)
|
switch (Global.Config.RamWatchDefinePrevious)
|
||||||
{
|
{
|
||||||
case PreviousType.LastSearch: //TODO
|
|
||||||
case PreviousType.Original:
|
case PreviousType.Original:
|
||||||
/*Do Nothing*/
|
return;
|
||||||
break;
|
|
||||||
case PreviousType.LastChange:
|
case PreviousType.LastChange:
|
||||||
var temp = _value;
|
var temp = _value;
|
||||||
_value = GetDWord();
|
_value = GetDWord();
|
||||||
if (_value != temp)
|
if (_value != temp)
|
||||||
{
|
{
|
||||||
_previous = _value;
|
_previous = _value;
|
||||||
ChangeCount++;
|
_changecount++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PreviousType.LastFrame:
|
case PreviousType.LastFrame:
|
||||||
|
@ -970,7 +892,7 @@ namespace BizHawk.MultiClient
|
||||||
_value = GetDWord();
|
_value = GetDWord();
|
||||||
if (_value != Previous)
|
if (_value != Previous)
|
||||||
{
|
{
|
||||||
ChangeCount++;
|
_changecount++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NotesBox.Text = (_watchList[0] as IWatchDetails).Notes;
|
NotesBox.Text = _watchList[0].Notes;
|
||||||
AddressBox.Text = _watchList[0].AddressString;
|
AddressBox.Text = _watchList[0].AddressString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ namespace BizHawk.MultiClient
|
||||||
switch (SizeDropDown.SelectedIndex)
|
switch (SizeDropDown.SelectedIndex)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
_watchList.Add(new DetailedByteWatch(domain, address)
|
_watchList.Add(new ByteWatch(domain, address)
|
||||||
{
|
{
|
||||||
Notes = notes,
|
Notes = notes,
|
||||||
Type = type,
|
Type = type,
|
||||||
|
@ -233,7 +233,7 @@ namespace BizHawk.MultiClient
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
_watchList.Add(new DetailedWordWatch(domain, address)
|
_watchList.Add(new WordWatch(domain, address)
|
||||||
{
|
{
|
||||||
Notes = notes,
|
Notes = notes,
|
||||||
Type = type,
|
Type = type,
|
||||||
|
@ -242,7 +242,7 @@ namespace BizHawk.MultiClient
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
_watchList.Add(new DetailedDWordWatch(domain, address)
|
_watchList.Add(new DWordWatch(domain, address)
|
||||||
{
|
{
|
||||||
Notes = notes,
|
Notes = notes,
|
||||||
Type = type,
|
Type = type,
|
||||||
|
@ -261,9 +261,9 @@ namespace BizHawk.MultiClient
|
||||||
_watchList.Clear();
|
_watchList.Clear();
|
||||||
foreach (var watch in tempWatchList)
|
foreach (var watch in tempWatchList)
|
||||||
{
|
{
|
||||||
var newWatch = Watch.GenerateWatch(watch.Domain, watch.Address.Value, watch.Size, details: true);
|
var newWatch = Watch.GenerateWatch(watch.Domain, watch.Address.Value, watch.Size);
|
||||||
newWatch.Type = watch.Type;
|
newWatch.Type = watch.Type;
|
||||||
(newWatch as IWatchDetails).Notes = (watch as IWatchDetails).Notes;
|
newWatch.Notes = watch.Notes;
|
||||||
_watchList.Add(watch);
|
_watchList.Add(watch);
|
||||||
}
|
}
|
||||||
DoEdit();
|
DoEdit();
|
||||||
|
@ -277,7 +277,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
if (_watchList.Count == 1)
|
if (_watchList.Count == 1)
|
||||||
{
|
{
|
||||||
(_watchList[0] as IWatchDetails).Notes = NotesBox.Text;
|
_watchList[0].Notes = NotesBox.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_changedSize)
|
if (_changedSize)
|
||||||
|
@ -297,13 +297,13 @@ namespace BizHawk.MultiClient
|
||||||
size = Watch.WatchSize.DWord;
|
size = Watch.WatchSize.DWord;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
string tempNotes = (_watchList[i] as IWatchDetails).Notes;
|
string tempNotes = _watchList[i].Notes;
|
||||||
_watchList[i] = Watch.GenerateWatch(
|
_watchList[i] = Watch.GenerateWatch(
|
||||||
_watchList[i].Domain,
|
_watchList[i].Domain,
|
||||||
_watchList.Count == 1 ? AddressBox.ToInt() : _watchList[i].Address.Value,
|
_watchList.Count == 1 ? AddressBox.ToInt() : _watchList[i].Address.Value,
|
||||||
size,
|
size
|
||||||
details: true);
|
);
|
||||||
(_watchList[i] as IWatchDetails).Notes = tempNotes;
|
_watchList[i].Notes = tempNotes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_changedDisplayType)
|
if (_changedDisplayType)
|
||||||
|
|
|
@ -137,7 +137,7 @@ namespace BizHawk.MultiClient
|
||||||
if (reverse)
|
if (reverse)
|
||||||
{
|
{
|
||||||
_watchList = _watchList
|
_watchList = _watchList
|
||||||
.OrderByDescending(x => (x as IWatchDetails).Diff)
|
.OrderByDescending(x => x.Diff)
|
||||||
.ThenBy(x => x.Address ?? 0)
|
.ThenBy(x => x.Address ?? 0)
|
||||||
.ThenBy(x => x.Size)
|
.ThenBy(x => x.Size)
|
||||||
.ThenBy(x => x.Type)
|
.ThenBy(x => x.Type)
|
||||||
|
@ -146,7 +146,7 @@ namespace BizHawk.MultiClient
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_watchList = _watchList
|
_watchList = _watchList
|
||||||
.OrderBy(x => (x as IWatchDetails).Diff)
|
.OrderBy(x => x.Diff)
|
||||||
.ThenBy(x => x.Address ?? 0)
|
.ThenBy(x => x.Address ?? 0)
|
||||||
.ThenBy(x => x.Size)
|
.ThenBy(x => x.Size)
|
||||||
.ThenBy(x => x.Type)
|
.ThenBy(x => x.Type)
|
||||||
|
@ -157,7 +157,7 @@ namespace BizHawk.MultiClient
|
||||||
if (reverse)
|
if (reverse)
|
||||||
{
|
{
|
||||||
_watchList = _watchList
|
_watchList = _watchList
|
||||||
.OrderByDescending(x => (x as IWatchDetails).ChangeCount)
|
.OrderByDescending(x => x.ChangeCount)
|
||||||
.ThenBy(x => x.Address ?? 0)
|
.ThenBy(x => x.Address ?? 0)
|
||||||
.ThenBy(x => x.Size)
|
.ThenBy(x => x.Size)
|
||||||
.ThenBy(x => x.Type)
|
.ThenBy(x => x.Type)
|
||||||
|
@ -166,7 +166,7 @@ namespace BizHawk.MultiClient
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_watchList = _watchList
|
_watchList = _watchList
|
||||||
.OrderBy(x => (x as IWatchDetails).ChangeCount)
|
.OrderBy(x => x.ChangeCount)
|
||||||
.ThenBy(x => x.Address ?? 0)
|
.ThenBy(x => x.Address ?? 0)
|
||||||
.ThenBy(x => x.Size)
|
.ThenBy(x => x.Size)
|
||||||
.ThenBy(x => x.Type)
|
.ThenBy(x => x.Type)
|
||||||
|
@ -199,7 +199,7 @@ namespace BizHawk.MultiClient
|
||||||
if (reverse)
|
if (reverse)
|
||||||
{
|
{
|
||||||
_watchList = _watchList
|
_watchList = _watchList
|
||||||
.OrderByDescending(x => (x as IWatchDetails).Notes)
|
.OrderByDescending(x => x.Notes)
|
||||||
.ThenBy(x => x.Address ?? 0)
|
.ThenBy(x => x.Address ?? 0)
|
||||||
.ThenBy(x => x.Size)
|
.ThenBy(x => x.Size)
|
||||||
.ThenBy(x => x.Type)
|
.ThenBy(x => x.Type)
|
||||||
|
@ -208,7 +208,7 @@ namespace BizHawk.MultiClient
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_watchList = _watchList
|
_watchList = _watchList
|
||||||
.OrderBy(x => (x as IWatchDetails).Notes)
|
.OrderBy(x => x.Notes)
|
||||||
.ThenBy(x => x.Address ?? 0)
|
.ThenBy(x => x.Address ?? 0)
|
||||||
.ThenBy(x => x.Size)
|
.ThenBy(x => x.Size)
|
||||||
.ThenBy(x => x.Type)
|
.ThenBy(x => x.Type)
|
||||||
|
@ -244,8 +244,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public void UpdateValues()
|
public void UpdateValues()
|
||||||
{
|
{
|
||||||
var detailedWatches = _watchList.OfType<IWatchDetails>().ToList();
|
foreach (var watch in _watchList)
|
||||||
foreach (var watch in detailedWatches)
|
|
||||||
{
|
{
|
||||||
watch.Update();
|
watch.Update();
|
||||||
}
|
}
|
||||||
|
@ -276,8 +275,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public void ClearChangeCounts()
|
public void ClearChangeCounts()
|
||||||
{
|
{
|
||||||
var detailedWatches = _watchList.OfType<IWatchDetails>().ToList();
|
foreach (var watch in _watchList)
|
||||||
foreach (var watch in detailedWatches)
|
|
||||||
{
|
{
|
||||||
watch.ClearChangeCount();
|
watch.ClearChangeCount();
|
||||||
}
|
}
|
||||||
|
@ -308,9 +306,9 @@ namespace BizHawk.MultiClient
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Load(string path, bool details, bool append)
|
public bool Load(string path, bool append)
|
||||||
{
|
{
|
||||||
bool result = LoadFile(path, details, append);
|
bool result = LoadFile(path, append);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
@ -332,7 +330,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
if (!String.IsNullOrWhiteSpace(CurrentFileName))
|
if (!String.IsNullOrWhiteSpace(CurrentFileName))
|
||||||
{
|
{
|
||||||
LoadFile(CurrentFileName, true, false);
|
LoadFile(CurrentFileName, append:false);
|
||||||
Changes = false;
|
Changes = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -359,7 +357,7 @@ namespace BizHawk.MultiClient
|
||||||
.Append(w.TypeAsChar).Append('\t')
|
.Append(w.TypeAsChar).Append('\t')
|
||||||
.Append(w.BigEndian ? '1' : '0').Append('\t')
|
.Append(w.BigEndian ? '1' : '0').Append('\t')
|
||||||
.Append(w.Domain.Name).Append('\t')
|
.Append(w.Domain.Name).Append('\t')
|
||||||
.Append(w is IWatchDetails ? (w as IWatchDetails).Notes : String.Empty)
|
.Append(w.Notes)
|
||||||
.AppendLine();
|
.AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,7 +381,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool LoadFile(string path, bool details, bool append)
|
private bool LoadFile(string path, bool append)
|
||||||
{
|
{
|
||||||
string domain = "";
|
string domain = "";
|
||||||
var file = new FileInfo(path);
|
var file = new FileInfo(path);
|
||||||
|
@ -500,13 +498,10 @@ namespace BizHawk.MultiClient
|
||||||
startIndex = line.IndexOf('\t') + 1;
|
startIndex = line.IndexOf('\t') + 1;
|
||||||
string notes = line.Substring(startIndex, line.Length - startIndex);
|
string notes = line.Substring(startIndex, line.Length - startIndex);
|
||||||
|
|
||||||
Watch w = Watch.GenerateWatch(memDomain, addr, size, details);
|
Watch w = Watch.GenerateWatch(memDomain, addr, size);
|
||||||
w.BigEndian = bigEndian;
|
w.BigEndian = bigEndian;
|
||||||
w.Type = type;
|
w.Type = type;
|
||||||
if (w is IWatchDetails)
|
w.Notes = notes;
|
||||||
{
|
|
||||||
(w as IWatchDetails).Notes = notes;
|
|
||||||
}
|
|
||||||
|
|
||||||
_watchList.Add(w);
|
_watchList.Add(w);
|
||||||
_domain = Global.Emulator.MemoryDomains[GetDomainPos(domain)];
|
_domain = Global.Emulator.MemoryDomains[GetDomainPos(domain)];
|
||||||
|
|
Loading…
Reference in New Issue