summaryrefslogtreecommitdiff
path: root/internal_rewrite/interface.cpp
diff options
context:
space:
mode:
authornavewindre <boneyaard@gmail.com>2018-09-01 14:23:02 +0200
committernavewindre <boneyaard@gmail.com>2018-09-01 14:23:02 +0200
commitbeb5515757c0e653adc33f181184fe3791ca0a6b (patch)
tree68f123f602795a31a8811bd56e3b3271c102a3fa /internal_rewrite/interface.cpp
parent0767d6d4acaf5f86a67a375dffa54da9323646e3 (diff)
dasdadasf
Diffstat (limited to 'internal_rewrite/interface.cpp')
-rw-r--r--internal_rewrite/interface.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/internal_rewrite/interface.cpp b/internal_rewrite/interface.cpp
index 351b1ea..baf4f8a 100644
--- a/internal_rewrite/interface.cpp
+++ b/internal_rewrite/interface.cpp
@@ -9,13 +9,20 @@
#include "base_cheat.hpp"
#include "settings.hpp"
#include "context.hpp"
+#include "modules.hpp"
using namespace factory;
interfaces::c_interface_manager g_factory;
factory::c_csgo g_csgo;
-bool factory::create_interfaces( c_csgo* instance ) {
+bool factory::create_interfaces( c_csgo* instance, header_t* header ) {
+#ifndef HEADER_MODULE
+ header->client_panorama = ( uintptr_t )GetModuleHandleA( "client_panorama.dll" );
+ header->vguimatsurface = ( uintptr_t )GetModuleHandleA( "vguimatsurface.dll" );
+ header->shaderapidx9 = ( uintptr_t )GetModuleHandleA( "shaderapidx9.dll" );
+ header->vstdlib = ( uintptr_t )GetModuleHandleA( "vstdlib.dll" );
+#endif
instance->create( &instance->m_chl, xors( "VClient" ) );
instance->create( &instance->m_surface, xors( "VGUI_Surface" ) );
@@ -43,10 +50,18 @@ bool factory::create_interfaces( c_csgo* instance ) {
auto d3d_device = pattern::first_code_match( GetModuleHandleA( xors( "shaderapidx9.dll" ) ),
xors( "A1 ?? ?? ?? ?? 50 8B 08 FF 51 0C" ) ) + 0x1;
+#ifdef HEADER_MODULE
+ auto move_helper = header->patterns.move_helper + 0x2;
+#else
auto move_helper = pattern::first_code_match( g_csgo.m_chl.dll( ),
xors( "8B 0D ?? ?? ?? ?? 8B 46 08 68" ) ) + 0x2;
+#endif
+#ifdef HEADER_MODULE
+ auto beam_ptr = header->patterns.beam_ptr + 0x1;
+#else
auto beam_ptr = pattern::first_code_match( g_csgo.m_chl.dll( ), xors( "B9 ? ? ? ? A1 ? ? ? ? FF 10 A1 ? ? ? ? B9" ), 0x1 );
+#endif
auto mm_ptr = pattern::first_code_match( g_csgo.m_chl.dll( ), xors( "89 4C 24 10 8B 0D ? ? ? ? 53" ), 0x6 );
@@ -55,10 +70,10 @@ bool factory::create_interfaces( c_csgo* instance ) {
instance->create( &instance->m_beams, *reinterpret_cast< uintptr_t* >( beam_ptr ) );
//instance->create( &instance->m_mm, **reinterpret_cast< uintptr_t** >( mm_ptr ) );
- instance->m_steam_pipe_handle = ( ( SteamPipeHandle( __cdecl* )( ) )GetProcAddress( GetModuleHandleA( xors( "steam_api.dll" ) ), xors( "SteamAPI_GetHSteamPipe" ) ) )( );
- instance->m_steam_user_handle = ( ( SteamUserHandle( __cdecl* )( ) )GetProcAddress( GetModuleHandleA( xors( "steam_api.dll" ) ), xors( "SteamAPI_GetHSteamUser" ) ) )( );
+ instance->m_steam_pipe_handle = ( ( SteamPipeHandle( __cdecl* )( ) )GetProcAddress( ( HMODULE )header->steam_api, xors( "SteamAPI_GetHSteamPipe" ) ) )( );
+ instance->m_steam_user_handle = ( ( SteamUserHandle( __cdecl* )( ) )GetProcAddress( ( HMODULE )header->steam_api, xors( "SteamAPI_GetHSteamUser" ) ) )( );
- uintptr_t steam_client_ptr = ( ( uintptr_t ( __cdecl* )( void ) )GetProcAddress( GetModuleHandleA( xors( "steam_api.dll" ) ), xors( "SteamClient" ) ) )( );
+ uintptr_t steam_client_ptr = ( ( uintptr_t ( __cdecl* )( void ) )GetProcAddress( ( HMODULE )header->steam_api, xors( "SteamClient" ) ) )( );
instance->create( &instance->m_steam_client, steam_client_ptr );
uintptr_t steam_friends_ptr = ( uintptr_t )instance->m_steam_client( )->GetISteamFriends( instance->m_steam_user_handle, instance->m_steam_pipe_handle, "SteamFriends015" );
@@ -66,15 +81,11 @@ bool factory::create_interfaces( c_csgo* instance ) {
auto kv_fn = ( void*( __cdecl* )( ) )( GetProcAddress(
- GetModuleHandleA( xors( "vstdlib.dll" ) ),
+ ( HMODULE )header->vstdlib,
xors( "KeyValuesSystem" ) ) );
instance->m_keyvalues = ( IKeyValuesSystem* )kv_fn( );
- instance->m_alloc = *( IMemAlloc** )GetProcAddress(
- GetModuleHandleA( xors( "tier0.dll" ) ),
- xors( "g_pMemAlloc" ) );
-
uintptr_t* globals = **reinterpret_cast< uintptr_t*** >(
instance->m_chl->get_old_function( 0 ) + 0x1b );
instance->m_globals = reinterpret_cast< global_vars_t* >( globals );
@@ -192,7 +203,7 @@ void factory::c_csgo::initialize( ) {
//hi
- factory::create_interfaces( &g_csgo );
+ factory::create_interfaces( &g_csgo, &g_header );
g_fonts.initialize( );
g_netvars.init( );