1 /* ======== SourceMM ========
2 * Copyright (C) 2004-2007 Metamod:Source Development Team
3 * No warranties of any kind
7 * Author(s): David "BAILOPAN" Anderson
8 * ============================
11 #ifndef _INCLUDE_SOURCEMM_H
12 #define _INCLUDE_SOURCEMM_H
15 * @brief SourceMM main functionality for GameDLL interception
20 #include <interface.h>
22 #include <sourcehook/sourcehook_impl.h>
23 #include <sourcehook/sourcehook.h>
28 #include "svn_version.h"
32 * increase api_major when API breaks
33 * increase api_minor when new functions are added (non-breaking)
35 #define SOURCEMM_VERSION SVN_FILE_VERSION_STRING
36 #define SOURCEMM_DATE __DATE__
37 #define SM_VERS_API_MAJOR 1 //increase this on a breaking change
38 #define SM_VERS_API_MINOR 5 //increase this on a non-breaking API change
40 //We need a good CServerGameDLL version to work properly. We support these inclusively.
41 #define MIN_GAMEDLL_VERSION 3
42 #define MAX_GAMEDLL_VERSION 8
45 * @brief Entry point for HL2 Engine
47 SMM_API void *CreateInterface(const char *name, int *code);
49 /** @brief Wrapper to catch GameDLL calls */
50 void *EngineFactory(const char *name, int *code);
52 /** @brief Wrapper to catch GameDLL calls */
53 void *PhysicsFactory(const char *name, int *code);
55 /** @brief Wrapper to catch GameDLL calls */
56 void *FileSystemFactory(const char *name, int *code);
58 /** @brief Loads all plugins found in a file */
59 int LoadPluginsFromFile(const char *file);
61 /** @brief Logs a message to the standard log file */
62 void LogMessage(const char *msg, ...);
64 /** @brief Stores information about the GameDLL */
69 CreateInterfaceFn factory;
70 IServerGameDLL *pGameDLL;
71 IServerGameClients *pGameClients;
74 /** @brief Stores information about the HL2 Engine pointers */
77 EngineInfo() : loaded(false),
78 engineFactory(NULL), physicsFactory(NULL), fileSystemFactory(NULL),
79 pGlobals(NULL), icvar(NULL), engine(NULL)
82 CreateInterfaceFn engineFactory;
83 CreateInterfaceFn physicsFactory;
84 CreateInterfaceFn fileSystemFactory;
85 CGlobalVars *pGlobals;
87 IVEngineServer *engine;
90 /** @brief Global variable for GameDLL info */
91 extern GameDllInfo g_GameDll;
93 /** @brief Global variable for Engine info */
94 extern EngineInfo g_Engine;
96 /** @brief Global singleton for SourceHook */
97 extern SourceHook::CSourceHookImpl g_SourceHook;
99 /** @brief Mod path (important!)*/
100 extern SourceHook::String g_ModPath;
102 /** @brief Path to server binary */
103 extern SourceHook::String g_BinPath;
105 /** @brief Global variable for SourceHook macros */
106 extern SourceHook::ISourceHook *g_SHPtr;
108 /** @brief We have our own internal plugin id... */
109 extern PluginId g_PLID;
111 /** @brief ServerGameDLL version that is currently loaded */
112 extern int g_GameDllVersion;
114 extern bool bGameInit;
116 /** @brief Global CallClass for IServerGameDLL */
117 extern SourceHook::CallClass<IServerGameDLL> *g_GameDllPatch;
119 #endif //_INCLUDE_SOURCEMM_H