From 458834577a30cbc458eccb0919e44e9d780dcef0 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Fri, 13 Sep 2019 22:26:58 -0500 Subject: [PATCH] Make separate roundness setting for RS --- DS4Windows/DS4Control/Mapping.cs | 4 ++-- DS4Windows/DS4Control/ProfilePropGroups.cs | 3 ++- DS4Windows/DS4Control/ScpUtil.cs | 12 +++++++---- DS4Windows/DS4Forms/Options.Designer.cs | 24 +++++++++++----------- DS4Windows/DS4Forms/Options.cs | 20 ++++++++++++++---- DS4Windows/DS4Forms/Options.resx | 16 +++++++-------- 6 files changed, 48 insertions(+), 31 deletions(-) diff --git a/DS4Windows/DS4Control/Mapping.cs b/DS4Windows/DS4Control/Mapping.cs index 9cbf6ca..01ea4a3 100644 --- a/DS4Windows/DS4Control/Mapping.cs +++ b/DS4Windows/DS4Control/Mapping.cs @@ -905,7 +905,7 @@ namespace DS4Windows double tempY = (dState.LY - 128.0) / capY; DS4SquareStick sqstick = outSqrStk[device]; 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); tempX = sqstick.current.x < -1.0 ? -1.0 : sqstick.current.x > 1.0 ? 1.0 : sqstick.current.x; @@ -1008,7 +1008,7 @@ namespace DS4Windows double tempY = (dState.RY - 128.0) / capY; DS4SquareStick sqstick = outSqrStk[device]; 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 ? 1.0 : sqstick.current.x; tempY = sqstick.current.y < -1.0 ? -1.0 : sqstick.current.y > 1.0 diff --git a/DS4Windows/DS4Control/ProfilePropGroups.cs b/DS4Windows/DS4Control/ProfilePropGroups.cs index ed53966..4bc2c69 100644 --- a/DS4Windows/DS4Control/ProfilePropGroups.cs +++ b/DS4Windows/DS4Control/ProfilePropGroups.cs @@ -6,7 +6,8 @@ namespace DS4Windows { public bool lsMode; public bool rsMode; - public double roundness = 5.0; + public double lsRoundness = 5.0; + public double rsRoundness = 5.0; } public class StickDeadZoneInfo diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index 15d574f..0e26dc1 100644 --- a/DS4Windows/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -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 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 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); } catch { squStickInfo[device].lsMode = false; missingSetting = true; } - try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SquareStickRoundness"); double.TryParse(Item.InnerText, out squStickInfo[device].roundness); } - catch { squStickInfo[device].roundness = 5.0; missingSetting = true; } + try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SquareStickRoundness"); double.TryParse(Item.InnerText, out squStickInfo[device].lsRoundness); } + 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); } catch { squStickInfo[device].rsMode = false; missingSetting = true; } @@ -4635,7 +4638,8 @@ namespace DS4Windows gyroMouseToggle[device] = false; squStickInfo[device].lsMode = false; squStickInfo[device].rsMode = false; - squStickInfo[device].roundness = 5.0; + squStickInfo[device].lsRoundness = 5.0; + squStickInfo[device].rsRoundness = 5.0; setLsOutCurveMode(device, 0); setRsOutCurveMode(device, 0); setL2OutCurveMode(device, 0); diff --git a/DS4Windows/DS4Forms/Options.Designer.cs b/DS4Windows/DS4Forms/Options.Designer.cs index f9abc62..d944b0e 100644 --- a/DS4Windows/DS4Forms/Options.Designer.cs +++ b/DS4Windows/DS4Forms/Options.Designer.cs @@ -272,7 +272,7 @@ this.BtnLSCurveEditor = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); 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.tBLSCustomOutputCurve = new System.Windows.Forms.TextBox(); this.rsOutCurveComboBox = new System.Windows.Forms.ComboBox(); @@ -494,7 +494,7 @@ this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nUDRSRotation)).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.nUDLSS)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.RoundnessNUpDown)).BeginInit(); @@ -2765,7 +2765,7 @@ this.groupBox1.Controls.Add(this.BtnLSCurveEditor); this.groupBox1.Controls.Add(this.label3); 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.tBLSCustomOutputCurve); this.groupBox1.Controls.Add(this.rsOutCurveComboBox); @@ -2857,22 +2857,22 @@ this.rsSquStickCk.Name = "rsSquStickCk"; this.rsSquStickCk.UseVisualStyleBackColor = true; // - // numericUpDown1 + // RoundnessRsNUD // - this.numericUpDown1.DecimalPlaces = 1; - this.numericUpDown1.Increment = new decimal(new int[] { + this.RoundnessRsNUD.DecimalPlaces = 1; + this.RoundnessRsNUD.Increment = new decimal(new int[] { 1, 0, 0, 65536}); - resources.ApplyResources(this.numericUpDown1, "numericUpDown1"); - this.numericUpDown1.Maximum = new decimal(new int[] { + resources.ApplyResources(this.RoundnessRsNUD, "RoundnessRsNUD"); + this.RoundnessRsNUD.Maximum = new decimal(new int[] { 5, 0, 0, 0}); - this.numericUpDown1.Name = "numericUpDown1"; - this.numericUpDown1.Value = new decimal(new int[] { + this.RoundnessRsNUD.Name = "RoundnessRsNUD"; + this.RoundnessRsNUD.Value = new decimal(new int[] { 50, 0, 0, @@ -4684,7 +4684,7 @@ this.groupBox1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.nUDRSRotation)).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.nUDLSS)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.RoundnessNUpDown)).EndInit(); @@ -5081,7 +5081,7 @@ private System.Windows.Forms.Label lbRSCurvePercent; private System.Windows.Forms.NumericUpDown nUDRSCurve; 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 nUDRSMaxZone; private System.Windows.Forms.NumericUpDown nUDRS; diff --git a/DS4Windows/DS4Forms/Options.cs b/DS4Windows/DS4Forms/Options.cs index e76893a..01afcdd 100644 --- a/DS4Windows/DS4Forms/Options.cs +++ b/DS4Windows/DS4Forms/Options.cs @@ -164,7 +164,7 @@ namespace DS4Windows.Forms SetupEvents(); 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) @@ -350,6 +350,7 @@ namespace DS4Windows.Forms tBRSCustomOutputCurve.Leave += TBRSCustomOutputCurve_Leave; btnRSCurveEditor.Click += BtnCurveEditor_Click; rsSquStickCk.Click += rsSquStickCk_Click; + RoundnessRsNUD.ValueChanged += RoundnessRsNUD_ValueChanged; nUDRSCurve.ValueChanged += nUDRSCurve_ValueChanged; nUDRSRotation.ValueChanged += nUDRSRotation_ValueChanged; nUDL2.ValueChanged += numUDL2_ValueChanged; @@ -456,6 +457,14 @@ namespace DS4Windows.Forms 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) { if (loading == false) @@ -899,7 +908,8 @@ namespace DS4Windows.Forms lsSquStickCk.Checked = SquStickInfo[device].lsMode; 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]; olddinputcheck = cBDinput.Checked; @@ -1119,6 +1129,7 @@ namespace DS4Windows.Forms lsSquStickCk.Checked = false; rsSquStickCk.Checked = false; RoundnessNUpDown.Value = 5.0m; + RoundnessRsNUD.Value = 5.0m; cBLaunchProgram.Checked = false; pBProgram.Image = null; @@ -1657,7 +1668,8 @@ namespace DS4Windows.Forms SZAntiDeadzone[device] = (double)nUDSixaxisZAntiDead.Value; SquStickInfo[device].lsMode = lsSquStickCk.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; DinputOnly[device] = cBDinput.Checked; StartTouchpadOff[device] = cbStartTouchpadOff.Checked; @@ -3601,7 +3613,7 @@ namespace DS4Windows.Forms private void RoundnessNUpDown_ValueChanged(object sender, EventArgs e) { if (loading == false) { - SquStickInfo[device].roundness = (int)RoundnessNUpDown.Value; + SquStickInfo[device].lsRoundness = (double)RoundnessNUpDown.Value; } } diff --git a/DS4Windows/DS4Forms/Options.resx b/DS4Windows/DS4Forms/Options.resx index 6014211..45653d2 100644 --- a/DS4Windows/DS4Forms/Options.resx +++ b/DS4Windows/DS4Forms/Options.resx @@ -5580,25 +5580,25 @@ 8 - + 285, 190 - + 44, 20 - + 221 - - numericUpDown1 + + RoundnessRsNUD - + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + groupBox1 - + 9