Add IKeyValuesSystem class from Valve Source SDK 2013

This commit is contained in:
Kawe Mazidjatari 2022-11-27 21:53:54 +01:00
parent b1b1e85b69
commit f6c26464c7
2 changed files with 54 additions and 4 deletions

View File

@ -0,0 +1,52 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef VSTDLIB_IKEYVALUESSYSTEM_H
#define VSTDLIB_IKEYVALUESSYSTEM_H
#ifdef _WIN32
#pragma once
#endif
//#include "vstdlib/vstdlib.h"
// handle to a KeyValues key name symbol
typedef int HKeySymbol;
#define INVALID_KEY_SYMBOL (-1)
//-----------------------------------------------------------------------------
// Purpose: Interface to shared data repository for KeyValues (included in vgui_controls.lib)
// allows for central data storage point of KeyValues symbol table
//-----------------------------------------------------------------------------
class IKeyValuesSystem
{
public:
// 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
virtual void RegisterSizeofKeyValues( int size ) = 0;
// allocates/frees a KeyValues object from the shared mempool
virtual void *AllocKeyValuesMemory( int size ) = 0;
virtual void FreeKeyValuesMemory( void *pMem ) = 0;
// symbol table access (used for key names)
virtual HKeySymbol GetSymbolForString( const char *name, bool bCreate = true ) = 0;
virtual const char *GetStringForSymbol( HKeySymbol symbol ) = 0;
// for debugging, adds KeyValues record into global list so we can track memory leaks
virtual void AddKeyValuesToMemoryLeakList( void *pMem, HKeySymbol name ) = 0;
virtual void RemoveKeyValuesFromMemoryLeakList( void *pMem ) = 0;
// set/get a value for keyvalues resolution symbol
// e.g.: SetKeyValuesExpressionSymbol( "LOWVIOLENCE", true ) - enables [$LOWVIOLENCE]
virtual void SetKeyValuesExpressionSymbol( const char *name, bool bValue ) = 0;
virtual bool GetKeyValuesExpressionSymbol( const char *name ) = 0;
// symbol table access from code with case-preserving requirements (used for key names)
virtual HKeySymbol GetSymbolForStringCaseSensitive( HKeySymbol &hCaseInsensitiveSymbol, const char *name, bool bCreate = true ) = 0;
};
#endif // VSTDLIB_IKEYVALUESSYSTEM_H

View File

@ -1,9 +1,8 @@
#pragma once
typedef int HKeySymbol;
#define INVALID_KEY_SYMBOL (-1)
#include "public/ikeyvaluessystem.h"
class CKeyValuesSystem // VTABLE @ 0x1413AA1E8 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
class CKeyValuesSystem : public IKeyValuesSystem// VTABLE @ 0x1413AA1E8 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
{
public:
void RegisterSizeofKeyValues(int64_t size);
@ -19,7 +18,6 @@ public:
// Datatypes aren't accurate. But full fill the actual byte distance.
public:
void* m_pVTable; // 0x0000
int64_t m_iMaxKeyValuesSize; // 0x0008
private:
char gap10[240]; // 0x0010