Make separate roundness setting for RS

This commit is contained in:
Travis Nickles 2019-09-13 22:26:58 -05:00
parent 6f27ea047c
commit 458834577a
6 changed files with 48 additions and 31 deletions

View File

@ -905,7 +905,7 @@ namespace DS4Windows
double tempY = (dState.LY - 128.0) / capY; double tempY = (dState.LY - 128.0) / capY;
DS4SquareStick sqstick = outSqrStk[device]; DS4SquareStick sqstick = outSqrStk[device];
sqstick.current.x = tempX; sqstick.current.y = tempY; sqstick.current.x = tempX; sqstick.current.y = tempY;
sqstick.CircleToSquare(squStk.roundness); sqstick.CircleToSquare(squStk.lsRoundness);
//Console.WriteLine("Input ({0}) | Output ({1})", tempY, sqstick.current.y); //Console.WriteLine("Input ({0}) | Output ({1})", tempY, sqstick.current.y);
tempX = sqstick.current.x < -1.0 ? -1.0 : sqstick.current.x > 1.0 tempX = sqstick.current.x < -1.0 ? -1.0 : sqstick.current.x > 1.0
? 1.0 : sqstick.current.x; ? 1.0 : sqstick.current.x;
@ -1008,7 +1008,7 @@ namespace DS4Windows
double tempY = (dState.RY - 128.0) / capY; double tempY = (dState.RY - 128.0) / capY;
DS4SquareStick sqstick = outSqrStk[device]; DS4SquareStick sqstick = outSqrStk[device];
sqstick.current.x = tempX; sqstick.current.y = tempY; sqstick.current.x = tempX; sqstick.current.y = tempY;
sqstick.CircleToSquare(squStk.roundness); sqstick.CircleToSquare(squStk.rsRoundness);
tempX = sqstick.current.x < -1.0 ? -1.0 : sqstick.current.x > 1.0 tempX = sqstick.current.x < -1.0 ? -1.0 : sqstick.current.x > 1.0
? 1.0 : sqstick.current.x; ? 1.0 : sqstick.current.x;
tempY = sqstick.current.y < -1.0 ? -1.0 : sqstick.current.y > 1.0 tempY = sqstick.current.y < -1.0 ? -1.0 : sqstick.current.y > 1.0

View File

@ -6,7 +6,8 @@ namespace DS4Windows
{ {
public bool lsMode; public bool lsMode;
public bool rsMode; public bool rsMode;
public double roundness = 5.0; public double lsRoundness = 5.0;
public double rsRoundness = 5.0;
} }
public class StickDeadZoneInfo public class StickDeadZoneInfo

View File

