Fix: exclude device id when loading preset (independent presets)

fixed bug when selected gamepad disappears if another gamepad was disconnected
This commit is contained in:
Vova 2025-03-02 23:49:40 +10:00
parent 299f2144c8
commit e097ea71ff

View file

@ -465,7 +465,15 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
await Dispatcher.UIThread.InvokeAsync(() => await Dispatcher.UIThread.InvokeAsync(() =>
{ {
LoadDevices(); LoadDevices();
if (Config != null)
{
// Load configuration after disconnection if it is in the configuration file
IsModified = true;
LoadSavedConfiguration();
}
FindPairedDevice(); FindPairedDevice();
_isChangeTrackingActive = true; _isChangeTrackingActive = true;
return System.Threading.Tasks.Task.CompletedTask; return System.Threading.Tasks.Task.CompletedTask;
}); });
@ -474,7 +482,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
private async void HandleOnGamepadConnected(string id) private async void HandleOnGamepadConnected(string id)
{ {
_isChangeTrackingActive = false; _isChangeTrackingActive = false;
await Dispatcher.UIThread.InvokeAsync(() => await Dispatcher.UIThread.InvokeAsync(() =>
{ {
LoadDevices(); LoadDevices();
@ -485,7 +492,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
IsModified = true; IsModified = true;
LoadSavedConfiguration(); LoadSavedConfiguration();
} }
_isChangeTrackingActive = true; _isChangeTrackingActive = true;
}); });
} }
@ -847,6 +853,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
{ {
_isLoaded = false; _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); LoadConfiguration(config);
// This line of code hard-links profiles to controllers, the commented line allows profiles to be applied to all controllers // This line of code hard-links profiles to controllers, the commented line allows profiles to be applied to all controllers