diff options
| author | navewindre <boneyaard@gmail.com> | 2018-09-09 18:28:04 +0200 |
|---|---|---|
| committer | navewindre <boneyaard@gmail.com> | 2018-09-09 18:28:04 +0200 |
| commit | 215818ddedc02be3a1a5c2be3912abdbcd29dd72 (patch) | |
| tree | 16453999d9380f43a6f436e491e63aa58ac7e764 /internal_rewrite/extra.cpp | |
| parent | 620f39df29fed446ab007e03c7b071f635379f1f (diff) | |
detours etc
Diffstat (limited to 'internal_rewrite/extra.cpp')
| -rw-r--r-- | internal_rewrite/extra.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/internal_rewrite/extra.cpp b/internal_rewrite/extra.cpp index d67b0d7..fa0882a 100644 --- a/internal_rewrite/extra.cpp +++ b/internal_rewrite/extra.cpp @@ -4,6 +4,7 @@ #include "math.hpp"
#include "hooks.hpp"
#include "interface.hpp"
+#include "detours.h"
#undef min
@@ -109,8 +110,9 @@ namespace features break;
}
+ static bool enabled = false;
auto clientstate = g_csgo.m_global_state->get_client_state( );
- if( clientstate ) {
+ if( clientstate && !enabled ) {
// TODO: Change this to the non-homosexual way of hooking CNetChan functions.
// Actually, I'm too lazy. You can do this if you want.
/* @@ -123,14 +125,8 @@ namespace features */
auto netchannel = clientstate->m_netchannel;
if( netchannel ) {
- auto old_netchannel = g_csgo.m_net_channel( );
-
- if( old_netchannel != netchannel ||
- ( old_netchannel &&
- g_csgo.m_net_channel->get_function< void* >( 46 ) != &hooks::send_datagram ) ) {
- g_csgo.m_net_channel( netchannel );
- g_csgo.m_net_channel->hook( 46, &hooks::send_datagram );
- }
+ hooks::send_datagram_o = memory::detours.create_hook( &hooks::send_datagram, g_csgo.m_net_channel->get_old_function< void* >( 46 ) );
+ enabled = true;
}
}
}
@@ -232,11 +228,16 @@ namespace features int def_index = weapon->m_iItemDefinitionIndex( );
if( def_index != WEAPON_R8REVOLVER ) return;
- if( !g_ctx.m_local->can_attack( ) ) {
+ static float next_time = 0.f;
+
+ auto time = g_ctx.pred_time( );
+ if( g_ctx.m_local->can_attack( ) && next_time >= time ) {
+ g_ctx.m_revolver_shot = false;
cmd->m_buttons |= IN_ATTACK;
}
- else if( !g_cheat.m_lagmgr.get_sent( ) ) {
- g_cheat.m_lagmgr.set_state( true );
+ else {
+ next_time = time + 0.234375f;
+ g_ctx.m_revolver_shot = true;
}
}
|
