17 lines
512 B
C++
17 lines
512 B
C++
#pragma once
|
|
|
|
namespace vfunc
|
|
{
|
|
template <size_t Index, typename ReturnType, typename... Args>
|
|
__forceinline ReturnType call(void* instance, Args... args)
|
|
{
|
|
using Fn = ReturnType(__thiscall*)(void*, Args...);
|
|
|
|
auto function = (*reinterpret_cast<Fn**>(instance))[Index];
|
|
|
|
return spoof_call(function, instance, args...);
|
|
}
|
|
}
|
|
|
|
#define VIRTUAL_FUNC(NAME, RETURN_VALUE, INDEX, ARGS, ...) RETURN_VALUE NAME ARGS { return vfunc::call<INDEX, RETURN_VALUE>(__VA_ARGS__); }
|