mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-29 04:24:19 +01:00
Double SocketAsyncEventArgs buffer length
This commit is contained in:
parent
082b201800
commit
40b63c9853
@ -73,6 +73,7 @@ namespace DS4Windows
|
|||||||
private SocketAsyncEventArgs[] argsList;
|
private SocketAsyncEventArgs[] argsList;
|
||||||
private int listInd = 0;
|
private int listInd = 0;
|
||||||
private ReaderWriterLockSlim poolLock = new ReaderWriterLockSlim();
|
private ReaderWriterLockSlim poolLock = new ReaderWriterLockSlim();
|
||||||
|
private const int ARG_BUFFER_LEN = 80;
|
||||||
|
|
||||||
public delegate void GetPadDetail(int padIdx, ref DualShockPadMeta meta);
|
public delegate void GetPadDetail(int padIdx, ref DualShockPadMeta meta);
|
||||||
|
|
||||||
@ -81,8 +82,8 @@ namespace DS4Windows
|
|||||||
public UdpServer(GetPadDetail getPadDetailDel)
|
public UdpServer(GetPadDetail getPadDetailDel)
|
||||||
{
|
{
|
||||||
portInfoGet = getPadDetailDel;
|
portInfoGet = getPadDetailDel;
|
||||||
argsList = new SocketAsyncEventArgs[40];
|
argsList = new SocketAsyncEventArgs[ARG_BUFFER_LEN];
|
||||||
for (int num = 0; num < 40; num++)
|
for (int num = 0; num < ARG_BUFFER_LEN; num++)
|
||||||
{
|
{
|
||||||
SocketAsyncEventArgs args = new SocketAsyncEventArgs();
|
SocketAsyncEventArgs args = new SocketAsyncEventArgs();
|
||||||
args.SetBuffer(new byte[100], 0, 100);
|
args.SetBuffer(new byte[100], 0, 100);
|
||||||
@ -188,7 +189,7 @@ namespace DS4Windows
|
|||||||
int temp = 0;
|
int temp = 0;
|
||||||
poolLock.EnterWriteLock();
|
poolLock.EnterWriteLock();
|
||||||
temp = listInd;
|
temp = listInd;
|
||||||
listInd = ++listInd % 40;
|
listInd = ++listInd % ARG_BUFFER_LEN;
|
||||||
SocketAsyncEventArgs args = argsList[temp];
|
SocketAsyncEventArgs args = argsList[temp];
|
||||||
poolLock.ExitWriteLock();
|
poolLock.ExitWriteLock();
|
||||||
|
|
||||||
@ -682,7 +683,7 @@ namespace DS4Windows
|
|||||||
int temp = 0;
|
int temp = 0;
|
||||||
poolLock.EnterWriteLock();
|
poolLock.EnterWriteLock();
|
||||||
temp = listInd;
|
temp = listInd;
|
||||||
listInd = ++listInd % 40;
|
listInd = ++listInd % ARG_BUFFER_LEN;
|
||||||
SocketAsyncEventArgs args = argsList[temp];
|
SocketAsyncEventArgs args = argsList[temp];
|
||||||
poolLock.ExitWriteLock();
|
poolLock.ExitWriteLock();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user