From 4582a8879849675682c73f2bd70da658231ed45a Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 23 Nov 2014 20:30:53 +0000 Subject: [PATCH] Add an ICoreService interface that interfaces such as IEmulator and IDebuggable inherit --- .../BizHawk.Emulation.Common.csproj | 1 + BizHawk.Emulation.Common/Interfaces/ICoreService.cs | 11 +++++++++++ BizHawk.Emulation.Common/Interfaces/IDebuggable.cs | 2 +- BizHawk.Emulation.Common/Interfaces/IEmulator.cs | 2 +- BizHawk.Emulation.Common/Interfaces/IMemoryDomains.cs | 2 +- BizHawk.Emulation.Common/Interfaces/ISettable.cs | 2 +- 6 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 BizHawk.Emulation.Common/Interfaces/ICoreService.cs diff --git a/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj b/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj index 49205b8875..9cac77e364 100644 --- a/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj +++ b/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj @@ -61,6 +61,7 @@ + diff --git a/BizHawk.Emulation.Common/Interfaces/ICoreService.cs b/BizHawk.Emulation.Common/Interfaces/ICoreService.cs new file mode 100644 index 0000000000..720db94a1a --- /dev/null +++ b/BizHawk.Emulation.Common/Interfaces/ICoreService.cs @@ -0,0 +1,11 @@ +namespace BizHawk.Emulation.Common +{ + /// + /// This interface specifies that an interface or implementation is a emulator core service, such as IDebuggable, + /// but is an optional part of the core functionality + /// Clients should gracefully handle an IEmulator that has a missing or partial implementation of one of these services + /// + public interface ICoreService + { + } +} diff --git a/BizHawk.Emulation.Common/Interfaces/IDebuggable.cs b/BizHawk.Emulation.Common/Interfaces/IDebuggable.cs index c7fb7c8466..8c49765ac6 100644 --- a/BizHawk.Emulation.Common/Interfaces/IDebuggable.cs +++ b/BizHawk.Emulation.Common/Interfaces/IDebuggable.cs @@ -2,7 +2,7 @@ namespace BizHawk.Emulation.Common { - public interface IDebuggable : IEmulator + public interface IDebuggable : IEmulator, ICoreService { /// /// Returns a list of Cpu registers and their current state diff --git a/BizHawk.Emulation.Common/Interfaces/IEmulator.cs b/BizHawk.Emulation.Common/Interfaces/IEmulator.cs index 3bc1da923f..19182b0757 100644 --- a/BizHawk.Emulation.Common/Interfaces/IEmulator.cs +++ b/BizHawk.Emulation.Common/Interfaces/IEmulator.cs @@ -4,7 +4,7 @@ using System.IO; namespace BizHawk.Emulation.Common { - public interface IEmulator : IDisposable + public interface IEmulator : ICoreService, IDisposable { /// /// Video provider to the client diff --git a/BizHawk.Emulation.Common/Interfaces/IMemoryDomains.cs b/BizHawk.Emulation.Common/Interfaces/IMemoryDomains.cs index 89e1a80d1a..748618e6f9 100644 --- a/BizHawk.Emulation.Common/Interfaces/IMemoryDomains.cs +++ b/BizHawk.Emulation.Common/Interfaces/IMemoryDomains.cs @@ -1,6 +1,6 @@ namespace BizHawk.Emulation.Common { - public interface IMemoryDomains : IEmulator + public interface IMemoryDomains : IEmulator, ICoreService { ///The list of all avaialble memory domains /// A memory domain is a byte array that respresents a distinct part of the emulated system. diff --git a/BizHawk.Emulation.Common/Interfaces/ISettable.cs b/BizHawk.Emulation.Common/Interfaces/ISettable.cs index 55ec10a41f..cd60d85e6e 100644 --- a/BizHawk.Emulation.Common/Interfaces/ISettable.cs +++ b/BizHawk.Emulation.Common/Interfaces/ISettable.cs @@ -87,7 +87,7 @@ namespace BizHawk.Emulation.Common } } - public interface ISettable : IEmulator + public interface ISettable : IEmulator, ICoreService { // in addition to these methods, it's expected that the constructor or Load() method // will take a Settings and SyncSettings object to set the initial state of the core