mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-25 08:01:49 +01:00
Trim ScpUtil.cs. Do not create new instances of DS4StateFieldMapping each frame
This commit is contained in:
parent
17a1e895eb
commit
c5c56cf78c
@ -3,7 +3,7 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
public class DS4StateFieldMapping
|
public class DS4StateFieldMapping
|
||||||
{
|
{
|
||||||
public enum ControlType { Unknown = 0, Button, AxisDir, Trigger, Touch, GyroDir, SwipeDir }
|
public enum ControlType: int { Unknown = 0, Button, AxisDir, Trigger, Touch, GyroDir, SwipeDir }
|
||||||
|
|
||||||
public bool[] buttons = new bool[(int)DS4Controls.SwipeDown + 1];
|
public bool[] buttons = new bool[(int)DS4Controls.SwipeDown + 1];
|
||||||
public byte[] axisdirs = new byte[(int)DS4Controls.SwipeDown + 1];
|
public byte[] axisdirs = new byte[(int)DS4Controls.SwipeDown + 1];
|
||||||
@ -52,7 +52,16 @@ namespace DS4Windows
|
|||||||
ControlType.SwipeDir, // DS4Controls.SwipeDown
|
ControlType.SwipeDir, // DS4Controls.SwipeDown
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public DS4StateFieldMapping()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public DS4StateFieldMapping(DS4State cState, DS4StateExposed exposeState, Mouse tp, bool priorMouse=false)
|
public DS4StateFieldMapping(DS4State cState, DS4StateExposed exposeState, Mouse tp, bool priorMouse=false)
|
||||||
|
{
|
||||||
|
populateFieldMapping(cState, exposeState, tp, priorMouse);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void populateFieldMapping(DS4State cState, DS4StateExposed exposeState, Mouse tp, bool priorMouse = false)
|
||||||
{
|
{
|
||||||
axisdirs[(int)DS4Controls.LXNeg] = cState.LX;
|
axisdirs[(int)DS4Controls.LXNeg] = cState.LX;
|
||||||
axisdirs[(int)DS4Controls.LXPos] = cState.LX;
|
axisdirs[(int)DS4Controls.LXPos] = cState.LX;
|
||||||
@ -98,7 +107,7 @@ namespace DS4Windows
|
|||||||
gryodirs[(int)DS4Controls.GyroZPos] = sixAxisZ > 0 ? sixAxisZ : 0;
|
gryodirs[(int)DS4Controls.GyroZPos] = sixAxisZ > 0 ? sixAxisZ : 0;
|
||||||
gryodirs[(int)DS4Controls.GyroZNeg] = sixAxisZ < 0 ? sixAxisZ : 0;
|
gryodirs[(int)DS4Controls.GyroZNeg] = sixAxisZ < 0 ? sixAxisZ : 0;
|
||||||
|
|
||||||
swipedirs[(int)DS4Controls.SwipeLeft] = tp != null ? (!priorMouse ? tp.swipeLeftB : tp.priorSwipeLeftB): (byte)0;
|
swipedirs[(int)DS4Controls.SwipeLeft] = tp != null ? (!priorMouse ? tp.swipeLeftB : tp.priorSwipeLeftB) : (byte)0;
|
||||||
swipedirs[(int)DS4Controls.SwipeRight] = tp != null ? (!priorMouse ? tp.swipeRightB : tp.priorSwipeRightB) : (byte)0;
|
swipedirs[(int)DS4Controls.SwipeRight] = tp != null ? (!priorMouse ? tp.swipeRightB : tp.priorSwipeRightB) : (byte)0;
|
||||||
swipedirs[(int)DS4Controls.SwipeUp] = tp != null ? (!priorMouse ? tp.swipeUpB : tp.priorSwipeUpB) : (byte)0;
|
swipedirs[(int)DS4Controls.SwipeUp] = tp != null ? (!priorMouse ? tp.swipeUpB : tp.priorSwipeUpB) : (byte)0;
|
||||||
swipedirs[(int)DS4Controls.SwipeDown] = tp != null ? (!priorMouse ? tp.swipeDownB : tp.priorSwipeDownB) : (byte)0;
|
swipedirs[(int)DS4Controls.SwipeDown] = tp != null ? (!priorMouse ? tp.swipeDownB : tp.priorSwipeDownB) : (byte)0;
|
||||||
|
@ -63,6 +63,16 @@ namespace DS4Windows
|
|||||||
{ new SyntheticState(), new SyntheticState(), new SyntheticState(),
|
{ new SyntheticState(), new SyntheticState(), new SyntheticState(),
|
||||||
new SyntheticState() };
|
new SyntheticState() };
|
||||||
|
|
||||||
|
public static DS4StateFieldMapping[] fieldMappings = new DS4StateFieldMapping[4] {
|
||||||
|
new DS4StateFieldMapping(), new DS4StateFieldMapping(), new DS4StateFieldMapping(),
|
||||||
|
new DS4StateFieldMapping()
|
||||||
|
};
|
||||||
|
public static DS4StateFieldMapping[] outputFieldMappings = new DS4StateFieldMapping[4]
|
||||||
|
{
|
||||||
|
new DS4StateFieldMapping(), new DS4StateFieldMapping(), new DS4StateFieldMapping(),
|
||||||
|
new DS4StateFieldMapping()
|
||||||
|
};
|
||||||
|
|
||||||
// TODO When we disconnect, process a null/dead state to release any keys or buttons.
|
// TODO When we disconnect, process a null/dead state to release any keys or buttons.
|
||||||
public static DateTime oldnow = DateTime.UtcNow;
|
public static DateTime oldnow = DateTime.UtcNow;
|
||||||
private static bool pressagain = false;
|
private static bool pressagain = false;
|
||||||
@ -1097,8 +1107,12 @@ namespace DS4Windows
|
|||||||
int mouseDeltaY = 0;
|
int mouseDeltaY = 0;
|
||||||
|
|
||||||
cState.calculateStickAngles();
|
cState.calculateStickAngles();
|
||||||
DS4StateFieldMapping fieldMapping = new DS4StateFieldMapping(cState, eState, tp);
|
DS4StateFieldMapping fieldMapping = fieldMappings[device];
|
||||||
DS4StateFieldMapping outputfieldMapping = new DS4StateFieldMapping(cState, eState, tp);
|
fieldMapping.populateFieldMapping(cState, eState, tp);
|
||||||
|
DS4StateFieldMapping outputfieldMapping = outputFieldMappings[device];
|
||||||
|
outputfieldMapping.populateFieldMapping(cState, eState, tp);
|
||||||
|
//DS4StateFieldMapping fieldMapping = new DS4StateFieldMapping(cState, eState, tp);
|
||||||
|
//DS4StateFieldMapping outputfieldMapping = new DS4StateFieldMapping(cState, eState, tp);
|
||||||
|
|
||||||
SyntheticState deviceState = Mapping.deviceState[device];
|
SyntheticState deviceState = Mapping.deviceState[device];
|
||||||
if (getProfileActionCount(device) > 0 || !string.IsNullOrEmpty(tempprofilename[device]))
|
if (getProfileActionCount(device) > 0 || !string.IsNullOrEmpty(tempprofilename[device]))
|
||||||
|
@ -22,7 +22,6 @@ namespace DS4Windows
|
|||||||
public class DS4ControlSettings
|
public class DS4ControlSettings
|
||||||
{
|
{
|
||||||
public DS4Controls control;
|
public DS4Controls control;
|
||||||
//public string extras = "0,0,0,0,0,0,0,0";
|
|
||||||
public string extras = null;
|
public string extras = null;
|
||||||
public DS4KeyType keyType = DS4KeyType.None;
|
public DS4KeyType keyType = DS4KeyType.None;
|
||||||
public enum ActionType : byte { Default, Key, Button, Macro };
|
public enum ActionType : byte { Default, Key, Button, Macro };
|
||||||
@ -31,7 +30,6 @@ namespace DS4Windows
|
|||||||
public ActionType shiftActionType = ActionType.Default;
|
public ActionType shiftActionType = ActionType.Default;
|
||||||
public object shiftAction = null;
|
public object shiftAction = null;
|
||||||
public int shiftTrigger = 0;
|
public int shiftTrigger = 0;
|
||||||
//public string shiftExtras = "0,0,0,0,0,0,0,0";
|
|
||||||
public string shiftExtras = null;
|
public string shiftExtras = null;
|
||||||
public DS4KeyType shiftKeyType = DS4KeyType.None;
|
public DS4KeyType shiftKeyType = DS4KeyType.None;
|
||||||
|
|
||||||
@ -42,7 +40,6 @@ namespace DS4Windows
|
|||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
//extras = "0,0,0,0,0,0,0,0";
|
|
||||||
extras = null;
|
extras = null;
|
||||||
keyType = DS4KeyType.None;
|
keyType = DS4KeyType.None;
|
||||||
actionType = ActionType.Default;
|
actionType = ActionType.Default;
|
||||||
@ -50,7 +47,6 @@ namespace DS4Windows
|
|||||||
shiftActionType = ActionType.Default;
|
shiftActionType = ActionType.Default;
|
||||||
shiftAction = null;
|
shiftAction = null;
|
||||||
shiftTrigger = 0;
|
shiftTrigger = 0;
|
||||||
//shiftExtras = "0,0,0,0,0,0,0,0";
|
|
||||||
shiftExtras = null;
|
shiftExtras = null;
|
||||||
shiftKeyType = DS4KeyType.None;
|
shiftKeyType = DS4KeyType.None;
|
||||||
}
|
}
|
||||||
@ -94,16 +90,16 @@ namespace DS4Windows
|
|||||||
public class DebugEventArgs : EventArgs
|
public class DebugEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
protected DateTime m_Time = DateTime.Now;
|
protected DateTime m_Time = DateTime.Now;
|
||||||
protected String m_Data = String.Empty;
|
protected string m_Data = string.Empty;
|
||||||
protected bool warning = false;
|
protected bool warning = false;
|
||||||
public DebugEventArgs(String Data, bool warn)
|
public DebugEventArgs(string Data, bool warn)
|
||||||
{
|
{
|
||||||
m_Data = Data;
|
m_Data = Data;
|
||||||
warning = warn;
|
warning = warn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime Time => m_Time;
|
public DateTime Time => m_Time;
|
||||||
public String Data => m_Data;
|
public string Data => m_Data;
|
||||||
public bool Warning => warning;
|
public bool Warning => warning;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +118,7 @@ namespace DS4Windows
|
|||||||
public class ReportEventArgs : EventArgs
|
public class ReportEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
protected Ds3PadId m_Pad = Ds3PadId.None;
|
protected Ds3PadId m_Pad = Ds3PadId.None;
|
||||||
protected Byte[] m_Report = new Byte[64];
|
protected byte[] m_Report = new byte[64];
|
||||||
|
|
||||||
public ReportEventArgs()
|
public ReportEventArgs()
|
||||||
{
|
{
|
||||||
@ -2519,13 +2515,17 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
XmlNode ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/Button");
|
XmlNode ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/Button");
|
||||||
if (ParentItem != null)
|
if (ParentItem != null)
|
||||||
|
{
|
||||||
foreach (XmlNode item in ParentItem.ChildNodes)
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
||||||
{
|
{
|
||||||
UpdateDS4CSetting(device, item.Name, false, getX360ControlsByName(item.InnerText), "", DS4KeyType.None, 0);
|
UpdateDS4CSetting(device, item.Name, false, getX360ControlsByName(item.InnerText), "", DS4KeyType.None, 0);
|
||||||
customMapButtons.Add(getDS4ControlsByName(item.Name), getX360ControlsByName(item.InnerText));
|
customMapButtons.Add(getDS4ControlsByName(item.Name), getX360ControlsByName(item.InnerText));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/Macro");
|
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/Macro");
|
||||||
if (ParentItem != null)
|
if (ParentItem != null)
|
||||||
|
{
|
||||||
foreach (XmlNode item in ParentItem.ChildNodes)
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
||||||
{
|
{
|
||||||
customMapMacros.Add(getDS4ControlsByName(item.Name), item.InnerText);
|
customMapMacros.Add(getDS4ControlsByName(item.Name), item.InnerText);
|
||||||
@ -2541,21 +2541,32 @@ namespace DS4Windows
|
|||||||
skeys = new string[0];
|
skeys = new string[0];
|
||||||
keys = new int[0];
|
keys = new int[0];
|
||||||
}
|
}
|
||||||
for (int i = 0; i < keys.Length; i++)
|
|
||||||
|
for (int i = 0, keylen = keys.Length; i < keylen; i++)
|
||||||
keys[i] = int.Parse(skeys[i]);
|
keys[i] = int.Parse(skeys[i]);
|
||||||
|
|
||||||
UpdateDS4CSetting(device, item.Name, false, keys, "", DS4KeyType.None, 0);
|
UpdateDS4CSetting(device, item.Name, false, keys, "", DS4KeyType.None, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/Key");
|
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/Key");
|
||||||
if (ParentItem != null)
|
if (ParentItem != null)
|
||||||
|
{
|
||||||
foreach (XmlNode item in ParentItem.ChildNodes)
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
||||||
|
{
|
||||||
if (ushort.TryParse(item.InnerText, out wvk))
|
if (ushort.TryParse(item.InnerText, out wvk))
|
||||||
{
|
{
|
||||||
UpdateDS4CSetting(device, item.Name, false, wvk, "", DS4KeyType.None, 0);
|
UpdateDS4CSetting(device, item.Name, false, wvk, "", DS4KeyType.None, 0);
|
||||||
customMapKeys.Add(getDS4ControlsByName(item.Name), wvk);
|
customMapKeys.Add(getDS4ControlsByName(item.Name), wvk);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/Extras");
|
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/Extras");
|
||||||
if (ParentItem != null)
|
if (ParentItem != null)
|
||||||
|
{
|
||||||
foreach (XmlNode item in ParentItem.ChildNodes)
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
||||||
|
{
|
||||||
if (item.InnerText != string.Empty)
|
if (item.InnerText != string.Empty)
|
||||||
{
|
{
|
||||||
UpdateDS4CExtra(device, item.Name, false, item.InnerText);
|
UpdateDS4CExtra(device, item.Name, false, item.InnerText);
|
||||||
@ -2563,9 +2574,14 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
ParentItem.RemoveChild(item);
|
ParentItem.RemoveChild(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/KeyType");
|
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/KeyType");
|
||||||
if (ParentItem != null)
|
if (ParentItem != null)
|
||||||
|
{
|
||||||
foreach (XmlNode item in ParentItem.ChildNodes)
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
||||||
|
{
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
keyType = DS4KeyType.None;
|
keyType = DS4KeyType.None;
|
||||||
@ -2585,9 +2601,12 @@ namespace DS4Windows
|
|||||||
customMapKeyTypes.Add(getDS4ControlsByName(item.Name), keyType);
|
customMapKeyTypes.Add(getDS4ControlsByName(item.Name), keyType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/ShiftControl/Button");
|
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/ShiftControl/Button");
|
||||||
if (ParentItem != null)
|
if (ParentItem != null)
|
||||||
|
{
|
||||||
foreach (XmlElement item in ParentItem.ChildNodes)
|
foreach (XmlElement item in ParentItem.ChildNodes)
|
||||||
{
|
{
|
||||||
int shiftT = shiftM;
|
int shiftT = shiftM;
|
||||||
@ -2596,8 +2615,11 @@ namespace DS4Windows
|
|||||||
UpdateDS4CSetting(device, item.Name, true, getX360ControlsByName(item.InnerText), "", DS4KeyType.None, shiftT);
|
UpdateDS4CSetting(device, item.Name, true, getX360ControlsByName(item.InnerText), "", DS4KeyType.None, shiftT);
|
||||||
shiftCustomMapButtons.Add(getDS4ControlsByName(item.Name), getX360ControlsByName(item.InnerText));
|
shiftCustomMapButtons.Add(getDS4ControlsByName(item.Name), getX360ControlsByName(item.InnerText));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/ShiftControl/Macro");
|
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/ShiftControl/Macro");
|
||||||
if (ParentItem != null)
|
if (ParentItem != null)
|
||||||
|
{
|
||||||
foreach (XmlElement item in ParentItem.ChildNodes)
|
foreach (XmlElement item in ParentItem.ChildNodes)
|
||||||
{
|
{
|
||||||
shiftCustomMapMacros.Add(getDS4ControlsByName(item.Name), item.InnerText);
|
shiftCustomMapMacros.Add(getDS4ControlsByName(item.Name), item.InnerText);
|
||||||
@ -2613,16 +2635,22 @@ namespace DS4Windows
|
|||||||
skeys = new string[0];
|
skeys = new string[0];
|
||||||
keys = new int[0];
|
keys = new int[0];
|
||||||
}
|
}
|
||||||
for (int i = 0; i < keys.Length; i++)
|
|
||||||
|
for (int i = 0, keylen = keys.Length; i < keylen; i++)
|
||||||
keys[i] = int.Parse(skeys[i]);
|
keys[i] = int.Parse(skeys[i]);
|
||||||
|
|
||||||
int shiftT = shiftM;
|
int shiftT = shiftM;
|
||||||
if (item.HasAttribute("Trigger"))
|
if (item.HasAttribute("Trigger"))
|
||||||
int.TryParse(item.Attributes["Trigger"].Value, out shiftT);
|
int.TryParse(item.Attributes["Trigger"].Value, out shiftT);
|
||||||
UpdateDS4CSetting(device, item.Name, true, keys, "", DS4KeyType.None, shiftT);
|
UpdateDS4CSetting(device, item.Name, true, keys, "", DS4KeyType.None, shiftT);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/ShiftControl/Key");
|
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/ShiftControl/Key");
|
||||||
if (ParentItem != null)
|
if (ParentItem != null)
|
||||||
|
{
|
||||||
foreach (XmlElement item in ParentItem.ChildNodes)
|
foreach (XmlElement item in ParentItem.ChildNodes)
|
||||||
|
{
|
||||||
if (ushort.TryParse(item.InnerText, out wvk))
|
if (ushort.TryParse(item.InnerText, out wvk))
|
||||||
{
|
{
|
||||||
int shiftT = shiftM;
|
int shiftT = shiftM;
|
||||||
@ -2631,9 +2659,14 @@ namespace DS4Windows
|
|||||||
UpdateDS4CSetting(device, item.Name, true, wvk, "", DS4KeyType.None, shiftT);
|
UpdateDS4CSetting(device, item.Name, true, wvk, "", DS4KeyType.None, shiftT);
|
||||||
shiftCustomMapKeys.Add(getDS4ControlsByName(item.Name), wvk);
|
shiftCustomMapKeys.Add(getDS4ControlsByName(item.Name), wvk);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/ShiftControl/Extras");
|
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/ShiftControl/Extras");
|
||||||
if (ParentItem != null)
|
if (ParentItem != null)
|
||||||
|
{
|
||||||
foreach (XmlElement item in ParentItem.ChildNodes)
|
foreach (XmlElement item in ParentItem.ChildNodes)
|
||||||
|
{
|
||||||
if (item.InnerText != string.Empty)
|
if (item.InnerText != string.Empty)
|
||||||
{
|
{
|
||||||
UpdateDS4CExtra(device, item.Name, true, item.InnerText);
|
UpdateDS4CExtra(device, item.Name, true, item.InnerText);
|
||||||
@ -2641,9 +2674,14 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
ParentItem.RemoveChild(item);
|
ParentItem.RemoveChild(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/ShiftControl/KeyType");
|
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/ShiftControl/KeyType");
|
||||||
if (ParentItem != null)
|
if (ParentItem != null)
|
||||||
|
{
|
||||||
foreach (XmlElement item in ParentItem.ChildNodes)
|
foreach (XmlElement item in ParentItem.ChildNodes)
|
||||||
|
{
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
keyType = DS4KeyType.None;
|
keyType = DS4KeyType.None;
|
||||||
@ -2663,25 +2701,10 @@ namespace DS4Windows
|
|||||||
shiftCustomMapKeyTypes.Add(getDS4ControlsByName(item.Name), keyType);
|
shiftCustomMapKeyTypes.Add(getDS4ControlsByName(item.Name), keyType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//LoadButtons(buttons, "Control", customMapKeyTypes, customMapKeys, customMapButtons, customMapMacros, customMapExtras);
|
}
|
||||||
//LoadButtons(shiftbuttons, "ShiftControl", shiftCustomMapKeyTypes, shiftCustomMapKeys, shiftCustomMapButtons, shiftCustomMapMacros, shiftCustomMapExtras);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//catch { Loaded = false; }
|
|
||||||
/*if (Loaded)
|
|
||||||
{
|
|
||||||
this.customMapButtons[device] = customMapButtons;
|
|
||||||
this.customMapKeys[device] = customMapKeys;
|
|
||||||
this.customMapKeyTypes[device] = customMapKeyTypes;
|
|
||||||
this.customMapMacros[device] = customMapMacros;
|
|
||||||
this.customMapExtras[device] = customMapExtras;
|
|
||||||
|
|
||||||
this.shiftCustomMapButtons[device] = shiftCustomMapButtons;
|
|
||||||
this.shiftCustomMapKeys[device] = shiftCustomMapKeys;
|
|
||||||
this.shiftCustomMapKeyTypes[device] = shiftCustomMapKeyTypes;
|
|
||||||
this.shiftCustomMapMacros[device] = shiftCustomMapMacros;
|
|
||||||
this.shiftCustomMapExtras[device] = shiftCustomMapExtras;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Only add missing settings if the actual load was graceful
|
// Only add missing settings if the actual load was graceful
|
||||||
if (missingSetting && Loaded)// && buttons != null)
|
if (missingSetting && Loaded)// && buttons != null)
|
||||||
@ -2774,10 +2797,12 @@ namespace DS4Windows
|
|||||||
olderProfilePath[3] = profilePath[3];
|
olderProfilePath[3] = profilePath[3];
|
||||||
}
|
}
|
||||||
catch { profilePath[3] = olderProfilePath[3] = string.Empty; distanceProfiles[3] = false; missingSetting = true; }
|
catch { profilePath[3] = olderProfilePath[3] = string.Empty; distanceProfiles[3] = false; missingSetting = true; }
|
||||||
|
|
||||||
try { Item = m_Xdoc.SelectSingleNode("/Profile/LastChecked"); DateTime.TryParse(Item.InnerText, out lastChecked); }
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/LastChecked"); DateTime.TryParse(Item.InnerText, out lastChecked); }
|
||||||
catch { missingSetting = true; }
|
catch { missingSetting = true; }
|
||||||
try { Item = m_Xdoc.SelectSingleNode("/Profile/CheckWhen"); Int32.TryParse(Item.InnerText, out CheckWhen); }
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/CheckWhen"); Int32.TryParse(Item.InnerText, out CheckWhen); }
|
||||||
catch { missingSetting = true; }
|
catch { missingSetting = true; }
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Item = m_Xdoc.SelectSingleNode("/Profile/Notifications");
|
Item = m_Xdoc.SelectSingleNode("/Profile/Notifications");
|
||||||
@ -2785,6 +2810,7 @@ namespace DS4Windows
|
|||||||
notifications = (Boolean.Parse(Item.InnerText) ? 2 : 0);
|
notifications = (Boolean.Parse(Item.InnerText) ? 2 : 0);
|
||||||
}
|
}
|
||||||
catch { missingSetting = true; }
|
catch { missingSetting = true; }
|
||||||
|
|
||||||
try { Item = m_Xdoc.SelectSingleNode("/Profile/DisconnectBTAtStop"); Boolean.TryParse(Item.InnerText, out disconnectBTAtStop); }
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/DisconnectBTAtStop"); Boolean.TryParse(Item.InnerText, out disconnectBTAtStop); }
|
||||||
catch { missingSetting = true; }
|
catch { missingSetting = true; }
|
||||||
try { Item = m_Xdoc.SelectSingleNode("/Profile/SwipeProfiles"); Boolean.TryParse(Item.InnerText, out swipeProfiles); }
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/SwipeProfiles"); Boolean.TryParse(Item.InnerText, out swipeProfiles); }
|
||||||
@ -2805,6 +2831,7 @@ namespace DS4Windows
|
|||||||
catch { missingSetting = true; }
|
catch { missingSetting = true; }
|
||||||
try { Item = m_Xdoc.SelectSingleNode("/Profile/WhiteIcon"); Boolean.TryParse(Item.InnerText, out useWhiteIcon); }
|
try { Item = m_Xdoc.SelectSingleNode("/Profile/WhiteIcon"); Boolean.TryParse(Item.InnerText, out useWhiteIcon); }
|
||||||
catch { missingSetting = true; }
|
catch { missingSetting = true; }
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -2877,9 +2904,6 @@ namespace DS4Windows
|
|||||||
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 xmlCustomLed3 = m_Xdoc.CreateNode(XmlNodeType.Element, "CustomLed3", null); xmlCustomLed3.InnerText = profilePath[2]; Node.AppendChild(xmlCustomLed3);
|
|
||||||
XmlNode xmlCustomLed4 = m_Xdoc.CreateNode(XmlNodeType.Element, "CustomLed4", null); xmlCustomLed4.InnerText = profilePath[3]; Node.AppendChild(xmlCustomLed4);*/
|
|
||||||
|
|
||||||
m_Xdoc.AppendChild(Node);
|
m_Xdoc.AppendChild(Node);
|
||||||
|
|
||||||
@ -3196,7 +3220,6 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
||||||
|
|
||||||
//foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
|
||||||
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
||||||
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
||||||
{
|
{
|
||||||
@ -3217,7 +3240,6 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
||||||
|
|
||||||
//foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
|
||||||
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
||||||
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
||||||
{
|
{
|
||||||
@ -3242,7 +3264,6 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
||||||
|
|
||||||
//foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
|
||||||
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
||||||
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
||||||
{
|
{
|
||||||
@ -3267,7 +3288,6 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
||||||
|
|
||||||
//foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
|
||||||
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
||||||
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
||||||
{
|
{
|
||||||
@ -3312,7 +3332,6 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
||||||
|
|
||||||
//foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
|
||||||
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
||||||
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
||||||
{
|
{
|
||||||
@ -3337,7 +3356,6 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
||||||
|
|
||||||
//foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
|
||||||
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
||||||
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
||||||
{
|
{
|
||||||
@ -3362,7 +3380,6 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
||||||
|
|
||||||
//foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
|
||||||
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
||||||
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
||||||
{
|
{
|
||||||
@ -3395,7 +3412,6 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
dc = (DS4Controls)Enum.Parse(typeof(DS4Controls), buttonName, true);
|
||||||
|
|
||||||
//foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
|
||||||
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
||||||
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
||||||
{
|
{
|
||||||
@ -3422,7 +3438,6 @@ namespace DS4Windows
|
|||||||
|
|
||||||
public bool HasCustomActions(int deviceNum)
|
public bool HasCustomActions(int deviceNum)
|
||||||
{
|
{
|
||||||
//foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
|
||||||
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
||||||
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
||||||
{
|
{
|
||||||
@ -3437,7 +3452,6 @@ namespace DS4Windows
|
|||||||
|
|
||||||
public bool HasCustomExtras(int deviceNum)
|
public bool HasCustomExtras(int deviceNum)
|
||||||
{
|
{
|
||||||
//foreach (DS4ControlSettings dcs in ds4settings[deviceNum])
|
|
||||||
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
List<DS4ControlSettings> ds4settingsList = ds4settings[deviceNum];
|
||||||
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
for (int i = 0, settingsLen = ds4settingsList.Count; i < settingsLen; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user