Meet mlbms

Janusz Dziemidowicz has been making some nifty progress with his mlbms program for mounting game resource archive format (GRAF) files. Check this out:

$ mlbms bms/alg-lib.bms resource-files/alg-lib/maddog.lib mount/
$ ls -al mount/
total 1
dr-xr-xr-x  2 melanson users       0 Feb 26 23:05 .
drwxr-xr-x  7 melanson users    1120 Feb 26 19:07 ..
-r--r--r--  1 melanson users  305172 Feb 26 23:05 alg.mm
-r--r--r--  1 melanson users   24912 Feb 26 23:05 credits.mm
-r--r--r--  1 melanson users  314245 Feb 26 23:05 ibmlogo.mm
-r--r--r--  1 melanson users  338277 Feb 26 23:05 scen110a.mm
-r--r--r--  1 melanson users  278177 Feb 26 23:05 scen112a.mm
[... ad nauseum ...]

Slick, huh? I knew you’d think so. This command mounts the LIB GRAF from Mad Dog McCree as part of the normal filesystem.

This is the BMS script I used for parsing (might not be 100% compatible with other BMS-using programs in existence):

GoTo 2 0;
Get IndexOffset Long 0;
GoTo IndexOffset 0;
Get IndexLength Int 0;
Math IndexLength /= 17;
Math IndexLength -= 1;
For File = 1 to IndexLength;
Get FileOffset Long 0;
GetDString Filename 13 0;
SavePos PreJump 0;
GoTo FileOffset 0;
Get FileSize Long 0;
Math FileOffset += 4;
Log Filename FileOffset FileSize 0 0;
GoTo PreJump 0;
Next File;

BMS development presents an interesting challenge for me since I can’t presently compile mlbms on my main AMD64 machine (x-wing). I also have a little headless x86 box (yavin4) that serves some other duties. It can compile mlbms so I am using the 2 machines in tandem to develop BMS scripts. Behold the incredible flexibility of Linux filesystems:

  • Mount the CD-ROM on x-wing via normal Linux kernel facilities.
  • Mount x-wing’s CD-ROM mountpoint on yavin4 via sshfs/FUSE.
  • Mount the maddog.lib GRAF onto yavin4’s filesystem via mlbms/FUSE.
  • Mount yavin4’s GRAF mountpoint on x-wing via sshfs/FUSE.
  • Read and play the files inside the GRAF using multimedia programs on x-wing.

Oh, how I’m grateful that sshfs frees me from actually having to think about setting up NFS or Samba just to do basic file sharing between PCs on a local network. FUSE rocks.

According to the mlbms page, Janusz is using this as a teaching tool for his lectures. What an awesome academic example!