Use inheritance instead of Type for PadSchema controls

* Rename ButtonSchema to PadSchemaControl, create ButtonSchema subclass, rename
AnalogSchema to AnalogStickSchema, and make PadSchemaControl abstract
* Replace switching on PadSchemaControl.Type (enum PadInputType) with type
checks
* Refactor and merge VirtualpadTool.CheckPads() into .CreatePads() (it was
easier than just using type checks in the old algorithm)
* Move members from PadSchemaControl to subtypes and cleanup
This commit is contained in:
YoshiRulz 2020-03-31 21:40:36 +10:00
parent 0ba7a5a7df
commit 3decfa5019
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
20 changed files with 267 additions and 324 deletions

View File

@ -48,6 +48,28 @@ namespace BizHawk.Client.EmuHawk
private void VirtualPadControl_Load(object sender, EventArgs e)
{
static VirtualPadButton GenVirtualPadButton(ButtonSchema button)
{
var buttonControl = new VirtualPadButton
{
Name = button.Name,
Text = button.Icon != null
? null
: string.IsNullOrWhiteSpace(button.DisplayName)
? button.Name
: button.DisplayName,
Location = UIHelper.Scale(button.Location),
Image = button.Icon
};
if (button.Icon != null && UIHelper.AutoScaleFactorX > 1F && UIHelper.AutoScaleFactorY > 1F)
{
// When scaling up, unfortunately the icon will look too small, but at least we can make the rest of the button bigger
buttonControl.AutoSize = false;
buttonControl.Size = UIHelper.Scale(button.Icon.Size) + new Size(6, 6);
}
return buttonControl;
}
Size = UIHelper.Scale(_schema.Size);
MaximumSize = UIHelper.Scale(_schema.Size);
PadBox.Text = _schema.DisplayName;
@ -57,75 +79,48 @@ namespace BizHawk.Client.EmuHawk
this.PadBox.ForeColor = SystemColors.HotTrack;
}
foreach (var button in _schema.Buttons)
foreach (var controlSchema in _schema.Buttons)
{
switch (button.Type)
PadBox.Controls.Add(controlSchema switch
{
case PadInputType.Boolean:
var buttonControl = new VirtualPadButton
{
Name = button.Name,
Text = button.Icon != null
? null
: string.IsNullOrWhiteSpace(button.DisplayName)
? button.Name
: button.DisplayName,
Location = UIHelper.Scale(button.Location),
Image = button.Icon
};
if (button.Icon != null && UIHelper.AutoScaleFactorX > 1F && UIHelper.AutoScaleFactorY > 1F)
{
// When scaling up, unfortunately the icon will look too small, but at least we can make the rest of the button bigger
buttonControl.AutoSize = false;
buttonControl.Size = UIHelper.Scale(button.Icon.Size) + new Size(6, 6);
}
PadBox.Controls.Add(buttonControl);
break;
case PadInputType.AnalogStick:
PadBox.Controls.Add(new VirtualPadAnalogStick
{
Name = button.Name,
SecondaryName = (button.SecondaryNames != null && button.SecondaryNames.Any()) ? button.SecondaryNames[0] : "",
Location = UIHelper.Scale(button.Location),
Size = UIHelper.Scale(new Size(180 + 79, 200 + 9)),
RangeX = button.AxisRange ?? throw new Exception(),
RangeY = button.SecondaryAxisRange ?? throw new Exception()
});
break;
case PadInputType.TargetedPair:
PadBox.Controls.Add(new VirtualPadTargetScreen
{
Name = button.Name,
Location = UIHelper.Scale(button.Location),
TargetSize = button.TargetSize,
XName = button.Name,
YName = button.SecondaryNames[0],
RangeX = button.MaxValue,
RangeY = button.MaxValue // TODO: ability to have a different Y than X
});
break;
case PadInputType.SingleAxis:
PadBox.Controls.Add(new VirtualPadAnalogButton
{
Name = button.Name,
DisplayName = button.DisplayName,
Location = UIHelper.Scale(button.Location),
Size = UIHelper.Scale(button.TargetSize),
MinValue = button.MinValue,
MaxValue = button.MaxValue,
Orientation = button.Orientation
});
break;
case PadInputType.DiscManager:
PadBox.Controls.Add(new VirtualPadDiscManager(button.SecondaryNames)
{
Name = button.Name,
Location = UIHelper.Scale(button.Location),
Size = UIHelper.Scale(button.TargetSize),
OwnerEmulator = button.OwnerEmulator
});
break;
}
ButtonSchema button => GenVirtualPadButton(button),
SingleAxisSchema singleAxis => new VirtualPadAnalogButton
{
Name = singleAxis.Name,
DisplayName = singleAxis.DisplayName,
Location = UIHelper.Scale(singleAxis.Location),
Size = UIHelper.Scale(singleAxis.TargetSize),
MinValue = singleAxis.MinValue,
MaxValue = singleAxis.MaxValue,
Orientation = singleAxis.Orientation
},
AnalogSchema analog => new VirtualPadAnalogStick
{
Name = analog.Name,
SecondaryName = analog.SecondaryName,
Location = UIHelper.Scale(analog.Location),
Size = UIHelper.Scale(new Size(180 + 79, 200 + 9)),
RangeX = analog.AxisRange,
RangeY = analog.SecondaryAxisRange
},
TargetedPairSchema targetedPair => new VirtualPadTargetScreen
{
Name = targetedPair.Name,
Location = UIHelper.Scale(targetedPair.Location),
TargetSize = targetedPair.TargetSize,
XName = targetedPair.Name,
YName = targetedPair.SecondaryName,
RangeX = targetedPair.MaxValue,
RangeY = targetedPair.MaxValue //TODO split into MaxX and MaxY, and rename VirtualPadTargetScreen.RangeX/RangeY
},
DiscManagerSchema discManager => new VirtualPadDiscManager(discManager.SecondaryNames) {
Name = discManager.Name,
Location = UIHelper.Scale(discManager.Location),
Size = UIHelper.Scale(discManager.TargetSize),
OwnerEmulator = discManager.OwnerEmulator
},
_ => throw new InvalidOperationException()
});
}
}

