Allow gyro roll to control mouse x axis. Related to issue #90.

This commit is contained in:
Travis Nickles 2017-07-14 07:46:45 -05:00
parent 56fff28f65
commit 53b0de087c
5 changed files with 164 additions and 69 deletions

View File

@ -37,7 +37,8 @@ namespace DS4Windows
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.gyroYawFull; deltaX = Global.getGyroMouseHorizontalAxis(deviceNumber) == 0 ? arg.sixAxis.gyroYawFull :
arg.sixAxis.gyroRollFull;
deltaY = -arg.sixAxis.gyroPitchFull; deltaY = -arg.sixAxis.gyroPitchFull;
//Console.WriteLine(arg.sixAxis.deltaX); //Console.WriteLine(arg.sixAxis.deltaX);

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)
{ {
@ -1274,6 +1280,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;
@ -1492,6 +1499,7 @@ 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);
@ -2442,6 +2450,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; }
@ -3499,6 +3510,7 @@ 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;
} }

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();
@ -342,8 +344,8 @@
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.touchpadInvertComboBox = new System.Windows.Forms.ComboBox(); this.label16 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label(); this.cBGyroMouseXAxis = new System.Windows.Forms.ComboBox();
((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();
@ -904,6 +906,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");
@ -3087,6 +3107,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);
@ -3631,23 +3653,21 @@
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);
// //
// touchpadInvertComboBox // label16
// //
this.touchpadInvertComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; resources.ApplyResources(this.label16, "label16");
this.touchpadInvertComboBox.FormattingEnabled = true; this.label16.Name = "label16";
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);
// //
// label15 // cBGyroMouseXAxis
// //
resources.ApplyResources(this.label15, "label15"); this.cBGyroMouseXAxis.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.label15.Name = "label15"; 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);
// //
// Options // Options
// //
@ -4088,5 +4108,7 @@
private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label15; private System.Windows.Forms.Label label15;
private System.Windows.Forms.ComboBox touchpadInvertComboBox; private System.Windows.Forms.ComboBox touchpadInvertComboBox;
private System.Windows.Forms.ComboBox cBGyroMouseXAxis;
private System.Windows.Forms.Label label16;
} }
} }

View File

