sourcemm/sourcemm.cpp
changeset 224 401c3ea7f8b5
parent 216 baece18f381f
child 231 1edd10b26450
     1.1 --- a/sourcemm/sourcemm.cpp	Thu Jul 20 11:31:41 2006 +0000
     1.2 +++ b/sourcemm/sourcemm.cpp	Fri Jul 21 06:59:58 2006 +0000
     1.3 @@ -172,6 +172,17 @@
     1.4  //This is where the magic happens
     1.5  SMM_API void *CreateInterface(const char *iface, int *ret)
     1.6  {
     1.7 +	// Prevent loading of self as a SourceMM plugin or Valve server plugin :x
     1.8 +	const char *vspIface = "ISERVERPLUGINCALLBACKS";
     1.9 +	if (strcmp(iface, PLAPI_NAME) == 0 || strnicmp(iface, vspIface, strlen(vspIface)) == 0)
    1.10 +	{
    1.11 +		Warning("Do not try loading Metamod:Source as a SourceMM or Valve server plugin.\n");
    1.12 +
    1.13 +		if (ret)
    1.14 +			*ret = IFACE_FAILED;
    1.15 +		return NULL;
    1.16 +	}
    1.17 +
    1.18  	if (!gParsedGameInfo)
    1.19  	{
    1.20  		gParsedGameInfo = true;
    1.21 @@ -180,7 +191,7 @@
    1.22  		getcwd(curpath, sizeof(curpath)-1);
    1.23  		if (!GetFileOfAddress((void *)CreateInterface, dllpath, sizeof(dllpath)-1))
    1.24  		{
    1.25 -			Error("GetFileOfAddress() failed! Metamod cannot load.");
    1.26 +			Error("GetFileOfAddress() failed! Metamod cannot load.\n");
    1.27  			return NULL;
    1.28  		}
    1.29  		SourceHook::String s_dllpath(dllpath);
    1.30 @@ -213,7 +224,7 @@
    1.31  		//     c:\gaben.dll
    1.32  		if (path_len > dll_len)
    1.33  		{
    1.34 -			Error("Could not detect GameDLL path! Metamod cannot load[1].");
    1.35 +			Error("Could not detect GameDLL path! Metamod cannot load[1].\n");
    1.36  			return NULL;
    1.37  		}
    1.38  
    1.39 @@ -229,7 +240,7 @@
    1.40  		if ( ((cmp)(curpath, dllpath, path_len)) != 0 )
    1.41  		{
    1.42  			//:TODO: In this case, we should read /proc/self/maps and find srcds!
    1.43 -			Error("Could not detect GameDLL path! Metamod cannot load[2].");
    1.44 +			Error("Could not detect GameDLL path! Metamod cannot load[2].\n");
    1.45  			return NULL;
    1.46  		}
    1.47  		//this will skip past the dir and its separator char
    1.48 @@ -241,7 +252,7 @@
    1.49  			{
    1.50  				if (i == 0)
    1.51  				{
    1.52 -					Error("Could not detect GameDLL path! Metamod cannot load[3].");
    1.53 +					Error("Could not detect GameDLL path! Metamod cannot load[3].\n");
    1.54  					return NULL;
    1.55  				} else {
    1.56  					ptr[i] = '\0';
    1.57 @@ -269,7 +280,7 @@
    1.58  		FILE *fp = fopen(temp_path, "rt");
    1.59  		if (!fp)
    1.60  		{
    1.61 -			Error("Unable to open gameinfo.txt!  Metamod cannot load.");
    1.62 +			Error("Unable to open gameinfo.txt!  Metamod cannot load.\n");
    1.63  			return NULL;
    1.64  		}
    1.65  		char buffer[255];
    1.66 @@ -411,7 +422,7 @@
    1.67  			{
    1.68  				if (sizeTooBig)
    1.69  				{
    1.70 -					Error("This mod version requires a SourceMM update (ServerGameDLL%03d)!", sizeTooBig);
    1.71 +					Error("This mod version requires a SourceMM update (ServerGameDLL%03d)!\n", sizeTooBig);
    1.72  					if (ret)
    1.73  						*ret = IFACE_FAILED;
    1.74  					return NULL;
    1.75 @@ -427,7 +438,7 @@
    1.76  		} else {
    1.77  			//wtf do we do...
    1.78  			//:TODO: .. something a bit more intelligent?
    1.79 -			Error("Engine requested unknown interface before GameDLL was known!");
    1.80 +			Error("Engine requested unknown interface before GameDLL was known!\n");
    1.81  			return NULL;
    1.82  		}
    1.83  	}