Gameconfig: Add game configs natives

This commit is contained in:
Arkshine
2015-06-24 17:45:12 +02:00
parent 14513e6f70
commit f38c726faf
18 changed files with 481 additions and 30 deletions

View File

@ -32,6 +32,8 @@
#ifndef _INCLUDE_SOURCEMOD_TEXTPARSERS_INTERFACE_H_
#define _INCLUDE_SOURCEMOD_TEXTPARSERS_INTERFACE_H_
#include <string.h> // size_t
/**
* @file ITextParsers.h
* @brief Defines various text/file parsing functions, as well as UTF-8 support code.

View File

@ -644,7 +644,7 @@ bool MemoryUtils::GetLibraryOfAddress(const void *libPtr, char *buffer, size_t m
return false;
}
const char *dllpath = info.dli_fname;
UTIL_Format(buffer, maxlength, "%s", dllpath);
Format(buffer, maxlength, "%s", dllpath);
if (base)
{
*base = (uintptr_t)info.dli_fbase;
@ -708,4 +708,20 @@ size_t MemoryUtils::DecodeHexString(unsigned char *buffer, size_t maxlength, con
}
return written;
}
size_t MemoryUtils::Format(char *buffer, size_t maxlength, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
size_t len = vsnprintf(buffer, maxlength, fmt, ap);
va_end(ap);
if (len >= maxlength)
{
buffer[maxlength - 1] = '\0';
return (maxlength - 1);
}
return len;
}

View File

@ -80,6 +80,7 @@ class MemoryUtils
public:
size_t DecodeHexString(unsigned char *buffer, size_t maxlength, const char *hexstr);
size_t Format(char *buffer, size_t maxlength, const char *fmt, ...);
#if defined(__linux__) || defined(__APPLE__)
private:

View File

@ -2377,7 +2377,7 @@ const char * MF_GetLocalInfo (const char *name, const char *def) { }
int MF_AmxReRegister (AMX *amx, AMX_NATIVE_INFO *list, int number) { return 0; }
void * MF_RegisterFunctionEx (void *pfn, const char *description) { }
void * MF_MessageBlock (int mode, int msg, int *opt) { }
IGameConfigManager* MF_MessageBlock () { }
IGameConfigManager* MF_GetConfigManager (void) { }
#endif // MAY_NEVER_BE_DEFINED
#define MF_AddNatives g_fn_AddNatives