summaryrefslogtreecommitdiff
path: root/internal_rewrite/create_move.cpp
blob: e9bb5eaf83039f9de377346e9b3b9334df46ec0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#include <intrin.h>

#include "hooks.hpp"
#include "mem.hpp"
#include "interface.hpp"
#include "context.hpp"
#include "input_system.hpp"
#include "math.hpp"

#include "base_cheat.hpp"

/*
void __declspec( naked ) __stdcall hooks::hl_create_move_gate( int sequence_number, float input_sample_time, bool active ) {
	__asm {
		push	ebp
		mov		ebp, esp
		push	ebx //push ebx (sendpacket) to the top of the stack 
		push	esp //push the stack (with sendpacket on top) 
		push	active
		push	input_sample_time
		push	sequence_number
		call	hl_create_move
		pop		ebx
		pop		ebp
		ret		0xc
	}
}
*/

bool __fastcall hooks::create_move( void* ecx_, void* edx_, float input_sample_frametime, user_cmd_t* ucmd ) {
	stack_t stack( get_baseptr( ) );
	byte* send_packet = stack.next( ).local< byte* >( 0x1c );

	bool ret = create_move_o( ecx_, edx_, input_sample_frametime, ucmd );

	if( !ucmd->m_tick_count || !ucmd->m_cmd_nr )
		return ret;

	// when switching to non automatic weapons, it will sometimes not shoot when aimbotting so we reset attack flag
	bool is_switching_weapon = false;
	if( g_csgo.m_input( )->m_hSelectedWeapon != -1 ) {
		is_switching_weapon = true;
	}

	//g_csgo.m_input( )->CreateMove( sequence_number, input_sample_time, active );


	if( ret )
		g_csgo.m_engine( )->SetViewAngles( ucmd->m_viewangles );

	// FIX ME NAVE
	// ok love
	// yes thank u

	g_ctx.create_snapshot( ucmd );
	g_cheat.m_extra.update_netchannel( );
	g_cheat.m_identity( );

	if( g_ctx.run_frame( ) && g_ctx.m_local->is_alive( ) ) {
		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;

		last_frame = g_csgo.m_globals->m_framecount;

		g_cheat.m_legitbot.sample_angle_data( ucmd->m_viewangles );
		
		// Okay, this implementation was REALLY fucking gay.
		// g_cheat.m_prediction.local_pred( ucmd );

		// Yeah.
		g_cheat.m_movement( ucmd );
		
		//SUPER SECRET EXPLOIT DO NOT LEAK
		//ucmd->m_buttons |= IN_BULLRUSH;

		// This should account for the majority of FPS related bugs.

		// Actual implementation of RunCommand.
		g_cheat.m_prediction.run_command( ucmd );

		g_cheat.m_extra.auto_revolver( ucmd );

		g_cheat.m_legitbot.m_lagcomp( ucmd );
		g_cheat.m_legitbot.triggerbot( ucmd );

		g_cheat.m_lagmgr( ucmd, send_packet );

		g_cheat.m_visuals.update_hit_flags( );

		g_cheat.m_ragebot( ucmd );

		g_cheat.m_extra.no_recoil( ucmd );

		// Restores globals.

		g_cheat.m_move_rec( ucmd );

		g_cheat.m_visuals.radar( );

		g_cheat.m_extra.rank_reveal( ucmd );

		if( g_cheat.m_lagmgr.get_choked( ) > 15 ) {
			g_cheat.m_lagmgr.set_state( true );
		}

		vec3_t real_angle = g_ctx.m_thirdperson_angle;

		g_cheat.m_lagmgr.on_cmove_end( );
		g_ctx.on_cmove_end( ucmd );

		g_cheat.m_ragebot.m_antiaim->on_runcommand( );
	}
	else {
		g_ctx.reset_shot_queue( );
	}

	if( is_switching_weapon ) {
		ucmd->m_buttons &= ~IN_ATTACK;
	}

	//m_bIsValveDS
	//if( *( bool* )( c_base_player::get_game_rules( ) + 0x75 ) )
		//g_settings.menu.anti_untrusted = true;

	ucmd->clamp( g_settings.menu.anti_untrusted );

	return false;
}