diff options
| author | navewindre <boneyaard@gmail.com> | 2018-09-09 18:28:04 +0200 |
|---|---|---|
| committer | navewindre <boneyaard@gmail.com> | 2018-09-09 18:28:04 +0200 |
| commit | 215818ddedc02be3a1a5c2be3912abdbcd29dd72 (patch) | |
| tree | 16453999d9380f43a6f436e491e63aa58ac7e764 | |
| parent | 620f39df29fed446ab007e03c7b071f635379f1f (diff) | |
detours etc
43 files changed, 175 insertions, 240 deletions
diff --git a/internal_rewrite/begin_lock.cpp b/internal_rewrite/begin_lock.cpp index bbc00c8..0417654 100644 --- a/internal_rewrite/begin_lock.cpp +++ b/internal_rewrite/begin_lock.cpp @@ -5,9 +5,6 @@ #include "context.hpp"
void __fastcall hooks::begin_lock( void* ecx, void* edx ) { // THIS IS PROLLY NOT ENDLOCK, BUT WHATEVER
- static auto begin_lock_o = g_csgo.m_mdl_cache->get_old_function< decltype( &hooks::begin_lock ) >( 33 );
-
-
// signature:
// search "CL_CallPostDataUpdates: missing ent %d" in engine.dll.
// where framestagenotify gets called
diff --git a/internal_rewrite/c_base_player.cpp b/internal_rewrite/c_base_player.cpp index 0d1edb5..348c961 100644 --- a/internal_rewrite/c_base_player.cpp +++ b/internal_rewrite/c_base_player.cpp @@ -408,11 +408,7 @@ bool c_base_player::can_attack( bool ignore_rapid ) { }
if( weapon->m_iItemDefinitionIndex( ) == WEAPON_R8REVOLVER ) {
- float ready_time = weapon->m_flPostponeFireReadyTime( );
- if( ready_time == FLT_MAX ) return false;
-
- float time_to_shoot = ready_time - time;
- return TIME_TO_TICKS( time_to_shoot ) < 1;
+ return g_ctx.m_revolver_shot;
}
return true;
diff --git a/internal_rewrite/context.cpp b/internal_rewrite/context.cpp index 421bc06..9ec1f62 100644 --- a/internal_rewrite/context.cpp +++ b/internal_rewrite/context.cpp @@ -130,17 +130,6 @@ void c_context::reset_shot_queue( ) { m_shot_data[ 0 ] = last_shot; } -void c_context::update_local_hook( ) { - if( !run_frame( ) ) - return; - - auto func = util::get_vfunc< void* >( m_local, 218 ); - if( func != &hooks::update_clientside_animation || g_csgo.m_local( ) != m_local ) { - g_csgo.m_local( m_local ); - g_csgo.m_local->hook( 218, &hooks::update_clientside_animation ); - } -} - //predicted servertime of player, use this for breaking lby etc float c_context::pred_time( ) { calculate_tickbase( ); diff --git a/internal_rewrite/context.hpp b/internal_rewrite/context.hpp index 827a95a..bf28a11 100644 --- a/internal_rewrite/context.hpp +++ b/internal_rewrite/context.hpp @@ -33,8 +33,6 @@ public: bool run_frame( );
float pred_time( );
- void update_local_hook( );
-
void on_cmove_end( user_cmd_t* cmd );
bool create_snapshot( user_cmd_t* );
//calculate accurate tickbase
@@ -52,6 +50,8 @@ public: //accurate tickbase
int m_tickbase{ };
+ bool m_revolver_shot{ };
+
bool m_drawing_postscreenspace{ };
bool m_has_incremented_shots{ };
bool m_drawing_screneend{ };
diff --git a/internal_rewrite/create_move.cpp b/internal_rewrite/create_move.cpp index f56390a..c6a75c0 100644 --- a/internal_rewrite/create_move.cpp +++ b/internal_rewrite/create_move.cpp @@ -28,8 +28,6 @@ void __declspec( naked ) __stdcall hooks::hl_create_move_gate( int sequence_numb */ bool __fastcall hooks::create_move( void* ecx_, void* edx_, float input_sample_frametime, user_cmd_t* ucmd ) { - static auto create_move_o = g_csgo.m_clientmode->get_old_function< decltype( &hooks::create_move ) >( 24 ); - stack_t stack( get_baseptr( ) ); byte* send_packet = stack.next( ).local< byte* >( 0x1c ); @@ -59,7 +57,6 @@ bool __fastcall hooks::create_move( void* ecx_, void* edx_, float input_sample_f g_cheat.m_identity( ); if( g_ctx.run_frame( ) && g_ctx.m_local->is_alive( ) ) { - g_ctx.update_local_hook( ); static int last_frame = g_csgo.m_globals->m_framecount; if( last_frame != g_csgo.m_globals->m_framecount ) g_ctx.m_has_fired_this_frame = false; diff --git a/internal_rewrite/debug_show_spread.cpp b/internal_rewrite/debug_show_spread.cpp index 1dd0c8c..54da769 100644 --- a/internal_rewrite/debug_show_spread.cpp +++ b/internal_rewrite/debug_show_spread.cpp @@ -3,6 +3,7 @@ int __fastcall hooks::debug_show_spread_get_int( void* ecx_, void* edx_ ) { static auto original_fn = g_csgo.m_debug_show_spread->get_old_function< decltype( &debug_show_spread_get_int ) >( 13 ); + if( !g_settings.visuals.snipers_crosshair || !g_ctx.run_frame( ) || !g_ctx.m_local->is_valid( ) || g_ctx.m_local->m_bIsScoped( ) ) { return original_fn( ecx_, 0 ); } diff --git a/internal_rewrite/do_post_screen_space_effects.cpp b/internal_rewrite/do_post_screen_space_effects.cpp index 7786dd8..1cdd00c 100644 --- a/internal_rewrite/do_post_screen_space_effects.cpp +++ b/internal_rewrite/do_post_screen_space_effects.cpp @@ -3,7 +3,7 @@ #include "context.hpp" bool __fastcall hooks::do_post_screen_space_effects( void* ecx_, void* edx_, CViewSetup* setup ) { - static auto old_fn = g_csgo.m_clientmode->get_old_function< decltype( &do_post_screen_space_effects ) >( 44 ); + static auto old_fn = do_post_screen_space_effects_o; g_ctx.m_drawing_postscreenspace = true; if( g_csgo.m_engine( )->IsInGame( ) && g_ctx.m_local ) { diff --git a/internal_rewrite/draw_model_execute.cpp b/internal_rewrite/draw_model_execute.cpp index 1ab2732..5d1ef0d 100644 --- a/internal_rewrite/draw_model_execute.cpp +++ b/internal_rewrite/draw_model_execute.cpp @@ -9,7 +9,7 @@ void __fastcall hooks::draw_model_execute( IVModelRender* ecx_, void* edx_,
void* render_ctx, const DrawModelState_t& state,
const ModelRenderInfo_t& info, matrix3x4* bone_to_world ) {
- static auto dme_o = g_csgo.m_model_render->get_old_function< decltype( &hooks::draw_model_execute ) >( 21 );
+ static auto dme_o = draw_model_execute_o;
if( g_csgo.m_panic || g_ctx.m_drawing_postscreenspace || g_settings.misc.hide_from_obs )
return dme_o( ecx_, edx_, render_ctx, state, info, bone_to_world );
diff --git a/internal_rewrite/draw_small_entities.cpp b/internal_rewrite/draw_small_entities.cpp index d84957b..2f88c74 100644 --- a/internal_rewrite/draw_small_entities.cpp +++ b/internal_rewrite/draw_small_entities.cpp @@ -6,7 +6,6 @@ #include "base_cheat.hpp" void __fastcall hooks::draw_small_entities( void* ecx, void* edx, bool state ) { - static auto draw_small_entities_o = g_csgo.m_clientleaf->get_old_function< decltype( &hooks::draw_small_entities ) >( 39 ); #ifdef HEADER_MODULE static auto ret_addr = g_header.patterns.draw_small_entities_retaddr + 6; diff --git a/internal_rewrite/emit_sound.cpp b/internal_rewrite/emit_sound.cpp index 79ed3f1..13ae28a 100644 --- a/internal_rewrite/emit_sound.cpp +++ b/internal_rewrite/emit_sound.cpp @@ -1,7 +1,8 @@ #include "base_cheat.hpp" #include "hooks.hpp" #include "settings.hpp" -void __fastcall hooks::emit_sound( void* ecx_, void* edx_, void* filter, int ent, int channel, const char* sound, uint32_t hash, + +/*void __fastcall hooks::emit_sound( void* ecx_, void* edx_, void* filter, int ent, int channel, const char* sound, uint32_t hash, const char* sample, float volume, float attenuation, int seed, int flags, int pitch, const vec3_t* origin, const vec3_t* direction, vec3_t* origins, bool update_pos, float sound_time, int speaker_entry ) { static auto emit_sound_o = g_csgo.m_engine_sound->get_old_function< decltype( &hooks::emit_sound ) >( 5 ); @@ -23,4 +24,4 @@ void __fastcall hooks::emit_sound( void* ecx_, void* edx_, void* filter, int ent emit_sound_o( ecx_, 0, filter, ent, channel, sound, hash, sample, volume, attenuation, seed, flags, pitch, origin, direction, origins, update_pos, sound_time, speaker_entry ); -}
\ No newline at end of file +}*/
\ No newline at end of file diff --git a/internal_rewrite/end_lock.cpp b/internal_rewrite/end_lock.cpp index e0b30d8..ee81d7a 100644 --- a/internal_rewrite/end_lock.cpp +++ b/internal_rewrite/end_lock.cpp @@ -5,7 +5,6 @@ #include "context.hpp" void __fastcall hooks::end_lock( void* ecx, void* edx ) { // THIS IS PROLLY NOT ENDLOCK, BUT WHATEVER - static auto end_lock_o = g_csgo.m_mdl_cache->get_old_function< decltype( &hooks::end_lock ) >( 34 ); // signature: diff --git a/internal_rewrite/extra.cpp b/internal_rewrite/extra.cpp index d67b0d7..fa0882a 100644 --- a/internal_rewrite/extra.cpp +++ b/internal_rewrite/extra.cpp @@ -4,6 +4,7 @@ #include "math.hpp"
#include "hooks.hpp"
#include "interface.hpp"
+#include "detours.h"
#undef min
@@ -109,8 +110,9 @@ namespace features break;
}
+ static bool enabled = false;
auto clientstate = g_csgo.m_global_state->get_client_state( );
- if( clientstate ) {
+ if( clientstate && !enabled ) {
// TODO: Change this to the non-homosexual way of hooking CNetChan functions.
// Actually, I'm too lazy. You can do this if you want.
/* @@ -123,14 +125,8 @@ namespace features */
auto netchannel = clientstate->m_netchannel;
if( netchannel ) {
- auto old_netchannel = g_csgo.m_net_channel( );
-
- if( old_netchannel != netchannel ||
- ( old_netchannel &&
- g_csgo.m_net_channel->get_function< void* >( 46 ) != &hooks::send_datagram ) ) {
- g_csgo.m_net_channel( netchannel );
- g_csgo.m_net_channel->hook( 46, &hooks::send_datagram );
- }
+ hooks::send_datagram_o = memory::detours.create_hook( &hooks::send_datagram, g_csgo.m_net_channel->get_old_function< void* >( 46 ) );
+ enabled = true;
}
}
}
@@ -232,11 +228,16 @@ namespace features int def_index = weapon->m_iItemDefinitionIndex( );
if( def_index != WEAPON_R8REVOLVER ) return;
- if( !g_ctx.m_local->can_attack( ) ) {
+ static float next_time = 0.f;
+
+ auto time = g_ctx.pred_time( );
+ if( g_ctx.m_local->can_attack( ) && next_time >= time ) {
+ g_ctx.m_revolver_shot = false;
cmd->m_buttons |= IN_ATTACK;
}
- else if( !g_cheat.m_lagmgr.get_sent( ) ) {
- g_cheat.m_lagmgr.set_state( true );
+ else {
+ next_time = time + 0.234375f;
+ g_ctx.m_revolver_shot = true;
}
}
diff --git a/internal_rewrite/factory.hpp b/internal_rewrite/factory.hpp index c81c79b..d197951 100644 --- a/internal_rewrite/factory.hpp +++ b/internal_rewrite/factory.hpp @@ -11,7 +11,7 @@ //IFACE_DLLMAIN - interfaces are passed through dllmain and below code doesnt need to be ran
#ifndef _DEBUG
//#define IFACE_DLLMAIN
-#define HEADER_MODULE
+//#define HEADER_MODULE
#endif
#ifdef IFACE_DLLMAIN
diff --git a/internal_rewrite/fire_event_clientside.cpp b/internal_rewrite/fire_event_clientside.cpp index 02faace..10233a2 100644 --- a/internal_rewrite/fire_event_clientside.cpp +++ b/internal_rewrite/fire_event_clientside.cpp @@ -3,7 +3,7 @@ #include "context.hpp" bool __fastcall hooks::fire_event_clientside( void* ecx_, void* edx, IGameEvent* event_ ) { - static auto original_fn = g_csgo.m_event_mgr->get_old_function< decltype( &fire_event_clientside ) >( 9 ); + static auto original_fn = fire_event_clientside_o; if( g_ctx.m_local && g_ctx.m_local->is_valid( ) && strstr( event_->GetName( ), xors( "player_death" ) ) ) g_cheat.m_skins.replace_deaths( event_ ); diff --git a/internal_rewrite/get_screen_size.cpp b/internal_rewrite/get_screen_size.cpp index 1b89b24..be7e245 100644 --- a/internal_rewrite/get_screen_size.cpp +++ b/internal_rewrite/get_screen_size.cpp @@ -6,7 +6,6 @@ #include "mem.hpp" void __fastcall hooks::get_screen_size( void* ecx, void* edx, int& w, int& h ) { - static auto get_screen_size_o = g_csgo.m_surface->get_old_function< decltype( &hooks::get_screen_size ) >( 44 ); static auto draw_crosshair_h = pattern::first_code_match( g_csgo.m_chl.dll( ), xors( "8B 4C 24 10 0F 57 D2 99" ) ); stack_t stack( get_baseptr( ) ); diff --git a/internal_rewrite/get_viewmodel_fov.cpp b/internal_rewrite/get_viewmodel_fov.cpp index 050399c..be48dd3 100644 --- a/internal_rewrite/get_viewmodel_fov.cpp +++ b/internal_rewrite/get_viewmodel_fov.cpp @@ -2,7 +2,5 @@ #include "settings.hpp" float __fastcall hooks::get_viewmodel_fov( void* ecx, void* edx ) { - static auto get_viewmodel_fov_o = g_csgo.m_clientmode->get_old_function< decltype( &hooks::get_viewmodel_fov ) >( 35 ); - return get_viewmodel_fov_o( ecx, nullptr ) + float( g_settings.misc.viewmodel_fov ); } diff --git a/internal_rewrite/hooks.cpp b/internal_rewrite/hooks.cpp index a02537a..34ba24b 100644 --- a/internal_rewrite/hooks.cpp +++ b/internal_rewrite/hooks.cpp @@ -2,6 +2,36 @@ #include "interface.hpp" #include "detours.h" +//god i'm so cool +namespace hooks { + decltype( &paint_traverse ) paint_traverse_o; + decltype( &create_move ) create_move_o; + decltype( &frame_stage_notify ) fsn_o; + decltype( &suppress_lists ) suppress_lists_o; + decltype( &draw_small_entities ) draw_small_entities_o; + decltype( &begin_lock ) begin_lock_o; + decltype( &end_lock ) end_lock_o; + decltype( &simulate ) simulate_o; + decltype( &run_command ) run_command_o; + decltype( &override_mouse_input ) override_mouse_input_o; + decltype( &draw_model_execute ) draw_model_execute_o; + decltype( &scene_end ) scene_end_o; + decltype( &get_viewmodel_fov ) get_viewmodel_fov_o; + decltype( &get_screen_size ) get_screen_size_o; + decltype( &override_view ) override_view_o; + decltype( &shut_down ) shut_down_o; + decltype( &lock_cursor ) lock_cursor_o; + decltype( &is_connected ) is_connected_o; + decltype( &in_prediction ) in_prediction_o; + decltype( &update_clientside_animation ) update_clientside_animation_o; + decltype( &material_system ) material_system_o; + decltype( &fire_event_clientside ) fire_event_clientside_o; + decltype( &send_datagram ) send_datagram_o; + decltype( &do_post_screen_space_effects ) do_post_screen_space_effects_o; + decltype( &on_screen_size_changed ) on_screen_size_changed_o; + decltype( &play_sound ) play_sound_o; + decltype( &convar_getint ) convar_getint_o; +} hooks::c_netvar_proxy hooks::lby_proxy; hooks::c_netvar_proxy hooks::last_shot_proxy; @@ -30,35 +60,33 @@ bool hooks::commit( factory::c_csgo* instance ) { //instance->m_engine->hook( 93, &hooks::is_hltv_proxy ); //instance->m_engine->hook( 90, &hooks::is_paused ); //instance->m_engine->hook( 27, &hooks::is_connected ); - instance->m_panel->hook( 41, &hooks::paint_traverse ); - instance->m_clientmode->hook( 24, &hooks::create_move ); - instance->m_clientmode->hook( 23, &hooks::override_mouse_input ); - instance->m_clientmode->hook( 35, &hooks::get_viewmodel_fov ); - instance->m_clientmode->hook( 44, &hooks::do_post_screen_space_effects ); - instance->m_clientmode->hook( 18, &hooks::override_view ); - instance->m_surface->hook( 67, &hooks::lock_cursor ); - //instance->m_input->hook( 3, &hooks::hl_create_move ); - //instance->m_chl->hook( 36, &hooks::frame_stage_notify ); - //instance->m_chl->hook( 10, &hooks::hud_process_input ); - instance->m_prediction->hook( 19, &hooks::run_command ); - instance->m_prediction->hook( 14, &hooks::in_prediction ); - instance->m_model_render->hook( 21, &hooks::draw_model_execute ); - instance->m_render_view->hook( 9, &hooks::scene_end ); - instance->m_surface->hook( 44, &hooks::get_screen_size ); - instance->m_surface->hook( 116, &hooks::on_screen_size_changed ); - instance->m_surface->hook( 82, &hooks::play_sound ); - //instance->m_engine_sound->hook( 6, &hooks::emit_sound ); + instance->m_debug_show_spread->hook( 13, &hooks::debug_show_spread_get_int ); - instance->m_interpolate->hook( 13, &hooks::cl_interpolate_get_int ); - //instance->m_event_mgr->hook( 9, &hooks::fire_event_clientside ); - instance->m_mat_system->hook( 21, &hooks::material_system ); - instance->m_partition->hook( 16, &hooks::suppress_lists ); - instance->m_clientleaf->hook( 39, &hooks::draw_small_entities ); - instance->m_engine_vgui->hook( 39, &hooks::simulate ); - instance->m_mdl_cache->hook( 33, &hooks::begin_lock ); - instance->m_mdl_cache->hook( 34, &hooks::end_lock ); instance->m_netshowfragments->hook( 13, &hooks::net_showfragments_get_int ); - //instance->m_trace->hook( 5, &hooks::trace_ray ); + + + paint_traverse_o = d->create_hook( &hooks::paint_traverse, instance->m_panel->get_old_function< void* >( 42 ) ); + create_move_o = d->create_hook( &hooks::create_move, instance->m_clientmode->get_old_function< void* >( 24 ) ); + override_mouse_input_o = d->create_hook( &hooks::override_mouse_input, instance->m_clientmode->get_old_function< void* >( 23 ) ); + get_viewmodel_fov_o = d->create_hook( &hooks::get_viewmodel_fov, instance->m_clientmode->get_old_function< void* >( 35 ) ); + do_post_screen_space_effects_o = d->create_hook( &hooks::do_post_screen_space_effects, instance->m_clientmode->get_old_function< void* >( 44 ) ); + override_view_o = d->create_hook( &hooks::override_view, instance->m_clientmode->get_old_function< void* >( 18 ) ); + lock_cursor_o = d->create_hook( &hooks::lock_cursor, instance->m_surface->get_old_function< void* >( 67 ) ); + run_command_o = d->create_hook( &hooks::run_command, instance->m_prediction->get_old_function< void* >( 19 ) ); + in_prediction_o = d->create_hook( &hooks::in_prediction, instance->m_prediction->get_old_function< void* >( 14 ) ); + draw_model_execute_o = d->create_hook( &hooks::draw_model_execute, instance->m_model_render->get_old_function< void* >( 21 ) ); + scene_end_o = d->create_hook( &hooks::scene_end, instance->m_render_view->get_old_function< void* >( 9 ) ); + get_screen_size_o = d->create_hook( &hooks::get_screen_size, instance->m_surface->get_old_function< void* >( 44 ) ); + on_screen_size_changed_o = d->create_hook( &hooks::on_screen_size_changed, instance->m_surface->get_old_function< void* >( 116 ) ); + play_sound_o = d->create_hook( &hooks::play_sound, instance->m_surface->get_old_function< void* >( 82 ) ); + material_system_o = d->create_hook( &hooks::material_system, instance->m_mat_system->get_old_function< void* >( 21 ) ); + suppress_lists_o = d->create_hook( &hooks::suppress_lists, instance->m_partition->get_old_function< void* >( 16 ) ); + draw_small_entities_o = d->create_hook( &hooks::draw_small_entities, instance->m_clientleaf->get_old_function< void* >( 39 ) ); + simulate_o = d->create_hook( &hooks::simulate, instance->m_engine_vgui->get_old_function< void* >( 39 ) ); + begin_lock_o = d->create_hook( &hooks::begin_lock, instance->m_mdl_cache->get_old_function< void* >( 33 ) ); + end_lock_o = d->create_hook( &hooks::end_lock, instance->m_mdl_cache->get_old_function< void* >( 34 ) ); + + d->enable( ); return true; } diff --git a/internal_rewrite/hooks.hpp b/internal_rewrite/hooks.hpp index 41e36ad..3815c15 100644 --- a/internal_rewrite/hooks.hpp +++ b/internal_rewrite/hooks.hpp @@ -14,50 +14,92 @@ namespace hooks extern decltype( &window_procedure ) window_procedure_o; void __fastcall paint_traverse( void*, void*, unsigned int, bool, bool ); + extern decltype( &paint_traverse ) paint_traverse_o; + bool __fastcall create_move( void*, void*, float, user_cmd_t* ); + extern decltype( &create_move ) create_move_o; + //void __fastcall hl_create_move( void*, void*, int, float, bool ); void __fastcall frame_stage_notify( void*, void*, ClientFrameStage_t ); + extern decltype( &frame_stage_notify ) fsn_o; + void __fastcall suppress_lists( void*, void*, int, bool ); + extern decltype( &suppress_lists ) suppress_lists_o; + void __fastcall draw_small_entities( void*, void*, bool ); + extern decltype( &draw_small_entities ) draw_small_entities_o; + void __fastcall begin_lock( void*, void* ); + extern decltype( &begin_lock ) begin_lock_o; + void __fastcall end_lock( void*, void* ); + extern decltype( &end_lock ) end_lock_o; + void __fastcall simulate( void*, void* ); + extern decltype( &simulate ) simulate_o; + void __fastcall run_command( void*, void*, IClientEntity*, user_cmd_t*, IMoveHelper* ); + extern decltype( &run_command ) run_command_o; + void __fastcall override_mouse_input( void*, void*, float*, float* ); + extern decltype( &override_mouse_input ) override_mouse_input_o; + void __fastcall draw_model_execute( IVModelRender*, void*, void*, const DrawModelState_t&, const ModelRenderInfo_t&, matrix3x4* ); + extern decltype( &draw_model_execute ) draw_model_execute_o; + void __fastcall scene_end( void*, void* ); - bool __fastcall is_hltv_proxy( void*, void* ); - bool __fastcall is_hltv( void* thisptr, uintptr_t pvs_entity ); + extern decltype( &scene_end ) scene_end_o; + float __fastcall get_viewmodel_fov( void*, void* ); + extern decltype( &get_viewmodel_fov ) get_viewmodel_fov_o; + void __fastcall get_screen_size( void*, void*, int&, int& ); + extern decltype( &get_screen_size ) get_screen_size_o; + void __fastcall override_view( void* ecx_, void* edx_, CViewSetup* setup ); - void __fastcall emit_sound( void* ecx_, void* edx_, void* filter, int ent, int channel, const char* sound, uint32_t hash, - const char* sample, float volume, float attenuation, int seed, int flags, int pitch, const vec3_t* origin, - const vec3_t* direction, vec3_t* origins, bool update_pos, float sound_time, int speaker_entry ); + extern decltype( &override_view ) override_view_o; + + //void __fastcall emit_sound( void* ecx_, void* edx_, void* filter, int ent, int channel, const char* sound, uint32_t hash, + // const char* sample, float volume, float attenuation, int seed, int flags, int pitch, const vec3_t* origin, + // const vec3_t* direction, vec3_t* origins, bool update_pos, float sound_time, int speaker_entry ); void __fastcall shut_down( void* ecx_, void* edx_ ); + extern decltype( &shut_down ) shut_down_o; + void __fastcall lock_cursor( void* ecx_, void* edx_ ); + extern decltype( &lock_cursor ) lock_cursor_o; bool __fastcall is_connected( void* ecx_, void* edx_ ); + extern decltype( &is_connected ) is_connected_o; bool __fastcall in_prediction( void* ecx_, void* edx_ ); + extern decltype( &in_prediction ) in_prediction_o; + void __fastcall update_clientside_animation( void* ecx_, void* edx_ ); + extern decltype( &update_clientside_animation ) update_clientside_animation_o; bool __fastcall material_system( void* ecx_, void* edx_, IMaterialSystem_Config_t* config, bool forceupdate ); + extern decltype( &material_system ) material_system_o; + bool __fastcall fire_event_clientside( void* ecx_, void* edx, IGameEvent* event ); + extern decltype( &fire_event_clientside ) fire_event_clientside_o; + void __cdecl lby_proxy_fn( const CRecvProxyData* proxy_data_const, void* entity, void* output ); void __cdecl last_shot_proxy_fn( const CRecvProxyData* proxy_data_const, void* entity, void* output ); void __cdecl simtime_proxy_fn( const CRecvProxyData* proxy_data_const, void* ent, void* output ); int __fastcall send_datagram( INetChannel* channel, void* edx, void* datagram ); - bool __fastcall is_paused( void* ecx_, void* edx_ ); + extern decltype( &send_datagram ) send_datagram_o; + bool __fastcall do_post_screen_space_effects( void* ecx_, void* edx_, CViewSetup* setup ); + extern decltype( &do_post_screen_space_effects ) do_post_screen_space_effects_o; + void __fastcall on_screen_size_changed( void* ecx_, void* edx_, int old_h, int old_w ); + extern decltype( &on_screen_size_changed ) on_screen_size_changed_o; + void __fastcall play_sound( void* ecx_, void* edx_, const char* name ); - void __fastcall hud_process_input( void* ecx_, void* edx_, bool repaint ); - void __fastcall trace_ray( void* ecx_, void* edx_, const Ray_t& ray, unsigned int fMask, ITraceFilter* pTraceFilter, CBaseTrace* pTrace ); + extern decltype( &play_sound ) play_sound_o; int __fastcall debug_show_spread_get_int( void* ecx_, void* edx_ ); - int __fastcall cl_interpolate_get_int( void* ecx_, void* edx_ ); int __fastcall net_showfragments_get_int( void* ecx_, void* edx_ ); extern c_netvar_proxy lby_proxy; @@ -72,5 +114,8 @@ namespace hooks long __stdcall draw( IDirect3DDevice9*, D3DPRIMITIVETYPE, int, uint32_t, uint32_t, uint32_t, uint32_t ); } + int __fastcall convar_getint( void* ecx_, void* edx_ ); + extern decltype( &convar_getint ) convar_getint_o; + extern bool commit( factory::c_csgo* ); }
\ No newline at end of file diff --git a/internal_rewrite/hud_process_input.cpp b/internal_rewrite/hud_process_input.cpp deleted file mode 100644 index 548d05f..0000000 --- a/internal_rewrite/hud_process_input.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "context.hpp" -#include "hooks.hpp" - -void __fastcall hooks::hud_process_input( void* ecx_, void* edx_, bool active ) { - static auto hud_update_o = g_csgo.m_chl->get_old_function< decltype( &hooks::hud_process_input ) >( 10 ); - - //todo: hook hudupdate - //g_csgo.m_prediction( )->SetLocalViewAngles( g_ctx.m_last_fakeangle ); - - return hud_update_o( ecx_, 0, active ); -}
\ No newline at end of file diff --git a/internal_rewrite/internal_rewrite.vcxproj b/internal_rewrite/internal_rewrite.vcxproj index bd3e6dc..a094bd0 100644 --- a/internal_rewrite/internal_rewrite.vcxproj +++ b/internal_rewrite/internal_rewrite.vcxproj @@ -408,13 +408,10 @@ <ClCompile Include="create_move.cpp" />
<ClCompile Include="hde32.cpp" />
<ClCompile Include="hooks.cpp" />
- <ClCompile Include="hud_process_input.cpp" />
<ClCompile Include="identity.cpp" />
<ClCompile Include="input_system.cpp" />
<ClCompile Include="interface.cpp" />
- <ClCompile Include="interpolate.cpp" />
<ClCompile Include="is_connected.cpp" />
- <ClCompile Include="is_paused.cpp" />
<ClCompile Include="KeyValues.cpp" />
<ClCompile Include="lag_mgr.cpp" />
<ClCompile Include="legitbot.cpp" />
@@ -448,10 +445,8 @@ <ClCompile Include="simulate.cpp" />
<ClCompile Include="skins.cpp" />
<ClCompile Include="Source.cpp" />
- <ClCompile Include="is_hltv.cpp" />
<ClCompile Include="in_prediction.cpp" />
<ClCompile Include="suppress_lists.cpp" />
- <ClCompile Include="traceray.cpp" />
<ClCompile Include="ui_itemlist_def.h" />
<ClCompile Include="ui_text_input.cpp" />
<ClCompile Include="update_clientside_animation.cpp" />
diff --git a/internal_rewrite/internal_rewrite.vcxproj.filters b/internal_rewrite/internal_rewrite.vcxproj.filters index be58e72..f8816fc 100644 --- a/internal_rewrite/internal_rewrite.vcxproj.filters +++ b/internal_rewrite/internal_rewrite.vcxproj.filters @@ -118,9 +118,6 @@ <ClCompile Include="legitbot_lagcomp.cpp">
<Filter>features</Filter>
</ClCompile>
- <ClCompile Include="is_hltv.cpp">
- <Filter>hooks</Filter>
- </ClCompile>
<ClCompile Include="ragebot.cpp">
<Filter>features</Filter>
</ClCompile>
@@ -190,9 +187,6 @@ <ClCompile Include="send_datagram.cpp">
<Filter>hooks</Filter>
</ClCompile>
- <ClCompile Include="is_paused.cpp">
- <Filter>hooks</Filter>
- </ClCompile>
<ClCompile Include="do_post_screen_space_effects.cpp">
<Filter>hooks</Filter>
</ClCompile>
@@ -211,9 +205,6 @@ <ClCompile Include="is_connected.cpp">
<Filter>hooks</Filter>
</ClCompile>
- <ClCompile Include="hud_process_input.cpp">
- <Filter>hooks</Filter>
- </ClCompile>
<ClCompile Include="skins.cpp">
<Filter>features</Filter>
</ClCompile>
@@ -259,15 +250,9 @@ <ClCompile Include="update_clientside_animation.cpp">
<Filter>hooks</Filter>
</ClCompile>
- <ClCompile Include="interpolate.cpp">
- <Filter>hooks</Filter>
- </ClCompile>
<ClCompile Include="lock_cursor.cpp">
<Filter>hooks</Filter>
</ClCompile>
- <ClCompile Include="traceray.cpp">
- <Filter>hooks</Filter>
- </ClCompile>
<ClCompile Include="net_showfragments.cpp">
<Filter>hooks</Filter>
</ClCompile>
diff --git a/internal_rewrite/interpolate.cpp b/internal_rewrite/interpolate.cpp deleted file mode 100644 index 51a5c08..0000000 --- a/internal_rewrite/interpolate.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "hooks.hpp" -#include "interface.hpp" -#include "mem.hpp" -#include "base_cheat.hpp" -#include "util.hpp" -#include "context.hpp" - -int __fastcall hooks::cl_interpolate_get_int( void* ecx_, void* edx_ ) { - static auto old_fn = g_csgo.m_interpolate->get_old_function< decltype( &hooks::cl_interpolate_get_int ) >( 13 ); - static auto interpolate_entities = pattern::first_code_match( g_csgo.m_chl.dll( ), xors( "55 8B EC 83 EC 1C 8B 0D ? ? ? ? 53" ), 0x72 ); - - stack_t stack( get_baseptr( ) ); - - if( stack.return_address( ) == interpolate_entities ) { - //if( g_settings.rage.enabled( ) && g_ctx.m_local && g_ctx.m_local->is_valid( ) ) - //return 0; - } - - return old_fn( ecx_, 0 ); -}
\ No newline at end of file diff --git a/internal_rewrite/is_hltv.cpp b/internal_rewrite/is_hltv.cpp deleted file mode 100644 index 60b24f8..0000000 --- a/internal_rewrite/is_hltv.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "hooks.hpp" -#include "pattern.hpp" -#include "mem.hpp" - -bool __fastcall hooks::is_hltv( void* ecx, uintptr_t pvs_ent ) { - static auto is_hltv_o = g_csgo.m_engine->get_old_function< decltype( &hooks::is_hltv ) >( 93 ); - static auto pvs_retaddr = pattern::first_code_match( g_csgo.m_chl.dll( ), xors( "84 C0 0F 85 ? ? ? ? A1 ? ? ? ? 8B B7" ) ); - - if ( !g_csgo.m_panic && pvs_retaddr ) { - stack_t stack( get_baseptr( ) ); - auto return_address = stack.return_address( ); - - if ( return_address == pvs_retaddr ) { - if ( pvs_ent && reinterpret_cast< c_base_player* >( pvs_ent )->is_valid( ) ) { - *( int* )( pvs_ent + 0xa24 ) = -1; - *( int* )( pvs_ent + 0xa2c ) = *( int* )( pvs_ent + 0xa28 ); - *( int* )( pvs_ent + 0xa28 ) = 0; - return true; - } - } - } - - return is_hltv_o( ecx, pvs_ent ); -} - -bool __declspec( naked ) __fastcall hooks::is_hltv_proxy( void*, void* ) { - __asm { - mov edx, edi; - jmp is_hltv; - } -}
\ No newline at end of file diff --git a/internal_rewrite/is_paused.cpp b/internal_rewrite/is_paused.cpp deleted file mode 100644 index 9cb0ef8..0000000 --- a/internal_rewrite/is_paused.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "mem.hpp" -#include "hooks.hpp" - -bool __fastcall hooks::is_paused( void* ecx_, void* edx_ ) { - static auto interpolation_addr = pattern::first_code_match( g_csgo.m_chl.dll( ), xors( "84 C0 74 07 C6 05 ? ? ? ? ? 8B 0D" ) ); - static auto is_paused_o = g_csgo.m_engine->get_old_function< decltype( &is_paused ) >( 90 ); - - stack_t stack( get_baseptr( ) ); - uintptr_t return_address = stack.return_address( ); - - if( g_settings.rage.enabled && return_address == interpolation_addr ) { - return true; - } - - return is_paused_o( ecx_, 0 ); -}
\ No newline at end of file diff --git a/internal_rewrite/lock_cursor.cpp b/internal_rewrite/lock_cursor.cpp index 1d4d0e2..6edb52a 100644 --- a/internal_rewrite/lock_cursor.cpp +++ b/internal_rewrite/lock_cursor.cpp @@ -1,8 +1,6 @@ #include "hooks.hpp"
void __fastcall hooks::lock_cursor( void* ecx_, void* edx_ ) {
- static auto lock_cursor_o = g_csgo.m_surface->get_old_function< decltype( &lock_cursor ) >( 67 );
-
if( g_settings.menu.open || g_con->m_open ) {
g_csgo.m_surface( )->UnlockCursor( );
return;
diff --git a/internal_rewrite/materialsystem_config.cpp b/internal_rewrite/materialsystem_config.cpp index d3dc44a..102d09b 100644 --- a/internal_rewrite/materialsystem_config.cpp +++ b/internal_rewrite/materialsystem_config.cpp @@ -2,7 +2,7 @@ #include "settings.hpp" bool __fastcall hooks::material_system( void* ecx, void* edx, IMaterialSystem_Config_t* config, bool forceupdate ) { - static auto original_fn = g_csgo.m_mat_system->get_old_function< decltype( &hooks::material_system ) >( 21 ); + static auto original_fn = material_system_o; config->m_fullbright = g_settings.visuals.fullbright( ); diff --git a/internal_rewrite/on_screen_size_changed.cpp b/internal_rewrite/on_screen_size_changed.cpp index 62a5102..731835e 100644 --- a/internal_rewrite/on_screen_size_changed.cpp +++ b/internal_rewrite/on_screen_size_changed.cpp @@ -1,7 +1,7 @@ #include "hooks.hpp" void __fastcall hooks::on_screen_size_changed( void* ecx_, void* edx_, int old_w, int old_h ) { - static auto old_fn = g_csgo.m_surface->get_old_function< decltype( &on_screen_size_changed ) >( 116 ); + static auto old_fn = on_screen_size_changed_o; old_fn( ecx_, nullptr, old_w, old_h ); diff --git a/internal_rewrite/override_mouse_input.cpp b/internal_rewrite/override_mouse_input.cpp index 47d3b49..84e3f57 100644 --- a/internal_rewrite/override_mouse_input.cpp +++ b/internal_rewrite/override_mouse_input.cpp @@ -3,7 +3,7 @@ #include "context.hpp" void __fastcall hooks::override_mouse_input( void* ecx_, void* edx_, float* x, float* y ) { - static auto omi_o = g_csgo.m_clientmode->get_old_function< decltype( &hooks::override_mouse_input ) >( 23 ); + static auto omi_o = override_mouse_input_o; omi_o( ecx_, edx_, x, y ); if( g_csgo.m_panic ) return; diff --git a/internal_rewrite/override_view.cpp b/internal_rewrite/override_view.cpp index 9a2e972..9217381 100644 --- a/internal_rewrite/override_view.cpp +++ b/internal_rewrite/override_view.cpp @@ -3,7 +3,6 @@ #include "hooks.hpp" #include "settings.hpp" void __fastcall hooks::override_view( void* ecx_, void* edx_, CViewSetup* setup ) { - static auto override_view_o = g_csgo.m_clientmode->get_old_function< decltype( &hooks::override_view ) >( 18 ); if( g_csgo.m_panic ) { return override_view_o( ecx_, nullptr, setup ); } diff --git a/internal_rewrite/paint_traverse.cpp b/internal_rewrite/paint_traverse.cpp index 7664f9a..ef2efe7 100644 --- a/internal_rewrite/paint_traverse.cpp +++ b/internal_rewrite/paint_traverse.cpp @@ -7,8 +7,9 @@ #include "settings.hpp" void __fastcall hooks::paint_traverse( void* ecx_, void* edx_, unsigned int panel, bool force_repaint, bool allowforce ) { - static auto paint_traverse_o = g_csgo.m_panel->get_old_function< decltype( &hooks::paint_traverse ) >( 41 ); if( g_csgo.m_panic ) return paint_traverse_o( ecx_, 0, panel, force_repaint, allowforce ); + if( ecx_ != g_csgo.m_panel.get( ) ) + return paint_traverse_o( ecx_, 0, panel, force_repaint, allowforce ); g_csgo.m_main_thread = std::this_thread::get_id( ); diff --git a/internal_rewrite/play_sound.cpp b/internal_rewrite/play_sound.cpp index 3042b02..542be24 100644 --- a/internal_rewrite/play_sound.cpp +++ b/internal_rewrite/play_sound.cpp @@ -1,8 +1,6 @@ #include "hooks.hpp" #include "base_cheat.hpp" 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 = 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 ); diff --git a/internal_rewrite/ragebot.cpp b/internal_rewrite/ragebot.cpp index 54b74d9..1638a55 100644 --- a/internal_rewrite/ragebot.cpp +++ b/internal_rewrite/ragebot.cpp @@ -74,6 +74,9 @@ namespace features vec3_t c_ragebot::multipoint( c_base_player* ent, int hitbox, float* out_dmg ) {
auto should_multipoint = [ ]( int hitbox, bool moving ) -> bool {
+ if( !g_settings.rage.multipoint_enable )
+ return false;
+
auto& setting = g_settings.rage.multipoint;
switch( hitbox ) {
diff --git a/internal_rewrite/ragebot_lagcomp.cpp b/internal_rewrite/ragebot_lagcomp.cpp index a047cec..201c9be 100644 --- a/internal_rewrite/ragebot_lagcomp.cpp +++ b/internal_rewrite/ragebot_lagcomp.cpp @@ -419,7 +419,7 @@ namespace features }
else if( is_moving && !was_dormant[ i ] && g_settings.rage.resolver ) {
- m_first_update[ i ] = true;
+ m_first_update[ i ] = false;
ent->m_angEyeAngles( ).y = lby;
update_anims( i );
@@ -436,7 +436,7 @@ namespace features update_anims( i );
lag_record_t new_record( ent );
- if( !m_first_update ) {
+ if( !m_first_update[ i ] ) {
m_data_lby[ i ].push_front( new_record );
m_flick_time[ i ] = ent->m_flOldSimulationTime( ) + TICK_INTERVAL( );
}
diff --git a/internal_rewrite/run_command.cpp b/internal_rewrite/run_command.cpp index c92dd7b..9761960 100644 --- a/internal_rewrite/run_command.cpp +++ b/internal_rewrite/run_command.cpp @@ -2,8 +2,7 @@ #include "base_cheat.hpp" #include "context.hpp" -void __fastcall hooks::run_command( void* ecx_, void* edx_, IClientEntity* entity, user_cmd_t* ucmd, IMoveHelper* move_helper) { - static auto run_command_o = g_csgo.m_prediction->get_old_function< decltype( &hooks::run_command ) >( 19 ); +void __fastcall hooks::run_command( void* ecx_, void* edx_, IClientEntity* entity, user_cmd_t* ucmd, IMoveHelper* move_helper ) { if( !g_csgo.m_panic && g_settings.rage.anti_aim( ) && entity == g_ctx.m_local->ce( ) ) { g_cheat.m_ragebot.m_antiaim->on_runcommand( ); } diff --git a/internal_rewrite/scene_end.cpp b/internal_rewrite/scene_end.cpp index be3ceeb..619ac48 100644 --- a/internal_rewrite/scene_end.cpp +++ b/internal_rewrite/scene_end.cpp @@ -4,7 +4,6 @@ #include "context.hpp" void __fastcall hooks::scene_end( void* ecx_, void* edx_ ) { - static auto scene_end_o = g_csgo.m_render_view->get_old_function< decltype( &hooks::scene_end ) >( 9 ); scene_end_o( edx_, 0 ); if( !g_csgo.m_panic && g_ctx.m_local && g_settings.visuals.chams.enabled( ) && g_settings.visuals.chams.ignore_z( ) && g_settings.visuals.chams.clear_occlusion ) { diff --git a/internal_rewrite/send_datagram.cpp b/internal_rewrite/send_datagram.cpp index 8a7b21b..7a86842 100644 --- a/internal_rewrite/send_datagram.cpp +++ b/internal_rewrite/send_datagram.cpp @@ -6,7 +6,6 @@ uintptr_t cl_sendmove = 0; int __fastcall hooks::send_datagram( INetChannel* channel, void* edx_, void* datagram ) { - auto send_datagram_o = g_csgo.m_net_channel->get_old_function< decltype( &hooks::send_datagram ) >( 46 ); if( g_csgo.m_panic || !g_settings.misc.net_fakelag || datagram ) { return send_datagram_o( channel, 0, datagram ); } diff --git a/internal_rewrite/shut_down.cpp b/internal_rewrite/shut_down.cpp index 9a0ec0d..c3d2a95 100644 --- a/internal_rewrite/shut_down.cpp +++ b/internal_rewrite/shut_down.cpp @@ -1,12 +1,18 @@ #include "hooks.hpp" #include "chams.hpp" #include "base_cheat.hpp" +#include "detours.h" void __fastcall hooks::shut_down( void* ecx_, void* edx_ ) { - static auto original_fn = g_csgo.m_chl->get_old_function< decltype( &shut_down ) >( 3 ); + static auto original_fn = shut_down_o; g_csgo.m_engine( )->ClientCmd_Unrestricted( xors( "host_writeconfig" ) ); //fuck you + + memory::detours.restore( ); + + g_con->destroy( ); + abort( ); g_cheat.m_chams.m_materials.destroy_materials( ); diff --git a/internal_rewrite/simulate.cpp b/internal_rewrite/simulate.cpp index 6404a1c..28ec687 100644 --- a/internal_rewrite/simulate.cpp +++ b/internal_rewrite/simulate.cpp @@ -5,8 +5,6 @@ #include "context.hpp"
void __fastcall hooks::simulate( void* ecx, void* edx ) {
- static auto simulate_o = g_csgo.m_engine_vgui->get_old_function< decltype( &hooks::simulate ) >( 39 );
-
static auto ret_addr = pattern::first_code_match< void* >( g_csgo.m_engine.dll( ), "8B CE 6A FF 8B 06", -0x81 );
if( _ReturnAddress( ) == (void*)ret_addr ) {
diff --git a/internal_rewrite/suppress_lists.cpp b/internal_rewrite/suppress_lists.cpp index 93c31b2..01036ea 100644 --- a/internal_rewrite/suppress_lists.cpp +++ b/internal_rewrite/suppress_lists.cpp @@ -5,9 +5,7 @@ #include "settings.hpp" #include "base_cheat.hpp" -void __fastcall hooks::suppress_lists( void* ecx, void* edx, int list_mask, bool suppress ) { - static auto suppress_lists_o = g_csgo.m_partition->get_old_function< decltype( &hooks::suppress_lists ) >( 16 ); - +void __fastcall hooks::suppress_lists( void* ecx, void* edx, int list_mask, bool suppress ) { #ifdef HEADER_MODULE static auto net_update_ret = g_header.patterns.net_update_retaddr; #else diff --git a/internal_rewrite/traceray.cpp b/internal_rewrite/traceray.cpp deleted file mode 100644 index 8ca6d79..0000000 --- a/internal_rewrite/traceray.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "hooks.hpp"
-
-#include <intrin.h>
-#include "mem.hpp"
-
-void __fastcall hooks::trace_ray( void* ecx_, void* edx_, const Ray_t& ray, unsigned int fMask, ITraceFilter* pTraceFilter, CBaseTrace* pTrace ) {
- static auto trace_ray_o = g_csgo.m_trace->get_old_function< decltype( &trace_ray ) >( 5 );
-
-/* if( std::this_thread::get_id( ) == g_csgo.m_d3d_thread ) {
- void* address = _ReturnAddress( );
- //MEMORY_BASIC_INFORMATION info;
- //VirtualQuery( address, &info, sizeof( MEMORY_BASIC_INFORMATION ) );
-
- char mod[ MAX_PATH ];
- //GetModuleFileNameA( ( HMODULE )info.AllocationBase, mod, MAX_PATH );
-
- //printf( "TRACERAY CALLED FROM D3D\n" );
- stack_t stack( get_baseptr( ) );
-
- int i{ };
- for( ; stack.get( ) > 0x100; stack = stack.next( ), i++ ) {
- MEMORY_BASIC_INFORMATION info;
- VirtualQuery( ( void* )( stack.return_address( ) ), &info, sizeof( MEMORY_BASIC_INFORMATION ) );
-
- GetModuleFileNameA( ( HMODULE )info.AllocationBase, mod, MAX_PATH );
-
- if( strstr( mod, "moneybot" ) )
- printf( "stack frame: %d retaddr: %08x %s\n", i, stack.return_address( ), mod );
- }
- }*/
-
- return trace_ray_o( ecx_, edx_, ray, fMask, pTraceFilter, pTrace );
-}
\ No newline at end of file diff --git a/internal_rewrite/update_clientside_animation.cpp b/internal_rewrite/update_clientside_animation.cpp index cf1db8b..fb4ab72 100644 --- a/internal_rewrite/update_clientside_animation.cpp +++ b/internal_rewrite/update_clientside_animation.cpp @@ -5,7 +5,11 @@ void __fastcall hooks::update_clientside_animation( void* ecx_, void* edx_ ) {
static bool first_update = true;
- auto old_func = g_csgo.m_local->get_old_function< decltype( &hooks::update_clientside_animation ) >( 218 );
+ auto old_func = update_clientside_animation_o;
+
+ if( ecx_ != g_ctx.m_local )
+ return old_func( ecx_, edx_ );
+
auto ent = ( c_base_player* )( ecx_ );
static ent_animdata_t prev_anims;
diff --git a/internal_rewrite/visual_player.cpp b/internal_rewrite/visual_player.cpp index 2e94530..645417d 100644 --- a/internal_rewrite/visual_player.cpp +++ b/internal_rewrite/visual_player.cpp @@ -595,7 +595,7 @@ namespace features }
-#ifdef _DEBUG
+
static con_var< bool > dbg_multipoint{ &data::holder_, fnv( "dbg_multipoint" ), false };
if( dbg_multipoint( ) ) {
auto should_multipoint = [ ]( int hitbox, bool moving ) -> bool {
@@ -722,7 +722,7 @@ namespace features }
}
-
+#ifdef _DEBUG
static con_var< bool > dbg_bt{ &data::holder_, fnv( "dbg_bt" ), false };
if( dbg_bt( ) && i == g_cheat.m_ragebot.get_shot_target( ) ) {
auto hdr = g_csgo.m_model_info( )->GetStudiomodel( ent->ce( )->GetModel( ) );
diff --git a/internal_rewrite/vmt.hpp b/internal_rewrite/vmt.hpp index 2ea9d72..03409ce 100644 --- a/internal_rewrite/vmt.hpp +++ b/internal_rewrite/vmt.hpp @@ -24,6 +24,7 @@ namespace hooks class c_vmt { uintptr_t* m_table; uintptr_t* m_original; + bool m_copied; std::vector< uintptr_t > m_new; public: int count( ) { @@ -48,8 +49,7 @@ namespace hooks this->m_new.push_back( this->m_original[ i ] ); } - auto data = this->m_new.data( ); - *this->m_table = uintptr_t( &data[ 1 ] ); + m_copied = false; } ~c_vmt( ) { } @@ -63,6 +63,13 @@ namespace hooks } void hook( int index, uintptr_t new_func ) { + if( !m_copied ) { + auto data = this->m_new.data( ); + *this->m_table = uintptr_t( &data[ 1 ] ); + + m_copied = true; + } + this->m_new.at( index + 1 ) = new_func; } @@ -71,6 +78,13 @@ namespace hooks } void hook( int index, void* new_func ) { + if( !m_copied ) { + auto data = this->m_new.data( ); + *this->m_table = uintptr_t( &data[ 1 ] ); + + m_copied = true; + } + hook( index, reinterpret_cast< uintptr_t >( new_func ) ); } |
