Skip to content

Add a UDF reader and wrapper - #100

Open
gmipf wants to merge 2 commits into
SabreTools:mainfrom
gmipf:udf-reader
Open

gmipf wants to merge 2 commits into
SabreTools:mainfrom
gmipf:udf-reader

Conversation

@gmipf

@gmipf gmipf commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Adds a reader and a wrapper for UDF volumes, so discs without an ISO 9660 file system (dual-layer PC DVDs, BD-Video, HD DVD) can be listed and extracted.

  • Volume Recognition Sequence, Anchor Volume Descriptor Pointer (sector 256, then N − 256 and N), Main or Reserve Volume Descriptor Sequence, File Set Descriptor, directory hierarchy
  • Type 1 and Metadata Partitions; Virtual and Sparable partitions are not supported
  • File Entries and directories are read in ascending sector order with wrap-around, adjacent sectors merged into one request
  • FindFileEntry follows one path and reads only the directories on it
  • CreateDiscImageWrapper tries UDF after ISO 9660 for a stream at offset 0

Depends on a SabreTools.IO release with SabreTools/SabreTools.IO#3 (0-byte reads at the end of a byte array); with IO 2.3.0 the UDF tests fail.

Measured (the drive runs open /dev/srX as a stream and take its length from sysfs, since FileStream.Length is 0 for a block device):

  • 49 Redump PC DVD images without ISO 9660 (38 UDF 1.02, 10 UDF 1.50, 1 UDF 2.01): file count, total size and 7-Zip's SHA256 sum identical for every image
  • Street Fighter IV - The Ties That Bind - Bonus Disc (BD-Video, 185 files) and Dragon's Lair HD (HD DVD, 41 files; 7-Zip does not open it), both UDF 2.50 with a Metadata Partition: every file identical to libudfread 1.2.0
  • World of WarCraft - Mists of Pandaria - Behind the Scenes (BD, AACS, UDF 2.50 with a Metadata Partition) from a BD drive: all 237 files identical to libudfread reading the same drive
  • Hitman: Absolution (Disc 1) (UDF 1.50) from the same drive: all 32 files identical to the Redump image
  • Gun (UDF 1.02 with ISO 9660) from a DVD drive, cache dropped before every run: full tree (4573 entries) 37.6 / 37.0 s, kernel udf mount + find 105.3 / 107.0 s, same listing; one file seven directories deep, drive spun down: 4.0 s, kernel mount + read 3.9 s

Tests: reader (on built UDF images), extensions, wrapper.

Prepared with AI assistance (Claude Opus 5.5) and reviewed before submission.

gmipf and others added 2 commits October 15, 2026 20:11
Reads the Volume Recognition Sequence, the Anchor Volume Descriptor
Pointer (sector 256, then the end of the volume), the Main or Reserve
Volume Descriptor Sequence, the File Set Descriptor and the directory
hierarchy. Type 1 and Metadata Partitions are mapped, Virtual and
Sparable partitions are not.

File Entries, Allocation Extent Descriptors and directories are read in
ascending sector order with wrap-around, adjacent sectors merged into
one request. FindFileEntry follows one path and reads only the
directories on it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Prints the volume and file set structures and the directory hierarchy,
and extracts the files. CreateDiscImageWrapper tries UDF after ISO 9660
for a stream at offset 0, so discs with both file systems still open as
ISO 9660.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant