Add option to change controller LED color #572

Merged
Otozinclus merged 33 commits from Change-Controller-LED-Color into master 2025-01-24 20:47:36 +00:00
Showing only changes of commit 8904397685 - Show all commits

View File

@ -86,6 +86,11 @@ namespace Ryujinx.Input.SDL2
Features = GetFeaturesFlag();
_triggerThreshold = 0.0f;
//if (SDL_GameControllerHasLED(_gamepadHandle))
{
_setControllerLedColor("000000");
}
// Enable motion tracking
if (Features.HasFlag(GamepadFeaturesFlag.Motion))
{
@ -101,6 +106,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;