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
6 changed files with 22 additions and 7 deletions
Showing only changes of commit cfe42563f2 - Show all commits

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

View File

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

View File

@ -142,6 +142,8 @@ namespace Ryujinx.Ava.Input
#pragma warning restore IDE0055
}
}
public void SetLed(uint packedRgb) { }
public void SetTriggerThreshold(float triggerThreshold) { }

View File

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