summaryrefslogtreecommitdiff
path: root/src/cs2/cs2.h
diff options
context:
space:
mode:
authornavewindre <nw@moneybot.cc>2024-07-12 05:40:41 +0200
committernavewindre <nw@moneybot.cc>2024-07-12 05:40:41 +0200
commit28f41cf689def99fb586bfca47b7e1786227a5a2 (patch)
tree4a843c7785035ca548625ccf988ac924b8815f85 /src/cs2/cs2.h
parent2ebf959ec02048c15323e1bbfc63faedcf5067b6 (diff)
base shit
Diffstat (limited to 'src/cs2/cs2.h')
-rw-r--r--src/cs2/cs2.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/cs2/cs2.h b/src/cs2/cs2.h
new file mode 100644
index 0000000..58eba14
--- /dev/null
+++ b/src/cs2/cs2.h
@@ -0,0 +1,46 @@
+#pragma once
+
+#include "../process64.h"
+
+class CS2 : public PROCESS64 {
+public:
+ CS2() : PROCESS64( "cs2.exe" ) {};
+
+ bool open() {
+ if( !PROCESS64::open() )
+ return false;
+
+ mod.client = get_module64( "client.dll"fnv );
+ mod.engine = get_module64( "engine.dll"fnv );
+ mod.schema = get_module64( "schemasystem.dll"fnv );
+
+ // todo: handle this using loader
+ iface.client = get_iface( "Source2Client0" );
+ iface.engine = get_iface( "Source2EngineToClient0" );
+
+ return true;
+ }
+
+ IFACE_ENTRY get_iface( const char* name ) {
+ VECTOR<IFACE_ENTRY> entries = iface_get_all( this );
+ for( auto it : entries ) {
+ if( strncmp( it.name, name, strlen( name ) ) == 0 ) {
+ clog( "iface %s: [%llx]\n", it.name.data, it.ptr );
+ return it;
+ }
+ }
+
+ return {};
+ }
+
+ struct {
+ MODULE_ENTRY client;
+ MODULE_ENTRY engine;
+ MODULE_ENTRY schema;
+ } mod;
+
+ struct {
+ IFACE_ENTRY client;
+ IFACE_ENTRY engine;
+ } iface;
+}; \ No newline at end of file