diff --git a/DS4Windows/DS4Control/DS4LightBar.cs b/DS4Windows/DS4Control/DS4LightBar.cs index 92d3963..f1eb82b 100644 --- a/DS4Windows/DS4Control/DS4LightBar.cs +++ b/DS4Windows/DS4Control/DS4LightBar.cs @@ -164,9 +164,9 @@ namespace DS4Windows //distanceprofile = (ProfilePath[deviceNum].ToLower().Contains("distance") || tempprofilename[deviceNum].ToLower().Contains("distance")); if (distanceprofile && !defualtLight) { //Thing I did for Distance - float rumble = device.LeftHeavySlowRumble / 2.55f; + float rumble = device.getLeftHeavySlowRumble() / 2.55f; byte max = Max(color.red, Max(color.green, color.blue)); - if (device.LeftHeavySlowRumble > 100) + if (device.getLeftHeavySlowRumble() > 100) color = getTransitionedColor(new DS4Color(max, max, 0), new DS4Color(255, 0, 0), rumble); else color = getTransitionedColor(color, getTransitionedColor(new DS4Color(max, max, 0), new DS4Color(255, 0, 0), 39.6078f), device.getLeftHeavySlowRumble()); diff --git a/DS4Windows/DS4Control/Mapping.cs b/DS4Windows/DS4Control/Mapping.cs index 6f5384d..3a417a7 100644 --- a/DS4Windows/DS4Control/Mapping.cs +++ b/DS4Windows/DS4Control/Mapping.cs @@ -687,6 +687,7 @@ namespace DS4Windows { switch (trigger) { + case 0: return false; case 1: return getBoolMapping(device, DS4Controls.Cross, cState, eState, tp); case 2: return getBoolMapping(device, DS4Controls.Circle, cState, eState, tp); case 3: return getBoolMapping(device, DS4Controls.Square, cState, eState, tp); @@ -792,7 +793,6 @@ namespace DS4Windows cState.CopyTo(MappedState); Dictionary tempControlDict = new Dictionary(); - //Dictionary tempAxesControlDict = new Dictionary(); DS4Controls usingExtra = DS4Controls.None; foreach (DS4ControlSettings dcs in getDS4CSettings(device)) { @@ -811,6 +811,7 @@ namespace DS4Windows actionType = dcs.actionType; keyType = dcs.keyType; } + if (action != null) { if (actionType == DS4ControlSettings.ActionType.Macro) @@ -991,8 +992,9 @@ namespace DS4Windows else p = dcs.extras; string[] extraS = p.Split(','); - int[] extras = new int[extraS.Length]; - for (int i = 0; i < extraS.Length; i++) + int extrasSLen = extraS.Length; + int[] extras = new int[extrasSLen]; + for (int i = 0; i < extrasSLen; i++) { int b; if (int.TryParse(extraS[i], out b)) @@ -1188,7 +1190,10 @@ namespace DS4Windows } } - InputMethods.MoveCursorBy(MouseDeltaX, MouseDeltaY); + if (MouseDeltaX != 0 || MouseDeltaY != 0) + { + InputMethods.MoveCursorBy(MouseDeltaX, MouseDeltaY); + } } private static bool IfAxisIsNotModified(int device, bool shift, DS4Controls dc) @@ -1200,6 +1205,8 @@ namespace DS4Windows /* TODO: This method is slow sauce. Find ways to speed up action execution */ try { + int actionDoneCount = actionDone.Count; + int totalActionCount = GetActions().Count; List profileActions = getProfileActions(device); foreach (string actionname in profileActions) { @@ -1208,11 +1215,18 @@ namespace DS4Windows //int index = GetActionIndexOf(actionname); SpecialAction action = GetProfileAction(device, actionname); int index = GetProfileActionIndexOf(device, actionname); - int actionDoneCount = actionDone.Count; + if (actionDoneCount < index + 1) + { actionDone.Add(new ActionState()); - else if (actionDoneCount > GetActions().Count) + actionDoneCount++; + } + else if (actionDoneCount > totalActionCount) + { actionDone.RemoveAt(actionDoneCount - 1); + actionDoneCount--; + } + double time = 0.0; //If a key or button is assigned to the trigger, a key special action is used like //a quick tap to use and hold to use the regular custom button/key @@ -1399,7 +1413,7 @@ namespace DS4Windows else if (triggeractivated && action.typeID == SpecialAction.ActionTypeId.DisconnectBT) { DS4Device d = ctrl.DS4Controllers[device]; - if (!d.Charging) + if (!d.isCharging()) { ConnectionType deviceConn = d.ConnectionType; if (deviceConn == ConnectionType.BT) @@ -1417,7 +1431,7 @@ namespace DS4Windows else if (dcs.actionType == DS4ControlSettings.ActionType.Macro) { int[] keys = (int[])dcs.action; - for (int i = 0; i < keys.Length; i++) + for (int i = 0, keysLen = keys.Length; i < keysLen; i++) InputMethods.performKeyRelease((ushort)keys[i]); } } @@ -1616,7 +1630,7 @@ namespace DS4Windows else if (dcs.actionType == DS4ControlSettings.ActionType.Macro) { int[] keys = (int[])dcs.action; - for (int i = 0; i < keys.Length; i++) + for (int i = 0, keysLen=keys.Length; i < keysLen; i++) InputMethods.performKeyRelease((ushort)keys[i]); } }