From 4007ae8310c8c0dd07a6af59dab057ecf9b3a3cb Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Fri, 22 Jul 2016 13:59:58 -0400 Subject: [PATCH] Disable dynamic hooking iface on non-Windows Dota. This should really be disabled on x64 (or ported to work on it), but not sure how to best check that in the AMBuilder file. --- core/AMBuilder | 5 ++++- core/metamod.cpp | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/AMBuilder b/core/AMBuilder index 5b15887..00d8f54 100644 --- a/core/AMBuilder +++ b/core/AMBuilder @@ -18,7 +18,6 @@ for sdk_name in MMS.sdks: 'provider/console.cpp', 'provider/provider_ep2.cpp', 'sourcehook/sourcehook.cpp', - 'sourcehook/sourcehook_hookmangen.cpp', 'sourcehook/sourcehook_impl_chookidman.cpp', 'sourcehook/sourcehook_impl_chookmaninfo.cpp', 'sourcehook/sourcehook_impl_cproto.cpp', @@ -26,5 +25,9 @@ for sdk_name in MMS.sdks: 'gamedll_bridge.cpp', 'vsp_bridge.cpp' ] + + # Source2 hack. TODO: check this more deterministically, "are we doing an x64 build?" + if sdk.name != 'dota' or builder.target_platform == 'windows': + binary.sources += ['sourcehook/sourcehook_hookmangen.cpp'] nodes = builder.Add(binary) MMS.binaries += [nodes] diff --git a/core/metamod.cpp b/core/metamod.cpp index d283c4b..c93196c 100644 --- a/core/metamod.cpp +++ b/core/metamod.cpp @@ -131,7 +131,9 @@ static ConVar *mm_basedir = NULL; static CreateInterfaceFn engine_factory = NULL; static CreateInterfaceFn physics_factory = NULL; static CreateInterfaceFn filesystem_factory = NULL; +#if !defined( __amd64__ ) static CHookManagerAutoGen g_SH_HookManagerAutoGen(&g_SourceHook); +#endif static META_RES last_meta_res; static IServerPluginCallbacks *vsp_callbacks = NULL; static bool were_plugins_loaded = false; @@ -1025,11 +1027,19 @@ void *MetamodSource::MetaFactory(const char *iface, int *ret, PluginId *id) } else if (strcmp(iface, MMIFACE_SH_HOOKMANAUTOGEN) == 0) { +#if defined( __amd64__ ) + if (ret) + { + *ret = META_IFACE_FAILED; + } + return nullptr; +#else if (ret) { *ret = META_IFACE_OK; } return static_cast(static_cast(&g_SH_HookManagerAutoGen)); +#endif } CPluginManager::CPlugin *pl;