View File

@ -79,25 +79,35 @@ namespace BizHawk.Client.EmuHawk
.FirstOrDefault(t => t.GetCustomAttributes(false)
.OfType<SchemaAttribute>()
.First().SystemId == Emulator.SystemId);
if (schemaType != null)
if (schemaType == null) return;
var padSchemata = ((IVirtualPadSchema) Activator.CreateInstance(schemaType))
.GetPadSchemas(Emulator)
.ToList();
if (VersionInfo.DeveloperBuild)
{
var padSchemas = ((IVirtualPadSchema)Activator.CreateInstance(schemaType))
.GetPadSchemas(Emulator)
.ToList();
if (VersionInfo.DeveloperBuild)
var buttonControls = Emulator.ControllerDefinition.BoolButtons;
var axisControls = Emulator.ControllerDefinition.AxisControls;
foreach (var schema in padSchemata) foreach (var controlSchema in schema.Buttons)
{
CheckPads(padSchemas, Emulator.ControllerDefinition);
}
var pads = padSchemas.Select(s => new VirtualPad(s));
if (pads.Any())
{
ControllerPanel.Controls.AddRange(pads.Reverse().ToArray());
Predicate<string> searchSetContains = controlSchema switch
{
ButtonSchema _ => buttonControls.Contains,
DiscManagerSchema _ => s => buttonControls.Contains(s) || axisControls.Contains(s),
_ => axisControls.Contains
};
if (!searchSetContains(controlSchema.Name))
{
MessageBox.Show(this,
$"Schema warning: Schema entry '{schema.DisplayName}':'{controlSchema.Name}' will not correspond to any control in definition '{Emulator.ControllerDefinition.Name}'",
"Dev Warning");
}
}
}
ControllerPanel.Controls.AddRange(padSchemata.Select(s => (Control) new VirtualPad(s)).Reverse().ToArray());
}
public void ScrollToPadSchema(string padSchemaName)
@ -117,42 +127,6 @@ namespace BizHawk.Client.EmuHawk
}
}
private void CheckPads(IEnumerable<PadSchema> schemas, ControllerDefinition def)
{
var analogs = new HashSet<string>(def.AxisControls);
var bools = new HashSet<string>(def.BoolButtons);
foreach (var schema in schemas)
{
foreach (var button in schema.Buttons)
{
var searchSet = new HashSet<string>();
switch (button.Type)
{
case PadInputType.AnalogStick:
case PadInputType.SingleAxis:
case PadInputType.TargetedPair:
// analog
searchSet = analogs;
break;
case PadInputType.Boolean:
searchSet = bools;
break;
case PadInputType.DiscManager:
searchSet = bools;
searchSet.UnionWith(analogs);
break;
}
if (!searchSet.Contains(button.Name))
{
MessageBox.Show(this,
$"Schema warning: Schema entry '{schema.DisplayName}':'{button.Name}' will not correspond to any control in definition '{def.Name}'",
"Dev Warning");
}
}
}
}
#region IToolForm Implementation
public bool AskSaveChanges() => true;

