Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <dlfcn.h>
- #include "sourcehook.h"
- using namespace SourceHook;
- using namespace SourceHook::Impl;
- bool LoadSourceHook()
- {
- //You'd better damn well hope the path to metamod doesn't change
- void* hndl = dlopen("metamod/bin/metamod.2.ep2v.so", RTLD_LAZY);
- if (!hndl)
- {
- //nope, no metamod
- g_SHPtr = new CSourceHookImpl();
- return false;
- }
- void* addr = dlsym(hndl, "g_SHPtr");
- if (addr)
- {
- //yay
- g_SHPtr = (ISourceHook*)addr;
- return true;
- } else {
- //oh no
- g_SHPtr = new CSourceHookImpl();
- return false;
- }
- }
- ISourceHook *g_SHPtr
Add Comment
Please, Sign In to add comment