loader/gamedll.cpp
changeset 683 b507295429f9
parent 681 a9f34c9f06e7
child 705 a1001281dcb1
     1.1 --- a/loader/gamedll.cpp	Tue Nov 17 04:49:17 2009 -0500
     1.2 +++ b/loader/gamedll.cpp	Sun Nov 22 23:54:55 2009 -0600
     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 @@ -52,17 +50,17 @@
    1.24  static QueryValveInterface gamedll_qvi = NULL;
    1.25  static int gamedll_version = 0;
    1.26  static int isgd_shutdown_index = -1;
    1.27 +static char mm_path[PLATFORM_MAX_PATH];
    1.28  
    1.29  #if defined _WIN32
    1.30  #define SERVER_NAME			"server.dll"
    1.31  #elif defined __linux__
    1.32 -#define SERVER_NAME			"server" BINARY_SUFFIX
    1.33 +#define SERVER_NAME			"server" LIB_SUFFIX
    1.34  #endif
    1.35  
    1.36  static bool
    1.37  mm_DetectGameInformation()
    1.38  {
    1.39 -	char mm_path[PLATFORM_MAX_PATH];
    1.40  	char game_path[PLATFORM_MAX_PATH];
    1.41  
    1.42  	if (game_info_detected)
    1.43 @@ -77,7 +75,7 @@
    1.44  
    1.45  	if (!mm_GetFileOfAddress((void*)mm_DetectGameInformation, mm_path, sizeof(mm_path)))
    1.46  	{
    1.47 -		mm_LogFatal("Could not locate metamod loader library path");
    1.48 +		mm_LogFatal("Could not locate Metamod loader library path");
    1.49  		return false;
    1.50  	}
    1.51  
    1.52 @@ -216,18 +214,18 @@
    1.53  						 QueryValveInterface fileSystemFactory, 
    1.54  						 void *pGlobals)
    1.55  	{
    1.56 -		MetamodBackend backend = mm_DetermineBackend(engineFactory, game_name);
    1.57 +		mm_backend = mm_DetermineBackend(engineFactory, game_name);
    1.58  
    1.59  		char error[255];
    1.60 -		if (backend == MMBackend_UNKNOWN)
    1.61 +		if (mm_backend == MMBackend_UNKNOWN)
    1.62  		{
    1.63  			mm_LogFatal("Could not detect engine version");
    1.64  		}
    1.65  		else
    1.66  		{
    1.67 -			if (!mm_LoadMetamodLibrary(backend, error, sizeof(error)))
    1.68 +			if (!mm_LoadMetamodLibrary(mm_backend, error, sizeof(error)))
    1.69  			{
    1.70 -				mm_LogFatal("Detected engine %d but could not load: %s", backend, error);
    1.71 +				mm_LogFatal("Detected engine %d but could not load: %s", mm_backend, error);
    1.72  			}
    1.73  			else
    1.74  			{
    1.75 @@ -236,7 +234,7 @@
    1.76  				if (get_bridge == NULL)
    1.77  				{
    1.78  					mm_UnloadMetamodLibrary();
    1.79 -					mm_LogFatal("Detected engine %d but could not find GetGameDllBridge callback", backend);
    1.80 +					mm_LogFatal("Detected engine %d but could not find GetGameDllBridge callback", mm_backend);
    1.81  				}
    1.82  				else
    1.83  				{
    1.84 @@ -256,13 +254,14 @@
    1.85  			info.dllVersion = gamedll_version;
    1.86  			info.isgd = gamedll_iface;
    1.87  			info.gsFactory = gamedll_qvi;
    1.88 +			info.vsp_listener_path = mm_path;
    1.89  
    1.90  			strcpy(error, "Unknown error");
    1.91  			if (!gamedll_bridge->DLLInit_Pre(&info, error, sizeof(error)))
    1.92  			{
    1.93  				gamedll_bridge = NULL;
    1.94  				mm_UnloadMetamodLibrary();
    1.95 -				mm_LogFatal("Unknown error loading Metamod for engine %d: %s", backend, error);	
    1.96 +				mm_LogFatal("Unknown error loading Metamod for engine %d: %s", mm_backend, error);	
    1.97  			}
    1.98  		}
    1.99