1 2#------------------------------------------------------------------------------ 3# $File: adventure,v 1.19 2023/12/02 13:48:56 christos Exp $ 4# adventure: file(1) magic for Adventure game files 5# 6# from Allen Garvin <earendil@faeryland.tamu-commerce.edu> 7# Edited by Dave Chapeskie <dchapes@ddm.on.ca> Jun 28, 1998 8# Edited by Chris Chittleborough <cchittleborough@yahoo.com.au>, March 2002 9# 10# ALAN 11# I assume there are other, lower versions, but these are the only ones I 12# saw in the archive. 13# 14# FIXME: Conflicts with Microsoft x.out big-endian and PDP-11 binaries (./xenix) 150 beshort 0x0206 ALAN game data 16>2 byte <10 version 2.6%d 17 18 19# Infocom (see z-machine) 20#------------------------------------------------------------------------------ 21# Z-machine: file(1) magic for Z-machine binaries. 22# Sanity checks by David Griffith <dave@661.org> 23# Updated by Adam Buchbinder <adam.buchbinder@gmail.com> 24# 25#http://www.gnelson.demon.co.uk/zspec/sect11.html 26#https://www.jczorkmid.net/~jpenney/ZSpec11-latest.txt 27#https://en.wikipedia.org/wiki/Z-machine 28# The first byte is the Z-machine revision; it is always between 1 and 8. We 29# had false matches (for instance, inbig5.ocp from the Omega TeX extension as 30# well as an occasional MP3 file), so we sanity-check the version number. 31# 32# It might be possible to sanity-check the release number as well, as it seems 33# (at least in classic Infocom games) to always be a relatively small number, 34# always under 150 or so, but as this isn't rigorous, we'll wait on that until 35# it becomes clear that it's needed. 36# 370 ubyte >0 38>0 ubyte <9 39>>16 belong&0xfe00f0f0 0x3030 40>>>0 ubyte < 10 41>>>>2 ubeshort x 42>>>>>18 regex [0-9][0-9][0-9][0-9][0-9][0-9] 43>>>>>>0 ubyte < 10 Infocom (Z-machine %d 44>>>>>>>2 ubeshort x \b, Release %d 45>>>>>>>>18 string >\0 \b, Serial %.6s 46>>>>>>>>18 string x \b) 47!:strength + 40 48!:mime application/x-zmachine 49 50#------------------------------------------------------------------------------ 51# Glulx: file(1) magic for Glulx binaries. 52# 53# David Griffith <dave@661.org> 54# I haven't checked for false matches yet. 55# 560 string Glul Glulx game data 57>4 beshort x (Version %d 58>>6 byte x \b.%d 59>>8 byte x \b.%d) 60>36 string Info Compiled by Inform 61!:mime application/x-glulx 62 63 64# For Quetzal and blorb magic see iff 65 66 67# TADS (Text Adventure Development System) version 2 68# All files are machine-independent (games compile to byte-code) and are tagged 69# with a version string of the form "V2.<digit>.<digit>\0". 70# Game files start with "TADS2 bin\n\r\032\0" then the compiler version. 710 string TADS2\ bin TADS 72>9 belong !0x0A0D1A00 game data, CORRUPTED 73>9 belong 0x0A0D1A00 74>>13 string >\0 %s game data 75!:mime application/x-tads 76# Resource files start with "TADS2 rsc\n\r\032\0" then the compiler version. 770 string TADS2\ rsc TADS 78>9 belong !0x0A0D1A00 resource data, CORRUPTED 79>9 belong 0x0A0D1A00 80>>13 string >\0 %s resource data 81!:mime application/x-tads 82# Some saved game files start with "TADS2 save/g\n\r\032\0", a little-endian 83# 2-byte length N, the N-char name of the game file *without* a NUL (darn!), 84# "TADS2 save\n\r\032\0" and the interpreter version. 850 string TADS2\ save/g TADS 86>12 belong !0x0A0D1A00 saved game data, CORRUPTED 87>12 belong 0x0A0D1A00 88>>(16.s+32) string >\0 %s saved game data 89!:mime application/x-tads 90# Other saved game files start with "TADS2 save\n\r\032\0" and the interpreter 91# version. 920 string TADS2\ save TADS 93>10 belong !0x0A0D1A00 saved game data, CORRUPTED 94>10 belong 0x0A0D1A00 95>>14 string >\0 %s saved game data 96!:mime application/x-tads 97 98# TADS (Text Adventure Development System) version 3 99# Game files start with "T3-image\015\012\032" 1000 string T3-image\015\012\032 101>11 leshort x TADS 3 game data (format version %d) 102# Saved game files start with "T3-state-v####\015\012\032" 103# where #### is a format version number 1040 string T3-state-v 105>14 string \015\012\032 TADS 3 saved game data (format version 106>>10 byte x %c 107>>11 byte x \b%c 108>>12 byte x \b%c 109>>13 byte x \b%c) 110!:mime application/x-t3vm-image 111 112# edited by David Griffith <dave@661.org> 113# Danny Milosavljevic <danny.milo@gmx.net> 114# These are ADRIFT (adventure game standard) game files, extension .taf 115# Checked from source at (http://www.adrift.co/) and various taf files 116# found at the Interactive Fiction Archive (https://ifarchive.org/) 1170 belong 0x3C423FC9 118>4 belong 0x6A87C2CF Adrift game file version 119>>8 belong 0x94453661 3.80 120>>8 belong 0x94453761 3.90 121>>8 belong 0x93453E61 4.0 122>>8 belong 0x92453E61 5.0 123>>8 default x unknown 124!:mime application/x-adrift 125