diff --git a/bitmap/colorconversion.cpp b/bitmap/colorconversion.cpp index 9b9432fe..38601ed1 100644 --- a/bitmap/colorconversion.cpp +++ b/bitmap/colorconversion.cpp @@ -10,7 +10,6 @@ #include "bitmap/imageformat.h" #include "basetypes.h" #include "tier0/dbg.h" -#include #include #include "mathlib/mathlib.h" #include "mathlib/vector.h" diff --git a/bitmap/imageformat.cpp b/bitmap/imageformat.cpp index 2808f77e..c2222653 100644 --- a/bitmap/imageformat.cpp +++ b/bitmap/imageformat.cpp @@ -11,7 +11,6 @@ #include "bitmap/imageformat.h" #include "basetypes.h" #include "tier0/dbg.h" -#include #include #include "nvtc.h" #include "mathlib/mathlib.h" diff --git a/bitmap/resample.cpp b/bitmap/resample.cpp index 0ca61f0d..98998899 100644 --- a/bitmap/resample.cpp +++ b/bitmap/resample.cpp @@ -8,7 +8,6 @@ #include "bitmap/imageformat.h" #include "basetypes.h" #include "tier0/dbg.h" -#include #include #include "mathlib/mathlib.h" #include "mathlib/vector.h" diff --git a/bitmap/tgawriter.cpp b/bitmap/tgawriter.cpp index a73c9965..d1324fbc 100644 --- a/bitmap/tgawriter.cpp +++ b/bitmap/tgawriter.cpp @@ -7,7 +7,6 @@ #include #include #include "tier0/dbg.h" -#include #include "filesystem.h" #include "bitmap/tgawriter.h" #include "tier1/utlbuffer.h" diff --git a/common/GameUI/ObjectList.cpp b/common/GameUI/ObjectList.cpp index 7da11005..4b8758ce 100644 --- a/common/GameUI/ObjectList.cpp +++ b/common/GameUI/ObjectList.cpp @@ -6,7 +6,11 @@ // //=============================================================================// #include +#ifdef OSX +#include +#else #include +#endif #include "ObjectList.h" #include "tier1/strtools.h" diff --git a/common/freetype/config/ftconfig.h b/common/freetype/config/ftconfig.h index 5e19c414..200dd57f 100644 --- a/common/freetype/config/ftconfig.h +++ b/common/freetype/config/ftconfig.h @@ -3,6 +3,8 @@ #ifdef ANDROID #include +#elif defined(OSX) +#include #else #include #endif diff --git a/engine/common.cpp b/engine/common.cpp index a7a3ec5d..f9348c95 100644 --- a/engine/common.cpp +++ b/engine/common.cpp @@ -16,7 +16,11 @@ #include #include #include "common.h" +#ifdef OSX +#include +#else #include +#endif #include "traceinit.h" #include #include "filesystem_engine.h" diff --git a/engine/decals.cpp b/engine/decals.cpp index d7de7122..106ff7fd 100644 --- a/engine/decals.cpp +++ b/engine/decals.cpp @@ -14,7 +14,11 @@ #include "filesystem.h" #include "filesystem_engine.h" #include "materialsystem/imaterial.h" +#ifdef OSX +#include +#else #include +#endif #include "utldict.h" // memdbgon must be the last include file in a .cpp file!!! diff --git a/engine/materialproxyfactory.cpp b/engine/materialproxyfactory.cpp index e4936195..9ea00252 100644 --- a/engine/materialproxyfactory.cpp +++ b/engine/materialproxyfactory.cpp @@ -6,7 +6,6 @@ //=============================================================================// #include -#include #include #include "materialsystem/imaterialproxy.h" #include "materialproxyfactory.h" diff --git a/engine/packed_entity.cpp b/engine/packed_entity.cpp index 9944f823..72e592c4 100644 --- a/engine/packed_entity.cpp +++ b/engine/packed_entity.cpp @@ -5,7 +5,11 @@ // $NoKeywords: $ // //=============================================================================// +#ifdef OSX +#include +#else #include +#endif #include #include #include "packed_entity.h" diff --git a/engine/pr_edict.cpp b/engine/pr_edict.cpp index 755adc1c..b8b13bd0 100644 --- a/engine/pr_edict.cpp +++ b/engine/pr_edict.cpp @@ -32,7 +32,11 @@ #ifdef _DEBUG +#ifdef OSX +#include +#else #include +#endif #endif // _DEBUG static ConVar sv_useexplicitdelete( "sv_useexplicitdelete", "1", FCVAR_DEVELOPMENTONLY, "Explicitly delete dormant client entities caused by AllowImmediateReuse()." ); diff --git a/engine/zone.cpp b/engine/zone.cpp index 5d90fa57..83363497 100644 --- a/engine/zone.cpp +++ b/engine/zone.cpp @@ -133,7 +133,14 @@ void Hunk_Print() void Memory_Init( void ) { MEM_ALLOC_CREDIT(); + +#ifdef PLATFORM_64BITS + // Seems to need to be larger to not get exhausted on + // 64-bit. Perhaps because of larger pointer sizes. + int nMaxBytes = 128*1024*1024; +#else int nMaxBytes = 48*1024*1024; +#endif const int nMinCommitBytes = 0x8000; #ifndef HUNK_USE_16MB_PAGE const int nInitialCommit = 0x280000; diff --git a/materialsystem/CMaterialSubRect.cpp b/materialsystem/CMaterialSubRect.cpp index 1b4d3866..e0f1b372 100644 --- a/materialsystem/CMaterialSubRect.cpp +++ b/materialsystem/CMaterialSubRect.cpp @@ -17,7 +17,7 @@ #include "materialsystem/imaterialproxyfactory.h" #include "IHardwareConfigInternal.h" #include "utlsymbol.h" -#include +#include #include "filesystem.h" #include #include "mempool.h" diff --git a/materialsystem/cmaterial.cpp b/materialsystem/cmaterial.cpp index 6c6ebe85..cb64757c 100644 --- a/materialsystem/cmaterial.cpp +++ b/materialsystem/cmaterial.cpp @@ -17,7 +17,11 @@ #include "materialsystem/imaterialproxyfactory.h" #include "IHardwareConfigInternal.h" #include "utlsymbol.h" +#ifdef OSX +#include +#else #include +#endif #include "filesystem.h" #include #include "mempool.h" diff --git a/materialsystem/materialsystem_global.cpp b/materialsystem/materialsystem_global.cpp index f64c1559..06dafd5f 100644 --- a/materialsystem/materialsystem_global.cpp +++ b/materialsystem/materialsystem_global.cpp @@ -7,7 +7,6 @@ #include "materialsystem_global.h" #include "shaderapi/ishaderapi.h" #include "shadersystem.h" -#include #include "filesystem.h" // memdbgon must be the last include file in a .cpp file!!! diff --git a/materialsystem/pch_materialsystem.h b/materialsystem/pch_materialsystem.h index f6935b50..3d2e7a1a 100644 --- a/materialsystem/pch_materialsystem.h +++ b/materialsystem/pch_materialsystem.h @@ -16,7 +16,11 @@ #include "windows.h" #endif +#ifdef OSX +#include +#else #include +#endif #include #include "crtmemdebug.h" diff --git a/materialsystem/shaderapidx9/shaderapidx8.cpp b/materialsystem/shaderapidx9/shaderapidx8.cpp index 69a510c7..15562e5d 100644 --- a/materialsystem/shaderapidx9/shaderapidx8.cpp +++ b/materialsystem/shaderapidx9/shaderapidx8.cpp @@ -42,7 +42,6 @@ mat_fullbright 1 doesn't work properly on alpha materials in testroom_standards #include "colorformatdx8.h" #include "texturedx8.h" #include "textureheap.h" -#include #include "interface.h" #include "utlrbtree.h" #include "utlsymbol.h" diff --git a/public/builddisp.cpp b/public/builddisp.cpp index 3cce06dc..da749e2c 100644 --- a/public/builddisp.cpp +++ b/public/builddisp.cpp @@ -9,7 +9,6 @@ //#include #include -#include #include "builddisp.h" #include "collisionutils.h" #include "tier1/strtools.h" diff --git a/public/saverestoretypes.h b/public/saverestoretypes.h index da06298e..55fa0042 100644 --- a/public/saverestoretypes.h +++ b/public/saverestoretypes.h @@ -512,7 +512,7 @@ inline const char *CSaveRestoreSegment::StringFromSymbol( int token ) /// compilers. Either way, there's no portable intrinsic. // Newer GCC versions provide this in this header, older did by default. -#if !defined( _rotr ) && defined( COMPILER_GCC ) && !defined( __arm__ ) +#if !defined( _rotr ) && defined( COMPILER_GCC ) && !defined( __arm__ ) && !defined( __arm64__ ) #include #endif diff --git a/public/tier0/memalloc.h b/public/tier0/memalloc.h index 0a1c0895..3a64fc32 100644 --- a/public/tier0/memalloc.h +++ b/public/tier0/memalloc.h @@ -96,8 +96,8 @@ public: virtual bool IsDebugHeap() = 0; virtual void GetActualDbgInfo( const char *&pFileName, int &nLine ) = 0; - virtual void RegisterAllocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ) = 0; - virtual void RegisterDeallocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ) = 0; + virtual void RegisterAllocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) = 0; + virtual void RegisterDeallocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) = 0; virtual int GetVersion() = 0; @@ -473,9 +473,14 @@ inline void MemAlloc_CheckAlloc( void *ptr, size_t nSize ) } #if defined( OSX ) -// Mac always aligns allocs, don't need to call posix_memalign which doesn't exist in 10.5.8 which TF2 still needs to run on -//inline void *memalign(size_t alignment, size_t size) {void *pTmp=NULL; posix_memalign(&pTmp, alignment, size); return pTmp;} -inline void *memalign(size_t alignment, size_t size) {void *pTmp=NULL; pTmp = malloc(size); MemAlloc_CheckAlloc( pTmp, size ); return pTmp;} +inline void *memalign(size_t alignment, size_t size) { + // MoeMod : 64bit fix + if(alignment < sizeof(void *)) + alignment = sizeof(void *); + void *pTmp = nullptr; + posix_memalign(&pTmp, alignment, size); + return pTmp; +} #endif inline void *_aligned_malloc( size_t nSize, size_t align ) { void *ptr = memalign( align, nSize ); MemAlloc_CheckAlloc( ptr, nSize ); return ptr; } diff --git a/public/tier0/memdbgon.h b/public/tier0/memdbgon.h index 3998b223..b9eec5dd 100644 --- a/public/tier0/memdbgon.h +++ b/public/tier0/memdbgon.h @@ -29,7 +29,11 @@ #include #endif #include +#ifdef OSX +#include +#else #include +#endif #include "commonmacros.h" #include "memalloc.h" diff --git a/public/tier1/mempool.h b/public/tier1/mempool.h index 01d3a33f..0e3931b9 100644 --- a/public/tier1/mempool.h +++ b/public/tier1/mempool.h @@ -458,7 +458,7 @@ inline void CAlignedMemPool inline int __cdecl CAlignedMemPool::CompareChunk( void * const *ppLeft, void * const *ppRight ) { - return ((unsigned)*ppLeft) - ((unsigned)*ppRight); + return (int)(((uintp)*ppLeft) - ((uintp)*ppRight)); } template diff --git a/public/vallocator.cpp b/public/vallocator.cpp index be717033..c1476536 100644 --- a/public/vallocator.cpp +++ b/public/vallocator.cpp @@ -8,7 +8,11 @@ #if !defined(_STATIC_LINKED) || defined(_SHARED_LIB) +#ifdef OSX +#include +#else #include +#endif #include "vallocator.h" #include "basetypes.h" diff --git a/public/vstdlib/pch_vstdlib.h b/public/vstdlib/pch_vstdlib.h index bef1b7f1..ee8a9c7a 100644 --- a/public/vstdlib/pch_vstdlib.h +++ b/public/vstdlib/pch_vstdlib.h @@ -19,7 +19,11 @@ #include #include #include +#ifdef OSX +#include +#else #include +#endif #include #include diff --git a/studiorender/r_studiodraw.cpp b/studiorender/r_studiodraw.cpp index 4e6d18cd..19748fd8 100644 --- a/studiorender/r_studiodraw.cpp +++ b/studiorender/r_studiodraw.cpp @@ -15,7 +15,6 @@ #include "optimize.h" #include "mathlib/mathlib.h" #include "mathlib/vector.h" -#include #include "mathlib/vmatrix.h" #include "studiorendercontext.h" #include "tier2/tier2.h" diff --git a/tier0/dbg.cpp b/tier0/dbg.cpp index 931ea21f..2a64e77c 100644 --- a/tier0/dbg.cpp +++ b/tier0/dbg.cpp @@ -17,7 +17,11 @@ #endif #include +#ifdef OSX +#include +#else #include +#endif #include #include #include @@ -319,7 +323,7 @@ static SpewRetval_t _SpewMessage( SpewType_t spewType, const char *pGroupName, i g_pSpewInfo = &spewInfo; ret = s_SpewOutputFunc( spewType, pTempBuffer ); - g_pSpewInfo = (int)NULL; + g_pSpewInfo = NULL; switch (ret) { diff --git a/tier0/mem.cpp b/tier0/mem.cpp index 3e716d56..f7d5c140 100644 --- a/tier0/mem.cpp +++ b/tier0/mem.cpp @@ -7,7 +7,11 @@ #include "pch_tier0.h" #include "tier0/mem.h" +#ifdef OSX +#include +#else #include +#endif #include "tier0/dbg.h" #include "tier0/minidump.h" diff --git a/tier0/mem_helpers.cpp b/tier0/mem_helpers.cpp index b55c4e4b..82eaaf84 100644 --- a/tier0/mem_helpers.cpp +++ b/tier0/mem_helpers.cpp @@ -7,7 +7,11 @@ #include "pch_tier0.h" #include "mem_helpers.h" #include +#ifdef OSX +#include +#else #include +#endif bool g_bInitMemory = true; diff --git a/tier0/memdbg.cpp b/tier0/memdbg.cpp index ef23e9a3..6b9379f0 100644 --- a/tier0/memdbg.cpp +++ b/tier0/memdbg.cpp @@ -10,7 +10,11 @@ #if !defined(STEAM) && !defined(NO_MALLOC_OVERRIDE) +#ifdef OSX +#include +#else #include +#endif #include #include "tier0/dbg.h" #include "tier0/memalloc.h" @@ -269,7 +273,7 @@ struct DbgMemHeader_t : CrtDbgMemHeader_t #endif { - unsigned nLogicalSize; + size_t nLogicalSize; byte reserved[12]; // MS allocator always returns mem aligned on 16 bytes, which some of our code depends on }; @@ -634,11 +638,11 @@ private: const char *FindOrCreateFilename( const char *pFileName ); // Updates stats - void RegisterAllocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ); - void RegisterDeallocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ); + void RegisterAllocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ); + void RegisterDeallocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ); - void RegisterAllocation( MemInfo_t &info, int nLogicalSize, int nActualSize, unsigned nTime ); - void RegisterDeallocation( MemInfo_t &info, int nLogicalSize, int nActualSize, unsigned nTime ); + void RegisterAllocation( MemInfo_t &info, size_t nLogicalSize, size_t nActualSize, unsigned nTime ); + void RegisterDeallocation( MemInfo_t &info, size_t nLogicalSize, size_t nActualSize, unsigned nTime ); // Gets the allocation file name const char *GetAllocatonFileName( void *pMem ); @@ -1056,21 +1060,21 @@ CDbgMemAlloc::MemInfo_t &CDbgMemAlloc::FindOrCreateEntry( const char *pFileName, //----------------------------------------------------------------------------- // Updates stats //----------------------------------------------------------------------------- -void CDbgMemAlloc::RegisterAllocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ) +void CDbgMemAlloc::RegisterAllocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) { HEAP_LOCK(); RegisterAllocation( m_GlobalInfo, nLogicalSize, nActualSize, nTime ); RegisterAllocation( FindOrCreateEntry( pFileName, nLine ), nLogicalSize, nActualSize, nTime ); } -void CDbgMemAlloc::RegisterDeallocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ) +void CDbgMemAlloc::RegisterDeallocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) { HEAP_LOCK(); RegisterDeallocation( m_GlobalInfo, nLogicalSize, nActualSize, nTime ); RegisterDeallocation( FindOrCreateEntry( pFileName, nLine ), nLogicalSize, nActualSize, nTime ); } -void CDbgMemAlloc::RegisterAllocation( MemInfo_t &info, int nLogicalSize, int nActualSize, unsigned nTime ) +void CDbgMemAlloc::RegisterAllocation( MemInfo_t &info, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) { ++info.m_nCurrentCount; ++info.m_nTotalCount; @@ -1107,7 +1111,7 @@ void CDbgMemAlloc::RegisterAllocation( MemInfo_t &info, int nLogicalSize, int nA info.m_nTime += nTime; } -void CDbgMemAlloc::RegisterDeallocation( MemInfo_t &info, int nLogicalSize, int nActualSize, unsigned nTime ) +void CDbgMemAlloc::RegisterDeallocation( MemInfo_t &info, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) { // Check for decrementing these counters below zero. The checks // must be done here because these unsigned counters will wrap-around and @@ -1117,7 +1121,7 @@ void CDbgMemAlloc::RegisterDeallocation( MemInfo_t &info, int nLogicalSize, int // It is technically legal for code to request allocations of zero bytes, and there are a number of places in our code // that do. So only assert that nLogicalSize >= 0. http://stackoverflow.com/questions/1087042/c-new-int0-will-it-allocate-memory Assert( nLogicalSize >= 0 ); - Assert( info.m_nCurrentSize >= (size_t)nLogicalSize ); + Assert( info.m_nCurrentSize >= nLogicalSize ); --info.m_nCurrentCount; info.m_nCurrentSize -= nLogicalSize; @@ -1250,8 +1254,8 @@ void CDbgMemAlloc::Free( void *pMem, const char * /*pFileName*/, int nLine ) return; } - int nOldLogicalSize = InternalLogicalSize( pMem ); - int nOldSize = InternalMSize( pMem ); + size_t nOldLogicalSize = InternalLogicalSize( pMem ); + size_t nOldSize = InternalMSize( pMem ); const char *pOldFileName = GetAllocatonFileName( pMem ); int oldLine = GetAllocatonLineNumber( pMem ); @@ -1832,6 +1836,10 @@ static inline void unprotect_malloc_zone( malloc_zone_t *malloc_zone ) // The version check may not be necessary, but we know it was RW before that. if ( malloc_zone->version >= 8 ) { +#ifdef __arm64__ + // MoeMod : this is required for Apple Silicon + pthread_jit_write_protect_np(false); +#endif vm_protect( mach_task_self(), (uintptr_t)malloc_zone, sizeof( malloc_zone_t ), 0, VM_PROT_READ | VM_PROT_WRITE ); } } @@ -1841,6 +1849,10 @@ static inline void protect_malloc_zone( malloc_zone_t *malloc_zone ) if ( malloc_zone->version >= 8 ) { vm_protect( mach_task_self(), (uintptr_t)malloc_zone, sizeof( malloc_zone_t ), 0, VM_PROT_READ ); +#ifdef __arm64__ + // MoeMod : this is required for Apple Silicon + pthread_jit_write_protect_np(true); +#endif } } diff --git a/tier0/memstd.cpp b/tier0/memstd.cpp index ab297ebc..36d9fb13 100644 --- a/tier0/memstd.cpp +++ b/tier0/memstd.cpp @@ -20,7 +20,11 @@ #define VA_RESERVE_FLAGS (MEM_RESERVE|MEM_LARGE_PAGES) #endif +#ifdef OSX +#include +#else #include +#endif #include "tier0/valve_minmax_off.h" // GCC 4.2.2 headers screw up our min/max defs. #include diff --git a/tier0/memstd.h b/tier0/memstd.h index 59ea7f70..bad033ba 100644 --- a/tier0/memstd.h +++ b/tier0/memstd.h @@ -18,7 +18,11 @@ #endif #endif +#ifdef OSX +#include +#else #include +#endif #include #include "tier0/dbg.h" #include "tier0/memalloc.h" @@ -253,8 +257,8 @@ public: virtual bool IsDebugHeap() { return false; } virtual void GetActualDbgInfo( const char *&pFileName, int &nLine ) {} - virtual void RegisterAllocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ) {} - virtual void RegisterDeallocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ) {} + virtual void RegisterAllocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) {} + virtual void RegisterDeallocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) {} virtual int GetVersion() { return MEMALLOC_VERSION; } diff --git a/tier0/memvalidate.cpp b/tier0/memvalidate.cpp index 73b15cc1..69c78a0e 100644 --- a/tier0/memvalidate.cpp +++ b/tier0/memvalidate.cpp @@ -102,8 +102,8 @@ private: void GetActualDbgInfo( const char *&pFileName, int &nLine ); // Updates stats - void RegisterAllocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ); - void RegisterDeallocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ); + void RegisterAllocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ); + void RegisterDeallocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ); HeapSuffix_t *Suffix( HeapPrefix_t *pPrefix ); void *AllocationStart( HeapPrefix_t *pBase ); @@ -460,12 +460,12 @@ void CValidateAlloc::GetActualDbgInfo( const char *&pFileName, int &nLine ) } // Updates stats -void CValidateAlloc::RegisterAllocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ) +void CValidateAlloc::RegisterAllocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) { g_pActualAlloc->RegisterAllocation( pFileName, nLine, nLogicalSize, nActualSize, nTime ); } -void CValidateAlloc::RegisterDeallocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ) +void CValidateAlloc::RegisterDeallocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) { g_pActualAlloc->RegisterDeallocation( pFileName, nLine, nLogicalSize, nActualSize, nTime ); } diff --git a/tier0/pch_tier0.h b/tier0/pch_tier0.h index ad06d221..7ab82889 100644 --- a/tier0/pch_tier0.h +++ b/tier0/pch_tier0.h @@ -30,7 +30,11 @@ #include #include #include +#ifdef OSX +#include +#else #include +#endif #include #include #include diff --git a/tier0/platform_posix.cpp b/tier0/platform_posix.cpp index f5c7a22c..dbfaf36e 100644 --- a/tier0/platform_posix.cpp +++ b/tier0/platform_posix.cpp @@ -679,13 +679,17 @@ PLATFORM_INTERFACE void Plat_SetWatchdogHandlerFunction( Plat_WatchDogHandlerFun // memory logging this functionality is portable code, except for the way in which it hooks // malloc/free. glibc contains the ability for the app to install hooks into malloc/free. +#ifdef OSX +#include +#else #include +#endif #include #include #include #define MEMALLOC_HASHSIZE 8193 -typedef uint32 ptrint_t; +typedef uintp ptrint_t; @@ -993,7 +997,7 @@ static inline bool SortLessFunc( CLinuxMallocContext * const &left, CLinuxMalloc void DumpMemoryLog( int nThresh ) { AUTO_LOCK( s_MemoryMutex ); - EndWatchdogTimer(); + Plat_EndWatchdogTimer(); RemoveHooks(); std::vector memList; @@ -1028,7 +1032,7 @@ void DumpMemoryLog( int nThresh ) void DumpChangedMemory( int nThresh ) { AUTO_LOCK( s_MemoryMutex ); - EndWatchdogTimer(); + Plat_EndWatchdogTimer(); RemoveHooks(); std::vector memList; diff --git a/tier1/mempool.cpp b/tier1/mempool.cpp index fa49edb5..fc3fb9b1 100644 --- a/tier1/mempool.cpp +++ b/tier1/mempool.cpp @@ -6,7 +6,11 @@ #include "mempool.h" #include +#ifdef OSX +#include +#else #include +#endif #include #include "tier0/dbg.h" #include diff --git a/vgui2/src/vgui.cpp b/vgui2/src/vgui.cpp index 3508b1ad..b3de84e5 100644 --- a/vgui2/src/vgui.cpp +++ b/vgui2/src/vgui.cpp @@ -26,7 +26,11 @@ #include #include #include +#ifdef OSX +#include +#else #include +#endif #include #include #include "vgui_internal.h" diff --git a/vgui2/vgui_controls/TextImage.cpp b/vgui2/vgui_controls/TextImage.cpp index 61532126..ead30ed2 100644 --- a/vgui2/vgui_controls/TextImage.cpp +++ b/vgui2/vgui_controls/TextImage.cpp @@ -9,7 +9,11 @@ #include #include #include +#ifdef OSX +#include +#else #include +#endif #include #include diff --git a/vgui2/vgui_surfacelib/BitmapFont.cpp b/vgui2/vgui_surfacelib/BitmapFont.cpp index 36d6be93..b597ac47 100644 --- a/vgui2/vgui_surfacelib/BitmapFont.cpp +++ b/vgui2/vgui_surfacelib/BitmapFont.cpp @@ -10,7 +10,11 @@ #include #include #include +#ifdef OSX +#include +#else #include +#endif #include "vgui_surfacelib/BitmapFont.h" #include "vgui_surfacelib/FontManager.h" #include diff --git a/vgui2/vgui_surfacelib/linuxfont.cpp b/vgui2/vgui_surfacelib/linuxfont.cpp index e9170fdb..30126afa 100644 --- a/vgui2/vgui_surfacelib/linuxfont.cpp +++ b/vgui2/vgui_surfacelib/linuxfont.cpp @@ -12,7 +12,11 @@ #include #include #include +#ifdef OSX +#include +#else #include +#endif #include #include #include diff --git a/vguimatsurface/MatSystemSurface.cpp b/vguimatsurface/MatSystemSurface.cpp index 74265908..1f8d53e9 100644 --- a/vguimatsurface/MatSystemSurface.cpp +++ b/vguimatsurface/MatSystemSurface.cpp @@ -48,7 +48,11 @@ ILauncherMgr *g_pLauncherMgr = NULL; #include "mathlib/vmatrix.h" #include #include "materialsystem/itexture.h" +#ifdef OSX +#include +#else #include +#endif #include "../vgui2/src/VPanel.h" #include #if defined( _X360 ) @@ -142,7 +146,7 @@ CMatSystemSurface g_MatSystemSurface; EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CMatSystemSurface, ISurface, VGUI_SURFACE_INTERFACE_VERSION, g_MatSystemSurface ); -#ifdef LINUX +#if defined(LINUX) || defined(OSX) CUtlDict< CMatSystemSurface::font_entry, unsigned short > CMatSystemSurface::m_FontData; #endif @@ -403,7 +407,7 @@ InitReturnVal_t CMatSystemSurface::Init( void ) FontManager().SetLanguage( "english" ); } -#ifdef LINUX +#if defined(LINUX) || defined(OSX) FontManager().SetFontDataHelper( &CMatSystemSurface::FontDataHelper ); #endif @@ -1903,16 +1907,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon } Assert( success ); return success; -#elif OSX - - FSRef ref; - OSStatus err = FSPathMakeRef( (const UInt8*)fullPath, &ref, NULL ); - if ( err == noErr ) - err = ATSFontActivateFromFileReference( &ref, kATSFontContextLocal, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault, NULL ); - - return err == noErr; - -#elif LINUX +#elif defined(LINUX) || defined(OSX) int size; if ( CMatSystemSurface::FontDataHelper( fontName, size, fontFileName ) ) @@ -1926,7 +1921,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon #endif } -#ifdef LINUX +#if defined(LINUX) || defined(OSX) static void RemoveSpaces( CUtlString &str ) {