-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterfaces.cpp
More file actions
64 lines (56 loc) · 2.87 KB
/
interfaces.cpp
File metadata and controls
64 lines (56 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "interfaces.h"
#include <iostream>
#include "SDK/Globals.h"
void I::Init() {
I::baseclient = I::Capture<IBaseClientDLL>("client.dll", "VClient016");
std::cout << "baseclient: " << I::baseclient << std::endl;
I::clientmode = **reinterpret_cast<void***>((*reinterpret_cast<unsigned int**>(baseclient))[10] + 5);
std::cout << "clientmode: " << I::clientmode << std::endl;
I::engine = I::Capture<IVEngineClient>("engine.dll", "VEngineClient013");
std::cout << "engine: " << I::engine << std::endl;
I::entitylist = I::Capture<IClientEntityList>("client.dll", "VClientEntityList003");
std::cout << "entitylist: " << I::entitylist << std::endl;
I::panel = I::Capture<IVPanel>("vgui2.dll", "VGUI_Panel009");
std::cout << "panel: " << I::panel << std::endl;
I::surface = I::Capture<ISurface>("vguimatsurface.dll", "VGUI_Surface031");
std::cout << "surface: " << I::surface << std::endl;
I::enginevgui = I::Capture<IEngineVGui>("engine.dll", "VEngineVGui001");
std::cout << "enginevgui: " << I::enginevgui << std::endl;
I::debugoverlay = I::Capture<IVDebugOverlay>("engine.dll", "VDebugOverlay004");
std::cout << "debugoverlay: " << I::debugoverlay << std::endl;
I::globals = **reinterpret_cast<IGlobalVars***>((*reinterpret_cast<uintptr_t**>(baseclient))[11] + 10);
std::cout << "globals: " << I::globals << std::endl;
I::engineTrace = I::Capture<IEngineTrace>("engine.dll", "EngineTraceClient004");
std::cout << "engineTrace: " << I::engineTrace << std::endl;
I::prediction = I::Capture<IPrediction>("client.dll", "VClientPrediction001");
std::cout << "prediction: " << I::prediction << std::endl;
I::input = *(CInput**)((*(DWORD**)baseclient)[15] + 0x1);
std::cout << "input: " << I::input << std::endl;
I::modelinfo = I::Capture<IVModelInfoClient>("engine.dll", "VModelInfoClient004");
std::cout << "modelinfo: " << I::modelinfo << std::endl;
}
void* I::Capture(const char* moduleName, const char* interfaceName) noexcept
{
const HINSTANCE handle = GetModuleHandle(moduleName);
if (!handle)
return nullptr;
// get the exported Createinterface function
using CreateInterfaceFn = void* (__cdecl*)(const char*, int*);
const CreateInterfaceFn createInterface =
reinterpret_cast<CreateInterfaceFn>(GetProcAddress(handle, "CreateInterface"));
// return the interface pointer by calling the function
return createInterface(interfaceName, nullptr);
}
template <typename Interface>
Interface* I::Capture(const char* moduleName, const char* interfaceName) noexcept
{
const HINSTANCE handle = GetModuleHandle(moduleName);
if (!handle)
return nullptr;
// get the exported Createinterface function
using CreateInterfaceFn = Interface * (__cdecl*)(const char*, int*);
const CreateInterfaceFn createInterface =
reinterpret_cast<CreateInterfaceFn>(GetProcAddress(handle, "CreateInterface"));
// return the interface pointer by calling the function
return createInterface(interfaceName, nullptr);
}