From 8a363b5df2387bd254a3dd48bfd3c9884ff74dab Mon Sep 17 00:00:00 2001 From: Mary Date: Thu, 6 Jul 2023 18:08:14 +0200 Subject: [PATCH] Revert "sdl: set `SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS` to 0 (#5433)" (#5439) This reverts commit 2b5abac809dacb351ec69e322732d45ea01a4d65. --- .../UI/ViewModels/ControllerInputViewModel.cs | 10 ++++++---- src/Ryujinx.Headless.SDL2/Program.cs | 10 ++++++---- src/Ryujinx.SDL2.Common/SDL2Driver.cs | 1 - src/Ryujinx/Ui/Windows/ControllerWindow.cs | 10 ++++++---- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/Ryujinx.Ava/UI/ViewModels/ControllerInputViewModel.cs b/src/Ryujinx.Ava/UI/ViewModels/ControllerInputViewModel.cs index 8b5dbcef0a..fda58504ea 100644 --- a/src/Ryujinx.Ava/UI/ViewModels/ControllerInputViewModel.cs +++ b/src/Ryujinx.Ava/UI/ViewModels/ControllerInputViewModel.cs @@ -597,6 +597,8 @@ namespace Ryujinx.Ava.UI.ViewModels } else if (activeDevice.Type == DeviceType.Controller) { + bool isNintendoStyle = Devices.ToList().Find(x => x.Id == activeDevice.Id).Name.Contains("Nintendo"); + string id = activeDevice.Id.Split(" ")[0]; config = new StandardControllerInputConfig @@ -631,10 +633,10 @@ namespace Ryujinx.Ava.UI.ViewModels }, RightJoycon = new RightJoyconCommonConfig { - ButtonA = ConfigGamepadInputId.B, - ButtonB = ConfigGamepadInputId.A, - ButtonX = ConfigGamepadInputId.Y, - ButtonY = ConfigGamepadInputId.X, + ButtonA = isNintendoStyle ? ConfigGamepadInputId.A : ConfigGamepadInputId.B, + ButtonB = isNintendoStyle ? ConfigGamepadInputId.B : ConfigGamepadInputId.A, + ButtonX = isNintendoStyle ? ConfigGamepadInputId.X : ConfigGamepadInputId.Y, + ButtonY = isNintendoStyle ? ConfigGamepadInputId.Y : ConfigGamepadInputId.X, ButtonPlus = ConfigGamepadInputId.Plus, ButtonR = ConfigGamepadInputId.RightShoulder, ButtonZr = ConfigGamepadInputId.RightTrigger, diff --git a/src/Ryujinx.Headless.SDL2/Program.cs b/src/Ryujinx.Headless.SDL2/Program.cs index ffcac9ed5c..98cc5abf4a 100644 --- a/src/Ryujinx.Headless.SDL2/Program.cs +++ b/src/Ryujinx.Headless.SDL2/Program.cs @@ -195,6 +195,8 @@ namespace Ryujinx.Headless.SDL2 } else { + bool isNintendoStyle = gamepadName.Contains("Nintendo"); + config = new StandardControllerInputConfig { Version = InputConfig.CurrentVersion, @@ -230,10 +232,10 @@ namespace Ryujinx.Headless.SDL2 RightJoycon = new RightJoyconCommonConfig { - ButtonA = ConfigGamepadInputId.B, - ButtonB = ConfigGamepadInputId.A, - ButtonX = ConfigGamepadInputId.Y, - ButtonY = ConfigGamepadInputId.X, + ButtonA = isNintendoStyle ? ConfigGamepadInputId.A : ConfigGamepadInputId.B, + ButtonB = isNintendoStyle ? ConfigGamepadInputId.B : ConfigGamepadInputId.A, + ButtonX = isNintendoStyle ? ConfigGamepadInputId.X : ConfigGamepadInputId.Y, + ButtonY = isNintendoStyle ? ConfigGamepadInputId.Y : ConfigGamepadInputId.X, ButtonPlus = ConfigGamepadInputId.Plus, ButtonR = ConfigGamepadInputId.RightShoulder, ButtonZr = ConfigGamepadInputId.RightTrigger, diff --git a/src/Ryujinx.SDL2.Common/SDL2Driver.cs b/src/Ryujinx.SDL2.Common/SDL2Driver.cs index 3411fa041a..2642b26fab 100644 --- a/src/Ryujinx.SDL2.Common/SDL2Driver.cs +++ b/src/Ryujinx.SDL2.Common/SDL2Driver.cs @@ -60,7 +60,6 @@ namespace Ryujinx.SDL2.Common SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED, "0"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1"); - SDL_SetHint(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, "0"); SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1"); diff --git a/src/Ryujinx/Ui/Windows/ControllerWindow.cs b/src/Ryujinx/Ui/Windows/ControllerWindow.cs index 2993e1f231..ebf22ab607 100644 --- a/src/Ryujinx/Ui/Windows/ControllerWindow.cs +++ b/src/Ryujinx/Ui/Windows/ControllerWindow.cs @@ -1035,6 +1035,8 @@ namespace Ryujinx.Ui.Windows } else if (_inputDevice.ActiveId.StartsWith("controller")) { + bool isNintendoStyle = _inputDevice.ActiveText.Contains("Nintendo"); + config = new StandardControllerInputConfig { Version = InputConfig.CurrentVersion, @@ -1070,10 +1072,10 @@ namespace Ryujinx.Ui.Windows RightJoycon = new RightJoyconCommonConfig { - ButtonA = ConfigGamepadInputId.B, - ButtonB = ConfigGamepadInputId.A, - ButtonX = ConfigGamepadInputId.Y, - ButtonY = ConfigGamepadInputId.X, + ButtonA = isNintendoStyle ? ConfigGamepadInputId.A : ConfigGamepadInputId.B, + ButtonB = isNintendoStyle ? ConfigGamepadInputId.B : ConfigGamepadInputId.A, + ButtonX = isNintendoStyle ? ConfigGamepadInputId.X : ConfigGamepadInputId.Y, + ButtonY = isNintendoStyle ? ConfigGamepadInputId.Y : ConfigGamepadInputId.X, ButtonPlus = ConfigGamepadInputId.Plus, ButtonR = ConfigGamepadInputId.RightShoulder, ButtonZr = ConfigGamepadInputId.RightTrigger,