diff --git a/DS4Windows/DS4Control/ControlService.cs b/DS4Windows/DS4Control/ControlService.cs index 0d5e044..ab8bfa9 100644 --- a/DS4Windows/DS4Control/ControlService.cs +++ b/DS4Windows/DS4Control/ControlService.cs @@ -364,17 +364,21 @@ namespace DS4Windows device.SyncChange += this.On_SyncChange; device.SyncChange += DS4Devices.UpdateSerial; device.SerialChange += this.On_SerialChange; - if (device.isValidSerial() && containsLinkedProfile(device.getMacAddress())) + if (!useTempProfile[i]) { - ProfilePath[i] = getLinkedProfile(device.getMacAddress()); - } - else - { - ProfilePath[i] = OlderProfilePath[i]; + if (device.isValidSerial() && containsLinkedProfile(device.getMacAddress())) + { + ProfilePath[i] = getLinkedProfile(device.getMacAddress()); + } + else + { + ProfilePath[i] = OlderProfilePath[i]; + } + + LoadProfile(i, false, this, false, false); } touchPad[i] = new Mouse(i, device); - LoadProfile(i, false, this, false, false); device.LightBarColor = getMainColor(i); if (!getDInputOnly(i) && device.isSynced()) @@ -605,17 +609,21 @@ namespace DS4Windows device.SyncChange += this.On_SyncChange; device.SyncChange += DS4Devices.UpdateSerial; device.SerialChange += this.On_SerialChange; - if (device.isValidSerial() && containsLinkedProfile(device.getMacAddress())) + if (!useTempProfile[Index]) { - ProfilePath[Index] = getLinkedProfile(device.getMacAddress()); - } - else - { - ProfilePath[Index] = OlderProfilePath[Index]; + if (device.isValidSerial() && containsLinkedProfile(device.getMacAddress())) + { + ProfilePath[Index] = getLinkedProfile(device.getMacAddress()); + } + else + { + ProfilePath[Index] = OlderProfilePath[Index]; + } + + LoadProfile(Index, false, this, false, false); } touchPad[Index] = new Mouse(Index, device); - LoadProfile(Index, false, this, false, false); device.LightBarColor = getMainColor(Index); int tempIdx = Index; @@ -1093,7 +1101,7 @@ namespace DS4Windows cState = Mapping.SetCurveAndDeadzone(ind, cState, TempState[ind]); - if (!recordingMacro && (!string.IsNullOrEmpty(tempprofilename[ind]) || + if (!recordingMacro && (useTempProfile[ind] || containsCustomAction(ind) || containsCustomExtras(ind) || getProfileActionCount(ind) > 0)) { diff --git a/DS4Windows/DS4Control/Mapping.cs b/DS4Windows/DS4Control/Mapping.cs index b28c9ca..7e8b1e2 100644 --- a/DS4Windows/DS4Control/Mapping.cs +++ b/DS4Windows/DS4Control/Mapping.cs @@ -1317,7 +1317,7 @@ namespace DS4Windows //DS4StateFieldMapping outputfieldMapping = new DS4StateFieldMapping(cState, eState, tp); SyntheticState deviceState = Mapping.deviceState[device]; - if (getProfileActionCount(device) > 0 || !string.IsNullOrEmpty(tempprofilename[device])) + if (getProfileActionCount(device) > 0 || useTempProfile[device]) MapCustomAction(device, cState, MappedState, eState, tp, ctrl, fieldMapping, outputfieldMapping); if (ctrl.DS4Controllers[device] == null) return; @@ -1896,7 +1896,7 @@ namespace DS4Windows { actionFound = true; - if (!actionDone[index].dev[device] && string.IsNullOrEmpty(tempprofilename[device])) + if (!actionDone[index].dev[device] && !useTempProfile[device]) { actionDone[index].dev[device] = true; untriggeraction[device] = action; @@ -2286,7 +2286,7 @@ namespace DS4Windows if ((action.controls == action.ucontrols && !actionDone[index].dev[device]) || //if trigger and end trigger are the same action.controls != action.ucontrols) { - if (!string.IsNullOrEmpty(tempprofilename[device])) + if (useTempProfile[device]) { //foreach (DS4Controls dc in action.uTrigger) for (int i = 0, arlen = action.uTrigger.Count; i < arlen; i++) diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index faa6ae3..7cef8cf 100644 --- a/DS4Windows/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -237,6 +237,7 @@ namespace DS4Windows public static bool runHotPlug = false; public const int XINPUT_UNPLUG_SETTLE_TIME = 250; // Inhibit races that occur with the asynchronous teardown of ScpVBus -> X360 driver instance. public static string[] tempprofilename = new string[5] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty }; + public static bool[] useTempProfile = new bool[5] { false, false, false, false, false }; public static bool[] tempprofileDistance = new bool[5] { false, false, false, false, false }; public static bool[] useDInputOnly = new bool[5] { true, true, true, true, true }; public static bool[] linkedProfileCheck = new bool[4] { true, true, true, true }; @@ -1308,6 +1309,7 @@ namespace DS4Windows { m_Config.LoadProfile(device, launchprogram, control, "", xinputChange, postLoad); tempprofilename[device] = string.Empty; + useTempProfile[device] = false; tempprofileDistance[device] = false; } @@ -1316,6 +1318,7 @@ namespace DS4Windows { m_Config.LoadProfile(device, launchprogram, control, appdatapath + @"\Profiles\" + name + ".xml"); tempprofilename[device] = name; + useTempProfile[device] = true; tempprofileDistance[device] = name.ToLower().Contains("distance"); }