Ram Watch - fix issue with stale memory domains when rebooting a core, some cores were unaffected, cores like atari 2600 were affected by this bug
This commit is contained in:
parent
d308a16f8d
commit
f4d3b70469
|
@ -64,9 +64,9 @@ namespace BizHawk.Client.Common
|
||||||
public virtual DisplayType Type { get { return _type; } set { _type = value; } }
|
public virtual DisplayType Type { get { return _type; } set { _type = value; } }
|
||||||
public virtual bool BigEndian { get { return _bigEndian; } set { _bigEndian = value; } }
|
public virtual bool BigEndian { get { return _bigEndian; } set { _bigEndian = value; } }
|
||||||
|
|
||||||
public MemoryDomain Domain { get { return _domain; } }
|
public MemoryDomain Domain { get { return _domain; } set { _domain = value; } }
|
||||||
|
|
||||||
public string DomainName { get { return _domain != null ? _domain.Name : String.Empty; } }
|
public string DomainName { get { return _domain != null ? _domain.Name : string.Empty; } }
|
||||||
|
|
||||||
public virtual int? Address { get { return _address; } }
|
public virtual int? Address { get { return _address; } }
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
public class WatchList : IList<Watch>
|
public class WatchList : IList<Watch>
|
||||||
{
|
{
|
||||||
private readonly IMemoryDomains Core;
|
private IMemoryDomains _core;
|
||||||
private List<Watch> _watchList = new List<Watch>();
|
private List<Watch> _watchList = new List<Watch>();
|
||||||
private MemoryDomain _domain;
|
private MemoryDomain _domain;
|
||||||
private string _currentFilename = string.Empty;
|
private string _currentFilename = string.Empty;
|
||||||
|
@ -27,9 +27,20 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public WatchList(IMemoryDomains core, MemoryDomain domain)
|
public WatchList(IMemoryDomains core, MemoryDomain domain)
|
||||||
{
|
{
|
||||||
Core = core;
|
_core = core;
|
||||||
_domain = domain;
|
_domain = domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RefreshDomans(IMemoryDomains core, MemoryDomain domain)
|
||||||
|
{
|
||||||
|
_core = core;
|
||||||
|
_domain = domain;
|
||||||
|
|
||||||
|
_watchList.ForEach(w =>
|
||||||
|
{
|
||||||
|
w.Domain = _core.MemoryDomains[w.Domain.Name];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public enum WatchPrevDef { LastSearch, Original, LastFrame, LastChange }
|
public enum WatchPrevDef { LastSearch, Original, LastFrame, LastChange }
|
||||||
|
|
||||||
|
@ -473,7 +484,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// Temporary, rename if kept
|
// Temporary, rename if kept
|
||||||
int addr;
|
int addr;
|
||||||
var memDomain = Core.MemoryDomains.MainMemory;
|
var memDomain = _core.MemoryDomains.MainMemory;
|
||||||
|
|
||||||
var temp = line.Substring(0, line.IndexOf('\t'));
|
var temp = line.Substring(0, line.IndexOf('\t'));
|
||||||
try
|
try
|
||||||
|
@ -511,7 +522,7 @@ namespace BizHawk.Client.Common
|
||||||
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'));
|
||||||
memDomain = Core.MemoryDomains[temp] ?? Core.MemoryDomains.MainMemory;
|
memDomain = _core.MemoryDomains[temp] ?? _core.MemoryDomains.MainMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
startIndex = line.IndexOf('\t') + 1;
|
startIndex = line.IndexOf('\t') + 1;
|
||||||
|
@ -525,10 +536,10 @@ namespace BizHawk.Client.Common
|
||||||
type,
|
type,
|
||||||
notes,
|
notes,
|
||||||
bigEndian));
|
bigEndian));
|
||||||
_domain = Core.MemoryDomains[domain];
|
_domain = _core.MemoryDomains[domain];
|
||||||
}
|
}
|
||||||
|
|
||||||
Domain = Core.MemoryDomains[domain] ?? Core.MemoryDomains.MainMemory;
|
Domain = _core.MemoryDomains[domain] ?? _core.MemoryDomains.MainMemory;
|
||||||
_currentFilename = path;
|
_currentFilename = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{ WatchList.NOTES, 128 },
|
{ WatchList.NOTES, 128 },
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly WatchList _watches;
|
private WatchList _watches;
|
||||||
private readonly IMemoryDomains Core;
|
private IMemoryDomains _core;
|
||||||
|
|
||||||
|
|
||||||
private int _defaultWidth;
|
private int _defaultWidth;
|
||||||
|
@ -41,8 +41,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public RamWatch()
|
public RamWatch()
|
||||||
{
|
{
|
||||||
Core = (IMemoryDomains)Global.Emulator; // Cast is intentional, better to get a cast exception than a null reference exception later
|
_core = (IMemoryDomains)Global.Emulator; // Cast is intentional, better to get a cast exception than a null reference exception later
|
||||||
_watches = new WatchList(Core, Core.MemoryDomains.MainMemory);
|
_watches = new WatchList(_core, _core.MemoryDomains.MainMemory);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
WatchListView.QueryItemText += WatchListView_QueryItemText;
|
WatchListView.QueryItemText += WatchListView_QueryItemText;
|
||||||
WatchListView.QueryItemBkColor += WatchListView_QueryItemBkColor;
|
WatchListView.QueryItemBkColor += WatchListView_QueryItemBkColor;
|
||||||
|
@ -200,13 +200,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_core = (IMemoryDomains)Global.Emulator; // Cast is intentional, better to get a cast exception than a null reference exception later
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(_watches.CurrentFileName))
|
if (!string.IsNullOrWhiteSpace(_watches.CurrentFileName))
|
||||||
{
|
{
|
||||||
_watches.Reload();
|
_watches.Reload();
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
|
_watches.RefreshDomans(_core, _core.MemoryDomains.MainMemory);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
_watches = new WatchList(_core, _core.MemoryDomains.MainMemory);
|
||||||
NewWatchList(true);
|
NewWatchList(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -568,7 +572,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void SetMemoryDomain(string name)
|
private void SetMemoryDomain(string name)
|
||||||
{
|
{
|
||||||
_watches.Domain = Core.MemoryDomains[name];
|
_watches.Domain = _core.MemoryDomains[name];
|
||||||
SetPlatformAndMemoryDomainLabel();
|
SetPlatformAndMemoryDomainLabel();
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
@ -749,7 +753,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
MemoryDomainsSubMenu.DropDownItems.Clear();
|
MemoryDomainsSubMenu.DropDownItems.Clear();
|
||||||
MemoryDomainsSubMenu.DropDownItems.AddRange(
|
MemoryDomainsSubMenu.DropDownItems.AddRange(
|
||||||
Core.MemoryDomains.MenuItems(SetMemoryDomain, _watches.Domain.Name)
|
_core.MemoryDomains.MenuItems(SetMemoryDomain, _watches.Domain.Name)
|
||||||
.ToArray());
|
.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue