mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-24 23:51:49 +01:00
Trim some property usage
This commit is contained in:
parent
efeaf852ac
commit
5aff8d95f0
@ -365,6 +365,7 @@ namespace DS4Windows
|
|||||||
case Click.WDOWN:
|
case Click.WDOWN:
|
||||||
deviceState[device].currentClicks.wDownCount++;
|
deviceState[device].currentClicks.wDownCount++;
|
||||||
break;
|
break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,9 @@ namespace DS4Windows
|
|||||||
case 16: return s.Options;
|
case 16: return s.Options;
|
||||||
case 17: return s.Share;
|
case 17: return s.Share;
|
||||||
case 18: return s.PS;
|
case 18: return s.PS;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,11 +100,13 @@ namespace DS4Windows
|
|||||||
swipeLeftB = (byte)Math.Min(255, Math.Max(0, firstTouch.hwX - arg.touches[0].hwX));
|
swipeLeftB = (byte)Math.Min(255, Math.Max(0, firstTouch.hwX - arg.touches[0].hwX));
|
||||||
swipeRightB = (byte)Math.Min(255, Math.Max(0, arg.touches[0].hwX - firstTouch.hwX));
|
swipeRightB = (byte)Math.Min(255, Math.Max(0, arg.touches[0].hwX - firstTouch.hwX));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math.Abs(firstTouch.hwY - arg.touches[0].hwY) < 50 && arg.touches.Length == 2)
|
if (Math.Abs(firstTouch.hwY - arg.touches[0].hwY) < 50 && arg.touches.Length == 2)
|
||||||
if (arg.touches[0].hwX - firstTouch.hwX > 200 && !slideleft)
|
if (arg.touches[0].hwX - firstTouch.hwX > 200 && !slideleft)
|
||||||
slideright = true;
|
slideright = true;
|
||||||
else if (firstTouch.hwX - arg.touches[0].hwX > 200 && !slideright)
|
else if (firstTouch.hwX - arg.touches[0].hwX > 200 && !slideright)
|
||||||
slideleft = true;
|
slideleft = true;
|
||||||
|
|
||||||
dev.getCurrentState(s);
|
dev.getCurrentState(s);
|
||||||
synthesizeMouseButtons();
|
synthesizeMouseButtons();
|
||||||
}
|
}
|
||||||
@ -113,14 +117,17 @@ namespace DS4Windows
|
|||||||
cursor.touchesBegan(arg);
|
cursor.touchesBegan(arg);
|
||||||
wheel.touchesBegan(arg);
|
wheel.touchesBegan(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
pastTime = arg.timeStamp;
|
pastTime = arg.timeStamp;
|
||||||
firstTouch = arg.touches[0];
|
firstTouch = arg.touches[0];
|
||||||
|
|
||||||
if (Global.DoubleTap[deviceNum])
|
if (Global.DoubleTap[deviceNum])
|
||||||
{
|
{
|
||||||
DateTime test = arg.timeStamp;
|
DateTime test = arg.timeStamp;
|
||||||
if (test <= (firstTap + TimeSpan.FromMilliseconds((double)Global.TapSensitivity[deviceNum] * 1.5)) && !arg.touchButtonPressed)
|
if (test <= (firstTap + TimeSpan.FromMilliseconds((double)Global.TapSensitivity[deviceNum] * 1.5)) && !arg.touchButtonPressed)
|
||||||
secondtouchbegin = true;
|
secondtouchbegin = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev.getCurrentState(s);
|
dev.getCurrentState(s);
|
||||||
synthesizeMouseButtons();
|
synthesizeMouseButtons();
|
||||||
}
|
}
|
||||||
@ -129,16 +136,17 @@ namespace DS4Windows
|
|||||||
slideright = slideleft = false;
|
slideright = slideleft = false;
|
||||||
swipeUp = swipeDown = swipeLeft = swipeRight = false;
|
swipeUp = swipeDown = swipeLeft = swipeRight = false;
|
||||||
swipeUpB = swipeDownB = swipeLeftB = swipeRightB = 0;
|
swipeUpB = swipeDownB = swipeLeftB = swipeRightB = 0;
|
||||||
if (Global.TapSensitivity[deviceNum] != 0 && !Global.UseTPforControls[deviceNum])
|
byte tapSensitivity = Global.TapSensitivity[deviceNum];
|
||||||
|
if (tapSensitivity != 0 && !Global.UseTPforControls[deviceNum])
|
||||||
{
|
{
|
||||||
|
|
||||||
if (secondtouchbegin)
|
if (secondtouchbegin)
|
||||||
{
|
{
|
||||||
tappedOnce = false;
|
tappedOnce = false;
|
||||||
secondtouchbegin = false;
|
secondtouchbegin = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime test = arg.timeStamp;
|
DateTime test = arg.timeStamp;
|
||||||
if (test <= (pastTime + TimeSpan.FromMilliseconds((double)Global.TapSensitivity[deviceNum] * 2)) && !arg.touchButtonPressed && !tappedOnce)
|
if (test <= (pastTime + TimeSpan.FromMilliseconds((double)tapSensitivity * 2)) && !arg.touchButtonPressed && !tappedOnce)
|
||||||
if (Math.Abs(firstTouch.hwX - arg.touches[0].hwX) < 10 && Math.Abs(firstTouch.hwY - arg.touches[0].hwY) < 10)
|
if (Math.Abs(firstTouch.hwX - arg.touches[0].hwX) < 10 && Math.Abs(firstTouch.hwY - arg.touches[0].hwY) < 10)
|
||||||
if (Global.DoubleTap[deviceNum])
|
if (Global.DoubleTap[deviceNum])
|
||||||
{
|
{
|
||||||
@ -149,6 +157,7 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
Mapping.MapClick(deviceNum, Mapping.Click.Left); //this way no delay if disabled
|
Mapping.MapClick(deviceNum, Mapping.Click.Left); //this way no delay if disabled
|
||||||
}
|
}
|
||||||
|
|
||||||
dev.getCurrentState(s);
|
dev.getCurrentState(s);
|
||||||
synthesizeMouseButtons();
|
synthesizeMouseButtons();
|
||||||
}
|
}
|
||||||
@ -174,19 +183,23 @@ namespace DS4Windows
|
|||||||
public bool dragging, dragging2;
|
public bool dragging, dragging2;
|
||||||
private void synthesizeMouseButtons()
|
private void synthesizeMouseButtons()
|
||||||
{
|
{
|
||||||
if (Global.GetDS4Action(deviceNum, DS4Controls.TouchLeft.ToString(), false) == null && leftDown)
|
if (Global.GetDS4Action(deviceNum, DS4Controls.TouchLeft, false) == null && leftDown)
|
||||||
{
|
{
|
||||||
Mapping.MapClick(deviceNum, Mapping.Click.Left);
|
Mapping.MapClick(deviceNum, Mapping.Click.Left);
|
||||||
dragging2 = true;
|
dragging2 = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
dragging2 = false;
|
dragging2 = false;
|
||||||
if (Global.GetDS4Action(deviceNum, DS4Controls.TouchUpper.ToString(), false) == null && upperDown)
|
}
|
||||||
|
|
||||||
|
if (Global.GetDS4Action(deviceNum, DS4Controls.TouchUpper, false) == null && upperDown)
|
||||||
Mapping.MapClick(deviceNum, Mapping.Click.Middle);
|
Mapping.MapClick(deviceNum, Mapping.Click.Middle);
|
||||||
if (Global.GetDS4Action(deviceNum, DS4Controls.TouchRight.ToString(), false) == null && rightDown)
|
if (Global.GetDS4Action(deviceNum, DS4Controls.TouchRight, false) == null && rightDown)
|
||||||
Mapping.MapClick(deviceNum, Mapping.Click.Left);
|
Mapping.MapClick(deviceNum, Mapping.Click.Left);
|
||||||
if (Global.GetDS4Action(deviceNum, DS4Controls.TouchMulti.ToString(), false) == null && multiDown)
|
if (Global.GetDS4Action(deviceNum, DS4Controls.TouchMulti, false) == null && multiDown)
|
||||||
Mapping.MapClick(deviceNum, Mapping.Click.Right);
|
Mapping.MapClick(deviceNum, Mapping.Click.Right);
|
||||||
|
|
||||||
if (!Global.UseTPforControls[deviceNum])
|
if (!Global.UseTPforControls[deviceNum])
|
||||||
{
|
{
|
||||||
if (tappedOnce)
|
if (tappedOnce)
|
||||||
@ -205,8 +218,11 @@ namespace DS4Windows
|
|||||||
dragging = true;
|
dragging = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
dragging = false;
|
dragging = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s = remapped;
|
s = remapped;
|
||||||
//remapped.CopyTo(s);
|
//remapped.CopyTo(s);
|
||||||
}
|
}
|
||||||
@ -231,11 +247,13 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
if ((Global.LowerRCOn[deviceNum] && arg.touches[0].hwX > (1920 * 3) / 4 && arg.touches[0].hwY > (960 * 3) / 4))
|
if ((Global.LowerRCOn[deviceNum] && arg.touches[0].hwX > (1920 * 3) / 4 && arg.touches[0].hwY > (960 * 3) / 4))
|
||||||
Mapping.MapClick(deviceNum, Mapping.Click.Right);
|
Mapping.MapClick(deviceNum, Mapping.Click.Right);
|
||||||
|
|
||||||
if (isLeft(arg.touches[0]))
|
if (isLeft(arg.touches[0]))
|
||||||
leftDown = true;
|
leftDown = true;
|
||||||
else if (isRight(arg.touches[0]))
|
else if (isRight(arg.touches[0]))
|
||||||
rightDown = true;
|
rightDown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev.getCurrentState(s);
|
dev.getCurrentState(s);
|
||||||
synthesizeMouseButtons();
|
synthesizeMouseButtons();
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,14 @@ namespace DS4Windows
|
|||||||
int yAction = (int)yMotion;
|
int yAction = (int)yMotion;
|
||||||
vRemainder += yMotion - yAction;
|
vRemainder += yMotion - yAction;
|
||||||
vRemainder -= (int)vRemainder;
|
vRemainder -= (int)vRemainder;
|
||||||
if (Global.GyroInvert[deviceNumber] == 2 || Global.GyroInvert[deviceNumber] == 3)
|
|
||||||
|
int gyroInvert = Global.GyroInvert[deviceNumber];
|
||||||
|
if (gyroInvert == 2 || gyroInvert == 3)
|
||||||
xAction *= -1;
|
xAction *= -1;
|
||||||
if (Global.GyroInvert[deviceNumber] == 1 || Global.GyroInvert[deviceNumber] == 3)
|
|
||||||
|
if (gyroInvert == 1 || gyroInvert == 3)
|
||||||
yAction *= -1;
|
yAction *= -1;
|
||||||
|
|
||||||
if (yAction != 0 || xAction != 0)
|
if (yAction != 0 || xAction != 0)
|
||||||
InputMethods.MoveCursorBy(xAction, yAction);
|
InputMethods.MoveCursorBy(xAction, yAction);
|
||||||
|
|
||||||
@ -65,8 +69,10 @@ namespace DS4Windows
|
|||||||
private byte lastTouchID;
|
private byte lastTouchID;
|
||||||
public void touchesMoved(TouchpadEventArgs arg, bool dragging)
|
public void touchesMoved(TouchpadEventArgs arg, bool dragging)
|
||||||
{
|
{
|
||||||
if ((!dragging && arg.touches.Length != 1) || (dragging && arg.touches.Length < 1))
|
int touchesLen = arg.touches.Length;
|
||||||
|
if ((!dragging && touchesLen != 1) || (dragging && touchesLen < 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int deltaX, deltaY;
|
int deltaX, deltaY;
|
||||||
if (arg.touches[0].touchID != lastTouchID)
|
if (arg.touches[0].touchID != lastTouchID)
|
||||||
{
|
{
|
||||||
@ -78,8 +84,7 @@ namespace DS4Windows
|
|||||||
else if (Global.TouchpadJitterCompensation[deviceNumber])
|
else if (Global.TouchpadJitterCompensation[deviceNumber])
|
||||||
{
|
{
|
||||||
// Often the DS4's internal jitter compensation kicks in and starts hiding changes, ironically creating jitter...
|
// Often the DS4's internal jitter compensation kicks in and starts hiding changes, ironically creating jitter...
|
||||||
|
if (dragging && touchesLen > 1)
|
||||||
if (dragging && arg.touches.Length > 1)
|
|
||||||
{
|
{
|
||||||
deltaX = arg.touches[1].deltaX;
|
deltaX = arg.touches[1].deltaX;
|
||||||
deltaY = arg.touches[1].deltaY;
|
deltaY = arg.touches[1].deltaY;
|
||||||
@ -89,6 +94,7 @@ namespace DS4Windows
|
|||||||
deltaX = arg.touches[0].deltaX;
|
deltaX = arg.touches[0].deltaX;
|
||||||
deltaY = arg.touches[0].deltaY;
|
deltaY = arg.touches[0].deltaY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow only very fine, slow motions, when changing direction, even from neutral
|
// allow only very fine, slow motions, when changing direction, even from neutral
|
||||||
// TODO maybe just consume it completely?
|
// TODO maybe just consume it completely?
|
||||||
if (deltaX <= -1)
|
if (deltaX <= -1)
|
||||||
@ -127,7 +133,7 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dragging && arg.touches.Length > 1)
|
if (dragging && touchesLen > 1)
|
||||||
{
|
{
|
||||||
deltaX = arg.touches[1].deltaX;
|
deltaX = arg.touches[1].deltaX;
|
||||||
deltaY = arg.touches[1].deltaY;
|
deltaY = arg.touches[1].deltaY;
|
||||||
|
@ -27,6 +27,7 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
if (arg.touches.Length != 2 || dragging)
|
if (arg.touches.Length != 2 || dragging)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Touch lastT0 = arg.touches[0].previousTouch;
|
Touch lastT0 = arg.touches[0].previousTouch;
|
||||||
Touch lastT1 = arg.touches[1].previousTouch;
|
Touch lastT1 = arg.touches[1].previousTouch;
|
||||||
Touch T0 = arg.touches[0];
|
Touch T0 = arg.touches[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user