hlsdk

interfaces

Sep 27th, 2011
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.46 KB | None | 0 0
  1. #include "pch.h"
  2. #include <playerinfomanager.h>
  3.  
  4. IClientEntityList *entitylist;
  5. IVModelRender *modelrender;
  6. IVEngineClient  *engine;
  7. IVEfx *effects;
  8. IVRenderView *render;
  9. IVDebugOverlay *debugoverlay;
  10. IMaterialSystemStub *materials_stub;
  11. IDataCache *datacache;
  12. IVModelInfoClient *modelinfo;
  13. IEngineVGui *enginevgui;
  14. ISpatialPartition* partition;
  15. IBaseClientDLL *clientdll;
  16. IFileSystem *filesystem;
  17. IStaticPropMgrClient *staticpropmgr;
  18. IShadowMgr *shadowmgr;
  19. IUniformRandomStream *random;
  20. CGaussianRandomStream *randomgaussian;
  21. IEngineSound *enginesound;
  22. IEngineTrace *enginetrace;
  23. IGameUIFuncs *gameuifuncs;
  24. IGameEventManager2 *gameeventmanager;
  25. IPhysicsGameTrace *physgametrace;
  26. CGlobalVarsBase *gpGlobals;
  27. IClientTools *clienttools;
  28. IInputSystem *inputsystem;
  29. ISceneFileCache *scenefilecache;
  30. IMatchmaking *matchmaking;
  31. IAvi *avi;
  32. IBik *bik;
  33. IUploadGameStats *gamestatsuploader;
  34. CSteamAPIContext *steamapicontext;
  35. CInput* m_pInput;
  36. CClientEntityList * cl_entitylist;
  37. CBaseEntityList * g_pEntityList;
  38. IPhysicsSurfaceProps* physprops;
  39. IPlayerInfoManager* playerinfomanager;
  40.  
  41. void Interfaces_Load()
  42. {
  43.     CreateInterfaceFn sf, vf, ef, cf, srvf, mf, srf, vmsf, pf;
  44.     sf = Sys_GetFactory("studiorender.dll");
  45.     vf = Sys_GetFactory("vgui2.dll");
  46.     ef = Sys_GetFactory("engine.dll");
  47.     cf = Sys_GetFactory("client.dll");
  48.     srvf = Sys_GetFactory("server.dll");
  49.     mf = Sys_GetFactory("materialsystem.dll");
  50.     srf = Sys_GetFactory("studiorender.dll");
  51.     vmsf = Sys_GetFactory("vguimatsurface.dll");
  52.     pf = Sys_GetFactory("vphysics.dll");
  53.  
  54.     CreateInterfaceFn fl[8] = { sf, vf, ef, cf, srvf, mf, srf, vmsf };
  55.     ConnectTier1Libraries(fl, 8);
  56.     ConnectTier2Libraries(fl, 8);
  57.     ConnectTier3Libraries(fl, 8);
  58.     ConVar_Register();
  59.  
  60.     vgui::VGui_InitInterfacesList("Haskell.dll", fl, 8);
  61.  
  62.     engine = (IVEngineClient*)ef(VENGINE_CLIENT_INTERFACE_VERSION, NULL);
  63.     clientdll = (IBaseClientDLL*)cf(CLIENT_DLL_INTERFACE_VERSION, NULL);
  64.     studiorender = (IStudioRender*)sf(STUDIO_RENDER_INTERFACE_VERSION, NULL);
  65.     modelrender = (IVModelRender*)ef(VENGINE_HUDMODEL_INTERFACE_VERSION, NULL);
  66.     render = (IVRenderView*)ef(VENGINE_RENDERVIEW_INTERFACE_VERSION, NULL);
  67.     debugoverlay = (IVDebugOverlay*)ef(VDEBUG_OVERLAY_INTERFACE_VERSION, NULL);
  68.     gameeventmanager = (IGameEventManager2*)ef(INTERFACEVERSION_GAMEEVENTSMANAGER2,NULL);
  69.     random = (IUniformRandomStream *)ef(VENGINE_SERVER_RANDOM_INTERFACE_VERSION, NULL);
  70.     enginevgui = (IEngineVGui*)ef(VENGINE_VGUI_VERSION, NULL);
  71.     //g_pMatSystemSurface = (IMatSystemSurface*)vf( MAT_SYSTEM_SURFACE_INTERFACE_VERSION, NULL );
  72.     playerinfomanager = (IPlayerInfoManager*)srvf(INTERFACEVERSION_PLAYERINFOMANAGER, NULL);
  73.     gpGlobals = (CGlobalVars*)playerinfomanager->GetGlobalVars();
  74.  
  75.     physprops = (IPhysicsSurfaceProps*)pf(VPHYSICS_SURFACEPROPS_INTERFACE_VERSION, NULL);
  76.     random = (IUniformRandomStream*)ef(VENGINE_CLIENT_RANDOM_INTERFACE_VERSION, NULL);
  77.  
  78.     entitylist = (IClientEntityList*)cf(VCLIENTENTITYLIST_INTERFACE_VERSION, NULL);
  79.     cl_entitylist = dynamic_cast<CClientEntityList*>(entitylist);
  80.     g_pEntityList = dynamic_cast<CBaseEntityList*>(entitylist);
  81.  
  82.     enginetrace = (IEngineTrace*)ef(INTERFACEVERSION_ENGINETRACE_CLIENT, NULL);
  83.     modelinfo = (IVModelInfoClient*)ef(VMODELINFO_CLIENT_INTERFACE_VERSION, NULL);
  84.  
  85.     CInput* tmp = NULL;
  86.     DWORD* tmp1 = (DWORD*)clientdll;
  87.  
  88.     __asm
  89.     {
  90.         pushad
  91.         mov edx, [tmp1];
  92.         mov eax, [edx];
  93.         mov ecx, [eax+0x54];
  94.         mov eax, [ecx+0x28];
  95.         mov ecx, [eax];
  96.         mov tmp, ecx;
  97.         popad
  98.     }
  99.    
  100.     m_pInput = tmp;
  101. }
  102.  
Advertisement
Add Comment
Please, Sign In to add comment