mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-24 23:51:49 +01:00
Fix issue with actions not executing. Cache information for action execution.
This commit is contained in:
parent
9eafb54dbc
commit
54ffcf0201
@ -13,21 +13,22 @@ namespace DS4Windows
|
|||||||
public class ControlService
|
public class ControlService
|
||||||
{
|
{
|
||||||
public X360Device x360Bus;
|
public X360Device x360Bus;
|
||||||
public DS4Device[] DS4Controllers = new DS4Device[4];
|
public const int DS4_CONTROLLER_COUNT = 4;
|
||||||
public Mouse[] touchPad = new Mouse[4];
|
public DS4Device[] DS4Controllers = new DS4Device[DS4_CONTROLLER_COUNT];
|
||||||
|
public Mouse[] touchPad = new Mouse[DS4_CONTROLLER_COUNT];
|
||||||
private bool running = false;
|
private bool running = false;
|
||||||
private DS4State[] MappedState = new DS4State[4];
|
private DS4State[] MappedState = new DS4State[DS4_CONTROLLER_COUNT];
|
||||||
private DS4State[] CurrentState = new DS4State[4];
|
private DS4State[] CurrentState = new DS4State[DS4_CONTROLLER_COUNT];
|
||||||
private DS4State[] PreviousState = new DS4State[4];
|
private DS4State[] PreviousState = new DS4State[DS4_CONTROLLER_COUNT];
|
||||||
public DS4StateExposed[] ExposedState = new DS4StateExposed[4];
|
public DS4StateExposed[] ExposedState = new DS4StateExposed[DS4_CONTROLLER_COUNT];
|
||||||
public bool recordingMacro = false;
|
public bool recordingMacro = false;
|
||||||
public event EventHandler<DebugEventArgs> Debug = null;
|
public event EventHandler<DebugEventArgs> Debug = null;
|
||||||
public bool eastertime = false;
|
public bool eastertime = false;
|
||||||
private int eCode = 0;
|
private int eCode = 0;
|
||||||
bool[] buttonsdown = { false, false, false, false };
|
bool[] buttonsdown = { false, false, false, false };
|
||||||
List<DS4Controls> dcs = new List<DS4Controls>();
|
List<DS4Controls> dcs = new List<DS4Controls>();
|
||||||
bool[] held = new bool[4];
|
bool[] held = new bool[DS4_CONTROLLER_COUNT];
|
||||||
int[] oldmouse = new int[4] { -1, -1, -1, -1 };
|
int[] oldmouse = new int[DS4_CONTROLLER_COUNT] { -1, -1, -1, -1 };
|
||||||
SoundPlayer sp = new SoundPlayer();
|
SoundPlayer sp = new SoundPlayer();
|
||||||
|
|
||||||
private class X360Data
|
private class X360Data
|
||||||
@ -460,7 +461,7 @@ namespace DS4Windows
|
|||||||
DS4Device device = (DS4Device)sender;
|
DS4Device device = (DS4Device)sender;
|
||||||
|
|
||||||
int ind = -1;
|
int ind = -1;
|
||||||
for (int i = 0, arlength = DS4Controllers.Length; ind == -1 && i < arlength; i++)
|
for (int i = 0, arlength = DS4_CONTROLLER_COUNT; ind == -1 && i < arlength; i++)
|
||||||
if (device == DS4Controllers[i])
|
if (device == DS4Controllers[i])
|
||||||
ind = i;
|
ind = i;
|
||||||
|
|
||||||
@ -504,7 +505,7 @@ namespace DS4Windows
|
|||||||
*/
|
*/
|
||||||
cState = Mapping.SetCurveAndDeadzone(ind, cState);
|
cState = Mapping.SetCurveAndDeadzone(ind, cState);
|
||||||
if (!recordingMacro && (!string.IsNullOrEmpty(tempprofilename[ind]) ||
|
if (!recordingMacro && (!string.IsNullOrEmpty(tempprofilename[ind]) ||
|
||||||
containsCustomAction(ind) || containsCustomExtras(ind) || getProfileActions(ind).Count > 0))
|
containsCustomAction(ind) || containsCustomExtras(ind) || getProfileActionCount(ind) > 0))
|
||||||
{
|
{
|
||||||
Mapping.MapCustom(ind, cState, MappedState[ind], ExposedState[ind], touchPad[ind], this);
|
Mapping.MapCustom(ind, cState, MappedState[ind], ExposedState[ind], touchPad[ind], this);
|
||||||
cState = MappedState[ind];
|
cState = MappedState[ind];
|
||||||
|
@ -785,7 +785,7 @@ namespace DS4Windows
|
|||||||
int MouseDeltaY = 0;
|
int MouseDeltaY = 0;
|
||||||
|
|
||||||
SyntheticState deviceState = Mapping.deviceState[device];
|
SyntheticState deviceState = Mapping.deviceState[device];
|
||||||
if (containsCustomAction(device) && (getProfileActions(device).Count > 0 || !string.IsNullOrEmpty(tempprofilename[device])))
|
if (getProfileActionCount(device) > 0 || !string.IsNullOrEmpty(tempprofilename[device]))
|
||||||
MapCustomAction(device, cState, MappedState, eState, tp, ctrl);
|
MapCustomAction(device, cState, MappedState, eState, tp, ctrl);
|
||||||
if (ctrl.DS4Controllers[device] == null) return;
|
if (ctrl.DS4Controllers[device] == null) return;
|
||||||
|
|
||||||
@ -1193,7 +1193,7 @@ namespace DS4Windows
|
|||||||
|
|
||||||
private static bool IfAxisIsNotModified(int device, bool shift, DS4Controls dc)
|
private static bool IfAxisIsNotModified(int device, bool shift, DS4Controls dc)
|
||||||
{
|
{
|
||||||
return shift ? false : GetDS4Action(device, dc.ToString(), false) == null;
|
return shift ? false : GetDS4Action(device, dc, false) == null;
|
||||||
}
|
}
|
||||||
public static async void MapCustomAction(int device, DS4State cState, DS4State MappedState, DS4StateExposed eState, Mouse tp, ControlService ctrl)
|
public static async void MapCustomAction(int device, DS4State cState, DS4State MappedState, DS4StateExposed eState, Mouse tp, ControlService ctrl)
|
||||||
{
|
{
|
||||||
@ -1204,8 +1204,10 @@ namespace DS4Windows
|
|||||||
foreach (string actionname in profileActions)
|
foreach (string actionname in profileActions)
|
||||||
{
|
{
|
||||||
//DS4KeyType keyType = getShiftCustomKeyType(device, customKey.Key);
|
//DS4KeyType keyType = getShiftCustomKeyType(device, customKey.Key);
|
||||||
SpecialAction action = GetAction(actionname);
|
//SpecialAction action = GetAction(actionname);
|
||||||
int index = GetActionIndexOf(actionname);
|
//int index = GetActionIndexOf(actionname);
|
||||||
|
SpecialAction action = GetProfileAction(device, actionname);
|
||||||
|
int index = GetProfileActionIndexOf(device, actionname);
|
||||||
int actionDoneCount = actionDone.Count;
|
int actionDoneCount = actionDone.Count;
|
||||||
if (actionDoneCount < index + 1)
|
if (actionDoneCount < index + 1)
|
||||||
actionDone.Add(new ActionState());
|
actionDone.Add(new ActionState());
|
||||||
@ -1214,7 +1216,7 @@ namespace DS4Windows
|
|||||||
double time = 0.0;
|
double time = 0.0;
|
||||||
//If a key or button is assigned to the trigger, a key special action is used like
|
//If a key or button is assigned to the trigger, a key special action is used like
|
||||||
//a quick tap to use and hold to use the regular custom button/key
|
//a quick tap to use and hold to use the regular custom button/key
|
||||||
bool triggerToBeTapped = action.type == "Key" && action.trigger.Count == 1 &&
|
bool triggerToBeTapped = action.typeID == SpecialAction.ActionTypeId.None && action.trigger.Count == 1 &&
|
||||||
GetDS4Action(device, action.trigger[0], false) == null;
|
GetDS4Action(device, action.trigger[0], false) == null;
|
||||||
if (!(action.name == "null" || index < 0))
|
if (!(action.name == "null" || index < 0))
|
||||||
{
|
{
|
||||||
@ -1292,7 +1294,7 @@ namespace DS4Windows
|
|||||||
|
|
||||||
bool utriggeractivated = true;
|
bool utriggeractivated = true;
|
||||||
int uTriggerCount = action.uTrigger.Count;
|
int uTriggerCount = action.uTrigger.Count;
|
||||||
if (action.type == "Key" && uTriggerCount > 0)
|
if (action.typeID == SpecialAction.ActionTypeId.Key && uTriggerCount > 0)
|
||||||
{
|
{
|
||||||
foreach (DS4Controls dc in action.uTrigger)
|
foreach (DS4Controls dc in action.uTrigger)
|
||||||
{
|
{
|
||||||
@ -1305,7 +1307,7 @@ namespace DS4Windows
|
|||||||
if (action.pressRelease) utriggeractivated = !utriggeractivated;
|
if (action.pressRelease) utriggeractivated = !utriggeractivated;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (triggeractivated && action.type == "Program")
|
if (triggeractivated && action.typeID == SpecialAction.ActionTypeId.Program)
|
||||||
{
|
{
|
||||||
if (!actionDone[index].dev[device])
|
if (!actionDone[index].dev[device])
|
||||||
{
|
{
|
||||||
@ -1316,7 +1318,7 @@ namespace DS4Windows
|
|||||||
Process.Start(action.details);
|
Process.Start(action.details);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (triggeractivated && action.type == "Profile")
|
else if (triggeractivated && action.typeID == SpecialAction.ActionTypeId.Profile)
|
||||||
{
|
{
|
||||||
if (!actionDone[index].dev[device] && string.IsNullOrEmpty(tempprofilename[device]))
|
if (!actionDone[index].dev[device] && string.IsNullOrEmpty(tempprofilename[device]))
|
||||||
{
|
{
|
||||||
@ -1342,7 +1344,7 @@ namespace DS4Windows
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (triggeractivated && action.type == "Macro")
|
else if (triggeractivated && action.typeID == SpecialAction.ActionTypeId.Macro)
|
||||||
{
|
{
|
||||||
if (!actionDone[index].dev[device])
|
if (!actionDone[index].dev[device])
|
||||||
{
|
{
|
||||||
@ -1355,7 +1357,7 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
EndMacro(device, macroControl, String.Join("/", action.macro), DS4Controls.None);
|
EndMacro(device, macroControl, String.Join("/", action.macro), DS4Controls.None);
|
||||||
}
|
}
|
||||||
else if (triggeractivated && action.type == "Key")
|
else if (triggeractivated && action.typeID == SpecialAction.ActionTypeId.Key)
|
||||||
{
|
{
|
||||||
if (uTriggerCount == 0 || (uTriggerCount > 0 && untriggerindex[device] == -1 && !actionDone[index].dev[device]))
|
if (uTriggerCount == 0 || (uTriggerCount > 0 && untriggerindex[device] == -1 && !actionDone[index].dev[device]))
|
||||||
{
|
{
|
||||||
@ -1380,7 +1382,7 @@ namespace DS4Windows
|
|||||||
InputMethods.performKeyPress(key);
|
InputMethods.performKeyPress(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (uTriggerCount > 0 && utriggeractivated && action.type == "Key")
|
else if (uTriggerCount > 0 && utriggeractivated && action.typeID == SpecialAction.ActionTypeId.Key)
|
||||||
{
|
{
|
||||||
if (untriggerindex[device] > -1 && !actionDone[index].dev[device])
|
if (untriggerindex[device] > -1 && !actionDone[index].dev[device])
|
||||||
{
|
{
|
||||||
@ -1394,7 +1396,7 @@ namespace DS4Windows
|
|||||||
InputMethods.performKeyRelease(key);
|
InputMethods.performKeyRelease(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (triggeractivated && action.type == "DisconnectBT")
|
else if (triggeractivated && action.typeID == SpecialAction.ActionTypeId.DisconnectBT)
|
||||||
{
|
{
|
||||||
DS4Device d = ctrl.DS4Controllers[device];
|
DS4Device d = ctrl.DS4Controllers[device];
|
||||||
if (!d.Charging)
|
if (!d.Charging)
|
||||||
@ -1418,7 +1420,7 @@ namespace DS4Windows
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (triggeractivated && action.type == "BatteryCheck")
|
else if (triggeractivated && action.typeID == SpecialAction.ActionTypeId.BatteryCheck)
|
||||||
{
|
{
|
||||||
string[] dets = action.details.Split('|');
|
string[] dets = action.details.Split('|');
|
||||||
if (dets.Length == 1)
|
if (dets.Length == 1)
|
||||||
@ -1444,7 +1446,7 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
actionDone[index].dev[device] = true;
|
actionDone[index].dev[device] = true;
|
||||||
}
|
}
|
||||||
else if (!triggeractivated && action.type == "BatteryCheck")
|
else if (!triggeractivated && action.typeID == SpecialAction.ActionTypeId.BatteryCheck)
|
||||||
{
|
{
|
||||||
if (actionDone[index].dev[device])
|
if (actionDone[index].dev[device])
|
||||||
{
|
{
|
||||||
@ -1460,7 +1462,7 @@ namespace DS4Windows
|
|||||||
actionDone[index].dev[device] = false;
|
actionDone[index].dev[device] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (action.type == "XboxGameDVR" || action.type == "MultiAction")
|
else if (action.typeID == SpecialAction.ActionTypeId.XboxGameDVR || action.typeID == SpecialAction.ActionTypeId.MultiAction)
|
||||||
{
|
{
|
||||||
/*if (getCustomButton(device, action.trigger[0]) != X360Controls.Unbound)
|
/*if (getCustomButton(device, action.trigger[0]) != X360Controls.Unbound)
|
||||||
getCustomButtons(device)[action.trigger[0]] = X360Controls.Unbound;
|
getCustomButtons(device)[action.trigger[0]] = X360Controls.Unbound;
|
||||||
@ -1505,7 +1507,7 @@ namespace DS4Windows
|
|||||||
string macro = "";
|
string macro = "";
|
||||||
if (tappedOnce) //single tap
|
if (tappedOnce) //single tap
|
||||||
{
|
{
|
||||||
if (action.type == "MultiAction")
|
if (action.typeID == SpecialAction.ActionTypeId.MultiAction)
|
||||||
{
|
{
|
||||||
macro = dets[0];
|
macro = dets[0];
|
||||||
}
|
}
|
||||||
@ -1530,7 +1532,7 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
else if (firstTouch && (DateTime.UtcNow - pastTime) > TimeSpan.FromMilliseconds(1000)) //helddown
|
else if (firstTouch && (DateTime.UtcNow - pastTime) > TimeSpan.FromMilliseconds(1000)) //helddown
|
||||||
{
|
{
|
||||||
if (action.type == "MultiAction")
|
if (action.typeID == SpecialAction.ActionTypeId.MultiAction)
|
||||||
{
|
{
|
||||||
macro = dets[1];
|
macro = dets[1];
|
||||||
}
|
}
|
||||||
@ -1551,7 +1553,7 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
else if (secondtouchbegin) //if double tap
|
else if (secondtouchbegin) //if double tap
|
||||||
{
|
{
|
||||||
if (action.type == "MultiAction")
|
if (action.typeID == SpecialAction.ActionTypeId.MultiAction)
|
||||||
{
|
{
|
||||||
macro = dets[2];
|
macro = dets[2];
|
||||||
}
|
}
|
||||||
@ -1592,7 +1594,7 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (utriggeractivated && action.type == "Profile")
|
if (utriggeractivated && action.typeID == SpecialAction.ActionTypeId.Profile)
|
||||||
{
|
{
|
||||||
if ((action.controls == action.ucontrols && !actionDone[index].dev[device]) || //if trigger and end trigger are the same
|
if ((action.controls == action.ucontrols && !actionDone[index].dev[device]) || //if trigger and end trigger are the same
|
||||||
action.controls != action.ucontrols)
|
action.controls != action.ucontrols)
|
||||||
|
@ -429,6 +429,14 @@ namespace DS4Windows
|
|||||||
public static string[] ProfilePath => m_Config.profilePath;
|
public static string[] ProfilePath => m_Config.profilePath;
|
||||||
public static bool[] DistanceProfiles = m_Config.distanceProfiles;
|
public static bool[] DistanceProfiles = m_Config.distanceProfiles;
|
||||||
public static List<string>[] ProfileActions => m_Config.profileActions;
|
public static List<string>[] ProfileActions => m_Config.profileActions;
|
||||||
|
public static int getProfileActionCount(int index)
|
||||||
|
{
|
||||||
|
return m_Config.profileActionCount[index];
|
||||||
|
}
|
||||||
|
public static void calculateProfileActionCount(int index)
|
||||||
|
{
|
||||||
|
m_Config.profileActionCount[index] = m_Config.profileActions[index].Count;
|
||||||
|
}
|
||||||
public static List<string> getProfileActions(int index)
|
public static List<string> getProfileActions(int index)
|
||||||
{
|
{
|
||||||
return m_Config.profileActions[index];
|
return m_Config.profileActions[index];
|
||||||
@ -490,6 +498,13 @@ namespace DS4Windows
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int GetProfileActionIndexOf(int device, string name)
|
||||||
|
{
|
||||||
|
int index = -1;
|
||||||
|
m_Config.profileActionIndexDict[device].TryGetValue(name, out index);
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
public static SpecialAction GetAction(string name)
|
public static SpecialAction GetAction(string name)
|
||||||
{
|
{
|
||||||
foreach (SpecialAction sA in m_Config.actions)
|
foreach (SpecialAction sA in m_Config.actions)
|
||||||
@ -498,6 +513,24 @@ namespace DS4Windows
|
|||||||
return new SpecialAction("null", "null", "null", "null");
|
return new SpecialAction("null", "null", "null", "null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SpecialAction GetProfileAction(int device, string name)
|
||||||
|
{
|
||||||
|
SpecialAction sA = new SpecialAction("null", "null", "null", "null");
|
||||||
|
m_Config.profileActionDict[device].TryGetValue(name, out sA);
|
||||||
|
return sA;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void calculateProfileActionDicts(int device)
|
||||||
|
{
|
||||||
|
m_Config.profileActionDict[device].Clear();
|
||||||
|
m_Config.profileActionIndexDict[device].Clear();
|
||||||
|
|
||||||
|
foreach (string actionname in m_Config.profileActions[device])
|
||||||
|
{
|
||||||
|
m_Config.profileActionDict[device].Add(actionname, Global.GetAction(actionname));
|
||||||
|
m_Config.profileActionIndexDict[device].Add(actionname, Global.GetActionIndexOf(actionname));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*public static X360Controls getCustomButton(int device, DS4Controls controlName) => m_Config.GetCustomButton(device, controlName);
|
/*public static X360Controls getCustomButton(int device, DS4Controls controlName) => m_Config.GetCustomButton(device, controlName);
|
||||||
|
|
||||||
@ -736,6 +769,9 @@ namespace DS4Windows
|
|||||||
public Dictionary<DS4Controls, X360Controls>[] shiftCustomMapButtons = { null, null, null, null, null };
|
public Dictionary<DS4Controls, X360Controls>[] shiftCustomMapButtons = { null, null, null, null, null };
|
||||||
public Dictionary<DS4Controls, String>[] shiftCustomMapExtras = { null, null, null, null, null };*/
|
public Dictionary<DS4Controls, String>[] shiftCustomMapExtras = { null, null, null, null, null };*/
|
||||||
public List<string>[] profileActions = { null, null, null, null, null };
|
public List<string>[] profileActions = { null, null, null, null, null };
|
||||||
|
public int[] profileActionCount = { 0, 0, 0, 0, 0 };
|
||||||
|
public Dictionary<string, SpecialAction>[] profileActionDict = { new Dictionary<string, SpecialAction>(), new Dictionary<string, SpecialAction>(), new Dictionary<string, SpecialAction>(), new Dictionary<string, SpecialAction>(), new Dictionary<string, SpecialAction>() };
|
||||||
|
public Dictionary<string, int>[] profileActionIndexDict = { new Dictionary<string, int>(), new Dictionary<string, int>(), new Dictionary<string, int>(), new Dictionary<string, int>(), new Dictionary<string, int>() };
|
||||||
public bool downloadLang = true;
|
public bool downloadLang = true;
|
||||||
public bool useWhiteIcon;
|
public bool useWhiteIcon;
|
||||||
public bool flashWhenLate = true;
|
public bool flashWhenLate = true;
|
||||||
@ -767,6 +803,7 @@ namespace DS4Windows
|
|||||||
shiftCustomMapExtras[i] = new Dictionary<DS4Controls, string>();*/
|
shiftCustomMapExtras[i] = new Dictionary<DS4Controls, string>();*/
|
||||||
profileActions[i] = new List<string>();
|
profileActions[i] = new List<string>();
|
||||||
profileActions[i].Add("Disconnect Controller");
|
profileActions[i].Add("Disconnect Controller");
|
||||||
|
profileActionCount[i] = profileActions[i].Count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1627,6 +1664,14 @@ namespace DS4Windows
|
|||||||
|
|
||||||
containsCustomAction[device] = false;
|
containsCustomAction[device] = false;
|
||||||
containsCustomExtras[device] = false;
|
containsCustomExtras[device] = false;
|
||||||
|
profileActionCount[device] = profileActions[device].Count;
|
||||||
|
profileActionDict[device].Clear();
|
||||||
|
profileActionIndexDict[device].Clear();
|
||||||
|
foreach (string actionname in profileActions[device])
|
||||||
|
{
|
||||||
|
profileActionDict[device].Add(actionname, Global.GetAction(actionname));
|
||||||
|
profileActionIndexDict[device].Add(actionname, Global.GetActionIndexOf(actionname));
|
||||||
|
}
|
||||||
|
|
||||||
DS4KeyType keyType;
|
DS4KeyType keyType;
|
||||||
ushort wvk;
|
ushort wvk;
|
||||||
@ -2478,9 +2523,12 @@ namespace DS4Windows
|
|||||||
|
|
||||||
public class SpecialAction
|
public class SpecialAction
|
||||||
{
|
{
|
||||||
|
public enum ActionTypeId { None, Key, Program, Profile, Macro, DisconnectBT, BatteryCheck, MultiAction, XboxGameDVR }
|
||||||
|
|
||||||
public string name;
|
public string name;
|
||||||
public List<DS4Controls> trigger = new List<DS4Controls>();
|
public List<DS4Controls> trigger = new List<DS4Controls>();
|
||||||
public string type;
|
public string type;
|
||||||
|
public ActionTypeId typeID;
|
||||||
public string controls;
|
public string controls;
|
||||||
public List<int> macro = new List<int>();
|
public List<int> macro = new List<int>();
|
||||||
public string details;
|
public string details;
|
||||||
@ -2494,25 +2542,16 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
this.typeID = ActionTypeId.None;
|
||||||
this.controls = controls;
|
this.controls = controls;
|
||||||
delayTime = delay;
|
delayTime = delay;
|
||||||
string[] ctrls = controls.Split('/');
|
string[] ctrls = controls.Split('/');
|
||||||
foreach (string s in ctrls)
|
foreach (string s in ctrls)
|
||||||
trigger.Add(getDS4ControlsByName(s));
|
trigger.Add(getDS4ControlsByName(s));
|
||||||
if (type == "Macro")
|
|
||||||
{
|
if (type == "Key")
|
||||||
string[] macs = details.Split('/');
|
|
||||||
foreach (string s in macs)
|
|
||||||
{
|
|
||||||
int v;
|
|
||||||
if (int.TryParse(s, out v))
|
|
||||||
macro.Add(v);
|
|
||||||
}
|
|
||||||
if (extras.Contains("Scan Code"))
|
|
||||||
keyType |= DS4KeyType.ScanCode;
|
|
||||||
}
|
|
||||||
else if (type == "Key")
|
|
||||||
{
|
{
|
||||||
|
typeID = ActionTypeId.Key;
|
||||||
this.details = details.Split(' ')[0];
|
this.details = details.Split(' ')[0];
|
||||||
if (!string.IsNullOrEmpty(extras))
|
if (!string.IsNullOrEmpty(extras))
|
||||||
{
|
{
|
||||||
@ -2528,12 +2567,43 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
else if (type == "Program")
|
else if (type == "Program")
|
||||||
{
|
{
|
||||||
|
typeID = ActionTypeId.Program;
|
||||||
this.details = details;
|
this.details = details;
|
||||||
if (extras != string.Empty)
|
if (extras != string.Empty)
|
||||||
extra = extras;
|
extra = extras;
|
||||||
}
|
}
|
||||||
|
else if (type == "Profile")
|
||||||
|
{
|
||||||
|
typeID = ActionTypeId.Profile;
|
||||||
|
}
|
||||||
|
else if (type == "Macro")
|
||||||
|
{
|
||||||
|
typeID = ActionTypeId.Macro;
|
||||||
|
string[] macs = details.Split('/');
|
||||||
|
foreach (string s in macs)
|
||||||
|
{
|
||||||
|
int v;
|
||||||
|
if (int.TryParse(s, out v))
|
||||||
|
macro.Add(v);
|
||||||
|
}
|
||||||
|
if (extras.Contains("Scan Code"))
|
||||||
|
keyType |= DS4KeyType.ScanCode;
|
||||||
|
}
|
||||||
|
else if (type == "DisconnectBT")
|
||||||
|
{
|
||||||
|
typeID = ActionTypeId.DisconnectBT;
|
||||||
|
}
|
||||||
|
else if (type == "BatteryCheck")
|
||||||
|
{
|
||||||
|
typeID = ActionTypeId.BatteryCheck;
|
||||||
|
}
|
||||||
|
else if (type == "MultiAction")
|
||||||
|
{
|
||||||
|
typeID = ActionTypeId.MultiAction;
|
||||||
|
}
|
||||||
else if (type == "XboxGameDVR")
|
else if (type == "XboxGameDVR")
|
||||||
{
|
{
|
||||||
|
this.typeID = ActionTypeId.XboxGameDVR;
|
||||||
string[] dets = details.Split(',');
|
string[] dets = details.Split(',');
|
||||||
List<string> macros = new List<string>();
|
List<string> macros = new List<string>();
|
||||||
//string dets = "";
|
//string dets = "";
|
||||||
|
@ -1080,6 +1080,8 @@ namespace DS4Windows
|
|||||||
if (lvi.Checked)
|
if (lvi.Checked)
|
||||||
pactions.Add(lvi.Text);
|
pactions.Add(lvi.Text);
|
||||||
ProfileActions[device] = pactions;
|
ProfileActions[device] = pactions;
|
||||||
|
calculateProfileActionCount(device);
|
||||||
|
calculateProfileActionDicts(device);
|
||||||
pnlTPMouse.Visible = rBTPMouse.Checked;
|
pnlTPMouse.Visible = rBTPMouse.Checked;
|
||||||
pnlSAMouse.Visible = rBSAMouse.Checked;
|
pnlSAMouse.Visible = rBSAMouse.Checked;
|
||||||
fLPTiltControls.Visible = rBSAControls.Checked;
|
fLPTiltControls.Visible = rBSAControls.Checked;
|
||||||
@ -2010,6 +2012,8 @@ namespace DS4Windows
|
|||||||
if (lvi != null && lvi.Checked)
|
if (lvi != null && lvi.Checked)
|
||||||
pactions.Add(lvi.Text);
|
pactions.Add(lvi.Text);
|
||||||
ProfileActions[device] = pactions;
|
ProfileActions[device] = pactions;
|
||||||
|
calculateProfileActionCount(device);
|
||||||
|
calculateProfileActionDicts(device);
|
||||||
/*if (lVActions.Items.Count >= 50)
|
/*if (lVActions.Items.Count >= 50)
|
||||||
{
|
{
|
||||||
btnNewAction.Enabled = false;
|
btnNewAction.Enabled = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user