This repository has been archived on 2026-11-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
my-first-apex-internal/inc/shd/vfunc.h
T
2026-11-05 02:19:09 +01:00

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__); }