Changes to how output reports are sent. Mainly affects USB and SONYWA

This commit is contained in:
Travis Nickles 2017-12-10 05:09:15 -06:00
parent 132d411b24
commit 567aa393ae

View File

@ -1028,10 +1028,10 @@ namespace DS4Windows
setHapticState();
bool quitOutputThread = false;
lock (outputReportBuffer)
{
if (conType == ConnectionType.BT)
bool usingBT = conType == ConnectionType.BT;
if (usingBT)
{
Monitor.Enter(outputReportBuffer);
outputReportBuffer[0] = 0x11;
outputReportBuffer[1] = (byte)(0x80 | btPollRate); // input report rate
// enable rumble (0x01), lightbar (0x02), flash (0x04)
@ -1072,9 +1072,8 @@ namespace DS4Windows
outputRumble = false;
outputPendCount = 3;
if (usingBT) { Monitor.Enter(outputReport); }
try
{
lock (outputReport)
{
if (!writeOutput())
{
@ -1082,8 +1081,9 @@ namespace DS4Windows
quitOutputThread = true;
}
}
}
catch { } // If it's dead already, don't worry about it.
if (usingBT) { Monitor.Exit(outputReport); }
}
else
{
@ -1094,14 +1094,16 @@ namespace DS4Windows
if (output || change)
{
if (change)
{
outputPendCount = 3;
}
outputRumble = true;
Monitor.Pulse(outputReportBuffer);
}
}
}
if (usingBT) { Monitor.Exit(outputReportBuffer); }
if (quitOutputThread)
{
StopOutputUpdate();