Work on input get/set through ApiHawk
Convertion has been moved to dedicated class SystemInfo class review SystemInfo class now instanciate all SystemInfo and stores them in a static readonly collection (avoid creating a new class each time we call DisplayName property). + EmulatedSystem enum (in Api) renamed to CoreSystem and moved to BizHawk.Client.Common + this enum is used in SystemInfo class Created a Joypad class that is populated with JoypadButton enum flags Input get/set throught ApiHawk works for NES only. So many work remains...
This commit is contained in:
parent
1b8a51e447
commit
fcb0c8bc32
|
@ -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 <see cref="BizHawkExternalToolUsageAttribute"/>
|
||||
/// </summary>
|
||||
/// <param name="usage"><see cref="BizHawkExternalToolUsage"/> i.e. what your external tool is for</param>
|
||||
/// <param name="system"><see cref="EmulatedSystem"/> that your external tool is used for</param>
|
||||
/// <param name="system"><see cref="CoreSystem"/> that your external tool is used for</param>
|
||||
/// <param name="gameHash">The game hash, unique game ID (see in the game database)</param>
|
||||
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 <see cref="BizHawkExternalToolUsageAttribute"/>
|
||||
/// </summary>
|
||||
/// <param name="usage"><see cref="BizHawkExternalToolUsage"/> i.e. what your external tool is for</param>
|
||||
/// <param name="system"><see cref="EmulatedSystem"/> that your external tool is used for</param>
|
||||
public BizHawkExternalToolUsageAttribute(BizHawkExternalToolUsage usage, EmulatedSystem system)
|
||||
/// <param name="system"><see cref="CoreSystem"/> that your external tool is used for</param>
|
||||
public BizHawkExternalToolUsageAttribute(BizHawkExternalToolUsage usage, CoreSystem system)
|
||||
:this(usage, system, string.Empty)
|
||||
{}
|
||||
|
||||
|
@ -54,7 +54,7 @@ namespace BizHawk.Client.ApiHawk
|
|||
/// Initialize a new instance of <see cref="BizHawkExternalToolUsageAttribute"/>
|
||||
/// </summary>
|
||||
public BizHawkExternalToolUsageAttribute()
|
||||
:this(BizHawkExternalToolUsage.Global, EmulatedSystem.Null, string.Empty)
|
||||
:this(BizHawkExternalToolUsage.Global, CoreSystem.Null, string.Empty)
|
||||
{ }
|
||||
|
||||
|
||||
|
@ -65,7 +65,7 @@ namespace BizHawk.Client.ApiHawk
|
|||
/// <summary>
|
||||
/// Gets the specific system used by the exetrnal tool
|
||||
/// </summary>
|
||||
public EmulatedSystem System
|
||||
public CoreSystem System
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||
<DocumentationFile>..\output64\dll\BizHawk.Client.ApiHawk.XML</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
|
@ -81,8 +82,7 @@
|
|||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DocumentationFile>..\output\dll\BizHawk.Client.ApiHawk.XML</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
@ -98,10 +98,12 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="Attributes\BizHawkExternalToolUsageAttribute.cs" />
|
||||
<Compile Include="Attributes\BizHawkExternalToolAttribute.cs" />
|
||||
<Compile Include="Classes\BizHawkSystemIdToCoreSystemEnumConverter.cs" />
|
||||
<Compile Include="Classes\Joypad.cs" />
|
||||
<Compile Include="Classes\JoypadStringToEnumConverter.cs" />
|
||||
<Compile Include="Enums\BizHawkExternalToolUsage.cs" />
|
||||
<Compile Include="Classes\ClientApi.cs" />
|
||||
<Compile Include="Classes\ExternalToolManager.cs" />
|
||||
<Compile Include="Enums\EmulatedSystem.cs" />
|
||||
<Compile Include="Interfaces\IExternalToolForm.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
@ -118,6 +120,10 @@
|
|||
<Project>{e1a23168-b571-411c-b360-2229e7225e0e}</Project>
|
||||
<Name>BizHawk.Emulation.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\BizHawk.Emulation.Cores\BizHawk.Emulation.Cores.csproj">
|
||||
<Project>{197d4314-8a9f-49ba-977d-54acefaeb6ba}</Project>
|
||||
<Name>BizHawk.Emulation.Cores</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
|
|
|
@ -0,0 +1,214 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace BizHawk.Client.ApiHawk
|
||||
{
|
||||
/// <summary>
|
||||
/// This class holds a converter for BizHawk SystemId (which is a simple <see cref="string"/>
|
||||
/// It allows you to convert it to a <see cref="CoreSystem"/> value and vice versa
|
||||
/// </summary>
|
||||
/// <remarks>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
|
||||
/// </remarks>
|
||||
public sealed class BizHawkSystemIdToEnumConverter //:IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Convert BizHawk SystemId <see cref="string"/> to <see cref="CoreSystem"/> value
|
||||
/// </summary>
|
||||
/// <param name="value"><see cref="string"/> you want to convert</param>
|
||||
/// <param name="targetType">The type of the binding target property</param>
|
||||
/// <param name="parameter">The converter parameter to use; null in our case</param>
|
||||
/// <param name="cultureInfo">The culture to use in the converter</param>
|
||||
/// <returns>A <see cref="CoreSystem"/> that is equivalent to BizHawk SystemId <see cref="string"/></returns>
|
||||
/// <exception cref="IndexOutOfRangeException">Thrown when SystemId hasn't been found</exception>
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert BizHawk SystemId <see cref="string"/> to <see cref="CoreSystem"/> value
|
||||
/// </summary>
|
||||
/// <param name="value"><see cref="string"/> you want to convert</param>
|
||||
/// <returns>A <see cref="CoreSystem"/> that is equivalent to BizHawk SystemId <see cref="string"/></returns>
|
||||
/// <exception cref="IndexOutOfRangeException">Thrown when SystemId hasn't been found</exception>
|
||||
public CoreSystem Convert(string value)
|
||||
{
|
||||
return (CoreSystem)Convert(value, null, null, CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a <see cref="CoreSystem"/> value to BizHawk SystemId <see cref="string"/>
|
||||
/// </summary>
|
||||
/// <param name="value"><see cref="CoreSystem"/> you want to convert</param>
|
||||
/// <param name="targetType">The type of the binding target property</param>
|
||||
/// <param name="parameter">The converter parameter to use; null in our case</param>
|
||||
/// <param name="cultureInfo">The culture to use in the converter</param>
|
||||
/// <returns>A <see cref="string"/> that is used by BizHawk SystemId</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">Thrown when <see cref="CoreSystem"/> hasn't been found</exception>
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a <see cref="CoreSystem"/> value to BizHawk SystemId <see cref="string"/>
|
||||
/// </summary>
|
||||
/// <param name="value"><see cref="CoreSystem"/> you want to convert</param>
|
||||
/// <returns>A <see cref="string"/> that is used by BizHawk SystemId</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">Thrown when <see cref="CoreSystem"/> hasn't been found</exception>
|
||||
public string ConvertBack(CoreSystem value)
|
||||
{
|
||||
return (string)ConvertBack(value, null, null, CultureInfo.CurrentCulture);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<Joypad> allJoypads;
|
||||
|
||||
#endregion
|
||||
|
||||
#region cTor(s)
|
||||
|
@ -30,15 +42,48 @@ namespace BizHawk.Client.ApiHawk
|
|||
|
||||
#region Methods
|
||||
|
||||
#region Public
|
||||
/// <summary>
|
||||
/// THE FrameAdvance stuff
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// THE FrameAdvance stuff
|
||||
/// Auto unpause emulation
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Joypad"/> for specified player
|
||||
/// </summary>
|
||||
/// <param name="player">Player (one based) you want current inputs</param>
|
||||
/// <returns>A <see cref="Joypad"/> populated with current inputs</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">Raised when you specify a player less than 1 or greater than maximum allows (see SystemInfo class to get this information)</exception>
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raise when a rom is successfully Loaded
|
||||
|
@ -49,8 +94,15 @@ namespace BizHawk.Client.ApiHawk
|
|||
{
|
||||
RomLoaded(null, EventArgs.Empty);
|
||||
}
|
||||
|
||||
allJoypads = new List<Joypad>(RunningSystem.MaxControllers);
|
||||
for (int i = 1; i <= RunningSystem.MaxControllers; i++)
|
||||
{
|
||||
allJoypads.Add(new Joypad(RunningSystem, i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the extra padding added to the 'native' surface so that you can draw HUD elements in predictable placements
|
||||
/// </summary>
|
||||
|
@ -95,169 +147,77 @@ namespace BizHawk.Client.ApiHawk
|
|||
SetExtraPadding(left, top, right, 0);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a specified <see cref="EmulatedSystem"/> into a <see cref="string"/> used in BizHawk internal code
|
||||
/// Set inputs in specified <see cref="Joypad"/> to specified player
|
||||
/// </summary>
|
||||
/// <param name="system"><see cref="EmulatedSystem"/> to convert</param>
|
||||
/// <returns>Emulated system as <see cref="string"/> used in BizHawk code</returns>
|
||||
internal static string EmulatedSytemEnumToBizhawkString(EmulatedSystem system)
|
||||
/// <param name="player">Player (one based) whom inputs must be set</param>
|
||||
/// <param name="joypad"><see cref="Joypad"/> with inputs</param>
|
||||
/// <exception cref="IndexOutOfRangeException">Raised when you specify a player less than 1 or greater than maximum allows (see SystemInfo class to get this information)</exception>
|
||||
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<JoypadButton>((IEnumerable<JoypadButton>)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);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a BizHawk <see cref="string"/> to <see cref="EmulatedSystem"/>
|
||||
/// Resume the emulation
|
||||
/// </summary>
|
||||
/// <param name="system">BizHawk systemId to convert</param>
|
||||
/// <returns>SytemID as <see cref="EmulatedSystem"/> enum</returns>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// Gets all current inputs for each joypad and store
|
||||
/// them in <see cref="Joypad"/> class collection
|
||||
/// </summary>
|
||||
private static void GetAllInputs()
|
||||
{
|
||||
AutoFireStickyXorAdapter joypadAdaptor = Global.AutofireStickyXORAdapter;
|
||||
|
||||
IEnumerable<string> 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<string>(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
|
||||
|
||||
/// <summary>
|
||||
/// Gets current emulated system id as <see cref="EmulatedSystem"/> enum
|
||||
/// Gets current emulated system
|
||||
/// </summary>
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
using System;
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.ApiHawk
|
||||
{
|
||||
/// <summary>
|
||||
/// This class holds a joypad for any type of console
|
||||
/// </summary>
|
||||
public sealed class Joypad
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private SystemInfo _System;
|
||||
private JoypadButton _PressedButtons;
|
||||
private int _Player;
|
||||
|
||||
#endregion
|
||||
|
||||
#region cTor(s)
|
||||
|
||||
/// <summary>
|
||||
/// Initialize a new instance of <see cref="Joypad"/>
|
||||
/// </summary>
|
||||
/// <param name="system">What <see cref="SystemInfo"/> this <see cref="Joypad"/> is used for</param>
|
||||
/// <param name="player">Which player this controller is assigned to</param>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// Add specified input to current ones
|
||||
/// </summary>
|
||||
/// <param name="input">Input to add</param>
|
||||
public void AddInput(JoypadButton input)
|
||||
{
|
||||
input &= _System.AvailableButtons;
|
||||
_PressedButtons |= input;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Clear inputs
|
||||
/// </summary>
|
||||
public void ClearInputs()
|
||||
{
|
||||
_PressedButtons = 0;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Remove specified input to current ones
|
||||
/// </summary>
|
||||
/// <param name="input">Input to remove</param>
|
||||
public void RemoveInput(JoypadButton input)
|
||||
{
|
||||
_PressedButtons ^= input;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets inputs
|
||||
/// If you pass inputs unavailable for current system, they'll be removed
|
||||
/// </summary>
|
||||
/// <remarks>It overrides all existing inputs</remarks>
|
||||
public JoypadButton Inputs
|
||||
{
|
||||
get
|
||||
{
|
||||
return _PressedButtons;
|
||||
}
|
||||
set
|
||||
{
|
||||
value &= _System.AvailableButtons;
|
||||
_PressedButtons = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets <see cref="SystemInfo"/> for current <see cref="Joypad"/>
|
||||
/// </summary>
|
||||
public SystemInfo System
|
||||
{
|
||||
get
|
||||
{
|
||||
return _System;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.ApiHawk
|
||||
{
|
||||
/// <summary>
|
||||
/// This class holds a converter for BizHawk joypad buttons (which is a simple <see cref="string"/>
|
||||
/// It allows you to convert it to a <see cref="JoypadButton"/> value and vice versa
|
||||
/// </summary>
|
||||
/// <remarks>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
|
||||
/// </remarks>
|
||||
public sealed class JoypadStringToEnumConverter //:IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Convert BizHawk button <see cref="string"/> to <see cref="JoypadButton"/> value
|
||||
/// </summary>
|
||||
/// <param name="value"><see cref="string"/> you want to convert</param>
|
||||
/// <param name="targetType">The type of the binding target property</param>
|
||||
/// <param name="parameter">The converter parameter to use; null in our case</param>
|
||||
/// <param name="cultureInfo">The culture to use in the converter</param>
|
||||
/// <returns>A <see cref="JoypadButton"/> that is equivalent to BizHawk <see cref="string"/> button</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">Thrown when SystemId hasn't been found</exception>
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert BizHawk button <see cref="string"/> to <see cref="JoypadButton"/> value
|
||||
/// </summary>
|
||||
/// <param name="value"><see cref="string"/> you want to convert</param>
|
||||
/// <returns>A <see cref="JoypadButton"/> that is equivalent to BizHawk <see cref="string"/> button</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">Thrown when SystemId hasn't been found</exception>
|
||||
public JoypadButton Convert(string value)
|
||||
{
|
||||
return (JoypadButton)Convert(value, null, null, CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a <see cref="JoypadButton"/> value to BizHawk <see cref="string"/>
|
||||
/// </summary>
|
||||
/// <param name="value"><see cref="JoypadButton"/> you want to convert</param>
|
||||
/// <param name="targetType">The type of the binding target property</param>
|
||||
/// <param name="parameter">In our case, we pass the <see cref="SystemInfo"/></param>
|
||||
/// <param name="cultureInfo">The culture to use in the converter</param>
|
||||
/// <returns>A <see cref="string"/> that is used by BizHawk</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">Thrown when <see cref="JoypadButton"/> hasn't been found</exception>
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a <see cref="JoypadButton"/> value to BizHawk <see cref="string"/>
|
||||
/// </summary>
|
||||
/// <param name="button"><see cref="JoypadButton"/> you want to convert</param>
|
||||
/// <param name="system">Current <see cref="SystemInfo"/></param>
|
||||
/// <returns>A <see cref="string"/> that is used by BizHawk</returns>
|
||||
/// <exception cref="IndexOutOfRangeException">Thrown when <see cref="JoypadButton"/> hasn't been found</exception>
|
||||
public string ConvertBack(JoypadButton button, SystemInfo system)
|
||||
{
|
||||
return (string)ConvertBack(button, null, system, CultureInfo.CurrentCulture);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
<Lollipop Orientation="Left" Position="0.1" />
|
||||
</Class>
|
||||
<Class Name="BizHawk.Client.Common.SeparatorWatch">
|
||||
<Position X="6" Y="19" Width="3.25" />
|
||||
<Position X="9.25" Y="19.25" Width="3.25" />
|
||||
<TypeIdentifier />
|
||||
</Class>
|
||||
<Class Name="BizHawk.Client.Common.ByteWatch">
|
||||
|
@ -17,7 +17,7 @@
|
|||
<TypeIdentifier />
|
||||
</Class>
|
||||
<Class Name="BizHawk.Client.Common.WordWatch">
|
||||
<Position X="9.5" Y="19" Width="3.25" />
|
||||
<Position X="13.5" Y="19" Width="3.25" />
|
||||
<TypeIdentifier />
|
||||
</Class>
|
||||
<Class Name="BizHawk.Client.Common.DWordWatch">
|
||||
|
@ -53,7 +53,7 @@
|
|||
<Class Name="BizHawk.Client.ApiHawk.ClientApi">
|
||||
<Position X="4.75" Y="10" Width="4" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAEAAAAAAAAAAAAAAAAAQAIAAAAAACAAAAAAAAACAAA=</HashCode>
|
||||
<HashCode>CQEAAAAAgAAAQAAAAAABQAIAAAAAoGAACCAAAAAQAAA=</HashCode>
|
||||
<FileName>Classes\ClientApi.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
|
@ -64,6 +64,31 @@
|
|||
<FileName>Attributes\BizHawkExternalToolUsageAttribute.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="BizHawk.Client.ApiHawk.BizHawkSystemIdToEnumConverter">
|
||||
<Position X="10.75" Y="9.75" Width="6" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAIAAAAAAAAgAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Classes\BizHawkSystemIdToCoreSystemEnumConverter.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="BizHawk.Client.ApiHawk.JoypadStringToEnumConverter">
|
||||
<Position X="10.75" Y="11.75" Width="6" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAIAAAAAAAAgAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Classes\JoypadStringToEnumConverter.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="BizHawk.Client.ApiHawk.Joypad">
|
||||
<Position X="0.75" Y="6.75" Width="3" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AQAACAAAAIAAAACBAAgAAABAEAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Classes\Joypad.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="BizHawk.Client.Common.SystemInfo">
|
||||
<Position X="0.5" Y="10.25" Width="4" />
|
||||
<TypeIdentifier />
|
||||
</Class>
|
||||
<Interface Name="BizHawk.Client.EmuHawk.IExternalToolForm">
|
||||
<Position X="4.5" Y="4.5" Width="2.75" />
|
||||
<TypeIdentifier>
|
||||
|
@ -98,12 +123,13 @@
|
|||
<FileName>Enums\BizHawkExternalToolUsage.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Enum>
|
||||
<Enum Name="BizHawk.Client.ApiHawk.EmulatedSystem">
|
||||
<Position X="28.5" Y="8.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>SAACIAABQAAQCAAmAAAAAAAIAhAAAIAADAIAAIAgGAA=</HashCode>
|
||||
<FileName>Enums\EmulatedSystem.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Enum Name="BizHawk.Client.ApiHawk.JoypadButton">
|
||||
<Position X="30.25" Y="9.75" Width="1.5" />
|
||||
<TypeIdentifier />
|
||||
</Enum>
|
||||
<Enum Name="BizHawk.Client.ApiHawk.CoreSystem">
|
||||
<Position X="28.25" Y="9.75" Width="1.5" />
|
||||
<TypeIdentifier />
|
||||
</Enum>
|
||||
<Font Name="Segoe UI" Size="9" />
|
||||
</ClassDiagram>
|
|
@ -3,7 +3,7 @@
|
|||
/// <summary>
|
||||
/// Enumeration of each system emulated by BizHawk
|
||||
/// </summary>
|
||||
public enum EmulatedSystem
|
||||
public enum CoreSystem : int
|
||||
{
|
||||
Null = 0,
|
||||
TI83,
|
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
|
||||
namespace BizHawk.Client.ApiHawk
|
||||
{
|
||||
/// <summary>
|
||||
/// This enumeration list all buttons
|
||||
/// for all existing controllers
|
||||
/// </summary>
|
||||
[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,
|
||||
|
||||
/// <summary>
|
||||
/// Master system Button 1
|
||||
/// </summary>
|
||||
B1 = 16384,
|
||||
/// <summary>
|
||||
/// Master system Button 1
|
||||
/// </summary>
|
||||
B2 = 32768,
|
||||
|
||||
/// <summary>
|
||||
/// N64 C up
|
||||
/// </summary>
|
||||
CUp = 65536,
|
||||
/// <summary>
|
||||
/// N64 C down
|
||||
/// </summary>
|
||||
CDown = 131072,
|
||||
/// <summary>
|
||||
/// N64 C Left
|
||||
/// </summary>
|
||||
CLeft = 262144,
|
||||
/// <summary>
|
||||
/// N64 C Right
|
||||
/// </summary>
|
||||
CRight = 524288,
|
||||
/// <summary>
|
||||
/// N64 Analog stick
|
||||
/// </summary>
|
||||
AnalogStick = 1048576
|
||||
}
|
||||
}
|
|
@ -137,6 +137,8 @@
|
|||
<Compile Include="7z\SevenZipExtractorAsynchronous.cs" />
|
||||
<Compile Include="7z\SevenZipSfx.cs" />
|
||||
<Compile Include="7z\StreamWrappers.cs" />
|
||||
<Compile Include="Api\CoreSystem.cs" />
|
||||
<Compile Include="Api\JoypadButton.cs" />
|
||||
<Compile Include="BinarySaveStates.cs" />
|
||||
<Compile Include="BitmapBufferVideoProvider.cs" />
|
||||
<Compile Include="config\Binding.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
|
||||
/// <summary>
|
||||
/// This class holds logic for System information.
|
||||
/// That means specifiactions about a system that BizHawk emulate
|
||||
/// </summary>
|
||||
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<SystemInfo> allSystemInfos;
|
||||
|
||||
private string _DisplayName;
|
||||
private CoreSystem _System;
|
||||
private JoypadButton _AvailableButtons;
|
||||
private int _MaxControllers;
|
||||
|
||||
#endregion
|
||||
|
||||
#region cTor(s)
|
||||
|
||||
/// <summary>
|
||||
/// Global initialization stuff
|
||||
/// </summary>
|
||||
/// <remarks>DO NOT CHANGE List order because properties depends on it (and it is hardcoded)</remarks>
|
||||
static SystemInfo()
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SystemInfo
|
||||
{
|
||||
DisplayName = "",
|
||||
};
|
||||
}
|
||||
allSystemInfos = new List<SystemInfo>(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
|
||||
/// <summary>
|
||||
/// Initialize a new instance of <see cref="SystemInfo"/>
|
||||
/// </summary>
|
||||
/// <param name="displayName">A <see cref="string"/> that specify how the system name is displayed</param>
|
||||
/// <param name="system">A <see cref="CoreSystem"/> that specify what core is used</param>
|
||||
/// <param name="maxControllers">Maximum controller allowed by this system</param>
|
||||
/// <param name="availableButtons">Which buttons are available (i.e. are actually on the controller) for this system</param>
|
||||
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",
|
||||
};
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Initialize a new instance of <see cref="SystemInfo"/>
|
||||
/// </summary>
|
||||
/// <param name="displayName">A <see cref="string"/> that specify how the system name is displayed</param>
|
||||
/// <param name="system">A <see cref="CoreSystem"/> that specify what core is used</param>
|
||||
/// <param name="maxControllers">Maximum controller allowed by this system</param>
|
||||
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",
|
||||
};
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Initialize a new instance of <see cref="SystemInfo"/>
|
||||
/// </summary>
|
||||
/// <param name="displayName">A <see cref="string"/> that specify how the system name is displayed</param>
|
||||
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
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Apple II
|
||||
/// </summary
|
||||
public static SystemInfo AppleII
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SystemInfo
|
||||
{
|
||||
DisplayName = "Apple II",
|
||||
};
|
||||
return allSystemInfos[24];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Atari 2600
|
||||
/// </summary
|
||||
public static SystemInfo Atari2600
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[14];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Atari 7800
|
||||
/// </summary>
|
||||
public static SystemInfo Atari7800
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[15];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Commodore 64
|
||||
/// </summary>
|
||||
public static SystemInfo C64
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[16];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Coleco Vision
|
||||
/// </summary>
|
||||
public static SystemInfo Coleco
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[17];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Dual Gameboy
|
||||
/// </summary>
|
||||
public static SystemInfo DualGB
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[21];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Gameboy
|
||||
/// </summary>
|
||||
public static SystemInfo GB
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[12];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Gameboy Advance
|
||||
/// </summary>
|
||||
public static SystemInfo GBA
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[18];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Gameboy Color
|
||||
/// </summary>
|
||||
public static SystemInfo GBC
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[13];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Genesis
|
||||
/// </summary>
|
||||
public static SystemInfo Genesis
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[9];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Game Gear
|
||||
/// </summary>
|
||||
public static SystemInfo GG
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[5];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Intellivision
|
||||
/// </summary>
|
||||
public static SystemInfo Intellivision
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Lynx
|
||||
/// </summary>
|
||||
public static SystemInfo Lynx
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[23];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for NES
|
||||
/// </summary>
|
||||
public static SystemInfo Nes
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Nintendo 64
|
||||
/// </summary>
|
||||
public static SystemInfo N64
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[19];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Null (i.e. nothing is emulated) emulator
|
||||
/// </summary>
|
||||
public static SystemInfo Null
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for PCEngine (TurboGrafx-16)
|
||||
/// </summary>
|
||||
public static SystemInfo PCE
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[6];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for PCEngine (TurboGrafx-16) + CD
|
||||
/// </summary>
|
||||
public static SystemInfo PCECD
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[7];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for PlayStation
|
||||
/// </summary>
|
||||
public static SystemInfo PSX
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[24];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Sega Saturn
|
||||
/// </summary>
|
||||
public static SystemInfo Saturn
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[20];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for SG-1000 (Sega Game 1000)
|
||||
/// </summary>
|
||||
public static SystemInfo SG
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[4];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for PCEngine (Supergraph FX)
|
||||
/// </summary>
|
||||
public static SystemInfo SGX
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[8];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Sega Master System
|
||||
/// </summary>
|
||||
public static SystemInfo SMS
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[3];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for SNES
|
||||
/// </summary>
|
||||
public static SystemInfo SNES
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[11];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for TI-83
|
||||
/// </summary>
|
||||
public static SystemInfo TI83
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[10];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for TI-83
|
||||
/// </summary>
|
||||
public static SystemInfo WonderSwan
|
||||
{
|
||||
get
|
||||
{
|
||||
return allSystemInfos[22];
|
||||
}
|
||||
}
|
||||
#endregion Get SystemInfo
|
||||
|
||||
/// <summary>
|
||||
/// Get a <see cref="SystemInfo"/> by its <see cref="CoreSystem"/>
|
||||
/// </summary>
|
||||
/// <param name="system"><see cref="CoreSystem"/> you're looking for</param>
|
||||
/// <returns>Mathing <see cref="SystemInfo"/></returns>
|
||||
public static SystemInfo FindByCoreSystem(CoreSystem system)
|
||||
{
|
||||
return allSystemInfos.Find(s => s._System == system);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine if this <see cref="SystemInfo"/> is equal to specified <see cref="object"/>
|
||||
/// </summary>
|
||||
/// <param name="obj"><see cref="object"/> to comapre to</param>
|
||||
/// <returns>True if object is equal to this instance; otherwise, false</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is SystemInfo)
|
||||
{
|
||||
return this == (SystemInfo)obj;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.Equals(obj);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the haschode for current insance
|
||||
/// </summary>
|
||||
/// <returns>This instance hashcode</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="string"/> representation of current <see cref="SystemInfo"/>
|
||||
/// In fact, return the same as DisplayName property
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return _DisplayName;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Determine if two <see cref="SystemInfo"/> are equals.
|
||||
/// As it is all static instance, it just compare their reference
|
||||
/// </summary>
|
||||
/// <param name="system1">First <see cref="SystemInfo"/></param>
|
||||
/// <param name="system2">Second <see cref="SystemInfo"/></param>
|
||||
/// <returns>True if both system are equals; otherwise, false</returns>
|
||||
public static bool operator ==(SystemInfo system1, SystemInfo system2)
|
||||
{
|
||||
return ReferenceEquals(system1, system2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine if two <see cref="SystemInfo"/> are different.
|
||||
/// As it is all static instance, it just compare their reference
|
||||
/// </summary>
|
||||
/// <param name="system1">First <see cref="SystemInfo"/></param>
|
||||
/// <param name="system2">Second <see cref="SystemInfo"/></param>
|
||||
/// <returns>True if both system are diferent; otherwise, false</returns>
|
||||
public static bool operator !=(SystemInfo system1, SystemInfo system2)
|
||||
{
|
||||
return !(system1 == system2);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets <see cref="JoypadButton"/> available for this system
|
||||
/// </summary>
|
||||
public JoypadButton AvailableButtons
|
||||
{
|
||||
get
|
||||
{
|
||||
return _AvailableButtons;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sytem name as <see cref="string"/>
|
||||
/// </summary>
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
return _DisplayName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the maximum amount of controller allowed for this system
|
||||
/// </summary>
|
||||
public int MaxControllers
|
||||
{
|
||||
get
|
||||
{
|
||||
return _MaxControllers;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets core used for this system as <see cref="CoreSystem"/> enum
|
||||
/// </summary>
|
||||
public CoreSystem System
|
||||
{
|
||||
get
|
||||
{
|
||||
return _System;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -730,7 +730,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
internal set
|
||||
{
|
||||
if (_domain.Name == value.Name)
|
||||
if (value != null &&_domain.Name == value.Name)
|
||||
{
|
||||
_domain = value;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue