CHUDCS2

Packet layout

Internal frame packets, packed structures and C++ layout checks.

View as Markdown

ShmPacket is the internal snapshot produced by GameReader and consumed by the frame loop. The name remains from an earlier shared-memory bridge. The current reader uses process_vm_readv and copies snapshots under a mutex. It does not open POSIX shared memory or named semaphores.

The former CHUDCS2_SHM_NAME and CHUDCS2_SEM_NAME variables have no effect. This page keeps its original URL for existing links.

Packed layout

Packet definitions live in src/overlay/game_reader.hpp. Packed structures use #pragma pack(push, 1) and compile-time size assertions. Preserve field order, scalar widths, array lengths and nested layouts when changing them.

The packet includes view and local-player state, weapon spread and recoil values, hitboxes, projectiles, infernos, doors, dropped items, smokes, spectators and player records. Player records contain model names, bone transforms, status flags, weapon data, velocity and shot state.

Change checklist

  1. Update the definitions and size assertions in src/overlay/game_reader.hpp together.
  2. Update affected assertions and bounds checks in tests/cpp/test_main.cpp.
  3. Update the producer in src/overlay/game_reader.cpp and affected consumers.
  4. Build with CHUDCS2_BUILD_TESTS=ON and run CTest as described in Testing.

The repository does not contain the former Python ctypes mirror or simulation fixtures. A test name such as test_shm_reader_bounds refers to the retained packet types and bounds logic.

Was this page helpful?

Edit this page on GitHub

Last updated on

On this page