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