From 3d412a4b30a9f7c7f51ea6562e694315948bd3da Mon Sep 17 00:00:00 2001 From: boris Date: Wed, 28 Nov 2018 16:00:02 +1300 Subject: 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 --- cheat/gmod/create_move.cpp | 87 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 cheat/gmod/create_move.cpp (limited to 'cheat/gmod/create_move.cpp') diff --git a/cheat/gmod/create_move.cpp b/cheat/gmod/create_move.cpp new file mode 100644 index 0000000..c25d0c5 --- /dev/null +++ b/cheat/gmod/create_move.cpp @@ -0,0 +1,87 @@ +#include + +#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; +} -- cgit v1.2.3