paavohtl Claude Opus 4.6 (1M context) commited on
Commit
c359816
Β·
1 Parent(s): aab6d6e

docs: update CLAUDE.md for core/wormkit split and SoundId unification

Browse files

Update crate descriptions and Key Files to reflect game logic now
living in openwa-core (weapon_fire, weapon_release, sound_ops,
team_ops) with wormkit as thin hook shims. Update SoundId description
to document packed format (slot + flags).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Files changed (1) hide show
  1. CLAUDE.md +8 -6
CLAUDE.md CHANGED
@@ -155,9 +155,9 @@ Key env vars:
155
 
156
  ## Crate Architecture
157
 
158
- - **`openwa-core`** β€” Types, addresses, parsers, ASLR rebasing, and typed WA function wrappers. The source of truth for all reverse-engineered type layouts and known addresses. Contains `registry` (structured address database + field registries), `rebase` (ASLR delta), `wa_call` (calling convention helpers), and `wa/` (typed handle wrappers like `DDGameWrapperHandle`, `CWndHandle`).
159
  - **`openwa-derive`** β€” Proc macro crate. Provides `#[derive(FieldRegistry)]` for struct field maps and `#[vtable(...)]` for typed vtable definitions with introspection, calling wrappers, and replacement support.
160
- - **`openwa-wormkit`** β€” Unified WormKit cdylib that replaces WA functions with Rust. Logs to `OpenWA.log`. Uses MinHook for inline hooking. Runs registry-driven startup checks (vtable locations, function prologues) automatically at load; the test runner reports any failures after the test summary.
161
  - **`openwa-test-runner`** β€” Headless replay test runner (`openwa-test` binary). Discovers replay tests, runs them concurrently via WA.exe's `/getlog` mode, compares output logs. See "Replay Testing" section.
162
  - **`openwa-debug-cli`** β€” CLI tool for live memory inspection (`openwa-debug` binary). Connects to the debug server in the DLL.
163
  - **`openwa-debug-proto`** β€” Shared protocol types (Request/Response enums, MessagePack framing) between CLI and server.
@@ -237,12 +237,14 @@ Currently dormant β€” no hooks wired up. Activate by adding calls in `game_sessi
237
  - `crates/openwa-core/src/task/base.rs` β€” CTask<V>, CTaskVtable (7 slots), Task trait, SharedDataTable, broadcast_message
238
  - `crates/openwa-core/src/task/worm.rs` β€” CTaskWorm, CTaskWormVTable (20 slots), WormState enum (all gaps filled)
239
  - `crates/openwa-core/src/game/weapon.rs` β€” Weapon enum, WeaponEntry, FireType/FireMethod/SpecialFireSubtype enums, WeaponFireParams
240
- - `crates/openwa-core/src/audio/sound.rs` β€” SoundId newtype (any u32) + KnownSoundId enum (1-126 SFX)
 
241
  - `crates/openwa-core/src/engine/team_arena.rs` β€” TeamArenaState, WormEntry, TeamHeader, TeamArenaRef
 
242
  - `crates/openwa-core/src/engine/ddgame_constructor.rs` β€” DDGame constructor (create_ddgame, init_graphics_and_resources)
243
- - `crates/openwa-wormkit/src/replacements/weapon.rs` β€” FireWeapon dispatch (trapped, called from weapon_release), 20+ subtypes pure Rust
244
- - `crates/openwa-wormkit/src/replacements/weapon_release.rs` β€” WeaponRelease (0x51C3D0), SpawnEffect (0x547C30) β€” fully ported
245
- - `crates/openwa-wormkit/src/replacements/sound.rs` β€” Sound queue, PlaySoundLocal/Global hooks, worm sound functions (stop/play)
246
  - `crates/openwa-wormkit/src/replacements/frame_hook.rs` β€” TurnManager_ProcessFrame hook, debug_sync, watchpoint arming (always installed)
247
  - `crates/openwa-wormkit/src/replacements/replay_test.rs` β€” Fast-forward + gameplay milestones (headful replay testing only)
248
  - `crates/openwa-wormkit/src/replacements/trace_desync.rs` β€” Per-frame checksum logging for desync bisection
 
155
 
156
  ## Crate Architecture
157
 
158
+ - **`openwa-core`** β€” Types, addresses, parsers, ASLR rebasing, typed WA function wrappers, **and game logic**. The source of truth for all reverse-engineered type layouts, known addresses, and Rust reimplementations of WA functions. Contains `registry` (structured address database + field registries), `rebase` (ASLR delta), `wa_call` (calling convention helpers), `wa/` (typed handle wrappers), and game logic modules (`game/weapon_fire.rs`, `game/weapon_release.rs`, `audio/sound_ops.rs`, `engine/team_ops.rs`).
159
  - **`openwa-derive`** β€” Proc macro crate. Provides `#[derive(FieldRegistry)]` for struct field maps and `#[vtable(...)]` for typed vtable definitions with introspection, calling wrappers, and replacement support.
