extensions/sdk/smsdk_ext.h
changeset 324 e23aca731e37
parent 323 e12c1cd285e2
child 325 66fa86233688
     1.1 --- a/extensions/sdk/smsdk_ext.h	Fri Jan 19 05:25:43 2007 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,142 +0,0 @@
     1.4 -#ifndef _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
     1.5 -#define _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
     1.6 -
     1.7 -#include "smsdk_config.h"
     1.8 -#include <IExtensionSys.h>
     1.9 -#include <IHandleSys.h>
    1.10 -#include <sp_vm_api.h>
    1.11 -#include <sm_platform.h>
    1.12 -#include <ISourceMod.h>
    1.13 -
    1.14 -#if defined SMEXT_CONF_METAMOD
    1.15 -#include <ISmmPlugin.h>
    1.16 -#include <eiface.h>
    1.17 -#endif
    1.18 -
    1.19 -using namespace SourceMod;
    1.20 -using namespace SourcePawn;
    1.21 -
    1.22 -class SDKExtension : 
    1.23 -#if defined SMEXT_CONF_METAMOD
    1.24 -	public ISmmPlugin,
    1.25 -#endif
    1.26 -	public IExtensionInterface
    1.27 -{
    1.28 -public:
    1.29 -	SDKExtension();
    1.30 -public:
    1.31 -	/**
    1.32 -	 * @brief This is called after the initial loading sequence has been processed.
    1.33 -	 *
    1.34 -	 * @param error		Error message buffer.
    1.35 -	 * @param err_max	Size of error message buffer.
    1.36 -	 * @param late		Whether or not the module was loaded after map load.
    1.37 -	 * @return			True to succeed loading, false to fail.
    1.38 -	 */
    1.39 -	virtual bool SDK_OnLoad(char *error, size_t err_max, bool late);
    1.40 -	
    1.41 -	/**
    1.42 -	 * @brief This is called right before the extension is unloaded.
    1.43 -	 */
    1.44 -	virtual void SDK_OnUnload();
    1.45 -
    1.46 -	/**
    1.47 -	 * @brief This is called once all known extensions have been loaded.
    1.48 -	 */
    1.49 -	virtual void SDK_OnAllLoaded();
    1.50 -
    1.51 -	/**
    1.52 -	 * @brief Called when the pause state is changed.
    1.53 -	 */
    1.54 -	virtual void SDK_OnPauseChange(bool paused);
    1.55 -
    1.56 -#if defined SMEXT_CONF_METAMOD
    1.57 -	/**
    1.58 -	 * @brief Called when Metamod is attached, before the extension version is called.
    1.59 -	 *
    1.60 -	 * @param error			Error buffer.
    1.61 -	 * @param err_max		Maximum size of error buffer.
    1.62 -	 * @param late			Whether or not Metamod considers this a late load.
    1.63 -	 * @return				True to succeed, false to fail.
    1.64 -	 */
    1.65 -	virtual bool SDK_OnMetamodLoad(char *error, size_t err_max, bool late);
    1.66 -
    1.67 -	/**
    1.68 -	 * @brief Called when Metamod is detaching, after the extension version is called.
    1.69 -	 * NOTE: By default this is blocked unless sent from SourceMod.
    1.70 -	 *
    1.71 -	 * @param error			Error buffer.
    1.72 -	 * @param err_max		Maximum size of error buffer.
    1.73 -	 * @return				True to succeed, false to fail.
    1.74 -	 */
    1.75 -	virtual bool SDK_OnMetamodUnload(char *error, size_t err_max);
    1.76 -
    1.77 -	/**
    1.78 -	 * @brief Called when Metamod's pause state is changing.
    1.79 -	 * NOTE: By default this is blocked unless sent from SourceMod.
    1.80 -	 *
    1.81 -	 * @param paused		Pause state being set.
    1.82 -	 * @param error			Error buffer.
    1.83 -	 * @param err_max		Maximum size of error buffer.
    1.84 -	 * @return				True to succeed, false to fail.
    1.85 -	 */
    1.86 -	virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max);
    1.87 -#endif
    1.88 -
    1.89 -public: //IExtensionInterface
    1.90 -	virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t err_max, bool late);
    1.91 -	virtual void OnExtensionUnload();
    1.92 -	virtual void OnExtensionsAllLoaded();
    1.93 -	virtual bool IsMetamodExtension();
    1.94 -	virtual void OnExtensionPauseChange(bool state);
    1.95 -	virtual const char *GetExtensionName();
    1.96 -	virtual const char *GetExtensionURL();
    1.97 -	virtual const char *GetExtensionTag();
    1.98 -	virtual const char *GetExtensionAuthor();
    1.99 -	virtual const char *GetExtensionVerString();
   1.100 -	virtual const char *GetExtensionDescription();
   1.101 -	virtual const char *GetExtensionDateString();
   1.102 -#if defined SMEXT_CONF_METAMOD
   1.103 -public: //ISmmPlugin
   1.104 -	virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlength, bool late);
   1.105 -	virtual const char *GetAuthor();
   1.106 -	virtual const char *GetName();
   1.107 -	virtual const char *GetDescription();
   1.108 -	virtual const char *GetURL();
   1.109 -	virtual const char *GetLicense();
   1.110 -	virtual const char *GetVersion();
   1.111 -	virtual const char *GetDate();
   1.112 -	virtual const char *GetLogTag();
   1.113 -	virtual bool Unload(char *error, size_t maxlen);
   1.114 -	virtual bool Pause(char *error, size_t maxlen);
   1.115 -	virtual bool Unpause(char *error, size_t maxlen);
   1.116 -private:
   1.117 -	bool m_SourceMMLoaded;
   1.118 -	bool m_WeAreUnloaded;
   1.119 -	bool m_WeGotPauseChange;
   1.120 -#endif
   1.121 -};
   1.122 -
   1.123 -extern SDKExtension *g_pExtensionIface;
   1.124 -
   1.125 -extern IShareSys *g_pShareSys;
   1.126 -extern IExtension *myself;
   1.127 -extern IHandleSys *g_pHandleSys;
   1.128 -extern ISourceMod *g_pSM;
   1.129 -
   1.130 -#if defined SMEXT_CONF_METAMOD
   1.131 -PLUGIN_GLOBALVARS();
   1.132 -extern IVEngineServer *engine;
   1.133 -extern IServerGameDLL *gamedll;
   1.134 -#endif
   1.135 -
   1.136 -#define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION
   1.137 -#define SM_GET_IFACE(prefix,addr) \
   1.138 -	if (!g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)) { \
   1.139 -	 if (error) { \
   1.140 -		snprintf(error, err_max, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \
   1.141 -	 } \
   1.142 -	 return false; \
   1.143 -	}
   1.144 -
   1.145 -#endif //_INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_