Follow attribute class best practices, cleanup docs on attributes

This commit is contained in:
YoshiRulz 2020-02-19 01:10:24 +10:00
parent 0ff2539da7
commit 3afcf416e8
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
50 changed files with 127 additions and 130 deletions

View File

@ -122,23 +122,15 @@ namespace BizHawk.BizInvoke
}
}
/// <summary>
/// mark an instance method to be exported by BizExvoker
/// </summary>
/// <summary>Indicates that a method is to be exported by BizExvoker.</summary>
[AttributeUsage(AttributeTargets.Method)]
public class BizExportAttribute : Attribute
public sealed class BizExportAttribute : Attribute
{
public CallingConvention CallingConvention { get; }
/// <summary>
/// Gets or sets the name of entry point; if not given, the method's name is used
/// </summary>
/// <remarks>The annotated method's name is used iff <see langword="null"/>.</remarks>
public string EntryPoint { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="BizImportAttribute"/> class.
/// </summary>
/// <param name="c">unmanaged calling convention</param>
public BizExportAttribute(CallingConvention c)
{
CallingConvention = c;

View File

@ -537,28 +537,18 @@ namespace BizHawk.BizInvoke
}
}
/// <summary>
/// mark an abstract method to be proxied by BizInvoker
/// </summary>
/// <summary>Indicates that an abstract method is to be proxied by BizInvoker.</summary>
[AttributeUsage(AttributeTargets.Method)]
public class BizImportAttribute : Attribute
public sealed class BizImportAttribute : Attribute
{
public CallingConvention CallingConvention { get; }
/// <summary>
/// Gets or sets the name of entry point; if not given, the method's name is used
/// </summary>
/// <remarks>The annotated method's name is used iff <see langword="null"/>.</remarks>
public string EntryPoint { get; set; }
/// <summary>
/// Gets or sets a value indicating whether or not to use a slower interop that supports more argument types
/// </summary>
/// <summary><see langword="true"/> iff a compatibility interop should be used, which is slower but supports more argument types.</summary>
public bool Compatibility { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="BizImportAttribute"/> class.
/// </summary>
/// <param name="c">unmanaged calling convention</param>
public BizImportAttribute(CallingConvention c)
{
CallingConvention = c;

View File

@ -68,12 +68,12 @@ namespace BizHawk.Client.ApiHawk
}
[AttributeUsage(AttributeTargets.Property)]
public class RequiredApiAttribute : Attribute
public sealed class RequiredApiAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property)]
public class OptionalApiAttribute : Attribute
public sealed class OptionalApiAttribute : Attribute
{
}
}

View File

