From e298863b3d373892ec45489687fba17d2943d62e Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 6 Jun 2017 11:38:43 -0500 Subject: [PATCH] VB - virtual pad support, slight fix to button order on controller config --- .../BizHawk.Client.EmuHawk.csproj | 1 + .../VirtualPads/schema/VirtualBoySchema.cs | 155 ++++++++++++++++++ .../Consoles/Nintendo/VB/VirtualBoyee.cs | 8 +- 3 files changed, 160 insertions(+), 4 deletions(-) create mode 100644 BizHawk.Client.EmuHawk/tools/VirtualPads/schema/VirtualBoySchema.cs diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index 83ef4f6b5b..1adf8cab6b 100644 --- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -1220,6 +1220,7 @@ + UserControl diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/VirtualBoySchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/VirtualBoySchema.cs new file mode 100644 index 0000000000..e731e61e52 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/VirtualBoySchema.cs @@ -0,0 +1,155 @@ +using System.Collections.Generic; +using System.Drawing; + +using BizHawk.Emulation.Common; + +namespace BizHawk.Client.EmuHawk +{ + [SchemaAttributes("VB")] + public class VirtualBoySchema : IVirtualPadSchema + { + public IEnumerable GetPadSchemas(IEmulator core) + { + yield return StandardController(); + yield return ConsoleButtons(); + } + + private static PadSchema StandardController() + { + return new PadSchema + { + IsConsole = false, + DefaultSize = new Size(222, 103), + Buttons = new[] + { + new PadSchema.ButtonSchema + { + Name = "L_Up", + DisplayName = "", + Icon = Properties.Resources.BlueUp, + Location = new Point(14, 36), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "L_Down", + DisplayName = "", + Icon = Properties.Resources.BlueDown, + Location = new Point(14, 80), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "L_Left", + DisplayName = "", + Icon = Properties.Resources.Back, + Location = new Point(2, 58), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "L_Right", + DisplayName = "", + Icon = Properties.Resources.Forward, + Location = new Point(24, 58), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "B", + DisplayName = "B", + Location = new Point(122, 58), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "A", + DisplayName = "A", + Location = new Point(146, 58), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "Select", + DisplayName = "s", + Location = new Point(52, 58), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "Start", + DisplayName = "S", + Location = new Point(74, 58), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "R_Up", + DisplayName = "", + Icon = Properties.Resources.BlueUp, + Location = new Point(188, 36), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "R_Down", + DisplayName = "", + Icon = Properties.Resources.BlueDown, + Location = new Point(188, 80), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "R_Left", + DisplayName = "", + Icon = Properties.Resources.Back, + Location = new Point(176, 58), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "R_Right", + DisplayName = "", + Icon = Properties.Resources.Forward, + Location = new Point(198, 58), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "L", + DisplayName = "L", + Location = new Point(24, 8), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "R", + DisplayName = "R", + Location = new Point(176, 8), + Type = PadSchema.PadInputType.Boolean + }, + } + }; + } + + private static PadSchema ConsoleButtons() + { + return new PadSchema + { + DisplayName = "Console", + IsConsole = true, + DefaultSize = new Size(75, 50), + Buttons = new[] + { + new PadSchema.ButtonSchema + { + Name = "Power", + DisplayName = "Power", + Location = new Point(10, 15), + Type = PadSchema.PadInputType.Boolean + } + } + }; + } + } +} diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/VB/VirtualBoyee.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/VB/VirtualBoyee.cs index 439fab0884..23c405551d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/VB/VirtualBoyee.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/VB/VirtualBoyee.cs @@ -137,7 +137,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.VB "Start", "Select", "R_Left", "R_Down" }; - private static Dictionary _buttonOrdinals = new Dictionary + private static readonly Dictionary _buttonOrdinals = new Dictionary { ["L_Up"] = 1, ["L_Down"] = 2, @@ -148,9 +148,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.VB ["R_Left"] = 7, ["R_Right"] = 8, ["B"] = 9, - ["A"] = 10, - ["R"] = 11, - ["L"] = 12, + ["A"] = 10, + ["L"] = 11, + ["R"] = 12, ["Select"] = 13, ["Start"] = 14 };