From ec353e163e7eb2cac832b1ac90518f120660e9ac Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 22 Mar 2020 15:15:22 -0500 Subject: [PATCH] ButtonSchema - simplify with another overload --- .../tools/VirtualPads/schema/A26Schema.cs | 12 ++++-------- .../tools/VirtualPads/schema/A78Schema.cs | 5 +---- .../tools/VirtualPads/schema/ButtonSchema.cs | 6 ++++++ .../tools/VirtualPads/schema/ColecoSchema.cs | 2 +- .../tools/VirtualPads/schema/NesSchema.cs | 2 +- .../tools/VirtualPads/schema/PSXSchema.cs | 10 ++++------ .../tools/VirtualPads/schema/SaturnSchema.cs | 16 +++++++--------- 7 files changed, 24 insertions(+), 29 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A26Schema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A26Schema.cs index 30d6eb9596..c7c33b17dd 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A26Schema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A26Schema.cs @@ -77,16 +77,14 @@ namespace BizHawk.Client.EmuHawk { DisplayName = "B2" }, - new SingleFloatSchema(55, 17, $"P{controller} Paddle X 1") + new SingleFloatSchema(55, 17, controller, "Paddle X 1") { - DisplayName = "Paddle X 1", TargetSize = new Size(128, 69), MaxValue = 127, MinValue = -127 }, - new SingleFloatSchema(193, 17, $"P{controller} Paddle X 2") + new SingleFloatSchema(193, 17, controller, "Paddle X 2") { - DisplayName = "Paddle X 2", TargetSize = new Size(128, 69), MaxValue = 127, MinValue = -127 @@ -137,16 +135,14 @@ namespace BizHawk.Client.EmuHawk { DisplayName = "B1" }, - new SingleFloatSchema(55, 17, $"P{controller} Wheel X 1") + new SingleFloatSchema(55, 17, controller, "Wheel X 1") { - DisplayName = "Wheel X 1", TargetSize = new Size(128, 69), MaxValue = 127, MinValue = -127 }, - new SingleFloatSchema(193, 17, $"P{controller} Wheel X 2") + new SingleFloatSchema(193, 17, controller, "Wheel X 2") { - DisplayName = "Wheel X 2", TargetSize = new Size(128, 69), MaxValue = 127, MinValue = -127 diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A78Schema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A78Schema.cs index a3755d4871..1742d73fc6 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A78Schema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A78Schema.cs @@ -105,10 +105,7 @@ namespace BizHawk.Client.EmuHawk DefaultSize = new Size(250, 74), Buttons = new[] { - new SingleFloatSchema(23, 15, $"P{controller} Paddle") - { - DisplayName = "Paddle" - }, + new SingleFloatSchema(23, 15, controller, "Paddle"), new ButtonSchema(12, 90, $"P{controller} Trigger") { DisplayName = "1" diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ButtonSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ButtonSchema.cs index 4b2b5b0866..ca3f9a4b39 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ButtonSchema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ButtonSchema.cs @@ -77,6 +77,12 @@ namespace BizHawk.Client.EmuHawk { Type = PadInputType.SingleFloat; } + + public SingleFloatSchema(int x, int y, int controller, string name) + : base(x, y, controller, name) + { + Type = PadInputType.SingleFloat; + } } public class TargetedPairSchema : ButtonSchema diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ColecoSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ColecoSchema.cs index 9f0a377bdd..ca561cdc94 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ColecoSchema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ColecoSchema.cs @@ -110,7 +110,7 @@ namespace BizHawk.Client.EmuHawk new ButtonSchema(27, 154, controller, "Star") { DisplayName = "*" }, new ButtonSchema(50, 154, controller, "0"), new ButtonSchema(73, 154, controller, "Pound") { DisplayName = "#" }, - new SingleFloatSchema(6, 200, $"P{controller} Disc X") + new SingleFloatSchema(6, 200, controller, "Disc X") { DisplayName = "Disc", TargetSize = new Size(180, 55), diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/NesSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/NesSchema.cs index d128a32198..dfc95ff700 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/NesSchema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/NesSchema.cs @@ -284,7 +284,7 @@ namespace BizHawk.Client.EmuHawk MaxSize = new Size(380, 110), Buttons = new[] { - new SingleFloatSchema(14, 17, $"P{controller} Paddle") + new SingleFloatSchema(14, 17, controller, "Paddle") { DisplayName = "Arkanoid Paddle", TargetSize = new Size(380, 69), diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PSXSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PSXSchema.cs index c3a72ce0d5..c4426c5b89 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PSXSchema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PSXSchema.cs @@ -164,29 +164,27 @@ namespace BizHawk.Client.EmuHawk new ButtonSchema(278, 38, controller, "B"), new ButtonSchema(308, 55, controller, "A"), new ButtonSchema(308, 15, controller, "R"), - new SingleFloatSchema(5, 15, $"P{controller} L") + new SingleFloatSchema(5, 15, controller, "L") { - DisplayName = "L", TargetSize = new Size(128, 55), MinValue = 0, MaxValue = 255 }, - new SingleFloatSchema(125, 15, $"P{controller} Twist") + new SingleFloatSchema(125, 15, controller, "Twist") { - DisplayName = "Twist", TargetSize = new Size(64, 178), MinValue = 0, MaxValue = 255, Orientation = Orientation.Vertical }, - new SingleFloatSchema(180, 60, $"P{controller} 2") + new SingleFloatSchema(180, 60, controller, "2") { DisplayName = "II", TargetSize = new Size(128, 55), MinValue = 0, MaxValue = 255 }, - new SingleFloatSchema(220, 120, $"P{controller} 1") + new SingleFloatSchema(220, 120, controller, "1") { DisplayName = "I", TargetSize = new Size(128, 55), diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/SaturnSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/SaturnSchema.cs index e5151514a3..943ea9db95 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/SaturnSchema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/SaturnSchema.cs @@ -115,16 +115,16 @@ namespace BizHawk.Client.EmuHawk AxisRange = axisRanges[0], SecondaryAxisRange = axisRanges[1], }, - new SingleFloatSchema(8, 12, $"P{controller} Left Shoulder") + new SingleFloatSchema(8, 12, controller, "Left Shoulder") { DisplayName = "L", TargetSize = new Size(128, 55), MinValue = 0, MaxValue = 255 }, - new SingleFloatSchema(328, 12, $"P{controller} Right Shoulder") + new SingleFloatSchema(328, 12, controller, "Right Shoulder") { - DisplayName = "L", + DisplayName = "R", TargetSize = new Size(128, 55), MinValue = 0, MaxValue = 255 @@ -170,9 +170,8 @@ namespace BizHawk.Client.EmuHawk DefaultSize = new Size(325, 100), Buttons = new[] { - new SingleFloatSchema(8, 12, $"P{controller} Wheel") + new SingleFloatSchema(8, 12, controller, "Wheel") { - DisplayName = "Wheel", TargetSize = new Size(128, 55), MinValue = 0, MaxValue = 255 @@ -214,9 +213,8 @@ namespace BizHawk.Client.EmuHawk AxisRange = axisRanges[0], SecondaryAxisRange = axisRanges[1] }, - new SingleFloatSchema(135, 13, $"P{controller} Throttle") + new SingleFloatSchema(135, 13, controller, "Throttle") { - DisplayName = "Throttle", TargetSize = new Size(64, 178), MinValue = 0, MaxValue = 255, @@ -241,7 +239,7 @@ namespace BizHawk.Client.EmuHawk AxisRange = axisRanges[3], SecondaryAxisRange = axisRanges[4] }, - new SingleFloatSchema(8, 13, $"P{controller} Left Throttle") + new SingleFloatSchema(8, 13, controller, "Left Throttle") { DisplayName = "Throttle", TargetSize = new Size(64, 178), @@ -255,7 +253,7 @@ namespace BizHawk.Client.EmuHawk AxisRange = axisRanges[0], SecondaryAxisRange = axisRanges[1] }, - new SingleFloatSchema(350, 13, $"P{controller} Right Throttle") + new SingleFloatSchema(350, 13, controller, "Right Throttle") { DisplayName = "Throttle", TargetSize = new Size(64, 178),