summaryrefslogtreecommitdiff
path: root/tf2/KeyValues.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tf2/KeyValues.cpp')
-rw-r--r--tf2/KeyValues.cpp62
1 files changed, 0 insertions, 62 deletions
diff --git a/tf2/KeyValues.cpp b/tf2/KeyValues.cpp
deleted file mode 100644
index 16ccf6e..0000000
--- a/tf2/KeyValues.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "KeyValues.h"
-#include "pattern.hpp"
-#include "interfaces.h"
-
-void* KeyValues::key_values_ptr;
-
-void IKeyValuesSystem::FreeKeyValuesMemory( void* memory ) {
- return util::get_vfunc< 2, void >( this, memory );
-}
-
-int IKeyValuesSystem::GetSymbolForString( const char* str, bool create ) {
- static auto offset = pattern::first_code_match( GetModuleHandleA( xors( "client.dll" ) ), xors( "FF 15 ? ? ? ? 83 C4 08 89 06 8B C6" ) );
- using fn = int( __thiscall* )( void*, const char*, bool );
-
- int symbol = ( ( fn )( offset ) )( this, str, create );
- return symbol;
-}
-
-const char* IKeyValuesSystem::GetStringForSymbol( int symbol ) {
- static auto offset = pattern::first_code_match( GetModuleHandleA( xors( "client.dll" ) ), xors( "55 8B EC 8B 55 08 83 FA FF" ) );
- using fn = const char*( __thiscall* )( void*, int );
-
- auto result = ( ( fn )( offset ) )( this, symbol );
- printf( "%d: %d\n", symbol, *( int* )( &result ) );
-
- return result;
-}
-
-//honestly keyvalues can suck my fucking cock while i force feeds that fucking whores ass rats to live in its cum infested shithole
-
-
-KeyValues::KeyValues( const char* name ) {
- static std::string fun_pattern = "E8 ? ? ? ? 80 7D 84 00";
- static uintptr_t function_offset = pattern::first_code_match( cl.m_chl.dll( ), fun_pattern ) + 0x13C;
- static auto function = reinterpret_cast< void( __thiscall* )( void*, const char* ) >( function_offset );
- if( function ) function( this, name );
-}
-
-bool KeyValues::LoadFromBuffer( const char* resource_name, const char* buffer, void* file_system, const char* path_id ) {
- static std::string fun_pattern = "55 8B EC 83 E4 F8 83 EC 34 53 8B 5D 0C 89 4C 24 04";
- static auto function = pattern::first_code_match< bool( __thiscall* )( void*, const char*, const char*, void*, const char*, void* ) >( cl.m_chl.dll( ), fun_pattern );
- if( function ) return function( this, resource_name, buffer, file_system, path_id, 0 );
- return false;
-}
-
-void* KeyValues::operator new( size_t alloc_size ) {
- if( !KeyValues::key_values_ptr ) {
- static auto get_key_values = reinterpret_cast< void*( __cdecl* )( ) >( GetProcAddress( GetModuleHandleA( "vstdlib.dll" ), "KeyValuesSystem" ) );
- KeyValues::key_values_ptr = get_key_values( );
- }
-
- return call_vfunc< void*( __thiscall* )( void*, size_t ) >( KeyValues::key_values_ptr, 1 )( KeyValues::key_values_ptr, 32 );
-}
-
-void KeyValues::operator delete( void* mem ) {
- if( !KeyValues::key_values_ptr ) {
- static auto get_key_values = reinterpret_cast< void*( __cdecl* )( ) >( GetProcAddress( GetModuleHandleA( "vstdlib.dll" ), "KeyValuesSystem" ) );
- KeyValues::key_values_ptr = get_key_values( );
- }
-
- call_vfunc< void( __thiscall* )( void*, void* ) >( KeyValues::key_values_ptr, 2 )( KeyValues::key_values_ptr, mem );
-}