From 5f24a07fc95264adb9d01896fe74e45cc5e0864f Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 22 Mar 2020 12:56:00 -0500 Subject: [PATCH] add ButtonSchema overload with name, and use it in places --- .../tools/VirtualPads/schema/A26Schema.cs | 12 +++------ .../tools/VirtualPads/schema/A78Schema.cs | 16 +++++------- .../tools/VirtualPads/schema/ButtonSchema.cs | 13 +++++++--- .../tools/VirtualPads/schema/ColecoSchema.cs | 3 +-- .../tools/VirtualPads/schema/GBASchema.cs | 26 ++++++++----------- .../tools/VirtualPads/schema/NesSchema.cs | 3 +-- .../tools/VirtualPads/schema/PSXSchema.cs | 13 ++++------ .../tools/VirtualPads/schema/SaturnSchema.cs | 25 +++++++----------- 8 files changed, 47 insertions(+), 64 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A26Schema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A26Schema.cs index 21dd741e2b..23b9351f1d 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A26Schema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A26Schema.cs @@ -83,17 +83,15 @@ namespace BizHawk.Client.EmuHawk Name = $"P{controller} Button 2", DisplayName = "B2" }, - new SingleFloatSchema(55, 17) + new SingleFloatSchema(55, 17, $"P{controller} Paddle X 1") { - Name = $"P{controller} Paddle X 1", DisplayName = "Paddle X 1", TargetSize = new Size(128, 69), MaxValue = 127, MinValue = -127 }, - new SingleFloatSchema(193, 17) + new SingleFloatSchema(193, 17, $"P{controller} Paddle X 2") { - Name = $"P{controller} Paddle X 2", DisplayName = "Paddle X 2", TargetSize = new Size(128, 69), MaxValue = 127, @@ -149,17 +147,15 @@ namespace BizHawk.Client.EmuHawk Name = $"P{controller} Button", DisplayName = "B1" }, - new SingleFloatSchema(55, 17) + new SingleFloatSchema(55, 17, $"P{controller} Wheel X 1") { - Name = $"P{controller} Wheel X 1", DisplayName = "Wheel X 1", TargetSize = new Size(128, 69), MaxValue = 127, MinValue = -127 }, - new SingleFloatSchema(193, 17) + new SingleFloatSchema(193, 17, $"P{controller} Wheel X 2") { - Name = $"P{controller} Wheel X 2", DisplayName = "Wheel X 2", TargetSize = new Size(128, 69), MaxValue = 127, diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A78Schema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A78Schema.cs index 0ae3240103..dcf3a0301d 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A78Schema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A78Schema.cs @@ -108,14 +108,12 @@ namespace BizHawk.Client.EmuHawk DefaultSize = new Size(250, 74), Buttons = new[] { - new SingleFloatSchema(23, 15) + new SingleFloatSchema(23, 15, $"P{controller} Paddle") { - Name = $"P{controller} Paddle", DisplayName = "Paddle" }, - new ButtonSchema(12, 90) + new ButtonSchema(12, 90, $"P{controller} Trigger") { - Name = $"P{controller} Trigger", DisplayName = "1" } } @@ -156,11 +154,11 @@ namespace BizHawk.Client.EmuHawk DefaultSize = new Size(215, 50), Buttons = new[] { - new ButtonSchema(10, 15) { Name = "Select" }, - new ButtonSchema(60, 15) { Name = "Reset" }, - new ButtonSchema(108, 15) { Name = "Power" }, - new ButtonSchema(158, 15) { Name = "Pause" }, - new ButtonSchema(158, 15) { Name = "BW" } + new ButtonSchema(10, 15, "Select"), + new ButtonSchema(60, 15, "Reset"), + new ButtonSchema(108, 15, "Power"), + new ButtonSchema(158, 15, "Pause"), + new ButtonSchema(158, 15, "BW") } }; } diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ButtonSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ButtonSchema.cs index 09b6600506..2cc13eb6ea 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ButtonSchema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ButtonSchema.cs @@ -18,6 +18,12 @@ namespace BizHawk.Client.EmuHawk { public ButtonSchema(int x, int y) => Location = new Point(x, y); + public ButtonSchema(int x, int y, string name) + { + Location = new Point(x, y); + Name = name; + } + public string Name { get; set; } public string DisplayName { get; set; } public PadInputType Type { get; protected set; } = PadInputType.Boolean; @@ -66,8 +72,8 @@ namespace BizHawk.Client.EmuHawk public class SingleFloatSchema : ButtonSchema { - public SingleFloatSchema(int x, int y) - : base(x, y) + public SingleFloatSchema(int x, int y, string name) + : base(x, y, name) { Type = PadInputType.SingleFloat; } @@ -114,10 +120,9 @@ namespace BizHawk.Client.EmuHawk public class DiscManagerSchema : ButtonSchema { public DiscManagerSchema(int x, int y) - : base(x, y) + : base(x, y, "Disc Select") { Type = PadInputType.DiscManager; - Name = "Disc Select"; // not really, but shuts up a warning } } } diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ColecoSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ColecoSchema.cs index d87e9614ef..80cd7c5f2e 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ColecoSchema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/ColecoSchema.cs @@ -221,9 +221,8 @@ namespace BizHawk.Client.EmuHawk DisplayName = "#" }, - new SingleFloatSchema(6, 200) + new SingleFloatSchema(6, 200, $"P{controller} Disc X") { - Name = $"P{controller} Disc X", DisplayName = "Disc", TargetSize = new Size(180, 55), MinValue = -360, diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/GBASchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/GBASchema.cs index 37c1a0ae9f..0cbcdea0f5 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/GBASchema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/GBASchema.cs @@ -30,30 +30,26 @@ namespace BizHawk.Client.EmuHawk MaxSize = new Size(256, 326), Buttons = new[] { - new SingleFloatSchema(10, 15) + new SingleFloatSchema(10, 15, "Tilt X") { - Name = "Tilt X", TargetSize = new Size(226, 69), MinValue = short.MinValue, MaxValue = short.MaxValue }, - new SingleFloatSchema(10, 94) + new SingleFloatSchema(10, 94, "Tilt Y") { - Name = "Tilt Y", TargetSize = new Size(226, 69), MinValue = short.MinValue, MaxValue = short.MaxValue }, - new SingleFloatSchema(10, 173) + new SingleFloatSchema(10, 173, "Tilt Z") { - Name = "Tilt Z", TargetSize = new Size(226, 69), MinValue = short.MinValue, MaxValue = short.MaxValue }, - new SingleFloatSchema(10, 252) + new SingleFloatSchema(10, 252, "Light Sensor") { - Name = "Light Sensor", TargetSize = new Size(226, 69), MaxValue = byte.MaxValue } @@ -72,12 +68,12 @@ namespace BizHawk.Client.EmuHawk ButtonSchema.Down(29, 61, "Down"), ButtonSchema.Left(17, 39, "Left"), ButtonSchema.Right(39, 39, "Right"), - new ButtonSchema(130, 39) { Name = "B" }, - new ButtonSchema(154, 39) { Name = "A" }, - new ButtonSchema(64, 39) { Name = "Select", DisplayName = "s" }, - new ButtonSchema(86, 39) { Name = "Start", DisplayName = "S" }, - new ButtonSchema(2, 12) { Name = "L" }, - new ButtonSchema(166, 12) { Name = "R" } + new ButtonSchema(130, 39, "B"), + new ButtonSchema(154, 39, "A"), + new ButtonSchema(64, 39, "Select") { DisplayName = "s" }, + new ButtonSchema(86, 39, "Start") { DisplayName = "S" }, + new ButtonSchema(2, 12, "L"), + new ButtonSchema(166, 12, "R") } }; } @@ -89,7 +85,7 @@ namespace BizHawk.Client.EmuHawk DefaultSize = new Size(75, 50), Buttons = new[] { - new ButtonSchema(10, 15) { Name = "Power" } + new ButtonSchema(10, 15, "Power") } }; } diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/NesSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/NesSchema.cs index 8dcb2f7c75..4398fdcdc1 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/NesSchema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/NesSchema.cs @@ -309,9 +309,8 @@ namespace BizHawk.Client.EmuHawk MaxSize = new Size(380, 110), Buttons = new[] { - new SingleFloatSchema(14, 17) + new SingleFloatSchema(14, 17, $"P{controller} Paddle") { - Name = $"P{controller} Paddle", DisplayName = "Arkanoid Paddle", TargetSize = new Size(380, 69), MaxValue = 160 diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PSXSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PSXSchema.cs index 251bebc2e0..49c33c3dfb 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PSXSchema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PSXSchema.cs @@ -232,7 +232,7 @@ namespace BizHawk.Client.EmuHawk Name = $"P{controller} R", DisplayName = "R" }, - new SingleFloatSchema(5, 15) + new SingleFloatSchema(5, 15, $"P{controller} L") { Name = $"P{controller} L", DisplayName = "L", @@ -240,26 +240,23 @@ namespace BizHawk.Client.EmuHawk MinValue = 0, MaxValue = 255 }, - new SingleFloatSchema(125, 15) + new SingleFloatSchema(125, 15, $"P{controller} Twist") { - Name = $"P{controller} Twist", DisplayName = "Twist", TargetSize = new Size(64, 178), MinValue = 0, MaxValue = 255, Orientation = Orientation.Vertical }, - new SingleFloatSchema(180, 60) + new SingleFloatSchema(180, 60, $"P{controller} 2") { - Name = $"P{controller} 2", DisplayName = "II", TargetSize = new Size(128, 55), MinValue = 0, MaxValue = 255 }, - new SingleFloatSchema(220, 120) + new SingleFloatSchema(220, 120, $"P{controller} 1") { - Name = $"P{controller} 1", DisplayName = "I", TargetSize = new Size(128, 55), MinValue = 0, @@ -276,7 +273,7 @@ namespace BizHawk.Client.EmuHawk DefaultSize = new Size(310, 400), Buttons = new[] { - new ButtonSchema(10, 15) { Name = "Reset" }, + new ButtonSchema(10, 15, "Reset"), new DiscManagerSchema(10, 54) { TargetSize = new Size(300, 300), diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/SaturnSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/SaturnSchema.cs index 9315ced8f5..0a085b23d9 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/SaturnSchema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/SaturnSchema.cs @@ -180,15 +180,14 @@ namespace BizHawk.Client.EmuHawk AxisRange = axisRanges[0], SecondaryAxisRange = axisRanges[1], }, - new SingleFloatSchema(8, 12) + new SingleFloatSchema(8, 12, $"P{controller} Left Shoulder") { - Name = $"P{controller} Left Shoulder", DisplayName = "L", TargetSize = new Size(128, 55), MinValue = 0, MaxValue = 255 }, - new SingleFloatSchema(328, 12) + new SingleFloatSchema(328, 12, $"P{controller} Right Shoulder") { Name = $"P{controller} Right Shoulder", DisplayName = "L", @@ -208,10 +207,8 @@ namespace BizHawk.Client.EmuHawk DefaultSize = new Size(375, 320), Buttons = new[] { - new SingleFloatSchema(14, 17) + new TargetedPairSchema(14, 17, $"P{controller} X") { - Name = $"P{controller} X", - SecondaryNames = new[] { $"P{controller} Y" }, TargetSize = new Size(256, 256) }, new ButtonSchema(300, 17) @@ -246,9 +243,8 @@ namespace BizHawk.Client.EmuHawk DefaultSize = new Size(325, 100), Buttons = new[] { - new SingleFloatSchema(8, 12) + new SingleFloatSchema(8, 12, $"P{controller} Wheel") { - Name = $"P{controller} Wheel", DisplayName = "Wheel", TargetSize = new Size(128, 55), MinValue = 0, @@ -356,9 +352,8 @@ namespace BizHawk.Client.EmuHawk AxisRange = axisRanges[0], SecondaryAxisRange = axisRanges[1] }, - new SingleFloatSchema(135, 13) + new SingleFloatSchema(135, 13, $"P{controller} Throttle") { - Name = $"P{controller} Throttle", DisplayName = "Throttle", TargetSize = new Size(64, 178), MinValue = 0, @@ -385,9 +380,8 @@ namespace BizHawk.Client.EmuHawk AxisRange = axisRanges[3], SecondaryAxisRange = axisRanges[4] }, - new SingleFloatSchema(8, 13) + new SingleFloatSchema(8, 13, $"P{controller} Left Throttle") { - Name = $"P{controller} Left Throttle", DisplayName = "Throttle", TargetSize = new Size(64, 178), MinValue = 0, @@ -401,9 +395,8 @@ namespace BizHawk.Client.EmuHawk AxisRange = axisRanges[0], SecondaryAxisRange = axisRanges[1] }, - new SingleFloatSchema(350, 13) + new SingleFloatSchema(350, 13, $"P{controller} Right Throttle") { - Name = $"P{controller} Right Throttle", DisplayName = "Throttle", TargetSize = new Size(64, 178), MinValue = 0, @@ -421,8 +414,8 @@ namespace BizHawk.Client.EmuHawk DefaultSize = new Size(250, 50), Buttons = new[] { - new ButtonSchema(10, 15) { Name = "Reset" }, - new ButtonSchema(58, 15) { Name = "Power" }, + new ButtonSchema(10, 15, "Reset"), + new ButtonSchema(58, 15, "Power"), new ButtonSchema(108, 15) { Name = "Previous Disk",