mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-08 00:43:04 +00:00
Added Button Configuration for all other Buttons
This commit is contained in:
parent
29d2d32372
commit
50ee597735
3 changed files with 73 additions and 20 deletions
|
@ -21,6 +21,19 @@ namespace Ryujinx
|
|||
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 void Read(Logger Log)
|
||||
{
|
||||
|
@ -42,10 +55,23 @@ namespace Ryujinx
|
|||
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_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");
|
||||
|
||||
string[] FilteredLogClasses = Parser.Value("Logging_Filtered_Classes").Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
|
|
|
@ -59,4 +59,17 @@ Controls_Right_FakeJoycon_Button_ZR = 97
|
|||
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_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
|
|
@ -101,7 +101,8 @@ namespace Ryujinx
|
|||
return result;
|
||||
}
|
||||
|
||||
private float getGamePadTriggerFromString(GamePadState gamePad, string str) {
|
||||
private float getGamePadTriggerFromString(GamePadState gamePad, string str)
|
||||
{
|
||||
float result = 0;
|
||||
|
||||
switch (str)
|
||||
|
@ -132,6 +133,7 @@ namespace Ryujinx
|
|||
int RightJoystickDY = 0;
|
||||
float deadzone = Config.GamePad_Deadzone;
|
||||
|
||||
//Keyboard Input
|
||||
if (Keyboard.HasValue)
|
||||
{
|
||||
KeyboardState Keyboard = this.Keyboard.Value;
|
||||
|
@ -171,33 +173,45 @@ namespace Ryujinx
|
|||
if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonZR]) CurrentButton |= HidControllerButtons.KEY_ZR;
|
||||
}
|
||||
|
||||
//Controller Input
|
||||
if (Config.GamePad_Enable)
|
||||
{
|
||||
GamePadState gamePad = GamePad.GetState(Config.GamePad_Index);
|
||||
|
||||
//RightButtons
|
||||
if (getGamePadButtonFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadButton_A)
|
||||
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)
|
||||
if (getGamePadButtonFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadButton_X)
|
||||
== ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_X;
|
||||
if (getGamePadButtonFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadButton_Y)
|
||||
if (getGamePadButtonFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadButton_Y)
|
||||
== ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_Y;
|
||||
if (gamePad.Buttons.RightStick == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_RSTICK;
|
||||
if (gamePad.Buttons.Start == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_PLUS;
|
||||
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 (gamePad.Buttons.RightShoulder == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_R;
|
||||
if (gamePad.Triggers.Right >= 0.5) CurrentButton |= HidControllerButtons.KEY_ZR;
|
||||
if (getGamePadTriggerFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadTrigger_ZR)
|
||||
>= 0.5) CurrentButton |= HidControllerButtons.KEY_ZR;
|
||||
|
||||
//LeftButtons
|
||||
if (gamePad.Buttons.LeftStick == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_LSTICK;
|
||||
if (gamePad.DPad.IsUp) CurrentButton |= HidControllerButtons.KEY_DUP;
|
||||
if (gamePad.DPad.IsDown) CurrentButton |= HidControllerButtons.KEY_DDOWN;
|
||||
if (gamePad.DPad.IsLeft) CurrentButton |= HidControllerButtons.KEY_DLEFT;
|
||||
if (gamePad.DPad.IsRight) CurrentButton |= HidControllerButtons.KEY_DRIGHT;
|
||||
if (gamePad.Buttons.Back == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_MINUS;
|
||||
if (gamePad.Buttons.LeftShoulder == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_L;
|
||||
if (gamePad.Triggers.Left >= 0.5) CurrentButton |= HidControllerButtons.KEY_ZL;
|
||||
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;
|
||||
|
||||
//RightJoystick
|
||||
if (gamePad.ThumbSticks.Right.X >= deadzone || gamePad.ThumbSticks.Right.X <= -deadzone)
|
||||
|
|
Loading…
Reference in a new issue