mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-19 03:56:10 +08:00
Pieces of the HL2SDK can now be included from Mac OS X (bug 3515, r=ds).
This commit is contained in:
@ -115,12 +115,13 @@ public:
|
|||||||
virtual char *ReadLine( char *pOutput, int maxChars, FileHandle_t file ) { return m_pFileSystemPassThru->ReadLine( pOutput, maxChars, file ); }
|
virtual char *ReadLine( char *pOutput, int maxChars, FileHandle_t file ) { return m_pFileSystemPassThru->ReadLine( pOutput, maxChars, file ); }
|
||||||
virtual int FPrintf( FileHandle_t file, char *pFormat, ... )
|
virtual int FPrintf( FileHandle_t file, char *pFormat, ... )
|
||||||
{
|
{
|
||||||
|
char _fmt[] = "%s";
|
||||||
char str[8192];
|
char str[8192];
|
||||||
va_list marker;
|
va_list marker;
|
||||||
va_start( marker, pFormat );
|
va_start( marker, pFormat );
|
||||||
_vsnprintf( str, sizeof( str ), pFormat, marker );
|
_vsnprintf( str, sizeof( str ), pFormat, marker );
|
||||||
va_end( marker );
|
va_end( marker );
|
||||||
return m_pFileSystemPassThru->FPrintf( file, "%s", str );
|
return m_pFileSystemPassThru->FPrintf( file, _fmt, str );
|
||||||
}
|
}
|
||||||
virtual CSysModule *LoadModule( const char *pFileName, const char *pPathID, bool bValidatedDllOnly ) { return m_pFileSystemPassThru->LoadModule( pFileName, pPathID, bValidatedDllOnly ); }
|
virtual CSysModule *LoadModule( const char *pFileName, const char *pPathID, bool bValidatedDllOnly ) { return m_pFileSystemPassThru->LoadModule( pFileName, pPathID, bValidatedDllOnly ); }
|
||||||
virtual void UnloadModule( CSysModule *pModule ) { m_pFileSystemPassThru->UnloadModule( pModule ); }
|
virtual void UnloadModule( CSysModule *pModule ) { m_pFileSystemPassThru->UnloadModule( pModule ); }
|
||||||
|
@ -64,6 +64,9 @@ inline T AlignValue( T val, unsigned alignment )
|
|||||||
( ((number) + ((boundary)-1)) / (boundary) ) * (boundary)
|
( ((number) + ((boundary)-1)) / (boundary) ) * (boundary)
|
||||||
|
|
||||||
// In case this ever changes
|
// In case this ever changes
|
||||||
|
#if defined M_PI
|
||||||
|
#undef M_PI
|
||||||
|
#endif
|
||||||
#define M_PI 3.14159265358979323846
|
#define M_PI 3.14159265358979323846
|
||||||
|
|
||||||
#ifndef min
|
#ifndef min
|
||||||
|
@ -21,7 +21,11 @@
|
|||||||
#define NEW_SOFTWARE_LIGHTING
|
#define NEW_SOFTWARE_LIGHTING
|
||||||
|
|
||||||
// need this for _alloca
|
// need this for _alloca
|
||||||
|
#if defined __APPLE__
|
||||||
|
#include <alloca.h>
|
||||||
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <new.h>
|
#include <new.h>
|
||||||
#elif defined __GNUC__
|
#elif defined __GNUC__
|
||||||
|
@ -1052,6 +1052,9 @@ inline CThreadMutex::CThreadMutex()
|
|||||||
{
|
{
|
||||||
// enable recursive locks as we need them
|
// enable recursive locks as we need them
|
||||||
pthread_mutexattr_init( &m_Attr );
|
pthread_mutexattr_init( &m_Attr );
|
||||||
|
#if defined __APPLE__
|
||||||
|
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||||
|
#endif
|
||||||
pthread_mutexattr_settype( &m_Attr, PTHREAD_MUTEX_RECURSIVE_NP );
|
pthread_mutexattr_settype( &m_Attr, PTHREAD_MUTEX_RECURSIVE_NP );
|
||||||
pthread_mutex_init( &m_Mutex, &m_Attr );
|
pthread_mutex_init( &m_Mutex, &m_Attr );
|
||||||
}
|
}
|
||||||
|
@ -147,8 +147,8 @@ public:
|
|||||||
void SetColor( const char *keyName, Color value);
|
void SetColor( const char *keyName, Color value);
|
||||||
|
|
||||||
// Memory allocation (optimized)
|
// Memory allocation (optimized)
|
||||||
void *operator new( unsigned int iAllocSize );
|
void *operator new( size_t iAllocSize );
|
||||||
void *operator new( unsigned int iAllocSize, int nBlockUse, const char *pFileName, int nLine );
|
void *operator new( size_t iAllocSize, int nBlockUse, const char *pFileName, int nLine );
|
||||||
void operator delete( void *pMem );
|
void operator delete( void *pMem );
|
||||||
void operator delete( void *pMem, int nBlockUse, const char *pFileName, int nLine );
|
void operator delete( void *pMem, int nBlockUse, const char *pFileName, int nLine );
|
||||||
|
|
||||||
|
@ -2131,13 +2131,13 @@ bool KeyValues::ReadAsBinary( CUtlBuffer &buffer )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: memory allocator
|
// Purpose: memory allocator
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void *KeyValues::operator new( unsigned int iAllocSize )
|
void *KeyValues::operator new( size_t iAllocSize )
|
||||||
{
|
{
|
||||||
MEM_ALLOC_CREDIT();
|
MEM_ALLOC_CREDIT();
|
||||||
return KeyValuesSystem()->AllocKeyValuesMemory(iAllocSize);
|
return KeyValuesSystem()->AllocKeyValuesMemory(iAllocSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *KeyValues::operator new( unsigned int iAllocSize, int nBlockUse, const char *pFileName, int nLine )
|
void *KeyValues::operator new( size_t iAllocSize, int nBlockUse, const char *pFileName, int nLine )
|
||||||
{
|
{
|
||||||
MemAlloc_PushAllocDbgInfo( pFileName, nLine );
|
MemAlloc_PushAllocDbgInfo( pFileName, nLine );
|
||||||
void *p = KeyValuesSystem()->AllocKeyValuesMemory(iAllocSize);
|
void *p = KeyValuesSystem()->AllocKeyValuesMemory(iAllocSize);
|
||||||
|
Reference in New Issue
Block a user