mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-18 15:23:26 +00:00
fix
This commit is contained in:
@@ -119,16 +119,28 @@ namespace omath::rev_eng
|
||||
template<std::size_t TableIndex, std::size_t Id, class ReturnType>
|
||||
ReturnType call_virtual_method(auto... arg_list)
|
||||
{
|
||||
const auto vtable = *reinterpret_cast<void***>(
|
||||
void* sub_this = reinterpret_cast<void*>(
|
||||
reinterpret_cast<std::uintptr_t>(this) + TableIndex * sizeof(std::uintptr_t));
|
||||
return call_method<ReturnType>(vtable[Id], arg_list...);
|
||||
const auto vtable = *reinterpret_cast<void***>(sub_this);
|
||||
#ifdef _MSC_VER
|
||||
using Fn = ReturnType(__thiscall*)(void*, decltype(arg_list)...);
|
||||
#else
|
||||
using Fn = ReturnType(*)(void*, decltype(arg_list)...);
|
||||
#endif
|
||||
return reinterpret_cast<Fn>(vtable[Id])(sub_this, arg_list...);
|
||||
}
|
||||
template<std::size_t TableIndex, std::size_t Id, class ReturnType>
|
||||
ReturnType call_virtual_method(auto... arg_list) const
|
||||
{
|
||||
const auto vtable = *reinterpret_cast<void* const* const*>(
|
||||
const void* sub_this = reinterpret_cast<const void*>(
|
||||
reinterpret_cast<std::uintptr_t>(this) + TableIndex * sizeof(std::uintptr_t));
|
||||
return call_method<ReturnType>(vtable[Id], arg_list...);
|
||||
const auto vtable = *reinterpret_cast<void* const* const*>(sub_this);
|
||||
#ifdef _MSC_VER
|
||||
using Fn = ReturnType(__thiscall*)(const void*, decltype(arg_list)...);
|
||||
#else
|
||||
using Fn = ReturnType(*)(const void*, decltype(arg_list)...);
|
||||
#endif
|
||||
return reinterpret_cast<Fn>(vtable[Id])(sub_this, arg_list...);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user