cleanup virtualpad code

This commit is contained in:
adelikat 2019-12-31 11:36:22 -06:00
parent 0f33e2b1e7
commit b390c2829c
30 changed files with 120 additions and 193 deletions

View File

@ -7,6 +7,7 @@ using BizHawk.Emulation.Cores.Atari.Atari2600;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("A26")] [Schema("A26")]
// ReSharper disable once UnusedMember.Global
public class A26Schema : IVirtualPadSchema public class A26Schema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -9,6 +9,7 @@ using BizHawk.Emulation.Cores.Atari.A7800Hawk;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("A78")] [Schema("A78")]
// ReSharper disable once UnusedMember.Global
public class A78Schema : IVirtualPadSchema public class A78Schema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
@ -19,15 +20,14 @@ namespace BizHawk.Client.EmuHawk
internal static class Atari7800HawkSchema internal static class Atari7800HawkSchema
{ {
private static string UnpluggedControllerName => typeof(UnpluggedController).DisplayName();
private static string StandardControllerName => typeof(StandardController).DisplayName(); private static string StandardControllerName => typeof(StandardController).DisplayName();
private static string ProLineControllerName => typeof(ProLineController).DisplayName(); private static string ProLineControllerName => typeof(ProLineController).DisplayName();
public static IEnumerable<PadSchema> GetPadSchemas(A7800Hawk core) public static IEnumerable<PadSchema> GetPadSchemas(A7800Hawk core)
{ {
var A78SyncSettings = core.GetSyncSettings().Clone(); var a78SyncSettings = core.GetSyncSettings().Clone();
var port1 = A78SyncSettings.Port1; var port1 = a78SyncSettings.Port1;
var port2 = A78SyncSettings.Port2; var port2 = a78SyncSettings.Port2;
if (port1 == StandardControllerName) if (port1 == StandardControllerName)
{ {

View File

@ -6,6 +6,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("AppleII")] [Schema("AppleII")]
// ReSharper disable once UnusedMember.Global
public class AppleIISchema : IVirtualPadSchema public class AppleIISchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -6,6 +6,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("C64")] [Schema("C64")]
// ReSharper disable once UnusedMember.Global
public class C64Schema : IVirtualPadSchema public class C64Schema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -7,6 +7,7 @@ using BizHawk.Emulation.Cores.ColecoVision;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("Coleco")] [Schema("Coleco")]
// ReSharper disable once UnusedMember.Global
public class ColecoSchema : IVirtualPadSchema public class ColecoSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -6,6 +6,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("DGB")] [Schema("DGB")]
// ReSharper disable once UnusedMember.Global
public class DualGBSchema : IVirtualPadSchema public class DualGBSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -7,6 +7,7 @@ using BizHawk.Emulation.Cores.Nintendo.GBA;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("GBA")] [Schema("GBA")]
// ReSharper disable once UnusedMember.Global
public class GBASchema : IVirtualPadSchema public class GBASchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -6,6 +6,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("GB")] [Schema("GB")]
// ReSharper disable once UnusedMember.Global
public class GBSchema : IVirtualPadSchema public class GBSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -6,6 +6,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("GGL")] [Schema("GGL")]
// ReSharper disable once UnusedMember.Global
public class GGLSchema : IVirtualPadSchema public class GGLSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -3,24 +3,24 @@ using System.Drawing;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx; using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
using BizHawk.Emulation.Cores.Consoles.Sega.PicoDrive;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("GEN")] [Schema("GEN")]
// ReSharper disable once UnusedMember.Global
public class GenSchema : IVirtualPadSchema public class GenSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{ {
if (core is GPGX) if (core is GPGX gpgx)
{ {
return GpgxPadSchemas((GPGX)core); return GpgxPadSchemas(gpgx);
} }
return PicoPadSchemas((PicoDrive)core); return PicoPadSchemas();
} }
private IEnumerable<PadSchema> PicoPadSchemas(PicoDrive core) private IEnumerable<PadSchema> PicoPadSchemas()
{ {
yield return SixButtonController(1); yield return SixButtonController(1);
yield return SixButtonController(2); yield return SixButtonController(2);
@ -29,9 +29,9 @@ namespace BizHawk.Client.EmuHawk
private IEnumerable<PadSchema> GpgxPadSchemas(GPGX core) private IEnumerable<PadSchema> GpgxPadSchemas(GPGX core)
{ {
var devs = (core).GetDevices(); var devices = core.GetDevices();
int player = 1; int player = 1;
foreach (var dev in devs) foreach (var dev in devices)
{ {
switch (dev) switch (dev)
{ {
@ -53,7 +53,7 @@ namespace BizHawk.Client.EmuHawk
yield return Activator(player); yield return Activator(player);
break; break;
case LibGPGX.INPUT_DEVICE.DEVICE_XE_A1P: case LibGPGX.INPUT_DEVICE.DEVICE_XE_A1P:
yield return XE1AP(player); yield return Xe1AP(player);
break; break;
default: default:
// TO DO // TO DO
@ -429,7 +429,7 @@ namespace BizHawk.Client.EmuHawk
}; };
} }
private static PadSchema XE1AP(int controller) private static PadSchema Xe1AP(int controller)
{ {
return new PadSchema return new PadSchema
{ {

View File

@ -8,6 +8,7 @@ using BizHawk.Emulation.Cores.Intellivision;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("INTV")] [Schema("INTV")]
// ReSharper disable once UnusedMember.Global
public class IntvSchema : IVirtualPadSchema public class IntvSchema : IVirtualPadSchema
{ {
private string StandardControllerName => typeof(StandardController).DisplayName(); private string StandardControllerName => typeof(StandardController).DisplayName();

View File

@ -6,12 +6,12 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("Lynx")] [Schema("Lynx")]
// ReSharper disable once UnusedMember.Global
public class LynxSchema : IVirtualPadSchema public class LynxSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{ {
yield return StandardController(); yield return StandardController();
//yield return ConsoleButtons();
} }
private static PadSchema StandardController() private static PadSchema StandardController()

View File

@ -7,6 +7,7 @@ using BizHawk.Emulation.Cores.Nintendo.N64;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("N64")] [Schema("N64")]
// ReSharper disable once UnusedMember.Global
public class N64Schema : IVirtualPadSchema public class N64Schema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -11,17 +11,29 @@ using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("NES")] [Schema("NES")]
// ReSharper disable once UnusedMember.Global
public class NesSchema : IVirtualPadSchema public class NesSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{ {
if (core is NES) if (core is NES || core is SubNESHawk)
{ {
var nes = (NES)core; NES.NESSyncSettings ss = null;
bool isFds = false;
int fdsButtonCount = 0;
if (core is NES nesHawk)
{
ss = nesHawk.GetSyncSettings();
isFds = nesHawk.IsFDS;
fdsButtonCount = nesHawk.ControllerDefinition.BoolButtons.Count(b => b.StartsWith("FDS Insert "));
}
else if (core is SubNESHawk subNesHawk)
{
ss = subNesHawk.GetSyncSettings();
isFds = subNesHawk.IsFDS;
fdsButtonCount = subNesHawk.ControllerDefinition.BoolButtons.Count(b => b.StartsWith("FDS Insert "));
}
var ss = nes.GetSyncSettings();
var isFds = nes.IsFDS;
if (ss.Controls.Famicom) if (ss.Controls.Famicom)
{ {
yield return StandardController(1); yield return StandardController(1);
@ -52,7 +64,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
var currentControlerNo = 1; var currentControllerNo = 1;
switch (ss.Controls.NesLeftPort) switch (ss.Controls.NesLeftPort)
{ {
default: default:
@ -60,24 +72,24 @@ namespace BizHawk.Client.EmuHawk
break; break;
case "ControllerNES": case "ControllerNES":
yield return StandardController(1); yield return StandardController(1);
currentControlerNo++; currentControllerNo++;
break; break;
case "Zapper": case "Zapper":
yield return Zapper(1); yield return Zapper(1);
currentControlerNo++; currentControllerNo++;
break; break;
case "ArkanoidNES": case "ArkanoidNES":
yield return ArkanoidPaddle(1); yield return ArkanoidPaddle(1);
currentControlerNo++; currentControllerNo++;
break; break;
case "FourScore": case "FourScore":
yield return StandardController(1); yield return StandardController(1);
yield return StandardController(2); yield return StandardController(2);
currentControlerNo += 2; currentControllerNo += 2;
break; break;
case "PowerPad": case "PowerPad":
yield return PowerPad(1); yield return PowerPad(1);
currentControlerNo++; currentControllerNo++;
break; break;
case "ControllerSNES": case "ControllerSNES":
throw new Exception("TODO"); throw new Exception("TODO");
@ -89,27 +101,27 @@ namespace BizHawk.Client.EmuHawk
case "UnpluggedNES": case "UnpluggedNES":
break; break;
case "ControllerNES": case "ControllerNES":
yield return StandardController(currentControlerNo); yield return StandardController(currentControllerNo);
break; break;
case "Zapper": case "Zapper":
yield return Zapper(currentControlerNo); yield return Zapper(currentControllerNo);
break; break;
case "ArkanoidNES": case "ArkanoidNES":
yield return ArkanoidPaddle(currentControlerNo); yield return ArkanoidPaddle(currentControllerNo);
break; break;
case "FourScore": case "FourScore":
yield return StandardController(currentControlerNo); yield return StandardController(currentControllerNo);
yield return StandardController(currentControlerNo + 1); yield return StandardController(currentControllerNo + 1);
currentControlerNo += 2; currentControllerNo += 2;
break; break;
case "PowerPad": case "PowerPad":
yield return PowerPad(currentControlerNo); yield return PowerPad(currentControllerNo);
break; break;
case "ControllerSNES": case "ControllerSNES":
throw new Exception("TODO"); throw new Exception("TODO");
} }
if (currentControlerNo == 0) if (currentControllerNo == 0)
{ {
yield return null; yield return null;
} }
@ -117,139 +129,28 @@ namespace BizHawk.Client.EmuHawk
if (isFds) if (isFds)
{ {
yield return FdsConsoleButtons(core.ControllerDefinition.BoolButtons.Count(b => b.StartsWith("FDS Insert "))); yield return FdsConsoleButtons(fdsButtonCount);
} }
else else
{ {
yield return NesConsoleButtons(); yield return NesConsoleButtons();
} }
} }
else if (core is SubNESHawk)
{
{
var nes = (SubNESHawk)core;
var ss = nes.GetSyncSettings();
var isFds = nes.IsFDS;
if (ss.Controls.Famicom)
{
yield return StandardController(1);
yield return Famicom2ndController();
switch (ss.Controls.FamicomExpPort)
{
default:
case "UnpluggedFam":
break;
case "Zapper":
yield return Zapper(3);
break;
case "ArkanoidFam":
yield return ArkanoidPaddle(3);
break;
case "Famicom4P":
yield return StandardController(3);
yield return StandardController(4);
break;
case "FamilyBasicKeyboard":
yield return FamicomFamilyKeyboard(3);
break;
case "OekaKids":
yield return OekaKidsTablet(3);
break;
}
}
else
{
var currentControlerNo = 1;
switch (ss.Controls.NesLeftPort)
{
default:
case "UnpluggedNES":
break;
case "ControllerNES":
yield return StandardController(1);
currentControlerNo++;
break;
case "Zapper":
yield return Zapper(1);
currentControlerNo++;
break;
case "ArkanoidNES":
yield return ArkanoidPaddle(1);
currentControlerNo++;
break;
case "FourScore":
yield return StandardController(1);
yield return StandardController(2);
currentControlerNo += 2;
break;
case "PowerPad":
yield return PowerPad(1);
currentControlerNo++;
break;
case "ControllerSNES":
throw new Exception("TODO");
}
switch (ss.Controls.NesRightPort)
{
default:
case "UnpluggedNES":
break;
case "ControllerNES":
yield return StandardController(currentControlerNo);
break;
case "Zapper":
yield return Zapper(currentControlerNo);
break;
case "ArkanoidNES":
yield return ArkanoidPaddle(currentControlerNo);
break;
case "FourScore":
yield return StandardController(currentControlerNo);
yield return StandardController(currentControlerNo + 1);
currentControlerNo += 2;
break;
case "PowerPad":
yield return PowerPad(currentControlerNo);
break;
case "ControllerSNES":
throw new Exception("TODO");
}
if (currentControlerNo == 0)
{
yield return null;
}
}
if (isFds)
{
yield return FdsConsoleButtons(core.ControllerDefinition.BoolButtons.Count(b => b.StartsWith("FDS Insert ")));
}
else
{
yield return NesConsoleButtons();
}
}
}
else else
// Quicknes Can support none, one or two controllers. // Quicknes Can support none, one or two controllers.
{ {
var ss = ((QuickNES)core).GetSyncSettings(); var ss = ((QuickNES)core).GetSyncSettings();
if (ss.LeftPortConnected == true && ss.RightPortConnected == true) if (ss.LeftPortConnected && ss.RightPortConnected)
{ {
// Set both controllers // Set both controllers
yield return StandardController(1); yield return StandardController(1);
yield return StandardController(2); yield return StandardController(2);
} }
else if (ss.LeftPortConnected == true && ss.RightPortConnected == false) else if (ss.LeftPortConnected && !ss.RightPortConnected)
{ {
yield return StandardController(1); yield return StandardController(1);
} }
else if (ss.LeftPortConnected == false && ss.RightPortConnected == true) else if (!ss.LeftPortConnected && ss.RightPortConnected)
{ {
yield return StandardController(1); yield return StandardController(1);
} }

View File

@ -6,6 +6,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("NGP")] [Schema("NGP")]
// ReSharper disable once UnusedMember.Global
public class NgpSchema : IVirtualPadSchema public class NgpSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -7,6 +7,7 @@ using BizHawk.Emulation.Cores.Consoles.O2Hawk;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("O2")] [Schema("O2")]
// ReSharper disable once UnusedMember.Global
public class O2Schema : IVirtualPadSchema public class O2Schema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -8,6 +8,7 @@ using BizHawk.Emulation.Cores.Sony.PSX;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("PSX")] [Schema("PSX")]
// ReSharper disable once UnusedMember.Global
public class PSXSchema : IVirtualPadSchema public class PSXSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
@ -23,20 +24,20 @@ namespace BizHawk.Client.EmuHawk
continue; continue;
} }
int pnum = i + 1; int pNum = i + 1;
if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.DualAnalog || fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.DualShock) if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.DualAnalog || fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.DualShock)
{ {
yield return DualShockController(pnum); yield return DualShockController(pNum);
} }
if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.Pad) if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.Pad)
{ {
yield return GamePadController(pnum); yield return GamePadController(pNum);
} }
if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.NegCon) if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.NegCon)
{ {
yield return NeGcon(pnum); yield return NeGcon(pNum);
} }
} }

