Skip to main content

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

modules::impl();
Creates an empty module object.

Parameterized Constructor

explicit modules::impl(const char* mod_name);
Creates a module object for a specific DLL.
mod_name
const char*
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.
sig
const char*
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.
T
template parameter
Interface pointer type to cast to
interface_name
const char*
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.
name
const char*
Module name
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;
g_client_dll
modules::impl
Client-side game logic (client.dll)
g_engine_dll
modules::impl
Game engine (engine.dll)
g_material_system_dll
modules::impl
Material and rendering system (materialsystem.dll)
g_vgui2_dll
modules::impl
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 = 0x1) const;
    template<typename T = std::uintptr_t> void set(const T& value);
};

Address Methods

to

template<typename T = address>
T to() const;
Dereferences the address and returns value as type T. Returns: Value at address cast to type T

as

template<typename T = address>
T as() const;
Casts the address to type T without dereferencing. Returns: Address cast to type T

at

template<typename T = address>
T at(std::ptrdiff_t offset) const;
Reads value at address + offset.
offset
std::ptrdiff_t
Offset in bytes
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.
offset
std::ptrdiff_t
Offset in bytes to add
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
std::ptrdiff_t
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.
dereferences
std::uint8_t
default:"1"
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 = 0x1) 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.
value
const T&
Value to write

Usage Examples

Pattern Scanning

// 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

auto entity_list = g_client_dll.find_interface<IClientEntityList*>(
    "VClientEntityList003"
);

if (entity_list) {
    auto local = entity_list->GetClientEntity(engine->GetLocalPlayer());
}

Address Manipulation

// Read int at offset 0x10
auto base = g_client_dll.pattern_scan("55 8B EC 83 EC 18");
int value = base.at<int>(0x10);

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(0x1).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:
  1. Cache pattern scan results - don’t scan every frame
  2. Validate addresses - always check if address is valid before using
  3. Use pre-initialized modules - prefer g_client_dll over creating new instances
  4. Handle failures - pattern scans can fail on game updates
  5. Document patterns - comment what each pattern finds
  6. 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"

Build docs developers (and LLMs) love