Deprecated Acquire/ReleaseLock from IGameConfigManager, use thread pump in updater.
3 * =============================================================================
5 * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
6 * =============================================================================
8 * This program is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, version 3.0, as published by the
10 * Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU General Public License along with
18 * this program. If not, see <http://www.gnu.org/licenses/>.
20 * As a special exception, AlliedModders LLC gives you permission to link the
21 * code of this program (as well as its derivative works) to "Half-Life 2," the
22 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
23 * by the Valve Corporation. You must obey the GNU General Public License in
24 * all respects for all other code used. Additionally, AlliedModders LLC grants
25 * this exception to all derivative works. AlliedModders LLC defines further
26 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
27 * or <http://www.sourcemod.net/license.php>.
32 #ifndef _INCLUDE_SOURCEMOD_GAMECONFIG_SYSTEM_H_
33 #define _INCLUDE_SOURCEMOD_GAMECONFIG_SYSTEM_H_
35 #include <IShareSys.h>
36 #include <IHandleSys.h>
37 #include <ITextParsers.h>
40 * @file IGameConfigs.h
41 * @brief Abstracts game private data configuration.
44 #define SMINTERFACE_GAMECONFIG_NAME "IGameConfigManager"
45 #define SMINTERFACE_GAMECONFIG_VERSION 5
52 * @brief Describes a game private data config file
58 * @brief Returns an offset value.
60 * @param key Key to retrieve from the offset section.
61 * @param value Pointer to store the offset value in.
62 * @return True if found, false otherwise.
64 virtual bool GetOffset(const char *key, int *value) =0;
67 * @brief Returns information about a dynamic offset.
69 * @param key Key to retrieve from the property section.
70 * @return A SendProp pointer, or NULL if not found.
72 virtual SendProp *GetSendProp(const char *key) =0;
75 * @brief Returns the value of a key from the "Keys" section.
77 * @param key Key to retrieve from the Keys section.
78 * @return String containing the value, or NULL if not found.
80 virtual const char *GetKeyValue(const char *key) =0;
83 * @brief Retrieves a cached memory signature.
85 * @param key Name of the signature.
86 * @param addr Pointer to store the memory address in.
87 * @return True if the key was found, false otherwise.
88 * Note that true is a valid return even if the
91 virtual bool GetMemSig(const char *key, void **addr) =0;
95 * @brief Manages game config files
97 class IGameConfigManager : public SMInterface
100 const char *GetInterfaceName()
102 return SMINTERFACE_GAMECONFIG_NAME;
104 unsigned int GetInterfaceVersion()
106 return SMINTERFACE_GAMECONFIG_VERSION;
110 * @brief Loads or finds an already loaded game config file.
112 * @param file File to load. The path must be relative to the
113 * 'gamedata' folder and the extension should be
115 * @param pConfig Pointer to store the game config pointer. Pointer
116 * will be valid even on failure.
117 * @param error Optional error message buffer.
118 * @param maxlength Maximum length of the error buffer.
119 * @return True on success, false if the file failed.
121 virtual bool LoadGameConfigFile(const char *file,
122 IGameConfig **pConfig,
124 size_t maxlength) =0;
127 * @brief Closes an IGameConfig pointer. Since a file can be loaded
128 * more than once, the file will not actually be removed from memory
129 * until it is closed once for each call to LoadGameConfigfile().
131 * @param cfg Pointer to the IGameConfig to close.
133 virtual void CloseGameConfigFile(IGameConfig *cfg) =0;
136 * @brief Reads an GameConfig Handle.
138 * @param hndl Handle to read.
139 * @param ident Identity of the owner (can be NULL).
140 * @param err Optional error buffer.
141 * @return IGameConfig pointer on success, NULL otherwise.
143 virtual IGameConfig *ReadHandle(Handle_t hndl,
144 IdentityToken_t *ident,
145 HandleError *err) =0;
148 * @brief Adds a custom gamedata section hook.
150 * @param sectionname Section name to hook.
151 * @param listener Listener callback.
154 virtual void AddUserConfigHook(const char *sectionname, ITextListener_SMC *listener) =0;
157 * @brief Removes a custom gamedata section hook.
159 * @param sectionname Section name to unhook.
160 * @param listener Listener callback.
163 virtual void RemoveUserConfigHook(const char *sectionname, ITextListener_SMC *listener) =0;
166 * @brief Does nothing.
168 virtual void AcquireLock() = 0;
171 * @brief Does nothing.
173 virtual void ReleaseLock() = 0;
177 #endif //_INCLUDE_SOURCEMOD_GAMECONFIG_SYSTEM_H_