From 60ad45cc2912ed6a457a9fb78b375085fab774a2 Mon Sep 17 00:00:00 2001 From: John Clemis Date: Thu, 28 Jun 2018 08:59:36 -0500 Subject: [PATCH] Refactored all of the button mapping code --- CONFIG.md | 127 +++++++++++---- README.md | 25 ++- Ryujinx/Config.cs | 140 ++++++++--------- Ryujinx/JoyConController.cs | 38 +++++ .../JoyCon.cs => Ryujinx/JoyConKeyboard.cs | 17 +- Ryujinx/JoyConReal.cs | 8 + Ryujinx/Ryujinx.conf | 88 ++++++----- Ryujinx/Ui/GLScreen.cs | 147 +++++++++--------- 8 files changed, 352 insertions(+), 238 deletions(-) create mode 100644 Ryujinx/JoyConController.cs rename Ryujinx.HLE/Hid/JoyCon.cs => Ryujinx/JoyConKeyboard.cs (67%) create mode 100644 Ryujinx/JoyConReal.cs diff --git a/CONFIG.md b/CONFIG.md index 764eb528d..b5de9fa6d 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -8,23 +8,23 @@ - `Logging_Enable_Trace` *(bool)* - Enable the Trace Logging (Enabled in Debug recommanded). + Enable the Trace Logging (Enabled in Debug recommended). - `Logging_Enable_Debug` *(bool)* - Enable the Debug Logging (Enabled in Debug recommanded). + Enable the Debug Logging (Enabled in Debug recommended). - `Logging_Enable_Warn` *(bool)* - Enable the Warning Logging (Enabled in Debug recommanded). + Enable the Warning Logging (Enabled in Debug recommended). - `Logging_Enable_Error` *(bool)* - Enable the Error Logging (Enabled in Debug recommanded). + Enable the Error Logging (Enabled in Debug recommended). - `Logging_Enable_Fatal` *(bool)* - Enable the Fatal Logging (Enabled in Debug recommanded). + Enable the Fatal Logging (Enabled in Debug recommended). - `Logging_Enable_Ipc` *(bool)* @@ -34,46 +34,107 @@ Enable writing the logging inside a Ryujinx.log file. -- `Controls_Left_FakeJoycon_XX` *(int)* +- `GamePad_Index` *(int)* + + The index of the Controller Device. + +- `GamePad_Deadzone` *(float)* + + The deadzone of both analog sticks on the Controller. + +- `GamePad_Enable` *(bool)* + + Whether or not to enable Controller Support. + +- `Controls_Left_JoyConKeyboard_XX` *(int)* ``` - Controls_Left_FakeJoycon_Stick_Up (int) - Controls_Left_FakeJoycon_Stick_Down (int) - Controls_Left_FakeJoycon_Stick_Left (int) - Controls_Left_FakeJoycon_Stick_Right (int) - Controls_Left_FakeJoycon_Stick_Button (int) - Controls_Left_FakeJoycon_DPad_Up (int) - Controls_Left_FakeJoycon_DPad_Down (int) - Controls_Left_FakeJoycon_DPad_Left (int) - Controls_Left_FakeJoycon_DPad_Right (int) - Controls_Left_FakeJoycon_Button_Minus (int) - Controls_Left_FakeJoycon_Button_L (int) - Controls_Left_FakeJoycon_Button_ZL (int) + Controls_Left_JoyConKeyboard_Stick_Up (int) + Controls_Left_JoyConKeyboard_Stick_Down (int) + Controls_Left_JoyConKeyboard_Stick_Left (int) + Controls_Left_JoyConKeyboard_Stick_Right (int) + Controls_Left_JoyConKeyboard_Stick_Button (int) + Controls_Left_JoyConKeyboard_DPad_Up (int) + Controls_Left_JoyConKeyboard_DPad_Down (int) + Controls_Left_JoyConKeyboard_DPad_Left (int) + Controls_Left_JoyConKeyboard_DPad_Right (int) + Controls_Left_JoyConKeyboard_Button_Minus (int) + Controls_Left_JoyConKeyboard_Button_L (int) + Controls_Left_JoyConKeyboard_Button_ZL (int) ``` Keys of the Left Emulated Joycon, the values depend of the [OpenTK Enum Keys](https://github.com/opentk/opentk/blob/develop/src/OpenTK/Input/Key.cs). OpenTK use a QWERTY layout, so pay attention if you use another Keyboard Layout. - Ex: `Controls_Left_FakeJoycon_Button_Minus = 52` > Tab key (All Layout). + Ex: `Controls_Left_JoyConKeyboard_Button_Minus = 52` > Tab key (All Layout). -- `Controls_Right_FakeJoycon_XX` *(int)* +- `Controls_Right_JoyConKeyboard_XX` *(int)* ``` - Controls_Right_FakeJoycon_Stick_Up (int) - Controls_Right_FakeJoycon_Stick_Down (int) - Controls_Right_FakeJoycon_Stick_Left (int) - Controls_Right_FakeJoycon_Stick_Right (int) - Controls_Right_FakeJoycon_Stick_Button (int) - Controls_Right_FakeJoycon_Button_A (int) - Controls_Right_FakeJoycon_Button_B (int) - Controls_Right_FakeJoycon_Button_X (int) - Controls_Right_FakeJoycon_Button_Y (int) - Controls_Right_FakeJoycon_Button_Plus (int) - Controls_Right_FakeJoycon_Button_R (int) - Controls_Right_FakeJoycon_Button_ZR (int) + Controls_Right_JoyConKeyboard_Stick_Up (int) + Controls_Right_JoyConKeyboard_Stick_Down (int) + Controls_Right_JoyConKeyboard_Stick_Left (int) + Controls_Right_JoyConKeyboard_Stick_Right (int) + Controls_Right_JoyConKeyboard_Stick_Button (int) + Controls_Right_JoyConKeyboard_Button_A (int) + Controls_Right_JoyConKeyboard_Button_B (int) + Controls_Right_JoyConKeyboard_Button_X (int) + Controls_Right_JoyConKeyboard_Button_Y (int) + Controls_Right_JoyConKeyboard_Button_Plus (int) + Controls_Right_JoyConKeyboard_Button_R (int) + Controls_Right_JoyConKeyboard_Button_ZR (int) ``` Keys of the right Emulated Joycon, the values depend of the [OpenTK Enum Keys](https://github.com/opentk/opentk/blob/develop/src/OpenTK/Input/Key.cs). OpenTK use a QWERTY layout, so pay attention if you use another Keyboard Layout. - Ex: `Controls_Right_FakeJoycon_Button_A = 83` > A key (QWERTY Layout) / Q key (AZERTY Layout). + Ex: `Controls_Right_JoyConKeyboard_Button_A = 83` > A key (QWERTY Layout) / Q key (AZERTY Layout). + +- `Controls_Left_JoyConController_XX` *(String)* + ``` + Controls_Left_JoyConController_Stick (String) + Controls_Left_JoyConController_Stick_Button (String) + Controls_Left_JoyConController_DPad_Up (String) + Controls_Left_JoyConController_DPad_Down (String) + Controls_Left_JoyConController_DPad_Left (String) + Controls_Left_JoyConController_DPad_Right (String) + Controls_Left_JoyConController_Button_Minus (String) + Controls_Left_JoyConController_Button_L (String) + Controls_Left_JoyConController_Button_ZL (String) + ``` + +- `Controls_Right_JoyConController_XX` *(String)* + ``` + Controls_Right_JoyConController_Stick (String) + Controls_Right_JoyConController_Stick_Button (String) + Controls_Right_JoyConController_Button_A (String) + Controls_Right_JoyConController_Button_B (String) + Controls_Right_JoyConController_Button_X (String) + Controls_Right_JoyConController_Button_Y (String) + Controls_Right_JoyConController_Button_Plus (String) + Controls_Right_JoyConController_Button_R (String) + Controls_Right_JoyConController_Button_ZR (String) + ``` + +- Valid Button Mappings + - A = The A / Cross Button + - B = The B / Circle Button + - X = The X / Square Button + - 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. \ No newline at end of file diff --git a/README.md b/README.md index 3efd347a8..71dad9ce2 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,32 @@ https://openal.org/downloads/OpenAL11CoreSDK.zip - Plus = + - R = U - ZR = O + - For more information on how to configure these buttons see [CONFIG.md](CONFIG.md) + + - Controller Input is partially supported: + - Left Joycon: + - Analog Stick = Left Analog Stick + - DPad Up = DPad Up + - DPad Down = DPad Down + - DPad Left = DPad Left + - DPad Right = DPad Right + - Minus = Select / Back / Share + - L = Left Shoulder Button + - ZL = Left Trigger + + - Right Joycon: + - Analog Stick = Right Analog Stick + - A = B / Circle + - B = A / Cross + - X = Y / Triangle + - Y = X / Square + - Plus = Start / Options + - R = Right Shoulder Button + - ZR = Right Trigger + - For more information on how to configure these buttons see [CONFIG.md](CONFIG.md) - Config File: `Ryujinx.conf` should be present in executable folder. - For more informations [you can go here](CONFIG.md). + For more information [you can go here](CONFIG.md). - If you are a Windows user, you can configure your keys, the logs, install OpenAL, etc... with Ryujinx-Setting. [Download it, right here](https://github.com/AcK77/Ryujinx-Settings) diff --git a/Ryujinx/Config.cs b/Ryujinx/Config.cs index 1a38ffa6e..022da2427 100644 --- a/Ryujinx/Config.cs +++ b/Ryujinx/Config.cs @@ -1,5 +1,5 @@ using OpenTK.Input; -using Ryujinx.HLE.Input; +using Ryujinx.Input; using Ryujinx.HLE.Logging; using System; using System.Collections.Generic; @@ -11,32 +11,13 @@ namespace Ryujinx { public static class Config { - public static JoyCon FakeJoyCon { get; private set; } + public static JoyConKeyboard JoyConKeyboard { get; private set; } + public static JoyConController JoyConController { get; private set; } public static float GamePad_Deadzone; public static bool GamePad_Enable; public static int GamePad_Index; - - public static string Controls_Right_FakeJoycon_GamePadButton_A; - public static string Controls_Right_FakeJoycon_GamePadButton_B; - public static string Controls_Right_FakeJoycon_GamePadButton_X; - public static string Controls_Right_FakeJoycon_GamePadButton_Y; - public static string Controls_Right_FakeJoycon_GamePadButton_Plus; - public static string Controls_Right_FakeJoycon_GamePadButton_R; - public static string Controls_Right_FakeJoycon_GamePadStick_Button; - public static string Controls_Right_FakeJoycon_GamePadTrigger_ZR; - - public static string Controls_Left_FakeJoycon_GamePadDPad_Up; - public static string Controls_Left_FakeJoycon_GamePadDPad_Down; - public static string Controls_Left_FakeJoycon_GamePadDPad_Left; - public static string Controls_Left_FakeJoycon_GamePadDPad_Right; - public static string Controls_Left_FakeJoycon_GamePadButton_Minus; - public static string Controls_Left_FakeJoycon_GamePadButton_L; - public static string Controls_Left_FakeJoycon_GamePadStick_Button; - public static string Controls_Left_FakeJoycon_GamePadTrigger_ZL; - - public static string Controls_Right_FakeJoycon_GamePadJoystick_R; - public static string Controls_Left_FakeJoycon_GamePadJoystick_L; + public static float GamePad_Trigger_Threshold; public static void Read(Logger Log) { @@ -54,30 +35,10 @@ namespace Ryujinx Log.SetEnable(LogLevel.Warning, Convert.ToBoolean(Parser.Value("Logging_Enable_Warn"))); Log.SetEnable(LogLevel.Error, Convert.ToBoolean(Parser.Value("Logging_Enable_Error"))); - GamePad_Enable = Convert.ToBoolean(Parser.Value("GamePad_Enable")); - GamePad_Index = Convert.ToInt32 (Parser.Value("GamePad_Index")); - GamePad_Deadzone = (float)Convert.ToDouble (Parser.Value("GamePad_Deadzone")); - - Controls_Right_FakeJoycon_GamePadButton_A = Parser.Value("Controls_Right_FakeJoycon_GamePadButton_A"); - Controls_Right_FakeJoycon_GamePadButton_B = Parser.Value("Controls_Right_FakeJoycon_GamePadButton_B"); - Controls_Right_FakeJoycon_GamePadButton_X = Parser.Value("Controls_Right_FakeJoycon_GamePadButton_X"); - Controls_Right_FakeJoycon_GamePadButton_Y = Parser.Value("Controls_Right_FakeJoycon_GamePadButton_Y"); - Controls_Right_FakeJoycon_GamePadButton_Plus = Parser.Value("Controls_Right_FakeJoycon_GamePadButton_Plus"); - Controls_Right_FakeJoycon_GamePadButton_R = Parser.Value("Controls_Right_FakeJoycon_GamePadButton_R"); - Controls_Right_FakeJoycon_GamePadStick_Button = Parser.Value("Controls_Right_FakeJoycon_GamePadStick_Button"); - Controls_Right_FakeJoycon_GamePadTrigger_ZR = Parser.Value("Controls_Right_FakeJoycon_GamePadTrigger_ZR"); - - Controls_Left_FakeJoycon_GamePadDPad_Up = Parser.Value("Controls_Left_FakeJoycon_GamePadDPad_Up"); - Controls_Left_FakeJoycon_GamePadDPad_Down = Parser.Value("Controls_Left_FakeJoycon_GamePadDPad_Down"); - Controls_Left_FakeJoycon_GamePadDPad_Left = Parser.Value("Controls_Left_FakeJoycon_GamePadDPad_Left"); - Controls_Left_FakeJoycon_GamePadDPad_Right = Parser.Value("Controls_Left_FakeJoycon_GamePadDPad_Right"); - Controls_Left_FakeJoycon_GamePadButton_Minus = Parser.Value("Controls_Left_FakeJoycon_GamePadButton_Minus"); - Controls_Left_FakeJoycon_GamePadButton_L = Parser.Value("Controls_Left_FakeJoycon_GamePadButton_L"); - Controls_Left_FakeJoycon_GamePadStick_Button = Parser.Value("Controls_Left_FakeJoycon_GamePadStick_Button"); - Controls_Left_FakeJoycon_GamePadTrigger_ZL = Parser.Value("Controls_Left_FakeJoycon_GamePadTrigger_ZL"); - - Controls_Right_FakeJoycon_GamePadJoystick_R = Parser.Value("Controls_Right_FakeJoycon_GamePadJoystick_R"); - Controls_Left_FakeJoycon_GamePadJoystick_L = Parser.Value("Controls_Left_FakeJoycon_GamePadJoystick_L"); + GamePad_Enable = Convert.ToBoolean(Parser.Value("GamePad_Enable")); + GamePad_Index = Convert.ToInt32 (Parser.Value("GamePad_Index")); + GamePad_Deadzone = (float)Convert.ToDouble (Parser.Value("GamePad_Deadzone")); + GamePad_Trigger_Threshold = (float)Convert.ToDouble (Parser.Value("GamePad_Trigger_Threshold")); string[] FilteredLogClasses = Parser.Value("Logging_Filtered_Classes").Split(',', StringSplitOptions.RemoveEmptyEntries); @@ -107,44 +68,73 @@ namespace Ryujinx } } - FakeJoyCon = new JoyCon + JoyConKeyboard = new JoyConKeyboard { - Left = new JoyConLeft + Left = new JoyConKeyboardLeft { - StickUp = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Stick_Up")), - StickDown = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Stick_Down")), - StickLeft = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Stick_Left")), - StickRight = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Stick_Right")), - StickButton = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Stick_Button")), - DPadUp = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_DPad_Up")), - DPadDown = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_DPad_Down")), - DPadLeft = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_DPad_Left")), - DPadRight = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_DPad_Right")), - ButtonMinus = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Button_Minus")), - ButtonL = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Button_L")), - ButtonZL = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Button_ZL")) + StickUp = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Up")), + StickDown = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Down")), + StickLeft = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Left")), + StickRight = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Right")), + StickButton = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Button")), + DPadUp = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Up")), + DPadDown = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Down")), + DPadLeft = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Left")), + DPadRight = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Right")), + ButtonMinus = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_Minus")), + ButtonL = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_L")), + ButtonZL = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_ZL")) }, - Right = new JoyConRight + Right = new JoyConKeyboardRight { - StickUp = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Stick_Up")), - StickDown = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Stick_Down")), - StickLeft = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Stick_Left")), - StickRight = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Stick_Right")), - StickButton = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Stick_Button")), - ButtonA = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Button_A")), - ButtonB = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Button_B")), - ButtonX = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Button_X")), - ButtonY = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Button_Y")), - ButtonPlus = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Button_Plus")), - ButtonR = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Button_R")), - ButtonZR = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Button_ZR")) + StickUp = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Up")), + StickDown = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Down")), + StickLeft = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Left")), + StickRight = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Right")), + StickButton = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Button")), + ButtonA = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_A")), + ButtonB = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_B")), + ButtonX = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_X")), + ButtonY = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_Y")), + ButtonPlus = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_Plus")), + ButtonR = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_R")), + ButtonZR = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_ZR")) + } + }; + + JoyConController = new JoyConController + { + Left = new JoyConControllerLeft + { + Stick = Parser.Value("Controls_Left_JoyConController_Stick"), + StickButton = Parser.Value("Controls_Left_JoyConController_Stick_Button"), + DPadUp = Parser.Value("Controls_Left_JoyConController_DPad_Up"), + DPadDown = Parser.Value("Controls_Left_JoyConController_DPad_Down"), + DPadLeft = Parser.Value("Controls_Left_JoyConController_DPad_Left"), + DPadRight = Parser.Value("Controls_Left_JoyConController_DPad_Right"), + ButtonMinus = Parser.Value("Controls_Left_JoyConController_Button_Minus"), + ButtonL = Parser.Value("Controls_Left_JoyConController_Button_L"), + ButtonZL = Parser.Value("Controls_Left_JoyConController_Button_ZL") + }, + + Right = new JoyConControllerRight + { + Stick = Parser.Value("Controls_Right_JoyConController_Stick"), + StickButton = Parser.Value("Controls_Right_JoyConController_Stick_Button"), + ButtonA = Parser.Value("Controls_Right_JoyConController_Button_A"), + ButtonB = Parser.Value("Controls_Right_JoyConController_Button_B"), + ButtonX = Parser.Value("Controls_Right_JoyConController_Button_X"), + ButtonY = Parser.Value("Controls_Right_JoyConController_Button_Y"), + ButtonPlus = Parser.Value("Controls_Right_JoyConController_Button_Plus"), + ButtonR = Parser.Value("Controls_Right_JoyConController_Button_R"), + ButtonZR = Parser.Value("Controls_Right_JoyConController_Button_ZR") } }; } } - // https://stackoverflow.com/a/37772571 + //https://stackoverflow.com/a/37772571 public class IniParser { private readonly Dictionary Values; diff --git a/Ryujinx/JoyConController.cs b/Ryujinx/JoyConController.cs new file mode 100644 index 000000000..d779abf43 --- /dev/null +++ b/Ryujinx/JoyConController.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Ryujinx.Input +{ + public struct JoyConControllerLeft + { + public string Stick; + public string StickButton; + public string DPadUp; + public string DPadDown; + public string DPadLeft; + public string DPadRight; + public string ButtonMinus; + public string ButtonL; + public string ButtonZL; + } + + public struct JoyConControllerRight + { + public string Stick; + public string StickButton; + public string ButtonA; + public string ButtonB; + public string ButtonX; + public string ButtonY; + public string ButtonPlus; + public string ButtonR; + public string ButtonZR; + } + + public struct JoyConController + { + public JoyConControllerLeft Left; + public JoyConControllerRight Right; + } +} diff --git a/Ryujinx.HLE/Hid/JoyCon.cs b/Ryujinx/JoyConKeyboard.cs similarity index 67% rename from Ryujinx.HLE/Hid/JoyCon.cs rename to Ryujinx/JoyConKeyboard.cs index e45e1a47e..2d57b67a4 100644 --- a/Ryujinx.HLE/Hid/JoyCon.cs +++ b/Ryujinx/JoyConKeyboard.cs @@ -1,7 +1,6 @@ -//TODO: This is only used by Config, it doesn't belong to Core. -namespace Ryujinx.HLE.Input +namespace Ryujinx.Input { - public struct JoyConLeft + public struct JoyConKeyboardLeft { public int StickUp; public int StickDown; @@ -15,11 +14,9 @@ namespace Ryujinx.HLE.Input public int ButtonMinus; public int ButtonL; public int ButtonZL; - public int ButtonSL; - public int ButtonSR; } - public struct JoyConRight + public struct JoyConKeyboardRight { public int StickUp; public int StickDown; @@ -33,13 +30,11 @@ namespace Ryujinx.HLE.Input public int ButtonPlus; public int ButtonR; public int ButtonZR; - public int ButtonSL; - public int ButtonSR; } - public struct JoyCon + public struct JoyConKeyboard { - public JoyConLeft Left; - public JoyConRight Right; + public JoyConKeyboardLeft Left; + public JoyConKeyboardRight Right; } } diff --git a/Ryujinx/JoyConReal.cs b/Ryujinx/JoyConReal.cs new file mode 100644 index 000000000..9851bb497 --- /dev/null +++ b/Ryujinx/JoyConReal.cs @@ -0,0 +1,8 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Ryujinx.Input +{ + //TODO: Add real Bluetooth Joy Con Support in the far future. +} diff --git a/Ryujinx/Ryujinx.conf b/Ryujinx/Ryujinx.conf index 1b41b6380..59f7f859e 100644 --- a/Ryujinx/Ryujinx.conf +++ b/Ryujinx/Ryujinx.conf @@ -25,54 +25,58 @@ GamePad_Index = 0 #Controller Analog Stick Deadzone GamePad_Deadzone = 0.05 +#The value of how pressed down each trigger has to be in order to register a button press +GamePad_Trigger_Threshold = 0.5 + #Whether or not to enable Controller support GamePad_Enable = true #https://github.com/opentk/opentk/blob/develop/src/OpenTK/Input/Key.cs -Controls_Left_FakeJoycon_Stick_Up = 105 -Controls_Left_FakeJoycon_Stick_Down = 101 -Controls_Left_FakeJoycon_Stick_Left = 83 -Controls_Left_FakeJoycon_Stick_Right = 86 -Controls_Left_FakeJoycon_Stick_Button = 88 -Controls_Left_FakeJoycon_DPad_Up = 45 -Controls_Left_FakeJoycon_DPad_Down = 46 -Controls_Left_FakeJoycon_DPad_Left = 47 -Controls_Left_FakeJoycon_DPad_Right = 48 -Controls_Left_FakeJoycon_Button_Minus = 120 -Controls_Left_FakeJoycon_Button_L = 87 -Controls_Left_FakeJoycon_Button_ZL = 99 +Controls_Left_JoyConKeyboard_Stick_Up = 105 +Controls_Left_JoyConKeyboard_Stick_Down = 101 +Controls_Left_JoyConKeyboard_Stick_Left = 83 +Controls_Left_JoyConKeyboard_Stick_Right = 86 +Controls_Left_JoyConKeyboard_Stick_Button = 88 +Controls_Left_JoyConKeyboard_DPad_Up = 45 +Controls_Left_JoyConKeyboard_DPad_Down = 46 +Controls_Left_JoyConKeyboard_DPad_Left = 47 +Controls_Left_JoyConKeyboard_DPad_Right = 48 +Controls_Left_JoyConKeyboard_Button_Minus = 120 +Controls_Left_JoyConKeyboard_Button_L = 87 +Controls_Left_JoyConKeyboard_Button_ZL = 99 -Controls_Right_FakeJoycon_Stick_Up = 91 -Controls_Right_FakeJoycon_Stick_Down = 93 -Controls_Right_FakeJoycon_Stick_Left = 92 -Controls_Right_FakeJoycon_Stick_Right = 94 -Controls_Right_FakeJoycon_Stick_Button = 90 -Controls_Right_FakeJoycon_Button_A = 108 -Controls_Right_FakeJoycon_Button_B = 106 -Controls_Right_FakeJoycon_Button_X = 85 -Controls_Right_FakeJoycon_Button_Y = 104 -Controls_Right_FakeJoycon_Button_Plus = 121 -Controls_Right_FakeJoycon_Button_R = 103 -Controls_Right_FakeJoycon_Button_ZR = 97 +Controls_Right_JoyConKeyboard_Stick_Up = 91 +Controls_Right_JoyConKeyboard_Stick_Down = 93 +Controls_Right_JoyConKeyboard_Stick_Left = 92 +Controls_Right_JoyConKeyboard_Stick_Right = 94 +Controls_Right_JoyConKeyboard_Stick_Button = 90 +Controls_Right_JoyConKeyboard_Button_A = 108 +Controls_Right_JoyConKeyboard_Button_B = 106 +Controls_Right_JoyConKeyboard_Button_X = 85 +Controls_Right_JoyConKeyboard_Button_Y = 104 +Controls_Right_JoyConKeyboard_Button_Plus = 121 +Controls_Right_JoyConKeyboard_Button_R = 103 +Controls_Right_JoyConKeyboard_Button_ZR = 97 #Controller Controls -Controls_Right_FakeJoycon_GamePadButton_A = B -Controls_Right_FakeJoycon_GamePadButton_B = A -Controls_Right_FakeJoycon_GamePadButton_X = Y -Controls_Right_FakeJoycon_GamePadButton_Y = X -Controls_Right_FakeJoycon_GamePadButton_Plus = Start -Controls_Right_FakeJoycon_GamePadButton_R = RShoulder -Controls_Right_FakeJoycon_GamePadStick_Button = RStick -Controls_Right_FakeJoycon_GamePadTrigger_ZR = RTrigger -Controls_Left_FakeJoycon_GamePadDPad_Up = DPadUp -Controls_Left_FakeJoycon_GamePadDPad_Down = DPadDown -Controls_Left_FakeJoycon_GamePadDPad_Left = DPadLeft -Controls_Left_FakeJoycon_GamePadDPad_Right = DPadRight -Controls_Left_FakeJoycon_GamePadButton_Minus = Back -Controls_Left_FakeJoycon_GamePadButton_L = LShoulder -Controls_Left_FakeJoycon_GamePadStick_Button = LStick -Controls_Left_FakeJoycon_GamePadTrigger_ZL = LTrigger +Controls_Left_JoyConController_Stick_Button = LStick +Controls_Left_JoyConController_DPad_Up = DPadUp +Controls_Left_JoyConController_DPad_Down = DPadDown +Controls_Left_JoyConController_DPad_Left = DPadLeft +Controls_Left_JoyConController_DPad_Right = DPadRight +Controls_Left_JoyConController_Button_Minus = Back +Controls_Left_JoyConController_Button_L = LShoulder +Controls_Left_JoyConController_Button_ZL = LTrigger -Controls_Right_FakeJoycon_GamePadJoystick_R = RJoystick -Controls_Left_FakeJoycon_GamePadJoystick_L = LJoystick \ No newline at end of file +Controls_Right_JoyConController_Stick_Button = RStick +Controls_Right_JoyConController_Button_A = B +Controls_Right_JoyConController_Button_B = A +Controls_Right_JoyConController_Button_X = Y +Controls_Right_JoyConController_Button_Y = X +Controls_Right_JoyConController_Button_Plus = Start +Controls_Right_JoyConController_Button_R = RShoulder +Controls_Right_JoyConController_Button_ZR = RTrigger + +Controls_Left_JoyConController_Stick = LJoystick +Controls_Right_JoyConController_Stick = RJoystick \ No newline at end of file diff --git a/Ryujinx/Ui/GLScreen.cs b/Ryujinx/Ui/GLScreen.cs index 50dfe7013..f042bdc45 100644 --- a/Ryujinx/Ui/GLScreen.cs +++ b/Ryujinx/Ui/GLScreen.cs @@ -44,8 +44,20 @@ namespace Ryujinx Renderer.FrameBuffer.SetWindowSize(Width, Height); } + + private bool IsGamePadButtonPressedFromString(GamePadState gamePad, string str) + { + if (str == "LTrigger" || str == "RTrigger") + { + return GetGamePadTriggerFromString(gamePad, str) >= Config.GamePad_Trigger_Threshold; + } + else + { + return (GetGamePadButtonFromString(gamePad, str) == ButtonState.Pressed); + } + } - private ButtonState getGamePadButtonFromString(GamePadState gamePad, string str) //Please make this prettier if you can. + private ButtonState GetGamePadButtonFromString(GamePadState gamePad, string str) //Please make this prettier if you can. { ButtonState result = gamePad.Buttons.A; @@ -101,7 +113,7 @@ namespace Ryujinx return result; } - private float getGamePadTriggerFromString(GamePadState gamePad, string str) + private float GetGamePadTriggerFromString(GamePadState gamePad, string str) { float result = 0; @@ -121,7 +133,7 @@ namespace Ryujinx return result; } - private Vector2 getJoystickAxisFromString(GamePadState gamePad, string str) + private Vector2 GetJoystickAxisFromString(GamePadState gamePad, string str) { Vector2 result = new Vector2(0, 0); @@ -161,36 +173,36 @@ namespace Ryujinx if (Keyboard[Key.Escape]) this.Exit(); //LeftJoystick - if (Keyboard[(Key)Config.FakeJoyCon.Left.StickUp]) LeftJoystickDY = short.MaxValue; - if (Keyboard[(Key)Config.FakeJoyCon.Left.StickDown]) LeftJoystickDY = -short.MaxValue; - if (Keyboard[(Key)Config.FakeJoyCon.Left.StickLeft]) LeftJoystickDX = -short.MaxValue; - if (Keyboard[(Key)Config.FakeJoyCon.Left.StickRight]) LeftJoystickDX = short.MaxValue; + if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickUp]) LeftJoystickDY = short.MaxValue; + if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickDown]) LeftJoystickDY = -short.MaxValue; + if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickLeft]) LeftJoystickDX = -short.MaxValue; + if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickRight]) LeftJoystickDX = short.MaxValue; //LeftButtons - if (Keyboard[(Key)Config.FakeJoyCon.Left.StickButton]) CurrentButton |= HidControllerButtons.KEY_LSTICK; - if (Keyboard[(Key)Config.FakeJoyCon.Left.DPadUp]) CurrentButton |= HidControllerButtons.KEY_DUP; - if (Keyboard[(Key)Config.FakeJoyCon.Left.DPadDown]) CurrentButton |= HidControllerButtons.KEY_DDOWN; - if (Keyboard[(Key)Config.FakeJoyCon.Left.DPadLeft]) CurrentButton |= HidControllerButtons.KEY_DLEFT; - if (Keyboard[(Key)Config.FakeJoyCon.Left.DPadRight]) CurrentButton |= HidControllerButtons.KEY_DRIGHT; - if (Keyboard[(Key)Config.FakeJoyCon.Left.ButtonMinus]) CurrentButton |= HidControllerButtons.KEY_MINUS; - if (Keyboard[(Key)Config.FakeJoyCon.Left.ButtonL]) CurrentButton |= HidControllerButtons.KEY_L; - if (Keyboard[(Key)Config.FakeJoyCon.Left.ButtonZL]) CurrentButton |= HidControllerButtons.KEY_ZL; + if (Keyboard[(Key)Config.JoyConKeyboard.Left.StickButton]) CurrentButton |= HidControllerButtons.KEY_LSTICK; + if (Keyboard[(Key)Config.JoyConKeyboard.Left.DPadUp]) CurrentButton |= HidControllerButtons.KEY_DUP; + if (Keyboard[(Key)Config.JoyConKeyboard.Left.DPadDown]) CurrentButton |= HidControllerButtons.KEY_DDOWN; + if (Keyboard[(Key)Config.JoyConKeyboard.Left.DPadLeft]) CurrentButton |= HidControllerButtons.KEY_DLEFT; + if (Keyboard[(Key)Config.JoyConKeyboard.Left.DPadRight]) CurrentButton |= HidControllerButtons.KEY_DRIGHT; + if (Keyboard[(Key)Config.JoyConKeyboard.Left.ButtonMinus]) CurrentButton |= HidControllerButtons.KEY_MINUS; + if (Keyboard[(Key)Config.JoyConKeyboard.Left.ButtonL]) CurrentButton |= HidControllerButtons.KEY_L; + if (Keyboard[(Key)Config.JoyConKeyboard.Left.ButtonZL]) CurrentButton |= HidControllerButtons.KEY_ZL; //RightJoystick - if (Keyboard[(Key)Config.FakeJoyCon.Right.StickUp]) RightJoystickDY = short.MaxValue; - if (Keyboard[(Key)Config.FakeJoyCon.Right.StickDown]) RightJoystickDY = -short.MaxValue; - if (Keyboard[(Key)Config.FakeJoyCon.Right.StickLeft]) RightJoystickDX = -short.MaxValue; - if (Keyboard[(Key)Config.FakeJoyCon.Right.StickRight]) RightJoystickDX = short.MaxValue; + if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickUp]) RightJoystickDY = short.MaxValue; + if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickDown]) RightJoystickDY = -short.MaxValue; + if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickLeft]) RightJoystickDX = -short.MaxValue; + if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickRight]) RightJoystickDX = short.MaxValue; //RightButtons - if (Keyboard[(Key)Config.FakeJoyCon.Right.StickButton]) CurrentButton |= HidControllerButtons.KEY_RSTICK; - if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonA]) CurrentButton |= HidControllerButtons.KEY_A; - if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonB]) CurrentButton |= HidControllerButtons.KEY_B; - if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonX]) CurrentButton |= HidControllerButtons.KEY_X; - if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonY]) CurrentButton |= HidControllerButtons.KEY_Y; - if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonPlus]) CurrentButton |= HidControllerButtons.KEY_PLUS; - if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonR]) CurrentButton |= HidControllerButtons.KEY_R; - if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonZR]) CurrentButton |= HidControllerButtons.KEY_ZR; + if (Keyboard[(Key)Config.JoyConKeyboard.Right.StickButton]) CurrentButton |= HidControllerButtons.KEY_RSTICK; + if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonA]) CurrentButton |= HidControllerButtons.KEY_A; + if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonB]) CurrentButton |= HidControllerButtons.KEY_B; + if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonX]) CurrentButton |= HidControllerButtons.KEY_X; + if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonY]) CurrentButton |= HidControllerButtons.KEY_Y; + if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonPlus]) CurrentButton |= HidControllerButtons.KEY_PLUS; + if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonR]) CurrentButton |= HidControllerButtons.KEY_R; + if (Keyboard[(Key)Config.JoyConKeyboard.Right.ButtonZR]) CurrentButton |= HidControllerButtons.KEY_ZR; } //Controller Input @@ -198,60 +210,43 @@ namespace Ryujinx { GamePadState gamePad = GamePad.GetState(Config.GamePad_Index); - //RightButtons - if (getGamePadButtonFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadButton_A) - == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_A; - if (getGamePadButtonFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadButton_B) - == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_B; - if (getGamePadButtonFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadButton_X) - == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_X; - if (getGamePadButtonFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadButton_Y) - == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_Y; - if (getGamePadButtonFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadStick_Button) - == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_RSTICK; - if (getGamePadButtonFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadButton_Plus) - == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_PLUS; - if (getGamePadButtonFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadButton_R) - == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_R; - if (getGamePadTriggerFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadTrigger_ZR) - >= 0.5) CurrentButton |= HidControllerButtons.KEY_ZR; - //LeftButtons - if (getGamePadButtonFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadDPad_Up) - == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_DUP; - if (getGamePadButtonFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadDPad_Down) - == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_DDOWN; - if (getGamePadButtonFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadDPad_Left) - == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_DLEFT; - if (getGamePadButtonFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadDPad_Right) - == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_DRIGHT; - if (getGamePadButtonFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadStick_Button) - == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_LSTICK; - if (getGamePadButtonFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadButton_Minus) - == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_MINUS; - if (getGamePadButtonFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadButton_L) - == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_L; - if (getGamePadTriggerFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadTrigger_ZL) - >= 0.5) CurrentButton |= HidControllerButtons.KEY_ZL; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Left.DPadUp)) CurrentButton |= HidControllerButtons.KEY_DUP; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Left.DPadDown)) CurrentButton |= HidControllerButtons.KEY_DDOWN; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Left.DPadLeft)) CurrentButton |= HidControllerButtons.KEY_DLEFT; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Left.DPadRight)) CurrentButton |= HidControllerButtons.KEY_DRIGHT; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Left.StickButton)) CurrentButton |= HidControllerButtons.KEY_LSTICK; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Left.ButtonMinus)) CurrentButton |= HidControllerButtons.KEY_MINUS; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Left.ButtonL)) CurrentButton |= HidControllerButtons.KEY_L; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Left.ButtonZL)) CurrentButton |= HidControllerButtons.KEY_ZL; - //RightJoystick - - if (getJoystickAxisFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadJoystick_R).X >= deadzone - || getJoystickAxisFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadJoystick_R).X <= -deadzone) - RightJoystickDX = (int)(getJoystickAxisFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadJoystick_R).X * short.MaxValue); - - if (getJoystickAxisFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadJoystick_R).Y >= deadzone - || getJoystickAxisFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadJoystick_R).Y <= -deadzone) - RightJoystickDY = (int)(getJoystickAxisFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadJoystick_R).Y * short.MaxValue); + //RightButtons + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Right.ButtonA)) CurrentButton |= HidControllerButtons.KEY_A; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Right.ButtonB)) CurrentButton |= HidControllerButtons.KEY_B; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Right.ButtonX)) CurrentButton |= HidControllerButtons.KEY_X; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Right.ButtonY)) CurrentButton |= HidControllerButtons.KEY_Y; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Right.StickButton)) CurrentButton |= HidControllerButtons.KEY_RSTICK; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Right.ButtonPlus)) CurrentButton |= HidControllerButtons.KEY_PLUS; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Right.ButtonR)) CurrentButton |= HidControllerButtons.KEY_R; + if (IsGamePadButtonPressedFromString(gamePad, Config.JoyConController.Right.ButtonZR)) CurrentButton |= HidControllerButtons.KEY_ZR; //LeftJoystick - if (getJoystickAxisFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadJoystick_L).X >= deadzone - || getJoystickAxisFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadJoystick_L).X <= -deadzone) - LeftJoystickDX = (int)(getJoystickAxisFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadJoystick_L).X * short.MaxValue); + if (GetJoystickAxisFromString(gamePad, Config.JoyConController.Left.Stick).X >= deadzone + || GetJoystickAxisFromString(gamePad, Config.JoyConController.Left.Stick).X <= -deadzone) + LeftJoystickDX = (int)(GetJoystickAxisFromString(gamePad, Config.JoyConController.Left.Stick).X * short.MaxValue); - if (getJoystickAxisFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadJoystick_L).Y >= deadzone - || getJoystickAxisFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadJoystick_L).Y <= -deadzone) - LeftJoystickDY = (int)(getJoystickAxisFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadJoystick_L).Y * short.MaxValue); + if (GetJoystickAxisFromString(gamePad, Config.JoyConController.Left.Stick).Y >= deadzone + || GetJoystickAxisFromString(gamePad, Config.JoyConController.Left.Stick).Y <= -deadzone) + LeftJoystickDY = (int)(GetJoystickAxisFromString(gamePad, Config.JoyConController.Left.Stick).Y * short.MaxValue); + + //RightJoystick + if (GetJoystickAxisFromString(gamePad, Config.JoyConController.Right.Stick).X >= deadzone + || GetJoystickAxisFromString(gamePad, Config.JoyConController.Right.Stick).X <= -deadzone) + RightJoystickDX = (int)(GetJoystickAxisFromString(gamePad, Config.JoyConController.Right.Stick).X * short.MaxValue); + + if (GetJoystickAxisFromString(gamePad, Config.JoyConController.Right.Stick).Y >= deadzone + || GetJoystickAxisFromString(gamePad, Config.JoyConController.Right.Stick).Y <= -deadzone) + RightJoystickDY = (int)(GetJoystickAxisFromString(gamePad, Config.JoyConController.Right.Stick).Y * short.MaxValue); } LeftJoystick = new HidJoystickPosition