Implement full decrypt + decompress pipeline for XEX2 PE extraction: - decompress.rs: None, Basic (zero-fill), and Normal (LZX) decompression - extract.rs: orchestrates decryption then decompression - Wire up CLI extract command to write PE files - LZX decompression via lzxd crate with per-frame chunk processing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.4 KiB
Rust
50 lines
1.4 KiB
Rust
//! # xex2tractor
|
|
//!
|
|
//! A library for parsing Xbox 360 XEX2 executable files.
|
|
//!
|
|
//! XEX2 is the executable format used by the Xbox 360 console. This crate
|
|
//! provides types and functions to parse the binary format and extract
|
|
//! structured information from XEX2 files.
|
|
|
|
pub mod crypto;
|
|
pub mod decompress;
|
|
pub mod display;
|
|
pub mod error;
|
|
pub mod extract;
|
|
pub mod header;
|
|
pub mod optional;
|
|
pub mod security;
|
|
pub mod util;
|
|
|
|
use error::Result;
|
|
use header::Xex2Header;
|
|
use optional::OptionalHeaders;
|
|
use security::SecurityInfo;
|
|
|
|
/// A parsed XEX2 file containing all extracted structures.
|
|
#[derive(Debug)]
|
|
pub struct Xex2File {
|
|
/// The main XEX2 header (magic, flags, sizes, offsets).
|
|
pub header: Xex2Header,
|
|
/// All parsed optional headers.
|
|
pub optional_headers: OptionalHeaders,
|
|
/// Security info (signatures, keys, page descriptors).
|
|
pub security_info: SecurityInfo,
|
|
}
|
|
|
|
/// Parses an XEX2 file from a byte slice.
|
|
///
|
|
/// The `data` slice should contain the entire XEX2 file contents.
|
|
/// Returns a [`Xex2File`] with all successfully parsed structures.
|
|
pub fn parse(data: &[u8]) -> Result<Xex2File> {
|
|
let header = header::parse_header(data)?;
|
|
let optional_headers = optional::parse_optional_headers(data, &header)?;
|
|
let security_info = security::parse_security_info(data, header.security_offset)?;
|
|
|
|
Ok(Xex2File {
|
|
header,
|
|
optional_headers,
|
|
security_info,
|
|
})
|
|
}
|