Add the LED functionality to the base IGamepad interface
This commit is contained in:
parent
5712e83a11
commit
cfe42563f2
@ -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();
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -75,6 +75,8 @@ namespace Ryujinx.Input.SDL2
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetLed(uint packedRgb) {}
|
||||
|
||||
public void SetTriggerThreshold(float triggerThreshold)
|
||||
{
|
||||
|
@ -65,6 +65,13 @@ namespace Ryujinx.Input
|
||||
/// <param name="configuration">The configuration of the gamepad</param>
|
||||
void SetConfiguration(InputConfig configuration);
|
||||
|
||||
/// <summary>
|
||||
/// Set the LED on the gamepad to a given color.
|
||||
/// </summary>
|
||||
/// <remarks>Does nothing on a controller without LED functionality.</remarks>
|
||||
/// <param name="packedRgb">The packed RGB integer.</param>
|
||||
void SetLed(uint packedRgb);
|
||||
|
||||
/// <summary>
|
||||
/// Starts a rumble effect on the gamepad.
|
||||
/// </summary>
|
||||
|
@ -142,6 +142,8 @@ namespace Ryujinx.Ava.Input
|
||||
#pragma warning restore IDE0055
|
||||
}
|
||||
}
|
||||
|
||||
public void SetLed(uint packedRgb) { }
|
||||
|
||||
public void SetTriggerThreshold(float triggerThreshold) { }
|
||||
|
||||
|
@ -73,6 +73,8 @@ namespace Ryujinx.Ava.Input
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetLed(uint packedRgb) { }
|
||||
|
||||
public void SetTriggerThreshold(float triggerThreshold)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user