SourceMM::ISmmAPI Class Reference

#include <ISmmAPI.h>

List of all members.

Public Member Functions

virtual void LogMsg (ISmmPlugin *pl, const char *msg,...)=0
 Logs a message through the HL2 log system. Note: Newlines are appended automatically.
virtual CreateInterfaceFn GetEngineFactory (bool syn=true)=0
 Returns an interface factory for the HL2 engine.
virtual CreateInterfaceFn GetPhysicsFactory (bool syn=true)=0
 Returns an interface factory for the HL2 physics engine.
virtual CreateInterfaceFn GetFileSystemFactory (bool syn=true)=0
 Returns an interface factory for the HL2 file system.
virtual CreateInterfaceFn GetServerFactory (bool syn=true)=0
 Returns an interface factory for the GameDLL.
virtual CGlobalVars * GetCGlobals ()=0
 Returns a CGlobalVars pointer from the HL2 Engine.
virtual bool RegisterConCommandBase (ISmmPlugin *plugin, ConCommandBase *pCommand)=0
 Registers a ConCommandBase.
virtual void UnregisterConCommandBase (ISmmPlugin *plugin, ConCommandBase *pCommand)=0
 Unregisters a ConCommandBase.
virtual void ConPrint (const char *str)=0
 Prints an unformatted string to the remote server console.
virtual void ConPrintf (const char *fmt,...)=0
 Prints a formatted message to the remote server console.
virtual void GetApiVersions (int &major, int &minor, int &plvers, int &plmin)=0
 Returns the Metamod Version numbers as major version and minor (API) version. Changes to minor version are guaranteed to be backwards compatible. Changes to major version are not.
virtual void GetShVersions (int &shvers, int &shimpl)=0
 Returns sourcehook API version and implementation version.
virtual void AddListener (ISmmPlugin *plugin, IMetamodListener *pListener)=0
 Adds a Metamod listener.
virtual void * MetaFactory (const char *iface, int *ret, PluginId *id)=0
 Queries the metamod factory.
virtual int FormatIface (char iface[], unsigned int maxlength)=0
 Given a base interface name, such as ServerGameDLL or ServerGameDLL003, reformats the string to increase the number, then returns the new number. This is the base function to InterfaceSearch() and VInterfaceMatch().
virtual void * InterfaceSearch (CreateInterfaceFn fn, const char *iface, int max, int *ret)=0
 Searches for an interface, eliminating the need to loop through FormatIface().
virtual const char * GetBaseDir ()=0
 Returns the base directory of the game/server, equivalent to IVEngineServer::GetGameDir(), except the path is absolute.
virtual size_t PathFormat (char *buffer, size_t len, const char *fmt,...)=0
 Formats a file path to the local OS.
virtual void ClientConPrintf (edict_t *client, const char *fmt,...)=0
 Prints text in the specified client's console. Same as IVEngineServer::ClientPrintf except that it allows for string formatting.
virtual void * VInterfaceMatch (CreateInterfaceFn fn, const char *iface, int min=-1)=0
 Wrapper around InterfaceSearch(). Assumes no maximum. This is designed to replace the fact that searches only went upwards. The "V" is intended to convey that this is for Valve formatted interface strings.
virtual void EnableVSPListener ()=0
 Tells SourceMM to add VSP hooking capability to plugins.
virtual int GetGameDLLVersion ()=0
 Returns the interface version of the GameDLL's IServerGameDLL implementation.
virtual int GetUserMessageCount ()=0
 Returns the number of user messages in the GameDLL.
virtual int FindUserMessage (const char *name, int *size=NULL)=0
 Returns the index of the specified user message.
virtual const char * GetUserMessage (int index, int *size=NULL)=0
 Returns the name of the specified user message.
virtual int GetVSPVersion ()=0
 Returns the highest interface version of IServerPluginCallbacks that the engine supports. This is useful for games that run on older versions of the Source engine, such as The Ship.
virtual int GetSourceEngineBuild ()=0
 Returns the engine interface that MM:S is using as a backend.
virtual IServerPluginCallbacks * GetVSPInfo (int *pVersion)=0
 Returns the VSP listener loaded.
virtual size_t Format (char *buffer, size_t maxlength, const char *format,...)=0
 Formats a string. This is a platform safe wrapper around snprintf/_snprintf.
virtual size_t FormatArgs (char *buffer, size_t maxlength, const char *format, va_list ap)=0
 Formats a string. This is a platform safe wrapper around vsnprintf/_vsnprintf.


