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