sketched out new 'alt loader' interface
authorDavid Anderson <dvander@alliedmods.net>
Mon Oct 08 19:17:38 2007 +0000 (2007-10-08)
changeset 39813e6e510cc6c
parent 397 936c1a0b6900
child 399 3cd3255adb76
sketched out new 'alt loader' interface
sourcemm/ISmmPlugin.h
sourcemm/ISmmPluginExt.h
     1.1 --- a/sourcemm/ISmmPlugin.h	Mon Oct 08 18:51:51 2007 +0000
     1.2 +++ b/sourcemm/ISmmPlugin.h	Mon Oct 08 19:17:38 2007 +0000
     1.3 @@ -415,7 +415,6 @@
     1.4  using namespace SourceMM;
     1.5  #endif
     1.6  
     1.7 -
     1.8  #define PL_EXPOSURE		CreateInterface
     1.9  #define PL_EXPOSURE_C	"CreateInterface"
    1.10  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/sourcemm/ISmmPluginExt.h	Mon Oct 08 19:17:38 2007 +0000
     2.3 @@ -0,0 +1,89 @@
     2.4 +/**
     2.5 + * vim: set ts=4 :
     2.6 + * ======================================================
     2.7 + * Metamod:Source
     2.8 + * Copyright (C) 2004-2007 AlliedModders LLC and authors.
     2.9 + * All rights reserved.
    2.10 + * ======================================================
    2.11 + *
    2.12 + * This software is provided 'as-is', without any express or implied warranty.
    2.13 + * In no event will the authors be held liable for any damages arising from 
    2.14 + * the use of this software.
    2.15 + * 
    2.16 + * Permission is granted to anyone to use this software for any purpose, 
    2.17 + * including commercial applications, and to alter it and redistribute it 
    2.18 + * freely, subject to the following restrictions:
    2.19 + *
    2.20 + * 1. The origin of this software must not be misrepresented; you must not 
    2.21 + * claim that you wrote the original software. If you use this software in a 
    2.22 + * product, an acknowledgment in the product documentation would be 
    2.23 + * appreciated but is not required.
    2.24 + * 2. Altered source versions must be plainly marked as such, and must not be
    2.25 + * misrepresented as being the original software.
    2.26 + * 3. This notice may not be removed or altered from any source distribution.
    2.27 + *
    2.28 + * Version: $Id$
    2.29 + */
    2.30 +
    2.31 +#ifndef _INCLUDE_METAMOD_SOURCE_PLUGIN_EXT_H_
    2.32 +#define _INCLUDE_METAMOD_SOUrCE_PLUGIN_EXT_H_
    2.33 +
    2.34 +namespace SourceMM
    2.35 +{
    2.36 +	class ISmmAPI;
    2.37 +}
    2.38 +
    2.39 +/**
    2.40 + * @file ISmmPluginExt.h 	Definitions for extended plugin exposure syntax.
    2.41 + * @brief Provides an alternate method for loading plugins, without needing to 
    2.42 + * 		  include the default headers and all their Half-Life baggage.
    2.43 + */
    2.44 +
    2.45 +/**
    2.46 + * @brief Contains version information.
    2.47 + */
    2.48 +struct MetamodVersionInfo
    2.49 +{
    2.50 +	int api_major;			/**< ISmmAPI major version */
    2.51 +	int api_minor;			/**< ISmmAPI minor version */
    2.52 +	int sh_iface;			/**< SourceHook interface version */
    2.53 +	int sh_impl;			/**< SourceHook implementation version */
    2.54 +	int pl_min;				/**< Plugin API minimum version */
    2.55 +	int pl_max;				/**< Plugin API maximum version */
    2.56 +	int source_engine;		/**< Source Engine version (SOURCE_* constants) */
    2.57 +};
    2.58 +
    2.59 +/**
    2.60 + * @brief Contains information about loading a plugin.
    2.61 + */
    2.62 +struct MetamodLoaderInfo
    2.63 +{
    2.64 +	const char *pl_file;	/**< File path to the plugin being loaded. */
    2.65 +	const char *pl_path;	/**< Folder path containing the plugin. */
    2.66 +};
    2.67 +
    2.68 +/**
    2.69 + * @brief If a function of this type is exposed as "CreateInterface_MMS", then
    2.70 + * Metamod:Source will attempt to call this function before calling 
    2.71 + * CreateInterface.  If this function returns a valid ISmmPlugin pointer, then 
    2.72 + * CreateInterface will not be called.
    2.73 + *
    2.74 + * This is useful for implementing a mini-loader plugin for multiple versions.
    2.75 + *
    2.76 + * @param mvi				MetamodVersionInfo structure.
    2.77 + * @param mli				MetamodLoaderInfo structure.
    2.78 + * @return					ISmmAPI pointer, or NULL if none.
    2.79 + */
    2.80 +typedef SourceMM::ISmmAPI *(*METAMOD_FN_LOAD)(const MetamodVersionInfo *mvi, 
    2.81 +											  const MetamodLoaderInfo *mli);
    2.82 +
    2.83 +/**
    2.84 + * @brief If a function of this type is exposed as "UnloadInterface_MMS", then
    2.85 + * Metamod:Source will attempt to call this function after calling 
    2.86 + * ISmmAPI::Unload(), and before closing the library.  This lets loader plugins 
    2.87 + * clean up before exiting.
    2.88 + */
    2.89 +typedef void (*METAMOD_FN_UNLOAD)();
    2.90 +
    2.91 +#endif //INCLUDE_METAMOD_SOURCE_PLUGIN_EXT_H_
    2.92 +