Detailed Description

The core API that Metamod:Source provides to plugins.

Definition at line 63 of file ISmmAPI.h.


Member Function Documentation

virtual void SourceMM::ISmmAPI::LogMsg ( ISmmPlugin pl,
const char *  msg,
  ... 
) [pure virtual]

Parameters:
pl Plugin API pointer (used for tagging message)
msg Formatted string.

virtual CreateInterfaceFn SourceMM::ISmmAPI::GetEngineFactory ( bool  syn = true  )  [pure virtual]

Parameters:
syn If syn is true, the synthetic wrapper is returned. If syn is false, the true function is returned.
Returns:
CreateInterfaceFn function pointer.

virtual CreateInterfaceFn SourceMM::ISmmAPI::GetPhysicsFactory ( bool  syn = true  )  [pure virtual]

Parameters:
syn If syn is true, the synthetic wrapper is returned. If syn is false, the true function is returned.
Returns:
CreateInterfaceFn function pointer.

virtual CreateInterfaceFn SourceMM::ISmmAPI::GetFileSystemFactory ( bool  syn = true  )  [pure virtual]

Parameters:
syn If syn is true, the synthetic wrapper is returned. If syn is false, the true function is returned.
Returns:
CreateInterfaceFn function pointer.

virtual CreateInterfaceFn SourceMM::ISmmAPI::GetServerFactory ( bool  syn = true  )  [pure virtual]

If syn is false, the true function is returned.

Returns:
CreateInterfaceFn function pointer.

virtual CGlobalVars* SourceMM::ISmmAPI::GetCGlobals (  )  [pure virtual]

Returns:
CGlobalVars pointer.

virtual bool SourceMM::ISmmAPI::RegisterConCommandBase ( ISmmPlugin plugin,
ConCommandBase *  pCommand 
) [pure virtual]

Parameters:
plugin Parent plugin API pointer.
pCommand ConCommandBase to register.
Returns:
True if successful, false otherwise.

virtual void SourceMM::ISmmAPI::UnregisterConCommandBase ( ISmmPlugin plugin,
ConCommandBase *  pCommand 
) [pure virtual]

Parameters:
plugin Parent plugin API pointer.
pCommand ConCommandBase to unlink.

virtual void SourceMM::ISmmAPI::ConPrint ( const char *  str  )  [pure virtual]

Note: Newlines are not added automatically.

Parameters:
str Message string.

virtual void SourceMM::ISmmAPI::ConPrintf ( const char *  fmt,
  ... 
) [pure virtual]

Note: Newlines are not added automatically.

Parameters:
fmt Formatted message.

virtual void SourceMM::ISmmAPI::GetApiVersions ( int &  major,
int &  minor,
int &  plvers,
int &  plmin 
) [pure virtual]

Parameters:
major Filled with the major API version number.
minor Filled with the minor API version number.
plvers Filled with the current plugin API version number.
plmin Filled with the minimum plugin API version number supported.

virtual void SourceMM::ISmmAPI::GetShVersions ( int &  shvers,
int &  shimpl 
) [pure virtual]

Parameters:
shvers Filled with the SourceHook API version number.
shimpl Filled with the SourceHook implementation number.

virtual void SourceMM::ISmmAPI::AddListener ( ISmmPlugin plugin,
IMetamodListener pListener 
) [pure virtual]

Parameters:
plugin Plugin interface pointer.
pListener Listener interface pointer to add.

virtual void* SourceMM::ISmmAPI::MetaFactory ( const char *  iface,
int *  ret,
PluginId *  id 
) [pure virtual]

Parameters:
iface String containing interface name
ret Optional pointer to store return status
id Optional pointer to store id of plugin that overrode interface, 0 if none
Returns:
Returned pointer

virtual int SourceMM::ISmmAPI::FormatIface ( char  iface[],
unsigned int  maxlength 
) [pure virtual]

Parameters:
iface Input/output interface name. Must be writable.
maxlength Maximum length of iface buffer. Must be at least strlen(iface)+4 chars.
Returns:
The newly incremented iface version number.
Deprecated:
Use InterfaceSearch() or VInterfaceMatch instead.

virtual void* SourceMM::ISmmAPI::InterfaceSearch ( CreateInterfaceFn  fn,
const char *  iface,
int  max,
int *  ret 
) [pure virtual]

Parameters:
fn InterfaceFactory function.
iface Interface string name.
max Maximum version to look up.
ret Last return code from interface factory function.
Returns:
Interface pointer, or NULL if not found.

