mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-26 11:04:21 +01:00
Implemented square stick roundness selectability
This commit is contained in:
parent
5d9546f5bd
commit
4b901b3489
@ -102,10 +102,9 @@ namespace DS4Windows
|
||||
squared = new DS4Vector2(0.0, 0.0);
|
||||
}
|
||||
|
||||
public void CircleToSquare()
|
||||
public void CircleToSquare(double roundness)
|
||||
{
|
||||
const double PiOverFour = Math.PI / 4.0;
|
||||
const double roundness = 5.0;
|
||||
|
||||
// Determine the theta angle
|
||||
double angle = Math.Atan2(current.y, -current.x);
|
||||
@ -876,9 +875,10 @@ namespace DS4Windows
|
||||
double capY = dState.LY >= 128 ? 127.0 : 128.0;
|
||||
double tempX = (dState.LX - 128.0) / capX;
|
||||
double tempY = (dState.LY - 128.0) / capY;
|
||||
double roundness = getSquareStickRoundness(device);
|
||||
DS4SquareStick sqstick = outSqrStk[device];
|
||||
sqstick.current.x = tempX; sqstick.current.y = tempY;
|
||||
sqstick.CircleToSquare();
|
||||
sqstick.CircleToSquare(roundness);
|
||||
//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;
|
||||
@ -974,9 +974,10 @@ namespace DS4Windows
|
||||
double capY = dState.RY >= 128 ? 127.0 : 128.0;
|
||||
double tempX = (dState.RX - 128.0) / capX;
|
||||
double tempY = (dState.RY - 128.0) / capY;
|
||||
double roundness = getSquareStickRoundness(device);
|
||||
DS4SquareStick sqstick = outSqrStk[device];
|
||||
sqstick.current.x = tempX; sqstick.current.y = tempY;
|
||||
sqstick.CircleToSquare();
|
||||
sqstick.CircleToSquare(roundness);
|
||||
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
|
||||
|
@ -1184,6 +1184,12 @@ namespace DS4Windows
|
||||
return m_Config.sqRSStickMode[device];
|
||||
}
|
||||
|
||||
public static double[] squareStickRoundness => m_Config.sqStickRoundness;
|
||||
public static double getSquareStickRoundness(int device)
|
||||
{
|
||||
return m_Config.sqStickRoundness[device];
|
||||
}
|
||||
|
||||
public static int[] lsOutCurveMode => m_Config.lsOutCurveMode;
|
||||
public static int getLsOutCurveMode(int index)
|
||||
{
|
||||
@ -1630,6 +1636,7 @@ namespace DS4Windows
|
||||
false, false };
|
||||
public bool[] sqLSStickMode = new bool[5] { false, false, false, false, false };
|
||||
public bool[] sqRSStickMode = new bool[5] { false, false, false, false, false };
|
||||
public double[] sqStickRoundness = new double[5] { 5.0, 5.0, 5.0, 5.0, 5.0 };
|
||||
public int[] lsOutCurveMode = new int[5] { 0, 0, 0, 0, 0 };
|
||||
public int[] rsOutCurveMode = new int[5] { 0, 0, 0, 0, 0 };
|
||||
public int[] l2OutCurveMode = new int[5] { 0, 0, 0, 0, 0 };
|
||||
@ -2017,6 +2024,8 @@ namespace DS4Windows
|
||||
XmlNode xmlLsSquareStickMode = m_Xdoc.CreateNode(XmlNodeType.Element, "LSSquareStick", null); xmlLsSquareStickMode.InnerText = sqLSStickMode[device].ToString(); Node.AppendChild(xmlLsSquareStickMode);
|
||||
XmlNode xmlRsSquareStickMode = m_Xdoc.CreateNode(XmlNodeType.Element, "RSSquareStick", null); xmlRsSquareStickMode.InnerText = sqRSStickMode[device].ToString(); Node.AppendChild(xmlRsSquareStickMode);
|
||||
|
||||
XmlNode xmlSquareStickRoundness = m_Xdoc.CreateNode(XmlNodeType.Element, "SquareStickRoundness", null); xmlSquareStickRoundness.InnerText = sqStickRoundness[device].ToString(); Node.AppendChild(xmlSquareStickRoundness);
|
||||
|
||||
XmlNode xmlL2OutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "L2OutputCurveMode", null); xmlL2OutputCurveMode.InnerText = axisOutputCurveString(l2OutCurveMode[device]); Node.AppendChild(xmlL2OutputCurveMode);
|
||||
XmlNode xmlR2OutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "R2OutputCurveMode", null); xmlR2OutputCurveMode.InnerText = axisOutputCurveString(r2OutCurveMode[device]); Node.AppendChild(xmlR2OutputCurveMode);
|
||||
|
||||
@ -2921,6 +2930,9 @@ namespace DS4Windows
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSSquareStick"); bool.TryParse(Item.InnerText, out sqLSStickMode[device]); }
|
||||
catch { sqLSStickMode[device] = false; missingSetting = true; }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SquareStickRoundness"); double.TryParse(Item.InnerText, out sqStickRoundness[device]); }
|
||||
catch { sqStickRoundness[device] = 5.0; missingSetting = true; }
|
||||
|
||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSSquareStick"); bool.TryParse(Item.InnerText, out sqRSStickMode[device]); }
|
||||
catch { sqRSStickMode[device] = false; missingSetting = true; }
|
||||
|
||||
@ -4220,6 +4232,7 @@ namespace DS4Windows
|
||||
gyroMouseHorizontalAxis[device] = 0;
|
||||
sqLSStickMode[device] = false;
|
||||
sqRSStickMode[device] = false;
|
||||
sqStickRoundness[device] = 5;
|
||||
lsOutCurveMode[device] = 0;
|
||||
rsOutCurveMode[device] = 0;
|
||||
l2OutCurveMode[device] = 0;
|
||||
|
31
DS4Windows/DS4Forms/Options.Designer.cs
generated
31
DS4Windows/DS4Forms/Options.Designer.cs
generated
@ -293,6 +293,8 @@
|
||||
this.nUDLSMaxZone = new System.Windows.Forms.NumericUpDown();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.squStickTabPage = new System.Windows.Forms.TabPage();
|
||||
this.RoundnessNUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.label28 = new System.Windows.Forms.Label();
|
||||
this.rsSquStickCk = new System.Windows.Forms.CheckBox();
|
||||
this.lsSquStickCk = new System.Windows.Forms.CheckBox();
|
||||
this.tPOutCurve = new System.Windows.Forms.TabPage();
|
||||
@ -473,6 +475,7 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDRSMaxZone)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDLSMaxZone)).BeginInit();
|
||||
this.squStickTabPage.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.RoundnessNUpDown)).BeginInit();
|
||||
this.tPOutCurve.SuspendLayout();
|
||||
this.tPCurve.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDLSCurve)).BeginInit();
|
||||
@ -3206,12 +3209,36 @@
|
||||
//
|
||||
// squStickTabPage
|
||||
//
|
||||
this.squStickTabPage.Controls.Add(this.RoundnessNUpDown);
|
||||
this.squStickTabPage.Controls.Add(this.label28);
|
||||
this.squStickTabPage.Controls.Add(this.rsSquStickCk);
|
||||
this.squStickTabPage.Controls.Add(this.lsSquStickCk);
|
||||
resources.ApplyResources(this.squStickTabPage, "squStickTabPage");
|
||||
this.squStickTabPage.Name = "squStickTabPage";
|
||||
this.squStickTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// RoundnessNUpDown
|
||||
//
|
||||
this.RoundnessNUpDown.DecimalPlaces = 1;
|
||||
this.RoundnessNUpDown.Increment = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
65536});
|
||||
resources.ApplyResources(this.RoundnessNUpDown, "RoundnessNUpDown");
|
||||
this.RoundnessNUpDown.Maximum = new decimal(new int[] {
|
||||
5,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.RoundnessNUpDown.Name = "RoundnessNUpDown";
|
||||
this.RoundnessNUpDown.ValueChanged += new System.EventHandler(this.RoundnessNUpDown_ValueChanged);
|
||||
//
|
||||
// label28
|
||||
//
|
||||
resources.ApplyResources(this.label28, "label28");
|
||||
this.label28.Name = "label28";
|
||||
//
|
||||
// rsSquStickCk
|
||||
//
|
||||
resources.ApplyResources(this.rsSquStickCk, "rsSquStickCk");
|
||||
@ -4374,6 +4401,8 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDRSMaxZone)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nUDLSMaxZone)).EndInit();
|
||||
this.squStickTabPage.ResumeLayout(false);
|
||||
this.squStickTabPage.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.RoundnessNUpDown)).EndInit();
|
||||
this.tPOutCurve.ResumeLayout(false);
|
||||
this.tPOutCurve.PerformLayout();
|
||||
this.tPCurve.ResumeLayout(false);
|
||||
@ -4782,5 +4811,7 @@
|
||||
private System.Windows.Forms.CheckBox lsSquStickCk;
|
||||
private System.Windows.Forms.ComboBox OutContTypeCb;
|
||||
private System.Windows.Forms.Label outcontLb;
|
||||
private System.Windows.Forms.Label label28;
|
||||
private System.Windows.Forms.NumericUpDown RoundnessNUpDown;
|
||||
}
|
||||
}
|
@ -688,6 +688,7 @@ namespace DS4Windows.Forms
|
||||
|
||||
lsSquStickCk.Checked = squareStickLS[device];
|
||||
rsSquStickCk.Checked = squareStickRS[device];
|
||||
RoundnessNUpDown.Value = (decimal)squareStickRoundness[device];
|
||||
|
||||
cBDinput.Checked = DinputOnly[device];
|
||||
olddinputcheck = cBDinput.Checked;
|
||||
@ -1330,6 +1331,7 @@ namespace DS4Windows.Forms
|
||||
SZAntiDeadzone[device] = (double)nUDSixaxisZAntiDead.Value;
|
||||
squareStickLS[device] = lsSquStickCk.Checked;
|
||||
squareStickRS[device] = rsSquStickCk.Checked;
|
||||
squareStickRoundness[device] = (double)RoundnessNUpDown.Value;
|
||||
MouseAccel[device] = cBMouseAccel.Checked;
|
||||
DinputOnly[device] = cBDinput.Checked;
|
||||
StartTouchpadOff[device] = cbStartTouchpadOff.Checked;
|
||||
@ -3154,6 +3156,13 @@ namespace DS4Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void RoundnessNUpDown_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (loading == false) {
|
||||
squareStickRoundness[device] = (int)RoundnessNUpDown.Value;
|
||||
}
|
||||
}
|
||||
|
||||
private void OutContTypeCb_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (loading == false)
|
||||
|
@ -7165,14 +7165,62 @@ with profile</value>
|
||||
<data name=">>maxZoneTabPage.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="RoundnessNUpDown.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>216, 17</value>
|
||||
</data>
|
||||
<data name="RoundnessNUpDown.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>36, 20</value>
|
||||
</data>
|
||||
<data name="RoundnessNUpDown.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name=">>RoundnessNUpDown.Name" xml:space="preserve">
|
||||
<value>RoundnessNUpDown</value>
|
||||
</data>
|
||||
<data name=">>RoundnessNUpDown.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>RoundnessNUpDown.Parent" xml:space="preserve">
|
||||
<value>squStickTabPage</value>
|
||||
</data>
|
||||
<data name=">>RoundnessNUpDown.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="label28.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="label28.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>141, 19</value>
|
||||
</data>
|
||||
<data name="label28.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>61, 13</value>
|
||||
</data>
|
||||
<data name="label28.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="label28.Text" xml:space="preserve">
|
||||
<value>Roundness</value>
|
||||
</data>
|
||||
<data name=">>label28.Name" xml:space="preserve">
|
||||
<value>label28</value>
|
||||
</data>
|
||||
<data name=">>label28.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label28.Parent" xml:space="preserve">
|
||||
<value>squStickTabPage</value>
|
||||
</data>
|
||||
<data name=">>label28.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="rsSquStickCk.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>130, 13</value>
|
||||
<value>70, 14</value>
|
||||
</data>
|
||||
<data name="rsSquStickCk.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms">
|
||||
<value>No</value>
|
||||
</data>
|
||||
<data name="rsSquStickCk.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>104, 24</value>
|
||||
<value>43, 24</value>
|
||||
</data>
|
||||
<data name="rsSquStickCk.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
@ -7190,16 +7238,16 @@ with profile</value>
|
||||
<value>squStickTabPage</value>
|
||||
</data>
|
||||
<data name=">>rsSquStickCk.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="lsSquStickCk.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>13, 13</value>
|
||||
<value>10, 14</value>
|
||||
</data>
|
||||
<data name="lsSquStickCk.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms">
|
||||
<value>No</value>
|
||||
</data>
|
||||
<data name="lsSquStickCk.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>91, 24</value>
|
||||
<value>48, 24</value>
|
||||
</data>
|
||||
<data name="lsSquStickCk.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
@ -7217,7 +7265,7 @@ with profile</value>
|
||||
<value>squStickTabPage</value>
|
||||
</data>
|
||||
<data name=">>lsSquStickCk.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="squStickTabPage.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>4, 22</value>
|
||||
|
@ -28,6 +28,8 @@
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
Loading…
Reference in New Issue
Block a user