diff --git a/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs b/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs index ed22c3661..48636b99b 100644 --- a/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs +++ b/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs @@ -1,6 +1,7 @@ using Ryujinx.Common.Configuration.Hid; using Ryujinx.Common.Configuration.Hid.Controller; using Ryujinx.Common.Logging; +using Ryujinx.HLE.HOS.Services.Hid; using SDL2; using System; using System.Collections.Generic; @@ -86,7 +87,7 @@ namespace Ryujinx.Input.SDL2 Id = driverId; Features = GetFeaturesFlag(); _triggerThreshold = 0.0f; - + // Enable motion tracking if (Features.HasFlag(GamepadFeaturesFlag.Motion)) { @@ -102,6 +103,19 @@ namespace Ryujinx.Input.SDL2 } } + public void SetLedColor() + { + 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); + + SDL_GameControllerSetLED(_gamepadHandle, red, green, blue); + } + private GamepadFeaturesFlag GetFeaturesFlag() { GamepadFeaturesFlag result = GamepadFeaturesFlag.None; @@ -220,6 +234,9 @@ namespace Ryujinx.Input.SDL2 { _configuration = (StandardControllerInputConfig)configuration; + if (Features.HasFlag(GamepadFeaturesFlag.Led)) + SetLedColor(); + _buttonsUserMapping.Clear(); // First update sticks