From a5dbb62fd6211f2cd297635855660b0040663977 Mon Sep 17 00:00:00 2001 From: PerfectLaugh <20559490+PerfectLaugh@users.noreply.github.com> Date: Fri, 24 Jun 2022 21:23:27 +0800 Subject: [PATCH] KeyValues update on 6/24/2022 (#102) * to get around gcc compilation * KeyValues update on 6/24/2022 * I should initialize the additional varaibles * correct vtable destructor * remove unknown1 virtual --- public/tier0/threadtools.h | 10 ++++++++-- public/tier1/KeyValues.h | 3 +++ public/vstdlib/IKeyValuesSystem.h | 4 +++- tier1/KeyValues.cpp | 5 ++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/public/tier0/threadtools.h b/public/tier0/threadtools.h index 876f3a0e..dfcd5a8d 100644 --- a/public/tier0/threadtools.h +++ b/public/tier0/threadtools.h @@ -1,4 +1,4 @@ -//========== Copyright © 2005, Valve Corporation, All rights reserved. ======== +//========== Copyright � 2005, Valve Corporation, All rights reserved. ======== // // Purpose: A collection of utility classes to simplify thread handling, and // as much as possible contain portability problems. Here avoiding @@ -1135,7 +1135,13 @@ private: class ALIGN8 PLATFORM_CLASS CThreadSpinRWLock { public: - CThreadSpinRWLock() { COMPILE_TIME_ASSERT( sizeof( LockInfo_t ) == sizeof( int64 ) ); Assert( (intp)this % 8 == 0 ); memset( this, 0, sizeof( *this ) ); } + CThreadSpinRWLock() { + COMPILE_TIME_ASSERT( sizeof( LockInfo_t ) == sizeof( int64 ) ); + Assert( (intp)this % 8 == 0 ); + m_lockInfo.m_writerId = 0; + m_lockInfo.m_nReaders = 0; + m_lockInfo.m_i64 = 0; + } bool TryLockForWrite(); bool TryLockForRead(); diff --git a/public/tier1/KeyValues.h b/public/tier1/KeyValues.h index 9eeb47bd..b3b83897 100644 --- a/public/tier1/KeyValues.h +++ b/public/tier1/KeyValues.h @@ -342,6 +342,9 @@ private: char m_bHasEscapeSequences; // true, if while parsing this KeyValue, Escape Sequences are used (default false) uint16 m_iKeyNameCaseSensitive2; // 2nd part of case sensitive symbol defined in KeyValueSystem; + uint32 m_iUnk1; + uint32 m_iUnk2; + 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 diff --git a/public/vstdlib/IKeyValuesSystem.h b/public/vstdlib/IKeyValuesSystem.h index 6f3eb159..d750f412 100644 --- a/public/vstdlib/IKeyValuesSystem.h +++ b/public/vstdlib/IKeyValuesSystem.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -23,6 +23,8 @@ typedef int HKeySymbol; class IKeyValuesSystem { public: + virtual ~IKeyValuesSystem() = 0; + // registers the size of the KeyValues in the specified instance // so it can build a properly sized memory pool for the KeyValues objects // the sizes will usually never differ but this is for versioning safety diff --git a/tier1/KeyValues.cpp b/tier1/KeyValues.cpp index c433c649..a444f848 100644 --- a/tier1/KeyValues.cpp +++ b/tier1/KeyValues.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -300,6 +300,9 @@ void KeyValues::Init() m_pValue = NULL; m_bHasEscapeSequences = false; + + m_iUnk1 = 0; + m_iUnk2 = 0; } //-----------------------------------------------------------------------------