mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-08 20:02:39 +00:00
parent
c4c414dd65
commit
bdeebf59d8
|
@ -186,7 +186,29 @@ namespace Ryujinx
|
||||||
case "-JOYSTICKAXIS1": return -GamePad.ThumbSticks.Left.Y;
|
case "-JOYSTICKAXIS1": return -GamePad.ThumbSticks.Left.Y;
|
||||||
case "-JOYSTICKAXIS2": return -GamePad.ThumbSticks.Right.X;
|
case "-JOYSTICKAXIS2": return -GamePad.ThumbSticks.Right.X;
|
||||||
case "-JOYSTICKAXIS3": return -GamePad.ThumbSticks.Right.Y;
|
case "-JOYSTICKAXIS3": return -GamePad.ThumbSticks.Right.Y;
|
||||||
default: throw new ArgumentException(nameof(Joystick));
|
default: throw new ArgumentException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsGamePadActive(int Index)
|
||||||
|
{
|
||||||
|
return IsGamePadActive(GamePad.GetState(Index));
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsGamePadActive(GamePadState GamePad)
|
||||||
|
{
|
||||||
|
if (GamePad.IsConnected)
|
||||||
|
{
|
||||||
|
return GamePad.Buttons.IsAnyButtonPressed
|
||||||
|
|| (GamePad.Triggers.Left >= 0.8f || GamePad.Triggers.Right >= 0.8f)
|
||||||
|
|| ((GamePad.ThumbSticks.Left.X >= 0.1f || GamePad.ThumbSticks.Left.X <= -0.1f)
|
||||||
|
|| (GamePad.ThumbSticks.Left.Y >= 0.1f || GamePad.ThumbSticks.Left.Y <= -0.1f)
|
||||||
|
|| (GamePad.ThumbSticks.Right.X >= 0.1f || GamePad.ThumbSticks.Right.X <= -0.1f)
|
||||||
|
|| (GamePad.ThumbSticks.Right.Y >= 0.1f || GamePad.ThumbSticks.Right.Y <= -0.1f));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +224,7 @@ namespace Ryujinx
|
||||||
int RightJoystickDY = 0;
|
int RightJoystickDY = 0;
|
||||||
|
|
||||||
//Keyboard Input
|
//Keyboard Input
|
||||||
if (Keyboard.HasValue)
|
if (Keyboard.HasValue && !IsGamePadActive(Config.GamePadIndex))
|
||||||
{
|
{
|
||||||
KeyboardState Keyboard = this.Keyboard.Value;
|
KeyboardState Keyboard = this.Keyboard.Value;
|
||||||
|
|
||||||
|
@ -242,7 +264,7 @@ namespace Ryujinx
|
||||||
}
|
}
|
||||||
|
|
||||||
//Controller Input
|
//Controller Input
|
||||||
if (Config.GamePadEnable)
|
if (Config.GamePadEnable && !Keyboard.HasValue && IsGamePadActive(Config.GamePadIndex))
|
||||||
{
|
{
|
||||||
GamePadState GamePad = OpenTK.Input.GamePad.GetState(Config.GamePadIndex);
|
GamePadState GamePad = OpenTK.Input.GamePad.GetState(Config.GamePadIndex);
|
||||||
float AnalogStickDeadzone = Config.GamePadDeadzone;
|
float AnalogStickDeadzone = Config.GamePadDeadzone;
|
||||||
|
|
Loading…
Reference in a new issue