mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2025-12-06 07:12:01 +01:00
This is inspired by the changes https://github.com/ayufan/steam-deck-tools/pull/146, but completely rewritten. This removes `DeltaValue` methods, and `Deadzone` fixed values. Adds a settings value for `Deadzone` per profile.
51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using System.ComponentModel;
|
|
using System.Configuration;
|
|
|
|
namespace SteamController.ProfilesSettings
|
|
{
|
|
[Category("3. Haptic")]
|
|
internal sealed class HapticSettings : CommonHelpers.BaseSettings
|
|
{
|
|
public const sbyte MinIntensity = -2;
|
|
public const sbyte MaxIntensity = 10;
|
|
|
|
public static HapticSettings X360 = new HapticSettings("X360HapticSettings");
|
|
public static HapticSettings DS4 = new HapticSettings("DS4HapticSettings");
|
|
|
|
public HapticSettings(string name) : base(name)
|
|
{
|
|
}
|
|
|
|
public static bool GetHapticIntensity(byte? input, sbyte maxIntensity, out sbyte output)
|
|
{
|
|
output = default;
|
|
if (input is null || input.Value == 0)
|
|
return false;
|
|
|
|
int value = MinIntensity + (maxIntensity - MinIntensity) * input.Value / 255;
|
|
output = (sbyte)value;
|
|
return true;
|
|
}
|
|
|
|
public Devices.SteamController.HapticStyle HapticStyle
|
|
{
|
|
get { return Get<Devices.SteamController.HapticStyle>("HapticStyle", Devices.SteamController.HapticStyle.Weak); }
|
|
set { Set("HapticStyle", value); }
|
|
}
|
|
|
|
[Description("Haptic intensity between -2dB and 10dB")]
|
|
public sbyte LeftIntensity
|
|
{
|
|
get { return Get<sbyte>("LeftIntensity", 2); }
|
|
set { Set("LeftIntensity", Math.Clamp(value, MinIntensity, MaxIntensity)); }
|
|
}
|
|
|
|
[Description("Haptic intensity between -2dB and 10dB")]
|
|
public sbyte RightIntensity
|
|
{
|
|
get { return Get<sbyte>("RightIntensity", 2); }
|
|
set { Set("RightIntensity", Math.Clamp(value, MinIntensity, MaxIntensity)); }
|
|
}
|
|
}
|
|
}
|