diff --git a/crates/blaze-proto/src/frame.rs b/crates/blaze-proto/src/frame.rs index 4a2cccc..c3471c7 100644 --- a/crates/blaze-proto/src/frame.rs +++ b/crates/blaze-proto/src/frame.rs @@ -1,13 +1,35 @@ -//! Blaze packet frame header. +//! Blaze packet frame header (FIFA 23 capture-tool GUESS — not validated). //! -//! Two framing variants exist ("Fire" and "Fire2"). FIFA 23's variant is UNKNOWN — -//! the capture tool will determine which it uses. This module implements Fire2 -//! (the modern EA format, used by ME3, BF3, and most post-2012 titles) because -//! it is the most likely candidate. +//! FIFA 23's framing is UNKNOWN; this crate's server is a capture tool that +//! decodes with a best guess and falls back to `FramingVariant::Raw` (see +//! `codec.rs`) when Fire2 decode fails. The layout implemented below is that +//! guess and it has NOT been validated against a live FIFA 23 client. //! -//! Fire2 header layout (12 bytes, little-endian **big**-endian per wire): +//! !!! It also DISAGREES with the proven FIFA 17 Fire2 layout. !!! +//! +//! The authoritative, live-driven layout is `openfut-protocol-blaze::fire2` +//! (byte-for-byte parity-tested; it drove a retail FIFA 17 client through login). +//! It is **16 bytes**, big-endian, with a `u32` length and NO error field and NO +//! jumbo escape: //! ```text -//! [0..2] u16 body length (low 16 bits; or full length if < 65536) +//! [0..4] u32 payload length (bytes after header + metadata) +//! [4..6] u16 metadata length +//! [6..8] u16 component +//! [8..10] u16 command +//! [10..13] u24 msgNum +//! [13] u8 (msgType << 5) | (userIndex & 0x1F) +//! [14] u8 options +//! [15] u8 reserved +//! ``` +//! If the project's "FIFA 23 uses the same wire format as FIFA 17" hypothesis is +//! confirmed by a live FIFA 23 capture, this module should adopt that 16-byte +//! layout (or depend on `openfut-protocol-blaze::fire2` directly). Until there is +//! FIFA 23 evidence, the guessed 12-byte layout below is retained as-is so the +//! capture tool keeps its documented "guess, then fall back to Raw" behaviour. +//! +//! Guessed Fire2 header layout THIS MODULE IMPLEMENTS (12 bytes, big-endian; unvalidated): +//! ```text +//! [0..2] u16 body length (low 16 bits) //! [2..4] u16 component id //! [4..6] u16 command id //! [6..8] u16 error code