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>
31 * increase api_major when API breaks
32 * increase api_minor when new functions are added (non-breaking)
34 #define SOURCEMM_VERSION "1.4"
35 #define SOURCEMM_DATE __DATE__
36 #define SM_VERS_API_MAJOR 1 //increase this on a breaking change
37 #define SM_VERS_API_MINOR 5 //increase this on a non-breaking API change
39 //We need a good CServerGameDLL version to work properly. We support these inclusively.
40 #define MIN_GAMEDLL_VERSION 3
41 #define MAX_GAMEDLL_VERSION 8
44 * @brief Entry point for HL2 Engine
46 SMM_API void *CreateInterface(const char *name, int *code);
48 /** @brief Wrapper to catch GameDLL calls */
49 void *EngineFactory(const char *name, int *code);
51 /** @brief Wrapper to catch GameDLL calls */
52 void *PhysicsFactory(const char *name, int *code);
54 /** @brief Wrapper to catch GameDLL calls */
55 void *FileSystemFactory(const char *name, int *code);
57 /** @brief Loads all plugins found in a file */
58 int LoadPluginsFromFile(const char *file);
60 /** @brief Logs a message to the standard log file */
61 void LogMessage(const char *msg, ...);
63 /** @brief Stores information about the GameDLL */
68 CreateInterfaceFn factory;
69 IServerGameDLL *pGameDLL;
70 IServerGameClients *pGameClients;
73 /** @brief Stores information about the HL2 Engine pointers */
76 EngineInfo() : loaded(false),
77 engineFactory(NULL), physicsFactory(NULL), fileSystemFactory(NULL),
78 pGlobals(NULL), icvar(NULL), engine(NULL)
81 CreateInterfaceFn engineFactory;
82 CreateInterfaceFn physicsFactory;
83 CreateInterfaceFn fileSystemFactory;
84 CGlobalVars *pGlobals;
86 IVEngineServer *engine;
89 /** @brief Global variable for GameDLL info */
90 extern GameDllInfo g_GameDll;
92 /** @brief Global variable for Engine info */
93 extern EngineInfo g_Engine;
95 /** @brief Global singleton for SourceHook */
96 extern SourceHook::CSourceHookImpl g_SourceHook;
98 /** @brief Mod path (important!)*/
99 extern SourceHook::String g_ModPath;
101 /** @brief Path to server binary */
102 extern SourceHook::String g_BinPath;
104 /** @brief Global variable for SourceHook macros */
105 extern SourceHook::ISourceHook *g_SHPtr;
107 /** @brief We have our own internal plugin id... */
108 extern PluginId g_PLID;
110 /** @brief ServerGameDLL version that is currently loaded */
111 extern int g_GameDllVersion;
113 extern bool bGameInit;
115 #endif //_INCLUDE_SOURCEMM_H