This repository has been archived on 2024-06-01. You can view files and clone it, but cannot push or open issues or pull requests.
cathook/include/vfunc.hpp
2017-11-13 09:41:53 +03:00

18 lines
347 B
C++

/*
* vfunc.h
*
* Created on: Jan 8, 2017
* Author: nullifiedcat
*/
#ifndef VFUNC_HPP_
#define VFUNC_HPP_
template<typename F>
inline F vfunc(void* thisptr, uintptr_t idx, uintptr_t offset = 0) {
void** vmt = *reinterpret_cast<void***>(uintptr_t(thisptr) + offset);
return reinterpret_cast<F>((vmt)[idx]);
}
#endif /* VFUNC_HPP_ */