Modules
The modules namespace provides utilities for working with game modules (DLLs), including pattern scanning, interface retrieval, and memory address manipulation.
Class: modules::impl
Represents a loaded game module with utilities for searching and accessing its contents.
namespace modules {
class impl {
public:
impl () = default ;
explicit impl ( const char* mod_name );
address pattern_scan ( const char* sig );
template < class T >
T find_interface ( const char* interface_name );
constexpr HMODULE get_module_handle_safe ( const char* name );
HMODULE module_handle{};
};
}
Constructors
Default Constructor
Creates an empty module object.
Parameterized Constructor
explicit modules :: impl ( const char * mod_name);
Creates a module object for a specific DLL.
Name of the module/DLL to load (e.g., “client.dll”)
Methods
pattern_scan
address pattern_scan ( const char* sig );
Searches the module for a byte pattern signature.
IDA-style pattern string (e.g., “55 8B EC 83 ? ? 56”)
Returns: address object containing the found address, or null address if not found
Patterns use IDA-style syntax:
55 8B EC = exact bytes
? or ?? = wildcard (any byte)
Separate bytes with spaces
find_interface
template < class T >
T find_interface ( const char* interface_name );
Finds a Source Engine interface by name.
Interface pointer type to cast to
Name of the interface (e.g., “VClientEntityList003”)
Returns: Typed pointer to the interface, or nullptr if not found
get_module_handle_safe
constexpr HMODULE get_module_handle_safe ( const char* name );
Safely retrieves a module handle.
Returns: HMODULE handle to the module
Global Module Instances
The SDK provides pre-initialized module objects for all CS:GO DLLs:
inline modules ::impl g_client_dll;
inline modules ::impl g_engine_dll;
inline modules ::impl g_localize_dll;
inline modules ::impl g_shaderapidx9_dll;
inline modules ::impl g_vstdlib_dll;
inline modules ::impl g_server_dll;
inline modules ::impl g_studio_render_dll;
inline modules ::impl g_material_system_dll;
inline modules ::impl g_vgui_dll;
inline modules ::impl g_vgui2_dll;
inline modules ::impl g_game_overlay_renderer_dll;
inline modules ::impl g_physics_dll;
inline modules ::impl g_tier0_dll;
inline modules ::impl g_input_system_dll;
inline modules ::impl g_data_cache_dll;
inline modules ::impl g_steam_api_dll;
inline modules ::impl g_matchmaking_dll;
inline modules ::impl g_file_system_stdio_dll;
Client-side game logic (client.dll)
Material and rendering system (materialsystem.dll)
VGUI2 interface system (vgui2.dll)
Class: address
A wrapper class for memory addresses with convenient manipulation methods.
struct address {
address ();
address ( std :: uintptr_t ad );
address ( void* address );
template < typename T = address> T to () const ;
template < typename T = address> T as () const ;
template < typename T = address> T at ( std :: ptrdiff_t offset ) const ;
template < typename T = address> T add ( std :: ptrdiff_t offset ) const ;
template < typename T = address> T sub ( std :: ptrdiff_t offset ) const ;
template < typename T = address> T get ( std :: uint8_t dereferences = 1 ) const ;
template < typename T = address> T relative ( std :: ptrdiff_t offset = 0x 1 ) const ;
template < typename T = std :: uintptr_t > void set ( const T & value );
};
Address Methods
template < typename T = address>
T to () const ;
Dereferences the address and returns value as type T.
Returns: Value at address cast to type T
template < typename T = address>
T as () const ;
Casts the address to type T without dereferencing.
Returns: Address cast to type T
template < typename T = address>
T at ( std :: ptrdiff_t offset ) const ;
Reads value at address + offset.
Returns: Value at (address + offset) cast to type T
add
template < typename T = address>
T add ( std :: ptrdiff_t offset ) const ;
Adds offset to address without dereferencing.
Returns: New address (address + offset) cast to type T
sub
template < typename T = address>
T sub ( std :: ptrdiff_t offset ) const ;
Subtracts offset from address without dereferencing.
Offset in bytes to subtract
Returns: New address (address - offset) cast to type T
get
template < typename T = address>
T get ( std :: uint8_t dereferences = 1 ) const ;
Dereferences the address multiple times.
Number of pointer dereferences to perform
Returns: Final dereferenced value cast to type T
relative
template < typename T = address>
T relative ( std :: ptrdiff_t offset = 0x 1 ) const ;
Resolves a relative address (RIP-relative on x64, or x86 relative addressing).
offset
std::ptrdiff_t
default: "0x1"
Offset to the relative displacement value
Returns: Resolved absolute address cast to type T
Used for resolving relative jumps/calls in x86/x64 assembly: E8 [4 bytes] ; CALL relative
The 4-byte value is relative to the instruction after the call.
set
template < typename T = std :: uintptr_t >
void set ( const T & value );
Writes a value to the address.
Usage Examples
Pattern Scanning
Basic Pattern Scan
Pattern with Wildcards
Resolve Relative Call
// Find a function by signature
auto addr = g_client_dll . pattern_scan ( "55 8B EC 83 EC 18 56 57" );
if (addr) {
auto func = addr . as < my_func_t > ();
// Use function
}
Interface Finding
Get Entity List
Get Engine Client
auto entity_list = g_client_dll . find_interface < IClientEntityList *> (
"VClientEntityList003"
);
if (entity_list) {
auto local = entity_list -> GetClientEntity ( engine -> GetLocalPlayer ());
}
Address Manipulation
Read Value at Offset
Pointer Chain
Write Memory
Multiple Dereferences
// Read int at offset 0x10
auto base = g_client_dll . pattern_scan ( "55 8B EC 83 EC 18" );
int value = base . at < int > ( 0x 10 );
Finding Virtual Functions
// Get vtable from object
void * object = get_some_object ();
auto vtable = address (object). to < void **> ();
// Get 5th virtual function
auto vfunc = address (vtable). at < void *> ( 5 * sizeof ( void * ));
auto typed_func = vfunc . as < my_vfunc_t > ();
Common Patterns
Global Variable Access
// Pattern: A1 [addr] = MOV EAX, [global_var]
auto pattern = g_client_dll . pattern_scan ( "A1 ? ? ? ? 8B 10" );
auto global_ptr = pattern . add ( 0x 1 ). to < void **> ();
Virtual Function Table
// Get interface and access vtable
auto entity_list = g_client_dll . find_interface < void *> ( "VClientEntityList003" );
auto vtable = address (entity_list). to < void **> ();
auto get_entity_fn = address ( vtable [ 3 ]). as < get_entity_t > ();
Best Practices
Guidelines:
Cache pattern scan results - don’t scan every frame
Validate addresses - always check if address is valid before using
Use pre-initialized modules - prefer g_client_dll over creating new instances
Handle failures - pattern scans can fail on game updates
Document patterns - comment what each pattern finds
Update patterns - verify patterns after game updates
Module Constants
Defined in globals/macros/macros.h:
#define CLIENT_DLL "client.dll"
#define ENGINE_DLL "engine.dll"
#define LOCALIZE_DLL "localize.dll"
#define MATERIALSYSTEM_DLL "materialsystem.dll"
#define VGUI2_DLL "vgui2.dll"
#define SHADERAPIDX9_DLL "shaderapidx9.dll"
#define VSTDLIB_DLL "vstdlib.dll"
#define SERVER_DLL "server.dll"
#define STUDIORENDER_DLL "studiorender.dll"
#define VGUI_DLL "vguimatsurface.dll"
#define GAMEOVERLAYRENDERER_DLL "gameoverlayrenderer.dll"
#define PHYSICS_DLL "vphysics.dll"
#define TIER0_DLL "tier0.dll"
#define INPUTSYSTEM_DLL "inputsystem.dll"
#define DATACACHE_DLL "datacache.dll"
#define STEAM_API_DLL "steam_api.dll"
#define MATCHMAKING_DLL "matchmaking.dll"
#define FILESYSTEM_DLL "filesystem_stdio.dll"