Merge branch 'Kamilczak020-jay' into jay

This commit is contained in:
Travis Nickles 2019-06-26 01:36:51 -05:00
commit 4aa110e442
6 changed files with 3923 additions and 3821 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);
@ -870,7 +869,8 @@ namespace DS4Windows
if (r2Sens != 1.0)
dState.R2 = (byte)Global.Clamp(0, r2Sens * dState.R2, 255);
if (getSquareStickLS(device) && (dState.LX != 128 || dState.LY != 128))
SquareStickInfo squStk = GetSquareStickInfo(device);
if (squStk.lsMode && (dState.LX != 128 || dState.LY != 128))
{
double capX = dState.LX >= 128 ? 127.0 : 128.0;
double capY = dState.LY >= 128 ? 127.0 : 128.0;
@ -878,7 +878,7 @@ namespace DS4Windows
double tempY = (dState.LY - 128.0) / capY;
DS4SquareStick sqstick = outSqrStk[device];
sqstick.current.x = tempX; sqstick.current.y = tempY;
sqstick.CircleToSquare();
sqstick.CircleToSquare(squStk.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;
@ -968,7 +968,7 @@ namespace DS4Windows
}
}
if (getSquareStickRS(device) && (dState.RX != 128 || dState.RY != 128))
if (squStk.rsMode && (dState.RX != 128 || dState.RY != 128))
{
double capX = dState.RX >= 128 ? 127.0 : 128.0;
double capY = dState.RY >= 128 ? 127.0 : 128.0;
@ -976,7 +976,7 @@ namespace DS4Windows
double tempY = (dState.RY - 128.0) / capY;
DS4SquareStick sqstick = outSqrStk[device];
sqstick.current.x = tempX; sqstick.current.y = tempY;
sqstick.CircleToSquare();
sqstick.CircleToSquare(squStk.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

@ -1172,16 +1172,10 @@ namespace DS4Windows
return m_Config.btPollRate[index];
}
public static bool[] squareStickLS => m_Config.sqLSStickMode;
public static bool getSquareStickLS(int device)
public static SquareStickInfo[] SquStickInfo = m_Config.squStickInfo;
public static SquareStickInfo GetSquareStickInfo(int device)
{
return m_Config.sqLSStickMode[device];
}
public static bool[] squareStickRS => m_Config.sqRSStickMode;
public static bool getSquareStickRS(int device)
{
return m_Config.sqRSStickMode[device];
return m_Config.squStickInfo[device];
}
public static int[] lsOutCurveMode => m_Config.lsOutCurveMode;
@ -1574,6 +1568,13 @@ namespace DS4Windows
}
}
public class SquareStickInfo
{
public bool lsMode;
public bool rsMode;
public double roundness = 5.0;
}
public class BackingStore
{
//public String m_Profile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool" + "\\Profiles.xml";
@ -1628,8 +1629,13 @@ namespace DS4Windows
MouseCursor.GYRO_MOUSE_DEADZONE };
public bool[] gyroMouseToggle = new bool[5] { false, false, false,
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 SquareStickInfo[] squStickInfo = new SquareStickInfo[5]
{
new SquareStickInfo(), new SquareStickInfo(),
new SquareStickInfo(), new SquareStickInfo(),
new SquareStickInfo(),
};
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 };
@ -2014,8 +2020,10 @@ namespace DS4Windows
XmlNode xmlLsOutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "LSOutputCurveMode", null); xmlLsOutputCurveMode.InnerText = stickOutputCurveString(lsOutCurveMode[device]); Node.AppendChild(xmlLsOutputCurveMode);
XmlNode xmlRsOutputCurveMode = m_Xdoc.CreateNode(XmlNodeType.Element, "RSOutputCurveMode", null); xmlRsOutputCurveMode.InnerText = stickOutputCurveString(rsOutCurveMode[device]); Node.AppendChild(xmlRsOutputCurveMode);
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 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 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);
@ -2918,11 +2926,14 @@ namespace DS4Windows
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSOutputCurveMode"); rsOutCurveMode[device] = stickOutputCurveId(Item.InnerText); }
catch { rsOutCurveMode[device] = 0; missingSetting = true; }
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 + "/LSSquareStick"); bool.TryParse(Item.InnerText, out squStickInfo[device].lsMode); }
catch { squStickInfo[device].lsMode = false; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSSquareStick"); bool.TryParse(Item.InnerText, out sqRSStickMode[device]); }
catch { sqRSStickMode[device] = 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 + "/RSSquareStick"); bool.TryParse(Item.InnerText, out squStickInfo[device].rsMode); }
catch { squStickInfo[device].rsMode = false; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/L2OutputCurveMode"); l2OutCurveMode[device] = axisOutputCurveId(Item.InnerText); }
catch { l2OutCurveMode[device] = 0; missingSetting = true; }
@ -4218,8 +4229,9 @@ namespace DS4Windows
gyroSmoothing[device] = false;
gyroSmoothWeight[device] = 0.5;
gyroMouseHorizontalAxis[device] = 0;
sqLSStickMode[device] = false;
sqRSStickMode[device] = false;
squStickInfo[device].lsMode = false;
squStickInfo[device].rsMode = false;
squStickInfo[device].roundness = 5;
lsOutCurveMode[device] = 0;
rsOutCurveMode[device] = 0;
l2OutCurveMode[device] = 0;

View File

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

View File

@ -686,8 +686,9 @@ namespace DS4Windows.Forms
btnBrowse.Text = Path.GetFileNameWithoutExtension(LaunchProgram[device]);
}
lsSquStickCk.Checked = squareStickLS[device];
rsSquStickCk.Checked = squareStickRS[device];
lsSquStickCk.Checked = SquStickInfo[device].lsMode;
rsSquStickCk.Checked = SquStickInfo[device].rsMode;
RoundnessNUpDown.Value = (decimal)SquStickInfo[device].roundness;
cBDinput.Checked = DinputOnly[device];
olddinputcheck = cBDinput.Checked;
@ -1328,8 +1329,9 @@ namespace DS4Windows.Forms
SZMaxzone[device] = (double)nUDSixAxisZMaxZone.Value;
SXAntiDeadzone[device] = (double)nUDSixaxisXAntiDead.Value;
SZAntiDeadzone[device] = (double)nUDSixaxisZAntiDead.Value;
squareStickLS[device] = lsSquStickCk.Checked;
squareStickRS[device] = rsSquStickCk.Checked;
SquStickInfo[device].lsMode = lsSquStickCk.Checked;
SquStickInfo[device].rsMode = rsSquStickCk.Checked;
SquStickInfo[device].roundness = (double)RoundnessNUpDown.Value;
MouseAccel[device] = cBMouseAccel.Checked;
DinputOnly[device] = cBDinput.Checked;
StartTouchpadOff[device] = cbStartTouchpadOff.Checked;
@ -3142,7 +3144,7 @@ namespace DS4Windows.Forms
{
if (loading == false)
{
squareStickLS[device] = lsSquStickCk.Checked;
SquStickInfo[device].lsMode = lsSquStickCk.Checked;
}
}
@ -3150,7 +3152,14 @@ namespace DS4Windows.Forms
{
if (loading == false)
{
squareStickRS[device] = rsSquStickCk.Checked;
SquStickInfo[device].rsMode = rsSquStickCk.Checked;
}
}
private void RoundnessNUpDown_ValueChanged(object sender, EventArgs e)
{
if (loading == false) {
SquStickInfo[device].roundness = (int)RoundnessNUpDown.Value;
}
}

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>