View File

@ -10,7 +10,7 @@ namespace BizHawk.Client.EmuHawk
{
public partial class VirtualPadDiscManager : UserControl, IVirtualPadControl
{
public VirtualPadDiscManager(string[] buttonNames)
public VirtualPadDiscManager(IReadOnlyList<string> buttonNames)
{
InitializeComponent();
btnOpen.Name = buttonNames[0];

View File

@ -66,7 +66,7 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = $"Player {controller}",
Size = new Size(334, 94),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new ButtonSchema(5, 24, controller, "Button 1")
{
@ -117,7 +117,7 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = $"Player {controller}",
Size = new Size(334, 94),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new ButtonSchema(5, 24, controller, "Button")
{

View File

@ -95,7 +95,7 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Light Gun",
Size = new Size(356, 290),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new TargetedPairSchema(14, 17, $"P{controller} X")
{

View File

@ -1,151 +0,0 @@
using System.Drawing;
using System.Windows.Forms;
using BizHawk.Client.EmuHawk.Properties;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public enum PadInputType
{
Boolean, // A single on/off button
AnalogStick, // An analog stick X,Y Pair
SingleAxis, // A single analog control (pressure sensitive button for instance)
TargetedPair, // A X,Y pair intended to be a screen coordinate (for zappers, mouse, stylus, etc)
DiscManager
}
public class ButtonSchema
{
public ButtonSchema(int x, int y, string name)
{
Location = new Point(x, y);
Name = name;
}
public ButtonSchema(int x, int y, int controller, string name)
: this(x, y, $"P{controller} {name}")
{
DisplayName = name;
}
public string Name { get; protected set; }
public string DisplayName { get; set; }
public PadInputType Type { get; protected set; } = PadInputType.Boolean;
public Point Location { get; protected set; }
public Bitmap Icon { get; set; }
public Size TargetSize { get; set; } // Specifically for TargetedPair, specifies the screen size
public string[] SecondaryNames { get; set; } // Any other buttons necessary to operate (such as the Y axis)
public int MaxValue { get; set; } // For non-boolean values, specifies the maximum value the button allows
public int MidValue { get; set; } // For non-boolean values, specifies the mid (zero) value for the button
public int MinValue { get; set; } // For non-boolean values, specifies the minimum value the button allows
public int MaxValueSec { get; set; }
public int MidValueSec { get; set; }
public int MinValueSec { get; set; }
public object OwnerEmulator { get; set; }
public Orientation Orientation { get; set; } // For SingleAxis controls
// for Analog Stick controls
public ControllerDefinition.AxisRange? AxisRange { get; set; }
public ControllerDefinition.AxisRange? SecondaryAxisRange { get; set; }
public static ButtonSchema Up(int x, int y, string name = null)
=> new ButtonSchema(x, y, name ?? "Up")
{
Icon = Resources.BlueUp
};
public static ButtonSchema Up(int x, int y, int controller)
=> new ButtonSchema(x, y, controller, "Up")
{
Icon = Resources.BlueUp
};
public static ButtonSchema Down(int x, int y, string name = null)
=> new ButtonSchema(x, y, name ?? "Down")
{
Icon = Resources.BlueDown
};
public static ButtonSchema Down(int x, int y, int controller)
=> new ButtonSchema(x, y, controller, "Down")
{
Icon = Resources.BlueDown
};
public static ButtonSchema Left(int x, int y, string name = null)
=> new ButtonSchema(x, y, name ?? "Left")
{
Icon = Resources.Back
};
public static ButtonSchema Left(int x, int y, int controller)
=> new ButtonSchema(x, y, controller, "Left")
{
Icon = Resources.Back
};
public static ButtonSchema Right(int x, int y, string name = null)
=> new ButtonSchema(x, y, name ?? "Right")
{
Icon = Resources.Forward
};
public static ButtonSchema Right(int x, int y, int controller)
=> new ButtonSchema(x, y, controller, "Right")
{
Icon = Resources.Forward
};
}
public class SingleAxisSchema : ButtonSchema
{
public SingleAxisSchema(int x, int y, string name)
: base(x, y, name)
{
Type = PadInputType.SingleAxis;
}
public SingleAxisSchema(int x, int y, int controller, string name)
: base(x, y, controller, name)
{
Type = PadInputType.SingleAxis;
}
}
public class TargetedPairSchema : ButtonSchema
{
public TargetedPairSchema(int x, int y, string nameX)
: base(x, y, nameX)
{
Type = PadInputType.TargetedPair;
SecondaryNames = new[]
{
nameX.Replace("X", "Y")
};
}
}
public class AnalogSchema : ButtonSchema
{
public AnalogSchema(int x, int y, string nameX)
: base(x, y, nameX)
{
Type = PadInputType.AnalogStick;
SecondaryNames = new[]
{
nameX.Replace("X", "Y")
};
}
}
public class DiscManagerSchema : ButtonSchema
{
public DiscManagerSchema(int x, int y)
: base(x, y, "Disc Select")
{
Type = PadInputType.DiscManager;
}
}
}

View File

@ -52,7 +52,7 @@ namespace BizHawk.Client.EmuHawk
return new PadSchema
{
Size = new Size(275, 260),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new AnalogSchema(6, 14, $"P{controller} Disc X")
{
@ -69,7 +69,7 @@ namespace BizHawk.Client.EmuHawk
return new PadSchema
{
Size = new Size(195, 260),
Buttons = StandardButtons(controller).Concat(new[]
Buttons = StandardButtons(controller).Concat(new PadSchemaControl[]
{
new SingleAxisSchema(6, 200, controller, "Disc X")
{

View File

@ -41,7 +41,7 @@ namespace BizHawk.Client.EmuHawk
};
}
private static ButtonSchema Tilt(int x, int y, string direction)
private static SingleAxisSchema Tilt(int x, int y, string direction)
=> new SingleAxisSchema(x, y, "Tilt " + direction)
{
TargetSize = new Size(226, 69),

View File

@ -111,11 +111,10 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Light Gun",
Size = new Size(356, 300),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new TargetedPairSchema(14, 17, $"P{controller} Lightgun X")
new TargetedPairSchema(14, 17, $"P{controller} Lightgun X", 10000)
{
MaxValue = 10000,
TargetSize = new Size(320, 240)
},
new ButtonSchema(284, 17, controller, "Lightgun Trigger")
@ -136,12 +135,12 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Mouse",
Size = new Size(418, 290),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new AnalogSchema(14, 17, $"P{controller} Mouse X")
{
MaxValue = 255,
TargetSize = new Size(520, 570)
// MaxValue = 255,
// TargetSize = new Size(520, 570)
},
new ButtonSchema(365, 17, controller, "Mouse Left")
{

View File

@ -75,7 +75,7 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = $"Player {controller}",
Size = new Size(280, 332),
Buttons = StandardButtons(controller).Concat(new[]
Buttons = StandardButtons(controller).Concat(new PadSchemaControl[]
{
new AnalogSchema(1, 121, $"P{controller} Disc X")
{

View File

@ -28,7 +28,7 @@ namespace BizHawk.Client.EmuHawk
return new PadSchema
{
Size = new Size(275, 316),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
ButtonSchema.Up(24, 230, $"P{controller} DPad U"),
ButtonSchema.Down(24, 251, $"P{controller} DPad D"),

View File

@ -19,7 +19,7 @@ namespace BizHawk.Client.EmuHawk.tools.VirtualPads.schema
return new PadSchema
{
Size = new Size(440, 260),
Buttons = new []
Buttons = new PadSchemaControl[]
{
ButtonSchema.Up(14, 79),
ButtonSchema.Down(14, 122),

View File

@ -252,7 +252,7 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Zapper",
Size = new Size(356, 290),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new TargetedPairSchema(14, 17, $"P{controller} Zapper X")
{
@ -269,7 +269,7 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Arkanoid Paddle",
Size = new Size(380, 110),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new SingleAxisSchema(14, 17, controller, "Paddle")
{
@ -320,7 +320,7 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Tablet",
Size = new Size(356, 290),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new TargetedPairSchema(14, 17, $"P{controller} Pen X")
{

View File

@ -51,7 +51,7 @@ namespace BizHawk.Client.EmuHawk
{
Size = new Size(500, 290),
DisplayName = $"DualShock Player{controller}",
Buttons = new[]
Buttons = new PadSchemaControl[]
{
ButtonSchema.Up(32, 50, controller),
ButtonSchema.Down(32, 71, controller),
@ -151,7 +151,7 @@ namespace BizHawk.Client.EmuHawk
{
Size = new Size(343, 195),
DisplayName = $"NeGcon Player{controller}",
Buttons = new[]
Buttons = new PadSchemaControl[]
{
ButtonSchema.Up(36, 83, controller),
ButtonSchema.Down(36, 104, controller),
@ -167,12 +167,11 @@ namespace BizHawk.Client.EmuHawk
MinValue = 0,
MaxValue = 255
},
new SingleAxisSchema(125, 15, controller, "Twist")
new SingleAxisSchema(125, 15, controller, "Twist", isVertical: true)
{
TargetSize = new Size(64, 178),
MinValue = 0,
MaxValue = 255,
Orientation = Orientation.Vertical
MaxValue = 255
},
new SingleAxisSchema(180, 60, controller, "2")
{
@ -197,15 +196,10 @@ namespace BizHawk.Client.EmuHawk
return new ConsoleSchema
{
Size = new Size(310, 400),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new ButtonSchema(10, 15, "Reset"),
new DiscManagerSchema(10, 54)
{
TargetSize = new Size(300, 300),
OwnerEmulator = psx,
SecondaryNames = new[] { "Open", "Close", "Disc Select" }
}
new DiscManagerSchema(10, 54, new Size(300, 300), psx, new[] { "Open", "Close", "Disc Select" })
}
};
}

View File

@ -7,7 +7,7 @@ namespace BizHawk.Client.EmuHawk
{
public Size Size { get; set; }
public bool IsConsole { get; protected set; }
public IEnumerable<ButtonSchema> Buttons { get; set; } = new List<ButtonSchema>();
public IEnumerable<PadSchemaControl> Buttons { get; set; } = new List<PadSchemaControl>();
public string DisplayName { get; set; } // The name of the pad itself, presumably will be displayed by the given pad time if supplied
}

View File

@ -0,0 +1,135 @@
#nullable enable
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using BizHawk.Client.EmuHawk.Properties;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public abstract class PadSchemaControl
{
public readonly Point Location;
public readonly string Name;
protected PadSchemaControl(Point location, string name)
{
Location = location;
Name = name;
}
}
/// <summary>A single on/off button</summary>
public class ButtonSchema : PadSchemaControl
{
public string? DisplayName { get; set; }
public Bitmap? Icon { get; set; }
public ButtonSchema(int x, int y, string name)
: base(new Point(x, y), name)
=> DisplayName = name;
public ButtonSchema(int x, int y, int controller, string name)
: this(x, y, $"P{controller} {name}") {}
public static ButtonSchema Up(int x, int y, string? name = null)
=> new ButtonSchema(x, y, name ?? "Up") { Icon = Resources.BlueUp };
public static ButtonSchema Up(int x, int y, int controller)
=> new ButtonSchema(x, y, controller, "Up") { Icon = Resources.BlueUp };
public static ButtonSchema Down(int x, int y, string? name = null)
=> new ButtonSchema(x, y, name ?? "Down") { Icon = Resources.BlueDown };
public static ButtonSchema Down(int x, int y, int controller)
=> new ButtonSchema(x, y, controller, "Down") { Icon = Resources.BlueDown };
public static ButtonSchema Left(int x, int y, string? name = null)
=> new ButtonSchema(x, y, name ?? "Left") { Icon = Resources.Back };
public static ButtonSchema Left(int x, int y, int controller)
=> new ButtonSchema(x, y, controller, "Left") { Icon = Resources.Back };
public static ButtonSchema Right(int x, int y, string? name = null)
=> new ButtonSchema(x, y, name ?? "Right") { Icon = Resources.Forward };
public static ButtonSchema Right(int x, int y, int controller)
=> new ButtonSchema(x, y, controller, "Right") { Icon = Resources.Forward };
}
/// <summary>A single analog control (e.g. pressure sensitive button)</summary>
public class SingleAxisSchema : PadSchemaControl
{
public string DisplayName { get; set; }
public int MaxValue { get; set; }
public int MinValue { get; set; }
public readonly Orientation Orientation;
public Size TargetSize { get; set; }
public SingleAxisSchema(int x, int y, string name, bool isVertical = false)
: base(new Point(x, y), name)
{
DisplayName = name;
Orientation = isVertical ? Orientation.Vertical : Orientation.Horizontal;
}
public SingleAxisSchema(int x, int y, int controller, string name, bool isVertical = false)
: this(x, y, $"P{controller} {name}", isVertical) {}
}
/// <summary>An analog stick (X, Y) pair</summary>
public class AnalogSchema : PadSchemaControl
{
public ControllerDefinition.AxisRange AxisRange { get; set; }
public ControllerDefinition.AxisRange SecondaryAxisRange { get; set; }
public string SecondaryName { get; set; }
public AnalogSchema(int x, int y, string nameX)
: base(new Point(x, y), nameX)
=> SecondaryName = nameX.Replace("X", "Y");
}
/// <summary>An (X, Y) pair intended to be a screen coordinate (for zappers, mouse, stylus, etc.)</summary>
public class TargetedPairSchema : PadSchemaControl
{
public readonly int MaxValue;
public readonly string SecondaryName;
public Size TargetSize { get; set; }
public TargetedPairSchema(int x, int y, string nameX, int maxValue = default)
: base(new Point(x, y), nameX)
{
MaxValue = maxValue;
SecondaryName = nameX.Replace("X", "Y");
}
}
public class DiscManagerSchema : PadSchemaControl
{
public readonly IEmulator OwnerEmulator;
public readonly IReadOnlyList<string> SecondaryNames;
public readonly Size TargetSize;
public DiscManagerSchema(int x, int y, Size targetSize, IEmulator owner, IReadOnlyList<string> secondaryNames)
: base(new Point(x, y), "Disc Select")
{
OwnerEmulator = owner;
SecondaryNames = secondaryNames;
TargetSize = targetSize;
}
}
}

View File

@ -72,7 +72,7 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Mouse",
Size = new Size(375, 320),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new TargetedPairSchema(14, 17, $"P{controller} X")
{

View File

@ -96,7 +96,7 @@ namespace BizHawk.Client.EmuHawk
return new PadSchema
{
Size = new Size(458, 285),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
ButtonSchema.Up(290, 77, controller),
ButtonSchema.Down(290, 121, controller),
@ -111,7 +111,7 @@ namespace BizHawk.Client.EmuHawk
new ButtonSchema(414, 80, controller, "Z"),
new AnalogSchema(6, 74, $"P{controller} Stick Horizontal")
{
SecondaryNames = new[] { $"P{controller} Stick Vertical" },
SecondaryName = $"P{controller} Stick Vertical",
AxisRange = axisRanges[0],
SecondaryAxisRange = axisRanges[1]
},
@ -139,7 +139,7 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Mouse",
Size = new Size(375, 320),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new TargetedPairSchema(14, 17, $"P{controller} X")
{
@ -168,7 +168,7 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Wheel",
Size = new Size(325, 100),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new SingleAxisSchema(8, 12, controller, "Wheel")
{
@ -196,7 +196,7 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Mission",
Size = new Size(445, 230),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new ButtonSchema(45, 15, controller, "Start"),
new ButtonSchema(5, 58, controller, "L"),
@ -209,16 +209,15 @@ namespace BizHawk.Client.EmuHawk
new ButtonSchema(80, 70, controller, "C"),
new AnalogSchema(185, 13, $"P{controller} Stick Horizontal")
{
SecondaryNames = new[] { $"P{controller} Stick Vertical" },
SecondaryName = $"P{controller} Stick Vertical",
AxisRange = axisRanges[0],
SecondaryAxisRange = axisRanges[1]
},
new SingleAxisSchema(135, 13, controller, "Throttle")
new SingleAxisSchema(135, 13, controller, "Throttle", isVertical: true)
{
TargetSize = new Size(64, 178),
MinValue = 0,
MaxValue = 255,
Orientation = Orientation.Vertical
MaxValue = 255
}
}
};
@ -231,35 +230,33 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Dual Mission",
Size = new Size(680, 230),
Buttons = new ButtonSchema[]
Buttons = new PadSchemaControl[]
{
new AnalogSchema(58, 13, $"P{controller} Left Stick Horizontal")
{
SecondaryNames = new[] { $"P{controller} Left Stick Vertical" },
SecondaryName = $"P{controller} Left Stick Vertical",
AxisRange = axisRanges[3],
SecondaryAxisRange = axisRanges[4]
},
new SingleAxisSchema(8, 13, controller, "Left Throttle")
new SingleAxisSchema(8, 13, controller, "Left Throttle", isVertical: true)
{
DisplayName = "Throttle",
TargetSize = new Size(64, 178),
MinValue = 0,
MaxValue = 255,
Orientation = Orientation.Vertical
MaxValue = 255
},
new AnalogSchema(400, 13, $"P{controller} Right Stick Horizontal")
{
SecondaryNames = new[] { $"P{controller} Right Stick Vertical" },
SecondaryName = $"P{controller} Right Stick Vertical",
AxisRange = axisRanges[0],
SecondaryAxisRange = axisRanges[1]
},
new SingleAxisSchema(350, 13, controller, "Right Throttle")
new SingleAxisSchema(350, 13, controller, "Right Throttle", isVertical: true)
{
DisplayName = "Throttle",
TargetSize = new Size(64, 178),
MinValue = 0,
MaxValue = 255,
Orientation = Orientation.Vertical
MaxValue = 255
}
}
};

View File

@ -137,7 +137,7 @@ namespace BizHawk.Client.EmuHawk
return new PadSchema
{
Size = new Size(345, 225),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new AnalogSchema(6, 14, $"P{controller} Mouse X")
{
@ -162,7 +162,7 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Super Scope",
Size = new Size(356, 290),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new TargetedPairSchema(14, 17, $"P{controller} Scope X")
{
@ -182,7 +182,7 @@ namespace BizHawk.Client.EmuHawk
{
DisplayName = "Justifier",
Size = new Size(356, 290),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
new TargetedPairSchema(14, 17, $"P{controller} Justifier X")
{

View File

@ -64,7 +64,7 @@ namespace BizHawk.Client.EmuHawk
return new PadSchema
{
Size = new Size(280, 300),
Buttons = new[]
Buttons = new PadSchemaControl[]
{
Button(74, 34, controller, 1),
Button(98, 34, controller, 2),