From e097ea71ff36e141337a3558088dee6a62b9d77c Mon Sep 17 00:00:00 2001 From: Vova Date: Sun, 2 Mar 2025 23:49:40 +1000 Subject: [PATCH] Fix: exclude device id when loading preset (independent presets) fixed bug when selected gamepad disappears if another gamepad was disconnected --- src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs index 21ebcdd33..8cb780152 100644 --- a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs @@ -465,7 +465,15 @@ namespace Ryujinx.Ava.UI.ViewModels.Input await Dispatcher.UIThread.InvokeAsync(() => { LoadDevices(); + + if (Config != null) + { + // Load configuration after disconnection if it is in the configuration file + IsModified = true; + LoadSavedConfiguration(); + } FindPairedDevice(); + _isChangeTrackingActive = true; return System.Threading.Tasks.Task.CompletedTask; }); @@ -474,7 +482,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input private async void HandleOnGamepadConnected(string id) { _isChangeTrackingActive = false; - await Dispatcher.UIThread.InvokeAsync(() => { LoadDevices(); @@ -485,7 +492,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input IsModified = true; LoadSavedConfiguration(); } - _isChangeTrackingActive = true; }); } @@ -847,6 +853,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input { _isLoaded = false; + config.Id = null; // ignore device IDs (there is no longer a need to store device IDs for presets due to their independence from devices) + LoadConfiguration(config); // This line of code hard-links profiles to controllers, the commented line allows profiles to be applied to all controllers