mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-26 11:04:21 +01:00
Allow gyro button triggers to disable gyro
This commit is contained in:
parent
162092800e
commit
2d58034415
@ -34,21 +34,29 @@ namespace DS4Windows
|
||||
|
||||
public virtual void sixaxisMoved(object sender, SixAxisEventArgs arg)
|
||||
{
|
||||
if (Global.UseSAforMouse[deviceNum] && Global.GyroSensitivity[deviceNum] > 0)
|
||||
if (Global.isUsingSAforMouse(deviceNum) && Global.getGyroSensitivity(deviceNum) > 0)
|
||||
{
|
||||
bool triggeractivated = true;
|
||||
bool useReverseRatchet = Global.getGyroTriggerTurns(deviceNum);
|
||||
int i = 0;
|
||||
string[] ss = Global.SATriggers[deviceNum].Split(',');
|
||||
string[] ss = Global.getSATriggers(deviceNum).Split(',');
|
||||
if (!string.IsNullOrEmpty(ss[0]))
|
||||
{
|
||||
foreach (string s in ss)
|
||||
string s = string.Empty;
|
||||
for (int index = 0, arlen = ss.Length; triggeractivated && index < arlen; index++)
|
||||
//foreach (string s in ss)
|
||||
{
|
||||
s = ss[index];
|
||||
if (!(int.TryParse(s, out i) && getDS4ControlsByName(i)))
|
||||
{
|
||||
triggeractivated = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (triggeractivated)
|
||||
if (useReverseRatchet && triggeractivated)
|
||||
cursor.sixaxisMoved(arg);
|
||||
else if (!useReverseRatchet && !triggeractivated)
|
||||
cursor.sixaxisMoved(arg);
|
||||
|
||||
dev.getCurrentState(s);
|
||||
|
@ -567,8 +567,28 @@ namespace DS4Windows
|
||||
}
|
||||
|
||||
public static string[] SATriggers => m_Config.sATriggers;
|
||||
public static string getSATriggers(int index)
|
||||
{
|
||||
return m_Config.sATriggers[index];
|
||||
}
|
||||
|
||||
public static int[] GyroSensitivity => m_Config.gyroSensitivity;
|
||||
public static int getGyroSensitivity(int index)
|
||||
{
|
||||
return m_Config.gyroSensitivity[index];
|
||||
}
|
||||
|
||||
public static int[] GyroInvert => m_Config.gyroInvert;
|
||||
public static int getGyroInvert(int index)
|
||||
{
|
||||
return m_Config.gyroInvert[index];
|
||||
}
|
||||
|
||||
public static bool[] GyroTriggerTurns => m_Config.gyroTriggerTurns;
|
||||
public static bool getGyroTriggerTurns(int index)
|
||||
{
|
||||
return m_Config.gyroTriggerTurns[index];
|
||||
}
|
||||
|
||||
public static DS4Color[] MainColor => m_Config.m_Leds;
|
||||
public static DS4Color getMainColor(int index)
|
||||
@ -1206,10 +1226,13 @@ namespace DS4Windows
|
||||
public int flashWhenLateAt = 20;
|
||||
// Cache whether profile has custom action
|
||||
public bool[] containsCustomAction = { false, false, false, false, false };
|
||||
|
||||
// Cache whether profile has custom extras
|
||||
public bool[] containsCustomExtras = { false, false, false, false, false };
|
||||
|
||||
public int[] gyroSensitivity = { 100, 100, 100, 100, 100 };
|
||||
public int[] gyroInvert = { 0, 0, 0, 0, 0 };
|
||||
public bool[] gyroTriggerTurns = { true, true, true, true, true };
|
||||
|
||||
public BackingStore()
|
||||
{
|
||||
@ -1418,6 +1441,7 @@ namespace DS4Windows
|
||||
XmlNode xmlSATriggers = m_Xdoc.CreateNode(XmlNodeType.Element, "SATriggers", null); xmlSATriggers.InnerText = sATriggers[device].ToString(); Node.AppendChild(xmlSATriggers);
|
||||
XmlNode xmlGyroSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroSensitivity", null); xmlGyroSensitivity.InnerText = gyroSensitivity[device].ToString(); Node.AppendChild(xmlGyroSensitivity);
|
||||
XmlNode xmlGyroInvert = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroInvert", null); xmlGyroInvert.InnerText = gyroInvert[device].ToString(); Node.AppendChild(xmlGyroInvert);
|
||||
XmlNode xmlGyroTriggerTurns = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroTriggerTurns", null); xmlGyroTriggerTurns.InnerText = gyroTriggerTurns[device].ToString(); Node.AppendChild(xmlGyroTriggerTurns);
|
||||
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 xmlProfileActions = m_Xdoc.CreateNode(XmlNodeType.Element, "ProfileActions", null); xmlProfileActions.InnerText = string.Join("/", profileActions[device]); Node.AppendChild(xmlProfileActions);
|
||||
@ -2315,25 +2339,29 @@ namespace DS4Windows
|
||||
}
|
||||
catch { startTouchpadOff[device] = false; missingSetting = true; }
|
||||
|
||||
try
|
||||
{ Item = m_Xdoc.SelectSingleNode("/" + rootname + "/UseTPforControls"); Boolean.TryParse(Item.InnerText, out useTPforControls[device]); }
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/UseTPforControls"); bool.TryParse(Item.InnerText, out useTPforControls[device]); }
|
||||
catch { useTPforControls[device] = false; missingSetting = true; }
|
||||
try
|
||||
{ Item = m_Xdoc.SelectSingleNode("/" + rootname + "/UseSAforMouse"); Boolean.TryParse(Item.InnerText, out useSAforMouse[device]); }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/UseSAforMouse"); bool.TryParse(Item.InnerText, out useSAforMouse[device]); }
|
||||
catch { useSAforMouse[device] = false; missingSetting = true; }
|
||||
try
|
||||
{ Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SATriggers"); sATriggers[device] = Item.InnerText; }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SATriggers"); sATriggers[device] = Item.InnerText; }
|
||||
catch { sATriggers[device] = ""; missingSetting = true; }
|
||||
try
|
||||
{ Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroSensitivity"); int.TryParse(Item.InnerText, out gyroSensitivity[device]); }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroSensitivity"); int.TryParse(Item.InnerText, out gyroSensitivity[device]); }
|
||||
catch { gyroSensitivity[device] = 100; missingSetting = true; }
|
||||
try
|
||||
{ Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroInvert"); int.TryParse(Item.InnerText, out gyroInvert[device]); }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroInvert"); int.TryParse(Item.InnerText, out gyroInvert[device]); }
|
||||
catch { gyroInvert[device] = 0; missingSetting = true; }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroTriggerTurns"); bool.TryParse(Item.InnerText, out gyroTriggerTurns[device]); }
|
||||
catch { gyroTriggerTurns[device] = true; missingSetting = true; }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSCurve"); int.TryParse(Item.InnerText, out lsCurve[device]); }
|
||||
catch { missingSetting = true; }
|
||||
catch { lsCurve[device] = 0; missingSetting = true; }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSCurve"); int.TryParse(Item.InnerText, out rsCurve[device]); }
|
||||
catch { missingSetting = true; }
|
||||
catch { rsCurve[device] = 0; missingSetting = true; }
|
||||
|
||||
try {
|
||||
Item = m_Xdoc.SelectSingleNode("/" + rootname + "/BTPollRate");
|
||||
@ -3381,6 +3409,7 @@ namespace DS4Windows
|
||||
gyroInvert[device] = 0;
|
||||
lsOutCurveMode[device] = 0;
|
||||
rsOutCurveMode[device] = 0;
|
||||
gyroTriggerTurns[device] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
12
DS4Windows/DS4Forms/Options.Designer.cs
generated
12
DS4Windows/DS4Forms/Options.Designer.cs
generated
@ -328,6 +328,7 @@
|
||||
this.shareToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.pSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.alwaysOnToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.gyroTriggerBehavior = new System.Windows.Forms.CheckBox();
|
||||
this.advColorDialog = new DS4Windows.AdvancedColorDialog();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDRainbow)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tBBlueBar)).BeginInit();
|
||||
@ -3012,6 +3013,7 @@
|
||||
//
|
||||
// pnlSAMouse
|
||||
//
|
||||
this.pnlSAMouse.Controls.Add(this.gyroTriggerBehavior);
|
||||
this.pnlSAMouse.Controls.Add(this.cBGyroInvertY);
|
||||
this.pnlSAMouse.Controls.Add(this.cBGyroInvertX);
|
||||
this.pnlSAMouse.Controls.Add(this.lbGyroInvert);
|
||||
@ -3474,6 +3476,15 @@
|
||||
resources.ApplyResources(this.alwaysOnToolStripMenuItem, "alwaysOnToolStripMenuItem");
|
||||
this.alwaysOnToolStripMenuItem.CheckedChanged += new System.EventHandler(this.SATrigger_CheckedChanged);
|
||||
//
|
||||
// gyroTriggerBehavior
|
||||
//
|
||||
resources.ApplyResources(this.gyroTriggerBehavior, "gyroTriggerBehavior");
|
||||
this.gyroTriggerBehavior.Checked = true;
|
||||
this.gyroTriggerBehavior.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.gyroTriggerBehavior.Name = "gyroTriggerBehavior";
|
||||
this.gyroTriggerBehavior.UseVisualStyleBackColor = true;
|
||||
this.gyroTriggerBehavior.CheckedChanged += new System.EventHandler(this.gyroTriggerBehavior_CheckedChanged);
|
||||
//
|
||||
// Options
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
@ -3892,5 +3903,6 @@
|
||||
private System.Windows.Forms.ComboBox lsOutCurveComboBox;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.CheckBox gyroTriggerBehavior;
|
||||
}
|
||||
}
|
@ -361,6 +361,7 @@ namespace DS4Windows
|
||||
btPollRateComboBox.SelectedIndex = getBTPollRate(device);
|
||||
lsOutCurveComboBox.SelectedIndex = getLsOutCurveMode(device);
|
||||
rsOutCurveComboBox.SelectedIndex = getRsOutCurveMode(device);
|
||||
gyroTriggerBehavior.Checked = getGyroTriggerTurns(device);
|
||||
|
||||
try
|
||||
{
|
||||
@ -594,6 +595,7 @@ namespace DS4Windows
|
||||
cbStartTouchpadOff.Checked = false;
|
||||
rBSAControls.Checked = true;
|
||||
rBTPMouse.Checked = true;
|
||||
gyroTriggerBehavior.Checked = true;
|
||||
switch (device)
|
||||
{
|
||||
case 0: tBRedBar.Value = 0; tBGreenBar.Value = 0; tBBlueBar.Value = 255; break;
|
||||
@ -1297,6 +1299,7 @@ namespace DS4Windows
|
||||
StartTouchpadOff[device] = cbStartTouchpadOff.Checked;
|
||||
UseTPforControls[device] = rBTPControls.Checked;
|
||||
UseSAforMouse[device] = rBSAMouse.Checked;
|
||||
GyroTriggerTurns[device] = gyroTriggerBehavior.Checked;
|
||||
DS4Mapping = cBControllerInput.Checked;
|
||||
LSCurve[device] = (int)Math.Round(nUDLSCurve.Value, 0);
|
||||
RSCurve[device] = (int)Math.Round(nUDRSCurve.Value, 0);
|
||||
@ -2803,6 +2806,14 @@ namespace DS4Windows
|
||||
}
|
||||
}
|
||||
|
||||
private void gyroTriggerBehavior_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!loading)
|
||||
{
|
||||
GyroTriggerTurns[device] = gyroTriggerBehavior.Checked;
|
||||
}
|
||||
}
|
||||
|
||||
private void Options_Resize(object sender, EventArgs e)
|
||||
{
|
||||
fLPSettings.AutoScroll = false;
|
||||
|
@ -6943,6 +6943,39 @@ with profile</value>
|
||||
<data name=">>rBSAMouse.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="gyroTriggerBehavior.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="gyroTriggerBehavior.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="gyroTriggerBehavior.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>5, 41</value>
|
||||
</data>
|
||||
<data name="gyroTriggerBehavior.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms">
|
||||
<value>Yes</value>
|
||||
</data>
|
||||
<data name="gyroTriggerBehavior.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>165, 17</value>
|
||||
</data>
|
||||
<data name="gyroTriggerBehavior.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>262</value>
|
||||
</data>
|
||||
<data name="gyroTriggerBehavior.Text" xml:space="preserve">
|
||||
<value>Trigger Behavior - Turns Gyro</value>
|
||||
</data>
|
||||
<data name=">>gyroTriggerBehavior.Name" xml:space="preserve">
|
||||
<value>gyroTriggerBehavior</value>
|
||||
</data>
|
||||
<data name=">>gyroTriggerBehavior.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>gyroTriggerBehavior.Parent" xml:space="preserve">
|
||||
<value>pnlSAMouse</value>
|
||||
</data>
|
||||
<data name=">>gyroTriggerBehavior.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="cBGyroInvertY.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
@ -6950,7 +6983,7 @@ with profile</value>
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="cBGyroInvertY.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>97, 76</value>
|
||||
<value>94, 94</value>
|
||||
</data>
|
||||
<data name="cBGyroInvertY.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms">
|
||||
<value>Yes</value>
|
||||
@ -6974,7 +7007,7 @@ with profile</value>
|
||||
<value>pnlSAMouse</value>
|
||||
</data>
|
||||
<data name=">>cBGyroInvertY.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="cBGyroInvertX.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@ -6983,7 +7016,7 @@ with profile</value>
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="cBGyroInvertX.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>54, 76</value>
|
||||
<value>51, 94</value>
|
||||
</data>
|
||||
<data name="cBGyroInvertX.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms">
|
||||
<value>Yes</value>
|
||||
@ -7007,7 +7040,7 @@ with profile</value>
|
||||
<value>pnlSAMouse</value>
|
||||
</data>
|
||||
<data name=">>cBGyroInvertX.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="lbGyroInvert.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@ -7016,7 +7049,7 @@ with profile</value>
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="lbGyroInvert.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>9, 77</value>
|
||||
<value>6, 95</value>
|
||||
</data>
|
||||
<data name="lbGyroInvert.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>37, 13</value>
|
||||
@ -7040,7 +7073,7 @@ with profile</value>
|
||||
<value>pnlSAMouse</value>
|
||||
</data>
|
||||
<data name=">>lbGyroInvert.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="lbGyroTriggers.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@ -7073,7 +7106,7 @@ with profile</value>
|
||||
<value>pnlSAMouse</value>
|
||||
</data>
|
||||
<data name=">>lbGyroTriggers.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="btnGyroTriggers.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
@ -7103,10 +7136,10 @@ with profile</value>
|
||||
<value>pnlSAMouse</value>
|
||||
</data>
|
||||
<data name=">>btnGyroTriggers.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="nUDGyroSensitivity.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>110, 45</value>
|
||||
<value>110, 65</value>
|
||||
</data>
|
||||
<data name="nUDGyroSensitivity.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>49, 20</value>
|
||||
@ -7124,7 +7157,7 @@ with profile</value>
|
||||
<value>pnlSAMouse</value>
|
||||
</data>
|
||||
<data name=">>nUDGyroSensitivity.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="lbGyroSens.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@ -7133,7 +7166,7 @@ with profile</value>
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="lbGyroSens.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>6, 46</value>
|
||||
<value>6, 66</value>
|
||||
</data>
|
||||
<data name="lbGyroSens.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>82, 13</value>
|
||||
@ -7157,7 +7190,7 @@ with profile</value>
|
||||
<value>pnlSAMouse</value>
|
||||
</data>
|
||||
<data name=">>lbGyroSens.ZOrder" xml:space="preserve">
|
||||
<value>6</value>
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="pnlSAMouse.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>6, 43</value>
|
||||
@ -7726,6 +7759,9 @@ with profile</value>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1010, 481</value>
|
||||
</data>
|
||||
<data name="$this.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>4, 4, 4, 4</value>
|
||||
</data>
|
||||
@ -8030,7 +8066,7 @@ with profile</value>
|
||||
<value>advColorDialog</value>
|
||||
</data>
|
||||
<data name=">>advColorDialog.Type" xml:space="preserve">
|
||||
<value>DS4Windows.AdvancedColorDialog, DS4Windows, Version=1.4.74.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>DS4Windows.AdvancedColorDialog, DS4Windows, Version=1.4.80.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>Options</value>
|
||||
|
@ -813,11 +813,6 @@ namespace DS4Windows
|
||||
cState.TouchButton = (inputReport[7] & (1 << 2 - 1)) != 0;
|
||||
cState.FrameCounter = (byte)(inputReport[7] >> 2);
|
||||
|
||||
// Store Gyro and Accel values
|
||||
Array.Copy(inputReport, 13, gyro, 0, 6);
|
||||
Array.Copy(inputReport, 19, accel, 0, 6);
|
||||
sixAxis.handleSixaxis(gyro, accel, cState);
|
||||
|
||||
try
|
||||
{
|
||||
charging = (inputReport[30] & 0x10) != 0;
|
||||
@ -855,6 +850,11 @@ namespace DS4Windows
|
||||
}
|
||||
catch { currerror = "Index out of bounds: touchpad"; }
|
||||
|
||||
// Store Gyro and Accel values
|
||||
Array.Copy(inputReport, 13, gyro, 0, 6);
|
||||
Array.Copy(inputReport, 19, accel, 0, 6);
|
||||
sixAxis.handleSixaxis(gyro, accel, cState);
|
||||
|
||||
/* Debug output of incoming HID data:
|
||||
if (cState.L2 == 0xff && cState.R2 == 0xff)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user