mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-02-02 18:12:32 +01:00
Speed up event detection for options window. Use angle for stick dirs controls instead of using an extra dead zone.
This commit is contained in:
parent
ee2df546d1
commit
babed4eaf1
@ -714,37 +714,129 @@ namespace DS4Windows
|
||||
DS4State cState = CurrentState[ind];
|
||||
DS4StateExposed eState = ExposedState[ind];
|
||||
Mouse tp = touchPad[ind];
|
||||
string result = "nothing";
|
||||
|
||||
if (DS4Controllers[ind] != null)
|
||||
if (Mapping.getBoolMapping(ind, DS4Controls.Cross, cState, eState, tp)) return "Cross";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.Circle, cState, eState, tp)) return "Circle";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.Triangle, cState, eState, tp)) return "Triangle";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.Square, cState, eState, tp)) return "Square";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.L1, cState, eState, tp)) return "L1";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.R1, cState, eState, tp)) return "R1";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.L2, cState, eState, tp)) return "L2";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.R2, cState, eState, tp)) return "R2";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.L3, cState, eState, tp)) return "L3";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.R3, cState, eState, tp)) return "R3";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.DpadUp, cState, eState, tp)) return "Up";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.DpadDown, cState, eState, tp)) return "Down";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.DpadLeft, cState, eState, tp)) return "Left";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.DpadRight, cState, eState, tp)) return "Right";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.Share, cState, eState, tp)) return "Share";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.Options, cState, eState, tp)) return "Options";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.PS, cState, eState, tp)) return "PS";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.LXPos, cState, eState, tp)) return "LS Right";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.LXNeg, cState, eState, tp)) return "LS Left";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.LYPos, cState, eState, tp)) return "LS Down";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.LYNeg, cState, eState, tp)) return "LS Up";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.RXPos, cState, eState, tp)) return "RS Right";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.RXNeg, cState, eState, tp)) return "RS Left";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.RYPos, cState, eState, tp)) return "RS Down";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.RYNeg, cState, eState, tp)) return "RS Up";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.TouchLeft, cState, eState, tp)) return "Touch Left";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.TouchRight, cState, eState, tp)) return "Touch Right";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.TouchMulti, cState, eState, tp)) return "Touch Multi";
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.TouchUpper, cState, eState, tp)) return "Touch Upper";
|
||||
return "nothing";
|
||||
{
|
||||
if (Mapping.getBoolButtonMapping(cState.Cross))
|
||||
{
|
||||
result = "Cross";
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.Circle))
|
||||
{
|
||||
result = "Circle";
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.Triangle))
|
||||
{
|
||||
result = "Triangle";
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.Square))
|
||||
{
|
||||
result = "Triangle";
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.L1))
|
||||
{
|
||||
result = "L1";
|
||||
}
|
||||
else if (Mapping.getBoolTriggerMapping(cState.L2))
|
||||
{
|
||||
result = "L2";
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.L3))
|
||||
{
|
||||
result = "L3";
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.R1))
|
||||
{
|
||||
result = "R1";
|
||||
}
|
||||
else if (Mapping.getBoolTriggerMapping(cState.R2))
|
||||
{
|
||||
result = "R2";
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.R3))
|
||||
{
|
||||
result = "R3";
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.DpadUp))
|
||||
{
|
||||
result = "Up";
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.DpadDown))
|
||||
{
|
||||
result = "Down";
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.DpadLeft))
|
||||
{
|
||||
result = "Left";
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.DpadRight))
|
||||
{
|
||||
result = "DpadRight";
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.Share))
|
||||
{
|
||||
result = "Share";
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.Options))
|
||||
{
|
||||
result = "Options";
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.PS))
|
||||
{
|
||||
result = "PS";
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.LX, true))
|
||||
{
|
||||
result = "LS Right";
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.LX, false))
|
||||
{
|
||||
result = "LS Left";
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.LY, true))
|
||||
{
|
||||
result = "LS Down";
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.LY, false))
|
||||
{
|
||||
result = "LS Up";
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.RX, true))
|
||||
{
|
||||
result = "RS Right";
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.RX, false))
|
||||
{
|
||||
result = "RS Left";
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.RY, true))
|
||||
{
|
||||
result = "RS Down";
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.RY, false))
|
||||
{
|
||||
result = "RS Up";
|
||||
}
|
||||
else if (Mapping.getBoolTouchMapping(tp.leftDown))
|
||||
{
|
||||
result = "Touch Left";
|
||||
}
|
||||
else if (Mapping.getBoolTouchMapping(tp.rightDown))
|
||||
{
|
||||
result = "Touch Right";
|
||||
}
|
||||
else if (Mapping.getBoolTouchMapping(tp.multiDown))
|
||||
{
|
||||
result = "Touch Multi";
|
||||
}
|
||||
else if (Mapping.getBoolTouchMapping(tp.upperDown))
|
||||
{
|
||||
result = "Touch Upper";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public DS4Controls GetInputkeysDS4(int ind)
|
||||
@ -752,37 +844,129 @@ namespace DS4Windows
|
||||
DS4State cState = CurrentState[ind];
|
||||
DS4StateExposed eState = ExposedState[ind];
|
||||
Mouse tp = touchPad[ind];
|
||||
DS4Controls result = DS4Controls.None;
|
||||
|
||||
if (DS4Controllers[ind] != null)
|
||||
if (Mapping.getBoolMapping(ind, DS4Controls.Cross, cState, eState, tp)) return DS4Controls.Cross;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.Circle, cState, eState, tp)) return DS4Controls.Circle;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.Triangle, cState, eState, tp)) return DS4Controls.Triangle;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.Square, cState, eState, tp)) return DS4Controls.Square;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.L1, cState, eState, tp)) return DS4Controls.L1;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.R1, cState, eState, tp)) return DS4Controls.R1;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.L2, cState, eState, tp)) return DS4Controls.L2;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.R2, cState, eState, tp)) return DS4Controls.R2;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.L3, cState, eState, tp)) return DS4Controls.L3;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.R3, cState, eState, tp)) return DS4Controls.R3;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.DpadUp, cState, eState, tp)) return DS4Controls.DpadUp;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.DpadDown, cState, eState, tp)) return DS4Controls.DpadDown;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.DpadLeft, cState, eState, tp)) return DS4Controls.DpadLeft;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.DpadRight, cState, eState, tp)) return DS4Controls.DpadRight;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.Share, cState, eState, tp)) return DS4Controls.Share;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.Options, cState, eState, tp)) return DS4Controls.Options;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.PS, cState, eState, tp)) return DS4Controls.PS;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.LXPos, cState, eState, tp)) return DS4Controls.LXPos;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.LXNeg, cState, eState, tp)) return DS4Controls.LXNeg;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.LYPos, cState, eState, tp)) return DS4Controls.LYPos;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.LYNeg, cState, eState, tp)) return DS4Controls.LYNeg;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.RXPos, cState, eState, tp)) return DS4Controls.RXPos;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.RXNeg, cState, eState, tp)) return DS4Controls.RXNeg;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.RYPos, cState, eState, tp)) return DS4Controls.RYPos;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.RYNeg, cState, eState, tp)) return DS4Controls.RYNeg;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.TouchLeft, cState, eState, tp)) return DS4Controls.TouchLeft;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.TouchRight, cState, eState, tp)) return DS4Controls.TouchRight;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.TouchMulti, cState, eState, tp)) return DS4Controls.TouchMulti;
|
||||
else if (Mapping.getBoolMapping(ind, DS4Controls.TouchUpper, cState, eState, tp)) return DS4Controls.TouchUpper;
|
||||
return DS4Controls.None;
|
||||
{
|
||||
if (Mapping.getBoolButtonMapping(cState.Cross))
|
||||
{
|
||||
result = DS4Controls.Cross;
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.Circle))
|
||||
{
|
||||
result = DS4Controls.Circle;
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.Triangle))
|
||||
{
|
||||
result = DS4Controls.Triangle;
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.Square))
|
||||
{
|
||||
result = DS4Controls.Square;
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.L1))
|
||||
{
|
||||
result = DS4Controls.L1;
|
||||
}
|
||||
else if (Mapping.getBoolTriggerMapping(cState.L2))
|
||||
{
|
||||
result = DS4Controls.L2;
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.L3))
|
||||
{
|
||||
result = DS4Controls.L3;
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.R1))
|
||||
{
|
||||
result = DS4Controls.R1;
|
||||
}
|
||||
else if (Mapping.getBoolTriggerMapping(cState.R2))
|
||||
{
|
||||
result = DS4Controls.R2;
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.R3))
|
||||
{
|
||||
result = DS4Controls.R3;
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.DpadUp))
|
||||
{
|
||||
result = DS4Controls.DpadUp;
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.DpadDown))
|
||||
{
|
||||
result = DS4Controls.DpadDown;
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.DpadLeft))
|
||||
{
|
||||
result = DS4Controls.DpadLeft;
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.DpadRight))
|
||||
{
|
||||
result = DS4Controls.DpadRight;
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.Share))
|
||||
{
|
||||
result = DS4Controls.Share;
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.Options))
|
||||
{
|
||||
result = DS4Controls.Options;
|
||||
}
|
||||
else if (Mapping.getBoolButtonMapping(cState.PS))
|
||||
{
|
||||
result = DS4Controls.PS;
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.LX, true))
|
||||
{
|
||||
result = DS4Controls.LXPos;
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.LX, false))
|
||||
{
|
||||
result = DS4Controls.LXNeg;
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.LY, true))
|
||||
{
|
||||
result = DS4Controls.LYPos;
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.LY, false))
|
||||
{
|
||||
result = DS4Controls.LYNeg;
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.RX, true))
|
||||
{
|
||||
result = DS4Controls.RXPos;
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.RX, false))
|
||||
{
|
||||
result = DS4Controls.RXNeg;
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.RY, true))
|
||||
{
|
||||
result = DS4Controls.RYPos;
|
||||
}
|
||||
else if (Mapping.getBoolAxisDirMapping(cState.RY, false))
|
||||
{
|
||||
result = DS4Controls.RYNeg;
|
||||
}
|
||||
else if (Mapping.getBoolTouchMapping(tp.leftDown))
|
||||
{
|
||||
result = DS4Controls.TouchLeft;
|
||||
}
|
||||
else if (Mapping.getBoolTouchMapping(tp.rightDown))
|
||||
{
|
||||
result = DS4Controls.TouchRight;
|
||||
}
|
||||
else if (Mapping.getBoolTouchMapping(tp.multiDown))
|
||||
{
|
||||
result = DS4Controls.TouchMulti;
|
||||
}
|
||||
else if (Mapping.getBoolTouchMapping(tp.upperDown))
|
||||
{
|
||||
result = DS4Controls.TouchUpper;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool[] touchreleased = { true, true, true, true }, touchslid = { false, false, false, false };
|
||||
@ -798,16 +982,16 @@ namespace DS4Windows
|
||||
oldscrollvalue[deviceID] = getScrollSensitivity(deviceID);
|
||||
getTouchSensitivity()[deviceID] = 0;
|
||||
getScrollSensitivity()[deviceID] = 0;
|
||||
LogDebug(TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
||||
Log.LogToTray(TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
||||
LogDebug(getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
||||
Log.LogToTray(getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
||||
touchreleased[deviceID] = false;
|
||||
}
|
||||
else if (touchreleased[deviceID])
|
||||
{
|
||||
getTouchSensitivity()[deviceID] = oldtouchvalue[deviceID];
|
||||
getScrollSensitivity()[deviceID] = oldscrollvalue[deviceID];
|
||||
LogDebug(TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
||||
Log.LogToTray(TouchSensitivity[deviceID] > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
||||
LogDebug(getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
||||
Log.LogToTray(getTouchSensitivity(deviceID) > 0 ? Properties.Resources.TouchpadMovementOn : Properties.Resources.TouchpadMovementOff);
|
||||
touchreleased[deviceID] = false;
|
||||
}
|
||||
}
|
||||
@ -819,8 +1003,8 @@ namespace DS4Windows
|
||||
{
|
||||
if (deviceID < 4)
|
||||
{
|
||||
oldtouchvalue[deviceID] = TouchSensitivity[deviceID];
|
||||
oldscrollvalue[deviceID] = ScrollSensitivity[deviceID];
|
||||
oldtouchvalue[deviceID] = getTouchSensitivity(deviceID);
|
||||
oldscrollvalue[deviceID] = getScrollSensitivity(deviceID);
|
||||
TouchSensitivity[deviceID] = 0;
|
||||
ScrollSensitivity[deviceID] = 0;
|
||||
}
|
||||
@ -848,6 +1032,7 @@ namespace DS4Windows
|
||||
}
|
||||
return slidedir;
|
||||
}
|
||||
|
||||
public virtual void LogDebug(String Data, bool warning = false)
|
||||
{
|
||||
Console.WriteLine(System.DateTime.Now.ToString("G") + "> " + Data);
|
||||
|
@ -836,7 +836,7 @@ namespace DS4Windows
|
||||
else if (actionType == DS4ControlSettings.ActionType.Key)
|
||||
{
|
||||
ushort value = ushort.Parse(action.ToString());
|
||||
if (getBoolMapping(device, dcs.control, cState, eState, tp))
|
||||
if (getBoolActionMapping(device, dcs.control, cState, eState, tp))
|
||||
{
|
||||
resetToDefaultValue(dcs.control, MappedState);
|
||||
SyntheticState.KeyPresses kp;
|
||||
@ -944,38 +944,38 @@ namespace DS4Windows
|
||||
{
|
||||
case X360Controls.LeftMouse:
|
||||
keyvalue = 256;
|
||||
if (getBoolMapping(device, dcs.control, cState, eState, tp))
|
||||
if (getBoolActionMapping(device, dcs.control, cState, eState, tp))
|
||||
deviceState.currentClicks.leftCount++;
|
||||
break;
|
||||
case X360Controls.RightMouse:
|
||||
keyvalue = 257;
|
||||
if (getBoolMapping(device, dcs.control, cState, eState, tp))
|
||||
if (getBoolActionMapping(device, dcs.control, cState, eState, tp))
|
||||
deviceState.currentClicks.rightCount++;
|
||||
break;
|
||||
case X360Controls.MiddleMouse:
|
||||
keyvalue = 258;
|
||||
if (getBoolMapping(device, dcs.control, cState, eState, tp))
|
||||
if (getBoolActionMapping(device, dcs.control, cState, eState, tp))
|
||||
deviceState.currentClicks.middleCount++;
|
||||
break;
|
||||
case X360Controls.FourthMouse:
|
||||
keyvalue = 259;
|
||||
if (getBoolMapping(device, dcs.control, cState, eState, tp))
|
||||
if (getBoolActionMapping(device, dcs.control, cState, eState, tp))
|
||||
deviceState.currentClicks.fourthCount++;
|
||||
break;
|
||||
case X360Controls.FifthMouse:
|
||||
keyvalue = 260;
|
||||
if (getBoolMapping(device, dcs.control, cState, eState, tp))
|
||||
if (getBoolActionMapping(device, dcs.control, cState, eState, tp))
|
||||
deviceState.currentClicks.fifthCount++;
|
||||
break;
|
||||
case X360Controls.WUP:
|
||||
if (getBoolMapping(device, dcs.control, cState, eState, tp))
|
||||
if (getBoolActionMapping(device, dcs.control, cState, eState, tp))
|
||||
if (isAnalog)
|
||||
getMouseWheelMapping(device, dcs.control, cState, eState, tp, false);
|
||||
else
|
||||
deviceState.currentClicks.wUpCount++;
|
||||
break;
|
||||
case X360Controls.WDOWN:
|
||||
if (getBoolMapping(device, dcs.control, cState, eState, tp))
|
||||
if (getBoolActionMapping(device, dcs.control, cState, eState, tp))
|
||||
if (isAnalog)
|
||||
getMouseWheelMapping(device, dcs.control, cState, eState, tp, true);
|
||||
else
|
||||
@ -1033,7 +1033,7 @@ namespace DS4Windows
|
||||
|
||||
if (keyType.HasFlag(DS4KeyType.Toggle))
|
||||
{
|
||||
if (getBoolMapping(device, dcs.control, cState, eState, tp))
|
||||
if (getBoolActionMapping(device, dcs.control, cState, eState, tp))
|
||||
{
|
||||
resetToDefaultValue(dcs.control, MappedState);
|
||||
if (!pressedonce[keyvalue])
|
||||
@ -1057,7 +1057,7 @@ namespace DS4Windows
|
||||
{
|
||||
bool shiftE = !string.IsNullOrEmpty(dcs.shiftExtras) && dcs.shiftExtras != "0,0,0,0,0,0,0,0" && ShiftTrigger(dcs.shiftTrigger, device, cState, eState, tp);
|
||||
bool regE = !string.IsNullOrEmpty(dcs.extras) && dcs.extras != "0,0,0,0,0,0,0,0";
|
||||
if ((regE || shiftE) && getBoolMapping(device, dcs.control, cState, eState, tp))
|
||||
if ((regE || shiftE) && getBoolActionMapping(device, dcs.control, cState, eState, tp))
|
||||
{
|
||||
usingExtra = dcs.control;
|
||||
string p;
|
||||
@ -1167,7 +1167,7 @@ namespace DS4Windows
|
||||
DS4Controls dc = tempControlDict[key];
|
||||
//DS4Controls key = entry.Key;
|
||||
//DS4Controls dc = entry.Value;
|
||||
if (getBoolMapping(device, dc, cState, eState, tp))
|
||||
if (getBoolActionMapping(device, dc, cState, eState, tp))
|
||||
{
|
||||
if (key >= DS4Controls.Square && key <= DS4Controls.Cross)
|
||||
{
|
||||
@ -2506,6 +2506,177 @@ namespace DS4Windows
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool getBoolActionMapping(int device, DS4Controls control, DS4State cState, DS4StateExposed eState, Mouse tp)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (control >= DS4Controls.Square && control <= DS4Controls.Cross)
|
||||
{
|
||||
switch (control)
|
||||
{
|
||||
case DS4Controls.Cross: result = cState.Cross; break;
|
||||
case DS4Controls.Square: result = cState.Square; break;
|
||||
case DS4Controls.Triangle: result = cState.Triangle; break;
|
||||
case DS4Controls.Circle: result = cState.Circle; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else if (control >= DS4Controls.L1 && control <= DS4Controls.R3)
|
||||
{
|
||||
switch (control)
|
||||
{
|
||||
case DS4Controls.L1: result = cState.L1; break;
|
||||
case DS4Controls.R1: result = cState.R1; break;
|
||||
case DS4Controls.L2: result = cState.L2 > 0; break;
|
||||
case DS4Controls.R2: result = cState.R2 > 0; break;
|
||||
case DS4Controls.L3: result = cState.L3; break;
|
||||
case DS4Controls.R3: result = cState.R3; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else if (control >= DS4Controls.DpadUp && control <= DS4Controls.DpadLeft)
|
||||
{
|
||||
switch (control)
|
||||
{
|
||||
case DS4Controls.DpadUp: result = cState.DpadUp; break;
|
||||
case DS4Controls.DpadDown: result = cState.DpadDown; break;
|
||||
case DS4Controls.DpadLeft: result = cState.DpadLeft; break;
|
||||
case DS4Controls.DpadRight: result = cState.DpadRight; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else if (control >= DS4Controls.LXNeg && control <= DS4Controls.RYPos)
|
||||
{
|
||||
switch (control)
|
||||
{
|
||||
case DS4Controls.LXNeg:
|
||||
{
|
||||
double angle = Math.Atan2((cState.LX - 127), -(cState.LY - 127));
|
||||
angle = (angle >= 0 ? angle : (2 * Math.PI + angle)) * 180 / Math.PI;
|
||||
result = cState.LX < 127 && (angle >= 210 && angle <= 330);
|
||||
break;
|
||||
}
|
||||
case DS4Controls.LYNeg:
|
||||
{
|
||||
double angle = Math.Atan2((cState.LX - 127), -(cState.LY - 127));
|
||||
angle = (angle >= 0 ? angle : (2 * Math.PI + angle)) * 180 / Math.PI;
|
||||
result = cState.LY < 127 && (angle >= 300 || angle <= 60);
|
||||
break;
|
||||
}
|
||||
case DS4Controls.RXNeg:
|
||||
{
|
||||
double angle = Math.Atan2((cState.RX - 127), -(cState.RY - 127));
|
||||
angle = (angle >= 0 ? angle : (2 * Math.PI + angle)) * 180 / Math.PI;
|
||||
result = cState.RX < 127 && (angle >= 210 && angle <= 330);
|
||||
break;
|
||||
}
|
||||
case DS4Controls.RYNeg:
|
||||
{
|
||||
double angle = Math.Atan2((cState.RX - 127), -(cState.RY - 127));
|
||||
angle = (angle >= 0 ? angle : (2 * Math.PI + angle)) * 180 / Math.PI;
|
||||
result = cState.RY < 127 && (angle >= 300 || angle <= 60);
|
||||
break;
|
||||
}
|
||||
case DS4Controls.LXPos:
|
||||
{
|
||||
double angle = Math.Atan2((cState.LX - 127), -(cState.LY - 127));
|
||||
angle = (angle >= 0 ? angle : (2 * Math.PI + angle)) * 180 / Math.PI;
|
||||
result = cState.LX > 127 && (angle >= 30 && angle <= 150);
|
||||
break;
|
||||
}
|
||||
case DS4Controls.LYPos:
|
||||
{
|
||||
double angle = Math.Atan2((cState.LX - 127), -(cState.LY - 127));
|
||||
angle = (angle >= 0 ? angle : (2 * Math.PI + angle)) * 180 / Math.PI;
|
||||
result = cState.LY > 127 && (angle >= 120 && angle <= 240);
|
||||
break;
|
||||
}
|
||||
case DS4Controls.RXPos:
|
||||
{
|
||||
double angle = Math.Atan2((cState.RX - 127), -(cState.RY - 127));
|
||||
angle = (angle >= 0 ? angle : (2 * Math.PI + angle)) * 180 / Math.PI;
|
||||
result = cState.RX > 127 && (angle >= 30 && angle <= 150);
|
||||
break;
|
||||
}
|
||||
case DS4Controls.RYPos:
|
||||
{
|
||||
double angle = Math.Atan2((cState.RX - 127), -(cState.RY - 127));
|
||||
angle = (angle >= 0 ? angle : (2 * Math.PI + angle)) * 180 / Math.PI;
|
||||
result = cState.RY > 127 && (angle >= 120 && angle <= 240);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else if (control >= DS4Controls.TouchLeft && control <= DS4Controls.TouchRight)
|
||||
{
|
||||
switch (control)
|
||||
{
|
||||
case DS4Controls.TouchLeft: result = (tp != null ? tp.leftDown : false); break;
|
||||
case DS4Controls.TouchRight: result = (tp != null ? tp.rightDown : false); break;
|
||||
case DS4Controls.TouchMulti: result = (tp != null ? tp.multiDown : false); break;
|
||||
case DS4Controls.TouchUpper: result = (tp != null ? tp.upperDown : false); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else if (control >= DS4Controls.SwipeLeft && control <= DS4Controls.SwipeDown)
|
||||
{
|
||||
switch (control)
|
||||
{
|
||||
case DS4Controls.SwipeUp: result = (tp != null && tp.swipeUp); break;
|
||||
case DS4Controls.SwipeDown: result = (tp != null && tp.swipeDown); break;
|
||||
case DS4Controls.SwipeLeft: result = (tp != null && tp.swipeLeft); break;
|
||||
case DS4Controls.SwipeRight: result = (tp != null && tp.swipeRight); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else if (control >= DS4Controls.GyroXPos && control <= DS4Controls.GyroZNeg)
|
||||
{
|
||||
bool sOff = isUsingSAforMouse(device);
|
||||
|
||||
switch (control)
|
||||
{
|
||||
case DS4Controls.GyroXPos: result = !sOff ? SXSens[device] * eState.GyroX > 67 : false; break;
|
||||
case DS4Controls.GyroXNeg: result = !sOff ? SXSens[device] * eState.GyroX < -67 : false; break;
|
||||
case DS4Controls.GyroZPos: result = !sOff ? SZSens[device] * eState.GyroZ > 67 : false; break;
|
||||
case DS4Controls.GyroZNeg: result = !sOff ? SZSens[device] * eState.GyroZ < -67 : false; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (control)
|
||||
{
|
||||
case DS4Controls.PS: result = cState.PS; break;
|
||||
case DS4Controls.Share: result = cState.Share; break;
|
||||
case DS4Controls.Options: result = cState.Options; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool getBoolButtonMapping(bool stateButton)
|
||||
{
|
||||
return stateButton;
|
||||
}
|
||||
|
||||
public static bool getBoolAxisDirMapping(byte stateAxis, bool positive)
|
||||
{
|
||||
return positive ? stateAxis > 127 + 55 : stateAxis < 127 - 55;
|
||||
}
|
||||
|
||||
public static bool getBoolTriggerMapping(byte stateAxis)
|
||||
{
|
||||
return stateAxis > 100;
|
||||
}
|
||||
|
||||
public static bool getBoolTouchMapping(bool touchButton)
|
||||
{
|
||||
return touchButton;
|
||||
}
|
||||
|
||||
public static byte getXYAxisMapping(int device, DS4Controls control, DS4State cState, DS4StateExposed eState, Mouse tp, bool alt = false)
|
||||
{
|
||||
byte result = 0;
|
||||
|
@ -2608,18 +2608,28 @@ namespace DS4Windows
|
||||
|
||||
public bool HasCustomActions(int deviceNum)
|
||||
{
|
||||
foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
||||
//foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
||||
for (int i = 0, listLen = ds4settings[deviceNum].Count; i < listLen; i++)
|
||||
{
|
||||
DS4ControlSettings dcs = ds4settings[deviceNum][i];
|
||||
if (dcs.action != null || dcs.shiftAction != null)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public bool HasCustomExtras(int deviceNum)
|
||||
{
|
||||
foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
||||
//foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
||||
for (int i = 0, listLen = ds4settings[deviceNum].Count; i < listLen; i++)
|
||||
{
|
||||
DS4ControlSettings dcs = ds4settings[deviceNum][i];
|
||||
if (dcs.extras != null || dcs.shiftExtras != null)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user