mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-15 12:36:28 +02:00
parent
634cfae98e
commit
50211d5f2d
622 changed files with 3080 additions and 2652 deletions
|
@ -86,7 +86,7 @@ namespace Ryujinx.Input.SDL2
|
|||
Id = driverId;
|
||||
Features = GetFeaturesFlag();
|
||||
_triggerThreshold = 0.0f;
|
||||
|
||||
|
||||
// Enable motion tracking
|
||||
if (Features.HasFlag(GamepadFeaturesFlag.Motion))
|
||||
{
|
||||
|
@ -104,12 +104,13 @@ namespace Ryujinx.Input.SDL2
|
|||
|
||||
public void SetLed(uint packedRgb)
|
||||
{
|
||||
if (!Features.HasFlag(GamepadFeaturesFlag.Led)) return;
|
||||
if (!Features.HasFlag(GamepadFeaturesFlag.Led))
|
||||
return;
|
||||
|
||||
byte red = packedRgb > 0 ? (byte)(packedRgb >> 16) : (byte)0;
|
||||
byte green = packedRgb > 0 ? (byte)(packedRgb >> 8) : (byte)0;
|
||||
byte blue = packedRgb > 0 ? (byte)(packedRgb % 256) : (byte)0;
|
||||
|
||||
|
||||
if (SDL_GameControllerSetLED(_gamepadHandle, red, green, blue) != 0)
|
||||
Logger.Debug?.Print(LogClass.Hid, "LED setting failed; probably in the middle of disconnecting.");
|
||||
}
|
||||
|
@ -155,6 +156,7 @@ namespace Ryujinx.Input.SDL2
|
|||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public void SetTriggerThreshold(float triggerThreshold)
|
||||
|
@ -223,7 +225,7 @@ namespace Ryujinx.Input.SDL2
|
|||
private static Vector3 RadToDegree(Vector3 rad) => rad * (180 / MathF.PI);
|
||||
|
||||
private static Vector3 GsToMs2(Vector3 gs) => gs / SDL_STANDARD_GRAVITY;
|
||||
|
||||
|
||||
public void SetConfiguration(InputConfig configuration)
|
||||
{
|
||||
lock (_userMappingLock)
|
||||
|
@ -236,11 +238,11 @@ namespace Ryujinx.Input.SDL2
|
|||
(this as IGamepad).ClearLed();
|
||||
else if (_configuration.Led.UseRainbow)
|
||||
SetLed((uint)Rainbow.Color.ToArgb());
|
||||
|
||||
|
||||
if (!_configuration.Led.TurnOffLed && !_configuration.Led.UseRainbow)
|
||||
SetLed(_configuration.Led.LedColor);
|
||||
}
|
||||
|
||||
|
||||
_buttonsUserMapping.Clear();
|
||||
|
||||
// First update sticks
|
||||
|
@ -290,7 +292,6 @@ namespace Ryujinx.Input.SDL2
|
|||
if (_buttonsUserMapping.Count == 0)
|
||||
return rawState;
|
||||
|
||||
|
||||
// ReSharper disable once ForeachCanBePartlyConvertedToQueryUsingAnotherGetEnumerator
|
||||
foreach (ButtonMappingEntry entry in _buttonsUserMapping)
|
||||
{
|
||||
|
@ -336,6 +337,7 @@ namespace Ryujinx.Input.SDL2
|
|||
else
|
||||
return _configuration.RightJoyconStick;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue