Use unsafe memory pointers for detecting output report changes

This commit is contained in:
Travis Nickles 2018-03-06 17:01:18 -06:00
parent 895539c787
commit f3a019742d

View File

@ -1089,7 +1089,7 @@ namespace DS4Windows
hDevice.flush_Queue(); hDevice.flush_Queue();
} }
private void sendOutputReport(bool synchronous) private unsafe void sendOutputReport(bool synchronous)
{ {
setTestRumble(); setTestRumble();
setHapticState(); setHapticState();
@ -1161,8 +1161,14 @@ namespace DS4Windows
else else
{ {
bool output = outputPendCount > 0, change = false; bool output = outputPendCount > 0, change = false;
fixed (byte* byteR = outputReport, byteB = outReportBuffer)
{
for (int i = 0, arlen = outputReport.Length; !change && i < arlen; i++) for (int i = 0, arlen = outputReport.Length; !change && i < arlen; i++)
change = outputReport[i] != outReportBuffer[i]; change = byteR[i] != byteB[i];
}
//for (int i = 0, arlen = outputReport.Length; !change && i < arlen; i++)
// change = outputReport[i] != outReportBuffer[i];
if (output || change) if (output || change)
{ {