Triggering build.
2 * vim: set ts=4 sw=4 tw=99 noet :
3 * ======================================================
5 * Copyright (C) 2004-2010 AlliedModders LLC and authors.
7 * ======================================================
9 * This software is provided 'as-is', without any express or implied warranty.
10 * In no event will the authors be held liable for any damages arising from
11 * the use of this software.
13 * Permission is granted to anyone to use this software for any purpose,
14 * including commercial applications, and to alter it and redistribute it
15 * freely, subject to the following restrictions:
17 * 1. The origin of this software must not be misrepresented; you must not
18 * claim that you wrote the original software. If you use this software in a
19 * product, an acknowledgment in the product documentation would be
20 * appreciated but is not required.
21 * 2. Altered source versions must be plainly marked as such, and must not be
22 * misrepresented as being the original software.
23 * 3. This notice may not be removed or altered from any source distribution.
26 #ifndef _INCLUDE_SOURCEMM_H
27 #define _INCLUDE_SOURCEMM_H
30 * @brief SourceMM main functionality for GameDLL interception
35 #include <interface.h>
37 #include <sourcehook/sourcehook_impl.h>
38 #include <sourcehook/sourcehook_hookmangen.h>
39 #include <sourcehook/sourcehook.h>
40 #include <ISmmPlugin.h>
41 #include "metamod_provider.h"
42 #include <metamod_version.h>
44 using namespace SourceMM;
48 * increase api_major when API breaks
49 * increase api_minor when new functions are added (non-breaking)
51 #define SOURCEMM_VERSION SVN_FILE_VERSION_STRING
52 #define SOURCEMM_DATE __DATE__
53 #define METAMOD_API_MAJOR 2 /* increase this on a breaking change */
54 #define METAMOD_API_MINOR 0 /* increase this on a non-breaking API change */
56 class MetamodSource : public ISmmAPI
59 void LogMsg(ISmmPlugin *pl, const char *msg, ...);
60 CreateInterfaceFn GetEngineFactory(bool syn=true);
61 CreateInterfaceFn GetPhysicsFactory(bool syn=true);
62 CreateInterfaceFn GetFileSystemFactory(bool syn=true);
63 CreateInterfaceFn GetServerFactory(bool syn=true);
64 CGlobalVars *GetCGlobals();
65 void SetLastMetaReturn(META_RES res);
66 META_RES GetLastMetaReturn();
67 IConCommandBaseAccessor *GetCvarBaseAccessor();
68 bool RegisterConCommandBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
69 void UnregisterConCommandBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
70 void ConPrint(const char *str);
71 void ConPrintf(const char *fmt, ...);
72 bool RemotePrintingAvailable();
73 void GetApiVersions(int &major, int &minor, int &plvers, int &plmin);
74 void GetShVersions(int &shvers, int &shimpl);
75 void AddListener(ISmmPlugin *plugin, IMetamodListener *pListener);
76 void *MetaFactory(const char *iface, int *ret, PluginId *id);
77 int FormatIface(char iface[], unsigned int maxlength);
78 void *InterfaceSearch(CreateInterfaceFn fn, const char *iface, int max, int *ret);
79 const char *GetBaseDir();
80 size_t PathFormat(char *buffer, size_t len, const char *fmt, ...);
81 void ClientConPrintf(edict_t *client, const char *fmt, ...);
82 void *VInterfaceMatch(CreateInterfaceFn fn, const char *iface, int min=-1);
83 void EnableVSPListener();
84 int GetGameDLLVersion();
85 int GetUserMessageCount();
86 int FindUserMessage(const char *name, int *size=NULL);
87 const char *GetUserMessage(int index, int *size=NULL);
89 int GetSourceEngineBuild();
90 IServerPluginCallbacks *GetVSPInfo(int *pVersion);
91 size_t Format(char *buffer, size_t maxlength, const char *format, ...);
92 size_t FormatArgs(char *buffer, size_t maxlength, const char *format, va_list ap);
94 bool IsLoadedAsGameDLL();
95 const char *GetGameBinaryPath();
96 const char *GetPluginsFile();
97 const char *GetVDFDir();
98 void UnregisterConCommandBase(PluginId id, ConCommandBase *pCommand);
99 void NotifyVSPListening(IServerPluginCallbacks *callbacks, int version);
100 void SetGameDLLInfo(CreateInterfaceFn serverFactory, int version, bool loaded);
101 void SetVSPListener(const char *path);
102 size_t GetFullPluginPath(const char *plugin, char *buffer, size_t len);
106 mm_DetectGameInformation();
109 mm_LogMessage(const char *msg, ...);
112 mm_LoadPlugins(const char *filepath, const char *vdfpath);
115 mm_InitializeForLoad();
118 mm_InitializeGlobals(CreateInterfaceFn engineFactory,
119 CreateInterfaceFn physicsFactory,
120 CreateInterfaceFn filesystemFactory,
121 CGlobalVars *pGlobals);
123 mm_StartupMetamod(bool is_vsp_load);
132 mm_IsVspLoadComplete();
134 extern MetamodSource g_Metamod;
135 extern SourceHook::Impl::CSourceHookImpl g_SourceHook;
137 #endif //_INCLUDE_SOURCEMM_H