remove the IEmulator inheritance from some services, and fix code as needed
This commit is contained in:
parent
d08fb39cb8
commit
ea47246658
|
@ -71,7 +71,7 @@ namespace BizHawk.Client.Common
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
var registers = debuggable.AsDebuggable().GetCpuFlagsAndRegisters();
|
var registers = debuggable.GetCpuFlagsAndRegisters();
|
||||||
return registers.ContainsKey(name)
|
return registers.ContainsKey(name)
|
||||||
? registers[name]
|
? registers[name]
|
||||||
: 0;
|
: 0;
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace BizHawk.Client.Common
|
||||||
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;
|
||||||
|
private string _systemid;
|
||||||
|
|
||||||
public const string ADDRESS = "AddressColumn";
|
public const string ADDRESS = "AddressColumn";
|
||||||
public const string VALUE = "ValueColumn";
|
public const string VALUE = "ValueColumn";
|
||||||
|
@ -25,10 +26,11 @@ namespace BizHawk.Client.Common
|
||||||
public const string DOMAIN = "DomainColumn";
|
public const string DOMAIN = "DomainColumn";
|
||||||
public const string NOTES = "NotesColumn";
|
public const string NOTES = "NotesColumn";
|
||||||
|
|
||||||
public WatchList(IMemoryDomains core, MemoryDomain domain)
|
public WatchList(IMemoryDomains core, MemoryDomain domain, string systemid)
|
||||||
{
|
{
|
||||||
_core = core;
|
_core = core;
|
||||||
_domain = domain;
|
_domain = domain;
|
||||||
|
_systemid = systemid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshDomans(IMemoryDomains core, MemoryDomain domain)
|
public void RefreshDomans(IMemoryDomains core, MemoryDomain domain)
|
||||||
|
@ -387,7 +389,7 @@ namespace BizHawk.Client.Common
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb
|
sb
|
||||||
.Append("Domain ").AppendLine(_domain.Name)
|
.Append("Domain ").AppendLine(_domain.Name)
|
||||||
.Append("SystemID ").AppendLine(_core.SystemId);
|
.Append("SystemID ").AppendLine(_systemid);
|
||||||
|
|
||||||
foreach (var watch in _watchList)
|
foreach (var watch in _watchList)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
[RequiredService]
|
[RequiredService]
|
||||||
private IMemoryDomains Core { get; set; }
|
private IMemoryDomains Core { get; set; }
|
||||||
|
|
||||||
|
[RequiredService] // TODO: use of this property should be factored out
|
||||||
|
private IEmulator Emu { get; set; }
|
||||||
|
|
||||||
public const string NAME = "NamesColumn";
|
public const string NAME = "NamesColumn";
|
||||||
public const string ADDRESS = "AddressColumn";
|
public const string ADDRESS = "AddressColumn";
|
||||||
public const string VALUE = "ValueColumn";
|
public const string VALUE = "ValueColumn";
|
||||||
|
@ -195,11 +198,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
GameGenieToolbarSeparator.Visible =
|
GameGenieToolbarSeparator.Visible =
|
||||||
LoadGameGenieToolbarItem.Visible =
|
LoadGameGenieToolbarItem.Visible =
|
||||||
(Core.SystemId == "NES")
|
(Emu.SystemId == "NES")
|
||||||
|| (Core.SystemId == "GEN" && VersionInfo.DeveloperBuild)
|
|| (Emu.SystemId == "GEN" && VersionInfo.DeveloperBuild)
|
||||||
|| (Core.SystemId == "GB")
|
|| (Emu.SystemId == "GB")
|
||||||
|| (Global.Game.System == "GG")
|
|| (Global.Game.System == "GG")
|
||||||
|| (Core is LibsnesCore);
|
|| (Emu is LibsnesCore);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddCheat()
|
private void AddCheat()
|
||||||
|
@ -536,11 +539,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
GameGenieSeparator.Visible =
|
GameGenieSeparator.Visible =
|
||||||
OpenGameGenieEncoderDecoderMenuItem.Visible =
|
OpenGameGenieEncoderDecoderMenuItem.Visible =
|
||||||
(Core.SystemId == "NES")
|
(Emu.SystemId == "NES")
|
||||||
|| (Core is Genesis)
|
|| (Emu is Genesis)
|
||||||
|| (Core.SystemId == "GB")
|
|| (Emu.SystemId == "GB")
|
||||||
|| (Global.Game.System == "GG")
|
|| (Global.Game.System == "GG")
|
||||||
|| (Core is LibsnesCore);
|
|| (Emu is LibsnesCore);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveCheatMenuItem_Click(object sender, EventArgs e)
|
private void RemoveCheatMenuItem_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
|
||||||
public partial class BreakpointControl : UserControl
|
public partial class BreakpointControl : UserControl
|
||||||
{
|
{
|
||||||
public IDebuggable Core { get; set; }
|
public IDebuggable Core { get; set; }
|
||||||
|
public IMemoryCallbackSystem MCS { get; set; }
|
||||||
public GenericDebugger ParentDebugger { get; set; }
|
public GenericDebugger ParentDebugger { get; set; }
|
||||||
private readonly BreakpointList Breakpoints = new BreakpointList();
|
private readonly BreakpointList Breakpoints = new BreakpointList();
|
||||||
|
|
||||||
|
@ -73,9 +74,9 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
|
||||||
|
|
||||||
public void GenerateUI()
|
public void GenerateUI()
|
||||||
{
|
{
|
||||||
if (Core.MemoryCallbacksAvailable())
|
if (MCS != null)
|
||||||
{
|
{
|
||||||
foreach (var callback in Core.MemoryCallbacks)
|
foreach (var callback in MCS)
|
||||||
{
|
{
|
||||||
Breakpoints.Add(new Breakpoint(Core, callback));
|
Breakpoints.Add(new Breakpoint(Core, callback));
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private IDisassemblable Disassembler { get; set; }
|
private IDisassemblable Disassembler { get; set; }
|
||||||
[OptionalService]
|
[OptionalService]
|
||||||
private IMemoryDomains MemoryDomainSource { get; set; }
|
private IMemoryDomains MemoryDomainSource { get; set; }
|
||||||
|
[OptionalService]
|
||||||
|
private IMemoryCallbackSystem MCS { get; set; }
|
||||||
|
|
||||||
private MemoryDomainList MemoryDomains { get { return MemoryDomainSource.MemoryDomains; } }
|
private MemoryDomainList MemoryDomains { get { return MemoryDomainSource.MemoryDomains; } }
|
||||||
|
|
||||||
private int PC
|
private int PC
|
||||||
|
|
|
@ -100,8 +100,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
DropDownStyle = ComboBoxStyle.DropDownList
|
DropDownStyle = ComboBoxStyle.DropDownList
|
||||||
};
|
};
|
||||||
|
|
||||||
c.Items.AddRange(Core.AsDissassembler().AvailableCpus.ToArray());
|
c.Items.AddRange(Disassembler.AvailableCpus.ToArray());
|
||||||
c.SelectedItem = Core.AsDissassembler().Cpu;
|
c.SelectedItem = Disassembler.Cpu;
|
||||||
c.SelectedIndexChanged += OnCpuDropDownIndexChanged;
|
c.SelectedIndexChanged += OnCpuDropDownIndexChanged;
|
||||||
|
|
||||||
DisassemblerBox.Controls.Add(c);
|
DisassemblerBox.Controls.Add(c);
|
||||||
|
@ -140,6 +140,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
// TODO: handle if unavailable
|
// TODO: handle if unavailable
|
||||||
BreakPointControl1.Core = Core;
|
BreakPointControl1.Core = Core;
|
||||||
|
BreakPointControl1.MCS = MCS;
|
||||||
BreakPointControl1.ParentDebugger = this;
|
BreakPointControl1.ParentDebugger = this;
|
||||||
BreakPointControl1.GenerateUI();
|
BreakPointControl1.GenerateUI();
|
||||||
}
|
}
|
||||||
|
@ -147,8 +148,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private void DisengageDebugger()
|
private void DisengageDebugger()
|
||||||
{
|
{
|
||||||
SaveConfigSettings();
|
SaveConfigSettings();
|
||||||
|
if (Core.Tracer != null)
|
||||||
if (Core.CpuTraceAvailable())
|
|
||||||
{
|
{
|
||||||
Core.Tracer.Enabled = false;
|
Core.Tracer.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
[RequiredService]
|
[RequiredService]
|
||||||
public IMemoryDomains Core { get; private set; }
|
public IMemoryDomains Core { get; private set; }
|
||||||
|
[RequiredService]
|
||||||
|
public IEmulator Emu { get; private set; }
|
||||||
|
|
||||||
public bool AskSaveChanges()
|
public bool AskSaveChanges()
|
||||||
{
|
{
|
||||||
|
@ -839,7 +841,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_currentFileName = file.FullName;
|
_currentFileName = file.FullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
var watches = new WatchList(Core, _settings.Domain);
|
var watches = new WatchList(Core, _settings.Domain, Emu.SystemId);
|
||||||
watches.Load(file.FullName, append);
|
watches.Load(file.FullName, append);
|
||||||
|
|
||||||
var watchList = watches.Where(x => !x.IsSeparator);
|
var watchList = watches.Where(x => !x.IsSeparator);
|
||||||
|
@ -995,7 +997,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(_currentFileName))
|
if (!string.IsNullOrWhiteSpace(_currentFileName))
|
||||||
{
|
{
|
||||||
var watches = new WatchList(Core, _settings.Domain) { CurrentFileName = _currentFileName };
|
var watches = new WatchList(Core, _settings.Domain, Emu.SystemId) { CurrentFileName = _currentFileName };
|
||||||
for (var i = 0; i < _searches.Count; i++)
|
for (var i = 0; i < _searches.Count; i++)
|
||||||
{
|
{
|
||||||
watches.Add(_searches[i]);
|
watches.Add(_searches[i]);
|
||||||
|
@ -1023,7 +1025,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void SaveAsMenuItem_Click(object sender, EventArgs e)
|
private void SaveAsMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var watches = new WatchList(Core, _settings.Domain) { CurrentFileName = _currentFileName };
|
var watches = new WatchList(Core, _settings.Domain, Emu.SystemId) { CurrentFileName = _currentFileName };
|
||||||
for (var i = 0; i < _searches.Count; i++)
|
for (var i = 0; i < _searches.Count; i++)
|
||||||
{
|
{
|
||||||
watches.Add(_searches[i]);
|
watches.Add(_searches[i]);
|
||||||
|
|
|
@ -39,6 +39,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
[RequiredService]
|
[RequiredService]
|
||||||
private IMemoryDomains _core { get; set; }
|
private IMemoryDomains _core { get; set; }
|
||||||
|
[RequiredService]
|
||||||
|
private IEmulator _emu { get; set; }
|
||||||
|
|
||||||
public RamWatch()
|
public RamWatch()
|
||||||
{
|
{
|
||||||
|
@ -203,7 +205,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_watches = new WatchList(_core, _core.MemoryDomains.MainMemory);
|
_watches = new WatchList(_core, _core.MemoryDomains.MainMemory, _emu.SystemId);
|
||||||
NewWatchList(true);
|
NewWatchList(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -572,7 +574,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void SetPlatformAndMemoryDomainLabel()
|
private void SetPlatformAndMemoryDomainLabel()
|
||||||
{
|
{
|
||||||
MemDomainLabel.Text = _core.SystemId + " " + _watches.Domain.Name;
|
MemDomainLabel.Text = _emu.SystemId + " " + _watches.Domain.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateStatusBar(bool saved = false)
|
private void UpdateStatusBar(bool saved = false)
|
||||||
|
@ -1076,7 +1078,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void NewRamWatch_Load(object sender, EventArgs e)
|
private void NewRamWatch_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_watches = new WatchList(_core, _core.MemoryDomains.MainMemory);
|
_watches = new WatchList(_core, _core.MemoryDomains.MainMemory, _emu.SystemId);
|
||||||
LoadConfigSettings();
|
LoadConfigSettings();
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
|
||||||
return (CoreAttributes)Attribute.GetCustomAttribute(core.GetType(), typeof(CoreAttributes));
|
return (CoreAttributes)Attribute.GetCustomAttribute(core.GetType(), typeof(CoreAttributes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo: most of the special cases involving the NullEmulator should probably go away
|
||||||
public static bool IsNull(this IEmulator core)
|
public static bool IsNull(this IEmulator core)
|
||||||
{
|
{
|
||||||
return core == null || core is NullEmulator;
|
return core == null || core is NullEmulator;
|
||||||
|
@ -169,7 +170,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
|
||||||
|
|
||||||
public static IDisassemblable AsDissassembler(this IEmulator core)
|
public static IDisassemblable AsDissassembler(this IEmulator core)
|
||||||
{
|
{
|
||||||
return (IDisassemblable)core.ServiceProvider.GetService<IDisassemblable>();
|
return (IDisassemblable)core.ServiceProvider.GetService<IDisassemblable>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: a better place for these
|
// TODO: a better place for these
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Common
|
namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
public interface IDebuggable : IEmulator, IEmulatorService
|
public interface IDebuggable : IEmulatorService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a list of Cpu registers and their current state
|
/// Returns a list of Cpu registers and their current state
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace BizHawk.Emulation.Common
|
namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
public interface IMemoryDomains : IEmulator, IEmulatorService
|
public interface IMemoryDomains : IEmulatorService
|
||||||
{
|
{
|
||||||
///The list of all avaialble memory domains
|
///The list of all avaialble memory domains
|
||||||
/// A memory domain is a byte array that respresents a distinct part of the emulated system.
|
/// A memory domain is a byte array that respresents a distinct part of the emulated system.
|
||||||
|
|
Loading…
Reference in New Issue