xref: /freebsd/contrib/file/magic/Magdir/adventure (revision ae316d1d1cffd71ab7751f94e10118777a88e027)
1b6cee71dSXin LI
2b6cee71dSXin LI#------------------------------------------------------------------------------
3*ae316d1dSXin LI# $File: adventure,v 1.19 2023/12/02 13:48:56 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.
13*ae316d1dSXin LI#
14*ae316d1dSXin LI# FIXME: Conflicts with Microsoft x.out big-endian and PDP-11 binaries (./xenix)
15b6cee71dSXin LI0	beshort	0x0206	ALAN game data
16b6cee71dSXin LI>2	byte	<10	version 2.6%d
17b6cee71dSXin LI
18b6cee71dSXin LI
19b6cee71dSXin LI# Infocom (see z-machine)
20b6cee71dSXin LI#------------------------------------------------------------------------------
21b6cee71dSXin LI# Z-machine:  file(1) magic for Z-machine binaries.
229ce06829SXin LI# Sanity checks by David Griffith <dave@661.org>
23b6cee71dSXin LI# Updated by Adam Buchbinder <adam.buchbinder@gmail.com>
24b6cee71dSXin LI#
25b6cee71dSXin LI#http://www.gnelson.demon.co.uk/zspec/sect11.html
2648c779cdSXin LI#https://www.jczorkmid.net/~jpenney/ZSpec11-latest.txt
2748c779cdSXin LI#https://en.wikipedia.org/wiki/Z-machine
28b6cee71dSXin LI# The first byte is the Z-machine revision; it is always between 1 and 8. We
29b6cee71dSXin LI# had false matches (for instance, inbig5.ocp from the Omega TeX extension as
30b6cee71dSXin LI# well as an occasional MP3 file), so we sanity-check the version number.
31b6cee71dSXin LI#
32b6cee71dSXin LI# It might be possible to sanity-check the release number as well, as it seems
33b6cee71dSXin LI# (at least in classic Infocom games) to always be a relatively small number,
34b6cee71dSXin LI# always under 150 or so, but as this isn't rigorous, we'll wait on that until
35b6cee71dSXin LI# it becomes clear that it's needed.
36b6cee71dSXin LI#
37b6cee71dSXin LI0	ubyte			>0
38b6cee71dSXin LI>0	ubyte			<9
39b6cee71dSXin LI>>16	belong&0xfe00f0f0	0x3030
40b6cee71dSXin LI>>>0	ubyte			< 10
4140427ccaSGordon Tetlow>>>>2	ubeshort		x
42b6cee71dSXin LI>>>>>18	regex			[0-9][0-9][0-9][0-9][0-9][0-9]
4340427ccaSGordon Tetlow>>>>>>0	ubyte			< 10	Infocom (Z-machine %d
4440427ccaSGordon Tetlow>>>>>>>2	ubeshort	x 	\b, Release %d
4540427ccaSGordon Tetlow>>>>>>>>18	string		>\0	\b, Serial %.6s
4640427ccaSGordon Tetlow>>>>>>>>18	string		x	\b)
47b6cee71dSXin LI!:strength + 40
489ce06829SXin LI!:mime	application/x-zmachine
49b6cee71dSXin LI
50b6cee71dSXin LI#------------------------------------------------------------------------------
51b6cee71dSXin LI# Glulx:  file(1) magic for Glulx binaries.
52b6cee71dSXin LI#
539ce06829SXin LI# David Griffith <dave@661.org>
54b6cee71dSXin LI# I haven't checked for false matches yet.
55b6cee71dSXin LI#
56b6cee71dSXin LI0	string			Glul	Glulx game data
57b6cee71dSXin LI>4	beshort			x	(Version %d
58b6cee71dSXin LI>>6	byte			x	\b.%d
59b6cee71dSXin LI>>8	byte			x	\b.%d)
60b6cee71dSXin LI>36	string			Info	Compiled by Inform
619ce06829SXin LI!:mime	application/x-glulx
62b6cee71dSXin LI
63b6cee71dSXin LI
64b6cee71dSXin LI# For Quetzal and blorb magic see iff
65b6cee71dSXin LI
66b6cee71dSXin LI
67b6cee71dSXin LI# TADS (Text Adventure Development System) version 2
68b6cee71dSXin LI#  All files are machine-independent (games compile to byte-code) and are tagged
69b6cee71dSXin LI#  with a version string of the form "V2.<digit>.<digit>\0".
70b6cee71dSXin LI#  Game files start with "TADS2 bin\n\r\032\0" then the compiler version.
71b6cee71dSXin LI0	string	TADS2\ bin	TADS
72b6cee71dSXin LI>9	belong  !0x0A0D1A00	game data, CORRUPTED
73b6cee71dSXin LI>9	belong	 0x0A0D1A00
74b6cee71dSXin LI>>13	string	>\0		%s game data
759ce06829SXin LI!:mime	application/x-tads
76b6cee71dSXin LI#  Resource files start with "TADS2 rsc\n\r\032\0" then the compiler version.
77b6cee71dSXin LI0	string	TADS2\ rsc	TADS
78b6cee71dSXin LI>9	belong  !0x0A0D1A00	resource data, CORRUPTED
79b6cee71dSXin LI>9	belong	 0x0A0D1A00
80b6cee71dSXin LI>>13	string	>\0		%s resource data
819ce06829SXin LI!:mime	application/x-tads
82b6cee71dSXin LI#  Some saved game files start with "TADS2 save/g\n\r\032\0", a little-endian
83b6cee71dSXin LI#  2-byte length N, the N-char name of the game file *without* a NUL (darn!),
84b6cee71dSXin LI# "TADS2 save\n\r\032\0" and the interpreter version.
85b6cee71dSXin LI0	string	TADS2\ save/g	TADS
86b6cee71dSXin LI>12	belong	!0x0A0D1A00	saved game data, CORRUPTED
87b6cee71dSXin LI>12	belong	 0x0A0D1A00
88b6cee71dSXin LI>>(16.s+32) string >\0		%s saved game data
899ce06829SXin LI!:mime	application/x-tads
90b6cee71dSXin LI#  Other saved game files start with "TADS2 save\n\r\032\0" and the interpreter
91b6cee71dSXin LI#  version.
92b6cee71dSXin LI0	string	TADS2\ save	TADS
93b6cee71dSXin LI>10	belong	!0x0A0D1A00	saved game data, CORRUPTED
94b6cee71dSXin LI>10	belong	 0x0A0D1A00
95b6cee71dSXin LI>>14	string	>\0		%s saved game data
969ce06829SXin LI!:mime	application/x-tads
97b6cee71dSXin LI
98b6cee71dSXin LI# TADS (Text Adventure Development System) version 3
99b6cee71dSXin LI#  Game files start with "T3-image\015\012\032"
100b6cee71dSXin LI0	string	T3-image\015\012\032
101b6cee71dSXin LI>11	leshort	x		TADS 3 game data (format version %d)
102b6cee71dSXin LI#  Saved game files start with "T3-state-v####\015\012\032"
103b6cee71dSXin LI#  where #### is a format version number
104b6cee71dSXin LI0	string	T3-state-v
105b6cee71dSXin LI>14	string	\015\012\032	TADS 3 saved game data (format version
106b6cee71dSXin LI>>10	byte	x		%c
107b6cee71dSXin LI>>11	byte	x		\b%c
108b6cee71dSXin LI>>12	byte	x		\b%c
109b6cee71dSXin LI>>13	byte	x		\b%c)
1109ce06829SXin LI!:mime	application/x-t3vm-image
111b6cee71dSXin LI
1129ce06829SXin LI# edited by David Griffith <dave@661.org>
113b6cee71dSXin LI# Danny Milosavljevic <danny.milo@gmx.net>
1149ce06829SXin LI# These are ADRIFT (adventure game standard) game files, extension .taf
1159ce06829SXin LI# Checked from source at (http://www.adrift.co/) and various taf files
11648c779cdSXin LI# found at the Interactive Fiction Archive (https://ifarchive.org/)
1179ce06829SXin LI0	belong  0x3C423FC9
1189ce06829SXin LI>4	belong  0x6A87C2CF	Adrift game file version
1199ce06829SXin LI>>8	belong  0x94453661	3.80
1209ce06829SXin LI>>8	belong  0x94453761	3.90
1219ce06829SXin LI>>8	belong  0x93453E61	4.0
1229ce06829SXin LI>>8	belong  0x92453E61	5.0
1239ce06829SXin LI>>8	default x		unknown
1249ce06829SXin LI!:mime	application/x-adrift
125