summaryrefslogtreecommitdiff
path: root/gmod/create_move.cpp
diff options
context:
space:
mode:
authorJustSomePwner <crotchyalt@gmail.com>2018-08-30 14:01:54 +0200
committerJustSomePwner <crotchyalt@gmail.com>2018-08-30 14:01:54 +0200
commit7ccb819f867493f8ec202ea3b39c94c198c64584 (patch)
tree94622e61af0ff359e3d6689cf274d74f60b2492a /gmod/create_move.cpp
parent564d979b79e8a5aaa5014eba0ecd36c61575934f (diff)
first
Diffstat (limited to 'gmod/create_move.cpp')
-rw-r--r--gmod/create_move.cpp87
1 files changed, 87 insertions, 0 deletions
diff --git a/gmod/create_move.cpp b/gmod/create_move.cpp
new file mode 100644
index 0000000..c25d0c5
--- /dev/null
+++ b/gmod/create_move.cpp
@@ -0,0 +1,87 @@
+#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"
+
+
+bool __fastcall hooks::create_move( void* ecx_, void* edx_, float input_sample_frametime, user_cmd_t* ucmd ) {
+ static auto create_move_o = g_gmod.m_clientmode->get_old_function< decltype( &hooks::create_move ) >( 21 );
+
+ // call from CInput::ExtraMouseSample with dummy cmd.
+ if( !ucmd->m_cmd_nr || !ucmd->m_tick_count || g_gmod.m_panic )
+ return create_move_o( ecx_, 0, input_sample_frametime, ucmd );
+
+ // for interfacing with lua related stuff.
+ g_ctx.m_lua = g_gmod.m_lua_shared( )->GetLuaInterface( LUA_CLIENT );
+ if( !g_ctx.m_lua )
+ return create_move_o( ecx_, 0, input_sample_frametime, ucmd );
+
+ // random_seed isn't generated in ClientMode::CreateMove yet (since CInput::CreateMove handles that), we must generate it ourselves.
+ ucmd->m_random_seed = math::md5_pseudorandom( ucmd->m_cmd_nr ) & 0x7fffffff;
+
+ //get sendpacket off the stack
+ stack_t stack( get_baseptr( ) );
+ byte *send_packet = stack.next( ).next( ).next( ).local< byte* >( 0x1 );
+
+ g_ctx.create_snapshot( ucmd );
+
+ //return create_move_o( ecx_, 0, input_sample_frametime, 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_gmod.m_globals->m_framecount;
+ if( last_frame != g_gmod.m_globals->m_framecount )
+ g_ctx.m_has_fired_this_frame = false;
+
+ last_frame = g_gmod.m_globals->m_framecount;
+
+ // hook fire bullets for spread compensation.
+ if( !fire_bullets_o ) {
+ fire_bullets_o = decltype( &hooks::fire_bullets )( c_vmt::hook_method( g_ctx.m_local, 16, hooks::fire_bullets ) );
+ }
+
+ g_cheat.m_prediction( ucmd );
+ g_cheat.m_movement( ucmd );
+
+ g_cheat.m_lagmgr( ucmd, send_packet );
+
+ g_cheat.m_aimbot( ucmd );
+
+ //if( auto weapon = g_ctx.m_local->get_weapon( ) ) {
+ // if( auto c_class = weapon->ce( )->GetClientClass( ) ) {
+ // g_con->print( "%s\n", c_class->m_name );
+ // }
+ //}
+
+ g_cheat.m_extra.use_spammer( ucmd );
+
+ if( g_cheat.m_lagmgr.get_choked( ) > 15 ) {
+ g_cheat.m_lagmgr.set_state( true );
+ }
+
+ g_cheat.m_lagmgr.on_cmove_end( );
+
+ g_ctx.on_cmove_end( ucmd );
+
+ ucmd->clamp( );
+ // call original *after* any changes due to anticheats detecting changes between this and any changes after.
+ create_move_o( ecx_, 0, input_sample_frametime, ucmd );
+
+ g_cheat.m_aimbot.silent( );
+ }
+ else {
+ create_move_o( ecx_, 0, input_sample_frametime, ucmd );
+ }
+
+ return false;
+}