From dd9bbd12ef353f270d95ba733e1ef465d15d2b44 Mon Sep 17 00:00:00 2001 From: navewindre Date: Sun, 9 Dec 2018 17:12:07 +0100 Subject: hack works now please go fix rest --- cheat/internal_rewrite/extra.cpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'cheat/internal_rewrite/extra.cpp') diff --git a/cheat/internal_rewrite/extra.cpp b/cheat/internal_rewrite/extra.cpp index 07a8aaf..cbca0be 100644 --- a/cheat/internal_rewrite/extra.cpp +++ b/cheat/internal_rewrite/extra.cpp @@ -80,9 +80,9 @@ namespace features void c_extra::update_netchannel( ) { // fuck u bithc - auto *netchan = g_csgo.m_global_state->get_client_state()->m_netchannel; + auto *netchan = g_csgo.m_global_state->get_client_state( )->m_netchannel; - if (netchan->m_nInSequenceNr != m_last_sequence) { + if( netchan->m_nInSequenceNr != m_last_sequence ) { m_last_sequence = netchan->m_nInSequenceNr; // emplace new record @@ -91,36 +91,39 @@ namespace features netchan->m_nInReliableState, netchan->m_nInSequenceNr }; - m_net_records.emplace_back(record); + m_net_records.emplace_back( record ); } + // here's the thing. + // stl is autistic and it crashes. + // clear outdated records - for (auto &it = m_net_records.begin(); it != m_net_records.end(); ++it) { - const float delta = g_csgo.m_globals->m_realtime - it->m_realtime; + for( size_t i{ }; i < m_net_records.size( ); ++i ) { + const float delta = g_csgo.m_globals->m_curtime - m_net_records.at( i ).m_curtime; // 200ms is the max we can fake anyway.. // hnn this might be why it's so fucked :/ - if (delta > 0.4f) - m_net_records.erase(it); + if( delta > 0.4f ) + m_net_records.erase( m_net_records.begin( ) + i ); } } void c_extra::add_latency( INetChannel* channel ) { - auto nci = g_csgo.m_engine()->GetNetChannelInfo(); - float in_latency = nci->GetLatency(0); - + auto nci = g_csgo.m_engine( )->GetNetChannelInfo( ); + float in_latency = nci->GetLatency( 0 ); + // amount of latency we want to achieve - float latency = 0.15f - (in_latency + g_csgo.m_globals->m_frametime) - TICK_INTERVAL(); + float latency = 0.15f - ( in_latency + g_csgo.m_globals->m_frametime ) - TICK_INTERVAL( ); - if ( g_ctx.m_local && g_ctx.m_local->is_valid( ) ) { + if( g_ctx.m_local && g_ctx.m_local->is_valid( ) ) { // god this is autistic - for (auto &it = m_net_records.begin(); it != m_net_records.end(); ++it) { - const float delta = g_csgo.m_globals->m_realtime - it->m_realtime; + for( auto& it : m_net_records ) { + const float delta = g_csgo.m_globals->m_curtime - it.m_curtime; - if (delta >= latency) { + if( delta >= latency ) { // apply latency - channel->m_nInReliableState = it->m_reliable; - channel->m_nInSequenceNr = it->m_sequence; + channel->m_nInReliableState = it.m_reliable; + channel->m_nInSequenceNr = it.m_sequence; break; } -- cgit v1.2.3