Add the LED functionality to the base IGamepad interface

This commit is contained in:
Evan Husted
2025-01-23 18:33:52 -06:00
parent 5712e83a11
commit cfe42563f2
6 changed files with 22 additions and 7 deletions

View File

@@ -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();

View File

@@ -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)
{

View File

@@ -75,6 +75,8 @@ namespace Ryujinx.Input.SDL2
{
throw new NotImplementedException();
}
public void SetLed(uint packedRgb) {}
public void SetTriggerThreshold(float triggerThreshold)
{