diff --git a/src/Ryujinx/Assets/locales.json b/src/Ryujinx/Assets/locales.json
index ff12ca1f3..d96682956 100644
--- a/src/Ryujinx/Assets/locales.json
+++ b/src/Ryujinx/Assets/locales.json
@@ -7623,7 +7623,7 @@
}
},
{
- "ID": "ControllerSettingsLedColor",
+ "ID": "ControllerSettingsLed",
"Translations": {
"ar_SA": "",
"de_DE": "",
@@ -7697,6 +7697,31 @@
"zh_TW": ""
}
},
+ {
+ "ID": "ControllerSettingsLedColor",
+ "Translations": {
+ "ar_SA": "",
+ "de_DE": "",
+ "el_GR": "",
+ "en_US": "Color",
+ "es_ES": "",
+ "fr_FR": "",
+ "he_IL": "",
+ "it_IT": "",
+ "ja_JP": "",
+ "ko_KR": "",
+ "no_NO": "",
+ "pl_PL": "",
+ "pt_BR": "",
+ "ru_RU": "",
+ "sv_SE": "",
+ "th_TH": "",
+ "tr_TR": "",
+ "uk_UA": "",
+ "zh_CN": "",
+ "zh_TW": ""
+ }
+ },
{
"ID": "ControllerSettingsSave",
"Translations": {
@@ -18897,6 +18922,31 @@
"zh_TW": "震動設定"
}
},
+ {
+ "ID": "ControllerLedTitle",
+ "Translations": {
+ "ar_SA": "",
+ "de_DE": "",
+ "el_GR": "",
+ "en_US": "LED Settings",
+ "es_ES": "",
+ "fr_FR": "",
+ "he_IL": "",
+ "it_IT": "",
+ "ja_JP": "",
+ "ko_KR": "",
+ "no_NO": "",
+ "pl_PL": "",
+ "pt_BR": "",
+ "ru_RU": "",
+ "sv_SE": "",
+ "th_TH": "",
+ "tr_TR": "",
+ "uk_UA": "",
+ "zh_CN": "",
+ "zh_TW": ""
+ }
+ },
{
"ID": "SettingsSelectThemeFileDialogTitle",
"Translations": {
diff --git a/src/Ryujinx/UI/ViewModels/Input/ControllerInputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/ControllerInputViewModel.cs
index d291f09a0..9fcf31a9b 100644
--- a/src/Ryujinx/UI/ViewModels/Input/ControllerInputViewModel.cs
+++ b/src/Ryujinx/UI/ViewModels/Input/ControllerInputViewModel.cs
@@ -5,6 +5,7 @@ using FluentAvalonia.UI.Controls;
using Ryujinx.Ava.UI.Helpers;
using Ryujinx.Ava.UI.Models.Input;
using Ryujinx.Ava.UI.Views.Input;
+using Ryujinx.UI.Views.Input;
namespace Ryujinx.Ava.UI.ViewModels.Input
{
@@ -59,16 +60,11 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
{
await RumbleInputView.Show(this);
}
-
- public RelayCommand LedDisabledChanged => Commands.Create(() =>
+
+ public async void ShowLedConfig()
{
- if (!Config.EnableLedChanging) return;
-
- if (Config.TurnOffLed)
- ParentModel.SelectedGamepad.ClearLed();
- else
- ParentModel.SelectedGamepad.SetLed(Config.LedColor.ToUInt32());
- });
+ await LedInputView.Show(this);
+ }
public void OnParentModelChanged()
{
diff --git a/src/Ryujinx/UI/ViewModels/Input/LedInputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/LedInputViewModel.cs
new file mode 100644
index 000000000..a9d14d894
--- /dev/null
+++ b/src/Ryujinx/UI/ViewModels/Input/LedInputViewModel.cs
@@ -0,0 +1,53 @@
+using Avalonia.Media;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+using Ryujinx.Ava.UI.Helpers;
+
+namespace Ryujinx.Ava.UI.ViewModels.Input
+{
+ public partial class LedInputViewModel : BaseModel
+ {
+ public required InputViewModel ParentModel { get; init; }
+
+ public RelayCommand LedDisabledChanged => Commands.Create(() =>
+ {
+ if (!EnableLedChanging) return;
+
+ if (TurnOffLed)
+ ParentModel.SelectedGamepad.ClearLed();
+ else
+ ParentModel.SelectedGamepad.SetLed(LedColor.ToUInt32());
+ });
+
+ [ObservableProperty] private bool _enableLedChanging;
+ [ObservableProperty] private Color _ledColor;
+
+ public bool ShowLedColorPicker => !TurnOffLed && !UseRainbowLed;
+
+ private bool _turnOffLed;
+
+ public bool TurnOffLed
+ {
+ get => _turnOffLed;
+ set
+ {
+ _turnOffLed = value;
+ OnPropertyChanged();
+ OnPropertyChanged(nameof(ShowLedColorPicker));
+ }
+ }
+
+ private bool _useRainbowLed;
+
+ public bool UseRainbowLed
+ {
+ get => _useRainbowLed;
+ set
+ {
+ _useRainbowLed = value;
+ OnPropertyChanged();
+ OnPropertyChanged(nameof(ShowLedColorPicker));
+ }
+ }
+ }
+}
diff --git a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml
index 1662f4a3d..5cf0fa03a 100644
--- a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml
+++ b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml
@@ -495,8 +495,6 @@
Margin="0,-1,0,0">
-
-
@@ -505,39 +503,14 @@
MinWidth="0"
Grid.Column="0"
IsChecked="{Binding Config.EnableLedChanging, Mode=TwoWay}">
-
+
-
-
-
-
-
-
-
-
+ Command="{Binding ShowLedConfig}">
+
+
diff --git a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs
index 99ac3f008..e7221bac4 100644
--- a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs
+++ b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml.cs
@@ -6,12 +6,10 @@ using Avalonia.Interactivity;
using Avalonia.LogicalTree;
using FluentAvalonia.UI.Controls;
using Ryujinx.Ava.UI.Helpers;
-using Ryujinx.Ava.UI.Models;
using Ryujinx.Ava.UI.ViewModels.Input;
using Ryujinx.Common.Configuration.Hid.Controller;
using Ryujinx.Input;
using Ryujinx.Input.Assigner;
-using System.Linq;
using Button = Ryujinx.Input.Button;
using StickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId;
@@ -246,24 +244,5 @@ namespace Ryujinx.Ava.UI.Views.Input
_currentAssigner?.Cancel();
_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;
- if (cVm.Config.TurnOffLed) 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;
- if (cVm.Config.TurnOffLed) return;
-
- cVm.ParentModel.SelectedGamepad.SetLed(cVm.Config.LedColor.ToUInt32());
- }
}
}
diff --git a/src/Ryujinx/UI/Views/Input/LedInputView.axaml b/src/Ryujinx/UI/Views/Input/LedInputView.axaml
new file mode 100644
index 000000000..39e464224
--- /dev/null
+++ b/src/Ryujinx/UI/Views/Input/LedInputView.axaml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Ryujinx/UI/Views/Input/LedInputView.axaml.cs b/src/Ryujinx/UI/Views/Input/LedInputView.axaml.cs
new file mode 100644
index 000000000..2fbb40ff2
--- /dev/null
+++ b/src/Ryujinx/UI/Views/Input/LedInputView.axaml.cs
@@ -0,0 +1,75 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+using FluentAvalonia.UI.Controls;
+using Ryujinx.Ava.Common.Locale;
+using Ryujinx.Ava.UI.Models.Input;
+using Ryujinx.Ava.UI.ViewModels.Input;
+using Ryujinx.Ava.UI.Views.Input;
+using System.Threading.Tasks;
+
+namespace Ryujinx.UI.Views.Input
+{
+ public partial class LedInputView : UserControl
+ {
+ private readonly LedInputViewModel _viewModel;
+
+ public LedInputView(ControllerInputViewModel viewModel)
+ {
+ DataContext = _viewModel = new LedInputViewModel
+ {
+ ParentModel = viewModel.ParentModel,
+ TurnOffLed = viewModel.Config.TurnOffLed,
+ EnableLedChanging = viewModel.Config.EnableLedChanging,
+ LedColor = viewModel.Config.LedColor,
+ UseRainbowLed = viewModel.Config.UseRainbowLed,
+ };
+
+ InitializeComponent();
+ }
+
+ private void ColorPickerButton_OnColorChanged(ColorPickerButton sender, ColorButtonColorChangedEventArgs args)
+ {
+ if (!args.NewColor.HasValue) return;
+ if (DataContext is not LedInputViewModel lvm) return;
+ if (!lvm.EnableLedChanging) return;
+ if (lvm.TurnOffLed) return;
+
+ lvm.ParentModel.SelectedGamepad.SetLed(args.NewColor.Value.ToUInt32());
+ }
+
+ private void ColorPickerButton_OnAttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e)
+ {
+ if (DataContext is not LedInputViewModel lvm) return;
+ if (!lvm.EnableLedChanging) return;
+ if (lvm.TurnOffLed) return;
+
+ lvm.ParentModel.SelectedGamepad.SetLed(lvm.LedColor.ToUInt32());
+ }
+
+ public static async Task Show(ControllerInputViewModel viewModel)
+ {
+ LedInputView content = new(viewModel);
+
+ ContentDialog contentDialog = new()
+ {
+ Title = LocaleManager.Instance[LocaleKeys.ControllerLedTitle],
+ PrimaryButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsSave],
+ SecondaryButtonText = string.Empty,
+ CloseButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsClose],
+ Content = content,
+ };
+ contentDialog.PrimaryButtonClick += (sender, args) =>
+ {
+ GamepadInputConfig config = viewModel.Config;
+ config.EnableLedChanging = content._viewModel.EnableLedChanging;
+ config.LedColor = content._viewModel.LedColor;
+ config.UseRainbowLed = content._viewModel.UseRainbowLed;
+ config.TurnOffLed = content._viewModel.TurnOffLed;
+ };
+
+ await contentDialog.ShowAsync();
+ }
+ }
+}
+