Group trigger mod profile properties

This commit is contained in:
Travis Nickles 2019-06-30 20:59:51 -05:00
parent a6ed8240df
commit dfaecd474f
4 changed files with 100 additions and 51 deletions

View File

@ -782,9 +782,15 @@ namespace DS4Windows
}
}
byte l2Deadzone = getL2Deadzone(device);
/*byte l2Deadzone = getL2Deadzone(device);
int l2AntiDeadzone = getL2AntiDeadzone(device);
int l2Maxzone = getL2Maxzone(device);
*/
TriggerDeadZoneZInfo l2ModInfo = GetL2ModInfo(device);
byte l2Deadzone = l2ModInfo.deadZone;
int l2AntiDeadzone = l2ModInfo.antiDeadZone;
int l2Maxzone = l2ModInfo.maxZone;
if (l2Deadzone > 0 || l2AntiDeadzone > 0 || l2Maxzone != 100)
{
double tempL2Output = cState.L2 / 255.0;
@ -820,9 +826,14 @@ namespace DS4Windows
}
}
byte r2Deadzone = getR2Deadzone(device);
/*byte r2Deadzone = getR2Deadzone(device);
int r2AntiDeadzone = getR2AntiDeadzone(device);
int r2Maxzone = getR2Maxzone(device);
*/
TriggerDeadZoneZInfo r2ModInfo = GetR2ModInfo(device);
byte r2Deadzone = r2ModInfo.deadZone;
int r2AntiDeadzone = r2ModInfo.antiDeadZone;
int r2Maxzone = r2ModInfo.maxZone;
if (r2Deadzone > 0 || r2AntiDeadzone > 0 || r2Maxzone != 100)
{
double tempR2Output = cState.R2 / 255.0;

View File

@ -15,4 +15,11 @@ namespace DS4Windows
public int antiDeadZone;
public int maxZone = 100;
}
public class TriggerDeadZoneZInfo
{
public byte deadZone; // Trigger deadzone is expressed in axis units
public int antiDeadZone;
public int maxZone = 100;
}
}

View File

