diff --git a/core/logic/smn_gameconfigs.cpp b/core/logic/smn_gameconfigs.cpp index f475954aa..bd48490d0 100644 --- a/core/logic/smn_gameconfigs.cpp +++ b/core/logic/smn_gameconfigs.cpp @@ -155,11 +155,10 @@ static cell_t smn_GameConfGetAddress(IPluginContext *pCtx, const cell_t *params) if (!gc->GetAddress(key, &val)) return 0; -#ifdef KE_ARCH_X86 - return (cell_t)val; -#else - return pseudoAddr.ToPseudoAddress(val); -#endif + if (pCtx->GetRuntime()->FindPubvarByName("__Virtual_Address__", nullptr) == SP_ERROR_NONE) { + return pseudoAddr.ToPseudoAddress(val); + } + return reinterpret_cast(val); } static cell_t smn_GameConfGetMemSig(IPluginContext *pCtx, const cell_t *params) @@ -187,11 +186,10 @@ static cell_t smn_GameConfGetMemSig(IPluginContext *pCtx, const cell_t *params) return 0; } -#ifdef KE_ARCH_X86 - return (cell_t)val; -#else - return pseudoAddr.ToPseudoAddress(val); -#endif + if (pCtx->GetRuntime()->FindPubvarByName("__Virtual_Address__", nullptr) == SP_ERROR_NONE) { + return pseudoAddr.ToPseudoAddress(val); + } + return reinterpret_cast(val); } static GameConfigsNatives s_GameConfigsNatives; diff --git a/core/smn_entities.cpp b/core/smn_entities.cpp index e15692151..62a3cd74c 100644 --- a/core/smn_entities.cpp +++ b/core/smn_entities.cpp @@ -834,11 +834,10 @@ static cell_t SetEntDataEnt2(IPluginContext *pContext, const cell_t *params) static cell_t StoreEntityToHandleAddress(IPluginContext *pContext, const cell_t *params) { -#ifdef KE_ARCH_X86 void *addr = reinterpret_cast(params[1]); -#else - void *addr = g_SourceMod.FromPseudoAddress(params[1]); -#endif + if (pContext->GetRuntime()->FindPubvarByName("__Virtual_Address__", nullptr) == SP_ERROR_NONE) { + addr = g_SourceMod.FromPseudoAddress(params[1]); + } if (addr == NULL) { @@ -2771,11 +2770,10 @@ static cell_t GetEntityAddress(IPluginContext *pContext, const cell_t *params) return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]); } -#ifdef KE_ARCH_X86 - return reinterpret_cast(pEntity); -#else - return g_SourceMod.ToPseudoAddress(pEntity); -#endif + if (pContext->GetRuntime()->FindPubvarByName("__Virtual_Address__", nullptr) == SP_ERROR_NONE) { + return g_SourceMod.ToPseudoAddress(pEntity); + } + return reinterpret_cast(pEntity); } REGISTER_NATIVES(entityNatives)