Allow Disconnect BT special action to work with Sony dongle connections

This might be temporary
This commit is contained in:
Travis Nickles 2017-06-30 21:29:20 -07:00
parent 2d198d6446
commit b62b490ff1
2 changed files with 14 additions and 3 deletions

View File

@ -130,6 +130,7 @@ namespace DS4Windows
// It is enough to feel a difference during gameplay.
private static int[] rsOutCurveModeArray = { 0, 0, 0, 0 };
private static int[] lsOutCurveModeArray = { 0, 0, 0, 0 };
static bool tempBool = false;
// Special macros
static bool altTabDone = true;
@ -1746,13 +1747,19 @@ namespace DS4Windows
actionFound = true;
DS4Device d = ctrl.DS4Controllers[device];
if (!d.isCharging())
bool synced = tempBool = d.isSynced();
if (synced && !d.isCharging())
{
ConnectionType deviceConn = d.getConnectionType();
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++)

View File

@ -1268,6 +1268,8 @@ namespace DS4Windows
public bool[] gyroSmoothing = { false, false, false, false, false };
public double[] gyroSmoothWeight = { 0.5, 0.5, 0.5, 0.5, 0.5 };
bool tempBool = false;
public BackingStore()
{
for (int i = 0; i < 5; i++)
@ -2352,7 +2354,9 @@ namespace DS4Windows
{
//bool changed = false;
DS4Device tempDevice = control.DS4Controllers[device];
bool exists = tempBool = (tempDevice != null);
bool synced = tempBool = exists ? tempDevice.isSynced() : false;
bool isAlive = tempBool = exists ? tempDevice.IsAlive() : false;
if (dinputOnly[device] != oldUseDInputOnly)
{
if (dinputOnly[device] == true)
@ -2367,7 +2371,7 @@ namespace DS4Windows
//changed = true;
}
else if (tempDevice != null && tempDevice.IsAlive())
else if (synced && isAlive)
{
bool xinputResult = control.x360Bus.Plugin(device);
if (xinputResult)