mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-23 13:41:15 +01:00
Reset old backstore profile values before loading new profile values
This commit is contained in:
parent
b370d57bc3
commit
84fdb26d18
@ -1039,7 +1039,7 @@ namespace DS4Windows
|
|||||||
public String m_Actions = Global.appdatapath + "\\Actions.xml";
|
public String m_Actions = Global.appdatapath + "\\Actions.xml";
|
||||||
|
|
||||||
protected XmlDocument m_Xdoc = new XmlDocument();
|
protected XmlDocument m_Xdoc = new XmlDocument();
|
||||||
//fifth value used to for options, not fifth controller
|
// fifth value used for options, not fifth controller
|
||||||
public int[] buttonMouseSensitivity = { 25, 25, 25, 25, 25 };
|
public int[] buttonMouseSensitivity = { 25, 25, 25, 25, 25 };
|
||||||
|
|
||||||
public bool[] flushHIDQueue = { false, false, false, false, false };
|
public bool[] flushHIDQueue = { false, false, false, false, false };
|
||||||
@ -1848,11 +1848,10 @@ namespace DS4Windows
|
|||||||
return "Unbound";
|
return "Unbound";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Explicitly reset profile values back to default before loading new profile. */
|
|
||||||
public bool LoadProfile(int device, bool launchprogram, ControlService control,
|
public bool LoadProfile(int device, bool launchprogram, ControlService control,
|
||||||
string propath = "", bool xinputChange = true)
|
string propath = "", bool xinputChange = true)
|
||||||
{
|
{
|
||||||
Boolean Loaded = true;
|
bool Loaded = true;
|
||||||
Dictionary<DS4Controls, DS4KeyType> customMapKeyTypes = new Dictionary<DS4Controls, DS4KeyType>();
|
Dictionary<DS4Controls, DS4KeyType> customMapKeyTypes = new Dictionary<DS4Controls, DS4KeyType>();
|
||||||
Dictionary<DS4Controls, UInt16> customMapKeys = new Dictionary<DS4Controls, UInt16>();
|
Dictionary<DS4Controls, UInt16> customMapKeys = new Dictionary<DS4Controls, UInt16>();
|
||||||
Dictionary<DS4Controls, X360Controls> customMapButtons = new Dictionary<DS4Controls, X360Controls>();
|
Dictionary<DS4Controls, X360Controls> customMapButtons = new Dictionary<DS4Controls, X360Controls>();
|
||||||
@ -1864,7 +1863,7 @@ namespace DS4Windows
|
|||||||
Dictionary<DS4Controls, String> shiftCustomMapMacros = new Dictionary<DS4Controls, String>();
|
Dictionary<DS4Controls, String> shiftCustomMapMacros = new Dictionary<DS4Controls, String>();
|
||||||
Dictionary<DS4Controls, String> shiftCustomMapExtras = new Dictionary<DS4Controls, String>();
|
Dictionary<DS4Controls, String> shiftCustomMapExtras = new Dictionary<DS4Controls, String>();
|
||||||
string rootname = "DS4Windows";
|
string rootname = "DS4Windows";
|
||||||
Boolean missingSetting = false;
|
bool missingSetting = false;
|
||||||
string profilepath;
|
string profilepath;
|
||||||
if (propath == "")
|
if (propath == "")
|
||||||
profilepath = Global.appdatapath + @"\Profiles\" + profilePath[device] + ".xml";
|
profilepath = Global.appdatapath + @"\Profiles\" + profilePath[device] + ".xml";
|
||||||
@ -1888,6 +1887,9 @@ namespace DS4Windows
|
|||||||
DS4LightBar.forcedFlash[device] = 0;
|
DS4LightBar.forcedFlash[device] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure to reset currently set profile values before parsing
|
||||||
|
ResetProfile(device);
|
||||||
|
|
||||||
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/flushHIDQueue"); Boolean.TryParse(Item.InnerText, out flushHIDQueue[device]); }
|
try { Item = m_Xdoc.SelectSingleNode("/" + rootname + "/flushHIDQueue"); Boolean.TryParse(Item.InnerText, out flushHIDQueue[device]); }
|
||||||
catch { missingSetting = true; }//rootname = }
|
catch { missingSetting = true; }//rootname = }
|
||||||
|
|
||||||
@ -2705,7 +2707,7 @@ namespace DS4Windows
|
|||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
XmlNode xmlCustomLed = m_Xdoc.CreateNode(XmlNodeType.Element, "CustomLed" + (1 + i), null);
|
XmlNode xmlCustomLed = m_Xdoc.CreateNode(XmlNodeType.Element, "CustomLed" + (1 + i), null);
|
||||||
xmlCustomLed.InnerText = useCustomLeds[i] + ":" + m_CustomLeds[i].red + ","+ m_CustomLeds[i].green + "," + m_CustomLeds[i].blue;
|
xmlCustomLed.InnerText = useCustomLeds[i] + ":" + m_CustomLeds[i].red + "," + m_CustomLeds[i].green + "," + m_CustomLeds[i].blue;
|
||||||
Node.AppendChild(xmlCustomLed);
|
Node.AppendChild(xmlCustomLed);
|
||||||
}
|
}
|
||||||
/* XmlNode xmlCustomLed2 = m_Xdoc.CreateNode(XmlNodeType.Element, "CustomLed2", null); xmlCustomLed2.InnerText = profilePath[1]; Node.AppendChild(xmlCustomLed2);
|
/* XmlNode xmlCustomLed2 = m_Xdoc.CreateNode(XmlNodeType.Element, "CustomLed2", null); xmlCustomLed2.InnerText = profilePath[1]; Node.AppendChild(xmlCustomLed2);
|
||||||
@ -3178,6 +3180,67 @@ namespace DS4Windows
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ResetProfile(int device)
|
||||||
|
{
|
||||||
|
buttonMouseSensitivity[device] = 25;
|
||||||
|
flushHIDQueue[device] = false;
|
||||||
|
enableTouchToggle[device] = false;
|
||||||
|
idleDisconnectTimeout[device] = 0;
|
||||||
|
touchpadJitterCompensation[device] = false;
|
||||||
|
lowerRCOn[device] = false;
|
||||||
|
ledAsBattery[device] = false;
|
||||||
|
flashType[device] = 0;
|
||||||
|
rumble[device] = 100;
|
||||||
|
touchSensitivity[device] = 100;
|
||||||
|
l2Deadzone[device] = r2Deadzone[device] = 0;
|
||||||
|
LSDeadzone[device] = RSDeadzone[device] = 0;
|
||||||
|
LSAntiDeadzone[device] = RSAntiDeadzone[device] = 0;
|
||||||
|
LSMaxzone[device] = RSMaxzone[device] = 100;
|
||||||
|
l2AntiDeadzone[device] = r2AntiDeadzone[device] = 0;
|
||||||
|
l2Maxzone[device] = r2Maxzone[device] = 100;
|
||||||
|
SXDeadzone[device] = SZDeadzone[device] = 0.25;
|
||||||
|
l2Sens[device] = r2Sens[device] = 1;
|
||||||
|
LSSens[device] = RSSens[device] = 1;
|
||||||
|
SXSens[device] = SZSens[device] = 1;
|
||||||
|
tapSensitivity[device] = 0;
|
||||||
|
doubleTap[device] = false;
|
||||||
|
scrollSensitivity[device] = 0;
|
||||||
|
rainbow[device] = 0;
|
||||||
|
flashAt[device] = 0;
|
||||||
|
mouseAccel[device] = true;
|
||||||
|
btPollRate[device] = 0;
|
||||||
|
|
||||||
|
m_LowLeds[device] = new DS4Color(Color.Black);
|
||||||
|
|
||||||
|
Color tempColor = Color.Blue;
|
||||||
|
switch(device)
|
||||||
|
{
|
||||||
|
case 0: tempColor = Color.Blue; break;
|
||||||
|
case 1: tempColor = Color.Red; break;
|
||||||
|
case 2: tempColor = Color.Green; break;
|
||||||
|
case 3: tempColor = Color.Pink; break;
|
||||||
|
case 4: tempColor = Color.White; break;
|
||||||
|
default: tempColor = Color.Blue; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Leds[device] = new DS4Color(tempColor);
|
||||||
|
m_ChargingLeds[device] = new DS4Color(Color.Black);
|
||||||
|
m_FlashLeds[device] = new DS4Color(Color.Black);
|
||||||
|
useCustomLeds[device] = false;
|
||||||
|
m_CustomLeds[device] = new DS4Color(Color.Black);
|
||||||
|
|
||||||
|
chargingType[device] = 0;
|
||||||
|
launchProgram[device] = string.Empty;
|
||||||
|
dinputOnly[device] = false;
|
||||||
|
startTouchpadOff[device] = false;
|
||||||
|
useTPforControls[device] = false;
|
||||||
|
useSAforMouse[device] = false;
|
||||||
|
sATriggers[device] = "";
|
||||||
|
lsCurve[device] = rsCurve[device] = 0;
|
||||||
|
gyroSensitivity[device] = 100;
|
||||||
|
gyroInvert[device] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SpecialAction
|
public class SpecialAction
|
||||||
|
@ -1942,7 +1942,7 @@
|
|||||||
<value>0</value>
|
<value>0</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btPollRateComboBox.Items" xml:space="preserve">
|
<data name="btPollRateComboBox.Items" xml:space="preserve">
|
||||||
<value>Full (1 ms)</value>
|
<value>Max (1 ms)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="btPollRateComboBox.Items1" xml:space="preserve">
|
<data name="btPollRateComboBox.Items1" xml:space="preserve">
|
||||||
<value>1000 Hz (1 ms)</value>
|
<value>1000 Hz (1 ms)</value>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user