From 63688885cdf7587ea91353dd04ad36260ca57a69 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Tue, 6 Mar 2018 17:16:46 -0600 Subject: [PATCH] Use unsafe memory pointers for BT output report --- DS4Windows/DS4Library/DS4Device.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/DS4Windows/DS4Library/DS4Device.cs b/DS4Windows/DS4Library/DS4Device.cs index 5eb684b..82f827e 100644 --- a/DS4Windows/DS4Library/DS4Device.cs +++ b/DS4Windows/DS4Library/DS4Device.cs @@ -604,7 +604,7 @@ namespace DS4Windows } private byte outputPendCount = 0; - private void performDs4Output() + private unsafe void performDs4Output() { try { @@ -640,7 +640,12 @@ namespace DS4Windows lock (outReportBuffer) { Monitor.Wait(outReportBuffer); - outReportBuffer.CopyTo(outputReport, 0); + fixed (byte* byteR = outputReport, byteB = outReportBuffer) + { + for (int i = 0, arlen = outputReport.Length; i < arlen; i++) + byteR[i] = byteB[i]; + } + //outReportBuffer.CopyTo(outputReport, 0); outputPendCount--; outputRumble = false; }