@ -2307,7 +2307,8 @@ namespace DS4Windows
XmlNode xmlLsSquareStickMode = m_Xdoc.CreateNode(XmlNodeType.Element, "LSSquareStick", null); xmlLsSquareStickMode.InnerText = squStickInfo[device].lsMode.ToString(); Node.AppendChild(xmlLsSquareStickMode); XmlNode xmlLsSquareStickMode = m_Xdoc.CreateNode(XmlNodeType.Element, "LSSquareStick", null); xmlLsSquareStickMode.InnerText = squStickInfo[device].lsMode.ToString(); Node.AppendChild(xmlLsSquareStickMode);
XmlNode xmlRsSquareStickMode = m_Xdoc.CreateNode(XmlNodeType.Element, "RSSquareStick", null); xmlRsSquareStickMode.InnerText = squStickInfo[device].rsMode.ToString(); Node.AppendChild(xmlRsSquareStickMode); XmlNode xmlRsSquareStickMode = m_Xdoc.CreateNode(XmlNodeType.Element, "RSSquareStick", null); xmlRsSquareStickMode.InnerText = squStickInfo[device].rsMode.ToString(); Node.AppendChild(xmlRsSquareStickMode);
XmlNode xmlSquareStickRoundness = m_Xdoc.CreateNode(XmlNodeType.Element, "SquareStickRoundness", null); xmlSquareStickRoundness.InnerText = squStickInfo[device].roundness.ToString(); Node.AppendChild(xmlSquareStickRoundness); XmlNode xmlSquareStickRoundness = m_Xdoc.CreateNode(XmlNodeType.Element, "SquareStickRoundness", null); xmlSquareStickRoundness.InnerText = squStickInfo[device].lsRoundness.ToString(); Node.AppendChild(xmlSquareStickRoundness);
XmlNode xmlSquareRStickRoundness = m_Xdoc.CreateNode(XmlNodeType.Element, "SquareRStickRoundness", null); xmlSquareRStickRoundness.InnerText = squStickInfo[device].rsRoundness.ToString(); Node.AppendChild(xmlSquareRStickRoundness);
XmlNode xmlL2OutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "L2OutputCurveMode", null); xmlL2OutputCurveMode.InnerText = axisOutputCurveString(getL2OutCurveMode(device)); Node.AppendChild(xmlL2OutputCurveMode); XmlNode xmlL2OutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "L2OutputCurveMode", null); xmlL2OutputCurveMode.InnerText = axisOutputCurveString(getL2OutCurveMode(device)); Node.AppendChild(xmlL2OutputCurveMode);
XmlNode xmlL2OutputCurveCustom = m_Xdoc.CreateNode(XmlNodeType.Element, "L2OutputCurveCustom", null); xmlL2OutputCurveCustom.InnerText = l2OutBezierCurveObj[device].ToString(); Node.AppendChild(xmlL2OutputCurveCustom); XmlNode xmlL2OutputCurveCustom = m_Xdoc.CreateNode(XmlNodeType.Element, "L2OutputCurveCustom", null); xmlL2OutputCurveCustom.InnerText = l2OutBezierCurveObj[device].ToString(); Node.AppendChild(xmlL2OutputCurveCustom);
@ -3298,8 +3299,10 @@ namespace DS4Windows
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSSquareStick"); bool.TryParse(Item.InnerText, out squStickInfo[device].lsMode); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSSquareStick"); bool.TryParse(Item.InnerText, out squStickInfo[device].lsMode); }
catch { squStickInfo[device].lsMode = false; missingSetting = true; } catch { squStickInfo[device].lsMode = false; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SquareStickRoundness"); double.TryParse(Item.InnerText, out squStickInfo[device].roundness); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SquareStickRoundness"); double.TryParse(Item.InnerText, out squStickInfo[device].lsRoundness); }
catch { squStickInfo[device].roundness = 5.0; missingSetting = true; } catch { squStickInfo[device].lsRoundness = 5.0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SquareRStickRoundness"); double.TryParse(Item.InnerText, out squStickInfo[device].rsRoundness); }
catch { squStickInfo[device].rsRoundness = 5.0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSSquareStick"); bool.TryParse(Item.InnerText, out squStickInfo[device].rsMode); } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSSquareStick"); bool.TryParse(Item.InnerText, out squStickInfo[device].rsMode); }
catch { squStickInfo[device].rsMode = false; missingSetting = true; } catch { squStickInfo[device].rsMode = false; missingSetting = true; }
@ -4635,7 +4638,8 @@ namespace DS4Windows
gyroMouseToggle[device] = false; 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].lsRoundness = 5.0;
squStickInfo[device].rsRoundness = 5.0;
setLsOutCurveMode(device, 0); setLsOutCurveMode(device, 0);
setRsOutCurveMode(device, 0); setRsOutCurveMode(device, 0);
setL2OutCurveMode(device, 0); setL2OutCurveMode(device, 0);

View File

