feat: parse and display XEX2 main header (M1)

Implement XEX2 main header parsing with module flag decoding.
Add error handling, big-endian read utilities, CLI entry point,
and comprehensive unit + integration tests against a sample file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-03-28 18:52:15 +01:00
parent abbd264e4c
commit b5f2abe09a
9 changed files with 572 additions and 1 deletions

32
src/lib.rs Normal file
View File

@@ -0,0 +1,32 @@
//! # 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 display;
pub mod error;
pub mod header;
pub mod util;
use error::Result;
use header::Xex2Header;
/// A parsed XEX2 file containing all extracted structures.
#[derive(Debug)]
pub struct Xex2File {
/// The main XEX2 header (magic, flags, sizes, offsets).
pub header: Xex2Header,
}
/// 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)?;
Ok(Xex2File { header })
}