@ -574,27 +574,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;
} }
} }
@ -602,13 +603,14 @@ 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
{ {
@ -700,6 +702,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();
} }
@ -724,7 +727,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;
@ -762,18 +765,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;
@ -788,13 +780,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);
@ -805,15 +798,19 @@ namespace DS4Windows
else else
{ {
EnableReadings(true); EnableReadings(true);
SetDynamicTrackBarValue(tBsixaxisGyroX, (-Program.rootHub.ExposedState[tempDeviceNum].GyroYaw + tBsixaxisGyroX.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisGyroY, (Program.rootHub.ExposedState[tempDeviceNum].GyroPitch + tBsixaxisGyroY.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisGyroZ, (-Program.rootHub.ExposedState[tempDeviceNum].GyroRoll + 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.GyroYaw + tBsixaxisGyroX.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisGyroY, (exposeState.GyroPitch + tBsixaxisGyroY.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisGyroZ, (-exposeState.GyroRoll + tBsixaxisGyroZ.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisAccelX, (-exposeState.AccelX + tBsixaxisAccelX.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisAccelY, (-exposeState.AccelY + tBsixaxisAccelY.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisAccelZ, (exposeState.AccelZ + 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;
@ -857,8 +854,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;
@ -902,8 +899,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].AccelX + 127; x = -exposeState.AccelX + 127;
y = Program.rootHub.ExposedState[tempDeviceNum].AccelZ + 127; y = exposeState.AccelZ + 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;
@ -917,7 +914,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)));
@ -931,7 +928,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)));
@ -951,7 +948,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;
@ -1367,6 +1364,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)
@ -2914,6 +2912,14 @@ namespace DS4Windows
} }
} }
private void cBGyroMouseXAxis_SelectedIndexChanged(object sender, EventArgs e)
{
if (!loading)
{
GyroMouseHorizontalAxis[device] = cBGyroMouseXAxis.SelectedIndex;
}
}
private void Options_Resize(object sender, EventArgs e) private void Options_Resize(object sender, EventArgs e)
{ {
fLPSettings.AutoScroll = false; fLPSettings.AutoScroll = false;

View File

@ -7126,6 +7126,60 @@ with profile</value>
<data name="&gt;&gt;rBSAMouse.ZOrder" xml:space="preserve"> <data name="&gt;&gt;rBSAMouse.ZOrder" xml:space="preserve">
<value>1</value> <value>1</value>
</data> </data>
<data name="cBGyroMouseXAxis.Items" xml:space="preserve">
<value>Yaw</value>
</data>
<data name="cBGyroMouseXAxis.Items1" xml:space="preserve">
<value>Roll</value>
</data>
<data name="cBGyroMouseXAxis.Location" type="System.Drawing.Point, System.Drawing">
<value>170, 93</value>
</data>
<data name="cBGyroMouseXAxis.Size" type="System.Drawing.Size, System.Drawing">
<value>74, 21</value>
</data>
<data name="cBGyroMouseXAxis.TabIndex" type="System.Int32, mscorlib">
<value>271</value>
</data>
<data name="&gt;&gt;cBGyroMouseXAxis.Name" xml:space="preserve">
<value>cBGyroMouseXAxis</value>
</data>
<data name="&gt;&gt;cBGyroMouseXAxis.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cBGyroMouseXAxis.Parent" xml:space="preserve">
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;cBGyroMouseXAxis.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="label16.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label16.Location" type="System.Drawing.Point, System.Drawing">
<value>167, 74</value>
</data>
<data name="label16.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 13</value>
</data>
<data name="label16.TabIndex" type="System.Int32, mscorlib">
<value>270</value>
</data>
<data name="label16.Text" xml:space="preserve">
<value>X Axis:</value>
</data>
<data name="&gt;&gt;label16.Name" xml:space="preserve">
<value>label16</value>
</data>
<data name="&gt;&gt;label16.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label16.Parent" xml:space="preserve">
<value>pnlSAMouse</value>
</data>
<data name="&gt;&gt;label16.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="lbGyroSmooth.AutoSize" type="System.Boolean, mscorlib"> <data name="lbGyroSmooth.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
</data> </data>
@ -7151,7 +7205,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;lbGyroSmooth.ZOrder" xml:space="preserve"> <data name="&gt;&gt;lbGyroSmooth.ZOrder" xml:space="preserve">
<value>0</value> <value>2</value>
</data> </data>
<data name="cBGyroSmooth.AutoSize" type="System.Boolean, mscorlib"> <data name="cBGyroSmooth.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@ -7181,7 +7235,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;cBGyroSmooth.ZOrder" xml:space="preserve"> <data name="&gt;&gt;cBGyroSmooth.ZOrder" xml:space="preserve">
<value>1</value> <value>3</value>
</data> </data>
<data name="lbSmoothWeight.AutoSize" type="System.Boolean, mscorlib"> <data name="lbSmoothWeight.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@ -7211,7 +7265,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;lbSmoothWeight.ZOrder" xml:space="preserve"> <data name="&gt;&gt;lbSmoothWeight.ZOrder" xml:space="preserve">
<value>2</value> <value>4</value>
</data> </data>
<data name="nUDGyroSmoothWeight.Enabled" type="System.Boolean, mscorlib"> <data name="nUDGyroSmoothWeight.Enabled" type="System.Boolean, mscorlib">
<value>False</value> <value>False</value>
@ -7235,7 +7289,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;nUDGyroSmoothWeight.ZOrder" xml:space="preserve"> <data name="&gt;&gt;nUDGyroSmoothWeight.ZOrder" xml:space="preserve">
<value>3</value> <value>5</value>
</data> </data>
<data name="label12.AutoSize" type="System.Boolean, mscorlib"> <data name="label12.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@ -7265,7 +7319,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;label12.ZOrder" xml:space="preserve"> <data name="&gt;&gt;label12.ZOrder" xml:space="preserve">
<value>4</value> <value>6</value>
</data> </data>
<data name="nUDGyroMouseVertScale.Location" type="System.Drawing.Point, System.Drawing"> <data name="nUDGyroMouseVertScale.Location" type="System.Drawing.Point, System.Drawing">
<value>96, 93</value> <value>96, 93</value>
@ -7286,7 +7340,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;nUDGyroMouseVertScale.ZOrder" xml:space="preserve"> <data name="&gt;&gt;nUDGyroMouseVertScale.ZOrder" xml:space="preserve">
<value>5</value> <value>7</value>
</data> </data>
<data name="label11.AutoSize" type="System.Boolean, mscorlib"> <data name="label11.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@ -7316,7 +7370,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;label11.ZOrder" xml:space="preserve"> <data name="&gt;&gt;label11.ZOrder" xml:space="preserve">
<value>6</value> <value>8</value>
</data> </data>
<data name="gyroTriggerBehavior.AutoSize" type="System.Boolean, mscorlib"> <data name="gyroTriggerBehavior.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@ -7349,7 +7403,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;gyroTriggerBehavior.ZOrder" xml:space="preserve"> <data name="&gt;&gt;gyroTriggerBehavior.ZOrder" xml:space="preserve">
<value>7</value> <value>9</value>
</data> </data>
<data name="cBGyroInvertY.AutoSize" type="System.Boolean, mscorlib"> <data name="cBGyroInvertY.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@ -7382,7 +7436,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;cBGyroInvertY.ZOrder" xml:space="preserve"> <data name="&gt;&gt;cBGyroInvertY.ZOrder" xml:space="preserve">
<value>8</value> <value>10</value>
</data> </data>
<data name="cBGyroInvertX.AutoSize" type="System.Boolean, mscorlib"> <data name="cBGyroInvertX.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@ -7415,7 +7469,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;cBGyroInvertX.ZOrder" xml:space="preserve"> <data name="&gt;&gt;cBGyroInvertX.ZOrder" xml:space="preserve">
<value>9</value> <value>11</value>
</data> </data>
<data name="lbGyroInvert.AutoSize" type="System.Boolean, mscorlib"> <data name="lbGyroInvert.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@ -7448,7 +7502,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;lbGyroInvert.ZOrder" xml:space="preserve"> <data name="&gt;&gt;lbGyroInvert.ZOrder" xml:space="preserve">
<value>10</value> <value>12</value>
</data> </data>
<data name="lbGyroTriggers.AutoSize" type="System.Boolean, mscorlib"> <data name="lbGyroTriggers.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@ -7481,7 +7535,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;lbGyroTriggers.ZOrder" xml:space="preserve"> <data name="&gt;&gt;lbGyroTriggers.ZOrder" xml:space="preserve">
<value>11</value> <value>13</value>
</data> </data>
<data name="btnGyroTriggers.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> <data name="btnGyroTriggers.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value> <value>NoControl</value>
@ -7511,7 +7565,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;btnGyroTriggers.ZOrder" xml:space="preserve"> <data name="&gt;&gt;btnGyroTriggers.ZOrder" xml:space="preserve">
<value>12</value> <value>14</value>
</data> </data>
<data name="nUDGyroSensitivity.Location" type="System.Drawing.Point, System.Drawing"> <data name="nUDGyroSensitivity.Location" type="System.Drawing.Point, System.Drawing">
<value>96, 67</value> <value>96, 67</value>
@ -7532,7 +7586,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;nUDGyroSensitivity.ZOrder" xml:space="preserve"> <data name="&gt;&gt;nUDGyroSensitivity.ZOrder" xml:space="preserve">
<value>13</value> <value>15</value>
</data> </data>
<data name="lbGyroSens.AutoSize" type="System.Boolean, mscorlib"> <data name="lbGyroSens.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@ -7565,7 +7619,7 @@ with profile</value>
<value>pnlSAMouse</value> <value>pnlSAMouse</value>
</data> </data>
<data name="&gt;&gt;lbGyroSens.ZOrder" xml:space="preserve"> <data name="&gt;&gt;lbGyroSens.ZOrder" xml:space="preserve">
<value>14</value> <value>16</value>
</data> </data>
<data name="pnlSAMouse.Location" type="System.Drawing.Point, System.Drawing"> <data name="pnlSAMouse.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 43</value> <value>6, 43</value>