sourcemm/ISmmPluginExt.h
author David Anderson <dvander@alliedmods.net>
Fri Dec 14 14:55:37 2007 +0000 (2007-12-14)
changeset 484 d86328fe5aaf
parent 406 d159cb02b2bb
child 487 ddb0319e82aa
permissions -rw-r--r--
fixed amb1284 - silly bug in client meta handler
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@405
    29
#define _INCLUDE_METAMOD_SOURCE_PLUGIN_EXT_H_
dvander@405
    30
dvander@405
    31
#define SOURCE_ENGINE_UNKNOWN			0				/**< Could not determine the engine version */
dvander@405
    32
#define SOURCE_ENGINE_ORIGINAL			1				/**< Original Source Engine (used by The Ship) */
dvander@405
    33
#define SOURCE_ENGINE_EPISODEONE		2				/**< Episode 1 Source Engine (second major SDK) */
dvander@405
    34
#define SOURCE_ENGINE_ORANGEBOX			3				/**< Orange Box Source Engine (third major SDK) */
dvander@405
    35
dvander@405
    36
#define METAMOD_PLAPI_VERSION			14				/**< Version of this header file */
dvander@405
    37
#define METAMOD_PLAPI_NAME				"ISmmPlugin"	/**< Name of the plugin interface */
dvander@398
    38
dvander@398
    39
namespace SourceMM
dvander@398
    40
{
dvander@400
    41
	class ISmmPlugin;
dvander@398
    42
}
dvander@398
    43
dvander@400
    44
typedef SourceMM::ISmmPlugin METAMOD_PLUGIN;
dvander@400
    45
dvander@398
    46
/**
dvander@398
    47
 * @file ISmmPluginExt.h 	Definitions for extended plugin exposure syntax.
dvander@398
    48
 * @brief Provides an alternate method for loading plugins, without needing to 
dvander@398
    49
 * 		  include the default headers and all their Half-Life baggage.
dvander@398
    50
 */
dvander@398
    51
dvander@398
    52
/**
dvander@398
    53
 * @brief Contains version information.
dvander@398
    54
 */
dvander@398
    55
struct MetamodVersionInfo
dvander@398
    56
{
dvander@398
    57
	int api_major;			/**< ISmmAPI major version */
dvander@398
    58
	int api_minor;			/**< ISmmAPI minor version */
dvander@398
    59
	int sh_iface;			/**< SourceHook interface version */
dvander@398
    60
	int sh_impl;			/**< SourceHook implementation version */
dvander@398
    61
	int pl_min;				/**< Plugin API minimum version */
dvander@398
    62
	int pl_max;				/**< Plugin API maximum version */
dvander@398
    63
	int source_engine;		/**< Source Engine version (SOURCE_* constants) */
dvander@398
    64
};
dvander@398
    65
dvander@398
    66
/**
dvander@398
    67
 * @brief Contains information about loading a plugin.
dvander@398
    68
 */
dvander@398
    69
struct MetamodLoaderInfo
dvander@398
    70
{
dvander@398
    71
	const char *pl_file;	/**< File path to the plugin being loaded. */
dvander@398
    72
	const char *pl_path;	/**< Folder path containing the plugin. */
dvander@398
    73
};
dvander@398
    74
dvander@398
    75
/**
dvander@398
    76
 * @brief If a function of this type is exposed as "CreateInterface_MMS", then
dvander@398
    77
 * Metamod:Source will attempt to call this function before calling 
dvander@398
    78
 * CreateInterface.  If this function returns a valid ISmmPlugin pointer, then 
dvander@398
    79
 * CreateInterface will not be called.
dvander@398
    80
 *
dvander@398
    81
 * This is useful for implementing a mini-loader plugin for multiple versions.
dvander@398
    82
 *
dvander@398
    83
 * @param mvi				MetamodVersionInfo structure.
dvander@398
    84
 * @param mli				MetamodLoaderInfo structure.
dvander@398
    85
 * @return					ISmmAPI pointer, or NULL if none.
dvander@398
    86
 */
dvander@400
    87
typedef METAMOD_PLUGIN *(*METAMOD_FN_LOAD)(const MetamodVersionInfo *mvi, 
dvander@400
    88
										   const MetamodLoaderInfo *mli);
dvander@398
    89
dvander@398
    90
/**
dvander@398
    91
 * @brief If a function of this type is exposed as "UnloadInterface_MMS", then
dvander@398
    92
 * Metamod:Source will attempt to call this function after calling 
dvander@398
    93
 * ISmmAPI::Unload(), and before closing the library.  This lets loader plugins 
dvander@398
    94
 * clean up before exiting.
dvander@400
    95
 *
dvander@400
    96
 * Note: This function will be ignored unless CreateInterfce_MMS was exposed.
dvander@400
    97
 * It may be called even if ISmmAPI::Unload() could not be called.
dvander@398
    98
 */
dvander@398
    99
typedef void (*METAMOD_FN_UNLOAD)();
dvander@398
   100
dvander@406
   101
/**
dvander@406
   102
 * @brief Original type of load function.  CreateInterfaceFn from Valve.
dvander@406
   103
 * 
dvander@406
   104
 * Plugins will expose this as "CreateInterface".
dvander@406
   105
 */
dvander@406
   106
typedef void *(*METAMOD_FN_ORIG_LOAD)(const char *, int *);
dvander@406
   107
dvander@398
   108
#endif //INCLUDE_METAMOD_SOURCE_PLUGIN_EXT_H_
dvander@398
   109