Add Controller Support (#196)

* Added Basic Controller Support

* Added Extra Configuration Options

Added a GamePad_Enable option and GamePad_Index option

* Revert "Added Extra Configuration Options"

This reverts commit 6cc56bfe7ed473fedf8dfe79c7a888bbe7cfe147.

* Revert "Revert "Added Extra Configuration Options""

This reverts commit 4809e5effe7f54cdb67bc5e2b4f01315ae34efc5.

* Forgot to change the Gamepad Index

* Added Configuration for the A B X Y Buttons

* Added Button Configuration for all other Buttons

* Added Basic Joystick Configuration

* Fixed Joystick Axis Problems

Fixed Joystick Axis Problems when switching around the Joysticks (Left Stick is Right and Right stick is Left)

* Refactored all of the button mapping code

* Changes in compliance with review

* Changes in compliance with review

* Fixed problems in the configuration file with different regions

* Changes in compliance with review
This commit is contained in:
John Clemis 2018-07-02 17:08:54 -05:00 committed by gdkchan
parent 0c96e22d40
commit d24ea0d51b
7 changed files with 423 additions and 131 deletions

127
CONFIG.md
View file

@ -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.