diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index 31f3bc98f7..94528d9ba7 100644 --- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -887,8 +887,12 @@ Component + + + + UserControl diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPad.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPad.cs index 20174cf9dc..e3e6351e7e 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPad.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPad.cs @@ -36,18 +36,20 @@ namespace BizHawk.Client.EmuHawk switch (button.Type) { case PadSchema.PadInputType.Boolean: - var checkbox = new VirtualPadButton + Controls.Add(new VirtualPadButton { - AutoSize = true, - Location = button.Location, Name = button.Name, Text = button.DisplayName, + Location = button.Location, Image = button.Icon - }; - - Controls.Add(checkbox); + }); break; - case PadSchema.PadInputType.FloatPair: + case PadSchema.PadInputType.AnalogStick: + Controls.Add(new VirtualPadAnalogStick + { + Name = button.Name, + Location = button.Location + }); break; } } diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadTool.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadTool.cs index ba01aa5276..eab778e38f 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadTool.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadTool.cs @@ -67,6 +67,7 @@ namespace BizHawk.Client.EmuHawk { ControllerBox.Controls.Clear(); + // TODO: be more clever than this switch(Global.Emulator.SystemId) { case "NES": @@ -81,7 +82,36 @@ namespace BizHawk.Client.EmuHawk Location = new Point(200, 15) }); break; - + case "N64": + ControllerBox.Controls.Add(new VirtualPad( + N64Schema.StandardController(1)) + { + Location = new Point(15, 15) + }); + break; + case "SMS": + case "SG": + case "GG": // TODO: test if all 3 of these are needed + ControllerBox.Controls.Add(new VirtualPad( + SmsSchema.StandardController(1)) + { + Location = new Point(15, 15) + }); + break; + case "PCE": + ControllerBox.Controls.Add(new VirtualPad( + PceSchema.StandardController(1)) + { + Location = new Point(15, 15) + }); + break; + case "SNES": + ControllerBox.Controls.Add(new VirtualPad( + SnesSchema.StandardController(1)) + { + Location = new Point(15, 15) + }); + break; } } diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/AnalogControlPanel.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/AnalogControlPanel.cs index e1367e0a7a..08e318483d 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/AnalogControlPanel.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/AnalogControlPanel.cs @@ -5,7 +5,7 @@ using BizHawk.Client.Common; namespace BizHawk.Client.EmuHawk { - public sealed class AnalogControlPanel : Panel, IVirtualPadControl + public sealed class VirtualPadAnalogStick : Panel, IVirtualPadControl { public int X = 0; public int Y = 0; @@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk private readonly Bitmap dot = new Bitmap(7, 7); private readonly Bitmap graydot = new Bitmap(7, 7); - public AnalogControlPanel() + public VirtualPadAnalogStick() { Size = new Size(129, 129); SetStyle(ControlStyles.AllPaintingInWmPaint, true); diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/N64Schema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/N64Schema.cs new file mode 100644 index 0000000000..8acac693ca --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/N64Schema.cs @@ -0,0 +1,58 @@ +using System.Drawing; + +namespace BizHawk.Client.EmuHawk +{ + public class N64Schema + { + public static PadSchema StandardController(int controller) + { + return new PadSchema + { + IsConsole = false, + DefaultSize = new Size(200, 316), + Buttons = new[] + { + new PadSchema.ButtonScema + { + Name = "P" + controller + " X Axis", + DisplayName = "", + Location = new Point(6, 14), + Type = PadSchema.PadInputType.AnalogStick + }, + new PadSchema.ButtonScema + { + Name = "P" + controller + " Up", + DisplayName = "", + Icon = Properties.Resources.BlueUp, + Location = new Point(24, 195), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonScema + { + Name = "P" + controller + " Down", + DisplayName = "", + Icon = Properties.Resources.BlueDown, + Location = new Point(24, 216), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonScema + { + Name = "P" + controller + " Left", + DisplayName = "", + Icon = Properties.Resources.Back, + Location = new Point(3, 207), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonScema + { + Name = "P" + controller + " Right", + DisplayName = "", + Icon = Properties.Resources.Forward, + Location = new Point(45, 207), + Type = PadSchema.PadInputType.Boolean + } + } + }; + } + } +} diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PadSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PadSchema.cs index 099e5530ba..7ec838d0bb 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PadSchema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PadSchema.cs @@ -13,7 +13,7 @@ namespace BizHawk.Client.EmuHawk public enum PadInputType { Boolean, // A single on/off button - FloatPair, // An analog stick X,Y Pair + AnalogStick, // An analog stick X,Y Pair 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) } diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PceSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PceSchema.cs new file mode 100644 index 0000000000..d8564ba781 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PceSchema.cs @@ -0,0 +1,14 @@ +using System.Drawing; + +namespace BizHawk.Client.EmuHawk +{ + public static class PceSchema + { + public static PadSchema StandardController(int controller) + { + return new PadSchema + { + }; + } + } +} diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/SmsSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/SmsSchema.cs new file mode 100644 index 0000000000..8e63dd85e3 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/SmsSchema.cs @@ -0,0 +1,14 @@ +using System.Drawing; + +namespace BizHawk.Client.EmuHawk +{ + public static class SmsSchema + { + public static PadSchema StandardController(int controller) + { + return new PadSchema + { + }; + } + } +} diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/SnesSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/SnesSchema.cs new file mode 100644 index 0000000000..483f937b41 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/SnesSchema.cs @@ -0,0 +1,14 @@ +using System.Drawing; + +namespace BizHawk.Client.EmuHawk +{ + public static class SnesSchema + { + public static PadSchema StandardController(int controller) + { + return new PadSchema + { + }; + } + } +}