Fixed profiles on the input page:

- profiles are unlinked from controllers
- sometimes a new profile after saving changed to the previous one, had to select it again (fixed)
- when deleting, the profile now resets the name to "default"
This commit is contained in:
Vova 2025-03-01 23:44:05 +10:00
parent 9dc36646c1
commit 33e3ba9ff2
2 changed files with 22 additions and 2 deletions

View file

@ -106,6 +106,21 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
public event Action NotifyChangesEvent; public event Action NotifyChangesEvent;
public int _profileChoose;
public int ProfileChoose
{
get => _profileChoose;
set
{
if (value >= 0)
{
_profileChoose = value;
}
OnPropertyChanged();
}
}
public PlayerIndex PlayerIdChoose public PlayerIndex PlayerIdChoose
{ {
get => _playerIdChoose; get => _playerIdChoose;
@ -821,7 +836,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
LoadConfiguration(config); LoadConfiguration(config);
LoadDevice(); // This line of code hard-links profiles to controllers, the commented line allows profiles to be applied to all controllers
// LoadDevice();
_isLoaded = true; _isLoaded = true;
@ -873,6 +889,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
await File.WriteAllTextAsync(path, jsonString); await File.WriteAllTextAsync(path, jsonString);
LoadProfiles(); LoadProfiles();
ProfileChoose = ProfilesList.IndexOf(ProfileName); // Show new profile
} }
else else
{ {
@ -905,6 +923,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
} }
LoadProfiles(); LoadProfiles();
ProfileChoose = 0; // Show default profile
} }
} }

View file

@ -117,7 +117,7 @@
Name="ProfileBox" Name="ProfileBox"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Center" VerticalAlignment="Center"
SelectedIndex="0" SelectedIndex="{Binding ProfileChoose}"
ItemsSource="{Binding ProfilesList}" ItemsSource="{Binding ProfilesList}"
Text="{Binding ProfileName, Mode=TwoWay}" /> Text="{Binding ProfileName, Mode=TwoWay}" />
<Button <Button