3 * ===============================================================
4 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
5 * ===============================================================
7 * This file is not open source and may not be copied without explicit
8 * written permission of AlliedModders LLC. This file may not be redistributed
9 * in whole or significant part.
10 * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
15 #ifndef _INCLUDE_SOURCEMOD_GLOBALHEADER_H_
16 #define _INCLUDE_SOURCEMOD_GLOBALHEADER_H_
18 #include "sm_globals.h"
19 #include <ISourceMod.h>
21 #include "CDataPack.h"
23 using namespace SourceHook;
26 * @brief Implements SourceMod's global overall management, API, and logic
37 * @brief Initializes SourceMod, or returns an error on failure.
39 bool InitializeSourceMod(char *error, size_t err_max, bool late);
42 * @brief Starts everything SourceMod needs to run
44 void StartSourceMod(bool late);
47 * @brief Shuts down all SourceMod components
49 void CloseSourceMod();
52 * @brief Map change hook
54 bool LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background);
57 * @brief Level shutdown hook
62 * @brief Returns whether or not a map load is in progress
64 bool IsMapLoading() const;
67 * @brief Stores the global target index.
69 void SetGlobalTarget(unsigned int index);
72 * @brief Returns the global target index.
74 unsigned int GetGlobalTarget() const;
77 * @brief Sets whether if SoureMod needs to check player auths.
79 void SetAuthChecking(bool set);
80 public: // SMGlobalClass
81 CoreConfigErr OnSourceModConfigChanged(const char *option, const char *value);
83 const char *GetModPath() const;
84 const char *GetSourceModPath() const;
85 size_t BuildPath(PathType type, char *buffer, size_t maxlength, char *format, ...);
86 void LogMessage(IExtension *pExt, const char *format, ...);
87 void LogError(IExtension *pExt, const char *format, ...);
88 size_t FormatString(char *buffer, size_t maxlength, IPluginContext *pContext, const cell_t *params, unsigned int param);
89 IDataPack *CreateDataPack();
90 void FreeDataPack(IDataPack *pack);
91 HandleType_t GetDataPackHandleType(bool readonly=false);
94 * @brief Loading plugins
96 void DoGlobalPluginLoads();
99 * @brief GameFrame hook
101 void GameFrame(bool simulating);
103 CStack<CDataPack *> m_freepacks;
104 char m_SMBaseDir[PLATFORM_MAX_PATH];
105 char m_SMRelDir[PLATFORM_MAX_PATH];
107 bool m_ExecPluginReload;
108 unsigned int m_target;
113 extern SourceModBase g_SourceMod;
114 extern HandleType_t g_WrBitBufType;
115 extern HandleType_t g_RdBitBufType;
117 #endif //_INCLUDE_SOURCEMOD_GLOBALHEADER_H_