summaryrefslogtreecommitdiff
path: root/cheat/tf2/netvars.h
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 /cheat/tf2/netvars.h
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 'cheat/tf2/netvars.h')
-rw-r--r--cheat/tf2/netvars.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/cheat/tf2/netvars.h b/cheat/tf2/netvars.h
new file mode 100644
index 0000000..54b92be
--- /dev/null
+++ b/cheat/tf2/netvars.h
@@ -0,0 +1,44 @@
+#pragma once
+#include <vector>
+
+#include "dt_recv.h"
+#include "util.hpp"
+#include "fnv.hpp"
+
+class RecvTable;
+
+#define NETVAR( funcname, name, table, extra, type ) \
+__forceinline auto& funcname( ) { \
+ static std::ptrdiff_t offset = g_netvars.get_netvar( fnv( table ), fnv( name ) ); \
+ return get< type >( offset + extra ); \
+}
+
+#define PNETVAR( funcname, name, table, extra, type ) \
+__forceinline type* funcname( ) { \
+ static std::ptrdiff_t offset = g_netvars.get_netvar( fnv( table ), fnv( name ) ); \
+ return reinterpret_cast< type* >( uintptr_t( this ) + offset + extra ); \
+}
+
+#define OFFSET( funcname, offset, type ) \
+__forceinline auto& funcname( ) { \
+ return get< type >( offset ); \
+}
+
+NAMESPACE_REGION( tf2 )
+
+class c_netvars {
+public:
+ void init( );
+ //search through the netvar list
+ std::ptrdiff_t get_netvar( hash_t table, hash_t hash ) const;
+ RecvProp* get_prop( hash_t table, hash_t name ) const;
+public:
+ std::ptrdiff_t get_entry( hash_t hash, RecvTable* table ) const;
+ RecvTable* get_table( hash_t hash ) const;
+private:
+ std::vector< RecvTable* > m_tables;
+};
+
+END_REGION
+
+extern tf2::c_netvars g_netvars; \ No newline at end of file