View File

@ -11,7 +11,7 @@ namespace BizHawk.Client.EmuHawk
Boolean, // A single on/off button Boolean, // A single on/off button
AnalogStick, // An analog stick X,Y Pair AnalogStick, // An analog stick X,Y Pair
FloatSingle, // A single analog button (pressure sensitive button for instance) FloatSingle, // A single analog button (pressure sensitive button for instance)
TargetedPair, // A X,Y pair intended to be a screen cooridnate (for zappers, mouse, stylus, etc) TargetedPair, // A X,Y pair intended to be a screen coordinate (for zappers, mouse, stylus, etc)
DiscManager DiscManager
} }
@ -39,7 +39,7 @@ namespace BizHawk.Client.EmuHawk
public int MinValueSec { get; set; } public int MinValueSec { get; set; }
public object OwnerEmulator { get; set; } public object OwnerEmulator { get; set; }
public Orientation Orientation { get; set; } // For Single Flaot controls public Orientation Orientation { get; set; } // For Single Float controls
} }
} }
} }

View File

@ -9,6 +9,7 @@ using BizHawk.Emulation.Cores.PCEngine;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("PCECD")] [Schema("PCECD")]
// ReSharper disable once UnusedMember.Global
public class PceCdSchema : PceSchema { } public class PceCdSchema : PceSchema { }
[Schema("PCE")] [Schema("PCE")]

