$ show rehlds/ReAPI
ReAPI is a C++ Metamod plugin module for AMX Mod X (AMXX) that extends Counter-Strike 1.6 server modding by bridging the ReGameDLL and ReHLDS APIs to Pawn scripting. It provides a comprehensive hook chain system, reflection-based member access to game internals, and message interception capabilities, enabling scripters to modify nearly every aspect of gameplay, from player spawning and weapon handling to round logic and engine events. The module also integrates optional companion mods (Reunion, VTC, Rechecker) for authentication, voice chat, and file consistency checks. The architecture is a classic Metamod plugin with AMXX module entry points, exposing hundreds of native functions (rh_* and rg_* namespaces) and forwards. The codebase demonstrates sophisticated patterns such as template-based hook registries, compile-time member offset tables with type safety, and generic container utilities. However, it is tightly coupled to specific versions of ReHLDS/ReGameDLL and the GoldSrc engine, with hardcoded offsets and manual parameter conversion in many hooks. The project is actively maintained with frequent commits and issue triage, but carries medium technical drift due to an aging toolchain (GCC 4.5.1 runtime, deprecated Windows SDK) and large monolithic source files.
The LLM identified 4 files worth highlighting for reuse:
Defines a generic hook chain system using templates (IHookChain, IVoidHookChain) with priority-based registration and unregistration. The pattern allows intercepting any engine or game DLL function pre- or post-call, with automatic parameter conversion to AMX types. This is a reusable, well-abstracted interception framework that can be adapted to other game engines or event-driven systems.
Implements a compile-time reflection system for C++ game classes using macros (CLASS_MEMBERS, STRUCT_MEMBERS) that generate member_t entries with offset, type, size, and a dynamic_cast validation function. This allows Pawn scripts to read/write private class members by name, providing a safe and extensible pattern for exposing internal data without modifying the original class definitions.
A standalone CRC32C implementation with SSE4.2 hardware acceleration (crc32 intrinsics) and a software fallback. It is used for file integrity checks and is independent of the rest of the codebase. This utility can be extracted and reused in any C++ project requiring fast CRC32C computation.
Manages AMXX function callbacks for entity events (think, touch, use, blocked, move done). It stores callback pairs (entity, amx function) and defers deletion during processing to avoid iterator invalidation. This pattern is reusable for any event-driven system that needs dynamic callback registration and safe removal during iteration.