//! # 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 { 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, }) }