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_CGAMECONFIGS_H_
16 #define _INCLUDE_SOURCEMOD_CGAMECONFIGS_H_
18 #include <IGameConfigs.h>
19 #include <ITextParsers.h>
22 #include "sm_globals.h"
23 #include "sm_memtable.h"
25 using namespace SourceMod;
26 using namespace SourceHook;
31 public ITextListener_SMC,
34 friend class GameConfigManager;
36 CGameConfig(const char *file);
39 bool Reparse(char *error, size_t maxlength);
40 public: //ITextListener_SMC
41 SMCParseResult ReadSMC_NewSection(const char *name, bool opt_quotes);
42 SMCParseResult ReadSMC_KeyValue(const char *key, const char *value, bool key_quotes, bool value_quotes);
43 SMCParseResult ReadSMC_LeavingSection();
45 const char *GetKeyValue(const char *key);
46 bool GetOffset(const char *key, int *value);
47 SendProp *GetSendProp(const char *key);
48 bool GetMemSig(const char *key, void **addr);
51 unsigned int DecRefCount();
53 BaseStringTable *m_pStrings;
59 unsigned int m_RefCount;
62 unsigned int m_IgnoreLevel;
67 bool bShouldBeReadingDefault;
70 class GameConfigManager :
71 public IGameConfigManager,
77 public: //IGameConfigManager
78 bool LoadGameConfigFile(const char *file, IGameConfig **pConfig, char *error, size_t maxlength);
79 void CloseGameConfigFile(IGameConfig *cfg);
80 IGameConfig *ReadHandle(Handle_t hndl,
81 IdentityToken_t *ident,
83 public: //SMGlobalClass
84 void OnSourceModStartup(bool late);
85 void OnSourceModAllInitialized();
86 void OnSourceModAllShutdown();
88 List<CGameConfig *> m_cfgs;
92 extern GameConfigManager g_GameConfigs;
93 extern IGameConfig *g_pGameConf;
95 #endif //_INCLUDE_SOURCEMOD_CGAMECONFIGS_H_