diff --git a/BizHawk.Client.EmuHawk/ToolAttribute.cs b/BizHawk.Client.EmuHawk/ToolAttribute.cs index 1ba2a2c1ef..721fa0cf48 100644 --- a/BizHawk.Client.EmuHawk/ToolAttribute.cs +++ b/BizHawk.Client.EmuHawk/ToolAttribute.cs @@ -6,14 +6,17 @@ namespace BizHawk.Client.EmuHawk [AttributeUsage(AttributeTargets.Class)] public class ToolAttribute : Attribute { - public ToolAttribute(bool released, string[] supportedSystems) + public ToolAttribute(bool released, string[] supportedSystems, string[] unsupportedCores = null) { Released = released; SupportedSystems = supportedSystems; + UnsupportedCores = unsupportedCores; } public bool Released { get; private set; } public IEnumerable SupportedSystems { get; private set; } + + public IEnumerable UnsupportedCores { get; private set; } } } diff --git a/BizHawk.Client.EmuHawk/tools/GameShark.cs b/BizHawk.Client.EmuHawk/tools/GameShark.cs index ffd91c12fb..027630daf2 100644 --- a/BizHawk.Client.EmuHawk/tools/GameShark.cs +++ b/BizHawk.Client.EmuHawk/tools/GameShark.cs @@ -20,7 +20,8 @@ namespace BizHawk.Client.EmuHawk //Verify all wording in the error reports - [Tool(released: true, supportedSystems: new[] { "GB", "GBA", "GEN", "N64", "NES", "PSX", "SAT", "SMS", "SNES" })] + [Tool(released: true, supportedSystems: new[] { "GB", "GBA", "GEN", "N64", "NES", "PSX", "SAT", "SMS", "SNES" }, + unsupportedCores: new[] { "Snes9x" })] public partial class GameShark : Form, IToolForm, IToolFormAutoConfig { #region " Game Genie Dictionary " diff --git a/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/BizHawk.Client.EmuHawk/tools/ToolManager.cs index 1a95aba1fe..681ce8ec49 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolManager.cs +++ b/BizHawk.Client.EmuHawk/tools/ToolManager.cs @@ -10,6 +10,7 @@ using System.Windows.Forms; using BizHawk.Client.Common; using BizHawk.Emulation.Common; using BizHawk.Common.ReflectionExtensions; +using BizHawk.Client.EmuHawk.CoreExtensions; namespace BizHawk.Client.EmuHawk { @@ -743,13 +744,30 @@ namespace BizHawk.Client.EmuHawk .OfType() .FirstOrDefault(); - // If no supported systems mentioned assume all - if (attr?.SupportedSystems != null && attr.SupportedSystems.Any()) + // start with the assumption that if no supported systems are mentioned and no unsupported cores are mentioned + // then this is available for all + bool supported = true; + + if (attr?.SupportedSystems != null && attr.SupportedSystems.Any()) { - return attr.SupportedSystems.Contains(Global.Emulator.SystemId); - } + // supported systems are available + supported = attr.SupportedSystems.Contains(Global.Emulator.SystemId); - return true; + if (supported) + { + // check for a core not supported override + if (attr.UnsupportedCores.Contains(Global.Emulator.DisplayName())) + supported = false; + } + } + else if (attr?.UnsupportedCores != null && attr.UnsupportedCores.Any()) + { + // no supported system specified, but unsupported cores are + if (attr.UnsupportedCores.Contains(Global.Emulator.DisplayName())) + supported = false; + } + + return supported; } // Note: Referencing these properties creates an instance of the tool and persists it. They should be referenced by type if this is not desired @@ -973,7 +991,7 @@ namespace BizHawk.Client.EmuHawk public void LoadGameGenieEc() { if (GlobalWin.Tools.IsAvailable()) - { + { GlobalWin.Tools.Load(); } }