From 768905b2dbf31bcc02824f6543a5e9b5a01222b0 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 28 Feb 2016 14:06:11 -0500 Subject: [PATCH] Make an ISpecializedEmulatorService interface to show the intent of certain interfaces. In the core feature analysis, don't show these are unimplemented, as they aren't expected to be implemented by all cores. Make ILinkable inherit this interface. Also check in ILinkable, I forgot to do that last time --- BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs | 12 ++++++------ .../Interfaces/IEmulatorService.cs | 8 ++++++++ BizHawk.Emulation.Common/Interfaces/ILinkable.cs | 10 ++++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 BizHawk.Emulation.Common/Interfaces/ILinkable.cs diff --git a/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs b/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs index 8ddfc9542c..f92d5e6417 100644 --- a/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs +++ b/BizHawk.Client.EmuHawk/CoreFeatureAnalysis.cs @@ -169,19 +169,19 @@ namespace BizHawk.Client.EmuHawk .GetTypes() .Where(t => typeof(IEmulatorService).IsAssignableFrom(t)) .Where(t => t != typeof(IEmulatorService)) - .Where(t => t.IsInterface) - .Select(t => t.ToString()); + .Where(t => t.IsInterface); var additionalServices = knownServies - .Where(s => !ci.Services.ContainsKey(s)) - .Where(s => !ci.NotApplicableTypes.Contains(s)); + .Where(t => !ci.Services.ContainsKey(t.ToString())) + .Where(t => !ci.NotApplicableTypes.Contains(t.ToString())) + .Where(t => !typeof(ISpecializedEmulatorService).IsAssignableFrom(t)); // We don't want to show these as unimplemented, they aren't expected services - foreach (string servicename in additionalServices) + foreach (Type service in additionalServices) { string img = "Bad"; var serviceNode = new TreeNode { - Text = servicename, + Text = service.ToString(), ForeColor = Color.Red, ImageKey = img, SelectedImageKey = img, diff --git a/BizHawk.Emulation.Common/Interfaces/IEmulatorService.cs b/BizHawk.Emulation.Common/Interfaces/IEmulatorService.cs index 5de00c7d3b..0b9dd2fc44 100644 --- a/BizHawk.Emulation.Common/Interfaces/IEmulatorService.cs +++ b/BizHawk.Emulation.Common/Interfaces/IEmulatorService.cs @@ -22,6 +22,14 @@ namespace BizHawk.Emulation.Common public FeatureNotImplemented() { } } + /// + /// This represents a service that would not apply to every core, instead it is a specialized service specific to a core or group of cores + /// This service is merely intended to define semantics and expectations of a service + /// + public interface ISpecializedEmulatorService : IEmulatorService + { + } + [AttributeUsage(AttributeTargets.Class)] public class ServiceNotApplicable : Attribute { diff --git a/BizHawk.Emulation.Common/Interfaces/ILinkable.cs b/BizHawk.Emulation.Common/Interfaces/ILinkable.cs new file mode 100644 index 0000000000..a2e9f3e8d3 --- /dev/null +++ b/BizHawk.Emulation.Common/Interfaces/ILinkable.cs @@ -0,0 +1,10 @@ +namespace BizHawk.Emulation.Common +{ + public interface ILinkable : ISpecializedEmulatorService + { + /// + /// Whether or not the link cable is currently connected + /// + bool LinkConnected { get; } + } +}