From d74820dbf544ee32de074730a1357ade5247318b Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Fri, 30 Jun 2017 01:42:19 -0700 Subject: [PATCH] Add rotation routine for LS and RS --- DS4Windows/DS4Control/Mapping.cs | 9 + DS4Windows/DS4Control/ScpUtil.cs | 38 +- DS4Windows/DS4Forms/Options.Designer.cs | 128 +- DS4Windows/DS4Forms/Options.cs | 40 + DS4Windows/DS4Forms/Options.resx | 1526 +++++++++++++---------- DS4Windows/DS4Library/DS4State.cs | 20 + 6 files changed, 1106 insertions(+), 655 deletions(-) diff --git a/DS4Windows/DS4Control/Mapping.cs b/DS4Windows/DS4Control/Mapping.cs index 3e568a3..5a978c5 100644 --- a/DS4Windows/DS4Control/Mapping.cs +++ b/DS4Windows/DS4Control/Mapping.cs @@ -409,8 +409,17 @@ namespace DS4Windows return (value < min) ? min : (value > max) ? max : value; } + private static double[] tempDoubleArray = { 0.0, 0.0, 0.0, 0.0 }; public static DS4State SetCurveAndDeadzone(int device, DS4State cState) { + double rotation = tempDoubleArray[device] = getLSRotation(device); + if (rotation != 0.0) + cState.rotateLSCoordinates(rotation); + + double rotationRS = tempDoubleArray[device] = getRSRotation(device); + if (rotationRS != 0.0) + cState.rotateRSCoordinates(rotationRS); + DS4State dState = new DS4State(cState); int x; int y; diff --git a/DS4Windows/DS4Control/ScpUtil.cs b/DS4Windows/DS4Control/ScpUtil.cs index 84b1764..62a7ed1 100644 --- a/DS4Windows/DS4Control/ScpUtil.cs +++ b/DS4Windows/DS4Control/ScpUtil.cs @@ -756,6 +756,18 @@ namespace DS4Windows return m_Config.rsCurve[index]; } + public static double[] LSRotation => m_Config.LSRotation; + public static double getLSRotation(int index) + { + return m_Config.LSRotation[index]; + } + + public static double[] RSRotation => m_Config.RSRotation; + public static double getRSRotation(int index) + { + return m_Config.RSRotation[index]; + } + public static double[] L2Sens => m_Config.l2Sens; public static double getL2Sens(int index) { @@ -1144,6 +1156,7 @@ namespace DS4Windows public int[] LSMaxzone = { 100, 100, 100, 100, 100 }, RSMaxzone = { 100, 100, 100, 100, 100 }; public int[] l2AntiDeadzone = { 0, 0, 0, 0, 0 }, r2AntiDeadzone = { 0, 0, 0, 0, 0 }; public int[] l2Maxzone = { 100, 100, 100, 100, 100 }, r2Maxzone = { 100, 100, 100, 100, 100 }; + public double[] LSRotation = { 0.0, 0.0, 0.0, 0.0, 0.0 }, RSRotation = { 0.0, 0.0, 0.0, 0.0, 0.0 }; public double[] SXDeadzone = { 0.25, 0.25, 0.25, 0.25, 0.25 }, SZDeadzone = { 0.25, 0.25, 0.25, 0.25, 0.25 }; public double[] l2Sens = { 1, 1, 1, 1, 1 }, r2Sens = { 1, 1, 1, 1, 1 }; public double[] LSSens = { 1, 1, 1, 1, 1 }, RSSens = { 1, 1, 1, 1, 1 }; @@ -1444,6 +1457,9 @@ namespace DS4Windows XmlNode xmlRSAD = m_Xdoc.CreateNode(XmlNodeType.Element, "RSAntiDeadZone", null); xmlRSAD.InnerText = RSAntiDeadzone[device].ToString(); Node.AppendChild(xmlRSAD); XmlNode xmlLSMaxZone = m_Xdoc.CreateNode(XmlNodeType.Element, "LSMaxZone", null); xmlLSMaxZone.InnerText = LSMaxzone[device].ToString(); Node.AppendChild(xmlLSMaxZone); XmlNode xmlRSMaxZone = m_Xdoc.CreateNode(XmlNodeType.Element, "RSMaxZone", null); xmlRSMaxZone.InnerText = RSMaxzone[device].ToString(); Node.AppendChild(xmlRSMaxZone); + XmlNode xmlLSRotation = m_Xdoc.CreateNode(XmlNodeType.Element, "LSRotation", null); xmlLSRotation.InnerText = Convert.ToInt32(LSRotation[device] * 180.0 / Math.PI).ToString(); Node.AppendChild(xmlLSRotation); + XmlNode xmlRSRotation = m_Xdoc.CreateNode(XmlNodeType.Element, "RSRotation", null); xmlRSRotation.InnerText = Convert.ToInt32(RSRotation[device] * 180.0 / Math.PI).ToString(); Node.AppendChild(xmlRSRotation); + XmlNode xmlSXD = m_Xdoc.CreateNode(XmlNodeType.Element, "SXDeadZone", null); xmlSXD.InnerText = SXDeadzone[device].ToString(); Node.AppendChild(xmlSXD); XmlNode xmlSZD = m_Xdoc.CreateNode(XmlNodeType.Element, "SZDeadZone", null); xmlSZD.InnerText = SZDeadzone[device].ToString(); Node.AppendChild(xmlSZD); @@ -2195,6 +2211,24 @@ namespace DS4Windows } catch { r2Maxzone[device] = 100; missingSetting = true; } + try + { + Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSRotation"); int temp = 0; + int.TryParse(Item.InnerText, out temp); + temp = Math.Min(Math.Max(temp, -180), 180); + LSRotation[device] = temp * Math.PI / 180.0; + } + catch { LSRotation[device] = 0.0; missingSetting = true; } + + try + { + Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSRotation"); int temp = 0; + int.TryParse(Item.InnerText, out temp); + temp = Math.Min(Math.Max(temp, -180), 180); + RSRotation[device] = temp * Math.PI / 180.0; + } + catch { RSRotation[device] = 0.0; missingSetting = true; } + try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/ButtonMouseSensitivity"); int.TryParse(Item.InnerText, out buttonMouseSensitivity[device]); } catch { missingSetting = true; } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/Rainbow"); double.TryParse(Item.InnerText, out rainbow[device]); } @@ -2387,7 +2421,7 @@ namespace DS4Windows try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroSmoothing"); bool.TryParse(Item.InnerText, out gyroSmoothing[device]); } catch { gyroSmoothing[device] = false; missingSetting = true; } - try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/GyroSmoothingWeight"); int temp = 0; int.TryParse(Item.InnerText, out temp); gyroSmoothWeight[device] = Convert.ToDouble(temp * 0.01); } + 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; } try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSCurve"); int.TryParse(Item.InnerText, out lsCurve[device]); } @@ -3399,6 +3433,8 @@ namespace DS4Windows LSMaxzone[device] = RSMaxzone[device] = 100; l2AntiDeadzone[device] = r2AntiDeadzone[device] = 0; l2Maxzone[device] = r2Maxzone[device] = 100; + LSRotation[device] = 0.0; + RSRotation[device] = 0.0; SXDeadzone[device] = SZDeadzone[device] = 0.25; l2Sens[device] = r2Sens[device] = 1; LSSens[device] = RSSens[device] = 1; diff --git a/DS4Windows/DS4Forms/Options.Designer.cs b/DS4Windows/DS4Forms/Options.Designer.cs index 92cbce2..9403069 100644 --- a/DS4Windows/DS4Forms/Options.Designer.cs +++ b/DS4Windows/DS4Forms/Options.Designer.cs @@ -287,6 +287,10 @@ this.rBSAControls = new System.Windows.Forms.RadioButton(); this.rBSAMouse = new System.Windows.Forms.RadioButton(); this.pnlSAMouse = new System.Windows.Forms.Panel(); + this.lbGyroSmooth = new System.Windows.Forms.Label(); + this.cBGyroSmooth = new System.Windows.Forms.CheckBox(); + this.lbSmoothWeight = new System.Windows.Forms.Label(); + this.nUDGyroSmoothWeight = new System.Windows.Forms.NumericUpDown(); this.label12 = new System.Windows.Forms.Label(); this.nUDGyroMouseVertScale = new System.Windows.Forms.NumericUpDown(); this.label11 = new System.Windows.Forms.Label(); @@ -332,11 +336,12 @@ this.shareToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.alwaysOnToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.nUDGyroSmoothWeight = new System.Windows.Forms.NumericUpDown(); - this.lbSmoothWeight = new System.Windows.Forms.Label(); - this.cBGyroSmooth = new System.Windows.Forms.CheckBox(); this.advColorDialog = new DS4Windows.AdvancedColorDialog(); - this.lbGyroSmooth = new System.Windows.Forms.Label(); + this.tpRotation = new System.Windows.Forms.TabPage(); + this.label13 = new System.Windows.Forms.Label(); + this.nUDLSRotation = new System.Windows.Forms.NumericUpDown(); + this.label14 = new System.Windows.Forms.Label(); + this.nUDRSRotation = new System.Windows.Forms.NumericUpDown(); ((System.ComponentModel.ISupportInitialize)(this.nUDRainbow)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tBBlueBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tBGreenBar)).BeginInit(); @@ -410,6 +415,7 @@ this.fLPSettings.SuspendLayout(); this.gBGyro.SuspendLayout(); this.pnlSAMouse.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nUDGyroSmoothWeight)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDGyroMouseVertScale)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDGyroSensitivity)).BeginInit(); this.gBSensitivity.SuspendLayout(); @@ -420,7 +426,9 @@ ((System.ComponentModel.ISupportInitialize)(this.nUDSXS)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDSZS)).BeginInit(); this.cMGyroTriggers.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.nUDGyroSmoothWeight)).BeginInit(); + this.tpRotation.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nUDLSRotation)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nUDRSRotation)).BeginInit(); this.SuspendLayout(); // // lowColorChooserButton @@ -2633,6 +2641,7 @@ this.tCSens.Controls.Add(this.maxZoneTabPage); this.tCSens.Controls.Add(this.tPCurve); this.tCSens.Controls.Add(this.tPOutCurve); + this.tCSens.Controls.Add(this.tpRotation); resources.ApplyResources(this.tCSens, "tCSens"); this.tCSens.Name = "tCSens"; this.tCSens.SelectedIndex = 0; @@ -3040,6 +3049,40 @@ resources.ApplyResources(this.pnlSAMouse, "pnlSAMouse"); this.pnlSAMouse.Name = "pnlSAMouse"; // + // lbGyroSmooth + // + resources.ApplyResources(this.lbGyroSmooth, "lbGyroSmooth"); + this.lbGyroSmooth.Name = "lbGyroSmooth"; + // + // cBGyroSmooth + // + resources.ApplyResources(this.cBGyroSmooth, "cBGyroSmooth"); + this.cBGyroSmooth.Name = "cBGyroSmooth"; + this.cBGyroSmooth.UseVisualStyleBackColor = true; + this.cBGyroSmooth.CheckedChanged += new System.EventHandler(this.cBGyroSmooth_CheckedChanged); + // + // lbSmoothWeight + // + resources.ApplyResources(this.lbSmoothWeight, "lbSmoothWeight"); + this.lbSmoothWeight.Name = "lbSmoothWeight"; + // + // nUDGyroSmoothWeight + // + this.nUDGyroSmoothWeight.DecimalPlaces = 3; + resources.ApplyResources(this.nUDGyroSmoothWeight, "nUDGyroSmoothWeight"); + this.nUDGyroSmoothWeight.Maximum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.nUDGyroSmoothWeight.Name = "nUDGyroSmoothWeight"; + this.nUDGyroSmoothWeight.Value = new decimal(new int[] { + 5, + 0, + 0, + 65536}); + this.nUDGyroSmoothWeight.ValueChanged += new System.EventHandler(this.nUDGyroSmoothWeight_ValueChanged); + // // label12 // resources.ApplyResources(this.label12, "label12"); @@ -3532,39 +3575,57 @@ resources.ApplyResources(this.alwaysOnToolStripMenuItem, "alwaysOnToolStripMenuItem"); this.alwaysOnToolStripMenuItem.CheckedChanged += new System.EventHandler(this.SATrigger_CheckedChanged); // - // nUDGyroSmoothWeight + // tpRotation // - this.nUDGyroSmoothWeight.DecimalPlaces = 3; - resources.ApplyResources(this.nUDGyroSmoothWeight, "nUDGyroSmoothWeight"); - this.nUDGyroSmoothWeight.Maximum = new decimal(new int[] { - 1, + this.tpRotation.Controls.Add(this.nUDRSRotation); + this.tpRotation.Controls.Add(this.label14); + this.tpRotation.Controls.Add(this.nUDLSRotation); + this.tpRotation.Controls.Add(this.label13); + resources.ApplyResources(this.tpRotation, "tpRotation"); + this.tpRotation.Name = "tpRotation"; + this.tpRotation.UseVisualStyleBackColor = true; + // + // label13 + // + resources.ApplyResources(this.label13, "label13"); + this.label13.Name = "label13"; + // + // nUDLSRotation + // + resources.ApplyResources(this.nUDLSRotation, "nUDLSRotation"); + this.nUDLSRotation.Maximum = new decimal(new int[] { + 180, 0, 0, 0}); - this.nUDGyroSmoothWeight.Name = "nUDGyroSmoothWeight"; - this.nUDGyroSmoothWeight.Value = new decimal(new int[] { - 5, + this.nUDLSRotation.Minimum = new decimal(new int[] { + 180, 0, 0, - 65536}); - this.nUDGyroSmoothWeight.ValueChanged += new System.EventHandler(this.nUDGyroSmoothWeight_ValueChanged); + -2147483648}); + this.nUDLSRotation.Name = "nUDLSRotation"; + this.nUDLSRotation.ValueChanged += new System.EventHandler(this.nUDLSRotation_ValueChanged); // - // lbSmoothWeight + // label14 // - resources.ApplyResources(this.lbSmoothWeight, "lbSmoothWeight"); - this.lbSmoothWeight.Name = "lbSmoothWeight"; + resources.ApplyResources(this.label14, "label14"); + this.label14.Name = "label14"; // - // cBGyroSmooth + // nUDRSRotation // - resources.ApplyResources(this.cBGyroSmooth, "cBGyroSmooth"); - this.cBGyroSmooth.Name = "cBGyroSmooth"; - this.cBGyroSmooth.UseVisualStyleBackColor = true; - this.cBGyroSmooth.CheckedChanged += new System.EventHandler(this.cBGyroSmooth_CheckedChanged); - // - // lbGyroSmooth - // - resources.ApplyResources(this.lbGyroSmooth, "lbGyroSmooth"); - this.lbGyroSmooth.Name = "lbGyroSmooth"; + resources.ApplyResources(this.nUDRSRotation, "nUDRSRotation"); + this.nUDRSRotation.Maximum = new decimal(new int[] { + 180, + 0, + 0, + 0}); + this.nUDRSRotation.Minimum = new decimal(new int[] { + 180, + 0, + 0, + -2147483648}); + this.nUDRSRotation.Name = "nUDRSRotation"; + this.nUDRSRotation.ValueChanged += new System.EventHandler(this.nUDRSRotation_ValueChanged); // // Options // @@ -3667,6 +3728,7 @@ this.gBGyro.PerformLayout(); this.pnlSAMouse.ResumeLayout(false); this.pnlSAMouse.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nUDGyroSmoothWeight)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDGyroMouseVertScale)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDGyroSensitivity)).EndInit(); this.gBSensitivity.ResumeLayout(false); @@ -3678,7 +3740,10 @@ ((System.ComponentModel.ISupportInitialize)(this.nUDSXS)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nUDSZS)).EndInit(); this.cMGyroTriggers.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.nUDGyroSmoothWeight)).EndInit(); + this.tpRotation.ResumeLayout(false); + this.tpRotation.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nUDLSRotation)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nUDRSRotation)).EndInit(); this.ResumeLayout(false); } @@ -3994,5 +4059,10 @@ private System.Windows.Forms.NumericUpDown nUDGyroSmoothWeight; private System.Windows.Forms.CheckBox cBGyroSmooth; private System.Windows.Forms.Label lbGyroSmooth; + private System.Windows.Forms.TabPage tpRotation; + private System.Windows.Forms.NumericUpDown nUDRSRotation; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.NumericUpDown nUDLSRotation; + private System.Windows.Forms.Label label13; } } \ No newline at end of file diff --git a/DS4Windows/DS4Forms/Options.cs b/DS4Windows/DS4Forms/Options.cs index 3551b60..c770d06 100644 --- a/DS4Windows/DS4Forms/Options.cs +++ b/DS4Windows/DS4Forms/Options.cs @@ -464,6 +464,24 @@ namespace DS4Windows nUDRSMaxZone.Value = 1; } + try + { + nUDLSRotation.Value = (decimal)(LSRotation[device] * 180.0 / Math.PI); + } + catch + { + nUDLSRotation.Value = 0.0m; + } + + try + { + nUDRSRotation.Value = (decimal)(RSRotation[device] * 180.0 / Math.PI); + } + catch + { + nUDRSRotation.Value = 0.0m; + } + try { nUDSX.Value = (decimal)SXDeadzone[device]; @@ -645,6 +663,8 @@ namespace DS4Windows nUDRSAntiDead.Value = 0; nUDLSMaxZone.Value = 1; nUDRSMaxZone.Value = 1; + nUDLSRotation.Value = 0; + nUDRSRotation.Value = 0; nUDSX.Value = .25m; nUDSZ.Value = .25m; @@ -1298,6 +1318,10 @@ namespace DS4Windows LSDeadzone[device] = (int)Math.Round((nUDLS.Value * 127), 0); LSAntiDeadzone[device] = (int)(nUDLSAntiDead.Value * 100); RSAntiDeadzone[device] = (int)(nUDRSAntiDead.Value * 100); + LSMaxzone[device] = (int)(nUDLSMaxZone.Value * 100); + RSMaxzone[device] = (int)(nUDRSMaxZone.Value * 100); + LSRotation[device] = (double)nUDLSRotation.Value * Math.PI / 180.0; + RSRotation[device] = (double)nUDRSRotation.Value * Math.PI / 180.0; ButtonMouseSensitivity[device] = (int)numUDMouseSens.Value; FlashAt[device] = (int)nUDflashLED.Value; SXDeadzone[device] = (double)nUDSX.Value; @@ -2853,6 +2877,22 @@ namespace DS4Windows } } + private void nUDLSRotation_ValueChanged(object sender, EventArgs e) + { + if (!loading) + { + LSRotation[device] = (double)nUDLSRotation.Value * Math.PI / 180.0; + } + } + + private void nUDRSRotation_ValueChanged(object sender, EventArgs e) + { + if (!loading) + { + RSRotation[device] = (double)nUDRSRotation.Value * Math.PI / 180.0; + } + } + private void Options_Resize(object sender, EventArgs e) { fLPSettings.AutoScroll = false; diff --git a/DS4Windows/DS4Forms/Options.resx b/DS4Windows/DS4Forms/Options.resx index 9d99e26..8cddb5c 100644 --- a/DS4Windows/DS4Forms/Options.resx +++ b/DS4Windows/DS4Forms/Options.resx @@ -7651,87 +7651,6 @@ with profile 1 - - tPDeadzone - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tCSens - - - 0 - - - antiDeadzoneTabPage - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tCSens - - - 1 - - - maxZoneTabPage - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tCSens - - - 2 - - - tPCurve - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tCSens - - - 3 - - - tPOutCurve - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tCSens - - - 4 - - - 281, 55 - - - 272, 78 - - - 234 - - - tCSens - - - System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - fLPSettings - - - 3 - 4, 22 @@ -7882,6 +7801,444 @@ with profile 1 + + nUDR2Maxzone + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + maxZoneTabPage + + + 0 + + + nUDL2Maxzone + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + maxZoneTabPage + + + 1 + + + label8 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + maxZoneTabPage + + + 2 + + + label7 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + maxZoneTabPage + + + 3 + + + nUDRSMaxZone + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + maxZoneTabPage + + + 4 + + + label6 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + maxZoneTabPage + + + 5 + + + nUDLSMaxZone + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + maxZoneTabPage + + + 6 + + + label5 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + maxZoneTabPage + + + 7 + + + 4, 22 + + + 3, 3, 3, 3 + + + 264, 52 + + + 3 + + + Max Zone + + + maxZoneTabPage + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tCSens + + + 2 + + + nUDLSCurve + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tPCurve + + + 0 + + + nUDRSCurve + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tPCurve + + + 1 + + + lbRSCurve + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tPCurve + + + 2 + + + lbRSCurvePercent + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tPCurve + + + 3 + + + lbLSCurvePercent + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tPCurve + + + 4 + + + lbLSCurve + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tPCurve + + + 5 + + + 4, 22 + + + 3, 3, 3, 3 + + + 264, 52 + + + 1 + + + Curve (Input) + + + tPCurve + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tCSens + + + 3 + + + rsOutCurveComboBox + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tPOutCurve + + + 0 + + + lsOutCurveComboBox + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tPOutCurve + + + 1 + + + label10 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tPOutCurve + + + 2 + + + label9 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tPOutCurve + + + 3 + + + 4, 22 + + + 264, 52 + + + 4 + + + Output Curve + + + tPOutCurve + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tCSens + + + 4 + + + 160, 21 + + + 74, 20 + + + 219 + + + nUDRSRotation + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpRotation + + + 0 + + + True + + + 125, 23 + + + 25, 13 + + + 218 + + + RS: + + + label14 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpRotation + + + 1 + + + 42, 20 + + + 68, 20 + + + 217 + + + nUDLSRotation + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpRotation + + + 2 + + + True + + + 4, 22 + + + 23, 13 + + + 216 + + + LS: + + + label13 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpRotation + + + 3 + + + 4, 22 + + + 3, 3, 3, 3 + + + 264, 52 + + + 5 + + + Rotation + + + tpRotation + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tCSens + + + 5 + + + 281, 55 + + + 272, 78 + + + 234 + + + tCSens + + + System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + fLPSettings + + + 3 + 158, 30 @@ -8086,129 +8443,6 @@ with profile 7 - - nUDR2Maxzone - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - maxZoneTabPage - - - 0 - - - nUDL2Maxzone - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - maxZoneTabPage - - - 1 - - - label8 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - maxZoneTabPage - - - 2 - - - label7 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - maxZoneTabPage - - - 3 - - - nUDRSMaxZone - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - maxZoneTabPage - - - 4 - - - label6 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - maxZoneTabPage - - - 5 - - - nUDLSMaxZone - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - maxZoneTabPage - - - 6 - - - label5 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - maxZoneTabPage - - - 7 - - - 4, 22 - - - 3, 3, 3, 3 - - - 264, 52 - - - 3 - - - Max Zone - - - maxZoneTabPage - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tCSens - - - 2 - 161, 29 @@ -8413,105 +8647,6 @@ with profile 7 - - nUDLSCurve - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tPCurve - - - 0 - - - nUDRSCurve - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tPCurve - - - 1 - - - lbRSCurve - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tPCurve - - - 2 - - - lbRSCurvePercent - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tPCurve - - - 3 - - - lbLSCurvePercent - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tPCurve - - - 4 - - - lbLSCurve - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tPCurve - - - 5 - - - 4, 22 - - - 3, 3, 3, 3 - - - 264, 52 - - - 1 - - - Curve (Input) - - - tPCurve - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tCSens - - - 3 - 36, 16 @@ -8680,78 +8815,6 @@ with profile 5 - - rsOutCurveComboBox - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tPOutCurve - - - 0 - - - lsOutCurveComboBox - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tPOutCurve - - - 1 - - - label10 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tPOutCurve - - - 2 - - - label9 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tPOutCurve - - - 3 - - - 4, 22 - - - 264, 52 - - - 4 - - - Output Curve - - - tPOutCurve - - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tCSens - - - 4 - Linear @@ -8881,6 +8944,264 @@ with profile True + + rBSAControls + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBGyro + + + 0 + + + rBSAMouse + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBGyro + + + 1 + + + pnlSAMouse + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBGyro + + + 2 + + + 3, 253 + + + 272, 224 + + + 248 + + + Gyro + + + gBGyro + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + fLPSettings + + + 1 + + + lbL2S + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBSensitivity + + + 0 + + + nUDL2S + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBSensitivity + + + 1 + + + nUDLSS + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBSensitivity + + + 2 + + + lbSixaxisXS + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBSensitivity + + + 3 + + + nUDR2S + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBSensitivity + + + 4 + + + lbSixaxisZS + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBSensitivity + + + 5 + + + nUDRSS + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBSensitivity + + + 6 + + + lbR2LS + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBSensitivity + + + 7 + + + nUDSXS + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBSensitivity + + + 8 + + + lbRSS + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBSensitivity + + + 9 + + + lbLSS + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBSensitivity + + + 10 + + + nUDSZS + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBSensitivity + + + 11 + + + 281, 139 + + + 272, 76 + + + 257 + + + Sensitivity + + + gBSensitivity + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + fLPSettings + + + 4 + + + Fill + + + TopDown + + + 446, 0 + + + 2, 2, 2, 2 + + + 564, 481 + + + 254 + + + fLPSettings + + + System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + True @@ -8947,6 +9268,210 @@ with profile 1 + + lbGyroSmooth + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 0 + + + cBGyroSmooth + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 1 + + + lbSmoothWeight + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 2 + + + nUDGyroSmoothWeight + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 3 + + + label12 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 4 + + + nUDGyroMouseVertScale + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 5 + + + label11 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 6 + + + gyroTriggerBehavior + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 7 + + + cBGyroInvertY + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 8 + + + cBGyroInvertX + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 9 + + + lbGyroInvert + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 10 + + + lbGyroTriggers + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 11 + + + btnGyroTriggers + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 12 + + + nUDGyroSensitivity + + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 13 + + + lbGyroSens + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pnlSAMouse + + + 14 + + + 6, 43 + + + 2, 2, 2, 2 + + + 263, 170 + + + 259 + + + pnlSAMouse + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gBGyro + + + 2 + True @@ -9388,252 +9913,6 @@ with profile 14 - - 6, 43 - - - 2, 2, 2, 2 - - - 263, 170 - - - 259 - - - pnlSAMouse - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gBGyro - - - 2 - - - 3, 253 - - - 272, 224 - - - 248 - - - Gyro - - - gBGyro - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - fLPSettings - - - 1 - - - lbL2S - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gBSensitivity - - - 0 - - - nUDL2S - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gBSensitivity - - - 1 - - - nUDLSS - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gBSensitivity - - - 2 - - - lbSixaxisXS - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gBSensitivity - - - 3 - - - nUDR2S - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gBSensitivity - - - 4 - - - lbSixaxisZS - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gBSensitivity - - - 5 - - - nUDRSS - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gBSensitivity - - - 6 - - - lbR2LS - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gBSensitivity - - - 7 - - - nUDSXS - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gBSensitivity - - - 8 - - - lbRSS - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gBSensitivity - - - 9 - - - lbLSS - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gBSensitivity - - - 10 - - - nUDSZS - - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gBSensitivity - - - 11 - - - 281, 139 - - - 272, 76 - - - 257 - - - Sensitivity - - - gBSensitivity - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - fLPSettings - - - 4 - - - Fill - - - TopDown - - - 446, 0 - - - 2, 2, 2, 2 - - - 564, 481 - - - 254 - - - fLPSettings - - - System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 - True @@ -10099,9 +10378,6 @@ with profile 1010, 481 - - NoControl - 4, 4, 4, 4 @@ -10406,7 +10682,7 @@ with profile advColorDialog - DS4Windows.AdvancedColorDialog, DS4Windows, Version=1.4.81.0, Culture=neutral, PublicKeyToken=null + DS4Windows.AdvancedColorDialog, DS4Windows, Version=1.4.82.0, Culture=neutral, PublicKeyToken=null Options diff --git a/DS4Windows/DS4Library/DS4State.cs b/DS4Windows/DS4Library/DS4State.cs index 54e18ba..9971291 100644 --- a/DS4Windows/DS4Library/DS4State.cs +++ b/DS4Windows/DS4Library/DS4State.cs @@ -159,5 +159,25 @@ namespace DS4Windows RXUnit = Math.Abs(Math.Cos(RSAngleRad)); RYUnit = Math.Abs(Math.Sin(LSAngleRad)); } + + public void rotateLSCoordinates(double rotation) + { + double sinAngle = Math.Sin(rotation), cosAngle = Math.Cos(rotation); + double tempLX = LX - 127.5, tempLY = LY - 127.5; + Byte tempx = (Byte)(tempLX * cosAngle - tempLY * sinAngle + 127.5); + Byte tempy = (Byte)(tempLX * sinAngle + tempLY * cosAngle + 127.5); + LX = tempx; + LY = tempy; + } + + public void rotateRSCoordinates(double rotation) + { + double sinAngle = Math.Sin(rotation), cosAngle = Math.Cos(rotation); + double tempRX = RX - 127.5, tempRY = RY - 127.5; + Byte tempx = (Byte)(tempRX * cosAngle - tempRY * sinAngle + 127.5); + Byte tempy = (Byte)(tempRX * sinAngle + tempRY * cosAngle + 127.5); + RX = tempx; + RY = tempy; + } } }