diff options
| author | JustSomePwner <crotchyalt@gmail.com> | 2018-08-30 14:01:54 +0200 |
|---|---|---|
| committer | JustSomePwner <crotchyalt@gmail.com> | 2018-08-30 14:01:54 +0200 |
| commit | 7ccb819f867493f8ec202ea3b39c94c198c64584 (patch) | |
| tree | 94622e61af0ff359e3d6689cf274d74f60b2492a /internal_rewrite/send_datagram.cpp | |
| parent | 564d979b79e8a5aaa5014eba0ecd36c61575934f (diff) | |
first
Diffstat (limited to 'internal_rewrite/send_datagram.cpp')
| -rw-r--r-- | internal_rewrite/send_datagram.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/internal_rewrite/send_datagram.cpp b/internal_rewrite/send_datagram.cpp new file mode 100644 index 0000000..8a7b21b --- /dev/null +++ b/internal_rewrite/send_datagram.cpp @@ -0,0 +1,33 @@ +#include "mem.hpp" +#include "base_cheat.hpp" +#include "context.hpp" +#include "hooks.hpp" + +uintptr_t cl_sendmove = 0; + +int __fastcall hooks::send_datagram( INetChannel* channel, void* edx_, void* datagram ) { + auto send_datagram_o = g_csgo.m_net_channel->get_old_function< decltype( &hooks::send_datagram ) >( 46 ); + if( g_csgo.m_panic || !g_settings.misc.net_fakelag || datagram ) { + return send_datagram_o( channel, 0, datagram ); + } + + auto cl = g_csgo.m_global_state->get_client_state( ); + if( !cl || cl->m_delta_tick <= 0 ) { + return send_datagram_o( channel, 0, datagram ); + } + + // There is no need to restore the reliable state sequence since + // we are not fucking with reliable state with 'proper' fake latency. + + int backup_sequence = channel->m_nInSequenceNr; + + g_cheat.m_extra.add_latency( channel ); + + auto nci = g_csgo.m_engine( )->GetNetChannelInfo( ); + + int ret = send_datagram_o( channel, 0, datagram ); + + channel->m_nInSequenceNr = backup_sequence; + + return ret; +}
\ No newline at end of file |
