GenericControllerInputConfig.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using Ryujinx.Common.Configuration.Hid.Controller.Motion;
  2. using System;
  3. using System.Text.Json.Serialization;
  4. namespace Ryujinx.Common.Configuration.Hid.Controller
  5. {
  6. public class GenericControllerInputConfig<Button, Stick> : GenericInputConfigurationCommon<Button> where Button : unmanaged where Stick : unmanaged
  7. {
  8. [JsonIgnore]
  9. private float _deadzoneLeft;
  10. [JsonIgnore]
  11. private float _deadzoneRight;
  12. [JsonIgnore]
  13. private float _triggerThreshold;
  14. /// <summary>
  15. /// Left JoyCon Controller Stick Bindings
  16. /// </summary>
  17. public JoyconConfigControllerStick<Button, Stick> LeftJoyconStick { get; set; }
  18. /// <summary>
  19. /// Right JoyCon Controller Stick Bindings
  20. /// </summary>
  21. public JoyconConfigControllerStick<Button, Stick> RightJoyconStick { get; set; }
  22. /// <summary>
  23. /// Controller Left Analog Stick Deadzone
  24. /// </summary>
  25. public float DeadzoneLeft
  26. {
  27. get => _deadzoneLeft; set
  28. {
  29. _deadzoneLeft = MathF.Round(value, 3);
  30. OnPropertyChanged();
  31. }
  32. }
  33. /// <summary>
  34. /// Controller Right Analog Stick Deadzone
  35. /// </summary>
  36. public float DeadzoneRight
  37. {
  38. get => _deadzoneRight; set
  39. {
  40. _deadzoneRight = MathF.Round(value, 3);
  41. OnPropertyChanged();
  42. }
  43. }
  44. /// <summary>
  45. /// Controller Left Analog Stick Range
  46. /// </summary>
  47. public float RangeLeft { get; set; }
  48. /// <summary>
  49. /// Controller Right Analog Stick Range
  50. /// </summary>
  51. public float RangeRight { get; set; }
  52. /// <summary>
  53. /// Controller Trigger Threshold
  54. /// </summary>
  55. public float TriggerThreshold
  56. {
  57. get => _triggerThreshold; set
  58. {
  59. _triggerThreshold = MathF.Round(value, 3);
  60. OnPropertyChanged();
  61. }
  62. }
  63. /// <summary>
  64. /// Controller Motion Settings
  65. /// </summary>
  66. public MotionConfigController Motion { get; set; }
  67. /// <summary>
  68. /// Controller Rumble Settings
  69. /// </summary>
  70. public RumbleConfigController Rumble { get; set; }
  71. }
  72. }