ISource2ModGameConfig

Interface for accessing game configuration (gamedata).

Provides access to external configuration data used for:

  • Signature scanning
  • Symbol resolution
  • Memory patching
  • Offset lookup
Typically backed by external config files (JSON, KV, etc.).

Interface for accessing game configuration entries.

Interface id ISource2ModGameConfig002 (SOURCE2MOD_GAMECONFIG_INTERFACE) · Global g_pSource2ModGameConfig · Header source2mod/ISource2ModGameConfig.h

Methods

GetLibrary

virtual const char* GetLibrary(const char* pchName) = 0;

Gets library/module name.

ParameterTypeDescription
pchNameconst char*Config entry name

Returns const char* — Library name

GetSignature

virtual const char* GetSignature(const char* pchName) = 0;

Gets signature (pattern).

ParameterTypeDescription
pchNameconst char*Config entry name

Returns const char* — Pattern string

GetSymbol

virtual const char* GetSymbol(const char* pchName) = 0;

Gets symbol name.

ParameterTypeDescription
pchNameconst char*Config entry name

Returns const char* — Symbol string

GetPatch

virtual const char* GetPatch(const char* pchName) = 0;

Gets patch definition.

ParameterTypeDescription
pchNameconst char*Config entry name

Returns const char* — Patch data

GetOffset

virtual int GetOffset(const char* pchName) = 0;

Gets integer offset.

ParameterTypeDescription
pchNameconst char*Config entry name

Returns int — Offset value

IsSymbol

virtual bool IsSymbol(const char* pchName) = 0;

Whether the entry is a symbol name rather than a byte pattern.

Symbol entries are written into the signature field with a leading "@".

ParameterType
pchNameconst char*

ResolveSignature

virtual ISource2ModMemory ResolveSignature(const char* pchName) = 0;

Resolves a gamedata entry to an address.

Looks the entry's "library" up among the loaded modules -- engine2, server, vscript, tier0 -- then finds it by exported symbol when the entry is "@"-prefixed, or by pattern scan otherwise. Saves a plugin repeating the module lookup and the symbol/pattern branch for every signature.

ParameterTypeDescription
pchNameconst char*Gamedata entry name.

Returns ISource2ModMemory — The address, or a null ISource2ModMemory when the module, symbol or pattern is missing. Converts to void* on its own; use RCast<T>() for a typed function pointer.

Macros

MacroExpands to
GAMECONFIG_LIBRARY(name)g_pSource2ModGameConfig->GetLibrary(name)
GAMECONFIG_SIGNATURE(name)g_pSource2ModGameConfig->GetSignature(name)
GAMECONFIG_SYMBOL(name)g_pSource2ModGameConfig->GetSymbol(name)
GAMECONFIG_PATCH(name)g_pSource2ModGameConfig->GetPatch(name)
GAMECONFIG_OFFSET(name)g_pSource2ModGameConfig->GetOffset(name)
GAMECONFIG_RESOLVE(name)g_pSource2ModGameConfig->ResolveSignature(name)

On this page