MechaCat02 053aa81953 Cutscene voice: resolve movies via continuous-stream cue regions
Cracked how the game maps a movie to its voice track and reimplemented it,
fixing wrong/short voices for RT and hokyu cutscenes.

## Mechanism (RE'd from a Canary file-I/O trace, user-confirmed by ear)

The movie voices are ONE continuous XMA stream, physically chunked into
`<lang>\Movie\VOICE_*.slb` (and `\etc\VOICE_D_*.slb`) sound.pak TOC entries
whose boundaries do NOT align with the cutscene cues. A single cue routinely
spans two `.slb` chunks, so a `.slb` does not necessarily hold the track its
name claims (they are off-by-one vs the cues). Each cue ends at an inline
trailer descriptor `(sound_id:u32be, 0x11, …)` whose id repeats at +0x800.

Resolution chain (all derivable on-disc, no guest-code RE):
  1. movie -> cue token         (ADVERTISE_MOVIE manifest VOICETRACK)
  2. cue token -> sound-id       (master sound registry, tables.pak
                                  a2c8c185=eng / b04238e0=jpn, schema 0x13cb84ba)
  3. sound-id -> [start,end)      scan the stream for trailer(id) and its
                                  predecessor; cue audio = the bytes between,
                                  read continuously across chunk boundaries.

Validated: decoded voice length matches each movie within ~0.4s, including
cross-boundary cues (ADV/RT01A/RT01B/RT01C/S00A/S01A + the 5 bound hokyu).

## Changes

- sylpheed-formats/src/movie_voice.rs (new): registry_voice_ids(),
  find_descriptor(), find_descriptor_before() (gap-tolerant predecessor).
  Unit-tested.