@ -992,16 +992,30 @@ namespace DS4Windows
return m_Config.touchpadInvert[index];
}
public static byte[] L2Deadzone => m_Config.l2Deadzone;
public static byte getL2Deadzone(int index)
public static TriggerDeadZoneZInfo[] L2ModInfo => m_Config.l2ModInfo;
public static TriggerDeadZoneZInfo GetL2ModInfo(int index)
{
return m_Config.l2Deadzone[index];
return m_Config.l2ModInfo[index];
}
public static byte[] R2Deadzone => m_Config.r2Deadzone;
//public static byte[] L2Deadzone => m_Config.l2Deadzone;
public static byte getL2Deadzone(int index)
{
return m_Config.l2ModInfo[index].deadZone;
//return m_Config.l2Deadzone[index];
}
public static TriggerDeadZoneZInfo[] R2ModInfo => m_Config.r2ModInfo;
public static TriggerDeadZoneZInfo GetR2ModInfo(int index)
{
return m_Config.r2ModInfo[index];
}
//public static byte[] R2Deadzone => m_Config.r2Deadzone;
public static byte getR2Deadzone(int index)
{
return m_Config.r2Deadzone[index];
return m_Config.r2ModInfo[index].deadZone;
//return m_Config.r2Deadzone[index];
}
public static double[] SXDeadzone => m_Config.SXDeadzone;
@ -1094,28 +1108,32 @@ namespace DS4Windows
return m_Config.SZMaxzone[index];
}
public static int[] L2AntiDeadzone => m_Config.l2AntiDeadzone;
//public static int[] L2AntiDeadzone => m_Config.l2AntiDeadzone;
public static int getL2AntiDeadzone(int index)
{
return m_Config.l2AntiDeadzone[index];
return m_Config.l2ModInfo[index].antiDeadZone;
//return m_Config.l2AntiDeadzone[index];
}
public static int[] R2AntiDeadzone => m_Config.r2AntiDeadzone;
//public static int[] R2AntiDeadzone => m_Config.r2AntiDeadzone;
public static int getR2AntiDeadzone(int index)
{
return m_Config.r2AntiDeadzone[index];
return m_Config.r2ModInfo[index].antiDeadZone;
//return m_Config.r2AntiDeadzone[index];
}
public static int[] L2Maxzone => m_Config.l2Maxzone;
//public static int[] L2Maxzone => m_Config.l2Maxzone;
public static int getL2Maxzone(int index)
{
return m_Config.l2Maxzone[index];
return m_Config.l2ModInfo[index].maxZone;
//return m_Config.l2Maxzone[index];
}
public static int[] R2Maxzone => m_Config.r2Maxzone;
//public static int[] R2Maxzone => m_Config.r2Maxzone;
public static int getR2Maxzone(int index)
{
return m_Config.r2Maxzone[index];
return m_Config.r2ModInfo[index].maxZone;
//return m_Config.r2Maxzone[index];
}
public static int[] LSCurve => m_Config.lsCurve;
@ -1612,7 +1630,6 @@ namespace DS4Windows
public bool[] distanceProfiles = new bool[5] { false, false, false, false, false };
public Byte[] rumble = new Byte[5] { 100, 100, 100, 100, 100 };
public Byte[] touchSensitivity = new Byte[5] { 100, 100, 100, 100, 100 };
public Byte[] l2Deadzone = new Byte[5] { 0, 0, 0, 0, 0 }, r2Deadzone = new Byte[5] { 0, 0, 0, 0, 0 };
public StickDeadZoneInfo[] lsModInfo = new StickDeadZoneInfo[5]
{
new StickDeadZoneInfo(), new StickDeadZoneInfo(),
@ -1625,8 +1642,22 @@ namespace DS4Windows
new StickDeadZoneInfo(), new StickDeadZoneInfo(),
new StickDeadZoneInfo()
};
public TriggerDeadZoneZInfo[] l2ModInfo = new TriggerDeadZoneZInfo[5]
{
new TriggerDeadZoneZInfo(), new TriggerDeadZoneZInfo(),
new TriggerDeadZoneZInfo(), new TriggerDeadZoneZInfo(),
new TriggerDeadZoneZInfo()
};
public TriggerDeadZoneZInfo[] r2ModInfo = new TriggerDeadZoneZInfo[5]
{
new TriggerDeadZoneZInfo(), new TriggerDeadZoneZInfo(),
new TriggerDeadZoneZInfo(), new TriggerDeadZoneZInfo(),
new TriggerDeadZoneZInfo()
};
/*public Byte[] l2Deadzone = new Byte[5] { 0, 0, 0, 0, 0 }, r2Deadzone = new Byte[5] { 0, 0, 0, 0, 0 };
public int[] l2AntiDeadzone = new int[5] { 0, 0, 0, 0, 0 }, r2AntiDeadzone = new int[5] { 0, 0, 0, 0, 0 };
public int[] l2Maxzone = new int[5] { 100, 100, 100, 100, 100 }, r2Maxzone = new int[5] { 100, 100, 100, 100, 100 };
*/
public double[] LSRotation = new double[5] { 0.0, 0.0, 0.0, 0.0, 0.0 }, RSRotation = new double[5] { 0.0, 0.0, 0.0, 0.0, 0.0 };
public double[] SXDeadzone = new double[5] { 0.25, 0.25, 0.25, 0.25, 0.25 }, SZDeadzone = new double[5] { 0.25, 0.25, 0.25, 0.25, 0.25 };
public double[] SXMaxzone = new double[5] { 1.0, 1.0, 1.0, 1.0, 1.0 },
@ -1975,13 +2006,13 @@ namespace DS4Windows
XmlNode xmlTapSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "tapSensitivity", null); xmlTapSensitivity.InnerText = tapSensitivity[device].ToString(); Node.AppendChild(xmlTapSensitivity);
XmlNode xmlDouble = m_Xdoc.CreateNode(XmlNodeType.Element, "doubleTap", null); xmlDouble.InnerText = doubleTap[device].ToString(); Node.AppendChild(xmlDouble);
XmlNode xmlScrollSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "scrollSensitivity", null); xmlScrollSensitivity.InnerText = scrollSensitivity[device].ToString(); Node.AppendChild(xmlScrollSensitivity);
XmlNode xmlLeftTriggerMiddle = m_Xdoc.CreateNode(XmlNodeType.Element, "LeftTriggerMiddle", null); xmlLeftTriggerMiddle.InnerText = l2Deadzone[device].ToString(); Node.AppendChild(xmlLeftTriggerMiddle);
XmlNode xmlRightTriggerMiddle = m_Xdoc.CreateNode(XmlNodeType.Element, "RightTriggerMiddle", null); xmlRightTriggerMiddle.InnerText = r2Deadzone[device].ToString(); Node.AppendChild(xmlRightTriggerMiddle);
XmlNode xmlLeftTriggerMiddle = m_Xdoc.CreateNode(XmlNodeType.Element, "LeftTriggerMiddle", null); xmlLeftTriggerMiddle.InnerText = l2ModInfo[device].deadZone.ToString(); Node.AppendChild(xmlLeftTriggerMiddle);
XmlNode xmlRightTriggerMiddle = m_Xdoc.CreateNode(XmlNodeType.Element, "RightTriggerMiddle", null); xmlRightTriggerMiddle.InnerText = r2ModInfo[device].deadZone.ToString(); Node.AppendChild(xmlRightTriggerMiddle);
XmlNode xmlTouchpadInvert = m_Xdoc.CreateNode(XmlNodeType.Element, "TouchpadInvert", null); xmlTouchpadInvert.InnerText = touchpadInvert[device].ToString(); Node.AppendChild(xmlTouchpadInvert);
XmlNode xmlL2AD = m_Xdoc.CreateNode(XmlNodeType.Element, "L2AntiDeadZone", null); xmlL2AD.InnerText = l2AntiDeadzone[device].ToString(); Node.AppendChild(xmlL2AD);
XmlNode xmlR2AD = m_Xdoc.CreateNode(XmlNodeType.Element, "R2AntiDeadZone", null); xmlR2AD.InnerText = r2AntiDeadzone[device].ToString(); Node.AppendChild(xmlR2AD);
XmlNode xmlL2Maxzone = m_Xdoc.CreateNode(XmlNodeType.Element, "L2MaxZone", null); xmlL2Maxzone.InnerText = l2Maxzone[device].ToString(); Node.AppendChild(xmlL2Maxzone);
XmlNode xmlR2Maxzone = m_Xdoc.CreateNode(XmlNodeType.Element, "R2MaxZone", null); xmlR2Maxzone.InnerText = r2Maxzone[device].ToString(); Node.AppendChild(xmlR2Maxzone);
XmlNode xmlL2AD = m_Xdoc.CreateNode(XmlNodeType.Element, "L2AntiDeadZone", null); xmlL2AD.InnerText = l2ModInfo[device].antiDeadZone.ToString(); Node.AppendChild(xmlL2AD);
XmlNode xmlR2AD = m_Xdoc.CreateNode(XmlNodeType.Element, "R2AntiDeadZone", null); xmlR2AD.InnerText = r2ModInfo[device].antiDeadZone.ToString(); Node.AppendChild(xmlR2AD);
XmlNode xmlL2Maxzone = m_Xdoc.CreateNode(XmlNodeType.Element, "L2MaxZone", null); xmlL2Maxzone.InnerText = l2ModInfo[device].maxZone.ToString(); Node.AppendChild(xmlL2Maxzone);
XmlNode xmlR2Maxzone = m_Xdoc.CreateNode(XmlNodeType.Element, "R2MaxZone", null); xmlR2Maxzone.InnerText = r2ModInfo[device].maxZone.ToString(); Node.AppendChild(xmlR2Maxzone);
XmlNode xmlButtonMouseSensitivity = m_Xdoc.CreateNode(XmlNodeType.Element, "ButtonMouseSensitivity", null); xmlButtonMouseSensitivity.InnerText = buttonMouseSensitivity[device].ToString(); Node.AppendChild(xmlButtonMouseSensitivity);
XmlNode xmlRainbow = m_Xdoc.CreateNode(XmlNodeType.Element, "Rainbow", null); xmlRainbow.InnerText = rainbow[device].ToString(); Node.AppendChild(xmlRainbow);
XmlNode xmlLSD = m_Xdoc.CreateNode(XmlNodeType.Element, "LSDeadZone", null); xmlLSD.InnerText = lsModInfo[device].deadZone.ToString(); Node.AppendChild(xmlLSD);
@ -2666,30 +2697,30 @@ namespace DS4Windows
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/TouchpadInvert"); int temp = 0; int.TryParse(Item.InnerText, out temp); touchpadInvert[device] = Math.Min(Math.Max(temp, 0), 3); }
catch { touchpadInvert[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LeftTriggerMiddle"); byte.TryParse(Item.InnerText, out l2Deadzone[device]); }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LeftTriggerMiddle"); byte.TryParse(Item.InnerText, out l2ModInfo[device].deadZone); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RightTriggerMiddle"); byte.TryParse(Item.InnerText, out r2Deadzone[device]); }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RightTriggerMiddle"); byte.TryParse(Item.InnerText, out r2ModInfo[device].deadZone); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/L2AntiDeadZone"); int.TryParse(Item.InnerText, out l2AntiDeadzone[device]); }
catch { l2AntiDeadzone[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/L2AntiDeadZone"); int.TryParse(Item.InnerText, out l2ModInfo[device].antiDeadZone); }
catch { l2ModInfo[device].antiDeadZone = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/R2AntiDeadZone"); int.TryParse(Item.InnerText, out r2AntiDeadzone[device]); }
catch { r2AntiDeadzone[device] = 0; missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/R2AntiDeadZone"); int.TryParse(Item.InnerText, out r2ModInfo[device].antiDeadZone); }
catch { r2ModInfo[device].antiDeadZone = 0; missingSetting = true; }
try {
Item = m_Xdoc.SelectSingleNode("/" + rootname + "/L2MaxZone"); int temp = 100;
int.TryParse(Item.InnerText, out temp);
l2Maxzone[device] = Math.Min(Math.Max(temp, 0), 100);
l2ModInfo[device].maxZone = Math.Min(Math.Max(temp, 0), 100);
}
catch { l2Maxzone[device] = 100; missingSetting = true; }
catch { l2ModInfo[device].maxZone = 100; missingSetting = true; }
try {
Item = m_Xdoc.SelectSingleNode("/" + rootname + "/R2MaxZone"); int temp = 100;
int.TryParse(Item.InnerText, out temp);
r2Maxzone[device] = Math.Min(Math.Max(temp, 0), 100);
r2ModInfo[device].maxZone = Math.Min(Math.Max(temp, 0), 100);
}
catch { r2Maxzone[device] = 100; missingSetting = true; }
catch { r2ModInfo[device].maxZone = 100; missingSetting = true; }
try
{
@ -4188,12 +4219,12 @@ namespace DS4Windows
flashType[device] = 0;
rumble[device] = 100;
touchSensitivity[device] = 100;
l2Deadzone[device] = r2Deadzone[device] = 0;
l2ModInfo[device].deadZone = r2ModInfo[device].deadZone = 0;
lsModInfo[device].deadZone = rsModInfo[device].deadZone = 0;
lsModInfo[device].antiDeadZone = rsModInfo[device].antiDeadZone = 0;
lsModInfo[device].maxZone = rsModInfo[device].maxZone = 100;
l2AntiDeadzone[device] = r2AntiDeadzone[device] = 0;
l2Maxzone[device] = r2Maxzone[device] = 100;
l2ModInfo[device].antiDeadZone = r2ModInfo[device].antiDeadZone = 0;
l2ModInfo[device].maxZone = r2ModInfo[device].maxZone = 100;
LSRotation[device] = 0.0;
RSRotation[device] = 0.0;
SXDeadzone[device] = SZDeadzone[device] = 0.25;

View File

@ -458,7 +458,7 @@ namespace DS4Windows.Forms
try
{
nUDL2.Value = Math.Round((decimal)L2Deadzone[device] / 255, 2);
nUDL2.Value = Math.Round((decimal)L2ModInfo[device].deadZone / 255, 2);
}
catch
{
@ -466,7 +466,7 @@ namespace DS4Windows.Forms
}
try
{
nUDR2.Value = Math.Round((decimal)R2Deadzone[device] / 255, 2);
nUDR2.Value = Math.Round((decimal)R2ModInfo[device].deadZone / 255, 2);
}
catch
{
@ -475,7 +475,7 @@ namespace DS4Windows.Forms
try
{
nUDL2AntiDead.Value = (decimal)(L2AntiDeadzone[device] / 100d);
nUDL2AntiDead.Value = (decimal)(L2ModInfo[device].antiDeadZone / 100d);
}
catch
{
@ -483,7 +483,7 @@ namespace DS4Windows.Forms
}
try
{
nUDR2AntiDead.Value = (decimal)(R2AntiDeadzone[device] / 100d);
nUDR2AntiDead.Value = (decimal)(R2ModInfo[device].antiDeadZone / 100d);
}
catch
{
@ -492,7 +492,7 @@ namespace DS4Windows.Forms
try
{
nUDL2Maxzone.Value = (decimal)(L2Maxzone[device] / 100d);
nUDL2Maxzone.Value = (decimal)(L2ModInfo[device].maxZone / 100d);
}
catch
{
@ -500,7 +500,7 @@ namespace DS4Windows.Forms
}
try
{
nUDR2Maxzone.Value = (decimal)(R2Maxzone[device] / 100d);
nUDR2Maxzone.Value = (decimal)(R2ModInfo[device].maxZone / 100d);
}
catch
{
@ -1296,10 +1296,10 @@ namespace DS4Windows.Forms
r2OutCurveMode[device] = cBR2OutputCurve.SelectedIndex;
sxOutCurveMode[device] = cBSixaxisXOutputCurve.SelectedIndex;
szOutCurveMode[device] = cBSixaxisZOutputCurve.SelectedIndex;
L2Deadzone[device] = (byte)Math.Round((nUDL2.Value * 255), 0);
R2Deadzone[device] = (byte)Math.Round((nUDR2.Value * 255), 0);
L2AntiDeadzone[device] = (int)(nUDL2AntiDead.Value * 100);
R2AntiDeadzone[device] = (int)(nUDR2AntiDead.Value * 100);
L2ModInfo[device].deadZone = (byte)Math.Round((nUDL2.Value * 255), 0);
R2ModInfo[device].deadZone = (byte)Math.Round((nUDR2.Value * 255), 0);
L2ModInfo[device].antiDeadZone = (int)(nUDL2AntiDead.Value * 100);
R2ModInfo[device].antiDeadZone = (int)(nUDR2AntiDead.Value * 100);
RumbleBoost[device] = (byte)nUDRumbleBoost.Value;
TouchSensitivity[device] = (byte)nUDTouch.Value;
TouchpadJitterCompensation[device] = cBTouchpadJitterCompensation.Checked;
@ -2034,12 +2034,12 @@ namespace DS4Windows.Forms
private void numUDL2_ValueChanged(object sender, EventArgs e)
{
L2Deadzone[device] = (byte)(nUDL2.Value * 255);
L2ModInfo[device].deadZone = (byte)(nUDL2.Value * 255);
}
private void numUDR2_ValueChanged(object sender, EventArgs e)
{
R2Deadzone[device] = (byte)(nUDR2.Value * 255);
R2ModInfo[device].deadZone = (byte)(nUDR2.Value * 255);
}
private void nUDSX_ValueChanged(object sender, EventArgs e)
@ -2745,12 +2745,12 @@ namespace DS4Windows.Forms
private void nUDL2AntiDead_ValueChanged(object sender, EventArgs e)
{
L2AntiDeadzone[device] = (int)(nUDL2AntiDead.Value * 100);
L2ModInfo[device].antiDeadZone = (int)(nUDL2AntiDead.Value * 100);
}
private void nUDR2AntiDead_ValueChanged(object sender, EventArgs e)
{
R2AntiDeadzone[device] = (int)(nUDR2AntiDead.Value * 100);
R2ModInfo[device].antiDeadZone = (int)(nUDR2AntiDead.Value * 100);
}
private void lVActions_ItemCheck(object sender, ItemCheckEventArgs e)
@ -2788,12 +2788,12 @@ namespace DS4Windows.Forms
private void nUDL2Maxzone_ValueChanged(object sender, EventArgs e)
{
L2Maxzone[device] = (int)(nUDL2Maxzone.Value * 100);
L2ModInfo[device].maxZone = (int)(nUDL2Maxzone.Value * 100);
}
private void nUDR2Maxzone_ValueChanged(object sender, EventArgs e)
{
R2Maxzone[device] = (int)(nUDR2Maxzone.Value * 100);
R2ModInfo[device].maxZone = (int)(nUDR2Maxzone.Value * 100);
}
private void btPollRateComboBox_SelectedIndexChanged(object sender, EventArgs e)