1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2024-11-28 10:24:20 +01:00

Change AllowDedicatedServer hook to be Windows-only.

It's not needed elsewhere right now.
This commit is contained in:
Nicholas Hastings 2016-07-22 14:02:37 -04:00
parent a88de796a3
commit a2400e3681
3 changed files with 15 additions and 3 deletions

View File

@ -43,7 +43,7 @@
#include <iserver.h> #include <iserver.h>
#endif #endif
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA && defined( _WIN32 )
SH_DECL_HOOK1(ISource2ServerConfig, AllowDedicatedServers, const, 0, bool, EUniverse); SH_DECL_HOOK1(ISource2ServerConfig, AllowDedicatedServers, const, 0, bool, EUniverse);
bool BaseProvider::AllowDedicatedServers(EUniverse universe) const bool BaseProvider::AllowDedicatedServers(EUniverse universe) const
{ {
@ -239,7 +239,7 @@ void BaseProvider::Notify_DLLInit_Pre(CreateInterfaceFn engineFactory,
SH_ADD_HOOK_STATICFUNC(IServerGameClients, ClientCommand, gameclients, ClientCommand, false); SH_ADD_HOOK_STATICFUNC(IServerGameClients, ClientCommand, gameclients, ClientCommand, false);
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA && defined( _WIN32 )
SH_ADD_VPHOOK(ISource2ServerConfig, AllowDedicatedServers, serverconfig, SH_MEMBER(this, &BaseProvider::AllowDedicatedServers), false); SH_ADD_VPHOOK(ISource2ServerConfig, AllowDedicatedServers, serverconfig, SH_MEMBER(this, &BaseProvider::AllowDedicatedServers), false);
#endif #endif
} }

View File

@ -81,7 +81,7 @@ public:
virtual const char *GetUserMessage(int index, int *size=NULL); virtual const char *GetUserMessage(int index, int *size=NULL);
virtual int DetermineSourceEngine(); virtual int DetermineSourceEngine();
virtual bool ProcessVDF(const char *file, char path[], size_t path_len, char alias[], size_t alias_len); virtual bool ProcessVDF(const char *file, char path[], size_t path_len, char alias[], size_t alias_len);
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA && defined( _WIN32 )
bool AllowDedicatedServers(EUniverse universe) const; bool AllowDedicatedServers(EUniverse universe) const;
#endif #endif
}; };

View File

@ -52,7 +52,9 @@ static ISource2ServerConfig *config_iface = NULL;
static QueryValveInterface gamedll_qvi = NULL; static QueryValveInterface gamedll_qvi = NULL;
static int gamedll_version = 0; static int gamedll_version = 0;
static int isgd_shutdown_index = -1; static int isgd_shutdown_index = -1;
#if defined _WIN32
static int is2sc_allowdedi_index = 21; static int is2sc_allowdedi_index = 21;
#endif
static char mm_path[PLATFORM_MAX_PATH]; static char mm_path[PLATFORM_MAX_PATH];
static bool g_is_source2 = false; static bool g_is_source2 = false;
@ -229,15 +231,19 @@ mm_PatchDllInit(bool patch);
static void static void
mm_PatchDllShutdown(); mm_PatchDllShutdown();
#if defined _WIN32
static void static void
mm_PatchAllowDedicated(bool patch); mm_PatchAllowDedicated(bool patch);
#endif
static void static void
mm_PatchConnect(bool patch); mm_PatchConnect(bool patch);
static void *isgd_orig_init = NULL; static void *isgd_orig_init = NULL;
static void *isgd_orig_shutdown = NULL; static void *isgd_orig_shutdown = NULL;
#if defined _WIN32
static void *is2sc_orig_allowdedi = NULL; static void *is2sc_orig_allowdedi = NULL;
#endif
static void *is2sc_orig_connect = NULL; static void *is2sc_orig_connect = NULL;
class VEmptyClass class VEmptyClass
@ -299,11 +305,13 @@ public:
return result; return result;
} }
#if defined _WIN32
virtual bool AllowDedicatedServers(int universe) const virtual bool AllowDedicatedServers(int universe) const
{ {
mm_PatchAllowDedicated(false); mm_PatchAllowDedicated(false);
return true; return true;
} }
#endif
}; };
class ISource2Server class ISource2Server
@ -661,6 +669,7 @@ mm_PatchDllShutdown()
vtable_dest[isgd_shutdown_index] = vtable_src[mfp.vtblindex]; vtable_dest[isgd_shutdown_index] = vtable_src[mfp.vtblindex];
} }
#if defined _WIN32
static void static void
mm_PatchAllowDedicated(bool patch) mm_PatchAllowDedicated(bool patch)
{ {
@ -694,6 +703,7 @@ mm_PatchAllowDedicated(bool patch)
is2sc_orig_allowdedi = NULL; is2sc_orig_allowdedi = NULL;
} }
} }
#endif
static void static void
mm_PatchConnect(bool patch) mm_PatchConnect(bool patch)
@ -776,7 +786,9 @@ mm_GameDllRequest(const char *name, int *ret)
gamedll_qvi = qvi; gamedll_qvi = qvi;
mm_PatchConnect(true); mm_PatchConnect(true);
#if defined _WIN32
mm_PatchAllowDedicated(true); mm_PatchAllowDedicated(true);
#endif
if (ret != NULL) if (ret != NULL)
*ret = 0; *ret = 0;