diff --git a/.claude/skills/debug-cli/SKILL.md b/.claude/skills/debug-cli/SKILL.md index 0fc7687e42402a86615e533685a6953fa1e7d42b..7ddffdd2e1e3409b8a62a4711d83438943eafaa2 100644 --- a/.claude/skills/debug-cli/SKILL.md +++ b/.claude/skills/debug-cli/SKILL.md @@ -278,4 +278,4 @@ Use `inspect` to see all named fields with formatted values, or `read` with a fi - Both are independent — you can use the CLI without the UI and vice versa - Protocol: MessagePack over TCP with 4-byte LE length-prefix framing - The `openwa-debug` binary is built to `target/i686-pc-windows-msvc/release/openwa-debug.exe` -- Source: `crates/openwa-debug-cli/` (CLI), `crates/openwa-debug-proto/` (protocol), `crates/openwa-wormkit/src/debug_server.rs` (server) +- Source: `crates/openwa-debug-cli/` (CLI), `crates/openwa-debug-proto/` (protocol), `crates/openwa-dll/src/debug_server.rs` (server) diff --git a/.claude/skills/desync-debug/SKILL.md b/.claude/skills/desync-debug/SKILL.md index 807eec9f213692467b0c9216ec735db7a687c889..6492c816369f22bbf1724ca516c0f9780bbedf7c 100644 --- a/.claude/skills/desync-debug/SKILL.md +++ b/.claude/skills/desync-debug/SKILL.md @@ -47,9 +47,9 @@ See "Hardware Watchpoints" in CLAUDE.md for watchpoint env vars (`OPENWA_WATCH_F ## Key Files -- `crates/openwa-wormkit/src/replacements/trace_desync.rs` -- Per-frame checksum logging -- `crates/openwa-wormkit/src/debug_watchpoint.rs` -- Hardware watchpoint instrumentation -- `crates/openwa-wormkit/src/replacements/frame_hook.rs` -- Frame hook (watchpoint arming) +- `crates/openwa-dll/src/replacements/trace_desync.rs` -- Per-frame checksum logging +- `crates/openwa-dll/src/debug_watchpoint.rs` -- Hardware watchpoint instrumentation +- `crates/openwa-dll/src/replacements/frame_hook.rs` -- Frame hook (watchpoint arming) - `crates/openwa-test-runner/` -- Test runner that detects failures - `docs/re-notes/desync-investigation.md` -- Detailed case study - `trace-desync.ps1` -- Convenience script diff --git a/.claude/skills/type-struct/SKILL.md b/.claude/skills/type-struct/SKILL.md index 9f11264bfcb9430a0649dc9e6716d9af5cc7b3dd..8d156b58a0ef36f49c7a9302878f5116260f218b 100644 --- a/.claude/skills/type-struct/SKILL.md +++ b/.claude/skills/type-struct/SKILL.md @@ -63,7 +63,7 @@ Compute offsets relative to the struct base. Verify with: ### 7. Verify -- `cargo build --release -p openwa-wormkit` — must compile clean, zero warnings +- `cargo build --release -p openwa-dll` — must compile clean, zero warnings - Run `/replay-test` (headful + headless) to verify runtime correctness - Check that `sizeof` assertion passes (struct size matches allocation size) diff --git a/CLAUDE.md b/CLAUDE.md index 966068f0673a018e65c9554e7d19c651f20e1a67..93be165418d50c49c519df9186beb6b89adc31e1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2,7 +2,7 @@ ## Project -OpenWA (short for "Open Worms Armageddon") is an incremental Rust reimplementation of Worms Armageddon 3.8.1 (Steam). The replacement strategy is the same as was used in OpenRCT2: a custom launcher (`openwa-launcher`) injects a DLL (`openwa-wormkit`) into a suspended game process, which replaces game functions with Rust implementations (from `openwa-core`). +OpenWA (short for "Open Worms Armageddon") is an incremental Rust reimplementation of Worms Armageddon 3.8.1 (Steam). The replacement strategy is the same as was used in OpenRCT2: a custom launcher (`openwa-launcher`) injects a DLL (`openwa-dll`) into a suspended game process, which replaces game functions with Rust implementations (from `openwa-core`). The original WA.exe is a 32-bit x86 Windows PE binary built with MSVC 2005 + MFC. All Rust code targets `i686-pc-windows-msvc`. @@ -10,7 +10,7 @@ The original WA.exe is a 32-bit x86 Windows PE binary built with MSVC 2005 + MFC - **`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`). - **`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. -- **`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. +- **`openwa-dll`** — Injected DLL (`openwa.dll`): 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. - **`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. - **`openwa-launcher`** — Launches WA.exe with the DLL injected via CREATE_SUSPENDED + remote thread. - **`openwa-debugui`** — In-process egui debug window (entity census, struct inspector, cheats). Enabled via `OPENWA_DEBUG_UI=1` + `debug-ui` cargo feature. @@ -60,7 +60,7 @@ Use the `/debug-cli` skill for live memory inspection, struct inspection, frame- ## Hardware Watchpoints -`crates/openwa-wormkit/src/debug_watchpoint.rs` — x86 debug register instrumentation (DR0-DR3) for answering "who writes this memory?" without an external debugger. Uses INT3→VEH trick, logs symbolicated stack traces via `registry::format_va()`. Max 4 watchpoints per run (hardware limit). +`crates/openwa-dll/src/debug_watchpoint.rs` — x86 debug register instrumentation (DR0-DR3) for answering "who writes this memory?" without an external debugger. Uses INT3→VEH trick, logs symbolicated stack traces via `registry::format_va()`. Max 4 watchpoints per run (hardware limit). **API:** `arm_watchpoint(base_ptr, offset, size)` sets a write watchpoint. `prepare()` initializes the VEH handler, `teardown()` removes it. Can be armed at any point during execution — on object allocation, at a specific frame via env var, or manually from debug server commands. @@ -91,7 +91,7 @@ These are critical — wrong conventions cause stack corruption and crashes. ## Hooking & Desync Debugging -See `crates/openwa-wormkit/CLAUDE.md` for hooking patterns (passthrough, full replacement, vtable, trap), bridge function patterns, `usercall_trampoline!` macro, and hook installation details. +See `crates/openwa-dll/CLAUDE.md` for hooking patterns (passthrough, full replacement, vtable, trap), bridge function patterns, `usercall_trampoline!` macro, and hook installation details. Use the `/desync-debug` skill for desync diagnosis (trace-desync, per-frame analysis). Only after a headless test has already detected a failure. diff --git a/Cargo.lock b/Cargo.lock index 19465fd324b30bcc0d1c5a9ba0b2508ba1acb992..a561880d8b7a080283059bb7a3294af61f17a19d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1524,32 +1524,32 @@ dependencies = [ ] [[package]] -name = "openwa-launcher" +name = "openwa-dll" version = "0.1.0" dependencies = [ - "openwa-config", + "heapless", + "hound", + "minhook", + "openwa-core", + "openwa-debug-proto", + "openwa-debugui", + "windows", + "windows-sys 0.59.0", ] [[package]] -name = "openwa-test-runner" +name = "openwa-launcher" version = "0.1.0" dependencies = [ - "chrono", "openwa-config", ] [[package]] -name = "openwa-wormkit" +name = "openwa-test-runner" version = "0.1.0" dependencies = [ - "heapless", - "hound", - "minhook", - "openwa-core", - "openwa-debug-proto", - "openwa-debugui", - "windows", - "windows-sys 0.59.0", + "chrono", + "openwa-config", ] [[package]] diff --git a/crates/openwa-core/src/audio/sound_ops.rs b/crates/openwa-core/src/audio/sound_ops.rs index fd1dd56ba86afd4b19810fbac365b9b103527edb..28acf24777abf0afb59c1438f0b4ba8ae50f8ef9 100644 --- a/crates/openwa-core/src/audio/sound_ops.rs +++ b/crates/openwa-core/src/audio/sound_ops.rs @@ -1,7 +1,7 @@ //! Sound playback operations. //! //! Pure Rust reimplementations of WA.exe sound functions. Called from -//! wormkit hook trampolines and from other core game logic (weapon fire, etc.). +//! hook trampolines in openwa-dll and from other core game logic (weapon fire, etc.). //! //! Original WA functions: //! - PlaySoundGlobal queue insertion (0x546E20) diff --git a/crates/openwa-core/src/audio/speech_ops.rs b/crates/openwa-core/src/audio/speech_ops.rs index 033d3048df2662b54ad5c76989cfa487205c80c1..1efde1374478388446e5bf4a06a4f5a814d2c243 100644 --- a/crates/openwa-core/src/audio/speech_ops.rs +++ b/crates/openwa-core/src/audio/speech_ops.rs @@ -1,7 +1,7 @@ //! Speech / fanfare / FE SFX operations. //! //! Pure Rust reimplementations of WA.exe speech and fanfare functions. -//! Called from wormkit hook trampolines. +//! Called from hook trampolines in openwa-dll. //! //! Original WA functions: //! - PlayFeSfx (0x4D7960) diff --git a/crates/openwa-core/src/engine/ddgame_constructor.rs b/crates/openwa-core/src/engine/ddgame_constructor.rs index a68c3979493da8d26672d798c6064c43436fa38f..f096802bd27fb5d487fa83b8b7c30e62614847b6 100644 --- a/crates/openwa-core/src/engine/ddgame_constructor.rs +++ b/crates/openwa-core/src/engine/ddgame_constructor.rs @@ -36,7 +36,7 @@ pub use crate::task::bit_grid::bit_grid_init; // Pure Rust implementations of DDGame sub-functions // ============================================================ // These are called both by create_ddgame() and by MinHook -// trampolines in openwa-wormkit/replacements/ddgame_init.rs. +// trampolines in openwa-dll/replacements/ddgame_init.rs. /// Pure Rust implementation of DDGame__InitFields (0x526120). /// diff --git a/crates/openwa-core/src/engine/team_ops.rs b/crates/openwa-core/src/engine/team_ops.rs index 99049bc73d2a0f030496f98c6eec8a41ae63741f..13ef2f2b5b416e5feee601c693a94f912d616ebf 100644 --- a/crates/openwa-core/src/engine/team_ops.rs +++ b/crates/openwa-core/src/engine/team_ops.rs @@ -1,7 +1,7 @@ //! Team and worm state accessor functions. //! //! Pure Rust reimplementations of WA.exe functions that access the TeamArenaState -//! area (DDGame + 0x4628). These are called from wormkit hook trampolines. +//! area (DDGame + 0x4628). Called from hook trampolines in openwa-dll. //! //! Original WA functions: //! - CountTeamsByAlliance (0x522030) diff --git a/crates/openwa-core/src/game/frontend.rs b/crates/openwa-core/src/game/frontend.rs index 5cfab7494126465bdea6fb77c6e9077dd3c23f38..0e06e201d2a89deccb4aba612eac7ca843529046 100644 --- a/crates/openwa-core/src/game/frontend.rs +++ b/crates/openwa-core/src/game/frontend.rs @@ -16,7 +16,7 @@ /// /// Source: Ghidra decompilation of Frontend__MainNavigationLoop (0x4E6440), /// 65 FrontendChangeScreen call sites, wkJellyWorm Lobby.cpp, -/// + runtime observation via openwa-wormkit +/// + runtime observation via openwa-dll #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[repr(i32)] pub enum ScreenId { diff --git a/crates/openwa-core/src/game/weapon_fire.rs b/crates/openwa-core/src/game/weapon_fire.rs index 968e88c36bb35171b6429c3125ce945f8ada7750..d739d8c083dedb4c50e4f886ad237d720d7208f1 100644 --- a/crates/openwa-core/src/game/weapon_fire.rs +++ b/crates/openwa-core/src/game/weapon_fire.rs @@ -1,7 +1,7 @@ //! Weapon fire dispatch, ammo management, and object creation. //! //! Pure Rust reimplementations of WA.exe weapon functions. Called from -//! wormkit hook trampolines. +//! hook trampolines in openwa-dll. //! //! Original WA functions: //! - AddAmmo (0x522640), SubtractAmmo (0x522680), GetAmmo (0x5225E0) diff --git a/crates/openwa-core/src/game/weapon_release.rs b/crates/openwa-core/src/game/weapon_release.rs index 0be3f2598c235d7889dfe0978bbc63397ab02fa4..4a38639240de372a6c4ed234e95fad0fae97e094 100644 --- a/crates/openwa-core/src/game/weapon_release.rs +++ b/crates/openwa-core/src/game/weapon_release.rs @@ -1,7 +1,7 @@ //! WeaponRelease orchestration and spawn effect. //! //! Pure Rust reimplementation of WA.exe WeaponRelease (0x51C3D0) and -//! SpawnEffect (0x547C30). Called from wormkit hook trampolines. +//! SpawnEffect (0x547C30). Called from hook trampolines in openwa-dll. use crate::audio::{KnownSoundId, SoundId}; use crate::fixed::Fixed; diff --git a/crates/openwa-core/src/render/spr.rs b/crates/openwa-core/src/render/spr.rs index 8865659db323ac5853a4f13f0c7518307faa8358..f20ac0ce8d8e3dd459bfd86ffd6db128db4c7bf7 100644 --- a/crates/openwa-core/src/render/spr.rs +++ b/crates/openwa-core/src/render/spr.rs @@ -2,8 +2,8 @@ //! //! WA's sprite format stores paletted animated sprites with per-frame metadata. //! This module provides both a clean Rust parser (`ParsedSprite`) for tooling -//! and shared metadata extraction (`parse_spr_header`) used by WormKit hook -//! replacements. +//! and shared metadata extraction (`parse_spr_header`) used by hook +//! replacements in openwa-dll. use crate::render::sprite::SpriteFrame; @@ -86,7 +86,7 @@ fn align4(offset: usize) -> usize { /// Parse `.spr` header and compute data region offsets. /// /// This is a pure function with no WA dependencies. Both `ParsedSprite::parse` -/// and the WormKit ProcessSprite hook build on this. +/// and the ProcessSprite hook replacement build on this. pub fn parse_spr_header(data: &[u8]) -> Result { // Minimum: 4 (unused) + 4 (data_size) + 2 (header_flags) + 2 (palette_count) = 12 if data.len() < 12 { @@ -207,7 +207,7 @@ pub fn parse_spr_header(data: &[u8]) -> Result { /// raw bitmap pixel indices, and frame metadata. Suitable for standalone /// tooling, tests, and debugging. /// -/// For WormKit hook replacements, `parse_spr_header` is used directly +/// For hook replacements in openwa-dll, `parse_spr_header` is used directly /// with in-place buffer operations instead. #[derive(Debug, Clone)] pub struct ParsedSprite { diff --git a/crates/openwa-debugui/src/lib.rs b/crates/openwa-debugui/src/lib.rs index a8068563009348ccb4c44f7cba60b5ca52a7ac69..a8042e3a9dc5144142edd399ecc35100f0817134 100644 --- a/crates/openwa-debugui/src/lib.rs +++ b/crates/openwa-debugui/src/lib.rs @@ -7,7 +7,7 @@ //! # Usage //! //! ```rust -//! // In openwa-wormkit lib.rs, after rebase::init() and hook installation: +//! // In openwa-dll lib.rs, after rebase::init() and hook installation: //! if std::env::var("OPENWA_DEBUG_UI").is_ok() { //! openwa_debugui::spawn(); //! } diff --git a/crates/openwa-wormkit/CLAUDE.md b/crates/openwa-dll/CLAUDE.md similarity index 93% rename from crates/openwa-wormkit/CLAUDE.md rename to crates/openwa-dll/CLAUDE.md index d0c83e839b18b555bc4ba2bbb6faaa4b95b4a5d1..91a80da137b63c0517e45c34e668d1f1f3d61ea6 100644 --- a/crates/openwa-wormkit/CLAUDE.md +++ b/crates/openwa-dll/CLAUDE.md @@ -1,6 +1,6 @@ -# openwa-wormkit +# openwa-dll -Unified WormKit cdylib (`wkOpenWA.dll`). Contains thin hook installation shims that wire `openwa-core` game logic into WA.exe via MinHook. Game logic itself lives in `openwa-core` — this crate is purely the wiring layer. +Injected DLL (`openwa.dll`). Contains thin hook installation shims that wire `openwa-core` game logic into WA.exe via MinHook. Game logic itself lives in `openwa-core` — this crate is purely the wiring layer. See the root `CLAUDE.md` for project-wide rules: architecture, calling conventions, ASLR rebasing, FFI style, design conventions. diff --git a/crates/openwa-wormkit/Cargo.toml b/crates/openwa-dll/Cargo.toml similarity index 86% rename from crates/openwa-wormkit/Cargo.toml rename to crates/openwa-dll/Cargo.toml index 6563170f58d41e248fd431b24d8177aede450c31..9ea3c8877a505ce36dbab2bebb0343ced626af8c 100644 --- a/crates/openwa-wormkit/Cargo.toml +++ b/crates/openwa-dll/Cargo.toml @@ -1,10 +1,11 @@ [package] -name = "openwa-wormkit" +name = "openwa-dll" version = "0.1.0" edition = "2021" -description = "WormKit DLL that replaces WA.exe functions with Rust reimplementations" +description = "Injected DLL that replaces WA.exe functions with Rust reimplementations" [lib] +name = "openwa" crate-type = ["cdylib"] [features] diff --git a/crates/openwa-wormkit/src/debug_server.rs b/crates/openwa-dll/src/debug_server.rs similarity index 100% rename from crates/openwa-wormkit/src/debug_server.rs rename to crates/openwa-dll/src/debug_server.rs diff --git a/crates/openwa-wormkit/src/debug_sync.rs b/crates/openwa-dll/src/debug_sync.rs similarity index 100% rename from crates/openwa-wormkit/src/debug_sync.rs rename to crates/openwa-dll/src/debug_sync.rs diff --git a/crates/openwa-wormkit/src/debug_ui.rs b/crates/openwa-dll/src/debug_ui.rs similarity index 100% rename from crates/openwa-wormkit/src/debug_ui.rs rename to crates/openwa-dll/src/debug_ui.rs diff --git a/crates/openwa-wormkit/src/debug_watchpoint.rs b/crates/openwa-dll/src/debug_watchpoint.rs similarity index 100% rename from crates/openwa-wormkit/src/debug_watchpoint.rs rename to crates/openwa-dll/src/debug_watchpoint.rs diff --git a/crates/openwa-wormkit/src/hook.rs b/crates/openwa-dll/src/hook.rs similarity index 100% rename from crates/openwa-wormkit/src/hook.rs rename to crates/openwa-dll/src/hook.rs diff --git a/crates/openwa-wormkit/src/lib.rs b/crates/openwa-dll/src/lib.rs similarity index 98% rename from crates/openwa-wormkit/src/lib.rs rename to crates/openwa-dll/src/lib.rs index cd4fadb4b54e0c8b21aafd2f215c9b7c680202ab..19be13cd76d232c989ae63897a1c858970a64c1c 100644 --- a/crates/openwa-wormkit/src/lib.rs +++ b/crates/openwa-dll/src/lib.rs @@ -73,7 +73,7 @@ fn run() -> Result<(), String> { let delta = openwa_core::rebase::init(); let _ = log_line(&format!( - "=== OpenWA WormKit DLL loaded ===\n ASLR delta: 0x{delta:08X}" + "=== OpenWA DLL loaded ===\n ASLR delta: 0x{delta:08X}" )); replacements::install_all()?; diff --git a/crates/openwa-wormkit/src/replacements/config.rs b/crates/openwa-dll/src/replacements/config.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/config.rs rename to crates/openwa-dll/src/replacements/config.rs diff --git a/crates/openwa-wormkit/src/replacements/ddgame_init.rs b/crates/openwa-dll/src/replacements/ddgame_init.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/ddgame_init.rs rename to crates/openwa-dll/src/replacements/ddgame_init.rs diff --git a/crates/openwa-wormkit/src/replacements/debug_utils.rs b/crates/openwa-dll/src/replacements/debug_utils.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/debug_utils.rs rename to crates/openwa-dll/src/replacements/debug_utils.rs diff --git a/crates/openwa-wormkit/src/replacements/display.rs b/crates/openwa-dll/src/replacements/display.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/display.rs rename to crates/openwa-dll/src/replacements/display.rs diff --git a/crates/openwa-wormkit/src/replacements/file_isolation.rs b/crates/openwa-dll/src/replacements/file_isolation.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/file_isolation.rs rename to crates/openwa-dll/src/replacements/file_isolation.rs diff --git a/crates/openwa-wormkit/src/replacements/frame_hook.rs b/crates/openwa-dll/src/replacements/frame_hook.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/frame_hook.rs rename to crates/openwa-dll/src/replacements/frame_hook.rs diff --git a/crates/openwa-wormkit/src/replacements/frontend.rs b/crates/openwa-dll/src/replacements/frontend.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/frontend.rs rename to crates/openwa-dll/src/replacements/frontend.rs diff --git a/crates/openwa-wormkit/src/replacements/game_session.rs b/crates/openwa-dll/src/replacements/game_session.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/game_session.rs rename to crates/openwa-dll/src/replacements/game_session.rs diff --git a/crates/openwa-wormkit/src/replacements/game_state_hooks.rs b/crates/openwa-dll/src/replacements/game_state_hooks.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/game_state_hooks.rs rename to crates/openwa-dll/src/replacements/game_state_hooks.rs diff --git a/crates/openwa-wormkit/src/replacements/hardware_init.rs b/crates/openwa-dll/src/replacements/hardware_init.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/hardware_init.rs rename to crates/openwa-dll/src/replacements/hardware_init.rs diff --git a/crates/openwa-wormkit/src/replacements/headless.rs b/crates/openwa-dll/src/replacements/headless.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/headless.rs rename to crates/openwa-dll/src/replacements/headless.rs diff --git a/crates/openwa-wormkit/src/replacements/mod.rs b/crates/openwa-dll/src/replacements/mod.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/mod.rs rename to crates/openwa-dll/src/replacements/mod.rs diff --git a/crates/openwa-wormkit/src/replacements/music.rs b/crates/openwa-dll/src/replacements/music.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/music.rs rename to crates/openwa-dll/src/replacements/music.rs diff --git a/crates/openwa-wormkit/src/replacements/render.rs b/crates/openwa-dll/src/replacements/render.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/render.rs rename to crates/openwa-dll/src/replacements/render.rs diff --git a/crates/openwa-wormkit/src/replacements/replay.rs b/crates/openwa-dll/src/replacements/replay.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/replay.rs rename to crates/openwa-dll/src/replacements/replay.rs diff --git a/crates/openwa-wormkit/src/replacements/replay_test.rs b/crates/openwa-dll/src/replacements/replay_test.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/replay_test.rs rename to crates/openwa-dll/src/replacements/replay_test.rs diff --git a/crates/openwa-wormkit/src/replacements/scheme.rs b/crates/openwa-dll/src/replacements/scheme.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/scheme.rs rename to crates/openwa-dll/src/replacements/scheme.rs diff --git a/crates/openwa-wormkit/src/replacements/sound.rs b/crates/openwa-dll/src/replacements/sound.rs similarity index 99% rename from crates/openwa-wormkit/src/replacements/sound.rs rename to crates/openwa-dll/src/replacements/sound.rs index e31b5cf7d183c6426f1a5eaf51b255b8d7dae45d..13ecab23be4c191d41d2a718b4697c3ac31727a4 100644 --- a/crates/openwa-wormkit/src/replacements/sound.rs +++ b/crates/openwa-dll/src/replacements/sound.rs @@ -1,6 +1,6 @@ //! Sound playback hooks. //! -//! Thin wormkit shim — game logic lives in `openwa_core::audio::sound_ops`. +//! Thin hook shim — game logic lives in `openwa_core::audio::sound_ops`. //! This file contains hook entry points, trampolines, and installation. //! //! Hooks: diff --git a/crates/openwa-wormkit/src/replacements/speech.rs b/crates/openwa-dll/src/replacements/speech.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/speech.rs rename to crates/openwa-dll/src/replacements/speech.rs diff --git a/crates/openwa-wormkit/src/replacements/sprite.rs b/crates/openwa-dll/src/replacements/sprite.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/sprite.rs rename to crates/openwa-dll/src/replacements/sprite.rs diff --git a/crates/openwa-wormkit/src/replacements/task/cloud.rs b/crates/openwa-dll/src/replacements/task/cloud.rs similarity index 90% rename from crates/openwa-wormkit/src/replacements/task/cloud.rs rename to crates/openwa-dll/src/replacements/task/cloud.rs index 3d8ec8bea17e66bb41c1015bcbe836a89d9ac64f..2533250d60191cf3f65ce12fc2f44847503ad8ec 100644 --- a/crates/openwa-wormkit/src/replacements/task/cloud.rs +++ b/crates/openwa-dll/src/replacements/task/cloud.rs @@ -1,6 +1,6 @@ //! CTaskCloud vtable hooks and CreateWeatherFilter replacement. //! -//! Thin wormkit shim — game logic lives in `openwa_core::task::cloud`. +//! Thin hook shim — game logic lives in `openwa_core::task::cloud`. use openwa_core::address::va; use openwa_core::log::log_line; diff --git a/crates/openwa-wormkit/src/replacements/task/filter.rs b/crates/openwa-dll/src/replacements/task/filter.rs similarity index 81% rename from crates/openwa-wormkit/src/replacements/task/filter.rs rename to crates/openwa-dll/src/replacements/task/filter.rs index e04ef12284d29a755d49eb9770ebf9b6148ac8dd..71d91e32158abf5c69f3d3d63553df772168bf29 100644 --- a/crates/openwa-wormkit/src/replacements/task/filter.rs +++ b/crates/openwa-dll/src/replacements/task/filter.rs @@ -1,6 +1,6 @@ //! CTaskFilter vtable hooks. //! -//! Thin wormkit shim — game logic lives in `openwa_core::task::filter::filter_handle_message`. +//! Thin hook shim — game logic lives in `openwa_core::task::filter::filter_handle_message`. use openwa_core::address::va; use openwa_core::log::log_line; diff --git a/crates/openwa-wormkit/src/replacements/task/mod.rs b/crates/openwa-dll/src/replacements/task/mod.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/task/mod.rs rename to crates/openwa-dll/src/replacements/task/mod.rs diff --git a/crates/openwa-wormkit/src/replacements/team.rs b/crates/openwa-dll/src/replacements/team.rs similarity index 98% rename from crates/openwa-wormkit/src/replacements/team.rs rename to crates/openwa-dll/src/replacements/team.rs index bca4b4bcacd1ca5688d95c60bedd177c161d01ed..9276e1b652cf7c8c6188f3532c2f8598a67910cf 100644 --- a/crates/openwa-wormkit/src/replacements/team.rs +++ b/crates/openwa-dll/src/replacements/team.rs @@ -1,6 +1,6 @@ //! Team and worm state accessor hooks. //! -//! Thin wormkit shim — all game logic lives in `openwa_core::engine::team_ops`. +//! Thin hook shim — all game logic lives in `openwa_core::engine::team_ops`. //! This file contains only usercall trampolines and hook installation. use openwa_core::address::va; diff --git a/crates/openwa-wormkit/src/replacements/trace_desync.rs b/crates/openwa-dll/src/replacements/trace_desync.rs similarity index 100% rename from crates/openwa-wormkit/src/replacements/trace_desync.rs rename to crates/openwa-dll/src/replacements/trace_desync.rs diff --git a/crates/openwa-wormkit/src/replacements/weapon.rs b/crates/openwa-dll/src/replacements/weapon.rs similarity index 98% rename from crates/openwa-wormkit/src/replacements/weapon.rs rename to crates/openwa-dll/src/replacements/weapon.rs index 3d890d85ab100631c4f0d332659ae467a08beffa..161d3062597c9772cd4d45703f576f32a5e7b9c5 100644 --- a/crates/openwa-wormkit/src/replacements/weapon.rs +++ b/crates/openwa-dll/src/replacements/weapon.rs @@ -1,6 +1,6 @@ //! Weapon hooks. //! -//! Thin wormkit shim — all game logic lives in `openwa_core::game::weapon_fire`. +//! Thin hook shim — all game logic lives in `openwa_core::game::weapon_fire`. //! This file contains usercall trampolines, passthrough hooks, and installation. //! //! Hooks: diff --git a/crates/openwa-wormkit/src/replacements/weapon_release.rs b/crates/openwa-dll/src/replacements/weapon_release.rs similarity index 96% rename from crates/openwa-wormkit/src/replacements/weapon_release.rs rename to crates/openwa-dll/src/replacements/weapon_release.rs index fcc3c9a055506844ae4a1e9463eabcf719e0307c..e4c4049cfa868b3d018f7d42cc81308227246ace 100644 --- a/crates/openwa-wormkit/src/replacements/weapon_release.rs +++ b/crates/openwa-dll/src/replacements/weapon_release.rs @@ -1,6 +1,6 @@ //! WeaponRelease hook (0x51C3D0) and SpawnEffect (0x547C30). //! -//! Thin wormkit shim — game logic lives in `openwa_core::game::weapon_release`. +//! Thin hook shim — game logic lives in `openwa_core::game::weapon_release`. //! This file contains usercall trampolines and hook installation. use openwa_core::address::va; diff --git a/crates/openwa-wormkit/src/snapshot.rs b/crates/openwa-dll/src/snapshot.rs similarity index 100% rename from crates/openwa-wormkit/src/snapshot.rs rename to crates/openwa-dll/src/snapshot.rs diff --git a/crates/openwa-wormkit/src/startup_checks.rs b/crates/openwa-dll/src/startup_checks.rs similarity index 100% rename from crates/openwa-wormkit/src/startup_checks.rs rename to crates/openwa-dll/src/startup_checks.rs diff --git a/crates/openwa-launcher/Cargo.toml b/crates/openwa-launcher/Cargo.toml index 0922e63ad6b061fd6e0d71a0d5432cd552c3429c..459a011d2d8d1fcd18d09e73e43f4d507e7d17ce 100644 --- a/crates/openwa-launcher/Cargo.toml +++ b/crates/openwa-launcher/Cargo.toml @@ -2,7 +2,7 @@ name = "openwa-launcher" version = "0.1.0" edition = "2021" -description = "Launcher that injects openwa_wormkit.dll into WA.exe before its main thread runs" +description = "Launcher that injects openwa.dll into WA.exe before its main thread runs" [[bin]] name = "openwa-launcher" diff --git a/crates/openwa-launcher/src/main.rs b/crates/openwa-launcher/src/main.rs index 410d8f1b189520a4bf8d620d32c743bf78548366..03a734494ba581df9f1f30d130f4a60ecf2b2923 100644 --- a/crates/openwa-launcher/src/main.rs +++ b/crates/openwa-launcher/src/main.rs @@ -125,10 +125,10 @@ fn run() -> Result<(), String> { } // Locate the DLL: same directory as the launcher executable. - let dll_path = launcher_dir()?.join("openwa_wormkit.dll"); + let dll_path = launcher_dir()?.join("openwa.dll"); if !dll_path.exists() { return Err(format!( - "openwa_wormkit.dll not found at: {}\nBuild with: cargo build --release -p openwa-wormkit", + "openwa.dll not found at: {}\nBuild with: cargo build --release -p openwa-dll", dll_path.display() )); } diff --git a/crates/openwa-test-runner/src/main.rs b/crates/openwa-test-runner/src/main.rs index 783674197e951accc70bc7b4d16b95a173c849cc..cdb7720cc4275be8b72715da3c16ca4eff4e0032 100644 --- a/crates/openwa-test-runner/src/main.rs +++ b/crates/openwa-test-runner/src/main.rs @@ -186,7 +186,7 @@ fn build() -> Result { "build", "--release", "-p", - "openwa-wormkit", + "openwa-dll", "-p", "openwa-launcher", ]) diff --git a/docs/plans/2026-03-05-openwa-foundation-design.md b/docs/plans/2026-03-05-openwa-foundation-design.md index a21af1ecdb50c260a50325be90c2db6aa15fd392..0a959d961d5db5b975848fc96916bbfeee00e8d4 100644 --- a/docs/plans/2026-03-05-openwa-foundation-design.md +++ b/docs/plans/2026-03-05-openwa-foundation-design.md @@ -19,7 +19,7 @@ OpenWA/ (Cargo workspace) - Structs: CTask, CGameTask (partial, Ghidra-verified) - Primitives: FixedPoint (16.16 fixed-point math) - Addresses: Known function/global addresses - openwa-wormkit/ (future: WormKit DLL module) + openwa-dll/ (future: WormKit DLL module) openwa-render/ (future: modern rendering backend) ``` diff --git a/docs/plans/2026-03-06-configuration-system-design.md b/docs/plans/2026-03-06-configuration-system-design.md index df7eee13f10ba32b3d440171d94dc07d058424ac..692297d3b6cfff1d75f9966047953db0ef71f227 100644 --- a/docs/plans/2026-03-06-configuration-system-design.md +++ b/docs/plans/2026-03-06-configuration-system-design.md @@ -70,8 +70,8 @@ All 7 functions are full Rust replacements — no trampolines needed. All conven | `crates/openwa-lib/Cargo.toml` | Add `windows` crate dependency | | `crates/openwa-lib/src/wa/registry.rs` (new) | `read_profile_int`, `delete_key_recursive` | | `crates/openwa-lib/src/wa/mod.rs` | Add `pub mod registry;` | -| `crates/openwa-wormkit/src/replacements/config.rs` (new) | 7 hook functions + `install()` | -| `crates/openwa-wormkit/src/replacements/mod.rs` | Add `pub mod config;` | +| `crates/openwa-dll/src/replacements/config.rs` (new) | 7 hook functions + `install()` | +| `crates/openwa-dll/src/replacements/mod.rs` | Add `pub mod config;` | ## Global Data References in LoadOptions @@ -93,7 +93,7 @@ These are read via rebased pointers (`rb(addr)`) and written to the GameInfo str ## Verification -1. Build: `cargo build --release -p openwa-wormkit` — clean +1. Build: `cargo build --release -p openwa-dll` — clean 2. Deploy wkOpenWA.dll to game directory 3. Launch game, check OpenWA.log for config hook messages 4. Verify game options persist (change Detail Level, restart, confirm it's saved) diff --git a/docs/plans/2026-03-06-configuration-system-plan.md b/docs/plans/2026-03-06-configuration-system-plan.md index 022d676445649868a21b19db26b9c8ebae86fdbf..4c31faab9f4e9dd1904c1a2a408bef0483bc0b55 100644 --- a/docs/plans/2026-03-06-configuration-system-plan.md +++ b/docs/plans/2026-03-06-configuration-system-plan.md @@ -4,7 +4,7 @@ **Goal:** Port 7 WA.exe configuration functions (theme I/O, registry management, game options loading) to Rust. -**Architecture:** New `config.rs` replacement module in openwa-wormkit hooks 7 functions. Registry helpers live in openwa-lib for reuse. Uses `windows` crate for Win32 registry/MessageBox APIs, `std::fs` for theme file I/O. +**Architecture:** New `config.rs` replacement module in openwa-dll hooks 7 functions. Registry helpers live in openwa-lib for reuse. Uses `windows` crate for Win32 registry/MessageBox APIs, `std::fs` for theme file I/O. **Tech Stack:** Rust, `windows` crate (Win32 registry + UI), MinHook inline hooks, `std::fs` @@ -28,7 +28,7 @@ windows-sys = { version = "0.59", features = [ ] } ``` -Note: Use `windows-sys` (not `windows`) — it's the raw FFI bindings crate, already used by openwa-wormkit. Lower overhead, no COM wrappers. +Note: Use `windows-sys` (not `windows`) — it's the raw FFI bindings crate, already used by openwa-dll. Lower overhead, no COM wrappers. **Step 2: Build to verify** @@ -294,8 +294,8 @@ feat: add Win32 registry helpers to openwa-lib ### Task 4: Create config.rs with Theme hooks **Files:** -- Create: `crates/openwa-wormkit/src/replacements/config.rs` -- Modify: `crates/openwa-wormkit/src/replacements/mod.rs` +- Create: `crates/openwa-dll/src/replacements/config.rs` +- Modify: `crates/openwa-dll/src/replacements/mod.rs` **Step 1: Add `mod config;` to mod.rs and call install** @@ -414,9 +414,9 @@ pub fn install() -> Result<(), String> { } ``` -**Step 3: Add windows-sys dependency to openwa-wormkit Cargo.toml** +**Step 3: Add windows-sys dependency to openwa-dll Cargo.toml** -The `windows-sys` dep in openwa-wormkit needs the UI feature too. Update the existing entry: +The `windows-sys` dep in openwa-dll needs the UI feature too. Update the existing entry: ```toml [target.'cfg(target_os = "windows")'.dependencies] @@ -428,7 +428,7 @@ windows-sys = { version = "0.59", features = [ **Step 4: Build to verify** -Run: `cargo build --release -p openwa-wormkit` +Run: `cargo build --release -p openwa-dll` Expected: clean build **Step 5: Deploy + test theme** @@ -446,7 +446,7 @@ feat: add Theme file I/O hooks (GetFileSize, Load, Save) ### Task 5: Add Registry hooks **Files:** -- Modify: `crates/openwa-wormkit/src/replacements/config.rs` +- Modify: `crates/openwa-dll/src/replacements/config.rs` **Step 1: Add registry hook functions** @@ -529,7 +529,7 @@ Add before the closing `Ok(())`: **Step 3: Build to verify** -Run: `cargo build --release -p openwa-wormkit` +Run: `cargo build --release -p openwa-dll` Expected: clean build **Step 4: Commit** @@ -543,7 +543,7 @@ feat: add Registry cleanup hooks (DeleteKeyRecursive, CleanAll) ### Task 6: Add GameInfo__LoadOptions hook **Files:** -- Modify: `crates/openwa-wormkit/src/replacements/config.rs` +- Modify: `crates/openwa-dll/src/replacements/config.rs` - Modify: `crates/openwa-types/src/address.rs` (global data addresses) **Step 1: Add global data address constants** @@ -768,7 +768,7 @@ Add to the unsafe block in `install()`: **Step 4: Build to verify** -Run: `cargo build --release -p openwa-wormkit` +Run: `cargo build --release -p openwa-dll` Expected: clean build **Step 5: Deploy + test options** @@ -786,7 +786,7 @@ feat: add GameInfo__LoadOptions hook (registry reads) ### Task 7: Add Options__GetCrashReportURL hook **Files:** -- Modify: `crates/openwa-wormkit/src/replacements/config.rs` +- Modify: `crates/openwa-dll/src/replacements/config.rs` - Modify: `crates/openwa-types/src/address.rs` **Step 1: Add global address for the URL buffer** @@ -841,7 +841,7 @@ unsafe extern "cdecl" fn hook_get_crash_report_url() -> u32 { **Step 4: Build to verify** -Run: `cargo build --release -p openwa-wormkit` +Run: `cargo build --release -p openwa-dll` Expected: clean build **Step 5: Commit** @@ -856,13 +856,13 @@ feat: add Options__GetCrashReportURL hook **Step 1: Build clean** -Run: `cargo build --release -p openwa-wormkit` +Run: `cargo build --release -p openwa-dll` Expected: clean build, no warnings **Step 2: Deploy** ```bash -cp target/i686-pc-windows-msvc/release/openwa_wormkit.dll "I:/games/SteamLibrary/steamapps/common/Worms Armageddon/wkOpenWA.dll" +cp target/i686-pc-windows-msvc/release/openwa.dll "I:/games/SteamLibrary/steamapps/common/Worms Armageddon/wkOpenWA.dll" ``` **Step 3: In-game verification** diff --git a/docs/plans/2026-03-07-replay-testing-design.md b/docs/plans/2026-03-07-replay-testing-design.md index a06c7a7e4040b6c9e8f248bad1b82a16d6d11d95..faf5eae2b560dd0f23bc28c25a80144fcc2050c6 100644 --- a/docs/plans/2026-03-07-replay-testing-design.md +++ b/docs/plans/2026-03-07-replay-testing-design.md @@ -19,7 +19,7 @@ WA.exe accepts a replay file (`.WAgame`) as a command-line argument. It starts p Orchestrates the full workflow: -1. Build both DLLs (`cargo build --release -p openwa-wormkit -p openwa-validator`) +1. Build both DLLs (`cargo build --release -p openwa-dll -p openwa-validator`) 2. Deploy to game directory (same as `deploy.ps1`) 3. Clear old `OpenWA_validation.log` and `OpenWA.log` in game directory 4. Set `OPENWA_REPLAY_TEST=1` in environment diff --git a/docs/plans/2026-03-07-replay-testing-plan.md b/docs/plans/2026-03-07-replay-testing-plan.md index 249c01a6b8d7a964a33695d9f1ffb47dc283a857..5ffb14e5fa2b1f494868cc9be8ac87e1b26d1ea1 100644 --- a/docs/plans/2026-03-07-replay-testing-plan.md +++ b/docs/plans/2026-03-07-replay-testing-plan.md @@ -170,12 +170,12 @@ if (-not (Test-Path $ReplayFile)) { # 1. Build Write-Host "Building..." -ForegroundColor Cyan -cargo build --release -p openwa-wormkit -p openwa-validator +cargo build --release -p openwa-dll -p openwa-validator if ($LASTEXITCODE -ne 0) { exit 1 } # 2. Deploy Write-Host "Deploying to $gameDir..." -ForegroundColor Cyan -Copy-Item "$src\openwa_wormkit.dll" "$gameDir\wkOpenWA.dll" +Copy-Item "$src\openwa.dll" "$gameDir\wkOpenWA.dll" Copy-Item "$src\openwa_validator.dll" "$gameDir\wkOpenWAValidator.dll" # 3. Clear old logs @@ -277,7 +277,7 @@ powershell -File replay-test.ps1 ``` This will: -- Build openwa-wormkit and openwa-validator +- Build openwa-dll and openwa-validator - Deploy DLLs to the WA game directory - Launch WA.exe with the default replay file (testdata/replays/bots.WAgame) - Wait for auto-capture (30s) and process exit diff --git a/docs/plans/2026-03-08-replay-fastforward-design.md b/docs/plans/2026-03-08-replay-fastforward-design.md index 1bf60f7aa2d55cb7008c9c990f6288b3e92f86fb..5aa13ff40542f53426a08c14d5497acd317bb6e9 100644 --- a/docs/plans/2026-03-08-replay-fastforward-design.md +++ b/docs/plans/2026-03-08-replay-fastforward-design.md @@ -55,7 +55,7 @@ Hooking the function that runs at each turn start would enable per-turn assertio ## Files -- `crates/openwa-wormkit/src/replacements/input.rs` (new) — GetAsyncKeyState hook -- `crates/openwa-wormkit/src/validation/mod.rs` — Update auto-capture timeout -- `crates/openwa-wormkit/src/lib.rs` — Register input module +- `crates/openwa-dll/src/replacements/input.rs` (new) — GetAsyncKeyState hook +- `crates/openwa-dll/src/validation/mod.rs` — Update auto-capture timeout +- `crates/openwa-dll/src/lib.rs` — Register input module - `replay-test.ps1` — Add WaitForExit timeout diff --git a/docs/superpowers/plans/2026-03-16-ddgame-constructor.md b/docs/superpowers/plans/2026-03-16-ddgame-constructor.md index ea40d4d6c49feac4989962987f4253248e51986e..f58d86cce2601315a0f894b01f4684aa93da8b87 100644 --- a/docs/superpowers/plans/2026-03-16-ddgame-constructor.md +++ b/docs/superpowers/plans/2026-03-16-ddgame-constructor.md @@ -244,7 +244,7 @@ git commit -m "feat: DDGame::new() phase 1 — allocation, params, trivial inits ### Task 4: Wire DDGame::new() into game_session.rs **Files:** -- Modify: `crates/openwa-wormkit/src/replacements/game_session.rs` +- Modify: `crates/openwa-dll/src/replacements/game_session.rs` - [ ] **Step 1: Replace ddgame_constructor_call with DDGame::new()** @@ -279,14 +279,14 @@ hook::install_trap!("DDGame__Constructor", va::CONSTRUCT_DD_GAME); - [ ] **Step 4: Build and test** -Run: `cargo build --target i686-pc-windows-msvc -p openwa-wormkit --release` +Run: `cargo build --target i686-pc-windows-msvc -p openwa-dll --release` This will fail at runtime because DDGame::new() doesn't yet call all the sub-constructors. That's expected — the next tasks add them incrementally. - [ ] **Step 5: Commit** ```bash -git add crates/openwa-wormkit/src/replacements/game_session.rs +git add crates/openwa-dll/src/replacements/game_session.rs git commit -m "refactor: wire DDGame::new() into game_session, trap original" ``` diff --git a/docs/superpowers/plans/2026-03-19-replay-loader.md b/docs/superpowers/plans/2026-03-19-replay-loader.md index 10d0e9d9f996177b1b92e7850974e8c10c60b9a8..58c190a24d3855f9328cfc223495d3840ff4a8f8 100644 --- a/docs/superpowers/plans/2026-03-19-replay-loader.md +++ b/docs/superpowers/plans/2026-03-19-replay-loader.md @@ -28,8 +28,8 @@ FFI bridges for complex sub-functions. | `crates/openwa-core/src/engine/replay.rs` | Create | ReplayStream struct, ParseReplayPosition, replay data types | | `crates/openwa-core/src/engine/mod.rs` | Modify | Add `pub mod replay` | | `crates/openwa-core/src/address.rs` | Modify | Add replay global addresses | -| `crates/openwa-wormkit/src/replacements/replay.rs` | Create | Hook installation, ReplayLoader replacement | -| `crates/openwa-wormkit/src/replacements/mod.rs` | Modify | Add `mod replay` + `replay::install()?` | +| `crates/openwa-dll/src/replacements/replay.rs` | Create | Hook installation, ReplayLoader replacement | +| `crates/openwa-dll/src/replacements/mod.rs` | Modify | Add `mod replay` + `replay::install()?` | --- @@ -571,8 +571,8 @@ git commit -m "feat: port ParseReplayPosition to Rust" ## Task 4: Hook Installation — Passthrough + ParseReplayPosition Replacement **Files:** -- Create: `crates/openwa-wormkit/src/replacements/replay.rs` -- Modify: `crates/openwa-wormkit/src/replacements/mod.rs` +- Create: `crates/openwa-dll/src/replacements/replay.rs` +- Modify: `crates/openwa-dll/src/replacements/mod.rs` Install hooks for both functions. ReplayLoader starts as a passthrough (call original, log params). ParseReplayPosition is fully replaced. @@ -580,7 +580,7 @@ original, log params). ParseReplayPosition is fully replaced. - [ ] **Step 1: Create replay.rs hook file** ```rust -// crates/openwa-wormkit/src/replacements/replay.rs +// crates/openwa-dll/src/replacements/replay.rs use crate::hook; use crate::log_line; @@ -637,14 +637,14 @@ pub fn install() -> Result<(), String> { - [ ] **Step 2: Register in mod.rs** -In `crates/openwa-wormkit/src/replacements/mod.rs`, add: +In `crates/openwa-dll/src/replacements/mod.rs`, add: - `mod replay;` in the module list - `replay::install()?;` in `install_all()` - [ ] **Step 3: Build** ```bash -cargo build --release -p openwa-wormkit +cargo build --release -p openwa-dll ``` Expected: compiles successfully. @@ -670,7 +670,7 @@ port produces the same frame numbers as the original. - [ ] **Step 6: Commit** ```bash -git add crates/openwa-wormkit/src/replacements/replay.rs crates/openwa-wormkit/src/replacements/mod.rs +git add crates/openwa-dll/src/replacements/replay.rs crates/openwa-dll/src/replacements/mod.rs git commit -m "feat: hook ReplayLoader (passthrough) and replace ParseReplayPosition" ``` @@ -679,7 +679,7 @@ git commit -m "feat: hook ReplayLoader (passthrough) and replace ParseReplayPosi ## Task 5: ReplayLoader Skeleton — Mode Routing + Header Parsing **Files:** -- Modify: `crates/openwa-wormkit/src/replacements/replay.rs` +- Modify: `crates/openwa-dll/src/replacements/replay.rs` - Modify: `crates/openwa-core/src/engine/replay.rs` Replace the passthrough with a mode-routing skeleton. Mode 1 (play) enters Rust; @@ -759,7 +759,7 @@ field offsets. - [ ] **Step 4: Commit** ```bash -git add crates/openwa-wormkit/src/replacements/replay.rs crates/openwa-core/src/engine/replay.rs +git add crates/openwa-dll/src/replacements/replay.rs crates/openwa-core/src/engine/replay.rs git commit -m "feat: ReplayLoader mode routing + header parsing in Rust" ``` @@ -768,7 +768,7 @@ git commit -m "feat: ReplayLoader mode routing + header parsing in Rust" ## Task 6: Version 2+ Payload Parsing — Scheme + Sub-version **Files:** -- Modify: `crates/openwa-wormkit/src/replacements/replay.rs` +- Modify: `crates/openwa-dll/src/replacements/replay.rs` - Modify: `crates/openwa-core/src/engine/replay.rs` Parse the first portion of the version 2+ payload: sub-version flags, game version @@ -801,7 +801,7 @@ powershell -ExecutionPolicy Bypass -File replay-test.ps1 -Headless - [ ] **Step 4: Commit** ```bash -git add crates/openwa-wormkit/src/replacements/replay.rs crates/openwa-core/src/engine/replay.rs +git add crates/openwa-dll/src/replacements/replay.rs crates/openwa-core/src/engine/replay.rs git commit -m "feat: ReplayLoader version 2+ scheme parsing" ``` @@ -810,7 +810,7 @@ git commit -m "feat: ReplayLoader version 2+ scheme parsing" ## Task 7: Version 2+ Payload Parsing — Team Data **Files:** -- Modify: `crates/openwa-wormkit/src/replacements/replay.rs` +- Modify: `crates/openwa-dll/src/replacements/replay.rs` Parse the team data section. This is the largest parsing section: 6 teams × 0xD7B stride with per-worm names and weapon data blocks. @@ -862,7 +862,7 @@ Headless: validates team/scheme data was written correctly. - [ ] **Step 6: Commit** ```bash -git add crates/openwa-wormkit/src/replacements/replay.rs +git add crates/openwa-dll/src/replacements/replay.rs git commit -m "feat: ReplayLoader team data parsing" ``` @@ -871,7 +871,7 @@ git commit -m "feat: ReplayLoader team data parsing" ## Task 8: Post-Parse + Map Loading (Section 4) **Files:** -- Modify: `crates/openwa-wormkit/src/replacements/replay.rs` +- Modify: `crates/openwa-dll/src/replacements/replay.rs` - [ ] **Step 1: Port post-parse logic** @@ -890,7 +890,7 @@ powershell -ExecutionPolicy Bypass -File replay-test.ps1 -Headless - [ ] **Step 3: Commit** ```bash -git add crates/openwa-wormkit/src/replacements/replay.rs +git add crates/openwa-dll/src/replacements/replay.rs git commit -m "feat: ReplayLoader post-parse and map loading" ``` @@ -899,7 +899,7 @@ git commit -m "feat: ReplayLoader post-parse and map loading" ## Task 9: Log Output (Section 5) **Files:** -- Modify: `crates/openwa-wormkit/src/replacements/replay.rs` +- Modify: `crates/openwa-dll/src/replacements/replay.rs` Port the /getlog formatted output (~600 lines). This must match byte-for-byte for headless replay testing. @@ -943,7 +943,7 @@ Both must pass. - [ ] **Step 5: Commit** ```bash -git add crates/openwa-wormkit/src/replacements/replay.rs +git add crates/openwa-dll/src/replacements/replay.rs git commit -m "feat: ReplayLoader log output formatting" ``` @@ -952,7 +952,7 @@ git commit -m "feat: ReplayLoader log output formatting" ## Task 10: Version 1 Legacy Path (Optional/Deferred) **Files:** -- Modify: `crates/openwa-wormkit/src/replacements/replay.rs` +- Modify: `crates/openwa-dll/src/replacements/replay.rs` Version 1 replays are from pre-3.5 WA. If encountered, the current implementation would need to delegate to the original. This task ports the version 1 path. diff --git a/docs/superpowers/plans/2026-04-01-sprite-parser.md b/docs/superpowers/plans/2026-04-01-sprite-parser.md index 34cd7eaed916c751f44c180140d6895f26bfbae0..fd8bd2b2a1003d666502e03021b1ce38c65ce426 100644 --- a/docs/superpowers/plans/2026-04-01-sprite-parser.md +++ b/docs/superpowers/plans/2026-04-01-sprite-parser.md @@ -6,7 +6,7 @@ **Architecture:** A shared `parse_spr_header()` function extracts metadata and data offsets from raw `.spr` bytes. `ParsedSprite::parse()` builds on it to produce an owned Rust struct with `Vec` data. The hook replacements use `parse_spr_header()` directly, operating on the raw buffer in-place for palette remapping and bitmap index translation. -**Tech Stack:** Rust, `openwa-core` (types/parser), `openwa-wormkit` (hooks), `minhook` (hooking), WA.exe runtime (PaletteContext__MapColor) +**Tech Stack:** Rust, `openwa-core` (types/parser), `openwa-dll` (hooks), `minhook` (hooking), WA.exe runtime (PaletteContext__MapColor) --- @@ -17,8 +17,8 @@ | `crates/openwa-core/src/render/spr.rs` (create) | `SprHeader`, `SprError`, `parse_spr_header()`, `ParsedSprite`, `ParsedSprite::parse()` | | `crates/openwa-core/src/render/mod.rs` (modify) | Add `pub mod spr;` and re-exports | | `crates/openwa-core/src/address.rs` (modify) | Add `PALETTE_CONTEXT_MAP_COLOR`, `DISPLAYGFX_VTABLE` | -| `crates/openwa-wormkit/src/replacements/sprite.rs` (create) | Hook trampolines + `install()` for ConstructSprite, ProcessSprite | -| `crates/openwa-wormkit/src/replacements/mod.rs` (modify) | Wire `sprite::install()` | +| `crates/openwa-dll/src/replacements/sprite.rs` (create) | Hook trampolines + `install()` for ConstructSprite, ProcessSprite | +| `crates/openwa-dll/src/replacements/mod.rs` (modify) | Wire `sprite::install()` | ## Reference: .spr Binary Format @@ -688,11 +688,11 @@ git commit -m "feat: add ParsedSprite type with owned .spr parser" ### Task 4: ConstructSprite Hook Replacement **Files:** -- Create: `crates/openwa-wormkit/src/replacements/sprite.rs` +- Create: `crates/openwa-dll/src/replacements/sprite.rs` - [ ] **Step 1: Create sprite.rs with ConstructSprite hook** -Create `crates/openwa-wormkit/src/replacements/sprite.rs`: +Create `crates/openwa-dll/src/replacements/sprite.rs`: ```rust //! Sprite loading hook replacements. @@ -749,22 +749,22 @@ pub fn install() -> Result<(), String> { - [ ] **Step 2: Verify it compiles** -Run: `cargo build -p openwa-wormkit --release 2>&1 | tail -5` +Run: `cargo build -p openwa-dll --release 2>&1 | tail -5` Expected: Compiles (sprite.rs is not yet in mod.rs, so it won't be included — this just checks syntax). Actually, it won't compile unless added to mod.rs. Skip to step 3. - [ ] **Step 3: Add to mod.rs and verify** -In `crates/openwa-wormkit/src/replacements/mod.rs`, add `mod sprite;` and add `sprite::install()?;` in `install_all()` after `render::install()?;`. +In `crates/openwa-dll/src/replacements/mod.rs`, add `mod sprite;` and add `sprite::install()?;` in `install_all()` after `render::install()?;`. -Run: `cargo build -p openwa-wormkit --release 2>&1 | tail -5` +Run: `cargo build -p openwa-dll --release 2>&1 | tail -5` Expected: Compiles without errors. - [ ] **Step 4: Commit** ```bash -git add crates/openwa-wormkit/src/replacements/sprite.rs crates/openwa-wormkit/src/replacements/mod.rs +git add crates/openwa-dll/src/replacements/sprite.rs crates/openwa-dll/src/replacements/mod.rs git commit -m "feat: add ConstructSprite hook replacement" ``` @@ -773,7 +773,7 @@ git commit -m "feat: add ConstructSprite hook replacement" ### Task 5: ProcessSprite Hook Replacement **Files:** -- Modify: `crates/openwa-wormkit/src/replacements/sprite.rs` +- Modify: `crates/openwa-dll/src/replacements/sprite.rs` This is the most complex task. ProcessSprite: 1. Reads header metadata via `parse_spr_header` @@ -985,13 +985,13 @@ pub fn install() -> Result<(), String> { - [ ] **Step 4: Build and verify** -Run: `cargo build -p openwa-wormkit --release 2>&1 | tail -5` +Run: `cargo build -p openwa-dll --release 2>&1 | tail -5` Expected: Compiles without errors. - [ ] **Step 5: Commit** ```bash -git add crates/openwa-wormkit/src/replacements/sprite.rs +git add crates/openwa-dll/src/replacements/sprite.rs git commit -m "feat: add ProcessSprite hook replacement with palette remapping" ``` diff --git a/docs/superpowers/specs/2026-03-15-ddgame-constructor-design.md b/docs/superpowers/specs/2026-03-15-ddgame-constructor-design.md index f8e959ad9ceca9783585d42366ac25e7e8bcab24..07d4a7bd188a76fa7f87261cce2f4e524f02c43d 100644 --- a/docs/superpowers/specs/2026-03-15-ddgame-constructor-design.md +++ b/docs/superpowers/specs/2026-03-15-ddgame-constructor-design.md @@ -85,7 +85,7 @@ DDGame__Constructor( | File | Action | |------|--------| | `crates/openwa-core/src/engine/ddgame.rs` | Add `DDGame::new()`, fill unknown fields | -| `crates/openwa-wormkit/src/replacements/game_session.rs` | Replace bridge with `DDGame::new()` | +| `crates/openwa-dll/src/replacements/game_session.rs` | Replace bridge with `DDGame::new()` | | `crates/openwa-core/src/address.rs` | Add addresses for sub-functions | ## Verification diff --git a/docs/superpowers/specs/2026-03-25-vtable-derive-design.md b/docs/superpowers/specs/2026-03-25-vtable-derive-design.md index ba0025cb023196c3cb5f5d90353665aa70665880..5a1995ee95dd562b5312055b7fce918f261d8117 100644 --- a/docs/superpowers/specs/2026-03-25-vtable-derive-design.md +++ b/docs/superpowers/specs/2026-03-25-vtable-derive-design.md @@ -332,6 +332,6 @@ This already exists in `display.rs` — factor it out. - `cargo build -p openwa-core` — types compile - `cargo test -p openwa-core` — existing tests pass -- `cargo build -p openwa-wormkit --release` — DLL builds +- `cargo build -p openwa-dll --release` — DLL builds - `.\run-tests.ps1` — replay tests pass (no desync from layout changes) - Validate introspection: `vtable_info_for("PaletteVtable")` returns correct slot metadata diff --git a/docs/superpowers/specs/2026-04-01-sprite-parser-design.md b/docs/superpowers/specs/2026-04-01-sprite-parser-design.md index 2b86cb6da07fad8016ec2925908c74a8ed026fb1..34ca97d5b5931cb8b7c29966f25abf15f55c0481 100644 --- a/docs/superpowers/specs/2026-04-01-sprite-parser-design.md +++ b/docs/superpowers/specs/2026-04-01-sprite-parser-design.md @@ -77,7 +77,7 @@ Pixel data is copied verbatim — no format conversion needed. ## Hook Replacements -New file `crates/openwa-wormkit/src/replacements/sprite.rs`: +New file `crates/openwa-dll/src/replacements/sprite.rs`: ### ConstructSprite (0x4FAA30) @@ -117,8 +117,8 @@ Recommended: use internal fields to derive bounds. The `data_size` header field |---|---| | `crates/openwa-core/src/render/spr.rs` | New: `ParsedSprite`, `SprError`, `parse()`, `populate_wa_sprite()` | | `crates/openwa-core/src/render/mod.rs` | Add `pub mod spr;` | -| `crates/openwa-wormkit/src/replacements/sprite.rs` | New: hook trampolines + `install()` | -| `crates/openwa-wormkit/src/replacements/mod.rs` | Wire `sprite::install()` | +| `crates/openwa-dll/src/replacements/sprite.rs` | New: hook trampolines + `install()` | +| `crates/openwa-dll/src/replacements/mod.rs` | Wire `sprite::install()` | ## Verification diff --git a/start-debug.ps1 b/start-debug.ps1 index 58db040f888aaee8ee8ed40a3883fe9b4ae4b1c2..da5a871c984495086490f2af0f6d68b8d05c7779 100644 --- a/start-debug.ps1 +++ b/start-debug.ps1 @@ -2,7 +2,7 @@ $ErrorActionPreference = "Stop" Write-Host "Building..." -ForegroundColor Cyan -cargo build --release -p openwa-launcher -p openwa-wormkit -p openwa-debug-cli --features openwa-wormkit/debug-ui +cargo build --release -p openwa-launcher -p openwa-dll -p openwa-debug-cli --features openwa-dll/debug-ui if ($LASTEXITCODE -ne 0) { exit 1 } $env:OPENWA_DEBUG_UI = "1" diff --git a/start.ps1 b/start.ps1 index e5db54d40b9748b5786a7d68d07e4b3f250f348f..8c1865ed80ff7b77950c9330d6fb42efd128e3e0 100644 --- a/start.ps1 +++ b/start.ps1 @@ -2,7 +2,7 @@ $ErrorActionPreference = "Stop" Write-Host "Building..." -ForegroundColor Cyan -cargo build --release -p openwa-launcher -p openwa-wormkit +cargo build --release -p openwa-launcher -p openwa-dll if ($LASTEXITCODE -ne 0) { exit 1 } & "target\i686-pc-windows-msvc\release\openwa-launcher.exe"