(6c8ca4a55) Tester's build, January 20th 2020

This commit is contained in:
Juan Pablo Arce
2020-01-20 11:35:15 -03:00
parent e6a08d715b
commit 4a58987eae
47 changed files with 852 additions and 248 deletions
@@ -40,33 +40,41 @@ namespace Steamworks
private static byte[][] BufferPool;
private static int BufferPoolIndex;
private static object BufferMutex = new object();
/// <summary>
/// Returns a buffer. This will get returned and reused later on.
/// </summary>
public static byte[] TakeBuffer( int minSize )
{
if ( BufferPool == null )
int bufferPoolIndex;
lock (BufferMutex)
{
//
// The pool has 8 items.
//
BufferPool = new byte[8][];
if (BufferPool == null)
{
//
// The pool has 8 items.
//
BufferPool = new byte[8][];
for ( int i = 0; i < BufferPool.Length; i++ )
BufferPool[i] = new byte[ 1024 * 128 ];
for (int i = 0; i < BufferPool.Length; i++)
BufferPool[i] = new byte[1024 * 128];
}
BufferPoolIndex++;
if (BufferPoolIndex < 0 || BufferPoolIndex >= BufferPool.Length)
BufferPoolIndex = 0;
bufferPoolIndex = BufferPoolIndex;
}
BufferPoolIndex++;
if ( BufferPoolIndex >= BufferPool.Length )
BufferPoolIndex = 0;
if ( BufferPool[BufferPoolIndex].Length < minSize )
if ( BufferPool[bufferPoolIndex].Length < minSize )
{
BufferPool[BufferPoolIndex] = new byte[minSize + 1024];
BufferPool[bufferPoolIndex] = new byte[minSize + 1024];
}
return BufferPool[BufferPoolIndex];
return BufferPool[bufferPoolIndex];
}
internal unsafe static string MemoryToString( IntPtr ptr )