extensions can now be built for multiple engines, and will autoload from auto.X.Y folders

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401574
This commit is contained in:
David Anderson 2007-10-15 00:38:25 +00:00
parent d5add98082
commit 4de4797b8b
2 changed files with 23 additions and 2 deletions

View File

@ -405,7 +405,7 @@ void SourceModBase::DoGlobalPluginLoads()
if ((game_ext = g_pGameConf->GetKeyValue("GameExtension")) != NULL)
{
char path[PLATFORM_MAX_PATH];
UTIL_Format(path, sizeof(path), "games/%s.ext." PLATFORM_LIB_EXT, game_ext);
UTIL_Format(path, sizeof(path), "%s.ext." PLATFORM_LIB_EXT, game_ext);
g_Extensions.LoadAutoExtension(path);
}

View File

@ -51,7 +51,28 @@ CExtension::CExtension(const char *filename, char *error, size_t maxlength)
m_FullyLoaded = false;
char path[PLATFORM_MAX_PATH];
g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "extensions/%s", filename);
/* First see if there is an engine specific build! */
g_SourceMod.BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
#if defined METAMOD_PLAPI_VERSION
#if defined ORANGEBOX_BUILD
"extensions/auto.2.ep2/%s",
#else
"extensions/auto.2.ep1/%s",
#endif //ORANGEBOX_BUILD
#else //METAMOD_PLAPI_VERSION
"extensions/auto.1.ep1/%s",
#endif //METAMOD_PLAPI_VERSION
filename);
/* Try the "normal" version */
if (!g_LibSys.IsPathFile(path))
{
g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "extensions/%s", filename);
}
m_Path.assign(path);
m_pLib = NULL;