160
+ - **`openwa-wormkit`** β€” Unified WormKit cdylib: thin hook installation shims (trampolines, `usercall_trampoline!`, `install()`) that wire core's game logic into WA.exe via MinHook. Logs to `OpenWA.log`. Runs registry-driven startup checks automatically at load.
161
  - **`openwa-test-runner`** β€” Headless replay test runner (`openwa-test` binary). Discovers replay tests, runs them concurrently via WA.exe's `/getlog` mode, compares output logs. See "Replay Testing" section.
162
  - **`openwa-debug-cli`** β€” CLI tool for live memory inspection (`openwa-debug` binary). Connects to the debug server in the DLL.
163
  - **`openwa-debug-proto`** β€” Shared protocol types (Request/Response enums, MessagePack framing) between CLI and server.
 
237
  - `crates/openwa-core/src/task/base.rs` β€” CTask<V>, CTaskVtable (7 slots), Task trait, SharedDataTable, broadcast_message
238
  - `crates/openwa-core/src/task/worm.rs` β€” CTaskWorm, CTaskWormVTable (20 slots), WormState enum (all gaps filled)
239
  - `crates/openwa-core/src/game/weapon.rs` β€” Weapon enum, WeaponEntry, FireType/FireMethod/SpecialFireSubtype enums, WeaponFireParams
240
+ - `crates/openwa-core/src/audio/sound.rs` β€” SoundId packed type (low 16 = slot, bit 16 = loop, bit 17 = raw volume) + KnownSoundId enum (1-126 SFX)
241
+ - `crates/openwa-core/src/audio/sound_ops.rs` β€” Sound queue, PlaySoundLocal/Global, worm sound (stop/play), 3D distance attenuation, streaming dispatch
242
  - `crates/openwa-core/src/engine/team_arena.rs` β€” TeamArenaState, WormEntry, TeamHeader, TeamArenaRef
243
+ - `crates/openwa-core/src/engine/team_ops.rs` β€” Team/worm state accessors (alliance counting, health, state checks)
244
  - `crates/openwa-core/src/engine/ddgame_constructor.rs` β€” DDGame constructor (create_ddgame, init_graphics_and_resources)
245
+ - `crates/openwa-core/src/game/weapon_fire.rs` β€” FireWeapon dispatch, ammo management, 20+ special weapon handlers, projectile creation
246
+ - `crates/openwa-core/src/game/weapon_release.rs` β€” WeaponRelease (0x51C3D0), SpawnEffect (0x547C30) β€” fully ported
247
+ - `crates/openwa-wormkit/src/replacements/sound.rs` β€” Hook trampolines for sound functions (thin shim over sound_ops)
248
  - `crates/openwa-wormkit/src/replacements/frame_hook.rs` β€” TurnManager_ProcessFrame hook, debug_sync, watchpoint arming (always installed)
249
  - `crates/openwa-wormkit/src/replacements/replay_test.rs` β€” Fast-forward + gameplay milestones (headful replay testing only)
250
  - `crates/openwa-wormkit/src/replacements/trace_desync.rs` β€” Per-frame checksum logging for desync bisection