xref: /freebsd/contrib/file/magic/Magdir/console (revision 282e23f07bf49b4e37aabdcc1c513a788db36d10)
1b6cee71dSXin LI
2b6cee71dSXin LI#------------------------------------------------------------------------------
3*282e23f0SXin LI# $File: console,v 1.26 2016/06/12 15:20:37 christos Exp $
4b6cee71dSXin LI# Console game magic
5b6cee71dSXin LI# Toby Deshane <hac@shoelace.digivill.net>
6b6cee71dSXin LI
73e41d09dSXin LI# ines: file(1) magic for Marat's iNES Nintendo Entertainment System ROM dump format
83e41d09dSXin LI# Updated by David Korth <gerbilsoft@gerbilsoft.com>
93e41d09dSXin LI# References:
103e41d09dSXin LI# - http://wiki.nesdev.com/w/index.php/INES
113e41d09dSXin LI# - http://wiki.nesdev.com/w/index.php/NES_2.0
123e41d09dSXin LI0	string		NES\x1A		iNES ROM image
133e41d09dSXin LI>7	byte&0x0C	=0x8		(NES 2.0)
143e41d09dSXin LI>4	byte		x		\b: %ux16k PRG
153e41d09dSXin LI>5	byte		x		\b, %ux16k CHR
163e41d09dSXin LI>6	byte&0x08	=0x8		[4-Scr]
173e41d09dSXin LI>6	byte&0x09	=0x0		[H-mirror]
183e41d09dSXin LI>6	byte&0x09	=0x1		[V-mirror]
193e41d09dSXin LI>6	byte&0x02	=0x2		[SRAM]
203e41d09dSXin LI>6	byte&0x04	=0x4		[Trainer]
213e41d09dSXin LI>7	byte&0x03	=0x2		[PC10]
223e41d09dSXin LI>7	byte&0x03	=0x1		[VS
233e41d09dSXin LI>>7	byte&0x0C	=0x8
243e41d09dSXin LI# NES 2.0: VS PPU
253e41d09dSXin LI>>>13	byte&0x0F	=0x0		\b, RP2C03B
263e41d09dSXin LI>>>13	byte&0x0F	=0x1		\b, RP2C03G
273e41d09dSXin LI>>>13	byte&0x0F	=0x2		\b, RP2C04-0001
283e41d09dSXin LI>>>13	byte&0x0F	=0x3		\b, RP2C04-0002
293e41d09dSXin LI>>>13	byte&0x0F	=0x4		\b, RP2C04-0003
303e41d09dSXin LI>>>13	byte&0x0F	=0x5		\b, RP2C04-0004
313e41d09dSXin LI>>>13	byte&0x0F	=0x6		\b, RP2C03B
323e41d09dSXin LI>>>13	byte&0x0F	=0x7		\b, RP2C03C
333e41d09dSXin LI>>>13	byte&0x0F	=0x8		\b, RP2C05-01
343e41d09dSXin LI>>>13	byte&0x0F	=0x9		\b, RP2C05-02
353e41d09dSXin LI>>>13	byte&0x0F	=0xA		\b, RP2C05-03
363e41d09dSXin LI>>>13	byte&0x0F	=0xB		\b, RP2C05-04
373e41d09dSXin LI>>>13	byte&0x0F	=0xC		\b, RP2C05-05
383e41d09dSXin LI# TODO: VS protection hardware?
393e41d09dSXin LI>>7	byte		x		\b]
403e41d09dSXin LI# NES 2.0-specific flags.
413e41d09dSXin LI>7	byte&0x0C	=0x8
423e41d09dSXin LI>>12	byte&0x03	=0x0		[NTSC]
433e41d09dSXin LI>>12	byte&0x03	=0x1		[PAL]
443e41d09dSXin LI>>12	byte&0x02	=0x2		[NTSC+PAL]
453e41d09dSXin LI
463e41d09dSXin LI#------------------------------------------------------------------------------
473e41d09dSXin LI# unif: file(1) magic for UNIF-format Nintendo Entertainment System ROM images
483e41d09dSXin LI# Reference: http://wiki.nesdev.com/w/index.php/UNIF
493e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
503e41d09dSXin LI# TODO commit on 2016/03/21
513e41d09dSXin LI#
523e41d09dSXin LI# NOTE: The UNIF format uses chunks instead of a fixed header,
533e41d09dSXin LI# so most of the data isn't easily parseable.
543e41d09dSXin LI#
553e41d09dSXin LI0	string	UNIF
5620f8619dSXin LI>4	lelong	<16	UNIF v%d format NES ROM image
57b6cee71dSXin LI
58b6cee71dSXin LI#------------------------------------------------------------------------------
59*282e23f0SXin LI# fds: file(1) magic for Famciom Disk System disk images
60*282e23f0SXin LI# Reference: http://wiki.nesdev.com/w/index.php/Family_Computer_Disk_System#.FDS_format
61*282e23f0SXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
62*282e23f0SXin LI# TODO: Check "Disk info block" and get info from that in addition to the optional header.
63*282e23f0SXin LI
64*282e23f0SXin LI# Disk info block. (block 1)
65*282e23f0SXin LI0	name	nintendo-fds-disk-info-block
66*282e23f0SXin LI>1	string	*NINTENDO-HVC*	Famicom Disk System disk image:
67*282e23f0SXin LI>23	byte	!1		FMC-
68*282e23f0SXin LI>23	byte	1		FSC-
69*282e23f0SXin LI>16	string	x		\b%.3s
70*282e23f0SXin LI>15	byte	x		\b, mfr 0x%02X
71*282e23f0SXin LI>20	byte	x		(Rev.%02u)
72*282e23f0SXin LI
73*282e23f0SXin LI# Headered version.
74*282e23f0SXin LI0	string	FDS\x1A
75*282e23f0SXin LI>0x11	string	*NINTENDO-HVC*
76*282e23f0SXin LI>>0x10	use	nintendo-fds-disk-info-block
77*282e23f0SXin LI>4	byte	1	(%u side)
78*282e23f0SXin LI>4	byte	!1	(%u sides)
79*282e23f0SXin LI
80*282e23f0SXin LI# Unheadered version.
81*282e23f0SXin LI1	string	*NINTENDO-HVC*
82*282e23f0SXin LI>0	use	nintendo-fds-disk-info-block
83*282e23f0SXin LI
84*282e23f0SXin LI#------------------------------------------------------------------------------
85b6cee71dSXin LI# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format
863e41d09dSXin LI# Reference: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header
87b6cee71dSXin LI#
883e41d09dSXin LI0x104		bequad		0xCEED6666CC0D000B	Game Boy ROM image
893e41d09dSXin LI>0x143		byte&0x80	0x80
903e41d09dSXin LI>>0x134		string		>\0			\b: "%.15s"
913e41d09dSXin LI>0x143		byte&0x80	!0x80
923e41d09dSXin LI>>0x134		string		>\0			\b: "%.16s"
933e41d09dSXin LI>0x14c		byte		x			(Rev.%02u)
94b6cee71dSXin LI
953e41d09dSXin LI# Machine type. (SGB, CGB, SGB+CGB)
963e41d09dSXin LI>0x14b		byte		0x33
973e41d09dSXin LI>>0x146		byte		0x03
983e41d09dSXin LI>>>0x143	byte&0x80	0x80	[SGB+CGB]
993e41d09dSXin LI>>>0x143	byte&0x80	!0x80	[SGB]
1003e41d09dSXin LI>>0x146		byte		!0x03
1013e41d09dSXin LI>>>0x143	byte&0xC0	0x80	[CGB]
1023e41d09dSXin LI>>>0x143	byte&0xC0	0xC0	[CGB ONLY]
1033e41d09dSXin LI
1043e41d09dSXin LI# Mapper.
1053e41d09dSXin LI>0x147 byte 0x00  [ROM ONLY]
1063e41d09dSXin LI>0x147 byte 0x01  [MBC1]
1073e41d09dSXin LI>0x147 byte 0x02  [MBC1+RAM]
1083e41d09dSXin LI>0x147 byte 0x03  [MBC1+RAM+BATT]
1093e41d09dSXin LI>0x147 byte 0x05  [MBC2]
1103e41d09dSXin LI>0x147 byte 0x06  [MBC2+BATTERY]
1113e41d09dSXin LI>0x147 byte 0x08  [ROM+RAM]
1123e41d09dSXin LI>0x147 byte 0x09  [ROM+RAM+BATTERY]
1133e41d09dSXin LI>0x147 byte 0x0B  [MMM01]
1143e41d09dSXin LI>0x147 byte 0x0C  [MMM01+SRAM]
1153e41d09dSXin LI>0x147 byte 0x0D  [MMM01+SRAM+BATT]
1163e41d09dSXin LI>0x147 byte 0x0F  [MBC3+TIMER+BATT]
1173e41d09dSXin LI>0x147 byte 0x10  [MBC3+TIMER+RAM+BATT]
1183e41d09dSXin LI>0x147 byte 0x11  [MBC3]
1193e41d09dSXin LI>0x147 byte 0x12  [MBC3+RAM]
1203e41d09dSXin LI>0x147 byte 0x13  [MBC3+RAM+BATT]
1213e41d09dSXin LI>0x147 byte 0x19  [MBC5]
1223e41d09dSXin LI>0x147 byte 0x1A  [MBC5+RAM]
1233e41d09dSXin LI>0x147 byte 0x1B  [MBC5+RAM+BATT]
1243e41d09dSXin LI>0x147 byte 0x1C  [MBC5+RUMBLE]
1253e41d09dSXin LI>0x147 byte 0x1D  [MBC5+RUMBLE+SRAM]
1263e41d09dSXin LI>0x147 byte 0x1E  [MBC5+RUMBLE+SRAM+BATT]
1273e41d09dSXin LI>0x147 byte 0xFC  [Pocket Camera]
1283e41d09dSXin LI>0x147 byte 0xFD  [Bandai TAMA5]
1293e41d09dSXin LI>0x147 byte 0xFE  [Hudson HuC-3]
1303e41d09dSXin LI>0x147 byte 0xFF  [Hudson HuC-1]
1313e41d09dSXin LI
1323e41d09dSXin LI# ROM size.
133b6cee71dSXin LI>0x148 byte 0     \b, ROM: 256Kbit
134b6cee71dSXin LI>0x148 byte 1     \b, ROM: 512Kbit
135b6cee71dSXin LI>0x148 byte 2     \b, ROM: 1Mbit
136b6cee71dSXin LI>0x148 byte 3     \b, ROM: 2Mbit
137b6cee71dSXin LI>0x148 byte 4     \b, ROM: 4Mbit
138b6cee71dSXin LI>0x148 byte 5     \b, ROM: 8Mbit
139b6cee71dSXin LI>0x148 byte 6     \b, ROM: 16Mbit
1403e41d09dSXin LI>0x148 byte 7     \b, ROM: 32Mbit
141b6cee71dSXin LI>0x148 byte 0x52  \b, ROM: 9Mbit
142b6cee71dSXin LI>0x148 byte 0x53  \b, ROM: 10Mbit
143b6cee71dSXin LI>0x148 byte 0x54  \b, ROM: 12Mbit
144b6cee71dSXin LI
1453e41d09dSXin LI# RAM size.
146b6cee71dSXin LI>0x149 byte 1     \b, RAM: 16Kbit
147b6cee71dSXin LI>0x149 byte 2     \b, RAM: 64Kbit
148b6cee71dSXin LI>0x149 byte 3     \b, RAM: 128Kbit
149b6cee71dSXin LI>0x149 byte 4     \b, RAM: 1Mbit
1503e41d09dSXin LI>0x149 byte 5     \b, RAM: 512Kbit
151b6cee71dSXin LI
152b6cee71dSXin LI#------------------------------------------------------------------------------
1533e41d09dSXin LI# genesis: file(1) magic for various Sega Mega Drive / Genesis ROM image and disc formats
1543e41d09dSXin LI# Updated by David Korth <gerbilsoft@gerbilsoft.com>
1553e41d09dSXin LI# References:
1563e41d09dSXin LI# - http://www.retrodev.com/segacd.html
1573e41d09dSXin LI# - http://devster.monkeeh.com/sega/32xguide1.txt
158b6cee71dSXin LI#
1593e41d09dSXin LI
1603e41d09dSXin LI# Common Sega Mega Drive header format.
1613e41d09dSXin LI# FIXME: Name fields are 48 bytes, but have spaces for padding instead of 00s.
1623e41d09dSXin LI0		name	sega-mega-drive-header
1633e41d09dSXin LI# ROM title. (Use domestic if present; if not, use international.)
1643e41d09dSXin LI>0x120		byte	>0x20
1653e41d09dSXin LI>>0x120		string	>\0	\b: "%.16s"
1663e41d09dSXin LI>0x120		byte	<0x21
1673e41d09dSXin LI>>0x150		string	>\0	\b: "%.16s"
1683e41d09dSXin LI# Other information.
1693e41d09dSXin LI>0x180		string	>\0	(%.14s
1703e41d09dSXin LI>>0x110		string  >\0	\b, %.16s
1713e41d09dSXin LI>0x180		byte	0
1723e41d09dSXin LI>>0x110		string  >\0	(%.16s
1733e41d09dSXin LI>0		byte	x	\b)
1743e41d09dSXin LI
1753e41d09dSXin LI# TODO: Check for 32X CD?
1763e41d09dSXin LI# Sega Mega CD disc images: 2048-byte sectors.
1773e41d09dSXin LI0	string	SEGADISCSYSTEM\ \ 	Sega Mega CD disc image
1783e41d09dSXin LI>0	use	sega-mega-drive-header
1793e41d09dSXin LI>0	byte	x			\b, 2048-byte sectors
1803e41d09dSXin LI0	string	SEGABOOTDISC\ \ \ \ 	Sega Mega CD disc image
1813e41d09dSXin LI>0	use	sega-mega-drive-header
1823e41d09dSXin LI>0	byte	x			\b, 2048-byte sectors
1833e41d09dSXin LI# Sega Mega CD disc images: 2352-byte sectors.
1843e41d09dSXin LI0x10	string	SEGADISCSYSTEM\ \ 	Sega Mega CD disc image
1853e41d09dSXin LI>0x10	use	sega-mega-drive-header
1863e41d09dSXin LI>0	byte	x			\b, 2352-byte sectors
1873e41d09dSXin LI0x10	string	SEGABOOTDISC\ \ \ \ 	Sega Mega CD disc image
1883e41d09dSXin LI>0x10	use	sega-mega-drive-header
1893e41d09dSXin LI>0	byte	x			\b, 2352-byte sectors
1903e41d09dSXin LI
1913e41d09dSXin LI# Sega Mega Drive, 32X, Pico, and Mega CD Boot ROM images.
1923e41d09dSXin LI0x100		string	SEGA
1933e41d09dSXin LI>0x3C0		bequad	0x4D41525320434845	Sega 32X ROM image
1943e41d09dSXin LI>>0		use	sega-mega-drive-header
1953e41d09dSXin LI>0x3C0		bequad	!0x4D41525320434845
1963e41d09dSXin LI>>0x105		belong	0x5049434F	Sega Pico ROM image
1973e41d09dSXin LI>>>0		use	sega-mega-drive-header
1983e41d09dSXin LI>>0x105		belong	!0x5049434F
1993e41d09dSXin LI>>>0x180	beshort	0x4252		Sega Mega CD Boot ROM image
2003e41d09dSXin LI>>>0x180	beshort	!0x4252		Sega Mega Drive / Genesis ROM image
2013e41d09dSXin LI>>>0		use	sega-mega-drive-header
202b6cee71dSXin LI
203b6cee71dSXin LI#------------------------------------------------------------------------------
204b6cee71dSXin LI# genesis: file(1) magic for the Super MegaDrive ROM dump format
205b6cee71dSXin LI#
2063e41d09dSXin LI
2073e41d09dSXin LI# NOTE: Due to interleaving, we can't display anything
2083e41d09dSXin LI# other than the copier header information.
2093e41d09dSXin LI0      name    sega-genesis-smd-header
210b6cee71dSXin LI>0     byte    x       %dx16k blocks
211b6cee71dSXin LI>2     byte    0       \b, last in series or standalone
212b6cee71dSXin LI>2     byte    >0      \b, split ROM
2133e41d09dSXin LI
2143e41d09dSXin LI# "Sega Genesis" header.
2153e41d09dSXin LI0x280	string EAGN
2163e41d09dSXin LI>8	beshort	0xAABB	Sega Mega Drive / Genesis ROM image (SMD format):
2173e41d09dSXin LI>>0	use     sega-genesis-smd-header
2183e41d09dSXin LI
2193e41d09dSXin LI# "Sega Mega Drive" header.
2203e41d09dSXin LI0x280	string EAMG
2213e41d09dSXin LI>8	beshort	0xAABB	Sega Mega Drive / Genesis ROM image (SMD format):
2223e41d09dSXin LI>>0	use     sega-genesis-smd-header
223b6cee71dSXin LI
224b6cee71dSXin LI#------------------------------------------------------------------------------
2253e41d09dSXin LI# smsgg:  file(1) magic for Sega Master System and Game Gear ROM images
2263e41d09dSXin LI# Detects all Game Gear and export Sega Master System ROM images,
2273e41d09dSXin LI# and some Japanese Sega Master System ROM images.
2283e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
2293e41d09dSXin LI# Reference: http://www.smspower.org/Development/ROMHeader
230b6cee71dSXin LI#
2313e41d09dSXin LI
2323e41d09dSXin LI# General SMS header rule.
2333e41d09dSXin LI# The SMS boot ROM checks the header at three locations.
2343e41d09dSXin LI0	name	sega-master-system-rom-header
2353e41d09dSXin LI# Machine type.
2363e41d09dSXin LI>0x0F	byte&0xF0	0x30	Sega Master System
2373e41d09dSXin LI>0x0F	byte&0xF0	0x40	Sega Master System
2383e41d09dSXin LI>0x0F	byte&0xF0	0x50	Sega Game Gear
2393e41d09dSXin LI>0x0F	byte&0xF0	0x60	Sega Game Gear
2403e41d09dSXin LI>0x0F	byte&0xF0	0x70	Sega Game Gear
2413e41d09dSXin LI>0x0F	byte&0xF0	<0x30	Sega Master System / Game Gear
2423e41d09dSXin LI>0x0F	byte&0xF0	>0x70	Sega Master System / Game Gear
2433e41d09dSXin LI>0	byte		x	ROM image:
2443e41d09dSXin LI# Product code.
2453e41d09dSXin LI>0x0E	byte&0xF0	0x10	1
2463e41d09dSXin LI>0x0E	byte&0xF0	0x20	2
2473e41d09dSXin LI>0x0E	byte&0xF0	0x30	3
2483e41d09dSXin LI>0x0E	byte&0xF0	0x40	4
2493e41d09dSXin LI>0x0E	byte&0xF0	0x50	5
2503e41d09dSXin LI>0x0E	byte&0xF0	0x60	6
2513e41d09dSXin LI>0x0E	byte&0xF0	0x70	7
2523e41d09dSXin LI>0x0E	byte&0xF0	0x80	8
2533e41d09dSXin LI>0x0E	byte&0xF0	0x90	9
2543e41d09dSXin LI>0x0E	byte&0xF0	0xA0	10
2553e41d09dSXin LI>0x0E	byte&0xF0	0xB0	11
2563e41d09dSXin LI>0x0E	byte&0xF0	0xC0	12
2573e41d09dSXin LI>0x0E	byte&0xF0	0xD0	13
2583e41d09dSXin LI>0x0E	byte&0xF0	0xE0	14
2593e41d09dSXin LI>0x0E	byte&0xF0	0xF0	15
2603e41d09dSXin LI# If the product code is 5 digits, we'll need to backspace here.
2613e41d09dSXin LI>0x0E	byte&0xF0	!0
2623e41d09dSXin LI>>0x0C	leshort		x	\b%04x
2633e41d09dSXin LI>0x0E	byte&0xF0	0
2643e41d09dSXin LI>>0x0C	leshort		x	%04x
2653e41d09dSXin LI# Revision.
2663e41d09dSXin LI>0x0E	byte&0x0F	x	(Rev.%02d)
2673e41d09dSXin LI# ROM size. (Used for the boot ROM checksum routine.)
2683e41d09dSXin LI>0x0F	byte&0x0F	0x0A	(8 KB)
2693e41d09dSXin LI>0x0F	byte&0x0F	0x0B	(16 KB)
2703e41d09dSXin LI>0x0F	byte&0x0F	0x0C	(32 KB)
2713e41d09dSXin LI>0x0F	byte&0x0F	0x0D	(48 KB)
2723e41d09dSXin LI>0x0F	byte&0x0F	0x0E	(64 KB)
2733e41d09dSXin LI>0x0F	byte&0x0F	0x0F	(128 KB)
2743e41d09dSXin LI>0x0F	byte&0x0F	0x00	(256 KB)
2753e41d09dSXin LI>0x0F	byte&0x0F	0x01	(512 KB)
2763e41d09dSXin LI>0x0F	byte&0x0F	0x02	(1 MB)
2773e41d09dSXin LI
2783e41d09dSXin LI# SMS/GG header locations.
2793e41d09dSXin LI0x7FF0	string	TMR\ SEGA
2803e41d09dSXin LI>0x7FF0	use	sega-master-system-rom-header
2813e41d09dSXin LI0x3FF0	string	TMR\ SEGA
2823e41d09dSXin LI>0x3FF0	use	sega-master-system-rom-header
2833e41d09dSXin LI0x1FF0	string	TMR\ SEGA
2843e41d09dSXin LI>0x1FF0	use	sega-master-system-rom-header
285b6cee71dSXin LI
286b6cee71dSXin LI#------------------------------------------------------------------------------
2873e41d09dSXin LI# saturn: file(1) magic for the Sega Saturn disc image format.
2883e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
289b6cee71dSXin LI#
2903e41d09dSXin LI
2913e41d09dSXin LI# Common Sega Saturn disc header format.
2923e41d09dSXin LI# NOTE: Title is 112 bytes, but we're only showing 32 due to space padding.
2933e41d09dSXin LI# TODO: Release date, device information, region code, others?
2943e41d09dSXin LI0	name	sega-saturn-disc-header
2953e41d09dSXin LI>0x60	string	>\0	\b: "%.32s"
2963e41d09dSXin LI>0x20	string	>\0	(%.10s
2973e41d09dSXin LI>>0x2A	string	>\0	\b, %.6s)
2983e41d09dSXin LI>>0x2A	byte	0	\b)
2993e41d09dSXin LI
3003e41d09dSXin LI# 2048-byte sector version.
3013e41d09dSXin LI0	string	SEGA\ SEGASATURN\ 	Sega Saturn disc image
3023e41d09dSXin LI>0	use	sega-saturn-disc-header
3033e41d09dSXin LI>0	byte	x			(2048-byte sectors)
3043e41d09dSXin LI# 2352-byte sector version.
3053e41d09dSXin LI0x10	string	SEGA\ SEGASATURN\ 	Sega Saturn disc image
3063e41d09dSXin LI>0x10	use	sega-saturn-disc-header
3073e41d09dSXin LI>0	byte	x			(2352-byte sectors)
3083e41d09dSXin LI
3093e41d09dSXin LI#------------------------------------------------------------------------------
3103e41d09dSXin LI# dreamcast: file(1) magic for the Sega Dreamcast disc image format.
3113e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
3123e41d09dSXin LI# Reference: http://mc.pp.se/dc/ip0000.bin.html
313b6cee71dSXin LI#
3143e41d09dSXin LI
3153e41d09dSXin LI# Common Sega Dreamcast disc header format.
3163e41d09dSXin LI# NOTE: Title is 128 bytes, but we're only showing 32 due to space padding.
3173e41d09dSXin LI# TODO: Release date, device information, region code, others?
3183e41d09dSXin LI0	name	sega-dreamcast-disc-header
3193e41d09dSXin LI>0x80	string	>\0	\b: "%.32s"
3203e41d09dSXin LI>0x40	string	>\0	(%.10s
3213e41d09dSXin LI>>0x4A	string	>\0	\b, %.6s)
3223e41d09dSXin LI>>0x4A	byte	0	\b)
3233e41d09dSXin LI
3243e41d09dSXin LI# 2048-byte sector version.
3253e41d09dSXin LI0	string	SEGA\ SEGAKATANA\ 	Sega Dreamcast disc image
3263e41d09dSXin LI>0	use	sega-dreamcast-disc-header
3273e41d09dSXin LI>0	byte	x			(2048-byte sectors)
3283e41d09dSXin LI# 2352-byte sector version.
3293e41d09dSXin LI0x10	string	SEGA\ SEGAKATANA\ 	Sega Dreamcast disc image
3303e41d09dSXin LI>0x10	use	sega-dreamcast-disc-header
3313e41d09dSXin LI>0	byte	x			(2352-byte sectors)
332b6cee71dSXin LI
333b6cee71dSXin LI#------------------------------------------------------------------------------
334b6cee71dSXin LI# dreamcast:  file(1) uncertain magic for the Sega Dreamcast VMU image format
335b6cee71dSXin LI#
336b6cee71dSXin LI0 belong 0x21068028   Sega Dreamcast VMU game image
337b6cee71dSXin LI0 string LCDi         Dream Animator file
338b6cee71dSXin LI
339b6cee71dSXin LI#------------------------------------------------------------------------------
3403e41d09dSXin LI# z64: file(1) magic for the Z64 format N64 ROM dumps
3413e41d09dSXin LI# Reference: http://forum.pj64-emu.com/showthread.php?t=2239
3423e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
343b6cee71dSXin LI#
3443e41d09dSXin LI0	bequad	0x803712400000000F	Nintendo 64 ROM image
3453e41d09dSXin LI>0x20	string	>\0	\b: "%.20s"
3463e41d09dSXin LI>0x3B	string	x	(%.4s
3473e41d09dSXin LI>0x3F	byte	x	\b, Rev.%02u)
348b6cee71dSXin LI
3493e41d09dSXin LI#------------------------------------------------------------------------------
3503e41d09dSXin LI# v64: file(1) magic for the V64 format N64 ROM dumps
3513e41d09dSXin LI# Same as z64 format, but with 16-bit byteswapping.
3523e41d09dSXin LI#
3533e41d09dSXin LI0	bequad	0x3780401200000F00	Nintendo 64 ROM image (V64)
3543e41d09dSXin LI
3553e41d09dSXin LI#------------------------------------------------------------------------------
3563e41d09dSXin LI# n64-swap2: file(1) magic for the swap2 format N64 ROM dumps
3573e41d09dSXin LI# Same as z64 format, but with swapped 16-bit words.
3583e41d09dSXin LI#
3593e41d09dSXin LI0	bequad	0x12408037000F0000	Nintendo 64 ROM image (wordswapped)
3603e41d09dSXin LI
3613e41d09dSXin LI#------------------------------------------------------------------------------
3623e41d09dSXin LI# n64-le32: file(1) magic for the 32-bit byteswapped format N64 ROM dumps
3633e41d09dSXin LI# Same as z64 format, but with 32-bit byteswapping.
3643e41d09dSXin LI#
3653e41d09dSXin LI0	bequad	0x401237800F000000	Nintendo 64 ROM image (32-bit byteswapped)
3663e41d09dSXin LI
3673e41d09dSXin LI#------------------------------------------------------------------------------
3683e41d09dSXin LI# gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format
3693e41d09dSXin LI# Reference: http://problemkaputt.de/gbatek.htm#gbacartridgeheader
3703e41d09dSXin LI#
3713e41d09dSXin LI# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
3723e41d09dSXin LI# Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
3733e41d09dSXin LI#
3743e41d09dSXin LI4	bequad	0x24FFAE51699AA221	Game Boy Advance ROM image
3753e41d09dSXin LI>0xA0	string	>\0	\b: "%.12s"
3763e41d09dSXin LI>0xAC	string	x	(%.6s
3773e41d09dSXin LI>0xBC	byte	x	\b, Rev.%02u)
3783e41d09dSXin LI
3793e41d09dSXin LI#------------------------------------------------------------------------------
3803e41d09dSXin LI# nds: file(1) magic for the Nintendo DS(i) raw ROM format
3813e41d09dSXin LI# Reference: http://problemkaputt.de/gbatek.htm#dscartridgeheader
3823e41d09dSXin LI#
3833e41d09dSXin LI# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
3843e41d09dSXin LI# Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
3853e41d09dSXin LI#
3863e41d09dSXin LI0xC0	bequad	0x24FFAE51699AA221	Nintendo DS ROM image
3873e41d09dSXin LI>0x00	string	>\0		\b: "%.12s"
3883e41d09dSXin LI>0x0C	string	x		(%.6s
3893e41d09dSXin LI>0x1E	byte	x		\b, Rev.%02u)
3903e41d09dSXin LI>0x12	byte	2		(DSi enhanced)
3913e41d09dSXin LI>0x12	byte	3		(DSi only)
3923e41d09dSXin LI
3933e41d09dSXin LI#------------------------------------------------------------------------------
3943e41d09dSXin LI# nds_passme: file(1) magic for Nintendo DS ROM images for GBA cartridge boot.
3953e41d09dSXin LI# This is also used for loading .nds files using the MSET exploit on 3DS.
3963e41d09dSXin LI# Reference: https://github.com/devkitPro/ndstool/blob/master/source/ndscreate.cpp
3973e41d09dSXin LI0xC0	bequad	0xC8604FE201708FE2	Nintendo DS Slot-2 ROM image (PassMe)
3983e41d09dSXin LI
3993e41d09dSXin LI#------------------------------------------------------------------------------
4003e41d09dSXin LI# ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format.
4013e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
4023e41d09dSXin LI# References:
4033e41d09dSXin LI# - https://neogpc.googlecode.com/svn-history/r10/trunk/src/core/neogpc.cpp
4043e41d09dSXin LI# - http://www.devrs.com/ngp/files/ngpctech.txt
4053e41d09dSXin LI#
4063e41d09dSXin LI0x0A	string	BY\ SNK\ CORPORATION	Neo Geo Pocket
4073e41d09dSXin LI>0x23	byte	0x10			Color
4083e41d09dSXin LI>0	byte	x			ROM image
4093e41d09dSXin LI>0x24	string	>\0			\b: "%.12s"
4103e41d09dSXin LI>0x1F	byte	0xFF			(debug mode enabled)
411b6cee71dSXin LI
412b6cee71dSXin LI#------------------------------------------------------------------------------
413b6cee71dSXin LI# msx: file(1) magic for MSX game cartridge dumps
414b6cee71dSXin LI# Too simple - MPi
415b6cee71dSXin LI#0 beshort 0x4142 MSX game cartridge dump
416b6cee71dSXin LI
417b6cee71dSXin LI#------------------------------------------------------------------------------
418b6cee71dSXin LI# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) :
419b6cee71dSXin LI0	string	PS-X\ EXE	Sony Playstation executable
4203e41d09dSXin LI>16	lelong	x		PC=0x%08x,
4213e41d09dSXin LI>20	lelong	!0		GP=0x%08x,
4223e41d09dSXin LI>24	lelong	!0		.text=[0x%08x,
4233e41d09dSXin LI>>28	lelong	x		\b0x%x],
4243e41d09dSXin LI>32	lelong	!0		.data=[0x%08x,
4253e41d09dSXin LI>>36	lelong	x		\b0x%x],
4263e41d09dSXin LI>40	lelong	!0		.bss=[0x%08x,
4273e41d09dSXin LI>>44	lelong	x		\b0x%x],
4283e41d09dSXin LI>48	lelong	!0		Stack=0x%08x,
4293e41d09dSXin LI>48	lelong	=0		No Stack!,
4303e41d09dSXin LI>52	lelong	!0		StackSize=0x%x,
4313e41d09dSXin LI#>76	string	>\0		(%s)
432b6cee71dSXin LI#  Area:
433b6cee71dSXin LI>113	string	x		(%s)
434b6cee71dSXin LI
4353e41d09dSXin LI# CPE executables
4363e41d09dSXin LI0	string	CPE		CPE executable
4373e41d09dSXin LI>3	byte	x		(version %d)
4383e41d09dSXin LI
439b6cee71dSXin LI#------------------------------------------------------------------------------
440b6cee71dSXin LI# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>)
441b6cee71dSXin LI0       string          XBEH            XBE, Microsoft Xbox executable
442b6cee71dSXin LI# probabilistic checks whether signed or not
443b6cee71dSXin LI>0x0004 ulelong =0x0
444b6cee71dSXin LI>>&2    ulelong =0x0
445b6cee71dSXin LI>>>&2   ulelong =0x0  \b, not signed
446b6cee71dSXin LI>0x0004 ulelong >0
447b6cee71dSXin LI>>&2    ulelong >0
448b6cee71dSXin LI>>>&2   ulelong >0    \b, signed
449b6cee71dSXin LI# expect base address of 0x10000
450b6cee71dSXin LI>0x0104               ulelong =0x10000
451b6cee71dSXin LI>>(0x0118-0x0FF60)    ulelong&0x80000007  0x80000007 \b, all regions
452b6cee71dSXin LI>>(0x0118-0x0FF60)    ulelong&0x80000007  !0x80000007
453b6cee71dSXin LI>>>(0x0118-0x0FF60)   ulelong >0           (regions:
454b6cee71dSXin LI>>>>(0x0118-0x0FF60)  ulelong &0x00000001  NA
455b6cee71dSXin LI>>>>(0x0118-0x0FF60)  ulelong &0x00000002  Japan
456b6cee71dSXin LI>>>>(0x0118-0x0FF60)  ulelong &0x00000004  Rest_of_World
457b6cee71dSXin LI>>>>(0x0118-0x0FF60)  ulelong &0x80000000  Manufacturer
458b6cee71dSXin LI>>>(0x0118-0x0FF60)   ulelong >0           \b)
459b6cee71dSXin LI
460b6cee71dSXin LI# --------------------------------
461b6cee71dSXin LI# Microsoft Xbox data file formats
462b6cee71dSXin LI0       string          XIP0            XIP, Microsoft Xbox data
463b6cee71dSXin LI0       string          XTF0            XTF, Microsoft Xbox data
464b6cee71dSXin LI
465b6cee71dSXin LI# Atari Lynx cartridge dump (EXE/BLL header)
466b6cee71dSXin LI# From: "Stefan A. Haubenthal" <polluks@web.de>
467b6cee71dSXin LI
468b6cee71dSXin LI# Double-check that the image type matches too, 0x8008 conflicts with
469b6cee71dSXin LI# 8 character OMF-86 object file headers.
470b6cee71dSXin LI0	beshort		0x8008
471b6cee71dSXin LI>6	string		BS93		Lynx homebrew cartridge
472b6cee71dSXin LI>>2	beshort		x		\b, RAM start $%04x
473b6cee71dSXin LI>6	string		LYNX		Lynx cartridge
474b6cee71dSXin LI>>2	beshort		x		\b, RAM start $%04x
475b6cee71dSXin LI
476b6cee71dSXin LI# Opera file system that is used on the 3DO console
477b6cee71dSXin LI# From: Serge van den Boom <svdb@stack.nl>
478b6cee71dSXin LI0	string		\x01ZZZZZ\x01	3DO "Opera" file system
479b6cee71dSXin LI
4805f0216bdSXin LI# From: Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
4815f0216bdSXin LI# From: David Pflug <david@pflug.email>
4825f0216bdSXin LI# is the offset 12 or the offset 16 correct?
4835f0216bdSXin LI# GBS (Game Boy Sound) magic
4845f0216bdSXin LI# ftp://ftp.modland.com/pub/documents/format_documentation/\
4855f0216bdSXin LI# Gameboy%20Sound%20System%20(.gbs).txt
486b6cee71dSXin LI0	string		GBS		Nintendo Gameboy Music/Audio Data
4875f0216bdSXin LI#12	string		GameBoy\ Music\ Module	Nintendo Gameboy Music Module
4885f0216bdSXin LI>16	string		>\0	("%s" by
4895f0216bdSXin LI>48	string		>\0	%s, copyright
4905f0216bdSXin LI>80	string		>\0	%s),
4915f0216bdSXin LI>3	byte		x	version %d,
4925f0216bdSXin LI>4	byte		x	%d tracks
493b6cee71dSXin LI
494b6cee71dSXin LI# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at>
495b6cee71dSXin LI0	string	PPF30			Playstation Patch File version 3.0
496b6cee71dSXin LI>5	byte	0			\b, PPF 1.0 patch
497b6cee71dSXin LI>5	byte	1			\b, PPF 2.0 patch
498b6cee71dSXin LI>5	byte	2			\b, PPF 3.0 patch
499b6cee71dSXin LI>>56	byte	0			\b, Imagetype BIN (any)
500b6cee71dSXin LI>>56	byte	1			\b, Imagetype GI (PrimoDVD)
501b6cee71dSXin LI>>57	byte	0			\b, Blockcheck disabled
502b6cee71dSXin LI>>57	byte	1			\b, Blockcheck enabled
503b6cee71dSXin LI>>58	byte	0			\b, Undo data not available
504b6cee71dSXin LI>>58	byte	1			\b, Undo data available
505b6cee71dSXin LI>6	string	x			\b, description: %s
506b6cee71dSXin LI
507b6cee71dSXin LI0	string	PPF20			Playstation Patch File version 2.0
508b6cee71dSXin LI>5	byte	0			\b, PPF 1.0 patch
509b6cee71dSXin LI>5	byte	1			\b, PPF 2.0 patch
510b6cee71dSXin LI>>56	lelong	>0			\b, size of file to patch %d
511b6cee71dSXin LI>6	string	x			\b, description: %s
512b6cee71dSXin LI
513b6cee71dSXin LI0	string	PPF10			Playstation Patch File version 1.0
514b6cee71dSXin LI>5	byte	0			\b, Simple Encoding
515b6cee71dSXin LI>6	string	x			\b, description: %s
516b6cee71dSXin LI
517b6cee71dSXin LI# From: Daniel Dawson <ddawson@icehouse.net>
518b6cee71dSXin LI# SNES9x .smv "movie" file format.
519b6cee71dSXin LI0		string		SMV\x1A	SNES9x input recording
520b6cee71dSXin LI>0x4		lelong		x	\b, version %d
521b6cee71dSXin LI# version 4 is latest so far
522b6cee71dSXin LI>0x4		lelong		<5
523b6cee71dSXin LI>>0x8		ledate		x	\b, recorded at %s
524b6cee71dSXin LI>>0xc		lelong		>0	\b, rerecorded %d times
525b6cee71dSXin LI>>0x10		lelong		x	\b, %d frames long
526b6cee71dSXin LI>>0x14		byte		>0	\b, data for controller(s):
527b6cee71dSXin LI>>>0x14		byte		&0x1	#1
528b6cee71dSXin LI>>>0x14		byte		&0x2	#2
529b6cee71dSXin LI>>>0x14		byte		&0x4	#3
530b6cee71dSXin LI>>>0x14		byte		&0x8	#4
531b6cee71dSXin LI>>>0x14		byte		&0x10	#5
532b6cee71dSXin LI>>0x15		byte		^0x1	\b, begins from snapshot
533b6cee71dSXin LI>>0x15		byte		&0x1	\b, begins from reset
534b6cee71dSXin LI>>0x15		byte		^0x2	\b, NTSC standard
535b6cee71dSXin LI>>0x15		byte		&0x2	\b, PAL standard
536b6cee71dSXin LI>>0x17		byte		&0x1    \b, settings:
537b6cee71dSXin LI# WIP1Timing not used as of version 4
538b6cee71dSXin LI>>>0x4		lelong		<4
539b6cee71dSXin LI>>>>0x17	byte		&0x2	WIP1Timing
540b6cee71dSXin LI>>>0x17		byte		&0x4	Left+Right
541b6cee71dSXin LI>>>0x17		byte		&0x8	VolumeEnvX
542b6cee71dSXin LI>>>0x17		byte		&0x10	FakeMute
543b6cee71dSXin LI>>>0x17		byte		&0x20	SyncSound
544b6cee71dSXin LI# New flag as of version 4
545b6cee71dSXin LI>>>0x4		lelong		>3
546b6cee71dSXin LI>>>>0x17	byte		&0x80	NoCPUShutdown
547b6cee71dSXin LI>>0x4		lelong		<4
548b6cee71dSXin LI>>>0x18		lelong		>0x23
549b6cee71dSXin LI>>>>0x20	leshort		!0
550b6cee71dSXin LI>>>>>0x20	lestring16	x	\b, metadata: "%s"
551b6cee71dSXin LI>>0x4		lelong		>3
552b6cee71dSXin LI>>>0x24		byte		>0	\b, port 1:
553b6cee71dSXin LI>>>>0x24	byte		1	joypad
554b6cee71dSXin LI>>>>0x24	byte		2	mouse
555b6cee71dSXin LI>>>>0x24	byte		3	SuperScope
556b6cee71dSXin LI>>>>0x24	byte		4	Justifier
557b6cee71dSXin LI>>>>0x24	byte		5	multitap
558b6cee71dSXin LI>>>0x24		byte		>0	\b, port 2:
559b6cee71dSXin LI>>>>0x25	byte		1	joypad
560b6cee71dSXin LI>>>>0x25	byte		2	mouse
561b6cee71dSXin LI>>>>0x25	byte		3	SuperScope
562b6cee71dSXin LI>>>>0x25	byte		4	Justifier
563b6cee71dSXin LI>>>>0x25	byte		5	multitap
564b6cee71dSXin LI>>>0x18		lelong		>0x43
565b6cee71dSXin LI>>>>0x40	leshort		!0
566b6cee71dSXin LI>>>>>0x40	lestring16	x	\b, metadata: "%s"
567b6cee71dSXin LI>>0x17		byte		&0x40   \b, ROM:
568b6cee71dSXin LI>>>(0x18.l-26)	lelong		x	CRC32 0x%08x
569b6cee71dSXin LI>>>(0x18.l-23)	string		x	"%s"
570b6cee71dSXin LI
571b6cee71dSXin LI# Type: scummVM savegame files
572b6cee71dSXin LI# From: Sven Hartge <debian@ds9.argh.org>
573b6cee71dSXin LI0	string	SCVM	ScummVM savegame
574b6cee71dSXin LI>12	string	>\0	"%s"
5753e41d09dSXin LI
5763e41d09dSXin LI#------------------------------------------------------------------------------
5773e41d09dSXin LI# Nintendo GameCube / Wii file formats.
5783e41d09dSXin LI#
5793e41d09dSXin LI
5803e41d09dSXin LI# Type: Nintendo GameCube/Wii common disc header data.
5813e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
5823e41d09dSXin LI# Reference: http://wiibrew.org/wiki/Wii_Disc
5833e41d09dSXin LI0	name	nintendo-gcn-disc-common
5843e41d09dSXin LI>0x20	string	x	"%.64s"
5853e41d09dSXin LI>0x00	string	x	(%.6s
5863e41d09dSXin LI>0x06	byte	>0
5873e41d09dSXin LI>>0x06	byte	1	\b, Disc 2
5883e41d09dSXin LI>>0x06	byte	2	\b, Disc 3
5893e41d09dSXin LI>>0x06	byte	3	\b, Disc 4
5903e41d09dSXin LI>0x07	byte	x	\b, Rev.%02u)
5913e41d09dSXin LI
5923e41d09dSXin LI# Type: Nintendo GameCube disc image
5933e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
5943e41d09dSXin LI# Reference: http://wiibrew.org/wiki/Wii_Disc
5953e41d09dSXin LI0x1C	belong	0xC2339F3D	Nintendo GameCube disc image:
5963e41d09dSXin LI>0	use	nintendo-gcn-disc-common
5973e41d09dSXin LI
598*282e23f0SXin LI# Type: Nintendo GameCube embedded disc image
599*282e23f0SXin LI# Commonly found on demo discs.
600*282e23f0SXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
601*282e23f0SXin LI# Reference: http://hitmen.c02.at/files/yagcd/yagcd/index.html#idx14.8
602*282e23f0SXin LI0		belong	0xAE0F38A2
603*282e23f0SXin LI>0x0C		belong	0x00100000
604*282e23f0SXin LI>>(8.L+0x1C)	belong	0xC2339F3D	Nintendo GameCube embedded disc image:
605*282e23f0SXin LI>>>(8.L)	use	nintendo-gcn-disc-common
606*282e23f0SXin LI
6073e41d09dSXin LI# Type: Nintendo Wii disc image
6083e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
6093e41d09dSXin LI# Reference: http://wiibrew.org/wiki/Wii_Disc
6103e41d09dSXin LI0x18	belong	0x5D1C9EA3	Nintendo Wii disc image:
6113e41d09dSXin LI>0	use	nintendo-gcn-disc-common
6123e41d09dSXin LI
6133e41d09dSXin LI# Type: Nintendo Wii disc image (WBFS format)
6143e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
6153e41d09dSXin LI# Reference: http://wiibrew.org/wiki/Wii_Disc
6163e41d09dSXin LI0	string	WBFS
6173e41d09dSXin LI>0x218	belong	0x5D1C9EA3	Nintendo Wii disc image (WBFS format):
6183e41d09dSXin LI>>0x200	use	nintendo-gcn-disc-common
6193e41d09dSXin LI
6203e41d09dSXin LI#------------------------------------------------------------------------------
6213e41d09dSXin LI# Nintendo 3DS file formats.
6223e41d09dSXin LI#
6233e41d09dSXin LI
6243e41d09dSXin LI# Type: Nintendo 3DS "NCSD" image. (game cards and eMMC)
6253e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
6263e41d09dSXin LI# Reference: https://www.3dbrew.org/wiki/NCSD
6273e41d09dSXin LI0x100		string		NCSD
6283e41d09dSXin LI>0x118		lequad		0		Nintendo 3DS Game Card image
629*282e23f0SXin LI# NCCH header for partition 0. (game data)
630*282e23f0SXin LI>>0x1150	string		>\0	\b: "%.16s"
631*282e23f0SXin LI>>0x312		byte		x	(Rev.%02u)
632*282e23f0SXin LI>>0x118C	byte		2	(New3DS only)
6333e41d09dSXin LI>>0x18D		byte		0		(inner device)
6343e41d09dSXin LI>>0x18D		byte		1		(Card1)
6353e41d09dSXin LI>>0x18D		byte		2		(Card2)
6363e41d09dSXin LI>>0x18D		byte		3		(extended device)
6373e41d09dSXin LI>0x118		bequad		0x0102020202000000	Nintendo 3DS eMMC dump (Old3DS)
6383e41d09dSXin LI>0x118		bequad		0x0102020203000000	Nintendo 3DS eMMC dump (New3DS)
6393e41d09dSXin LI
640*282e23f0SXin LI# Nintendo 3DS version code.
641*282e23f0SXin LI# Reference: https://www.3dbrew.org/wiki/Titles
642*282e23f0SXin LI# Format: leshort containing three fields:
643*282e23f0SXin LI# - 6-bit: Major
644*282e23f0SXin LI# - 6-bit: Minor
645*282e23f0SXin LI# - 4-bit: Revision
646*282e23f0SXin LI# NOTE: Only supporting major/minor versions from 0-15 right now.
647*282e23f0SXin LI# NOTE: Should be prefixed with "v".
648*282e23f0SXin LI0	name	nintendo-3ds-version-code
649*282e23f0SXin LI# Raw version.
650*282e23f0SXin LI>0	leshort	x	\b%u,
651*282e23f0SXin LI# Major version.
652*282e23f0SXin LI>0	leshort&0xFC00	0x0000	0
653*282e23f0SXin LI>0	leshort&0xFC00	0x0400	1
654*282e23f0SXin LI>0	leshort&0xFC00	0x0800	2
655*282e23f0SXin LI>0	leshort&0xFC00	0x0C00	3
656*282e23f0SXin LI>0	leshort&0xFC00	0x1000	4
657*282e23f0SXin LI>0	leshort&0xFC00	0x1400	5
658*282e23f0SXin LI>0	leshort&0xFC00	0x1800	6
659*282e23f0SXin LI>0	leshort&0xFC00	0x1C00	7
660*282e23f0SXin LI>0	leshort&0xFC00	0x2000	8
661*282e23f0SXin LI>0	leshort&0xFC00	0x2400	9
662*282e23f0SXin LI>0	leshort&0xFC00	0x2800	10
663*282e23f0SXin LI>0	leshort&0xFC00	0x2C00	11
664*282e23f0SXin LI>0	leshort&0xFC00	0x3000	12
665*282e23f0SXin LI>0	leshort&0xFC00	0x3400	13
666*282e23f0SXin LI>0	leshort&0xFC00	0x3800	14
667*282e23f0SXin LI>0	leshort&0xFC00	0x3C00	15
668*282e23f0SXin LI# Minor version.
669*282e23f0SXin LI>0	leshort&0x03F0	0x0000	\b.0
670*282e23f0SXin LI>0	leshort&0x03F0	0x0010	\b.1
671*282e23f0SXin LI>0	leshort&0x03F0	0x0020	\b.2
672*282e23f0SXin LI>0	leshort&0x03F0	0x0030	\b.3
673*282e23f0SXin LI>0	leshort&0x03F0	0x0040	\b.4
674*282e23f0SXin LI>0	leshort&0x03F0	0x0050	\b.5
675*282e23f0SXin LI>0	leshort&0x03F0	0x0060	\b.6
676*282e23f0SXin LI>0	leshort&0x03F0	0x0070	\b.7
677*282e23f0SXin LI>0	leshort&0x03F0	0x0080	\b.8
678*282e23f0SXin LI>0	leshort&0x03F0	0x0090	\b.9
679*282e23f0SXin LI>0	leshort&0x03F0	0x00A0	\b.10
680*282e23f0SXin LI>0	leshort&0x03F0	0x00B0	\b.11
681*282e23f0SXin LI>0	leshort&0x03F0	0x00C0	\b.12
682*282e23f0SXin LI>0	leshort&0x03F0	0x00D0	\b.13
683*282e23f0SXin LI>0	leshort&0x03F0	0x00E0	\b.14
684*282e23f0SXin LI>0	leshort&0x03F0	0x00F0	\b.15
685*282e23f0SXin LI# Revision.
686*282e23f0SXin LI>0	leshort&0x000F	x	\b.%u
687*282e23f0SXin LI
6883e41d09dSXin LI# Type: Nintendo 3DS "NCCH" container.
6893e41d09dSXin LI# https://www.3dbrew.org/wiki/NCCH
6903e41d09dSXin LI0x100		string	NCCH	Nintendo 3DS
6913e41d09dSXin LI>0x18D		byte&2	0	File Archive (CFA)
6923e41d09dSXin LI>0x18D		byte&2	2	Executable Image (CXI)
693*282e23f0SXin LI>0x150		string	>\0	\b: "%.16s"
694*282e23f0SXin LI>0x18D		byte	0x05
695*282e23f0SXin LI>>0x10E		leshort	x	(Old3DS System Update v
696*282e23f0SXin LI>>0x10E		use	nintendo-3ds-version-code
697*282e23f0SXin LI>>0x10E		leshort	x	\b)
698*282e23f0SXin LI>0x18D		byte	0x15
699*282e23f0SXin LI>>0x10E		leshort	x	(New3DS System Update v
700*282e23f0SXin LI>>0x10E		use	nintendo-3ds-version-code
701*282e23f0SXin LI>>0x10E		leshort	x	\b)
702*282e23f0SXin LI>0x18D		byte	!0x05
703*282e23f0SXin LI>>0x18D		byte	!0x15
704*282e23f0SXin LI>>>0x112	byte	x	(v
705*282e23f0SXin LI>>>0x112	use	nintendo-3ds-version-code
706*282e23f0SXin LI>>>0x112	byte	x	\b)
707*282e23f0SXin LI>0x18C		byte	2	(New3DS only)
7083e41d09dSXin LI
7093e41d09dSXin LI# Type: Nintendo 3DS "SMDH" file. (application description)
7103e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
7113e41d09dSXin LI# Reference: https://3dbrew.org/wiki/SMDH
7123e41d09dSXin LI0		string		SMDH		Nintendo 3DS SMDH file
7133e41d09dSXin LI>0x208		leshort		!0
7143e41d09dSXin LI>>0x208		lestring16	x		\b: "%.128s"
7153e41d09dSXin LI>>0x388		leshort		!0
7163e41d09dSXin LI>>>0x388	lestring16	x		by %.128s
7173e41d09dSXin LI>0x208		leshort		0
7183e41d09dSXin LI>>0x008		leshort		!0
7193e41d09dSXin LI>>>0x008	lestring16	x		\b: "%.128s"
7203e41d09dSXin LI>>>0x188	leshort		!0
7213e41d09dSXin LI>>>>0x188	lestring16	x		by %.128s
7223e41d09dSXin LI
7233e41d09dSXin LI# Type: Nintendo 3DS Homebrew Application.
7243e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
7253e41d09dSXin LI# Refernece: https://3dbrew.org/wiki/3DSX_Format
7263e41d09dSXin LI0	string	3DSX	Nintendo 3DS Homebrew Application (3DSX)
7273e41d09dSXin LI
7283e41d09dSXin LI#------------------------------------------------------------------------------
7293e41d09dSXin LI# a7800: file(1) magic for the Atari 7800 raw ROM format.
7303e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
7313e41d09dSXin LI# Reference: https://sites.google.com/site/atari7800wiki/a78-header
7323e41d09dSXin LI
7333e41d09dSXin LI0	byte	>0
7343e41d09dSXin LI>0	byte	<3
7353e41d09dSXin LI>>1	string	ATARI7800	Atari 7800 ROM image
7363e41d09dSXin LI>>>0x11	string	>\0	\b: "%.32s"
7373e41d09dSXin LI# Display type.
7383e41d09dSXin LI>>>0x39	byte	0	(NTSC)
7393e41d09dSXin LI>>>0x39	byte	1	(PAL)
7403e41d09dSXin LI>>>0x36	byte&1	1	(POKEY)
7413e41d09dSXin LI
7423e41d09dSXin LI#------------------------------------------------------------------------------
7433e41d09dSXin LI# vectrex: file(1) magic for the GCE Vectrex raw ROM format.
7443e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
7453e41d09dSXin LI# Reference: http://www.playvectrex.com/designit/chrissalo/hello1.htm
7463e41d09dSXin LI#
7473e41d09dSXin LI# NOTE: Title is terminated with 0x80, not 0.
7483e41d09dSXin LI# The header is terminated with a 0, so that will
7493e41d09dSXin LI# terminate the title as well.
7503e41d09dSXin LI#
7513e41d09dSXin LI0	string	g\ GCE	Vectrex ROM image
7523e41d09dSXin LI>0x11	string	>\0	\b: "%.16s"
753