sourcemm/ISmmPluginExt.h
author David Anderson <dvander@alliedmods.net>
Mon Oct 08 20:47:11 2007 +0000 (2007-10-08)
changeset 403 bba208c59b0d
parent 400 beabd7f601c2
child 405 4699669af081
permissions -rw-r--r--
makefiles now link to proper srcds (rm -f are not actually needed)
dvander@398
     1
/**
dvander@398
     2
 * vim: set ts=4 :
dvander@398
     3
 * ======================================================
dvander@398
     4
 * Metamod:Source
dvander@398
     5
 * Copyright (C) 2004-2007 AlliedModders LLC and authors.
dvander@398
     6
 * All rights reserved.
dvander@398
     7
 * ======================================================
dvander@398
     8
 *
dvander@398
     9
 * This software is provided 'as-is', without any express or implied warranty.
dvander@398
    10
 * In no event will the authors be held liable for any damages arising from 
dvander@398
    11
 * the use of this software.
dvander@398
    12
 * 
dvander@398
    13
 * Permission is granted to anyone to use this software for any purpose, 
dvander@398
    14
 * including commercial applications, and to alter it and redistribute it 
dvander@398
    15
 * freely, subject to the following restrictions:
dvander@398
    16
 *
dvander@398
    17
 * 1. The origin of this software must not be misrepresented; you must not 
dvander@398
    18
 * claim that you wrote the original software. If you use this software in a 
dvander@398
    19
 * product, an acknowledgment in the product documentation would be 
dvander@398
    20
 * appreciated but is not required.
dvander@398
    21
 * 2. Altered source versions must be plainly marked as such, and must not be
dvander@398
    22
 * misrepresented as being the original software.
dvander@398
    23
 * 3. This notice may not be removed or altered from any source distribution.
dvander@398
    24
 *
dvander@398
    25
 * Version: $Id$
dvander@398
    26
 */
dvander@398
    27
dvander@398
    28
#ifndef _INCLUDE_METAMOD_SOURCE_PLUGIN_EXT_H_
dvander@398
    29
#define _INCLUDE_METAMOD_SOUrCE_PLUGIN_EXT_H_
dvander@398
    30
dvander@398
    31
namespace SourceMM
dvander@398
    32
{
dvander@400
    33
	class ISmmPlugin;
dvander@398
    34
}
dvander@398
    35
dvander@400
    36
typedef SourceMM::ISmmPlugin METAMOD_PLUGIN;
dvander@400
    37
dvander@398
    38
/**
dvander@398
    39
 * @file ISmmPluginExt.h 	Definitions for extended plugin exposure syntax.
dvander@398
    40
 * @brief Provides an alternate method for loading plugins, without needing to 
dvander@398
    41
 * 		  include the default headers and all their Half-Life baggage.
dvander@398
    42
 */
dvander@398
    43
dvander@398
    44
/**
dvander@398
    45
 * @brief Contains version information.
dvander@398
    46
 */
dvander@398
    47
struct MetamodVersionInfo
dvander@398
    48
{
dvander@398
    49
	int api_major;			/**< ISmmAPI major version */
dvander@398
    50
	int api_minor;			/**< ISmmAPI minor version */
dvander@398
    51
	int sh_iface;			/**< SourceHook interface version */
dvander@398
    52
	int sh_impl;			/**< SourceHook implementation version */
dvander@398
    53
	int pl_min;				/**< Plugin API minimum version */
dvander@398
    54
	int pl_max;				/**< Plugin API maximum version */
dvander@398
    55
	int source_engine;		/**< Source Engine version (SOURCE_* constants) */
dvander@398
    56
};
dvander@398
    57
dvander@398
    58
/**
dvander@398
    59
 * @brief Contains information about loading a plugin.
dvander@398
    60
 */
dvander@398
    61
struct MetamodLoaderInfo
dvander@398
    62
{
dvander@398
    63
	const char *pl_file;	/**< File path to the plugin being loaded. */
dvander@398
    64
	const char *pl_path;	/**< Folder path containing the plugin. */
dvander@398
    65
};
dvander@398
    66
dvander@398
    67
/**
dvander@398
    68
 * @brief If a function of this type is exposed as "CreateInterface_MMS", then
dvander@398
    69
 * Metamod:Source will attempt to call this function before calling 
dvander@398
    70
 * CreateInterface.  If this function returns a valid ISmmPlugin pointer, then 
dvander@398
    71
 * CreateInterface will not be called.
dvander@398
    72
 *
dvander@398
    73
 * This is useful for implementing a mini-loader plugin for multiple versions.
dvander@398
    74
 *
dvander@398
    75
 * @param mvi				MetamodVersionInfo structure.
dvander@398
    76
 * @param mli				MetamodLoaderInfo structure.
dvander@398
    77
 * @return					ISmmAPI pointer, or NULL if none.
dvander@398
    78
 */
dvander@400
    79
typedef METAMOD_PLUGIN *(*METAMOD_FN_LOAD)(const MetamodVersionInfo *mvi, 
dvander@400
    80
										   const MetamodLoaderInfo *mli);
dvander@398
    81
dvander@398
    82
/**
dvander@398
    83
 * @brief If a function of this type is exposed as "UnloadInterface_MMS", then
dvander@398
    84
 * Metamod:Source will attempt to call this function after calling 
dvander@398
    85
 * ISmmAPI::Unload(), and before closing the library.  This lets loader plugins 
dvander@398
    86
 * clean up before exiting.
dvander@400
    87
 *
dvander@400
    88
 * Note: This function will be ignored unless CreateInterfce_MMS was exposed.
dvander@400
    89
 * It may be called even if ISmmAPI::Unload() could not be called.
dvander@398
    90
 */
dvander@398
    91
typedef void (*METAMOD_FN_UNLOAD)();
dvander@398
    92
dvander@398
    93
#endif //INCLUDE_METAMOD_SOURCE_PLUGIN_EXT_H_
dvander@398
    94