Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.63 KB | None | 0 0
  1. #include "Interfaces.h"
  2. #include "Utils.h"
  3.  
  4. #include "..\SDK\IClientMode.h"
  5. #include "..\SDK\IBaseClientDll.h"
  6. #include "..\SDK\IClientEntityList.h"
  7. #include "..\SDK\IVEngineClient.h"
  8. #include "..\SDK\CPrediction.h"
  9. #include "..\SDK\IGameEvent.h"
  10. #include "..\SDK\ISurface.h"
  11. #include "..\SDK\IEngineTrace.h"
  12. #include "..\SDK\ISurfaceData.h"
  13. #include "..\SDK\ICvar.h"
  14. #include "..\SDK\IVModelInfo.h"
  15. #include "..\SDK\CModelRender.h"
  16. #include "..\SDK\IMaterial.h"
  17. #include "..\SDK\IVRenderView.h"
  18. #include "..\SDK\CGlowObjectManager.h"
  19. #include "..\SDK\IVRenderBeams.h"
  20. #include <fstream>
  21.  
  22. #define enc_str(s) std::string(s)
  23. #define enc_char(s) enc_str(s).c_str()
  24. #define enc_wstr(s) std::wstring(enc_str(s).begin(), enc_str(s).end())
  25. #define enc_wchar(s) enc_wstr(s).c_str()
  26.  
  27. IBaseClientDLL* g_pClientDll = nullptr;
  28. IClientMode* g_pClientMode = nullptr;
  29. IClientEntityList* g_pEntityList = nullptr;
  30. IVEngineClient* g_pEngine = nullptr;
  31. CPrediction* g_pPrediction = nullptr;
  32. IGameMovement* g_pMovement = nullptr;
  33. IMoveHelper* g_pMoveHelper = nullptr;
  34. CGlobalVarsBase* g_pGlobalVars = nullptr;
  35. IGameEventManager* g_pEventManager = nullptr;
  36. trace* g_pTraceV2 = nullptr;
  37. ISurface* g_pSurface = nullptr;
  38. IEngineTrace* g_pTrace = nullptr;
  39. IPhysicsSurfaceProps* g_pSurfaceData = nullptr;
  40. ICVar* g_pCvar = nullptr;
  41. IPanel* g_pPanel = nullptr;
  42. IVModelInfo* g_pModelInfo = nullptr;
  43. IInputSystem* g_InputSystem = nullptr;
  44. CModelRender* g_pModelRender = nullptr;
  45. IMaterialSystem* g_pMaterialSys = nullptr;
  46. IVRenderView* g_pRenderView = nullptr;
  47. CInput* g_GameInput = nullptr;
  48. IViewRenderBeams* g_pRenderBeams = nullptr;
  49. CGlowObjectManager* g_GlowManager = nullptr;
  50. CClientState* g_pClientState = nullptr;
  51. namespace interfaces
  52. {
  53. template< class T >
  54. T* FindClass(std::string szModuleName, std::string szInterfaceName, bool bSkip = false)
  55. {
  56. if (szModuleName.empty() || szInterfaceName.empty())
  57. return nullptr;
  58. typedef PVOID(*CreateInterfaceFn)(const char* pszName, int* piReturnCode);
  59. CreateInterfaceFn hInterface = nullptr;
  60. while (!hInterface)
  61. {
  62. hInterface = (CreateInterfaceFn)GetProcAddress(GetModuleHandleA(szModuleName.c_str()), "CreateInterface");
  63. Sleep(5);
  64. }
  65.  
  66. char pszBuffer[256];
  67. for (int i = 0; i < 100; i++)
  68. {
  69. sprintf_s(pszBuffer, "%s%0.3d", szInterfaceName.c_str(), i);
  70. PVOID pInterface = hInterface(pszBuffer, nullptr);
  71.  
  72. if (pInterface && pInterface != NULL)
  73. {
  74. if (bSkip)
  75. sprintf_s(pszBuffer, "%s%0.3d", szInterfaceName.c_str(), i + 1);
  76.  
  77. Sleep(5);
  78. break;
  79. }
  80. }
  81.  
  82. return (T*)hInterface(pszBuffer, nullptr);
  83. }
  84. void* FindInterface(const char* Module, const char* InterfaceName)
  85. {
  86. void* Interface = nullptr;
  87. auto CreateInterface = reinterpret_cast<CreateInterfaceFn>(GetProcAddress(
  88. GetModuleHandleA(Module), enc_char("CreateInterface")));
  89.  
  90. char PossibleInterfaceName[1024];
  91. for (int i = 1; i < 100; i++)
  92. {
  93. sprintf(PossibleInterfaceName, "%s0%i", InterfaceName, i);
  94. Interface = CreateInterface(PossibleInterfaceName, 0);
  95. if (Interface)
  96. break;
  97.  
  98. sprintf(PossibleInterfaceName, "%s00%i", InterfaceName, i);
  99. Interface = CreateInterface(PossibleInterfaceName, 0);
  100. if (Interface)
  101. break;
  102. }
  103.  
  104. // ДОДЕЛАТЬ !!!!!!!!!!!!!!!!!!!!
  105.  
  106. return Interface;
  107. }
  108.  
  109. void* FindInterfaceEx(const char* Module, const char* InterfaceName)
  110. {
  111. void* Interface = nullptr;
  112. auto CreateInterface = reinterpret_cast<CreateInterfaceFn>(GetProcAddress(
  113. GetModuleHandleA(Module), "CreateInterface"));
  114.  
  115. Interface = CreateInterface(InterfaceName, 0);
  116.  
  117.  
  118. return Interface;
  119. }
  120.  
  121. void Init()
  122. {
  123. g_pClientDll = reinterpret_cast<IBaseClientDLL*>(FindInterface("client_panorama.dll", "VClient"));
  124. g_pClientMode = **reinterpret_cast<IClientMode***> ((*reinterpret_cast<uintptr_t**>(g_pClientDll))[10] + 0x5u);
  125. g_pGlobalVars = **reinterpret_cast<CGlobalVarsBase***>((*reinterpret_cast<uintptr_t**>(g_pClientDll))[0] + 0x1Bu);
  126. g_pEntityList = reinterpret_cast<IClientEntityList*>(FindInterface("client_panorama.dll", "VClientEntityList"));
  127. g_pEngine = reinterpret_cast<IVEngineClient*>(FindInterface("engine.dll", "VEngineClient"));
  128. g_pPrediction = reinterpret_cast<CPrediction*>(FindInterface("client_panorama.dll", "VClientPrediction"));
  129. g_pMovement = reinterpret_cast<IGameMovement*>(FindInterface("client_panorama.dll", "GameMovement"));
  130. g_pMoveHelper = **reinterpret_cast<IMoveHelper***>((Utils::FindSignature("client_panorama.dll", "8B 0D ? ? ? ? 8B 46 08 68") + 0x2));
  131. g_pEventManager = reinterpret_cast<IGameEventManager*>(FindInterfaceEx("engine.dll", "GAMEEVENTSMANAGER002"));
  132. g_pSurface = reinterpret_cast<ISurface*>(FindInterface("vguimatsurface.dll", "VGUI_Surface"));
  133. g_pTrace = reinterpret_cast<IEngineTrace*>(FindInterface("engine.dll", "EngineTraceClient"));
  134. g_pTraceV2 = reinterpret_cast<trace*>(FindInterface("engine.dll", "EngineTraceClient"));
  135. g_pSurfaceData = reinterpret_cast<IPhysicsSurfaceProps*>(FindInterface("vphysics.dll", "VPhysicsSurfaceProps"));
  136. g_pCvar = reinterpret_cast<ICVar*>(FindInterface("vstdlib.dll", "VEngineCvar"));
  137. g_pPanel = reinterpret_cast<IPanel*>(FindInterface("vgui2.dll", "VGUI_Panel"));
  138. g_pModelInfo = reinterpret_cast<IVModelInfo*>(FindInterface("engine.dll", "VModelInfoClient"));
  139. g_InputSystem = reinterpret_cast<IInputSystem*>(FindInterface("inputsystem.dll", "InputSystemVersion"));
  140. g_pModelRender = FindClass<CModelRender>("engine.dll", "VEngineModel");
  141. g_pMaterialSys = FindClass<IMaterialSystem>("materialsystem.dll", "VMaterialSystem");
  142. g_pRenderView = FindClass<IVRenderView>("engine.dll", "VEngineRenderView");
  143. g_pRenderBeams = *reinterpret_cast<IViewRenderBeams**>(Utils::FindSignature("client_panorama.dll", "A1 ? ? ? ? 56 8B F1 B9 ? ? ? ? FF 50 08") + 0x1);
  144. g_GlowManager = *reinterpret_cast<CGlowObjectManager**>(Utils::FindSignature("client_panorama.dll", "0F 11 05 ? ? ? ? 83 C8 01 C7 05 ? ? ? ? 00 00 00 00") + 3);
  145. g_pClientState = util::get_method(g_pEngine, 12).add(16).get(2).as< CClientState* >();
  146.  
  147. auto pdwClient = *(PDWORD_PTR*)g_pClientDll;
  148. g_GameInput = *(CInput**)(Utils::FindSignature("client_panorama.dll", "B9 ? ? ? ? F3 0F 11 04 24 FF 50 10") + 1);
  149. //thanks monarch (from yeti)
  150.  
  151. std::ofstream("csgo\\materials\\nonflat.vmt") << R"#("VertexLitGeneric"
  152. {
  153. "$basetexture" "vgui/white_additive"
  154. "$ignorez" "0"
  155. "$envmap" ""
  156. "$nofog" "1"
  157. "$model" "1"
  158. "$nocull" "0"
  159. "$selfillum" "1"
  160. "$halflambert" "1"
  161. "$znearer" "0"
  162. "$flat" "1"
  163. "$reflectivity" "[1 1 1]"
  164. } )#";
  165.  
  166. std::ofstream("csgo\\materials\\metallic.vmt") << R"#("VertexLitGeneric" {
  167. "$basetexture" "vgui/white_additive"
  168. "$ignorez" "0"
  169. "$envmap" "env_cubemap"
  170. "$normalmapalphaenvmapmask" "1"
  171. "$envmapcontrast" "1"
  172. "$nofog" "1"
  173. "$model" "1"
  174. "$nocull" "0"
  175. "$selfillum" "1"
  176. "$halflambert" "1"
  177. "$znearer" "0"
  178. "$flat" "1"
  179. }
  180. )#";
  181.  
  182. std::ofstream("csgo\\materials\\flat.vmt") << R"#("UnlitGeneric"
  183. {
  184. "$basetexture" "vgui/white_additive"
  185. "$no_fullbright" "0"
  186. "$ignorez" "1"
  187. "$envmap" "env_cubemap"
  188. "$nofog" "1"
  189. "$model" "1"
  190. "$nocull" "0"
  191. "$selfillum" "1"
  192. "$halflambert" "1"
  193. "$znearer" "0"
  194. "$flat" "0"
  195. } )#";
  196. }
  197.  
  198. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement