mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-25 18:46:58 +01:00
Have Disconnect BT Special Action wait for Idle controller status with SONYWA
Related to issue #1079
This commit is contained in:
parent
3177530ccd
commit
e92a15aa1e
@ -2257,35 +2257,18 @@ namespace DS4Windows
|
||||
if (synced && !d.isCharging())
|
||||
{
|
||||
ConnectionType deviceConn = d.getConnectionType();
|
||||
bool exclusive = /*tempBool =*/ d.isExclusive();
|
||||
//bool exclusive = /*tempBool =*/ d.isExclusive();
|
||||
if (deviceConn == ConnectionType.BT)
|
||||
{
|
||||
d.DisconnectBT();
|
||||
}
|
||||
else if (deviceConn == ConnectionType.SONYWA && exclusive)
|
||||
{
|
||||
d.DisconnectDongle();
|
||||
}
|
||||
|
||||
//foreach (DS4Controls dc in action.trigger)
|
||||
for (int i = 0, arlen = action.trigger.Count; i < arlen; i++)
|
||||
{
|
||||
DS4Controls dc = action.trigger[i];
|
||||
DS4ControlSettings dcs = getDS4CSetting(device, dc);
|
||||
if (dcs.action != null)
|
||||
{
|
||||
if (dcs.actionType == DS4ControlSettings.ActionType.Key)
|
||||
InputMethods.performKeyRelease((ushort)dcs.action);
|
||||
else if (dcs.actionType == DS4ControlSettings.ActionType.Macro)
|
||||
{
|
||||
int[] keys = (int[])dcs.action;
|
||||
for (int j = 0, keysLen = keys.Length; j < keysLen; j++)
|
||||
InputMethods.performKeyRelease((ushort)keys[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
ReleaseActionKeys(action, device);
|
||||
return;
|
||||
}
|
||||
else if (deviceConn == ConnectionType.SONYWA)
|
||||
{
|
||||
action.pressRelease = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (action.typeID == SpecialAction.ActionTypeId.BatteryCheck)
|
||||
{
|
||||
@ -2354,6 +2337,22 @@ namespace DS4Windows
|
||||
actionDone[index].dev[device] = false;
|
||||
}
|
||||
}
|
||||
else if (action.typeID == SpecialAction.ActionTypeId.DisconnectBT && action.pressRelease)
|
||||
{
|
||||
actionFound = true;
|
||||
DS4Device d = ctrl.DS4Controllers[device];
|
||||
ConnectionType deviceConn = d.getConnectionType();
|
||||
if (deviceConn == ConnectionType.SONYWA && d.isSynced())
|
||||
{
|
||||
if (d.isDS4Idle())
|
||||
{
|
||||
d.DisconnectDongle();
|
||||
ReleaseActionKeys(action, device);
|
||||
actionDone[index].dev[device] = false;
|
||||
action.pressRelease = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (action.typeID != SpecialAction.ActionTypeId.Key &&
|
||||
action.typeID != SpecialAction.ActionTypeId.XboxGameDVR &&
|
||||
action.typeID != SpecialAction.ActionTypeId.MultiAction)
|
||||
@ -2625,6 +2624,27 @@ namespace DS4Windows
|
||||
}
|
||||
}
|
||||
|
||||
private static void ReleaseActionKeys(SpecialAction action, int device)
|
||||
{
|
||||
//foreach (DS4Controls dc in action.trigger)
|
||||
for (int i = 0, arlen = action.trigger.Count; i < arlen; i++)
|
||||
{
|
||||
DS4Controls dc = action.trigger[i];
|
||||
DS4ControlSettings dcs = getDS4CSetting(device, dc);
|
||||
if (dcs.action != null)
|
||||
{
|
||||
if (dcs.actionType == DS4ControlSettings.ActionType.Key)
|
||||
InputMethods.performKeyRelease((ushort)dcs.action);
|
||||
else if (dcs.actionType == DS4ControlSettings.ActionType.Macro)
|
||||
{
|
||||
int[] keys = (int[])dcs.action;
|
||||
for (int j = 0, keysLen = keys.Length; j < keysLen; j++)
|
||||
InputMethods.performKeyRelease((ushort)keys[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Play macro as a background task. Optionally the new macro play waits for completion of a previous macro execution (synchronized macro special action).
|
||||
// Macro steps are defined either as macrostr string value, macroLst list<int> object or as macroArr integer array. Only one of these should have a valid macro definition when this method is called.
|
||||
// If the macro definition is a macroStr string value then it will be converted as integer array on the fl. If steps are already defined as list or array of integers then there is no need to do type cast conversion.
|
||||
|
Loading…
Reference in New Issue
Block a user