summaryrefslogtreecommitdiff
path: root/gmod/netvars.cpp
diff options
context:
space:
mode:
authorboris <wzn@moneybot.cc>2018-11-28 16:00:02 +1300
committerboris <wzn@moneybot.cc>2018-11-28 16:00:02 +1300
commit3d412a4b30a9f7c7f51ea6562e694315948bd3da (patch)
tree26d67dfd1f3e5fd12903ad13e85d0cb8bcf8f21c /gmod/netvars.cpp
parente4729e4393d90271a3814c7a79950a660c48325a (diff)
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
Diffstat (limited to 'gmod/netvars.cpp')
-rw-r--r--gmod/netvars.cpp93
1 files changed, 0 insertions, 93 deletions
diff --git a/gmod/netvars.cpp b/gmod/netvars.cpp
deleted file mode 100644
index 19ab6d1..0000000
--- a/gmod/netvars.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-#include "netvars.hpp"
-#include "interface.hpp"
-
-factory::c_netvars g_netvars;
-
-NAMESPACE_REGION( factory )
-
-void c_netvars::init( ) {
- for ( auto client_class = g_gmod.m_chl( )->GetAllClasses( );
- !!client_class;
- client_class = client_class->m_next
- ) {
- auto table = client_class->m_rt_table;
- m_tables.push_back( table );
- }
-}
-
-RecvTable* c_netvars::get_table( hash_t hash ) const {
- if ( m_tables.empty( ) ) return nullptr;
-
- for ( auto& table : m_tables ) {
- if ( !table ) continue;
-
- if ( hash == hash::fnv1a( table->m_pNetTableName ) ) {
- return table;
- }
- }
-
- return nullptr;
-}
-
-//iterating this too much results in a stack overflow, so thats cool
-RecvProp* c_netvars::get_prop( hash_t data, hash_t name ) const {
- RecvProp* prop{ };
- RecvTable* child{ };
-
- auto table = get_table( data );
- if( !table ) return nullptr;
-
- for( int i{ }; i < table->m_nProps; ++i ) {
- prop = &table->m_pProps[ i ];
- child = prop->GetDataTable( );
-
- if( child && child->m_nProps ) {
- auto tmp = get_prop( hash::fnv1a( child->m_pNetTableName ), name );
- if( tmp ) return tmp;
- }
-
- if( name != hash::fnv1a( prop->m_pVarName ) )
- continue;
-
- return prop;
- }
-
- return nullptr;
-}
-
-std::ptrdiff_t c_netvars::get_entry( hash_t name, RecvTable* table ) const {
- std::ptrdiff_t ret{ };
- RecvProp* prop;
- RecvTable* child;
-
- for ( int i{ }; i < table->m_nProps; ++i ) {
- prop = &table->m_pProps[ i ];
- child = prop->GetDataTable( );
-
- if ( child && child->m_nProps ) {
- auto tmp = get_entry( name, child );
- if ( tmp ) ret += prop->GetOffset( ) + tmp;
- }
-
- if ( name != hash::fnv1a( prop->m_pVarName ) )
- continue;
-
- return prop->GetOffset( ) + ret;
- }
-
- return ret;
-}
-
-std::ptrdiff_t c_netvars::get_netvar( hash_t data, hash_t name ) const {
- std::ptrdiff_t ret{ };
- auto table = get_table( data );
- if ( !table ) return 0;
-
- ret = get_entry( name, table );
-#ifdef DEBUG
- printf( "%s:\t\t 0x%05x\n", name.c_str( ), ret );
-#endif
- return ret;
-}
-
-END_REGION \ No newline at end of file