diff --git a/DS4Windows/DS4Control/Mapping.cs b/DS4Windows/DS4Control/Mapping.cs index 584a576..752e97d 100644 --- a/DS4Windows/DS4Control/Mapping.cs +++ b/DS4Windows/DS4Control/Mapping.cs @@ -274,7 +274,7 @@ namespace DS4Windows public static int mouseaccel = 0; public static int prevmouseaccel = 0; private static double horizontalRemainder = 0.0, verticalRemainder = 0.0; - private const int MOUSESPEEDFACTOR = 48; + public const int MOUSESPEEDFACTOR = 48; private const double MOUSESTICKOFFSET = 0.26; public static void Commit(int device) diff --git a/DS4Windows/DS4Forms/ProfileEditor.xaml b/DS4Windows/DS4Forms/ProfileEditor.xaml index a1c1d2b..64a492a 100644 --- a/DS4Windows/DS4Forms/ProfileEditor.xaml +++ b/DS4Windows/DS4Forms/ProfileEditor.xaml @@ -952,8 +952,11 @@ diff --git a/DS4Windows/DS4Forms/ViewModels/ProfileSettingsViewModel.cs b/DS4Windows/DS4Forms/ViewModels/ProfileSettingsViewModel.cs index 9915650..69bb1cf 100644 --- a/DS4Windows/DS4Forms/ViewModels/ProfileSettingsViewModel.cs +++ b/DS4Windows/DS4Forms/ViewModels/ProfileSettingsViewModel.cs @@ -379,6 +379,32 @@ namespace DS4WinWPF.DS4Forms.ViewModels set => Global.DS4Mapping = value; } + public int ButtonMouseSensitivity + { + get => Global.ButtonMouseSensitivity[device]; + set + { + int temp = Global.ButtonMouseSensitivity[device]; + if (temp == value) return; + Global.ButtonMouseSensitivity[device] = value; + ButtonMouseSensitivityChanged?.Invoke(this, EventArgs.Empty); + } + } + public event EventHandler ButtonMouseSensitivityChanged; + + private int outputMouseSpeed; + public int OutputMouseSpeed + { + get => outputMouseSpeed; + set + { + if (value == outputMouseSpeed) return; + outputMouseSpeed = value; + OutputMouseSpeedChanged?.Invoke(this, EventArgs.Empty); + } + } + public event EventHandler OutputMouseSpeedChanged; + public bool MouseAcceleration { get => Global.MouseAccel[device]; @@ -1433,6 +1459,8 @@ namespace DS4WinWPF.DS4Forms.ViewModels Global.outDevTypeTemp[device] = OutContType.X360; tempBtPollRate = Global.BTPollRate[device]; + outputMouseSpeed = CalculateOutputMouseSpeed(ButtonMouseSensitivity); + ImageSourceConverter sourceConverter = new ImageSourceConverter(); ImageSource temp = sourceConverter. ConvertFromString("pack://application:,,,/DS4Windows;component/Resources/rainbowCCrop.png") as ImageSource; @@ -1462,6 +1490,11 @@ namespace DS4WinWPF.DS4Forms.ViewModels { LightbarBrushChanged?.Invoke(this, EventArgs.Empty); }; + + ButtonMouseSensitivityChanged += (sender, args) => + { + OutputMouseSpeed = CalculateOutputMouseSpeed(ButtonMouseSensitivity); + }; } private void ProfileSettingsViewModel_MainColorChanged(object sender, EventArgs e) @@ -1765,6 +1798,12 @@ namespace DS4WinWPF.DS4Forms.ViewModels GyroMouseStickTrigDisplay = string.Join(", ", triggerName.ToArray()); } + private int CalculateOutputMouseSpeed(int mouseSpeed) + { + int result = mouseSpeed * Mapping.MOUSESPEEDFACTOR; + return result; + } + public void LaunchCurveEditor(string customDefinition) { // Custom curve editor web link clicked. Open the bezier curve editor web app usign the default browser app and pass on current custom definition as a query string parameter.