Initial implementation of trackball mode

Related to issue #85
This commit is contained in:
Travis Nickles 2018-01-01 12:21:35 -06:00
parent 1283f274df
commit 4bb6b08f72
7 changed files with 3666 additions and 727 deletions

View File

@ -385,6 +385,7 @@ namespace DS4Windows
{ {
device.setIdleTimeout(getIdleDisconnectTimeout(ind)); device.setIdleTimeout(getIdleDisconnectTimeout(ind));
device.setBTPollRate(getBTPollRate(ind)); device.setBTPollRate(getBTPollRate(ind));
touchPad[ind].ResetTrackAccel((int)getTrackballFriction(ind));
if (!startUp) if (!startUp)
{ {

View File

@ -24,12 +24,37 @@ namespace DS4Windows
protected DS4Controls pushed = DS4Controls.None; protected DS4Controls pushed = DS4Controls.None;
protected Mapping.Click clicked = Mapping.Click.None; protected Mapping.Click clicked = Mapping.Click.None;
internal const int TRACKBALL_INIT_FICTION = 10;
internal const int TRACKBALL_MASS = 80;
internal const double TRACKBALL_RADIUS = 0.0245;
internal const double TRACKBALL_DEGREE = 40.0;
private double TRACKBALL_INERTIA = 2.0 * (TRACKBALL_MASS * TRACKBALL_RADIUS * TRACKBALL_RADIUS) / 5.0;
private double TRACKBALL_SCALE = 0.004;
private const int TRACKBALL_BUFFER_LEN = 6;
private double[] trackballXBuffer = new double[TRACKBALL_BUFFER_LEN];
private double[] trackballYBuffer = new double[TRACKBALL_BUFFER_LEN];
private int trackballBufferTail = 0;
private int trackballBufferHead = 0;
private double trackballAccel = 0.0;
private double trackballXVel = 0.0;
private double trackballYVel = 0.0;
private bool trackballActive = false;
private double trackballDXRemain = 0.0;
private double trackballDYRemain = 0.0;
public Mouse(int deviceID, DS4Device d) public Mouse(int deviceID, DS4Device d)
{ {
deviceNum = deviceID; deviceNum = deviceID;
dev = d; dev = d;
cursor = new MouseCursor(deviceNum); cursor = new MouseCursor(deviceNum);
wheel = new MouseWheel(deviceNum); wheel = new MouseWheel(deviceNum);
trackballAccel = TRACKBALL_RADIUS * TRACKBALL_INIT_FICTION / TRACKBALL_INERTIA;
}
public void ResetTrackAccel(double friction)
{
trackballAccel = TRACKBALL_RADIUS * friction / TRACKBALL_INERTIA;
} }
bool triggeractivated = false; bool triggeractivated = false;
@ -113,6 +138,16 @@ namespace DS4Windows
tempBool = false; tempBool = false;
} }
if (Global.getTrackballMode(deviceNum))
{
int iIndex = trackballBufferTail;
trackballXBuffer[iIndex] = (arg.touches[0].deltaX * TRACKBALL_SCALE) / dev.getCurrentStateRef().Motion.elapsed;
trackballYBuffer[iIndex] = (arg.touches[0].deltaY * TRACKBALL_SCALE) / dev.getCurrentStateRef().Motion.elapsed;
trackballBufferTail = (iIndex + 1) % TRACKBALL_BUFFER_LEN;
if (trackballBufferHead == trackballBufferTail)
trackballBufferHead = (trackballBufferHead + 1) % TRACKBALL_BUFFER_LEN;
}
cursor.touchesMoved(arg, dragging || dragging2, tempBool); cursor.touchesMoved(arg, dragging || dragging2, tempBool);
wheel.touchesMoved(arg, dragging || dragging2); wheel.touchesMoved(arg, dragging || dragging2);
} }
@ -147,6 +182,16 @@ namespace DS4Windows
{ {
if (!Global.UseTPforControls[deviceNum]) if (!Global.UseTPforControls[deviceNum])
{ {
Array.Clear(trackballXBuffer, 0, TRACKBALL_BUFFER_LEN);
Array.Clear(trackballXBuffer, 0, TRACKBALL_BUFFER_LEN);
trackballXVel = 0.0;
trackballYVel = 0.0;
trackballActive = false;
trackballBufferTail = 0;
trackballBufferHead = 0;
trackballDXRemain = 0.0;
trackballDYRemain = 0.0;
cursor.touchesBegan(arg); cursor.touchesBegan(arg);
wheel.touchesBegan(arg); wheel.touchesBegan(arg);
} }
@ -154,7 +199,7 @@ namespace DS4Windows
pastTime = arg.timeStamp; pastTime = arg.timeStamp;
firstTouch = arg.touches[0]; firstTouch = arg.touches[0];
if (Global.DoubleTap[deviceNum]) if (Global.getDoubleTap(deviceNum))
{ {
DateTime test = arg.timeStamp; DateTime test = arg.timeStamp;
if (test <= (firstTap + TimeSpan.FromMilliseconds((double)Global.TapSensitivity[deviceNum] * 1.5)) && !arg.touchButtonPressed) if (test <= (firstTap + TimeSpan.FromMilliseconds((double)Global.TapSensitivity[deviceNum] * 1.5)) && !arg.touchButtonPressed)
@ -167,11 +212,12 @@ namespace DS4Windows
public virtual void touchesEnded(object sender, TouchpadEventArgs arg) public virtual void touchesEnded(object sender, TouchpadEventArgs arg)
{ {
s = dev.getCurrentStateRef();
slideright = slideleft = false; slideright = slideleft = false;
swipeUp = swipeDown = swipeLeft = swipeRight = false; swipeUp = swipeDown = swipeLeft = swipeRight = false;
swipeUpB = swipeDownB = swipeLeftB = swipeRightB = 0; swipeUpB = swipeDownB = swipeLeftB = swipeRightB = 0;
byte tapSensitivity = Global.TapSensitivity[deviceNum]; byte tapSensitivity = Global.getTapSensitivity(deviceNum);
if (tapSensitivity != 0 && !Global.UseTPforControls[deviceNum]) if (tapSensitivity != 0 && !Global.getUseTPforControls(deviceNum))
{ {
if (secondtouchbegin) if (secondtouchbegin)
{ {
@ -184,7 +230,7 @@ namespace DS4Windows
{ {
if (Math.Abs(firstTouch.hwX - arg.touches[0].hwX) < 10 && Math.Abs(firstTouch.hwY - arg.touches[0].hwY) < 10) if (Math.Abs(firstTouch.hwX - arg.touches[0].hwX) < 10 && Math.Abs(firstTouch.hwY - arg.touches[0].hwY) < 10)
{ {
if (Global.DoubleTap[deviceNum]) if (Global.getDoubleTap(deviceNum))
{ {
tappedOnce = true; tappedOnce = true;
firstTap = arg.timeStamp; firstTap = arg.timeStamp;
@ -195,8 +241,94 @@ namespace DS4Windows
} }
} }
} }
else
{
if (Global.getUseTPforControls(deviceNum) == false)
{
int[] disArray = Global.getTouchDisInvertTriggers(deviceNum);
tempBool = true;
for (int i = 0, arlen = disArray.Length; tempBool && i < arlen; i++)
{
if (getDS4ControlsByName(disArray[i]) == false)
tempBool = false;
}
if (Global.getTrackballMode(deviceNum))
{
if (!trackballActive)
{
double currentWeight = 1.0;
double finalWeight = 0.0;
double x_out = 0.0, y_out = 0.0;
int idx = -1;
for (int i = 0; i < TRACKBALL_BUFFER_LEN && idx != trackballBufferHead; i++)
{
idx = (trackballBufferTail - i - 1 + TRACKBALL_BUFFER_LEN) % TRACKBALL_BUFFER_LEN;
x_out += trackballXBuffer[idx] * currentWeight;
y_out += trackballYBuffer[idx] * currentWeight;
finalWeight += currentWeight;
currentWeight *= 1.0;
}
x_out /= finalWeight;
trackballXVel = x_out;
y_out /= finalWeight;
trackballYVel = y_out;
trackballActive = true;
}
double tempAngle = Math.Atan2(-trackballYVel, trackballXVel);
double normX = Math.Abs(Math.Cos(tempAngle));
double normY = Math.Abs(Math.Sin(tempAngle));
int signX = Math.Sign(trackballXVel);
int signY = Math.Sign(trackballYVel);
double trackXvDecay = Math.Min(Math.Abs(trackballXVel), trackballAccel * s.Motion.elapsed * normX);
double trackYvDecay = Math.Min(Math.Abs(trackballYVel), trackballAccel * s.Motion.elapsed * normY);
double xVNew = trackballXVel - (trackXvDecay * signX);
double yVNew = trackballYVel - (trackYvDecay * signY);
double xMotion = (xVNew * s.Motion.elapsed) / TRACKBALL_SCALE;
double yMotion = (yVNew * s.Motion.elapsed) / TRACKBALL_SCALE;
if (xMotion != 0.0)
{
xMotion += trackballDXRemain;
}
else
{
trackballDXRemain = 0.0;
}
int dx = (int)xMotion;
trackballDXRemain = xMotion - dx;
if (yMotion != 0.0)
{
yMotion += trackballDYRemain;
}
else
{
trackballDYRemain = 0.0;
}
int dy = (int)yMotion;
trackballDYRemain = yMotion - dy;
trackballXVel = xVNew;
trackballYVel = yVNew;
if (dx == 0 && dy == 0)
{
trackballActive = false;
}
else
{
cursor.TouchMoveCursor(dx, dy, tempBool);
}
}
}
}
s = dev.getCurrentStateRef();
synthesizeMouseButtons(); synthesizeMouseButtons();
} }
@ -213,6 +345,67 @@ namespace DS4Windows
public virtual void touchUnchanged(object sender, EventArgs unused) public virtual void touchUnchanged(object sender, EventArgs unused)
{ {
s = dev.getCurrentStateRef(); s = dev.getCurrentStateRef();
if (trackballActive)
{
if (Global.getUseTPforControls(deviceNum) == false)
{
int[] disArray = Global.getTouchDisInvertTriggers(deviceNum);
tempBool = true;
for (int i = 0, arlen = disArray.Length; tempBool && i < arlen; i++)
{
if (getDS4ControlsByName(disArray[i]) == false)
tempBool = false;
}
double tempAngle = Math.Atan2(-trackballYVel, trackballXVel);
double normX = Math.Abs(Math.Cos(tempAngle));
double normY = Math.Abs(Math.Sin(tempAngle));
int signX = Math.Sign(trackballXVel);
int signY = Math.Sign(trackballYVel);
double trackXvDecay = Math.Min(Math.Abs(trackballXVel), trackballAccel * s.Motion.elapsed * normX);
double trackYvDecay = Math.Min(Math.Abs(trackballYVel), trackballAccel * s.Motion.elapsed * normY);
double xVNew = trackballXVel - (trackXvDecay * signX);
double yVNew = trackballYVel - (trackYvDecay * signY);
double xMotion = (xVNew * s.Motion.elapsed) / TRACKBALL_SCALE;
double yMotion = (yVNew * s.Motion.elapsed) / TRACKBALL_SCALE;
if (xMotion != 0.0)
{
xMotion += trackballDXRemain;
}
else
{
trackballDXRemain = 0.0;
}
int dx = (int)xMotion;
trackballDXRemain = xMotion - dx;
if (yMotion != 0.0)
{
yMotion += trackballDYRemain;
}
else
{
trackballDYRemain = 0.0;
}
int dy = (int)yMotion;
trackballDYRemain = yMotion - dy;
trackballXVel = xVNew;
trackballYVel = yVNew;
if (dx == 0 && dy == 0)
{
trackballActive = false;
}
else
{
cursor.TouchMoveCursor(dx, dy, tempBool);
}
}
}
//synthesizeMouseButtons(); //synthesizeMouseButtons();
} }

View File

@ -31,6 +31,8 @@ namespace DS4Windows
private double[] ySmoothBuffer = new double[SMOOTH_BUFFER_LEN]; private double[] ySmoothBuffer = new double[SMOOTH_BUFFER_LEN];
private int smoothBufferTail = 0; private int smoothBufferTail = 0;
double coefficient = 0.0; double coefficient = 0.0;
double verticalScale = 0.0; double verticalScale = 0.0;
bool gyroSmooth = false; bool gyroSmooth = false;
@ -194,6 +196,7 @@ namespace DS4Windows
{ {
horizontalRemainder = verticalRemainder = 0.0; horizontalRemainder = verticalRemainder = 0.0;
horizontalDirection = verticalDirection = Direction.Neutral; horizontalDirection = verticalDirection = Direction.Neutral;
} }
} }
@ -226,19 +229,24 @@ namespace DS4Windows
} }
} }
double tempAngle = Math.Atan2(-deltaY, deltaX); TouchMoveCursor(deltaX, deltaY, disableInvert);
}
public void TouchMoveCursor(int dx, int dy, bool disableInvert = false)
{
double tempAngle = Math.Atan2(-dy, dx);
double normX = Math.Abs(Math.Cos(tempAngle)); double normX = Math.Abs(Math.Cos(tempAngle));
double normY = Math.Abs(Math.Sin(tempAngle)); double normY = Math.Abs(Math.Sin(tempAngle));
int signX = Math.Sign(deltaX); int signX = Math.Sign(dx);
int signY = Math.Sign(deltaY); int signY = Math.Sign(dy);
double coefficient = Global.getTouchSensitivity(deviceNumber) * 0.01; double coefficient = Global.getTouchSensitivity(deviceNumber) * 0.01;
bool jitterCompenstation = Global.getTouchpadJitterCompensation(deviceNumber); bool jitterCompenstation = Global.getTouchpadJitterCompensation(deviceNumber);
double xMotion = deltaX != 0 ? double xMotion = dx != 0 ?
coefficient * deltaX + (normX * (TOUCHPAD_MOUSE_OFFSET * signX)) : 0.0; coefficient * dx + (normX * (TOUCHPAD_MOUSE_OFFSET * signX)) : 0.0;
double yMotion = deltaY != 0 ? double yMotion = dy != 0 ?
coefficient * deltaY + (normY * (TOUCHPAD_MOUSE_OFFSET * signY)) : 0.0; coefficient * dy + (normY * (TOUCHPAD_MOUSE_OFFSET * signY)) : 0.0;
if (jitterCompenstation) if (jitterCompenstation)
{ {

View File

@ -654,7 +654,16 @@ namespace DS4Windows
} }
public static byte[] TapSensitivity => m_Config.tapSensitivity; public static byte[] TapSensitivity => m_Config.tapSensitivity;
public static byte getTapSensitivity(int index)
{
return m_Config.tapSensitivity[index];
}
public static bool[] DoubleTap => m_Config.doubleTap; public static bool[] DoubleTap => m_Config.doubleTap;
public static bool getDoubleTap(int index)
{
return m_Config.doubleTap[index];
}
public static int[] ScrollSensitivity => m_Config.scrollSensitivity; public static int[] ScrollSensitivity => m_Config.scrollSensitivity;
public static int[] getScrollSensitivity() public static int[] getScrollSensitivity()
@ -895,6 +904,18 @@ namespace DS4Windows
return m_Config.szOutCurveMode[index]; return m_Config.szOutCurveMode[index];
} }
public static bool[] TrackballMode => m_Config.trackballMode;
public static bool getTrackballMode(int index)
{
return m_Config.trackballMode[index];
}
public static double[] TrackballFriction => m_Config.trackballFriction;
public static double getTrackballFriction(int index)
{
return m_Config.trackballFriction[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 string[] OlderProfilePath => m_Config.olderProfilePath; public static string[] OlderProfilePath => m_Config.olderProfilePath;
@ -1362,6 +1383,8 @@ namespace DS4Windows
public bool[] gyroSmoothing = new bool[5] { false, false, false, false, false }; public bool[] gyroSmoothing = new bool[5] { false, false, false, false, false };
public double[] gyroSmoothWeight = new double[5] { 0.5, 0.5, 0.5, 0.5, 0.5 }; public double[] gyroSmoothWeight = new double[5] { 0.5, 0.5, 0.5, 0.5, 0.5 };
public int[] gyroMouseHorizontalAxis = new int[5] { 0, 0, 0, 0, 0 }; public int[] gyroMouseHorizontalAxis = new int[5] { 0, 0, 0, 0, 0 };
public bool[] trackballMode = new bool[5] { false, false, false, false, false };
public double[] trackballFriction = new double[5] { 10.0, 10.0, 10.0, 10.0, 10.0 };
bool tempBool = false; bool tempBool = false;
@ -1552,6 +1575,9 @@ namespace DS4Windows
XmlNode xmlSXOutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "SXOutputCurveMode", null); xmlSXOutputCurveMode.InnerText = axisOutputCurveString(sxOutCurveMode[device]); Node.AppendChild(xmlSXOutputCurveMode); 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 xmlSZOutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "SZOutputCurveMode", null); xmlSZOutputCurveMode.InnerText = axisOutputCurveString(szOutCurveMode[device]); Node.AppendChild(xmlSZOutputCurveMode);
XmlNode xmlTrackBallMode = m_Xdoc.CreateNode(XmlNodeType.Element, "TrackballMode", null); xmlTrackBallMode.InnerText = trackballMode[device].ToString(); Node.AppendChild(xmlTrackBallMode);
XmlNode xmlTrackBallFriction = m_Xdoc.CreateNode(XmlNodeType.Element, "TrackballFriction", null); xmlTrackBallFriction.InnerText = trackballFriction[device].ToString(); Node.AppendChild(xmlTrackBallFriction);
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);
XmlNode Macro = m_Xdoc.CreateNode(XmlNodeType.Element, "Macro", null); XmlNode Macro = m_Xdoc.CreateNode(XmlNodeType.Element, "Macro", null);
@ -2476,6 +2502,12 @@ namespace DS4Windows
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SZOutputCurveMode"); szOutCurveMode[device] = axisOutputCurveId(Item.InnerText); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SZOutputCurveMode"); szOutCurveMode[device] = axisOutputCurveId(Item.InnerText); }
catch { szOutCurveMode[device] = 0; missingSetting = true; } catch { szOutCurveMode[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/TrackballMode"); bool.TryParse(Item.InnerText, out trackballMode[device]); }
catch { trackballMode[device] = false; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/TrackballFriction"); double.TryParse(Item.InnerText, out trackballFriction[device]); }
catch { trackballFriction[device] = 10.0; missingSetting = true; }
try try
{ {
Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ProfileActions"); Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ProfileActions");
@ -2725,6 +2757,8 @@ namespace DS4Windows
tempDev.setIdleTimeout(idleDisconnectTimeout[device]); tempDev.setIdleTimeout(idleDisconnectTimeout[device]);
tempDev.setBTPollRate(btPollRate[device]); tempDev.setBTPollRate(btPollRate[device]);
}); });
Program.rootHub.touchPad[device]?.ResetTrackAccel(trackballFriction[device]);
} }
} }
@ -3547,6 +3581,8 @@ namespace DS4Windows
l2OutCurveMode[device] = 0; l2OutCurveMode[device] = 0;
r2OutCurveMode[device] = 0; r2OutCurveMode[device] = 0;
sxOutCurveMode[device] = szOutCurveMode[device] = 0; sxOutCurveMode[device] = szOutCurveMode[device] = 0;
trackballMode[device] = false;
trackballFriction[device] = 10.0;
} }
} }

