1.1 --- a/core/GameConfigs.cpp Sat Jun 16 08:35:01 2007 +0000
1.2 +++ b/core/GameConfigs.cpp Sat Jun 16 08:35:26 2007 +0000
1.3 @@ -24,6 +24,7 @@
1.4 #include "ShareSys.h"
1.5 #include "MemoryUtils.h"
1.6 #include "LibrarySys.h"
1.7 +#include "HandleSys.h"
1.8
1.9 #if defined PLATFORM_LINUX
1.10 #include <dlfcn.h>
1.11 @@ -560,3 +561,19 @@
1.12 delete pConfig;
1.13 }
1.14 }
1.15 +
1.16 +extern HandleType_t g_GameConfigsType;
1.17 +
1.18 +IGameConfig *GameConfigManager::ReadHandle(Handle_t hndl, IdentityToken_t *ident, HandleError *err)
1.19 +{
1.20 + HandleSecurity sec(ident, g_pCoreIdent);
1.21 + IGameConfig *conf = NULL;
1.22 + HandleError _err = g_HandleSys.ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&conf);
1.23 +
1.24 + if (err)
1.25 + {
1.26 + *err = _err;
1.27 + }
1.28 +
1.29 + return conf;
1.30 +}
2.1 --- a/core/GameConfigs.h Sat Jun 16 08:35:01 2007 +0000
2.2 +++ b/core/GameConfigs.h Sat Jun 16 08:35:26 2007 +0000
2.3 @@ -76,6 +76,9 @@
2.4 public: //IGameConfigManager
2.5 bool LoadGameConfigFile(const char *file, IGameConfig **pConfig, char *error, size_t maxlength);
2.6 void CloseGameConfigFile(IGameConfig *cfg);
2.7 + IGameConfig *ReadHandle(Handle_t hndl,
2.8 + IdentityToken_t *ident,
2.9 + HandleError *err);
2.10 public: //SMGlobalClass
2.11 void OnSourceModStartup(bool late);
2.12 void OnSourceModAllInitialized();
3.1 --- a/public/IGameConfigs.h Sat Jun 16 08:35:01 2007 +0000
3.2 +++ b/public/IGameConfigs.h Sat Jun 16 08:35:26 2007 +0000
3.3 @@ -20,6 +20,7 @@
3.4 #define _INCLUDE_SOURCEMOD_GAMECONFIG_SYSTEM_H_
3.5
3.6 #include <IShareSys.h>
3.7 +#include <IHandleSys.h>
3.8
3.9 /**
3.10 * @file IGameConfigs.h
3.11 @@ -27,7 +28,7 @@
3.12 */
3.13
3.14 #define SMINTERFACE_GAMECONFIG_NAME "IGameConfigManager"
3.15 -#define SMINTERFACE_GAMECONFIG_VERSION 2
3.16 +#define SMINTERFACE_GAMECONFIG_VERSION 3
3.17
3.18 class SendProp;
3.19
3.20 @@ -69,8 +70,9 @@
3.21 *
3.22 * @param key Name of the signature.
3.23 * @param addr Pointer to store the memory address in.
3.24 - * @return A MemorySignature pointer on success, or NULL
3.25 - * if the key was not found.
3.26 + * @return True if the key was found, false otherwise.
3.27 + * Note that true is a valid return even if the
3.28 + * address is NULL.
3.29 */
3.30 virtual bool GetMemSig(const char *key, void **addr) =0;
3.31 };
3.32 @@ -93,23 +95,40 @@
3.33 /**
3.34 * @brief Loads or finds an already loaded game config file.
3.35 *
3.36 - * @param file File to load. The path must be relative to the 'gamedata'
3.37 - * folder under the config folder, and the extension should be omitted.
3.38 - * @param pConfig Pointer to store the game config pointer. Pointer will be valid even on failure.
3.39 + * @param file File to load. The path must be relative to the
3.40 + * 'gamedata' folder and the extension should be
3.41 + * omitted.
3.42 + * @param pConfig Pointer to store the game config pointer. Pointer
3.43 + * will be valid even on failure.
3.44 * @param error Optional error message buffer.
3.45 * @param maxlength Maximum length of the error buffer.
3.46 * @return True on success, false if the file failed.
3.47 */
3.48 - virtual bool LoadGameConfigFile(const char *file, IGameConfig **pConfig, char *error, size_t maxlength) =0;
3.49 + virtual bool LoadGameConfigFile(const char *file,
3.50 + IGameConfig **pConfig,
3.51 + char *error,
3.52 + size_t maxlength) =0;
3.53
3.54 /**
3.55 - * @brief Closes an IGameConfig pointer. Since a file can be loaded more than once,
3.56 - * the file will not actually be removed from memory until it is closed once for each
3.57 - * call to LoadGameConfigfile().
3.58 + * @brief Closes an IGameConfig pointer. Since a file can be loaded
3.59 + * more than once, the file will not actually be removed from memory
3.60 + * until it is closed once for each call to LoadGameConfigfile().
3.61 *
3.62 * @param cfg Pointer to the IGameConfig to close.
3.63 */
3.64 virtual void CloseGameConfigFile(IGameConfig *cfg) =0;
3.65 +
3.66 + /**
3.67 + * @brief Reads an GameConfig Handle.
3.68 + *
3.69 + * @param hndl Handle to read.
3.70 + * @param ident Identity of the owner (can be NULL).
3.71 + * @param err Optional error buffer.
3.72 + * @return IGameConfig pointer on success, NULL otherwise.
3.73 + */
3.74 + virtual IGameConfig *ReadHandle(Handle_t hndl,
3.75 + IdentityToken_t *ident,
3.76 + HandleError *err) =0;
3.77 };
3.78 }
3.79