Implemented square stick roundness selectability

This commit is contained in:
Kamilczak020 2019-06-25 23:42:08 +02:00
parent 5d9546f5bd
commit 4b901b3489
6 changed files with 3900 additions and 3796 deletions

View File

@ -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

View File

@ -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;

File diff suppressed because it is too large Load Diff

View File

@ -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,7 +3156,14 @@ namespace DS4Windows.Forms
}
}
private void OutContTypeCb_SelectedIndexChanged(object sender, EventArgs e)
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)
{
@ -3178,7 +3187,7 @@ namespace DS4Windows.Forms
}
}
private void trackFrictionNUD_ValueChanged(object sender, EventArgs e)
private void trackFrictionNUD_ValueChanged(object sender, EventArgs e)
{
if (loading == false)
{

View File

@ -7165,14 +7165,62 @@ with profile</value>
<data name="&gt;&gt;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="&gt;&gt;RoundnessNUpDown.Name" xml:space="preserve">
<value>RoundnessNUpDown</value>
</data>
<data name="&gt;&gt;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="&gt;&gt;RoundnessNUpDown.Parent" xml:space="preserve">
<value>squStickTabPage</value>
</data>
<data name="&gt;&gt;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="&gt;&gt;label28.Name" xml:space="preserve">
<value>label28</value>
</data>
<data name="&gt;&gt;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="&gt;&gt;label28.Parent" xml:space="preserve">
<value>squStickTabPage</value>
</data>
<data name="&gt;&gt;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="&gt;&gt;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="&gt;&gt;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>

View File

@ -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>