mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-02-11 10:04:23 +01:00
added joystick deadzone setting
This commit is contained in:
parent
4e896f32b0
commit
ca6ac7b0fc
|
|
@ -271,8 +271,10 @@ namespace SteamController.Devices
|
|||
public SteamButton? ActiveButton { get; internal set; }
|
||||
public SteamButton? VirtualLeft { get; internal set; }
|
||||
public SteamButton? VirtualRight { get; internal set; }
|
||||
|
||||
public short Deadzone { get; internal set; }
|
||||
public short MinChange { get; internal set; }
|
||||
public bool UseDeadzoneSetting {get; internal set;} = false;
|
||||
public short MinChange { get; internal set; } = 10;
|
||||
public DeltaValueMode DeltaValueMode { get; internal set; } = DeltaValueMode.Absolute;
|
||||
public SteamAxis? PartnerAxis { get; internal set; }
|
||||
|
||||
|
|
@ -293,8 +295,9 @@ namespace SteamController.Devices
|
|||
public static implicit operator bool(SteamAxis button) => button.Active;
|
||||
public static implicit operator short(SteamAxis button)
|
||||
{
|
||||
if (button.UseDeadzoneSetting)
|
||||
button.Deadzone = Settings.Default.JoystickDeadZone;
|
||||
int pValue = button.PartnerAxis?.Value ?? button.Value;
|
||||
// get circular deadzone reference
|
||||
int dzValue = pValue == button.Value ? button.Value : (int)Math.Sqrt(pValue * pValue + button.Value * button.Value);
|
||||
return dzValue > button.Deadzone ? button.Value : (short)0;
|
||||
}
|
||||
|
|
@ -316,8 +319,7 @@ namespace SteamController.Devices
|
|||
|
||||
int value = 0;
|
||||
int pValue = PartnerAxis?.Value ?? Value;
|
||||
|
||||
// get circular deadzone reference
|
||||
if (UseDeadzoneSetting) Deadzone = Settings.Default.JoystickDeadZone;
|
||||
int dzValue = (int)Math.Sqrt(pValue * pValue + Value * Value);
|
||||
|
||||
switch (mode)
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ namespace SteamController.Devices
|
|||
public readonly SteamAxis GyroYaw = new SteamAxis(0x22);
|
||||
public readonly SteamAxis LeftTrigger = new SteamAxis(0x2C);
|
||||
public readonly SteamAxis RightTrigger = new SteamAxis(0x2E);
|
||||
public readonly SteamAxis LeftThumbX = new SteamAxis(0x30) { Deadzone = 5000, MinChange = 10, DeltaValueMode = Devices.DeltaValueMode.AbsoluteTime };
|
||||
public readonly SteamAxis LeftThumbY = new SteamAxis(0x32) { Deadzone = 5000, MinChange = 10, DeltaValueMode = Devices.DeltaValueMode.AbsoluteTime };
|
||||
public readonly SteamAxis RightThumbX = new SteamAxis(0x34) { Deadzone = 5000, MinChange = 10, DeltaValueMode = Devices.DeltaValueMode.AbsoluteTime };
|
||||
public readonly SteamAxis RightThumbY = new SteamAxis(0x36) { Deadzone = 5000, MinChange = 10, DeltaValueMode = Devices.DeltaValueMode.AbsoluteTime };
|
||||
public readonly SteamAxis LeftThumbX = new SteamAxis(0x30) {UseDeadzoneSetting = true, MinChange = 10, DeltaValueMode = Devices.DeltaValueMode.AbsoluteTime };
|
||||
public readonly SteamAxis LeftThumbY = new SteamAxis(0x32) {UseDeadzoneSetting = true, MinChange = 10, DeltaValueMode = Devices.DeltaValueMode.AbsoluteTime };
|
||||
public readonly SteamAxis RightThumbX = new SteamAxis(0x34) {UseDeadzoneSetting = true, MinChange = 10, DeltaValueMode = Devices.DeltaValueMode.AbsoluteTime };
|
||||
public readonly SteamAxis RightThumbY = new SteamAxis(0x36) {UseDeadzoneSetting = true, MinChange = 10, DeltaValueMode = Devices.DeltaValueMode.AbsoluteTime };
|
||||
public readonly SteamAxis LPadPressure = new SteamAxis(0x38);
|
||||
public readonly SteamAxis RPadPressure = new SteamAxis(0x38);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,14 @@ namespace SteamController
|
|||
set { Set("DetectRTSSForeground", value); }
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
[Description("Deadzone for left and right sticks. Enter a number between 0 and 32768. If this number is too small you may experience drift. 5000 or smaller is recommended.")]
|
||||
public short JoystickDeadZone
|
||||
{
|
||||
get { return Get<short>("JoystickDeadZone", 5000); }
|
||||
set { Set("JoystickDeadZone", value); }
|
||||
}
|
||||
|
||||
[Description("Create a debug log in Documents/SteamDeckTools/Logs.")]
|
||||
public bool EnableDebugLogging
|
||||
{
|
||||
|
|
@ -87,6 +95,8 @@ namespace SteamController
|
|||
set { Set("SteamControllerConfigs", value); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public enum KeyboardStyles
|
||||
{
|
||||
DoNotShow,
|
||||
|
|
|
|||
Loading…
Reference in a new issue