View File

@ -383,6 +383,9 @@
this.optionsTouchInvStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.optionsTouchInvStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.shareTouchInvStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.shareTouchInvStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.psTouchInvStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.psTouchInvStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.trackballCk = new System.Windows.Forms.CheckBox();
this.trackFrictionNUD = new System.Windows.Forms.NumericUpDown();
this.trackFrictionLb = new System.Windows.Forms.Label();
this.advColorDialog = new DS4Windows.AdvancedColorDialog(); this.advColorDialog = new DS4Windows.AdvancedColorDialog();
((System.ComponentModel.ISupportInitialize)(this.nUDRainbow)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRainbow)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tBBlueBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tBBlueBar)).BeginInit();
@ -476,6 +479,7 @@
((System.ComponentModel.ISupportInitialize)(this.nUDSZS)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDSZS)).BeginInit();
this.cMGyroTriggers.SuspendLayout(); this.cMGyroTriggers.SuspendLayout();
this.cMTouchDisableInvert.SuspendLayout(); this.cMTouchDisableInvert.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackFrictionNUD)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// lowColorChooserButton // lowColorChooserButton
@ -932,6 +936,9 @@
// //
// pnlTPMouse // pnlTPMouse
// //
this.pnlTPMouse.Controls.Add(this.trackFrictionLb);
this.pnlTPMouse.Controls.Add(this.trackFrictionNUD);
this.pnlTPMouse.Controls.Add(this.trackballCk);
this.pnlTPMouse.Controls.Add(this.touchpadDisInvertButton); this.pnlTPMouse.Controls.Add(this.touchpadDisInvertButton);
this.pnlTPMouse.Controls.Add(this.label25); this.pnlTPMouse.Controls.Add(this.label25);
this.pnlTPMouse.Controls.Add(this.label15); this.pnlTPMouse.Controls.Add(this.label15);
@ -4074,6 +4081,30 @@
resources.ApplyResources(this.psTouchInvStripMenuItem, "psTouchInvStripMenuItem"); resources.ApplyResources(this.psTouchInvStripMenuItem, "psTouchInvStripMenuItem");
this.psTouchInvStripMenuItem.CheckedChanged += new System.EventHandler(this.TouchDisableInvert_CheckedChanged); this.psTouchInvStripMenuItem.CheckedChanged += new System.EventHandler(this.TouchDisableInvert_CheckedChanged);
// //
// trackballCk
//
resources.ApplyResources(this.trackballCk, "trackballCk");
this.trackballCk.Name = "trackballCk";
this.trackballCk.UseVisualStyleBackColor = true;
this.trackballCk.CheckedChanged += new System.EventHandler(this.trackballCk_CheckedChanged);
//
// trackFrictionNUD
//
this.trackFrictionNUD.DecimalPlaces = 1;
resources.ApplyResources(this.trackFrictionNUD, "trackFrictionNUD");
this.trackFrictionNUD.Name = "trackFrictionNUD";
this.trackFrictionNUD.Value = new decimal(new int[] {
10,
0,
0,
0});
this.trackFrictionNUD.ValueChanged += new System.EventHandler(this.trackFrictionNUD_ValueChanged);
//
// trackFrictionLb
//
resources.ApplyResources(this.trackFrictionLb, "trackFrictionLb");
this.trackFrictionLb.Name = "trackFrictionLb";
//
// Options // Options
// //
resources.ApplyResources(this, "$this"); resources.ApplyResources(this, "$this");
@ -4196,6 +4227,7 @@
((System.ComponentModel.ISupportInitialize)(this.nUDSZS)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDSZS)).EndInit();
this.cMGyroTriggers.ResumeLayout(false); this.cMGyroTriggers.ResumeLayout(false);
this.cMTouchDisableInvert.ResumeLayout(false); this.cMTouchDisableInvert.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.trackFrictionNUD)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -4558,5 +4590,8 @@
private System.Windows.Forms.ToolStripMenuItem psTouchInvStripMenuItem; private System.Windows.Forms.ToolStripMenuItem psTouchInvStripMenuItem;
private System.Windows.Forms.Button touchpadDisInvertButton; private System.Windows.Forms.Button touchpadDisInvertButton;
private System.Windows.Forms.Label label25; private System.Windows.Forms.Label label25;
private System.Windows.Forms.Label trackFrictionLb;
private System.Windows.Forms.NumericUpDown trackFrictionNUD;
private System.Windows.Forms.CheckBox trackballCk;
} }
} }

