template<typename T = void>
static T* GetInterface(const char* dllName, const char* interfaceName) {
auto CreateInterface = GetExport(dllName, "CreateInterface");
return (T*)CreateInterface(interfaceName, nullptr);
}
static auto networksystemMgr = GetInterface <VClass>("networksystem.dll", "CNetChan");
networksystemMgr ->GetVFunc< 69 >()
===================
HERE IS MY VCLASS
===================
public:
virtual void dummy_fn() = 0; // so that classes have a vtable
template<typename T>
T&Field(int offset) const {
if (!IsValidReadPtr((uintptr_t)this + offset))
throw "VClass::Field access violation";
return [I](T[/I])((uintptr_t)this + offset);
}
template<typename T>
T Member(int offset/[I], T defaultValue = T{}[/I]/) const {
if (!IsValidReadPtr((uintptr_t)this + offset))
return T{};
return [I](T[/I])((uintptr_t)this + offset);
}
// Gets a pointer to a type via the offset but does not dereference it
template<typename T>
T* MemberInline(int offset) const {
return (T*)((uintptr_t)this + offset);
}
Function GetVFunc(int index) const
{
return Function(([I](uintptr_t*[/I])this)[index]);
}
template<uint32_t index, typename RET = void*, typename ...T>
RET CallVFunc(T... t) {
return GetVFunc(index).Call<RET>(this, t...);
}
};