From c808aa077d17c1c837ea94dcde1c8c92df71999d Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sat, 28 May 2022 02:24:57 +0200 Subject: [PATCH] Light KeyValues cleanup --- r5dev/vstdlib/keyvaluessystem.cpp | 33 +++---------------------------- r5dev/vstdlib/keyvaluessystem.h | 3 +-- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/r5dev/vstdlib/keyvaluessystem.cpp b/r5dev/vstdlib/keyvaluessystem.cpp index 12f13615..82076459 100644 --- a/r5dev/vstdlib/keyvaluessystem.cpp +++ b/r5dev/vstdlib/keyvaluessystem.cpp @@ -64,41 +64,14 @@ const char* CKeyValuesSystem::GetStringForSymbol(HKeySymbol symbol) return CallVFunc(index, this, symbol); } -//----------------------------------------------------------------------------- -// Purpose: frees a KeyValues object from the shared mempool -// Input : *pMem - -//----------------------------------------------------------------------------- -void CKeyValuesSystem::FreeKeyValuesMemory(CKeyValuesSystem* thisptr, void* pMem) -{ - //__int64* v2; // rax - //__int64 v4; // rax - //__int64* v5; // rax - - //v2 = qword_14D40B538; - //if (!qword_14D40B538) - //{ - // v2 = sub_140462930(); - // qword_14D40B538 = v2; - //} - //v4 = (*(*v2 + 48))(v2, pMem); - //if (v4 > 0) - // CKeyValuesSystem::m_pMemPool -= v4; - //v5 = qword_14D40B538; - //if (!qword_14D40B538) - //{ - // v5 = sub_140462930(); - // qword_14D40B538 = v5; - //} - //(*(*v5 + 40))(v5, pMem); -} - //----------------------------------------------------------------------------- // Purpose: gets the global KeyValues memory pool // Output : *g_pKeyValuesMemPool - //----------------------------------------------------------------------------- -void* CKeyValuesSystem::GetMemPool(void) const +void* CKeyValuesSystem::GetMemPool(void) { - return g_pKeyValuesMemPool; // May need to dereference this once more not sure right now. + static int index = 7; + return CallVFunc(index, this); } //----------------------------------------------------------------------------- diff --git a/r5dev/vstdlib/keyvaluessystem.h b/r5dev/vstdlib/keyvaluessystem.h index cb38a74f..aa6cc597 100644 --- a/r5dev/vstdlib/keyvaluessystem.h +++ b/r5dev/vstdlib/keyvaluessystem.h @@ -11,9 +11,8 @@ public: void FreeKeyValuesMemory(void* pMem); HKeySymbol GetSymbolForString(const char* name, bool bCreate); const char* GetStringForSymbol(HKeySymbol symbol); - void __fastcall FreeKeyValuesMemory(CKeyValuesSystem* this_arg, void* ptr_mem_arg); - void* GetMemPool(void) const; // GetMemPool returns a global variable called m_pMemPool, it gets modified by AllocKeyValuesMemory and with FreeKeyValuesMemory you can see where to find it in FreeKeyValuesMemory. + void* GetMemPool(void); // GetMemPool returns a global variable called m_pMemPool, it gets modified by AllocKeyValuesMemory and with FreeKeyValuesMemory you can see where to find it in FreeKeyValuesMemory. void SetKeyValuesExpressionSymbol(const char* name, bool bValue); bool GetKeyValuesExpressionSymbol(const char* name); HKeySymbol GetSymbolForStringCaseSensitive(HKeySymbol& hCaseInsensitiveSymbol, const char* name, bool bCreate);