mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-02-18 08:56:20 +01:00
Detect the Sony Wireless Adaptor as its own connection type
This commit is contained in:
parent
f0d3a55bd0
commit
bfbcc15df5
@ -863,6 +863,7 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
case "USB": statPB[Index].Visible = true; statPB[Index].Image = Properties.Resources.USB; toolTip1.SetToolTip(statPB[Index], ""); break;
|
case "USB": statPB[Index].Visible = true; statPB[Index].Image = Properties.Resources.USB; toolTip1.SetToolTip(statPB[Index], ""); break;
|
||||||
case "BT": statPB[Index].Visible = true; statPB[Index].Image = Properties.Resources.BT; toolTip1.SetToolTip(statPB[Index], "Right click to disconnect"); break;
|
case "BT": statPB[Index].Visible = true; statPB[Index].Image = Properties.Resources.BT; toolTip1.SetToolTip(statPB[Index], "Right click to disconnect"); break;
|
||||||
|
case "SONYWA": statPB[Index].Visible = true; statPB[Index].Image = Properties.Resources.DS4_Config_PS; toolTip1.SetToolTip(statPB[Index], ""); break;
|
||||||
default: statPB[Index].Visible = false; toolTip1.SetToolTip(statPB[Index], ""); break;
|
default: statPB[Index].Visible = false; toolTip1.SetToolTip(statPB[Index], ""); break;
|
||||||
}
|
}
|
||||||
Batteries[Index].Text = Program.rootHub.getDS4Battery(Index);
|
Batteries[Index].Text = Program.rootHub.getDS4Battery(Index);
|
||||||
|
@ -87,7 +87,7 @@ namespace DS4Windows
|
|||||||
public override string ToString() => $"Red: {red} Green: {green} Blue: {blue}";
|
public override string ToString() => $"Red: {red} Green: {green} Blue: {blue}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ConnectionType : byte { BT, USB }; // Prioritize Bluetooth when both are connected.
|
public enum ConnectionType : byte { BT, USB, SONYWA }; // Prioritize Bluetooth when both BT and USB are connected.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The haptics engine uses a stack of these states representing the light bar and rumble motor settings.
|
* The haptics engine uses a stack of these states representing the light bar and rumble motor settings.
|
||||||
@ -249,7 +249,20 @@ namespace DS4Windows
|
|||||||
|
|
||||||
public static ConnectionType HidConnectionType(HidDevice hidDevice)
|
public static ConnectionType HidConnectionType(HidDevice hidDevice)
|
||||||
{
|
{
|
||||||
return hidDevice.Capabilities.InputReportByteLength == 64 ? ConnectionType.USB : ConnectionType.BT;
|
ConnectionType result = ConnectionType.USB;
|
||||||
|
if (hidDevice.Capabilities.InputReportByteLength == 64)
|
||||||
|
{
|
||||||
|
if (hidDevice.Capabilities.NumberFeatureDataIndices == 22)
|
||||||
|
{
|
||||||
|
result = ConnectionType.SONYWA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = ConnectionType.BT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DS4Device(HidDevice hidDevice)
|
public DS4Device(HidDevice hidDevice)
|
||||||
@ -454,7 +467,7 @@ namespace DS4Windows
|
|||||||
readTimeout.Interval = 3000.0;
|
readTimeout.Interval = 3000.0;
|
||||||
}
|
}
|
||||||
readTimeout.Enabled = true;
|
readTimeout.Enabled = true;
|
||||||
if (conType != ConnectionType.USB)
|
if (conType == ConnectionType.BT)
|
||||||
{
|
{
|
||||||
//HidDevice.ReadStatus res = hDevice.ReadFile(btInputReport);
|
//HidDevice.ReadStatus res = hDevice.ReadFile(btInputReport);
|
||||||
HidDevice.ReadStatus res = hDevice.ReadAsyncWithFileStream(btInputReport, READ_STREAM_TIMEOUT);
|
HidDevice.ReadStatus res = hDevice.ReadAsyncWithFileStream(btInputReport, READ_STREAM_TIMEOUT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user