1 /* ======== SourceMM ========
2 * Copyright (C) 2004-2006 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 * ?what the hell was I smoking when I wrote this
32 * increase api_major when API breaks
33 * increase api_minor when new functions are added (non-breaking)
34 * increase vers_release when bug fix releases are made
35 * never increase major
37 #define SOURCEMM_VERSION "1.3"
38 #define SOURCEMM_DATE __DATE__
39 #define SM_MAJOR_VERSION 1 //never need to increase this
40 #define SM_VERS_API_MAJOR 1 //increase this on a breaking change
41 #define SM_VERS_API_MINOR 4 //increase this on a non-breaking API change
42 #define SM_VERS_RELEASE 4 //increase this on a bug-fix release.
44 //We need a good CServerGameDLL version to work properly. We support these inclusively.
45 #define MIN_GAMEDLL_VERSION 3
46 #define MAX_GAMEDLL_VERSION 5
49 * @brief Entry point for HL2 Engine
51 SMM_API void *CreateInterface(const char *name, int *code);
53 /** @brief Wrapper to catch GameDLL calls */
54 void *EngineFactory(const char *name, int *code);
56 /** @brief Wrapper to catch GameDLL calls */
57 void *PhysicsFactory(const char *name, int *code);
59 /** @brief Wrapper to catch GameDLL calls */
60 void *FileSystemFactory(const char *name, int *code);
62 /** @brief Loads all plugins found in a file */
63 int LoadPluginsFromFile(const char *file);
65 /** @brief Logs a message to the standard log file */
66 void LogMessage(const char *msg, ...);
68 /** @brief Stores information about the GameDLL */
73 CreateInterfaceFn factory;
74 IServerGameDLL *pGameDLL;
75 IServerGameClients *pGameClients;
78 /** @brief Stores information about the HL2 Engine pointers */
81 EngineInfo() : loaded(false),
82 engineFactory(NULL), physicsFactory(NULL), fileSystemFactory(NULL),
83 pGlobals(NULL), icvar(NULL), engine(NULL)
86 CreateInterfaceFn engineFactory;
87 CreateInterfaceFn physicsFactory;
88 CreateInterfaceFn fileSystemFactory;
89 CGlobalVars *pGlobals;
91 IVEngineServer *engine;
94 /** @brief Global variable for GameDLL info */
95 extern GameDllInfo g_GameDll;
97 /** @brief Global variable for Engine info */
98 extern EngineInfo g_Engine;
100 /** @brief Global singleton for SourceHook */
101 extern SourceHook::CSourceHookImpl g_SourceHook;
103 /** @brief Mod path (important!)*/
104 extern SourceHook::String g_ModPath;
106 /** @brief Path to server binary */
107 extern SourceHook::String g_BinPath;
109 /** @brief Global variable for SourceHook macros */
110 extern SourceHook::ISourceHook *g_SHPtr;
112 /** @brief We have our own internal plugin id... */
113 extern PluginId g_PLID;
115 /** @brief ServerGameDLL version that is currently loaded */
116 extern int g_GameDllVersion;
118 #endif //_INCLUDE_SOURCEMM_H