Breaking Eggs And Making Omelettes

Topics On Multimedia Technology and Reverse Engineering


Archives:

xbfuse

November 11th, 2007 by Multimedia Mike

Well, you knew this was coming– xbfuse. This is a program that leverages the wonderful FUSE paradigm to mount a Microsoft Xbox disc filesystem — the so-called XDVD filesystem — under Linux. I hammered out the bug mentioned in yesterday’s post (sure enough, a 64-bit offset was being demoted to a signed 32-bit quantity at one point, and that matters for filesystems this large). This is what the program looks like in action:

$ xbfuse Halo-3.iso mnt/

$ ls -al mnt/
total 4
dr-xr-xr-x  6 melanson melanson       0 2007-11-07 20:00 .
drwxr-xr-x 47 melanson melanson    4096 2007-11-10 17:31 ..
dr-xr-xr-x  2 melanson melanson       0 2007-11-07 20:00 bink
-r--r--r--  1 melanson melanson 8929280 2007-11-07 20:00 default.xex
dr-xr-xr-x  5 melanson melanson       0 2007-11-07 20:00 maps
dr-xr-xr-x  2 melanson melanson       0 2007-11-07 20:00 $SystemUpdate
dr-xr-xr-x  2 melanson melanson       0 2007-11-07 20:00 waves
-r--r--r--  1 melanson melanson  561152 2007-11-07 20:00 WaveShell-Xbox.dll
-r--r--r--  1 melanson melanson  724992 2007-11-07 20:00 WavesLibDLL.dll

$ ls -al mnt/bink/
total 0
dr-xr-xr-x 2 melanson melanson        0 2007-11-07 20:00 .
dr-xr-xr-x 6 melanson melanson        0 2007-11-07 20:00 ..
-r--r--r-- 1 melanson melanson 77940860 2007-11-07 20:00 attract_1_60.bik
-r--r--r-- 1 melanson melanson 61324440 2007-11-07 20:00 attract_2_60.bik
-r--r--r-- 1 melanson melanson 72829508 2007-11-07 20:00 attract_3_60.bik
-r--r--r-- 1 melanson melanson 69631000 2007-11-07 20:00 credits_60.bik
-r--r--r-- 1 melanson melanson 21163412 2007-11-07 20:00 intro_60.bik

$ fusermount -u mnt/

So Halo 3 uses Bink files, some very high resolution ones, rather than any Xbox-specific multimedia formats, like XMV. Actually, Bungie (the company behind Halo) may have a history with Bink, as I seem to recall that the FMV for the PC demo version of Halo was also Bink (or at least one promotional file).

I actually just thought to look up whether there are other options for mounting Xbox filesystem images under Linux. The format certainly seems to be of much greater interest than, say, GameCube filesystem images. I did find a project called Mount ISO Image that is supposed to be able to handle XDVD filesystems. Though I can’t really figure out if it’s a KDE application, a script, or a KDE script.

I took a slightly different approach to writing this one. All in all, I suppose the result is much simpler than gcfuse. The GameCube filesystem is an odd beast and required a lot of custom hacks to parse all of the data structures. However, writing xbfuse scared me more because I had to write 2 mutually recursive functions: After loading the volume descriptor, call xbfs_recurse_directory(), which then calls xbfs_recurse_file_subtree(), which calls not only itself, but also xbfs_recurse_directory() when a file entry happens to be a directory. I thought about writing xbfuse in such a way that it would traverse the data structures on demand when loading a file, since the data structures are laid out to be conducive to binary searching. I also thought about only loading the first level of the directory tree, and loading other levels on demand. But in the end, I just went with the full tree load at the outset and finally squashed the 64 -> 32-bit bug and the program seems to work quite well.

What next? Wii discs seem to use a different format than the GameCube discs and I would like to find out what that is. Plus, I am still dogged by the slightly custom Dreamcast ISO-9660-style format. There is a lot of interesting Sofdec media on those Dreamcast games. And it only takes about 26 hours to rip the contents of a Dreamcast disc onto your PC, provided that you have the right serial cable.

Related Posts:

Posted in Game Hacking, xbox | 6 Comments »

6 Responses

  1. compn Says:

    it would be nice if libavformat could have support to play iso and other cd/dvd images too :)

    or if fuse could be made to work on mac / windows ;p
    either way.

    http://roundup.mplayerhq.hu/roundup/ffmpeg/issue124

  2. Multimedia Mike Says:

    I can’t help you out with FUSE on Windows, but check out Macfuse: http://code.google.com/p/macfuse/

    “Although MacFUSE has a completely different kernel-level implementation from Linux FUSE, it supports the FUSE specification well enough that many popular FUSE file systems can be easily compiled and work on Mac OS X–often out of the box.”

    I would be interested to know if gcfuse or xbfuse work with Macfuse.

  3. Jonathan Wilson Says:

    Is it possible to read XBOX game disks on a PC or does xbfuse only read ISO files?

  4. Multimedia Mike Says:

    If you have special firmware in your DVD-ROM drive, it just might be possible to read the data on your PC. But don’t bet on it. Read my other Xbox-related posts for my own investigations into this matter:

    http://multimedia.cx/eggs/category/xbox/

    Also, “ISO” is kind of a catch-all terms for strings of raw sectors ripped from an optical disc (even though the term was originally distilled from ISO-9660, the prevailing CD-ROM filesystem format). xbfuse searches for what it needs in the rip file you feed it. xbfuse has successfully picked the XDVD filesystem out of a .NRG image.

  5. Lantis Says:

    Unfortunately, xbfuse doesn’t compile on OS X with MacFUSE. I’ve managed to get the configure to run by passing a decent set of CPPFLAGS

    CPPFLAGS=”-D__FreeBSD__=10 -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=25″ ./configure –prefix=/usr/local

    but make fails because strndup() isn’t present on OS X, and tree.c requires it.

    Full output of make:
    Making all in src
    make all-am
    gcc -DHAVE_CONFIG_H -I. -I/sw/include -D__FreeBSD__=10 -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=25 -Wall -g -O2 -MT tree.o -MD -MP -MF .deps/tree.Tpo -c -o tree.o tree.c
    tree.c: In function ‘tree_insert’:
    tree.c:73: warning: implicit declaration of function ‘strndup’
    tree.c:73: warning: assignment makes pointer from integer without a cast
    mv -f .deps/tree.Tpo .deps/tree.Po
    gcc -DHAVE_CONFIG_H -I. -I/sw/include -D__FreeBSD__=10 -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=25 -Wall -g -O2 -MT xdvdfs.o -MD -MP -MF .deps/xdvdfs.Tpo -c -o xdvdfs.o xdvdfs.c
    mv -f .deps/xdvdfs.Tpo .deps/xdvdfs.Po
    gcc -DHAVE_CONFIG_H -I. -I/sw/include -D__FreeBSD__=10 -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=25 -Wall -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c
    mv -f .deps/main.Tpo .deps/main.Po
    gcc -g -O2 -o xbfuse tree.o xdvdfs.o main.o -lfuse
    /usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined symbols:
    _strndup
    collect2: ld returned 1 exit status
    make[2]: *** [xbfuse] Error 1
    make[1]: *** [all] Error 2
    make: *** [all-recursive] Error 1

  6. iksaif Says:

    Hi,
    I was trying to make gcfs works with wii dvd … but they seems to be crypted, just look à the strings, there is nothing readable (except the header, wich is the same as gc dvd).
    I also found:
    – a magic number
    – a 256 byte block that change with all dvd, it may be the key
    – a big block of data that is the same for all dvd …

    Did you found something better ?