This commit is contained in:
mika-n 2019-08-26 19:28:28 +03:00
commit c1acc8dee6
5 changed files with 3772 additions and 770 deletions

View File

@ -133,7 +133,7 @@ namespace DS4Windows
useReverseRatchet = Global.GetGyroMouseStickTriggerTurns(deviceNum); useReverseRatchet = Global.GetGyroMouseStickTriggerTurns(deviceNum);
int i = 0; int i = 0;
string[] ss = Global.GetSAMousestickTriggers(deviceNum).Split(','); string[] ss = Global.GetSAMouseStickTriggers(deviceNum).Split(',');
bool andCond = Global.GetSAMouseStickTriggerCond(deviceNum); bool andCond = Global.GetSAMouseStickTriggerCond(deviceNum);
triggeractivated = andCond ? true : false; triggeractivated = andCond ? true : false;
if (!string.IsNullOrEmpty(ss[0])) if (!string.IsNullOrEmpty(ss[0]))
@ -155,7 +155,6 @@ namespace DS4Windows
} }
} }
previousTriggerActivated = triggeractivated;
if (toggleGyroMouse) if (toggleGyroMouse)
{ {
if (triggeractivated && triggeractivated != previousTriggerActivated) if (triggeractivated && triggeractivated != previousTriggerActivated)

View File

@ -862,7 +862,7 @@ namespace DS4Windows
} }
public static string[] SAMousestickTriggers => m_Config.sAMouseStickTriggers; public static string[] SAMousestickTriggers => m_Config.sAMouseStickTriggers;
public static string GetSAMousestickTriggers(int device) public static string GetSAMouseStickTriggers(int device)
{ {
return m_Config.sAMouseStickTriggers[device]; return m_Config.sAMouseStickTriggers[device];
} }
@ -896,6 +896,10 @@ namespace DS4Windows
return m_Config.gyroMStickInfo[device]; return m_Config.gyroMStickInfo[device];
} }
public static bool[] GyroMouseStickToggle => m_Config.gyroMouseStickToggle;
public static void SetGyroMouseStickToggle(int index, bool value, ControlService control)
=> m_Config.SetGyroMouseStickToggle(index, value, control);
public static SASteeringWheelEmulationAxisType[] SASteeringWheelEmulationAxis => m_Config.sASteeringWheelEmulationAxis; public static SASteeringWheelEmulationAxisType[] SASteeringWheelEmulationAxis => m_Config.sASteeringWheelEmulationAxis;
public static SASteeringWheelEmulationAxisType GetSASteeringWheelEmulationAxis(int index) public static SASteeringWheelEmulationAxisType GetSASteeringWheelEmulationAxis(int index)
{ {
@ -1894,6 +1898,8 @@ namespace DS4Windows
new GyroMouseStickInfo(), new GyroMouseStickInfo(), new GyroMouseStickInfo(), new GyroMouseStickInfo(),
new GyroMouseStickInfo() new GyroMouseStickInfo()
}; };
public bool[] gyroMouseStickToggle = new bool[5] { false, false, false,
false, false };
public SASteeringWheelEmulationAxisType[] sASteeringWheelEmulationAxis = new SASteeringWheelEmulationAxisType[5] { SASteeringWheelEmulationAxisType.None, SASteeringWheelEmulationAxisType.None, SASteeringWheelEmulationAxisType.None, SASteeringWheelEmulationAxisType.None, SASteeringWheelEmulationAxisType.None }; public SASteeringWheelEmulationAxisType[] sASteeringWheelEmulationAxis = new SASteeringWheelEmulationAxisType[5] { SASteeringWheelEmulationAxisType.None, SASteeringWheelEmulationAxisType.None, SASteeringWheelEmulationAxisType.None, SASteeringWheelEmulationAxisType.None, SASteeringWheelEmulationAxisType.None };
public int[] sASteeringWheelEmulationRange = new int[5] { 360, 360, 360, 360, 360 }; public int[] sASteeringWheelEmulationRange = new int[5] { 360, 360, 360, 360, 360 };
@ -2070,6 +2076,13 @@ namespace DS4Windows
control.touchPad[index].ToggleGyroMouse = value; control.touchPad[index].ToggleGyroMouse = value;
} }
public void SetGyroMouseStickToggle(int index, bool value, ControlService control)
{
gyroMouseStickToggle[index] = value;
if (index < 4 && control.touchPad[index] != null)
control.touchPad[index].ToggleGyroMouse = value;
}
private string OutContDeviceString(OutContType id) private string OutContDeviceString(OutContType id)
{ {
string result = "X360"; string result = "X360";
@ -2266,6 +2279,7 @@ namespace DS4Windows
XmlNode xmlGyroMStickAntiDX = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroMouseStickAntiDeadX", null); xmlGyroMStickAntiDX.InnerText = gyroMStickInfo[device].antiDeadX.ToString(); Node.AppendChild(xmlGyroMStickAntiDX); XmlNode xmlGyroMStickAntiDX = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroMouseStickAntiDeadX", null); xmlGyroMStickAntiDX.InnerText = gyroMStickInfo[device].antiDeadX.ToString(); Node.AppendChild(xmlGyroMStickAntiDX);
XmlNode xmlGyroMStickAntiDY = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroMouseStickAntiDeadY", null); xmlGyroMStickAntiDY.InnerText = gyroMStickInfo[device].antiDeadY.ToString(); Node.AppendChild(xmlGyroMStickAntiDY); XmlNode xmlGyroMStickAntiDY = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroMouseStickAntiDeadY", null); xmlGyroMStickAntiDY.InnerText = gyroMStickInfo[device].antiDeadY.ToString(); Node.AppendChild(xmlGyroMStickAntiDY);
XmlNode xmlGyroMStickInvert = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroMouseStickInvert", null); xmlGyroMStickInvert.InnerText = gyroMStickInfo[device].inverted.ToString(); Node.AppendChild(xmlGyroMStickInvert); XmlNode xmlGyroMStickInvert = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroMouseStickInvert", null); xmlGyroMStickInvert.InnerText = gyroMStickInfo[device].inverted.ToString(); Node.AppendChild(xmlGyroMStickInvert);
XmlNode xmlGyroMStickToggle = m_Xdoc.CreateNode(XmlNodeType.Element, "GyroMouseStickToggle", null); xmlGyroMStickToggle.InnerText = gyroMouseStickToggle[device].ToString(); Node.AppendChild(xmlGyroMStickToggle);
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);
@ -3140,7 +3154,6 @@ namespace DS4Windows
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroMouseStickTriggerTurns"); bool.TryParse(Item.InnerText, out gyroMouseStickTriggerTurns[device]); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroMouseStickTriggerTurns"); bool.TryParse(Item.InnerText, out gyroMouseStickTriggerTurns[device]); }
catch { gyroMouseStickTriggerTurns[device] = true; missingSetting = true; } catch { gyroMouseStickTriggerTurns[device] = true; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroMouseStickHAxis"); int temp = 0; int.TryParse(Item.InnerText, out temp); gyroMouseStickHorizontalAxis[device] = Math.Min(Math.Max(0, temp), 1); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroMouseStickHAxis"); int temp = 0; int.TryParse(Item.InnerText, out temp); gyroMouseStickHorizontalAxis[device] = Math.Min(Math.Max(0, temp), 1); }
catch { gyroMouseStickHorizontalAxis[device] = 0; missingSetting = true; } catch { gyroMouseStickHorizontalAxis[device] = 0; missingSetting = true; }
@ -3172,6 +3185,13 @@ namespace DS4Windows
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroMouseStickInvert"); uint.TryParse(Item.InnerText, out gyroMStickInfo[device].inverted); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroMouseStickInvert"); uint.TryParse(Item.InnerText, out gyroMStickInfo[device].inverted); }
catch { gyroMStickInfo[device].inverted = 0; missingSetting = true; } catch { gyroMStickInfo[device].inverted = 0; missingSetting = true; }
try
{
Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroMouseStickToggle"); bool.TryParse(Item.InnerText, out bool temp);
gyroMouseStickToggle[device] = temp;
}
catch { gyroMouseStickToggle[device] = false; missingSetting = true; }
try try
{ {
@ -3217,9 +3237,9 @@ namespace DS4Windows
try try
{ {
Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroMouseToggle"); bool.TryParse(Item.InnerText, out bool temp); Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroMouseToggle"); bool.TryParse(Item.InnerText, out bool temp);
SetGyroMouseToggle(device, temp, control); gyroMouseToggle[device] = temp;
} }
catch { SetGyroMouseToggle(device, false, control); missingSetting = true; } catch { gyroMouseToggle[device] = false; 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; }
@ -3553,7 +3573,20 @@ namespace DS4Windows
containsCustomExtras[device] = HasCustomExtras(device); containsCustomExtras[device] = HasCustomExtras(device);
if (device < 4) if (device < 4)
{
Program.rootHub.touchPad[device]?.ResetToggleGyroM(); Program.rootHub.touchPad[device]?.ResetToggleGyroM();
GyroOutMode currentGyro = gyroOutMode[device];
if (currentGyro == GyroOutMode.Mouse)
{
control.touchPad[device].ToggleGyroMouse =
gyroMouseToggle[device];
}
else if (currentGyro == GyroOutMode.MouseJoystick)
{
control.touchPad[device].ToggleGyroMouse =
gyroMouseStickToggle[device];
}
}
// If a device exists, make sure to transfer relevant profile device // If a device exists, make sure to transfer relevant profile device
// options to device instance // options to device instance
@ -4555,6 +4588,7 @@ namespace DS4Windows
gyroMStickInfo[device].deadZone = 30; gyroMStickInfo[device].maxZone = 830; gyroMStickInfo[device].deadZone = 30; gyroMStickInfo[device].maxZone = 830;
gyroMStickInfo[device].antiDeadX = 0.4; gyroMStickInfo[device].antiDeadY = 0.4; gyroMStickInfo[device].antiDeadX = 0.4; gyroMStickInfo[device].antiDeadY = 0.4;
gyroMStickInfo[device].inverted = 0; gyroMStickInfo[device].inverted = 0;
gyroMouseStickToggle[device] = false;
sASteeringWheelEmulationAxis[device] = SASteeringWheelEmulationAxisType.None; sASteeringWheelEmulationAxis[device] = SASteeringWheelEmulationAxisType.None;
sASteeringWheelEmulationRange[device] = 360; sASteeringWheelEmulationRange[device] = 360;
touchDisInvertTriggers[device] = new int[1] { -1 }; touchDisInvertTriggers[device] = new int[1] { -1 };
@ -4566,6 +4600,7 @@ namespace DS4Windows
gyroSmoothing[device] = false; gyroSmoothing[device] = false;
gyroSmoothWeight[device] = 0.5; gyroSmoothWeight[device] = 0.5;
gyroMouseHorizontalAxis[device] = 0; gyroMouseHorizontalAxis[device] = 0;
gyroMouseToggle[device] = false;
squStickInfo[device].lsMode = false; squStickInfo[device].lsMode = false;
squStickInfo[device].rsMode = false; squStickInfo[device].rsMode = false;
squStickInfo[device].roundness = 5.0; squStickInfo[device].roundness = 5.0;

View File

@ -199,6 +199,7 @@
this.label36 = new System.Windows.Forms.Label(); this.label36 = new System.Windows.Forms.Label();
this.btnGyroMStickTrig = new System.Windows.Forms.Button(); this.btnGyroMStickTrig = new System.Windows.Forms.Button();
this.gyroMStickTrigBehaveCk = new System.Windows.Forms.CheckBox(); this.gyroMStickTrigBehaveCk = new System.Windows.Forms.CheckBox();
this.gyroMStickToggleCk = new System.Windows.Forms.CheckBox();
this.label29 = new System.Windows.Forms.Label(); this.label29 = new System.Windows.Forms.Label();
this.gyroMouseStickDZ = new System.Windows.Forms.NumericUpDown(); this.gyroMouseStickDZ = new System.Windows.Forms.NumericUpDown();
this.label30 = new System.Windows.Forms.Label(); this.label30 = new System.Windows.Forms.Label();
@ -2036,6 +2037,7 @@
this.gyroMouseJoyFLP.Controls.Add(this.label36); this.gyroMouseJoyFLP.Controls.Add(this.label36);
this.gyroMouseJoyFLP.Controls.Add(this.btnGyroMStickTrig); this.gyroMouseJoyFLP.Controls.Add(this.btnGyroMStickTrig);
this.gyroMouseJoyFLP.Controls.Add(this.gyroMStickTrigBehaveCk); this.gyroMouseJoyFLP.Controls.Add(this.gyroMStickTrigBehaveCk);
this.gyroMouseJoyFLP.Controls.Add(this.gyroMStickToggleCk);
this.gyroMouseJoyFLP.Controls.Add(this.label29); this.gyroMouseJoyFLP.Controls.Add(this.label29);
this.gyroMouseJoyFLP.Controls.Add(this.gyroMouseStickDZ); this.gyroMouseJoyFLP.Controls.Add(this.gyroMouseStickDZ);
this.gyroMouseJoyFLP.Controls.Add(this.label30); this.gyroMouseJoyFLP.Controls.Add(this.label30);
@ -2074,6 +2076,13 @@
this.gyroMStickTrigBehaveCk.UseVisualStyleBackColor = true; this.gyroMStickTrigBehaveCk.UseVisualStyleBackColor = true;
this.gyroMStickTrigBehaveCk.CheckedChanged += new System.EventHandler(this.GyroMStickTrigBehaveCk_CheckedChanged); this.gyroMStickTrigBehaveCk.CheckedChanged += new System.EventHandler(this.GyroMStickTrigBehaveCk_CheckedChanged);
// //
// gyroMStickToggleCk
//
resources.ApplyResources(this.gyroMStickToggleCk, "gyroMStickToggleCk");
this.gyroMStickToggleCk.Name = "gyroMStickToggleCk";
this.gyroMStickToggleCk.UseVisualStyleBackColor = true;
this.gyroMStickToggleCk.CheckedChanged += new System.EventHandler(this.GyroMStickToggleCk_CheckedChanged);
//
// label29 // label29
// //
resources.ApplyResources(this.label29, "label29"); resources.ApplyResources(this.label29, "label29");
@ -5082,5 +5091,6 @@
private System.Windows.Forms.CheckBox gyroMStickTrigBehaveCk; private System.Windows.Forms.CheckBox gyroMStickTrigBehaveCk;
private System.Windows.Forms.Label label35; private System.Windows.Forms.Label label35;
private System.Windows.Forms.ComboBox gyroMouseStickEvalCombo; private System.Windows.Forms.ComboBox gyroMouseStickEvalCombo;
private System.Windows.Forms.CheckBox gyroMStickToggleCk;
} }
} }

