GenericControllerInputConfig.cs 2.4 KB

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