summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal_rewrite/Source.cpp24
-rw-r--r--internal_rewrite/begin_lock.cpp4
-rw-r--r--internal_rewrite/frame_stage_notify.cpp14
-rw-r--r--internal_rewrite/interface.cpp17
-rw-r--r--internal_rewrite/internal_rewrite.vcxproj2
-rw-r--r--internal_rewrite/modules.hpp6
-rw-r--r--internal_rewrite/play_sound.cpp3
-rw-r--r--internal_rewrite/settings.hpp4
-rw-r--r--internal_rewrite/simple_settings.hpp45
9 files changed, 66 insertions, 53 deletions
diff --git a/internal_rewrite/Source.cpp b/internal_rewrite/Source.cpp
index 4e826bb..2894211 100644
--- a/internal_rewrite/Source.cpp
+++ b/internal_rewrite/Source.cpp
@@ -12,16 +12,20 @@ HMODULE g_dll;
header_t g_header;
void main_thread( HINSTANCE uh ) {
-#ifdef IFACE_DLLMAIN
- util::memset( ( uint8_t* )uh, 0x90, 0x1000 );
+
+#ifdef HEADER_MODULE
+ memcpy( &g_header, uh, sizeof( g_header ) );
+ for ( size_t i = 1; i < sizeof( header_t ); ++i )
+ *(uint8_t*)( uintptr_t( &g_header ) + i ) ^= g_header.xor_key;
+
#endif
+
g_csgo.initialize( );
- while ( !g_csgo.m_panic ) {
- std::this_thread::sleep_for( std::chrono::milliseconds( 1 ) );
- }
+#ifdef HEADER_MODULE
+ util::memset( (uint8_t*)uh, 0x90, 0x1000 );
+#endif
- g_csgo.uninitialize( );
ExitThread( 0 );
}
@@ -51,16 +55,8 @@ int __stdcall DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) {
//yayo
//SetUnhandledExceptionFilter( exception_handler );
-#ifdef HEADER_MODULE
- memcpy( &g_header, inst, sizeof( g_header ) );
- for( size_t i = 1; i < sizeof( header_t ); ++i ) {
- *( uint8_t* )( uintptr_t( &g_header ) + i ) ^= g_header.xor_key;
- }
-#endif
-
DisableThreadLibraryCalls( inst );
-
thread = CreateThread( nullptr, 0,
( LPTHREAD_START_ROUTINE )( main_thread ),
inst, 0, nullptr );
diff --git a/internal_rewrite/begin_lock.cpp b/internal_rewrite/begin_lock.cpp
index 49079cd..bbc00c8 100644
--- a/internal_rewrite/begin_lock.cpp
+++ b/internal_rewrite/begin_lock.cpp
@@ -12,11 +12,7 @@ void __fastcall hooks::begin_lock( void* ecx, void* edx ) { // THIS IS PROLLY NO
// search "CL_CallPostDataUpdates: missing ent %d" in engine.dll.
// where framestagenotify gets called
-#ifdef HEADER_MODULE
- static auto ret_addr = g_header.patterns.begin_lock_retaddr;
-#else
static auto ret_addr = pattern::first_code_match< void* >( g_csgo.m_engine.dll( ), "A1 ? ? ? ? B9 ? ? ? ? 6A 00 FF 50 18 8B 15 ? ? ? ?" );
-#endif
if( _ReturnAddress( ) == (void*)ret_addr ) {
g_ctx.m_stage = FRAME_NET_UPDATE_POSTDATAUPDATE_START;
diff --git a/internal_rewrite/frame_stage_notify.cpp b/internal_rewrite/frame_stage_notify.cpp
index 959a8e8..91cd7aa 100644
--- a/internal_rewrite/frame_stage_notify.cpp
+++ b/internal_rewrite/frame_stage_notify.cpp
@@ -21,7 +21,19 @@ const char* crash_str = R"("
void __fastcall hooks::frame_stage_notify( void* ecx_, void* edx_, ClientFrameStage_t stage ) {
static auto frame_stage_notify_o = g_csgo.m_chl->get_old_function< decltype( &hooks::frame_stage_notify ) >( 36 );
- if ( g_csgo.m_panic ) return frame_stage_notify_o( ecx_, edx_, stage );
+
+ if ( g_csgo.m_panic )
+ {
+ // unload from game thread
+ static bool unloaded = false;
+ if ( !unloaded)
+ {
+ g_csgo.uninitialize( );
+ unloaded = true;
+ }
+
+ return frame_stage_notify_o( ecx_, edx_, stage );
+ }
g_ctx.m_stage = stage;
g_cheat.m_visuals.world_modulate( );
diff --git a/internal_rewrite/interface.cpp b/internal_rewrite/interface.cpp
index 1d1be5b..904a4a9 100644
--- a/internal_rewrite/interface.cpp
+++ b/internal_rewrite/interface.cpp
@@ -17,6 +17,7 @@ interfaces::c_interface_manager g_factory;
factory::c_csgo g_csgo;
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" );
@@ -48,7 +49,7 @@ bool factory::create_interfaces( c_csgo* instance, header_t* header ) {
instance->create( &instance->m_engine_vgui, xors( "VEngineVGui" ) );
instance->create( &instance->m_input_sys, xors( "InputSystemVersion" ) );
- auto d3d_device = pattern::first_code_match( GetModuleHandleA( xors( "shaderapidx9.dll" ) ),
+ auto d3d_device = pattern::first_code_match( (HMODULE)header->shaderapidx9,
xors( "A1 ?? ?? ?? ?? 50 8B 08 FF 51 0C" ) ) + 0x1;
#ifdef HEADER_MODULE
@@ -197,18 +198,20 @@ con_fn unload_fn{ fnv( "unload" ),
};*/
void factory::c_csgo::initialize( ) {
- m_panic = true;
+ m_panic = false;
+
g_con->create( );
auto now = std::chrono::high_resolution_clock::now( );
g_con->print( xors( "hello\n" ) );
- //hi
-
factory::create_interfaces( &g_csgo, &g_header );
+
g_fonts.initialize( );
- g_netvars.init( );
+ g_netvars.init( );
+
g_settings.load( );
+
g_con->register_fn( &clear_fn );
g_con->register_fn( &enable_logs_fn );
g_con->register_fn( &fnv_fn );
@@ -218,7 +221,7 @@ void factory::c_csgo::initialize( ) {
g_con->register_fn( &unload_fn );
hooks::commit( &g_csgo );
-
+
g_cheat.m_chams.m_materials.initialize_materials( );
util::calculate_spread_runtime( );
@@ -230,8 +233,6 @@ void factory::c_csgo::initialize( ) {
g_con->log( xors( "cheat initialized\n" ) );
g_con->log( xors( "time taken: %f\n" ), delta.count( ) );
-
- m_panic = false;
}
void factory::c_csgo::uninitialize( ) {
diff --git a/internal_rewrite/internal_rewrite.vcxproj b/internal_rewrite/internal_rewrite.vcxproj
index f597bea..5834dca 100644
--- a/internal_rewrite/internal_rewrite.vcxproj
+++ b/internal_rewrite/internal_rewrite.vcxproj
@@ -327,10 +327,12 @@
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<LanguageStandard>stdcpplatest</LanguageStandard>
+ <DebugInformationFormat>None</DebugInformationFormat>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
diff --git a/internal_rewrite/modules.hpp b/internal_rewrite/modules.hpp
index 1f0aaa7..6e78bf3 100644
--- a/internal_rewrite/modules.hpp
+++ b/internal_rewrite/modules.hpp
@@ -7,19 +7,17 @@ struct patterns_t
uint32_t move_helper; // 8B 0D ? ? ? ? 8B 46 08 68
uint32_t calc_abs_velocity; // 55 8B EC 83 E4 F8 83 EC 1C 53 56 57 8B F9 F7 87
uint32_t animstate_update; // 55 8B EC 83 E4 F8 83 EC 18 56 57 8B F9 F3 0F 11 54 24
- uint32_t simulate_retaddr; // 8B CE 6A FF 8B 06
uint32_t draw_small_entities_retaddr; // FF 90 ? ? ? ? FF 15 ? ? ? ? 84 C0 74 28
- uint32_t begin_lock_retaddr; // A1 ? ? ? ? B9 ? ? ? ? 6A 00 FF 50 18 8B 15 ? ? ? ?
- uint32_t is_breakable; // 55 8B EC 51 56 8B F1 85 F6 74 68 83 BE
+ uint32_t is_breakable_ptr; // 55 8B EC 51 56 8B F1 85 F6 74 68 83 BE
uint32_t set_abs_angles; // 55 8B EC 83 E4 F8 83 EC 64 53 56 57 8B F1 E8
uint32_t set_abs_origin; // 55 8B EC 83 E4 F8 51 53 56 57 8B F1
uint32_t glow_manager; // 0F 11 05 00 00 00 00 83 C8 01
uint32_t smoke_count; // 55 8B EC 83 EC 08 8B 15 ? ? ? ? 0F 57 C0
uint32_t in_prediction_retaddr; // 84 C0 75 08 57 8B CE E8 ? ? ? ? 8B 06
- uint32_t is_ready; // 55 8B EC 83 E4 F8 83 EC 08 56 8B 35 00 00 00 00 57 83 BE
uint32_t net_update_retaddr; // 5F 5E 5D C2 04 00 83 3D ? ? ? ? ?
};
+
struct header_t {
uint8_t xor_key{ };
diff --git a/internal_rewrite/play_sound.cpp b/internal_rewrite/play_sound.cpp
index 1a8fc9f..3042b02 100644
--- a/internal_rewrite/play_sound.cpp
+++ b/internal_rewrite/play_sound.cpp
@@ -4,7 +4,8 @@ void __fastcall hooks::play_sound( void* ecx_, void*, const char* file ) {
static auto play_sound_o = g_csgo.m_surface->get_old_function< decltype( &play_sound ) >( 82 );
#ifdef HEADER_MODULE
- static auto is_ready = g_header.patterns.is_ready;
+ // static auto is_ready = g_header.patterns.is_ready;
+ static auto is_ready = pattern::first_code_match( g_csgo.m_chl.dll( ), xors( "55 8B EC 83 E4 F8 83 EC 08 56 8B 35 00 00 00 00 57 83 BE" ), 0 );
#else
static auto is_ready = pattern::first_code_match( g_csgo.m_chl.dll( ), xors( "55 8B EC 83 E4 F8 83 EC 08 56 8B 35 00 00 00 00 57 83 BE" ), 0 );
#endif
diff --git a/internal_rewrite/settings.hpp b/internal_rewrite/settings.hpp
index 75641c5..cb3307f 100644
--- a/internal_rewrite/settings.hpp
+++ b/internal_rewrite/settings.hpp
@@ -66,7 +66,7 @@ namespace data
memset( this->misc.skins.skins( ).data( ), -1, sizeof( this->misc.skins.skins( ) ) );
}
- void load( ) {
+ __declspec( noinline ) void load( ) {
switch( menu.cur_setting ) {
case 0:
holder_.load( "", xors( "./csgo/cfg/money_legit.cfg" ) );
@@ -89,7 +89,7 @@ namespace data
misc.skins.current_skin = -1;
}
- void save( ) {
+ __declspec( noinline ) void save( ) {
switch( menu.cur_setting ) {
case 0:
holder_.save( "", xors( "./csgo/cfg/money_legit.cfg" ) );
diff --git a/internal_rewrite/simple_settings.hpp b/internal_rewrite/simple_settings.hpp
index 71fd627..31701cd 100644
--- a/internal_rewrite/simple_settings.hpp
+++ b/internal_rewrite/simple_settings.hpp
@@ -31,21 +31,28 @@ public:
setting_nodes_.push_back( node_ptr );
}
- void load( const char* path, const char* file ) override {
- char full_path[ 64 ];
- strcpy_s( full_path, path );
- strcat_s( full_path, "_" );
- strcat_s( full_path, name_ );
- for ( auto x : setting_nodes_ )
+ __declspec( noinline ) void load( const char* path, const char* file ) override
+ {
+ static char full_path[1024];
+ memset( full_path, 0, 1024 );
+
+ strcpy_s( full_path, path );
+ strcat_s( full_path, "_" );
+ strcat_s( full_path, name_.c_str( ) );
+
+ for ( auto x : setting_nodes_ )
x->load( full_path, file );
}
- void save( const char* path, const char* file ) const override {
- char full_path[ 64 ];
- strcpy_s( full_path, path );
- strcat_s( full_path, "_" );
- strcat_s( full_path, name_ );
- for ( auto x : setting_nodes_ )
+ __declspec( noinline ) void save( const char* path, const char* file ) const override
+ {
+ static char full_path[1024];
+ memset( full_path, 0, 1024 );
+
+ strcpy_s( full_path, path );
+ strcat_s( full_path, "_" );
+ strcat_s( full_path, name_.c_str( ) );
+ for ( auto x : setting_nodes_ )
x->save( full_path, file );
}
@@ -58,7 +65,7 @@ public:
}
private:
- const char* name_;
+ std::string name_;
bool has_nodes_;
std::vector<ISettingNode*> setting_nodes_;
};
@@ -83,11 +90,11 @@ public:
holder_ptr->register_( this );
};
- void load( const char* path, const char* file ) override {
+ __declspec( noinline ) void load( const char* path, const char* file ) override {
GetPrivateProfileStringA( path, std::to_string( m_name ).c_str( ), "", m_value, L, file );
}
- void save( const char* path, const char* file ) const override {
+ __declspec( noinline ) void save( const char* path, const char* file ) const override {
WritePrivateProfileStringA( path, std::to_string( m_name ).c_str( ), m_value, file );
}
@@ -103,13 +110,13 @@ private:
template < typename T >
class con_var : public ISetting {
public:
- __forceinline con_var( SettingHolder* holder_ptr, hash_t name ) :
+ __declspec( noinline ) con_var( SettingHolder* holder_ptr, hash_t name ) :
name_( name ),
is_float_( std::is_floating_point_v< T > ),
is_integral_( std::is_integral_v< T > ) {
holder_ptr->register_( this );
}
- __forceinline con_var( SettingHolder* holder_ptr, hash_t name , const T& rhs ) :
+ __declspec( noinline ) con_var( SettingHolder* holder_ptr, hash_t name , const T& rhs ) :
value_( rhs ),
name_( name ),
is_float_( std::is_floating_point_v< T > ),
@@ -117,9 +124,9 @@ public:
holder_ptr->register_( this );
}
- void load( const char* path, const char* file ) override { simple_load( path, std::to_string( name_ ).c_str( ), &value_, sizeof( value_ ), file ); }
+ __declspec( noinline ) void load( const char* path, const char* file ) override { simple_load( path, std::to_string( name_ ).c_str( ), &value_, sizeof( value_ ), file ); }
- void save( const char* path, const char* file ) const override { simple_save( path, std::to_string( name_ ).c_str( ), &value_, sizeof( value_ ), file ); }
+ __declspec( noinline ) void save( const char* path, const char* file ) const override { simple_save( path, std::to_string( name_ ).c_str( ), &value_, sizeof( value_ ), file ); }
__forceinline operator T&( ) { return value_; }
__forceinline T* operator &( ) { return &value_; }