Advertisement
Guest User

(Cleaned) Darkstorm Portal 2 DLLMAIN

a guest
Jul 22nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. DWORD WINAPI dwMainThread( LPVOID lpArguments )
  2. {
  3. if (gInts.Client == NULL) //Prevent repeat callings.
  4. {
  5. //Gottammove those factorys up.
  6. //Grab the factorys from their resptive module's EAT.
  7.  
  8. ClientFactory = ( CreateInterfaceFn ) GetProcAddress( gBaseAPI.GetModuleHandleSafe( "client.dll" ), "CreateInterface" );
  9. EngineFactory = ( CreateInterfaceFn ) GetProcAddress( gBaseAPI.GetModuleHandleSafe( "engine.dll" ), "CreateInterface" );
  10. VGUIFactory = ( CreateInterfaceFn ) GetProcAddress( gBaseAPI.GetModuleHandleSafe( "vguimatsurface.dll" ), "CreateInterface" );
  11. VGUI2Factory = ( CreateInterfaceFn ) GetProcAddress( gBaseAPI.GetModuleHandleSafe( "vgui2.dll" ), "CreateInterface" );
  12.  
  13. gInts.Client = (CHLClient*)ClientFactory("VClient016", NULL);
  14. gInts.EntList = (CEntList*)ClientFactory("VClientEntityList003", NULL);
  15. gInts.Engine = (EngineClient*)EngineFactory("VEngineClient015", NULL);
  16. gInts.ModelInfo = (CModelInfo*)EngineFactory("VModelInfoClient004", NULL);
  17. gInts.Surface = (ISurface*)VGUIFactory("VGUI_Surface031", NULL);
  18. gInts.MdlRender = (CModelRender*)EngineFactory("VEngineModel016", NULL);
  19.  
  20. XASSERT(gInts.Client);
  21. XASSERT(gInts.Engine);
  22. XASSERT(gInts.ModelInfo);
  23. XASSERT(gInts.Surface);
  24.  
  25. //Setup the ClientMode hooks.
  26.  
  27. VMTBaseManager* clientMode = new VMTBaseManager(); //Setup our VMTBaseManager for Panels.
  28. VMTBaseManager* defRenderHook = new VMTBaseManager();
  29.  
  30. gInts.ClientMode = GetClientMode();
  31.  
  32. clientMode->Init(gInts.ClientMode);
  33. clientMode->HookMethod(&Hooked_CreateMove, gOffsets.iCreateMoveOffset); //ClientMode create move is called inside of CHLClient::CreateMove, and thus no need for hooking WriteUserCmdDelta.
  34. clientMode->Rehook();
  35.  
  36. //Setup the Panel hook so we can draw.
  37. if( !gInts.Panels )
  38. {
  39. gInts.Panels = ( IPanel* ) VGUI2Factory( "VGUI_Panel009", NULL );
  40. XASSERT( gInts.Panels );
  41.  
  42. if( gInts.Panels )
  43. {
  44. VMTBaseManager* panelHook = new VMTBaseManager(); //Setup our VMTBaseManager for Panels.
  45. panelHook->Init(gInts.Panels);
  46. panelHook->HookMethod(&Hooked_PaintTraverse, gOffsets.iPaintTraverseOffset);
  47. panelHook->Rehook();
  48. }
  49. }
  50. }
  51. return 0; //The thread has been completed, and we do not need to call anything once we're done. The call to Hooked_PaintTraverse is now our main thread.
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement