mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-26 11:04:21 +01:00
Use pre-allocated buffer in UDP server
This commit is contained in:
parent
827fe7c507
commit
1c869647ab
@ -58,6 +58,12 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
private X360Data[] processingData = new X360Data[4];
|
private X360Data[] processingData = new X360Data[4];
|
||||||
|
private byte[][] udpOutBuffers = new byte[4][]
|
||||||
|
{
|
||||||
|
new byte[100], new byte[100],
|
||||||
|
new byte[100], new byte[100]
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
void GetPadDetailForIdx(int padIdx, ref DualShockPadMeta meta)
|
void GetPadDetailForIdx(int padIdx, ref DualShockPadMeta meta)
|
||||||
{
|
{
|
||||||
@ -474,7 +480,7 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
DualShockPadMeta padDetail = new DualShockPadMeta();
|
DualShockPadMeta padDetail = new DualShockPadMeta();
|
||||||
GetPadDetailForIdx(tempIdx, ref padDetail);
|
GetPadDetailForIdx(tempIdx, ref padDetail);
|
||||||
_udpServer.NewReportIncoming(ref padDetail, CurrentState[tempIdx]);
|
_udpServer.NewReportIncoming(ref padDetail, CurrentState[tempIdx], udpOutBuffers[tempIdx]);
|
||||||
};
|
};
|
||||||
device.MotionEvent = tempEvnt;
|
device.MotionEvent = tempEvnt;
|
||||||
|
|
||||||
@ -696,7 +702,7 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
DualShockPadMeta padDetail = new DualShockPadMeta();
|
DualShockPadMeta padDetail = new DualShockPadMeta();
|
||||||
GetPadDetailForIdx(tempIdx, ref padDetail);
|
GetPadDetailForIdx(tempIdx, ref padDetail);
|
||||||
_udpServer.NewReportIncoming(ref padDetail, CurrentState[tempIdx]);
|
_udpServer.NewReportIncoming(ref padDetail, CurrentState[tempIdx], udpOutBuffers[tempIdx]);
|
||||||
};
|
};
|
||||||
device.MotionEvent = tempEvnt;
|
device.MotionEvent = tempEvnt;
|
||||||
|
|
||||||
|
@ -581,7 +581,7 @@ namespace DS4Windows
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NewReportIncoming(ref DualShockPadMeta padMeta, DS4State hidReport)
|
public void NewReportIncoming(ref DualShockPadMeta padMeta, DS4State hidReport, byte[] outputData)
|
||||||
{
|
{
|
||||||
if (!running)
|
if (!running)
|
||||||
return;
|
return;
|
||||||
@ -647,7 +647,7 @@ namespace DS4Windows
|
|||||||
|
|
||||||
unchecked
|
unchecked
|
||||||
{
|
{
|
||||||
byte[] outputData = new byte[100];
|
//byte[] outputData = new byte[100];
|
||||||
int outIdx = BeginPacket(outputData, 1001);
|
int outIdx = BeginPacket(outputData, 1001);
|
||||||
Array.Copy(BitConverter.GetBytes((uint)MessageType.DSUS_PadDataRsp), 0, outputData, outIdx, 4);
|
Array.Copy(BitConverter.GetBytes((uint)MessageType.DSUS_PadDataRsp), 0, outputData, outIdx, 4);
|
||||||
outIdx += 4;
|
outIdx += 4;
|
||||||
|
Loading…
Reference in New Issue
Block a user