32 #ifndef _INCLUDE_SOURCEMOD_MODULE_INTERFACE_H_
33 #define _INCLUDE_SOURCEMOD_MODULE_INTERFACE_H_
47 class IExtensionInterface;
48 typedef void * ITERATOR;
118 virtual bool IsRunning(
char *error,
size_t maxlength) =0;
140 #define SMINTERFACE_EXTENSIONAPI_VERSION 8
343 #define SOURCEMOD_INTERFACE_EXTENSIONS "SM_ExtensionManager"
356 #define SOURCEMOD_NOTICE_EXTENSIONS "SM_ExtensionsAttachable"
358 #define SMINTERFACE_EXTENSIONMANAGER_NAME "IExtensionManager"
359 #define SMINTERFACE_EXTENSIONMANAGER_VERSION 2
369 return SMINTERFACE_EXTENSIONMANAGER_NAME;
373 return SMINTERFACE_EXTENSIONMANAGER_VERSION;
397 size_t maxlength) =0;
424 const char *filepath,
425 const char *filename,
427 size_t maxlength) =0;
439 #define SM_IFACEPAIR(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION
441 #define SM_FIND_IFACE_OR_FAIL(prefix, variable, errbuf, errsize) \
442 if (!sharesys->RequestInterface(SM_IFACEPAIR(prefix), myself, (SMInterface **)&variable)) \
446 size_t len = snprintf(errbuf, \
448 "Could not find interface: %s (version: %d)", \
449 SM_IFACEPAIR(prefix)); \
450 if (len >= errsize) \
452 errbuf[errsize - 1] = '\0'; \
458 #define SM_FIND_IFACE(prefix, variable) \
459 sharesys->RequestInterface(SM_IFACEPAIR(prefix), myself, (SMInterface **)&variable);
462 #endif //_INCLUDE_SOURCEMOD_MODULE_INTERFACE_H_
virtual void OnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax)
Called on server activation before plugins receive the OnServerLoad forward.
Definition: IExtensionSys.h:315
virtual const char * GetExtensionName()=0
Must return a string containing the extension's short name.
The interface an extension must expose.
Definition: IExtensionSys.h:145
virtual bool IsVersionCompatible(unsigned int version)
Must return whether the requested version number is backwards compatible. Note: This can be overridde...
Definition: IExtensionSys.h:375
virtual void OnExtensionsAllLoaded()=0
Called when all extensions are loaded (loading cycle is done). If loaded late, this will be called ri...
virtual const char * GetExtensionURL()=0
Must return a string containing the extension's URL.
virtual const char * GetInterfaceName()
Must return a string defining the interface's unique name.
Definition: IExtensionSys.h:367
virtual void OnExtensionUnload()=0
Called when the extension is about to be unloaded.
virtual bool UnloadExtension(IExtension *pExt)=0
Attempts to unload an extension. External extensions must call this before unloading.
virtual const char * GetFilename()=0
Returns the filename of the extension, relative to the extension folder. If the extension is an "exte...
virtual const char * GetExtensionVerString()=0
Must return a string containing version information.
virtual unsigned int GetInterfaceVersion()
Must return an integer defining the interface's version.
Definition: IExtensionSys.h:371
virtual bool QueryInterfaceDrop(SMInterface *pInterface)
Asks the extension whether it's safe to remove an external interface it's using. If it's not safe...
Definition: IExtensionSys.h:204
virtual const char * GetExtensionDescription()=0
Must return a string containing description text.
Tracks dependencies and fires dependency listeners.
Definition: IShareSys.h:126
virtual unsigned int GetExtensionVersion()
Definition: IExtensionSys.h:149
Defines the Share System, responsible for shared resources and dependencies.
virtual bool IsLoaded()=0
Returns whether or not the extension is properly loaded.
virtual bool IsExternal()=0
Returns whether the extension is local (from the extensions folder), or is from an external source (s...
virtual void NotifyInterfaceDrop(SMInterface *pInterface)
Notifies the extension that an external interface it uses is being removed.
Definition: IExtensionSys.h:217
Defines the base functionality required by a shared interface.
Definition: IShareSys.h:92
virtual bool IsRunning(char *error, size_t maxlength)=0
Queries the extension to see its run state.
virtual const char * GetExtensionTag()=0
Must return a string containing a short identifier tag.
virtual void FreeDependencyIterator(ITERATOR *iter)=0
Frees an ITERATOR handle from FindFirstDependency.
virtual bool QueryRunning(char *error, size_t maxlength)
Return false to tell Core that your extension should be considered unusable.
Definition: IExtensionSys.h:228
virtual const char * GetExtensionAuthor()=0
Must return a string containing a short author identifier.
virtual IExtension * LoadExternal(IExtensionInterface *pInterface, const char *filepath, const char *filename, char *error, size_t maxlength)=0
Loads an extension into the extension system, directly, as an external extension. ...
virtual IExtension * LoadExtension(const char *path, char *error, size_t maxlength)=0
Loads a extension into the extension system.
virtual IExtensionInterface * GetAPI()=0
Returns the extension's API interface.
virtual void OnCoreMapEnd()
Called on level shutdown.
Definition: IExtensionSys.h:335
Manages the loading/unloading of extensions.
Definition: IExtensionSys.h:364
virtual const char * GetExtensionDateString()=0
Must return a string containing the compilation date.
virtual bool IsVersionCompatible(unsigned int version)
Must return whether the requested version number is backwards compatible. Note: This can be overridde...
Definition: IShareSys.h:112
Definition: IAdminSystem.h:63
virtual bool FindNextDependency(ITERATOR *iter, IExtension **pOwner, SMInterface **pInterface)=0
Finds the next dependency in the dependency list.
virtual void OnExtensionPauseChange(bool pause)=0
Called when your pause state is about to change.
virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late)=0
Called when the extension is loaded.
Encapsulates an IExtensionInterface and its dependencies.
Definition: IExtensionSys.h:53
virtual ITERATOR * FindFirstDependency(IExtension **pOwner, SMInterface **pInterface)=0
Retrieves the extension dependency list for this extension.
virtual IdentityToken_t * GetIdentity()=0
Returns the extension's identity token.
#define SMINTERFACE_EXTENSIONAPI_VERSION
Version code of the IExtensionInterface API itself.
Definition: IExtensionSys.h:140
Defines platform-dependent operations, such as opening libraries and files.
virtual bool IsMetamodExtension()=0
For extensions loaded through SourceMod, this should return true if the extension needs to attach to ...
virtual void OnDependenciesDropped()
Called once all dependencies have been unloaded. This is called AFTER OnExtensionUnload(), but before the extension library has been unloaded. It can be used as an alternate unload hook for cases where having no dependent plugins would make shutdown much simplier.
Definition: IExtensionSys.h:326