From fd9bce0f6b481f0508c437dbf641a330eacb3f08 Mon Sep 17 00:00:00 2001 From: uncavo-hdmi Date: Tue, 18 Feb 2025 11:27:30 +0100 Subject: [PATCH] fixed led live update while in settings --- .../Input/ControllerAssignmentManager.cs | 2 ++ .../UI/ViewModels/Input/InputViewModel.cs | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx/Input/ControllerAssignmentManager.cs b/src/Ryujinx/Input/ControllerAssignmentManager.cs index 9b0fb70ad..4cc77cbc5 100644 --- a/src/Ryujinx/Input/ControllerAssignmentManager.cs +++ b/src/Ryujinx/Input/ControllerAssignmentManager.cs @@ -94,6 +94,8 @@ namespace Ryujinx.Ava.Input { desiredIndex = GetFirstAvailableIndex(usedIndices); } + + if(desiredIndex == -1) continue; InputConfig config = new GamepadInputConfig(existingConfig).GetConfig(); config.PlayerIndex = (PlayerIndex)desiredIndex; diff --git a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs index 800deed01..427bdf4e2 100644 --- a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs @@ -375,10 +375,23 @@ namespace Ryujinx.Ava.UI.ViewModels.Input Dispatcher.UIThread.Post(() => { LoadDevices(); _isLoaded = false; - LoadConfiguration(); + LoadConfiguration(); LoadDevice(); _isLoaded = true; - NotifyChanges(); + + if (ConfigViewModel is not ControllerInputViewModel controllerInputViewModel) return; + GamepadInputConfig inputConfig = controllerInputViewModel.Config; + + if (inputConfig is not { EnableLedChanging: true }) return; + + if (inputConfig.TurnOffLed) + { + SelectedGamepad.ClearLed(); + } + else + { + SelectedGamepad.SetLed(inputConfig.LedColor.ToUInt32()); + } }); }