View File

@ -624,6 +624,12 @@ namespace DS4Windows
nUDLSCurve.Value = LSCurve[device]; nUDLSCurve.Value = LSCurve[device];
nUDRSCurve.Value = RSCurve[device]; nUDRSCurve.Value = RSCurve[device];
cBControllerInput.Checked = DS4Mapping; cBControllerInput.Checked = DS4Mapping;
trackballCk.Checked = TrackballMode[device];
trackFrictionNUD.Value = (decimal)TrackballFriction[device];
if (device < 4)
{
Program.rootHub.touchPad[device]?.ResetTrackAccel(TrackballFriction[device]);
}
for (int i = 0, arlen = cMGyroTriggers.Items.Count; i < arlen; i++) for (int i = 0, arlen = cMGyroTriggers.Items.Count; i < arlen; i++)
{ {
@ -785,6 +791,12 @@ namespace DS4Windows
nUDLSCurve.Value = 0; nUDLSCurve.Value = 0;
nUDRSCurve.Value = 0; nUDRSCurve.Value = 0;
cBControllerInput.Checked = DS4Mapping; cBControllerInput.Checked = DS4Mapping;
trackballCk.Checked = false;
trackFrictionNUD.Value = 10.0m;
if (device < 4)
{
Program.rootHub.touchPad[device]?.ResetTrackAccel(10.0);
}
for (int i = 0, arlen = cMGyroTriggers.Items.Count - 1; i < arlen; i++) for (int i = 0, arlen = cMGyroTriggers.Items.Count - 1; i < arlen; i++)
{ {
@ -1290,6 +1302,12 @@ namespace DS4Windows
pnlSAMouse.Visible = rBSAMouse.Checked; pnlSAMouse.Visible = rBSAMouse.Checked;
fLPTiltControls.Visible = rBSAControls.Checked; fLPTiltControls.Visible = rBSAControls.Checked;
fLPTouchSwipe.Visible = rBTPControls.Checked; fLPTouchSwipe.Visible = rBTPControls.Checked;
TrackballMode[device] = trackballCk.Checked;
TrackballFriction[device] = (double)trackFrictionNUD.Value;
if (device < 4)
{
Program.rootHub.touchPad[device]?.ResetTrackAccel(TrackballFriction[device]);
}
GyroSensitivity[device] = (int)Math.Round(nUDGyroSensitivity.Value, 0); GyroSensitivity[device] = (int)Math.Round(nUDGyroSensitivity.Value, 0);
GyroTriggerTurns[device] = gyroTriggerBehavior.Checked; GyroTriggerTurns[device] = gyroTriggerBehavior.Checked;
@ -2967,6 +2985,26 @@ namespace DS4Windows
e.Graphics.DrawImage(pnlControllerBgImg, 0, 0, Convert.ToInt32(pnlController.Width), Convert.ToInt32(pnlController.Height - 1)); e.Graphics.DrawImage(pnlControllerBgImg, 0, 0, Convert.ToInt32(pnlController.Width), Convert.ToInt32(pnlController.Height - 1));
} }
private void trackballCk_CheckedChanged(object sender, EventArgs e)
{
if (loading == false)
{
TrackballMode[device] = trackballCk.Checked;
}
}
private void trackFrictionNUD_ValueChanged(object sender, EventArgs e)
{
if (loading == false)
{
TrackballFriction[device] = (double)trackFrictionNUD.Value;
if (device < 4)
{
Program.rootHub.touchPad[device]?.ResetTrackAccel(TrackballFriction[device]);
}
}
}
private void btnLightbar_Paint(object sender, PaintEventArgs e) private void btnLightbar_Paint(object sender, PaintEventArgs e)
{ {
e.Graphics.DrawImage(btnLightBgImg, new Rectangle(0, -1, Convert.ToInt32(btnLightbar.Width), Convert.ToInt32(btnLightbar.Height - 2))); e.Graphics.DrawImage(btnLightBgImg, new Rectangle(0, -1, Convert.ToInt32(btnLightbar.Width), Convert.ToInt32(btnLightbar.Height - 2)));

File diff suppressed because it is too large Load Diff