blorple.py: Extract release and serial number from interactive fiction files

Explore an object’s mystic connections.

Accepts bare Z-code (.z3–.z8, etc.), Inform Glulx (.ulx), TADS 2/3 (.gam / .t3), ADRIFT .taf (3.7–5), and Blorbs.

The serial number is a YYMMDD date. Bare ADRIFT .taf files have no release number (only serial from CompileDate / LastUpdated). TADS stories without GameInfo use the image header compile timestamp as serial only.

Usage:

% python3 blorple.py anchor.z8
release: 5
serial: 990206
% python3 blorple.py CounterfeitMonkey.gblorb
release: 11
serial: 230220
% python3 blorple.py cain.t3
release: 6
serial: 230911
% python3 blorple.py deep.gam
release: 1
serial: 900101

# ADRIFT .taf only supports a serial number.
% python3 blorple.py Hamper.taf
serial: 030802

# Some TADS files don't contain GameInfo; serial only
% python3 blorple.py bmiss.gam
serial: 020410
2 Likes

Nice!

If you want to also support Å-machine files, those have a consistent header as well:

BYTE[4]    'FORM' (IFF chunk identifier)
LONG       length of entire file
BYTE[4]    'AAVM' (IFF form type)
BYTE[4]    'HEAD' (IFF chunk identifier; must be the first chunk)
LONG       length of header
BYTE[2]    Å-machine version (major, minor)
BYTE       word size in bytes
BYTE       string shift amount in bits
SHORT   !! story release number
BYTE[6] !! story serial number in ASCII
...

Which means if the file starts with FORM....AAVMHEAD, it’s an Å-machine file; the release number will be 24 bytes after the start of the file, and the serial number will be 26 bytes after the start of the file. (The resemblance to the Z-machine conventions is, of course, deliberate.)

This is the start of one of my .aastory files, for example:

0000: 464f 524d 0004 3d46 4141 564d 4845 4144  FORM..=FAAVMHEAD
0010: 0000 0044 0100 0200 0009 3236 3038 3235  ...D......260825
0020: 09d8 7f8c 05dc 01f4 0669 5555 4944 3a2f  .........iUUID:/
0030: 2f31 3835 4345 4133 462d 4544 3531 2d34  /185CEA3F-ED51-4
0040: 3938 422d 3932 4437 2d43 3141 3632 4632  98B-92D7-C1A62F2
0050: 4434 3331 432f 2f00 4d45 5441 0000 0209  D431C//.META....

Release 9 ($0009), serial 260825 ($3236 3038 3235).