core-legacy/sourcemm.cpp
changeset 683 b507295429f9
parent 666 acab40e6dbd7
child 689 4065ba5e9155
     1.1 --- a/core-legacy/sourcemm.cpp	Tue Nov 17 04:49:17 2009 -0500
     1.2 +++ b/core-legacy/sourcemm.cpp	Sun Nov 22 23:54:55 2009 -0600
     1.3 @@ -1,5 +1,5 @@
     1.4  /* ======== SourceMM ========
     1.5 - * Copyright (C) 2004-2008 Metamod:Source Development Team
     1.6 + * Copyright (C) 2004-2009 Metamod:Source Development Team
     1.7   * No warranties of any kind
     1.8   *
     1.9   * License: zlib/libpng
    1.10 @@ -18,7 +18,6 @@
    1.11  #include "CSmmAPI.h"
    1.12  #include "CPlugin.h"
    1.13  #include "util.h"
    1.14 -#include "vsp_listener.h"
    1.15  #include "iplayerinfo.h"
    1.16  #include <filesystem.h>
    1.17  
    1.18 @@ -57,6 +56,7 @@
    1.19  SourceHook::CSourceHookImpl g_SourceHook;
    1.20  SourceHook::ISourceHook *g_SHPtr = &g_SourceHook;
    1.21  SourceHook::String g_ModPath;
    1.22 +SourceHook::String g_MetamodPath;
    1.23  PluginId g_PLID = Pl_Console;			/* Technically, SourceMM is the "Console" plugin... :p */
    1.24  static bool bInFirstLevel = true;
    1.25  bool g_bGameInit = false;
    1.26 @@ -66,7 +66,7 @@
    1.27  static const char GAMEINFO_PATH[] = "|gameinfo_path|";
    1.28  IFileSystem *baseFs = NULL;
    1.29  bool g_bLevelChanged = false;
    1.30 -IServerPluginCallbacks *g_pRealVspCallbacks = &g_VspListener;
    1.31 +IServerPluginCallbacks *g_pRealVspCallbacks = NULL;
    1.32  unsigned int g_vsp_version = 0;
    1.33  
    1.34  #define ITER_EVENT(evn, args) \
    1.35 @@ -125,41 +125,6 @@
    1.36  	LoadPlugins(filepath, vdfpath);
    1.37  }
    1.38  
    1.39 -SMM_API void *
    1.40 -CreateInterface(const char *iface, int *ret)
    1.41 -{
    1.42 -	void *ptr = NULL;
    1.43 -
    1.44 -	if (!g_bIsBridgedAsVsp && strncmp(iface, "ISERVERPLUGINCALLBACKS", 22) == 0)
    1.45 -	{
    1.46 -		if (g_VspListener.IsLoaded())
    1.47 -		{
    1.48 -			if (ret != NULL)
    1.49 -				*ret = IFACE_FAILED;
    1.50 -			return NULL;
    1.51 -		}
    1.52 -
    1.53 -		assert(&g_VspListener == g_pRealVspCallbacks);
    1.54 -
    1.55 -		int vsp_version = atoi(&iface[22]);
    1.56 -		if (vsp_version < 1 || vsp_version > 2)
    1.57 -		{
    1.58 -			if (ret != NULL)
    1.59 -				*ret = IFACE_FAILED;
    1.60 -			return NULL;
    1.61 -		}
    1.62 -
    1.63 -		g_vsp_version = vsp_version;
    1.64 -
    1.65 -		return g_pRealVspCallbacks;
    1.66 -	}
    1.67 -
    1.68 -	if (ret)
    1.69 -		*ret = (ptr != NULL) ? IFACE_OK : IFACE_FAILED;
    1.70 -
    1.71 -	return ptr;
    1.72 -}
    1.73 -
    1.74  bool StartupMetamod(CreateInterfaceFn engineFactory, bool bWaitForGameInit)
    1.75  {
    1.76  	g_Engine.engine = (IVEngineServer *)((engineFactory)(INTERFACEVERSION_VENGINESERVER, NULL));
    1.77 @@ -241,6 +206,7 @@
    1.78  	g_GameDll.factory = (CreateInterfaceFn)info->gsFactory;
    1.79  	g_GameDll.pGameDLL = (IServerGameDLL*)info->isgd;
    1.80  	g_GameDllVersion = info->dllVersion;
    1.81 +	g_MetamodPath.assign(info->vsp_listener_path);
    1.82  
    1.83  	InitMainStates();
    1.84