General:
* Upgraded Steamworks SDK to v1.29 * Fixed mod compatibility problem with Multiplayer Base that was introduced in September. * In Hammer, while using the Vertex Tool, pressing CTRL+B will snap selected vertices to the grid. Virtual Reality: * Mods that support virtual reality now need to have a line in gameinfo.txt that says “supportsvr 1”. This indicates to gameui and engine that certain UI should be enabled. * VR-enabled mods will now start up in VR mode when launched from Steam’s VR mode. Windows: * Upgraded to Visual Studio 2013. If you need to build projects for VS 2010, add /2010 to your VPC command line. OSX: * Upgraded to XCode 5.
This commit is contained in:
@@ -1952,9 +1952,8 @@ void KeyValues::ParseIncludedKeys( char const *resourceName, const char *filetoi
|
||||
Q_strncpy( fullpath, resourceName, sizeof( fullpath ) );
|
||||
|
||||
// Strip off characters back to start or first /
|
||||
bool done = false;
|
||||
int len = Q_strlen( fullpath );
|
||||
while ( !done )
|
||||
for (;;)
|
||||
{
|
||||
if ( len <= 0 )
|
||||
{
|
||||
|
||||
@@ -269,7 +269,7 @@ char *ConCommandBase::CopyString( const char *from )
|
||||
int len;
|
||||
char *to;
|
||||
|
||||
len = strlen( from );
|
||||
len = V_strlen( from );
|
||||
if ( len <= 0 )
|
||||
{
|
||||
to = new char[1];
|
||||
@@ -507,7 +507,7 @@ int DefaultCompletionFunc( const char *partial, char commands[ COMMAND_COMPLETIO
|
||||
// m_bIsNewConCommand = true;
|
||||
//}
|
||||
|
||||
ConCommand::ConCommand( const char *pName, FnCommandCallbackV1_t callback, const char *pHelpString /*= 0*/, int flags /*= 0*/, FnCommandCompletionCallback completionFunc /*= 0*/ )
|
||||
ConCommand::ConCommand( const char *pName, FnCommandCallbackVoid_t callback, const char *pHelpString /*= 0*/, int flags /*= 0*/, FnCommandCompletionCallback completionFunc /*= 0*/ )
|
||||
{
|
||||
// Set the callback
|
||||
m_fnCommandCallbackV1 = callback;
|
||||
@@ -951,7 +951,7 @@ void ConVar::Create( const char *pName, const char *pDefaultValue, int flags /*=
|
||||
// Name should be static data
|
||||
SetDefault( pDefaultValue );
|
||||
|
||||
m_StringLength = strlen( m_pszDefaultValue ) + 1;
|
||||
m_StringLength = V_strlen( m_pszDefaultValue ) + 1;
|
||||
m_pszString = new char[m_StringLength];
|
||||
memcpy( m_pszString, m_pszDefaultValue, m_StringLength );
|
||||
|
||||
@@ -963,6 +963,7 @@ void ConVar::Create( const char *pName, const char *pDefaultValue, int flags /*=
|
||||
m_fnChangeCallback = callback;
|
||||
|
||||
m_fValue = ( float )atof( m_pszString );
|
||||
m_nValue = atoi( m_pszString ); // dont convert from float to int and lose bits
|
||||
|
||||
// Bounds Check, should never happen, if it does, no big deal
|
||||
if ( m_bHasMin && ( m_fValue < m_fMinVal ) )
|
||||
@@ -975,8 +976,6 @@ void ConVar::Create( const char *pName, const char *pDefaultValue, int flags /*=
|
||||
Assert( 0 );
|
||||
}
|
||||
|
||||
m_nValue = ( int )m_fValue;
|
||||
|
||||
BaseClass::Create( pName, pHelpString, flags );
|
||||
}
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ uint32 MurmurHash2( const void * key, int len, uint32 seed )
|
||||
#define TOLOWERU( c ) ( ( uint32 ) ( ( ( c >= 'A' ) && ( c <= 'Z' ) )? c + 32 : c ) )
|
||||
uint32 MurmurHash2LowerCase( char const *pString, uint32 nSeed )
|
||||
{
|
||||
int nLen = strlen( pString );
|
||||
int nLen = ( int )strlen( pString );
|
||||
char *p = ( char * ) stackalloc( nLen + 1 );
|
||||
for( int i = 0; i < nLen ; i++ )
|
||||
{
|
||||
|
||||
@@ -112,7 +112,7 @@ void ConstructStringVArgsInternal_Impl(T *unicodeOutput, int unicodeBufferSizeIn
|
||||
}
|
||||
else
|
||||
{
|
||||
AssertMsg( argindex < numFormatParameters, "ConstructStringVArgsInternal_Impl() - Found a %s# escape sequence whose index was more than the number of args." );
|
||||
AssertMsg( argindex < numFormatParameters, "ConstructStringVArgsInternal_Impl() - Found a %%s# escape sequence whose index was more than the number of args." );
|
||||
|
||||
//copy it over, char by char
|
||||
*outputPos = *searchPos;
|
||||
|
||||
@@ -32,7 +32,7 @@ void CUtlMemoryPool::SetErrorReportFunc( MemoryPoolReportFunc_t func )
|
||||
CUtlMemoryPool::CUtlMemoryPool( int blockSize, int numElements, int growMode, const char *pszAllocOwner, int nAlignment )
|
||||
{
|
||||
#ifdef _X360
|
||||
if( numElements > 0 && growMode != GROW_NONE )
|
||||
if( numElements > 0 && growMode != UTLMEMORYPOOL_GROW_NONE )
|
||||
{
|
||||
numElements = 1;
|
||||
}
|
||||
@@ -157,18 +157,18 @@ void CUtlMemoryPool::AddNewBlob()
|
||||
|
||||
int sizeMultiplier;
|
||||
|
||||
if( m_GrowMode == GROW_SLOW )
|
||||
if( m_GrowMode == UTLMEMORYPOOL_GROW_SLOW )
|
||||
{
|
||||
sizeMultiplier = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_GrowMode == GROW_NONE )
|
||||
if ( m_GrowMode == UTLMEMORYPOOL_GROW_NONE )
|
||||
{
|
||||
// Can only have one allocation when we're in this mode
|
||||
if( m_NumBlobs != 0 )
|
||||
{
|
||||
Assert( !"CUtlMemoryPool::AddNewBlob: mode == GROW_NONE" );
|
||||
Assert( !"CUtlMemoryPool::AddNewBlob: mode == UTLMEMORYPOOL_GROW_NONE" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -231,10 +231,10 @@ void *CUtlMemoryPool::Alloc( size_t amount )
|
||||
|
||||
if( !m_pHeadOfFreeList )
|
||||
{
|
||||
// returning NULL is fine in GROW_NONE
|
||||
if( m_GrowMode == GROW_NONE )
|
||||
// returning NULL is fine in UTLMEMORYPOOL_GROW_NONE
|
||||
if( m_GrowMode == UTLMEMORYPOOL_GROW_NONE )
|
||||
{
|
||||
//Assert( !"CUtlMemoryPool::Alloc: tried to make new blob with GROW_NONE" );
|
||||
//Assert( !"CUtlMemoryPool::Alloc: tried to make new blob with UTLMEMORYPOOL_GROW_NONE" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1824,7 +1824,18 @@ void V_DefaultExtension( char *path, const char *extension, int pathStringLength
|
||||
void V_SetExtension( char *path, const char *extension, int pathStringLength )
|
||||
{
|
||||
V_StripExtension( path, path, pathStringLength );
|
||||
V_DefaultExtension( path, extension, pathStringLength );
|
||||
|
||||
// We either had an extension and stripped it, or didn't have an extension
|
||||
// at all. Either way, we need to concatenate our extension now.
|
||||
|
||||
// extension is not required to start with '.', so if it's not there,
|
||||
// then append that first.
|
||||
if ( extension[0] != '.' )
|
||||
{
|
||||
V_strncat( path, ".", pathStringLength, COPY_ALL_CHARACTERS );
|
||||
}
|
||||
|
||||
V_strncat( path, extension, pathStringLength, COPY_ALL_CHARACTERS );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -2663,6 +2674,217 @@ char *V_AddBackSlashesToSpecialChars( char const *pSrc )
|
||||
*( pOut++ ) = 0;
|
||||
return pRet;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Helper for converting a numeric value to a hex digit, value should be 0-15.
|
||||
//-----------------------------------------------------------------------------
|
||||
char cIntToHexDigit( int nValue )
|
||||
{
|
||||
Assert( nValue >= 0 && nValue <= 15 );
|
||||
return "0123456789ABCDEF"[ nValue & 15 ];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Helper for converting a hex char value to numeric, return -1 if the char
|
||||
// is not a valid hex digit.
|
||||
//-----------------------------------------------------------------------------
|
||||
int iHexCharToInt( char cValue )
|
||||
{
|
||||
int32 iValue = cValue;
|
||||
if ( (uint32)( iValue - '0' ) < 10 )
|
||||
return iValue - '0';
|
||||
|
||||
iValue |= 0x20;
|
||||
if ( (uint32)( iValue - 'a' ) < 6 )
|
||||
return iValue - 'a' + 10;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Internal implementation of encode, works in the strict RFC manner, or
|
||||
// with spaces turned to + like HTML form encoding.
|
||||
//-----------------------------------------------------------------------------
|
||||
void Q_URLEncodeInternal( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen, bool bUsePlusForSpace )
|
||||
{
|
||||
if ( nDestLen < 3*nSourceLen )
|
||||
{
|
||||
pchDest[0] = '\0';
|
||||
AssertMsg( false, "Target buffer for Q_URLEncode needs to be 3 times larger than source to guarantee enough space\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
int iDestPos = 0;
|
||||
for ( int i=0; i < nSourceLen; ++i )
|
||||
{
|
||||
// We allow only a-z, A-Z, 0-9, period, underscore, and hyphen to pass through unescaped.
|
||||
// These are the characters allowed by both the original RFC 1738 and the latest RFC 3986.
|
||||
// Current specs also allow '~', but that is forbidden under original RFC 1738.
|
||||
if ( !( pchSource[i] >= 'a' && pchSource[i] <= 'z' ) && !( pchSource[i] >= 'A' && pchSource[i] <= 'Z' ) && !(pchSource[i] >= '0' && pchSource[i] <= '9' )
|
||||
&& pchSource[i] != '-' && pchSource[i] != '_' && pchSource[i] != '.'
|
||||
)
|
||||
{
|
||||
if ( bUsePlusForSpace && pchSource[i] == ' ' )
|
||||
{
|
||||
pchDest[iDestPos++] = '+';
|
||||
}
|
||||
else
|
||||
{
|
||||
pchDest[iDestPos++] = '%';
|
||||
uint8 iValue = pchSource[i];
|
||||
if ( iValue == 0 )
|
||||
{
|
||||
pchDest[iDestPos++] = '0';
|
||||
pchDest[iDestPos++] = '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
char cHexDigit1 = cIntToHexDigit( iValue % 16 );
|
||||
iValue /= 16;
|
||||
char cHexDigit2 = cIntToHexDigit( iValue );
|
||||
pchDest[iDestPos++] = cHexDigit2;
|
||||
pchDest[iDestPos++] = cHexDigit1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pchDest[iDestPos++] = pchSource[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Null terminate
|
||||
pchDest[iDestPos++] = 0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Internal implementation of decode, works in the strict RFC manner, or
|
||||
// with spaces turned to + like HTML form encoding.
|
||||
//
|
||||
// Returns the amount of space used in the output buffer.
|
||||
//-----------------------------------------------------------------------------
|
||||
size_t Q_URLDecodeInternal( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen, bool bUsePlusForSpace )
|
||||
{
|
||||
if ( nDecodeDestLen < nEncodedSourceLen )
|
||||
{
|
||||
AssertMsg( false, "Q_URLDecode needs a dest buffer at least as large as the source" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iDestPos = 0;
|
||||
for( int i=0; i < nEncodedSourceLen; ++i )
|
||||
{
|
||||
if ( bUsePlusForSpace && pchEncodedSource[i] == '+' )
|
||||
{
|
||||
pchDecodeDest[ iDestPos++ ] = ' ';
|
||||
}
|
||||
else if ( pchEncodedSource[i] == '%' )
|
||||
{
|
||||
// Percent signifies an encoded value, look ahead for the hex code, convert to numeric, and use that
|
||||
|
||||
// First make sure we have 2 more chars
|
||||
if ( i < nEncodedSourceLen - 2 )
|
||||
{
|
||||
char cHexDigit1 = pchEncodedSource[i+1];
|
||||
char cHexDigit2 = pchEncodedSource[i+2];
|
||||
|
||||
// Turn the chars into a hex value, if they are not valid, then we'll
|
||||
// just place the % and the following two chars direct into the string,
|
||||
// even though this really shouldn't happen, who knows what bad clients
|
||||
// may do with encoding.
|
||||
bool bValid = false;
|
||||
int iValue = iHexCharToInt( cHexDigit1 );
|
||||
if ( iValue != -1 )
|
||||
{
|
||||
iValue *= 16;
|
||||
int iValue2 = iHexCharToInt( cHexDigit2 );
|
||||
if ( iValue2 != -1 )
|
||||
{
|
||||
iValue += iValue2;
|
||||
pchDecodeDest[ iDestPos++ ] = iValue;
|
||||
bValid = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !bValid )
|
||||
{
|
||||
pchDecodeDest[ iDestPos++ ] = '%';
|
||||
pchDecodeDest[ iDestPos++ ] = cHexDigit1;
|
||||
pchDecodeDest[ iDestPos++ ] = cHexDigit2;
|
||||
}
|
||||
}
|
||||
|
||||
// Skip ahead
|
||||
i += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
pchDecodeDest[ iDestPos++ ] = pchEncodedSource[i];
|
||||
}
|
||||
}
|
||||
|
||||
// We may not have extra room to NULL terminate, since this can be used on raw data, but if we do
|
||||
// go ahead and do it as this can avoid bugs.
|
||||
if ( iDestPos < nDecodeDestLen )
|
||||
{
|
||||
pchDecodeDest[iDestPos] = 0;
|
||||
}
|
||||
|
||||
return (size_t)iDestPos;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Encodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2.
|
||||
// This version of the call isn't a strict RFC implementation, but uses + for space as is
|
||||
// the standard in HTML form encoding, despite it not being part of the RFC.
|
||||
//
|
||||
// Dest buffer should be at least as large as source buffer to guarantee room for decode.
|
||||
//-----------------------------------------------------------------------------
|
||||
void Q_URLEncode( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen )
|
||||
{
|
||||
return Q_URLEncodeInternal( pchDest, nDestLen, pchSource, nSourceLen, true );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Decodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2.
|
||||
// This version of the call isn't a strict RFC implementation, but uses + for space as is
|
||||
// the standard in HTML form encoding, despite it not being part of the RFC.
|
||||
//
|
||||
// Dest buffer should be at least as large as source buffer to guarantee room for decode.
|
||||
// Dest buffer being the same as the source buffer (decode in-place) is explicitly allowed.
|
||||
//-----------------------------------------------------------------------------
|
||||
size_t Q_URLDecode( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen )
|
||||
{
|
||||
return Q_URLDecodeInternal( pchDecodeDest, nDecodeDestLen, pchEncodedSource, nEncodedSourceLen, true );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Encodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2.
|
||||
// This version will not encode space as + (which HTML form encoding uses despite not being part of the RFC)
|
||||
//
|
||||
// Dest buffer should be at least as large as source buffer to guarantee room for decode.
|
||||
//-----------------------------------------------------------------------------
|
||||
void Q_URLEncodeRaw( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen )
|
||||
{
|
||||
return Q_URLEncodeInternal( pchDest, nDestLen, pchSource, nSourceLen, false );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Decodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2.
|
||||
// This version will not recognize + as a space (which HTML form encoding uses despite not being part of the RFC)
|
||||
//
|
||||
// Dest buffer should be at least as large as source buffer to guarantee room for decode.
|
||||
// Dest buffer being the same as the source buffer (decode in-place) is explicitly allowed.
|
||||
//-----------------------------------------------------------------------------
|
||||
size_t Q_URLDecodeRaw( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen )
|
||||
{
|
||||
return Q_URLDecodeInternal( pchDecodeDest, nDecodeDestLen, pchEncodedSource, nEncodedSourceLen, false );
|
||||
}
|
||||
|
||||
#if defined( LINUX ) || defined( _PS3 )
|
||||
extern "C" void qsort_s( void *base, size_t num, size_t width, int (*compare )(void *, const void *, const void *), void * context );
|
||||
#endif
|
||||
|
||||
@@ -1730,7 +1730,6 @@ void CUtlBuffer::Swap( CUtlMemory<uint8> &mem )
|
||||
CUtlInplaceBuffer::CUtlInplaceBuffer( int growSize /* = 0 */, int initSize /* = 0 */, int nFlags /* = 0 */ ) :
|
||||
CUtlBuffer( growSize, initSize, nFlags )
|
||||
{
|
||||
NULL;
|
||||
}
|
||||
|
||||
bool CUtlInplaceBuffer::InplaceGetLinePtr( char **ppszInBufferPtr, int *pnLineLength )
|
||||
|
||||
@@ -225,7 +225,7 @@ CUtlSymbol CUtlSymbolTable::AddString( const char* pString )
|
||||
if (id.IsValid())
|
||||
return id;
|
||||
|
||||
int len = strlen(pString) + 1;
|
||||
int len = V_strlen(pString) + 1;
|
||||
|
||||
// Find a pool with space for this string, or allocate a new one.
|
||||
int iPool = FindPoolWithSpace( len );
|
||||
|
||||
Reference in New Issue
Block a user