mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-24 15:41:49 +01:00
Try getting around wait yet again
This commit is contained in:
parent
9ec41b207a
commit
82c3d4beff
@ -328,12 +328,13 @@ namespace DS4Windows
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
exitOutputThread = true;
|
exitOutputThread = true;
|
||||||
lock (outputReport)
|
/*lock (outputReport)
|
||||||
{
|
{
|
||||||
Monitor.PulseAll(outputReport);
|
Monitor.PulseAll(outputReport);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//ds4Output.Interrupt();
|
ds4Output.Interrupt();
|
||||||
ds4Output.Join();
|
ds4Output.Join();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -360,39 +361,46 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
lock (outputReport)
|
lock (outputReport)
|
||||||
{
|
{
|
||||||
int lastError = 0;
|
try
|
||||||
while (!exitOutputThread)
|
|
||||||
{
|
{
|
||||||
bool result = false;
|
int lastError = 0;
|
||||||
if (outputRumble)
|
while (!exitOutputThread)
|
||||||
{
|
{
|
||||||
result = writeOutput();
|
bool result = false;
|
||||||
|
if (outputRumble)
|
||||||
if (!result)
|
|
||||||
{
|
{
|
||||||
int thisError = Marshal.GetLastWin32Error();
|
result = writeOutput();
|
||||||
if (lastError != thisError)
|
|
||||||
|
if (!result)
|
||||||
{
|
{
|
||||||
Console.WriteLine(MacAddress.ToString() + " " + System.DateTime.UtcNow.ToString("o") + "> encountered write failure: " + thisError);
|
int thisError = Marshal.GetLastWin32Error();
|
||||||
lastError = thisError;
|
if (lastError != thisError)
|
||||||
|
{
|
||||||
|
Console.WriteLine(MacAddress.ToString() + " " + System.DateTime.UtcNow.ToString("o") + "> encountered write failure: " + thisError);
|
||||||
|
lastError = thisError;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
outputRumble = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!outputRumble)
|
||||||
{
|
{
|
||||||
outputRumble = false;
|
lastError = 0;
|
||||||
|
Monitor.Wait(outputReport);
|
||||||
|
/*if (testRumble.IsRumbleSet()) // repeat test rumbles periodically; rumble has auto-shut-off in the DS4 firmware
|
||||||
|
Monitor.Wait(outputReport, 10000); // DS4 firmware stops it after 5 seconds, so let the motors rest for that long, too.
|
||||||
|
else
|
||||||
|
Monitor.Wait(outputReport);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (ThreadInterruptedException)
|
||||||
|
{
|
||||||
|
|
||||||
if (!outputRumble)
|
|
||||||
{
|
|
||||||
lastError = 0;
|
|
||||||
Monitor.Wait(outputReport);
|
|
||||||
/*if (testRumble.IsRumbleSet()) // repeat test rumbles periodically; rumble has auto-shut-off in the DS4 firmware
|
|
||||||
Monitor.Wait(outputReport, 10000); // DS4 firmware stops it after 5 seconds, so let the motors rest for that long, too.
|
|
||||||
else
|
|
||||||
Monitor.Wait(outputReport);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user