mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-23 23:21:49 +01:00
Revert back to old disconnect bluetooth behavior
This commit is contained in:
parent
de1b6b223f
commit
44501c24de
@ -1571,7 +1571,7 @@ namespace DS4Windows
|
||||
ConnectionType deviceConn = d.getConnectionType();
|
||||
if (deviceConn == ConnectionType.BT)
|
||||
{
|
||||
d.DisconnectBT(false);
|
||||
d.DisconnectBT();
|
||||
}
|
||||
|
||||
//foreach (DS4Controls dc in action.trigger)
|
||||
|
@ -726,7 +726,7 @@ namespace DS4Windows
|
||||
{
|
||||
if (conType == ConnectionType.BT)
|
||||
{
|
||||
if (DisconnectBT(false))
|
||||
if (DisconnectBT())
|
||||
return; // all done
|
||||
}
|
||||
else if (conType == ConnectionType.SONYWA)
|
||||
@ -835,7 +835,7 @@ namespace DS4Windows
|
||||
}
|
||||
}
|
||||
|
||||
public bool DisconnectBT(bool allThreadsQuit = true)
|
||||
public bool DisconnectBT()
|
||||
{
|
||||
if (Mac != null)
|
||||
{
|
||||
@ -850,6 +850,7 @@ namespace DS4Windows
|
||||
//parse hex byte in reverse order
|
||||
btAddr[5 - i] = Convert.ToByte(sbytes[i], 16);
|
||||
}
|
||||
|
||||
long lbtAddr = BitConverter.ToInt64(btAddr, 0);
|
||||
|
||||
NativeMethods.BLUETOOTH_FIND_RADIO_PARAMS p = new NativeMethods.BLUETOOTH_FIND_RADIO_PARAMS();
|
||||
@ -862,30 +863,27 @@ namespace DS4Windows
|
||||
success = NativeMethods.DeviceIoControl(btHandle, IOCTL_BTH_DISCONNECT_DEVICE, ref lbtAddr, 8, IntPtr.Zero, 0, ref bytesReturned, IntPtr.Zero);
|
||||
NativeMethods.CloseHandle(btHandle);
|
||||
if (!success)
|
||||
{
|
||||
if (!NativeMethods.BluetoothFindNextRadio(searchHandle, ref btHandle))
|
||||
btHandle = IntPtr.Zero;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
NativeMethods.BluetoothFindRadioClose(searchHandle);
|
||||
Console.WriteLine("Disconnect successful: " + success);
|
||||
success = true; // XXX return value indicates failure, but it still works?
|
||||
if(success)
|
||||
if (success)
|
||||
{
|
||||
IsDisconnecting = true;
|
||||
if (allThreadsQuit)
|
||||
{
|
||||
StopUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
StopOutputUpdate();
|
||||
}
|
||||
StopOutputUpdate();
|
||||
|
||||
if (Removal != null)
|
||||
Removal(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -902,6 +900,7 @@ namespace DS4Windows
|
||||
{
|
||||
isDisconnecting = true;
|
||||
StopOutputUpdate();
|
||||
|
||||
if (Removal != null)
|
||||
Removal(this, EventArgs.Empty);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace DS4Windows
|
||||
return deviceInstanceId;
|
||||
}
|
||||
|
||||
//enumerates ds4 controllers in the system
|
||||
// enumerates ds4 controllers in the system
|
||||
public static void findControllers()
|
||||
{
|
||||
lock (Devices)
|
||||
|
Loading…
Reference in New Issue
Block a user