Merge pull request #5 from Ryochan7/jay

Update to Version 1.4.86
This commit is contained in:
Yuki-nyan 2017-07-21 19:35:49 +01:00 committed by GitHub
commit 86d311b72a
16 changed files with 2849 additions and 3962 deletions

View File

@ -23,7 +23,7 @@ namespace DS4Windows
public DS4StateExposed[] ExposedState = new DS4StateExposed[DS4_CONTROLLER_COUNT]; public DS4StateExposed[] ExposedState = new DS4StateExposed[DS4_CONTROLLER_COUNT];
public bool recordingMacro = false; public bool recordingMacro = false;
public event EventHandler<DebugEventArgs> Debug = null; public event EventHandler<DebugEventArgs> Debug = null;
bool[] buttonsdown = { false, false, false, false }; bool[] buttonsdown = new bool[4] { false, false, false, false };
List<DS4Controls> dcs = new List<DS4Controls>(); List<DS4Controls> dcs = new List<DS4Controls>();
bool[] held = new bool[DS4_CONTROLLER_COUNT]; bool[] held = new bool[DS4_CONTROLLER_COUNT];
int[] oldmouse = new int[DS4_CONTROLLER_COUNT] { -1, -1, -1, -1 }; int[] oldmouse = new int[DS4_CONTROLLER_COUNT] { -1, -1, -1, -1 };
@ -249,7 +249,7 @@ namespace DS4Windows
DS4LightBar.updateLightBar(DS4Controllers[i], i, CurrentState[i], DS4LightBar.updateLightBar(DS4Controllers[i], i, CurrentState[i],
ExposedState[i], touchPad[i]); ExposedState[i], touchPad[i]);
tempDevice.IsRemoved = true; tempDevice.IsRemoved = true;
System.Threading.Thread.Sleep(50); Thread.Sleep(50);
} }
CurrentState[i].Battery = PreviousState[i].Battery = 0; // Reset for the next connection's initial status change. CurrentState[i].Battery = PreviousState[i].Battery = 0; // Reset for the next connection's initial status change.
@ -264,7 +264,7 @@ namespace DS4Windows
} }
if (anyUnplugged) if (anyUnplugged)
System.Threading.Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME); Thread.Sleep(XINPUT_UNPLUG_SETTLE_TIME);
x360Bus.UnplugAll(); x360Bus.UnplugAll();
x360Bus.Stop(); x360Bus.Stop();
@ -691,10 +691,10 @@ namespace DS4Windows
} }
} }
public bool[] lag = { false, false, false, false }; public bool[] lag = new bool[4] { false, false, false, false };
public bool[] inWarnMonitor = { false, false, false, false }; public bool[] inWarnMonitor = new bool[4] { false, false, false, false };
private byte[] currentBattery = { 0, 0, 0, 0 }; private byte[] currentBattery = new byte[4] { 0, 0, 0, 0 };
private bool[] charging = { false, false, false, false }; private bool[] charging = new bool[4] { false, false, false, false };
// Called every time a new input report has arrived // Called every time a new input report has arrived
protected virtual void On_Report(object sender, EventArgs e) protected virtual void On_Report(object sender, EventArgs e)
@ -747,7 +747,7 @@ namespace DS4Windows
} }
} }
device.getExposedState(ExposedState[ind], CurrentState[ind]); device.getCurrentState(CurrentState[ind]);
DS4State cState = CurrentState[ind]; DS4State cState = CurrentState[ind];
device.getPreviousState(PreviousState[ind]); device.getPreviousState(PreviousState[ind]);
DS4State pState = PreviousState[ind]; DS4State pState = PreviousState[ind];
@ -963,9 +963,11 @@ namespace DS4Windows
return result; return result;
} }
public bool[] touchreleased = { true, true, true, true }, touchslid = { false, false, false, false }; public bool[] touchreleased = new bool[4] { true, true, true, true },
public byte[] oldtouchvalue = { 0, 0, 0, 0 }; touchslid = new bool[4] { false, false, false, false };
public int[] oldscrollvalue = { 0, 0, 0, 0 };
public byte[] oldtouchvalue = new byte[4] { 0, 0, 0, 0 };
public int[] oldscrollvalue = new int[4] { 0, 0, 0, 0 };
protected virtual void CheckForTouchToggle(int deviceID, DS4State cState, DS4State pState) protected virtual void CheckForTouchToggle(int deviceID, DS4State cState, DS4State pState)
{ {

View File

@ -21,10 +21,15 @@ namespace DS4Windows
{ 224, 56 }, // on 80% of the time at 80, etc. { 224, 56 }, // on 80% of the time at 80, etc.
{ 252, 28 } // on 90% of the time at 90 { 252, 28 } // on 90% of the time at 90
}; };
static double[] counters = new double[4] { 0, 0, 0, 0 }; static double[] counters = new double[4] { 0, 0, 0, 0 };
public static Stopwatch[] fadewatches = { new Stopwatch(), new Stopwatch(), new Stopwatch(), new Stopwatch() }; public static Stopwatch[] fadewatches = new Stopwatch[4]
{ new Stopwatch(), new Stopwatch(), new Stopwatch(), new Stopwatch() };
static bool[] fadedirection = new bool[4] { false, false, false, false }; static bool[] fadedirection = new bool[4] { false, false, false, false };
static DateTime[] oldnow = { DateTime.UtcNow, DateTime.UtcNow, DateTime.UtcNow, DateTime.UtcNow }; static DateTime[] oldnow = new DateTime[4]
{ DateTime.UtcNow, DateTime.UtcNow, DateTime.UtcNow, DateTime.UtcNow };
public static bool[] forcelight = new bool[4] { false, false, false, false }; public static bool[] forcelight = new bool[4] { false, false, false, false };
public static DS4Color[] forcedColor = new DS4Color[4]; public static DS4Color[] forcedColor = new DS4Color[4];
public static byte[] forcedFlash = new byte[4]; public static byte[] forcedFlash = new byte[4];
@ -291,10 +296,6 @@ namespace DS4Windows
if (tempLightBarOnDuration != haptics.LightBarFlashDurationOn && tempLightBarOnDuration != 1 && haptics.LightBarFlashDurationOn == 0) if (tempLightBarOnDuration != haptics.LightBarFlashDurationOn && tempLightBarOnDuration != 1 && haptics.LightBarFlashDurationOn == 0)
haptics.LightBarFlashDurationOff = haptics.LightBarFlashDurationOn = 1; haptics.LightBarFlashDurationOff = haptics.LightBarFlashDurationOn = 1;
// Comment out code for now. This condition gets hit too often and bogs down the GUI
//if (device.LightBarOnDuration == 1) //helps better reset the color
// System.Threading.Thread.Sleep(5);
device.pushHapticState(haptics); device.pushHapticState(haptics);
} }

View File

@ -90,13 +90,13 @@ namespace DS4Windows
buttons[(int)DS4Controls.TouchUpper] = tp != null ? (!priorMouse ? tp.upperDown : tp.priorUpperDown) : false; buttons[(int)DS4Controls.TouchUpper] = tp != null ? (!priorMouse ? tp.upperDown : tp.priorUpperDown) : false;
buttons[(int)DS4Controls.TouchMulti] = tp != null ? (!priorMouse ? tp.multiDown : tp.priorMultiDown) : false; buttons[(int)DS4Controls.TouchMulti] = tp != null ? (!priorMouse ? tp.multiDown : tp.priorMultiDown) : false;
int gyroX = exposeState.getGyroX(); int sixAxisX = -exposeState.getAccelX();
gryodirs[(int)DS4Controls.GyroXPos] = gyroX > 0 ? gyroX : 0; gryodirs[(int)DS4Controls.GyroXPos] = sixAxisX > 0 ? sixAxisX : 0;
gryodirs[(int)DS4Controls.GyroXNeg] = gyroX < 0 ? gyroX : 0; gryodirs[(int)DS4Controls.GyroXNeg] = sixAxisX < 0 ? sixAxisX : 0;
int gyroZ = exposeState.getGyroZ(); int sixAxisZ = exposeState.getAccelZ();
gryodirs[(int)DS4Controls.GyroZPos] = gyroZ > 0 ? gyroZ : 0; gryodirs[(int)DS4Controls.GyroZPos] = sixAxisZ > 0 ? sixAxisZ : 0;
gryodirs[(int)DS4Controls.GyroZNeg] = gyroZ < 0 ? gyroZ : 0; gryodirs[(int)DS4Controls.GyroZNeg] = sixAxisZ < 0 ? sixAxisZ : 0;
swipedirs[(int)DS4Controls.SwipeLeft] = tp != null ? (!priorMouse ? tp.swipeLeftB : tp.priorSwipeLeftB): (byte)0; swipedirs[(int)DS4Controls.SwipeLeft] = tp != null ? (!priorMouse ? tp.swipeLeftB : tp.priorSwipeLeftB): (byte)0;
swipedirs[(int)DS4Controls.SwipeRight] = tp != null ? (!priorMouse ? tp.swipeRightB : tp.priorSwipeRightB) : (byte)0; swipedirs[(int)DS4Controls.SwipeRight] = tp != null ? (!priorMouse ? tp.swipeRightB : tp.priorSwipeRightB) : (byte)0;

View File

