#pragma once namespace vfunc { template __forceinline ReturnType call(void* instance, Args... args) { using Fn = ReturnType(__thiscall*)(void*, Args...); auto function = (*reinterpret_cast(instance))[Index]; return spoof_call(function, instance, args...); } } #define VIRTUAL_FUNC(NAME, RETURN_VALUE, INDEX, ARGS, ...) RETURN_VALUE NAME ARGS { return vfunc::call(__VA_ARGS__); }