Files
sp00nz 343df3088d tools: in-tree XDVDFS reader so step one is not "install Rust"
docs/formats/disc-image.md documented the format and then pointed at
xdvdfs-cli and extract-xiso for the actual extraction, which makes the
first step of the pipeline -- get me the XBE -- a dependency install.
Reading a tree of fixed-size directory entries is not worth that.

  py -3 -m tools.xiso ls     game.iso
  py -3 -m tools.xiso get    game.iso default.xbe -o game/
  py -3 -m tools.xiso unpack game.iso -o extracted/

Two decisions worth keeping:

The partition base is found by probing for MICROSOFT*XBOX*MEDIA at each
known offset rather than inferred from file size, because images turn up
both as bare game partitions and with a video partition in front.

Directory entries are walked per-sector rather than by following the
binary tree's left/right links. Entries are laid out contiguously within
each 2048-byte sector, so a linear walk with per-sector resync reads all
of them, and a padded or malformed link cannot silently drop a whole
subtree. Losing a file quietly is worse than being slow.

A non-XDVDFS file raises rather than returning an empty listing, which
would otherwise read as "this disc has no files on it".

Verified against the retail Crimson Skies image: 226 files, default.xbe
extracted at 3,219,456 bytes and parsed cleanly by tools.xbe_parser.
test_xdvdfs.py builds synthetic images in a temp dir so it runs without
one.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 02:38:56 -07:00
..