@ -59,7 +59,9 @@ namespace DS4Windows
} }
public static SyntheticState globalState = new SyntheticState(); public static SyntheticState globalState = new SyntheticState();
public static SyntheticState[] deviceState = { new SyntheticState(), new SyntheticState(), new SyntheticState(), new SyntheticState() }; public static SyntheticState[] deviceState = new SyntheticState[4]
{ new SyntheticState(), new SyntheticState(), new SyntheticState(),
new SyntheticState() };
// TODO When we disconnect, process a null/dead state to release any keys or buttons. // TODO When we disconnect, process a null/dead state to release any keys or buttons.
public static DateTime oldnow = DateTime.UtcNow; public static DateTime oldnow = DateTime.UtcNow;
@ -71,25 +73,24 @@ namespace DS4Windows
static bool[] macroControl = new bool[25]; static bool[] macroControl = new bool[25];
//actions //actions
public static int[] fadetimer = { 0, 0, 0, 0 }; public static int[] fadetimer = new int[4] { 0, 0, 0, 0 };
public static int[] prevFadetimer = { 0, 0, 0, 0 }; public static int[] prevFadetimer = new int[4] { 0, 0, 0, 0 };
public static DS4Color[] lastColor = new DS4Color[4]; public static DS4Color[] lastColor = new DS4Color[4];
public static List<ActionState> actionDone = new List<ActionState>(); public static List<ActionState> actionDone = new List<ActionState>();
//public static List<bool>[] actionDone = { new List<bool>(), new List<bool>(), new List<bool>(), new List<bool>() };
//public static bool[,] actionDone = new bool[4, 50];
public static SpecialAction[] untriggeraction = new SpecialAction[4]; public static SpecialAction[] untriggeraction = new SpecialAction[4];
public static DateTime[] nowAction = { DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue }; public static DateTime[] nowAction = { DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue };
public static DateTime[] oldnowAction = { DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue }; public static DateTime[] oldnowAction = { DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue };
public static int[] untriggerindex = { -1, -1, -1, -1 }; public static int[] untriggerindex = new int[4] { -1, -1, -1, -1 };
public static DateTime[] oldnowKeyAct = { DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue }; public static DateTime[] oldnowKeyAct = new DateTime[4] { DateTime.MinValue,
//private static bool tappedOnce = false, firstTouch = false, secondtouchbegin = false; DateTime.MinValue, DateTime.MinValue, DateTime.MinValue };
//private static DateTime pastTime, firstTap, TimeofEnd;
private static DS4Controls[] shiftTriggerMapping = { DS4Controls.None, DS4Controls.Cross, DS4Controls.Circle, DS4Controls.Square, private static DS4Controls[] shiftTriggerMapping = { DS4Controls.None, DS4Controls.Cross, DS4Controls.Circle, DS4Controls.Square,
DS4Controls.Triangle, DS4Controls.Options, DS4Controls.Share, DS4Controls.DpadUp, DS4Controls.DpadDown, DS4Controls.Triangle, DS4Controls.Options, DS4Controls.Share, DS4Controls.DpadUp, DS4Controls.DpadDown,
DS4Controls.DpadLeft, DS4Controls.DpadRight, DS4Controls.PS, DS4Controls.L1, DS4Controls.R1, DS4Controls.L2, DS4Controls.DpadLeft, DS4Controls.DpadRight, DS4Controls.PS, DS4Controls.L1, DS4Controls.R1, DS4Controls.L2,
DS4Controls.R2, DS4Controls.L3, DS4Controls.R3, DS4Controls.TouchLeft, DS4Controls.TouchUpper, DS4Controls.TouchMulti, DS4Controls.R2, DS4Controls.L3, DS4Controls.R3, DS4Controls.TouchLeft, DS4Controls.TouchUpper, DS4Controls.TouchMulti,
DS4Controls.TouchRight, DS4Controls.GyroZNeg, DS4Controls.GyroZPos, DS4Controls.GyroXPos, DS4Controls.GyroXNeg DS4Controls.TouchRight, DS4Controls.GyroZNeg, DS4Controls.GyroZPos, DS4Controls.GyroXPos, DS4Controls.GyroXNeg
}; };
private static int[] ds4ControlMapping = { 0, // DS4Control.None private static int[] ds4ControlMapping = { 0, // DS4Control.None
16, // DS4Controls.LXNeg 16, // DS4Controls.LXNeg
20, // DS4Controls.LXPos 20, // DS4Controls.LXPos
@ -128,13 +129,16 @@ namespace DS4Windows
// Define here to save some time processing. // Define here to save some time processing.
// It is enough to feel a difference during gameplay. // It is enough to feel a difference during gameplay.
private static int[] rsOutCurveModeArray = { 0, 0, 0, 0 }; private static int[] rsOutCurveModeArray = new int[4] { 0, 0, 0, 0 };
private static int[] lsOutCurveModeArray = { 0, 0, 0, 0 }; private static int[] lsOutCurveModeArray = new int[4] { 0, 0, 0, 0 };
static bool tempBool = false; static bool tempBool = false;
private static double[] tempDoubleArray = new double[4] { 0.0, 0.0, 0.0, 0.0 };
private static int[] tempIntArray = new int[4] { 0, 0, 0, 0 };
// Special macros // Special macros
static bool altTabDone = true; static bool altTabDone = true;
static DateTime altTabNow = DateTime.UtcNow, oldAltTabNow = DateTime.UtcNow - TimeSpan.FromSeconds(1); static DateTime altTabNow = DateTime.UtcNow,
oldAltTabNow = DateTime.UtcNow - TimeSpan.FromSeconds(1);
// Mouse // Mouse
public static int mcounter = 34; public static int mcounter = 34;
@ -347,6 +351,7 @@ namespace DS4Windows
} }
state.SavePrevious(true); state.SavePrevious(true);
} }
public enum Click { None, Left, Middle, Right, Fourth, Fifth, WUP, WDOWN }; public enum Click { None, Left, Middle, Right, Fourth, Fifth, WUP, WDOWN };
public static void MapClick(int device, Click mouseClick) public static void MapClick(int device, Click mouseClick)
{ {
@ -394,31 +399,19 @@ namespace DS4Windows
return value1 * percent + value2 * (1 - percent); return value1 * percent + value2 * (1 - percent);
} }
/*static double Clamp(double min, double value, double max)
{
if (value > max)
return max;
else if (value < min)
return min;
else
return value;
}
*/
private static int ClampInt(int min, int value, int max) private static int ClampInt(int min, int value, int max)
{ {
return (value < min) ? min : (value > max) ? max : value; return (value < min) ? min : (value > max) ? max : value;
} }
private static double[] tempDoubleArray = { 0.0, 0.0, 0.0, 0.0 };
public static DS4State SetCurveAndDeadzone(int device, DS4State cState) public static DS4State SetCurveAndDeadzone(int device, DS4State cState)
{ {
double rotation = tempDoubleArray[device] = getLSRotation(device); double rotation = tempDoubleArray[device] = getLSRotation(device);
if (rotation != 0.0) if (rotation > 0.0 || rotation < 0.0)
cState.rotateLSCoordinates(rotation); cState.rotateLSCoordinates(rotation);
double rotationRS = tempDoubleArray[device] = getRSRotation(device); double rotationRS = tempDoubleArray[device] = getRSRotation(device);
if (rotationRS != 0.0) if (rotationRS > 0.0 || rotationRS < 0.0)
cState.rotateRSCoordinates(rotationRS); cState.rotateRSCoordinates(rotationRS);
DS4State dState = new DS4State(cState); DS4State dState = new DS4State(cState);
@ -442,7 +435,6 @@ namespace DS4Windows
{ {
curvex = (x > 127.5f ? Math.Min(x, (x / max) * multimax) : Math.Max(x, (x / max) * multimin)); curvex = (x > 127.5f ? Math.Min(x, (x / max) * multimax) : Math.Max(x, (x / max) * multimin));
curvey = (y > 127.5f ? Math.Min(y, (y / max) * multimax) : Math.Max(y, (y / max) * multimin)); curvey = (y > 127.5f ? Math.Min(y, (y / max) * multimax) : Math.Max(y, (y / max) * multimin));
//btnLSTrack.Location = new Point((int)(dpix * curvex / 2.09 + lbLSTrack.Location.X), (int)(dpiy * curvey / 2.09 + lbLSTrack.Location.Y));
} }
else else
{ {
@ -511,17 +503,17 @@ namespace DS4Windows
} }
else if ((lsDeadzone > 0 && lsSquared > lsDeadzoneSquared) || lsAntiDead > 0 || lsMaxZone != 100) else if ((lsDeadzone > 0 && lsSquared > lsDeadzoneSquared) || lsAntiDead > 0 || lsMaxZone != 100)
{ {
double r = Math.Atan2(-(dState.LY - 127.5f), (dState.LX - 127.5f)); double r = Math.Atan2(-(dState.LY - 127.5), (dState.LX - 127.5));
double maxXValue = dState.LX >= 127.5 ? 127.5 : -127.5; double maxXValue = dState.LX >= 127.5 ? 127.5 : -127.5;
double maxYValue = dState.LY >= 127.5 ? 127.5 : -127.5; double maxYValue = dState.LY >= 127.5 ? 127.5 : -127.5;
double ratio = lsMaxZone / 100.0; double ratio = lsMaxZone / 100.0;
double maxZoneXNegValue = (ratio * -127.5f) + 127.5f; double maxZoneXNegValue = (ratio * -127.5) + 127.5;
double maxZoneXPosValue = (ratio * 127.5f) + 127.5f; double maxZoneXPosValue = (ratio * 127.5) + 127.5;
double maxZoneYNegValue = maxZoneXNegValue; double maxZoneYNegValue = maxZoneXNegValue;
double maxZoneYPosValue = maxZoneXPosValue; double maxZoneYPosValue = maxZoneXPosValue;
double maxZoneX = dState.LX >= 127.5 ? (maxZoneXPosValue - 127.5f) : (maxZoneXNegValue - 127.5f); double maxZoneX = dState.LX >= 127.5 ? (maxZoneXPosValue - 127.5) : (maxZoneXNegValue - 127.5);
double maxZoneY = dState.LY >= 127.5 ? (maxZoneYPosValue - 127.5f) : (maxZoneYNegValue - 127.5f); double maxZoneY = dState.LY >= 127.5 ? (maxZoneYPosValue - 127.5) : (maxZoneYNegValue - 127.5);
double tempLsXDead = 0.0, tempLsYDead = 0.0; double tempLsXDead = 0.0, tempLsYDead = 0.0;
double tempOutputX = 0.0, tempOutputY = 0.0; double tempOutputX = 0.0, tempOutputY = 0.0;
@ -534,18 +526,16 @@ namespace DS4Windows
{ {
double currentX = Global.Clamp(maxZoneXNegValue, dState.LX, maxZoneXPosValue); double currentX = Global.Clamp(maxZoneXNegValue, dState.LX, maxZoneXPosValue);
double currentY = Global.Clamp(maxZoneYNegValue, dState.LY, maxZoneYPosValue); double currentY = Global.Clamp(maxZoneYNegValue, dState.LY, maxZoneYPosValue);
//currentX = (byte)((dState.LX >= 127.5f) ? Math.Min(dState.LX, maxZoneX) : Math.Max(dState.LX, maxZoneX)); tempOutputX = ((currentX - 127.5 - tempLsXDead) / (maxZoneX - tempLsXDead));
//currentY = (byte)((dState.LY >= 127.5f) ? Math.Min(dState.LY, maxZoneY) : Math.Max(dState.LY, maxZoneY)); tempOutputY = ((currentY - 127.5 - tempLsYDead) / (maxZoneY - tempLsYDead));
tempOutputX = ((currentX - 127.5f - tempLsXDead) / (double)(maxZoneX - tempLsXDead));
tempOutputY = ((currentY - 127.5f - tempLsYDead) / (double)(maxZoneY - tempLsYDead));
} }
} }
else else
{ {
double currentX = Global.Clamp(maxZoneXNegValue, dState.LX, maxZoneXPosValue); double currentX = Global.Clamp(maxZoneXNegValue, dState.LX, maxZoneXPosValue);
double currentY = Global.Clamp(maxZoneYNegValue, dState.LY, maxZoneYPosValue); double currentY = Global.Clamp(maxZoneYNegValue, dState.LY, maxZoneYPosValue);
tempOutputX = (currentX - 127.5f) / (double)(maxZoneX); tempOutputX = (currentX - 127.5) / maxZoneX;
tempOutputY = (currentY - 127.5f) / (double)(maxZoneY); tempOutputY = (currentY - 127.5) / maxZoneY;
} }
double tempLsXAntiDeadPercent = 0.0, tempLsYAntiDeadPercent = 0.0; double tempLsXAntiDeadPercent = 0.0, tempLsYAntiDeadPercent = 0.0;
@ -557,7 +547,7 @@ namespace DS4Windows
if (tempOutputX > 0.0) if (tempOutputX > 0.0)
{ {
dState.LX = (byte)((((1.0 - tempLsXAntiDeadPercent) * tempOutputX + tempLsXAntiDeadPercent)) * maxXValue + 127.5f); dState.LX = (byte)((((1.0 - tempLsXAntiDeadPercent) * tempOutputX + tempLsXAntiDeadPercent)) * maxXValue + 127.5);
} }
else else
{ {
@ -566,7 +556,7 @@ namespace DS4Windows
if (tempOutputY > 0.0) if (tempOutputY > 0.0)
{ {
dState.LY = (byte)((((1.0 - tempLsYAntiDeadPercent) * tempOutputY + tempLsYAntiDeadPercent)) * maxYValue + 127.5f); dState.LY = (byte)((((1.0 - tempLsYAntiDeadPercent) * tempOutputY + tempLsYAntiDeadPercent)) * maxYValue + 127.5);
} }
else else
{ {
@ -580,7 +570,7 @@ namespace DS4Windows
int rsMaxZone = getRSMaxzone(device); int rsMaxZone = getRSMaxzone(device);
if (rsDeadzone > 0 || rsAntiDead > 0 || rsMaxZone != 100) if (rsDeadzone > 0 || rsAntiDead > 0 || rsMaxZone != 100)
{ {
double rsSquared = Math.Pow(cState.RX - 127.5f, 2) + Math.Pow(cState.RY - 127.5f, 2); double rsSquared = Math.Pow(cState.RX - 127.5, 2) + Math.Pow(cState.RY - 127.5, 2);
double rsDeadzoneSquared = Math.Pow(rsDeadzone, 2); double rsDeadzoneSquared = Math.Pow(rsDeadzone, 2);
if (rsDeadzone > 0 && rsSquared <= rsDeadzoneSquared) if (rsDeadzone > 0 && rsSquared <= rsDeadzoneSquared)
{ {
@ -589,17 +579,17 @@ namespace DS4Windows
} }
else if ((rsDeadzone > 0 && rsSquared > rsDeadzoneSquared) || rsAntiDead > 0 || rsMaxZone != 100) else if ((rsDeadzone > 0 && rsSquared > rsDeadzoneSquared) || rsAntiDead > 0 || rsMaxZone != 100)
{ {
double r = Math.Atan2(-(dState.RY - 127.5f), (dState.RX - 127.5f)); double r = Math.Atan2(-(dState.RY - 127.5), (dState.RX - 127.5));
double maxXValue = dState.RX >= 127.5 ? 127.5 : -127.5; double maxXValue = dState.RX >= 127.5 ? 127.5 : -127.5;
double maxYValue = dState.RY >= 127.5 ? 127.5 : -127.5; double maxYValue = dState.RY >= 127.5 ? 127.5 : -127.5;
double ratio = rsMaxZone / 100.0; double ratio = rsMaxZone / 100.0;
double maxZoneXNegValue = (ratio * -127.5f) + 127.5f; double maxZoneXNegValue = (ratio * -127.5) + 127.5;
double maxZoneXPosValue = (ratio * 127.5f) + 127.5f; double maxZoneXPosValue = (ratio * 127.5) + 127.5;
double maxZoneYNegValue = maxZoneXNegValue; double maxZoneYNegValue = maxZoneXNegValue;
double maxZoneYPosValue = maxZoneXPosValue; double maxZoneYPosValue = maxZoneXPosValue;
double maxZoneX = dState.RX >= 127.5 ? (maxZoneXPosValue - 127.5f) : (maxZoneXNegValue - 127.5f); double maxZoneX = dState.RX >= 127.5 ? (maxZoneXPosValue - 127.5) : (maxZoneXNegValue - 127.5);
double maxZoneY = dState.RY >= 127.5 ? (maxZoneYPosValue - 127.5f) : (maxZoneYNegValue - 127.5f); double maxZoneY = dState.RY >= 127.5 ? (maxZoneYPosValue - 127.5) : (maxZoneYNegValue - 127.5);
double tempRsXDead = 0.0, tempRsYDead = 0.0; double tempRsXDead = 0.0, tempRsYDead = 0.0;
double tempOutputX = 0.0, tempOutputY = 0.0; double tempOutputX = 0.0, tempOutputY = 0.0;
@ -613,10 +603,8 @@ namespace DS4Windows
double currentX = Global.Clamp(maxZoneXNegValue, dState.RX, maxZoneXPosValue); double currentX = Global.Clamp(maxZoneXNegValue, dState.RX, maxZoneXPosValue);
double currentY = Global.Clamp(maxZoneYNegValue, dState.RY, maxZoneYPosValue); double currentY = Global.Clamp(maxZoneYNegValue, dState.RY, maxZoneYPosValue);
tempOutputX = ((currentX - 127.5f - tempRsXDead) / (double)(maxZoneX - tempRsXDead)); tempOutputX = ((currentX - 127.5 - tempRsXDead) / (maxZoneX - tempRsXDead));
tempOutputY = ((currentY - 127.5f - tempRsYDead) / (double)(maxZoneY - tempRsYDead)); tempOutputY = ((currentY - 127.5 - tempRsYDead) / (maxZoneY - tempRsYDead));
//tempOutputX = ((dState.RX - 127.5f - tempRsXDead) / (double)(maxXValue - tempRsXDead));
//tempOutputY = ((dState.RY - 127.5f - tempRsYDead) / (double)(maxYValue - tempRsYDead));
} }
} }
else else
@ -624,10 +612,8 @@ namespace DS4Windows
double currentX = Global.Clamp(maxZoneXNegValue, dState.RX, maxZoneXPosValue); double currentX = Global.Clamp(maxZoneXNegValue, dState.RX, maxZoneXPosValue);
double currentY = Global.Clamp(maxZoneYNegValue, dState.RY, maxZoneYPosValue); double currentY = Global.Clamp(maxZoneYNegValue, dState.RY, maxZoneYPosValue);
tempOutputX = (currentX - 127.5f) / (double)(maxZoneX); tempOutputX = (currentX - 127.5) / maxZoneX;
tempOutputY = (currentY - 127.5f) / (double)(maxZoneY); tempOutputY = (currentY - 127.5) / maxZoneY;
//tempOutputX = ((dState.RX - 127.5f) / (double)(maxXValue));
//tempOutputY = ((dState.RY - 127.5f) / (double)(maxYValue));
} }
double tempRsXAntiDeadPercent = 0.0, tempRsYAntiDeadPercent = 0.0; double tempRsXAntiDeadPercent = 0.0, tempRsYAntiDeadPercent = 0.0;
@ -639,7 +625,7 @@ namespace DS4Windows
if (tempOutputX > 0.0) if (tempOutputX > 0.0)
{ {
dState.RX = (byte)((((1.0 - tempRsXAntiDeadPercent) * tempOutputX + tempRsXAntiDeadPercent)) * maxXValue + 127.5f); dState.RX = (byte)((((1.0 - tempRsXAntiDeadPercent) * tempOutputX + tempRsXAntiDeadPercent)) * maxXValue + 127.5);
} }
else else
{ {
@ -648,7 +634,7 @@ namespace DS4Windows
if (tempOutputY > 0.0) if (tempOutputY > 0.0)
{ {
dState.RY = (byte)((((1.0 - tempRsYAntiDeadPercent) * tempOutputY + tempRsYAntiDeadPercent)) * maxYValue + 127.5f); dState.RY = (byte)((((1.0 - tempRsYAntiDeadPercent) * tempOutputY + tempRsYAntiDeadPercent)) * maxYValue + 127.5);
} }
else else
{ {
@ -662,17 +648,17 @@ namespace DS4Windows
int l2Maxzone = getL2Maxzone(device); int l2Maxzone = getL2Maxzone(device);
if (l2Deadzone > 0 || l2AntiDeadzone > 0 || l2Maxzone != 100) if (l2Deadzone > 0 || l2AntiDeadzone > 0 || l2Maxzone != 100)
{ {
double tempL2Output = (cState.L2 / 255.0); double tempL2Output = cState.L2 / 255.0;
double tempL2AntiDead = 0.0; double tempL2AntiDead = 0.0;
double ratio = (l2Maxzone / 100.0); double ratio = l2Maxzone / 100.0;
double maxValue = 255 * ratio; double maxValue = 255.0 * ratio;
if (l2Deadzone > 0) if (l2Deadzone > 0)
{ {
if (cState.L2 > l2Deadzone) if (cState.L2 > l2Deadzone)
{ {
double current = Global.Clamp(0, dState.L2, maxValue); double current = Global.Clamp(0, dState.L2, maxValue);
tempL2Output = ((current - l2Deadzone) / (double)(maxValue - l2Deadzone)); tempL2Output = (current - l2Deadzone) / (maxValue - l2Deadzone);
} }
else else
{ {
@ -687,7 +673,7 @@ namespace DS4Windows
if (tempL2Output > 0.0) if (tempL2Output > 0.0)
{ {
dState.L2 = (byte)(((1.0 - tempL2AntiDead) * tempL2Output + tempL2AntiDead) * 255); dState.L2 = (byte)(((1.0 - tempL2AntiDead) * tempL2Output + tempL2AntiDead) * 255.0);
} }
else else
{ {
@ -700,9 +686,9 @@ namespace DS4Windows
int r2Maxzone = getR2Maxzone(device); int r2Maxzone = getR2Maxzone(device);
if (r2Deadzone > 0 || r2AntiDeadzone > 0 || r2Maxzone != 100) if (r2Deadzone > 0 || r2AntiDeadzone > 0 || r2Maxzone != 100)
{ {
double tempR2Output = (cState.R2 / 255.0); double tempR2Output = cState.R2 / 255.0;
double tempR2AntiDead = 0.0; double tempR2AntiDead = 0.0;
double ratio = (r2Maxzone / 100.0); double ratio = r2Maxzone / 100.0;
double maxValue = 255 * ratio; double maxValue = 255 * ratio;
if (r2Deadzone > 0) if (r2Deadzone > 0)
@ -710,7 +696,7 @@ namespace DS4Windows
if (cState.R2 > r2Deadzone) if (cState.R2 > r2Deadzone)
{ {
double current = Global.Clamp(0, dState.R2, maxValue); double current = Global.Clamp(0, dState.R2, maxValue);
tempR2Output = ((current - r2Deadzone) / (double)(maxValue - r2Deadzone)); tempR2Output = (current - r2Deadzone) / (maxValue - r2Deadzone);
} }
else else
{ {
@ -725,7 +711,7 @@ namespace DS4Windows
if (tempR2Output > 0.0) if (tempR2Output > 0.0)
{ {
dState.R2 = (byte)(((1.0 - tempR2AntiDead) * tempR2Output + tempR2AntiDead) * 255); dState.R2 = (byte)(((1.0 - tempR2AntiDead) * tempR2Output + tempR2AntiDead) * 255.0);
} }
else else
{ {
@ -736,15 +722,15 @@ namespace DS4Windows
double lsSens = getLSSens(device); double lsSens = getLSSens(device);
if (lsSens != 1.0) if (lsSens != 1.0)
{ {
dState.LX = (byte)Global.Clamp(0, lsSens * (dState.LX - 127.5f) + 127.5f, 255); dState.LX = (byte)Global.Clamp(0, lsSens * (dState.LX - 127.5) + 127.5, 255);
dState.LY = (byte)Global.Clamp(0, lsSens * (dState.LY - 127.5f) + 127.5f, 255); dState.LY = (byte)Global.Clamp(0, lsSens * (dState.LY - 127.5) + 127.5, 255);
} }
double rsSens = getRSSens(device); double rsSens = getRSSens(device);
if (rsSens != 1.0) if (rsSens != 1.0)
{ {
dState.RX = (byte)Global.Clamp(0, rsSens * (dState.RX - 127.5f) + 127.5f, 255); dState.RX = (byte)Global.Clamp(0, rsSens * (dState.RX - 127.5) + 127.5, 255);
dState.RY = (byte)Global.Clamp(0, rsSens * (dState.RY - 127.5f) + 127.5f, 255); dState.RY = (byte)Global.Clamp(0, rsSens * (dState.RY - 127.5) + 127.5, 255);
} }
double l2Sens = getL2Sens(device); double l2Sens = getL2Sens(device);
@ -756,10 +742,10 @@ namespace DS4Windows
dState.R2 = (byte)Global.Clamp(0, r2Sens * dState.R2, 255); dState.R2 = (byte)Global.Clamp(0, r2Sens * dState.R2, 255);
int lsOutCurveMode = lsOutCurveModeArray[device] = getLsOutCurveMode(device); int lsOutCurveMode = lsOutCurveModeArray[device] = getLsOutCurveMode(device);
if (lsOutCurveMode != 0) if (lsOutCurveMode > 0)
{ {
double tempX = (dState.LX - 127.5f) / 127.5; double tempX = (dState.LX - 127.5) / 127.5;
double tempY = (dState.LY - 127.5f) / 127.5; double tempY = (dState.LY - 127.5) / 127.5;
double signX = tempX >= 0.0 ? 1.0 : -1.0; double signX = tempX >= 0.0 ? 1.0 : -1.0;
double signY = tempY >= 0.0 ? 1.0 : -1.0; double signY = tempY >= 0.0 ? 1.0 : -1.0;
@ -796,30 +782,30 @@ namespace DS4Windows
outputY = (absY * 1.992) - 0.992; outputY = (absY * 1.992) - 0.992;
} }
dState.LX = (byte)(outputX * signX * 127.5f + 127.5f); dState.LX = (byte)(outputX * signX * 127.5 + 127.5);
dState.LY = (byte)(outputY * signY * 127.5f + 127.5f); dState.LY = (byte)(outputY * signY * 127.5 + 127.5);
} }
else if (lsOutCurveMode == 2) else if (lsOutCurveMode == 2)
{ {
double outputX = tempX * tempX; double outputX = tempX * tempX;
double outputY = tempY * tempY; double outputY = tempY * tempY;
dState.LX = (byte)(outputX * signX * 127.5f + 127.5f); dState.LX = (byte)(outputX * signX * 127.5 + 127.5);
dState.LY = (byte)(outputY * signY * 127.5f + 127.5f); dState.LY = (byte)(outputY * signY * 127.5 + 127.5);
} }
else if (lsOutCurveMode == 3) else if (lsOutCurveMode == 3)
{ {
double outputX = tempX * tempX * tempX; double outputX = tempX * tempX * tempX;
double outputY = tempY * tempY * tempY; double outputY = tempY * tempY * tempY;
dState.LX = (byte)(outputX * 127.5f + 127.5f); dState.LX = (byte)(outputX * 127.5 + 127.5);
dState.LY = (byte)(outputY * 127.5f + 127.5f); dState.LY = (byte)(outputY * 127.5 + 127.5);
} }
} }
int rsOutCurveMode = rsOutCurveModeArray[device] = getRsOutCurveMode(device); int rsOutCurveMode = rsOutCurveModeArray[device] = getRsOutCurveMode(device);
if (rsOutCurveMode != 0) if (rsOutCurveMode > 0)
{ {
double tempX = (dState.RX - 127.5f) / 127.5; double tempX = (dState.RX - 127.5) / 127.5;
double tempY = (dState.RY - 127.5f) / 127.5; double tempY = (dState.RY - 127.5) / 127.5;
double signX = tempX >= 0.0 ? 1.0 : -1.0; double signX = tempX >= 0.0 ? 1.0 : -1.0;
double signY = tempY >= 0.0 ? 1.0 : -1.0; double signY = tempY >= 0.0 ? 1.0 : -1.0;
@ -856,22 +842,144 @@ namespace DS4Windows
outputY = (absY * 1.992) - 0.992; outputY = (absY * 1.992) - 0.992;
} }
dState.RX = (byte)(outputX * signX * 127.5f + 127.5f); dState.RX = (byte)(outputX * signX * 127.5 + 127.5);
dState.RY = (byte)(outputY * signY * 127.5f + 127.5f); dState.RY = (byte)(outputY * signY * 127.5 + 127.5);
} }
else if (rsOutCurveMode == 2) else if (rsOutCurveMode == 2)
{ {
double outputX = tempX * tempX; double outputX = tempX * tempX;
double outputY = tempY * tempY; double outputY = tempY * tempY;
dState.RX = (byte)(outputX * signX * 127.5f + 127.5f); dState.RX = (byte)(outputX * signX * 127.5 + 127.5);
dState.RY = (byte)(outputY * signY * 127.5f + 127.5f); dState.RY = (byte)(outputY * signY * 127.5 + 127.5);
} }
else if (rsOutCurveMode == 3) else if (rsOutCurveMode == 3)
{ {
double outputX = tempX * tempX * tempX; double outputX = tempX * tempX * tempX;
double outputY = tempY * tempY * tempY; double outputY = tempY * tempY * tempY;
dState.RX = (byte)(outputX * 127.5f + 127.5f); dState.RX = (byte)(outputX * 127.5 + 127.5);
dState.RY = (byte)(outputY * 127.5f + 127.5f); dState.RY = (byte)(outputY * 127.5 + 127.5);
}
}
int l2OutCurveMode = tempIntArray[device] = getL2OutCurveMode(device);
if (l2OutCurveMode > 0)
{
double temp = dState.L2 / 255.0;
if (l2OutCurveMode == 1)
{
double output = temp * temp;
dState.L2 = (byte)(output * 255.0);
}
else if (l2OutCurveMode == 2)
{
double output = temp * temp * temp;
dState.L2 = (byte)(output * 255.0);
}
}
int r2OutCurveMode = tempIntArray[device] = getR2OutCurveMode(device);
if (r2OutCurveMode > 0)
{
double temp = dState.R2 / 255.0;
if (r2OutCurveMode == 1)
{
double output = temp * temp;
dState.R2 = (byte)(output * 255.0);
}
else if (r2OutCurveMode == 2)
{
double output = temp * temp * temp;
dState.R2 = (byte)(output * 255.0);
}
}
bool sOff = tempBool = isUsingSAforMouse(device);
if (sOff == false)
{
int SXD = (int)(10d * getSXDeadzone(device));
int SZD = (int)(10d * getSZDeadzone(device));
double SXMax = getSXMaxzone(device);
double SZMax = getSZMaxzone(device);
double sxAntiDead = getSXAntiDeadzone(device);
double szAntiDead = getSZAntiDeadzone(device);
double sxsens = getSXSens(device);
double szsens = getSZSens(device);
int gyroX = cState.Motion.accelX, gyroZ = cState.Motion.accelZ;
int absx = Math.Abs(gyroX), absz = Math.Abs(gyroZ);
if (SXD > 0 || SXMax < 1.0 || sxAntiDead > 0)
{
int maxValue = (int)(SXMax * 128d);
if (absx > SXD)
{
double ratioX = absx < maxValue ? (absx - SXD) / (double)(maxValue - SXD) : 1.0;
dState.Motion.accelX = Math.Sign(gyroX) *
(int)Math.Min(128d, sxsens * 128d * ((1.0 - sxAntiDead) * ratioX + sxAntiDead));
}
else
{
dState.Motion.accelX = 0;
}
}
else
{
dState.Motion.accelX = Math.Sign(gyroX) *
(int)Math.Min(128d, sxsens * 128d * (absx / 128d));
}
if (SZD > 0 || SZMax < 1.0 || szAntiDead > 0)
{
int maxValue = (int)(SZMax * 128d);
if (absz > SZD)
{
double ratioZ = absz < maxValue ? (absz - SZD) / (double)(maxValue - SZD) : 1.0;
dState.Motion.accelZ = Math.Sign(gyroZ) *
(int)Math.Min(128d, szsens * 128d * ((1.0 - szAntiDead) * ratioZ + szAntiDead));
}
else
{
dState.Motion.accelZ = 0;
}
}
else
{
dState.Motion.accelZ = Math.Sign(gyroZ) *
(int)Math.Min(128d, szsens * 128d * (absz / 128d));
}
int sxOutCurveMode = tempIntArray[device] = getSXOutCurveMode(device);
if (sxOutCurveMode > 0)
{
double temp = Math.Abs(dState.Motion.accelX) / 128.0;
double sign = Math.Sign(temp);
if (sxOutCurveMode == 1)
{
double output = temp * temp;
dState.Motion.accelX = (byte)(output * sign * 128.0);
}
else if (sxOutCurveMode == 2)
{
double output = temp * temp * temp;
dState.Motion.accelX = (byte)(output * 128.0);
}
}
int szOutCurveMode = tempIntArray[device] = getSZOutCurveMode(device);
if (szOutCurveMode > 0)
{
double temp = Math.Abs(dState.Motion.accelZ) / 128.0;
double sign = Math.Sign(temp);
if (szOutCurveMode == 1)
{
double output = temp * temp;
dState.Motion.accelZ = (byte)(output * sign * 128.0);
}
else if (szOutCurveMode == 2)
{
double output = temp * temp * temp;
dState.Motion.accelZ = (byte)(output * 128.0);
}
} }
} }
@ -916,6 +1024,7 @@ namespace DS4Windows
X360Controls x3c; X360Controls x3c;
if (Enum.TryParse(key, true, out x3c)) if (Enum.TryParse(key, true, out x3c))
return x3c; return x3c;
switch (key) switch (key)
{ {
case "Back": return X360Controls.Back; case "Back": return X360Controls.Back;
@ -959,8 +1068,9 @@ namespace DS4Windows
case "Mouse Left": return X360Controls.MouseLeft; case "Mouse Left": return X360Controls.MouseLeft;
case "Mouse Right": return X360Controls.MouseRight; case "Mouse Right": return X360Controls.MouseRight;
case "Unbound": return X360Controls.Unbound; case "Unbound": return X360Controls.Unbound;
default: break;
} }
return X360Controls.Unbound; return X360Controls.Unbound;
} }
@ -1036,7 +1146,6 @@ namespace DS4Windows
} }
else if (actionType == DS4ControlSettings.ActionType.Key) else if (actionType == DS4ControlSettings.ActionType.Key)
{ {
//ushort value = ushort.Parse(action.ToString());
ushort value = Convert.ToUInt16(action); ushort value = Convert.ToUInt16(action);
if (getBoolActionMapping2(device, dcs.control, cState, eState, tp, fieldMapping)) if (getBoolActionMapping2(device, dcs.control, cState, eState, tp, fieldMapping))
{ {
@ -1331,28 +1440,28 @@ namespace DS4Windows
if (macroControl[24]) MappedState.RY = 0; if (macroControl[24]) MappedState.RY = 0;
if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.LXNeg), device, cState, eState, tp, fieldMapping), DS4Controls.LXNeg)) if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.LXNeg), device, cState, eState, tp, fieldMapping), DS4Controls.LXNeg))
tempControlDict.Add(DS4Controls.LXNeg, DS4Controls.LXNeg); tempControlDict[DS4Controls.LXNeg] = DS4Controls.LXNeg;
if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.LXPos), device, cState, eState, tp, fieldMapping), DS4Controls.LXPos)) if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.LXPos), device, cState, eState, tp, fieldMapping), DS4Controls.LXPos))
tempControlDict.Add(DS4Controls.LXPos, DS4Controls.LXPos); tempControlDict[DS4Controls.LXPos] = DS4Controls.LXPos;
if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.LYNeg), device, cState, eState, tp, fieldMapping), DS4Controls.LYNeg)) if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.LYNeg), device, cState, eState, tp, fieldMapping), DS4Controls.LYNeg))
tempControlDict.Add(DS4Controls.LYNeg, DS4Controls.LYNeg); tempControlDict[DS4Controls.LYNeg] = DS4Controls.LYNeg;
if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.LYPos), device, cState, eState, tp, fieldMapping), DS4Controls.LYPos)) if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.LYPos), device, cState, eState, tp, fieldMapping), DS4Controls.LYPos))
tempControlDict.Add(DS4Controls.LYPos, DS4Controls.LYPos); tempControlDict[DS4Controls.LYPos] = DS4Controls.LYPos;
if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.RXNeg), device, cState, eState, tp, fieldMapping), DS4Controls.RXNeg)) if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.RXNeg), device, cState, eState, tp, fieldMapping), DS4Controls.RXNeg))
tempControlDict.Add(DS4Controls.RXNeg, DS4Controls.RXNeg); tempControlDict[DS4Controls.RXNeg] = DS4Controls.RXNeg;
if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.RXPos), device, cState, eState, tp, fieldMapping), DS4Controls.RXPos)) if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.RXPos), device, cState, eState, tp, fieldMapping), DS4Controls.RXPos))
tempControlDict.Add(DS4Controls.RXPos, DS4Controls.RXPos); tempControlDict[DS4Controls.RXPos] = DS4Controls.RXPos;
if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.RYNeg), device, cState, eState, tp, fieldMapping), DS4Controls.RYNeg)) if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.RYNeg), device, cState, eState, tp, fieldMapping), DS4Controls.RYNeg))
tempControlDict.Add(DS4Controls.RYNeg, DS4Controls.RYNeg); tempControlDict[DS4Controls.RYNeg] = DS4Controls.RYNeg;
if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.RYPos), device, cState, eState, tp, fieldMapping), DS4Controls.RYPos)) if (IfAxisIsNotModified(device, ShiftTrigger2(GetDS4STrigger(device, DS4Controls.RYPos), device, cState, eState, tp, fieldMapping), DS4Controls.RYPos))
tempControlDict.Add(DS4Controls.RYPos, DS4Controls.RYPos); tempControlDict[DS4Controls.RYPos] = DS4Controls.RYPos;
Dictionary<DS4Controls, DS4Controls>.KeyCollection controlKeys = tempControlDict.Keys; Dictionary<DS4Controls, DS4Controls>.KeyCollection controlKeys = tempControlDict.Keys;
//Dictionary<DS4Controls, List<DS4Controls>>.KeyCollection controlKeys = tempControlDict.Keys; //Dictionary<DS4Controls, List<DS4Controls>>.KeyCollection controlKeys = tempControlDict.Keys;
@ -2483,33 +2592,33 @@ namespace DS4Windows
} }
else if (controlType == DS4StateFieldMapping.ControlType.GyroDir) else if (controlType == DS4StateFieldMapping.ControlType.GyroDir)
{ {
double SXD = getSXDeadzone(device); //double SXD = getSXDeadzone(device);
double SZD = getSZDeadzone(device); //double SZD = getSZDeadzone(device);
switch (control) switch (control)
{ {
case DS4Controls.GyroXPos: case DS4Controls.GyroXPos:
{ {
int gyroX = fieldMapping.gryodirs[controlNum]; int gyroX = fieldMapping.gryodirs[controlNum];
value = (byte)(gyroX > SXD * 10 ? Math.Pow(root + speed / divide, gyroX) : 0); value = (byte)(gyroX > 0 ? Math.Pow(root + speed / divide, gyroX) : 0);
break; break;
} }
case DS4Controls.GyroXNeg: case DS4Controls.GyroXNeg:
{ {
int gyroX = fieldMapping.gryodirs[controlNum]; int gyroX = fieldMapping.gryodirs[controlNum];
value = (byte)(gyroX < -SXD * 10 ? Math.Pow(root + speed / divide, -gyroX) : 0); value = (byte)(gyroX < 0 ? Math.Pow(root + speed / divide, -gyroX) : 0);
break; break;
} }
case DS4Controls.GyroZPos: case DS4Controls.GyroZPos:
{ {
int gyroZ = fieldMapping.gryodirs[controlNum]; int gyroZ = fieldMapping.gryodirs[controlNum];
value = (byte)(gyroZ > SZD * 10 ? Math.Pow(root + speed / divide, gyroZ) : 0); value = (byte)(gyroZ > 0 ? Math.Pow(root + speed / divide, gyroZ) : 0);
break; break;
} }
case DS4Controls.GyroZNeg: case DS4Controls.GyroZNeg:
{ {
int gyroZ = fieldMapping.gryodirs[controlNum]; int gyroZ = fieldMapping.gryodirs[controlNum];
value = (byte)(gyroZ < -SZD * 10 ? Math.Pow(root + speed / divide, -gyroZ) : 0); value = (byte)(gyroZ < 0 ? Math.Pow(root + speed / divide, -gyroZ) : 0);
break; break;
} }
default: break; default: break;
@ -2535,7 +2644,7 @@ namespace DS4Windows
mcounter = 34; mcounter = 34;
} }
value *= 1 + (double)Math.Min(20000, (mouseaccel)) / 10000d; value *= 1 + Math.Min(20000, (mouseaccel)) / 10000d;
prevmouseaccel = mouseaccel; prevmouseaccel = mouseaccel;
} }
@ -2633,36 +2742,32 @@ namespace DS4Windows
} }
else if (controlType == DS4StateFieldMapping.ControlType.GyroDir) else if (controlType == DS4StateFieldMapping.ControlType.GyroDir)
{ {
double SXD = getSXDeadzone(device);
double SZD = getSZDeadzone(device);
bool sOff = isUsingSAforMouse(device); bool sOff = isUsingSAforMouse(device);
double sxsens = getSXSens(device);
double szsens = getSZSens(device);
switch (control) switch (control)
{ {
case DS4Controls.GyroXPos: case DS4Controls.GyroXPos:
{ {
int gyroX = fieldMap.gryodirs[controlNum]; int gyroX = fieldMap.gryodirs[controlNum];
result = (byte)(!sOff && sxsens * gyroX > SXD * 10 ? Math.Min(255, sxsens * gyroX * 2) : 0); result = (byte)(sOff == false ? Math.Min(255, gyroX * 2) : 0);
break; break;
} }
case DS4Controls.GyroXNeg: case DS4Controls.GyroXNeg:
{ {
int gyroX = fieldMap.gryodirs[controlNum]; int gyroX = fieldMap.gryodirs[controlNum];
result = (byte)(!sOff && sxsens * gyroX < -SXD * 10 ? Math.Min(255, sxsens * -gyroX * 2) : 0); result = (byte)(sOff == false ? Math.Min(255, -gyroX * 2) : 0);
break; break;
} }
case DS4Controls.GyroZPos: case DS4Controls.GyroZPos:
{ {
int gyroZ = fieldMap.gryodirs[controlNum]; int gyroZ = fieldMap.gryodirs[controlNum];
result = (byte)(!sOff && szsens * gyroZ > SZD * 10 ? Math.Min(255, szsens * gyroZ * 2) : 0); result = (byte)(sOff == false ? Math.Min(255, gyroZ * 2) : 0);
break; break;
} }
case DS4Controls.GyroZNeg: case DS4Controls.GyroZNeg:
{ {
int gyroZ = fieldMap.gryodirs[controlNum]; int gyroZ = fieldMap.gryodirs[controlNum];
result = (byte)(!sOff && szsens * gyroZ < -SZD * 10 ? Math.Min(255, szsens * -gyroZ * 2) : 0); result = (byte)(sOff == false ? Math.Min(255, -gyroZ * 2) : 0);
break; break;
} }
default: break; default: break;
@ -2760,25 +2865,25 @@ namespace DS4Windows
{ {
case DS4Controls.GyroXPos: case DS4Controls.GyroXPos:
{ {
int gyroX = eState.GyroX; int gyroX = -eState.AccelX;
result = (byte)(!sOff && sxsens * gyroX > SXD * 10 ? Math.Min(255, sxsens * gyroX * 2) : 0); result = (byte)(!sOff && sxsens * gyroX > SXD * 10 ? Math.Min(255, sxsens * gyroX * 2) : 0);
break; break;
} }
case DS4Controls.GyroXNeg: case DS4Controls.GyroXNeg:
{ {
int gyroX = eState.GyroX; int gyroX = -eState.AccelX;
result = (byte)(!sOff && sxsens * gyroX < -SXD * 10 ? Math.Min(255, sxsens * -gyroX * 2) : 0); result = (byte)(!sOff && sxsens * gyroX < -SXD * 10 ? Math.Min(255, sxsens * -gyroX * 2) : 0);
break; break;
} }
case DS4Controls.GyroZPos: case DS4Controls.GyroZPos:
{ {
int gyroZ = eState.GyroZ; int gyroZ = eState.AccelZ;
result = (byte)(!sOff && szsens * gyroZ > SZD * 10 ? Math.Min(255, szsens * gyroZ * 2) : 0); result = (byte)(!sOff && szsens * gyroZ > SZD * 10 ? Math.Min(255, szsens * gyroZ * 2) : 0);
break; break;
} }
case DS4Controls.GyroZNeg: case DS4Controls.GyroZNeg:
{ {
int gyroZ = eState.GyroZ; int gyroZ = eState.AccelZ;
result = (byte)(!sOff && szsens * gyroZ < -SZD * 10 ? Math.Min(255, szsens * -gyroZ * 2) : 0); result = (byte)(!sOff && szsens * gyroZ < -SZD * 10 ? Math.Min(255, szsens * -gyroZ * 2) : 0);
break; break;
} }
@ -2882,10 +2987,10 @@ namespace DS4Windows
switch (control) switch (control)
{ {
case DS4Controls.GyroXPos: result = !sOff ? SXSens[device] * eState.GyroX > 67 : false; break; case DS4Controls.GyroXPos: result = !sOff ? SXSens[device] * -eState.AccelX > 67 : false; break;
case DS4Controls.GyroXNeg: result = !sOff ? SXSens[device] * eState.GyroX < -67 : false; break; case DS4Controls.GyroXNeg: result = !sOff ? SXSens[device] * -eState.AccelX < -67 : false; break;
case DS4Controls.GyroZPos: result = !sOff ? SZSens[device] * eState.GyroZ > 67 : false; break; case DS4Controls.GyroZPos: result = !sOff ? SZSens[device] * eState.AccelZ > 67 : false; break;
case DS4Controls.GyroZNeg: result = !sOff ? SZSens[device] * eState.GyroZ < -67 : false; break; case DS4Controls.GyroZNeg: result = !sOff ? SZSens[device] * eState.AccelZ < -67 : false; break;
default: break; default: break;
} }
} }
@ -2946,14 +3051,14 @@ namespace DS4Windows
switch (control) switch (control)
{ {
case DS4Controls.GyroXPos: safeTest = SXSens[device] * fieldMap.gryodirs[controlNum] > 67; break; case DS4Controls.GyroXPos: safeTest = fieldMap.gryodirs[controlNum] > 67; break;
case DS4Controls.GyroXNeg: safeTest = SXSens[device] * fieldMap.gryodirs[controlNum] < -67; break; case DS4Controls.GyroXNeg: safeTest = fieldMap.gryodirs[controlNum] < -67; break;
case DS4Controls.GyroZPos: safeTest = SZSens[device] * fieldMap.gryodirs[controlNum] > 67; break; case DS4Controls.GyroZPos: safeTest = fieldMap.gryodirs[controlNum] > 67; break;
case DS4Controls.GyroZNeg: safeTest = SZSens[device] * fieldMap.gryodirs[controlNum] < -67; break; case DS4Controls.GyroZNeg: safeTest = fieldMap.gryodirs[controlNum] < -67; break;
default: break; default: break;
} }
result = !sOff ? safeTest : false; result = sOff == false ? safeTest : false;
} }
return result; return result;
@ -3108,14 +3213,14 @@ namespace DS4Windows
switch (control) switch (control)
{ {
case DS4Controls.GyroXPos: safeTest = SXSens[device] * fieldMap.gryodirs[controlNum] > 67; break; case DS4Controls.GyroXPos: safeTest = fieldMap.gryodirs[controlNum] > 67; break;
case DS4Controls.GyroXNeg: safeTest = SXSens[device] * fieldMap.gryodirs[controlNum] < -67; break; case DS4Controls.GyroXNeg: safeTest = fieldMap.gryodirs[controlNum] < -67; break;
case DS4Controls.GyroZPos: safeTest = SZSens[device] * fieldMap.gryodirs[controlNum] > 67; break; case DS4Controls.GyroZPos: safeTest = fieldMap.gryodirs[controlNum] > 67; break;
case DS4Controls.GyroZNeg: safeTest = SZSens[device] * fieldMap.gryodirs[controlNum] < -67; break; case DS4Controls.GyroZNeg: safeTest = fieldMap.gryodirs[controlNum] < -67; break;
default: break; default: break;
} }
result = !sOff ? safeTest : false; result = sOff == false ? safeTest : false;
} }
return result; return result;
@ -3309,10 +3414,10 @@ namespace DS4Windows
switch (control) switch (control)
{ {
case DS4Controls.GyroXPos: result = !sOff ? SXSens[device] * eState.GyroX > 67 : false; break; case DS4Controls.GyroXPos: result = !sOff ? SXSens[device] * eState.AccelX > 67 : false; break;
case DS4Controls.GyroXNeg: result = !sOff ? SXSens[device] * eState.GyroX < -67 : false; break; case DS4Controls.GyroXNeg: result = !sOff ? SXSens[device] * eState.AccelX < -67 : false; break;
case DS4Controls.GyroZPos: result = !sOff ? SZSens[device] * eState.GyroZ > 67 : false; break; case DS4Controls.GyroZPos: result = !sOff ? SZSens[device] * eState.AccelZ > 67 : false; break;
case DS4Controls.GyroZNeg: result = !sOff ? SZSens[device] * eState.GyroZ < -67 : false; break; case DS4Controls.GyroZNeg: result = !sOff ? SZSens[device] * eState.AccelZ < -67 : false; break;
default: break; default: break;
} }
} }
@ -3365,7 +3470,7 @@ namespace DS4Windows
if (controlType == DS4StateFieldMapping.ControlType.Button) if (controlType == DS4StateFieldMapping.ControlType.Button)
{ {
result = (byte)(fieldMap.buttons[controlNum] ? trueVal : falseVal); result = fieldMap.buttons[controlNum] ? trueVal : falseVal;
} }
else if (controlType == DS4StateFieldMapping.ControlType.AxisDir) else if (controlType == DS4StateFieldMapping.ControlType.AxisDir)
{ {
@ -3393,7 +3498,7 @@ namespace DS4Windows
} }
else if (controlType == DS4StateFieldMapping.ControlType.Touch) else if (controlType == DS4StateFieldMapping.ControlType.Touch)
{ {
result = (byte)(fieldMap.buttons[controlNum] ? trueVal : falseVal); result = fieldMap.buttons[controlNum] ? trueVal : falseVal;
} }
else if (controlType == DS4StateFieldMapping.ControlType.SwipeDir) else if (controlType == DS4StateFieldMapping.ControlType.SwipeDir)
{ {
@ -3408,44 +3513,42 @@ namespace DS4Windows
} }
else if (controlType == DS4StateFieldMapping.ControlType.GyroDir) else if (controlType == DS4StateFieldMapping.ControlType.GyroDir)
{ {
double SXD = getSXDeadzone(device);
double SZD = getSZDeadzone(device);
bool sOff = isUsingSAforMouse(device); bool sOff = isUsingSAforMouse(device);
switch (control) switch (control)
{ {
case DS4Controls.GyroXPos: case DS4Controls.GyroXPos:
{ {
if (!sOff && fieldMap.gryodirs[controlNum] > SXD * 10) if (sOff == false && fieldMap.gryodirs[controlNum] > 0)
{ {
if (alt) result = (byte)Math.Min(255, 127 + SXSens[device] * fieldMap.gryodirs[controlNum]); else result = (byte)Math.Max(0, 127 - SXSens[device] * fieldMap.gryodirs[controlNum]); if (alt) result = (byte)Math.Min(255, 127 + fieldMap.gryodirs[controlNum]); else result = (byte)Math.Max(0, 127 - fieldMap.gryodirs[controlNum]);
} }
else result = falseVal; else result = falseVal;
break; break;
} }
case DS4Controls.GyroXNeg: case DS4Controls.GyroXNeg:
{ {
if (!sOff && fieldMap.gryodirs[controlNum] < -SXD * 10) if (sOff == false && fieldMap.gryodirs[controlNum] < 0)
{ {
if (alt) result = (byte)Math.Min(255, 127 + SXSens[device] * -fieldMap.gryodirs[controlNum]); else result = (byte)Math.Max(0, 127 - SXSens[device] * -fieldMap.gryodirs[controlNum]); if (alt) result = (byte)Math.Min(255, 127 + -fieldMap.gryodirs[controlNum]); else result = (byte)Math.Max(0, 127 - -fieldMap.gryodirs[controlNum]);
} }
else result = falseVal; else result = falseVal;
break; break;
} }
case DS4Controls.GyroZPos: case DS4Controls.GyroZPos:
{ {
if (!sOff && fieldMap.gryodirs[controlNum] > SZD * 10) if (sOff == false && fieldMap.gryodirs[controlNum] > 0)
{ {
if (alt) result = (byte)Math.Min(255, 127 + SZSens[device] * fieldMap.gryodirs[controlNum]); else result = (byte)Math.Max(0, 127 - SZSens[device] * fieldMap.gryodirs[controlNum]); if (alt) result = (byte)Math.Min(255, 127 + fieldMap.gryodirs[controlNum]); else result = (byte)Math.Max(0, 127 - fieldMap.gryodirs[controlNum]);
} }
else return falseVal; else return falseVal;
break; break;
} }
case DS4Controls.GyroZNeg: case DS4Controls.GyroZNeg:
{ {
if (!sOff && fieldMap.gryodirs[controlNum] < -SZD * 10) if (sOff == false && fieldMap.gryodirs[controlNum] < 0)
{ {
if (alt) result = (byte)Math.Min(255, 127 + SZSens[device] * -fieldMap.gryodirs[controlNum]); else result = (byte)Math.Max(0, 127 - SZSens[device] * -fieldMap.gryodirs[controlNum]); if (alt) result = (byte)Math.Min(255, 127 + -fieldMap.gryodirs[controlNum]); else result = (byte)Math.Max(0, 127 - -fieldMap.gryodirs[controlNum]);
} }
else result = falseVal; else result = falseVal;
break; break;
@ -3548,36 +3651,36 @@ namespace DS4Windows
{ {
case DS4Controls.GyroXPos: case DS4Controls.GyroXPos:
{ {
if (!sOff && eState.GyroX > SXD * 10) if (!sOff && -eState.AccelX > SXD * 10)
{ {
if (alt) result = (byte)Math.Min(255, 127 + SXSens[device] * eState.GyroX); else result = (byte)Math.Max(0, 127 - SXSens[device] * eState.GyroX); if (alt) result = (byte)Math.Min(255, 127 + SXSens[device] * -eState.AccelX); else result = (byte)Math.Max(0, 127 - SXSens[device] * -eState.AccelX);
} }
else result = falseVal; else result = falseVal;
break; break;
} }
case DS4Controls.GyroXNeg: case DS4Controls.GyroXNeg:
{ {
if (!sOff && eState.GyroX < -SXD * 10) if (!sOff && -eState.AccelX < -SXD * 10)
{ {
if (alt) result = (byte)Math.Min(255, 127 + SXSens[device] * -eState.GyroX); else result = (byte)Math.Max(0, 127 - SXSens[device] * -eState.GyroX); if (alt) result = (byte)Math.Min(255, 127 + SXSens[device] * eState.AccelX); else result = (byte)Math.Max(0, 127 - SXSens[device] * eState.AccelX);
} }
else result = falseVal; else result = falseVal;
break; break;
} }
case DS4Controls.GyroZPos: case DS4Controls.GyroZPos:
{ {
if (!sOff && eState.GyroZ > SZD * 10) if (!sOff && eState.AccelZ > SZD * 10)
{ {
if (alt) result = (byte)Math.Min(255, 127 + SZSens[device] * eState.GyroZ); else result = (byte)Math.Max(0, 127 - SZSens[device] * eState.GyroZ); if (alt) result = (byte)Math.Min(255, 127 + SZSens[device] * eState.AccelZ); else result = (byte)Math.Max(0, 127 - SZSens[device] * eState.AccelZ);
} }
else return falseVal; else return falseVal;
break; break;
} }
case DS4Controls.GyroZNeg: case DS4Controls.GyroZNeg:
{ {
if (!sOff && eState.GyroZ < -SZD * 10) if (!sOff && eState.AccelZ < -SZD * 10)
{ {
if (alt) result = (byte)Math.Min(255, 127 + SZSens[device] * -eState.GyroZ); else result = (byte)Math.Max(0, 127 - SZSens[device] * -eState.GyroZ); if (alt) result = (byte)Math.Min(255, 127 + SZSens[device] * -eState.AccelZ); else result = (byte)Math.Max(0, 127 - SZSens[device] * -eState.AccelZ);
} }
else result = falseVal; else result = falseVal;
break; break;

View File

@ -15,13 +15,14 @@ namespace DS4Windows
/** Indicate x/y direction for doing jitter compensation, etc. */ /** Indicate x/y direction for doing jitter compensation, etc. */
public enum Direction { Negative, Neutral, Positive } public enum Direction { Negative, Neutral, Positive }
// Track direction vector separately and very trivially for now. // Track direction vector separately and very trivially for now.
private Direction horizontalDirection = Direction.Neutral, verticalDirection = Direction.Neutral; private Direction horizontalDirection = Direction.Neutral,
verticalDirection = Direction.Neutral;
private Direction hDirection = Direction.Neutral, vDirection = Direction.Neutral; private Direction hDirection = Direction.Neutral, vDirection = Direction.Neutral;
private double GYRO_MOUSE_COEFFICIENT = 0.0095; private double GYRO_MOUSE_COEFFICIENT = 0.0095;
private int GYRO_MOUSE_DEADZONE = 12; private int GYRO_MOUSE_DEADZONE = 12;
private double GYRO_MOUSE_OFFSET = 0.1463; private double GYRO_MOUSE_OFFSET = 0.1463;
private double GYRO_SMOOTH_MOUSE_OFFSET = 0.14698; private double GYRO_SMOOTH_MOUSE_OFFSET = 0.14696;
private const int SMOOTH_BUFFER_LEN = 3; private const int SMOOTH_BUFFER_LEN = 3;
private double[] xSmoothBuffer = new double[SMOOTH_BUFFER_LEN]; private double[] xSmoothBuffer = new double[SMOOTH_BUFFER_LEN];
@ -31,14 +32,17 @@ namespace DS4Windows
double coefficient = 0.0; double coefficient = 0.0;
double verticalScale = 0.0; double verticalScale = 0.0;
bool gyroSmooth = false; bool gyroSmooth = false;
//double gyroSmoothWeight = 0.0;
int tempInt = 0;
double tempDouble = 0.0;
public virtual void sixaxisMoved(SixAxisEventArgs arg) public virtual void sixaxisMoved(SixAxisEventArgs arg)
{ {
int deltaX = 0, deltaY = 0; int deltaX = 0, deltaY = 0;
deltaX = -arg.sixAxis.gyroXFull; deltaX = Global.getGyroMouseHorizontalAxis(deviceNumber) == 0 ? arg.sixAxis.gyroYawFull :
deltaY = -arg.sixAxis.gyroYFull; arg.sixAxis.gyroRollFull;
//Console.WriteLine(arg.sixAxis.deltaX); deltaY = -arg.sixAxis.gyroPitchFull;
tempDouble = arg.sixAxis.elapsed * 0.001 * 250.0; // Base default speed on 4 ms
gyroSmooth = Global.getGyroSmoothing(deviceNumber); gyroSmooth = Global.getGyroSmoothing(deviceNumber);
double gyroSmoothWeight = 0.0; double gyroSmoothWeight = 0.0;
@ -60,12 +64,12 @@ namespace DS4Windows
int signX = System.Math.Sign(deltaX); int signX = System.Math.Sign(deltaX);
int signY = System.Math.Sign(deltaY); int signY = System.Math.Sign(deltaY);
if ((hRemainder > 0) != (deltaX > 0)) if (deltaX == 0 || (hRemainder > 0 != deltaX > 0))
{ {
hRemainder = 0.0; hRemainder = 0.0;
} }
if ((vRemainder > 0) != (deltaY > 0)) if (deltaY == 0 || (vRemainder > 0 != deltaY > 0))
{ {
vRemainder = 0.0; vRemainder = 0.0;
} }
@ -93,32 +97,23 @@ namespace DS4Windows
deltaY = 0; deltaY = 0;
} }
double xMotion = deltaX != 0 ? coefficient * deltaX + (normX * (offset * signX)) : 0; double xMotion = deltaX != 0 ? coefficient * (deltaX * tempDouble)
+ (normX * (offset * signX)) : 0;
int xAction = 0; int xAction = 0;
if (xMotion != 0.0) if (xMotion != 0.0)
{ {
xMotion += hRemainder; xMotion += hRemainder;
//xAction = (int)xMotion;
//hRemainder = xMotion - xAction;
}
else
{
//hRemainder = 0.0;
} }
//hRemainder -= (int)hRemainder;
verticalScale = Global.getGyroSensVerticalScale(deviceNumber) * 0.01; verticalScale = Global.getGyroSensVerticalScale(deviceNumber) * 0.01;
double yMotion = deltaY != 0 ? (coefficient * verticalScale) * deltaY + (normY * (offset * signY)) : 0; double yMotion = deltaY != 0 ? (coefficient * verticalScale) * (deltaY * tempDouble)
+ (normY * (offset * signY)) : 0;
int yAction = 0; int yAction = 0;
if (yMotion != 0.0) if (yMotion != 0.0)
{ {
yMotion += vRemainder; yMotion += vRemainder;
//yAction = (int)yMotion;
//vRemainder = yMotion - yAction;
}
else
{
//vRemainder = 0.0;
} }
if (gyroSmooth) if (gyroSmooth)
@ -131,9 +126,10 @@ namespace DS4Windows
double currentWeight = 1.0; double currentWeight = 1.0;
double finalWeight = 0.0; double finalWeight = 0.0;
double x_out = 0.0, y_out = 0.0; double x_out = 0.0, y_out = 0.0;
int idx = 0;
for (int i = 0; i < SMOOTH_BUFFER_LEN; i++) for (int i = 0; i < SMOOTH_BUFFER_LEN; i++)
{ {
int idx = System.Math.Abs(smoothBufferTail - i - 1) % SMOOTH_BUFFER_LEN; idx = System.Math.Abs(smoothBufferTail - i - 1) % SMOOTH_BUFFER_LEN;
x_out += xSmoothBuffer[idx] * currentWeight; x_out += xSmoothBuffer[idx] * currentWeight;
y_out += ySmoothBuffer[idx] * currentWeight; y_out += ySmoothBuffer[idx] * currentWeight;
finalWeight += currentWeight; finalWeight += currentWeight;
@ -166,13 +162,11 @@ namespace DS4Windows
vRemainder = 0.0; vRemainder = 0.0;
} }
//vRemainder -= (int)vRemainder;
int gyroInvert = Global.getGyroInvert(deviceNumber); int gyroInvert = Global.getGyroInvert(deviceNumber);
if (gyroInvert == 2 || gyroInvert == 3) if ((gyroInvert & 0x02) == 2)
xAction *= -1; xAction *= -1;
if (gyroInvert == 1 || gyroInvert == 3) if ((gyroInvert & 0x01) == 1)
yAction *= -1; yAction *= -1;
if (yAction != 0 || xAction != 0) if (yAction != 0 || xAction != 0)
@ -279,7 +273,7 @@ namespace DS4Windows
} }
} }
double coefficient = Global.TouchSensitivity[deviceNumber] / 100.0; double coefficient = Global.TouchSensitivity[deviceNumber] * 0.01;
// Collect rounding errors instead of losing motion. // Collect rounding errors instead of losing motion.
double xMotion = coefficient * deltaX; double xMotion = coefficient * deltaX;
if (xMotion > 0.0) if (xMotion > 0.0)
@ -309,6 +303,13 @@ namespace DS4Windows
int yAction = (int)yMotion; int yAction = (int)yMotion;
verticalRemainder = yMotion - yAction; verticalRemainder = yMotion - yAction;
int touchpadInvert = tempInt = Global.getTouchpadInvert(deviceNumber);
if ((touchpadInvert & 0x02) == 2)
xAction *= -1;
if ((touchpadInvert & 0x01) == 1)
yAction *= -1;
if (yAction != 0 || xAction != 0) if (yAction != 0 || xAction != 0)
InputMethods.MoveCursorBy(xAction, yAction); InputMethods.MoveCursorBy(xAction, yAction);

View File

@ -608,6 +608,12 @@ namespace DS4Windows
return m_Config.gyroSmoothWeight[index]; return m_Config.gyroSmoothWeight[index];
} }
public static int[] GyroMouseHorizontalAxis => m_Config.gyroMouseHorizontalAxis;
public static int getGyroMouseHorizontalAxis(int index)
{
return m_Config.gyroMouseHorizontalAxis[index];
}
public static DS4Color[] MainColor => m_Config.m_Leds; public static DS4Color[] MainColor => m_Config.m_Leds;
public static DS4Color getMainColor(int index) public static DS4Color getMainColor(int index)
{ {
@ -660,6 +666,12 @@ namespace DS4Windows
public static bool[] LowerRCOn => m_Config.lowerRCOn; public static bool[] LowerRCOn => m_Config.lowerRCOn;
public static bool[] TouchpadJitterCompensation => m_Config.touchpadJitterCompensation; public static bool[] TouchpadJitterCompensation => m_Config.touchpadJitterCompensation;
public static int[] TouchpadInvert => m_Config.touchpadInvert;
public static int getTouchpadInvert(int index)
{
return m_Config.touchpadInvert[index];
}
public static byte[] L2Deadzone => m_Config.l2Deadzone; public static byte[] L2Deadzone => m_Config.l2Deadzone;
public static byte getL2Deadzone(int index) public static byte getL2Deadzone(int index)
{ {
@ -708,6 +720,18 @@ namespace DS4Windows
return m_Config.RSAntiDeadzone[index]; return m_Config.RSAntiDeadzone[index];
} }
public static double[] SXAntiDeadzone => m_Config.SXAntiDeadzone;
public static double getSXAntiDeadzone(int index)
{
return m_Config.SXAntiDeadzone[index];
}
public static double[] SZAntiDeadzone => m_Config.SZAntiDeadzone;
public static double getSZAntiDeadzone(int index)
{
return m_Config.SZAntiDeadzone[index];
}
public static int[] LSMaxzone => m_Config.LSMaxzone; public static int[] LSMaxzone => m_Config.LSMaxzone;
public static int getLSMaxzone(int index) public static int getLSMaxzone(int index)
{ {
@ -720,6 +744,18 @@ namespace DS4Windows
return m_Config.RSMaxzone[index]; return m_Config.RSMaxzone[index];
} }
public static double[] SXMaxzone => m_Config.SXMaxzone;
public static double getSXMaxzone(int index)
{
return m_Config.SXMaxzone[index];
}
public static double[] SZMaxzone => m_Config.SZMaxzone;
public static double getSZMaxzone(int index)
{
return m_Config.SZMaxzone[index];
}
public static int[] L2AntiDeadzone => m_Config.l2AntiDeadzone; public static int[] L2AntiDeadzone => m_Config.l2AntiDeadzone;
public static int getL2AntiDeadzone(int index) public static int getL2AntiDeadzone(int index)
{ {
@ -828,6 +864,30 @@ namespace DS4Windows
return m_Config.rsOutCurveMode[index]; return m_Config.rsOutCurveMode[index];
} }
public static int[] l2OutCurveMode => m_Config.l2OutCurveMode;
public static int getL2OutCurveMode(int index)
{
return m_Config.l2OutCurveMode[index];
}
public static int[] r2OutCurveMode => m_Config.r2OutCurveMode;
public static int getR2OutCurveMode(int index)
{
return m_Config.r2OutCurveMode[index];
}
public static int[] sxOutCurveMode => m_Config.sxOutCurveMode;
public static int getSXOutCurveMode(int index)
{
return m_Config.sxOutCurveMode[index];
}
public static int[] szOutCurveMode => m_Config.szOutCurveMode;
public static int getSZOutCurveMode(int index)
{
return m_Config.szOutCurveMode[index];
}
public static string[] LaunchProgram => m_Config.launchProgram; public static string[] LaunchProgram => m_Config.launchProgram;
public static string[] ProfilePath => m_Config.profilePath; public static string[] ProfilePath => m_Config.profilePath;
public static bool[] DistanceProfiles = m_Config.distanceProfiles; public static bool[] DistanceProfiles = m_Config.distanceProfiles;
@ -1158,18 +1218,27 @@ namespace DS4Windows
public int[] l2Maxzone = { 100, 100, 100, 100, 100 }, r2Maxzone = { 100, 100, 100, 100, 100 }; public int[] l2Maxzone = { 100, 100, 100, 100, 100 }, r2Maxzone = { 100, 100, 100, 100, 100 };
public double[] LSRotation = { 0.0, 0.0, 0.0, 0.0, 0.0 }, RSRotation = { 0.0, 0.0, 0.0, 0.0, 0.0 }; public double[] LSRotation = { 0.0, 0.0, 0.0, 0.0, 0.0 }, RSRotation = { 0.0, 0.0, 0.0, 0.0, 0.0 };
public double[] SXDeadzone = { 0.25, 0.25, 0.25, 0.25, 0.25 }, SZDeadzone = { 0.25, 0.25, 0.25, 0.25, 0.25 }; public double[] SXDeadzone = { 0.25, 0.25, 0.25, 0.25, 0.25 }, SZDeadzone = { 0.25, 0.25, 0.25, 0.25, 0.25 };
public double[] SXMaxzone = new double[5] { 1.0, 1.0, 1.0, 1.0, 1.0 },
SZMaxzone = new double[5] { 1.0, 1.0, 1.0, 1.0, 1.0 };
public double[] SXAntiDeadzone = new double[5] { 0.0, 0.0, 0.0, 0.0, 0.0 },
SZAntiDeadzone = new double[5] { 0.0, 0.0, 0.0, 0.0, 0.0 };
public double[] l2Sens = { 1, 1, 1, 1, 1 }, r2Sens = { 1, 1, 1, 1, 1 }; public double[] l2Sens = { 1, 1, 1, 1, 1 }, r2Sens = { 1, 1, 1, 1, 1 };
public double[] LSSens = { 1, 1, 1, 1, 1 }, RSSens = { 1, 1, 1, 1, 1 }; public double[] LSSens = { 1, 1, 1, 1, 1 }, RSSens = { 1, 1, 1, 1, 1 };
public double[] SXSens = { 1, 1, 1, 1, 1 }, SZSens = { 1, 1, 1, 1, 1 }; public double[] SXSens = { 1, 1, 1, 1, 1 }, SZSens = { 1, 1, 1, 1, 1 };
public Byte[] tapSensitivity = { 0, 0, 0, 0, 0 }; public Byte[] tapSensitivity = { 0, 0, 0, 0, 0 };
public bool[] doubleTap = { false, false, false, false, false }; public bool[] doubleTap = { false, false, false, false, false };
public int[] scrollSensitivity = { 0, 0, 0, 0, 0 }; public int[] scrollSensitivity = { 0, 0, 0, 0, 0 };
public int[] touchpadInvert = { 0, 0, 0, 0, 0 };
public double[] rainbow = { 0, 0, 0, 0, 0 }; public double[] rainbow = { 0, 0, 0, 0, 0 };
public int[] flashAt = { 0, 0, 0, 0, 0 }; public int[] flashAt = { 0, 0, 0, 0, 0 };
public bool[] mouseAccel = { true, true, true, true, true }; public bool[] mouseAccel = { true, true, true, true, true };
public int[] btPollRate = { 0, 0, 0, 0, 0 }; public int[] btPollRate = { 4, 4, 4, 4, 4 };
public int[] lsOutCurveMode = { 0, 0, 0, 0, 0 }; public int[] lsOutCurveMode = { 0, 0, 0, 0, 0 };
public int[] rsOutCurveMode = { 0, 0, 0, 0, 0 }; public int[] rsOutCurveMode = { 0, 0, 0, 0, 0 };
public int[] l2OutCurveMode = new int[5] { 0, 0, 0, 0, 0 };
public int[] r2OutCurveMode = new int[5] { 0, 0, 0, 0, 0 };
public int[] sxOutCurveMode = new int[5] { 0, 0, 0, 0, 0 };
public int[] szOutCurveMode = new int[5] { 0, 0, 0, 0, 0 };
public DS4Color[] m_LowLeds = new DS4Color[] public DS4Color[] m_LowLeds = new DS4Color[]
{ {
@ -1267,6 +1336,7 @@ namespace DS4Windows
public bool[] gyroTriggerTurns = { true, true, true, true, true }; public bool[] gyroTriggerTurns = { true, true, true, true, true };
public bool[] gyroSmoothing = { false, false, false, false, false }; public bool[] gyroSmoothing = { false, false, false, false, false };
public double[] gyroSmoothWeight = { 0.5, 0.5, 0.5, 0.5, 0.5 }; public double[] gyroSmoothWeight = { 0.5, 0.5, 0.5, 0.5, 0.5 };
public int[] gyroMouseHorizontalAxis = new int[5] { 0, 0, 0, 0, 0 };
bool tempBool = false; bool tempBool = false;
@ -1368,7 +1438,7 @@ namespace DS4Windows
catch { return 0; } catch { return 0; }
}*/ }*/
private string outputCurveString(int id) private string stickOutputCurveString(int id)
{ {
string result = "linear"; string result = "linear";
switch (id) switch (id)
@ -1383,7 +1453,7 @@ namespace DS4Windows
return result; return result;
} }
private int outputCurveId(string name) private int stickOutputCurveId(string name)
{ {
int id = 0; int id = 0;
switch (name) switch (name)
@ -1398,6 +1468,34 @@ namespace DS4Windows
return id; return id;
} }
private string axisOutputCurveString(int id)
{
string result = "linear";
switch (id)
{
case 0: break;
case 1: result = "quadratic"; break;
case 2: result = "cubic"; break;
default: break;
}
return result;
}
private int axisOutputCurveId(string name)
{
int id = 0;
switch (name)
{
case "linear": id = 0; break;
case "quadratic": id = 1; break;
case "cubic": id = 2; break;
default: break;
}
return id;
}
public bool SaveProfile(int device, string propath) public bool SaveProfile(int device, string propath)
{ {
bool Saved = true; bool Saved = true;
@ -1447,6 +1545,7 @@ namespace DS4Windows
XmlNode xmlScrollSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "scrollSensitivity", null); xmlScrollSensitivity.InnerText = scrollSensitivity[device].ToString(); Node.AppendChild(xmlScrollSensitivity); XmlNode xmlScrollSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "scrollSensitivity", null); xmlScrollSensitivity.InnerText = scrollSensitivity[device].ToString(); Node.AppendChild(xmlScrollSensitivity);
XmlNode xmlLeftTriggerMiddle = m_Xdoc.CreateNode(XmlNodeType.Element, "LeftTriggerMiddle", null); xmlLeftTriggerMiddle.InnerText = l2Deadzone[device].ToString(); Node.AppendChild(xmlLeftTriggerMiddle); XmlNode xmlLeftTriggerMiddle = m_Xdoc.CreateNode(XmlNodeType.Element, "LeftTriggerMiddle", null); xmlLeftTriggerMiddle.InnerText = l2Deadzone[device].ToString(); Node.AppendChild(xmlLeftTriggerMiddle);
XmlNode xmlRightTriggerMiddle = m_Xdoc.CreateNode(XmlNodeType.Element, "RightTriggerMiddle", null); xmlRightTriggerMiddle.InnerText = r2Deadzone[device].ToString(); Node.AppendChild(xmlRightTriggerMiddle); XmlNode xmlRightTriggerMiddle = m_Xdoc.CreateNode(XmlNodeType.Element, "RightTriggerMiddle", null); xmlRightTriggerMiddle.InnerText = r2Deadzone[device].ToString(); Node.AppendChild(xmlRightTriggerMiddle);
XmlNode xmlTouchpadInvert = m_Xdoc.CreateNode(XmlNodeType.Element, "TouchpadInvert", null); xmlTouchpadInvert.InnerText = touchpadInvert[device].ToString(); Node.AppendChild(xmlTouchpadInvert);
XmlNode xmlL2AD = m_Xdoc.CreateNode(XmlNodeType.Element, "L2AntiDeadZone", null); xmlL2AD.InnerText = l2AntiDeadzone[device].ToString(); Node.AppendChild(xmlL2AD); XmlNode xmlL2AD = m_Xdoc.CreateNode(XmlNodeType.Element, "L2AntiDeadZone", null); xmlL2AD.InnerText = l2AntiDeadzone[device].ToString(); Node.AppendChild(xmlL2AD);
XmlNode xmlR2AD = m_Xdoc.CreateNode(XmlNodeType.Element, "R2AntiDeadZone", null); xmlR2AD.InnerText = r2AntiDeadzone[device].ToString(); Node.AppendChild(xmlR2AD); XmlNode xmlR2AD = m_Xdoc.CreateNode(XmlNodeType.Element, "R2AntiDeadZone", null); xmlR2AD.InnerText = r2AntiDeadzone[device].ToString(); Node.AppendChild(xmlR2AD);
XmlNode xmlL2Maxzone = m_Xdoc.CreateNode(XmlNodeType.Element, "L2MaxZone", null); xmlL2Maxzone.InnerText = l2Maxzone[device].ToString(); Node.AppendChild(xmlL2Maxzone); XmlNode xmlL2Maxzone = m_Xdoc.CreateNode(XmlNodeType.Element, "L2MaxZone", null); xmlL2Maxzone.InnerText = l2Maxzone[device].ToString(); Node.AppendChild(xmlL2Maxzone);
@ -1465,6 +1564,12 @@ namespace DS4Windows
XmlNode xmlSXD = m_Xdoc.CreateNode(XmlNodeType.Element, "SXDeadZone", null); xmlSXD.InnerText = SXDeadzone[device].ToString(); Node.AppendChild(xmlSXD); XmlNode xmlSXD = m_Xdoc.CreateNode(XmlNodeType.Element, "SXDeadZone", null); xmlSXD.InnerText = SXDeadzone[device].ToString(); Node.AppendChild(xmlSXD);
XmlNode xmlSZD = m_Xdoc.CreateNode(XmlNodeType.Element, "SZDeadZone", null); xmlSZD.InnerText = SZDeadzone[device].ToString(); Node.AppendChild(xmlSZD); XmlNode xmlSZD = m_Xdoc.CreateNode(XmlNodeType.Element, "SZDeadZone", null); xmlSZD.InnerText = SZDeadzone[device].ToString(); Node.AppendChild(xmlSZD);
XmlNode xmlSXMaxzone = m_Xdoc.CreateNode(XmlNodeType.Element, "SXMaxZone", null); xmlSXMaxzone.InnerText = Convert.ToInt32(SXMaxzone[device] * 100.0).ToString(); Node.AppendChild(xmlSXMaxzone);
XmlNode xmlSZMaxzone = m_Xdoc.CreateNode(XmlNodeType.Element, "SZMaxZone", null); xmlSZMaxzone.InnerText = Convert.ToInt32(SZMaxzone[device] * 100.0).ToString(); Node.AppendChild(xmlSZMaxzone);
XmlNode xmlSXAntiDeadzone = m_Xdoc.CreateNode(XmlNodeType.Element, "SXAntiDeadZone", null); xmlSXAntiDeadzone.InnerText = Convert.ToInt32(SXAntiDeadzone[device] * 100.0).ToString(); Node.AppendChild(xmlSXAntiDeadzone);
XmlNode xmlSZAntiDeadzone = m_Xdoc.CreateNode(XmlNodeType.Element, "SZAntiDeadZone", null); xmlSZAntiDeadzone.InnerText = Convert.ToInt32(SZAntiDeadzone[device] * 100.0).ToString(); Node.AppendChild(xmlSZAntiDeadzone);
XmlNode xmlSens = m_Xdoc.CreateNode(XmlNodeType.Element, "Sensitivity", null); XmlNode xmlSens = m_Xdoc.CreateNode(XmlNodeType.Element, "Sensitivity", null);
xmlSens.InnerText = $"{LSSens[device]}|{RSSens[device]}|{l2Sens[device]}|{r2Sens[device]}|{SXSens[device]}|{SZSens[device]}"; xmlSens.InnerText = $"{LSSens[device]}|{RSSens[device]}|{l2Sens[device]}|{r2Sens[device]}|{SXSens[device]}|{SZSens[device]}";
Node.AppendChild(xmlSens); Node.AppendChild(xmlSens);
@ -1484,12 +1589,19 @@ namespace DS4Windows
XmlNode xmlGyroTriggerTurns = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroTriggerTurns", null); xmlGyroTriggerTurns.InnerText = gyroTriggerTurns[device].ToString(); Node.AppendChild(xmlGyroTriggerTurns); XmlNode xmlGyroTriggerTurns = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroTriggerTurns", null); xmlGyroTriggerTurns.InnerText = gyroTriggerTurns[device].ToString(); Node.AppendChild(xmlGyroTriggerTurns);
XmlNode xmlGyroSmoothWeight = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroSmoothingWeight", null); xmlGyroSmoothWeight.InnerText = Convert.ToInt32(gyroSmoothWeight[device] * 100).ToString(); Node.AppendChild(xmlGyroSmoothWeight); XmlNode xmlGyroSmoothWeight = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroSmoothingWeight", null); xmlGyroSmoothWeight.InnerText = Convert.ToInt32(gyroSmoothWeight[device] * 100).ToString(); Node.AppendChild(xmlGyroSmoothWeight);
XmlNode xmlGyroSmoothing = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroSmoothing", null); xmlGyroSmoothing.InnerText = gyroSmoothing[device].ToString(); Node.AppendChild(xmlGyroSmoothing); XmlNode xmlGyroSmoothing = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroSmoothing", null); xmlGyroSmoothing.InnerText = gyroSmoothing[device].ToString(); Node.AppendChild(xmlGyroSmoothing);
XmlNode xmlGyroMouseHAxis = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroMouseHAxis", null); xmlGyroMouseHAxis.InnerText = gyroMouseHorizontalAxis[device].ToString(); Node.AppendChild(xmlGyroMouseHAxis);
XmlNode xmlLSC = m_Xdoc.CreateNode(XmlNodeType.Element, "LSCurve", null); xmlLSC.InnerText = lsCurve[device].ToString(); Node.AppendChild(xmlLSC); XmlNode xmlLSC = m_Xdoc.CreateNode(XmlNodeType.Element, "LSCurve", null); xmlLSC.InnerText = lsCurve[device].ToString(); Node.AppendChild(xmlLSC);
XmlNode xmlRSC = m_Xdoc.CreateNode(XmlNodeType.Element, "RSCurve", null); xmlRSC.InnerText = rsCurve[device].ToString(); Node.AppendChild(xmlRSC); XmlNode xmlRSC = m_Xdoc.CreateNode(XmlNodeType.Element, "RSCurve", null); xmlRSC.InnerText = rsCurve[device].ToString(); Node.AppendChild(xmlRSC);
XmlNode xmlProfileActions = m_Xdoc.CreateNode(XmlNodeType.Element, "ProfileActions", null); xmlProfileActions.InnerText = string.Join("/", profileActions[device]); Node.AppendChild(xmlProfileActions); XmlNode xmlProfileActions = m_Xdoc.CreateNode(XmlNodeType.Element, "ProfileActions", null); xmlProfileActions.InnerText = string.Join("/", profileActions[device]); Node.AppendChild(xmlProfileActions);
XmlNode xmlBTPollRate = m_Xdoc.CreateNode(XmlNodeType.Element, "BTPollRate", null); xmlBTPollRate.InnerText = btPollRate[device].ToString(); Node.AppendChild(xmlBTPollRate); XmlNode xmlBTPollRate = m_Xdoc.CreateNode(XmlNodeType.Element, "BTPollRate", null); xmlBTPollRate.InnerText = btPollRate[device].ToString(); Node.AppendChild(xmlBTPollRate);
XmlNode xmlLsOutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "LSOutputCurveMode", null); xmlLsOutputCurveMode.InnerText = outputCurveString(lsOutCurveMode[device]); Node.AppendChild(xmlLsOutputCurveMode); XmlNode xmlLsOutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "LSOutputCurveMode", null); xmlLsOutputCurveMode.InnerText = stickOutputCurveString(lsOutCurveMode[device]); Node.AppendChild(xmlLsOutputCurveMode);
XmlNode xmlRsOutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "RSOutputCurveMode", null); xmlRsOutputCurveMode.InnerText = outputCurveString(rsOutCurveMode[device]); Node.AppendChild(xmlRsOutputCurveMode); XmlNode xmlRsOutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "RSOutputCurveMode", null); xmlRsOutputCurveMode.InnerText = stickOutputCurveString(rsOutCurveMode[device]); Node.AppendChild(xmlRsOutputCurveMode);
XmlNode xmlL2OutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "L2OutputCurveMode", null); xmlL2OutputCurveMode.InnerText = axisOutputCurveString(l2OutCurveMode[device]); Node.AppendChild(xmlL2OutputCurveMode);
XmlNode xmlR2OutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "R2OutputCurveMode", null); xmlR2OutputCurveMode.InnerText = axisOutputCurveString(r2OutCurveMode[device]); Node.AppendChild(xmlR2OutputCurveMode);
XmlNode xmlSXOutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "SXOutputCurveMode", null); xmlSXOutputCurveMode.InnerText = axisOutputCurveString(sxOutCurveMode[device]); Node.AppendChild(xmlSXOutputCurveMode);
XmlNode xmlSZOutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "SZOutputCurveMode", null); xmlSZOutputCurveMode.InnerText = axisOutputCurveString(szOutCurveMode[device]); Node.AppendChild(xmlSZOutputCurveMode);
XmlNode NodeControl = m_Xdoc.CreateNode(XmlNodeType.Element, "Control", null); XmlNode NodeControl = m_Xdoc.CreateNode(XmlNodeType.Element, "Control", null);
XmlNode Key = m_Xdoc.CreateNode(XmlNodeType.Element, "Key", null); XmlNode Key = m_Xdoc.CreateNode(XmlNodeType.Element, "Key", null);
@ -2190,12 +2302,18 @@ namespace DS4Windows
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/scrollSensitivity"); int.TryParse(Item.InnerText, out scrollSensitivity[device]); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/scrollSensitivity"); int.TryParse(Item.InnerText, out scrollSensitivity[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/TouchpadInvert"); int temp = 0; int.TryParse(Item.InnerText, out temp); touchpadInvert[device] = Math.Min(Math.Max(temp, 0), 3); }
catch { touchpadInvert[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LeftTriggerMiddle"); byte.TryParse(Item.InnerText, out l2Deadzone[device]); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LeftTriggerMiddle"); byte.TryParse(Item.InnerText, out l2Deadzone[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RightTriggerMiddle"); byte.TryParse(Item.InnerText, out r2Deadzone[device]); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RightTriggerMiddle"); byte.TryParse(Item.InnerText, out r2Deadzone[device]); }
catch { missingSetting = true; } catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/L2AntiDeadZone"); int.TryParse(Item.InnerText, out l2AntiDeadzone[device]); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/L2AntiDeadZone"); int.TryParse(Item.InnerText, out l2AntiDeadzone[device]); }
catch { l2AntiDeadzone[device] = 0; missingSetting = true; } catch { l2AntiDeadzone[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/R2AntiDeadZone"); int.TryParse(Item.InnerText, out r2AntiDeadzone[device]); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/R2AntiDeadZone"); int.TryParse(Item.InnerText, out r2AntiDeadzone[device]); }
catch { r2AntiDeadzone[device] = 0; missingSetting = true; } catch { r2AntiDeadzone[device] = 0; missingSetting = true; }
@ -2259,9 +2377,37 @@ namespace DS4Windows
catch { RSMaxzone[device] = 100; missingSetting = true; } catch { RSMaxzone[device] = 100; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SXDeadZone"); double.TryParse(Item.InnerText, out SXDeadzone[device]); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SXDeadZone"); double.TryParse(Item.InnerText, out SXDeadzone[device]); }
catch { missingSetting = true; } catch { SXDeadzone[device] = 0.25; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SZDeadZone"); double.TryParse(Item.InnerText, out SZDeadzone[device]); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SZDeadZone"); double.TryParse(Item.InnerText, out SZDeadzone[device]); }
catch { missingSetting = true; } catch { SZDeadzone[device] = 0.25; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SXMaxZone");
int temp = 0;
int.TryParse(Item.InnerText, out temp);
SXMaxzone[device] = Math.Min(Math.Max(temp * 0.01, 0.0), 1.0);
}
catch { SXMaxzone[device] = 1.0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SZMaxZone");
int temp = 0;
int.TryParse(Item.InnerText, out temp);
SZMaxzone[device] = Math.Min(Math.Max(temp * 0.01, 0.0), 1.0);
}
catch { SZMaxzone[device] = 1.0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SXAntiDeadZone");
int temp = 0;
int.TryParse(Item.InnerText, out temp);
SXAntiDeadzone[device] = Math.Min(Math.Max(temp * 0.01, 0.0), 1.0);
}
catch { SXAntiDeadzone[device] = 0.0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SZAntiDeadZone");
int temp = 0;
int.TryParse(Item.InnerText, out temp);
SZAntiDeadzone[device] = Math.Min(Math.Max(temp * 0.01, 0.0), 1.0);
}
catch { SZAntiDeadzone[device] = 0.0; missingSetting = true; }
try try
{ {
@ -2428,6 +2574,9 @@ namespace DS4Windows
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroSmoothingWeight"); int temp = 0; int.TryParse(Item.InnerText, out temp); gyroSmoothWeight[device] = Math.Min(Math.Max(0.0, Convert.ToDouble(temp * 0.01)), 1.0); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroSmoothingWeight"); int temp = 0; int.TryParse(Item.InnerText, out temp); gyroSmoothWeight[device] = Math.Min(Math.Max(0.0, Convert.ToDouble(temp * 0.01)), 1.0); }
catch { gyroSmoothWeight[device] = 0.5; missingSetting = true; } catch { gyroSmoothWeight[device] = 0.5; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroMouseHAxis"); int temp = 0; int.TryParse(Item.InnerText, out temp); gyroMouseHorizontalAxis[device] = Math.Min(Math.Max(0, temp), 1); }
catch { gyroMouseHorizontalAxis[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSCurve"); int.TryParse(Item.InnerText, out lsCurve[device]); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSCurve"); int.TryParse(Item.InnerText, out lsCurve[device]); }
catch { lsCurve[device] = 0; missingSetting = true; } catch { lsCurve[device] = 0; missingSetting = true; }
@ -2440,14 +2589,26 @@ namespace DS4Windows
int.TryParse(Item.InnerText, out temp); int.TryParse(Item.InnerText, out temp);
btPollRate[device] = (temp >= 0 && temp <= 16) ? temp : 0; btPollRate[device] = (temp >= 0 && temp <= 16) ? temp : 0;
} }
catch { btPollRate[device] = 0; missingSetting = true; } catch { btPollRate[device] = 4; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSOutputCurveMode"); lsOutCurveMode[device] = outputCurveId(Item.InnerText); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSOutputCurveMode"); lsOutCurveMode[device] = stickOutputCurveId(Item.InnerText); }
catch { lsOutCurveMode[device] = 0; missingSetting = true; } catch { lsOutCurveMode[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSOutputCurveMode"); rsOutCurveMode[device] = outputCurveId(Item.InnerText); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSOutputCurveMode"); rsOutCurveMode[device] = stickOutputCurveId(Item.InnerText); }
catch { rsOutCurveMode[device] = 0; missingSetting = true; } catch { rsOutCurveMode[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/L2OutputCurveMode"); l2OutCurveMode[device] = axisOutputCurveId(Item.InnerText); }
catch { l2OutCurveMode[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/R2OutputCurveMode"); r2OutCurveMode[device] = axisOutputCurveId(Item.InnerText); }
catch { r2OutCurveMode[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SXOutputCurveMode"); sxOutCurveMode[device] = axisOutputCurveId(Item.InnerText); }
catch { sxOutCurveMode[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SZOutputCurveMode"); szOutCurveMode[device] = axisOutputCurveId(Item.InnerText); }
catch { szOutCurveMode[device] = 0; missingSetting = true; }
try try
{ {
Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ProfileActions"); Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ProfileActions");
@ -3440,16 +3601,19 @@ namespace DS4Windows
LSRotation[device] = 0.0; LSRotation[device] = 0.0;
RSRotation[device] = 0.0; RSRotation[device] = 0.0;
SXDeadzone[device] = SZDeadzone[device] = 0.25; SXDeadzone[device] = SZDeadzone[device] = 0.25;
SXMaxzone[device] = SZMaxzone[device] = 1.0;
SXAntiDeadzone[device] = SZAntiDeadzone[device] = 0.0;
l2Sens[device] = r2Sens[device] = 1; l2Sens[device] = r2Sens[device] = 1;
LSSens[device] = RSSens[device] = 1; LSSens[device] = RSSens[device] = 1;
SXSens[device] = SZSens[device] = 1; SXSens[device] = SZSens[device] = 1;
tapSensitivity[device] = 0; tapSensitivity[device] = 0;
doubleTap[device] = false; doubleTap[device] = false;
scrollSensitivity[device] = 0; scrollSensitivity[device] = 0;
touchpadInvert[device] = 0;
rainbow[device] = 0; rainbow[device] = 0;
flashAt[device] = 0; flashAt[device] = 0;
mouseAccel[device] = true; mouseAccel[device] = true;
btPollRate[device] = 0; btPollRate[device] = 4;
m_LowLeds[device] = new DS4Color(Color.Black); m_LowLeds[device] = new DS4Color(Color.Black);
@ -3484,8 +3648,12 @@ namespace DS4Windows
gyroTriggerTurns[device] = true; gyroTriggerTurns[device] = true;
gyroSmoothing[device] = false; gyroSmoothing[device] = false;
gyroSmoothWeight[device] = 0.5; gyroSmoothWeight[device] = 0.5;
gyroMouseHorizontalAxis[device] = 0;
lsOutCurveMode[device] = 0; lsOutCurveMode[device] = 0;
rsOutCurveMode[device] = 0; rsOutCurveMode[device] = 0;
l2OutCurveMode[device] = 0;
r2OutCurveMode[device] = 0;
sxOutCurveMode[device] = szOutCurveMode[device] = 0;
} }
} }

View File

@ -56,10 +56,8 @@ namespace DS4Windows
public bool mAllowVisible; public bool mAllowVisible;
bool contextclose; bool contextclose;
string logFile = appdatapath + @"\DS4Service.log"; string logFile = appdatapath + @"\DS4Service.log";
//StreamWriter logWriter;
bool turnOffTemp; bool turnOffTemp;
bool runningBat; bool runningBat;
//bool outputlog = false;
Dictionary<Control, string> hoverTextDict = new Dictionary<Control, string>(); Dictionary<Control, string> hoverTextDict = new Dictionary<Control, string>();
// 0 index is used for application version text. 1 - 4 indices are used for controller status // 0 index is used for application version text. 1 - 4 indices are used for controller status
string[] notifyText = { "DS4Windows v" + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion, string[] notifyText = { "DS4Windows v" + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion,
@ -114,6 +112,7 @@ namespace DS4Windows
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[1], (ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[1],
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[2], (ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[2],
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[3] }; (ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[3] };
SystemEvents.PowerModeChanged += OnPowerChange; SystemEvents.PowerModeChanged += OnPowerChange;
tSOptions.Visible = false; tSOptions.Visible = false;
bool firstrun = false; bool firstrun = false;
@ -184,16 +183,14 @@ namespace DS4Windows
Log.GuiLog += On_Debug; Log.GuiLog += On_Debug;
logFile = appdatapath + "\\DS4Windows.log"; logFile = appdatapath + "\\DS4Windows.log";
//logWriter = File.AppendText(logFile);
Log.TrayIconLog += ShowNotification; Log.TrayIconLog += ShowNotification;
// tmrUpdate.Enabled = true; TODO remove tmrUpdate and leave tick()
Directory.CreateDirectory(appdatapath); Directory.CreateDirectory(appdatapath);
Global.Load(); Global.Load();
if (!Save()) //if can't write to file if (!Save()) //if can't write to file
{ {
if (MessageBox.Show("Cannot write at current location\nCopy Settings to appdata?", "DS4Windows", if (MessageBox.Show("Cannot write at current location\nCopy Settings to appdata?", "DS4Windows",
MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes) MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{ {
try try
{ {
@ -270,12 +267,14 @@ namespace DS4Windows
if (Path.GetExtension(s) == ".xml") if (Path.GetExtension(s) == ".xml")
{ {
xDoc.Load(s); xDoc.Load(s);
XmlNode el = xDoc.SelectSingleNode("DS4Windows/ProfileActions"); //.CreateElement("Action"); XmlNode el = xDoc.SelectSingleNode("DS4Windows/ProfileActions");
if (el != null) if (el != null)
{
if (string.IsNullOrEmpty(el.InnerText)) if (string.IsNullOrEmpty(el.InnerText))
el.InnerText = "Disconnect Controller"; el.InnerText = "Disconnect Controller";
else else
el.InnerText += "/Disconnect Controller"; el.InnerText += "/Disconnect Controller";
}
else else
{ {
XmlNode Node = xDoc.SelectSingleNode("DS4Windows"); XmlNode Node = xDoc.SelectSingleNode("DS4Windows");
@ -283,6 +282,7 @@ namespace DS4Windows
el.InnerText = "Disconnect Controller"; el.InnerText = "Disconnect Controller";
Node.AppendChild(el); Node.AppendChild(el);
} }
xDoc.Save(s); xDoc.Save(s);
LoadActions(); LoadActions();
} }
@ -312,11 +312,10 @@ namespace DS4Windows
Form_Resize(null, null); Form_Resize(null, null);
RefreshProfiles(); RefreshProfiles();
opt = new Options(this); opt = new Options(this);
//opt.Text = "Options for Controller " + (devID + 1);
opt.Icon = this.Icon; opt.Icon = this.Icon;
opt.TopLevel = false; opt.TopLevel = false;
opt.Dock = DockStyle.Fill; opt.Dock = DockStyle.Fill;
opt.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; opt.FormBorderStyle = FormBorderStyle.None;
tabProfiles.Controls.Add(opt); tabProfiles.Controls.Add(opt);
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
@ -1374,7 +1373,7 @@ namespace DS4Windows
private void pBStatus_MouseClick(object sender, MouseEventArgs e) private void pBStatus_MouseClick(object sender, MouseEventArgs e)
{ {
int i = Int32.Parse(((PictureBox)sender).Tag.ToString()); int i = Convert.ToInt32(((PictureBox)sender).Tag);
DS4Device d = Program.rootHub.DS4Controllers[i]; DS4Device d = Program.rootHub.DS4Controllers[i];
if (d != null) if (d != null)
{ {
@ -1412,8 +1411,6 @@ namespace DS4Windows
protected void On_Debug(object sender, DebugEventArgs e) protected void On_Debug(object sender, DebugEventArgs e)
{ {
//logWriter.WriteLine(e.Time + ":\t" + e.Data);
//logWriter.Flush();
LogDebug(e.Time, e.Data, e.Warning); LogDebug(e.Time, e.Data, e.Warning);
} }
@ -1613,7 +1610,7 @@ namespace DS4Windows
this.Show(); this.Show();
WindowState = FormWindowState.Normal; WindowState = FormWindowState.Normal;
ToolStripMenuItem em = (ToolStripMenuItem)sender; ToolStripMenuItem em = (ToolStripMenuItem)sender;
int i = Int32.Parse(em.Tag.ToString()); int i = Convert.ToInt32(em.Tag);
if (em.Text == Properties.Resources.ContextNew.Replace("*number*", (i + 1).ToString())) if (em.Text == Properties.Resources.ContextNew.Replace("*number*", (i + 1).ToString()))
ShowOptions(i, ""); ShowOptions(i, "");
else else
@ -1668,7 +1665,7 @@ namespace DS4Windows
private void Profile_Changed(object sender, EventArgs e) //cbs[i] changed private void Profile_Changed(object sender, EventArgs e) //cbs[i] changed
{ {
ComboBox cb = (ComboBox)sender; ComboBox cb = (ComboBox)sender;
int tdevice = Int32.Parse(cb.Tag.ToString()); int tdevice = Convert.ToInt32(cb.Tag);
if (cb.Items[cb.Items.Count - 1].ToString() == "+" + Properties.Resources.PlusNewProfile) if (cb.Items[cb.Items.Count - 1].ToString() == "+" + Properties.Resources.PlusNewProfile)
{ {
if (cb.SelectedIndex < cb.Items.Count - 1) if (cb.SelectedIndex < cb.Items.Count - 1)
@ -1701,7 +1698,7 @@ namespace DS4Windows
private void Profile_Changed_Menu(object sender, ToolStripItemClickedEventArgs e) private void Profile_Changed_Menu(object sender, ToolStripItemClickedEventArgs e)
{ {
ToolStripMenuItem tS = (ToolStripMenuItem)sender; ToolStripMenuItem tS = (ToolStripMenuItem)sender;
int tdevice = Int32.Parse(tS.Tag.ToString()); int tdevice = Convert.ToInt32(tS.Tag);
if (!(e.ClickedItem is ToolStripSeparator)) if (!(e.ClickedItem is ToolStripSeparator))
{ {
if (e.ClickedItem != tS.DropDownItems[tS.DropDownItems.Count - 1]) //if +New Profile not selected if (e.ClickedItem != tS.DropDownItems[tS.DropDownItems.Count - 1]) //if +New Profile not selected
@ -1835,12 +1832,6 @@ namespace DS4Windows
lbLastMessage.Text = lvDebug.Items[lvDebug.Items.Count - 1].SubItems[1].Text; lbLastMessage.Text = lvDebug.Items[lvDebug.Items.Count - 1].SubItems[1].Text;
else else
lbLastMessage.Text = ""; lbLastMessage.Text = "";
/*if (tabMain.SelectedIndex != 1 || !opt.Visible)
opt.inputtimer.Stop();
else if (opt.Visible && tabMain.SelectedIndex == 1)
opt.inputtimer.Start();
*/
} }
private void Items_MouseHover(object sender, EventArgs e) private void Items_MouseHover(object sender, EventArgs e)
@ -1853,23 +1844,6 @@ namespace DS4Windows
} }
lbLastMessage.Text = hoverText; lbLastMessage.Text = hoverText;
/*switch (((System.Windows.Forms.Control)sender).Name)
{
//if (File.Exists(appdatapath + "\\Auto Profiles.xml"))
case "linkUninstall": lbLastMessage.Text = Properties.Resources.IfRemovingDS4Windows; break;
case "cBSwipeProfiles": lbLastMessage.Text = Properties.Resources.TwoFingerSwipe; break;
case "cBQuickCharge": lbLastMessage.Text = Properties.Resources.QuickCharge; break;
case "pnlXIPorts": lbLastMessage.Text = Properties.Resources.XinputPorts; break;
case "lbUseXIPorts": lbLastMessage.Text = Properties.Resources.XinputPorts; break;
case "nUDXIPorts": lbLastMessage.Text = Properties.Resources.XinputPorts; break;
case "lbLastXIPort": lbLastMessage.Text = Properties.Resources.XinputPorts; break;
case "cBCloseMini": lbLastMessage.Text = Properties.Resources.CloseMinimize; break;
default: lbLastMessage.Text = Properties.Resources.HoverOverItems; break;
}
*/
//if (lbLastMessage.Text != Properties.Resources.HoverOverItems)
if (hoverText != Properties.Resources.HoverOverItems) if (hoverText != Properties.Resources.HoverOverItems)
lbLastMessage.ForeColor = Color.Black; lbLastMessage.ForeColor = Color.Black;
else else
@ -2223,6 +2197,9 @@ namespace DS4Windows
blankControllerTab(); blankControllerTab();
Program.rootHub.Stop(); Program.rootHub.Stop();
} }
// Make sure to stop event generation routines. Should fix odd crashes on shutdown
Application.Exit();
} }
private void cBSwipeProfiles_CheckedChanged(object sender, EventArgs e) private void cBSwipeProfiles_CheckedChanged(object sender, EventArgs e)
@ -2296,7 +2273,7 @@ namespace DS4Windows
private void Pads_MouseHover(object sender, EventArgs e) private void Pads_MouseHover(object sender, EventArgs e)
{ {
Label lb = (Label)sender; Label lb = (Label)sender;
int i = Int32.Parse(lb.Tag.ToString()); int i = Convert.ToInt32(lb.Tag);
DS4Device d = Program.rootHub.DS4Controllers[i]; DS4Device d = Program.rootHub.DS4Controllers[i];
if (d != null && d.ConnectionType == ConnectionType.BT) if (d != null && d.ConnectionType == ConnectionType.BT)
{ {
@ -2331,10 +2308,12 @@ namespace DS4Windows
int currentCustomLed; int currentCustomLed;
private void EditCustomLed(object sender, EventArgs e) private void EditCustomLed(object sender, EventArgs e)
{ {
currentCustomLed = int.Parse(((Button)sender).Tag.ToString()); Button btn = (Button)sender;
useCustomColorToolStripMenuItem.Checked = UseCustomLed[currentCustomLed]; currentCustomLed = Convert.ToInt32(btn.Tag);
useProfileColorToolStripMenuItem.Checked = !UseCustomLed[currentCustomLed]; bool customLedChecked = UseCustomLed[currentCustomLed];
cMCustomLed.Show((Button)sender, new Point(0, ((Button)sender).Height)); useCustomColorToolStripMenuItem.Checked = customLedChecked;
useProfileColorToolStripMenuItem.Checked = !customLedChecked;
cMCustomLed.Show(btn, new Point(0, btn.Height));
} }
private void useProfileColorToolStripMenuItem_Click(object sender, EventArgs e) private void useProfileColorToolStripMenuItem_Click(object sender, EventArgs e)
@ -2422,7 +2401,7 @@ namespace DS4Windows
if (principal.IsInRole(WindowsBuiltInRole.Administrator)) if (principal.IsInRole(WindowsBuiltInRole.Administrator))
{ {
TaskService ts = new TaskService(); TaskService ts = new TaskService();
Microsoft.Win32.TaskScheduler.Task tasker = ts.FindTask("RunDS4Windows"); Task tasker = ts.FindTask("RunDS4Windows");
if (tasker != null) if (tasker != null)
{ {
ts.RootFolder.DeleteTask("RunDS4Windows"); ts.RootFolder.DeleteTask("RunDS4Windows");
@ -2444,7 +2423,7 @@ namespace DS4Windows
if (principal.IsInRole(WindowsBuiltInRole.Administrator)) if (principal.IsInRole(WindowsBuiltInRole.Administrator))
{ {
TaskService ts = new TaskService(); TaskService ts = new TaskService();
Microsoft.Win32.TaskScheduler.Task tasker = ts.FindTask("RunDS4Windows"); Task tasker = ts.FindTask("RunDS4Windows");
if (tasker != null) if (tasker != null)
{ {
ts.RootFolder.DeleteTask("RunDS4Windows"); ts.RootFolder.DeleteTask("RunDS4Windows");

View File

@ -76,6 +76,8 @@
this.nUDL2 = new System.Windows.Forms.NumericUpDown(); this.nUDL2 = new System.Windows.Forms.NumericUpDown();
this.gBTouchpad = new System.Windows.Forms.GroupBox(); this.gBTouchpad = new System.Windows.Forms.GroupBox();
this.pnlTPMouse = new System.Windows.Forms.Panel(); this.pnlTPMouse = new System.Windows.Forms.Panel();
this.label15 = new System.Windows.Forms.Label();
this.touchpadInvertComboBox = new System.Windows.Forms.ComboBox();
this.cbStartTouchpadOff = new System.Windows.Forms.CheckBox(); this.cbStartTouchpadOff = new System.Windows.Forms.CheckBox();
this.rBTPControls = new System.Windows.Forms.RadioButton(); this.rBTPControls = new System.Windows.Forms.RadioButton();
this.rBTPMouse = new System.Windows.Forms.RadioButton(); this.rBTPMouse = new System.Windows.Forms.RadioButton();
@ -253,6 +255,10 @@
this.tCSens = new System.Windows.Forms.TabControl(); this.tCSens = new System.Windows.Forms.TabControl();
this.tPDeadzone = new System.Windows.Forms.TabPage(); this.tPDeadzone = new System.Windows.Forms.TabPage();
this.antiDeadzoneTabPage = new System.Windows.Forms.TabPage(); this.antiDeadzoneTabPage = new System.Windows.Forms.TabPage();
this.nUDSixaxisZAntiDead = new System.Windows.Forms.NumericUpDown();
this.nUDSixaxisXAntiDead = new System.Windows.Forms.NumericUpDown();
this.label20 = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
this.nUDR2AntiDead = new System.Windows.Forms.NumericUpDown(); this.nUDR2AntiDead = new System.Windows.Forms.NumericUpDown();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.nUDL2AntiDead = new System.Windows.Forms.NumericUpDown(); this.nUDL2AntiDead = new System.Windows.Forms.NumericUpDown();
@ -262,6 +268,10 @@
this.nUDLSAntiDead = new System.Windows.Forms.NumericUpDown(); this.nUDLSAntiDead = new System.Windows.Forms.NumericUpDown();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.maxZoneTabPage = new System.Windows.Forms.TabPage(); this.maxZoneTabPage = new System.Windows.Forms.TabPage();
this.nUDSixAxisZMaxZone = new System.Windows.Forms.NumericUpDown();
this.nUDSixAxisXMaxZone = new System.Windows.Forms.NumericUpDown();
this.label18 = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
this.nUDR2Maxzone = new System.Windows.Forms.NumericUpDown(); this.nUDR2Maxzone = new System.Windows.Forms.NumericUpDown();
this.nUDL2Maxzone = new System.Windows.Forms.NumericUpDown(); this.nUDL2Maxzone = new System.Windows.Forms.NumericUpDown();
this.label8 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label();
@ -270,6 +280,19 @@
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.nUDLSMaxZone = new System.Windows.Forms.NumericUpDown(); this.nUDLSMaxZone = new System.Windows.Forms.NumericUpDown();
this.label5 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.tPOutCurve = new System.Windows.Forms.TabPage();
this.cBSixaxisZOutputCurve = new System.Windows.Forms.ComboBox();
this.cBSixaxisXOutputCurve = new System.Windows.Forms.ComboBox();
this.label24 = new System.Windows.Forms.Label();
this.label23 = new System.Windows.Forms.Label();
this.cBR2OutputCurve = new System.Windows.Forms.ComboBox();
this.cBL2OutputCurve = new System.Windows.Forms.ComboBox();
this.label22 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
this.rsOutCurveComboBox = new System.Windows.Forms.ComboBox();
this.lsOutCurveComboBox = new System.Windows.Forms.ComboBox();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.tPCurve = new System.Windows.Forms.TabPage(); this.tPCurve = new System.Windows.Forms.TabPage();
this.nUDLSCurve = new System.Windows.Forms.NumericUpDown(); this.nUDLSCurve = new System.Windows.Forms.NumericUpDown();
this.nUDRSCurve = new System.Windows.Forms.NumericUpDown(); this.nUDRSCurve = new System.Windows.Forms.NumericUpDown();
@ -277,16 +300,18 @@
this.lbRSCurvePercent = new System.Windows.Forms.Label(); this.lbRSCurvePercent = new System.Windows.Forms.Label();
this.lbLSCurvePercent = new System.Windows.Forms.Label(); this.lbLSCurvePercent = new System.Windows.Forms.Label();
this.lbLSCurve = new System.Windows.Forms.Label(); this.lbLSCurve = new System.Windows.Forms.Label();
this.tPOutCurve = new System.Windows.Forms.TabPage(); this.tpRotation = new System.Windows.Forms.TabPage();
this.rsOutCurveComboBox = new System.Windows.Forms.ComboBox(); this.nUDRSRotation = new System.Windows.Forms.NumericUpDown();
this.lsOutCurveComboBox = new System.Windows.Forms.ComboBox(); this.label14 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label(); this.nUDLSRotation = new System.Windows.Forms.NumericUpDown();
this.label9 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label();
this.fLPSettings = new System.Windows.Forms.FlowLayoutPanel(); this.fLPSettings = new System.Windows.Forms.FlowLayoutPanel();
this.gBGyro = new System.Windows.Forms.GroupBox(); this.gBGyro = new System.Windows.Forms.GroupBox();
this.rBSAControls = new System.Windows.Forms.RadioButton(); this.rBSAControls = new System.Windows.Forms.RadioButton();
this.rBSAMouse = new System.Windows.Forms.RadioButton(); this.rBSAMouse = new System.Windows.Forms.RadioButton();
this.pnlSAMouse = new System.Windows.Forms.Panel(); this.pnlSAMouse = new System.Windows.Forms.Panel();
this.cBGyroMouseXAxis = new System.Windows.Forms.ComboBox();
this.label16 = new System.Windows.Forms.Label();
this.lbGyroSmooth = new System.Windows.Forms.Label(); this.lbGyroSmooth = new System.Windows.Forms.Label();
this.cBGyroSmooth = new System.Windows.Forms.CheckBox(); this.cBGyroSmooth = new System.Windows.Forms.CheckBox();
this.lbSmoothWeight = new System.Windows.Forms.Label(); this.lbSmoothWeight = new System.Windows.Forms.Label();
@ -337,11 +362,6 @@
this.pSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.alwaysOnToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.alwaysOnToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.advColorDialog = new DS4Windows.AdvancedColorDialog(); this.advColorDialog = new DS4Windows.AdvancedColorDialog();
this.tpRotation = new System.Windows.Forms.TabPage();
this.label13 = new System.Windows.Forms.Label();
this.nUDLSRotation = new System.Windows.Forms.NumericUpDown();
this.label14 = new System.Windows.Forms.Label();
this.nUDRSRotation = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.nUDRainbow)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRainbow)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tBBlueBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tBBlueBar)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tBGreenBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tBGreenBar)).BeginInit();
@ -399,19 +419,26 @@
this.tCSens.SuspendLayout(); this.tCSens.SuspendLayout();
this.tPDeadzone.SuspendLayout(); this.tPDeadzone.SuspendLayout();
this.antiDeadzoneTabPage.SuspendLayout(); this.antiDeadzoneTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDSixaxisZAntiDead)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDSixaxisXAntiDead)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDR2AntiDead)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDR2AntiDead)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDL2AntiDead)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDL2AntiDead)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDRSAntiDead)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRSAntiDead)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDLSAntiDead)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDLSAntiDead)).BeginInit();
this.maxZoneTabPage.SuspendLayout(); this.maxZoneTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDSixAxisZMaxZone)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDSixAxisXMaxZone)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDR2Maxzone)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDR2Maxzone)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDL2Maxzone)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDL2Maxzone)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDRSMaxZone)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRSMaxZone)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDLSMaxZone)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDLSMaxZone)).BeginInit();
this.tPOutCurve.SuspendLayout();
this.tPCurve.SuspendLayout(); this.tPCurve.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDLSCurve)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDLSCurve)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDRSCurve)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRSCurve)).BeginInit();
this.tPOutCurve.SuspendLayout(); this.tpRotation.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDRSRotation)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDLSRotation)).BeginInit();
this.fLPSettings.SuspendLayout(); this.fLPSettings.SuspendLayout();
this.gBGyro.SuspendLayout(); this.gBGyro.SuspendLayout();
this.pnlSAMouse.SuspendLayout(); this.pnlSAMouse.SuspendLayout();
@ -426,9 +453,6 @@
((System.ComponentModel.ISupportInitialize)(this.nUDSXS)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDSXS)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDSZS)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDSZS)).BeginInit();
this.cMGyroTriggers.SuspendLayout(); this.cMGyroTriggers.SuspendLayout();
this.tpRotation.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDLSRotation)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDRSRotation)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// lowColorChooserButton // lowColorChooserButton
@ -887,6 +911,8 @@
// //
// pnlTPMouse // pnlTPMouse
// //
this.pnlTPMouse.Controls.Add(this.label15);
this.pnlTPMouse.Controls.Add(this.touchpadInvertComboBox);
this.pnlTPMouse.Controls.Add(this.nUDScroll); this.pnlTPMouse.Controls.Add(this.nUDScroll);
this.pnlTPMouse.Controls.Add(this.cBDoubleTap); this.pnlTPMouse.Controls.Add(this.cBDoubleTap);
this.pnlTPMouse.Controls.Add(this.cBScroll); this.pnlTPMouse.Controls.Add(this.cBScroll);
@ -900,6 +926,24 @@
resources.ApplyResources(this.pnlTPMouse, "pnlTPMouse"); resources.ApplyResources(this.pnlTPMouse, "pnlTPMouse");
this.pnlTPMouse.Name = "pnlTPMouse"; this.pnlTPMouse.Name = "pnlTPMouse";
// //
// label15
//
resources.ApplyResources(this.label15, "label15");
this.label15.Name = "label15";
//
// touchpadInvertComboBox
//
this.touchpadInvertComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.touchpadInvertComboBox.FormattingEnabled = true;
this.touchpadInvertComboBox.Items.AddRange(new object[] {
resources.GetString("touchpadInvertComboBox.Items"),
resources.GetString("touchpadInvertComboBox.Items1"),
resources.GetString("touchpadInvertComboBox.Items2"),
resources.GetString("touchpadInvertComboBox.Items3")});
resources.ApplyResources(this.touchpadInvertComboBox, "touchpadInvertComboBox");
this.touchpadInvertComboBox.Name = "touchpadInvertComboBox";
this.touchpadInvertComboBox.SelectedIndexChanged += new System.EventHandler(this.touchpadInvertComboBox_SelectedIndexChanged);
//
// cbStartTouchpadOff // cbStartTouchpadOff
// //
resources.ApplyResources(this.cbStartTouchpadOff, "cbStartTouchpadOff"); resources.ApplyResources(this.cbStartTouchpadOff, "cbStartTouchpadOff");
@ -2639,8 +2683,8 @@
this.tCSens.Controls.Add(this.tPDeadzone); this.tCSens.Controls.Add(this.tPDeadzone);
this.tCSens.Controls.Add(this.antiDeadzoneTabPage); this.tCSens.Controls.Add(this.antiDeadzoneTabPage);
this.tCSens.Controls.Add(this.maxZoneTabPage); this.tCSens.Controls.Add(this.maxZoneTabPage);
this.tCSens.Controls.Add(this.tPCurve);
this.tCSens.Controls.Add(this.tPOutCurve); this.tCSens.Controls.Add(this.tPOutCurve);
this.tCSens.Controls.Add(this.tPCurve);
this.tCSens.Controls.Add(this.tpRotation); this.tCSens.Controls.Add(this.tpRotation);
resources.ApplyResources(this.tCSens, "tCSens"); resources.ApplyResources(this.tCSens, "tCSens");
this.tCSens.Name = "tCSens"; this.tCSens.Name = "tCSens";
@ -2666,6 +2710,10 @@
// //
// antiDeadzoneTabPage // antiDeadzoneTabPage
// //
this.antiDeadzoneTabPage.Controls.Add(this.nUDSixaxisZAntiDead);
this.antiDeadzoneTabPage.Controls.Add(this.nUDSixaxisXAntiDead);
this.antiDeadzoneTabPage.Controls.Add(this.label20);
this.antiDeadzoneTabPage.Controls.Add(this.label19);
this.antiDeadzoneTabPage.Controls.Add(this.nUDR2AntiDead); this.antiDeadzoneTabPage.Controls.Add(this.nUDR2AntiDead);
this.antiDeadzoneTabPage.Controls.Add(this.label3); this.antiDeadzoneTabPage.Controls.Add(this.label3);
this.antiDeadzoneTabPage.Controls.Add(this.nUDL2AntiDead); this.antiDeadzoneTabPage.Controls.Add(this.nUDL2AntiDead);
@ -2678,6 +2726,50 @@
this.antiDeadzoneTabPage.Name = "antiDeadzoneTabPage"; this.antiDeadzoneTabPage.Name = "antiDeadzoneTabPage";
this.antiDeadzoneTabPage.UseVisualStyleBackColor = true; this.antiDeadzoneTabPage.UseVisualStyleBackColor = true;
// //
// nUDSixaxisZAntiDead
//
this.nUDSixaxisZAntiDead.DecimalPlaces = 2;
this.nUDSixaxisZAntiDead.Increment = new decimal(new int[] {
1,
0,
0,
65536});
resources.ApplyResources(this.nUDSixaxisZAntiDead, "nUDSixaxisZAntiDead");
this.nUDSixaxisZAntiDead.Maximum = new decimal(new int[] {
1,
0,
0,
0});
this.nUDSixaxisZAntiDead.Name = "nUDSixaxisZAntiDead";
this.nUDSixaxisZAntiDead.ValueChanged += new System.EventHandler(this.nUDSixaxisZAntiDead_ValueChanged);
//
// nUDSixaxisXAntiDead
//
this.nUDSixaxisXAntiDead.DecimalPlaces = 2;
this.nUDSixaxisXAntiDead.Increment = new decimal(new int[] {
1,
0,
0,
65536});
resources.ApplyResources(this.nUDSixaxisXAntiDead, "nUDSixaxisXAntiDead");
this.nUDSixaxisXAntiDead.Maximum = new decimal(new int[] {
1,
0,
0,
0});
this.nUDSixaxisXAntiDead.Name = "nUDSixaxisXAntiDead";
this.nUDSixaxisXAntiDead.ValueChanged += new System.EventHandler(this.nUDSixaxisXAntiDead_ValueChanged);
//
// label20
//
resources.ApplyResources(this.label20, "label20");
this.label20.Name = "label20";
//
// label19
//
resources.ApplyResources(this.label19, "label19");
this.label19.Name = "label19";
//
// nUDR2AntiDead // nUDR2AntiDead
// //
this.nUDR2AntiDead.DecimalPlaces = 2; this.nUDR2AntiDead.DecimalPlaces = 2;
@ -2768,6 +2860,10 @@
// //
// maxZoneTabPage // maxZoneTabPage
// //
this.maxZoneTabPage.Controls.Add(this.nUDSixAxisZMaxZone);
this.maxZoneTabPage.Controls.Add(this.nUDSixAxisXMaxZone);
this.maxZoneTabPage.Controls.Add(this.label18);
this.maxZoneTabPage.Controls.Add(this.label17);
this.maxZoneTabPage.Controls.Add(this.nUDR2Maxzone); this.maxZoneTabPage.Controls.Add(this.nUDR2Maxzone);
this.maxZoneTabPage.Controls.Add(this.nUDL2Maxzone); this.maxZoneTabPage.Controls.Add(this.nUDL2Maxzone);
this.maxZoneTabPage.Controls.Add(this.label8); this.maxZoneTabPage.Controls.Add(this.label8);
@ -2780,6 +2876,60 @@
this.maxZoneTabPage.Name = "maxZoneTabPage"; this.maxZoneTabPage.Name = "maxZoneTabPage";
this.maxZoneTabPage.UseVisualStyleBackColor = true; this.maxZoneTabPage.UseVisualStyleBackColor = true;
// //
// nUDSixAxisZMaxZone
//
this.nUDSixAxisZMaxZone.DecimalPlaces = 2;
this.nUDSixAxisZMaxZone.Increment = new decimal(new int[] {
1,
0,
0,
65536});
resources.ApplyResources(this.nUDSixAxisZMaxZone, "nUDSixAxisZMaxZone");
this.nUDSixAxisZMaxZone.Maximum = new decimal(new int[] {
1,
0,
0,
0});
this.nUDSixAxisZMaxZone.Name = "nUDSixAxisZMaxZone";
this.nUDSixAxisZMaxZone.Value = new decimal(new int[] {
1,
0,
0,
0});
this.nUDSixAxisZMaxZone.ValueChanged += new System.EventHandler(this.nUDSixAxisZMaxZone_ValueChanged);
//
// nUDSixAxisXMaxZone
//
this.nUDSixAxisXMaxZone.DecimalPlaces = 2;
this.nUDSixAxisXMaxZone.Increment = new decimal(new int[] {
1,
0,
0,
65536});
resources.ApplyResources(this.nUDSixAxisXMaxZone, "nUDSixAxisXMaxZone");
this.nUDSixAxisXMaxZone.Maximum = new decimal(new int[] {
1,
0,
0,
0});
this.nUDSixAxisXMaxZone.Name = "nUDSixAxisXMaxZone";
this.nUDSixAxisXMaxZone.Value = new decimal(new int[] {
1,
0,
0,
0});
this.nUDSixAxisXMaxZone.ValueChanged += new System.EventHandler(this.nUDSixAxisXMaxZone_ValueChanged);
//
// label18
//
resources.ApplyResources(this.label18, "label18");
this.label18.Name = "label18";
//
// label17
//
resources.ApplyResources(this.label17, "label17");
this.label17.Name = "label17";
//
// nUDR2Maxzone // nUDR2Maxzone
// //
this.nUDR2Maxzone.DecimalPlaces = 2; this.nUDR2Maxzone.DecimalPlaces = 2;
@ -2888,6 +3038,134 @@
resources.ApplyResources(this.label5, "label5"); resources.ApplyResources(this.label5, "label5");
this.label5.Name = "label5"; this.label5.Name = "label5";
// //
// tPOutCurve
//
this.tPOutCurve.Controls.Add(this.cBSixaxisZOutputCurve);
this.tPOutCurve.Controls.Add(this.cBSixaxisXOutputCurve);
this.tPOutCurve.Controls.Add(this.label24);
this.tPOutCurve.Controls.Add(this.label23);
this.tPOutCurve.Controls.Add(this.cBR2OutputCurve);
this.tPOutCurve.Controls.Add(this.cBL2OutputCurve);
this.tPOutCurve.Controls.Add(this.label22);
this.tPOutCurve.Controls.Add(this.label21);
this.tPOutCurve.Controls.Add(this.rsOutCurveComboBox);
this.tPOutCurve.Controls.Add(this.lsOutCurveComboBox);
this.tPOutCurve.Controls.Add(this.label10);
this.tPOutCurve.Controls.Add(this.label9);
resources.ApplyResources(this.tPOutCurve, "tPOutCurve");
this.tPOutCurve.Name = "tPOutCurve";
this.tPOutCurve.UseVisualStyleBackColor = true;
//
// cBSixaxisZOutputCurve
//
this.cBSixaxisZOutputCurve.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBSixaxisZOutputCurve.DropDownWidth = 70;
this.cBSixaxisZOutputCurve.FormattingEnabled = true;
this.cBSixaxisZOutputCurve.Items.AddRange(new object[] {
resources.GetString("cBSixaxisZOutputCurve.Items"),
resources.GetString("cBSixaxisZOutputCurve.Items1"),
resources.GetString("cBSixaxisZOutputCurve.Items2")});
resources.ApplyResources(this.cBSixaxisZOutputCurve, "cBSixaxisZOutputCurve");
this.cBSixaxisZOutputCurve.Name = "cBSixaxisZOutputCurve";
this.cBSixaxisZOutputCurve.SelectedIndexChanged += new System.EventHandler(this.cBSixaxisZOutputCurve_SelectedIndexChanged);
//
// cBSixaxisXOutputCurve
//
this.cBSixaxisXOutputCurve.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBSixaxisXOutputCurve.DropDownWidth = 70;
this.cBSixaxisXOutputCurve.FormattingEnabled = true;
this.cBSixaxisXOutputCurve.Items.AddRange(new object[] {
resources.GetString("cBSixaxisXOutputCurve.Items"),
resources.GetString("cBSixaxisXOutputCurve.Items1"),
resources.GetString("cBSixaxisXOutputCurve.Items2")});
resources.ApplyResources(this.cBSixaxisXOutputCurve, "cBSixaxisXOutputCurve");
this.cBSixaxisXOutputCurve.Name = "cBSixaxisXOutputCurve";
this.cBSixaxisXOutputCurve.SelectedIndexChanged += new System.EventHandler(this.cBSixaxisXOutputCurve_SelectedIndexChanged);
//
// label24
//
resources.ApplyResources(this.label24, "label24");
this.label24.Name = "label24";
//
// label23
//
resources.ApplyResources(this.label23, "label23");
this.label23.Name = "label23";
//
// cBR2OutputCurve
//
this.cBR2OutputCurve.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBR2OutputCurve.DropDownWidth = 70;
this.cBR2OutputCurve.FormattingEnabled = true;
this.cBR2OutputCurve.Items.AddRange(new object[] {
resources.GetString("cBR2OutputCurve.Items"),
resources.GetString("cBR2OutputCurve.Items1"),
resources.GetString("cBR2OutputCurve.Items2")});
resources.ApplyResources(this.cBR2OutputCurve, "cBR2OutputCurve");
this.cBR2OutputCurve.Name = "cBR2OutputCurve";
this.cBR2OutputCurve.SelectedIndexChanged += new System.EventHandler(this.cBR2OutputCurve_SelectedIndexChanged);
//
// cBL2OutputCurve
//
this.cBL2OutputCurve.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBL2OutputCurve.DropDownWidth = 70;
this.cBL2OutputCurve.FormattingEnabled = true;
this.cBL2OutputCurve.Items.AddRange(new object[] {
resources.GetString("cBL2OutputCurve.Items"),
resources.GetString("cBL2OutputCurve.Items1"),
resources.GetString("cBL2OutputCurve.Items2")});
resources.ApplyResources(this.cBL2OutputCurve, "cBL2OutputCurve");
this.cBL2OutputCurve.Name = "cBL2OutputCurve";
this.cBL2OutputCurve.SelectedIndexChanged += new System.EventHandler(this.cBL2OutputCurve_SelectedIndexChanged);
//
// label22
//
resources.ApplyResources(this.label22, "label22");
this.label22.Name = "label22";
//
// label21
//
resources.ApplyResources(this.label21, "label21");
this.label21.Name = "label21";
//
// rsOutCurveComboBox
//
this.rsOutCurveComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.rsOutCurveComboBox.DropDownWidth = 120;
this.rsOutCurveComboBox.FormattingEnabled = true;
this.rsOutCurveComboBox.Items.AddRange(new object[] {
resources.GetString("rsOutCurveComboBox.Items"),
resources.GetString("rsOutCurveComboBox.Items1"),
resources.GetString("rsOutCurveComboBox.Items2"),
resources.GetString("rsOutCurveComboBox.Items3")});
resources.ApplyResources(this.rsOutCurveComboBox, "rsOutCurveComboBox");
this.rsOutCurveComboBox.Name = "rsOutCurveComboBox";
this.rsOutCurveComboBox.SelectedIndexChanged += new System.EventHandler(this.rsOutCurveComboBox_SelectedIndexChanged);
//
// lsOutCurveComboBox
//
this.lsOutCurveComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.lsOutCurveComboBox.DropDownWidth = 120;
this.lsOutCurveComboBox.FormattingEnabled = true;
this.lsOutCurveComboBox.Items.AddRange(new object[] {
resources.GetString("lsOutCurveComboBox.Items"),
resources.GetString("lsOutCurveComboBox.Items1"),
resources.GetString("lsOutCurveComboBox.Items2"),
resources.GetString("lsOutCurveComboBox.Items3")});
resources.ApplyResources(this.lsOutCurveComboBox, "lsOutCurveComboBox");
this.lsOutCurveComboBox.Name = "lsOutCurveComboBox";
this.lsOutCurveComboBox.SelectedIndexChanged += new System.EventHandler(this.lsOutCurveComboBox_SelectedIndexChanged);
//
// label10
//
resources.ApplyResources(this.label10, "label10");
this.label10.Name = "label10";
//
// label9
//
resources.ApplyResources(this.label9, "label9");
this.label9.Name = "label9";
//
// tPCurve // tPCurve
// //
this.tPCurve.BackColor = System.Drawing.Color.WhiteSmoke; this.tPCurve.BackColor = System.Drawing.Color.WhiteSmoke;
@ -2942,53 +3220,57 @@
resources.ApplyResources(this.lbLSCurve, "lbLSCurve"); resources.ApplyResources(this.lbLSCurve, "lbLSCurve");
this.lbLSCurve.Name = "lbLSCurve"; this.lbLSCurve.Name = "lbLSCurve";
// //
// tPOutCurve // tpRotation
// //
this.tPOutCurve.Controls.Add(this.rsOutCurveComboBox); this.tpRotation.Controls.Add(this.nUDRSRotation);
this.tPOutCurve.Controls.Add(this.lsOutCurveComboBox); this.tpRotation.Controls.Add(this.label14);
this.tPOutCurve.Controls.Add(this.label10); this.tpRotation.Controls.Add(this.nUDLSRotation);
this.tPOutCurve.Controls.Add(this.label9); this.tpRotation.Controls.Add(this.label13);
resources.ApplyResources(this.tPOutCurve, "tPOutCurve"); resources.ApplyResources(this.tpRotation, "tpRotation");
this.tPOutCurve.Name = "tPOutCurve"; this.tpRotation.Name = "tpRotation";
this.tPOutCurve.UseVisualStyleBackColor = true; this.tpRotation.UseVisualStyleBackColor = true;
// //
// rsOutCurveComboBox // nUDRSRotation
// //
this.rsOutCurveComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; resources.ApplyResources(this.nUDRSRotation, "nUDRSRotation");
this.rsOutCurveComboBox.DropDownWidth = 100; this.nUDRSRotation.Maximum = new decimal(new int[] {
this.rsOutCurveComboBox.FormattingEnabled = true; 180,
this.rsOutCurveComboBox.Items.AddRange(new object[] { 0,
resources.GetString("rsOutCurveComboBox.Items"), 0,
resources.GetString("rsOutCurveComboBox.Items1"), 0});
resources.GetString("rsOutCurveComboBox.Items2"), this.nUDRSRotation.Minimum = new decimal(new int[] {
resources.GetString("rsOutCurveComboBox.Items3")}); 180,
resources.ApplyResources(this.rsOutCurveComboBox, "rsOutCurveComboBox"); 0,
this.rsOutCurveComboBox.Name = "rsOutCurveComboBox"; 0,
this.rsOutCurveComboBox.SelectedIndexChanged += new System.EventHandler(this.rsOutCurveComboBox_SelectedIndexChanged); -2147483648});
this.nUDRSRotation.Name = "nUDRSRotation";
this.nUDRSRotation.ValueChanged += new System.EventHandler(this.nUDRSRotation_ValueChanged);
// //
// lsOutCurveComboBox // label14
// //
this.lsOutCurveComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; resources.ApplyResources(this.label14, "label14");
this.lsOutCurveComboBox.DropDownWidth = 100; this.label14.Name = "label14";
this.lsOutCurveComboBox.FormattingEnabled = true;
this.lsOutCurveComboBox.Items.AddRange(new object[] {
resources.GetString("lsOutCurveComboBox.Items"),
resources.GetString("lsOutCurveComboBox.Items1"),
resources.GetString("lsOutCurveComboBox.Items2"),
resources.GetString("lsOutCurveComboBox.Items3")});
resources.ApplyResources(this.lsOutCurveComboBox, "lsOutCurveComboBox");
this.lsOutCurveComboBox.Name = "lsOutCurveComboBox";
this.lsOutCurveComboBox.SelectedIndexChanged += new System.EventHandler(this.lsOutCurveComboBox_SelectedIndexChanged);
// //
// label10 // nUDLSRotation
// //
resources.ApplyResources(this.label10, "label10"); resources.ApplyResources(this.nUDLSRotation, "nUDLSRotation");
this.label10.Name = "label10"; this.nUDLSRotation.Maximum = new decimal(new int[] {
180,
0,
0,
0});
this.nUDLSRotation.Minimum = new decimal(new int[] {
180,
0,
0,
-2147483648});
this.nUDLSRotation.Name = "nUDLSRotation";
this.nUDLSRotation.ValueChanged += new System.EventHandler(this.nUDLSRotation_ValueChanged);
// //
// label9 // label13
// //
resources.ApplyResources(this.label9, "label9"); resources.ApplyResources(this.label13, "label13");
this.label9.Name = "label9"; this.label13.Name = "label13";
// //
// fLPSettings // fLPSettings
// //
@ -3031,6 +3313,8 @@
// //
// pnlSAMouse // pnlSAMouse
// //
this.pnlSAMouse.Controls.Add(this.cBGyroMouseXAxis);
this.pnlSAMouse.Controls.Add(this.label16);
this.pnlSAMouse.Controls.Add(this.lbGyroSmooth); this.pnlSAMouse.Controls.Add(this.lbGyroSmooth);
this.pnlSAMouse.Controls.Add(this.cBGyroSmooth); this.pnlSAMouse.Controls.Add(this.cBGyroSmooth);
this.pnlSAMouse.Controls.Add(this.lbSmoothWeight); this.pnlSAMouse.Controls.Add(this.lbSmoothWeight);
@ -3049,6 +3333,22 @@
resources.ApplyResources(this.pnlSAMouse, "pnlSAMouse"); resources.ApplyResources(this.pnlSAMouse, "pnlSAMouse");
this.pnlSAMouse.Name = "pnlSAMouse"; this.pnlSAMouse.Name = "pnlSAMouse";
// //
// cBGyroMouseXAxis
//
this.cBGyroMouseXAxis.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBGyroMouseXAxis.FormattingEnabled = true;
this.cBGyroMouseXAxis.Items.AddRange(new object[] {
resources.GetString("cBGyroMouseXAxis.Items"),
resources.GetString("cBGyroMouseXAxis.Items1")});
resources.ApplyResources(this.cBGyroMouseXAxis, "cBGyroMouseXAxis");
this.cBGyroMouseXAxis.Name = "cBGyroMouseXAxis";
this.cBGyroMouseXAxis.SelectedIndexChanged += new System.EventHandler(this.cBGyroMouseXAxis_SelectedIndexChanged);
//
// label16
//
resources.ApplyResources(this.label16, "label16");
this.label16.Name = "label16";
//
// lbGyroSmooth // lbGyroSmooth
// //
resources.ApplyResources(this.lbGyroSmooth, "lbGyroSmooth"); resources.ApplyResources(this.lbGyroSmooth, "lbGyroSmooth");
@ -3575,58 +3875,6 @@
resources.ApplyResources(this.alwaysOnToolStripMenuItem, "alwaysOnToolStripMenuItem"); resources.ApplyResources(this.alwaysOnToolStripMenuItem, "alwaysOnToolStripMenuItem");
this.alwaysOnToolStripMenuItem.CheckedChanged += new System.EventHandler(this.SATrigger_CheckedChanged); this.alwaysOnToolStripMenuItem.CheckedChanged += new System.EventHandler(this.SATrigger_CheckedChanged);
// //
// tpRotation
//
this.tpRotation.Controls.Add(this.nUDRSRotation);
this.tpRotation.Controls.Add(this.label14);
this.tpRotation.Controls.Add(this.nUDLSRotation);
this.tpRotation.Controls.Add(this.label13);
resources.ApplyResources(this.tpRotation, "tpRotation");
this.tpRotation.Name = "tpRotation";
this.tpRotation.UseVisualStyleBackColor = true;
//
// label13
//
resources.ApplyResources(this.label13, "label13");
this.label13.Name = "label13";
//
// nUDLSRotation
//
resources.ApplyResources(this.nUDLSRotation, "nUDLSRotation");
this.nUDLSRotation.Maximum = new decimal(new int[] {
180,
0,
0,
0});
this.nUDLSRotation.Minimum = new decimal(new int[] {
180,
0,
0,
-2147483648});
this.nUDLSRotation.Name = "nUDLSRotation";
this.nUDLSRotation.ValueChanged += new System.EventHandler(this.nUDLSRotation_ValueChanged);
//
// label14
//
resources.ApplyResources(this.label14, "label14");
this.label14.Name = "label14";
//
// nUDRSRotation
//
resources.ApplyResources(this.nUDRSRotation, "nUDRSRotation");
this.nUDRSRotation.Maximum = new decimal(new int[] {
180,
0,
0,
0});
this.nUDRSRotation.Minimum = new decimal(new int[] {
180,
0,
0,
-2147483648});
this.nUDRSRotation.Name = "nUDRSRotation";
this.nUDRSRotation.ValueChanged += new System.EventHandler(this.nUDRSRotation_ValueChanged);
//
// Options // Options
// //
resources.ApplyResources(this, "$this"); resources.ApplyResources(this, "$this");
@ -3707,22 +3955,30 @@
this.tPDeadzone.PerformLayout(); this.tPDeadzone.PerformLayout();
this.antiDeadzoneTabPage.ResumeLayout(false); this.antiDeadzoneTabPage.ResumeLayout(false);
this.antiDeadzoneTabPage.PerformLayout(); this.antiDeadzoneTabPage.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDSixaxisZAntiDead)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDSixaxisXAntiDead)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDR2AntiDead)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDR2AntiDead)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDL2AntiDead)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDL2AntiDead)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDRSAntiDead)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRSAntiDead)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDLSAntiDead)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDLSAntiDead)).EndInit();
this.maxZoneTabPage.ResumeLayout(false); this.maxZoneTabPage.ResumeLayout(false);
this.maxZoneTabPage.PerformLayout(); this.maxZoneTabPage.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDSixAxisZMaxZone)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDSixAxisXMaxZone)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDR2Maxzone)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDR2Maxzone)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDL2Maxzone)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDL2Maxzone)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDRSMaxZone)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRSMaxZone)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDLSMaxZone)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDLSMaxZone)).EndInit();
this.tPOutCurve.ResumeLayout(false);
this.tPOutCurve.PerformLayout();
this.tPCurve.ResumeLayout(false); this.tPCurve.ResumeLayout(false);
this.tPCurve.PerformLayout(); this.tPCurve.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDLSCurve)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDLSCurve)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDRSCurve)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRSCurve)).EndInit();
this.tPOutCurve.ResumeLayout(false); this.tpRotation.ResumeLayout(false);
this.tPOutCurve.PerformLayout(); this.tpRotation.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDRSRotation)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDLSRotation)).EndInit();
this.fLPSettings.ResumeLayout(false); this.fLPSettings.ResumeLayout(false);
this.gBGyro.ResumeLayout(false); this.gBGyro.ResumeLayout(false);
this.gBGyro.PerformLayout(); this.gBGyro.PerformLayout();
@ -3740,10 +3996,6 @@
((System.ComponentModel.ISupportInitialize)(this.nUDSXS)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDSXS)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDSZS)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDSZS)).EndInit();
this.cMGyroTriggers.ResumeLayout(false); this.cMGyroTriggers.ResumeLayout(false);
this.tpRotation.ResumeLayout(false);
this.tpRotation.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDLSRotation)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDRSRotation)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -4064,5 +4316,25 @@
private System.Windows.Forms.Label label14; private System.Windows.Forms.Label label14;
private System.Windows.Forms.NumericUpDown nUDLSRotation; private System.Windows.Forms.NumericUpDown nUDLSRotation;
private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.ComboBox touchpadInvertComboBox;
private System.Windows.Forms.ComboBox cBGyroMouseXAxis;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.NumericUpDown nUDSixAxisZMaxZone;
private System.Windows.Forms.NumericUpDown nUDSixAxisXMaxZone;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.NumericUpDown nUDSixaxisZAntiDead;
private System.Windows.Forms.NumericUpDown nUDSixaxisXAntiDead;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.ComboBox cBR2OutputCurve;
private System.Windows.Forms.ComboBox cBL2OutputCurve;
private System.Windows.Forms.ComboBox cBSixaxisZOutputCurve;
private System.Windows.Forms.ComboBox cBSixaxisXOutputCurve;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.Label label23;
} }
} }

