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