Skip to main content

Crate war3parser

Crate war3parser 

Source
Expand description

§war3parser

A library for parsing and extracting Warcraft III map files (.w3x / .w3m).

§Crate layout

  • archive — the map container: optional HM3W header + embedded MPQ
  • carve — metadata salvage for archives whose MPQ tables are unreadable
  • formats — parsers for the member files (w3i, wts, imp, mmp)
  • model — portable data structures shared by CLI / WASM / library users
  • reader — bounds-checked little-endian reader::ByteReader
  • error — the crate-wide error::Error type

The war3map.w3i parser supports the full format-version ladder v8 → v33 (Reign of Chaos betas through WC3 2.0); see formats::w3i::FormatVersion.

§Features

FeatureDefaultPurpose
serdeyesJSON serialization for dumps and the WASM bridge
carveyescarve salvage for unreadable archives (pulls in flate2)

§Example

use war3parser::prelude::*;

let buffer = std::fs::read("path/to/map.w3x")?;
let mut metadata = War3MapMetadata::parse(&buffer)?;
metadata.resolve_trigger_strings();
let snapshot = metadata.snapshot()?;
println!("{:?}", snapshot.map_info.map(|i| i.name));

Modules§

archive
Map container: optional HM3W header followed by an embedded MPQ archive.
carve
Metadata recovery for archives whose MPQ tables cannot be read.
error
Crate-wide error type.
formats
Parsers for the individual file formats found inside a map archive.
model
Portable, reusable data model shared by the library, CLI, and WASM bindings.
modscan
Detection of known third-party modifications injected into map scripts.
prelude
The most commonly used types in one import.
reader
Zero-copy little-endian cursor over a byte slice.

Structs§

ImportEntry
Single import path as exposed to CLI/WASM consumers.
MapSnapshot
Portable map snapshot shared by the CLI, WASM bindings, and serde dumps.
ModInfo
A modification recognised inside a map script.
StringTableEntry
Single WTS entry as exposed to CLI/WASM consumers.
War3Image
Raster image held in memory (not directly serializable).
War3ImageData
Portable image representation used by CLI dumps and WASM.
War3MapHeader
Fields of the optional HM3W prefix that precedes the embedded MPQ.
War3MapMetadata
Rich in-memory parse result.
War3MapW3x
A Warcraft III map file (.w3x / .w3m): optional HM3W header plus the embedded MPQ archive.

Enums§

Error
Errors produced while parsing map files or converting assets.