summaryrefslogtreecommitdiff
path: root/cheat/internal_rewrite/proxies.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 /cheat/internal_rewrite/proxies.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 'cheat/internal_rewrite/proxies.cpp')
-rw-r--r--cheat/internal_rewrite/proxies.cpp116
1 files changed, 116 insertions, 0 deletions
diff --git a/cheat/internal_rewrite/proxies.cpp b/cheat/internal_rewrite/proxies.cpp
new file mode 100644
index 0000000..287970b
--- /dev/null
+++ b/cheat/internal_rewrite/proxies.cpp
@@ -0,0 +1,116 @@
+#include "hooks.hpp"
+#include "context.hpp"
+#include "base_cheat.hpp"
+
+void __cdecl hooks::lby_proxy_fn( const CRecvProxyData* proxy_data_const, void* entity, void* output ) {
+ lby_proxy.get_old_function( )( proxy_data_const, entity, output );
+
+ if( !g_csgo.m_panic ) {
+ auto player = ( c_base_player* )( entity );
+ if( player && player == g_ctx.m_local ) {
+ g_cheat.m_ragebot.m_antiaim->on_lby_proxy( );
+ }
+ }
+}
+
+void __cdecl hooks::last_shot_proxy_fn( const CRecvProxyData* proxy_data_const, void* entity, void* output ) {
+ last_shot_proxy.get_old_function( )( proxy_data_const, entity, output );
+ if( !g_csgo.m_panic && proxy_data_const && g_settings.rage.enabled( ) && g_settings.rage.resolver( ) ) {
+ auto wep = ( c_base_weapon* )( entity );
+ if( wep && !wep->is_knife( ) && !wep->is_grenade( ) ) {
+ auto owner = g_csgo.m_entlist( )->GetClientEntityFromHandle( wep->m_hOwner( ) );
+ if( owner && owner->is_valid( ) && owner != g_ctx.m_local && g_ctx.m_local->is_valid( ) && owner->has_valid_anim( ) ) {
+ if( owner->m_iTeamNum( ) == g_ctx.m_local->m_iTeamNum( ) && !g_settings.rage.friendlies )
+ return;
+
+ static float last_time = 0.f;
+ float time = wep->m_fLastShotTime( );
+
+ if( !time )
+ return;
+
+ float anim_time = owner->m_flOldSimulationTime( ) + TICK_INTERVAL( );
+ auto record = g_cheat.m_ragebot.m_lagcomp->get_newest_record( owner->ce( )->GetIndex( ) );
+ float& last_update = g_cheat.m_ragebot.m_lagcomp->get_last_updated_simtime( owner->ce( )->GetIndex( ) );
+
+ if( time == anim_time && owner->has_valid_anim( ) && owner->m_flSimulationTime( ) != last_update ) {
+ last_update = owner->m_flSimulationTime( );
+
+ vec3_t local_pos = g_ctx.m_local->m_vecOrigin( );
+ vec3_t enemy_pos = owner->m_vecOrigin( );
+ vec3_t ang = math::vector_angles( enemy_pos, local_pos );
+
+ owner->m_angEyeAngles( ).y = ang.y;
+ owner->fix_animations( );
+
+ features::c_ragebot::lag_record_t record( owner );
+ record.m_shot = true;
+
+ g_cheat.m_ragebot.m_lagcomp->store_record( owner->ce( )->GetIndex( ), RECORD_NORMAL, record );
+ last_time = time;
+ }
+ else if( owner->has_valid_anim( ) && time != last_time ) {
+ auto lby_records = g_cheat.m_ragebot.m_lagcomp->get_records( owner->ce( )->GetIndex( ), RECORD_LBY );
+ auto sim_records = g_cheat.m_ragebot.m_lagcomp->get_records( owner->ce( )->GetIndex( ), RECORD_NORMAL );
+
+ features::c_ragebot::lag_record_t* prev_record = nullptr;
+ float min_delta = FLT_MAX;
+
+ if( lby_records->size( ) ) {
+ for( auto& it : *lby_records ) {
+ float delta = std::abs( it.m_flSimulationTime - time );
+ if( delta > TICKS_TO_TIME( 15 ) )
+ break;
+
+ if( delta < g_csgo.m_globals->m_interval_per_tick )
+ break;
+
+ if( delta < min_delta ) {
+ prev_record = &it;
+ min_delta = delta;
+ }
+ }
+ }
+
+ if( sim_records->size( ) ) {
+ for( auto& it : *sim_records ) {
+ if( it.m_shot )
+ continue;
+
+ float delta = std::abs( it.m_flSimulationTime - time );
+ if( delta > TICKS_TO_TIME( 15 ) )
+ break;
+
+ if( delta < g_csgo.m_globals->m_interval_per_tick )
+ break;
+
+ if( delta < min_delta ) {
+ prev_record = &it;
+ min_delta = delta;
+ }
+ }
+ }
+
+ if( prev_record && !prev_record->m_shot ) {
+ owner->m_angEyeAngles( ).x = prev_record->m_vecAngles.x;
+ }
+
+ last_time = time;
+ }
+ }
+ }
+ }
+}
+
+void __cdecl hooks::simtime_proxy_fn( const CRecvProxyData* proxy_data_const, void* entity, void* output ) {
+ auto old_fn = simtime_proxy.get_old_function( );
+
+ auto ent = ( c_base_player* )( entity );
+ if( ent && ent->is_valid( ) && ent->has_valid_anim( ) && ( ent->m_iTeamNum( ) != g_ctx.m_local->m_iTeamNum( ) || g_settings.rage.friendlies( ) ) && ent != g_ctx.m_local ) {
+ if( !proxy_data_const->m_Value.m_Int ) {
+ return;
+ }
+ }
+
+ old_fn( proxy_data_const, entity, output );
+} \ No newline at end of file