diff --git a/BizHawk.Client.ApiHawk/Attributes/BizHawkExternalToolUsageAttribute.cs b/BizHawk.Client.ApiHawk/Attributes/BizHawkExternalToolUsageAttribute.cs
index 672de2a054..66737e038c 100644
--- a/BizHawk.Client.ApiHawk/Attributes/BizHawkExternalToolUsageAttribute.cs
+++ b/BizHawk.Client.ApiHawk/Attributes/BizHawkExternalToolUsageAttribute.cs
@@ -12,7 +12,7 @@ namespace BizHawk.Client.ApiHawk
#region Fields
private BizHawkExternalToolUsage _ToolUsage;
- private EmulatedSystem _System;
+ private CoreSystem _System;
private string _GameHash;
#endregion
@@ -23,11 +23,11 @@ namespace BizHawk.Client.ApiHawk
/// Initialize a new instance of
///
/// i.e. what your external tool is for
- /// that your external tool is used for
+ /// that your external tool is used for
/// The game hash, unique game ID (see in the game database)
- public BizHawkExternalToolUsageAttribute(BizHawkExternalToolUsage usage, EmulatedSystem system, string gameHash)
+ public BizHawkExternalToolUsageAttribute(BizHawkExternalToolUsage usage, CoreSystem system, string gameHash)
{
- if (usage == BizHawkExternalToolUsage.EmulatorSpecific && system == EmulatedSystem.Null)
+ if (usage == BizHawkExternalToolUsage.EmulatorSpecific && system == CoreSystem.Null)
{
throw new InvalidOperationException("A system must be set");
}
@@ -45,8 +45,8 @@ namespace BizHawk.Client.ApiHawk
/// Initialize a new instance of
///
/// i.e. what your external tool is for
- /// that your external tool is used for
- public BizHawkExternalToolUsageAttribute(BizHawkExternalToolUsage usage, EmulatedSystem system)
+ /// that your external tool is used for
+ public BizHawkExternalToolUsageAttribute(BizHawkExternalToolUsage usage, CoreSystem system)
:this(usage, system, string.Empty)
{}
@@ -54,7 +54,7 @@ namespace BizHawk.Client.ApiHawk
/// Initialize a new instance of
///
public BizHawkExternalToolUsageAttribute()
- :this(BizHawkExternalToolUsage.Global, EmulatedSystem.Null, string.Empty)
+ :this(BizHawkExternalToolUsage.Global, CoreSystem.Null, string.Empty)
{ }
@@ -65,7 +65,7 @@ namespace BizHawk.Client.ApiHawk
///
/// Gets the specific system used by the exetrnal tool
///
- public EmulatedSystem System
+ public CoreSystem System
{
get
{
diff --git a/BizHawk.Client.ApiHawk/BizHawk.Client.ApiHawk.csproj b/BizHawk.Client.ApiHawk/BizHawk.Client.ApiHawk.csproj
index 1635c2c44a..daac456de0 100644
--- a/BizHawk.Client.ApiHawk/BizHawk.Client.ApiHawk.csproj
+++ b/BizHawk.Client.ApiHawk/BizHawk.Client.ApiHawk.csproj
@@ -27,6 +27,7 @@
MinimumRecommendedRules.ruleset
;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets
;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules
+ ..\output64\dll\BizHawk.Client.ApiHawk.XML
@@ -81,8 +82,7 @@
x86
prompt
MinimumRecommendedRules.ruleset
-
-
+ ..\output\dll\BizHawk.Client.ApiHawk.XML
@@ -98,10 +98,12 @@
+
+
+
-
@@ -118,6 +120,10 @@
{e1a23168-b571-411c-b360-2229e7225e0e}
BizHawk.Emulation.Common
+
+ {197d4314-8a9f-49ba-977d-54acefaeb6ba}
+ BizHawk.Emulation.Cores
+
diff --git a/BizHawk.Client.ApiHawk/Classes/BizHawkSystemIdToCoreSystemEnumConverter.cs b/BizHawk.Client.ApiHawk/Classes/BizHawkSystemIdToCoreSystemEnumConverter.cs
new file mode 100644
index 0000000000..cea50ad964
--- /dev/null
+++ b/BizHawk.Client.ApiHawk/Classes/BizHawkSystemIdToCoreSystemEnumConverter.cs
@@ -0,0 +1,214 @@
+using System;
+using System.Globalization;
+
+namespace BizHawk.Client.ApiHawk
+{
+ ///
+ /// This class holds a converter for BizHawk SystemId (which is a simple
+ /// It allows you to convert it to a value and vice versa
+ ///
+ /// I made it this way just in case one day we need it for WPF (DependencyProperty binding). Just uncomment :IValueConverter implementation
+ /// I didn't implemented it because of mono compatibility
+ ///
+ public sealed class BizHawkSystemIdToEnumConverter //:IValueConverter
+ {
+ ///
+ /// Convert BizHawk SystemId to value
+ ///
+ /// you want to convert
+ /// The type of the binding target property
+ /// The converter parameter to use; null in our case
+ /// The culture to use in the converter
+ /// A that is equivalent to BizHawk SystemId
+ /// Thrown when SystemId hasn't been found
+ public object Convert(object value, Type targetType, object parameter, CultureInfo cultureInfo)
+ {
+ switch ((string)value)
+ {
+ case "AppleII":
+ return CoreSystem.AppleII;
+
+ case "A26":
+ return CoreSystem.Atari2600;
+
+ case "A78":
+ return CoreSystem.Atari2600;
+
+ case "Coleco":
+ return CoreSystem.ColecoVision;
+
+ case "C64":
+ return CoreSystem.Commodore64;
+
+ case "DGB":
+ return CoreSystem.DualGameBoy;
+
+ case "GB":
+ return CoreSystem.GameBoy;
+
+ case "GBA":
+ return CoreSystem.GameBoyAdvance;
+
+ case "GEN":
+ return CoreSystem.Genesis;
+
+ case "INTV":
+ return CoreSystem.Intellivision;
+
+ case "Libretro":
+ return CoreSystem.Libretro;
+
+ case "Lynx":
+ return CoreSystem.Lynx;
+
+ case "SMS":
+ return CoreSystem.MasterSystem;
+
+ case "NES":
+ return CoreSystem.NES;
+
+ case "N64":
+ return CoreSystem.Nintendo64;
+
+ case "NULL":
+ return CoreSystem.Null;
+
+ case "PCE":
+ return CoreSystem.PCEngine;
+
+ case "PSX":
+ return CoreSystem.Playstation;
+
+ case "PSP":
+ return CoreSystem.PSP;
+
+ case "SAT":
+ return CoreSystem.Saturn;
+
+ case "SNES":
+ return CoreSystem.SNES;
+
+ case "TI83":
+ return CoreSystem.TI83;
+
+ case "WSWAN":
+ return CoreSystem.WonderSwan;
+
+ default:
+ throw new IndexOutOfRangeException(string.Format("{0} is missing in convert list", value));
+ }
+ }
+
+
+ ///
+ /// Convert BizHawk SystemId to value
+ ///
+ /// you want to convert
+ /// A that is equivalent to BizHawk SystemId
+ /// Thrown when SystemId hasn't been found
+ public CoreSystem Convert(string value)
+ {
+ return (CoreSystem)Convert(value, null, null, CultureInfo.CurrentCulture);
+ }
+
+
+ ///
+ /// Convert a value to BizHawk SystemId
+ ///
+ /// you want to convert
+ /// The type of the binding target property
+ /// The converter parameter to use; null in our case
+ /// The culture to use in the converter
+ /// A that is used by BizHawk SystemId
+ /// Thrown when hasn't been found
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo cultureInfo)
+ {
+ switch ((CoreSystem)value)
+ {
+ case CoreSystem.AppleII:
+ return "AppleII";
+
+ case CoreSystem.Atari2600:
+ return "A26";
+
+ case CoreSystem.Atari7800:
+ return "A78";
+
+ case CoreSystem.ColecoVision:
+ return "Coleco";
+
+ case CoreSystem.Commodore64:
+ return "C64";
+
+ case CoreSystem.DualGameBoy:
+ return "DGB";
+
+ case CoreSystem.GameBoy:
+ return "GB";
+
+ case CoreSystem.GameBoyAdvance:
+ return "GBA";
+
+ case CoreSystem.Genesis:
+ return "GEN";
+
+ case CoreSystem.Intellivision:
+ return "INTV";
+
+ case CoreSystem.Libretro:
+ return "Libretro";
+
+ case CoreSystem.Lynx:
+ return "Lynx";
+
+ case CoreSystem.MasterSystem:
+ return "SMS";
+
+ case CoreSystem.NES:
+ return "NES";
+
+ case CoreSystem.Nintendo64:
+ return "N64";
+
+ case CoreSystem.Null:
+ return "NULL";
+
+ case CoreSystem.PCEngine:
+ return "PCE";
+
+ case CoreSystem.Playstation:
+ return "PSX";
+
+ case CoreSystem.PSP:
+ return "PSP";
+
+ case CoreSystem.Saturn:
+ return "SAT";
+
+ case CoreSystem.SNES:
+ return "SNES";
+
+ case CoreSystem.TI83:
+ return "TI83";
+
+ case CoreSystem.WonderSwan:
+ return "WSWAN";
+
+ default:
+ throw new IndexOutOfRangeException(string.Format("{0} is missing in convert list", value.ToString()));
+ }
+ }
+
+
+ ///
+ /// Convert a value to BizHawk SystemId
+ ///
+ /// you want to convert
+ /// A that is used by BizHawk SystemId
+ /// Thrown when hasn't been found
+ public string ConvertBack(CoreSystem value)
+ {
+ return (string)ConvertBack(value, null, null, CultureInfo.CurrentCulture);
+ }
+ }
+}
diff --git a/BizHawk.Client.ApiHawk/Classes/ClientApi.cs b/BizHawk.Client.ApiHawk/Classes/ClientApi.cs
index af72e8403d..e22e71139d 100644
--- a/BizHawk.Client.ApiHawk/Classes/ClientApi.cs
+++ b/BizHawk.Client.ApiHawk/Classes/ClientApi.cs
@@ -1,5 +1,13 @@
using System;
+using System.Collections.Generic;
+using System.Linq;
using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using BizHawk.Client.Common;
+using BizHawk.Emulation.Cores.Nintendo.Gameboy;
+using BizHawk.Emulation.Cores.PCEngine;
+using BizHawk.Emulation.Cores.Sega.MasterSystem;
namespace BizHawk.Client.ApiHawk
{
@@ -13,9 +21,13 @@ namespace BizHawk.Client.ApiHawk
private static readonly Assembly clientAssembly;
private static readonly object clientMainForm;
+ internal static readonly BizHawkSystemIdToEnumConverter SystemIdConverter = new BizHawkSystemIdToEnumConverter();
+ internal static readonly JoypadStringToEnumConverter JoypadConverter = new JoypadStringToEnumConverter();
public static event EventHandler RomLoaded;
+ private static List allJoypads;
+
#endregion
#region cTor(s)
@@ -30,15 +42,48 @@ namespace BizHawk.Client.ApiHawk
#region Methods
+ #region Public
///
/// THE FrameAdvance stuff
///
- public static void DoframeAdvance()
+ public static void DoFrameAdvance()
{
Type reflectClass = clientAssembly.GetType("BizHawk.Client.EmuHawk.MainForm");
MethodInfo method = reflectClass.GetMethod("FrameAdvance");
method.Invoke(clientMainForm, null);
- }
+ }
+
+ ///
+ /// THE FrameAdvance stuff
+ /// Auto unpause emulation
+ ///
+ public static void DoFrameAdvanceAndUnpause()
+ {
+ Type reflectClass = clientAssembly.GetType("BizHawk.Client.EmuHawk.MainForm");
+ MethodInfo method = reflectClass.GetMethod("FrameAdvance");
+ method.Invoke(clientMainForm, null);
+ method = reflectClass.GetMethod("UnpauseEmulator");
+ method.Invoke(clientMainForm, null);
+ }
+
+ ///
+ /// Gets a for specified player
+ ///
+ /// Player (one based) you want current inputs
+ /// A populated with current inputs
+ /// Raised when you specify a player less than 1 or greater than maximum allows (see SystemInfo class to get this information)
+ public static Joypad GetInput(int player)
+ {
+ if (player < 1 || player > RunningSystem.MaxControllers)
+ {
+ throw new IndexOutOfRangeException(string.Format("{0} does not support {1} controller(s)", RunningSystem.DisplayName, player));
+ }
+ else
+ {
+ GetAllInputs();
+ return allJoypads[player - 1];
+ }
+ }
///
/// Raise when a rom is successfully Loaded
@@ -49,8 +94,15 @@ namespace BizHawk.Client.ApiHawk
{
RomLoaded(null, EventArgs.Empty);
}
+
+ allJoypads = new List(RunningSystem.MaxControllers);
+ for (int i = 1; i <= RunningSystem.MaxControllers; i++)
+ {
+ allJoypads.Add(new Joypad(RunningSystem, i));
+ }
}
+
///
/// Sets the extra padding added to the 'native' surface so that you can draw HUD elements in predictable placements
///
@@ -95,169 +147,77 @@ namespace BizHawk.Client.ApiHawk
SetExtraPadding(left, top, right, 0);
}
+
///
- /// Convert a specified into a used in BizHawk internal code
+ /// Set inputs in specified to specified player
///
- /// to convert
- /// Emulated system as used in BizHawk code
- internal static string EmulatedSytemEnumToBizhawkString(EmulatedSystem system)
+ /// Player (one based) whom inputs must be set
+ /// with inputs
+ /// Raised when you specify a player less than 1 or greater than maximum allows (see SystemInfo class to get this information)
+ public static void SetInput(int player, Joypad joypad)
{
- switch (system)
+ if (player < 1 || player > RunningSystem.MaxControllers)
{
- case EmulatedSystem.AppleII:
- return "AppleII";
-
- case EmulatedSystem.Atari2600:
- return "A26";
-
- case EmulatedSystem.Atari7800:
- return "A78";
-
- case EmulatedSystem.ColecoVision:
- return "Coleco";
-
- case EmulatedSystem.Commodore64:
- return "C64";
-
- case EmulatedSystem.DualGameBoy:
- return "DGB";
-
- case EmulatedSystem.GameBoy:
- return "GB";
-
- case EmulatedSystem.GameBoyAdvance:
- return "GBA";
-
- case EmulatedSystem.Genesis:
- return "GEN";
-
- case EmulatedSystem.Intellivision:
- return "INTV";
-
- case EmulatedSystem.Libretro:
- return "Libretro";
-
- case EmulatedSystem.Lynx:
- return "Lynx";
-
- case EmulatedSystem.MasterSystem:
- return "SMS";
-
- case EmulatedSystem.NES:
- return "NES";
-
- case EmulatedSystem.Nintendo64:
- return "N64";
-
- case EmulatedSystem.Null:
- return "NULL";
-
- case EmulatedSystem.PCEngine:
- return "PCE";
-
- case EmulatedSystem.Playstation:
- return "PSX";
-
- case EmulatedSystem.PSP:
- return "PSP";
-
- case EmulatedSystem.Saturn:
- return "SAT";
-
- case EmulatedSystem.SNES:
- return "SNES";
-
- case EmulatedSystem.TI83:
- return "TI83";
-
- case EmulatedSystem.WonderSwan:
- return "WSWAN";
-
- default:
- throw new IndexOutOfRangeException(string.Format("{0} is missing in convert list", system.ToString()));
- }
+ throw new IndexOutOfRangeException(string.Format("{0} does not support {1} controller(s)", RunningSystem.DisplayName, player));
+ }
+ else
+ {
+ allJoypads[player - 1] = joypad;
+ Parallel.ForEach((IEnumerable)Enum.GetValues(typeof(JoypadButton)), button =>
+ {
+ if (joypad.Inputs.HasFlag(button))
+ {
+ //joypadAdaptor[string.Format("P{0} {1}", player, JoypadConverter.ConvertBack(button, RunningSystem))] = true;
+ //joypadAdaptor.S
+ Global.LuaAndAdaptor.SetButton(string.Format("P{0} {1}", player, JoypadConverter.ConvertBack(button, RunningSystem)), true);
+ Global.ActiveController.Overrides(Global.LuaAndAdaptor);
+ }
+ }
+ );
+ }
}
+
///
- /// Convert a BizHawk to
+ /// Resume the emulation
///
- /// BizHawk systemId to convert
- /// SytemID as enum
- internal static EmulatedSystem BizHawkStringToEmulatedSytemEnum(string system)
+ public static void UnpauseEmulation()
{
- switch(system)
+ Type reflectClass = clientAssembly.GetType("BizHawk.Client.EmuHawk.MainForm");
+ MethodInfo method = reflectClass.GetMethod("UnpauseEmulator");
+ method.Invoke(clientMainForm, null);
+ }
+ #endregion Public
+
+ ///
+ /// Gets all current inputs for each joypad and store
+ /// them in class collection
+ ///
+ private static void GetAllInputs()
+ {
+ AutoFireStickyXorAdapter joypadAdaptor = Global.AutofireStickyXORAdapter;
+
+ IEnumerable pressedButtons = from button in joypadAdaptor.Type.BoolButtons
+ where joypadAdaptor[button]
+ select button;
+
+ foreach (Joypad j in allJoypads)
{
- case "AppleII":
- return EmulatedSystem.AppleII;
+ j.ClearInputs();
+ }
- case "A26":
- return EmulatedSystem.Atari2600;
+ Parallel.ForEach(pressedButtons, button =>
+ {
+ int player;
+ if (int.TryParse(button.Substring(1, 2), out player))
+ {
+ allJoypads[player - 1].AddInput(JoypadConverter.Convert(button.Substring(3)));
+ }
+ });
- case "A78":
- return EmulatedSystem.Atari2600;
-
- case "Coleco":
- return EmulatedSystem.ColecoVision;
-
- case "C64":
- return EmulatedSystem.Commodore64;
-
- case "DGB":
- return EmulatedSystem.DualGameBoy;
-
- case "GB":
- return EmulatedSystem.GameBoy;
-
- case "GBA":
- return EmulatedSystem.GameBoyAdvance;
-
- case "GEN":
- return EmulatedSystem.Genesis;
-
- case "INTV":
- return EmulatedSystem.Intellivision;
-
- case "Libretro":
- return EmulatedSystem.Libretro;
-
- case "Lynx":
- return EmulatedSystem.Lynx;
-
- case "SMS":
- return EmulatedSystem.MasterSystem;
-
- case "NES":
- return EmulatedSystem.NES;
-
- case "N64":
- return EmulatedSystem.Nintendo64;
-
- case "NULL":
- return EmulatedSystem.Null;
-
- case "PCE":
- return EmulatedSystem.PCEngine;
-
- case "PSX":
- return EmulatedSystem.Playstation;
-
- case "PSP":
- return EmulatedSystem.PSP;
-
- case "SAT":
- return EmulatedSystem.Saturn;
-
- case "SNES":
- return EmulatedSystem.SNES;
-
- case "TI83":
- return EmulatedSystem.TI83;
-
- case "WSWAN":
- return EmulatedSystem.WonderSwan;
-
- default:
- throw new IndexOutOfRangeException(string.Format("{0} is missing in convert list", system));
+ if ((RunningSystem.AvailableButtons & JoypadButton.AnalogStick) == JoypadButton.AnalogStick)
+ {
+ //joypadAdaptor.GetFloat();
}
}
@@ -266,13 +226,59 @@ namespace BizHawk.Client.ApiHawk
#region Properties
///
- /// Gets current emulated system id as enum
+ /// Gets current emulated system
///
- public static EmulatedSystem RunningSystem
+ public static SystemInfo RunningSystem
{
get
{
- return BizHawkStringToEmulatedSytemEnum(Common.Global.Emulator.SystemId);
+ switch (Global.Emulator.SystemId)
+ {
+ case "PCE":
+ if (((PCEngine)Global.Emulator).Type == NecSystemType.TurboGrafx)
+ {
+ return SystemInfo.PCE;
+ }
+ else if (((PCEngine)Global.Emulator).Type == NecSystemType.SuperGrafx)
+ {
+ return SystemInfo.SGX;
+ }
+ else
+ {
+ return SystemInfo.PCECD;
+ }
+
+ case "SMS":
+ if (((SMS)Global.Emulator).IsSG1000)
+ {
+ return SystemInfo.SG;
+ }
+ else if (((SMS)Global.Emulator).IsGameGear)
+ {
+ return SystemInfo.GG;
+ }
+ else
+ {
+ return SystemInfo.SMS;
+ }
+
+ case "GB":
+ if (Global.Emulator is Gameboy)
+ {
+ return SystemInfo.GB;
+ }
+ else if (Global.Emulator is GBColors)
+ {
+ return SystemInfo.GBC;
+ }
+ else
+ {
+ return SystemInfo.DualGB;
+ }
+
+ default:
+ return SystemInfo.FindByCoreSystem(SystemIdConverter.Convert(Global.Emulator.SystemId));
+ }
}
}
diff --git a/BizHawk.Client.ApiHawk/Classes/ExternalToolManager.cs b/BizHawk.Client.ApiHawk/Classes/ExternalToolManager.cs
index 33388a5518..1217959080 100644
--- a/BizHawk.Client.ApiHawk/Classes/ExternalToolManager.cs
+++ b/BizHawk.Client.ApiHawk/Classes/ExternalToolManager.cs
@@ -116,7 +116,7 @@ namespace BizHawk.Client.ApiHawk
item.ToolTipText = "This tool doesn't work if nothing is loaded";
item.Enabled = false;
}
- else if(attribute2.ToolUsage == BizHawkExternalToolUsage.EmulatorSpecific && Global.Emulator.SystemId != ClientApi.EmulatedSytemEnumToBizhawkString(attribute2.System))
+ else if(attribute2.ToolUsage == BizHawkExternalToolUsage.EmulatorSpecific && Global.Emulator.SystemId != ClientApi.SystemIdConverter.ConvertBack(attribute2.System))
{
item.ToolTipText = "This tool doesn't work for current system";
item.Enabled = false;
diff --git a/BizHawk.Client.ApiHawk/Classes/Joypad.cs b/BizHawk.Client.ApiHawk/Classes/Joypad.cs
new file mode 100644
index 0000000000..e4dd93dc95
--- /dev/null
+++ b/BizHawk.Client.ApiHawk/Classes/Joypad.cs
@@ -0,0 +1,106 @@
+using System;
+using BizHawk.Client.Common;
+
+namespace BizHawk.Client.ApiHawk
+{
+ ///
+ /// This class holds a joypad for any type of console
+ ///
+ public sealed class Joypad
+ {
+ #region Fields
+
+ private SystemInfo _System;
+ private JoypadButton _PressedButtons;
+ private int _Player;
+
+ #endregion
+
+ #region cTor(s)
+
+ ///
+ /// Initialize a new instance of
+ ///
+ /// What this is used for
+ /// Which player this controller is assigned to
+ internal Joypad(SystemInfo system, int player)
+ {
+ if (player < 1 || player > system.MaxControllers)
+ {
+ throw new InvalidOperationException(string.Format("{0} is invalid for {1}", player, system.DisplayName));
+ }
+
+ _System = system;
+ _Player = player;
+ }
+
+ #endregion
+
+ #region Methods
+
+ ///
+ /// Add specified input to current ones
+ ///
+ /// Input to add
+ public void AddInput(JoypadButton input)
+ {
+ input &= _System.AvailableButtons;
+ _PressedButtons |= input;
+ }
+
+
+ ///
+ /// Clear inputs
+ ///
+ public void ClearInputs()
+ {
+ _PressedButtons = 0;
+ }
+
+
+ ///
+ /// Remove specified input to current ones
+ ///
+ /// Input to remove
+ public void RemoveInput(JoypadButton input)
+ {
+ _PressedButtons ^= input;
+ }
+
+ #endregion
+
+
+ #region Properties
+
+ ///
+ /// Gets or sets inputs
+ /// If you pass inputs unavailable for current system, they'll be removed
+ ///
+ /// It overrides all existing inputs
+ public JoypadButton Inputs
+ {
+ get
+ {
+ return _PressedButtons;
+ }
+ set
+ {
+ value &= _System.AvailableButtons;
+ _PressedButtons = value;
+ }
+ }
+
+ ///
+ /// Gets for current
+ ///
+ public SystemInfo System
+ {
+ get
+ {
+ return _System;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/BizHawk.Client.ApiHawk/Classes/JoypadStringToEnumConverter.cs b/BizHawk.Client.ApiHawk/Classes/JoypadStringToEnumConverter.cs
new file mode 100644
index 0000000000..2ca467804b
--- /dev/null
+++ b/BizHawk.Client.ApiHawk/Classes/JoypadStringToEnumConverter.cs
@@ -0,0 +1,126 @@
+using System;
+using System.Globalization;
+using BizHawk.Client.Common;
+
+namespace BizHawk.Client.ApiHawk
+{
+ ///
+ /// This class holds a converter for BizHawk joypad buttons (which is a simple
+ /// It allows you to convert it to a value and vice versa
+ ///
+ /// I made it this way just in case one day we need it for WPF (DependencyProperty binding). Just uncomment :IValueConverter implementation
+ /// I didn't implemented it because of mono compatibility
+ ///
+ public sealed class JoypadStringToEnumConverter //:IValueConverter
+ {
+ ///
+ /// Convert BizHawk button to value
+ ///
+ /// you want to convert
+ /// The type of the binding target property
+ /// The converter parameter to use; null in our case
+ /// The culture to use in the converter
+ /// A that is equivalent to BizHawk button
+ /// Thrown when SystemId hasn't been found
+ public object Convert(object value, Type targetType, object parameter, CultureInfo cultureInfo)
+ {
+ switch (((string)value).ToUpper())
+ {
+ case "A":
+ return JoypadButton.A;
+
+ case "B":
+ return JoypadButton.B;
+
+ case "START":
+ return JoypadButton.Start;
+
+ case "SELECT":
+ return JoypadButton.Select;
+
+ case "UP":
+ return JoypadButton.Up;
+
+ case "DOWN":
+ return JoypadButton.Down;
+
+ case "LEFT":
+ return JoypadButton.Left;
+
+ case "RIGHT":
+ return JoypadButton.Right;
+
+ default:
+ throw new IndexOutOfRangeException(string.Format("{0} is missing in convert list", value));
+ }
+ }
+
+
+ ///
+ /// Convert BizHawk button to value
+ ///
+ /// you want to convert
+ /// A that is equivalent to BizHawk button
+ /// Thrown when SystemId hasn't been found
+ public JoypadButton Convert(string value)
+ {
+ return (JoypadButton)Convert(value, null, null, CultureInfo.CurrentCulture);
+ }
+
+
+ ///
+ /// Convert a value to BizHawk
+ ///
+ /// you want to convert
+ /// The type of the binding target property
+ /// In our case, we pass the
+ /// The culture to use in the converter
+ /// A that is used by BizHawk
+ /// Thrown when hasn't been found
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo cultureInfo)
+ {
+ switch ((JoypadButton)value)
+ {
+ case JoypadButton.A:
+ return "A";
+
+ case JoypadButton.B:
+ return "B";
+
+ case JoypadButton.Start:
+ return "Start";
+
+ case JoypadButton.Select:
+ return "Select";
+
+ case JoypadButton.Up:
+ return "Up";
+
+ case JoypadButton.Down:
+ return "Down";
+
+ case JoypadButton.Left:
+ return "Left";
+
+ case JoypadButton.Right:
+ return "Right";
+
+ default:
+ throw new IndexOutOfRangeException(string.Format("{0} is missing in convert list", value));
+ }
+ }
+
+
+ ///
+ /// Convert a value to BizHawk
+ ///
+ /// you want to convert
+ /// Current
+ /// A that is used by BizHawk
+ /// Thrown when hasn't been found
+ public string ConvertBack(JoypadButton button, SystemInfo system)
+ {
+ return (string)ConvertBack(button, null, system, CultureInfo.CurrentCulture);
+ }
+ }
+}
diff --git a/BizHawk.Client.ApiHawk/Resources/ApiClassDiagram.cd b/BizHawk.Client.ApiHawk/Resources/ApiClassDiagram.cd
index a0bce9afc1..e67e4c43d9 100644
--- a/BizHawk.Client.ApiHawk/Resources/ApiClassDiagram.cd
+++ b/BizHawk.Client.ApiHawk/Resources/ApiClassDiagram.cd
@@ -9,7 +9,7 @@
-
+
@@ -17,7 +17,7 @@
-
+
@@ -53,7 +53,7 @@
- AAEAAAAAAAAAAAAAAAAAQAIAAAAAACAAAAAAAAACAAA=
+ CQEAAAAAgAAAQAAAAAABQAIAAAAAoGAACCAAAAAQAAA=
Classes\ClientApi.cs
@@ -64,6 +64,31 @@
Attributes\BizHawkExternalToolUsageAttribute.cs
+
+
+
+ AAAAAAAAAAAAAAAAAIAAAAAAAAgAAAAAAAAAAAAAAAA=
+ Classes\BizHawkSystemIdToCoreSystemEnumConverter.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAIAAAAAAAAgAAAAAAAAAAAAAAAA=
+ Classes\JoypadStringToEnumConverter.cs
+
+
+
+
+
+ AQAACAAAAIAAAACBAAgAAABAEAAAAAAAAAAAAAAAAAA=
+ Classes\Joypad.cs
+
+
+
+
+
+
@@ -98,12 +123,13 @@
Enums\BizHawkExternalToolUsage.cs
-
-
-
- SAACIAABQAAQCAAmAAAAAAAIAhAAAIAADAIAAIAgGAA=
- Enums\EmulatedSystem.cs
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BizHawk.Client.ApiHawk/Enums/EmulatedSystem.cs b/BizHawk.Client.Common/Api/CoreSystem.cs
similarity index 93%
rename from BizHawk.Client.ApiHawk/Enums/EmulatedSystem.cs
rename to BizHawk.Client.Common/Api/CoreSystem.cs
index 89c27d3dba..c7114e509c 100644
--- a/BizHawk.Client.ApiHawk/Enums/EmulatedSystem.cs
+++ b/BizHawk.Client.Common/Api/CoreSystem.cs
@@ -3,7 +3,7 @@
///
/// Enumeration of each system emulated by BizHawk
///
- public enum EmulatedSystem
+ public enum CoreSystem : int
{
Null = 0,
TI83,
diff --git a/BizHawk.Client.Common/Api/JoypadButton.cs b/BizHawk.Client.Common/Api/JoypadButton.cs
new file mode 100644
index 0000000000..4647961741
--- /dev/null
+++ b/BizHawk.Client.Common/Api/JoypadButton.cs
@@ -0,0 +1,57 @@
+using System;
+
+namespace BizHawk.Client.ApiHawk
+{
+ ///
+ /// This enumeration list all buttons
+ /// for all existing controllers
+ ///
+ [Flags]
+ public enum JoypadButton : int
+ {
+ A = 1,
+ B = 2,
+ C = 4,
+ X = 8,
+ Y = 16,
+ Z = 32,
+ L = 64,
+ R = 128,
+ Start = 256,
+ Select = 512,
+ Up = 1024,
+ Down = 2048,
+ Left = 4096,
+ Right = 8192,
+
+ ///
+ /// Master system Button 1
+ ///
+ B1 = 16384,
+ ///
+ /// Master system Button 1
+ ///
+ B2 = 32768,
+
+ ///
+ /// N64 C up
+ ///
+ CUp = 65536,
+ ///
+ /// N64 C down
+ ///
+ CDown = 131072,
+ ///
+ /// N64 C Left
+ ///
+ CLeft = 262144,
+ ///
+ /// N64 C Right
+ ///
+ CRight = 524288,
+ ///
+ /// N64 Analog stick
+ ///
+ AnalogStick = 1048576
+ }
+}
diff --git a/BizHawk.Client.Common/BizHawk.Client.Common.csproj b/BizHawk.Client.Common/BizHawk.Client.Common.csproj
index 25ee628237..610d55229a 100644
--- a/BizHawk.Client.Common/BizHawk.Client.Common.csproj
+++ b/BizHawk.Client.Common/BizHawk.Client.Common.csproj
@@ -137,6 +137,8 @@
+
+
diff --git a/BizHawk.Client.Common/SystemInfo.cs b/BizHawk.Client.Common/SystemInfo.cs
index 4915307d60..af19433b63 100644
--- a/BizHawk.Client.Common/SystemInfo.cs
+++ b/BizHawk.Client.Common/SystemInfo.cs
@@ -1,295 +1,537 @@
-using System;
-using BizHawk.Emulation.Common;
+using System.Collections.Generic;
+using BizHawk.Client.ApiHawk;
namespace BizHawk.Client.Common
{
- public class SystemInfo
+ ///
+ /// This class holds logic for System information.
+ /// That means specifiactions about a system that BizHawk emulate
+ ///
+ public sealed class SystemInfo
{
- public SystemInfo() { }
+ #region Fields
- public string DisplayName { get; set; }
+ private const JoypadButton UpDownLeftRight = JoypadButton.Up | JoypadButton.Down | JoypadButton.Left | JoypadButton.Right;
+ private const JoypadButton StandardButtons = JoypadButton.A | JoypadButton.B | JoypadButton.Start | JoypadButton.Select | UpDownLeftRight;
- public static SystemInfo Null
+ private static readonly List allSystemInfos;
+
+ private string _DisplayName;
+ private CoreSystem _System;
+ private JoypadButton _AvailableButtons;
+ private int _MaxControllers;
+
+ #endregion
+
+ #region cTor(s)
+
+ ///
+ /// Global initialization stuff
+ ///
+ /// DO NOT CHANGE List order because properties depends on it (and it is hardcoded)
+ static SystemInfo()
{
- get
- {
- return new SystemInfo
- {
- DisplayName = "",
- };
- }
+ allSystemInfos = new List(26);
+
+ allSystemInfos.Add(new SystemInfo(string.Empty));
+ allSystemInfos.Add(new SystemInfo("NES", CoreSystem.NES, 2, StandardButtons));
+ allSystemInfos.Add(new SystemInfo("Intellivision", CoreSystem.Intellivision, 2));
+ allSystemInfos.Add(new SystemInfo("Sega Master System", CoreSystem.MasterSystem, 2, UpDownLeftRight | JoypadButton.B1 | JoypadButton.B2));
+ allSystemInfos.Add(new SystemInfo("SG-1000", CoreSystem.MasterSystem, 1));
+ allSystemInfos.Add(new SystemInfo("Game Gear", CoreSystem.MasterSystem, 1, UpDownLeftRight | JoypadButton.B1 | JoypadButton.B2));
+ allSystemInfos.Add(new SystemInfo("TurboGrafx-16", CoreSystem.PCEngine, 1));
+ allSystemInfos.Add(new SystemInfo("TurboGrafx - 16(CD)", CoreSystem.PCEngine, 1));
+ allSystemInfos.Add(new SystemInfo("SuperGrafx", CoreSystem.PCEngine, 1));
+ allSystemInfos.Add(new SystemInfo("Genesis", CoreSystem.Genesis, 2, UpDownLeftRight | JoypadButton.A | JoypadButton.B | JoypadButton.C | JoypadButton.X | JoypadButton.Y | JoypadButton.Z));
+ allSystemInfos.Add(new SystemInfo("TI - 83", CoreSystem.TI83, 1));
+ allSystemInfos.Add(new SystemInfo("SNES", CoreSystem.SNES, 8, StandardButtons | JoypadButton.X | JoypadButton.Y | JoypadButton.L | JoypadButton.R));
+ allSystemInfos.Add(new SystemInfo("GB", CoreSystem.GameBoy, 1, StandardButtons));
+ allSystemInfos.Add(new SystemInfo("Gameboy Color", CoreSystem.GameBoy, 1, StandardButtons)); //13 (0 based)
+ allSystemInfos.Add(new SystemInfo("Atari 2600", CoreSystem.Atari2600, 1));
+ allSystemInfos.Add(new SystemInfo("Atari 7800", CoreSystem.Atari7800, 1));
+ allSystemInfos.Add(new SystemInfo("Commodore 64", CoreSystem.Commodore64, 1));
+ allSystemInfos.Add(new SystemInfo("ColecoVision", CoreSystem.ColecoVision, 1));
+ allSystemInfos.Add(new SystemInfo("Gameboy Advance", CoreSystem.GameBoyAdvance, 1, StandardButtons | JoypadButton.L | JoypadButton.R));
+ allSystemInfos.Add(new SystemInfo("Nintendo 64", CoreSystem.Nintendo64, 4, StandardButtons ^ JoypadButton.Select | JoypadButton.Z | JoypadButton.CUp | JoypadButton.CDown | JoypadButton.CLeft | JoypadButton.CRight | JoypadButton.AnalogStick));
+ allSystemInfos.Add(new SystemInfo("Saturn", CoreSystem.Saturn, 2, UpDownLeftRight | JoypadButton.A | JoypadButton.B | JoypadButton.C | JoypadButton.X | JoypadButton.Y | JoypadButton.Z));
+ allSystemInfos.Add(new SystemInfo("Game Boy Link", CoreSystem.DualGameBoy, 2, StandardButtons));
+ allSystemInfos.Add(new SystemInfo("WonderSwan", CoreSystem.WonderSwan, 1));
+ allSystemInfos.Add(new SystemInfo("Lynx", CoreSystem.Lynx, 1));
+ allSystemInfos.Add(new SystemInfo("PlayStation", CoreSystem.Playstation, 2));
+ allSystemInfos.Add(new SystemInfo("Apple II", CoreSystem.AppleII, 1));
}
- public static SystemInfo Nes
+ ///
+ /// Initialize a new instance of
+ ///
+ /// A that specify how the system name is displayed
+ /// A that specify what core is used
+ /// Maximum controller allowed by this system
+ /// Which buttons are available (i.e. are actually on the controller) for this system
+ private SystemInfo(string displayName, CoreSystem system, int maxControllers, JoypadButton availableButtons)
{
- get
- {
- return new SystemInfo
- {
- DisplayName = "NES",
- };
- }
+ _DisplayName = displayName;
+ _System = system;
+ _MaxControllers = maxControllers;
+ _AvailableButtons = availableButtons;
}
- public static SystemInfo Intellivision
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "Intellivision",
- };
- }
- }
+ ///
+ /// Initialize a new instance of
+ ///
+ /// A that specify how the system name is displayed
+ /// A that specify what core is used
+ /// Maximum controller allowed by this system
+ private SystemInfo(string displayName, CoreSystem system, int maxControllers)
+ : this(displayName, system, maxControllers, 0)
+ { }
- public static SystemInfo SMS
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "Sega Master System",
- };
- }
- }
+ ///
+ /// Initialize a new instance of
+ ///
+ /// A that specify how the system name is displayed
+ private SystemInfo(string displayName)
+ : this(displayName, CoreSystem.Null, 0, 0)
+ { }
- public static SystemInfo SG
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "SG-1000",
- };
- }
- }
+ #endregion
- public static SystemInfo GG
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "Game Gear",
- };
- }
- }
+ #region Methods
- public static SystemInfo PCE
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "TurboGrafx-16",
- };
- }
- }
-
- public static SystemInfo PCECD
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "TurboGrafx-16 (CD)",
- };
- }
- }
-
- public static SystemInfo SGX
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "SuperGrafx",
- };
- }
- }
-
- public static SystemInfo Genesis
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "Genesis",
- };
- }
- }
-
- public static SystemInfo TI83
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "TI-83",
- };
- }
- }
-
- public static SystemInfo SNES
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "SNES",
- };
- }
- }
-
- public static SystemInfo GB
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "Gameboy",
- };
- }
- }
-
- public static SystemInfo GBC
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "Gameboy Color",
- };
- }
- }
-
- public static SystemInfo Atari2600
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "Atari 2600",
- };
- }
- }
-
- public static SystemInfo Atari7800
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "Atari 7800",
- };
- }
- }
-
- public static SystemInfo C64
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "Commodore 64",
- };
- }
- }
-
- public static SystemInfo Coleco
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "ColecoVision",
- };
- }
- }
-
- public static SystemInfo GBA
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "Gameboy Advance",
- };
- }
- }
-
- public static SystemInfo N64
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "Nintendo 64",
- };
- }
- }
-
- public static SystemInfo Saturn
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "Saturn",
- };
- }
- }
-
- public static SystemInfo DualGB
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "Game Boy Link",
- };
- }
- }
-
- public static SystemInfo WonderSwan
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "WonderSwan",
- };
- }
- }
- public static SystemInfo Lynx
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "Lynx",
- };
- }
- }
- public static SystemInfo PSX
- {
- get
- {
- return new SystemInfo
- {
- DisplayName = "PlayStation",
- };
- }
- }
+ #region Get SystemInfo
+ ///
+ /// Gets the instance for Apple II
+ ///
+ /// Gets the instance for Atari 2600
+ ///
+ /// Gets the instance for Atari 7800
+ ///
+ public static SystemInfo Atari7800
+ {
+ get
+ {
+ return allSystemInfos[15];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for Commodore 64
+ ///
+ public static SystemInfo C64
+ {
+ get
+ {
+ return allSystemInfos[16];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for Coleco Vision
+ ///
+ public static SystemInfo Coleco
+ {
+ get
+ {
+ return allSystemInfos[17];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for Dual Gameboy
+ ///
+ public static SystemInfo DualGB
+ {
+ get
+ {
+ return allSystemInfos[21];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for Gameboy
+ ///
+ public static SystemInfo GB
+ {
+ get
+ {
+ return allSystemInfos[12];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for Gameboy Advance
+ ///
+ public static SystemInfo GBA
+ {
+ get
+ {
+ return allSystemInfos[18];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for Gameboy Color
+ ///
+ public static SystemInfo GBC
+ {
+ get
+ {
+ return allSystemInfos[13];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for Genesis
+ ///
+ public static SystemInfo Genesis
+ {
+ get
+ {
+ return allSystemInfos[9];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for Game Gear
+ ///
+ public static SystemInfo GG
+ {
+ get
+ {
+ return allSystemInfos[5];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for Intellivision
+ ///
+ public static SystemInfo Intellivision
+ {
+ get
+ {
+ return allSystemInfos[2];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for Lynx
+ ///
+ public static SystemInfo Lynx
+ {
+ get
+ {
+ return allSystemInfos[23];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for NES
+ ///
+ public static SystemInfo Nes
+ {
+ get
+ {
+ return allSystemInfos[1];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for Nintendo 64
+ ///
+ public static SystemInfo N64
+ {
+ get
+ {
+ return allSystemInfos[19];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for Null (i.e. nothing is emulated) emulator
+ ///
+ public static SystemInfo Null
+ {
+ get
+ {
+ return allSystemInfos[0];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for PCEngine (TurboGrafx-16)
+ ///
+ public static SystemInfo PCE
+ {
+ get
+ {
+ return allSystemInfos[6];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for PCEngine (TurboGrafx-16) + CD
+ ///
+ public static SystemInfo PCECD
+ {
+ get
+ {
+ return allSystemInfos[7];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for PlayStation
+ ///
+ public static SystemInfo PSX
+ {
+ get
+ {
+ return allSystemInfos[24];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for Sega Saturn
+ ///
+ public static SystemInfo Saturn
+ {
+ get
+ {
+ return allSystemInfos[20];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for SG-1000 (Sega Game 1000)
+ ///
+ public static SystemInfo SG
+ {
+ get
+ {
+ return allSystemInfos[4];
+ }
+ }
+
+
+
+ ///
+ /// Gets the instance for PCEngine (Supergraph FX)
+ ///
+ public static SystemInfo SGX
+ {
+ get
+ {
+ return allSystemInfos[8];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for Sega Master System
+ ///
+ public static SystemInfo SMS
+ {
+ get
+ {
+ return allSystemInfos[3];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for SNES
+ ///
+ public static SystemInfo SNES
+ {
+ get
+ {
+ return allSystemInfos[11];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for TI-83
+ ///
+ public static SystemInfo TI83
+ {
+ get
+ {
+ return allSystemInfos[10];
+ }
+ }
+
+
+ ///
+ /// Gets the instance for TI-83
+ ///
+ public static SystemInfo WonderSwan
+ {
+ get
+ {
+ return allSystemInfos[22];
+ }
+ }
+ #endregion Get SystemInfo
+
+ ///
+ /// Get a by its
+ ///
+ /// you're looking for
+ /// Mathing
+ public static SystemInfo FindByCoreSystem(CoreSystem system)
+ {
+ return allSystemInfos.Find(s => s._System == system);
+ }
+
+ ///
+ /// Determine if this is equal to specified
+ ///
+ /// to comapre to
+ /// True if object is equal to this instance; otherwise, false
+ public override bool Equals(object obj)
+ {
+ if (obj is SystemInfo)
+ {
+ return this == (SystemInfo)obj;
+ }
+ else
+ {
+ return base.Equals(obj);
+ }
+ }
+
+ ///
+ /// Gets the haschode for current insance
+ ///
+ /// This instance hashcode
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ ///
+ /// Returns a representation of current
+ /// In fact, return the same as DisplayName property
+ ///
+ ///
+ public override string ToString()
+ {
+ return _DisplayName;
+ }
+
+
+ ///
+ /// Determine if two are equals.
+ /// As it is all static instance, it just compare their reference
+ ///
+ /// First
+ /// Second
+ /// True if both system are equals; otherwise, false
+ public static bool operator ==(SystemInfo system1, SystemInfo system2)
+ {
+ return ReferenceEquals(system1, system2);
+ }
+
+ ///
+ /// Determine if two are different.
+ /// As it is all static instance, it just compare their reference
+ ///
+ /// First
+ /// Second
+ /// True if both system are diferent; otherwise, false
+ public static bool operator !=(SystemInfo system1, SystemInfo system2)
+ {
+ return !(system1 == system2);
+ }
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Gets available for this system
+ ///
+ public JoypadButton AvailableButtons
+ {
+ get
+ {
+ return _AvailableButtons;
+ }
+ }
+
+ ///
+ /// Gets the sytem name as
+ ///
+ public string DisplayName
+ {
+ get
+ {
+ return _DisplayName;
+ }
+ }
+
+
+ ///
+ /// Gets the maximum amount of controller allowed for this system
+ ///
+ public int MaxControllers
+ {
+ get
+ {
+ return _MaxControllers;
+ }
+ }
+
+ ///
+ /// Gets core used for this system as enum
+ ///
+ public CoreSystem System
+ {
+ get
+ {
+ return _System;
+ }
+ }
+
+ #endregion
}
}
diff --git a/BizHawk.Client.Common/tools/Watch/Watch.cs b/BizHawk.Client.Common/tools/Watch/Watch.cs
index affdf673fb..a4b1f1c8ed 100644
--- a/BizHawk.Client.Common/tools/Watch/Watch.cs
+++ b/BizHawk.Client.Common/tools/Watch/Watch.cs
@@ -730,7 +730,7 @@ namespace BizHawk.Client.Common
}
internal set
{
- if (_domain.Name == value.Name)
+ if (value != null &&_domain.Name == value.Name)
{
_domain = value;
}