mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-05-01 15:52:53 +02:00
parent
0eac27c8d1
commit
79377ced7f
@ -5,6 +5,7 @@ using System.Net;
|
|||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace DS4Windows
|
namespace DS4Windows
|
||||||
{
|
{
|
||||||
@ -70,7 +71,8 @@ namespace DS4Windows
|
|||||||
private bool running;
|
private bool running;
|
||||||
private byte[] recvBuffer = new byte[1024];
|
private byte[] recvBuffer = new byte[1024];
|
||||||
private SocketAsyncEventArgs[] argsList;
|
private SocketAsyncEventArgs[] argsList;
|
||||||
private int listInd = 0;
|
private volatile int listInd = 0;
|
||||||
|
private object poolLock = new object();
|
||||||
|
|
||||||
public delegate void GetPadDetail(int padIdx, ref DualShockPadMeta meta);
|
public delegate void GetPadDetail(int padIdx, ref DualShockPadMeta meta);
|
||||||
|
|
||||||
@ -182,8 +184,14 @@ namespace DS4Windows
|
|||||||
FinishPacket(packetData);
|
FinishPacket(packetData);
|
||||||
|
|
||||||
//try { udpSock.SendTo(packetData, clientEP); }
|
//try { udpSock.SendTo(packetData, clientEP); }
|
||||||
SocketAsyncEventArgs args = argsList[listInd];
|
int temp = 0;
|
||||||
listInd = ++listInd % 20;
|
lock (poolLock)
|
||||||
|
{
|
||||||
|
listInd = ++listInd % 20;
|
||||||
|
temp = listInd;
|
||||||
|
}
|
||||||
|
|
||||||
|
SocketAsyncEventArgs args = argsList[temp];
|
||||||
args.RemoteEndPoint = clientEP;
|
args.RemoteEndPoint = clientEP;
|
||||||
args.SetBuffer(packetData, 0, packetData.Length);
|
args.SetBuffer(packetData, 0, packetData.Length);
|
||||||
try {
|
try {
|
||||||
@ -642,8 +650,14 @@ namespace DS4Windows
|
|||||||
foreach (var cl in clientsList)
|
foreach (var cl in clientsList)
|
||||||
{
|
{
|
||||||
//try { udpSock.SendTo(outputData, cl); }
|
//try { udpSock.SendTo(outputData, cl); }
|
||||||
SocketAsyncEventArgs args = argsList[listInd];
|
int temp = 0;
|
||||||
listInd = ++listInd % 20;
|
lock (poolLock)
|
||||||
|
{
|
||||||
|
listInd = ++listInd % 20;
|
||||||
|
temp = listInd;
|
||||||
|
}
|
||||||
|
|
||||||
|
SocketAsyncEventArgs args = argsList[temp];
|
||||||
args.RemoteEndPoint = cl;
|
args.RemoteEndPoint = cl;
|
||||||
args.SetBuffer(outputData, 0, outputData.Length);
|
args.SetBuffer(outputData, 0, outputData.Length);
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user