Change controller LED color

This changes the controller LED color. Now I need to add the option to change it in the settings
This commit is contained in:
Otozinclus 2025-01-22 21:55:53 +01:00 committed by mika
parent c03cd50fa3
commit eff11f52a8

View File

@ -87,6 +87,11 @@ namespace Ryujinx.Input.SDL2
Features = GetFeaturesFlag();
_triggerThreshold = 0.0f;
//if (SDL_GameControllerHasLED(_gamepadHandle))
{
_setControllerLedColor("000000");
}
// Enable motion tracking
if (Features.HasFlag(GamepadFeaturesFlag.Motion))
{
@ -102,6 +107,16 @@ namespace Ryujinx.Input.SDL2
}
}
private void _setControllerLedColor(string hex)
{
ulong LEDcolor = Convert.ToUInt64(hex, 16);
byte red = (byte)((LEDcolor >> 16) % 256);
byte green = (byte)((LEDcolor >> 8) % 256);
byte blue = (byte)(LEDcolor % 256);
SDL_GameControllerSetLED(_gamepadHandle, red, green, blue);
}
private GamepadFeaturesFlag GetFeaturesFlag()
{
GamepadFeaturesFlag result = GamepadFeaturesFlag.None;