diff --git a/DS4Windows/DS4Control/Mapping.cs b/DS4Windows/DS4Control/Mapping.cs index 713b7d9..9047c89 100644 --- a/DS4Windows/DS4Control/Mapping.cs +++ b/DS4Windows/DS4Control/Mapping.cs @@ -1058,28 +1058,28 @@ namespace DS4Windows if (macroControl[23]) MappedState.RY = 255; if (macroControl[24]) MappedState.RY = 0; - if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.LXNeg.ToString()), device, cState, eState, tp), DS4Controls.LXNeg)) + if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.LXNeg), device, cState, eState, tp), DS4Controls.LXNeg)) tempControlDict.Add(DS4Controls.LXNeg, DS4Controls.LXNeg); - if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.LXPos.ToString()), device, cState, eState, tp), DS4Controls.LXPos)) + if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.LXPos), device, cState, eState, tp), DS4Controls.LXPos)) tempControlDict.Add(DS4Controls.LXPos, DS4Controls.LXPos); - if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.LYNeg.ToString()), device, cState, eState, tp), DS4Controls.LYNeg)) + if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.LYNeg), device, cState, eState, tp), DS4Controls.LYNeg)) tempControlDict.Add(DS4Controls.LYNeg, DS4Controls.LYNeg); - if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.LYPos.ToString()), device, cState, eState, tp), DS4Controls.LYPos)) + if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.LYPos), device, cState, eState, tp), DS4Controls.LYPos)) tempControlDict.Add(DS4Controls.LYPos, DS4Controls.LYPos); - if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.RXNeg.ToString()), device, cState, eState, tp), DS4Controls.RXNeg)) + if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.RXNeg), device, cState, eState, tp), DS4Controls.RXNeg)) tempControlDict.Add(DS4Controls.RXNeg, DS4Controls.RXNeg); - if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.RXPos.ToString()), device, cState, eState, tp), DS4Controls.RXPos)) + if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.RXPos), device, cState, eState, tp), DS4Controls.RXPos)) tempControlDict.Add(DS4Controls.RXPos, DS4Controls.RXPos); - if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.RYNeg.ToString()), device, cState, eState, tp), DS4Controls.RYNeg)) + if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.RYNeg), device, cState, eState, tp), DS4Controls.RYNeg)) tempControlDict.Add(DS4Controls.RYNeg, DS4Controls.RYNeg); - if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.RYPos.ToString()), device, cState, eState, tp), DS4Controls.RYPos)) + if (IfAxisIsNotModified(device, ShiftTrigger(GetDS4STrigger(device, DS4Controls.RYPos), device, cState, eState, tp), DS4Controls.RYPos)) tempControlDict.Add(DS4Controls.RYPos, DS4Controls.RYPos); foreach (KeyValuePair entry in tempControlDict) @@ -1320,7 +1320,7 @@ namespace DS4Windows untriggerindex[device] = index; foreach (DS4Controls dc in action.trigger) { - DS4ControlSettings dcs = getDS4CSetting(device, dc.ToString()); + DS4ControlSettings dcs = getDS4CSetting(device, dc); if (dcs.action != null) { if (dcs.actionType == DS4ControlSettings.ActionType.Key) @@ -1397,7 +1397,7 @@ namespace DS4Windows d.DisconnectBT(); foreach (DS4Controls dc in action.trigger) { - DS4ControlSettings dcs = getDS4CSetting(device, dc.ToString()); + DS4ControlSettings dcs = getDS4CSetting(device, dc); if (dcs.action != null) { if (dcs.actionType == DS4ControlSettings.ActionType.Key) @@ -1596,7 +1596,7 @@ namespace DS4Windows foreach (DS4Controls dc in action.uTrigger) { actionDone[index].dev[device] = true; - DS4ControlSettings dcs = getDS4CSetting(device, dc.ToString()); + DS4ControlSettings dcs = getDS4CSetting(device, dc); if (dcs.action != null) { if (dcs.actionType == DS4ControlSettings.ActionType.Key) diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index cd92c01..dea86c3 100644 --- a/DS4Windows/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -395,8 +395,10 @@ namespace DS4Windows public static DS4KeyType GetDS4KeyType(int deviceNum, string buttonName, bool shift) => m_Config.GetDS4KeyType(deviceNum, buttonName, shift); public static string GetDS4Extra(int deviceNum, string buttonName, bool shift) => m_Config.GetDS4Extra(deviceNum, buttonName, shift); public static int GetDS4STrigger(int deviceNum, string buttonName) => m_Config.GetDS4STrigger(deviceNum, buttonName); + public static int GetDS4STrigger(int deviceNum, DS4Controls control) => m_Config.GetDS4STrigger(deviceNum, control); public static List getDS4CSettings(int device) => m_Config.ds4settings[device]; public static DS4ControlSettings getDS4CSetting(int deviceNum, string control) => m_Config.getDS4CSetting(deviceNum, control); + public static DS4ControlSettings getDS4CSetting(int deviceNum, DS4Controls control) => m_Config.getDS4CSetting(deviceNum, control); public static bool HasCustomAction(int deviceNum) => m_Config.HasCustomActions(deviceNum); public static bool HasCustomExtras(int deviceNum) => m_Config.HasCustomExtras(deviceNum); public static bool containsCustomAction(int deviceNum) @@ -2340,6 +2342,19 @@ namespace DS4Windows return 0; } + public int GetDS4STrigger(int deviceNum, DS4Controls dc) + { + int temp = (int)dc; + if (temp > 0) + { + int index = temp - 1; + DS4ControlSettings dcs = ds4settings[deviceNum][index]; + return dcs.shiftTrigger; + } + + return 0; + } + public DS4ControlSettings getDS4CSetting(int deviceNum, string buttonName) { DS4Controls dc; @@ -2353,6 +2368,19 @@ namespace DS4Windows return null; } + public DS4ControlSettings getDS4CSetting(int deviceNum, DS4Controls dc) + { + int temp = (int)dc; + if (temp > 0) + { + int index = temp - 1; + DS4ControlSettings dcs = ds4settings[deviceNum][index]; + return dcs; + } + + return null; + } + public bool HasCustomActions(int deviceNum) { foreach (DS4ControlSettings dcs in ds4settings[deviceNum])