New Ram Watch - basic display of 1 byte values working
This commit is contained in:
parent
d03b7aa687
commit
05fc6d8dd3
|
@ -61,20 +61,17 @@ namespace BizHawk.MultiClient
|
||||||
text = Watches[index].ValueString;
|
text = Watches[index].ValueString;
|
||||||
break;
|
break;
|
||||||
case 2: // prev
|
case 2: // prev
|
||||||
text = "TODO";
|
if (Watches[index] is iWatchEntryDetails)
|
||||||
//switch (Global.Config.RamWatchPrev_Type)
|
{
|
||||||
//{
|
text = "TODO";
|
||||||
// case 1:
|
//text = (Watches[index] as iWatchEntryDetails).Previous;
|
||||||
// text = Watches[index].PrevString;
|
}
|
||||||
// break;
|
|
||||||
// case 2:
|
|
||||||
// text = Watches[index].LastChangeString;
|
|
||||||
// break;
|
|
||||||
//}
|
|
||||||
break;
|
break;
|
||||||
case 3: // changes
|
case 3: // changes
|
||||||
text = "TODO";
|
if (Watches[index] is iWatchEntryDetails)
|
||||||
//text = Watches[index].Changecount;
|
{
|
||||||
|
text = (Watches[index] as iWatchEntryDetails).ChangeCount.ToString();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4: // diff
|
case 4: // diff
|
||||||
text = "TODO";
|
text = "TODO";
|
||||||
|
@ -92,8 +89,10 @@ namespace BizHawk.MultiClient
|
||||||
text = Watches[index].DomainName;
|
text = Watches[index].DomainName;
|
||||||
break;
|
break;
|
||||||
case 6: // notes
|
case 6: // notes
|
||||||
text = "TODO";
|
if (Watches[index] is iWatchEntryDetails)
|
||||||
//text = Watches[index].Notes;
|
{
|
||||||
|
text = (Watches[index] as iWatchEntryDetails).Notes;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -897,28 +897,22 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public abstract class WatchEntryBase
|
public abstract class WatchEntryBase
|
||||||
{
|
{
|
||||||
protected MemoryDomain _domain;
|
|
||||||
|
|
||||||
public abstract int? Address { get; }
|
|
||||||
public abstract int? Value { get; }
|
|
||||||
|
|
||||||
public abstract string AddressString { get; }
|
|
||||||
public abstract string ValueString { get; }
|
|
||||||
|
|
||||||
public enum WatchSize { Byte = 1, Word = 2, DWord = 4, Separator = 0 };
|
public enum WatchSize { Byte = 1, Word = 2, DWord = 4, Separator = 0 };
|
||||||
public enum DisplayType { Signed, Unsigned, Hex };
|
public enum DisplayType { Signed, Unsigned, Hex };
|
||||||
|
|
||||||
public readonly WatchSize Size;
|
protected MemoryDomain _domain;
|
||||||
public readonly DisplayType Type;
|
protected DisplayType _type;
|
||||||
public bool BigEndian = false;
|
protected bool _bigEndian;
|
||||||
|
|
||||||
public virtual bool IsSeparator
|
public abstract int? Address { get; }
|
||||||
{
|
public abstract int? Value { get; }
|
||||||
get
|
public abstract string AddressString { get; }
|
||||||
{
|
public abstract string ValueString { get; }
|
||||||
return Size == WatchSize.Separator;
|
public abstract WatchSize Size { get; }
|
||||||
}
|
public abstract bool IsSeparator { get; }
|
||||||
}
|
|
||||||
|
public virtual DisplayType Type { get { return _type; } set { _type = value; } }
|
||||||
|
public virtual bool BigEndian { get { return _bigEndian; } set { _bigEndian = value; } }
|
||||||
|
|
||||||
public string DomainName
|
public string DomainName
|
||||||
{
|
{
|
||||||
|
@ -955,7 +949,22 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WatchEntryBase GenerateWatch(MemoryDomain domain, int address, WatchSize size, DisplayType type, bool details)
|
public string AddressFormatStr
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_domain != null)
|
||||||
|
{
|
||||||
|
return "X" + IntHelpers.GetNumDigits(_domain.Size - 1).ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WatchEntryBase GenerateWatch(MemoryDomain domain, int address, WatchSize size, bool details)
|
||||||
{
|
{
|
||||||
switch (size)
|
switch (size)
|
||||||
{
|
{
|
||||||
|
@ -1031,6 +1040,11 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override WatchSize Size
|
||||||
|
{
|
||||||
|
get { return WatchSize.Separator; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ByteWatch : WatchEntryBase
|
public class ByteWatch : WatchEntryBase
|
||||||
|
@ -1045,10 +1059,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public override int? Address
|
public override int? Address
|
||||||
{
|
{
|
||||||
get
|
get { return _address; }
|
||||||
{
|
|
||||||
return _address;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int? Value
|
public override int? Value
|
||||||
|
@ -1070,7 +1081,14 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (Address.HasValue)
|
||||||
|
{
|
||||||
|
return Address.Value.ToString(AddressFormatStr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1078,7 +1096,16 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
switch (Type)
|
||||||
|
{
|
||||||
|
case DisplayType.Signed:
|
||||||
|
return ((sbyte)Value).ToString();
|
||||||
|
default:
|
||||||
|
case DisplayType.Unsigned:
|
||||||
|
return ((byte)Value).ToString();
|
||||||
|
case DisplayType.Hex:
|
||||||
|
return String.Format("{0:X2}", Value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1087,9 +1114,19 @@ namespace BizHawk.MultiClient
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return Value.ToString(); //TODO
|
return Value.ToString(); //TODO - this is used by on screen display
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool IsSeparator
|
||||||
|
{
|
||||||
|
get { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override WatchSize Size
|
||||||
|
{
|
||||||
|
get { return WatchSize.Byte; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DetailedByteWatch : ByteWatch, iWatchEntryDetails
|
public class DetailedByteWatch : ByteWatch, iWatchEntryDetails
|
||||||
|
@ -1196,7 +1233,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public void Load(string path, bool details, bool append)
|
public void Load(string path, bool details, bool append)
|
||||||
{
|
{
|
||||||
bool result = LoadFile(path, append, details);
|
bool result = LoadFile(path, details, append);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
@ -1287,17 +1324,17 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
|
|
||||||
//Temporary, rename if kept
|
//Temporary, rename if kept
|
||||||
int THEADDRESS_ = 0;
|
int addr = 0;
|
||||||
WatchEntryBase.WatchSize THESIZE = WatchEntryBase.WatchSize.Separator;
|
WatchEntryBase.WatchSize size = WatchEntryBase.WatchSize.Separator;
|
||||||
WatchEntryBase.DisplayType THEDISPLAYTYPE = WatchEntryBase.DisplayType.Unsigned;
|
WatchEntryBase.DisplayType type = WatchEntryBase.DisplayType.Unsigned;
|
||||||
bool BIGENDIAN = false;
|
bool bigEndian = false;
|
||||||
MemoryDomain THEDOMAIN = Global.Emulator.MainMemory;
|
MemoryDomain memDomain = Global.Emulator.MainMemory;
|
||||||
string THENOTES;
|
string notes;
|
||||||
|
|
||||||
string temp = line.Substring(0, line.IndexOf('\t'));
|
string temp = line.Substring(0, line.IndexOf('\t'));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
THEADDRESS_ = Int32.Parse(temp, NumberStyles.HexNumber);
|
addr = Int32.Parse(temp, NumberStyles.HexNumber);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -1306,12 +1343,12 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
startIndex = line.IndexOf('\t') + 1;
|
startIndex = line.IndexOf('\t') + 1;
|
||||||
line = line.Substring(startIndex, line.Length - startIndex); //Type
|
line = line.Substring(startIndex, line.Length - startIndex); //Type
|
||||||
THESIZE = WatchEntryBase.SizeFromChar(line[0]);
|
size = WatchEntryBase.SizeFromChar(line[0]);
|
||||||
|
|
||||||
|
|
||||||
startIndex = line.IndexOf('\t') + 1;
|
startIndex = line.IndexOf('\t') + 1;
|
||||||
line = line.Substring(startIndex, line.Length - startIndex); //Signed
|
line = line.Substring(startIndex, line.Length - startIndex); //Signed
|
||||||
THEDISPLAYTYPE = WatchEntryBase.DisplayTypeFromChar(line[0]);
|
type = WatchEntryBase.DisplayTypeFromChar(line[0]);
|
||||||
|
|
||||||
startIndex = line.IndexOf('\t') + 1;
|
startIndex = line.IndexOf('\t') + 1;
|
||||||
line = line.Substring(startIndex, line.Length - startIndex); //Endian
|
line = line.Substring(startIndex, line.Length - startIndex); //Endian
|
||||||
|
@ -1325,11 +1362,11 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
if (startIndex == 0)
|
if (startIndex == 0)
|
||||||
{
|
{
|
||||||
BIGENDIAN = false;
|
bigEndian = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BIGENDIAN = true;
|
bigEndian = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isBizHawkWatch && !isOldBizHawkWatch)
|
if (isBizHawkWatch && !isOldBizHawkWatch)
|
||||||
|
@ -1337,20 +1374,17 @@ namespace BizHawk.MultiClient
|
||||||
startIndex = line.IndexOf('\t') + 1;
|
startIndex = line.IndexOf('\t') + 1;
|
||||||
line = line.Substring(startIndex, line.Length - startIndex); //Domain
|
line = line.Substring(startIndex, line.Length - startIndex); //Domain
|
||||||
temp = line.Substring(0, line.IndexOf('\t'));
|
temp = line.Substring(0, line.IndexOf('\t'));
|
||||||
THEDOMAIN = Global.Emulator.MemoryDomains[GetDomainPos(temp)];
|
memDomain = Global.Emulator.MemoryDomains[GetDomainPos(temp)];
|
||||||
}
|
}
|
||||||
|
|
||||||
startIndex = line.IndexOf('\t') + 1;
|
startIndex = line.IndexOf('\t') + 1;
|
||||||
THENOTES = line.Substring(startIndex, line.Length - startIndex); //User notes
|
notes = line.Substring(startIndex, line.Length - startIndex); //User notes
|
||||||
|
|
||||||
|
WatchEntryBase w = WatchEntryBase.GenerateWatch(memDomain, addr, size, details);
|
||||||
|
w.BigEndian = bigEndian;
|
||||||
|
w.Type = type;
|
||||||
|
(w as iWatchEntryDetails).Notes = notes;
|
||||||
|
|
||||||
WatchEntryBase w = WatchEntryBase.GenerateWatch(
|
|
||||||
THEDOMAIN,
|
|
||||||
THEADDRESS_,
|
|
||||||
THESIZE,
|
|
||||||
THEDISPLAYTYPE,
|
|
||||||
details
|
|
||||||
);
|
|
||||||
w.BigEndian = BIGENDIAN;
|
|
||||||
_watchList.Add(w);
|
_watchList.Add(w);
|
||||||
_domain = Global.Emulator.MemoryDomains[GetDomainPos(domain)];
|
_domain = Global.Emulator.MemoryDomains[GetDomainPos(domain)];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue