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

Replace hardcoded "ServerGameDLL" part of iface name in meta game output

This commit is contained in:
Nick Hastings 2023-05-21 15:27:46 -04:00
parent bf62e8e59c
commit ee9243c82f
7 changed files with 24 additions and 9 deletions

View File

@ -38,7 +38,8 @@ public:
virtual bool DLLInit_Pre(const gamedll_bridge_info *info, char *buffer, size_t maxlength)
{
server = (IServerGameDLL *) info->isgd;
g_Metamod.SetGameDLLInfo((CreateInterfaceFn) info->gsFactory,
g_Metamod.SetGameDLLInfo((CreateInterfaceFn)info->gsFactory,
info->dllInterfaceName,
info->dllVersion,
true);
g_Metamod.SetVSPListener(info->vsp_listener_path);

View File

@ -69,6 +69,7 @@ static String metamod_path;
static String full_bin_path;
static int vsp_version = 0;
static int gamedll_version = 0;
static const char *gamedll_interface_name = nullptr;
static int engine_build = SOURCE_ENGINE_UNKNOWN;
static List<game_dll_t *> gamedll_list;
static bool is_gamedll_loaded = false;
@ -1018,9 +1019,10 @@ bool MetamodSource::IsLoadedAsGameDLL()
return is_gamedll_loaded;
}
void MetamodSource::SetGameDLLInfo(CreateInterfaceFn serverFactory, int version, bool loaded)
void MetamodSource::SetGameDLLInfo(CreateInterfaceFn serverFactory, const char *pGameDllIfaceName, int version, bool loaded)
{
gamedll_info.factory = serverFactory;
gamedll_interface_name = pGameDllIfaceName;
gamedll_version = version;
is_gamedll_loaded = loaded;
}
@ -1086,6 +1088,11 @@ size_t MetamodSource::GetFullPluginPath(const char *plugin, char *buffer, size_t
return num;
}
const char *MetamodSource::GetGameDLLInterfaceName() const
{
return gamedll_interface_name;
}
static bool
ProcessVDF(const char *path, bool &skipped)
{

View File

@ -93,7 +93,8 @@ public:
const char *GetVDFDir();
void UnregisterConCommandBase(PluginId id, ConCommandBase *pCommand);
void NotifyVSPListening(IServerPluginCallbacks *callbacks, int version);
void SetGameDLLInfo(CreateInterfaceFn serverFactory, int version, bool loaded);
const char* GetGameDLLInterfaceName() const;
void SetGameDLLInfo(CreateInterfaceFn serverFactory, const char *pGameDllIfaceName, int version, bool loaded);
void SetVSPListener(const char *path);
size_t GetFullPluginPath(const char *plugin, char *buffer, size_t len);
};

View File

@ -119,7 +119,7 @@ bool Command_Meta(IMetamodSourceCommandInfo *info)
CONMSG(" Description: %s\n", provider->GetGameDescription());
CONMSG(" Mod Path: %s\n", g_Metamod.GetBaseDir());
CONMSG(" DLL Path: %s\n", g_Metamod.GetGameBinaryPath());
CONMSG(" Interface: ServerGameDLL%03d\n", g_Metamod.GetGameDLLVersion());
CONMSG(" Interface: %s\n", g_Metamod.GetGameDLLInterfaceName());
CONMSG(" Engine: %s\n", provider->GetEngineDescription());
// Display user messages

View File

@ -43,6 +43,7 @@ SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
ConCommand *g_plugin_unload = NULL;
bool g_bIsTryingToUnload;
SourceHook::String vsp_desc("Metamod:Source");
static char gamedll_iface_name[128] = { 0 };
#if SOURCE_ENGINE >= SE_ORANGEBOX
void InterceptPluginUnloads(const CCommand &args)
@ -84,13 +85,12 @@ public:
pGlobals = playerInfoManager->GetGlobalVars();
char gamedll_iface[24];
for (unsigned int i = 3; i <= 50; i++)
{
UTIL_Format(gamedll_iface, sizeof(gamedll_iface), "ServerGameDLL%03d", i);
if ((server = (IServerGameDLL *)info->gsFactory(gamedll_iface, NULL)) != NULL)
UTIL_Format(gamedll_iface_name, sizeof(gamedll_iface_name), "ServerGameDLL%03d", i);
if ((server = (IServerGameDLL *)info->gsFactory(gamedll_iface_name, NULL)) != NULL)
{
g_Metamod.SetGameDLLInfo((CreateInterfaceFn)info->gsFactory, i, false);
g_Metamod.SetGameDLLInfo((CreateInterfaceFn)info->gsFactory, gamedll_iface_name, i, false);
break;
}
}

View File

@ -50,6 +50,7 @@ static void *gamedll_lib = NULL;
static IServerGameDLL *gamedll_iface = NULL;
static ISource2ServerConfig *config_iface = NULL;
static QueryValveInterface gamedll_qvi = NULL;
static char gamedll_iface_name[128] = { 0 };
static int gamedll_version = 0;
static int isgd_shutdown_index = -1;
#if defined _WIN32
@ -361,6 +362,7 @@ public:
{
g_bridge_info.pGlobals = nullptr;// pGlobals;
g_bridge_info.dllVersion = gamedll_version;
g_bridge_info.dllInterfaceName = gamedll_iface_name;
g_bridge_info.isgd = gamedll_iface;
g_bridge_info.gsFactory = gamedll_qvi;
g_bridge_info.vsp_listener_path = mm_path;
@ -497,6 +499,7 @@ public:
g_bridge_info.fsFactory = (QueryValveInterface)fileSystemFactory;
g_bridge_info.pGlobals = pGlobals;
g_bridge_info.dllVersion = gamedll_version;
g_bridge_info.dllInterfaceName = gamedll_iface_name;
g_bridge_info.isgd = gamedll_iface;
g_bridge_info.gsFactory = gamedll_qvi;
g_bridge_info.vsp_listener_path = mm_path;
@ -807,9 +810,10 @@ mm_GameDllRequest(const char *name, int *ret)
return ptr;
}
}
else if (strncmp(name, "Source2Server0", 14) == 0)
else if (strncmp(name, "Source2Server", 13) == 0 && atoi(&name[13]) != 0)
{
gamedll_iface = (IServerGameDLL *)gamedll_qvi(name, ret);
strncpy(gamedll_iface_name, name, sizeof(gamedll_iface_name));
gamedll_version = atoi(&name[13]);
mm_PatchDllInit(true);
@ -856,6 +860,7 @@ mm_GameDllRequest(const char *name, int *ret)
mm_FreeCachedLibraries();
gamedll_lib = lib;
gamedll_iface = (IServerGameDLL *)ptr;
strncpy(gamedll_iface_name, name, sizeof(gamedll_iface_name));
gamedll_qvi = qvi;
gamedll_version = atoi(&name[13]);
mm_PatchDllInit(true);

View File

@ -53,6 +53,7 @@ struct gamedll_bridge_info
QueryValveInterface gsFactory;
void * pGlobals;
unsigned int dllVersion;
const char * dllInterfaceName;
void * isgd;
const char * vsp_listener_path;
};