How sergeantserk/horsemenu works
Main Components
• Core Subsystem: Located in the "src/core" directory, this includes several key modules:
• Command handling (e.g., various command types such as BoolCommand, ColorCommand, etc.)
• Hooking mechanisms (e.g., BaseHook, DetourHook, VMTHook, and related hooking infrastructure)
• Memory and file management (pattern scanning, memory patching, file manager)
• Logging and error handling (“logger”)
• Renderer and settings management
• Game-Specific Subsystem: Found in "src/game", it implements functionality dedicated to the RDR2 game environment.
• Backend logic for game-specific manipulations (features like player commands, network features, and map editor functions)
• Frontend/UI elements for mod menu display (menus, submenus, chat display, overlays with ImGui widgets)
• Game hooks – specific hooks for detecting/overriding native calls, interfacing with the game’s engine (hooks components for anticheat, GUI integration, etc.)
• Feature implementations for custom functionalities (teleports, self-modifications, players, vehicles, world features, etc.)
• Utility and Common Functions: Under “src/util” and “src/common”, these modules provide more generic functionalities that are reused across the application (e.g., helper functions, network utilities, storage, vehicle spawner, etc.)
• Build and Dependency Management:
• CMake configuration (CMakeLists.txt, cmake directory) manages project building.
• Dependencies such as the Vulkan library under “deps” and integration cmake modules (async-logger, imgui, json, etc.)
Relationships and Interactions
• The mod menu (frontend) communicates with the core and game-specific subsystems. For instance, UI actions in the mod frontend (menus/submenus) trigger command functions that modify game state.
• The core subsystem provides services such as logging, hooking, and memory management which are consumed by both the frontend and game-specific components.
• The hooking logic intercepts game routines. It is often integrated with backend elements to run custom scripts, alter game events, or enhance gameplay behavior.
• Utility functions offer common functionality that may be used by both core and game layers, such as mathematical computations, network interactions, or storage handling.
Architectural Patterns and Design Principles
• Modular design: The project is clearly divided into separate modules (core, game, and util), which fosters separation of concerns.
• Layered approach: The architecture separates low-level functionalities (hooking, memory operations, logging) from high-level application logic (UI display, gameplay modifications, feature modules).
• Extensibility: With dedicated directories for commands, features (further subdivided into players, network, self, etc.), and hooking, new functionalities can be added as isolated modules.
• Use of CMake for cross-platform builds indicates reliance on standard build methodologies and dependency management best practices.