mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-11-20 08:01:04 +00:00
fix: detect face button layout for gamepads (ryubing/ryujinx!219)
See merge request ryubing/ryujinx!219
This commit is contained in:
parent
c5082ac85a
commit
10476771d3
@ -22,7 +22,7 @@ namespace Ryujinx.Input.SDL3
|
|||||||
|
|
||||||
private StandardControllerInputConfig _configuration;
|
private StandardControllerInputConfig _configuration;
|
||||||
|
|
||||||
private static readonly SDL_GamepadButton[] _buttonsDriverMapping =
|
private readonly SDL_GamepadButton[] _buttonsDriverMapping =
|
||||||
[
|
[
|
||||||
// Unbound, ignored.
|
// Unbound, ignored.
|
||||||
SDL_GamepadButton.SDL_GAMEPAD_BUTTON_INVALID,
|
SDL_GamepadButton.SDL_GAMEPAD_BUTTON_INVALID,
|
||||||
@ -88,6 +88,20 @@ namespace Ryujinx.Input.SDL3
|
|||||||
Features = GetFeaturesFlag();
|
Features = GetFeaturesFlag();
|
||||||
_triggerThreshold = 0.0f;
|
_triggerThreshold = 0.0f;
|
||||||
|
|
||||||
|
// Face button mapping
|
||||||
|
SDL_GamepadButton[] faceButtons = _buttonsDriverMapping[1..5];
|
||||||
|
foreach (SDL_GamepadButton btn in faceButtons) {
|
||||||
|
int mapId = SDL_GetGamepadButtonLabel(_gamepadHandle, btn) switch {
|
||||||
|
SDL_GamepadButtonLabel.SDL_GAMEPAD_BUTTON_LABEL_A or SDL_GamepadButtonLabel.SDL_GAMEPAD_BUTTON_LABEL_CROSS => 1,
|
||||||
|
SDL_GamepadButtonLabel.SDL_GAMEPAD_BUTTON_LABEL_B or SDL_GamepadButtonLabel.SDL_GAMEPAD_BUTTON_LABEL_CIRCLE => 2,
|
||||||
|
SDL_GamepadButtonLabel.SDL_GAMEPAD_BUTTON_LABEL_X or SDL_GamepadButtonLabel.SDL_GAMEPAD_BUTTON_LABEL_SQUARE => 3,
|
||||||
|
SDL_GamepadButtonLabel.SDL_GAMEPAD_BUTTON_LABEL_Y or SDL_GamepadButtonLabel.SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE => 4,
|
||||||
|
_ => -1
|
||||||
|
};
|
||||||
|
if (mapId == -1) { continue; }
|
||||||
|
_buttonsDriverMapping[mapId] = btn;
|
||||||
|
}
|
||||||
|
|
||||||
// Enable motion tracking
|
// Enable motion tracking
|
||||||
if ((Features & GamepadFeaturesFlag.Motion) != 0)
|
if ((Features & GamepadFeaturesFlag.Motion) != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user