diff --git a/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs b/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs index 48636b99b..9037f7ef7 100644 --- a/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs +++ b/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs @@ -103,16 +103,16 @@ namespace Ryujinx.Input.SDL2 } } - public void SetLedColor() + public void SetLed(uint packedRgb) { + if (!Features.HasFlag(GamepadFeaturesFlag.Led)) return; if (!HasConfiguration) return; if (!_configuration.Led.EnableLed) return; - uint _rawColor = _configuration.Led.LedColor; - byte red = (byte)(_rawColor >> 16); - byte green = (byte)(_rawColor >> 8); - byte blue = (byte)(_rawColor % 256); - + byte red = (byte)(packedRgb >> 16); + byte green = (byte)(packedRgb >> 8); + byte blue = (byte)(packedRgb % 256); + SDL_GameControllerSetLED(_gamepadHandle, red, green, blue); } @@ -235,7 +235,7 @@ namespace Ryujinx.Input.SDL2 _configuration = (StandardControllerInputConfig)configuration; if (Features.HasFlag(GamepadFeaturesFlag.Led)) - SetLedColor(); + SetLed(_configuration.Led.LedColor); _buttonsUserMapping.Clear(); diff --git a/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs b/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs index 8d6a30d11..4a418230b 100644 --- a/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs +++ b/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs @@ -384,6 +384,8 @@ namespace Ryujinx.Input.SDL2 _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleLeftTrigger1, (Key)_configuration.RightJoycon.ButtonSl)); } } + + public void SetLed(uint packedRgb) {} public void SetTriggerThreshold(float triggerThreshold) { diff --git a/src/Ryujinx.Input.SDL2/SDL2Mouse.cs b/src/Ryujinx.Input.SDL2/SDL2Mouse.cs index 37b356b76..57997726f 100644 --- a/src/Ryujinx.Input.SDL2/SDL2Mouse.cs +++ b/src/Ryujinx.Input.SDL2/SDL2Mouse.cs @@ -75,6 +75,8 @@ namespace Ryujinx.Input.SDL2 { throw new NotImplementedException(); } + + public void SetLed(uint packedRgb) {} public void SetTriggerThreshold(float triggerThreshold) { diff --git a/src/Ryujinx.Input/IGamepad.cs b/src/Ryujinx.Input/IGamepad.cs index 3853f2819..6781c0faa 100644 --- a/src/Ryujinx.Input/IGamepad.cs +++ b/src/Ryujinx.Input/IGamepad.cs @@ -65,6 +65,13 @@ namespace Ryujinx.Input /// The configuration of the gamepad void SetConfiguration(InputConfig configuration); + /// + /// Set the LED on the gamepad to a given color. + /// + /// Does nothing on a controller without LED functionality. + /// The packed RGB integer. + void SetLed(uint packedRgb); + /// /// Starts a rumble effect on the gamepad. /// diff --git a/src/Ryujinx/Input/AvaloniaKeyboard.cs b/src/Ryujinx/Input/AvaloniaKeyboard.cs index 0b63af2d9..0b79c76ce 100644 --- a/src/Ryujinx/Input/AvaloniaKeyboard.cs +++ b/src/Ryujinx/Input/AvaloniaKeyboard.cs @@ -142,6 +142,8 @@ namespace Ryujinx.Ava.Input #pragma warning restore IDE0055 } } + + public void SetLed(uint packedRgb) { } public void SetTriggerThreshold(float triggerThreshold) { } diff --git a/src/Ryujinx/Input/AvaloniaMouse.cs b/src/Ryujinx/Input/AvaloniaMouse.cs index 1aa2d586a..6cc7d14bb 100644 --- a/src/Ryujinx/Input/AvaloniaMouse.cs +++ b/src/Ryujinx/Input/AvaloniaMouse.cs @@ -73,6 +73,8 @@ namespace Ryujinx.Ava.Input { throw new NotImplementedException(); } + + public void SetLed(uint packedRgb) { } public void SetTriggerThreshold(float triggerThreshold) {