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 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; } }
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public class WatchList : IList<Watch>
|
||||
{
|
||||
private readonly IMemoryDomains Core;
|
||||
private IMemoryDomains _core;
|
||||
private List<Watch> _watchList = new List<Watch>();
|
||||
private MemoryDomain _domain;
|
||||
private string _currentFilename = string.Empty;
|
||||
|
@ -27,9 +27,20 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public WatchList(IMemoryDomains core, MemoryDomain domain)
|
||||
{
|
||||
Core = core;
|
||||
_core = core;
|
||||
_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 }
|
||||
|
||||
|
@ -473,7 +484,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
// Temporary, rename if kept
|
||||
int addr;
|
||||
var memDomain = Core.MemoryDomains.MainMemory;
|
||||
var memDomain = _core.MemoryDomains.MainMemory;
|
||||
|
||||
var temp = line.Substring(0, line.IndexOf('\t'));
|
||||
try
|
||||
|
@ -511,7 +522,7 @@ namespace BizHawk.Client.Common
|
|||
startIndex = line.IndexOf('\t') + 1;
|
||||
line = line.Substring(startIndex, line.Length - startIndex); // Domain
|
||||
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;
|
||||
|
@ -525,10 +536,10 @@ namespace BizHawk.Client.Common
|
|||
type,
|
||||
notes,
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{ WatchList.NOTES, 128 },
|
||||
};
|
||||
|
||||
private readonly WatchList _watches;
|
||||
private readonly IMemoryDomains Core;
|
||||
private WatchList _watches;
|
||||
private IMemoryDomains _core;
|
||||
|
||||
|
||||
private int _defaultWidth;
|
||||
|
@ -41,8 +41,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public RamWatch()
|
||||
{
|
||||
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);
|
||||
_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);
|
||||
InitializeComponent();
|
||||
WatchListView.QueryItemText += WatchListView_QueryItemText;
|
||||
WatchListView.QueryItemBkColor += WatchListView_QueryItemBkColor;
|
||||
|
@ -200,13 +200,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
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))
|
||||
{
|
||||
_watches.Reload();
|
||||
UpdateStatusBar();
|
||||
_watches.RefreshDomans(_core, _core.MemoryDomains.MainMemory);
|
||||
}
|
||||
else
|
||||
{
|
||||
_watches = new WatchList(_core, _core.MemoryDomains.MainMemory);
|
||||
NewWatchList(true);
|
||||
}
|
||||
}
|
||||
|
@ -568,7 +572,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SetMemoryDomain(string name)
|
||||
{
|
||||
_watches.Domain = Core.MemoryDomains[name];
|
||||
_watches.Domain = _core.MemoryDomains[name];
|
||||
SetPlatformAndMemoryDomainLabel();
|
||||
Update();
|
||||
}
|
||||
|
@ -749,7 +753,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
MemoryDomainsSubMenu.DropDownItems.Clear();
|
||||
MemoryDomainsSubMenu.DropDownItems.AddRange(
|
||||
Core.MemoryDomains.MenuItems(SetMemoryDomain, _watches.Domain.Name)
|
||||
_core.MemoryDomains.MenuItems(SetMemoryDomain, _watches.Domain.Name)
|
||||
.ToArray());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue