1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-02-20 13:54:14 +01:00

Ditch "source2" naming, restoring "dota".

This commit is contained in:
Nicholas Hastings 2016-07-22 13:57:54 -04:00
parent 4472cc4cc7
commit 366a27e10c
14 changed files with 53 additions and 70 deletions

View File

@ -32,13 +32,12 @@ PossibleSDKs = {
'bgt': SDK('HL2SDK-BGT', '2.bgt', '4', 'BLOODYGOODTIME', WinOnly, 'bgt'),
'eye': SDK('HL2SDK-EYE', '2.eye', '5', 'EYE', WinOnly, 'eye'),
'csgo': SDK('HL2SDKCSGO', '2.csgo', '20', 'CSGO', WinLinuxMac, 'csgo'),
'dota': SDK('HL2SDKDOTA', '2.dota', '21', 'DOTA', [], 'dota'),
'dota': SDK('HL2SDKDOTA', '2.dota', '21', 'DOTA', WinLinux, 'dota'),
'portal2': SDK('HL2SDKPORTAL2', '2.portal2', '17', 'PORTAL2', [], 'portal2'),
'blade': SDK('HL2SDKBLADE', '2.blade', '18', 'BLADE', WinLinux, 'blade'),
'insurgency': SDK('HL2SDKINSURGENCY', '2.insurgency', '19', 'INSURGENCY', WinLinuxMac, 'insurgency'),
'contagion': SDK('HL2SDKCONTAGION', '2.contagion', '14', 'CONTAGION', WinOnly, 'contagion'),
'bms': SDK('HL2SDKBMS', '2.bms', '10', 'BMS', WinLinux, 'bms'),
'source2': SDK('HL2SDKSOURCE2', '2.source2', '22', 'SOURCE2', WinOnly, 'source2'),
}
def ResolveEnvPath(env, folder):
@ -281,7 +280,7 @@ class MMSConfig(object):
else:
compiler.defines += ['COMPILER_GCC']
if sdk.name in ['css', 'hl2dm', 'dods', 'sdk2013', 'bms', 'tf2', 'l4d', 'nucleardawn', 'l4d2', 'dota', 'source2']:
if sdk.name in ['css', 'hl2dm', 'dods', 'sdk2013', 'bms', 'tf2', 'l4d', 'nucleardawn', 'l4d2', 'dota']:
if builder.target_platform in ['linux', 'mac']:
compiler.defines += ['NO_HOOK_MALLOC', 'NO_MALLOC_OVERRIDE']
@ -357,7 +356,7 @@ class MMSConfig(object):
else:
compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'tier1_i486.a'))]
if sdk.name in ['blade', 'insurgency', 'csgo', 'dota', 'source2']:
if sdk.name in ['blade', 'insurgency', 'csgo', 'dota']:
compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'interfaces_i486.a'))]
binary = self.LibraryBuilder(compiler, name)
@ -367,7 +366,7 @@ class MMSConfig(object):
compiler.linkflags[0:0] = ['-lm']
if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'bms', 'nucleardawn', 'l4d2', 'insurgency']:
dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so']
elif sdk.name in ['l4d', 'blade', 'insurgency', 'csgo', 'dota', 'source2']:
elif sdk.name in ['l4d', 'blade', 'insurgency', 'csgo', 'dota']:
dynamic_libs = ['libtier0.so', 'libvstdlib.so']
else:
dynamic_libs = ['tier0_i486.so', 'vstdlib_i486.so']
@ -376,7 +375,7 @@ class MMSConfig(object):
dynamic_libs = ['libtier0.dylib', 'libvstdlib.dylib']
elif builder.target_platform == 'windows':
libs = ['tier0', 'tier1', 'vstdlib']
if sdk.name in ['swarm', 'blade', 'insurgency', 'csgo', 'dota', 'source2']:
if sdk.name in ['swarm', 'blade', 'insurgency', 'csgo', 'dota']:
libs.append('interfaces')
for lib in libs:
lib_path = os.path.join(sdk.path, 'lib', 'public', lib) + '.lib'

View File

@ -59,7 +59,6 @@
#define SOURCE_ENGINE_INSURGENCY 21 /**< Insurgency */
#define SOURCE_ENGINE_CONTAGION 22 /**< Contagion */
#define SOURCE_ENGINE_BMS 23 /**< Black Mesa Multiplayer */
#define SOURCE_ENGINE_SOURCE2 24
#define METAMOD_PLAPI_VERSION 15 /**< Version of this header file */
#define METAMOD_PLAPI_NAME "ISmmPlugin" /**< Name of the plugin interface */

View File

@ -63,7 +63,7 @@ public:
SourceHook::MemFuncInfo mfi;
mfi.isVirtual = false;
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
SourceHook::GetFuncInfo(&IServerGameDLL::Shutdown, mfi);
#else
SourceHook::GetFuncInfo(&IServerGameDLL::DLLShutdown, mfi);

View File

@ -37,7 +37,7 @@
#if defined __linux__
#include <sys/stat.h>
#endif
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
#include <iserver.h>
#endif
@ -50,7 +50,7 @@ using namespace SourceHook::Impl;
* @file sourcemm.cpp
*/
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
// Hack to make hook decl compile when only having forward decl in header.
// (we have class structure but it requires protobuf which we don't want to include here)
class GameSessionConfiguration_t { };
@ -189,7 +189,7 @@ mm_InitializeForLoad()
*/
in_first_level = true;
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
SourceHook::MemFuncInfo info;
if (!provider->GetHookInfo(ProvidedHook_StartupServer, &info))
@ -537,7 +537,7 @@ mm_HandleGameInit()
if (is_game_init)
return;
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
Msg("MMS: GameInit\n");
#endif
@ -557,7 +557,7 @@ mm_HandleGameInit()
static void
mm_HandleLevelShutdown()
{
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
Msg("MMS: LevelShutdown\n");
#endif
@ -601,14 +601,14 @@ char const *pLandmarkName,
bool loadGame,
bool background)
{
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
Msg("MMS: LevelInit\n");
#endif
ITER_EVENT(OnLevelInit, (pMapName, pMapEntities, pOldLevel, pLandmarkName, loadGame, background));
}
#include <utlbuffer.h>
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
static void
Handler_SwitchToLoop(const char *pszLoopName, KeyValues *pKV, uint32 nId, const char *pszUnk, bool bUnk)
{
@ -943,7 +943,7 @@ size_t MetamodSource::PathFormat(char *buffer, size_t len, const char *fmt, ...)
return mylen;
}
#if SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
void MetamodSource::ClientConPrintf(int clientIndex, const char *fmt, ...)
{
va_list ap;

View File

@ -76,7 +76,7 @@ public:
void *InterfaceSearch(CreateInterfaceFn fn, const char *iface, int max, int *ret);
const char *GetBaseDir();
size_t PathFormat(char *buffer, size_t len, const char *fmt, ...);
#if SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
// Shim
void ClientConPrintf(int clientIndex, const char *fmt, ...);
#endif

View File

@ -44,7 +44,7 @@ using namespace SourceHook;
#define CLIENT_CONMSG g_Metamod.ClientConPrintf
template <typename ... Ts>
#if SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
void CMDMSG(int client, const char *pMsg, Ts ... ts)
#else
void CMDMSG(edict_t *client, const char *pMsg, Ts ... ts)
@ -100,13 +100,11 @@ void CMDMSG(edict_t *client, const char *pMsg, Ts ... ts)
#define MMS_ENGINE_NAME "Counter-Strike: Global Offensive (2012)"
#elif SOURCE_ENGINE == SE_DOTA
#define MMS_ENGINE_NAME "Dota 2 (2013)"
#elif SOURCE_ENGINE == SE_SOURCE2
#define MMS_ENGINE_NAME "Source 2"
#else
#error "SOURCE_ENGINE not defined to a known value"
#endif
#if SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
static void ReplyCredits(int client = 0)
#else
static void ReplyCredits(edict_t *client = nullptr)
@ -120,7 +118,7 @@ static void ReplyCredits(edict_t *client = nullptr)
CMDMSG(client, "http://www.metamodsource.net/\n");
}
#if SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
static void ReplyVersion(int client = 0)
#else
static void ReplyVersion(edict_t *client = nullptr)
@ -700,7 +698,7 @@ bool Command_Meta(IMetamodSourceCommandInfo *info)
return true;
}
#if SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
bool Command_ClientMeta(int client, IMetamodSourceCommandInfo *info)
#else
bool Command_ClientMeta(edict_t *client, IMetamodSourceCommandInfo *info)

View File

@ -31,7 +31,7 @@
#include "metamod_provider.h"
bool Command_Meta(IMetamodSourceCommandInfo *info);
#if SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
bool Command_ClientMeta(int client, IMetamodSourceCommandInfo *info);
#else
bool Command_ClientMeta(edict_t *client, IMetamodSourceCommandInfo *info);

View File

@ -37,7 +37,7 @@ namespace SourceMM
enum ProvidedHooks
{
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
ProvidedHook_StartChangeLevel = 0,
ProvidedHook_Init = 1,
ProvidedHook_StartupServer = 2,

View File

@ -39,11 +39,11 @@
#include <filesystem.h>
#include "metamod.h"
#include <tier1/KeyValues.h>
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
#include <iserver.h>
#endif
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
SH_DECL_HOOK1(ISource2ServerConfig, AllowDedicatedServers, const, 0, bool, EUniverse);
bool BaseProvider::AllowDedicatedServers(EUniverse universe) const
{
@ -74,23 +74,18 @@ DLL_IMPORT ICommandLine *CommandLine();
/* Functions */
void CacheUserMessages();
void Detour_Error(const tchar *pMsg, ...);
#if SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
void ClientCommand(CEntityIndex index, const CCommand &args);
#if SOURCE_ENGINE == SE_DOTA
void LocalCommand_Meta(const CCommandContext &context, const CCommand &args);
#else
void LocalCommand_Meta(const CCommand &args);
#endif
#if SOURCE_ENGINE == SE_SOURCE2
void meta_game_init(const CCommand &args);
void meta_level_init(const CCommand &args);
void meta_level_shutdown(const CCommand &args);
#endif
void ClientCommand(CEntityIndex index, const CCommand &args);
#elif SOURCE_ENGINE >= SE_ORANGEBOX
void ClientCommand(edict_t *pEdict, const CCommand &args);
void LocalCommand_Meta(const CCommand &args);
#else
void ClientCommand(edict_t *pEdict);
#endif
#if SOURCE_ENGINE >= SE_ORANGEBOX
void LocalCommand_Meta(const CCommand &args);
#else
void LocalCommand_Meta();
#endif
@ -104,7 +99,7 @@ static jmp_buf usermsg_end;
ICvar *icvar = NULL;
IFileSystem *baseFs = NULL;
IServerGameDLL *server = NULL;
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
static ISource2ServerConfig *serverconfig = NULL;
INetworkServerService *netservice = NULL;
IEngineServiceMgr *enginesvcmgr = NULL;
@ -115,7 +110,7 @@ CGlobalVars *gpGlobals = NULL;
IMetamodSourceProvider *provider = &g_Ep1Provider;
ConCommand meta_local_cmd("meta", LocalCommand_Meta, "Metamod:Source control options");
#if SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, CEntityIndex, const CCommand &);
#elif SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &);
@ -154,7 +149,7 @@ void BaseProvider::Notify_DLLInit_Pre(CreateInterfaceFn engineFactory,
DisplayError("Could not find IVEngineServer! Metamod cannot load.");
return;
}
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
gpGlobals = engine->GetServerGlobals();
serverconfig = (ISource2ServerConfig *) ((serverFactory) (INTERFACEVERSION_SERVERCONFIG, NULL));
netservice = (INetworkServerService *) ((engineFactory) (NETWORKSERVERSERVICE_INTERFACE_VERSION, NULL));
@ -171,7 +166,7 @@ void BaseProvider::Notify_DLLInit_Pre(CreateInterfaceFn engineFactory,
return;
}
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
gameclients = (IServerGameClients *)(serverFactory(INTERFACEVERSION_SERVERGAMECLIENTS, NULL));
#else
if ((gameclients = (IServerGameClients *)(serverFactory("ServerGameClients003", NULL)))
@ -187,7 +182,7 @@ void BaseProvider::Notify_DLLInit_Pre(CreateInterfaceFn engineFactory,
mm_LogMessage("Unable to find \"%s\": .vdf files will not be parsed", FILESYSTEM_INTERFACE_VERSION);
}
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
// Since we have to be added as a Game path (cannot add GameBin directly), we
// automatically get added to other paths as well, including having the MM:S
// dir become the default write path for logs and more. We can fix some of these.
@ -244,7 +239,7 @@ void BaseProvider::Notify_DLLInit_Pre(CreateInterfaceFn engineFactory,
SH_ADD_HOOK_STATICFUNC(IServerGameClients, ClientCommand, gameclients, ClientCommand, false);
}
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
SH_ADD_VPHOOK(ISource2ServerConfig, AllowDedicatedServers, serverconfig, SH_MEMBER(this, &BaseProvider::AllowDedicatedServers), false);
#endif
}
@ -269,7 +264,7 @@ bool BaseProvider::IsRemotePrintingAvailable()
void BaseProvider::ClientConsolePrint(edict_t *pEdict, const char *message)
{
#if SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
int client = (int)(pEdict - gpGlobals->pEdicts);
engine->ClientPrintf(client, message);
#else
@ -353,7 +348,7 @@ bool BaseProvider::LogMessage(const char *buffer)
bool BaseProvider::GetHookInfo(ProvidedHooks hook, SourceHook::MemFuncInfo *pInfo)
{
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
SourceHook::MemFuncInfo mfi = {true, -1, 0, 0};
switch (hook)
@ -411,7 +406,7 @@ void BaseProvider::DisplayError(const char *fmt, ...)
UTIL_FormatArgs(buffer, sizeof(buffer), fmt, ap);
va_end(ap);
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
Msg("ERROR: %s", buffer);
#else
Error("%s", buffer);
@ -447,7 +442,7 @@ void BaseProvider::UnregisterConCommandBase(ConCommandBase *pCommand)
int BaseProvider::GetUserMessageCount()
{
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
return -1;
#else
return (int)usermsgs_list.size();
@ -493,7 +488,7 @@ void BaseProvider::GetGamePath(char *pszBuffer, int len)
const char *BaseProvider::GetGameDescription()
{
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
return serverconfig->GetGameDescription();
#else
return server->GetGameDescription();
@ -542,8 +537,6 @@ int BaseProvider::DetermineSourceEngine()
return SOURCE_ENGINE_DOTA;
#elif SOURCE_ENGINE == SE_BMS
return SOURCE_ENGINE_BMS;
#elif SOURCE_ENGINE == SE_SOURCE2
return SOURCE_ENGINE_SOURCE2;
#else
#error "SOURCE_ENGINE not defined to a known value"
#endif
@ -657,11 +650,7 @@ public:
};
#endif
#if SOURCE_ENGINE == SE_DOTA// || SOURCE_ENGINE == SE_SOURCE2
void LocalCommand_Meta(const CCommandContext &context, const CCommand &args)
{
GlobCommand cmd(&args);
#elif SOURCE_ENGINE >= SE_ORANGEBOX
#if SOURCE_ENGINE >= SE_ORANGEBOX
void LocalCommand_Meta(const CCommand &args)
{
GlobCommand cmd(&args);
@ -673,7 +662,7 @@ void LocalCommand_Meta()
Command_Meta(&cmd);
}
#if SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
void ClientCommand(CEntityIndex index, const CCommand &_cmd)
{
int client = index.Get();
@ -696,7 +685,7 @@ void ClientCommand(edict_t *client)
RETURN_META(MRES_IGNORED);
}
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
void CacheUserMessages()
{

View File

@ -32,7 +32,7 @@
#endif
#include <sourcehook.h>
#include <sh_memfuncinfo.h>
#if SOURCE_ENGINE != SE_SOURCE2
#if SOURCE_ENGINE != SE_DOTA
#include <iserverplugin.h>
#endif
#include "ISmmAPI.h"
@ -81,7 +81,7 @@ public:
virtual const char *GetUserMessage(int index, int *size=NULL);
virtual int DetermineSourceEngine();
virtual bool ProcessVDF(const char *file, char path[], size_t path_len, char alias[], size_t alias_len);
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
bool AllowDedicatedServers(EUniverse universe) const;
#endif
};
@ -91,7 +91,7 @@ extern IServerGameDLL *server;
extern IServerGameClients *gameclients;
extern ICvar *icvar;
extern CGlobalVars *gpGlobals;
#if SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
extern INetworkServerService *netservice;
extern IEngineServiceMgr *enginesvcmgr;
#endif

View File

@ -34,7 +34,7 @@
#include <sh_string.h>
#include "provider/provider_ep2.h"
#if SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
SH_DECL_HOOK2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
#elif SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_HOOK1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
@ -46,7 +46,7 @@ ConCommand *g_plugin_unload = NULL;
bool g_bIsTryingToUnload;
SourceHook::String vsp_desc("Metamod:Source");
#if SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
void InterceptPluginUnloads(const CCommandContext &context, const CCommand &args)
#elif SOURCE_ENGINE >= SE_ORANGEBOX
void InterceptPluginUnloads(const CCommand &args)
@ -57,7 +57,7 @@ void InterceptPluginUnloads()
g_bIsTryingToUnload = true;
}
#if SOURCE_ENGINE == SE_DOTA || SOURCE_ENGINE == SE_SOURCE2
#if SOURCE_ENGINE == SE_DOTA
void InterceptPluginUnloads_Post(const CCommandContext &context, const CCommand &args)
#elif SOURCE_ENGINE >= SE_ORANGEBOX
void InterceptPluginUnloads_Post(const CCommand &args)
@ -165,7 +165,7 @@ public:
virtual void Unload()
{
// Source2 doesn't have the Error function (nor VSP support).
#if SOURCE_ENGINE != SE_SOURCE2
#if SOURCE_ENGINE != SE_DOTA
if (g_bIsTryingToUnload)
{
Error("Metamod:Source cannot be unloaded from VSP mode. Use \"meta unload\" to unload specific plugins.\n");

View File

@ -315,7 +315,7 @@ public:
virtual InitReturnVal_t Init()
{
mm_backend = MMBackend_Source2;
mm_backend = MMBackend_DOTA;
char error[255];
if (!mm_LoadMetamodLibrary(mm_backend, error, sizeof(error)))

View File

@ -89,8 +89,7 @@ static const char *backend_names[] =
"2.blade",
"2.insurgency",
"2.contagion",
"2.bms",
"2.source2"
"2.bms"
};
#if defined _WIN32

View File

@ -102,7 +102,6 @@ enum MetamodBackend
MMBackend_Insurgency,
MMBackend_Contagion,
MMBackend_BMS,
MMBackend_Source2,
MMBackend_UNKNOWN
};