View File

@ -30,6 +30,9 @@ namespace DS4Windows
private Dictionary<Control, int> hoverIndexDict = new Dictionary<Control, int>(); private Dictionary<Control, int> hoverIndexDict = new Dictionary<Control, int>();
private Dictionary<Control, Bitmap> hoverImageDict = new Dictionary<Control, Bitmap>(); private Dictionary<Control, Bitmap> hoverImageDict = new Dictionary<Control, Bitmap>();
private Dictionary<Control, Label> hoverLabelDict = new Dictionary<Control, Label>(); private Dictionary<Control, Label> hoverLabelDict = new Dictionary<Control, Label>();
private int[] touchpadInvertToValue = new int[4] { 0, 2, 1, 3 };
int tempInt = 0;
public Options(DS4Form rt) public Options(DS4Form rt)
{ {
@ -338,6 +341,10 @@ namespace DS4Windows
cBTap.Checked = TapSensitivity[device] > 0; cBTap.Checked = TapSensitivity[device] > 0;
cBDoubleTap.Checked = DoubleTap[device]; cBDoubleTap.Checked = DoubleTap[device];
cBTouchpadJitterCompensation.Checked = TouchpadJitterCompensation[device]; cBTouchpadJitterCompensation.Checked = TouchpadJitterCompensation[device];
tempInt = TouchpadInvert[device];
touchpadInvertComboBox.SelectedIndex = touchpadInvertToValue[tempInt];
cBlowerRCOn.Checked = LowerRCOn[device]; cBlowerRCOn.Checked = LowerRCOn[device];
cBFlushHIDQueue.Checked = FlushHIDQueue[device]; cBFlushHIDQueue.Checked = FlushHIDQueue[device];
enableTouchToggleCheckbox.Checked = getEnableTouchToggle(device); enableTouchToggleCheckbox.Checked = getEnableTouchToggle(device);
@ -361,6 +368,10 @@ namespace DS4Windows
btPollRateComboBox.SelectedIndex = getBTPollRate(device); btPollRateComboBox.SelectedIndex = getBTPollRate(device);
lsOutCurveComboBox.SelectedIndex = getLsOutCurveMode(device); lsOutCurveComboBox.SelectedIndex = getLsOutCurveMode(device);
rsOutCurveComboBox.SelectedIndex = getRsOutCurveMode(device); rsOutCurveComboBox.SelectedIndex = getRsOutCurveMode(device);
cBL2OutputCurve.SelectedIndex = getL2OutCurveMode(device);
cBR2OutputCurve.SelectedIndex = getR2OutCurveMode(device);
cBSixaxisXOutputCurve.SelectedIndex = getSXOutCurveMode(device);
cBSixaxisZOutputCurve.SelectedIndex = getSZOutCurveMode(device);
try try
{ {
@ -490,6 +501,7 @@ namespace DS4Windows
{ {
nUDSX.Value = 0.25m; nUDSX.Value = 0.25m;
} }
try try
{ {
nUDSZ.Value = (decimal)SZDeadzone[device]; nUDSZ.Value = (decimal)SZDeadzone[device];
@ -498,6 +510,43 @@ namespace DS4Windows
{ {
nUDSZ.Value = 0.25m; nUDSZ.Value = 0.25m;
} }
try
{
nUDSixAxisXMaxZone.Value = (decimal)SXMaxzone[device];
}
catch
{
nUDSixAxisXMaxZone.Value = 1.0m;
}
try
{
nUDSixAxisZMaxZone.Value = (decimal)SZMaxzone[device];
}
catch
{
nUDSixAxisZMaxZone.Value = 1.0m;
}
try
{
nUDSixaxisXAntiDead.Value = (decimal)SXAntiDeadzone[device];
}
catch
{
nUDSixaxisXAntiDead.Value = 0.0m;
}
try
{
nUDSixaxisZAntiDead.Value = (decimal)SZAntiDeadzone[device];
}
catch
{
nUDSixaxisZAntiDead.Value = 0.0m;
}
try try
{ {
nUDL2S.Value = Math.Round((decimal)L2Sens[device], 2); nUDL2S.Value = Math.Round((decimal)L2Sens[device], 2);
@ -567,27 +616,28 @@ namespace DS4Windows
string[] satriggers = SATriggers[device].Split(','); string[] satriggers = SATriggers[device].Split(',');
List<string> s = new List<string>(); List<string> s = new List<string>();
int gyroTriggerCount = cMGyroTriggers.Items.Count;
for (int i = 0, satrigLen = satriggers.Length; i < satrigLen; i++) for (int i = 0, satrigLen = satriggers.Length; i < satrigLen; i++)
{ {
int tr; int tr = 0;
if (int.TryParse(satriggers[i], out tr)) if (int.TryParse(satriggers[i], out tr))
{ {
if (tr < cMGyroTriggers.Items.Count && tr > -1) if (tr < gyroTriggerCount && tr > -1)
{ {
((ToolStripMenuItem)cMGyroTriggers.Items[tr]).Checked = true; ((ToolStripMenuItem)cMGyroTriggers.Items[tr]).Checked = true;
s.Add(cMGyroTriggers.Items[tr].Text); s.Add(cMGyroTriggers.Items[tr].Text);
} }
else else
{ {
((ToolStripMenuItem)cMGyroTriggers.Items[cMGyroTriggers.Items.Count - 1]).Checked = true; ((ToolStripMenuItem)cMGyroTriggers.Items[gyroTriggerCount - 1]).Checked = true;
s.Add(cMGyroTriggers.Items[cMGyroTriggers.Items.Count - 1].Text); s.Add(cMGyroTriggers.Items[gyroTriggerCount - 1].Text);
break; break;
} }
} }
else else
{ {
((ToolStripMenuItem)cMGyroTriggers.Items[cMGyroTriggers.Items.Count - 1]).Checked = true; ((ToolStripMenuItem)cMGyroTriggers.Items[gyroTriggerCount - 1]).Checked = true;
s.Add(cMGyroTriggers.Items[cMGyroTriggers.Items.Count - 1].Text); s.Add(cMGyroTriggers.Items[gyroTriggerCount - 1].Text);
break; break;
} }
} }
@ -595,21 +645,26 @@ namespace DS4Windows
gyroTriggerBehavior.Checked = GyroTriggerTurns[device]; gyroTriggerBehavior.Checked = GyroTriggerTurns[device];
nUDGyroMouseVertScale.Value = GyroSensVerticalScale[device]; nUDGyroMouseVertScale.Value = GyroSensVerticalScale[device];
int invert = GyroInvert[device]; int invert = GyroInvert[device];
cBGyroInvertX.Checked = invert == 2 || invert == 3; cBGyroInvertX.Checked = (invert & 0x02) == 2;
cBGyroInvertY.Checked = invert == 1 || invert == 3; cBGyroInvertY.Checked = (invert & 0x01) == 1;
if (s.Count > 0) if (s.Count > 0)
btnGyroTriggers.Text = string.Join(", ", s); btnGyroTriggers.Text = string.Join(", ", s);
cBGyroSmooth.Checked = nUDGyroSmoothWeight.Enabled = GyroSmoothing[device]; cBGyroSmooth.Checked = nUDGyroSmoothWeight.Enabled = GyroSmoothing[device];
nUDGyroSmoothWeight.Value = (decimal)(GyroSmoothingWeight[device]); nUDGyroSmoothWeight.Value = (decimal)(GyroSmoothingWeight[device]);
cBGyroMouseXAxis.SelectedIndex = GyroMouseHorizontalAxis[device];
} }
else else
{ {
cBFlashType.SelectedIndex = 0; cBFlashType.SelectedIndex = 0;
cBWhileCharging.SelectedIndex = 0; cBWhileCharging.SelectedIndex = 0;
btPollRateComboBox.SelectedIndex = 0; btPollRateComboBox.SelectedIndex = 4;
lsOutCurveComboBox.SelectedIndex = 0; lsOutCurveComboBox.SelectedIndex = 0;
rsOutCurveComboBox.SelectedIndex = 0; rsOutCurveComboBox.SelectedIndex = 0;
cBL2OutputCurve.SelectedIndex = 0;
cBR2OutputCurve.SelectedIndex = 0;
cBSixaxisXOutputCurve.SelectedIndex = 0;
cBSixaxisZOutputCurve.SelectedIndex = 0;
rBTPMouse.Checked = true; rBTPMouse.Checked = true;
rBSAControls.Checked = true; rBSAControls.Checked = true;
ToggleRainbow(false); ToggleRainbow(false);
@ -643,6 +698,7 @@ namespace DS4Windows
cBTap.Checked = false; cBTap.Checked = false;
cBDoubleTap.Checked = false; cBDoubleTap.Checked = false;
cBTouchpadJitterCompensation.Checked = true; cBTouchpadJitterCompensation.Checked = true;
touchpadInvertComboBox.SelectedIndex = 0;
cBlowerRCOn.Checked = false; cBlowerRCOn.Checked = false;
cBFlushHIDQueue.Checked = false; cBFlushHIDQueue.Checked = false;
enableTouchToggleCheckbox.Checked = true; enableTouchToggleCheckbox.Checked = true;
@ -667,6 +723,10 @@ namespace DS4Windows
nUDRSRotation.Value = 0; nUDRSRotation.Value = 0;
nUDSX.Value = .25m; nUDSX.Value = .25m;
nUDSZ.Value = .25m; nUDSZ.Value = .25m;
nUDSixAxisXMaxZone.Value = 1.0m;
nUDSixAxisZMaxZone.Value = 1.0m;
nUDSixaxisXAntiDead.Value = 0.0m;
nUDSixaxisZAntiDead.Value = 0.0m;
nUDL2S.Value = 1; nUDL2S.Value = 1;
nUDR2S.Value = 1; nUDR2S.Value = 1;
@ -692,6 +752,7 @@ namespace DS4Windows
cBGyroInvertY.Checked = false; cBGyroInvertY.Checked = false;
cBGyroSmooth.Checked = false; cBGyroSmooth.Checked = false;
nUDGyroSmoothWeight.Value = 0.5m; nUDGyroSmoothWeight.Value = 0.5m;
cBGyroMouseXAxis.SelectedIndex = 0;
Set(); Set();
} }
@ -716,7 +777,7 @@ namespace DS4Windows
case "Macro": lvi.SubItems.Add(Properties.Resources.Macro + (action.keyType.HasFlag(DS4KeyType.ScanCode) ? " (" + Properties.Resources.ScanCode + ")" : "")); break; case "Macro": lvi.SubItems.Add(Properties.Resources.Macro + (action.keyType.HasFlag(DS4KeyType.ScanCode) ? " (" + Properties.Resources.ScanCode + ")" : "")); break;
case "Program": lvi.SubItems.Add(Properties.Resources.LaunchProgram.Replace("*program*", Path.GetFileNameWithoutExtension(action.details))); break; case "Program": lvi.SubItems.Add(Properties.Resources.LaunchProgram.Replace("*program*", Path.GetFileNameWithoutExtension(action.details))); break;
case "Profile": lvi.SubItems.Add(Properties.Resources.LoadProfile.Replace("*profile*", action.details)); break; case "Profile": lvi.SubItems.Add(Properties.Resources.LoadProfile.Replace("*profile*", action.details)); break;
case "Key": lvi.SubItems.Add(((Keys)int.Parse(action.details)).ToString() + (action.uTrigger.Count > 0 ? " (Toggle)" : "")); break; case "Key": lvi.SubItems.Add(((Keys)Convert.ToInt32(action.details)).ToString() + (action.uTrigger.Count > 0 ? " (Toggle)" : "")); break;
case "DisconnectBT": case "DisconnectBT":
lvi.SubItems.Add(Properties.Resources.DisconnectBT); lvi.SubItems.Add(Properties.Resources.DisconnectBT);
break; break;
@ -754,18 +815,7 @@ namespace DS4Windows
} }
} }
/*public double Clamp(double min, double value, double max) private void EnableReadings(bool on)
{
if (value > max)
return max;
else if (value < min)
return min;
else
return value;
}
*/
void EnableReadings(bool on)
{ {
lbL2Track.Enabled = on; lbL2Track.Enabled = on;
lbR2Track.Enabled = on; lbR2Track.Enabled = on;
@ -780,13 +830,14 @@ namespace DS4Windows
btnSATrackS.Visible = on; btnSATrackS.Visible = on;
} }
void ControllerReadout_Tick(object sender, EventArgs e) private void ControllerReadout_Tick(object sender, EventArgs e)
{ {
// MEMS gyro data is all calibrated to roughly -1G..1G for values -0x2000..0x1fff // MEMS gyro data is all calibrated to roughly -1G..1G for values -0x2000..0x1fff
// Enough additional acceleration and we are no longer mostly measuring Earth's gravity... // Enough additional acceleration and we are no longer mostly measuring Earth's gravity...
// We should try to indicate setpoints of the calibration when exposing this measurement.... // We should try to indicate setpoints of the calibration when exposing this measurement....
int tempDeviceNum = (int)nUDSixaxis.Value - 1; int tempDeviceNum = (int)nUDSixaxis.Value - 1;
DS4Device ds = Program.rootHub.DS4Controllers[tempDeviceNum]; DS4Device ds = Program.rootHub.DS4Controllers[tempDeviceNum];
if (ds == null) if (ds == null)
{ {
EnableReadings(false); EnableReadings(false);
@ -797,15 +848,19 @@ namespace DS4Windows
else else
{ {
EnableReadings(true); EnableReadings(true);
SetDynamicTrackBarValue(tBsixaxisGyroX, (Program.rootHub.ExposedState[tempDeviceNum].GyroX + tBsixaxisGyroX.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisGyroY, (Program.rootHub.ExposedState[tempDeviceNum].GyroY + tBsixaxisGyroY.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisGyroZ, (Program.rootHub.ExposedState[tempDeviceNum].GyroZ + tBsixaxisGyroZ.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisAccelX, (int)(Program.rootHub.ExposedState[tempDeviceNum].AccelX + tBsixaxisAccelX.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisAccelY, (int)(Program.rootHub.ExposedState[tempDeviceNum].AccelY + tBsixaxisAccelY.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisAccelZ, (int)(Program.rootHub.ExposedState[tempDeviceNum].AccelZ + tBsixaxisAccelZ.Value * 2) / 3);
int x = Program.rootHub.getDS4State(tempDeviceNum).LX; DS4StateExposed exposeState = Program.rootHub.ExposedState[tempDeviceNum];
int y = Program.rootHub.getDS4State(tempDeviceNum).LY; DS4State baseState = Program.rootHub.getDS4State(tempDeviceNum);
SetDynamicTrackBarValue(tBsixaxisGyroX, (exposeState.getGyroYaw() + tBsixaxisGyroX.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisGyroY, (exposeState.getGyroPitch() + tBsixaxisGyroY.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisGyroZ, (exposeState.getGyroRoll() + tBsixaxisGyroZ.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisAccelX, (exposeState.getAccelX() + tBsixaxisAccelX.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisAccelY, (exposeState.getAccelY() + tBsixaxisAccelY.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisAccelZ, (exposeState.getAccelZ() + tBsixaxisAccelZ.Value * 2) / 3);
int x = baseState.LX;
int y = baseState.LY;
double tempLSS = (double)nUDLSS.Value; double tempLSS = (double)nUDLSS.Value;
btnLSTrackS.Visible = tempLSS != 1; btnLSTrackS.Visible = tempLSS != 1;
@ -849,8 +904,8 @@ namespace DS4Windows
(int)(tempLSS * (btnLSTrack.Location.Y - pnlLSTrack.Size.Height / 2f) + pnlLSTrack.Size.Height / 2f)); (int)(tempLSS * (btnLSTrack.Location.Y - pnlLSTrack.Size.Height / 2f) + pnlLSTrack.Size.Height / 2f));
} }
x = Program.rootHub.getDS4State(tempDeviceNum).RX; x = baseState.RX;
y = Program.rootHub.getDS4State(tempDeviceNum).RY; y = baseState.RY;
double tempRSS = (double)nUDRSS.Value; double tempRSS = (double)nUDRSS.Value;
btnRSTrackS.Visible = tempRSS != 1; btnRSTrackS.Visible = tempRSS != 1;
@ -894,8 +949,8 @@ namespace DS4Windows
(int)(tempRSS * (btnRSTrack.Location.Y - pnlRSTrack.Size.Height / 2f) + pnlRSTrack.Size.Height / 2f)); (int)(tempRSS * (btnRSTrack.Location.Y - pnlRSTrack.Size.Height / 2f) + pnlRSTrack.Size.Height / 2f));
} }
x = -Program.rootHub.ExposedState[tempDeviceNum].GyroX + 127; x = exposeState.getAccelX() + 127;
y = Program.rootHub.ExposedState[tempDeviceNum].GyroZ + 127; y = exposeState.getAccelZ() + 127;
btnSATrack.Location = new Point((int)(dpix * Global.Clamp(0, x / 2.09, pnlSATrack.Size.Width)), (int)(dpiy * Global.Clamp(0, y / 2.09, pnlSATrack.Size.Height))); btnSATrack.Location = new Point((int)(dpix * Global.Clamp(0, x / 2.09, pnlSATrack.Size.Width)), (int)(dpiy * Global.Clamp(0, y / 2.09, pnlSATrack.Size.Height)));
double tempSXS = (double)nUDSXS.Value; double tempSXS = (double)nUDSXS.Value;
@ -909,7 +964,7 @@ namespace DS4Windows
double tempL2 = (double)nUDL2.Value; double tempL2 = (double)nUDL2.Value;
double tempL2S = (double)nUDL2S.Value; double tempL2S = (double)nUDL2S.Value;
tBL2.Value = Program.rootHub.getDS4State(tempDeviceNum).L2; tBL2.Value = baseState.L2;
lbL2Track.Location = new Point(tBL2.Location.X - (int)(dpix * 25), lbL2Track.Location = new Point(tBL2.Location.X - (int)(dpix * 25),
Math.Max((int)(((tBL2.Location.Y + tBL2.Size.Height) - (tBL2.Value * tempL2S) / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20), Math.Max((int)(((tBL2.Location.Y + tBL2.Size.Height) - (tBL2.Value * tempL2S) / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20),
(int)(1 * ((tBL2.Location.Y + tBL2.Size.Height) - 255 / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20))); (int)(1 * ((tBL2.Location.Y + tBL2.Size.Height) - 255 / (tBL2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20)));
@ -923,7 +978,7 @@ namespace DS4Windows
double tempR2 = (double)nUDR2.Value; double tempR2 = (double)nUDR2.Value;
double tempR2S = (double)nUDR2S.Value; double tempR2S = (double)nUDR2S.Value;
tBR2.Value = Program.rootHub.getDS4State(tempDeviceNum).R2; tBR2.Value = baseState.R2;
lbR2Track.Location = new Point(tBR2.Location.X + (int)(dpix * 25), lbR2Track.Location = new Point(tBR2.Location.X + (int)(dpix * 25),
Math.Max((int)(1 * ((tBR2.Location.Y + tBR2.Size.Height) - (tBR2.Value * tempR2S) / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20), Math.Max((int)(1 * ((tBR2.Location.Y + tBR2.Size.Height) - (tBR2.Value * tempR2S) / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20),
(int)(1 * ((tBR2.Location.Y + tBR2.Size.Height) - 255 / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20))); (int)(1 * ((tBR2.Location.Y + tBR2.Size.Height) - 255 / (tBR2.Size.Height * .0209f / Math.Pow(dpix, 2))) - dpix * 20)));
@ -943,7 +998,7 @@ namespace DS4Windows
lbInputDelay.BackColor = Color.Red; lbInputDelay.BackColor = Color.Red;
lbInputDelay.ForeColor = Color.White; lbInputDelay.ForeColor = Color.White;
} }
else if (latency > (warnInterval / 2)) else if (latency > (warnInterval * 0.5))
{ {
lbInputDelay.BackColor = Color.Yellow; lbInputDelay.BackColor = Color.Yellow;
lbInputDelay.ForeColor = Color.Black; lbInputDelay.ForeColor = Color.Black;
@ -1301,6 +1356,10 @@ namespace DS4Windows
BTPollRate[device] = btPollRateComboBox.SelectedIndex; BTPollRate[device] = btPollRateComboBox.SelectedIndex;
lsOutCurveMode[device] = lsOutCurveComboBox.SelectedIndex; lsOutCurveMode[device] = lsOutCurveComboBox.SelectedIndex;
rsOutCurveMode[device] = rsOutCurveComboBox.SelectedIndex; rsOutCurveMode[device] = rsOutCurveComboBox.SelectedIndex;
l2OutCurveMode[device] = cBL2OutputCurve.SelectedIndex;
r2OutCurveMode[device] = cBR2OutputCurve.SelectedIndex;
sxOutCurveMode[device] = cBSixaxisXOutputCurve.SelectedIndex;
szOutCurveMode[device] = cBSixaxisZOutputCurve.SelectedIndex;
L2Deadzone[device] = (byte)Math.Round((nUDL2.Value * 255), 0); L2Deadzone[device] = (byte)Math.Round((nUDL2.Value * 255), 0);
R2Deadzone[device] = (byte)Math.Round((nUDR2.Value * 255), 0); R2Deadzone[device] = (byte)Math.Round((nUDR2.Value * 255), 0);
L2AntiDeadzone[device] = (int)(nUDL2AntiDead.Value * 100); L2AntiDeadzone[device] = (int)(nUDL2AntiDead.Value * 100);
@ -1312,6 +1371,10 @@ namespace DS4Windows
ScrollSensitivity[device] = (int)nUDScroll.Value; ScrollSensitivity[device] = (int)nUDScroll.Value;
DoubleTap[device] = cBDoubleTap.Checked; DoubleTap[device] = cBDoubleTap.Checked;
TapSensitivity[device] = (byte)nUDTap.Value; TapSensitivity[device] = (byte)nUDTap.Value;
tempInt = touchpadInvertComboBox.SelectedIndex;
TouchpadInvert[device] = touchpadInvertToValue[tempInt];
IdleDisconnectTimeout[device] = (int)(nUDIdleDisconnect.Value * 60); IdleDisconnectTimeout[device] = (int)(nUDIdleDisconnect.Value * 60);
Rainbow[device] = (int)nUDRainbow.Value; Rainbow[device] = (int)nUDRainbow.Value;
RSDeadzone[device] = (int)Math.Round((nUDRS.Value * 127), 0); RSDeadzone[device] = (int)Math.Round((nUDRS.Value * 127), 0);
@ -1326,6 +1389,10 @@ namespace DS4Windows
FlashAt[device] = (int)nUDflashLED.Value; FlashAt[device] = (int)nUDflashLED.Value;
SXDeadzone[device] = (double)nUDSX.Value; SXDeadzone[device] = (double)nUDSX.Value;
SZDeadzone[device] = (double)nUDSZ.Value; SZDeadzone[device] = (double)nUDSZ.Value;
SXMaxzone[device] = (double)nUDSixAxisXMaxZone.Value;
SZMaxzone[device] = (double)nUDSixAxisZMaxZone.Value;
SXAntiDeadzone[device] = (double)nUDSixaxisXAntiDead.Value;
SZAntiDeadzone[device] = (double)nUDSixaxisZAntiDead.Value;
MouseAccel[device] = cBMouseAccel.Checked; MouseAccel[device] = cBMouseAccel.Checked;
DinputOnly[device] = cBDinput.Checked; DinputOnly[device] = cBDinput.Checked;
StartTouchpadOff[device] = cbStartTouchpadOff.Checked; StartTouchpadOff[device] = cbStartTouchpadOff.Checked;
@ -1355,6 +1422,7 @@ namespace DS4Windows
GyroSensVerticalScale[device] = (int)nUDGyroMouseVertScale.Value; GyroSensVerticalScale[device] = (int)nUDGyroMouseVertScale.Value;
GyroSmoothing[device] = cBGyroSmooth.Checked; GyroSmoothing[device] = cBGyroSmooth.Checked;
GyroSmoothingWeight[device] = (double)nUDGyroSmoothWeight.Value; GyroSmoothingWeight[device] = (double)nUDGyroSmoothWeight.Value;
GyroMouseHorizontalAxis[device] = cBGyroMouseXAxis.SelectedIndex;
int invert = 0; int invert = 0;
if (cBGyroInvertX.Checked) if (cBGyroInvertX.Checked)
@ -2893,6 +2961,87 @@ namespace DS4Windows
} }
} }
private void touchpadInvertComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (!loading)
{
tempInt = touchpadInvertToValue[touchpadInvertComboBox.SelectedIndex];
TouchpadInvert[device] = tempInt;
}
}
private void cBGyroMouseXAxis_SelectedIndexChanged(object sender, EventArgs e)
{
if (!loading)
{
GyroMouseHorizontalAxis[device] = cBGyroMouseXAxis.SelectedIndex;
}
}
private void nUDSixAxisXMaxZone_ValueChanged(object sender, EventArgs e)
{
if (!loading)
{
SXMaxzone[device] = (double)nUDSixAxisXMaxZone.Value;
}
}
private void nUDSixAxisZMaxZone_ValueChanged(object sender, EventArgs e)
{
if (!loading)
{
SZMaxzone[device] = (double)nUDSixAxisZMaxZone.Value;
}
}
private void nUDSixaxisXAntiDead_ValueChanged(object sender, EventArgs e)
{
if (loading == false)
{
SXAntiDeadzone[device] = (double)nUDSixaxisXAntiDead.Value;
}
}
private void nUDSixaxisZAntiDead_ValueChanged(object sender, EventArgs e)
{
if (loading == false)
{
SZAntiDeadzone[device] = (double)nUDSixaxisZAntiDead.Value;
}
}
private void cBL2OutputCurve_SelectedIndexChanged(object sender, EventArgs e)
{
if (loading == false)
{
l2OutCurveMode[device] = cBL2OutputCurve.SelectedIndex;
}
}
private void cBR2OutputCurve_SelectedIndexChanged(object sender, EventArgs e)
{
if (loading == false)
{
r2OutCurveMode[device] = cBR2OutputCurve.SelectedIndex;
}
}
private void cBSixaxisXOutputCurve_SelectedIndexChanged(object sender, EventArgs e)
{
if (loading == false)
{
sxOutCurveMode[device] = cBSixaxisXOutputCurve.SelectedIndex;
}
}
private void cBSixaxisZOutputCurve_SelectedIndexChanged(object sender, EventArgs e)
{
if (loading == false)
{
szOutCurveMode[device] = cBSixaxisZOutputCurve.SelectedIndex;
}
}
private void Options_Resize(object sender, EventArgs e) private void Options_Resize(object sender, EventArgs e)
{ {
fLPSettings.AutoScroll = false; fLPSettings.AutoScroll = false;

File diff suppressed because it is too large Load Diff

View File

@ -133,7 +133,6 @@ namespace DS4Windows
private byte[] accel = new byte[6]; private byte[] accel = new byte[6];
private byte[] gyro = new byte[6]; private byte[] gyro = new byte[6];
private byte[] inputReport; private byte[] inputReport;
//private byte[] inputReport2;
private byte[] btInputReport = null; private byte[] btInputReport = null;
private byte[] outputReportBuffer, outputReport; private byte[] outputReportBuffer, outputReport;
private readonly DS4Touchpad touchpad = null; private readonly DS4Touchpad touchpad = null;
@ -164,7 +163,7 @@ namespace DS4Windows
public event EventHandler<EventArgs> Removal = null; public event EventHandler<EventArgs> Removal = null;
public event EventHandler<EventArgs> SyncChange = null; public event EventHandler<EventArgs> SyncChange = null;
public event EventHandler<EventArgs> SerialChange = null; public event EventHandler<EventArgs> SerialChange = null;
public event EventHandler<EventArgs> PublishRemoval = null; //public event EventHandler<EventArgs> PublishRemoval = null;
public HidDevice HidDevice => hDevice; public HidDevice HidDevice => hDevice;
public bool IsExclusive => HidDevice.IsExclusive; public bool IsExclusive => HidDevice.IsExclusive;
@ -415,7 +414,6 @@ namespace DS4Windows
if (conType == ConnectionType.USB || conType == ConnectionType.SONYWA) if (conType == ConnectionType.USB || conType == ConnectionType.SONYWA)
{ {
inputReport = new byte[64]; inputReport = new byte[64];
//inputReport2 = new byte[64];
outputReport = new byte[hDevice.Capabilities.OutputReportByteLength]; outputReport = new byte[hDevice.Capabilities.OutputReportByteLength];
outputReportBuffer = new byte[hDevice.Capabilities.OutputReportByteLength]; outputReportBuffer = new byte[hDevice.Capabilities.OutputReportByteLength];
if (conType == ConnectionType.USB) if (conType == ConnectionType.USB)
@ -668,8 +666,6 @@ namespace DS4Windows
{ {
oldCharging = charging; oldCharging = charging;
currerror = string.Empty; currerror = string.Empty;
curTimeDouble = sw.Elapsed.TotalMilliseconds;
curtime = sw.ElapsedMilliseconds;
if (tempLatencyCount >= 50) if (tempLatencyCount >= 50)
{ {
@ -677,12 +673,9 @@ namespace DS4Windows
tempLatencyCount--; tempLatencyCount--;
} }
lastTimeElapsed = curtime - oldtime;
lastTimeElapsedDouble = (curTimeDouble - oldTimeDouble);
latencyQueue.Enqueue(this.lastTimeElapsed); latencyQueue.Enqueue(this.lastTimeElapsed);
tempLatencyCount++; tempLatencyCount++;
oldtime = curtime;
oldTimeDouble = curTimeDouble;
Latency = latencyQueue.Average(); Latency = latencyQueue.Average();
if (conType == ConnectionType.BT) if (conType == ConnectionType.BT)
@ -691,7 +684,6 @@ namespace DS4Windows
//HidDevice.ReadStatus res = hDevice.ReadAsyncWithFileStream(btInputReport, READ_STREAM_TIMEOUT); //HidDevice.ReadStatus res = hDevice.ReadAsyncWithFileStream(btInputReport, READ_STREAM_TIMEOUT);
HidDevice.ReadStatus res = hDevice.ReadWithFileStream(btInputReport); HidDevice.ReadStatus res = hDevice.ReadWithFileStream(btInputReport);
timeoutEvent = false; timeoutEvent = false;
//HidDevice.ReadStatus res = hDevice.ReadFileOverlapped(btInputReport, READ_STREAM_TIMEOUT);
if (res == HidDevice.ReadStatus.Success) if (res == HidDevice.ReadStatus.Success)
{ {
Array.Copy(btInputReport, 2, inputReport, 0, inputReport.Length); Array.Copy(btInputReport, 2, inputReport, 0, inputReport.Length);
@ -705,7 +697,7 @@ namespace DS4Windows
else else
{ {
int winError = Marshal.GetLastWin32Error(); int winError = Marshal.GetLastWin32Error();
Console.WriteLine(Mac.ToString() + " " + System.DateTime.UtcNow.ToString("o") + "> disconnect due to read failure: " + winError); Console.WriteLine(Mac.ToString() + " " + DateTime.UtcNow.ToString("o") + "> disconnect due to read failure: " + winError);
//Log.LogToGui(Mac.ToString() + " disconnected due to read failure: " + winError, true); //Log.LogToGui(Mac.ToString() + " disconnected due to read failure: " + winError, true);
} }
@ -730,7 +722,6 @@ namespace DS4Windows
//Array.Clear(inputReport, 0, inputReport.Length); //Array.Clear(inputReport, 0, inputReport.Length);
//HidDevice.ReadStatus res = hDevice.ReadAsyncWithFileStream(inputReport, READ_STREAM_TIMEOUT); //HidDevice.ReadStatus res = hDevice.ReadAsyncWithFileStream(inputReport, READ_STREAM_TIMEOUT);
HidDevice.ReadStatus res = hDevice.ReadWithFileStream(inputReport); HidDevice.ReadStatus res = hDevice.ReadWithFileStream(inputReport);
//HidDevice.ReadStatus res = hDevice.ReadFileOverlapped(inputReport, READ_STREAM_TIMEOUT);
if (res != HidDevice.ReadStatus.Success) if (res != HidDevice.ReadStatus.Success)
{ {
if (res == HidDevice.ReadStatus.WaitTimedOut) if (res == HidDevice.ReadStatus.WaitTimedOut)
@ -740,7 +731,7 @@ namespace DS4Windows
else else
{ {
int winError = Marshal.GetLastWin32Error(); int winError = Marshal.GetLastWin32Error();
Console.WriteLine(Mac.ToString() + " " + System.DateTime.UtcNow.ToString("o") + "> disconnect due to read failure: " + winError); Console.WriteLine(Mac.ToString() + " " + DateTime.UtcNow.ToString("o") + "> disconnect due to read failure: " + winError);
//Log.LogToGui(Mac.ToString() + " disconnected due to read failure: " + winError, true); //Log.LogToGui(Mac.ToString() + " disconnected due to read failure: " + winError, true);
} }
@ -757,12 +748,17 @@ namespace DS4Windows
timeoutExecuted = true; timeoutExecuted = true;
return; return;
} }
else
{
//Array.Copy(inputReport2, 0, inputReport, 0, inputReport.Length);
}
} }
curTimeDouble = sw.Elapsed.TotalMilliseconds;
curtime = sw.ElapsedMilliseconds;
lastTimeElapsed = curtime - oldtime;
lastTimeElapsedDouble = (curTimeDouble - oldTimeDouble);
oldtime = curtime;
oldTimeDouble = curTimeDouble;
if (conType == ConnectionType.BT && btInputReport[0] != 0x11) if (conType == ConnectionType.BT && btInputReport[0] != 0x11)
{ {
//Received incorrect report, skip it //Received incorrect report, skip it
@ -855,7 +851,7 @@ namespace DS4Windows
// Store Gyro and Accel values // Store Gyro and Accel values
Array.Copy(inputReport, 13, gyro, 0, 6); Array.Copy(inputReport, 13, gyro, 0, 6);
Array.Copy(inputReport, 19, accel, 0, 6); Array.Copy(inputReport, 19, accel, 0, 6);
sixAxis.handleSixaxis(gyro, accel, cState); sixAxis.handleSixaxis(gyro, accel, cState, lastTimeElapsedDouble);
/* Debug output of incoming HID data: /* Debug output of incoming HID data:
if (cState.L2 == 0xff && cState.R2 == 0xff) if (cState.L2 == 0xff && cState.R2 == 0xff)
@ -996,7 +992,7 @@ namespace DS4Windows
//outputReportBuffer[1] = 0x80; //outputReportBuffer[1] = 0x80;
//outputReportBuffer[1] = 0x84; //outputReportBuffer[1] = 0x84;
outputReportBuffer[1] = (byte)(0x80 | btPollRate); // input report rate outputReportBuffer[1] = (byte)(0x80 | btPollRate); // input report rate
// enable lightbar, rumble, flash // enable rumble (0x01), lightbar (0x02), flash (0x04)
outputReportBuffer[3] = 0xf7; outputReportBuffer[3] = 0xf7;
outputReportBuffer[6] = rightLightFastRumble; // fast motor outputReportBuffer[6] = rightLightFastRumble; // fast motor
outputReportBuffer[7] = leftHeavySlowRumble; // slow motor outputReportBuffer[7] = leftHeavySlowRumble; // slow motor
@ -1009,7 +1005,7 @@ namespace DS4Windows
else else
{ {
outputReportBuffer[0] = 0x05; outputReportBuffer[0] = 0x05;
// enable lightbar, rumble, flash // enable rumble (0x01), lightbar (0x02), flash (0x04)
outputReportBuffer[1] = 0xf7; outputReportBuffer[1] = 0xf7;
outputReportBuffer[4] = rightLightFastRumble; // fast motor outputReportBuffer[4] = rightLightFastRumble; // fast motor
outputReportBuffer[5] = leftHeavySlowRumble; // slow motor outputReportBuffer[5] = leftHeavySlowRumble; // slow motor
@ -1200,13 +1196,6 @@ namespace DS4Windows
return pState.Clone(); return pState.Clone();
} }
public void getExposedState(DS4StateExposed expState, DS4State state)
{
cState.CopyTo(state);
expState.setAccel(accel);
expState.setGyro(gyro);
}
public void getCurrentState(DS4State state) public void getCurrentState(DS4State state)
{ {
cState.CopyTo(state); cState.CopyTo(state);

View File

@ -15,100 +15,79 @@ namespace DS4Windows
public class SixAxis public class SixAxis
{ {
public readonly int gyroX, gyroY, gyroZ, deltaX, deltaY, deltaZ, accelX, accelY, accelZ; public int gyroYaw, gyroPitch, gyroRoll, accelX, accelY, accelZ;
public readonly int gyroXFull, gyroYFull, gyroZFull; public readonly int gyroYawFull, gyroPitchFull, gyroRollFull;
public readonly int accelXFull, accelYFull, accelZFull; public int accelXFull, accelYFull, accelZFull;
public readonly byte touchID; public readonly byte touchID;
public readonly SixAxis previousAxis; public readonly double elapsed;
public SixAxis(int X, int Y, int Z, int aX, int aY, int aZ, SixAxis prevAxis = null) public readonly SixAxis previousAxis = null;
public SixAxis(int X, int Y, int Z, int aX, int aY, int aZ,
double milliseconds, SixAxis prevAxis = null)
{ {
gyroX = X / 256; gyroYaw = -X / 256;
gyroY = Y / 256; gyroPitch = Y / 256;
gyroZ = Z / 256; gyroRoll = -Z / 256;
gyroXFull = X; gyroYawFull = -X;
gyroYFull = Y; gyroPitchFull = Y;
gyroZFull = Z; gyroRollFull = -Z;
accelX = aX / 64; // Put accel ranges between 0 - 128 abs
accelY = aY / 64; accelX = -aX / 64;
accelY = -aY / 64;
accelZ = aZ / 64; accelZ = aZ / 64;
accelXFull = aX;
accelYFull = aY; accelXFull = -aX;
accelYFull = -aY;
accelZFull = aZ; accelZFull = aZ;
elapsed = milliseconds;
previousAxis = prevAxis; previousAxis = prevAxis;
if (previousAxis != null)
{
deltaX = gyroX - previousAxis.gyroX;
deltaY = gyroY - previousAxis.gyroY;
deltaZ = gyroZ - previousAxis.gyroZ;
}
} }
} }
public class DS4SixAxis public class DS4SixAxis
{ {
//public event EventHandler<SixAxisEventArgs> SixAxisMoved = null; // deltaX/deltaY are set because one or both fingers were already down on a prior sensor reading public event EventHandler<SixAxisEventArgs> SixAccelMoved = null;
public event EventHandler<SixAxisEventArgs> SixAccelMoved = null; // no status change for the touchpad itself... but other sensors may have changed, or you may just want to do some processing
internal int lastGyroX, lastGyroY, lastGyroZ, lastAX, lastAY, lastAZ; // tracks 0, 1 or 2 touches; we maintain touch 1 and 2 separately internal int lastGyroYaw, lastGyroPitch, lastGyroRoll,
lastAX, lastAY, lastAZ;
internal double lastMilliseconds;
internal byte[] previousPacket = new byte[8]; internal byte[] previousPacket = new byte[8];
public void handleSixaxis(byte[] gyro, byte[] accel, DS4State state) public void handleSixaxis(byte[] gyro, byte[] accel, DS4State state, double milliseconds)
{ {
//bool touchPadIsDown = sensors.TouchButton; int currentYaw = (short)((ushort)(gyro[3] << 8) | gyro[2]);
/*if (!PacketChanged(data, touchPacketOffset) && touchPadIsDown == lastTouchPadIsDown) int currentPitch = (short)((ushort)(gyro[1] << 8) | gyro[0]);
{ int currentRoll = (short)((ushort)(gyro[5] << 8) | gyro[4]);
if (SixAxisUnchanged != null) int AccelX = (short)((ushort)(accel[1] << 8) | accel[0]);
SixAxisUnchanged(this, EventArgs.Empty); int AccelY = (short)((ushort)(accel[3] << 8) | accel[2]);
return; int AccelZ = (short)((ushort)(accel[5] << 8) | accel[4]);
}*/
/* byte touchID1 = (byte)(data[0 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0x7F);
byte touchID2 = (byte)(data[4 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0x7F);*/
int currentX = (short)((ushort)(gyro[3] << 8) | gyro[2]); // Gyro Pitch SixAxisEventArgs args = null;
int currentY = (short)((ushort)(gyro[1] << 8) | gyro[0]); // Gyro Yaw
int currentZ = (short)((ushort)(gyro[5] << 8) | gyro[4]); // Gyro Roll
int AccelX = (short)((ushort)(accel[1] << 8) | accel[0]); // Accel Pitch
int AccelY = (short)((ushort)(accel[3] << 8) | accel[2]); // Accel Roll
int AccelZ = (short)((ushort)(accel[5] << 8) | accel[4]); // Accel Yaw
SixAxisEventArgs args;
//if (sensors.Touch1 || sensors.Touch2)
{
/* if (SixAxisMoved != null)
{
SixAxis sPrev, now;
sPrev = new SixAxis(lastGyroX, lastGyroY, lastGyroZ, lastAX,lastAY,lastAZ);
now = new SixAxis(currentX, currentY, currentZ, AccelX, AccelY, AccelZ, sPrev);
args = new SixAxisEventArgs(state.ReportTimeStamp, now);
SixAxisMoved(this, args);
}
lastGyroX = currentX;
lastGyroY = currentY;
lastGyroZ = currentZ;
lastAX = AccelX;
lastAY = AccelY;
lastAZ = AccelZ;*/
}
if (AccelX != 0 || AccelY != 0 || AccelZ != 0) if (AccelX != 0 || AccelY != 0 || AccelZ != 0)
{ {
if (SixAccelMoved != null) if (SixAccelMoved != null)
{ {
SixAxis sPrev, now; SixAxis sPrev = null, now = null;
sPrev = new SixAxis(lastGyroX, lastGyroY, lastGyroZ, lastAX, lastAY, lastAZ); sPrev = new SixAxis(lastGyroYaw, lastGyroPitch, lastGyroRoll,
now = new SixAxis(currentX, currentY, currentZ, AccelX, AccelY, AccelZ, sPrev); lastAX, lastAY, lastAZ, lastMilliseconds);
now = new SixAxis(currentYaw, currentPitch, currentRoll,
AccelX, AccelY, AccelZ, milliseconds, sPrev);
args = new SixAxisEventArgs(state.ReportTimeStamp, now); args = new SixAxisEventArgs(state.ReportTimeStamp, now);
state.Motion = now;
SixAccelMoved(this, args); SixAccelMoved(this, args);
} }
lastGyroX = currentX; lastGyroYaw = currentYaw;
lastGyroY = currentY; lastGyroPitch = currentPitch;
lastGyroZ = currentZ; lastGyroRoll = currentRoll;
lastAX = AccelX; lastAX = AccelX;
lastAY = AccelY; lastAY = AccelY;
lastAZ = AccelZ; lastAZ = AccelZ;
lastMilliseconds = milliseconds;
} }
} }
} }

View File

@ -8,7 +8,8 @@ namespace DS4Windows
public bool Square, Triangle, Circle, Cross; public bool Square, Triangle, Circle, Cross;
public bool DpadUp, DpadDown, DpadLeft, DpadRight; public bool DpadUp, DpadDown, DpadLeft, DpadRight;
public bool L1, L3, R1, R3; public bool L1, L3, R1, R3;
public bool Share, Options, PS, Touch1, Touch2, TouchButton, TouchRight, TouchLeft, Touch1Finger, Touch2Fingers; public bool Share, Options, PS, Touch1, Touch2, TouchButton, TouchRight,
TouchLeft, Touch1Finger, Touch2Fingers;
public byte Touch1Identifier, Touch2Identifier; public byte Touch1Identifier, Touch2Identifier;
public byte LX, RX, LY, RY, L2, R2; public byte LX, RX, LY, RY, L2, R2;
public byte FrameCounter; // 0, 1, 2...62, 63, 0.... public byte FrameCounter; // 0, 1, 2...62, 63, 0....
@ -22,6 +23,7 @@ namespace DS4Windows
public double LYUnit; public double LYUnit;
public double RXUnit; public double RXUnit;
public double RYUnit; public double RYUnit;
public SixAxis Motion = null;
public static readonly int DEFAULT_AXISDIR_VALUE = 127; public static readonly int DEFAULT_AXISDIR_VALUE = 127;
public DS4State() public DS4State()
@ -44,6 +46,7 @@ namespace DS4Windows
LYUnit = 0.0; LYUnit = 0.0;
RXUnit = 0.0; RXUnit = 0.0;
RYUnit = 0.0; RYUnit = 0.0;
Motion = new SixAxis(0, 0, 0, 0, 0, 0, 0.0);
} }
public DS4State(DS4State state) public DS4State(DS4State state)
@ -90,6 +93,7 @@ namespace DS4Windows
LYUnit = state.LYUnit; LYUnit = state.LYUnit;
RXUnit = state.RXUnit; RXUnit = state.RXUnit;
RYUnit = state.RYUnit; RYUnit = state.RYUnit;
Motion = state.Motion;
} }
public DS4State Clone() public DS4State Clone()
@ -141,6 +145,7 @@ namespace DS4Windows
state.LYUnit = LYUnit; state.LYUnit = LYUnit;
state.RXUnit = RXUnit; state.RXUnit = RXUnit;
state.RYUnit = RYUnit; state.RYUnit = RYUnit;
state.Motion = Motion;
} }
public void calculateStickAngles() public void calculateStickAngles()
@ -164,20 +169,16 @@ namespace DS4Windows
{ {
double sinAngle = Math.Sin(rotation), cosAngle = Math.Cos(rotation); double sinAngle = Math.Sin(rotation), cosAngle = Math.Cos(rotation);
double tempLX = LX - 127.5, tempLY = LY - 127.5; double tempLX = LX - 127.5, tempLY = LY - 127.5;
Byte tempx = (Byte)(tempLX * cosAngle - tempLY * sinAngle + 127.5); LX = (Byte)(Global.Clamp(-127.5, (tempLX * cosAngle - tempLY * sinAngle), 127.5) + 127.5);
Byte tempy = (Byte)(tempLX * sinAngle + tempLY * cosAngle + 127.5); LY = (Byte)(Global.Clamp(-127.5, (tempLX * sinAngle + tempLY * cosAngle), 127.5) + 127.5);
LX = tempx;
LY = tempy;
} }
public void rotateRSCoordinates(double rotation) public void rotateRSCoordinates(double rotation)
{ {
double sinAngle = Math.Sin(rotation), cosAngle = Math.Cos(rotation); double sinAngle = Math.Sin(rotation), cosAngle = Math.Cos(rotation);
double tempRX = RX - 127.5, tempRY = RY - 127.5; double tempRX = RX - 127.5, tempRY = RY - 127.5;
Byte tempx = (Byte)(tempRX * cosAngle - tempRY * sinAngle + 127.5); RX = (Byte)(Global.Clamp(-127.5, (tempRX * cosAngle - tempRY * sinAngle), 127.5) + 127.5);
Byte tempy = (Byte)(tempRX * sinAngle + tempRY * cosAngle + 127.5); RY = (Byte)(Global.Clamp(-127.5, (tempRX * sinAngle + tempRY * cosAngle), 127.5) + 127.5);
RX = tempx;
RY = tempy;
} }
} }
} }

View File

@ -4,13 +4,12 @@ namespace DS4Windows
public class DS4StateExposed public class DS4StateExposed
{ {
private DS4State _state; private DS4State _state;
private byte[] accel = new byte[] { 0, 0, 0, 0, 0, 0 },
gyro = new byte[] { 0, 0, 0, 0, 0, 0 };
public DS4StateExposed() public DS4StateExposed()
{ {
_state = new DS4State(); _state = new DS4State();
} }
public DS4StateExposed(DS4State state) public DS4StateExposed(DS4State state)
{ {
_state = state; _state = state;
@ -44,75 +43,40 @@ namespace DS4Windows
byte R2 { get { return _state.R2; } } byte R2 { get { return _state.R2; } }
int Battery { get { return _state.Battery; } } int Battery { get { return _state.Battery; } }
/// <summary> Holds raw DS4 input data from 14 to 19 </summary> public int GyroYaw { get { return _state.Motion.gyroYaw; } }
public byte[] Accel { set { accel = value; } } public int getGyroYaw()
public void setAccel(byte[] value)
{ {
accel = value; return _state.Motion.gyroYaw;
} }
/// <summary> Holds raw DS4 input data from 20 to 25 </summary> public int GyroPitch { get { return _state.Motion.gyroPitch; } }
public byte[] Gyro { set { gyro = value; } } public int getGyroPitch()
public void setGyro(byte[] value)
{ {
gyro = value; return _state.Motion.gyroPitch;
} }
/// <summary> Yaw leftward/counter-clockwise/turn to port or larboard side </summary> public int GyroRoll { get { return _state.Motion.gyroRoll; } }
/// <remarks> Add double the previous result to this delta and divide by three.</remarks> public int getGyroRoll()
//public int AccelX { get { return (short)((ushort)(accel[2] << 8) | accel[3]) / 256; } }
//public int AccelX { get { return (short)((ushort)(accel[1] << 8) | accel[0]) / 64; } }
public int AccelX { get { return (short)((ushort)(gyro[3] << 8) | gyro[2]) / 256; } }
/// <summary> Pitch upward/backward </summary>
/// <remarks> Add double the previous result to this delta and divide by three.</remarks>
//public int AccelY { get { return (short)((ushort)(accel[0] << 8) | accel[1] ) / 256; } }
//public int AccelY { get { return (short)((ushort)(accel[3] << 8) | accel[2]) / 64; } }
public int AccelY { get { return (short)((ushort)(gyro[1] << 8) | gyro[0]) / 256; } }
/// <summary> roll left/L side of controller down/starboard raising up </summary>
/// <remarks> Add double the previous result to this delta and divide by three.</remarks>
//public int AccelZ { get { return (short)((ushort)(accel[4] << 8) | accel[5]) / 256; } }
//public int AccelZ { get { return (short)((ushort)(accel[5] << 8) | accel[4]) / 64; } }
public int AccelZ { get { return (short)((ushort)(gyro[5] << 8) | gyro[4]) / 256; } }
/// <summary> R side of controller upward </summary>
/// <remarks> Add double the previous result to this delta and divide by three.</remarks>
//public int GyroX { get { return (short)((ushort)(gyro[0] << 8) | gyro[1]) / 64; } }
//public int GyroX { get { return (short)((ushort)(gyro[3] << 8) | gyro[2]) / 256; } }
public int GyroX { get { return (short)((ushort)(accel[1] << 8) | accel[0]) / 64; } }
public int getGyroX()
{ {
//return (short)((ushort)(gyro[0] << 8) | gyro[1]) / 64; return _state.Motion.gyroRoll;
//return (short)((ushort)(gyro[3] << 8) | gyro[2]) / 256;
return (short)((ushort)(accel[1] << 8) | accel[0]) / 64;
} }
/// <summary> touchpad and button face side of controller upward </summary> public int AccelX { get { return _state.Motion.accelX; } }
/// <remarks> Add double the previous result to this delta and divide by three.</remarks> public int getAccelX()
//public int GyroY { get { return (short)((ushort)(gyro[2] << 8) | gyro[3]) / 64; } }
//public int GyroY { get { return (short)((ushort)(gyro[1] << 8) | gyro[0]) / 256; } }
public int GyroY { get { return (short)((ushort)(accel[3] << 8) | accel[2]) / 64; } }
public int getGyroY()
{ {
//return (short)((ushort)(gyro[2] << 8) | gyro[3]) / 64; return _state.Motion.accelX;
//return (short)((ushort)(gyro[1] << 8) | gyro[0]) / 256;
return (short)((ushort)(accel[3] << 8) | accel[2]) / 64;
} }
/// <summary> Audio/expansion ports upward and light bar/shoulders/bumpers/USB port downward </summary> public int AccelY { get { return _state.Motion.accelY; } }
/// <remarks> Add double the previous result to this delta and divide by three.</remarks> public int getAccelY()
//public int GyroZ { get { return (short)((ushort)(gyro[4] << 8) | gyro[5]) / 64; } }
//public int GyroZ { get { return (short)((ushort)(gyro[5] << 8) | gyro[4]) / 256; } }
public int GyroZ { get { return (short)((ushort)(accel[5] << 8) | accel[4]) / 64; } }
public int getGyroZ()
{ {
//return (short)((ushort)(gyro[4] << 8) | gyro[5]) / 64; return _state.Motion.accelY;
//return (short)((ushort)(gyro[5] << 8) | gyro[4]) / 256; }
return (short)((ushort)(accel[5] << 8) | accel[4]) / 64;
public int AccelZ { get { return _state.Motion.accelZ; } }
public int getAccelZ()
{
return _state.Motion.accelZ;
} }
} }
} }

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.84")] [assembly: AssemblyVersion("1.4.86")]
[assembly: AssemblyFileVersion("1.4.84")] [assembly: AssemblyFileVersion("1.4.86")]

View File

@ -6,14 +6,24 @@ DS4Windows is a portable program that allows you to get the best DualShock 4 exp
You can find the latest and older versions [here](https://github.com/Ryochan7/DS4Windows/releases). You can find the latest and older versions [here](https://github.com/Ryochan7/DS4Windows/releases).
This project is a fork of the work of Jays2Kings. You can find the old project
website at [ds4windows.com](http://ds4windows.com).
## Requirements ## Requirements
- [Microsoft .NET 4.5 or higher (needed to unzip the driver and for macros to work properly)](http://www.microsoft.com/en-us/download/details.aspx?id=42642) - [Microsoft .NET 4.5 or higher (needed to unzip the driver and for macros to work properly)](http://www.microsoft.com/en-us/download/details.aspx?id=42642)
- DS4 Driver (Downloaded & Installed with DS4Windows) - SCP Virtual Bus Driver (Downloaded & Installed with DS4Windows)
- Microsoft 360 Driver (link inside DS4Windows, already installed on Windows 7 SP1 and higher or if you've used a 360 controller before) - Microsoft 360 Driver (link inside DS4Windows, already installed on Windows 7 SP1 and higher or if you've used a 360 controller before)
- Sony DualShock 4 (This should be obvious) - Sony DualShock 4 (This should be obvious)
- Micro USB cable - Micro USB cable
- (Optional)Bluetooth 2.1+, via adapter or built in pc [(My recommendation)](http://www.amazon.com/gp/product/B004LNXO28/ref=oh_aui_search_detailpage?ie=UTF8&psc=1) (Toshiba's bluetooth & Bluetooth adapters using CSR currently does not work) - (Optional)Bluetooth 2.1+, via adapter or built in pc [(My recommendation)](http://www.amazon.com/gp/product/B004LNXO28/ref=oh_aui_search_detailpage?ie=UTF8&psc=1) (Toshiba's bluetooth & Bluetooth adapters using CSR currently does not work)
Note: Hide DS4 currently doesn't work on Windows 10 without a workaround (disabling Network list service and restarting, but this causes serious issues with windows, use caution). ## Pull Requests
You can find more info out at [ds4windows.com](http://ds4windows.com).
Pull requests for DS4Windows are welcome. Before making a pull request, please
test your changes to ensure that the changes made do not negatively affect
the performance of other parts of the application. Some consideration will
be made during code review to try to tweak the changes in order to improve
application performance. However, there is a chance that a pull request will be
rejected if no reasonable solution can be found to incorporate code changes.