Compare commits
22 Commits
master
...
892c9cd14c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
892c9cd14c | ||
|
|
72d5af8b46 | ||
|
|
cfe42563f2 | ||
|
|
5712e83a11 | ||
|
|
8e642f0fe9 | ||
|
|
5276991517 | ||
|
|
898153ae13 | ||
|
|
96e9e3611d | ||
|
|
9aa834c268 | ||
|
|
97dfeae99f | ||
|
|
740e35872d | ||
|
|
2c4236f733 | ||
|
|
e945565259 | ||
|
|
bdaaddb591 | ||
|
|
488b09f974 | ||
|
|
f4c3a2e487 | ||
|
|
eff11f52a8 | ||
|
|
c21aa86a7b | ||
|
|
861531f431 | ||
|
|
6c0526c59f | ||
|
|
e861204078 | ||
|
|
8904397685 |
@@ -1,6 +1,7 @@
|
|||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
using Ryujinx.Common.Configuration.Hid.Controller;
|
using Ryujinx.Common.Configuration.Hid.Controller;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
|
using Ryujinx.HLE.HOS.Services.Hid;
|
||||||
using SDL2;
|
using SDL2;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -86,7 +87,7 @@ namespace Ryujinx.Input.SDL2
|
|||||||
Id = driverId;
|
Id = driverId;
|
||||||
Features = GetFeaturesFlag();
|
Features = GetFeaturesFlag();
|
||||||
_triggerThreshold = 0.0f;
|
_triggerThreshold = 0.0f;
|
||||||
|
|
||||||
// Enable motion tracking
|
// Enable motion tracking
|
||||||
if (Features.HasFlag(GamepadFeaturesFlag.Motion))
|
if (Features.HasFlag(GamepadFeaturesFlag.Motion))
|
||||||
{
|
{
|
||||||
@@ -102,6 +103,17 @@ namespace Ryujinx.Input.SDL2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetLed(uint packedRgb)
|
||||||
|
{
|
||||||
|
if (!Features.HasFlag(GamepadFeaturesFlag.Led)) return;
|
||||||
|
|
||||||
|
byte red = (byte)(packedRgb >> 16);
|
||||||
|
byte green = (byte)(packedRgb >> 8);
|
||||||
|
byte blue = (byte)(packedRgb % 256);
|
||||||
|
|
||||||
|
SDL_GameControllerSetLED(_gamepadHandle, red, green, blue);
|
||||||
|
}
|
||||||
|
|
||||||
private GamepadFeaturesFlag GetFeaturesFlag()
|
private GamepadFeaturesFlag GetFeaturesFlag()
|
||||||
{
|
{
|
||||||
GamepadFeaturesFlag result = GamepadFeaturesFlag.None;
|
GamepadFeaturesFlag result = GamepadFeaturesFlag.None;
|
||||||
@@ -220,6 +232,9 @@ namespace Ryujinx.Input.SDL2
|
|||||||
{
|
{
|
||||||
_configuration = (StandardControllerInputConfig)configuration;
|
_configuration = (StandardControllerInputConfig)configuration;
|
||||||
|
|
||||||
|
if (Features.HasFlag(GamepadFeaturesFlag.Led) && _configuration.Led.EnableLed)
|
||||||
|
SetLed(_configuration.Led.LedColor);
|
||||||
|
|
||||||
_buttonsUserMapping.Clear();
|
_buttonsUserMapping.Clear();
|
||||||
|
|
||||||
// First update sticks
|
// First update sticks
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
using Ryujinx.Common.Configuration.Hid.Keyboard;
|
using Ryujinx.Common.Configuration.Hid.Keyboard;
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
@@ -385,6 +386,11 @@ namespace Ryujinx.Input.SDL2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetLed(uint packedRgb)
|
||||||
|
{
|
||||||
|
Logger.Info?.Print(LogClass.UI, "SetLed called on an SDL2Keyboard");
|
||||||
|
}
|
||||||
|
|
||||||
public void SetTriggerThreshold(float triggerThreshold)
|
public void SetTriggerThreshold(float triggerThreshold)
|
||||||
{
|
{
|
||||||
// No operations
|
// No operations
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
@@ -76,6 +77,11 @@ namespace Ryujinx.Input.SDL2
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetLed(uint packedRgb)
|
||||||
|
{
|
||||||
|
Logger.Info?.Print(LogClass.UI, "SetLed called on an SDL2Mouse");
|
||||||
|
}
|
||||||
|
|
||||||
public void SetTriggerThreshold(float triggerThreshold)
|
public void SetTriggerThreshold(float triggerThreshold)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@@ -65,6 +65,13 @@ namespace Ryujinx.Input
|
|||||||
/// <param name="configuration">The configuration of the gamepad</param>
|
/// <param name="configuration">The configuration of the gamepad</param>
|
||||||
void SetConfiguration(InputConfig configuration);
|
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>
|
/// <summary>
|
||||||
/// Starts a rumble effect on the gamepad.
|
/// Starts a rumble effect on the gamepad.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
using Ryujinx.Common.Configuration.Hid.Keyboard;
|
using Ryujinx.Common.Configuration.Hid.Keyboard;
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -143,6 +144,11 @@ namespace Ryujinx.Ava.Input
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetLed(uint packedRgb)
|
||||||
|
{
|
||||||
|
Logger.Info?.Print(LogClass.UI, "SetLed called on an AvaloniaKeyboard");
|
||||||
|
}
|
||||||
|
|
||||||
public void SetTriggerThreshold(float triggerThreshold) { }
|
public void SetTriggerThreshold(float triggerThreshold) { }
|
||||||
|
|
||||||
public void Rumble(float lowFrequency, float highFrequency, uint durationMs) { }
|
public void Rumble(float lowFrequency, float highFrequency, uint durationMs) { }
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
@@ -74,6 +75,11 @@ namespace Ryujinx.Ava.Input
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetLed(uint packedRgb)
|
||||||
|
{
|
||||||
|
Logger.Info?.Print(LogClass.UI, "SetLed called on an AvaloniaMouse");
|
||||||
|
}
|
||||||
|
|
||||||
public void SetTriggerThreshold(float triggerThreshold)
|
public void SetTriggerThreshold(float triggerThreshold)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Avalonia.Svg.Skia;
|
using Avalonia.Svg.Skia;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using FluentAvalonia.UI.Controls;
|
||||||
using Ryujinx.Ava.UI.Models.Input;
|
using Ryujinx.Ava.UI.Models.Input;
|
||||||
using Ryujinx.Ava.UI.Views.Input;
|
using Ryujinx.Ava.UI.Views.Input;
|
||||||
|
|
||||||
|
|||||||
@@ -69,8 +69,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
public bool IsRight { get; set; }
|
public bool IsRight { get; set; }
|
||||||
public bool IsLeft { get; set; }
|
public bool IsLeft { get; set; }
|
||||||
|
|
||||||
public bool HasLed => false; //temporary
|
public bool HasLed => SelectedGamepad.Features.HasFlag(GamepadFeaturesFlag.Led);
|
||||||
//SelectedGamepad.Features.HasFlag(GamepadFeaturesFlag.Led);
|
|
||||||
|
|
||||||
public bool IsModified { get; set; }
|
public bool IsModified { get; set; }
|
||||||
public event Action NotifyChangesEvent;
|
public event Action NotifyChangesEvent;
|
||||||
|
|||||||
@@ -429,7 +429,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
<!-- Motion + Rumble -->
|
<!-- Motion, Rumble, LED -->
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Margin="0,10,0,0"
|
Margin="0,10,0,0"
|
||||||
Spacing="5"
|
Spacing="5"
|
||||||
@@ -514,6 +514,8 @@
|
|||||||
UseColorWheel="False"
|
UseColorWheel="False"
|
||||||
ShowAcceptDismissButtons="False"
|
ShowAcceptDismissButtons="False"
|
||||||
IsAlphaEnabled="False"
|
IsAlphaEnabled="False"
|
||||||
|
AttachedToVisualTree="ColorPickerButton_OnAttachedToVisualTree"
|
||||||
|
ColorChanged="ColorPickerButton_OnColorChanged"
|
||||||
Color="{Binding Config.LedColor, Mode=TwoWay}">
|
Color="{Binding Config.LedColor, Mode=TwoWay}">
|
||||||
</ui:ColorPickerButton>
|
</ui:ColorPickerButton>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Avalonia.Controls.Primitives;
|
|||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.LogicalTree;
|
using Avalonia.LogicalTree;
|
||||||
|
using FluentAvalonia.UI.Controls;
|
||||||
using Ryujinx.Ava.UI.Helpers;
|
using Ryujinx.Ava.UI.Helpers;
|
||||||
using Ryujinx.Ava.UI.ViewModels.Input;
|
using Ryujinx.Ava.UI.ViewModels.Input;
|
||||||
using Ryujinx.Common.Configuration.Hid.Controller;
|
using Ryujinx.Common.Configuration.Hid.Controller;
|
||||||
@@ -234,5 +235,22 @@ namespace Ryujinx.Ava.UI.Views.Input
|
|||||||
_currentAssigner?.Cancel();
|
_currentAssigner?.Cancel();
|
||||||
_currentAssigner = null;
|
_currentAssigner = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ColorPickerButton_OnColorChanged(ColorPickerButton sender, ColorButtonColorChangedEventArgs args)
|
||||||
|
{
|
||||||
|
if (!args.NewColor.HasValue) return;
|
||||||
|
if (DataContext is not ControllerInputViewModel cVm) return;
|
||||||
|
if (!cVm.Config.EnableLedChanging) return;
|
||||||
|
|
||||||
|
cVm.ParentModel.SelectedGamepad.SetLed(args.NewColor.Value.ToUInt32());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ColorPickerButton_OnAttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e)
|
||||||
|
{
|
||||||
|
if (DataContext is not ControllerInputViewModel cVm) return;
|
||||||
|
if (!cVm.Config.EnableLedChanging) return;
|
||||||
|
|
||||||
|
cVm.ParentModel.SelectedGamepad.SetLed(cVm.Config.LedColor.ToUInt32());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user