aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Ava/UI/ViewModels/ControllerSettingsViewModel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Ava/UI/ViewModels/ControllerSettingsViewModel.cs')
-rw-r--r--Ryujinx.Ava/UI/ViewModels/ControllerSettingsViewModel.cs9
1 files changed, 4 insertions, 5 deletions
diff --git a/Ryujinx.Ava/UI/ViewModels/ControllerSettingsViewModel.cs b/Ryujinx.Ava/UI/ViewModels/ControllerSettingsViewModel.cs
index 35256b3b..dd261b10 100644
--- a/Ryujinx.Ava/UI/ViewModels/ControllerSettingsViewModel.cs
+++ b/Ryujinx.Ava/UI/ViewModels/ControllerSettingsViewModel.cs
@@ -51,6 +51,8 @@ namespace Ryujinx.Ava.UI.ViewModels
private bool _isLoaded;
private readonly UserControl _owner;
+ private static readonly InputConfigJsonSerializerContext SerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
+
public IGamepadDriver AvaloniaKeyboardDriver { get; }
public IGamepad SelectedGamepad { get; private set; }
@@ -706,10 +708,7 @@ namespace Ryujinx.Ava.UI.ViewModels
try
{
- using (Stream stream = File.OpenRead(path))
- {
- config = JsonHelper.Deserialize<InputConfig>(stream);
- }
+ config = JsonHelper.DeserializeFromFile(path, SerializerContext.InputConfig);
}
catch (JsonException) { }
catch (InvalidOperationException)
@@ -775,7 +774,7 @@ namespace Ryujinx.Ava.UI.ViewModels
config.ControllerType = Controllers[_controller].Type;
- string jsonString = JsonHelper.Serialize(config, true);
+ string jsonString = JsonHelper.Serialize(config, SerializerContext.InputConfig);
await File.WriteAllTextAsync(path, jsonString);