From a0c29e7dd67abb15c74c85f07741784877edfdcd Mon Sep 17 00:00:00 2001 From: Joe Ludwig Date: Mon, 2 Sep 2013 11:39:10 -0700 Subject: General: * Fixed a variety of server browser issues with mods based on this SDK * Fixed many warnings on various platforms * Added source code for fgdlib and raytrace * Updated many source files with the latest shared source from TF2. OSX: * Added support for Xcode 4.6 * Switched OSX builds to use Xcode instead of makefiles * Moved libs from src/lib/osx32 to src/lib/public/osx32 or src/lib/common/osx32 to match windows better. Linux: * Moved libs from src/lib/linux32 to src/lib/public/linux32 or src/lib/common/linux32 to match windows better. --- mp/src/public/XUnzip.cpp | 8 ++++++++ mp/src/public/bone_setup.cpp | 2 ++ mp/src/public/cdll_int.h | 2 ++ mp/src/public/engine/IStaticPropMgr.h | 3 ++- mp/src/public/engine/ivmodelrender.h | 2 ++ mp/src/public/game/server/pluginvariant.h | 2 +- mp/src/public/inputsystem/iinputsystem.h | 7 +++++++ mp/src/public/tier0/dbg.h | 4 ++++ mp/src/public/tier0/platform.h | 4 ++-- mp/src/public/tier1/fmtstr.h | 11 +++++++++-- mp/src/public/tier1/utlstring.h | 3 ++- mp/src/public/vgui_controls/Panel.h | 8 ++++---- 12 files changed, 45 insertions(+), 11 deletions(-) (limited to 'mp/src/public') diff --git a/mp/src/public/XUnzip.cpp b/mp/src/public/XUnzip.cpp index 22c7d62c..72fc7805 100644 --- a/mp/src/public/XUnzip.cpp +++ b/mp/src/public/XUnzip.cpp @@ -3232,10 +3232,12 @@ int unzlocal_GetCurrentFileInfoInternal (unzFile file, unz_file_info *pfile_info // we check the magic if (err==UNZ_OK) + { if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) err=UNZ_ERRNO; else if (uMagic!=0x02014b50) err=UNZ_BADZIPFILE; + } if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK) err=UNZ_ERRNO; @@ -3312,10 +3314,12 @@ int unzlocal_GetCurrentFileInfoInternal (unzFile file, unz_file_info *pfile_info uSizeRead = extraFieldBufferSize; if (lSeek!=0) + { if (lufseek(s->file,lSeek,SEEK_CUR)==0) lSeek=0; else err=UNZ_ERRNO; + } if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) if (lufread(extraField,(uInt)uSizeRead,1,s->file)!=1) err=UNZ_ERRNO; @@ -3337,10 +3341,12 @@ int unzlocal_GetCurrentFileInfoInternal (unzFile file, unz_file_info *pfile_info uSizeRead = commentBufferSize; if (lSeek!=0) + { if (lufseek(s->file,lSeek,SEEK_CUR)==0) {} // unused lSeek=0; else err=UNZ_ERRNO; + } if ((file_info.size_file_comment>0) && (commentBufferSize>0)) if (lufread(szComment,(uInt)uSizeRead,1,s->file)!=1) err=UNZ_ERRNO; @@ -3490,10 +3496,12 @@ int unzlocal_CheckCurrentFileCoherencyHeader (unz_s *s,uInt *piSizeVar, if (err==UNZ_OK) + { if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) err=UNZ_ERRNO; else if (uMagic!=0x04034b50) err=UNZ_BADZIPFILE; + } if (unzlocal_getShort(s->file,&uData) != UNZ_OK) err=UNZ_ERRNO; diff --git a/mp/src/public/bone_setup.cpp b/mp/src/public/bone_setup.cpp index b8033c49..31fb4965 100644 --- a/mp/src/public/bone_setup.cpp +++ b/mp/src/public/bone_setup.cpp @@ -57,7 +57,9 @@ public: { p = new T[MAXSTUDIOBONES]; if ( ((size_t)p) % TSLIST_NODE_ALIGNMENT != 0 ) + { DebuggerBreak(); + } } return p; diff --git a/mp/src/public/cdll_int.h b/mp/src/public/cdll_int.h index 1801c383..56598198 100644 --- a/mp/src/public/cdll_int.h +++ b/mp/src/public/cdll_int.h @@ -566,6 +566,8 @@ public: virtual bool IsActiveApp() = 0; virtual void DisconnectInternal() = 0; + + virtual int GetInstancesRunningCount( ) = 0; }; diff --git a/mp/src/public/engine/IStaticPropMgr.h b/mp/src/public/engine/IStaticPropMgr.h index 428d0133..ca06f8ff 100644 --- a/mp/src/public/engine/IStaticPropMgr.h +++ b/mp/src/public/engine/IStaticPropMgr.h @@ -63,7 +63,8 @@ public: // Adds decals to static props, returns point of decal in trace_t virtual void AddDecalToStaticProp( const Vector& rayStart, const Vector& rayEnd, int staticPropIndex, int decalIndex, bool doTrace, trace_t& tr ) = 0; - + virtual void AddColorDecalToStaticProp( Vector const& rayStart, Vector const& rayEnd, + int staticPropIndex, int decalIndex, bool doTrace, trace_t& tr, bool bUseColor, Color cColor ) = 0; // Adds/removes shadows from static props virtual void AddShadowToStaticProp( unsigned short shadowHandle, IClientRenderable* pRenderable ) = 0; virtual void RemoveAllShadowsFromStaticProp( IClientRenderable* pRenderable ) = 0; diff --git a/mp/src/public/engine/ivmodelrender.h b/mp/src/public/engine/ivmodelrender.h index 0b28aba1..5b60d893 100644 --- a/mp/src/public/engine/ivmodelrender.h +++ b/mp/src/public/engine/ivmodelrender.h @@ -138,6 +138,8 @@ public: // radius of the decal to create. virtual void AddDecal( ModelInstanceHandle_t handle, Ray_t const& ray, Vector const& decalUp, int decalIndex, int body, bool noPokeThru = false, int maxLODToDecal = ADDDECAL_TO_ALL_LODS ) = 0; + virtual void AddColoredDecal( ModelInstanceHandle_t handle, Ray_t const& ray, + Vector const& decalUp, int decalIndex, int body, Color cColor, bool noPokeThru = false, int maxLODToDecal = ADDDECAL_TO_ALL_LODS ) = 0; // Removes all the decals on a model instance virtual void RemoveAllDecals( ModelInstanceHandle_t handle ) = 0; diff --git a/mp/src/public/game/server/pluginvariant.h b/mp/src/public/game/server/pluginvariant.h index 1f0d5f32..5eb67a5e 100644 --- a/mp/src/public/game/server/pluginvariant.h +++ b/mp/src/public/game/server/pluginvariant.h @@ -56,7 +56,7 @@ public: fieldtype_t FieldType( void ) { return fieldType; } void SetBool( bool b ) { bVal = b; fieldType = FIELD_BOOLEAN; } - void SetString( char *str ) { Q_snprintf(iszVal, 1024, str); fieldType = FIELD_STRING; } + void SetString( char *str ) { Q_snprintf(iszVal, 1024, "%s", str); fieldType = FIELD_STRING; } void SetInt( int val ) { iVal = val, fieldType = FIELD_INTEGER; } void SetFloat( float val ) { flVal = val, fieldType = FIELD_FLOAT; } void SetEdict( edict_t *val ) { eVal = val; fieldType = FIELD_EHANDLE; } diff --git a/mp/src/public/inputsystem/iinputsystem.h b/mp/src/public/inputsystem/iinputsystem.h index f2453067..55dd0559 100644 --- a/mp/src/public/inputsystem/iinputsystem.h +++ b/mp/src/public/inputsystem/iinputsystem.h @@ -117,6 +117,13 @@ public: // read and clear accumulated raw input values virtual bool GetRawMouseAccumulators( int& accumX, int& accumY ) = 0; + + // tell the input system that we're not a game, we're console text mode. + // this is used for dedicated servers to not initialize joystick system. + // this needs to be called before CInputSystem::Init (e.g. in PreInit of + // some system) if you want ot prevent the joystick system from ever + // being initialized. + virtual void SetConsoleTextMode( bool bConsoleTextMode ) = 0; }; diff --git a/mp/src/public/tier0/dbg.h b/mp/src/public/tier0/dbg.h index c1f8794e..2faa26a5 100644 --- a/mp/src/public/tier0/dbg.h +++ b/mp/src/public/tier0/dbg.h @@ -253,9 +253,13 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); if ( ret == SPEW_DEBUGGER) \ { \ if ( !ShouldUseNewAssertDialog() || DoNewAssertDialog( __TFILE__, __LINE__, _msg ) ) \ + { \ DebuggerBreak(); \ + } \ if ( _bFatal ) \ + { \ _ExitOnFatalAssert( __TFILE__, __LINE__ ); \ + } \ } \ } \ } while (0) diff --git a/mp/src/public/tier0/platform.h b/mp/src/public/tier0/platform.h index 38e6b563..1ff753f5 100644 --- a/mp/src/public/tier0/platform.h +++ b/mp/src/public/tier0/platform.h @@ -150,7 +150,6 @@ typedef signed char int8; #if defined(__x86_64__) || defined(_WIN64) #define X64BITS - #define PLATFORM_64BITS #endif // __x86_64__ #if defined( _WIN32 ) @@ -391,7 +390,7 @@ typedef void * HINSTANCE; // On OSX, SIGTRAP doesn't really stop the thread cold when debugging. // So if being debugged, use INT3 which is precise. #ifdef OSX -#define DebuggerBreak() if ( Plat_IsInDebugSession() ) __asm ( "int $3" ); else { raise(SIGTRAP); } +#define DebuggerBreak() if ( Plat_IsInDebugSession() ) { __asm ( "int $3" ); } else { raise(SIGTRAP); } #else #define DebuggerBreak() raise(SIGTRAP) #endif @@ -662,6 +661,7 @@ typedef void * HINSTANCE; #pragma GCC diagnostic ignored "-Wconversion-null" // passing NULL to non-pointer argument 1 #pragma GCC diagnostic ignored "-Wnull-arithmetic" // NULL used in arithmetic. Ie, vpanel == NULL where VPANEL is uint. #pragma GCC diagnostic ignored "-Wswitch-enum" // enumeration values not handled in switch +#pragma GCC diagnostic ignored "-Wswitch" // enumeration values not handled in switch #endif diff --git a/mp/src/public/tier1/fmtstr.h b/mp/src/public/tier1/fmtstr.h index d9d5fef2..64d44add 100644 --- a/mp/src/public/tier1/fmtstr.h +++ b/mp/src/public/tier1/fmtstr.h @@ -18,6 +18,9 @@ #if defined( _WIN32 ) #pragma once #endif +#if defined(POSIX) +#pragma GCC visibility push(hidden) +#endif //============================================================================= @@ -28,7 +31,7 @@ int result; \ va_list arg_ptr; \ bool bTruncated = false; \ - static int scAsserted = 0; \ + static unsigned int scAsserted = 0; \ \ va_start(arg_ptr, lastArg); \ result = Q_vsnprintfRet( (szBuf), nBufSize, (*(ppszFormat)), arg_ptr, &bTruncated ); \ @@ -115,7 +118,7 @@ public: m_nLength = 0; } - void AppendFormat( PRINTF_FORMAT_STRING const char *pchFormat, ... ) + void AppendFormat(PRINTF_FORMAT_STRING const char *pchFormat, ... ) FMTFUNCTION( 2, 3 ) { char *pchEnd = m_szBuf + m_nLength; FmtStrVSNPrintf( pchEnd, SIZE_BUF - m_nLength, m_bQuietTruncation, &pchFormat, m_nLength, pchFormat ); @@ -174,6 +177,10 @@ void CFmtStrN::AppendFormatV( const char *pchFormat, va_list args ) } +#if defined(POSIX) +#pragma GCC visibility pop +#endif + //----------------------------------------------------------------------------- // // Purpose: Default-sized string formatter diff --git a/mp/src/public/tier1/utlstring.h b/mp/src/public/tier1/utlstring.h index eec22dfa..26d98338 100644 --- a/mp/src/public/tier1/utlstring.h +++ b/mp/src/public/tier1/utlstring.h @@ -16,7 +16,8 @@ #include "limits.h" #if defined( OSX ) -inline wchar_t *wcsdup(const wchar_t *pString) +#define wcsdup wcsdup_osx +inline wchar_t *wcsdup_osx(const wchar_t *pString) { wchar_t *pMemory; diff --git a/mp/src/public/vgui_controls/Panel.h b/mp/src/public/vgui_controls/Panel.h index afbfd177..23af650c 100644 --- a/mp/src/public/vgui_controls/Panel.h +++ b/mp/src/public/vgui_controls/Panel.h @@ -519,10 +519,10 @@ public: // [tj] Simple getters and setters to decide which corners to draw rounded unsigned char GetRoundedCorners() { return m_roundedCorners; } void SetRoundedCorners (unsigned char cornerFlags) { m_roundedCorners = cornerFlags; } - bool ShouldDrawTopLeftCornerRounded() { return m_roundedCorners & PANEL_ROUND_CORNER_TOP_LEFT; } - bool ShouldDrawTopRightCornerRounded() { return m_roundedCorners & PANEL_ROUND_CORNER_TOP_RIGHT; } - bool ShouldDrawBottomLeftCornerRounded() { return m_roundedCorners & PANEL_ROUND_CORNER_BOTTOM_LEFT; } - bool ShouldDrawBottomRightCornerRounded() { return m_roundedCorners & PANEL_ROUND_CORNER_BOTTOM_RIGHT; } + bool ShouldDrawTopLeftCornerRounded() { return ( m_roundedCorners & PANEL_ROUND_CORNER_TOP_LEFT ) != 0; } + bool ShouldDrawTopRightCornerRounded() { return ( m_roundedCorners & PANEL_ROUND_CORNER_TOP_RIGHT ) != 0; } + bool ShouldDrawBottomLeftCornerRounded() { return ( m_roundedCorners & PANEL_ROUND_CORNER_BOTTOM_LEFT ) != 0; } + bool ShouldDrawBottomRightCornerRounded() { return ( m_roundedCorners & PANEL_ROUND_CORNER_BOTTOM_RIGHT ) != 0; } //============================================================================= // HPE_END -- cgit v1.2.3