virtual const char* SourceMM::ISmmAPI::GetBaseDir (  )  [pure virtual]

Returns:
Static pointer to game's absolute basedir.

virtual size_t SourceMM::ISmmAPI::PathFormat ( char *  buffer,
size_t  len,
const char *  fmt,
  ... 
) [pure virtual]

Does not include any base directories. Note that all slashes and black slashes are reverted to the local OS's expectancy.

Parameters:
buffer Destination buffer to store path.
len Maximum length of buffer, including null terminator.
fmt Formatted string.
... Arguments in the string.
Returns:
Number of bytes written, not including the null terminator.

virtual void SourceMM::ISmmAPI::ClientConPrintf ( edict_t *  client,
const char *  fmt,
  ... 
) [pure virtual]

Parameters:
client Client edict pointer.
fmt Formatted string to print to the client.

virtual void* SourceMM::ISmmAPI::VInterfaceMatch ( CreateInterfaceFn  fn,
const char *  iface,
int  min = -1 
) [pure virtual]

Parameters:
fn Interface factory function.
iface Interface string.
min Minimum value to search from. If zero, searching begins from the first available version regardless of the interface. Note that this can return interfaces EARLIER than the version specified. A value of -1 (default) specifies the string version as the minimum. Any other value specifices the minimum value to search from.
Returns:
Interface pointer, or NULL if not found.

virtual void SourceMM::ISmmAPI::EnableVSPListener (  )  [pure virtual]

Since this potentially uses more resources than it would otherwise, plugins have to explicitly enable the feature. Whether requested or not, if it is enabled, all plugins will get a pointer to the VSP listener through IMetamodListener. This will not be called more than once for a given plugin; if it is requested more than once, each successive call will only give the pointer to plugins which have not yet received it.

virtual int SourceMM::ISmmAPI::GetGameDLLVersion (  )  [pure virtual]

Returns:
Interface version of the loaded IServerGameDLL.

virtual int SourceMM::ISmmAPI::GetUserMessageCount (  )  [pure virtual]

Returns:
Number of user messages, or -1 if SourceMM has failed to get user message list.

virtual int SourceMM::ISmmAPI::FindUserMessage ( const char *  name,
int *  size = NULL 
) [pure virtual]

Parameters:
name User message name.
size Optional pointer to store size of user message.
Returns:
Message index, or -1 on failure.

virtual const char* SourceMM::ISmmAPI::GetUserMessage ( int  index,
int *  size = NULL 
) [pure virtual]

Parameters:
index User message index.
size Optional pointer to store size of user message.
Returns:
Message name, or NULL on failure.

virtual int SourceMM::ISmmAPI::GetVSPVersion (  )  [pure virtual]

Returns:
Highest interface version of IServerPluginCallbacks. Returns 0 if SourceMM's VSP listener isn't currently enabled.
Deprecated:
Use GetVSPInfo() instead.

virtual int SourceMM::ISmmAPI::GetSourceEngineBuild (  )  [pure virtual]

The values will be one of the SOURCE_ENGINE_* constants from the top of this file.

Returns:
A SOURCE_ENGINE_* constant value.

virtual IServerPluginCallbacks* SourceMM::ISmmAPI::GetVSPInfo ( int *  pVersion  )  [pure virtual]

This is useful for late-loading plugins which need to decide whether to add a listener or not (or need to get the pointer at all).

Parameters:
pVersion Optional pointer to store the VSP version.
Returns:
IServerPluginCallbacks pointer, or NULL if an IMetamodListener event has yet to occur for EnableVSPListener().

virtual size_t SourceMM::ISmmAPI::Format ( char *  buffer,
size_t  maxlength,
const char *  format,
  ... 
) [pure virtual]

Parameters:
buffer Buffer to write to.
maxlength Maximum length of the buffer.
format Format specifiers.
... Format arguments.
Returns:
Number of bytes actually written, not including the null terminator.

virtual size_t SourceMM::ISmmAPI::FormatArgs ( char *  buffer,
size_t  maxlength,
const char *  format,
va_list  ap 
) [pure virtual]

Parameters:
buffer Buffer to write to.
maxlength Maximum length of the buffer.
format Format specifiers.
ap Format argument list.
Returns:
Number of bytes actually written, not including the null terminator.


The documentation for this class was generated from the following file:

Generated on Mon Feb 18 18:10:28 2008 for Metamod:Source by  doxygen 1.5.5