diff --git a/BizHawk.Client.Common/movie/conversions/MovieConversionExtensions.cs b/BizHawk.Client.Common/movie/conversions/MovieConversionExtensions.cs
index 616ce7e57c..f285e5d9f1 100644
--- a/BizHawk.Client.Common/movie/conversions/MovieConversionExtensions.cs
+++ b/BizHawk.Client.Common/movie/conversions/MovieConversionExtensions.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using BizHawk.Common.ReflectionExtensions;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
+using BizHawk.Emulation.Common.IEmulatorExtensions;
namespace BizHawk.Client.Common.MovieConversionExtensions
{
@@ -283,10 +284,10 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
movie.BoardName = Global.Emulator.BoardName;
}
- if (Global.Emulator.HasPublicProperty("DisplayType"))
+ if (Global.Emulator.HasRegions())
{
- var region = Global.Emulator.GetPropertyValue("DisplayType");
- if ((DisplayType)region == DisplayType.PAL)
+ var region = Global.Emulator.AsRegionable().Region;
+ if (region == DisplayType.PAL)
{
movie.HeaderEntries.Add(HeaderKeys.PAL, "1");
}
diff --git a/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj b/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj
index a042c31897..dd74e4459f 100644
--- a/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj
+++ b/BizHawk.Emulation.Common/BizHawk.Emulation.Common.csproj
@@ -84,6 +84,7 @@
+
diff --git a/BizHawk.Emulation.Common/Extensions.cs b/BizHawk.Emulation.Common/Extensions.cs
index 16387bc5b7..6ac14b6d79 100644
--- a/BizHawk.Emulation.Common/Extensions.cs
+++ b/BizHawk.Emulation.Common/Extensions.cs
@@ -200,6 +200,21 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
return true;
}
+ public static bool HasRegions(this IEmulator core)
+ {
+ if (core == null)
+ {
+ return false;
+ }
+
+ return core.ServiceProvider.HasService();
+ }
+
+ public static IRegionable AsRegionable(this IEmulator core)
+ {
+ return (IRegionable)core.ServiceProvider.GetService();
+ }
+
// TODO: a better place for these
public static bool IsImplemented(this MethodInfo info)
{
diff --git a/BizHawk.Emulation.Cores/Calculator/TI83.cs b/BizHawk.Emulation.Cores/Calculator/TI83.cs
index c6686c01ac..cbb8197d24 100644
--- a/BizHawk.Emulation.Cores/Calculator/TI83.cs
+++ b/BizHawk.Emulation.Cores/Calculator/TI83.cs
@@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Cores.Calculators
isPorted: false,
isReleased: true
)]
- [ServiceNotApplicable(typeof(ISaveRam))]
+ [ServiceNotApplicable(typeof(ISaveRam), typeof(IRegionable))]
public partial class TI83 : IEmulator, IVideoProvider, IStatable, IDebuggable, IInputPollable, ISettable
{
[CoreConstructor("TI83")]
diff --git a/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs
index cad6c19f38..9f43877262 100644
--- a/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs
+++ b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs
@@ -14,6 +14,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
isPorted: true,
isReleased: true
)]
+ [ServiceNotApplicable(typeof(ISaveRam), typeof(IRegionable))]
public partial class AppleII : IEmulator, IDriveLight
{
public AppleII(CoreComm comm, IEnumerable gameInfoSet, IEnumerable romSet, Settings settings)
diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs
index c6588a1735..3d0028a017 100644
--- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs
+++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs
@@ -20,7 +20,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
isPorted: false,
isReleased: false
)]
- [ServiceNotApplicable(typeof(ISettable<,>))]
+ [ServiceNotApplicable(typeof(IRegionable), typeof(ISettable<,>))]
sealed public partial class C64 : IEmulator, IStatable, IInputPollable, IDriveLight, IDebuggable
{
// framework
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs
index 38c8b207bc..ea0a2112e4 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.Core.cs
@@ -320,11 +320,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private bool _pal;
- public DisplayType DisplayType
- {
- get { return _pal ? DisplayType.PAL : Common.DisplayType.NTSC; }
- }
-
private void HardReset()
{
Ram = new byte[128];
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs
index 8d35f2a7d2..dfc50a3cd5 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs
@@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
isReleased: true
)]
[ServiceNotApplicable(typeof(ISaveRam), typeof(IDriveLight))]
- public partial class Atari2600 : IEmulator, IStatable, IDebuggable, IInputPollable, ISettable
+ public partial class Atari2600 : IEmulator, IStatable, IDebuggable, IInputPollable, IRegionable, ISettable
{
private readonly GameInfo _game;
private int _frame;
@@ -58,6 +58,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public IEmulatorServiceProvider ServiceProvider { get; private set; }
+ public DisplayType Region
+ {
+ get { return _pal ? DisplayType.PAL : Common.DisplayType.NTSC; }
+ }
+
public string SystemId { get { return "A26"; } }
public string BoardName { get { return _mapper.GetType().Name; } }
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs b/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs
index f169effc48..b4276ca878 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs
@@ -17,7 +17,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
portedUrl: "http://emu7800.sourceforge.net/"
)]
[ServiceNotApplicable(typeof(ISettable<,>), typeof(IDriveLight))]
- public partial class Atari7800 : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable
+ public partial class Atari7800 : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IRegionable
{
// TODO:
// some things don't work when you try to plug in a 2600 game
@@ -164,7 +164,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
}
private bool _pal;
- public DisplayType DisplayType
+ public DisplayType Region
{
get { return _pal ? DisplayType.PAL : DisplayType.NTSC; }
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/lynx/Lynx.cs b/BizHawk.Emulation.Cores/Consoles/Atari/lynx/Lynx.cs
index ab792b2607..ed1f62307b 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/lynx/Lynx.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/lynx/Lynx.cs
@@ -12,7 +12,7 @@ using Newtonsoft.Json;
namespace BizHawk.Emulation.Cores.Atari.Lynx
{
[CoreAttributes("Handy", "K. Wilkins", true, true, "mednafen 0-9-34-1", "http://mednafen.sourceforge.net/")]
- [ServiceNotApplicable(typeof(ISettable<,>), typeof(IDriveLight))]
+ [ServiceNotApplicable(typeof(ISettable<,>), typeof(IDriveLight), typeof(IRegionable))]
public partial class Lynx : IEmulator, IVideoProvider, ISyncSoundProvider, ISaveRam, IStatable, IInputPollable
{
IntPtr Core;
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs
index 20d9b2d8e6..5738b05eef 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.cs
@@ -11,6 +11,7 @@ using System.ComponentModel;
namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
[CoreAttributes("mGBA", "endrift", true, false, "NOT DONE", "NOT DONE", false)]
+ [ServiceNotApplicable(typeof(IDriveLight), typeof(IRegionable))]
public class MGBAHawk : IEmulator, IVideoProvider, ISyncSoundProvider, IGBAGPUViewable, ISaveRam, IStatable, IInputPollable, ISettable