View File

@ -1,29 +1,28 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Consoles.NEC.PCFX; using BizHawk.Emulation.Cores.Consoles.NEC.PCFX;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("PCFX")] [Schema("PCFX")]
// ReSharper disable once UnusedMember.Global
public class PcfxSchema : IVirtualPadSchema public class PcfxSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{ {
var ss = ((Tst)core).GetSyncSettings(); var ss = ((Tst)core).GetSyncSettings();
List<PadSchema> _schemas = new List<PadSchema>(); var schemas = new List<PadSchema>();
if (ss.Port1 != ControllerType.None || ss.Port2 != ControllerType.None) if (ss.Port1 != ControllerType.None || ss.Port2 != ControllerType.None)
{ {
switch (ss.Port1) switch (ss.Port1)
{ {
case ControllerType.Gamepad: case ControllerType.Gamepad:
_schemas.Add(StandardController(1)); schemas.Add(StandardController(1));
break; break;
case ControllerType.Mouse: case ControllerType.Mouse:
_schemas.Add(Mouse(1)); schemas.Add(Mouse(1));
break; break;
} }
@ -31,15 +30,15 @@ namespace BizHawk.Client.EmuHawk
switch (ss.Port2) switch (ss.Port2)
{ {
case ControllerType.Gamepad: case ControllerType.Gamepad:
_schemas.Add(StandardController(controllerNum)); schemas.Add(StandardController(controllerNum));
break; break;
case ControllerType.Mouse: case ControllerType.Mouse:
_schemas.Add(Mouse(controllerNum)); schemas.Add(Mouse(controllerNum));
break; break;
} }
} }
return _schemas; return schemas;
} }
private static PadSchema StandardController(int controller) private static PadSchema StandardController(int controller)

