From c9bc4eaf58ca0d693a37b1229bb6fc210ce71474 Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Mon, 3 Apr 2023 15:37:27 +0200 Subject: [PATCH] Fix missing string enum converters for the config (#4634) * Fix missing string enum converters for the config * Revert changing KeyboardHotkeys to struct This needs to be done because Avalonia's TwoWay Binding breaks otherwise. --- .../Configuration/Hid/Controller/GamepadInputId.cs | 8 ++++++-- .../Configuration/Hid/Controller/StickInputId.cs | 8 ++++++-- Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs | 4 +++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Ryujinx.Common/Configuration/Hid/Controller/GamepadInputId.cs b/Ryujinx.Common/Configuration/Hid/Controller/GamepadInputId.cs index cae65fc9b8..ad1fa66730 100644 --- a/Ryujinx.Common/Configuration/Hid/Controller/GamepadInputId.cs +++ b/Ryujinx.Common/Configuration/Hid/Controller/GamepadInputId.cs @@ -1,5 +1,9 @@ -namespace Ryujinx.Common.Configuration.Hid.Controller +using Ryujinx.Common.Utilities; +using System.Text.Json.Serialization; + +namespace Ryujinx.Common.Configuration.Hid.Controller { + [JsonConverter(typeof(TypedStringEnumConverter))] public enum GamepadInputId : byte { Unbound, @@ -51,4 +55,4 @@ Count } -} +} \ No newline at end of file diff --git a/Ryujinx.Common/Configuration/Hid/Controller/StickInputId.cs b/Ryujinx.Common/Configuration/Hid/Controller/StickInputId.cs index 87945a75af..5fc4d1c871 100644 --- a/Ryujinx.Common/Configuration/Hid/Controller/StickInputId.cs +++ b/Ryujinx.Common/Configuration/Hid/Controller/StickInputId.cs @@ -1,5 +1,9 @@ -namespace Ryujinx.Common.Configuration.Hid.Controller +using Ryujinx.Common.Utilities; +using System.Text.Json.Serialization; + +namespace Ryujinx.Common.Configuration.Hid.Controller { + [JsonConverter(typeof(TypedStringEnumConverter))] public enum StickInputId : byte { Unbound, @@ -8,4 +12,4 @@ Count } -} +} \ No newline at end of file diff --git a/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs b/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs index 8b6c8c1450..1a10c2a537 100644 --- a/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs +++ b/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs @@ -1,6 +1,8 @@ namespace Ryujinx.Common.Configuration.Hid { - public struct KeyboardHotkeys + // NOTE: Please don't change this to struct. + // This breaks Avalonia's TwoWay binding, which makes us unable to save new KeyboardHotkeys. + public class KeyboardHotkeys { public Key ToggleVsync { get; set; } public Key Screenshot { get; set; }