Overview
Memory patterns are byte sequences that uniquely identify code or data in the game’s modules. The pattern system is used to find:- Function pointers
- Virtual method tables (VMTs)
- Global variables
- Class instances
Pattern Syntax
Patterns use a string-based format with wildcard support:- Hex bytes:
48 8B 03- exact match required - Wildcards:
?- matches any byte - Operations:
.add(9).abs()- offset and dereference
Pattern Finding Architecture
Pattern Finders
Each game module gets its own pattern finder:BytePattern Class
TheBytePattern class handles pattern matching:
- Compile-time construction from string literals
- Wildcard support for flexible matching
- Efficient byte-by-byte comparison
PatternFinder Implementation
The core search algorithm:- Uses
HybridPatternFinderfor optimized searching - Asserts pattern uniqueness (should match exactly once)
- Logs patterns that aren’t found
- Returns a
PatternSearchResultfor further processing
Pattern Operations
Patterns support post-processing operations:add(offset)- Add offset to result addressabs()- Dereference relative offset (RIP-relative on x64)read()- Read pointer at result address
Pattern Definitions
Patterns are organized by module and entity type:Client Patterns Example
- Associates a type (
MainMenuPanelPointer) with a byte pattern - Uses compile-time chaining for pattern operations
- Returns the final address after transformations
Compile-Time Pattern Pools
Patterns are aggregated at compile time into pools:kSceneSystemPatternskTier0PatternskFileSystemPatternskSoundSystemPatternskPanoramaPatterns
Pattern Search Results
Search results are stored and accessed by type:Platform-Specific Patterns
Patterns differ between Windows and Linux due to different calling conventions and compiler optimizations:Error Handling
When patterns aren’t found:PatternNotFoundLogger logs the missing pattern for debugging. The application continues execution but features requiring that pattern will be disabled.
Performance Considerations
- All pattern finding happens once during initialization
- Results are cached in
AllMemoryPatternSearchResults - Compile-time pattern validation catches errors early
- Hybrid search algorithm optimizes for patterns with/without wildcards
- Patterns are searched in parallel across modules
Example Usage
Finding the ViewRender instance:Related Topics
- Architecture - Overall system design
- Hooking - Using pattern results for hooks