Files
Syplheed-Reborn/crates/sylpheed-formats/src/lib.rs
MechaCat02 e17bc0216d feat(viewer): present subtitles, fonts, PNG + text in the PAK browser
Decode and present four more PAK item types in the pack browser's detail
pane. All content is decoded off-thread in build_pak_rows and attached to
each PakRow, then rendered with egui's own texture facilities — the Bevy
texture pipeline and egui's global font system are untouched.

formats crate (Bevy-free, reusable by CLI):
- ixud: parse IXUD localized-string tables as subtitle cue lists (UTF-16BE
  pool, SUBTITLE header + (text, timecode) pairs -> Vec<Cue{start,end,text}>).
- font: OTF/TTF/ttcf metadata (family / faces / glyphs) via ttf-parser.

viewer:
- PakRow gains `content: PakContent` (Subtitle | Font | Png | Text | None);
  classify_content fills it for IXUD / fonts / PNG / xml+text within the
  existing decode budget. Font samples are pre-rasterized off-thread with
  ab_glyph into an image (ImageRgba) — ab_glyph returns Option/Result at every
  step, so a bad font yields no sample instead of panicking (the earlier
  egui set_fonts approach crashed the app on atlas rebuild).
- draw_pak_browser dispatches on content: subtitle cue table, font metadata +
  sample image, PNG image, scrollable text; else the existing IDXD detail.
  Borrow-split PakView instead of cloning the (now heavy) rows each frame;
  one hash-keyed egui texture cache serves both PNG and font-sample images.

Subtitle<->movie auto-matching is deferred: movie filenames don't hash to the
IXUD keys and no cross-reference table was found (the link is an internal
MSG_DEMO id), so the movie player gets no subtitle track yet.

Tests: ixud unit tests; disc tests for the real English subtitle track
(cues + timecodes), eng/deu localization, font metadata, and off-thread
rasterization of the real font.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 15:19:31 +02:00

51 lines
1.5 KiB
Rust

//! # sylpheed-formats
//!
//! Asset format parsers for Project Sylpheed: Arc of Deception (Xbox 360).
//!
//! This crate handles:
//! - Reading game files from XISO disc images (native only)
//! - Reading IPFB archives (`*.pak` / `*.pNN`) and the `IDXD` definition objects inside
//! - Parsing Xbox 360 texture formats (XPR2 containers + DXT de-tiling)
//! - Parsing mesh formats (to be reverse engineered)
//! - Parsing audio formats (XMA → standard PCM)
//!
//! ## Platform notes
//! XISO reading is only available on native (Windows/macOS/Linux).
//! On WASM, assets must be pre-extracted and served over HTTP.
pub mod texture;
pub mod vfs;
// IPFB TOC name-hash (path → 32-bit key), recovered from the retail title
pub mod hash;
// IPFB archive (`*.pak` index + `*.pNN` segments) reader
pub mod pak;
// IDXD reflective object (ship / weapon / effect / menu definitions) reader
pub mod idxd;
// IXUD localized string / subtitle table reader
pub mod ixud;
// Embedded font (OTF / TTF / ttcf) metadata
pub mod font;
// XISO reading is not available in-browser
#[cfg(not(target_arch = "wasm32"))]
pub mod xiso;
// Mesh parsing — scaffold for reverse engineering
pub mod mesh;
// Audio parsing — scaffold for XMA handling
pub mod audio;
/// Re-export the most commonly used types at the crate root.
pub use font::FontInfo;
pub use idxd::{IdxdError, IdxdObject};
pub use ixud::{Cue, Subtitle};
pub use pak::{PakArchive, PakEntry, PakError};
pub use texture::{X360Texture, X360TextureFormat};
pub use vfs::{GameAssets, VfsError};