Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
FileEX committed Oct 4, 2024
1 parent 5feedfa commit 7418758
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions Client/game_sa/gamesa_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,32 +134,15 @@ template <typename ReturnType, typename CallingConvention, typename Func, typena
ReturnType CallGTAFunction(Func function, GTAFuncSignature<Args...>& sig)
{
if constexpr (std::is_same_v<CallingConvention, __THISCALL>)
{
return apply_helper<ReturnType>(reinterpret_cast<ReturnType(__thiscall*)(Args...)>(function), sig.args, std::index_sequence_for<Args...>{});
}
else if constexpr (std::is_same_v<CallingConvention, __CDECL>)
{
return apply_helper<ReturnType>(reinterpret_cast<ReturnType(__cdecl*)(Args...)>(function), sig.args, std::index_sequence_for<Args...>{});
}
else if constexpr (std::is_same_v<CallingConvention, __STDCALL>)
{
return apply_helper<ReturnType>(reinterpret_cast<ReturnType(__stdcall*)(Args...)>(function), sig.args, std::index_sequence_for<Args...>{});
}
else if constexpr (std::is_same_v<CallingConvention, __FASTCALL>)
{
return apply_helper<ReturnType>(reinterpret_cast<ReturnType(__fastcall*)(Args...)>(function), sig.args, std::index_sequence_for<Args...>{});
}
else if constexpr (std::is_same_v<CallingConvention, __VECTORCALL>)
{
return apply_helper<ReturnType>(reinterpret_cast<ReturnType(__vectorcall*)(Args...)>(function), sig.args, std::index_sequence_for<Args...>{});
}

static_assert(
std::is_same_v<CallingConvention, __THISCALL> ||
std::is_same_v<CallingConvention, __CDECL> ||
std::is_same_v<CallingConvention, __STDCALL> ||
std::is_same_v<CallingConvention, __FASTCALL> ||
std::is_same_v<CallingConvention, __VECTORCALL>,
"Invalid calling onvention specified in CallGTAFunction"
);
else
static_assert(sizeof(char) == 0, "Invalid calling convention specified in CallGTAFunction");
}

0 comments on commit 7418758

Please sign in to comment.