From e5ebd65176d6aadda2a688ee59d7bde025f2f7f9 Mon Sep 17 00:00:00 2001 From: Accelerator Date: Tue, 26 Jul 2022 23:14:49 +0300 Subject: [PATCH] Exposed SDKCall_Engine call type to use CVEngineServer methods (#1648) * Update vdecoder.h * Update vcaller.cpp * Update sdktools.inc --- extensions/sdktools/vcaller.cpp | 28 +++++++++++++++++++--------- extensions/sdktools/vdecoder.h | 1 + plugins/include/sdktools.inc | 3 ++- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/extensions/sdktools/vcaller.cpp b/extensions/sdktools/vcaller.cpp index d926cd790..23f9d0e1c 100644 --- a/extensions/sdktools/vcaller.cpp +++ b/extensions/sdktools/vcaller.cpp @@ -336,15 +336,25 @@ static cell_t SDKCall(IPluginContext *pContext, const cell_t *params) } break; case ValveCall_Server: - { - if (iserver == NULL) - { - vc->stk_put(ptr); - return pContext->ThrowNativeError("Server unsupported or not available; file a bug report"); - } - *(void **)ptr = iserver; - } - break; + { + if (iserver == NULL) + { + vc->stk_put(ptr); + return pContext->ThrowNativeError("Server unsupported or not available; file a bug report"); + } + *(void **)ptr = iserver; + } + break; + case ValveCall_Engine: + { + if (engine == NULL) + { + vc->stk_put(ptr); + return pContext->ThrowNativeError("Engine unsupported or not available; file a bug report"); + } + *(void **)ptr = engine; + } + break; case ValveCall_GameRules: { void *pGameRules = GameRules(); diff --git a/extensions/sdktools/vdecoder.h b/extensions/sdktools/vdecoder.h index 5e5641329..16478cf10 100644 --- a/extensions/sdktools/vdecoder.h +++ b/extensions/sdktools/vdecoder.h @@ -83,6 +83,7 @@ enum ValveCallType ValveCall_EntityList, /**< Thiscall (CGlobalEntityList implicit first paramater) */ ValveCall_Raw, /**< Thiscall (address explicit first parameter) */ ValveCall_Server, /**< Thiscall (CBaseServer implicit first parameter) */ + ValveCall_Engine, /**< Thiscall (CVEngineServer implicit first parameter) */ }; /** diff --git a/plugins/include/sdktools.inc b/plugins/include/sdktools.inc index 2e229ad3d..dcce2eb40 100644 --- a/plugins/include/sdktools.inc +++ b/plugins/include/sdktools.inc @@ -61,7 +61,8 @@ enum SDKCallType SDKCall_GameRules, /**< CGameRules call */ SDKCall_EntityList, /**< CGlobalEntityList call */ SDKCall_Raw, /**< |this| pointer with an arbitrary address */ - SDKCall_Server /**< CBaseServer call */ + SDKCall_Server, /**< CBaseServer call */ + SDKCall_Engine /**< CVEngineServer call */ }; enum SDKLibrary