summaryrefslogtreecommitdiff
path: root/gmod/KeyValues.cpp
diff options
context:
space:
mode:
authorboris <wzn@moneybot.cc>2018-11-28 16:00:02 +1300
committerboris <wzn@moneybot.cc>2018-11-28 16:00:02 +1300
commit3d412a4b30a9f7c7f51ea6562e694315948bd3da (patch)
tree26d67dfd1f3e5fd12903ad13e85d0cb8bcf8f21c /gmod/KeyValues.cpp
parente4729e4393d90271a3814c7a79950a660c48325a (diff)
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
Diffstat (limited to 'gmod/KeyValues.cpp')
-rw-r--r--gmod/KeyValues.cpp50
1 files changed, 0 insertions, 50 deletions
diff --git a/gmod/KeyValues.cpp b/gmod/KeyValues.cpp
deleted file mode 100644
index 265cfd8..0000000
--- a/gmod/KeyValues.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "KeyValues.hpp"
-#include "pattern.hpp"
-#include "interface.hpp"
-
-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 );
- printf( "%s: %d\n", str, symbol );
- 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 bool inc{ };
- static auto key_values_fn = pattern::first_code_match( g_gmod.m_chl.dll( ), xors( "68 ? ? ? ? 8B C8 E8 ? ? ? ? 89 45 FC EB 07 C7 45 ? ? ? ? ? 8B 03 56" ) ) + 7;
- if ( !inc ) {
- key_values_fn += *reinterpret_cast< uintptr_t* >( key_values_fn + 1 ) + 5;
- inc = true;
- }
-
- reinterpret_cast< void( __thiscall* )( KeyValues*, const char* ) >( key_values_fn )( this, setName );
-}
-
-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_gmod.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 );
-}
-
-KeyValues* KeyValues::FindKey( const char* name ) {
- auto key = g_gmod.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