core/metamod_plugins.cpp
changeset 674 c4ed595f6248
parent 539 db914129ae01
child 677 3ec9092c5dc8
     1.1 --- a/core/metamod_plugins.cpp	Thu Oct 29 11:26:05 2009 -0500
     1.2 +++ b/core/metamod_plugins.cpp	Thu Oct 29 16:23:25 2009 -0500
     1.3 @@ -1,8 +1,8 @@
     1.4  /**
     1.5 - * vim: set ts=4 :
     1.6 + * vim: set ts=4 sw=4 tw=99 noet :
     1.7   * ======================================================
     1.8   * Metamod:Source
     1.9 - * Copyright (C) 2004-2008 AlliedModders LLC and authors.
    1.10 + * Copyright (C) 2004-2009 AlliedModders LLC and authors.
    1.11   * All rights reserved.
    1.12   * ======================================================
    1.13   *
    1.14 @@ -21,8 +21,6 @@
    1.15   * 2. Altered source versions must be plainly marked as such, and must not be
    1.16   * misrepresented as being the original software.
    1.17   * 3. This notice may not be removed or altered from any source distribution.
    1.18 - *
    1.19 - * Version: $Id$
    1.20   */
    1.21  
    1.22  #include <stdio.h>
    1.23 @@ -62,7 +60,8 @@
    1.24  	SH_IMPL_VERSION,
    1.25  	PLAPI_MIN_VERSION,
    1.26  	METAMOD_PLAPI_VERSION,
    1.27 -	SOURCE_ENGINE_UNKNOWN
    1.28 +	SOURCE_ENGINE_UNKNOWN,
    1.29 +	NULL
    1.30  };
    1.31  
    1.32  CPluginManager::CPluginManager()
    1.33 @@ -437,6 +436,11 @@
    1.34  				{
    1.35  					GlobVersionInfo.source_engine = g_Metamod.GetSourceEngineBuild();
    1.36  				}
    1.37 +				if (GlobVersionInfo.game_dir == NULL)
    1.38 +				{
    1.39 +					GlobVersionInfo.game_dir = strrchr(g_Metamod.GetBaseDir(), PATH_SEP_CHAR) + 1;
    1.40 +					Msg("OH MY GIDDY AUNT: %s\n", GlobVersionInfo.game_dir);
    1.41 +				}
    1.42  
    1.43  				/* Build path information */
    1.44  				char file_path[256];
    1.45 @@ -456,6 +460,14 @@
    1.46  				info.pl_path = file_path;
    1.47  
    1.48  				pl->m_API = fnLoad(&GlobVersionInfo, &info);
    1.49 +#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
    1.50 +				/* For plugin compat - try loading again using original OB if OB-Valve has failed */
    1.51 +				if (pl->m_API == NULL)
    1.52 +				{
    1.53 +					GlobVersionInfo.source_engine = SOURCE_ENGINE_ORANGEBOX;
    1.54 +					pl->m_API = fnLoad(&GlobVersionInfo, &info);
    1.55 +				}
    1.56 +#endif
    1.57  				pl->m_UnloadFn = (METAMOD_FN_UNLOAD)dlsym(pl->m_Lib, "UnloadInterface_MMS");
    1.58  			}
    1.59