Add an IDisassemblable emulator service, currently no core implements it, just the interface and the IEmulator extensions

This commit is contained in:
adelikat 2014-12-13 20:52:52 +00:00
parent 6933d5ee56
commit 9a7715009a
3 changed files with 39 additions and 0 deletions

View File

@ -72,6 +72,7 @@
<Compile Include="Interfaces\IController.cs" />
<Compile Include="Interfaces\ICoreFileProvider.cs" />
<Compile Include="Interfaces\IDebuggable.cs" />
<Compile Include="Interfaces\IDisassemblable.cs" />
<Compile Include="Interfaces\IDriveLight.cs" />
<Compile Include="Interfaces\IEmulator.cs" />
<Compile Include="Interfaces\IEmulatorService.cs" />

View File

@ -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<IDisassemblable>();
}
public static IDisassemblable AsDissassembler(this IEmulator core)
{
return (IDisassemblable)core.ServiceProvider.GetService<IDisassemblable>();
}
// TODO: a better place for these
public static bool IsImplemented(this MethodInfo info)
{

View File

@ -0,0 +1,23 @@
using System.Collections.Generic;
namespace BizHawk.Emulation.Common
{
public interface IDisassemblable : IEmulator, IEmulatorService
{
/// <summary>
/// Gets or sets the Cpu that will be used to disassemble
/// Only values returned from AvailableCpus will be supported when Set
/// </summary>
string Cpu { get; set; }
/// <summary>
/// Gets a list of Cpus that can be used when setting the Cpu property
/// </summary>
IEnumerable<string> AvailableCpus { get; set; }
/// <summary>
/// returns a disassembly starting at addr lasting for length, using the given domain
/// </summary>
string Disassemble(MemoryDomain m, uint addr, out int length);
}
}