1327e51cbSPeter Avalos 2327e51cbSPeter Avalos#------------------------------------------------------------------------------ 36fca56fbSSascha Wildner# $File: adventure,v 1.18 2019/04/19 00:42:27 christos Exp $ 4327e51cbSPeter Avalos# adventure: file(1) magic for Adventure game files 5327e51cbSPeter Avalos# 6327e51cbSPeter Avalos# from Allen Garvin <earendil@faeryland.tamu-commerce.edu> 7327e51cbSPeter Avalos# Edited by Dave Chapeskie <dchapes@ddm.on.ca> Jun 28, 1998 8327e51cbSPeter Avalos# Edited by Chris Chittleborough <cchittleborough@yahoo.com.au>, March 2002 9327e51cbSPeter Avalos# 10327e51cbSPeter Avalos# ALAN 11327e51cbSPeter Avalos# I assume there are other, lower versions, but these are the only ones I 12327e51cbSPeter Avalos# saw in the archive. 13327e51cbSPeter Avalos0 beshort 0x0206 ALAN game data 14327e51cbSPeter Avalos>2 byte <10 version 2.6%d 15327e51cbSPeter Avalos 16327e51cbSPeter Avalos 17327e51cbSPeter Avalos# Infocom (see z-machine) 18327e51cbSPeter Avalos#------------------------------------------------------------------------------ 19327e51cbSPeter Avalos# Z-machine: file(1) magic for Z-machine binaries. 20*c30bd091SSascha Wildner# Sanity checks by David Griffith <dave@661.org> 21e4d4ce0cSPeter Avalos# Updated by Adam Buchbinder <adam.buchbinder@gmail.com> 22327e51cbSPeter Avalos# 23e4d4ce0cSPeter Avalos#http://www.gnelson.demon.co.uk/zspec/sect11.html 246fca56fbSSascha Wildner#https://www.jczorkmid.net/~jpenney/ZSpec11-latest.txt 256fca56fbSSascha Wildner#https://en.wikipedia.org/wiki/Z-machine 26e4d4ce0cSPeter Avalos# The first byte is the Z-machine revision; it is always between 1 and 8. We 27e4d4ce0cSPeter Avalos# had false matches (for instance, inbig5.ocp from the Omega TeX extension as 28e4d4ce0cSPeter Avalos# well as an occasional MP3 file), so we sanity-check the version number. 29327e51cbSPeter Avalos# 30e4d4ce0cSPeter Avalos# It might be possible to sanity-check the release number as well, as it seems 31e4d4ce0cSPeter Avalos# (at least in classic Infocom games) to always be a relatively small number, 32e4d4ce0cSPeter Avalos# always under 150 or so, but as this isn't rigorous, we'll wait on that until 33e4d4ce0cSPeter Avalos# it becomes clear that it's needed. 34327e51cbSPeter Avalos# 35e4d4ce0cSPeter Avalos0 ubyte >0 36e4d4ce0cSPeter Avalos>0 ubyte <9 37e8af9738SPeter Avalos>>16 belong&0xfe00f0f0 0x3030 38e8af9738SPeter Avalos>>>0 ubyte < 10 39*c30bd091SSascha Wildner>>>>2 ubeshort x 40e8af9738SPeter Avalos>>>>>18 regex [0-9][0-9][0-9][0-9][0-9][0-9] 41*c30bd091SSascha Wildner>>>>>>0 ubyte < 10 Infocom (Z-machine %d 42*c30bd091SSascha Wildner>>>>>>>2 ubeshort x \b, Release %d 43*c30bd091SSascha Wildner>>>>>>>>18 string >\0 \b, Serial %.6s 44*c30bd091SSascha Wildner>>>>>>>>18 string x \b) 45e8af9738SPeter Avalos!:strength + 40 46*c30bd091SSascha Wildner!:mime application/x-zmachine 47327e51cbSPeter Avalos 48327e51cbSPeter Avalos#------------------------------------------------------------------------------ 49327e51cbSPeter Avalos# Glulx: file(1) magic for Glulx binaries. 50327e51cbSPeter Avalos# 51*c30bd091SSascha Wildner# David Griffith <dave@661.org> 52327e51cbSPeter Avalos# I haven't checked for false matches yet. 53327e51cbSPeter Avalos# 54327e51cbSPeter Avalos0 string Glul Glulx game data 55327e51cbSPeter Avalos>4 beshort x (Version %d 56327e51cbSPeter Avalos>>6 byte x \b.%d 57327e51cbSPeter Avalos>>8 byte x \b.%d) 58327e51cbSPeter Avalos>36 string Info Compiled by Inform 59*c30bd091SSascha Wildner!:mime application/x-glulx 60327e51cbSPeter Avalos 61327e51cbSPeter Avalos 62327e51cbSPeter Avalos# For Quetzal and blorb magic see iff 63327e51cbSPeter Avalos 64327e51cbSPeter Avalos 65e4d4ce0cSPeter Avalos# TADS (Text Adventure Development System) version 2 66327e51cbSPeter Avalos# All files are machine-independent (games compile to byte-code) and are tagged 67e4d4ce0cSPeter Avalos# with a version string of the form "V2.<digit>.<digit>\0". 68327e51cbSPeter Avalos# Game files start with "TADS2 bin\n\r\032\0" then the compiler version. 69327e51cbSPeter Avalos0 string TADS2\ bin TADS 70327e51cbSPeter Avalos>9 belong !0x0A0D1A00 game data, CORRUPTED 71327e51cbSPeter Avalos>9 belong 0x0A0D1A00 72327e51cbSPeter Avalos>>13 string >\0 %s game data 73*c30bd091SSascha Wildner!:mime application/x-tads 74327e51cbSPeter Avalos# Resource files start with "TADS2 rsc\n\r\032\0" then the compiler version. 75327e51cbSPeter Avalos0 string TADS2\ rsc TADS 76327e51cbSPeter Avalos>9 belong !0x0A0D1A00 resource data, CORRUPTED 77327e51cbSPeter Avalos>9 belong 0x0A0D1A00 78327e51cbSPeter Avalos>>13 string >\0 %s resource data 79*c30bd091SSascha Wildner!:mime application/x-tads 80327e51cbSPeter Avalos# Some saved game files start with "TADS2 save/g\n\r\032\0", a little-endian 81327e51cbSPeter Avalos# 2-byte length N, the N-char name of the game file *without* a NUL (darn!), 82327e51cbSPeter Avalos# "TADS2 save\n\r\032\0" and the interpreter version. 83327e51cbSPeter Avalos0 string TADS2\ save/g TADS 84327e51cbSPeter Avalos>12 belong !0x0A0D1A00 saved game data, CORRUPTED 85327e51cbSPeter Avalos>12 belong 0x0A0D1A00 86327e51cbSPeter Avalos>>(16.s+32) string >\0 %s saved game data 87*c30bd091SSascha Wildner!:mime application/x-tads 88327e51cbSPeter Avalos# Other saved game files start with "TADS2 save\n\r\032\0" and the interpreter 89327e51cbSPeter Avalos# version. 90327e51cbSPeter Avalos0 string TADS2\ save TADS 91327e51cbSPeter Avalos>10 belong !0x0A0D1A00 saved game data, CORRUPTED 92327e51cbSPeter Avalos>10 belong 0x0A0D1A00 93327e51cbSPeter Avalos>>14 string >\0 %s saved game data 94*c30bd091SSascha Wildner!:mime application/x-tads 95327e51cbSPeter Avalos 96e4d4ce0cSPeter Avalos# TADS (Text Adventure Development System) version 3 97e4d4ce0cSPeter Avalos# Game files start with "T3-image\015\012\032" 98e4d4ce0cSPeter Avalos0 string T3-image\015\012\032 99e4d4ce0cSPeter Avalos>11 leshort x TADS 3 game data (format version %d) 100e4d4ce0cSPeter Avalos# Saved game files start with "T3-state-v####\015\012\032" 101e4d4ce0cSPeter Avalos# where #### is a format version number 102e4d4ce0cSPeter Avalos0 string T3-state-v 103e4d4ce0cSPeter Avalos>14 string \015\012\032 TADS 3 saved game data (format version 104e4d4ce0cSPeter Avalos>>10 byte x %c 105e4d4ce0cSPeter Avalos>>11 byte x \b%c 106e4d4ce0cSPeter Avalos>>12 byte x \b%c 107e4d4ce0cSPeter Avalos>>13 byte x \b%c) 108*c30bd091SSascha Wildner!:mime application/x-t3vm-image 109e4d4ce0cSPeter Avalos 110*c30bd091SSascha Wildner# edited by David Griffith <dave@661.org> 11179343712SPeter Avalos# Danny Milosavljevic <danny.milo@gmx.net> 112*c30bd091SSascha Wildner# These are ADRIFT (adventure game standard) game files, extension .taf 113*c30bd091SSascha Wildner# Checked from source at (http://www.adrift.co/) and various taf files 1146fca56fbSSascha Wildner# found at the Interactive Fiction Archive (https://ifarchive.org/) 115*c30bd091SSascha Wildner0 belong 0x3C423FC9 116*c30bd091SSascha Wildner>4 belong 0x6A87C2CF Adrift game file version 117*c30bd091SSascha Wildner>>8 belong 0x94453661 3.80 118*c30bd091SSascha Wildner>>8 belong 0x94453761 3.90 119*c30bd091SSascha Wildner>>8 belong 0x93453E61 4.0 120*c30bd091SSascha Wildner>>8 belong 0x92453E61 5.0 121*c30bd091SSascha Wildner>>8 default x unknown 122*c30bd091SSascha Wildner!:mime application/x-adrift 123