From 3d412a4b30a9f7c7f51ea6562e694315948bd3da Mon Sep 17 00:00:00 2001 From: boris Date: Wed, 28 Nov 2018 16:00:02 +1300 Subject: cleaned up in short, the cheat and loader are now separate solutions. unused stuff was moved into the legacy solution in case anyone wants to compile it or whatever. i can change this back if you want to. also, i configured the loader to compile in x64, and have separate build types for linux and win64 --- internal_rewrite/KeyValues.cpp | 83 ------------------------------------------ 1 file changed, 83 deletions(-) delete mode 100644 internal_rewrite/KeyValues.cpp (limited to 'internal_rewrite/KeyValues.cpp') diff --git a/internal_rewrite/KeyValues.cpp b/internal_rewrite/KeyValues.cpp deleted file mode 100644 index 300b6f1..0000000 --- a/internal_rewrite/KeyValues.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "KeyValues.hpp" -#include "pattern.hpp" -#include "interface.hpp" - -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( "vstdlib.dll" ) ), xors( "55 8B EC 83 EC 0C 53 8B 5D 08 57" ) ); - 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( "vstdlib.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; -} - -KeyValues::KeyValues( const char* setName ) { - static void( __thiscall* keyvalues_constructor )( KeyValues*, const char* ) = 0; - - if( !keyvalues_constructor ) { - auto address = pattern::first_code_match( g_csgo.m_chl.dll( ), - xors( "68 ? ? ? ? 8B C8 E8 ? ? ? ? 89 45 FC EB 07 C7 45 ? ? ? ? ? 8B 03 56" ), - 0x8 ); - - keyvalues_constructor = decltype( keyvalues_constructor )( address + *( uintptr_t* )( address ) + 4 ); - } - - keyvalues_constructor( this, setName ); -} - -KeyValues::~KeyValues( ) { - static bool( __thiscall* keyvalues_remove_everything )( KeyValues* ) = 0; - - if( !keyvalues_remove_everything ) { - auto address = pattern::first_code_match( g_csgo.m_chl.dll( ), - xors( "E8 ? ? ? ? 81 23 ? ? ? ?" ), - 0x1 ); - - keyvalues_remove_everything = decltype( keyvalues_remove_everything )( address + *( uintptr_t* )( address ) + 4 ); - } - - keyvalues_remove_everything( this ); - g_csgo.m_keyvalues->FreeKeyValuesMemory( this ); - -} - - -bool KeyValues::LoadFromBuffer( char const *resourceName, const char *pBuffer, void* pFileSystem, const char *pPathID, bool( *unknown )( const char* ) ) { - static auto load_from_buffer = pattern::first_code_match( g_csgo.m_chl.dll( ), xors( "55 8B EC 83 E4 F8 83 EC 34 53 8B 5D 0C 89 4C 24 04" ) ); - return reinterpret_cast< bool( __thiscall* )( KeyValues*, const char*, const char*, void*, const char*, bool( *)( const char* ) ) >( load_from_buffer ) - ( this, resourceName, pBuffer, pFileSystem, pPathID, unknown ); -} - -const char* KeyValues::get_string( const char* name, const char* value ) { - static auto offset = pattern::first_code_match( g_csgo.m_chl.dll( ), xors( "55 8B EC 83 E4 C0 81 EC ?? ?? ?? ?? 53 8B 5D 08" ) ); - using fn = const char*( __thiscall* )( void*, const char*, const char* ); - - auto result = ( ( fn )( offset ) )( this, name, value ); - - return result; - -} - -KeyValues* KeyValues::FindKey( const char* name ) { - auto key = g_csgo.m_keyvalues->GetSymbolForString( name, false ); - for( auto dat = m_pSub; !!dat; dat = dat->m_pPeer ) { - if( dat->m_iKeyName == key ) { - return dat; - } - } - - return nullptr; -} \ No newline at end of file -- cgit v1.2.3