Compare commits
6 Commits
Canary-1.2
...
8bbf7c0253
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bbf7c0253 | ||
|
|
c21aa86a7b | ||
|
|
861531f431 | ||
|
|
6c0526c59f | ||
|
|
e861204078 | ||
|
|
8904397685 |
@@ -78,10 +78,5 @@ namespace Ryujinx.Common.Configuration.Hid.Controller
|
|||||||
/// Controller Rumble Settings
|
/// Controller Rumble Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public RumbleConfigController Rumble { get; set; }
|
public RumbleConfigController Rumble { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Controller LED Settings
|
|
||||||
/// </summary>
|
|
||||||
public LedConfigController Led { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
namespace Ryujinx.Common.Configuration.Hid.Controller
|
|
||||||
{
|
|
||||||
public class LedConfigController
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Packed RGB int of the color
|
|
||||||
/// </summary>
|
|
||||||
public uint LedColor { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enable LED color changing by the emulator
|
|
||||||
/// </summary>
|
|
||||||
public bool EnableLed { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
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 SDL2;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
@@ -87,6 +86,11 @@ namespace Ryujinx.Input.SDL2
|
|||||||
Features = GetFeaturesFlag();
|
Features = GetFeaturesFlag();
|
||||||
_triggerThreshold = 0.0f;
|
_triggerThreshold = 0.0f;
|
||||||
|
|
||||||
|
if (SDL_GameControllerHasLED(_gamepadHandle) == SDL_bool.SDL_TRUE)
|
||||||
|
{
|
||||||
|
SetLedColor("FFE3B5");
|
||||||
|
}
|
||||||
|
|
||||||
// Enable motion tracking
|
// Enable motion tracking
|
||||||
if (Features.HasFlag(GamepadFeaturesFlag.Motion))
|
if (Features.HasFlag(GamepadFeaturesFlag.Motion))
|
||||||
{
|
{
|
||||||
@@ -102,6 +106,16 @@ namespace Ryujinx.Input.SDL2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetLedColor(string hex)
|
||||||
|
{
|
||||||
|
ulong LEDcolor = Convert.ToUInt64(hex, 16);
|
||||||
|
byte red = (byte)((LEDcolor >> 16) % 256);
|
||||||
|
byte green = (byte)((LEDcolor >> 8) % 256);
|
||||||
|
byte blue = (byte)(LEDcolor % 256);
|
||||||
|
|
||||||
|
SDL_GameControllerSetLED(_gamepadHandle, red, green, blue);
|
||||||
|
}
|
||||||
|
|
||||||
private GamepadFeaturesFlag GetFeaturesFlag()
|
private GamepadFeaturesFlag GetFeaturesFlag()
|
||||||
{
|
{
|
||||||
GamepadFeaturesFlag result = GamepadFeaturesFlag.None;
|
GamepadFeaturesFlag result = GamepadFeaturesFlag.None;
|
||||||
@@ -119,11 +133,6 @@ namespace Ryujinx.Input.SDL2
|
|||||||
result |= GamepadFeaturesFlag.Rumble;
|
result |= GamepadFeaturesFlag.Rumble;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_GameControllerHasLED(_gamepadHandle) == SDL_bool.SDL_TRUE)
|
|
||||||
{
|
|
||||||
result |= GamepadFeaturesFlag.Led;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,10 +24,5 @@ namespace Ryujinx.Input
|
|||||||
/// <remarks>Also named sixaxis</remarks>
|
/// <remarks>Also named sixaxis</remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Motion,
|
Motion,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The LED on the back of modern PlayStation controllers (DualSense & DualShock 4).
|
|
||||||
/// </summary>
|
|
||||||
Led,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using Avalonia.Media;
|
|
||||||
using Ryujinx.Ava.UI.ViewModels;
|
using Ryujinx.Ava.UI.ViewModels;
|
||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
using Ryujinx.Common.Configuration.Hid.Controller;
|
using Ryujinx.Common.Configuration.Hid.Controller;
|
||||||
@@ -388,30 +387,6 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _enableLedChanging;
|
|
||||||
|
|
||||||
public bool EnableLedChanging
|
|
||||||
{
|
|
||||||
get => _enableLedChanging;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_enableLedChanging = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color _ledColor;
|
|
||||||
|
|
||||||
public Color LedColor
|
|
||||||
{
|
|
||||||
get => _ledColor;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_ledColor = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool _enableMotion;
|
private bool _enableMotion;
|
||||||
public bool EnableMotion
|
public bool EnableMotion
|
||||||
{
|
{
|
||||||
@@ -508,23 +483,12 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||||||
WeakRumble = controllerInput.Rumble.WeakRumble;
|
WeakRumble = controllerInput.Rumble.WeakRumble;
|
||||||
StrongRumble = controllerInput.Rumble.StrongRumble;
|
StrongRumble = controllerInput.Rumble.StrongRumble;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controllerInput.Led != null)
|
|
||||||
{
|
|
||||||
EnableLedChanging = controllerInput.Led.EnableLed;
|
|
||||||
uint rawColor = controllerInput.Led.LedColor;
|
|
||||||
byte alpha = (byte)(rawColor >> 24);
|
|
||||||
byte red = (byte)(rawColor >> 16);
|
|
||||||
byte green = (byte)(rawColor >> 8);
|
|
||||||
byte blue = (byte)(rawColor % 256);
|
|
||||||
LedColor = new Color(alpha, red, green, blue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputConfig GetConfig()
|
public InputConfig GetConfig()
|
||||||
{
|
{
|
||||||
StandardControllerInputConfig config = new()
|
var config = new StandardControllerInputConfig
|
||||||
{
|
{
|
||||||
Id = Id,
|
Id = Id,
|
||||||
Backend = InputBackendType.GamepadSDL2,
|
Backend = InputBackendType.GamepadSDL2,
|
||||||
@@ -576,11 +540,6 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||||||
WeakRumble = WeakRumble,
|
WeakRumble = WeakRumble,
|
||||||
StrongRumble = StrongRumble,
|
StrongRumble = StrongRumble,
|
||||||
},
|
},
|
||||||
Led = new LedConfigController
|
|
||||||
{
|
|
||||||
EnableLed = EnableLedChanging,
|
|
||||||
LedColor = LedColor.ToUInt32()
|
|
||||||
},
|
|
||||||
Version = InputConfig.CurrentVersion,
|
Version = InputConfig.CurrentVersion,
|
||||||
DeadzoneLeft = DeadzoneLeft,
|
DeadzoneLeft = DeadzoneLeft,
|
||||||
DeadzoneRight = DeadzoneRight,
|
DeadzoneRight = DeadzoneRight,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
|
|
||||||
[ObservableProperty] private SvgImage _image;
|
[ObservableProperty] private SvgImage _image;
|
||||||
|
|
||||||
public InputViewModel ParentModel { get; }
|
public readonly InputViewModel ParentModel;
|
||||||
|
|
||||||
public ControllerInputViewModel(InputViewModel model, GamepadInputConfig config)
|
public ControllerInputViewModel(InputViewModel model, GamepadInputConfig config)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,8 +68,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
public bool IsKeyboard => !IsController;
|
public bool IsKeyboard => !IsController;
|
||||||
public bool IsRight { get; set; }
|
public bool IsRight { get; set; }
|
||||||
public bool IsLeft { get; set; }
|
public bool IsLeft { get; set; }
|
||||||
|
|
||||||
public bool HasLed => SelectedGamepad.Features.HasFlag(GamepadFeaturesFlag.Led);
|
|
||||||
|
|
||||||
public bool IsModified { get; set; }
|
public bool IsModified { get; set; }
|
||||||
public event Action NotifyChangesEvent;
|
public event Action NotifyChangesEvent;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup"
|
xmlns:ext="clr-namespace:Ryujinx.Ava.Common.Markup"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
|
||||||
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
|
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
|
||||||
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels.Input"
|
xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels.Input"
|
||||||
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
||||||
@@ -487,37 +486,6 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
<Border
|
|
||||||
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
|
||||||
BorderThickness="1"
|
|
||||||
CornerRadius="5"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
Margin="0,-1,0,0">
|
|
||||||
<Grid IsVisible="{Binding ParentModel.HasLed}">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="Auto" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<CheckBox
|
|
||||||
Margin="10"
|
|
||||||
MinWidth="0"
|
|
||||||
Grid.Column="0"
|
|
||||||
IsChecked="{Binding Config.EnableLedChanging, Mode=TwoWay}">
|
|
||||||
<TextBlock Text="Custom LED color" />
|
|
||||||
</CheckBox>
|
|
||||||
<ui:ColorPickerButton
|
|
||||||
Grid.Column="1"
|
|
||||||
Margin="10"
|
|
||||||
IsMoreButtonVisible="False"
|
|
||||||
UseColorPalette="False"
|
|
||||||
UseColorTriangle="False"
|
|
||||||
UseColorWheel="False"
|
|
||||||
ShowAcceptDismissButtons="False"
|
|
||||||
IsAlphaEnabled="False"
|
|
||||||
Color="{Binding Config.LedColor, Mode=TwoWay}">
|
|
||||||
</ui:ColorPickerButton>
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<!-- Right Controls -->
|
<!-- Right Controls -->
|
||||||
|
|||||||
@@ -4,11 +4,14 @@ using Avalonia.Controls.Primitives;
|
|||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.LogicalTree;
|
using Avalonia.LogicalTree;
|
||||||
|
using DiscordRPC;
|
||||||
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;
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
using Ryujinx.Input.Assigner;
|
using Ryujinx.Input.Assigner;
|
||||||
|
using System;
|
||||||
using StickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId;
|
using StickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.Views.Input
|
namespace Ryujinx.Ava.UI.Views.Input
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current version of the file format
|
/// The current version of the file format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const int CurrentVersion = 61;
|
public const int CurrentVersion = 60;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version of the configuration file format
|
/// Version of the configuration file format
|
||||||
|
|||||||
@@ -263,12 +263,15 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
|||||||
}),
|
}),
|
||||||
(30, static cff =>
|
(30, static cff =>
|
||||||
{
|
{
|
||||||
foreach (StandardControllerInputConfig config in cff.InputConfig.OfType<StandardControllerInputConfig>())
|
foreach (InputConfig config in cff.InputConfig)
|
||||||
{
|
{
|
||||||
config.Rumble = new RumbleConfigController
|
if (config is StandardControllerInputConfig controllerConfig)
|
||||||
{
|
{
|
||||||
EnableRumble = false, StrongRumble = 1f, WeakRumble = 1f,
|
controllerConfig.Rumble = new RumbleConfigController
|
||||||
};
|
{
|
||||||
|
EnableRumble = false, StrongRumble = 1f, WeakRumble = 1f,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
(31, static cff => cff.BackendThreading = BackendThreading.Auto),
|
(31, static cff => cff.BackendThreading = BackendThreading.Auto),
|
||||||
@@ -413,18 +416,7 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
|||||||
// so as a compromise users who want to use it will simply need to re-enable it once after updating.
|
// so as a compromise users who want to use it will simply need to re-enable it once after updating.
|
||||||
cff.IgnoreApplet = false;
|
cff.IgnoreApplet = false;
|
||||||
}),
|
}),
|
||||||
(60, static cff => cff.StartNoUI = false),
|
(60, static cff => cff.StartNoUI = false)
|
||||||
(61, static cff =>
|
|
||||||
{
|
|
||||||
foreach (StandardControllerInputConfig config in cff.InputConfig.OfType<StandardControllerInputConfig>())
|
|
||||||
{
|
|
||||||
config.Led = new LedConfigController
|
|
||||||
{
|
|
||||||
EnableLed = false,
|
|
||||||
LedColor = 328189
|
|
||||||
};
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user