Skip to main content

Crate lzexe

Crate lzexe 

Source
Expand description

§lzexe

Decompresses DOS EXE files packed with LZEXE versions 0.90, 0.91, and 0.91e — the packer written by Fabrice Bellard in 1989/1990 that was used in many early DOS games (id Software, Apogee, etc.).

§Usage

let compressed = std::fs::read("program.exe").unwrap();

// Transparently handles both compressed and uncompressed EXEs
let data = lzexe::decompress(&compressed).unwrap();

// data now has the same layout as the uncompressed EXE;
// hard-coded file offsets work without adjustment.

§Output format

The returned bytes are a valid MZ EXE with a reconstructed header followed by the decompressed load image. File offsets in the output match those of the original uncompressed EXE, so any code that relies on absolute offsets (e.g. asset extractors) works without modification.

Uncompressed files are returned unchanged (zero-copy passthrough detection, then to_vec() only if it really is an LZEXE file).

§No dependencies

This crate has no runtime dependencies and is no_std-compatible (requires alloc).

Functions§

decompress
Decompresses an LZEXE 0.90/0.91/0.91e packed DOS EXE.
is_compressed
Returns true if the bytes appear to be LZEXE-compressed (0.90/0.91/0.91e).