Guest User

Untitled

a guest
Jan 23rd, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <dlfcn.h>
  2. #include "sourcehook.h"
  3. using namespace SourceHook;
  4. using namespace SourceHook::Impl;
  5. bool LoadSourceHook()
  6. {
  7. //You'd better damn well hope the path to metamod doesn't change
  8. void* hndl = dlopen("metamod/bin/metamod.2.ep2v.so", RTLD_LAZY);
  9. if (!hndl)
  10. {
  11. //nope, no metamod
  12. g_SHPtr = new CSourceHookImpl();
  13. return false;
  14. }
  15. void* addr = dlsym(hndl, "g_SHPtr");
  16. if (addr)
  17. {
  18. //yay
  19. g_SHPtr = (ISourceHook*)addr;
  20. return true;
  21. } else {
  22. //oh no
  23. g_SHPtr = new CSourceHookImpl();
  24. return false;
  25. }
  26. }
  27. ISourceHook *g_SHPtr
Add Comment
Please, Sign In to add comment