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