2022-04-09 16:16:40 +02:00
# pragma once
typedef int HKeySymbol ;
2022-05-28 02:05:54 +02:00
# define INVALID_KEY_SYMBOL (-1)
2022-04-09 16:16:40 +02:00
class CKeyValuesSystem // VTABLE @ 0x1413AA1E8 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
{
public :
void RegisterSizeofKeyValues ( int64_t size ) ;
void * AllocKeyValuesMemory ( int64_t size ) ;
void FreeKeyValuesMemory ( void * pMem ) ;
HKeySymbol GetSymbolForString ( const char * name , bool bCreate ) ;
const char * GetStringForSymbol ( HKeySymbol symbol ) ;
2022-05-28 02:24:57 +02:00
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.
2022-04-09 16:16:40 +02:00
void SetKeyValuesExpressionSymbol ( const char * name , bool bValue ) ;
bool GetKeyValuesExpressionSymbol ( const char * name ) ;
HKeySymbol GetSymbolForStringCaseSensitive ( HKeySymbol & hCaseInsensitiveSymbol , const char * name , bool bCreate ) ;
// 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
public :
int m_KvConditionalSymbolTable ; // 0x0100
private :
char gap104 [ 4 ] ; // 0x0104
public :
int64_t field_108 ; // 0x0108
private :
char gap110 [ 32 ] ; // 0x0110
public :
int m_mutex ; // 0x0130
} ;
/* ==== KEYVALUESSYSTEM ================================================================================================================================================= */
2022-05-13 14:53:25 +02:00
inline void * g_pKeyValuesMemPool = nullptr ;
2022-04-18 03:35:08 +02:00
inline CKeyValuesSystem * g_pKeyValuesSystem = nullptr ;
2022-04-09 16:16:40 +02:00
///////////////////////////////////////////////////////////////////////////////
class HKeyValuesSystem : public IDetour
{
2022-04-11 01:44:30 +02:00
virtual void GetAdr ( void ) const
2022-04-09 16:16:40 +02:00
{
2022-05-13 14:53:25 +02:00
spdlog : : debug ( " | VAR: g_pKeyValuesMemPool : {:#18x} | \n " , reinterpret_cast < uintptr_t > ( g_pKeyValuesMemPool ) ) ;
spdlog : : debug ( " | VAR: g_pKeyValuesSystem : {:#18x} | \n " , reinterpret_cast < uintptr_t > ( g_pKeyValuesSystem ) ) ;
spdlog : : debug ( " +----------------------------------------------------------------+ \n " ) ;
2022-04-09 16:16:40 +02:00
}
2022-04-11 01:44:30 +02:00
virtual void GetFun ( void ) const { }
2022-04-18 03:35:08 +02:00
virtual void GetVar ( void ) const
{
g_pKeyValuesSystem = g_mGameDll . FindPatternSIMD (
reinterpret_cast < rsig_t > ( " \x48 \x89 \x5C \x24 \x00 \x48 \x89 \x6C \x24 \x00 \x56 \x57 \x41 \x56 \x48 \x83 \xEC \x40 \x48 \x8B \xF1 " ) , " xxxx?xxxx?xxxxxxxxxxx " )
2022-04-19 00:00:45 +02:00
. FindPatternSelf ( " 48 8D 0D ?? ?? ?? 01 " , CMemory : : Direction : : DOWN ) . ResolveRelativeAddressSelf ( 0x3 , 0x7 ) . RCast < CKeyValuesSystem * > ( ) ;
2022-04-18 03:35:08 +02:00
g_pKeyValuesMemPool = g_mGameDll . FindPatternSIMD (
reinterpret_cast < rsig_t > ( " \x48 \x8B \x05 \x00 \x00 \x00 \x00 \xC3 \xCC \xCC \xCC \xCC \xCC \xCC \xCC \xCC \x48 \x85 \xD2 " ) , " xxx????xxxxxxxxxxxx " ) .
2022-05-13 14:53:25 +02:00
ResolveRelativeAddressSelf ( 0x3 , 0x7 ) . RCast < void * > ( ) ;
2022-04-18 03:35:08 +02:00
}
2022-04-11 01:44:30 +02:00
virtual void GetCon ( void ) const { }
virtual void Attach ( void ) const { }
virtual void Detach ( void ) const { }
2022-04-09 16:16:40 +02:00
} ;
///////////////////////////////////////////////////////////////////////////////
REGISTER ( HKeyValuesSystem ) ;