From 774af581031d379404f3ed1b38e9735ebb9462d8 Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Mon, 22 Dec 2008 22:55:55 -0600 Subject: [PATCH] Fixed bug where plugin aliases defined in VDF files on core (Orange Box and L4D engines) didn't work. --- core/metamod.cpp | 28 ++++++++++++++++++++++++++-- core/provider/provider_ep2.cpp | 26 ++------------------------ 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/core/metamod.cpp b/core/metamod.cpp index 07b1035..64e217c 100644 --- a/core/metamod.cpp +++ b/core/metamod.cpp @@ -1114,7 +1114,7 @@ ProcessVDF(const char *path, bool &skipped) { PluginId id; bool already; - char alias[24], file[255], error[255]; + char alias[24], file[255], full_path[255], error[255]; if (!provider->ProcessVDF(path, file, sizeof(file), alias, sizeof(alias))) { @@ -1125,7 +1125,31 @@ ProcessVDF(const char *path, bool &skipped) if (alias[0] != '\0') g_PluginMngr.SetAlias(alias, file); - id = g_PluginMngr.Load(file, Pl_File, already, error, sizeof(error)); + /* Attempt to find a file extension */ + if (UTIL_GetExtension(file) == NULL) + { + g_pMetamod->PathFormat(full_path, + sizeof(full_path), + "%s/%s%s", + g_pMetamod->GetBaseDir(), + file, +#if defined WIN32 || defined _WIN32 + ".dll" +#else + "_i486.so" +#endif + ); + } + else + { + g_pMetamod->PathFormat(full_path, + sizeof(full_path), + "%s/%s", + g_pMetamod->GetBaseDir(), + file); + } + + id = g_PluginMngr.Load(full_path, Pl_File, already, error, sizeof(error)); skipped = already; if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused) { diff --git a/core/provider/provider_ep2.cpp b/core/provider/provider_ep2.cpp index 907ff29..fedf300 100644 --- a/core/provider/provider_ep2.cpp +++ b/core/provider/provider_ep2.cpp @@ -417,6 +417,8 @@ bool BaseProvider::ProcessVDF(const char *file, char path[], size_t path_len, ch return false; } + UTIL_Format(path, path_len, "%s", plugin_file); + if ((p_alias = pValues->GetString("alias", NULL)) != NULL) { UTIL_Format(alias, alias_len, "%s", p_alias); @@ -426,30 +428,6 @@ bool BaseProvider::ProcessVDF(const char *file, char path[], size_t path_len, ch UTIL_Format(alias, alias_len, ""); } - /* Attempt to find a file extension */ - if (UTIL_GetExtension(plugin_file) == NULL) - { - g_pMetamod->PathFormat(path, - path_len, - "%s/%s%s", - g_pMetamod->GetBaseDir(), - plugin_file, -#if defined WIN32 || defined _WIN32 - ".dll" -#else - "_i486.so" -#endif - ); - } - else - { - g_pMetamod->PathFormat(path, - path_len, - "%s/%s", - g_pMetamod->GetBaseDir(), - plugin_file); - } - pValues->deleteThis(); return true;