diff --git a/CLAUDE.md b/CLAUDE.md index 66c6b6aab9aadc765294904cadcddf92277986db..a417c3387820be675e61decefad6fcc4b7a9a561 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -19,13 +19,13 @@ cargo build -p openwa-wormkit --release cargo build -p openwa-validator --release # Run tests (openwa-types is pure Rust, works on any host) -cargo test -p openwa-types +cargo test -p openwa-core # Run harness tests (must be 32-bit, needs WA.exe on disk) cargo test --target i686-pc-windows-msvc -p openwa-harness # Single test -cargo test -p openwa-types -- scheme_parse::parse_beginner_v2 +cargo test -p openwa-core -- scheme_parse::parse_beginner_v2 ``` ## Deploy to Game @@ -70,7 +70,7 @@ Environment variables: ## Crate Architecture -- **`openwa-types`** — Enums, structs, addresses, parsers (no_std compatible). The source of truth for all reverse-engineered type layouts and known addresses (`address.rs`). No game dependency. +- **`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 (`address.rs`). Contains `rebase` (ASLR delta), `wa_call` (calling convention helpers), and `wa/` (typed handle wrappers like `DDGameWrapperHandle`, `CWndHandle`). - **`openwa-wormkit`** — Unified WormKit cdylib that replaces WA functions with Rust and optionally validates types against live memory. Logs to `OpenWA.log` (hooks) and `OpenWA_validation.log` (validation). Uses MinHook for inline hooking. Validation is enabled via `OPENWA_VALIDATE=1` env var. - **`openwa-harness`** — Offline test harness that loads WA.exe into process memory via `LoadLibraryExA(DONT_RESOLVE_DLL_REFERENCES)` for testing without running the game. @@ -106,10 +106,11 @@ For `__usercall` functions, use a naked trampoline to capture register params be ## Key Files -- `crates/openwa-types/src/address.rs` — All known WA.exe addresses with comments +- `crates/openwa-core/src/address.rs` — All known WA.exe addresses with comments +- `crates/openwa-core/src/wa_call.rs` — Helpers for calling WA functions (thiscall, stdcall wrappers) +- `crates/openwa-core/src/rebase.rs` — ASLR delta computation +- `crates/openwa-core/src/wa/` — Typed WA function wrappers (MFC, frontend, registry, DDGame) - `crates/openwa-wormkit/src/replacements/` — Function replacements (one file per subsystem) -- `crates/openwa-wormkit/src/wa_call.rs` — Helpers for calling WA functions (thiscall, stdcall wrappers) -- `crates/openwa-wormkit/src/rebase.rs` — ASLR delta computation - `docs/re-notes/` — Reverse engineering documentation (task hierarchy, memory map, frontend screens) - `docs/plans/` — Design docs and implementation plans diff --git a/Cargo.lock b/Cargo.lock index 389dd6b2347f2ae9515233c8d1374bdae9375f77..9db40adb620ec7b231484774087a130e1378a2c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -72,34 +72,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] -name = "openwa-harness" +name = "openwa-core" version = "0.1.0" dependencies = [ - "libc", - "openwa-types", "windows-sys", ] [[package]] -name = "openwa-lib" +name = "openwa-harness" version = "0.1.0" dependencies = [ - "openwa-types", + "libc", + "openwa-core", "windows-sys", ] -[[package]] -name = "openwa-types" -version = "0.1.0" - [[package]] name = "openwa-wormkit" version = "0.1.0" dependencies = [ "heapless", "minhook", - "openwa-lib", - "openwa-types", + "openwa-core", "windows-sys", ] diff --git a/crates/openwa-lib/Cargo.toml b/crates/openwa-core/Cargo.toml similarity index 57% rename from crates/openwa-lib/Cargo.toml rename to crates/openwa-core/Cargo.toml index b6caac2b00f69ed911c35dbcfa27c6d1adfaf4f2..f91cb233c3ec2e0a09a9671458d016e9f34911b3 100644 --- a/crates/openwa-lib/Cargo.toml +++ b/crates/openwa-core/Cargo.toml @@ -1,11 +1,8 @@ [package] -name = "openwa-lib" +name = "openwa-core" version = "0.1.0" edition = "2021" -description = "Shared library for calling WA.exe functions with typed wrappers" - -[dependencies] -openwa-types = { path = "../openwa-types" } +description = "Core library for Worms Armageddon reverse engineering — types, addresses, and runtime utilities" [target.'cfg(target_os = "windows")'.dependencies] windows-sys = { version = "0.59", features = [ diff --git a/crates/openwa-types/src/address.rs b/crates/openwa-core/src/address.rs similarity index 100% rename from crates/openwa-types/src/address.rs rename to crates/openwa-core/src/address.rs diff --git a/crates/openwa-types/src/class_type.rs b/crates/openwa-core/src/class_type.rs similarity index 100% rename from crates/openwa-types/src/class_type.rs rename to crates/openwa-core/src/class_type.rs diff --git a/crates/openwa-types/src/ddgame.rs b/crates/openwa-core/src/ddgame.rs similarity index 100% rename from crates/openwa-types/src/ddgame.rs rename to crates/openwa-core/src/ddgame.rs diff --git a/crates/openwa-types/src/ddgame_wrapper.rs b/crates/openwa-core/src/ddgame_wrapper.rs similarity index 100% rename from crates/openwa-types/src/ddgame_wrapper.rs rename to crates/openwa-core/src/ddgame_wrapper.rs diff --git a/crates/openwa-types/src/dssound.rs b/crates/openwa-core/src/dssound.rs similarity index 100% rename from crates/openwa-types/src/dssound.rs rename to crates/openwa-core/src/dssound.rs diff --git a/crates/openwa-types/src/fixed.rs b/crates/openwa-core/src/fixed.rs similarity index 100% rename from crates/openwa-types/src/fixed.rs rename to crates/openwa-core/src/fixed.rs diff --git a/crates/openwa-types/src/frontend.rs b/crates/openwa-core/src/frontend.rs similarity index 100% rename from crates/openwa-types/src/frontend.rs rename to crates/openwa-core/src/frontend.rs diff --git a/crates/openwa-types/src/game_info.rs b/crates/openwa-core/src/game_info.rs similarity index 100% rename from crates/openwa-types/src/game_info.rs rename to crates/openwa-core/src/game_info.rs diff --git a/crates/openwa-types/src/landscape.rs b/crates/openwa-core/src/landscape.rs similarity index 100% rename from crates/openwa-types/src/landscape.rs rename to crates/openwa-core/src/landscape.rs diff --git a/crates/openwa-types/src/lib.rs b/crates/openwa-core/src/lib.rs similarity index 81% rename from crates/openwa-types/src/lib.rs rename to crates/openwa-core/src/lib.rs index 888195ad00903486eb903c622addb6fcc5daa7a3..cacde6a7160b0a652959d5e1027bf67bb83c735b 100644 --- a/crates/openwa-types/src/lib.rs +++ b/crates/openwa-core/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(non_snake_case)] + pub mod class_type; pub mod message; pub mod weapon; @@ -16,3 +18,6 @@ pub mod game_info; pub mod scheme; pub mod speech; pub mod address; +pub mod rebase; +pub mod wa; +pub mod wa_call; diff --git a/crates/openwa-types/src/message.rs b/crates/openwa-core/src/message.rs similarity index 100% rename from crates/openwa-types/src/message.rs rename to crates/openwa-core/src/message.rs diff --git a/crates/openwa-types/src/opengl.rs b/crates/openwa-core/src/opengl.rs similarity index 100% rename from crates/openwa-types/src/opengl.rs rename to crates/openwa-core/src/opengl.rs diff --git a/crates/openwa-lib/src/rebase.rs b/crates/openwa-core/src/rebase.rs similarity index 95% rename from crates/openwa-lib/src/rebase.rs rename to crates/openwa-core/src/rebase.rs index 737bf3be429f85db03e4af3d03d92d7c503ea351..73ab892c51c1b9d39d8328496d97183a56776a71 100644 --- a/crates/openwa-lib/src/rebase.rs +++ b/crates/openwa-core/src/rebase.rs @@ -2,7 +2,7 @@ use std::sync::atomic::{AtomicU32, Ordering}; -use openwa_types::address::va; +use crate::address::va; /// Delta to add to Ghidra addresses to get runtime addresses. static REBASE_DELTA: AtomicU32 = AtomicU32::new(0); diff --git a/crates/openwa-types/src/render.rs b/crates/openwa-core/src/render.rs similarity index 100% rename from crates/openwa-types/src/render.rs rename to crates/openwa-core/src/render.rs diff --git a/crates/openwa-types/src/scheme.rs b/crates/openwa-core/src/scheme.rs similarity index 100% rename from crates/openwa-types/src/scheme.rs rename to crates/openwa-core/src/scheme.rs diff --git a/crates/openwa-types/src/sound.rs b/crates/openwa-core/src/sound.rs similarity index 100% rename from crates/openwa-types/src/sound.rs rename to crates/openwa-core/src/sound.rs diff --git a/crates/openwa-types/src/speech.rs b/crates/openwa-core/src/speech.rs similarity index 100% rename from crates/openwa-types/src/speech.rs rename to crates/openwa-core/src/speech.rs diff --git a/crates/openwa-types/src/sprite.rs b/crates/openwa-core/src/sprite.rs similarity index 100% rename from crates/openwa-types/src/sprite.rs rename to crates/openwa-core/src/sprite.rs diff --git a/crates/openwa-types/src/task.rs b/crates/openwa-core/src/task.rs similarity index 100% rename from crates/openwa-types/src/task.rs rename to crates/openwa-core/src/task.rs diff --git a/crates/openwa-lib/src/wa/ddgame.rs b/crates/openwa-core/src/wa/ddgame.rs similarity index 95% rename from crates/openwa-lib/src/wa/ddgame.rs rename to crates/openwa-core/src/wa/ddgame.rs index e729d274f13a12e3477be83aa500a54822ba5086..1dc8a60a365b26ee14faffbcb0e462790718942a 100644 --- a/crates/openwa-lib/src/wa/ddgame.rs +++ b/crates/openwa-core/src/wa/ddgame.rs @@ -1,7 +1,7 @@ //! Typed handle for DDGameWrapper — the main game engine wrapper object. -use openwa_types::ddgame::DDGame; -use openwa_types::game_info::GameInfo; +use crate::ddgame::DDGame; +use crate::game_info::GameInfo; /// Zero-cost handle to a DDGameWrapper instance (raw pointer as u32). /// diff --git a/crates/openwa-lib/src/wa/frontend.rs b/crates/openwa-core/src/wa/frontend.rs similarity index 95% rename from crates/openwa-lib/src/wa/frontend.rs rename to crates/openwa-core/src/wa/frontend.rs index 8efa6f457871832c0eba8794b897e84be2d52587..11c26678d286f8711192f169369bd1603a2d8ed4 100644 --- a/crates/openwa-lib/src/wa/frontend.rs +++ b/crates/openwa-core/src/wa/frontend.rs @@ -1,7 +1,7 @@ //! WA-internal frontend function wrappers. use crate::rebase::rb; -use openwa_types::address::va; +use crate::address::va; /// Frontend__PaletteAnimation (0x422180) /// diff --git a/crates/openwa-lib/src/wa/mfc.rs b/crates/openwa-core/src/wa/mfc.rs similarity index 99% rename from crates/openwa-lib/src/wa/mfc.rs rename to crates/openwa-core/src/wa/mfc.rs index 1f35e58524f996e12bc299a1650551d1ad72d3b6..f1abc76b9df2d3de27fad899ce8e4db2f06854a3 100644 --- a/crates/openwa-lib/src/wa/mfc.rs +++ b/crates/openwa-core/src/wa/mfc.rs @@ -2,7 +2,7 @@ use crate::rebase::rb; use crate::wa_call; -use openwa_types::address::va; +use crate::address::va; /// Zero-cost handle to a CWnd-derived MFC window (raw pointer as u32). #[derive(Clone, Copy)] diff --git a/crates/openwa-lib/src/wa/mod.rs b/crates/openwa-core/src/wa/mod.rs similarity index 100% rename from crates/openwa-lib/src/wa/mod.rs rename to crates/openwa-core/src/wa/mod.rs diff --git a/crates/openwa-lib/src/wa/registry.rs b/crates/openwa-core/src/wa/registry.rs similarity index 100% rename from crates/openwa-lib/src/wa/registry.rs rename to crates/openwa-core/src/wa/registry.rs diff --git a/crates/openwa-lib/src/wa/resource.rs b/crates/openwa-core/src/wa/resource.rs similarity index 100% rename from crates/openwa-lib/src/wa/resource.rs rename to crates/openwa-core/src/wa/resource.rs diff --git a/crates/openwa-lib/src/wa_call.rs b/crates/openwa-core/src/wa_call.rs similarity index 100% rename from crates/openwa-lib/src/wa_call.rs rename to crates/openwa-core/src/wa_call.rs diff --git a/crates/openwa-types/src/weapon.rs b/crates/openwa-core/src/weapon.rs similarity index 100% rename from crates/openwa-types/src/weapon.rs rename to crates/openwa-core/src/weapon.rs diff --git a/crates/openwa-types/tests/fixtures/beginner.wsc b/crates/openwa-core/tests/fixtures/beginner.wsc similarity index 100% rename from crates/openwa-types/tests/fixtures/beginner.wsc rename to crates/openwa-core/tests/fixtures/beginner.wsc diff --git a/crates/openwa-types/tests/fixtures/classic.wsc b/crates/openwa-core/tests/fixtures/classic.wsc similarity index 100% rename from crates/openwa-types/tests/fixtures/classic.wsc rename to crates/openwa-core/tests/fixtures/classic.wsc diff --git a/crates/openwa-types/tests/fixtures/shopping.wsc b/crates/openwa-core/tests/fixtures/shopping.wsc similarity index 100% rename from crates/openwa-types/tests/fixtures/shopping.wsc rename to crates/openwa-core/tests/fixtures/shopping.wsc diff --git a/crates/openwa-types/tests/scheme_parse.rs b/crates/openwa-core/tests/scheme_parse.rs similarity index 99% rename from crates/openwa-types/tests/scheme_parse.rs rename to crates/openwa-core/tests/scheme_parse.rs index c8699cab680667f1c6f17465e9bc4266ff920213..100bdc31a47cf3c6dab13922500fe3997a0bdcf9 100644 --- a/crates/openwa-types/tests/scheme_parse.rs +++ b/crates/openwa-core/tests/scheme_parse.rs @@ -1,6 +1,6 @@ use std::path::Path; -use openwa_types::scheme::{ +use openwa_core::scheme::{ ExtendedOptions, SchemeFile, SchemeVersion, EXTENDED_OPTIONS_DEFAULTS, EXTENDED_OPTIONS_SIZE, SCHEME_PAYLOAD_V1, SCHEME_PAYLOAD_V2, WEAPONS_V1_COUNT, }; diff --git a/crates/openwa-harness/Cargo.toml b/crates/openwa-harness/Cargo.toml index 1150435e04475de1f0613fb28785b1826301327a..cc0c6053a455d9187c53152c5e23758388a6a5a8 100644 --- a/crates/openwa-harness/Cargo.toml +++ b/crates/openwa-harness/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" description = "Offline test harness — loads WA.exe into process memory for validation" [dependencies] -openwa-types = { path = "../openwa-types" } +openwa-core = { path = "../openwa-core" } libc = "0.2" [target.'cfg(target_os = "windows")'.dependencies] diff --git a/crates/openwa-harness/src/lib.rs b/crates/openwa-harness/src/lib.rs index aa8043d64a31b382a5007e97222263b6891762ca..8ba96d27c793bdcf20c5f618409f28271577aa45 100644 --- a/crates/openwa-harness/src/lib.rs +++ b/crates/openwa-harness/src/lib.rs @@ -1,6 +1,6 @@ #![allow(non_snake_case)] -use openwa_types::address::va; +use openwa_core::address::va; #[cfg(target_os = "windows")] use windows_sys::Win32::System::LibraryLoader::{LoadLibraryExA, DONT_RESOLVE_DLL_REFERENCES}; diff --git a/crates/openwa-lib/src/lib.rs b/crates/openwa-lib/src/lib.rs deleted file mode 100644 index fc3b11b9e9d39fcbea0aaadcf51c939e8dc90f0c..0000000000000000000000000000000000000000 --- a/crates/openwa-lib/src/lib.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![allow(non_snake_case)] - -pub mod rebase; -pub mod wa; -pub mod wa_call; diff --git a/crates/openwa-types/Cargo.toml b/crates/openwa-types/Cargo.toml deleted file mode 100644 index edd87e99bd9d42c0d12724d6b1fc44534a298481..0000000000000000000000000000000000000000 --- a/crates/openwa-types/Cargo.toml +++ /dev/null @@ -1,5 +0,0 @@ -[package] -name = "openwa-types" -version = "0.1.0" -edition = "2021" -description = "Type definitions for Worms Armageddon reverse engineering" diff --git a/crates/openwa-wormkit/Cargo.toml b/crates/openwa-wormkit/Cargo.toml index f459de2fbf289d1def9da83178815941306e9b52..8f9d9e47d4308dc8e902e9c72c74015a9bbe4417 100644 --- a/crates/openwa-wormkit/Cargo.toml +++ b/crates/openwa-wormkit/Cargo.toml @@ -8,8 +8,7 @@ description = "WormKit DLL that replaces WA.exe functions with Rust reimplementa crate-type = ["cdylib"] [dependencies] -openwa-types = { path = "../openwa-types" } -openwa-lib = { path = "../openwa-lib" } +openwa-core = { path = "../openwa-core" } heapless = "0.9" minhook = "0.9" diff --git a/crates/openwa-wormkit/src/hook.rs b/crates/openwa-wormkit/src/hook.rs index 106824616a1fdd419310091a2462a492b46d60f9..722a36d4ae1056c3525108213da88eeaa0259417 100644 --- a/crates/openwa-wormkit/src/hook.rs +++ b/crates/openwa-wormkit/src/hook.rs @@ -317,7 +317,7 @@ use std::ffi::c_void; use minhook::MinHook; use crate::log_line; -use openwa_lib::rebase::rb; +use openwa_core::rebase::rb; /// Install a MinHook inline hook on a WA.exe function. /// diff --git a/crates/openwa-wormkit/src/lib.rs b/crates/openwa-wormkit/src/lib.rs index f882921d7aaaaccfc0f9d2cf51379dc5f4813625..0eff9fd2aa0a9ad8e3644e63efe27be800a7cbaa 100644 --- a/crates/openwa-wormkit/src/lib.rs +++ b/crates/openwa-wormkit/src/lib.rs @@ -54,7 +54,7 @@ fn clear_log() -> std::io::Result<()> { fn run() -> Result<(), String> { let _ = clear_log(); - let delta = openwa_lib::rebase::init(); + let delta = openwa_core::rebase::init(); let _ = log_line(&format!( "=== OpenWA WormKit DLL loaded ===\n ASLR delta: 0x{delta:08X}" )); diff --git a/crates/openwa-wormkit/src/replacements/config.rs b/crates/openwa-wormkit/src/replacements/config.rs index 991a04cb0fe0c65b67cb0e6706b4a1130b2753c7..59026426f10980983405773dc1590655004a1a4e 100644 --- a/crates/openwa-wormkit/src/replacements/config.rs +++ b/crates/openwa-wormkit/src/replacements/config.rs @@ -9,9 +9,9 @@ //! - GameInfo__LoadOptions (0x460AC0): game options from registry //! - Options__GetCrashReportURL (0x5A63F0): crash report URL from registry -use openwa_types::address::va; +use openwa_core::address::va; use crate::log_line; -use openwa_lib::rebase::rb; +use openwa_core::rebase::rb; const THEME_PATH: &str = "data\\current.thm"; const CLEAN_ALL_FLAG_OFFSET: usize = 0xE0; @@ -86,7 +86,7 @@ unsafe extern "stdcall" fn hook_delete_key_recursive(hkey: u32, subkey: u32) -> let _ = log_line(&format!("[Config] DeleteKeyRecursive: {subkey_str}")); - let result = openwa_lib::wa::registry::delete_key_recursive( + let result = openwa_core::wa::registry::delete_key_recursive( hkey as usize as HKEY, &subkey_str, ); @@ -114,7 +114,7 @@ unsafe extern "stdcall" fn hook_registry_clean_all(struct_ptr: u32) { ]; for section in §ions { - openwa_lib::wa::registry::delete_key_recursive(HKEY_CURRENT_USER, section); + openwa_core::wa::registry::delete_key_recursive(HKEY_CURRENT_USER, section); } // Clear the NetSettings INI section @@ -138,8 +138,8 @@ unsafe extern "stdcall" fn hook_registry_clean_all(struct_ptr: u32) { /// Reads game options from the Windows registry and copies various globals /// into the GameInfo struct at known offsets. unsafe extern "stdcall" fn hook_load_options(gi_ptr: u32) { - use openwa_lib::wa::registry::read_profile_int; - use openwa_types::game_info::GameInfo; + use openwa_core::wa::registry::read_profile_int; + use openwa_core::game_info::GameInfo; let gi = &mut *(gi_ptr as *mut GameInfo); @@ -273,7 +273,7 @@ unsafe extern "cdecl" fn hook_get_crash_report_url() -> u32 { let buf = rb(va::G_CRASH_REPORT_URL) as *mut u8; let buf_slice = core::slice::from_raw_parts_mut(buf, CRASH_REPORT_URL_BUF_SIZE); - let len = openwa_lib::wa::registry::read_profile_string( + let len = openwa_core::wa::registry::read_profile_string( "Options", "CrashReportURL", buf_slice, diff --git a/crates/openwa-wormkit/src/replacements/frontend.rs b/crates/openwa-wormkit/src/replacements/frontend.rs index 3009410464b445cc2ccc41142f359b96af6a7892..56b5372623102ead97e9928f25eaecbe13c415ef 100644 --- a/crates/openwa-wormkit/src/replacements/frontend.rs +++ b/crates/openwa-wormkit/src/replacements/frontend.rs @@ -6,10 +6,10 @@ use std::sync::atomic::{AtomicU32, Ordering}; use crate::log_line; -use openwa_lib::wa::mfc::{CDialogHandle, CWndHandle}; -use openwa_lib::wa_call; -use openwa_types::address::va; -use openwa_types::frontend::ScreenId; +use openwa_core::wa::mfc::{CDialogHandle, CWndHandle}; +use openwa_core::wa_call; +use openwa_core::address::va; +use openwa_core::frontend::ScreenId; // Frontend dialog struct offsets (MFC CDialog-derived) const DIALOG_FLAGS: usize = 0x3C; @@ -52,7 +52,7 @@ unsafe extern "cdecl" fn frontend_change_screen_impl(dialog: u32, screen_id: u32 let palette_param = *((dialog as usize + DIALOG_PALETTE_PARAM) as *const u32); let eax_value = *((dialog as usize + DIALOG_PALETTE_OBJ) as *const u32); - openwa_lib::wa::frontend::palette_animation(eax_value, palette_param); + openwa_core::wa::frontend::palette_animation(eax_value, palette_param); for i in 1u32..=2 { let vtable = *(dialog as *const u32); diff --git a/crates/openwa-wormkit/src/replacements/input.rs b/crates/openwa-wormkit/src/replacements/input.rs index cad472fdbca401f8b96bca4cd427c8e901c7b4f3..a1b4defd45d16cc97e1e2d333033473275c26c30 100644 --- a/crates/openwa-wormkit/src/replacements/input.rs +++ b/crates/openwa-wormkit/src/replacements/input.rs @@ -14,10 +14,10 @@ use std::sync::atomic::{AtomicU32, Ordering}; use crate::hook; use crate::log_line; -use openwa_lib::rebase::rb; -use openwa_types::address::va; -use openwa_types::ddgame::DDGame; -use openwa_types::ddgame_wrapper::DDGameWrapper; +use openwa_core::rebase::rb; +use openwa_core::address::va; +use openwa_core::ddgame::DDGame; +use openwa_core::ddgame_wrapper::DDGameWrapper; /// Trampoline to the original TurnManager_ProcessFrame. static ORIG_TURN_MANAGER: AtomicU32 = AtomicU32::new(0); diff --git a/crates/openwa-wormkit/src/replacements/render.rs b/crates/openwa-wormkit/src/replacements/render.rs index 20c38a9782315ddc4db292ce098ec519cf053be4..c6cfad85fdd51a077cf57e55ab214b3ec9de5518 100644 --- a/crates/openwa-wormkit/src/replacements/render.rs +++ b/crates/openwa-wormkit/src/replacements/render.rs @@ -3,10 +3,10 @@ //! All functions enqueue commands to the RenderQueue's downward-growing buffer. //! Calling conventions are __usercall variants with register + stack params. -use openwa_lib::rebase::rb; -use openwa_types::address::va; -use openwa_types::render::*; -use openwa_types::task::{BungeeTrailTask, WeaponAimTask}; +use openwa_core::rebase::rb; +use openwa_core::address::va; +use openwa_core::render::*; +use openwa_core::task::{BungeeTrailTask, WeaponAimTask}; use crate::hook::{self, usercall_trampoline}; diff --git a/crates/openwa-wormkit/src/replacements/scheme.rs b/crates/openwa-wormkit/src/replacements/scheme.rs index 2c69317bc49a57ec1821bd963ef64a4874d4b255..b2a1ec77c1227f8a53160c4cb0e38970d48768ca 100644 --- a/crates/openwa-wormkit/src/replacements/scheme.rs +++ b/crates/openwa-wormkit/src/replacements/scheme.rs @@ -15,9 +15,9 @@ use std::path::Path; use std::sync::atomic::{AtomicU32, Ordering}; use crate::log_line; -use openwa_lib::rebase::rb; -use openwa_types::address::va; -use openwa_types::scheme::{ +use openwa_core::rebase::rb; +use openwa_core::address::va; +use openwa_core::scheme::{ ExtendedOptions, SchemeFile, SchemeVersion, EXTENDED_OPTIONS_DEFAULTS, EXTENDED_OPTIONS_SIZE, SCHEME_PAYLOAD_V1, SCHEME_PAYLOAD_V2, SCHEME_PAYLOAD_V3, }; @@ -355,7 +355,7 @@ unsafe extern "fastcall" fn hook_init_from_data( dest: u32, name_cstring: u32, ) { - use openwa_lib::wa::mfc::{cstring_release, CStringRef}; + use openwa_core::wa::mfc::{cstring_release, CStringRef}; // Step 1: Copy 0xD8 bytes (V1 payload) from src_data to dest+0x14 core::ptr::copy_nonoverlapping( @@ -440,7 +440,7 @@ unsafe extern "stdcall" fn hook_scan_directory(cstring_param: u32) { let _ = log_line("[Scheme] ScanDirectory completed (Rust)"); // Release the CString parameter's refcount (caller transferred ownership) - openwa_lib::wa::mfc::cstring_release(cstring_param); + openwa_core::wa::mfc::cstring_release(cstring_param); } /// Parse a scheme filename matching the pattern `{{DD}} name.wsc`. @@ -530,7 +530,7 @@ const BUILTIN_SCHEME_NAMES: [&str; 14] = [ /// Zeros slot flags, scans for existing scheme files, then extracts missing /// built-in schemes from PE resources (type "SCHEMES") to User\Schemes\. unsafe extern "stdcall" fn hook_extract_builtins() { - use openwa_lib::wa::resource; + use openwa_core::wa::resource; // Step 1: Zero 16 bytes of slot flags (4 DWORDs covering slots 0-15) let slot_flags = rb(va::SCHEME_SLOT_FLAGS) as *mut u8; diff --git a/crates/openwa-wormkit/src/replacements/sound.rs b/crates/openwa-wormkit/src/replacements/sound.rs index f7f5a12c62d1f3c64b02505315335141a5618945..6459e3b53e968f1c8f5219301a1232543a2aac88 100644 --- a/crates/openwa-wormkit/src/replacements/sound.rs +++ b/crates/openwa-wormkit/src/replacements/sound.rs @@ -9,10 +9,10 @@ use std::sync::atomic::Ordering; -use openwa_types::address::va; -use openwa_types::ddgame::{DDGame, SoundQueueEntry}; -use openwa_types::sound::SoundId; -use openwa_types::task::CGameTask; +use openwa_core::address::va; +use openwa_core::ddgame::{DDGame, SoundQueueEntry}; +use openwa_core::sound::SoundId; +use openwa_core::task::CGameTask; use crate::hook; use crate::log_line; diff --git a/crates/openwa-wormkit/src/replacements/speech.rs b/crates/openwa-wormkit/src/replacements/speech.rs index a88615d25af72ee86d072a133b9ef7da356e83ed..3416c7a951a6a57d43f1dcd62f3b0cf119018453 100644 --- a/crates/openwa-wormkit/src/replacements/speech.rs +++ b/crates/openwa-wormkit/src/replacements/speech.rs @@ -12,10 +12,10 @@ use std::sync::atomic::{AtomicU32, Ordering}; use heapless::CString; -use openwa_lib::rebase::rb; -use openwa_lib::wa::ddgame::DDGameWrapperHandle; -use openwa_types::address::va::{self, game_info_offsets}; -use openwa_types::speech::SpeechLineTableEntry; +use openwa_core::rebase::rb; +use openwa_core::wa::ddgame::DDGameWrapperHandle; +use openwa_core::address::va::{self, game_info_offsets}; +use openwa_core::speech::SpeechLineTableEntry; use crate::hook::{self, usercall_trampoline}; use crate::log_line; diff --git a/crates/openwa-wormkit/src/replacements/team.rs b/crates/openwa-wormkit/src/replacements/team.rs index f38850e93e59dd81364f304c5b6ab601b3ee29c4..82a2773cf0cc3b67d175a09e119d05997dd090ff 100644 --- a/crates/openwa-wormkit/src/replacements/team.rs +++ b/crates/openwa-wormkit/src/replacements/team.rs @@ -10,8 +10,8 @@ //! - CheckAnyWormState0x8b (0x522970): scan all teams for state 0x8b //! - SetActiveWorm_Maybe (0x522500): update team active state and counters -use openwa_types::address::va; -use openwa_types::ddgame::{self, TeamArenaRef}; +use openwa_core::address::va; +use openwa_core::ddgame::{self, TeamArenaRef}; use crate::hook::{self, usercall_trampoline}; diff --git a/crates/openwa-wormkit/src/replacements/weapon.rs b/crates/openwa-wormkit/src/replacements/weapon.rs index 2019266e82adb07684211c213ec9f78f5ca08f34..099ef7d31fabceb71f3a00aa0624257419c5e681 100644 --- a/crates/openwa-wormkit/src/replacements/weapon.rs +++ b/crates/openwa-wormkit/src/replacements/weapon.rs @@ -6,9 +6,9 @@ //! - SubtractAmmo (0x522680): decrement ammo count //! - CountAliveWorms (0x5225A0): check if >1 worm alive on team -use openwa_types::address::va; -use openwa_types::ddgame::{self, TeamArenaRef}; -use openwa_types::weapon::Weapon; +use openwa_core::address::va; +use openwa_core::ddgame::{self, TeamArenaRef}; +use openwa_core::weapon::Weapon; use crate::hook::{self, usercall_trampoline}; diff --git a/crates/openwa-wormkit/src/validation/hooks/detour.rs b/crates/openwa-wormkit/src/validation/hooks/detour.rs index 977e2a61777ea2eda892061f65659c181c805de0..ab570e531e2f9b0023e43457c9c8b72d8f732a5e 100644 --- a/crates/openwa-wormkit/src/validation/hooks/detour.rs +++ b/crates/openwa-wormkit/src/validation/hooks/detour.rs @@ -5,8 +5,8 @@ use std::sync::atomic::{AtomicU32, Ordering}; use minhook::MinHook; -use openwa_lib::rebase::rb; -use openwa_types::address::va; +use openwa_core::rebase::rb; +use openwa_core::address::va; use super::log_validation; diff --git a/crates/openwa-wormkit/src/validation/hooks/vtable.rs b/crates/openwa-wormkit/src/validation/hooks/vtable.rs index ccb0acaa3c913d6f50417e76d7f505d7ea01cc3d..d12d4b38a6692ccffe686047665d60c59cafef4d 100644 --- a/crates/openwa-wormkit/src/validation/hooks/vtable.rs +++ b/crates/openwa-wormkit/src/validation/hooks/vtable.rs @@ -2,8 +2,8 @@ use std::sync::atomic::{AtomicU32, Ordering}; -use openwa_lib::rebase::rb; -use openwa_types::address::va; +use openwa_core::rebase::rb; +use openwa_core::address::va; use super::log_validation; diff --git a/crates/openwa-wormkit/src/validation/mod.rs b/crates/openwa-wormkit/src/validation/mod.rs index eed79a00eb5bbb00b00985aa4946b01988d0d52a..93b90e1bda76132d0bf9a035819bcaeb12fa9582 100644 --- a/crates/openwa-wormkit/src/validation/mod.rs +++ b/crates/openwa-wormkit/src/validation/mod.rs @@ -1,4 +1,4 @@ -//! Runtime validation of openwa-types against live WA.exe memory. +//! Runtime validation of openwa-core against live WA.exe memory. //! //! Enabled by setting `OPENWA_VALIDATE=1` environment variable. //! When `OPENWA_REPLAY_TEST=1` is also set, enters auto-capture mode: @@ -9,11 +9,11 @@ mod hooks; use std::sync::atomic::{AtomicU32, Ordering}; -use openwa_lib::rebase::rb; -use openwa_types::address::va; -use openwa_types::task::{CTask, CGameTask}; -use openwa_types::ddgame::DDGame; -use openwa_types::ddgame_wrapper::DDGameWrapper; +use openwa_core::rebase::rb; +use openwa_core::address::va; +use openwa_core::task::{CTask, CGameTask}; +use openwa_core::ddgame::DDGame; +use openwa_core::ddgame_wrapper::DDGameWrapper; static DUMP_COUNTER: AtomicU32 = AtomicU32::new(0); @@ -402,7 +402,7 @@ fn deferred_global_validation() { // --------------------------------------------------------------------------- fn dump_team_blocks() { - use openwa_types::ddgame::{offsets, TeamArenaRef}; + use openwa_core::ddgame::{offsets, TeamArenaRef}; let dump_num = DUMP_COUNTER.fetch_add(1, Ordering::Relaxed); let _ = log_validation(""); @@ -597,7 +597,7 @@ fn dump_team_blocks() { // --------------------------------------------------------------------------- fn dump_landscape() { - use openwa_types::landscape::PCLandscape; + use openwa_core::landscape::PCLandscape; let dump_num = DUMP_COUNTER.fetch_add(1, Ordering::Relaxed); let _ = log_validation("");