统一native_sdk
This commit is contained in:
14
csgo2/vmt.cpp
Normal file
14
csgo2/vmt.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "vmt.h"
|
||||
namespace vmt {
|
||||
template <typename T = void*>
|
||||
inline T GetVMethod(uint32_t uIndex, void* pClass) {
|
||||
void** pVTable = *static_cast<void***>(pClass);
|
||||
return reinterpret_cast<T>(pVTable[uIndex]);
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
inline T CallVirtual(uint32_t uIndex, void* pClass, Args... args) {
|
||||
auto pFunc = GetVMethod<T(__thiscall*)(void*, Args...)>(uIndex, pClass);
|
||||
return pFunc(pClass, args...);
|
||||
}
|
||||
} // namespace vmt
|
||||
Reference in New Issue
Block a user