diff options
Diffstat (limited to 'Ryujinx.Common/Configuration')
-rw-r--r-- | Ryujinx.Common/Configuration/Hid/Controller/GenericControllerInputConfig.cs | 38 | ||||
-rw-r--r-- | Ryujinx.Common/Configuration/Hid/InputConfig.cs | 16 |
2 files changed, 48 insertions, 6 deletions
diff --git a/Ryujinx.Common/Configuration/Hid/Controller/GenericControllerInputConfig.cs b/Ryujinx.Common/Configuration/Hid/Controller/GenericControllerInputConfig.cs index aeb09c58..da8ad797 100644 --- a/Ryujinx.Common/Configuration/Hid/Controller/GenericControllerInputConfig.cs +++ b/Ryujinx.Common/Configuration/Hid/Controller/GenericControllerInputConfig.cs @@ -1,9 +1,20 @@ using Ryujinx.Common.Configuration.Hid.Controller.Motion; +using System; +using System.ComponentModel; +using System.Text.Json.Serialization; +using NotImplementedException = System.NotImplementedException; namespace Ryujinx.Common.Configuration.Hid.Controller { public class GenericControllerInputConfig<Button, Stick> : GenericInputConfigurationCommon<Button> where Button : unmanaged where Stick : unmanaged { + [JsonIgnore] + private float _deadzoneLeft; + [JsonIgnore] + private float _deadzoneRight; + [JsonIgnore] + private float _triggerThreshold; + /// <summary> /// Left JoyCon Controller Stick Bindings /// </summary> @@ -17,12 +28,26 @@ namespace Ryujinx.Common.Configuration.Hid.Controller /// <summary> /// Controller Left Analog Stick Deadzone /// </summary> - public float DeadzoneLeft { get; set; } + public float DeadzoneLeft + { + get => _deadzoneLeft; set + { + _deadzoneLeft = MathF.Round(value, 3); + OnPropertyChanged(); + } + } /// <summary> /// Controller Right Analog Stick Deadzone /// </summary> - public float DeadzoneRight { get; set; } + public float DeadzoneRight + { + get => _deadzoneRight; set + { + _deadzoneRight = MathF.Round(value, 3); + OnPropertyChanged(); + } + } /// <summary> /// Controller Left Analog Stick Range @@ -37,7 +62,14 @@ namespace Ryujinx.Common.Configuration.Hid.Controller /// <summary> /// Controller Trigger Threshold /// </summary> - public float TriggerThreshold { get; set; } + public float TriggerThreshold + { + get => _triggerThreshold; set + { + _triggerThreshold = MathF.Round(value, 3); + OnPropertyChanged(); + } + } /// <summary> /// Controller Motion Settings diff --git a/Ryujinx.Common/Configuration/Hid/InputConfig.cs b/Ryujinx.Common/Configuration/Hid/InputConfig.cs index d204eba4..3364e35f 100644 --- a/Ryujinx.Common/Configuration/Hid/InputConfig.cs +++ b/Ryujinx.Common/Configuration/Hid/InputConfig.cs @@ -1,6 +1,9 @@ -namespace Ryujinx.Common.Configuration.Hid +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace Ryujinx.Common.Configuration.Hid { - public class InputConfig + public class InputConfig : INotifyPropertyChanged { /// <summary> /// The current version of the input file format @@ -25,5 +28,12 @@ /// Player's Index for the controller /// </summary> public PlayerIndex PlayerIndex { get; set; } + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } -} +}
\ No newline at end of file |