-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinterfaces.c
35 lines (27 loc) · 1.17 KB
/
interfaces.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <dlfcn.h>
#include "sdk.h"
#include "interfaces.h"
Interfaces interfaces;
static void *find(const char *moduleName, const char *name)
{
void *(*createInterface)(const char *name, int *returnCode);
*(void **)&createInterface = dlsym(dlopen(moduleName, RTLD_NOLOAD | RTLD_LAZY), "CreateInterface");
if (!createInterface)
return 0;
void *interface = createInterface(name, 0);
return interface;
}
void interfaces_init(void)
{
interfaces.client = find(CLIENT_SO, "VClient018");
interfaces.cvar = find(VSTDLIB_SO, "VEngineCvar007");
interfaces.engine = find(ENGINE_SO, "VEngineClient014");
interfaces.engineTrace = find(ENGINE_SO, "EngineTraceClient004");
interfaces.entityList = find(CLIENT_SO, "VClientEntityList003");
interfaces.inputSystem = find(INPUTSYSTEM_SO, "InputSystemVersion001");
interfaces.materialSystem = find(MATERIALSYSTEM_SO, "VMaterialSystem080");
interfaces.modelRender = find(ENGINE_SO, "VEngineModel016");
interfaces.gameMovement = find(CLIENT_SO, "GameMovement001");
interfaces.prediction = find(CLIENT_SO, "VClientPrediction001");
interfaces.studioRender = find(STUDIORENDER_SO, "VStudioRender026");
}