From c74019a54df288c6be33827567996b9124eb8eb9 Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 22 Apr 2014 00:38:59 +0000 Subject: [PATCH] Add a CoreAttributes class with a CoreName field, and apply it to all cores, when recording a new movie, add a core header line that captures this name --- BizHawk.Client.Common/movie/HeaderKeys.cs | 3 +++ BizHawk.Client.EmuHawk/movie/RecordMovie.cs | 6 ++++++ .../BizHawk.Emulation.Common.csproj | 1 + BizHawk.Emulation.Common/CoreAttributes.cs | 14 ++++++++++++++ .../Base Implementations/NullEmulator.cs | 1 + BizHawk.Emulation.Cores/Calculator/TI83.cs | 1 + .../Computers/Commodore64/C64.cs | 1 + .../Consoles/Atari/2600/Atari2600.cs | 1 + .../Consoles/Atari/7800/Atari7800.cs | 1 + .../Consoles/Coleco/ColecoVision.cs | 1 + .../Consoles/Intellivision/Intellivision.cs | 1 + .../Consoles/Nintendo/GBA/Meteor.cs | 1 + .../Consoles/Nintendo/Gameboy/Gambatte.cs | 1 + .../Consoles/Nintendo/Gameboy/GambatteLink.cs | 1 + .../Consoles/Nintendo/N64/N64.cs | 1 + .../Consoles/Nintendo/NES/NES.cs | 2 +- .../Consoles/Nintendo/QuickNES/QuickNES.cs | 1 + .../Consoles/Nintendo/SNES/LibsnesCore.cs | 2 +- .../Consoles/PC Engine/PCEngine.cs | 1 + .../Consoles/Sega/Genesis/Genesis.cs | 1 + BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs | 1 + .../Consoles/Sega/Saturn/Yabause.cs | 1 + BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs | 1 + BizHawk.Emulation.Cores/Consoles/Sony/PSP/PSP.cs | 1 + .../Consoles/Sony/PSX/Octoshock.cs | 1 + 25 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 BizHawk.Emulation.Common/CoreAttributes.cs diff --git a/BizHawk.Client.Common/movie/HeaderKeys.cs b/BizHawk.Client.Common/movie/HeaderKeys.cs index b159b13170..25b4486624 100644 --- a/BizHawk.Client.Common/movie/HeaderKeys.cs +++ b/BizHawk.Client.Common/movie/HeaderKeys.cs @@ -20,6 +20,9 @@ namespace BizHawk.Client.Common public const string PAL = "PAL"; public const string BOARDNAME = "BoardName"; + // Core Setting + public const string CORE = "Core"; + // Gameboy Settings that affect sync public const string GB_FORCEDMG = "Force_DMG_Mode"; public const string GB_GBA_IN_CGB = "GBA_In_CGB"; diff --git a/BizHawk.Client.EmuHawk/movie/RecordMovie.cs b/BizHawk.Client.EmuHawk/movie/RecordMovie.cs index eccbfeaaea..e96204afd8 100644 --- a/BizHawk.Client.EmuHawk/movie/RecordMovie.cs +++ b/BizHawk.Client.EmuHawk/movie/RecordMovie.cs @@ -12,6 +12,8 @@ using BizHawk.Emulation.Cores.Nintendo.SNES; using BizHawk.Emulation.Cores.Sega.MasterSystem; using BizHawk.Emulation.Cores.Consoles.Sega.gpgx; +using System.Reflection; + namespace BizHawk.Client.EmuHawk { public partial class RecordMovie : Form @@ -178,6 +180,10 @@ namespace BizHawk.Client.EmuHawk } } + _movieToRecord.Header[HeaderKeys.CORE] = ((CoreAttributes)Attribute + .GetCustomAttribute(Global.Emulator.GetType(), typeof(CoreAttributes))) + .CoreName; + GlobalWin.MainForm.StartNewMovie(_movieToRecord, true); Global.Config.UseDefaultAuthor = DefaultAuthorCheckBox.Checked; diff --git a/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj b/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj index 0ce6bd9288..6df1946d29 100644 --- a/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj +++ b/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj @@ -45,6 +45,7 @@ VersionInfo.cs + diff --git a/BizHawk.Emulation.Common/CoreAttributes.cs b/BizHawk.Emulation.Common/CoreAttributes.cs new file mode 100644 index 0000000000..9f38a89e02 --- /dev/null +++ b/BizHawk.Emulation.Common/CoreAttributes.cs @@ -0,0 +1,14 @@ +using System; + +namespace BizHawk.Emulation.Common +{ + public class CoreAttributes : Attribute + { + public CoreAttributes(string name) + { + CoreName = name; + } + + public string CoreName { get; private set; } + } +} diff --git a/BizHawk.Emulation.Common/Interfaces/Base Implementations/NullEmulator.cs b/BizHawk.Emulation.Common/Interfaces/Base Implementations/NullEmulator.cs index ea76de20e8..9fd4dc9628 100644 --- a/BizHawk.Emulation.Common/Interfaces/Base Implementations/NullEmulator.cs +++ b/BizHawk.Emulation.Common/Interfaces/Base Implementations/NullEmulator.cs @@ -5,6 +5,7 @@ using BizHawk.Common; namespace BizHawk.Emulation.Common { + [CoreAttributes("NullHawk")] public class NullEmulator : IEmulator, IVideoProvider, ISyncSoundProvider, ISoundProvider { public string SystemId { get { return "NULL"; } } diff --git a/BizHawk.Emulation.Cores/Calculator/TI83.cs b/BizHawk.Emulation.Cores/Calculator/TI83.cs index 231d1cb68d..2afc208063 100644 --- a/BizHawk.Emulation.Cores/Calculator/TI83.cs +++ b/BizHawk.Emulation.Cores/Calculator/TI83.cs @@ -11,6 +11,7 @@ using BizHawk.Emulation.Cores.Components.Z80; namespace BizHawk.Emulation.Cores.Calculators { + [CoreAttributes("TI83Hawk")] public class TI83 : IEmulator { //hardware diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs index 1f326669e2..bc2a8563da 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs @@ -6,6 +6,7 @@ using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Computers.Commodore64 { + [CoreAttributes("C64Hawk")] sealed public partial class C64 : IEmulator { // internal variables diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs index c5e971bb24..6d7633e689 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs @@ -9,6 +9,7 @@ using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Atari.Atari2600 { + [CoreAttributes("Atari2600Hawk")] public partial class Atari2600 : IEmulator { private readonly GameInfo _game; diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs b/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs index be5d07e8dc..3d2b8fdd2b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs @@ -8,6 +8,7 @@ using EMU7800.Core; namespace BizHawk.Emulation.Cores.Atari.Atari7800 { + [CoreAttributes("EMU7800")] public partial class Atari7800 : IEmulator { // TODO: diff --git a/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs b/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs index c3b7ec65cf..b38f8ae078 100644 --- a/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs +++ b/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs @@ -9,6 +9,7 @@ using BizHawk.Emulation.Cores.Components.Z80; namespace BizHawk.Emulation.Cores.ColecoVision { + [CoreAttributes("ColecoHawk")] public sealed partial class ColecoVision : IEmulator { // ROM diff --git a/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs b/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs index ee156eae89..656ebd0477 100644 --- a/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs +++ b/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs @@ -7,6 +7,7 @@ using BizHawk.Emulation.Cores.Components.CP1610; namespace BizHawk.Emulation.Cores.Intellivision { + [CoreAttributes("IntelliHawk")] public sealed partial class Intellivision : IEmulator { byte[] Rom; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs index b58a5926cc..e33f6112b8 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs @@ -8,6 +8,7 @@ using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Nintendo.GBA { + [CoreAttributes("Meteor")] public class GBA : IEmulator, IVideoProvider, ISyncSoundProvider { public Dictionary GetCpuFlagsAndRegisters() diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs index d445446aa6..bfb3877b44 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs @@ -10,6 +10,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy /// /// a gameboy/gameboy color emulator wrapped around native C++ libgambatte /// + [CoreAttributes("Gambatte")] public class Gameboy : IEmulator, IVideoProvider, ISyncSoundProvider { /// diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs index ad51cc0b06..a10a9d5426 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs @@ -9,6 +9,7 @@ using BizHawk.Emulation.Cores.Nintendo.SNES; namespace BizHawk.Emulation.Cores.Nintendo.Gameboy { + [CoreAttributes("DualGambatte")] public class GambatteLink : IEmulator, IVideoProvider, ISyncSoundProvider { bool disposed = false; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs index fadd45aa06..b67538b89a 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs @@ -11,6 +11,7 @@ using BizHawk.Emulation.Cores.Nintendo.N64.NativeApi; namespace BizHawk.Emulation.Cores.Nintendo.N64 { + [CoreAttributes("Mupen64Plus")] public class N64 : IEmulator { public Dictionary GetCpuFlagsAndRegisters() diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs index 041afffd9c..752226f363 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.cs @@ -9,7 +9,7 @@ using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Nintendo.NES { - + [CoreAttributes("NesHawk")] public partial class NES : IEmulator { static readonly bool USE_DATABASE = true; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs index ca29262a2d..aefb4d60f5 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.cs @@ -10,6 +10,7 @@ using Newtonsoft.Json; namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES { + [CoreAttributes("QuickNes")] public class QuickNES : IEmulator, IVideoProvider, ISyncSoundProvider { #region FPU precision diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs index 29c91eee66..7085a71b56 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs @@ -20,7 +20,6 @@ using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Nintendo.SNES { - public class ScanlineHookManager { public void Register(object tag, Action callback) @@ -58,6 +57,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES } } + [CoreAttributes("BSNES")] public unsafe class LibsnesCore : IEmulator, IVideoProvider { public bool IsSGB { get; private set; } diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs index a66aee7152..5a9df5d3f4 100644 --- a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs +++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs @@ -13,6 +13,7 @@ namespace BizHawk.Emulation.Cores.PCEngine { public enum NecSystemType { TurboGrafx, TurboCD, SuperGrafx } + [CoreAttributes("PCEHawk")] public sealed partial class PCEngine : IEmulator { // ROM diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs index 6e9aa2ab70..2debdf2f8e 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs @@ -14,6 +14,7 @@ using Native68000; namespace BizHawk.Emulation.Cores.Sega.Genesis { + [CoreAttributes("GenesisHawk")] public sealed partial class Genesis : IEmulator { private int _lagcount = 0; diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs index 459a1251da..230205e1e6 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs @@ -19,6 +19,7 @@ using BizHawk.Emulation.Cores.Components.Z80; namespace BizHawk.Emulation.Cores.Sega.MasterSystem { + [CoreAttributes("SMSHawk")] public sealed partial class SMS : IEmulator { // Constants diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs index 59f2218287..d05fec42cd 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Saturn/Yabause.cs @@ -11,6 +11,7 @@ using BizHawk.Emulation.DiscSystem; namespace BizHawk.Emulation.Cores.Sega.Saturn { + [CoreAttributes("Yabause")] public class Yabause : IEmulator, IVideoProvider, ISyncSoundProvider { public static ControllerDefinition SaturnController = new ControllerDefinition diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs index c3c6f0249d..0858dccb99 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/gpgx/GPGX.cs @@ -15,6 +15,7 @@ using System.ComponentModel; namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx { + [CoreAttributes("Genplus-gx")] public class GPGX : IEmulator, ISyncSoundProvider, IVideoProvider { static GPGX AttachedCore = null; diff --git a/BizHawk.Emulation.Cores/Consoles/Sony/PSP/PSP.cs b/BizHawk.Emulation.Cores/Consoles/Sony/PSP/PSP.cs index 6f83c27e31..b827d4fbd0 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sony/PSP/PSP.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sony/PSP/PSP.cs @@ -8,6 +8,7 @@ using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Sony.PSP { + [CoreAttributes("PPSSPP")] public class PSP : IEmulator, IVideoProvider, ISyncSoundProvider { public static readonly ControllerDefinition PSPController = new ControllerDefinition diff --git a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs index 259fcafd09..7d3ddef5ed 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs @@ -9,6 +9,7 @@ using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Sony.PSX { + [CoreAttributes("MednafenPSX")] public unsafe class Octoshock : IEmulator, IVideoProvider, ISoundProvider { public string SystemId { get { return "NULL"; } }