@ -272,7 +272,7 @@
this.BtnLSCurveEditor = new System.Windows.Forms.Button(); this.BtnLSCurveEditor = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.rsSquStickCk = new System.Windows.Forms.CheckBox(); this.rsSquStickCk = new System.Windows.Forms.CheckBox();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); this.RoundnessRsNUD = new System.Windows.Forms.NumericUpDown();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.tBLSCustomOutputCurve = new System.Windows.Forms.TextBox(); this.tBLSCustomOutputCurve = new System.Windows.Forms.TextBox();
this.rsOutCurveComboBox = new System.Windows.Forms.ComboBox(); this.rsOutCurveComboBox = new System.Windows.Forms.ComboBox();
@ -494,7 +494,7 @@
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDRSRotation)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRSRotation)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDRSCurve)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRSCurve)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.RoundnessRsNUD)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDRSS)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRSS)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nUDLSS)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDLSS)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RoundnessNUpDown)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.RoundnessNUpDown)).BeginInit();
@ -2765,7 +2765,7 @@
this.groupBox1.Controls.Add(this.BtnLSCurveEditor); this.groupBox1.Controls.Add(this.BtnLSCurveEditor);
this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.rsSquStickCk); this.groupBox1.Controls.Add(this.rsSquStickCk);
this.groupBox1.Controls.Add(this.numericUpDown1); this.groupBox1.Controls.Add(this.RoundnessRsNUD);
this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.tBLSCustomOutputCurve); this.groupBox1.Controls.Add(this.tBLSCustomOutputCurve);
this.groupBox1.Controls.Add(this.rsOutCurveComboBox); this.groupBox1.Controls.Add(this.rsOutCurveComboBox);
@ -2857,22 +2857,22 @@
this.rsSquStickCk.Name = "rsSquStickCk"; this.rsSquStickCk.Name = "rsSquStickCk";
this.rsSquStickCk.UseVisualStyleBackColor = true; this.rsSquStickCk.UseVisualStyleBackColor = true;
// //
// numericUpDown1 // RoundnessRsNUD
// //
this.numericUpDown1.DecimalPlaces = 1; this.RoundnessRsNUD.DecimalPlaces = 1;
this.numericUpDown1.Increment = new decimal(new int[] { this.RoundnessRsNUD.Increment = new decimal(new int[] {
1, 1,
0, 0,
0, 0,
65536}); 65536});
resources.ApplyResources(this.numericUpDown1, "numericUpDown1"); resources.ApplyResources(this.RoundnessRsNUD, "RoundnessRsNUD");
this.numericUpDown1.Maximum = new decimal(new int[] { this.RoundnessRsNUD.Maximum = new decimal(new int[] {
5, 5,
0, 0,
0, 0,
0}); 0});
this.numericUpDown1.Name = "numericUpDown1"; this.RoundnessRsNUD.Name = "RoundnessRsNUD";
this.numericUpDown1.Value = new decimal(new int[] { this.RoundnessRsNUD.Value = new decimal(new int[] {
50, 50,
0, 0,
0, 0,
@ -4684,7 +4684,7 @@
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDRSRotation)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRSRotation)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDRSCurve)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRSCurve)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.RoundnessRsNUD)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDRSS)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDRSS)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nUDLSS)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDLSS)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.RoundnessNUpDown)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.RoundnessNUpDown)).EndInit();
@ -5081,7 +5081,7 @@
private System.Windows.Forms.Label lbRSCurvePercent; private System.Windows.Forms.Label lbRSCurvePercent;
private System.Windows.Forms.NumericUpDown nUDRSCurve; private System.Windows.Forms.NumericUpDown nUDRSCurve;
private System.Windows.Forms.CheckBox rsSquStickCk; private System.Windows.Forms.CheckBox rsSquStickCk;
private System.Windows.Forms.NumericUpDown numericUpDown1; private System.Windows.Forms.NumericUpDown RoundnessRsNUD;
private System.Windows.Forms.NumericUpDown nUDRSAntiDead; private System.Windows.Forms.NumericUpDown nUDRSAntiDead;
private System.Windows.Forms.NumericUpDown nUDRSMaxZone; private System.Windows.Forms.NumericUpDown nUDRSMaxZone;
private System.Windows.Forms.NumericUpDown nUDRS; private System.Windows.Forms.NumericUpDown nUDRS;