@ -96,13 +96,12 @@ namespace BizHawk.Client.Common
[AttributeUsage(AttributeTargets.Class)]
public sealed class ExternalToolAttribute : Attribute
{
public readonly string Description;
public string Description { get; set; }
public readonly string Name;
public ExternalToolAttribute(string name, string description = null)
public ExternalToolAttribute(string name)
{
Description = description;
Name = string.IsNullOrWhiteSpace(name) ? Guid.NewGuid().ToString() : name;
}

View File

@ -69,7 +69,7 @@ namespace BizHawk.Client.Common
public static BinaryStateLump BranchUserText { get; private set; }
[AttributeUsage(AttributeTargets.Property)]
private class NameAttribute : Attribute
private sealed class NameAttribute : Attribute
{
public string Name { get; }
public string Ext { get; }

View File

@ -2,11 +2,9 @@
namespace BizHawk.Client.Common
{
/// <summary>
/// Define if the property has to be persisted in config
/// </summary>
/// <summary>Indicates that a property is to be saved to config for persistence.</summary>
[AttributeUsage(AttributeTargets.Property)]
public class ConfigPersistAttribute : Attribute
public sealed class ConfigPersistAttribute : Attribute
{
}
}

View File

@ -2,11 +2,10 @@
namespace BizHawk.Client.Common
{
/// <summary>
/// Defines a method to be called when a tool dialog's Restore Defaults method is called
/// </summary>
/// <summary>Indicates which method of an <see cref="IToolFormAutoConfig"/> is to be called when the generated <c>Restore Defaults</c> menu item is clicked.</summary>
/// <remarks>If not present on any instance method, the menu item will do nothing. If present on multiple, the first will be called.</remarks>
[AttributeUsage(AttributeTargets.Method)]
public class RestoreDefaultsAttribute : Attribute
public sealed class RestoreDefaultsAttribute : Attribute
{
}
}

View File

@ -3,7 +3,7 @@
namespace BizHawk.Client.Common
{
[AttributeUsage(AttributeTargets.Method)]
public class LuaMethodAttribute : Attribute
public sealed class LuaMethodAttribute : Attribute
{
public LuaMethodAttribute(string name, string description)
{
@ -16,7 +16,7 @@ namespace BizHawk.Client.Common
}
[AttributeUsage(AttributeTargets.Method)]
public class LuaMethodExampleAttribute : Attribute
public sealed class LuaMethodExampleAttribute : Attribute
{
public LuaMethodExampleAttribute(string example)
{
@ -27,7 +27,7 @@ namespace BizHawk.Client.Common
}
[AttributeUsage(AttributeTargets.Class)]
public class LuaLibraryAttribute : Attribute
public sealed class LuaLibraryAttribute : Attribute
{
public LuaLibraryAttribute(bool released)
{

View File

@ -101,7 +101,7 @@ namespace BizHawk.Client.Common
}
[AttributeUsage(AttributeTargets.Class)]
public class ImporterForAttribute : Attribute
public sealed class ImporterForAttribute : Attribute
{
public ImporterForAttribute(string emulator, string extension)
{

View File

@ -99,7 +99,7 @@ namespace BizHawk.Client.EmuHawk
}
[AttributeUsage(AttributeTargets.Class)]
public class VideoWriterAttribute : Attribute
public sealed class VideoWriterAttribute : Attribute
{
public string ShortName { get; }
public string Name { get; }
@ -114,7 +114,7 @@ namespace BizHawk.Client.EmuHawk
}
[AttributeUsage(AttributeTargets.Class)]
public class VideoWriterIgnoreAttribute : Attribute
public sealed class VideoWriterIgnoreAttribute : Attribute
{
}

View File

@ -5,15 +5,17 @@ using System.Linq;
namespace BizHawk.Client.EmuHawk
{
[AttributeUsage(AttributeTargets.Class)]
public class ToolAttribute : Attribute
public sealed class ToolAttribute : Attribute
{
public ToolAttribute(bool released, string[] supportedSystems, string[] unsupportedCores = null)
public ToolAttribute(bool released, string[] supportedSystems, string[] unsupportedCores)
{
Released = released;
SupportedSystems = supportedSystems ?? Enumerable.Empty<string>();
UnsupportedCores = unsupportedCores ?? Enumerable.Empty<string>();
}
public ToolAttribute(bool released, string[] supportedSystems) : this(released, supportedSystems, null) {}
public bool Released { get; }
public IEnumerable<string> SupportedSystems { get; }

View File

@ -3,11 +3,8 @@
namespace BizHawk.Client.EmuHawk
{
[AttributeUsage(AttributeTargets.Class)]
public class SchemaAttribute : Attribute
public sealed class SchemaAttribute : Attribute
{
/// <summary>
/// Gets the system id associated with this schema
/// </summary>
public string SystemId { get; }
public SchemaAttribute(string systemId)

View File

@ -7,11 +7,9 @@ using System.Reflection;
namespace BizHawk.Common
{
/// <summary>
/// causes DeepEquality to ignore this field when determining equality
/// </summary>
/// <summary>Annotated fields will not be used by <see cref="DeepEquality"/> for comparison.</summary>
[AttributeUsage(AttributeTargets.Field)]
public class DeepEqualsIgnoreAttribute : Attribute
public sealed class DeepEqualsIgnoreAttribute : Attribute
{
}

View File

@ -1,8 +1,21 @@
namespace BizHawk.Emulation.Common
{
[Core("NullHawk", "", false, true)]
[ServiceNotApplicable(typeof(IStatable), typeof(ISaveRam), typeof(IDriveLight), typeof(ICodeDataLogger), typeof(IMemoryDomains), typeof(ISettable<,>),
typeof(IDebuggable), typeof(IDisassemblable), typeof(IInputPollable), typeof(IRegionable), typeof(ITraceable), typeof(IBoardInfo), typeof(ISoundProvider))]
[ServiceNotApplicable(new[] {
typeof(IBoardInfo),
typeof(ICodeDataLogger),
typeof(IDebuggable),
typeof(IDisassemblable),
typeof(IDriveLight),
typeof(IInputPollable),
typeof(IMemoryDomains),
typeof(IRegionable),
typeof(ISaveRam),
typeof(ISettable<,>),
typeof(ISoundProvider),
typeof(IStatable),
typeof(ITraceable)
})]
public class NullEmulator : IEmulator, IVideoProvider
{
private readonly int[] _frameBuffer = new int[NullVideo.DefaultWidth * NullVideo.DefaultHeight];

View File

@ -3,26 +3,22 @@
namespace BizHawk.Emulation.Common
{
[AttributeUsage(AttributeTargets.Class)]
public class CoreAttribute : Attribute
public sealed class CoreAttribute : Attribute
{
public CoreAttribute(
string name,
string author,
bool isPorted = false,
bool isReleased = false,
string portedVersion = "",
string portedUrl = "",
bool singleInstance = false)
public CoreAttribute(string name, string author, bool isPorted, bool isReleased, string portedVersion, string portedUrl, bool singleInstance)
{
CoreName = name;
Author = author;
Ported = isPorted;
Released = isReleased;
PortedVersion = portedVersion;
PortedUrl = portedUrl;
PortedVersion = portedVersion ?? string.Empty;
PortedUrl = portedUrl ?? string.Empty;
SingleInstance = singleInstance;
}
public CoreAttribute(string name, string author, bool isPorted, bool isReleased)
: this(name, author, isPorted, isReleased, null, null, false) {}
public string CoreName { get; }
public string Author { get; }
public bool Ported { get; }

View File

@ -4,26 +4,27 @@ using System.Linq;
namespace BizHawk.Emulation.Common
{
/// <summary>
/// Should be added to any field of an IEmulatorService that is not implemented.
/// By Convention it should also throw a NotImplementedException
/// Any feature that does not have this attribute is assumed to be implemented
/// </summary>
public class FeatureNotImplementedAttribute : Attribute
/// <summary>Indicates that a method (or property getter/setter) inherited from a <see cref="IEmulatorService"/> has yet to be implemented.</summary>
/// <remarks>
/// By convention, calling a method with this attribute should throw a <see cref="NotImplementedException"/>.
/// If this attribute is not present on an implementation, it is assumed that the method is implemented and working.
/// </remarks>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)]
public sealed class FeatureNotImplementedAttribute : Attribute
{
}
/// <summary>
/// Should be added to any implementation of IEmulator to document any
/// IEmulatorService (that is not an ISpecializedEmulatorService) that
/// by design, will not be implemented by the core
/// Any service that is unimplemented and not marked with this attribute is
/// assumed to be a "TODO" that needs to be done but hasn't been done yet
/// </summary>
/// <summary>Indicates that a class intentionally does not inherit from the specified <see cref="IEmulatorService">IEmulatorServices</see>, and will never do so.</summary>
/// <remarks>
/// <see cref="ISpecializedEmulatorService">ISpecializedEmulatorServices</see> that a core doesn't implement should not be listed, as the semantic of only being applicable to some cores is already clear.<br/>
/// Any <see cref="IEmulatorService"/> which isn't specified and is also not implemented is assumed to be a work-in-progress.
/// These should be implemented as soon as possible, simply throwing a <see cref="NotImplementedException"/> on call, and should be annotated with <see cref="FeatureNotImplementedAttribute"/>.
/// </remarks>
[AttributeUsage(AttributeTargets.Class)]
public class ServiceNotApplicableAttribute : Attribute
public sealed class ServiceNotApplicableAttribute : Attribute
{
public ServiceNotApplicableAttribute(params Type[] types)
/// <remarks>TODO neither array nor <see cref="IEnumerable{T}"/> is the correct collection to be using here, try <see cref="IReadOnlyList{T}"/>/<see cref="IReadOnlyCollection{T}"/> instead</remarks>
public ServiceNotApplicableAttribute(Type[] types)
{
NotApplicableTypes = types?.AsEnumerable() ?? Enumerable.Empty<Type>();
}

View File

@ -68,12 +68,12 @@ namespace BizHawk.Emulation.Common
}
[AttributeUsage(AttributeTargets.Property)]
public class RequiredServiceAttribute : Attribute
public sealed class RequiredServiceAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property)]
public class OptionalServiceAttribute : Attribute
public sealed class OptionalServiceAttribute : Attribute
{
}
}

View File

@ -15,6 +15,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
name: "MAME",
author: "MAMEDev",
isPorted: true,
isReleased: false,
portedVersion: "0.217",
portedUrl: "https://github.com/mamedev/mame.git",
singleInstance: false)]

View File

@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.Calculators
"zeromus",
isPorted: false,
isReleased: true)]
[ServiceNotApplicable(typeof(ISoundProvider), typeof(ISaveRam), typeof(IRegionable), typeof(IDriveLight), typeof(IBoardInfo))]
[ServiceNotApplicable(new[] { typeof(IBoardInfo), typeof(IDriveLight), typeof(IRegionable), typeof(ISaveRam), typeof(ISoundProvider) })]
public partial class TI83 : IEmulator, IVideoProvider, IDebuggable, IInputPollable, ISettable<TI83.TI83Settings, object>
{
[CoreConstructor("TI83")]

View File

@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
"fool",
isPorted: true,
isReleased: true)]
[ServiceNotApplicable(typeof(ISaveRam), typeof(IRegionable), typeof(IBoardInfo))]
[ServiceNotApplicable(new[] { typeof(IBoardInfo), typeof(IRegionable), typeof(ISaveRam) })]
public partial class AppleII : IEmulator, ISoundProvider, IVideoProvider, IStatable, IDriveLight
{
static AppleII()

View File

@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
"",
isPorted: false,
isReleased: false)]
[ServiceNotApplicable(typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class MSX : IEmulator, IVideoProvider, ISoundProvider, ISaveRam, IInputPollable, IRegionable, ISettable<MSX.MSXSettings, MSX.MSXSyncSettings>
{
[CoreConstructor("MSX")]

View File

@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
"Micro500, Alyosha, adelikat, natt",
isPorted: false,
isReleased: true)]
[ServiceNotApplicable(typeof(ISaveRam), typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight), typeof(ISaveRam) })]
public partial class Atari2600 : IEmulator, IDebuggable, IInputPollable, IBoardInfo,
IRegionable, ICreateGameDBEntries, ISettable<Atari2600.A2600Settings, Atari2600.A2600SyncSettings>
{

View File

@ -12,7 +12,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
"",
isPorted: false,
isReleased: true)]
[ServiceNotApplicable(typeof(ISettable<,>), typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight), typeof(ISettable<,>) })]
public partial class A7800Hawk : IEmulator, ISaveRam, IDebuggable, IInputPollable,
IRegionable, IBoardInfo, ISettable<A7800Hawk.A7800Settings, A7800Hawk.A7800SyncSettings>
{

View File

@ -6,8 +6,8 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Atari.Lynx
{
[Core("Handy", "K. Wilkins, Mednafen Team", true, true, "mednafen 0-9-34-1", "http://mednafen.sourceforge.net/")]
[ServiceNotApplicable(typeof(ISettable<,>), typeof(IDriveLight), typeof(IRegionable))]
[Core("Handy", "K. Wilkins, Mednafen Team", true, true, "mednafen 0-9-34-1", "http://mednafen.sourceforge.net/", false)]
[ServiceNotApplicable(new[] { typeof(IDriveLight), typeof(IRegionable), typeof(ISettable<,>) })]
public partial class Lynx : IEmulator, IVideoProvider, ISoundProvider, ISaveRam, IStatable, IInputPollable
{
[CoreConstructor("Lynx")]

View File

@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
"Vecna",
isPorted: false,
isReleased: true)]
[ServiceNotApplicable(typeof(ISaveRam), typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight), typeof(ISaveRam) })]
public sealed partial class ColecoVision : IEmulator, IDebuggable, IInputPollable, ISettable<ColecoVision.ColecoSettings, ColecoVision.ColecoSyncSettings>
{
[CoreConstructor("Coleco")]

View File

@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
"Asnivor",
isPorted: false,
isReleased: false)]
[ServiceNotApplicable(typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class ChannelF
{
public ChannelF(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)

View File

@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
"",
isPorted: false,
isReleased: true)]
[ServiceNotApplicable(typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class VectrexHawk : IEmulator, ISaveRam, IDebuggable, IInputPollable, IRegionable,
ISettable<VectrexHawk.VectrexSettings, VectrexHawk.VectrexSyncSettings>
{

View File

@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
"BrandonE, Alyosha",
isPorted: false,
isReleased: true)]
[ServiceNotApplicable(typeof(ISaveRam), typeof(IDriveLight), typeof(IRegionable))]
[ServiceNotApplicable(new[] { typeof(IDriveLight), typeof(IRegionable), typeof(ISaveRam) })]
public sealed partial class Intellivision : IEmulator, IInputPollable, IDisassemblable,
IBoardInfo, IDebuggable, ISettable<Intellivision.IntvSettings, Intellivision.IntvSyncSettings>
{

View File

@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
"",
isPorted: false,
isReleased: false)]
[ServiceNotApplicable(typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class O2Hawk : IEmulator, ISaveRam, IDebuggable, IInputPollable, IRegionable, ISettable<O2Hawk.O2Settings, O2Hawk.O2SyncSettings>
{
// memory domains

View File

@ -5,7 +5,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
[Core("mGBA", "endrift", true, true, "0.8", "https://mgba.io/", false)]
[ServiceNotApplicable(typeof(IDriveLight), typeof(IRegionable))]
[ServiceNotApplicable(new[] { typeof(IDriveLight), typeof(IRegionable) })]
public partial class MGBAHawk : IEmulator, IVideoProvider, ISoundProvider, IGBAGPUViewable,
ISaveRam, IStatable, IInputPollable, ISettable<MGBAHawk.Settings, MGBAHawk.SyncSettings>,
IDebuggable

View File

@ -7,8 +7,8 @@ using BizHawk.Emulation.Cores.Components.ARM;
namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
[Core("VBA-Next", "many authors", true, true, "cd508312a29ed8c29dacac1b11c2dce56c338a54", "https://github.com/libretro/vba-next")]
[ServiceNotApplicable(typeof(IDriveLight), typeof(IRegionable))]
[Core("VBA-Next", "many authors", true, true, "cd508312a29ed8c29dacac1b11c2dce56c338a54", "https://github.com/libretro/vba-next", false)]
[ServiceNotApplicable(new[] { typeof(IDriveLight), typeof(IRegionable) })]
public partial class VBANext : IEmulator, IVideoProvider, ISoundProvider, IInputPollable,
IGBAGPUViewable, ISaveRam, IStatable, IDebuggable, ISettable<object, VBANext.SyncSettings>
{

View File

@ -14,7 +14,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
"",
isPorted: false,
isReleased: true)]
[ServiceNotApplicable(typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class GBHawk : IEmulator, ISaveRam, IDebuggable, IInputPollable, IRegionable, IGameboyCommon,
ISettable<GBHawk.GBSettings, GBHawk.GBSyncSettings>
{
@ -84,7 +84,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
private static byte[] GBA_override = { 0xFF, 0x00, 0xCD, 0x03, 0x35, 0xAA, 0x31, 0x90, 0x94, 0x00, 0x00, 0x00, 0x00 };
[CoreConstructor("GB", "GBC")]
[CoreConstructor(new[] { "GB", "GBC" })]
public GBHawk(CoreComm comm, GameInfo game, byte[] rom, /*string gameDbFn,*/ object settings, object syncSettings)
{
var ser = new BasicServiceProvider(this);

View File

@ -7,7 +7,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
"",
isPorted: false,
isReleased: true)]
[ServiceNotApplicable(typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class GBHawkLink : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IRegionable, ILinkable,
ISettable<GBHawkLink.GBLinkSettings, GBHawkLink.GBLinkSyncSettings>
{

View File

@ -7,7 +7,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
"",
isPorted: false,
isReleased: true)]
[ServiceNotApplicable(typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class GBHawkLink3x : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IRegionable,
ISettable<GBHawkLink3x.GBLink3xSettings, GBHawkLink3x.GBLink3xSyncSettings>
{

View File

@ -7,7 +7,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink4x
"",
isPorted: false,
isReleased: false)]
[ServiceNotApplicable(typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class GBHawkLink4x : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IRegionable,
ISettable<GBHawkLink4x.GBLink4xSettings, GBHawkLink4x.GBLink4xSyncSettings>
{

View File

@ -15,13 +15,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
isPorted: true,
isReleased: true,
portedVersion: "SVN 344",
portedUrl: "http://gambatte.sourceforge.net/")]
[ServiceNotApplicable(typeof(IDriveLight), typeof(IDriveLight))]
portedUrl: "http://gambatte.sourceforge.net/",
singleInstance: false)]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class Gameboy : IEmulator, IVideoProvider, ISoundProvider, ISaveRam, IStatable, IInputPollable, ICodeDataLogger,
IBoardInfo, IDebuggable, ISettable<Gameboy.GambatteSettings, Gameboy.GambatteSyncSettings>,
IGameboyCommon, ICycleTiming, ILinkable
{
[CoreConstructor("GB", "GBC")]
[CoreConstructor(new[] { "GB", "GBC" })]
public Gameboy(CoreComm comm, GameInfo game, byte[] file, object settings, object syncSettings, bool deterministic)
{
var ser = new BasicServiceProvider(this);

View File

@ -7,7 +7,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
"sinamas/natt",
isPorted: true,
isReleased: true)]
[ServiceNotApplicable(typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class GambatteLink : IEmulator, IVideoProvider, ISoundProvider, IInputPollable, ISaveRam, IStatable, ILinkable,
IBoardInfo, IDebuggable, ISettable<GambatteLink.GambatteLinkSettings, GambatteLink.GambatteLinkSyncSettings>, ICodeDataLogger
{

View File

@ -14,7 +14,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
portedVersion: "2.0",
portedUrl: "https://code.google.com/p/mupen64plus/",
singleInstance: true)]
[ServiceNotApplicable(typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class N64 : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IDisassemblable, IRegionable,
ISettable<N64Settings, N64SyncSettings>
{

View File

@ -341,14 +341,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//this will be used to track classes that implement boards
[AttributeUsage(AttributeTargets.Class)]
public class INESBoardImplAttribute : Attribute { }
public sealed class INESBoardImplAttribute : Attribute { }
//this tracks derived boards that shouldnt be used by the implementation scanner
[AttributeUsage(AttributeTargets.Class)]
public class INESBoardImplCancelAttribute : Attribute { }
public sealed class INESBoardImplCancelAttribute : Attribute { }
static List<Type> INESBoardImplementors = new List<Type>();
//flags it as being priority, i.e. in the top of the list
[AttributeUsage(AttributeTargets.Class)]
public class INESBoardImplPriorityAttribute : Attribute { }
public sealed class INESBoardImplPriorityAttribute : Attribute { }
static INESBoard CreateBoardInstance(Type boardType)
{
@ -736,7 +736,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
[AttributeUsage(AttributeTargets.Field)]
public class MapperPropAttribute : Attribute
public sealed class MapperPropAttribute : Attribute
{
public string Name { get; }

View File

@ -16,8 +16,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
isPorted: true,
isReleased: true,
portedVersion: "0.7.0",
portedUrl: "https://github.com/kode54/QuickNES")]
[ServiceNotApplicable(typeof(IDriveLight))]
portedUrl: "https://github.com/kode54/QuickNES",
singleInstance: false)]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class QuickNES : IEmulator, IVideoProvider, ISoundProvider, ISaveRam, IInputPollable, IBoardInfo,
IStatable, IDebuggable, ISettable<QuickNES.QuickNESSettings, QuickNES.QuickNESSyncSettings>, Cores.Nintendo.NES.INESPPUViewable
{

View File

@ -23,8 +23,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
isPorted: true,
isReleased: true,
portedVersion: "v87",
portedUrl: "http://byuu.org/")]
[ServiceNotApplicable(typeof(IDriveLight))]
portedUrl: "http://byuu.org/",
singleInstance: false)]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public unsafe partial class LibsnesCore : IEmulator, IVideoProvider, ISaveRam, IStatable, IInputPollable, IRegionable, ICodeDataLogger,
IDebuggable, ISettable<LibsnesCore.SnesSettings, LibsnesCore.SnesSyncSettings>
{

View File

@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES9X
{
[Core("Snes9x", "", true, true,
"5e0319ab3ef9611250efb18255186d0dc0d7e125", "https://github.com/snes9xgit/snes9x", false)]
[ServiceNotApplicable(typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public class Snes9x : WaterboxCore,
ISettable<Snes9x.Settings, Snes9x.SyncSettings>, IRegionable
{

View File

@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
"",
isPorted: false,
isReleased: true)]
[ServiceNotApplicable(typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class SubNESHawk : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IRegionable,
IBoardInfo, ISettable<NES.NES.NESSettings, NES.NES.NESSyncSettings>, INESPPUViewable
{

View File

@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
public sealed partial class PCEngine : IEmulator, ISaveRam, IInputPollable,
IDebuggable, ISettable<PCEngine.PCESettings, PCEngine.PCESyncSettings>, IDriveLight, ICodeDataLogger
{
[CoreConstructor("PCE", "SGX")]
[CoreConstructor(new[] { "PCE", "SGX" })]
public PCEngine(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
{
CoreComm = comm;

View File

@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
"",
isPorted: false,
isReleased: false)]
[ServiceNotApplicable(typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class GGHawkLink : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IRegionable, ILinkable,
ISettable<GGHawkLink.GGLinkSettings, GGHawkLink.GGLinkSyncSettings>
{

View File

@ -19,11 +19,11 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
"Vecna",
isPorted: false,
isReleased: true)]
[ServiceNotApplicable(typeof(IDriveLight))]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class SMS : IEmulator, ISaveRam, IInputPollable, IRegionable,
IDebuggable, ISettable<SMS.SmsSettings, SMS.SmsSyncSettings>, ICodeDataLogger
{
[CoreConstructor("SMS", "SG", "GG")]
[CoreConstructor(new[] { "SMS", "SG", "GG" })]
public SMS(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
{
ServiceProvider = new BasicServiceProvider(this);

View File

@ -10,6 +10,8 @@ namespace BizHawk.Emulation.Cores.Sony.PSP
"hrydgard",
isPorted: true,
isReleased: false,
portedVersion: null,
portedUrl: null,
singleInstance: true)]
public class PSP : IEmulator, IVideoProvider, ISoundProvider
{

View File

@ -6,8 +6,8 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.WonderSwan
{
[Core("Cygne/Mednafen", "Dox, Mednafen Team", true, true, "0.9.36.5", "http://mednafen.sourceforge.net/")]
[ServiceNotApplicable(typeof(IDriveLight), typeof(IRegionable))]
[Core("Cygne/Mednafen", "Dox, Mednafen Team", true, true, "0.9.36.5", "http://mednafen.sourceforge.net/", false)]
[ServiceNotApplicable(new[] { typeof(IDriveLight), typeof(IRegionable) })]
public partial class WonderSwan : IEmulator, IVideoProvider, ISoundProvider,
IInputPollable, IDebuggable
{

View File

@ -177,15 +177,21 @@ namespace BizHawk.Emulation.Cores
}
[AttributeUsage(AttributeTargets.Constructor)]
public class CoreConstructorAttribute : Attribute
public sealed class CoreConstructorAttribute : Attribute
{
private readonly List<string> _systems = new List<string>();
public CoreConstructorAttribute(params string[] systems)
/// <remarks>TODO neither array nor <see cref="IEnumerable{T}"/> is the correct collection to be using here, try <see cref="IReadOnlyList{T}"/>/<see cref="IReadOnlyCollection{T}"/> instead</remarks>
public CoreConstructorAttribute(string[] systems)
{
_systems.AddRange(systems);
}
public CoreConstructorAttribute(string system)
{
_systems.Add(system);
}
public IEnumerable<string> Systems => _systems;
}
}

View File

@ -11,8 +11,8 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Libretro
{
[Core("Libretro", "zeromus")]
[ServiceNotApplicable(typeof(IDriveLight))]
[Core("Libretro", "zeromus", isPorted: false, isReleased: false)]
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public unsafe partial class LibretroCore : IEmulator, ISettable<LibretroCore.Settings, LibretroCore.SyncSettings>,
ISaveRam, IStatable, IVideoProvider, IInputPollable
{