- viewer iso_loader.rs: resolve_movie_voice_region() + decode_voice_region()
  (continuous read via existing read_segment_range + to_xma_riffs). Voice/
  audio requests now region-first; a `\Movie\` token that fails region stays
  SILENT (never plays the wrong off-by-one chunk). Removed the old
  movie_is_demo_based suppress hack.
- Anchor tries subdirs Movie/etc/Voice so hokyu `\etc\VOICE_D_*` resolve too.
- Examples resolve_all/validate_cues/hokyu_final document + validate the pipeline.

## Status

- RT / S / ADV cutscene voices: CORRECT (user-confirmed).
- 5 manifest-bound hokyu (VOICE_D_450-454): CORRECT (user-confirmed).

## OPEN (handoff)

13 of 18 hokyu movies have NO manifest VOICETRACK; the game reuses the 5
recordings across stages via a code rule. `hokyu_fallback_token()` currently
guesses by category (ship LS/DS x source carrier-A/tanker-H: LS/A->450,
LS/H->453, DS/A->452, DS/H->454). USER REPORTS THIS IS SOMETIMES WRONG.
- LS/carrier has two takes (450 from s02A, 451 from s09A); the early-vs-late
  split is unknown — unbound LS/A currently all default to 450.
- Definitive fix = Canary `--phase_a_fileio_only` file.read trace of an unbound
  hokyu (e.g. hokyu_LS_s03A) to see which VOICE_D the game actually streams,
  then encode the real rule. Same method that cracked the RT mapping.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 06:53:55 +02:00

Project Sylpheed: Arc of Deception — Reborn

A clean-room, open-source reimplementation of Project Sylpheed: Arc of Deception (Xbox 360, 2006).

Built with Rust and the Bevy game engine. Runs natively on Windows, macOS, and Linux, and in the browser via WebAssembly.

Legal note: This project contains no original game code or assets. You must own a legitimate copy of Project Sylpheed to use this engine. Assets remain the intellectual property of SETA Corporation / Square Enix.


Current Status: Milestone 1 — Asset Explorer

  • XISO disc image reading via xdvdfs
  • Xbox 360 texture de-tiling (Morton / Z-order)
  • XPR2 texture container parsing
  • Bevy custom AssetLoader for .xpr textures
  • Orbit camera viewer
  • CLI tools: extract, list, sniff, texture info, texture export
  • GitHub Actions CI (Windows + macOS + Linux + WASM)
  • WASM / web build target
  • Mesh format (reverse engineering in progress)
  • Audio format (XMA → PCM pipeline)
  • Mission data format

Repository Structure

sylpheed-reborn/
└── sylpheed-viewer/        ← Milestone 1: asset explorer (Rust/Bevy workspace)
    ├── Cargo.toml          ← Workspace root
    ├── crates/
    │   ├── sylpheed-formats/   # Format parsers — no Bevy dependency
    │   │   ├── xiso.rs         # XISO / XDVDFS disc image reader
    │   │   ├── texture.rs      # XPR2 container + DXT de-tiling (Morton)
    │   │   ├── vfs.rs          # Virtual filesystem + magic-byte sniffer
    │   │   ├── mesh.rs         # Mesh parser (stub — RE in progress)
    │   │   └── audio.rs        # Audio parser (stub — XMA TODO)
    │   │
    │   ├── sylpheed-viewer/    # Bevy application
    │   │   ├── lib.rs          # App setup + WASM entry point
    │   │   ├── main.rs         # Native binary entry point
    │   │   ├── asset_loader.rs # Custom Bevy AssetLoaders
    │   │   ├── camera.rs       # Orbit camera (LMB orbit, RMB pan, scroll zoom)
    │   │   └── ui.rs           # egui file browser + RE notes panel
    │   │
    │   └── sylpheed-cli/       # Command-line tools
    │       └── main.rs         # extract / list / sniff / texture info commands
    │
    ├── assets/             ← Extracted game files (gitignored)
    ├── .github/workflows/
    │   └── ci.yml          # CI: Windows + macOS + Linux + WASM
    ├── Trunk.toml          # WASM build configuration
    └── justfile            # All build recipes

Getting Started

Prerequisites

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Install just (task runner)
cargo install just

# For web builds only
cargo install trunk
rustup target add wasm32-unknown-unknown

Linux — Bevy system dependencies

sudo apt-get install -y \
  libasound2-dev libudev-dev libwayland-dev \
  libxkbcommon-dev libx11-dev libxi-dev pkg-config

Step 1 — Extract your disc

cd sylpheed-viewer

# Extract using the CLI tool
just extract /path/to/project_sylpheed.iso

# Or manually with xdvdfs
cargo install xdvdfs-cli
xdvdfs unpack project_sylpheed.iso ./assets/

Step 2 — Run the viewer

cd sylpheed-viewer

just run          # Native viewer
just web          # WASM dev server → http://localhost:8080

The asset viewer opens an orbit camera scene. Use the left panel to browse extracted game files. Click a .xpr file to preview it as a texture.


Build Commands

All commands run from the sylpheed-viewer/ directory.

just run              # Run the native viewer (debug)
just run-dev          # Run with hot-reloading
just build-native     # Build native release binary
just web              # WASM dev server at localhost:8080
just build-web        # WASM release build → ./dist/

just extract game.iso # Extract an ISO to ./assets/
just sniff            # Identify file formats in ./assets/
just sniff-unknown    # Show only unrecognised formats (RE focus)

just test             # Run all tests
just ci               # Full CI: fmt + lint + test + WASM check

Technology Stack

Layer Choice Reason
Language Rust Memory safety, performance, cross-platform
Game engine Bevy 0.15 ECS-first, WASM-native, data-driven
XISO reading xdvdfs Pure Rust, reads Xbox 360 disc images
Binary parsing binrw Derive-macro based, ideal for RE work
Web bundler Trunk Bevy's standard WASM build tool
CLI clap Asset extraction and inspection tools
Debug UI bevy_egui In-viewer asset browser and RE notes panel

Key Architectural Decisions

sylpheed-formats has zero Bevy dependency. All binary format parsers live here and are testable with plain cargo test. Bevy integration is a thin layer on top in sylpheed-viewer.

WASM is a first-class target. XISO reading is gated behind #[cfg(not(target_arch = "wasm32"))] since the browser can't read local files. On the web, assets must be pre-extracted and served over HTTP.

Modding is designed in from the start. The virtual filesystem (vfs.rs) is the single choke point for all asset reads — a mod loader only needs to intercept that one layer to override any file.


Reverse Engineering Notes

Known file formats

Path pattern Format Status Notes
*.XPR, *.XPR2 XPR2 texture Parsing DXT1/3/5, DXN, Morton de-tiling done
DEFAULT.XEX Xbox EXE 2 🔬 Study Main executable — load in Ghidra (PPC BE)
*.XWB, *.XSB XACT audio TODO Wave/sound banks; audio is XMA codec
*.pak, *.p00 SETA archive Unknown Paired header/data format
mesh files Unknown TODO Run just sniff-unknown to find candidates

RE workflow

# 1. Extract and map the disc
just extract game.iso
just sniff-unknown   # shows hex magic bytes of unknown files

# 2. Hex-inspect candidates
#    Groups of 12 bytes at offsets: likely f32 XYZ vertices
#    Groups of 6 bytes:             likely u16 triangle indices

# 3. Cross-reference in Ghidra
#    Load DEFAULT.XEX with PowerPC Big-Endian processor
#    Search string refs to file extensions → find load functions

# 4. Implement parser
#    Add binrw #[derive(BinRead)] struct in sylpheed-formats/src/mesh.rs
#    cargo test -p sylpheed-formats

Next steps (Milestone 2)

  1. Mesh format — fingerprint with sniff-unknown, implement mesh.rs
  2. Audio — parse XWB headers, batch-convert XMA to WAV via ffmpeg
  3. Mission data — format unknown; starts after mesh/texture loading works
  4. Flight model — document by playing the original; implement as Bevy system

Constraints

  1. Never copy decompiled or disassembled game code — reimplement behavior through observation only.
  2. Assets stay gitignoredassets/ and *.iso are excluded. Never commit game files.
  3. Keep sylpheed-formats Bevy-free — parsers must be testable without a GPU.
  4. WASM must always compile — CI enforces cargo check --target wasm32-unknown-unknown.
  5. justfile is the source of truth for build commands — add new recipes there.

Milestone Roadmap

Milestone Goal Status
1 Asset Explorer 🚧 In Progress
2 Flying Tech Demo Planned
3 Combat Prototype Planned
4 Mission 1 Playable Planned
5 Full Game (all 16 missions) Planned
6 Mod SDK Planned

Useful References

Description
No description provided
Readme 1.1 MiB
Languages
Rust 97.4%
Python 1.2%
HTML 0.9%
Just 0.5%