From 7c959fa9bd74b7631c5a6375ba6e531df0cfdb1f Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sat, 15 Jul 2023 03:39:05 +0700 Subject: [PATCH] Implemented ATYPE_TRACE for SetHookChainArg native useful for replacement data on tracehandle argument --- reapi/extra/amxmodx/scripting/include/reapi.inc | 3 ++- reapi/src/hook_callback.h | 4 +++- reapi/src/natives/natives_hookchains.cpp | 3 +++ reapi/src/reapi_utils.cpp | 3 ++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/reapi/extra/amxmodx/scripting/include/reapi.inc b/reapi/extra/amxmodx/scripting/include/reapi.inc index 4533825..aac39c3 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi.inc @@ -130,7 +130,8 @@ enum AType ATYPE_EDICT, ATYPE_EVARS, ATYPE_BOOL, - ATYPE_VECTOR + ATYPE_VECTOR, + ATYPE_TRACE }; enum HookChain diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index 6340010..0816bf5 100644 --- a/reapi/src/hook_callback.h +++ b/reapi/src/hook_callback.h @@ -21,7 +21,8 @@ enum AType : uint8 ATYPE_EDICT, ATYPE_EVARS, ATYPE_BOOL, - ATYPE_VECTOR + ATYPE_VECTOR, + ATYPE_TRACE }; struct retval_t @@ -53,6 +54,7 @@ inline AType getApiType(entvars_t *) { return ATYPE_EVARS; } inline AType getApiType(bool) { return ATYPE_BOOL; } inline AType getApiType(Vector) { return ATYPE_VECTOR; } inline AType getApiType(ENTITYINIT) { return ATYPE_INTEGER; } +inline AType getApiType(TraceResult*) { return ATYPE_TRACE; } template inline AType getApiType(T *) { return ATYPE_INTEGER; } diff --git a/reapi/src/natives/natives_hookchains.cpp b/reapi/src/natives/natives_hookchains.cpp index 95ef2a2..87c8c0f 100644 --- a/reapi/src/natives/natives_hookchains.cpp +++ b/reapi/src/natives/natives_hookchains.cpp @@ -322,6 +322,9 @@ cell AMX_NATIVE_CALL SetHookChainArg(AMX *amx, cell *params) case ATYPE_EVARS: *(entvars_t **)destAddr = PEV(*srcAddr); break; + case ATYPE_TRACE: + **(TraceResult **)destAddr = *(TraceResult *)(*srcAddr); + break; default: return FALSE; } diff --git a/reapi/src/reapi_utils.cpp b/reapi/src/reapi_utils.cpp index 47394aa..5fc7f6e 100644 --- a/reapi/src/reapi_utils.cpp +++ b/reapi/src/reapi_utils.cpp @@ -250,7 +250,8 @@ const char *getATypeStr(AType type) "ATYPE_EDICT", "ATYPE_EVARS", "ATYPE_BOOL", - "ATYPE_VECTOR" + "ATYPE_VECTOR", + "ATYPE_TRACE" }; if (type >= arraysize(s_ATypes))