summaryrefslogtreecommitdiff
path: root/cheat/internal_rewrite/extra.cpp
diff options
context:
space:
mode:
authornavewindre <boneyaard@gmail.com>2018-12-09 17:12:07 +0100
committernavewindre <boneyaard@gmail.com>2018-12-09 17:12:07 +0100
commitdd9bbd12ef353f270d95ba733e1ef465d15d2b44 (patch)
treebfbb407601eff0bb8547f713688e665944a6e03b /cheat/internal_rewrite/extra.cpp
parent430f93006fb8ac7c37c8cfc984d3d02b9f7dc693 (diff)
hack works now please go fix rest
Diffstat (limited to 'cheat/internal_rewrite/extra.cpp')
-rw-r--r--cheat/internal_rewrite/extra.cpp37
1 files changed, 20 insertions, 17 deletions
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;
}