View File

@ -164,7 +164,7 @@ namespace DS4Windows.Forms
SetupEvents(); SetupEvents();
tp.SetToolTip(RoundnessNUpDown, Properties.Resources.SquareStickRoundness); tp.SetToolTip(RoundnessNUpDown, Properties.Resources.SquareStickRoundness);
tp.SetToolTip(numericUpDown1, Properties.Resources.SquareStickRoundness); tp.SetToolTip(RoundnessRsNUD, Properties.Resources.SquareStickRoundness);
} }
private void TriggerCondAndCombo_SelectedIndexChanged(object sender, EventArgs e) private void TriggerCondAndCombo_SelectedIndexChanged(object sender, EventArgs e)
@ -350,6 +350,7 @@ namespace DS4Windows.Forms
tBRSCustomOutputCurve.Leave += TBRSCustomOutputCurve_Leave; tBRSCustomOutputCurve.Leave += TBRSCustomOutputCurve_Leave;
btnRSCurveEditor.Click += BtnCurveEditor_Click; btnRSCurveEditor.Click += BtnCurveEditor_Click;
rsSquStickCk.Click += rsSquStickCk_Click; rsSquStickCk.Click += rsSquStickCk_Click;
RoundnessRsNUD.ValueChanged += RoundnessRsNUD_ValueChanged;
nUDRSCurve.ValueChanged += nUDRSCurve_ValueChanged; nUDRSCurve.ValueChanged += nUDRSCurve_ValueChanged;
nUDRSRotation.ValueChanged += nUDRSRotation_ValueChanged; nUDRSRotation.ValueChanged += nUDRSRotation_ValueChanged;
nUDL2.ValueChanged += numUDL2_ValueChanged; nUDL2.ValueChanged += numUDL2_ValueChanged;
@ -456,6 +457,14 @@ namespace DS4Windows.Forms
OutContTypeCb.SelectedIndexChanged += OutContTypeCb_SelectedIndexChanged; OutContTypeCb.SelectedIndexChanged += OutContTypeCb_SelectedIndexChanged;
} }
private void RoundnessRsNUD_ValueChanged(object sender, EventArgs e)
{
if (loading == false)
{
SquStickInfo[device].rsRoundness = (double)RoundnessRsNUD.Value;
}
}
private void MaxRainSatTB_ValueChanged(object sender, EventArgs e) private void MaxRainSatTB_ValueChanged(object sender, EventArgs e)
{ {
if (loading == false) if (loading == false)
@ -899,7 +908,8 @@ namespace DS4Windows.Forms
lsSquStickCk.Checked = SquStickInfo[device].lsMode; lsSquStickCk.Checked = SquStickInfo[device].lsMode;
rsSquStickCk.Checked = SquStickInfo[device].rsMode; rsSquStickCk.Checked = SquStickInfo[device].rsMode;
RoundnessNUpDown.Value = (decimal)SquStickInfo[device].roundness; RoundnessNUpDown.Value = (decimal)SquStickInfo[device].lsRoundness;
RoundnessRsNUD.Value = (decimal)SquStickInfo[device].rsRoundness;
cBDinput.Checked = DinputOnly[device]; cBDinput.Checked = DinputOnly[device];
olddinputcheck = cBDinput.Checked; olddinputcheck = cBDinput.Checked;
@ -1119,6 +1129,7 @@ namespace DS4Windows.Forms
lsSquStickCk.Checked = false; lsSquStickCk.Checked = false;
rsSquStickCk.Checked = false; rsSquStickCk.Checked = false;
RoundnessNUpDown.Value = 5.0m; RoundnessNUpDown.Value = 5.0m;
RoundnessRsNUD.Value = 5.0m;
cBLaunchProgram.Checked = false; cBLaunchProgram.Checked = false;
pBProgram.Image = null; pBProgram.Image = null;
@ -1657,7 +1668,8 @@ namespace DS4Windows.Forms
SZAntiDeadzone[device] = (double)nUDSixaxisZAntiDead.Value; SZAntiDeadzone[device] = (double)nUDSixaxisZAntiDead.Value;
SquStickInfo[device].lsMode = lsSquStickCk.Checked; SquStickInfo[device].lsMode = lsSquStickCk.Checked;
SquStickInfo[device].rsMode = rsSquStickCk.Checked; SquStickInfo[device].rsMode = rsSquStickCk.Checked;
SquStickInfo[device].roundness = (double)RoundnessNUpDown.Value; SquStickInfo[device].lsRoundness = (double)RoundnessNUpDown.Value;
SquStickInfo[device].rsRoundness = (double)RoundnessRsNUD.Value;
MouseAccel[device] = cBMouseAccel.Checked; MouseAccel[device] = cBMouseAccel.Checked;
DinputOnly[device] = cBDinput.Checked; DinputOnly[device] = cBDinput.Checked;
StartTouchpadOff[device] = cbStartTouchpadOff.Checked; StartTouchpadOff[device] = cbStartTouchpadOff.Checked;
@ -3601,7 +3613,7 @@ namespace DS4Windows.Forms
private void RoundnessNUpDown_ValueChanged(object sender, EventArgs e) private void RoundnessNUpDown_ValueChanged(object sender, EventArgs e)
{ {
if (loading == false) { if (loading == false) {
SquStickInfo[device].roundness = (int)RoundnessNUpDown.Value; SquStickInfo[device].lsRoundness = (double)RoundnessNUpDown.Value;
} }
} }

View File

@ -5580,25 +5580,25 @@
<data name="&gt;&gt;rsSquStickCk.ZOrder" xml:space="preserve"> <data name="&gt;&gt;rsSquStickCk.ZOrder" xml:space="preserve">
<value>8</value> <value>8</value>
</data> </data>
<data name="numericUpDown1.Location" type="System.Drawing.Point, System.Drawing"> <data name="RoundnessRsNUD.Location" type="System.Drawing.Point, System.Drawing">
<value>285, 190</value> <value>285, 190</value>
</data> </data>
<data name="numericUpDown1.Size" type="System.Drawing.Size, System.Drawing"> <data name="RoundnessRsNUD.Size" type="System.Drawing.Size, System.Drawing">
<value>44, 20</value> <value>44, 20</value>
</data> </data>
<data name="numericUpDown1.TabIndex" type="System.Int32, mscorlib"> <data name="RoundnessRsNUD.TabIndex" type="System.Int32, mscorlib">
<value>221</value> <value>221</value>
</data> </data>
<data name="&gt;&gt;numericUpDown1.Name" xml:space="preserve"> <data name="&gt;&gt;RoundnessRsNUD.Name" xml:space="preserve">
<value>numericUpDown1</value> <value>RoundnessRsNUD</value>
</data> </data>
<data name="&gt;&gt;numericUpDown1.Type" xml:space="preserve"> <data name="&gt;&gt;RoundnessRsNUD.Type" xml:space="preserve">
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="&gt;&gt;numericUpDown1.Parent" xml:space="preserve"> <data name="&gt;&gt;RoundnessRsNUD.Parent" xml:space="preserve">
<value>groupBox1</value> <value>groupBox1</value>
</data> </data>
<data name="&gt;&gt;numericUpDown1.ZOrder" xml:space="preserve"> <data name="&gt;&gt;RoundnessRsNUD.ZOrder" xml:space="preserve">
<value>9</value> <value>9</value>
</data> </data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib"> <data name="label2.AutoSize" type="System.Boolean, mscorlib">