diff --git a/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj b/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj index 99206673d3..ccf03881ab 100644 --- a/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj +++ b/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj @@ -72,6 +72,7 @@ + diff --git a/BizHawk.Emulation.Common/Extensions.cs b/BizHawk.Emulation.Common/Extensions.cs index b7ddf5d46f..eaa3765c2e 100644 --- a/BizHawk.Emulation.Common/Extensions.cs +++ b/BizHawk.Emulation.Common/Extensions.cs @@ -157,6 +157,21 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions return false; } + public static bool CanDisassemble(this IEmulator core) + { + if (core == null) + { + return false; + } + + return core.ServiceProvider.HasService(); + } + + public static IDisassemblable AsDissassembler(this IEmulator core) + { + return (IDisassemblable)core.ServiceProvider.GetService(); + } + // TODO: a better place for these public static bool IsImplemented(this MethodInfo info) { diff --git a/BizHawk.Emulation.Common/Interfaces/IDisassemblable.cs b/BizHawk.Emulation.Common/Interfaces/IDisassemblable.cs new file mode 100644 index 0000000000..29067ad9ab --- /dev/null +++ b/BizHawk.Emulation.Common/Interfaces/IDisassemblable.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace BizHawk.Emulation.Common +{ + public interface IDisassemblable : IEmulator, IEmulatorService + { + /// + /// Gets or sets the Cpu that will be used to disassemble + /// Only values returned from AvailableCpus will be supported when Set + /// + string Cpu { get; set; } + + /// + /// Gets a list of Cpus that can be used when setting the Cpu property + /// + IEnumerable AvailableCpus { get; set; } + + /// + /// returns a disassembly starting at addr lasting for length, using the given domain + /// + string Disassemble(MemoryDomain m, uint addr, out int length); + } +}