@ -49,7 +49,13 @@ public class QuakeParms
public void AllocateMemory ( int memorySize )
public void AllocateMemory ( int memorySize )
{
{
memSize = memorySize ;
memSize = memorySize ;
#if UNITY_GAMECORE
memBase = SystemLibrary . HeapAlloc ( SystemLibrary . GetProcessHeap ( ) , 0 , new IntPtr ( memorySize ) ) ;
#else
memBase = Marshal . AllocHGlobal ( memorySize ) ;
memBase = Marshal . AllocHGlobal ( memorySize ) ;
#endif
if ( memBase = = IntPtr . Zero )
if ( memBase = = IntPtr . Zero )
{
{
throw new OutOfMemoryException ( $"Could not allocate {memorySize / 1024 / 1024} MB of heap memory!" ) ;
throw new OutOfMemoryException ( $"Could not allocate {memorySize / 1024 / 1024} MB of heap memory!" ) ;
@ -66,7 +72,11 @@ public class QuakeParms
if ( memBase ! = IntPtr . Zero )
if ( memBase ! = IntPtr . Zero )
{
{
#if UNITY_GAMECORE
SystemLibrary . HeapFree ( SystemLibrary . GetProcessHeap ( ) , 0 , memBase ) ;
#else
Marshal . FreeHGlobal ( memBase ) ;
Marshal . FreeHGlobal ( memBase ) ;
#endif
memBase = IntPtr . Zero ;
memBase = IntPtr . Zero ;
}
}