xref: /freebsd/contrib/file/magic/Magdir/console (revision 8ef24a0d4b28fe230e20637f56869cc4148cd2ca)
1
2#------------------------------------------------------------------------------
3# $File: console,v 1.25 2016/04/18 20:22:10 christos Exp $
4# Console game magic
5# Toby Deshane <hac@shoelace.digivill.net>
6
7# ines: file(1) magic for Marat's iNES Nintendo Entertainment System ROM dump format
8# Updated by David Korth <gerbilsoft@gerbilsoft.com>
9# References:
10# - http://wiki.nesdev.com/w/index.php/INES
11# - http://wiki.nesdev.com/w/index.php/NES_2.0
120	string		NES\x1A		iNES ROM image
13>7	byte&0x0C	=0x8		(NES 2.0)
14>4	byte		x		\b: %ux16k PRG
15>5	byte		x		\b, %ux16k CHR
16>6	byte&0x08	=0x8		[4-Scr]
17>6	byte&0x09	=0x0		[H-mirror]
18>6	byte&0x09	=0x1		[V-mirror]
19>6	byte&0x02	=0x2		[SRAM]
20>6	byte&0x04	=0x4		[Trainer]
21>7	byte&0x03	=0x2		[PC10]
22>7	byte&0x03	=0x1		[VS
23>>7	byte&0x0C	=0x8
24# NES 2.0: VS PPU
25>>>13	byte&0x0F	=0x0		\b, RP2C03B
26>>>13	byte&0x0F	=0x1		\b, RP2C03G
27>>>13	byte&0x0F	=0x2		\b, RP2C04-0001
28>>>13	byte&0x0F	=0x3		\b, RP2C04-0002
29>>>13	byte&0x0F	=0x4		\b, RP2C04-0003
30>>>13	byte&0x0F	=0x5		\b, RP2C04-0004
31>>>13	byte&0x0F	=0x6		\b, RP2C03B
32>>>13	byte&0x0F	=0x7		\b, RP2C03C
33>>>13	byte&0x0F	=0x8		\b, RP2C05-01
34>>>13	byte&0x0F	=0x9		\b, RP2C05-02
35>>>13	byte&0x0F	=0xA		\b, RP2C05-03
36>>>13	byte&0x0F	=0xB		\b, RP2C05-04
37>>>13	byte&0x0F	=0xC		\b, RP2C05-05
38# TODO: VS protection hardware?
39>>7	byte		x		\b]
40# NES 2.0-specific flags.
41>7	byte&0x0C	=0x8
42>>12	byte&0x03	=0x0		[NTSC]
43>>12	byte&0x03	=0x1		[PAL]
44>>12	byte&0x02	=0x2		[NTSC+PAL]
45
46#------------------------------------------------------------------------------
47# unif: file(1) magic for UNIF-format Nintendo Entertainment System ROM images
48# Reference: http://wiki.nesdev.com/w/index.php/UNIF
49# From: David Korth <gerbilsoft@gerbilsoft.com>
50# TODO commit on 2016/03/21
51#
52# NOTE: The UNIF format uses chunks instead of a fixed header,
53# so most of the data isn't easily parseable.
54#
550	string	UNIF
56>4	lelong	<16	UNIF v%d format NES ROM image
57
58#------------------------------------------------------------------------------
59# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format
60# Reference: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header
61#
620x104		bequad		0xCEED6666CC0D000B	Game Boy ROM image
63>0x143		byte&0x80	0x80
64>>0x134		string		>\0			\b: "%.15s"
65>0x143		byte&0x80	!0x80
66>>0x134		string		>\0			\b: "%.16s"
67>0x14c		byte		x			(Rev.%02u)
68
69# Machine type. (SGB, CGB, SGB+CGB)
70>0x14b		byte		0x33
71>>0x146		byte		0x03
72>>>0x143	byte&0x80	0x80	[SGB+CGB]
73>>>0x143	byte&0x80	!0x80	[SGB]
74>>0x146		byte		!0x03
75>>>0x143	byte&0xC0	0x80	[CGB]
76>>>0x143	byte&0xC0	0xC0	[CGB ONLY]
77
78# Mapper.
79>0x147 byte 0x00  [ROM ONLY]
80>0x147 byte 0x01  [MBC1]
81>0x147 byte 0x02  [MBC1+RAM]
82>0x147 byte 0x03  [MBC1+RAM+BATT]
83>0x147 byte 0x05  [MBC2]
84>0x147 byte 0x06  [MBC2+BATTERY]
85>0x147 byte 0x08  [ROM+RAM]
86>0x147 byte 0x09  [ROM+RAM+BATTERY]
87>0x147 byte 0x0B  [MMM01]
88>0x147 byte 0x0C  [MMM01+SRAM]
89>0x147 byte 0x0D  [MMM01+SRAM+BATT]
90>0x147 byte 0x0F  [MBC3+TIMER+BATT]
91>0x147 byte 0x10  [MBC3+TIMER+RAM+BATT]
92>0x147 byte 0x11  [MBC3]
93>0x147 byte 0x12  [MBC3+RAM]
94>0x147 byte 0x13  [MBC3+RAM+BATT]
95>0x147 byte 0x19  [MBC5]
96>0x147 byte 0x1A  [MBC5+RAM]
97>0x147 byte 0x1B  [MBC5+RAM+BATT]
98>0x147 byte 0x1C  [MBC5+RUMBLE]
99>0x147 byte 0x1D  [MBC5+RUMBLE+SRAM]
100>0x147 byte 0x1E  [MBC5+RUMBLE+SRAM+BATT]
101>0x147 byte 0xFC  [Pocket Camera]
102>0x147 byte 0xFD  [Bandai TAMA5]
103>0x147 byte 0xFE  [Hudson HuC-3]
104>0x147 byte 0xFF  [Hudson HuC-1]
105
106# ROM size.
107>0x148 byte 0     \b, ROM: 256Kbit
108>0x148 byte 1     \b, ROM: 512Kbit
109>0x148 byte 2     \b, ROM: 1Mbit
110>0x148 byte 3     \b, ROM: 2Mbit
111>0x148 byte 4     \b, ROM: 4Mbit
112>0x148 byte 5     \b, ROM: 8Mbit
113>0x148 byte 6     \b, ROM: 16Mbit
114>0x148 byte 7     \b, ROM: 32Mbit
115>0x148 byte 0x52  \b, ROM: 9Mbit
116>0x148 byte 0x53  \b, ROM: 10Mbit
117>0x148 byte 0x54  \b, ROM: 12Mbit
118
119# RAM size.
120>0x149 byte 1     \b, RAM: 16Kbit
121>0x149 byte 2     \b, RAM: 64Kbit
122>0x149 byte 3     \b, RAM: 128Kbit
123>0x149 byte 4     \b, RAM: 1Mbit
124>0x149 byte 5     \b, RAM: 512Kbit
125
126#------------------------------------------------------------------------------
127# genesis: file(1) magic for various Sega Mega Drive / Genesis ROM image and disc formats
128# Updated by David Korth <gerbilsoft@gerbilsoft.com>
129# References:
130# - http://www.retrodev.com/segacd.html
131# - http://devster.monkeeh.com/sega/32xguide1.txt
132#
133
134# Common Sega Mega Drive header format.
135# FIXME: Name fields are 48 bytes, but have spaces for padding instead of 00s.
1360		name	sega-mega-drive-header
137# ROM title. (Use domestic if present; if not, use international.)
138>0x120		byte	>0x20
139>>0x120		string	>\0	\b: "%.16s"
140>0x120		byte	<0x21
141>>0x150		string	>\0	\b: "%.16s"
142# Other information.
143>0x180		string	>\0	(%.14s
144>>0x110		string  >\0	\b, %.16s
145>0x180		byte	0
146>>0x110		string  >\0	(%.16s
147>0		byte	x	\b)
148
149# TODO: Check for 32X CD?
150# Sega Mega CD disc images: 2048-byte sectors.
1510	string	SEGADISCSYSTEM\ \ 	Sega Mega CD disc image
152>0	use	sega-mega-drive-header
153>0	byte	x			\b, 2048-byte sectors
1540	string	SEGABOOTDISC\ \ \ \ 	Sega Mega CD disc image
155>0	use	sega-mega-drive-header
156>0	byte	x			\b, 2048-byte sectors
157# Sega Mega CD disc images: 2352-byte sectors.
1580x10	string	SEGADISCSYSTEM\ \ 	Sega Mega CD disc image
159>0x10	use	sega-mega-drive-header
160>0	byte	x			\b, 2352-byte sectors
1610x10	string	SEGABOOTDISC\ \ \ \ 	Sega Mega CD disc image
162>0x10	use	sega-mega-drive-header
163>0	byte	x			\b, 2352-byte sectors
164
165# Sega Mega Drive, 32X, Pico, and Mega CD Boot ROM images.
1660x100		string	SEGA
167>0x3C0		bequad	0x4D41525320434845	Sega 32X ROM image
168>>0		use	sega-mega-drive-header
169>0x3C0		bequad	!0x4D41525320434845
170>>0x105		belong	0x5049434F	Sega Pico ROM image
171>>>0		use	sega-mega-drive-header
172>>0x105		belong	!0x5049434F
173>>>0x180	beshort	0x4252		Sega Mega CD Boot ROM image
174>>>0x180	beshort	!0x4252		Sega Mega Drive / Genesis ROM image
175>>>0		use	sega-mega-drive-header
176
177#------------------------------------------------------------------------------
178# genesis: file(1) magic for the Super MegaDrive ROM dump format
179#
180
181# NOTE: Due to interleaving, we can't display anything
182# other than the copier header information.
1830      name    sega-genesis-smd-header
184>0     byte    x       %dx16k blocks
185>2     byte    0       \b, last in series or standalone
186>2     byte    >0      \b, split ROM
187
188# "Sega Genesis" header.
1890x280	string EAGN
190>8	beshort	0xAABB	Sega Mega Drive / Genesis ROM image (SMD format):
191>>0	use     sega-genesis-smd-header
192
193# "Sega Mega Drive" header.
1940x280	string EAMG
195>8	beshort	0xAABB	Sega Mega Drive / Genesis ROM image (SMD format):
196>>0	use     sega-genesis-smd-header
197
198#------------------------------------------------------------------------------
199# smsgg:  file(1) magic for Sega Master System and Game Gear ROM images
200# Detects all Game Gear and export Sega Master System ROM images,
201# and some Japanese Sega Master System ROM images.
202# From: David Korth <gerbilsoft@gerbilsoft.com>
203# Reference: http://www.smspower.org/Development/ROMHeader
204#
205
206# General SMS header rule.
207# The SMS boot ROM checks the header at three locations.
2080	name	sega-master-system-rom-header
209# Machine type.
210>0x0F	byte&0xF0	0x30	Sega Master System
211>0x0F	byte&0xF0	0x40	Sega Master System
212>0x0F	byte&0xF0	0x50	Sega Game Gear
213>0x0F	byte&0xF0	0x60	Sega Game Gear
214>0x0F	byte&0xF0	0x70	Sega Game Gear
215>0x0F	byte&0xF0	<0x30	Sega Master System / Game Gear
216>0x0F	byte&0xF0	>0x70	Sega Master System / Game Gear
217>0	byte		x	ROM image:
218# Product code.
219>0x0E	byte&0xF0	0x10	1
220>0x0E	byte&0xF0	0x20	2
221>0x0E	byte&0xF0	0x30	3
222>0x0E	byte&0xF0	0x40	4
223>0x0E	byte&0xF0	0x50	5
224>0x0E	byte&0xF0	0x60	6
225>0x0E	byte&0xF0	0x70	7
226>0x0E	byte&0xF0	0x80	8
227>0x0E	byte&0xF0	0x90	9
228>0x0E	byte&0xF0	0xA0	10
229>0x0E	byte&0xF0	0xB0	11
230>0x0E	byte&0xF0	0xC0	12
231>0x0E	byte&0xF0	0xD0	13
232>0x0E	byte&0xF0	0xE0	14
233>0x0E	byte&0xF0	0xF0	15
234# If the product code is 5 digits, we'll need to backspace here.
235>0x0E	byte&0xF0	!0
236>>0x0C	leshort		x	\b%04x
237>0x0E	byte&0xF0	0
238>>0x0C	leshort		x	%04x
239# Revision.
240>0x0E	byte&0x0F	x	(Rev.%02d)
241# ROM size. (Used for the boot ROM checksum routine.)
242>0x0F	byte&0x0F	0x0A	(8 KB)
243>0x0F	byte&0x0F	0x0B	(16 KB)
244>0x0F	byte&0x0F	0x0C	(32 KB)
245>0x0F	byte&0x0F	0x0D	(48 KB)
246>0x0F	byte&0x0F	0x0E	(64 KB)
247>0x0F	byte&0x0F	0x0F	(128 KB)
248>0x0F	byte&0x0F	0x00	(256 KB)
249>0x0F	byte&0x0F	0x01	(512 KB)
250>0x0F	byte&0x0F	0x02	(1 MB)
251
252# SMS/GG header locations.
2530x7FF0	string	TMR\ SEGA
254>0x7FF0	use	sega-master-system-rom-header
2550x3FF0	string	TMR\ SEGA
256>0x3FF0	use	sega-master-system-rom-header
2570x1FF0	string	TMR\ SEGA
258>0x1FF0	use	sega-master-system-rom-header
259
260#------------------------------------------------------------------------------
261# saturn: file(1) magic for the Sega Saturn disc image format.
262# From: David Korth <gerbilsoft@gerbilsoft.com>
263#
264
265# Common Sega Saturn disc header format.
266# NOTE: Title is 112 bytes, but we're only showing 32 due to space padding.
267# TODO: Release date, device information, region code, others?
2680	name	sega-saturn-disc-header
269>0x60	string	>\0	\b: "%.32s"
270>0x20	string	>\0	(%.10s
271>>0x2A	string	>\0	\b, %.6s)
272>>0x2A	byte	0	\b)
273
274# 2048-byte sector version.
2750	string	SEGA\ SEGASATURN\ 	Sega Saturn disc image
276>0	use	sega-saturn-disc-header
277>0	byte	x			(2048-byte sectors)
278# 2352-byte sector version.
2790x10	string	SEGA\ SEGASATURN\ 	Sega Saturn disc image
280>0x10	use	sega-saturn-disc-header
281>0	byte	x			(2352-byte sectors)
282
283#------------------------------------------------------------------------------
284# dreamcast: file(1) magic for the Sega Dreamcast disc image format.
285# From: David Korth <gerbilsoft@gerbilsoft.com>
286# Reference: http://mc.pp.se/dc/ip0000.bin.html
287#
288
289# Common Sega Dreamcast disc header format.
290# NOTE: Title is 128 bytes, but we're only showing 32 due to space padding.
291# TODO: Release date, device information, region code, others?
2920	name	sega-dreamcast-disc-header
293>0x80	string	>\0	\b: "%.32s"
294>0x40	string	>\0	(%.10s
295>>0x4A	string	>\0	\b, %.6s)
296>>0x4A	byte	0	\b)
297
298# 2048-byte sector version.
2990	string	SEGA\ SEGAKATANA\ 	Sega Dreamcast disc image
300>0	use	sega-dreamcast-disc-header
301>0	byte	x			(2048-byte sectors)
302# 2352-byte sector version.
3030x10	string	SEGA\ SEGAKATANA\ 	Sega Dreamcast disc image
304>0x10	use	sega-dreamcast-disc-header
305>0	byte	x			(2352-byte sectors)
306
307#------------------------------------------------------------------------------
308# dreamcast:  file(1) uncertain magic for the Sega Dreamcast VMU image format
309#
3100 belong 0x21068028   Sega Dreamcast VMU game image
3110 string LCDi         Dream Animator file
312
313#------------------------------------------------------------------------------
314# z64: file(1) magic for the Z64 format N64 ROM dumps
315# Reference: http://forum.pj64-emu.com/showthread.php?t=2239
316# From: David Korth <gerbilsoft@gerbilsoft.com>
317#
3180	bequad	0x803712400000000F	Nintendo 64 ROM image
319>0x20	string	>\0	\b: "%.20s"
320>0x3B	string	x	(%.4s
321>0x3F	byte	x	\b, Rev.%02u)
322
323#------------------------------------------------------------------------------
324# v64: file(1) magic for the V64 format N64 ROM dumps
325# Same as z64 format, but with 16-bit byteswapping.
326#
3270	bequad	0x3780401200000F00	Nintendo 64 ROM image (V64)
328
329#------------------------------------------------------------------------------
330# n64-swap2: file(1) magic for the swap2 format N64 ROM dumps
331# Same as z64 format, but with swapped 16-bit words.
332#
3330	bequad	0x12408037000F0000	Nintendo 64 ROM image (wordswapped)
334
335#------------------------------------------------------------------------------
336# n64-le32: file(1) magic for the 32-bit byteswapped format N64 ROM dumps
337# Same as z64 format, but with 32-bit byteswapping.
338#
3390	bequad	0x401237800F000000	Nintendo 64 ROM image (32-bit byteswapped)
340
341#------------------------------------------------------------------------------
342# gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format
343# Reference: http://problemkaputt.de/gbatek.htm#gbacartridgeheader
344#
345# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
346# Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
347#
3484	bequad	0x24FFAE51699AA221	Game Boy Advance ROM image
349>0xA0	string	>\0	\b: "%.12s"
350>0xAC	string	x	(%.6s
351>0xBC	byte	x	\b, Rev.%02u)
352
353#------------------------------------------------------------------------------
354# nds: file(1) magic for the Nintendo DS(i) raw ROM format
355# Reference: http://problemkaputt.de/gbatek.htm#dscartridgeheader
356#
357# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
358# Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
359#
3600xC0	bequad	0x24FFAE51699AA221	Nintendo DS ROM image
361>0x00	string	>\0		\b: "%.12s"
362>0x0C	string	x		(%.6s
363>0x1E	byte	x		\b, Rev.%02u)
364>0x12	byte	2		(DSi enhanced)
365>0x12	byte	3		(DSi only)
366
367#------------------------------------------------------------------------------
368# nds_passme: file(1) magic for Nintendo DS ROM images for GBA cartridge boot.
369# This is also used for loading .nds files using the MSET exploit on 3DS.
370# Reference: https://github.com/devkitPro/ndstool/blob/master/source/ndscreate.cpp
3710xC0	bequad	0xC8604FE201708FE2	Nintendo DS Slot-2 ROM image (PassMe)
372
373#------------------------------------------------------------------------------
374# ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format.
375# From: David Korth <gerbilsoft@gerbilsoft.com>
376# References:
377# - https://neogpc.googlecode.com/svn-history/r10/trunk/src/core/neogpc.cpp
378# - http://www.devrs.com/ngp/files/ngpctech.txt
379#
3800x0A	string	BY\ SNK\ CORPORATION	Neo Geo Pocket
381>0x23	byte	0x10			Color
382>0	byte	x			ROM image
383>0x24	string	>\0			\b: "%.12s"
384>0x1F	byte	0xFF			(debug mode enabled)
385
386#------------------------------------------------------------------------------
387# msx: file(1) magic for MSX game cartridge dumps
388# Too simple - MPi
389#0 beshort 0x4142 MSX game cartridge dump
390
391#------------------------------------------------------------------------------
392# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) :
3930	string	PS-X\ EXE	Sony Playstation executable
394>16	lelong	x		PC=0x%08x,
395>20	lelong	!0		GP=0x%08x,
396>24	lelong	!0		.text=[0x%08x,
397>>28	lelong	x		\b0x%x],
398>32	lelong	!0		.data=[0x%08x,
399>>36	lelong	x		\b0x%x],
400>40	lelong	!0		.bss=[0x%08x,
401>>44	lelong	x		\b0x%x],
402>48	lelong	!0		Stack=0x%08x,
403>48	lelong	=0		No Stack!,
404>52	lelong	!0		StackSize=0x%x,
405#>76	string	>\0		(%s)
406#  Area:
407>113	string	x		(%s)
408
409# CPE executables
4100	string	CPE		CPE executable
411>3	byte	x		(version %d)
412
413#------------------------------------------------------------------------------
414# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>)
4150       string          XBEH            XBE, Microsoft Xbox executable
416# probabilistic checks whether signed or not
417>0x0004 ulelong =0x0
418>>&2    ulelong =0x0
419>>>&2   ulelong =0x0  \b, not signed
420>0x0004 ulelong >0
421>>&2    ulelong >0
422>>>&2   ulelong >0    \b, signed
423# expect base address of 0x10000
424>0x0104               ulelong =0x10000
425>>(0x0118-0x0FF60)    ulelong&0x80000007  0x80000007 \b, all regions
426>>(0x0118-0x0FF60)    ulelong&0x80000007  !0x80000007
427>>>(0x0118-0x0FF60)   ulelong >0           (regions:
428>>>>(0x0118-0x0FF60)  ulelong &0x00000001  NA
429>>>>(0x0118-0x0FF60)  ulelong &0x00000002  Japan
430>>>>(0x0118-0x0FF60)  ulelong &0x00000004  Rest_of_World
431>>>>(0x0118-0x0FF60)  ulelong &0x80000000  Manufacturer
432>>>(0x0118-0x0FF60)   ulelong >0           \b)
433
434# --------------------------------
435# Microsoft Xbox data file formats
4360       string          XIP0            XIP, Microsoft Xbox data
4370       string          XTF0            XTF, Microsoft Xbox data
438
439# Atari Lynx cartridge dump (EXE/BLL header)
440# From: "Stefan A. Haubenthal" <polluks@web.de>
441
442# Double-check that the image type matches too, 0x8008 conflicts with
443# 8 character OMF-86 object file headers.
4440	beshort		0x8008
445>6	string		BS93		Lynx homebrew cartridge
446>>2	beshort		x		\b, RAM start $%04x
447>6	string		LYNX		Lynx cartridge
448>>2	beshort		x		\b, RAM start $%04x
449
450# Opera file system that is used on the 3DO console
451# From: Serge van den Boom <svdb@stack.nl>
4520	string		\x01ZZZZZ\x01	3DO "Opera" file system
453
454# From: Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
455# From: David Pflug <david@pflug.email>
456# is the offset 12 or the offset 16 correct?
457# GBS (Game Boy Sound) magic
458# ftp://ftp.modland.com/pub/documents/format_documentation/\
459# Gameboy%20Sound%20System%20(.gbs).txt
4600	string		GBS		Nintendo Gameboy Music/Audio Data
461#12	string		GameBoy\ Music\ Module	Nintendo Gameboy Music Module
462>16	string		>\0	("%s" by
463>48	string		>\0	%s, copyright
464>80	string		>\0	%s),
465>3	byte		x	version %d,
466>4	byte		x	%d tracks
467
468# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at>
4690	string	PPF30			Playstation Patch File version 3.0
470>5	byte	0			\b, PPF 1.0 patch
471>5	byte	1			\b, PPF 2.0 patch
472>5	byte	2			\b, PPF 3.0 patch
473>>56	byte	0			\b, Imagetype BIN (any)
474>>56	byte	1			\b, Imagetype GI (PrimoDVD)
475>>57	byte	0			\b, Blockcheck disabled
476>>57	byte	1			\b, Blockcheck enabled
477>>58	byte	0			\b, Undo data not available
478>>58	byte	1			\b, Undo data available
479>6	string	x			\b, description: %s
480
4810	string	PPF20			Playstation Patch File version 2.0
482>5	byte	0			\b, PPF 1.0 patch
483>5	byte	1			\b, PPF 2.0 patch
484>>56	lelong	>0			\b, size of file to patch %d
485>6	string	x			\b, description: %s
486
4870	string	PPF10			Playstation Patch File version 1.0
488>5	byte	0			\b, Simple Encoding
489>6	string	x			\b, description: %s
490
491# From: Daniel Dawson <ddawson@icehouse.net>
492# SNES9x .smv "movie" file format.
4930		string		SMV\x1A	SNES9x input recording
494>0x4		lelong		x	\b, version %d
495# version 4 is latest so far
496>0x4		lelong		<5
497>>0x8		ledate		x	\b, recorded at %s
498>>0xc		lelong		>0	\b, rerecorded %d times
499>>0x10		lelong		x	\b, %d frames long
500>>0x14		byte		>0	\b, data for controller(s):
501>>>0x14		byte		&0x1	#1
502>>>0x14		byte		&0x2	#2
503>>>0x14		byte		&0x4	#3
504>>>0x14		byte		&0x8	#4
505>>>0x14		byte		&0x10	#5
506>>0x15		byte		^0x1	\b, begins from snapshot
507>>0x15		byte		&0x1	\b, begins from reset
508>>0x15		byte		^0x2	\b, NTSC standard
509>>0x15		byte		&0x2	\b, PAL standard
510>>0x17		byte		&0x1    \b, settings:
511# WIP1Timing not used as of version 4
512>>>0x4		lelong		<4
513>>>>0x17	byte		&0x2	WIP1Timing
514>>>0x17		byte		&0x4	Left+Right
515>>>0x17		byte		&0x8	VolumeEnvX
516>>>0x17		byte		&0x10	FakeMute
517>>>0x17		byte		&0x20	SyncSound
518# New flag as of version 4
519>>>0x4		lelong		>3
520>>>>0x17	byte		&0x80	NoCPUShutdown
521>>0x4		lelong		<4
522>>>0x18		lelong		>0x23
523>>>>0x20	leshort		!0
524>>>>>0x20	lestring16	x	\b, metadata: "%s"
525>>0x4		lelong		>3
526>>>0x24		byte		>0	\b, port 1:
527>>>>0x24	byte		1	joypad
528>>>>0x24	byte		2	mouse
529>>>>0x24	byte		3	SuperScope
530>>>>0x24	byte		4	Justifier
531>>>>0x24	byte		5	multitap
532>>>0x24		byte		>0	\b, port 2:
533>>>>0x25	byte		1	joypad
534>>>>0x25	byte		2	mouse
535>>>>0x25	byte		3	SuperScope
536>>>>0x25	byte		4	Justifier
537>>>>0x25	byte		5	multitap
538>>>0x18		lelong		>0x43
539>>>>0x40	leshort		!0
540>>>>>0x40	lestring16	x	\b, metadata: "%s"
541>>0x17		byte		&0x40   \b, ROM:
542>>>(0x18.l-26)	lelong		x	CRC32 0x%08x
543>>>(0x18.l-23)	string		x	"%s"
544
545# Type: scummVM savegame files
546# From: Sven Hartge <debian@ds9.argh.org>
5470	string	SCVM	ScummVM savegame
548>12	string	>\0	"%s"
549
550#------------------------------------------------------------------------------
551# Nintendo GameCube / Wii file formats.
552#
553
554# Type: Nintendo GameCube/Wii common disc header data.
555# From: David Korth <gerbilsoft@gerbilsoft.com>
556# Reference: http://wiibrew.org/wiki/Wii_Disc
5570	name	nintendo-gcn-disc-common
558>0x20	string	x	"%.64s"
559>0x00	string	x	(%.6s
560>0x06	byte	>0
561>>0x06	byte	1	\b, Disc 2
562>>0x06	byte	2	\b, Disc 3
563>>0x06	byte	3	\b, Disc 4
564>0x07	byte	x	\b, Rev.%02u)
565
566# Type: Nintendo GameCube disc image
567# From: David Korth <gerbilsoft@gerbilsoft.com>
568# Reference: http://wiibrew.org/wiki/Wii_Disc
5690x1C	belong	0xC2339F3D	Nintendo GameCube disc image:
570>0	use	nintendo-gcn-disc-common
571
572# Type: Nintendo Wii disc image
573# From: David Korth <gerbilsoft@gerbilsoft.com>
574# Reference: http://wiibrew.org/wiki/Wii_Disc
5750x18	belong	0x5D1C9EA3	Nintendo Wii disc image:
576>0	use	nintendo-gcn-disc-common
577
578# Type: Nintendo Wii disc image (WBFS format)
579# From: David Korth <gerbilsoft@gerbilsoft.com>
580# Reference: http://wiibrew.org/wiki/Wii_Disc
5810	string	WBFS
582>0x218	belong	0x5D1C9EA3	Nintendo Wii disc image (WBFS format):
583>>0x200	use	nintendo-gcn-disc-common
584
585#------------------------------------------------------------------------------
586# Nintendo 3DS file formats.
587#
588
589# Type: Nintendo 3DS "NCCH" header.
590# Contained within either a CXI executable or an NCSD image.
591# From: David Korth <gerbilsoft@gerbilsoft.com>
592# Reference: https://www.3dbrew.org/wiki/NCCH
5930		name		nintendo-3ds-NCCH
594>0x100		string		NCCH
595>>0x150		string		>\0	\b: "%.16s"
596>>0x112		leshort		x	(v%u)
597>>0x18C		byte		2	(New3DS only)
598
599# Type: Nintendo 3DS "NCSD" image. (game cards and eMMC)
600# From: David Korth <gerbilsoft@gerbilsoft.com>
601# Reference: https://www.3dbrew.org/wiki/NCSD
6020x100		string		NCSD
603>0x118		lequad		0		Nintendo 3DS Game Card image
604>>0x1000	use		nintendo-3ds-NCCH
605>>0x18D		byte		0		(inner device)
606>>0x18D		byte		1		(Card1)
607>>0x18D		byte		2		(Card2)
608>>0x18D		byte		3		(extended device)
609>0x118		bequad		0x0102020202000000	Nintendo 3DS eMMC dump (Old3DS)
610>0x118		bequad		0x0102020203000000	Nintendo 3DS eMMC dump (New3DS)
611
612# Type: Nintendo 3DS "NCCH" container.
613# https://www.3dbrew.org/wiki/NCCH
6140x100	string	NCCH		Nintendo 3DS
615>0x18D	byte&2	0		File Archive (CFA)
616>0x18D	byte&2	2		Executable Image (CXI)
617>0	use	nintendo-3ds-NCCH
618
619# Type: Nintendo 3DS "SMDH" file. (application description)
620# From: David Korth <gerbilsoft@gerbilsoft.com>
621# Reference: https://3dbrew.org/wiki/SMDH
6220		string		SMDH		Nintendo 3DS SMDH file
623>0x208		leshort		!0
624>>0x208		lestring16	x		\b: "%.128s"
625>>0x388		leshort		!0
626>>>0x388	lestring16	x		by %.128s
627>0x208		leshort		0
628>>0x008		leshort		!0
629>>>0x008	lestring16	x		\b: "%.128s"
630>>>0x188	leshort		!0
631>>>>0x188	lestring16	x		by %.128s
632
633# Type: Nintendo 3DS Homebrew Application.
634# From: David Korth <gerbilsoft@gerbilsoft.com>
635# Refernece: https://3dbrew.org/wiki/3DSX_Format
6360	string	3DSX	Nintendo 3DS Homebrew Application (3DSX)
637
638#------------------------------------------------------------------------------
639# a7800: file(1) magic for the Atari 7800 raw ROM format.
640# From: David Korth <gerbilsoft@gerbilsoft.com>
641# Reference: https://sites.google.com/site/atari7800wiki/a78-header
642
6430	byte	>0
644>0	byte	<3
645>>1	string	ATARI7800	Atari 7800 ROM image
646>>>0x11	string	>\0	\b: "%.32s"
647# Display type.
648>>>0x39	byte	0	(NTSC)
649>>>0x39	byte	1	(PAL)
650>>>0x36	byte&1	1	(POKEY)
651
652#------------------------------------------------------------------------------
653# vectrex: file(1) magic for the GCE Vectrex raw ROM format.
654# From: David Korth <gerbilsoft@gerbilsoft.com>
655# Reference: http://www.playvectrex.com/designit/chrissalo/hello1.htm
656#
657# NOTE: Title is terminated with 0x80, not 0.
658# The header is terminated with a 0, so that will
659# terminate the title as well.
660#
6610	string	g\ GCE	Vectrex ROM image
662>0x11	string	>\0	\b: "%.16s"
663