View File

@ -6,6 +6,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("SGB")] [Schema("SGB")]
// ReSharper disable once UnusedMember.Global
public class SGBSchema : IVirtualPadSchema public class SGBSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -9,6 +9,7 @@ using BizHawk.Emulation.Cores.Consoles.Sega.Saturn;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("SAT")] [Schema("SAT")]
// ReSharper disable once UnusedMember.Global
public class SaturnSchema : IVirtualPadSchema public class SaturnSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
@ -17,7 +18,7 @@ namespace BizHawk.Client.EmuHawk
int totalPorts = (ss.Port1Multitap ? 6 : 1) + (ss.Port2Multitap ? 6 : 1); int totalPorts = (ss.Port1Multitap ? 6 : 1) + (ss.Port2Multitap ? 6 : 1);
var padSchemas = new SaturnusControllerDeck.Device[] var padSchemas = new[]
{ {
ss.Port1, ss.Port1,
ss.Port2, ss.Port2,

View File

@ -8,7 +8,7 @@ namespace BizHawk.Client.EmuHawk
/// <summary> /// <summary>
/// Gets the system id associated with this schema /// Gets the system id associated with this schema
/// </summary> /// </summary>
public string SystemId { get; private set; } public string SystemId { get; }
public SchemaAttribute(string systemId) public SchemaAttribute(string systemId)
{ {

View File

@ -7,6 +7,7 @@ using BizHawk.Emulation.Cores.Sega.MasterSystem;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("SMS")] [Schema("SMS")]
// ReSharper disable once UnusedMember.Global
public class SmsSchema : IVirtualPadSchema public class SmsSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -8,23 +8,24 @@ using BizHawk.Emulation.Cores.Nintendo.SNES9X;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("SNES")] [Schema("SNES")]
// ReSharper disable once UnusedMember.Global
public class SnesSchema : IVirtualPadSchema public class SnesSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{ {
if (core is LibsnesCore) if (core is LibsnesCore bsnes)
{ {
return GetBsnesPadSchemas(core); return GetBsnesPadSchemas(bsnes);
} }
return GetSnes9xPadSchemas(core); return GetSnes9xPadSchemas((Snes9x)core);
} }
private IEnumerable<PadSchema> GetSnes9xPadSchemas(IEmulator core) private IEnumerable<PadSchema> GetSnes9xPadSchemas(Snes9x core)
{ {
// Only standard controller is supported on the left port // Only standard controller is supported on the left port
yield return StandardController(1); yield return StandardController(1);
Snes9x.SyncSettings syncSettings = ((Snes9x)core).GetSyncSettings(); Snes9x.SyncSettings syncSettings = core.GetSyncSettings();
LibSnes9x.RightPortDevice rightPort = syncSettings.RightPort; LibSnes9x.RightPortDevice rightPort = syncSettings.RightPort;
switch (rightPort) switch (rightPort)
@ -53,14 +54,14 @@ namespace BizHawk.Client.EmuHawk
yield return ConsoleButtons(); yield return ConsoleButtons();
} }
private IEnumerable<PadSchema> GetBsnesPadSchemas(IEmulator core) private IEnumerable<PadSchema> GetBsnesPadSchemas(LibsnesCore core)
{ {
var syncsettings = ((LibsnesCore)core).GetSyncSettings(); var syncSettings = core.GetSyncSettings();
var ports = new[] var ports = new[]
{ {
syncsettings.LeftPort, syncSettings.LeftPort,
syncsettings.RightPort syncSettings.RightPort
}; };
int offset = 0; int offset = 0;
@ -252,7 +253,7 @@ namespace BizHawk.Client.EmuHawk
{ {
return new PadSchema return new PadSchema
{ {
DisplayName = "Superscope", DisplayName = "Super Scope",
IsConsole = false, IsConsole = false,
DefaultSize = new Size(356, 290), DefaultSize = new Size(356, 290),
MaxSize = new Size(356, 290), MaxSize = new Size(356, 290),

View File

@ -7,13 +7,14 @@ using BizHawk.Emulation.Cores.Consoles.Vectrex;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("VEC")] [Schema("VEC")]
public class VECSchema : IVirtualPadSchema // ReSharper disable once UnusedMember.Global
public class VecSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{ {
var VECSyncSettings = ((VectrexHawk)core).GetSyncSettings().Clone(); var vecSyncSettings = ((VectrexHawk)core).GetSyncSettings().Clone();
var port1 = VECSyncSettings.Port1; var port1 = vecSyncSettings.Port1;
var port2 = VECSyncSettings.Port2; var port2 = vecSyncSettings.Port2;
if (port1 == "Vectrex Digital Controller") if (port1 == "Vectrex Digital Controller")
{ {

View File

@ -6,6 +6,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("VB")] [Schema("VB")]
// ReSharper disable once UnusedMember.Global
public class VirtualBoySchema : IVirtualPadSchema public class VirtualBoySchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -6,6 +6,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("WSWAN")] [Schema("WSWAN")]
// ReSharper disable once UnusedMember.Global
public class WonderSwanSchema : IVirtualPadSchema public class WonderSwanSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)

View File

@ -2,12 +2,12 @@
using System.Drawing; using System.Drawing;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
using System.Linq;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Schema("ZXSpectrum")] [Schema("ZXSpectrum")]
class ZXSpectrumSchema : IVirtualPadSchema // ReSharper disable once UnusedMember.Global
class ZxSpectrumSchema : IVirtualPadSchema
{ {
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core) public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{ {
@ -77,12 +77,12 @@ namespace BizHawk.Client.EmuHawk
public string DisName { get; set; } public string DisName { get; set; }
public double WidthFactor { get; set; } public double WidthFactor { get; set; }
public int Row { get; set; } public int Row { get; set; }
public bool IsActive = true; public bool IsActive { get; } = true;
} }
private static PadSchema Keyboard() private static PadSchema Keyboard()
{ {
List<ButtonLayout> bls = new List<ButtonLayout> var bls = new List<ButtonLayout>
{ {
new ButtonLayout { Name = "Key True Video", DisName = "TV", Row = 0, WidthFactor = 1 }, new ButtonLayout { Name = "Key True Video", DisName = "TV", Row = 0, WidthFactor = 1 },
new ButtonLayout { Name = "Key Inv Video", DisName = "IV", Row = 0, WidthFactor = 1 }, new ButtonLayout { Name = "Key Inv Video", DisName = "IV", Row = 0, WidthFactor = 1 },
@ -148,14 +148,14 @@ namespace BizHawk.Client.EmuHawk
new ButtonLayout { Name = "Key Symbol Shift", DisName = "SS", Row = 4, WidthFactor = 1 }, new ButtonLayout { Name = "Key Symbol Shift", DisName = "SS", Row = 4, WidthFactor = 1 },
}; };
PadSchema ps = new PadSchema var ps = new PadSchema
{ {
DisplayName = "Keyboard", DisplayName = "Keyboard",
IsConsole = false, IsConsole = false,
DefaultSize = new Size(500, 170) DefaultSize = new Size(500, 170)
}; };
List<PadSchema.ButtonSchema> btns = new List<PadSchema.ButtonSchema>(); var btns = new List<PadSchema.ButtonSchema>();
int rowHeight = 29; //24 int rowHeight = 29; //24
int stdButtonWidth = 29; //24 int stdButtonWidth = 29; //24
@ -187,14 +187,15 @@ namespace BizHawk.Client.EmuHawk
case "W": disp = b.DisName; break; case "W": disp = b.DisName; break;
} }
if (b.IsActive) if (b.IsActive)
{ {
PadSchema.ButtonSchema btn = new PadSchema.ButtonSchema(); var btn = new PadSchema.ButtonSchema
btn.Name = b.Name; {
btn.DisplayName = disp; Name = b.Name,
btn.Location = new Point(xPos, yPos); DisplayName = disp,
btn.Type = PadSchema.PadInputType.Boolean; Location = new Point(xPos, yPos),
Type = PadSchema.PadInputType.Boolean
};
btns.Add(btn); btns.Add(btn);
} }

View File

@ -182,6 +182,7 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=addr/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=addr/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=amstrad/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=amstrad/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Arkanoid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=atten/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=atten/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Autofire/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Autofire/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=autoflushing/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=autoflushing/@EntryIndexedValue">True</s:Boolean>
@ -201,6 +202,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bools/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Bools/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=botting/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=botting/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bsnes/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=bsnes/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=btns/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bundler/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Bundler/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Byteswap/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Byteswap/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=chromeless/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=chromeless/@EntryIndexedValue">True</s:Boolean>
@ -252,6 +254,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gameboy/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Gameboy/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=gamedb/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=gamedb/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=gamepad/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=gamepad/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gcon/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=gpgx/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=gpgx/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Grafx/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Grafx/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=greenzone/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=greenzone/@EntryIndexedValue">True</s:Boolean>
@ -306,6 +309,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Numerics/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Numerics/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=nvidia/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=nvidia/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Objs/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Objs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Oeka/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=opcode/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=opcode/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=opengl/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=opengl/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Overdump/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Overdump/@EntryIndexedValue">True</s:Boolean>
@ -314,6 +318,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=PCSX/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=PCSX/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=performant/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=performant/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Phaser/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Phaser/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Pico/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=pinvoked/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=pinvoked/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Pollable/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Pollable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Prefs/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Prefs/@EntryIndexedValue">True</s:Boolean>