View File

@ -814,6 +814,7 @@ namespace DS4Windows.Forms
gyroMousestickXAxisCom.SelectedIndex = GyroMouseStickHorizontalAxis[device]; gyroMousestickXAxisCom.SelectedIndex = GyroMouseStickHorizontalAxis[device];
gyroMouseStickInvertXCk.Checked = (gyroMouseStickInfo.inverted & 1) == 1; gyroMouseStickInvertXCk.Checked = (gyroMouseStickInfo.inverted & 1) == 1;
gyroMouseStickInvertYCk.Checked = (gyroMouseStickInfo.inverted & 2) == 2; gyroMouseStickInvertYCk.Checked = (gyroMouseStickInfo.inverted & 2) == 2;
gyroMStickToggleCk.Checked = GyroMouseStickToggle[device];
} }
else else
{ {
@ -957,6 +958,8 @@ namespace DS4Windows.Forms
gyroMousestickXAxisCom.SelectedIndex = 0; gyroMousestickXAxisCom.SelectedIndex = 0;
gyroMouseStickInvertXCk.Checked = false; gyroMouseStickInvertXCk.Checked = false;
gyroMouseStickInvertYCk.Checked = false; gyroMouseStickInvertYCk.Checked = false;
gyroMStickTrigBehaveCk.Checked = false;
gyroMStickToggleCk.Checked = false;
Set(); Set();
} }
@ -1474,7 +1477,7 @@ namespace DS4Windows.Forms
GyroSmoothingWeight[device] = (double)nUDGyroSmoothWeight.Value; GyroSmoothingWeight[device] = (double)nUDGyroSmoothWeight.Value;
GyroMouseHorizontalAxis[device] = cBGyroMouseXAxis.SelectedIndex; GyroMouseHorizontalAxis[device] = cBGyroMouseXAxis.SelectedIndex;
SetGyroMouseDeadZone(device, (int)gyroMouseDzNUD.Value, Program.rootHub); SetGyroMouseDeadZone(device, (int)gyroMouseDzNUD.Value, Program.rootHub);
SetGyroMouseToggle(device, toggleGyroMCb.Checked, Program.rootHub); //SetGyroMouseToggle(device, toggleGyroMCb.Checked, Program.rootHub);
int invert = 0; int invert = 0;
if (cBGyroInvertX.Checked) if (cBGyroInvertX.Checked)
@ -1535,9 +1538,12 @@ namespace DS4Windows.Forms
break; break;
case 1: case 1:
GyroOutputMode[device] = GyroOutMode.Mouse; GyroOutputMode[device] = GyroOutMode.Mouse;
SetGyroMouseToggle(device, toggleGyroMCb.Checked, Program.rootHub);
break; break;
case 2: case 2:
GyroOutputMode[device] = GyroOutMode.MouseJoystick; GyroOutputMode[device] = GyroOutMode.MouseJoystick;
SetGyroMouseStickToggle(device,
gyroMStickToggleCk.Checked, Program.rootHub);
break; break;
default: default:
break; break;
@ -3666,6 +3672,15 @@ namespace DS4Windows.Forms
} }
} }
private void GyroMStickToggleCk_CheckedChanged(object sender, EventArgs e)
{
if (loading == false)
{
Global.SetGyroMouseStickToggle(device,
gyroMStickToggleCk.Checked, Program.rootHub);
}
}
private void trackFrictionNUD_ValueChanged(object sender, EventArgs e) private void trackFrictionNUD_ValueChanged(object sender, EventArgs e)
{ {
if (loading == false) if (loading == false)

File diff suppressed because it is too large Load Diff