diff --git a/lib/public/linux/tier1_i486.a b/lib/public/linux/tier1_i486.a index f98ae8ad..9ab30e56 100644 Binary files a/lib/public/linux/tier1_i486.a and b/lib/public/linux/tier1_i486.a differ diff --git a/lib/public/linux64/tier1.a b/lib/public/linux64/tier1.a index afd65298..5118beae 100644 Binary files a/lib/public/linux64/tier1.a and b/lib/public/linux64/tier1.a differ diff --git a/lib/public/x64/tier1.lib b/lib/public/x64/tier1.lib index 79ed01d6..11090c04 100644 Binary files a/lib/public/x64/tier1.lib and b/lib/public/x64/tier1.lib differ diff --git a/lib/public/x86/tier1.lib b/lib/public/x86/tier1.lib index 994c4014..f1786b31 100644 Binary files a/lib/public/x86/tier1.lib and b/lib/public/x86/tier1.lib differ diff --git a/public/tier1/KeyValues.h b/public/tier1/KeyValues.h index 838bf0b8..90195e73 100644 --- a/public/tier1/KeyValues.h +++ b/public/tier1/KeyValues.h @@ -39,6 +39,7 @@ class CUtlBuffer; class Color; typedef void * FileHandle_t; class CKeyValuesGrowableStringTable; +class IKeyValuesSystem; //----------------------------------------------------------------------------- // Purpose: Simple recursive data access class @@ -117,9 +118,12 @@ public: // gets the name as a unique int int GetNameSymbol() const { return m_iKeyName; } + bool IsUsingLocalStorage() const; + // File access. Set UsesEscapeSequences true, if resource file/buffer uses Escape Sequences (eg \n, \t) void UsesEscapeSequences(bool state); // default false void UsesConditionals(bool state); // default true + bool LoadFromFile( IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL, bool refreshCache = false ); bool SaveToFile( IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL, bool sortKeys = false, bool bAllowEmptyString = false, bool bCacheResult = false ); @@ -330,12 +334,14 @@ private: char m_iDataType; char m_bHasEscapeSequences; // true, if while parsing this KeyValue, Escape Sequences are used (default false) char m_bEvaluateConditionals; // true, if while parsing this KeyValue, conditionals blocks are evaluated (default true) - char unused[1]; + char m_bLocalStorage; KeyValues *m_pPeer; // pointer to next key in list KeyValues *m_pSub; // pointer to Start of a new sub key list KeyValues *m_pChain;// Search here if it's not in our list + CKeyValuesGrowableStringTable* m_pStringTable; + private: // Statics to implement the optional growable string table // Function pointers that will determine which mode we are in diff --git a/tier1/KeyValues.cpp b/tier1/KeyValues.cpp index f394bebe..6be7790e 100644 --- a/tier1/KeyValues.cpp +++ b/tier1/KeyValues.cpp @@ -461,9 +461,9 @@ void KeyValues::Init() m_bHasEscapeSequences = false; m_bEvaluateConditionals = true; + m_bLocalStorage = false; - // for future proof - memset( unused, 0, sizeof(unused) ); + m_pStringTable = NULL; } //----------------------------------------------------------------------------- @@ -528,7 +528,10 @@ void KeyValues::ChainKeyValue( KeyValues* pChain ) //----------------------------------------------------------------------------- const char *KeyValues::GetName( void ) const { - return s_pfGetStringForSymbol( m_iKeyName ); + if ( m_bLocalStorage ) + return m_pStringTable->GetStringForSymbol( m_iKeyName ); + else + return s_pfGetStringForSymbol( m_iKeyName ); } //----------------------------------------------------------------------------- @@ -1001,7 +1004,9 @@ KeyValues *KeyValues::FindKey(const char *keyName, bool bCreate) } // lookup the symbol for the search string - HKeySymbol iSearchStr = s_pfGetSymbolForString( searchStr, bCreate ); + HKeySymbol iSearchStr = m_bLocalStorage + ? m_pStringTable->GetSymbolForString( searchStr, bCreate ) + : s_pfGetSymbolForString( searchStr, bCreate ); if ( iSearchStr == INVALID_KEY_SYMBOL ) { @@ -1730,7 +1735,18 @@ void KeyValues::SetFloat( const char *keyName, float value ) void KeyValues::SetName( const char * setName ) { - m_iKeyName = s_pfGetSymbolForString( setName, true ); + if ( m_bLocalStorage ) + m_iKeyName = m_pStringTable->GetSymbolForString( setName ); + else + m_iKeyName = s_pfGetSymbolForString( setName, true ); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +bool KeyValues::IsUsingLocalStorage() const +{ + return m_bLocalStorage != 0; } //-----------------------------------------------------------------------------