mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-30 20:43:05 +00:00
Add config to XInput
This commit is contained in:
parent
b513c00627
commit
d324b8357c
4 changed files with 74 additions and 14 deletions
|
@ -12,6 +12,8 @@ namespace Ryujinx
|
|||
{
|
||||
public static JoyCon FakeJoyCon { get; private set; }
|
||||
|
||||
public static XInputController XInput { get; private set; }
|
||||
|
||||
public static void Read(Logger Log)
|
||||
{
|
||||
string IniFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||
|
@ -56,6 +58,24 @@ namespace Ryujinx
|
|||
}
|
||||
}
|
||||
|
||||
XInput = new XInputController
|
||||
{
|
||||
ButtonA = Convert.ToInt16(Parser.Value("Controls_XInput_Button_A")),
|
||||
ButtonB = Convert.ToInt16(Parser.Value("Controls_XInput_Button_B")),
|
||||
ButtonX = Convert.ToInt16(Parser.Value("Controls_XInput_Button_X")),
|
||||
ButtonY = Convert.ToInt16(Parser.Value("Controls_XInput_Button_Y")),
|
||||
ButtonPlus = Convert.ToInt16(Parser.Value("Controls_XInput_Button_A")),
|
||||
ButtonMinus = Convert.ToInt16(Parser.Value("Controls_XInput_Button_A")),
|
||||
DPadUp = Convert.ToInt16(Parser.Value("Controls_XInput_DPad_Up")),
|
||||
DPadDown = Convert.ToInt16(Parser.Value("Controls_XInput_DPad_Down")),
|
||||
DPadLeft = Convert.ToInt16(Parser.Value("Controls_XInput_DPad_Left")),
|
||||
DPadRight = Convert.ToInt16(Parser.Value("Controls_XInput_DPad_Right")),
|
||||
ButtonL = Convert.ToInt16(Parser.Value("Controls_XInput_Button_L")),
|
||||
ButtonZL = Convert.ToInt16(Parser.Value("Controls_XInput_Button_ZL")),
|
||||
ButtonR = Convert.ToInt16(Parser.Value("Controls_XInput_Button_R")),
|
||||
ButtonZR = Convert.ToInt16(Parser.Value("Controls_XInput_Button_ZR"))
|
||||
};
|
||||
|
||||
FakeJoyCon = new JoyCon
|
||||
{
|
||||
Left = new JoyConLeft
|
||||
|
|
|
@ -19,6 +19,22 @@ Logging_Enable_Error = true
|
|||
#Filtered log classes, seperated by ", ", eg. `Logging_Filtered_Classes = Loader, ServiceFS`
|
||||
Logging_Filtered_Classes =
|
||||
|
||||
#XInput, https://gist.github.com/Cyuubi/923bb473e412f477b39d7ee4ddae51ed
|
||||
Controls_XInput_Button_A = 4096
|
||||
Controls_XInput_Button_B = 8192
|
||||
Controls_XInput_Button_X = 16384
|
||||
Controls_XInput_Button_Y = 32768
|
||||
Controls_XInput_Button_Plus = 32
|
||||
Controls_XInput_Button_Minus = 16
|
||||
Controls_XInput_DPad_Up = 1
|
||||
Controls_XInput_DPad_Down = 2
|
||||
Controls_XInput_DPad_Left = 4
|
||||
Controls_XInput_DPad_Right = 8
|
||||
Controls_XInput_Button_L = 64
|
||||
Controls_XInput_Button_ZL = 256
|
||||
Controls_XInput_Button_R = 128
|
||||
Controls_XInput_Button_ZR = 512
|
||||
|
||||
#https://github.com/opentk/opentk/blob/develop/src/OpenTK/Input/Key.cs
|
||||
Controls_Left_FakeJoycon_Stick_Up = 105
|
||||
Controls_Left_FakeJoycon_Stick_Down = 101
|
||||
|
|
|
@ -94,26 +94,26 @@ namespace Ryujinx
|
|||
State CurrentState = InputController.GetState();
|
||||
|
||||
//Buttons
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag(GamepadButtonFlags.A)) CurrentButton |= HidControllerButtons.KEY_A;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag(GamepadButtonFlags.B)) CurrentButton |= HidControllerButtons.KEY_B;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag(GamepadButtonFlags.X)) CurrentButton |= HidControllerButtons.KEY_X;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag(GamepadButtonFlags.Y)) CurrentButton |= HidControllerButtons.KEY_Y;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag((GamepadButtonFlags)Config.XInput.ButtonA)) CurrentButton |= HidControllerButtons.KEY_A;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag((GamepadButtonFlags)Config.XInput.ButtonB)) CurrentButton |= HidControllerButtons.KEY_B;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag((GamepadButtonFlags)Config.XInput.ButtonX)) CurrentButton |= HidControllerButtons.KEY_X;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag((GamepadButtonFlags)Config.XInput.ButtonY)) CurrentButton |= HidControllerButtons.KEY_Y;
|
||||
|
||||
//Plus/Minus
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag(GamepadButtonFlags.Back)) CurrentButton |= HidControllerButtons.KEY_MINUS;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag(GamepadButtonFlags.Start)) CurrentButton |= HidControllerButtons.KEY_PLUS;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag((GamepadButtonFlags)Config.XInput.ButtonPlus)) CurrentButton |= HidControllerButtons.KEY_PLUS;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag((GamepadButtonFlags)Config.XInput.ButtonMinus)) CurrentButton |= HidControllerButtons.KEY_MINUS;
|
||||
|
||||
//DPad
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag(GamepadButtonFlags.DPadUp)) CurrentButton |= HidControllerButtons.KEY_DUP;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag(GamepadButtonFlags.DPadDown)) CurrentButton |= HidControllerButtons.KEY_DDOWN;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag(GamepadButtonFlags.DPadLeft)) CurrentButton |= HidControllerButtons.KEY_DLEFT;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag(GamepadButtonFlags.DPadRight)) CurrentButton |= HidControllerButtons.KEY_DRIGHT;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag((GamepadButtonFlags)Config.XInput.DPadUp)) CurrentButton |= HidControllerButtons.KEY_DUP;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag((GamepadButtonFlags)Config.XInput.DPadDown)) CurrentButton |= HidControllerButtons.KEY_DDOWN;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag((GamepadButtonFlags)Config.XInput.DPadLeft)) CurrentButton |= HidControllerButtons.KEY_DLEFT;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag((GamepadButtonFlags)Config.XInput.DPadRight)) CurrentButton |= HidControllerButtons.KEY_DRIGHT;
|
||||
|
||||
//L/ZL/R/ZR
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag(GamepadButtonFlags.LeftThumb)) CurrentButton |= HidControllerButtons.KEY_L;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag(GamepadButtonFlags.LeftShoulder)) CurrentButton |= HidControllerButtons.KEY_ZL;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag(GamepadButtonFlags.RightThumb)) CurrentButton |= HidControllerButtons.KEY_R;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag(GamepadButtonFlags.RightShoulder)) CurrentButton |= HidControllerButtons.KEY_ZR;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag((GamepadButtonFlags)Config.XInput.ButtonL)) CurrentButton |= HidControllerButtons.KEY_L;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag((GamepadButtonFlags)Config.XInput.ButtonZL)) CurrentButton |= HidControllerButtons.KEY_ZL;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag((GamepadButtonFlags)Config.XInput.ButtonR)) CurrentButton |= HidControllerButtons.KEY_R;
|
||||
if (CurrentState.Gamepad.Buttons.HasFlag((GamepadButtonFlags)Config.XInput.ButtonZR)) CurrentButton |= HidControllerButtons.KEY_ZR;
|
||||
}
|
||||
|
||||
//LeftJoystick
|
||||
|
|
24
Ryujinx/XInputController.cs
Normal file
24
Ryujinx/XInputController.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Ryujinx
|
||||
{
|
||||
public struct XInputController
|
||||
{
|
||||
public int ButtonA;
|
||||
public int ButtonB;
|
||||
public int ButtonX;
|
||||
public int ButtonY;
|
||||
public int ButtonPlus;
|
||||
public int ButtonMinus;
|
||||
public int DPadUp;
|
||||
public int DPadDown;
|
||||
public int DPadLeft;
|
||||
public int DPadRight;
|
||||
public int ButtonL;
|
||||
public int ButtonZL;
|
||||
public int ButtonR;
|
||||
public int ButtonZR;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue