diff options
| author | Xpl0itR <xpl0itr@outlook.com> | 2020-05-03 03:00:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-03 04:00:53 +0200 |
| commit | 538fba826b75cdd2feffaeac684044246590cb29 (patch) | |
| tree | 4f9b09aaaeec6249b49d665012dd4e585f3e67f0 /Ryujinx.Common/Configuration/Hid | |
| parent | 5f3558fd51a0920966e5341101c4233a02c98307 (diff) | |
Improvements to input and input configuration in the GUI. (#849)
* Improvements to input and input configuration in the GUI
* Requested changes
* nits
* more nits
Diffstat (limited to 'Ryujinx.Common/Configuration/Hid')
| -rw-r--r-- | Ryujinx.Common/Configuration/Hid/ControllerConfig.cs (renamed from Ryujinx.Common/Configuration/Hid/NpadController.cs) | 17 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/Hid/ControllerInputId.cs | 3 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/Hid/ControllerType.cs | 25 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/Hid/InputConfig.cs | 20 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/Hid/Key.cs | 3 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/Hid/KeyboardConfig.cs | 20 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs | 6 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/Hid/NpadControllerLeft.cs | 9 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/Hid/NpadControllerRight.cs | 9 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/Hid/NpadKeyboard.cs | 20 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/Hid/NpadKeyboardLeft.cs | 8 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/Hid/NpadKeyboardRight.cs | 8 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/Hid/PlayerIndex.cs | 18 |
13 files changed, 115 insertions, 51 deletions
diff --git a/Ryujinx.Common/Configuration/Hid/NpadController.cs b/Ryujinx.Common/Configuration/Hid/ControllerConfig.cs index 94b985d5..3e414055 100644 --- a/Ryujinx.Common/Configuration/Hid/NpadController.cs +++ b/Ryujinx.Common/Configuration/Hid/ControllerConfig.cs @@ -1,21 +1,16 @@ namespace Ryujinx.Common.Configuration.Hid { - public class NpadController + public class ControllerConfig : InputConfig { /// <summary> - /// Enables or disables controller support + /// Controller Left Analog Stick Deadzone /// </summary> - public bool Enabled { get; set; } + public float DeadzoneLeft { get; set; } /// <summary> - /// Controller Device Index + /// Controller Right Analog Stick Deadzone /// </summary> - public int Index { get; set; } - - /// <summary> - /// Controller Analog Stick Deadzone - /// </summary> - public float Deadzone { get; set; } + public float DeadzoneRight { get; set; } /// <summary> /// Controller Trigger Threshold @@ -32,4 +27,4 @@ /// </summary> public NpadControllerRight RightJoycon { get; set; } } -} +}
\ No newline at end of file diff --git a/Ryujinx.Common/Configuration/Hid/ControllerInputId.cs b/Ryujinx.Common/Configuration/Hid/ControllerInputId.cs index 8969b6a4..606a1b0c 100644 --- a/Ryujinx.Common/Configuration/Hid/ControllerInputId.cs +++ b/Ryujinx.Common/Configuration/Hid/ControllerInputId.cs @@ -40,6 +40,7 @@ Hat2Up, Hat2Down, Hat2Left, - Hat2Right + Hat2Right, + Unbound } } diff --git a/Ryujinx.Common/Configuration/Hid/ControllerType.cs b/Ryujinx.Common/Configuration/Hid/ControllerType.cs index b0613b2d..0ad01bbb 100644 --- a/Ryujinx.Common/Configuration/Hid/ControllerType.cs +++ b/Ryujinx.Common/Configuration/Hid/ControllerType.cs @@ -1,11 +1,20 @@ -namespace Ryujinx.Configuration.Hid +using System; + +namespace Ryujinx.Common.Configuration.Hid { - public enum ControllerType + [Flags] + // This enum was duplicated from Ryujinx.HLE.HOS.Services.Hid.PlayerIndex and should be kept identical + public enum ControllerType : int { - ProController, - Handheld, - NpadPair, - NpadLeft, - NpadRight + None, + ProController = 1 << 0, + Handheld = 1 << 1, + JoyconPair = 1 << 2, + JoyconLeft = 1 << 3, + JoyconRight = 1 << 4, + Invalid = 1 << 5, + Pokeball = 1 << 6, + SystemExternal = 1 << 29, + System = 1 << 30 } -} +}
\ No newline at end of file diff --git a/Ryujinx.Common/Configuration/Hid/InputConfig.cs b/Ryujinx.Common/Configuration/Hid/InputConfig.cs new file mode 100644 index 00000000..540506d5 --- /dev/null +++ b/Ryujinx.Common/Configuration/Hid/InputConfig.cs @@ -0,0 +1,20 @@ +namespace Ryujinx.Common.Configuration.Hid +{ + public class InputConfig + { + /// <summary> + /// Controller Device Index + /// </summary> + public int Index { get; set; } + + /// <summary> + /// Controller's Type + /// </summary> + public ControllerType ControllerType { get; set; } + + /// <summary> + /// Player's Index for the controller + /// </summary> + public PlayerIndex PlayerIndex { get; set; } + } +}
\ No newline at end of file diff --git a/Ryujinx.Common/Configuration/Hid/Key.cs b/Ryujinx.Common/Configuration/Hid/Key.cs index b658396b..67177eec 100644 --- a/Ryujinx.Common/Configuration/Hid/Key.cs +++ b/Ryujinx.Common/Configuration/Hid/Key.cs @@ -148,6 +148,7 @@ Slash = 128, BackSlash = 129, NonUSBackSlash = 130, - LastKey = 131 + LastKey = 131, + Unbound } } diff --git a/Ryujinx.Common/Configuration/Hid/KeyboardConfig.cs b/Ryujinx.Common/Configuration/Hid/KeyboardConfig.cs new file mode 100644 index 00000000..664fdff0 --- /dev/null +++ b/Ryujinx.Common/Configuration/Hid/KeyboardConfig.cs @@ -0,0 +1,20 @@ +namespace Ryujinx.Common.Configuration.Hid +{ + public class KeyboardConfig : InputConfig + { + /// <summary> + /// Left JoyCon Keyboard Bindings + /// </summary> + public NpadKeyboardLeft LeftJoycon { get; set; } + + /// <summary> + /// Right JoyCon Keyboard Bindings + /// </summary> + public NpadKeyboardRight RightJoycon { get; set; } + + /// <summary> + /// Hotkey Keyboard Bindings + /// </summary> + public KeyboardHotkeys Hotkeys { get; set; } + } +}
\ No newline at end of file diff --git a/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs b/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs index 30cc8d84..19cc0487 100644 --- a/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs +++ b/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs @@ -1,7 +1,9 @@ -namespace Ryujinx.Configuration.Hid +using Ryujinx.Configuration.Hid; + +namespace Ryujinx.Common.Configuration.Hid { public struct KeyboardHotkeys { public Key ToggleVsync { get; set; } } -} +}
\ No newline at end of file diff --git a/Ryujinx.Common/Configuration/Hid/NpadControllerLeft.cs b/Ryujinx.Common/Configuration/Hid/NpadControllerLeft.cs index c221b5e8..00816e56 100644 --- a/Ryujinx.Common/Configuration/Hid/NpadControllerLeft.cs +++ b/Ryujinx.Common/Configuration/Hid/NpadControllerLeft.cs @@ -2,14 +2,19 @@ { public struct NpadControllerLeft { - public ControllerInputId Stick { get; set; } + public ControllerInputId StickX { get; set; } + public bool InvertStickX { get; set; } + public ControllerInputId StickY { get; set; } + public bool InvertStickY { get; set; } public ControllerInputId StickButton { get; set; } public ControllerInputId ButtonMinus { get; set; } public ControllerInputId ButtonL { get; set; } public ControllerInputId ButtonZl { get; set; } + public ControllerInputId ButtonSl { get; set; } + public ControllerInputId ButtonSr { get; set; } public ControllerInputId DPadUp { get; set; } public ControllerInputId DPadDown { get; set; } public ControllerInputId DPadLeft { get; set; } public ControllerInputId DPadRight { get; set; } } -} +}
\ No newline at end of file diff --git a/Ryujinx.Common/Configuration/Hid/NpadControllerRight.cs b/Ryujinx.Common/Configuration/Hid/NpadControllerRight.cs index f52f6f16..b7b289cc 100644 --- a/Ryujinx.Common/Configuration/Hid/NpadControllerRight.cs +++ b/Ryujinx.Common/Configuration/Hid/NpadControllerRight.cs @@ -2,7 +2,10 @@ { public struct NpadControllerRight { - public ControllerInputId Stick { get; set; } + public ControllerInputId StickX { get; set; } + public bool InvertStickX { get; set; } + public ControllerInputId StickY { get; set; } + public bool InvertStickY { get; set; } public ControllerInputId StickButton { get; set; } public ControllerInputId ButtonA { get; set; } public ControllerInputId ButtonB { get; set; } @@ -11,5 +14,7 @@ public ControllerInputId ButtonPlus { get; set; } public ControllerInputId ButtonR { get; set; } public ControllerInputId ButtonZr { get; set; } + public ControllerInputId ButtonSl { get; set; } + public ControllerInputId ButtonSr { get; set; } } -} +}
\ No newline at end of file diff --git a/Ryujinx.Common/Configuration/Hid/NpadKeyboard.cs b/Ryujinx.Common/Configuration/Hid/NpadKeyboard.cs deleted file mode 100644 index 5ae82756..00000000 --- a/Ryujinx.Common/Configuration/Hid/NpadKeyboard.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Ryujinx.UI.Input -{ - public class NpadKeyboard - { - /// <summary> - /// Left JoyCon Keyboard Bindings - /// </summary> - public Configuration.Hid.NpadKeyboardLeft LeftJoycon { get; set; } - - /// <summary> - /// Right JoyCon Keyboard Bindings - /// </summary> - public Configuration.Hid.NpadKeyboardRight RightJoycon { get; set; } - - /// <summary> - /// Hotkey Keyboard Bindings - /// </summary> - public Configuration.Hid.KeyboardHotkeys Hotkeys { get; set; } - } -} diff --git a/Ryujinx.Common/Configuration/Hid/NpadKeyboardLeft.cs b/Ryujinx.Common/Configuration/Hid/NpadKeyboardLeft.cs index 4a61d932..6b78f5b6 100644 --- a/Ryujinx.Common/Configuration/Hid/NpadKeyboardLeft.cs +++ b/Ryujinx.Common/Configuration/Hid/NpadKeyboardLeft.cs @@ -1,4 +1,6 @@ -namespace Ryujinx.Configuration.Hid +using Ryujinx.Configuration.Hid; + +namespace Ryujinx.Common.Configuration.Hid { public struct NpadKeyboardLeft { @@ -14,5 +16,7 @@ public Key ButtonMinus { get; set; } public Key ButtonL { get; set; } public Key ButtonZl { get; set; } + public Key ButtonSl { get; set; } + public Key ButtonSr { get; set; } } -} +}
\ No newline at end of file diff --git a/Ryujinx.Common/Configuration/Hid/NpadKeyboardRight.cs b/Ryujinx.Common/Configuration/Hid/NpadKeyboardRight.cs index 0677b573..e2109902 100644 --- a/Ryujinx.Common/Configuration/Hid/NpadKeyboardRight.cs +++ b/Ryujinx.Common/Configuration/Hid/NpadKeyboardRight.cs @@ -1,4 +1,6 @@ -namespace Ryujinx.Configuration.Hid +using Ryujinx.Configuration.Hid; + +namespace Ryujinx.Common.Configuration.Hid { public struct NpadKeyboardRight { @@ -14,5 +16,7 @@ public Key ButtonPlus { get; set; } public Key ButtonR { get; set; } public Key ButtonZr { get; set; } + public Key ButtonSl { get; set; } + public Key ButtonSr { get; set; } } -} +}
\ No newline at end of file diff --git a/Ryujinx.Common/Configuration/Hid/PlayerIndex.cs b/Ryujinx.Common/Configuration/Hid/PlayerIndex.cs new file mode 100644 index 00000000..2e34cb96 --- /dev/null +++ b/Ryujinx.Common/Configuration/Hid/PlayerIndex.cs @@ -0,0 +1,18 @@ +namespace Ryujinx.Common.Configuration.Hid +{ + // This enum was duplicated from Ryujinx.HLE.HOS.Services.Hid.PlayerIndex and should be kept identical + public enum PlayerIndex : int + { + Player1 = 0, + Player2 = 1, + Player3 = 2, + Player4 = 3, + Player5 = 4, + Player6 = 5, + Player7 = 6, + Player8 = 7, + Handheld = 8, + Unknown = 9, + Auto = 10 // Shouldn't be used directly + } +}
\ No newline at end of file |
