Added Button Configuration for all other Buttons

This commit is contained in:
John Clemis 2018-06-27 18:31:10 -05:00
parent 29d2d32372
commit 50ee597735
3 changed files with 73 additions and 20 deletions

View file

@ -21,6 +21,19 @@ namespace Ryujinx
public static string Controls_Right_FakeJoycon_GamePadButton_B; public static string Controls_Right_FakeJoycon_GamePadButton_B;
public static string Controls_Right_FakeJoycon_GamePadButton_X; public static string Controls_Right_FakeJoycon_GamePadButton_X;
public static string Controls_Right_FakeJoycon_GamePadButton_Y; 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) public static void Read(Logger Log)
{ {
@ -46,6 +59,19 @@ namespace Ryujinx
Controls_Right_FakeJoycon_GamePadButton_B = Parser.Value("Controls_Right_FakeJoycon_GamePadButton_B"); 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_X = Parser.Value("Controls_Right_FakeJoycon_GamePadButton_X");
Controls_Right_FakeJoycon_GamePadButton_Y = Parser.Value("Controls_Right_FakeJoycon_GamePadButton_Y"); 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); string[] FilteredLogClasses = Parser.Value("Logging_Filtered_Classes").Split(',', StringSplitOptions.RemoveEmptyEntries);

View file

@ -60,3 +60,16 @@ Controls_Right_FakeJoycon_GamePadButton_A = B
Controls_Right_FakeJoycon_GamePadButton_B = A Controls_Right_FakeJoycon_GamePadButton_B = A
Controls_Right_FakeJoycon_GamePadButton_X = Y 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

View file

@ -101,7 +101,8 @@ namespace Ryujinx
return result; return result;
} }
private float getGamePadTriggerFromString(GamePadState gamePad, string str) { private float getGamePadTriggerFromString(GamePadState gamePad, string str)
{
float result = 0; float result = 0;
switch (str) switch (str)
@ -132,6 +133,7 @@ namespace Ryujinx
int RightJoystickDY = 0; int RightJoystickDY = 0;
float deadzone = Config.GamePad_Deadzone; float deadzone = Config.GamePad_Deadzone;
//Keyboard Input
if (Keyboard.HasValue) if (Keyboard.HasValue)
{ {
KeyboardState Keyboard = this.Keyboard.Value; KeyboardState Keyboard = this.Keyboard.Value;
@ -171,6 +173,7 @@ namespace Ryujinx
if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonZR]) CurrentButton |= HidControllerButtons.KEY_ZR; if (Keyboard[(Key)Config.FakeJoyCon.Right.ButtonZR]) CurrentButton |= HidControllerButtons.KEY_ZR;
} }
//Controller Input
if (Config.GamePad_Enable) if (Config.GamePad_Enable)
{ {
GamePadState gamePad = GamePad.GetState(Config.GamePad_Index); GamePadState gamePad = GamePad.GetState(Config.GamePad_Index);
@ -184,20 +187,31 @@ namespace Ryujinx
== ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_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; == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_Y;
if (gamePad.Buttons.RightStick == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_RSTICK; if (getGamePadButtonFromString(gamePad, Config.Controls_Right_FakeJoycon_GamePadStick_Button)
if (gamePad.Buttons.Start == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_PLUS; == 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.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 //LeftButtons
if (gamePad.Buttons.LeftStick == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_LSTICK; if (getGamePadButtonFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadDPad_Up)
if (gamePad.DPad.IsUp) CurrentButton |= HidControllerButtons.KEY_DUP; == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_DUP;
if (gamePad.DPad.IsDown) CurrentButton |= HidControllerButtons.KEY_DDOWN; if (getGamePadButtonFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadDPad_Down)
if (gamePad.DPad.IsLeft) CurrentButton |= HidControllerButtons.KEY_DLEFT; == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_DDOWN;
if (gamePad.DPad.IsRight) CurrentButton |= HidControllerButtons.KEY_DRIGHT; if (getGamePadButtonFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadDPad_Left)
if (gamePad.Buttons.Back == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_MINUS; == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_DLEFT;
if (gamePad.Buttons.LeftShoulder == ButtonState.Pressed) CurrentButton |= HidControllerButtons.KEY_L; if (getGamePadButtonFromString(gamePad, Config.Controls_Left_FakeJoycon_GamePadDPad_Right)
if (gamePad.Triggers.Left >= 0.5) CurrentButton |= HidControllerButtons.KEY_ZL; == 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 //RightJoystick
if (gamePad.ThumbSticks.Right.X >= deadzone || gamePad.ThumbSticks.Right.X <= -deadzone) if (gamePad.ThumbSticks.Right.X >= deadzone || gamePad.ThumbSticks.Right.X <= -deadzone)