Use the Joystick interface for game controller input. (#737)
* switch gamepad input to joystick * fix style nits * modify config.md to reflect new changes
This commit is contained in:
parent
54b79dffa8
commit
1ba58e9942
6 changed files with 239 additions and 219 deletions
63
CONFIG.md
63
CONFIG.md
|
@ -85,7 +85,7 @@
|
||||||
- `button_r` *(string)*
|
- `button_r` *(string)*
|
||||||
- `button_zr` *(string)*
|
- `button_zr` *(string)*
|
||||||
|
|
||||||
- `gamepad_controls` *(object)* :
|
- `joystick_controls` *(object)* :
|
||||||
- `enabled` *(bool)*
|
- `enabled` *(bool)*
|
||||||
Whether or not to enable Controller Support.
|
Whether or not to enable Controller Support.
|
||||||
- `index` *(int)*
|
- `index` *(int)*
|
||||||
|
@ -117,27 +117,27 @@
|
||||||
- `button_r` *(string)*
|
- `button_r` *(string)*
|
||||||
- `button_zr` *(string)*
|
- `button_zr` *(string)*
|
||||||
|
|
||||||
### Default Mapping
|
### Default Mapping.
|
||||||
#### Controller
|
#### Controller
|
||||||
- Left Joycon:
|
- Left Joycon:
|
||||||
- Analog Stick = Left Analog Stick
|
- Analog Stick = Axis 0
|
||||||
- DPad Up = DPad Up
|
- DPad Up = DPad Up #Hat0 Up
|
||||||
- DPad Down = DPad Down
|
- DPad Down = DPad Down #Hat0 Down
|
||||||
- DPad Left = DPad Left
|
- DPad Left = DPad Left #Hat0 Left
|
||||||
- DPad Right = DPad Right
|
- DPad Right = DPad Right #Hat0 Right
|
||||||
- Minus = Select / Back / Share
|
- Minus = Button 10
|
||||||
- L = Left Shoulder Button
|
- L = Button 6
|
||||||
- ZL = Left Trigger
|
- ZL = Button 8
|
||||||
|
|
||||||
- Right Joycon:
|
- Right Joycon:
|
||||||
- Analog Stick = Right Analog Stick
|
- Analog Stick = Axis 2
|
||||||
- A = B / Circle
|
- A = Button 0
|
||||||
- B = A / Cross
|
- B = Button 1
|
||||||
- X = Y / Triangle
|
- X = Button 3
|
||||||
- Y = X / Square
|
- Y = Button 4
|
||||||
- Plus = Start / Options
|
- Plus = Button 11
|
||||||
- R = Right Shoulder Button
|
- R = Button 7
|
||||||
- ZR = Right Trigger
|
- ZR = Button 9
|
||||||
|
|
||||||
#### Keyboard
|
#### Keyboard
|
||||||
- Left Joycon:
|
- Left Joycon:
|
||||||
|
@ -168,25 +168,10 @@
|
||||||
- R = U
|
- R = U
|
||||||
- ZR = O
|
- ZR = O
|
||||||
|
|
||||||
### Valid Button Mappings
|
### Valid Button Mappings.
|
||||||
- A = The A / Cross Button
|
- Button# = A button on the controller. # should not exceed the max # of buttons detected on your controller.
|
||||||
- B = The B / Circle Button
|
- Axis# = An analog axis on the controller. It can be a stick control, or a motion control axis.
|
||||||
- X = The X / Square Button
|
- Hat# = A Point of View (POV), Hat or Directional Pad control on the controller.
|
||||||
- Y = The Y / Triangle Button
|
|
||||||
- LStick = The Left Analog Stick when Pressed Down
|
|
||||||
- RStick = The Right Analog Stick when Pressed Down
|
|
||||||
- Start = The Start / Options Button
|
|
||||||
- Back = The Select / Back / Share Button
|
|
||||||
- RShoulder = The Right Shoulder Button
|
|
||||||
- LShoulder = The Left Shoulder Button
|
|
||||||
- RTrigger = The Right Trigger
|
|
||||||
- LTrigger = The Left Trigger
|
|
||||||
- DPadUp = Up on the DPad
|
|
||||||
- DPadDown = Down on the DPad
|
|
||||||
- DPadLeft = Left on the DPad
|
|
||||||
- DpadRight = Right on the DPad
|
|
||||||
- Valid Joystick Mappings
|
|
||||||
- LJoystick = The Left Analog Stick
|
|
||||||
- RJoystick = The Right Analog Stick
|
|
||||||
|
|
||||||
On more obscure / weird controllers this can vary, so if this list doesn't work, trial and error will.
|
Button configuration and controller capabilities differ from one controller to another. Please use a
|
||||||
|
configuration tool to find out the actual button configuration of your controller.
|
|
@ -107,7 +107,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
// Controller Controls
|
// Controller Controls
|
||||||
"gamepad_controls": {
|
"joystick_controls": {
|
||||||
// Whether or not to enable Controller support
|
// Whether or not to enable Controller support
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|
||||||
|
@ -122,28 +122,28 @@
|
||||||
|
|
||||||
// Left JoyCon Controller Bindings
|
// Left JoyCon Controller Bindings
|
||||||
"left_joycon": {
|
"left_joycon": {
|
||||||
"stick": "LJoystick",
|
"stick": "Axis0",
|
||||||
"stick_button": "LStick",
|
"stick_button": "Button13",
|
||||||
"dpad_up": "DPadUp",
|
"dpad_up": "Hat0Up",
|
||||||
"dpad_down": "DPadDown",
|
"dpad_down": "Hat0Down",
|
||||||
"dpad_left": "DPadLeft",
|
"dpad_left": "Hat0Left",
|
||||||
"dpad_right": "DPadRight",
|
"dpad_right": "Hat0Right",
|
||||||
"button_minus": "Back",
|
"button_minus": "Button10",
|
||||||
"button_l": "LShoulder",
|
"button_l": "Button6",
|
||||||
"button_zl": "LTrigger"
|
"button_zl": "Button8"
|
||||||
},
|
},
|
||||||
|
|
||||||
// Right JoyCon Controller Bindings
|
// Right JoyCon Controller Bindings
|
||||||
"right_joycon": {
|
"right_joycon": {
|
||||||
"stick": "RJoystick",
|
"stick": "Axis2",
|
||||||
"stick_button": "RStick",
|
"stick_button": "Button14",
|
||||||
"button_a": "B",
|
"button_a": "Button0",
|
||||||
"button_b": "A",
|
"button_b": "Button1",
|
||||||
"button_x": "Y",
|
"button_x": "Button3",
|
||||||
"button_y": "X",
|
"button_y": "Button4",
|
||||||
"button_plus": "Start",
|
"button_plus": "Button11",
|
||||||
"button_r": "RShoulder",
|
"button_r": "Button7",
|
||||||
"button_zr": "RTrigger"
|
"button_zr": "Button9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -135,7 +135,7 @@ namespace Ryujinx
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controller control bindings
|
/// Controller control bindings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UI.Input.NpadController GamepadControls { get; private set; }
|
public UI.Input.NpadController JoystickControls { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads a configuration file from disk
|
/// Loads a configuration file from disk
|
||||||
|
@ -246,11 +246,11 @@ namespace Ryujinx
|
||||||
|
|
||||||
ServiceConfiguration.IgnoreMissingServices = Instance.IgnoreMissingServices;
|
ServiceConfiguration.IgnoreMissingServices = Instance.IgnoreMissingServices;
|
||||||
|
|
||||||
if (Instance.GamepadControls.Enabled)
|
if (Instance.JoystickControls.Enabled)
|
||||||
{
|
{
|
||||||
if (GamePad.GetName(Instance.GamepadControls.Index) == "Unmapped Controller")
|
if (!Joystick.GetState(Instance.JoystickControls.Index).IsConnected)
|
||||||
{
|
{
|
||||||
Instance.GamepadControls.SetEnabled(false);
|
Instance.JoystickControls.SetEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,17 +183,17 @@ namespace Ryujinx
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
currentButton |= Configuration.Instance.GamepadControls.GetButtons();
|
currentButton |= Configuration.Instance.JoystickControls.GetButtons();
|
||||||
|
|
||||||
// Keyboard has priority stick-wise
|
// Keyboard has priority stick-wise
|
||||||
if (leftJoystickDx == 0 && leftJoystickDy == 0)
|
if (leftJoystickDx == 0 && leftJoystickDy == 0)
|
||||||
{
|
{
|
||||||
(leftJoystickDx, leftJoystickDy) = Configuration.Instance.GamepadControls.GetLeftStick();
|
(leftJoystickDx, leftJoystickDy) = Configuration.Instance.JoystickControls.GetLeftStick();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rightJoystickDx == 0 && rightJoystickDy == 0)
|
if (rightJoystickDx == 0 && rightJoystickDy == 0)
|
||||||
{
|
{
|
||||||
(rightJoystickDx, rightJoystickDy) = Configuration.Instance.GamepadControls.GetRightStick();
|
(rightJoystickDx, rightJoystickDy) = Configuration.Instance.JoystickControls.GetRightStick();
|
||||||
}
|
}
|
||||||
|
|
||||||
leftJoystick = new JoystickPosition
|
leftJoystick = new JoystickPosition
|
||||||
|
|
|
@ -7,43 +7,64 @@ namespace Ryujinx.UI.Input
|
||||||
{
|
{
|
||||||
public enum ControllerInputId
|
public enum ControllerInputId
|
||||||
{
|
{
|
||||||
Invalid,
|
Button0,
|
||||||
LStick,
|
Button1,
|
||||||
RStick,
|
Button2,
|
||||||
LShoulder,
|
Button3,
|
||||||
RShoulder,
|
Button4,
|
||||||
LTrigger,
|
Button5,
|
||||||
RTrigger,
|
Button6,
|
||||||
LJoystick,
|
Button7,
|
||||||
RJoystick,
|
Button8,
|
||||||
DPadUp,
|
Button9,
|
||||||
DPadDown,
|
Button10,
|
||||||
DPadLeft,
|
Button11,
|
||||||
DPadRight,
|
Button12,
|
||||||
Start,
|
Button13,
|
||||||
Back,
|
Button14,
|
||||||
A,
|
Button15,
|
||||||
B,
|
Button16,
|
||||||
X,
|
Button17,
|
||||||
Y
|
Button18,
|
||||||
|
Button19,
|
||||||
|
Button20,
|
||||||
|
Axis0,
|
||||||
|
Axis1,
|
||||||
|
Axis2,
|
||||||
|
Axis3,
|
||||||
|
Axis4,
|
||||||
|
Axis5,
|
||||||
|
Hat0Up,
|
||||||
|
Hat0Down,
|
||||||
|
Hat0Left,
|
||||||
|
Hat0Right,
|
||||||
|
Hat1Up,
|
||||||
|
Hat1Down,
|
||||||
|
Hat1Left,
|
||||||
|
Hat1Right,
|
||||||
|
Hat2Up,
|
||||||
|
Hat2Down,
|
||||||
|
Hat2Left,
|
||||||
|
Hat2Right,
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct NpadControllerLeft
|
public struct NpadControllerLeft
|
||||||
{
|
{
|
||||||
public ControllerInputId Stick;
|
public ControllerInputId Stick;
|
||||||
public ControllerInputId StickButton;
|
public ControllerInputId StickButton;
|
||||||
|
public ControllerInputId ButtonMinus;
|
||||||
|
public ControllerInputId ButtonL;
|
||||||
|
public ControllerInputId ButtonZl;
|
||||||
public ControllerInputId DPadUp;
|
public ControllerInputId DPadUp;
|
||||||
public ControllerInputId DPadDown;
|
public ControllerInputId DPadDown;
|
||||||
public ControllerInputId DPadLeft;
|
public ControllerInputId DPadLeft;
|
||||||
public ControllerInputId DPadRight;
|
public ControllerInputId DPadRight;
|
||||||
public ControllerInputId ButtonMinus;
|
|
||||||
public ControllerInputId ButtonL;
|
|
||||||
public ControllerInputId ButtonZl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct NpadControllerRight
|
public struct NpadControllerRight
|
||||||
{
|
{
|
||||||
public ControllerInputId Stick;
|
public ControllerInputId Stick;
|
||||||
|
public ControllerInputId StickY;
|
||||||
public ControllerInputId StickButton;
|
public ControllerInputId StickButton;
|
||||||
public ControllerInputId ButtonA;
|
public ControllerInputId ButtonA;
|
||||||
public ControllerInputId ButtonB;
|
public ControllerInputId ButtonB;
|
||||||
|
@ -114,31 +135,60 @@ namespace Ryujinx.UI.Input
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GamePadState gpState = GamePad.GetState(Index);
|
JoystickState joystickState = Joystick.GetState(Index);
|
||||||
|
|
||||||
ControllerButtons buttons = 0;
|
ControllerButtons buttons = 0;
|
||||||
|
|
||||||
if (IsPressed(gpState, LeftJoycon.DPadUp)) buttons |= ControllerButtons.DpadUp;
|
if (IsActivated(joystickState, LeftJoycon.DPadUp)) buttons |= ControllerButtons.DpadUp;
|
||||||
if (IsPressed(gpState, LeftJoycon.DPadDown)) buttons |= ControllerButtons.DpadDown;
|
if (IsActivated(joystickState, LeftJoycon.DPadDown)) buttons |= ControllerButtons.DpadDown;
|
||||||
if (IsPressed(gpState, LeftJoycon.DPadLeft)) buttons |= ControllerButtons.DpadLeft;
|
if (IsActivated(joystickState, LeftJoycon.DPadLeft)) buttons |= ControllerButtons.DpadLeft;
|
||||||
if (IsPressed(gpState, LeftJoycon.DPadRight)) buttons |= ControllerButtons.DPadRight;
|
if (IsActivated(joystickState, LeftJoycon.DPadRight)) buttons |= ControllerButtons.DPadRight;
|
||||||
if (IsPressed(gpState, LeftJoycon.StickButton)) buttons |= ControllerButtons.StickLeft;
|
if (IsActivated(joystickState, LeftJoycon.StickButton)) buttons |= ControllerButtons.StickLeft;
|
||||||
if (IsPressed(gpState, LeftJoycon.ButtonMinus)) buttons |= ControllerButtons.Minus;
|
if (IsActivated(joystickState, LeftJoycon.ButtonMinus)) buttons |= ControllerButtons.Minus;
|
||||||
if (IsPressed(gpState, LeftJoycon.ButtonL)) buttons |= ControllerButtons.L;
|
if (IsActivated(joystickState, LeftJoycon.ButtonL)) buttons |= ControllerButtons.L;
|
||||||
if (IsPressed(gpState, LeftJoycon.ButtonZl)) buttons |= ControllerButtons.Zl;
|
if (IsActivated(joystickState, LeftJoycon.ButtonZl)) buttons |= ControllerButtons.Zl;
|
||||||
|
|
||||||
if (IsPressed(gpState, RightJoycon.ButtonA)) buttons |= ControllerButtons.A;
|
if (IsActivated(joystickState, RightJoycon.ButtonA)) buttons |= ControllerButtons.A;
|
||||||
if (IsPressed(gpState, RightJoycon.ButtonB)) buttons |= ControllerButtons.B;
|
if (IsActivated(joystickState, RightJoycon.ButtonB)) buttons |= ControllerButtons.B;
|
||||||
if (IsPressed(gpState, RightJoycon.ButtonX)) buttons |= ControllerButtons.X;
|
if (IsActivated(joystickState, RightJoycon.ButtonX)) buttons |= ControllerButtons.X;
|
||||||
if (IsPressed(gpState, RightJoycon.ButtonY)) buttons |= ControllerButtons.Y;
|
if (IsActivated(joystickState, RightJoycon.ButtonY)) buttons |= ControllerButtons.Y;
|
||||||
if (IsPressed(gpState, RightJoycon.StickButton)) buttons |= ControllerButtons.StickRight;
|
if (IsActivated(joystickState, RightJoycon.StickButton)) buttons |= ControllerButtons.StickRight;
|
||||||
if (IsPressed(gpState, RightJoycon.ButtonPlus)) buttons |= ControllerButtons.Plus;
|
if (IsActivated(joystickState, RightJoycon.ButtonPlus)) buttons |= ControllerButtons.Plus;
|
||||||
if (IsPressed(gpState, RightJoycon.ButtonR)) buttons |= ControllerButtons.R;
|
if (IsActivated(joystickState, RightJoycon.ButtonR)) buttons |= ControllerButtons.R;
|
||||||
if (IsPressed(gpState, RightJoycon.ButtonZr)) buttons |= ControllerButtons.Zr;
|
if (IsActivated(joystickState, RightJoycon.ButtonZr)) buttons |= ControllerButtons.Zr;
|
||||||
|
|
||||||
return buttons;
|
return buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool IsActivated(JoystickState joystickState,ControllerInputId controllerInputId)
|
||||||
|
{
|
||||||
|
if (controllerInputId <= ControllerInputId.Button20)
|
||||||
|
{
|
||||||
|
return joystickState.IsButtonDown((int)controllerInputId);
|
||||||
|
}
|
||||||
|
else if (controllerInputId <= ControllerInputId.Axis5)
|
||||||
|
{
|
||||||
|
int axis = controllerInputId - ControllerInputId.Axis0;
|
||||||
|
|
||||||
|
return Math.Abs(joystickState.GetAxis(axis)) > Deadzone;
|
||||||
|
}
|
||||||
|
else if (controllerInputId <= ControllerInputId.Hat2Right)
|
||||||
|
{
|
||||||
|
int hat = (controllerInputId - ControllerInputId.Hat0Up) / 4;
|
||||||
|
|
||||||
|
int baseHatId = (int)ControllerInputId.Hat0Up + (hat * 4);
|
||||||
|
|
||||||
|
JoystickHatState hatState = joystickState.GetHat((JoystickHat)hat);
|
||||||
|
|
||||||
|
if (hatState.IsUp && ((int)controllerInputId % baseHatId == 0)) return true;
|
||||||
|
if (hatState.IsDown && ((int)controllerInputId % baseHatId == 1)) return true;
|
||||||
|
if (hatState.IsLeft && ((int)controllerInputId % baseHatId == 2)) return true;
|
||||||
|
if (hatState.IsRight && ((int)controllerInputId % baseHatId == 3)) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public (short, short) GetLeftStick()
|
public (short, short) GetLeftStick()
|
||||||
{
|
{
|
||||||
if (!Enabled)
|
if (!Enabled)
|
||||||
|
@ -159,21 +209,21 @@ namespace Ryujinx.UI.Input
|
||||||
return GetStick(RightJoycon.Stick);
|
return GetStick(RightJoycon.Stick);
|
||||||
}
|
}
|
||||||
|
|
||||||
private (short, short) GetStick(ControllerInputId joystick)
|
private (short, short) GetStick(ControllerInputId stickInputId)
|
||||||
{
|
{
|
||||||
GamePadState gpState = GamePad.GetState(Index);
|
if (stickInputId < ControllerInputId.Axis0 || stickInputId > ControllerInputId.Axis5)
|
||||||
|
|
||||||
switch (joystick)
|
|
||||||
{
|
{
|
||||||
case ControllerInputId.LJoystick:
|
return (0, 0);
|
||||||
return ApplyDeadzone(gpState.ThumbSticks.Left);
|
|
||||||
|
|
||||||
case ControllerInputId.RJoystick:
|
|
||||||
return ApplyDeadzone(gpState.ThumbSticks.Right);
|
|
||||||
|
|
||||||
default:
|
|
||||||
return (0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JoystickState jsState = Joystick.GetState(Index);
|
||||||
|
|
||||||
|
int xAxis = stickInputId - ControllerInputId.Axis0;
|
||||||
|
|
||||||
|
float xValue = jsState.GetAxis(xAxis);
|
||||||
|
float yValue = 0 - jsState.GetAxis(xAxis + 1); // Invert Y-axis
|
||||||
|
|
||||||
|
return ApplyDeadzone(new Vector2(xValue, yValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
private (short, short) ApplyDeadzone(Vector2 axis)
|
private (short, short) ApplyDeadzone(Vector2 axis)
|
||||||
|
@ -193,41 +243,5 @@ namespace Ryujinx.UI.Input
|
||||||
return (short)(value * short.MaxValue);
|
return (short)(value * short.MaxValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsPressed(GamePadState gpState, ControllerInputId button)
|
|
||||||
{
|
|
||||||
switch (button)
|
|
||||||
{
|
|
||||||
case ControllerInputId.A: return gpState.Buttons.A == ButtonState.Pressed;
|
|
||||||
case ControllerInputId.B: return gpState.Buttons.B == ButtonState.Pressed;
|
|
||||||
case ControllerInputId.X: return gpState.Buttons.X == ButtonState.Pressed;
|
|
||||||
case ControllerInputId.Y: return gpState.Buttons.Y == ButtonState.Pressed;
|
|
||||||
case ControllerInputId.LStick: return gpState.Buttons.LeftStick == ButtonState.Pressed;
|
|
||||||
case ControllerInputId.RStick: return gpState.Buttons.RightStick == ButtonState.Pressed;
|
|
||||||
case ControllerInputId.LShoulder: return gpState.Buttons.LeftShoulder == ButtonState.Pressed;
|
|
||||||
case ControllerInputId.RShoulder: return gpState.Buttons.RightShoulder == ButtonState.Pressed;
|
|
||||||
case ControllerInputId.DPadUp: return gpState.DPad.Up == ButtonState.Pressed;
|
|
||||||
case ControllerInputId.DPadDown: return gpState.DPad.Down == ButtonState.Pressed;
|
|
||||||
case ControllerInputId.DPadLeft: return gpState.DPad.Left == ButtonState.Pressed;
|
|
||||||
case ControllerInputId.DPadRight: return gpState.DPad.Right == ButtonState.Pressed;
|
|
||||||
case ControllerInputId.Start: return gpState.Buttons.Start == ButtonState.Pressed;
|
|
||||||
case ControllerInputId.Back: return gpState.Buttons.Back == ButtonState.Pressed;
|
|
||||||
|
|
||||||
case ControllerInputId.LTrigger: return gpState.Triggers.Left >= TriggerThreshold;
|
|
||||||
case ControllerInputId.RTrigger: return gpState.Triggers.Right >= TriggerThreshold;
|
|
||||||
|
|
||||||
// Using thumbsticks as buttons is not common, but it would be nice not to ignore them
|
|
||||||
case ControllerInputId.LJoystick:
|
|
||||||
return gpState.ThumbSticks.Left.X >= Deadzone ||
|
|
||||||
gpState.ThumbSticks.Left.Y >= Deadzone;
|
|
||||||
|
|
||||||
case ControllerInputId.RJoystick:
|
|
||||||
return gpState.ThumbSticks.Right.X >= Deadzone ||
|
|
||||||
gpState.ThumbSticks.Right.Y >= Deadzone;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
"controller_type",
|
"controller_type",
|
||||||
"enable_keyboard",
|
"enable_keyboard",
|
||||||
"keyboard_controls",
|
"keyboard_controls",
|
||||||
"gamepad_controls"
|
"joystick_controls"
|
||||||
],
|
],
|
||||||
"definitions": {
|
"definitions": {
|
||||||
"key": {
|
"key": {
|
||||||
|
@ -181,24 +181,45 @@
|
||||||
"input": {
|
"input": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
"DPadUp",
|
"Button0",
|
||||||
"DPadDown",
|
"Button1",
|
||||||
"DPadLeft",
|
"Button2",
|
||||||
"DPadRight",
|
"Button3",
|
||||||
"LStick",
|
"Button4",
|
||||||
"RStick",
|
"Button5",
|
||||||
"LShoulder",
|
"Button6",
|
||||||
"RShoulder",
|
"Button7",
|
||||||
"LTrigger",
|
"Button8",
|
||||||
"RTrigger",
|
"Button9",
|
||||||
"LJoystick",
|
"Button10",
|
||||||
"RJoystick",
|
"Button11",
|
||||||
"A",
|
"Button12",
|
||||||
"B",
|
"Button13",
|
||||||
"X",
|
"Button14",
|
||||||
"Y",
|
"Button15",
|
||||||
"Start",
|
"Button16",
|
||||||
"Back"
|
"Button17",
|
||||||
|
"Button18",
|
||||||
|
"Button19",
|
||||||
|
"Button20",
|
||||||
|
"Axis0",
|
||||||
|
"Axis1",
|
||||||
|
"Axis2",
|
||||||
|
"Axis3",
|
||||||
|
"Axis4",
|
||||||
|
"Axis5",
|
||||||
|
"Hat0Up",
|
||||||
|
"Hat0Down",
|
||||||
|
"Hat0Left",
|
||||||
|
"Hat0Right",
|
||||||
|
"Hat1Up",
|
||||||
|
"Hat1Down",
|
||||||
|
"Hat1Left",
|
||||||
|
"Hat1Right",
|
||||||
|
"Hat2Up",
|
||||||
|
"Hat2Down",
|
||||||
|
"Hat2Left",
|
||||||
|
"Hat2Right"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -717,19 +738,19 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gamepad_controls": {
|
"joystick_controls": {
|
||||||
"$id": "#/properties/gamepad_controls",
|
"$id": "#/properties/joystick_controls",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"title": "GamePad Controls",
|
"title": "Joystick Controls",
|
||||||
"required": [
|
"required": [
|
||||||
"left_joycon",
|
"left_joycon",
|
||||||
"right_joycon"
|
"right_joycon"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"enable": {
|
"enable": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/enable",
|
"$id": "#/properties/joystick_controls/properties/enable",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"title": "Gamepad Enable",
|
"title": "Joystick Enable",
|
||||||
"description": "Enables or disables controller support",
|
"description": "Enables or disables controller support",
|
||||||
"default": true,
|
"default": true,
|
||||||
"examples": [
|
"examples": [
|
||||||
|
@ -738,9 +759,9 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"index": {
|
"index": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/index",
|
"$id": "#/properties/joystick_controls/properties/index",
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"title": "Gamepad Index",
|
"title": "Joystick Index",
|
||||||
"description": "Controller Device Index",
|
"description": "Controller Device Index",
|
||||||
"default": 0,
|
"default": 0,
|
||||||
"minimum": 0,
|
"minimum": 0,
|
||||||
|
@ -751,9 +772,9 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"deadzone": {
|
"deadzone": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/deadzone",
|
"$id": "#/properties/joystick_controls/properties/deadzone",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"title": "Gamepad Deadzone",
|
"title": "Joystick Deadzone",
|
||||||
"description": "Controller Analog Stick Deadzone",
|
"description": "Controller Analog Stick Deadzone",
|
||||||
"default": 0.05,
|
"default": 0.05,
|
||||||
"minimum": -32768.0,
|
"minimum": -32768.0,
|
||||||
|
@ -763,7 +784,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"trigger_threshold": {
|
"trigger_threshold": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/trigger_threshold",
|
"$id": "#/properties/joystick_controls/properties/trigger_threshold",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"title": "Controller Trigger Threshold",
|
"title": "Controller Trigger Threshold",
|
||||||
"description": "The value of how pressed down each trigger has to be in order to register a button press",
|
"description": "The value of how pressed down each trigger has to be in order to register a button press",
|
||||||
|
@ -775,7 +796,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"left_joycon": {
|
"left_joycon": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/left_joycon",
|
"$id": "#/properties/joystick_controls/properties/left_joycon",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"title": "Left JoyCon Controls",
|
"title": "Left JoyCon Controls",
|
||||||
"required": [
|
"required": [
|
||||||
|
@ -791,63 +812,63 @@
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"stick": {
|
"stick": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/left_joycon/properties/stick",
|
"$id": "#/properties/joystick_controls/properties/left_joycon/properties/stick",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Stick",
|
"title": "Stick",
|
||||||
"default": "LJoystick"
|
"default": "Axis0"
|
||||||
},
|
},
|
||||||
"stick_button": {
|
"stick_button": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/left_joycon/properties/stick_button",
|
"$id": "#/properties/joystick_controls/properties/left_joycon/properties/stick_button",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Stick Button",
|
"title": "Stick Button",
|
||||||
"default": "LStick"
|
"default": "Button13"
|
||||||
},
|
},
|
||||||
"dpad_up": {
|
"dpad_up": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/left_joycon/properties/dpad_up",
|
"$id": "#/properties/joystick_controls/properties/left_joycon/properties/dpad_up",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Dpad Up",
|
"title": "Dpad Up",
|
||||||
"default": "DPadUp"
|
"default": "Hat0Up"
|
||||||
},
|
},
|
||||||
"dpad_down": {
|
"dpad_down": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/left_joycon/properties/dpad_down",
|
"$id": "#/properties/joystick_controls/properties/left_joycon/properties/dpad_down",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Dpad Down",
|
"title": "Dpad Down",
|
||||||
"default": "DPadDown"
|
"default": "Hat0Down"
|
||||||
},
|
},
|
||||||
"dpad_left": {
|
"dpad_left": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/left_joycon/properties/dpad_left",
|
"$id": "#/properties/joystick_controls/properties/left_joycon/properties/dpad_left",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Dpad Left",
|
"title": "Dpad Left",
|
||||||
"default": "DPadLeft"
|
"default": "Hat0Left"
|
||||||
},
|
},
|
||||||
"dpad_right": {
|
"dpad_right": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/left_joycon/properties/dpad_right",
|
"$id": "#/properties/joystick_controls/properties/left_joycon/properties/dpad_right",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Dpad Right",
|
"title": "Dpad Right",
|
||||||
"default": "DPadRight"
|
"default": "Hat0Right"
|
||||||
},
|
},
|
||||||
"button_minus": {
|
"button_minus": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/left_joycon/properties/button_minus",
|
"$id": "#/properties/joystick_controls/properties/left_joycon/properties/button_minus",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Button Minus",
|
"title": "Button Minus",
|
||||||
"default": "Back"
|
"default": "Button10"
|
||||||
},
|
},
|
||||||
"button_l": {
|
"button_l": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/left_joycon/properties/button_l",
|
"$id": "#/properties/joystick_controls/properties/left_joycon/properties/button_l",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Button L",
|
"title": "Button L",
|
||||||
"default": "LShoulder"
|
"default": "Button6"
|
||||||
},
|
},
|
||||||
"button_zl": {
|
"button_zl": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/left_joycon/properties/button_zl",
|
"$id": "#/properties/joystick_controls/properties/left_joycon/properties/button_zl",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Button ZL",
|
"title": "Button ZL",
|
||||||
"default": "LTrigger"
|
"default": "Button8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"right_joycon": {
|
"right_joycon": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/right_joycon",
|
"$id": "#/properties/joystick_controls/properties/right_joycon",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"title": "Right JoyCon Controls",
|
"title": "Right JoyCon Controls",
|
||||||
"required": [
|
"required": [
|
||||||
|
@ -863,58 +884,58 @@
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
"stick": {
|
"stick": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/right_joycon/properties/stick",
|
"$id": "#/properties/joystick_controls/properties/right_joycon/properties/stick",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Stick",
|
"title": "Stick",
|
||||||
"default": "RJoystick"
|
"default": "Axis2"
|
||||||
},
|
},
|
||||||
"stick_button": {
|
"stick_button": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/right_joycon/properties/stick_button",
|
"$id": "#/properties/joystick_controls/properties/right_joycon/properties/stick_button",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Stick Button",
|
"title": "Stick Button",
|
||||||
"default": "RStick"
|
"default": "Button14"
|
||||||
},
|
},
|
||||||
"button_a": {
|
"button_a": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/right_joycon/properties/button_a",
|
"$id": "#/properties/joystick_controls/properties/right_joycon/properties/button_a",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Button A",
|
"title": "Button A",
|
||||||
"default": "B"
|
"default": "Button0"
|
||||||
},
|
},
|
||||||
"button_b": {
|
"button_b": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/right_joycon/properties/button_b",
|
"$id": "#/properties/joystick_controls/properties/right_joycon/properties/button_b",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Button B",
|
"title": "Button B",
|
||||||
"default": "A"
|
"default": "Button1"
|
||||||
},
|
},
|
||||||
"button_x": {
|
"button_x": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/right_joycon/properties/button_x",
|
"$id": "#/properties/joystick_controls/properties/right_joycon/properties/button_x",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Button X",
|
"title": "Button X",
|
||||||
"default": "Y"
|
"default": "Button3"
|
||||||
},
|
},
|
||||||
"button_y": {
|
"button_y": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/right_joycon/properties/button_y",
|
"$id": "#/properties/joystick_controls/properties/right_joycon/properties/button_y",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Button Y",
|
"title": "Button Y",
|
||||||
"default": "X"
|
"default": "Button4"
|
||||||
},
|
},
|
||||||
"button_plus": {
|
"button_plus": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/right_joycon/properties/button_plus",
|
"$id": "#/properties/joystick_controls/properties/right_joycon/properties/button_plus",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Button Plus",
|
"title": "Button Plus",
|
||||||
"default": "Start"
|
"default": "Button11"
|
||||||
},
|
},
|
||||||
"button_r": {
|
"button_r": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/right_joycon/properties/button_r",
|
"$id": "#/properties/joystick_controls/properties/right_joycon/properties/button_r",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Button R",
|
"title": "Button R",
|
||||||
"default": "RShoulder"
|
"default": "Button7"
|
||||||
},
|
},
|
||||||
"button_zr": {
|
"button_zr": {
|
||||||
"$id": "#/properties/gamepad_controls/properties/right_joycon/properties/button_zr",
|
"$id": "#/properties/joystick_controls/properties/right_joycon/properties/button_zr",
|
||||||
"$ref": "#/definitions/input",
|
"$ref": "#/definitions/input",
|
||||||
"title": "Button ZR",
|
"title": "Button ZR",
|
||||||
"default": "RTrigger"
|
"default": "Button9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue