mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-23 21:51:09 +01:00
Make anti-deadzone setting persistent
This commit is contained in:
parent
11a7f8ca2f
commit
11cc515127
@ -457,15 +457,15 @@ namespace DS4Windows
|
|||||||
else if ((lsDeadzone > 0 && lsSquared > lsDeadzoneSquared) || lsAntiDead > 0)
|
else if ((lsDeadzone > 0 && lsSquared > lsDeadzoneSquared) || lsAntiDead > 0)
|
||||||
{
|
{
|
||||||
double r = Math.Atan2(-(dState.LY - 127.5f), (dState.LX - 127.5f));
|
double r = Math.Atan2(-(dState.LY - 127.5f), (dState.LX - 127.5f));
|
||||||
double maxXValue = dState.LX > 127.5 ? 127.5 : -127.5;
|
double maxXValue = dState.LX >= 127.5 ? 127.5 : -127.5;
|
||||||
double maxYValue = dState.LY > 127.5 ? 127.5 : -127.5;
|
double maxYValue = dState.LY >= 127.5 ? 127.5 : -127.5;
|
||||||
|
|
||||||
double tempLsXDead = 0.0, tempLsYDead = 0.0;
|
double tempLsXDead = 0.0, tempLsYDead = 0.0;
|
||||||
double tempOutputX = 0.0, tempOutputY = 0.0;
|
double tempOutputX = 0.0, tempOutputY = 0.0;
|
||||||
if (lsDeadzone > 0)
|
if (lsDeadzone > 0)
|
||||||
{
|
{
|
||||||
tempLsXDead = Math.Cos(r) * (lsDeadzone);
|
tempLsXDead = Math.Cos(r) * (lsDeadzone);
|
||||||
tempLsYDead = Math.Sin(r) * (lsDeadzone);
|
tempLsYDead = Math.Sin(r) * (-lsDeadzone);
|
||||||
|
|
||||||
if (lsSquared > lsDeadzoneSquared)
|
if (lsSquared > lsDeadzoneSquared)
|
||||||
{
|
{
|
||||||
@ -515,15 +515,15 @@ namespace DS4Windows
|
|||||||
else if ((rsDeadzone > 0 && rsSquared > rsDeadzoneSquared) || rsAntiDead > 0)
|
else if ((rsDeadzone > 0 && rsSquared > rsDeadzoneSquared) || rsAntiDead > 0)
|
||||||
{
|
{
|
||||||
double r = Math.Atan2(-(dState.RY - 127.5f), (dState.RX - 127.5f));
|
double r = Math.Atan2(-(dState.RY - 127.5f), (dState.RX - 127.5f));
|
||||||
double maxXValue = dState.RX > 127.5 ? 127.5 : -127.5;
|
double maxXValue = dState.RX >= 127.5 ? 127.5 : -127.5;
|
||||||
double maxYValue = dState.RY > 127.5 ? 127.5 : -127.5;
|
double maxYValue = dState.RY >= 127.5 ? 127.5 : -127.5;
|
||||||
|
|
||||||
double tempRsXDead = 0.0, tempRsYDead = 0.0;
|
double tempRsXDead = 0.0, tempRsYDead = 0.0;
|
||||||
double tempOutputX = 0.0, tempOutputY = 0.0;
|
double tempOutputX = 0.0, tempOutputY = 0.0;
|
||||||
if (rsDeadzone > 0)
|
if (rsDeadzone > 0)
|
||||||
{
|
{
|
||||||
tempRsXDead = Math.Cos(r) * (rsDeadzone);
|
tempRsXDead = Math.Cos(r) * (rsDeadzone);
|
||||||
tempRsYDead = Math.Sin(r) * (rsDeadzone);
|
tempRsYDead = Math.Sin(r) * (-rsDeadzone);
|
||||||
|
|
||||||
if (rsSquared > rsDeadzoneSquared)
|
if (rsSquared > rsDeadzoneSquared)
|
||||||
{
|
{
|
||||||
|
@ -773,6 +773,8 @@ namespace DS4Windows
|
|||||||
XmlNode xmlRainbow = m_Xdoc.CreateNode(XmlNodeType.Element, "Rainbow", null); xmlRainbow.InnerText = rainbow[device].ToString(); Node.AppendChild(xmlRainbow);
|
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 = LSDeadzone[device].ToString(); Node.AppendChild(xmlLSD);
|
XmlNode xmlLSD = m_Xdoc.CreateNode(XmlNodeType.Element, "LSDeadZone", null); xmlLSD.InnerText = LSDeadzone[device].ToString(); Node.AppendChild(xmlLSD);
|
||||||
XmlNode xmlRSD = m_Xdoc.CreateNode(XmlNodeType.Element, "RSDeadZone", null); xmlRSD.InnerText = RSDeadzone[device].ToString(); Node.AppendChild(xmlRSD);
|
XmlNode xmlRSD = m_Xdoc.CreateNode(XmlNodeType.Element, "RSDeadZone", null); xmlRSD.InnerText = RSDeadzone[device].ToString(); Node.AppendChild(xmlRSD);
|
||||||
|
XmlNode xmlLSAD = m_Xdoc.CreateNode(XmlNodeType.Element, "LSAntiDeadZone", null); xmlLSAD.InnerText = LSAntiDeadzone[device].ToString(); Node.AppendChild(xmlLSAD);
|
||||||
|
XmlNode xmlRSAD = m_Xdoc.CreateNode(XmlNodeType.Element, "RSAntiDeadZone", null); xmlRSAD.InnerText = RSAntiDeadzone[device].ToString(); Node.AppendChild(xmlRSAD);
|
||||||
XmlNode xmlSXD = m_Xdoc.CreateNode(XmlNodeType.Element, "SXDeadZone", null); xmlSXD.InnerText = SXDeadzone[device].ToString(); Node.AppendChild(xmlSXD);
|
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);
|
XmlNode xmlSZD = m_Xdoc.CreateNode(XmlNodeType.Element, "SZDeadZone", null); xmlSZD.InnerText = SZDeadzone[device].ToString(); Node.AppendChild(xmlSZD);
|
||||||
|
|
||||||
@ -1407,6 +1409,10 @@ namespace DS4Windows
|
|||||||
catch { missingSetting = true; }
|
catch { missingSetting = true; }
|
||||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSDeadZone"); int.TryParse(Item.InnerText, out RSDeadzone[device]); }
|
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSDeadZone"); int.TryParse(Item.InnerText, out RSDeadzone[device]); }
|
||||||
catch { missingSetting = true; }
|
catch { missingSetting = true; }
|
||||||
|
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/LSAntiDeadZone"); int.TryParse(Item.InnerText, out LSAntiDeadzone[device]); }
|
||||||
|
catch { missingSetting = true; }
|
||||||
|
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/RSAntiDeadZone"); int.TryParse(Item.InnerText, out RSAntiDeadzone[device]); }
|
||||||
|
catch { missingSetting = true; }
|
||||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SXDeadZone"); double.TryParse(Item.InnerText, out SXDeadzone[device]); }
|
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SXDeadZone"); double.TryParse(Item.InnerText, out SXDeadzone[device]); }
|
||||||
catch { missingSetting = true; }
|
catch { missingSetting = true; }
|
||||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SZDeadZone"); double.TryParse(Item.InnerText, out SZDeadzone[device]); }
|
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/SZDeadZone"); double.TryParse(Item.InnerText, out SZDeadzone[device]); }
|
||||||
|
@ -238,6 +238,22 @@ namespace DS4Windows
|
|||||||
nUDRS.Value = 0;
|
nUDRS.Value = 0;
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
nUDLSAntiDead.Value = (decimal)(LSAntiDeadzone[device] / 100d);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
nUDLSAntiDead.Value = 0;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
nUDRSAntiDead.Value = (decimal)(RSAntiDeadzone[device] / 100d);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
nUDRSAntiDead.Value = 0;
|
||||||
|
}
|
||||||
|
try
|
||||||
{
|
{
|
||||||
nUDSX.Value = (decimal)SXDeadzone[device];
|
nUDSX.Value = (decimal)SXDeadzone[device];
|
||||||
}
|
}
|
||||||
@ -399,6 +415,8 @@ namespace DS4Windows
|
|||||||
nUDR2.Value = 0;
|
nUDR2.Value = 0;
|
||||||
nUDLS.Value = 0;
|
nUDLS.Value = 0;
|
||||||
nUDRS.Value = 0;
|
nUDRS.Value = 0;
|
||||||
|
nUDLSAntiDead.Value = 0;
|
||||||
|
nUDRSAntiDead.Value = 0;
|
||||||
nUDSX.Value = .25m;
|
nUDSX.Value = .25m;
|
||||||
nUDSZ.Value = .25m;
|
nUDSZ.Value = .25m;
|
||||||
|
|
||||||
@ -1021,6 +1039,8 @@ namespace DS4Windows
|
|||||||
Rainbow[device] = (int)nUDRainbow.Value;
|
Rainbow[device] = (int)nUDRainbow.Value;
|
||||||
RSDeadzone[device] = (int)Math.Round((nUDRS.Value * 127), 0);
|
RSDeadzone[device] = (int)Math.Round((nUDRS.Value * 127), 0);
|
||||||
LSDeadzone[device] = (int)Math.Round((nUDLS.Value * 127), 0);
|
LSDeadzone[device] = (int)Math.Round((nUDLS.Value * 127), 0);
|
||||||
|
LSAntiDeadzone[device] = (int)(nUDLSAntiDead.Value * 100);
|
||||||
|
RSAntiDeadzone[device] = (int)(nUDRSAntiDead.Value * 100);
|
||||||
ButtonMouseSensitivity[device] = (int)numUDMouseSens.Value;
|
ButtonMouseSensitivity[device] = (int)numUDMouseSens.Value;
|
||||||
FlashAt[device] = (int)nUDflashLED.Value;
|
FlashAt[device] = (int)nUDflashLED.Value;
|
||||||
SXDeadzone[device] = (double)nUDSX.Value;
|
SXDeadzone[device] = (double)nUDSX.Value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user