mirror of
https://github.com/rehlds/reapi.git
synced 2025-03-14 06:20:32 +03:00
Fixed names collision with fakemeta
Fixed hookctx for recursive hookchain calls
This commit is contained in:
parent
7350d696e8
commit
6fb4fc6779
@ -113,7 +113,7 @@ native SetHookChainArg(number, AType:type, any:...);
|
||||
* @return 1/0
|
||||
*
|
||||
*/
|
||||
native is_rehlds();
|
||||
native bool:is_rehlds();
|
||||
|
||||
/*
|
||||
* Check if the regamedll is available
|
||||
@ -121,7 +121,7 @@ native is_rehlds();
|
||||
* @return 1/0
|
||||
*
|
||||
*/
|
||||
native is_regamedll();
|
||||
native bool:is_regamedll();
|
||||
|
||||
/*
|
||||
* Check if the reunion is available
|
||||
@ -129,7 +129,7 @@ native is_regamedll();
|
||||
* @return 1/0
|
||||
*
|
||||
*/
|
||||
native is_has_reunion();
|
||||
native bool:has_reunion();
|
||||
|
||||
/*
|
||||
* Check if the vtc is available
|
||||
@ -137,7 +137,7 @@ native is_has_reunion();
|
||||
* @return 1/0
|
||||
*
|
||||
*/
|
||||
native is_has_vtc();
|
||||
native bool:has_vtc();
|
||||
|
||||
/*
|
||||
* This is the callback from the module that gives major/minor versions for verifying compatibility reapi API versions
|
||||
|
@ -20,15 +20,15 @@ native any:get_entvar(const index, const EntVars:var, any:...);
|
||||
|
||||
/*
|
||||
* Sets usercmd data.
|
||||
* Use the var_* EntVars enum
|
||||
* Use the ucmd_* UCmd enum
|
||||
*/
|
||||
native set_ucmd(const ucmd, const UserCmd:var, any:...);
|
||||
native set_ucmd(const ucmd, const UCmd:var, any:...);
|
||||
|
||||
/*
|
||||
* Returns entvar data from an entity.
|
||||
* Use the var_* EntVars enum
|
||||
* Use the ucmd_* UCmd enum
|
||||
*/
|
||||
native any:get_ucmd(const ucmd, const UserCmd:var, any:...);
|
||||
native any:get_ucmd(const ucmd, const UCmd:var, any:...);
|
||||
|
||||
/*
|
||||
* Set name of the map
|
||||
|
@ -1024,7 +1024,7 @@ enum EntVars
|
||||
var_euser4
|
||||
};
|
||||
|
||||
enum UserCmd
|
||||
enum UCmd
|
||||
{
|
||||
/*
|
||||
* Description: -
|
||||
|
@ -50,23 +50,41 @@ inline AType getApiType(T *) { return ATYPE_INTEGER; }
|
||||
|
||||
#define MAX_ARGS 12u
|
||||
|
||||
template<size_t current = 0, typename T1, typename T2, typename T3, typename T4, typename ...t_args>
|
||||
void setupArgTypes(AType args_type[MAX_ARGS], T1, T2, T3, T4, t_args... args)
|
||||
{
|
||||
*(uint32 *)&args_type[current] = getApiType(T1()) | (getApiType(T2()) << 8) | (getApiType(T3()) << 16) | (getApiType(T4()) << 24);
|
||||
if (sizeof...(args) && current + 1 < MAX_ARGS)
|
||||
setupArgTypes<current + 4>(args_type, args...);
|
||||
}
|
||||
|
||||
template<size_t current = 0, typename T1, typename T2, typename T3>
|
||||
void setupArgTypes(AType args_type[MAX_ARGS], T1, T2, T3)
|
||||
{
|
||||
*(uint32 *)&args_type[current] = getApiType(T1()) | (getApiType(T2()) << 8) | (getApiType(T3()) << 16);
|
||||
}
|
||||
|
||||
template<size_t current = 0, typename T1, typename T2>
|
||||
void setupArgTypes(AType args_type[MAX_ARGS], T1, T2)
|
||||
{
|
||||
*(uint16 *)&args_type[current] = getApiType(T1()) | (getApiType(T2()) << 8);
|
||||
}
|
||||
|
||||
template<size_t current = 0, typename T>
|
||||
void setupArgTypes(AType args_type[MAX_ARGS], T)
|
||||
{
|
||||
args_type[current] = getApiType(T());
|
||||
}
|
||||
|
||||
template<size_t current = 0>
|
||||
void setupArgTypes(AType args_type[MAX_ARGS])
|
||||
{
|
||||
}
|
||||
|
||||
template<size_t current = 0, typename T, typename ...t_args>
|
||||
void setupArgTypes(AType args_type[MAX_ARGS], T, t_args... args)
|
||||
{
|
||||
args_type[current] = getApiType(T());
|
||||
if (sizeof...(args) && current + 1 < MAX_ARGS)
|
||||
setupArgTypes<current + 1>(args_type, args...);
|
||||
}
|
||||
|
||||
struct hookctx_t
|
||||
{
|
||||
template<typename ...t_args>
|
||||
hookctx_t(size_t arg_count, t_args... args) : args_ptr()
|
||||
hookctx_t(size_t arg_count, t_args... args)
|
||||
{
|
||||
args_count = min(arg_count, MAX_ARGS);
|
||||
setupArgTypes(args_type, args...);
|
||||
@ -128,9 +146,6 @@ NOINLINE void DLLEXPORT _callVoidForward(const hook_t* hook, original_t original
|
||||
template <typename original_t, typename ...f_args>
|
||||
void callVoidForward(size_t func, original_t original, f_args... args)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
static
|
||||
#endif
|
||||
hookctx_t hookCtx(sizeof...(args), args...);
|
||||
|
||||
g_hookCtx = &hookCtx;
|
||||
@ -193,9 +208,6 @@ NOINLINE R DLLEXPORT _callForward(const hook_t* hook, original_t original, volat
|
||||
template <typename R, typename original_t, typename ...f_args>
|
||||
R callForward(size_t func, original_t original, f_args... args)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
static
|
||||
#endif
|
||||
hookctx_t hookCtx(sizeof...(args), args...);
|
||||
|
||||
g_hookCtx = &hookCtx;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#define CLASS_MEMBERS(cx, mx, pref) ((!(pref##mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (pref##mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember([](member_t* ptr){ decltype(##cx::##mx) f = {};ptr->size = getTypeSize(f);ptr->max_size = sizeof(f);ptr->offset = offsetof(##cx, ##mx);ptr->type = getMemberType(f);}) : regmember(#mx)
|
||||
|
||||
#define GM_MEMBERS(mx) CLASS_MEMBERS(CHalfLifeMultiplay, mx,)
|
||||
#define GM_VOICE_MEMBERS(mx) CLASS_MEMBERS(CVoiceGameMgr, mx,)
|
||||
#define GM_VOICE_MEMBERS(mx) CLASS_MEMBERS(CVoiceGameMgr, mx,)
|
||||
#define BASE_MEMBERS(mx) CLASS_MEMBERS(CBaseEntity, mx,)
|
||||
#define ANIM_MEMBERS(mx) CLASS_MEMBERS(CBaseAnimating, mx,)
|
||||
#define MONST_MEMBERS(mx) CLASS_MEMBERS(CBaseMonster, mx,)
|
||||
|
@ -5,7 +5,7 @@
|
||||
// member types
|
||||
enum MType
|
||||
{
|
||||
MEMBER_FLOAT = 0, // Any floating popm_value
|
||||
MEMBER_FLOAT = 0, // Any floating point value
|
||||
MEMBER_DOUBLE, // double value
|
||||
MEMBER_ENTITY, // An entity offset (EOFFSET)
|
||||
MEMBER_CLASSPTR, // CBaseEntity *
|
||||
@ -13,7 +13,7 @@ enum MType
|
||||
MEMBER_EVARS, // EVARS *
|
||||
MEMBER_EDICT, // edict_t *, or edict_t * (same thing)
|
||||
MEMBER_VECTOR, // Any vector
|
||||
MEMBER_STRING, // pm_*, pm_[]
|
||||
MEMBER_STRING, // char *, char []
|
||||
MEMBER_QSTRING, // quake string, like string_t
|
||||
MEMBER_RSTRING, // reverse of qstring to string
|
||||
MEMBER_INTEGER, // Any integer or enum
|
||||
|
@ -1330,7 +1330,7 @@ cell AMX_NATIVE_CALL is_regamedll(AMX *amx, cell *params)
|
||||
*
|
||||
* native is_has_reunion();
|
||||
*/
|
||||
cell AMX_NATIVE_CALL is_has_reunion(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL has_reunion(AMX *amx, cell *params)
|
||||
{
|
||||
return (cell)api_cfg.hasReunion();
|
||||
}
|
||||
@ -1342,7 +1342,7 @@ cell AMX_NATIVE_CALL is_has_reunion(AMX *amx, cell *params)
|
||||
*
|
||||
* native is_has_vtc();
|
||||
*/
|
||||
cell AMX_NATIVE_CALL is_has_vtc(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL has_vtc(AMX *amx, cell *params)
|
||||
{
|
||||
return (cell)api_cfg.hasVTC();
|
||||
}
|
||||
@ -1351,8 +1351,8 @@ AMX_NATIVE_INFO Misc_Natives_Checks[] =
|
||||
{
|
||||
{ "is_rehlds", is_rehlds },
|
||||
{ "is_regamedll", is_regamedll },
|
||||
{ "is_has_reunion", is_has_reunion },
|
||||
{ "is_has_vtc", is_has_vtc }
|
||||
{ "has_reunion", has_reunion },
|
||||
{ "has_vtc", has_vtc }
|
||||
};
|
||||
|
||||
void RegisterNatives_Misc()
|
||||
|
Loading…
x
Reference in New Issue
Block a user