mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-29 12:34:18 +01:00
Remove some more unneeded loops from action detection
This commit is contained in:
parent
824a1e019c
commit
f56d50c8a5
@ -1058,28 +1058,28 @@ namespace DS4Windows
|
|||||||
if (macroControl[23]) MappedState.RY = 255;
|
if (macroControl[23]) MappedState.RY = 255;
|
||||||
if (macroControl[24]) MappedState.RY = 0;
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
tempControlDict.Add(DS4Controls.RYPos, DS4Controls.RYPos);
|
||||||
|
|
||||||
foreach (KeyValuePair<DS4Controls, DS4Controls> entry in tempControlDict)
|
foreach (KeyValuePair<DS4Controls, DS4Controls> entry in tempControlDict)
|
||||||
@ -1320,7 +1320,7 @@ namespace DS4Windows
|
|||||||
untriggerindex[device] = index;
|
untriggerindex[device] = index;
|
||||||
foreach (DS4Controls dc in action.trigger)
|
foreach (DS4Controls dc in action.trigger)
|
||||||
{
|
{
|
||||||
DS4ControlSettings dcs = getDS4CSetting(device, dc.ToString());
|
DS4ControlSettings dcs = getDS4CSetting(device, dc);
|
||||||
if (dcs.action != null)
|
if (dcs.action != null)
|
||||||
{
|
{
|
||||||
if (dcs.actionType == DS4ControlSettings.ActionType.Key)
|
if (dcs.actionType == DS4ControlSettings.ActionType.Key)
|
||||||
@ -1397,7 +1397,7 @@ namespace DS4Windows
|
|||||||
d.DisconnectBT();
|
d.DisconnectBT();
|
||||||
foreach (DS4Controls dc in action.trigger)
|
foreach (DS4Controls dc in action.trigger)
|
||||||
{
|
{
|
||||||
DS4ControlSettings dcs = getDS4CSetting(device, dc.ToString());
|
DS4ControlSettings dcs = getDS4CSetting(device, dc);
|
||||||
if (dcs.action != null)
|
if (dcs.action != null)
|
||||||
{
|
{
|
||||||
if (dcs.actionType == DS4ControlSettings.ActionType.Key)
|
if (dcs.actionType == DS4ControlSettings.ActionType.Key)
|
||||||
@ -1596,7 +1596,7 @@ namespace DS4Windows
|
|||||||
foreach (DS4Controls dc in action.uTrigger)
|
foreach (DS4Controls dc in action.uTrigger)
|
||||||
{
|
{
|
||||||
actionDone[index].dev[device] = true;
|
actionDone[index].dev[device] = true;
|
||||||
DS4ControlSettings dcs = getDS4CSetting(device, dc.ToString());
|
DS4ControlSettings dcs = getDS4CSetting(device, dc);
|
||||||
if (dcs.action != null)
|
if (dcs.action != null)
|
||||||
{
|
{
|
||||||
if (dcs.actionType == DS4ControlSettings.ActionType.Key)
|
if (dcs.actionType == DS4ControlSettings.ActionType.Key)
|
||||||
|
@ -395,8 +395,10 @@ namespace DS4Windows
|
|||||||
public static DS4KeyType GetDS4KeyType(int deviceNum, string buttonName, bool shift) => m_Config.GetDS4KeyType(deviceNum, buttonName, shift);
|
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 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, string buttonName) => m_Config.GetDS4STrigger(deviceNum, buttonName);
|
||||||
|
public static int GetDS4STrigger(int deviceNum, DS4Controls control) => m_Config.GetDS4STrigger(deviceNum, control);
|
||||||
public static List<DS4ControlSettings> getDS4CSettings(int device) => m_Config.ds4settings[device];
|
public static List<DS4ControlSettings> 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, 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 HasCustomAction(int deviceNum) => m_Config.HasCustomActions(deviceNum);
|
||||||
public static bool HasCustomExtras(int deviceNum) => m_Config.HasCustomExtras(deviceNum);
|
public static bool HasCustomExtras(int deviceNum) => m_Config.HasCustomExtras(deviceNum);
|
||||||
public static bool containsCustomAction(int deviceNum)
|
public static bool containsCustomAction(int deviceNum)
|
||||||
@ -2340,6 +2342,19 @@ namespace DS4Windows
|
|||||||
return 0;
|
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)
|
public DS4ControlSettings getDS4CSetting(int deviceNum, string buttonName)
|
||||||
{
|
{
|
||||||
DS4Controls dc;
|
DS4Controls dc;
|
||||||
@ -2353,6 +2368,19 @@ namespace DS4Windows
|
|||||||
return null;
|
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)
|
public bool HasCustomActions(int deviceNum)
|
||||||
{
|
{
|
||||||
foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
||||||
|
Loading…
Reference in New Issue
Block a user