summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal_rewrite/create_move.cpp2
-rw-r--r--internal_rewrite/prediction.cpp302
-rw-r--r--internal_rewrite/prediction.hpp2
-rw-r--r--internal_rewrite/ragebot.cpp2
4 files changed, 42 insertions, 266 deletions
diff --git a/internal_rewrite/create_move.cpp b/internal_rewrite/create_move.cpp
index 7c6aefa..f56390a 100644
--- a/internal_rewrite/create_move.cpp
+++ b/internal_rewrite/create_move.cpp
@@ -75,7 +75,6 @@ bool __fastcall hooks::create_move( void* ecx_, void* edx_, float input_sample_f
g_cheat.m_movement( ucmd );
// This should account for the majority of FPS related bugs.
- g_cheat.m_prediction.pre_run_command( );
// Actual implementation of RunCommand.
g_cheat.m_prediction.run_command( ucmd );
@@ -93,7 +92,6 @@ bool __fastcall hooks::create_move( void* ecx_, void* edx_, float input_sample_f
g_cheat.m_extra.no_recoil( ucmd );
// Restores globals.
- g_cheat.m_prediction.post_run_command( );
g_cheat.m_move_rec( ucmd );
diff --git a/internal_rewrite/prediction.cpp b/internal_rewrite/prediction.cpp
index 233fb62..c088a65 100644
--- a/internal_rewrite/prediction.cpp
+++ b/internal_rewrite/prediction.cpp
@@ -541,83 +541,6 @@ void c_prediction::try_touch_ground_in_quadrants( c_base_player* player, const v
pm->endpos = end_pos;
}
-// This is extremely gay, don't use it.
-// void c_prediction::local_pred( user_cmd_t* ucmd ) {
-// if( !ucmd || !g_ctx.m_local || !g_ctx.m_local->is_alive( ) )
-// return;
-//
-// static uintptr_t run_command_address = g_csgo.m_prediction->get_old_function< uintptr_t >( 19 );
-//
-// CMoveData move_data{ };
-// IClientEntity* local_ent = g_ctx.m_local->ce( );
-//
-// //backup data
-// int old_buttons = ucmd->m_buttons;
-// float old_curtime = g_csgo.m_globals->m_curtime;
-// float old_frame_time = g_csgo.m_globals->m_frametime;
-// int old_tickbase = g_ctx.m_local->m_nTickBase( );
-// int old_flags = g_ctx.m_local->m_fFlags( );
-// MoveType_t old_move_type = g_ctx.m_local->m_nMoveType( );
-// vec3_t old_velocity = g_ctx.m_local->m_vecVelocity( );
-//
-// //set globals
-// g_csgo.m_globals->m_curtime = g_csgo.m_globals->m_interval_per_tick * old_tickbase;
-// g_csgo.m_globals->m_frametime = g_csgo.m_globals->m_interval_per_tick;
-//
-// //random seed is already being calculated and set in createmove
-// **( uintptr_t** )( run_command_address + 0x3E ) = ucmd->m_random_seed; //prediction seed
-// **( uintptr_t** )( run_command_address + 0x54 ) = uintptr_t( g_ctx.m_local ); //prediction player
-//
-// //start prediction
-// g_csgo.m_move_helper( )->SetHost( local_ent );
-// g_csgo.m_game_movement( )->StartTrackPredictionErrors( local_ent );
-//
-// //run prediction
-// g_csgo.m_prediction( )->SetupMove( local_ent, ucmd, g_csgo.m_move_helper( ), &move_data );
-// g_csgo.m_game_movement( )->ProcessMovement( local_ent, &move_data );
-// g_csgo.m_prediction( )->FinishMove( local_ent, ucmd, &move_data );
-//
-// //finish prediction
-// g_csgo.m_game_movement( )->FinishTrackPredictionErrors( local_ent );
-// g_csgo.m_move_helper( )->SetHost( nullptr );
-//
-// **( uintptr_t** )( run_command_address + 0x3E ) = 0xffffffff;
-// **( uintptr_t*** )( run_command_address + 0x54 ) = nullptr;
-//
-// //good to have, can be used for edge jump and such
-// m_predicted_flags = g_ctx.m_local->m_fFlags( );
-//
-// //restore
-// ucmd->m_buttons = old_buttons;
-// g_csgo.m_globals->m_curtime = old_curtime;
-// g_csgo.m_globals->m_frametime = old_frame_time;
-// g_ctx.m_local->m_nTickBase( ) = old_tickbase;
-// g_ctx.m_local->m_fFlags( ) = old_flags;
-// g_ctx.m_local->m_nMoveType( ) = old_move_type;
-// g_ctx.m_local->m_vecVelocity( ) = old_velocity;
-// }
-
-void c_prediction::pre_run_command( ) {
- // The game does not advance the tickbase if the engine is paused.
- if ( g_csgo.m_prediction( )->m_bEnginePaused )
- return;
-
- auto *cl = g_csgo.m_global_state->get_client_state( );
-
- // Ideally, you should only be doing this if the last stage is
- // FRAME_NET_UPDATE_END.
-
- if ( cl && cl->m_delta_tick >= 0 ) {
- // This should fix the issues when bunny-hopping on a low frame-rate.
- g_csgo.m_prediction( )->Update(
- cl->m_delta_tick,
- cl->m_delta_tick > 0,
- cl->m_last_acknowledged_cmd,
- cl->m_lastoutgoingcommand + cl->m_chokedcommands
- );
- }
-}
-
// This code got nasty after a while, imo. You can clean it up if you care enough.
void c_prediction::run_command( user_cmd_t *ucmd ) {
CMoveData movedata{ };
@@ -641,7 +564,6 @@ void c_prediction::run_command( user_cmd_t *ucmd ) {
*reinterpret_cast< int * >( m_prediction_seed ) = ucmd ? ucmd->m_random_seed : -1;
*reinterpret_cast< uint32_t * >( m_prediction_player ) = uint32_t( player );
- // Copy user command to m_pCurrentCommand and m_pPlayerCommand.
int backup_buttons = ucmd->m_buttons;
float backup_forwardmove = ucmd->m_forwardmove;
float backup_sidemove = ucmd->m_sidemove;
@@ -649,173 +571,58 @@ void c_prediction::run_command( user_cmd_t *ucmd ) {
ucmd->m_forwardmove = ucmd->m_sidemove = 0.f;
ucmd->m_buttons &= ~( IN_BACK | IN_FORWARD | IN_MOVELEFT | IN_MOVERIGHT );
- *reinterpret_cast< uint32_t * >( uint32_t( player ) + 0x3314 ) = uint32_t( ucmd );
- *reinterpret_cast< uint32_t * >( uint32_t( player ) + 0x326C ) = uint32_t( ucmd );
-
- // Store entity variables that will get updated.
- auto old_flags = player->m_fFlags( );
- auto old_move = player->m_nMoveType( );
- auto old_tickbase = player->m_nTickBase( );
-
- m_velocity = player->m_vecVelocity( );
-
- // Store globals prior to prediction.
- m_old_time = g_csgo.m_globals->m_curtime;
- m_old_frametime = g_csgo.m_globals->m_frametime;
- m_old_tickcount = g_csgo.m_globals->m_tickcount;
-
- // Set up globals.
- g_csgo.m_globals->m_curtime = old_tickbase * TICK_INTERVAL( );
- g_csgo.m_globals->m_frametime = TICK_INTERVAL( );
- g_csgo.m_globals->m_tickcount = old_tickbase;
-
- // This is in order to avoid double footsteps
- // NOTE: This is being a meme in Moneybot for some reason, not sure why.
- // Worked perfectly fine in my cheat.
- bool old_predicted = g_csgo.m_prediction( )->m_bIsFirstTimePredicted;
- bool old_prediction = g_csgo.m_prediction( )->m_bInPrediction;
-
- g_csgo.m_prediction( )->m_bIsFirstTimePredicted = false;
- g_csgo.m_prediction( )->m_bInPrediction = true;
-
- // Handle frame-time as the engine would.
- if ( g_csgo.m_prediction( )->m_bEnginePaused )
- g_csgo.m_globals->m_frametime = 0.0f;
-
- ucmd->m_buttons |= *( uint32_t * ) ( ( uint32_t ) player + 0x3310 ); // unk01
-
- g_csgo.m_game_movement( )->StartTrackPredictionErrors( player_ce );
-
- if ( ucmd->m_impulse )
- *( uint32_t * ) ( ( uint32_t ) player + 0x31EC ) = ucmd->m_impulse;
-
- // CPrediction::UpdateButtonState
- {
- /*
- v16 = ucmd->m_fButtons;
- v17 = v16 ^ *(_DWORD *)(player + 0x31E8);
- *(_DWORD *)(player + 0x31DC) = *(_DWORD *)(player + 0x31E8);
- *(_DWORD *)(player + 0x31E8) = v16;
- *(_DWORD *)(player + 0x31E0) = v16 & v17;
- v18 = gpGlobals;
- *(_DWORD *)(player + 0x31E4) = v17 & ~v16;
- */
-
- auto original_buttons = ucmd->m_buttons;
-
- auto *m_afButtonBackup = reinterpret_cast< int * >( uint32_t( player ) + 0x31E8 );
- auto unk03 = original_buttons ^ *m_afButtonBackup;
-
- *reinterpret_cast< int * >( uint32_t( player ) + 0x31DC ) = *m_afButtonBackup; // m_afButtonLast
- *reinterpret_cast< int * >( uint32_t( player ) + 0x31E8 ) = original_buttons; // m_afButtonBackup (??)
- *reinterpret_cast< int * >( uint32_t( player ) + 0x31E0 ) = original_buttons & unk03; // m_afButtonPressed
- *reinterpret_cast< int * >( uint32_t( player ) + 0x31E4 ) = unk03 & ~original_buttons;// m_afButtonReleased
- }
-
- // NOTE: The IDA generated call is WRONG, check the assembly!
- // The function only uses the lower bits of the double, though. Valve code.....
-
- // using fnCheckMovingGround = void( __thiscall * )( void *, se::C_BaseEntity *, double );
- // Memory::Virtual< fnCheckMovingGround >( this, 16 )( this, player, frametime );
+ if( !ucmd || !g_ctx.m_local || !g_ctx.m_local->is_alive( ) )
+ return;
- // This might not be needed, tbh.
- /*
- (*(void (__stdcall **)(int, _DWORD, _DWORD))(*(_DWORD *)prediction->pad00 + 72))(
- player,
- COERCE_UNSIGNED_INT64(v18->frametime),
- COERCE_UNSIGNED_INT64(v18->frametime) >> 32);
- */
+ static uintptr_t run_command_address = g_csgo.m_prediction->get_old_function< uintptr_t >( 19 );
- g_csgo.m_prediction( )->CheckMovingGround( player_ce, g_csgo.m_globals->m_frametime );
+ CMoveData move_data{ };
+ IClientEntity* local_ent = g_ctx.m_local->ce( );
- // CPrediction::RunPreThink
- {
- player->set_local_view_angles( &ucmd->m_viewangles );
+ //backup data
+ int old_buttons = ucmd->m_buttons;
+ float old_curtime = g_csgo.m_globals->m_curtime;
+ float old_frame_time = g_csgo.m_globals->m_frametime;
+ int old_tickbase = g_ctx.m_local->m_nTickBase( );
+ int old_flags = g_ctx.m_local->m_fFlags( );
+ MoveType_t old_move_type = g_ctx.m_local->m_nMoveType( );
+ vec3_t old_velocity = g_ctx.m_local->m_vecVelocity( );
- if ( player->run_physics_think( 0 ) )
- player->pre_think( );
- }
+ //set globals
+ g_csgo.m_globals->m_curtime = g_csgo.m_globals->m_interval_per_tick * old_tickbase;
+ g_csgo.m_globals->m_frametime = g_csgo.m_globals->m_interval_per_tick;
- // CPrediction::RunThink
- {
- auto *next_think = reinterpret_cast< int * >( uint32_t( player ) + 0xF8 );
-
- if ( *next_think > 0 && *next_think <= player->m_nTickBase( ) )
- {
- *next_think = -1;
-
- // sub_1017E880
- /*
- v2 = (int)this;
- v3 = this[57];
- result = (this[57] >> 22) & 1;
- if ( result )
- {
- if ( a2 )
- {
- this[57] = v3 & 0xFFBFFFFF;
- return result;
- }
- }
- else if ( a2 )
- {
- return result;
- }
- if ( result )
- return result;
- result = sub_1017E840();
- if ( !result )
- *(_DWORD *)(v2 + 228) = v3 | 0x400000;
- return result;
- */
-
- auto v3 = *reinterpret_cast< uint32_t * >( uint32_t( player ) + 0xE4 ); // m_iEFlags
- auto v4 = v3 & 0x400000;
-
- // Referenced in sub_1017E840.
- /*
- v3 = *(_DWORD *)(this + 0x2B8);
- v4 = 0;
- if ( v3 <= 0 )
- return 0;
- */
- auto v5 = *reinterpret_cast< uint32_t * >( uint32_t( player ) + 0x2B8 );
-
- if ( !v4 && !v5 )
- *reinterpret_cast< uint32_t * >( uint32_t( player ) + 0xE4 ) = v3 | 0x400000;
-
- player->think( );
- }
- }
+ //random seed is already being calculated and set in createmove
+ **( uintptr_t** )( run_command_address + 0x3E ) = ucmd->m_random_seed; //prediction seed
+ **( uintptr_t** )( run_command_address + 0x54 ) = uintptr_t( g_ctx.m_local ); //prediction player
- g_csgo.m_move_helper( )->SetHost( player_ce );
+ //start prediction
+ g_csgo.m_move_helper( )->SetHost( local_ent );
+ g_csgo.m_game_movement( )->StartTrackPredictionErrors( local_ent );
- g_csgo.m_prediction( )->SetupMove( player_ce, ucmd, g_csgo.m_move_helper( ), &movedata );
- g_csgo.m_game_movement( )->ProcessMovement( player_ce, &movedata );
- g_csgo.m_prediction( )->FinishMove( player_ce, ucmd, &movedata );
+ //run prediction
+ g_csgo.m_prediction( )->SetupMove( local_ent, ucmd, g_csgo.m_move_helper( ), &move_data );
+ g_csgo.m_game_movement( )->ProcessMovement( local_ent, &move_data );
+ g_csgo.m_prediction( )->FinishMove( local_ent, ucmd, &move_data );
- // CPrediction::RunPostThink
- {
- g_csgo.m_move_helper( )->ProcessImpacts( );
-
- // Calling C_BasePlayer::PostThink will cause C_BasePlayer::ItemPostFrame
- // to be called, resulting in all of our timers being fucked up.
-
- // player->PostThink( );
- }
+ //finish prediction
+ g_csgo.m_game_movement( )->FinishTrackPredictionErrors( local_ent );
+ g_csgo.m_move_helper( )->SetHost( nullptr );
- // Restore prediction flags.
- g_csgo.m_prediction( )->m_bIsFirstTimePredicted = old_predicted;
- g_csgo.m_prediction( )->m_bInPrediction = old_prediction;
+ **( uintptr_t** )( run_command_address + 0x3E ) = 0xffffffff;
+ **( uintptr_t*** )( run_command_address + 0x54 ) = nullptr;
- // Important: restore the old tick-base.
- player->m_nTickBase( ) = old_tickbase;
- player->m_fFlags( ) = old_flags;
- player->m_nMoveType( ) = old_move;
+ //good to have, can be used for edge jump and such
+ m_predicted_flags = g_ctx.m_local->m_fFlags( );
- // IMLAZY:
- // I'd rather just restore this instead of fixing it everywhere in the cheat.
- player->m_vecVelocity( ) = m_velocity;
+ //restore
+ ucmd->m_buttons = old_buttons;
+ g_csgo.m_globals->m_curtime = old_curtime;
+ g_csgo.m_globals->m_frametime = old_frame_time;
+ g_ctx.m_local->m_nTickBase( ) = old_tickbase;
+ g_ctx.m_local->m_fFlags( ) = old_flags;
+ g_ctx.m_local->m_nMoveType( ) = old_move_type;
+ g_ctx.m_local->m_vecVelocity( ) = old_velocity;
ucmd->m_forwardmove = backup_forwardmove;
ucmd->m_sidemove = backup_sidemove;
@@ -831,31 +638,4 @@ void c_prediction::run_command( user_cmd_t *ucmd ) {
}
}
-void c_prediction::post_run_command( ) {
- // Time saver.
- auto *player = g_ctx.m_local;
- auto *player_ce = player->ce( );
-
- if ( !player || !player_ce )
- return;
-
- g_csgo.m_game_movement( )->FinishTrackPredictionErrors( player_ce );
- g_csgo.m_move_helper( )->SetHost( nullptr );
-
- // CPrediction::FinishCommand
- {
- // Restore globals.
- g_csgo.m_globals->m_curtime = m_old_time;
- g_csgo.m_globals->m_frametime = m_old_frametime;
- g_csgo.m_globals->m_tickcount = m_old_tickcount;
-
- // Invalidate seed, player.
- *reinterpret_cast< int * >( m_prediction_seed ) = int( -1 );
- *reinterpret_cast< int * >( m_prediction_player ) = 0;
- *reinterpret_cast< uint32_t * >( uint32_t( player ) + 0x3314 ) = 0;
- }
-
- g_csgo.m_game_movement( )->Reset( );
-}
-
END_REGION
diff --git a/internal_rewrite/prediction.hpp b/internal_rewrite/prediction.hpp
index 914b97f..74a86a0 100644
--- a/internal_rewrite/prediction.hpp
+++ b/internal_rewrite/prediction.hpp
@@ -52,9 +52,7 @@ public:
// void local_pred( user_cmd_t* );
- void pre_run_command( );
void run_command( user_cmd_t *cmd );
- void post_run_command( );
int get_predicted_flags( ) const {
return m_predicted_flags;
diff --git a/internal_rewrite/ragebot.cpp b/internal_rewrite/ragebot.cpp
index 5e106ce..e82602d 100644
--- a/internal_rewrite/ragebot.cpp
+++ b/internal_rewrite/ragebot.cpp
@@ -924,7 +924,7 @@ namespace features
}
}
- if( g_settings.rage.active->m_auto_stop || g_settings.rage.compensate_spread )
+ if( g_settings.rage.active->m_auto_stop && !m_antiaim->is_fakewalking( ) && !g_settings.rage.compensate_spread )
m_cmd->m_forwardmove = m_cmd->m_sidemove = 0.f;
m_cmd->m_buttons |= IN_ATTACK;