New Ram Watch - implement Separator object, finish file loading (only 1 byte supported currently)
This commit is contained in:
parent
ca579745de
commit
1254b8b03e
|
@ -109,7 +109,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
Watches.Load(file.FullName, false);
|
Watches.Load(file.FullName, details: true, append: false);
|
||||||
DisplayWatches();
|
DisplayWatches();
|
||||||
MessageLabel.Text = Path.GetFileNameWithoutExtension(Watches.CurrentFileName);
|
MessageLabel.Text = Path.GetFileNameWithoutExtension(Watches.CurrentFileName);
|
||||||
UpdateWatchCount();
|
UpdateWatchCount();
|
||||||
|
|
|
@ -912,10 +912,13 @@ namespace BizHawk.MultiClient
|
||||||
public readonly DisplayType Type;
|
public readonly DisplayType Type;
|
||||||
public bool BigEndian = false;
|
public bool BigEndian = false;
|
||||||
|
|
||||||
public bool IsSeparator()
|
public virtual bool IsSeparator
|
||||||
|
{
|
||||||
|
get
|
||||||
{
|
{
|
||||||
return Size == WatchSize.Separator;
|
return Size == WatchSize.Separator;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static WatchSize SizeFromChar(char c) //b = byte, w = word, d = dword
|
public static WatchSize SizeFromChar(char c) //b = byte, w = word, d = dword
|
||||||
{
|
{
|
||||||
|
@ -946,6 +949,30 @@ namespace BizHawk.MultiClient
|
||||||
return DisplayType.Hex;
|
return DisplayType.Hex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static WatchEntryBase GenerateWatch(MemoryDomain domain, int address, WatchSize size, DisplayType type, bool details)
|
||||||
|
{
|
||||||
|
switch (size)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case WatchSize.Separator:
|
||||||
|
return new SeparatorWatch();
|
||||||
|
case WatchSize.Byte:
|
||||||
|
if (details)
|
||||||
|
{
|
||||||
|
return new DetailedByteWatch(domain, address);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new ByteWatch(domain, address);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WatchSize.Word:
|
||||||
|
throw new NotImplementedException();
|
||||||
|
case WatchSize.DWord:
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface iWatchEntryDetails
|
public interface iWatchEntryDetails
|
||||||
|
@ -959,6 +986,48 @@ namespace BizHawk.MultiClient
|
||||||
string Notes { get; set; }
|
string Notes { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SeparatorWatch : WatchEntryBase
|
||||||
|
{
|
||||||
|
public SeparatorWatch()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int? Address
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int? Value
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string AddressString
|
||||||
|
{
|
||||||
|
get { return ""; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ValueString
|
||||||
|
{
|
||||||
|
get { return ""; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
switch (Type)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
return Value.ToString(); //TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsSeparator
|
||||||
|
{
|
||||||
|
get { return true; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class ByteWatch : WatchEntryBase
|
public class ByteWatch : WatchEntryBase
|
||||||
{
|
{
|
||||||
protected int? _address;
|
protected int? _address;
|
||||||
|
@ -1010,7 +1079,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
switch(Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return Value.ToString(); //TODO
|
return Value.ToString(); //TODO
|
||||||
|
@ -1038,6 +1107,8 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public class WatchList : IEnumerable
|
public class WatchList : IEnumerable
|
||||||
{
|
{
|
||||||
|
private string _currentFilename = "";
|
||||||
|
|
||||||
public enum WatchPrevDef { LastSearch, Original, LastFrame, LastChange };
|
public enum WatchPrevDef { LastSearch, Original, LastFrame, LastChange };
|
||||||
|
|
||||||
private List<WatchEntryBase> _watchList = new List<WatchEntryBase>();
|
private List<WatchEntryBase> _watchList = new List<WatchEntryBase>();
|
||||||
|
@ -1067,7 +1138,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _watchList.Count(w => !w.IsSeparator());
|
return _watchList.Count(w => !w.IsSeparator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1103,7 +1174,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
#region File handling logic - probably needs to be its own class
|
#region File handling logic - probably needs to be its own class
|
||||||
|
|
||||||
public string CurrentFileName { get; set; }
|
public string CurrentFileName { get { return _currentFilename; } set { _currentFilename = value; } }
|
||||||
public bool Changes { get; set; }
|
public bool Changes { get; set; }
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
|
@ -1118,9 +1189,9 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Load(string path, bool append)
|
public void Load(string path, bool details, bool append)
|
||||||
{
|
{
|
||||||
bool result = LoadFile(path, append);
|
bool result = LoadFile(path, append, details);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
@ -1147,7 +1218,7 @@ namespace BizHawk.MultiClient
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool LoadFile(string path, bool append)
|
private bool LoadFile(string path, bool details, bool append)
|
||||||
{
|
{
|
||||||
string domain = "";
|
string domain = "";
|
||||||
var file = new FileInfo(path);
|
var file = new FileInfo(path);
|
||||||
|
@ -1211,7 +1282,6 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
|
|
||||||
//Temporary, rename if kept
|
//Temporary, rename if kept
|
||||||
Watch w = new Watch();
|
|
||||||
int THEADDRESS_ = 0;
|
int THEADDRESS_ = 0;
|
||||||
WatchEntryBase.WatchSize THESIZE = WatchEntryBase.WatchSize.Separator;
|
WatchEntryBase.WatchSize THESIZE = WatchEntryBase.WatchSize.Separator;
|
||||||
WatchEntryBase.DisplayType THEDISPLAYTYPE = WatchEntryBase.DisplayType.Unsigned;
|
WatchEntryBase.DisplayType THEDISPLAYTYPE = WatchEntryBase.DisplayType.Unsigned;
|
||||||
|
@ -1268,7 +1338,16 @@ namespace BizHawk.MultiClient
|
||||||
startIndex = line.IndexOf('\t') + 1;
|
startIndex = line.IndexOf('\t') + 1;
|
||||||
THENOTES = line.Substring(startIndex, line.Length - startIndex); //User notes
|
THENOTES = line.Substring(startIndex, line.Length - startIndex); //User notes
|
||||||
|
|
||||||
//_watchList.Add(w); //TODO: we need a widget factory or something, to manage the logic of what object to use!
|
WatchEntryBase w = WatchEntryBase.GenerateWatch(
|
||||||
|
THEDOMAIN,
|
||||||
|
THEADDRESS_,
|
||||||
|
THESIZE,
|
||||||
|
THEDISPLAYTYPE,
|
||||||
|
details
|
||||||
|
);
|
||||||
|
w.BigEndian = BIGENDIAN;
|
||||||
|
_watchList.Add(w);
|
||||||
|
_domain = Global.Emulator.MemoryDomains[GetDomainPos(domain)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue