From 24f030aba5e61cb04004ef35514486be249e3192 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Sat, 28 Mar 2020 15:49:32 -0500 Subject: [PATCH] Change check for remapping execution. Take some Gyro mode settings into account --- DS4Windows/DS4Control/ControlService.cs | 3 +-- DS4Windows/DS4Control/ScpUtil.cs | 10 +++++++++- .../DS4Forms/ViewModels/ProfileSettingsViewModel.cs | 13 +++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/DS4Windows/DS4Control/ControlService.cs b/DS4Windows/DS4Control/ControlService.cs index 4f0e698..76a156a 100644 --- a/DS4Windows/DS4Control/ControlService.cs +++ b/DS4Windows/DS4Control/ControlService.cs @@ -1319,8 +1319,7 @@ namespace DS4Windows if (!recordingMacro && (useTempProfile[ind] || containsCustomAction(ind) || containsCustomExtras(ind) || - getProfileActionCount(ind) > 0 || - GetSASteeringWheelEmulationAxis(ind) >= SASteeringWheelEmulationAxisType.VJoy1X)) + getProfileActionCount(ind) > 0)) { Mapping.MapCustom(ind, cState, MappedState[ind], ExposedState[ind], touchPad[ind], this); cState = MappedState[ind]; diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index e8d3bd4..53ae692 100644 --- a/DS4Windows/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -1690,8 +1690,16 @@ namespace DS4Windows public static void cacheProfileCustomsFlags(int device) { - m_Config.containsCustomAction[device] = HasCustomActions(device); + bool customAct = false; + m_Config.containsCustomAction[device] = customAct = HasCustomActions(device); m_Config.containsCustomExtras[device] = HasCustomExtras(device); + + if (!customAct) + { + customAct = m_Config.gyroOutMode[device] == GyroOutMode.MouseJoystick; + customAct = customAct || m_Config.sASteeringWheelEmulationAxis[device] >= SASteeringWheelEmulationAxisType.VJoy1X; + m_Config.containsCustomAction[device] = customAct; + } } public static void CacheExtraProfileInfo(int device) diff --git a/DS4Windows/DS4Forms/ViewModels/ProfileSettingsViewModel.cs b/DS4Windows/DS4Forms/ViewModels/ProfileSettingsViewModel.cs index b467bd4..42366e6 100644 --- a/DS4Windows/DS4Forms/ViewModels/ProfileSettingsViewModel.cs +++ b/DS4Windows/DS4Forms/ViewModels/ProfileSettingsViewModel.cs @@ -651,9 +651,13 @@ namespace DS4WinWPF.DS4Forms.ViewModels default: break; } + GyroOutMode current = Global.GyroOutputMode[device]; + if (temp == current) return; Global.GyroOutputMode[device] = temp; + GyroOutModeIndexChanged?.Invoke(this, EventArgs.Empty); } } + public event EventHandler GyroOutModeIndexChanged; public OutContType ContType { @@ -665,6 +669,7 @@ namespace DS4WinWPF.DS4Forms.ViewModels get => (int)Global.SASteeringWheelEmulationAxis[device]; set => Global.SASteeringWheelEmulationAxis[device] = (SASteeringWheelEmulationAxisType)value; } + public event EventHandler SASteeringWheelEmulationAxisIndexChanged; private int[] saSteeringRangeValues = new int[9] { 90, 180, 270, 360, 450, 720, 900, 1080, 1440 }; @@ -1561,6 +1566,14 @@ namespace DS4WinWPF.DS4Forms.ViewModels { DS4WinLightVisibleChanged?.Invoke(this, EventArgs.Empty); }; + + GyroOutModeIndexChanged += CalcProfileFlags; + SASteeringWheelEmulationAxisIndexChanged += CalcProfileFlags; + } + + private void CalcProfileFlags(object sender, EventArgs e) + { + Global.cacheProfileCustomsFlags(device); } private void ProfileSettingsViewModel_MainColorChanged(object sender, EventArgs e)