xref: /freebsd/contrib/file/magic/Magdir/console (revision 58a0f0d00c0cc4a90ce584a61470290751bfcac7)
1b6cee71dSXin LI
2b6cee71dSXin LI#------------------------------------------------------------------------------
3*58a0f0d0SEitan Adler# $File: console,v 1.35 2017/11/14 15:48:36 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
1240427ccaSGordon Tetlow
1340427ccaSGordon Tetlow# Common header for iNES, NES 2.0, and Wii U iNES.
1440427ccaSGordon Tetlow0	name		nes-rom-image-ines
153e41d09dSXin LI>7	byte&0x0C	=0x8		(NES 2.0)
163e41d09dSXin LI>4	byte		x		\b: %ux16k PRG
1740427ccaSGordon Tetlow>5	byte		x		\b, %ux8k CHR
183e41d09dSXin LI>6	byte&0x08	=0x8		[4-Scr]
193e41d09dSXin LI>6	byte&0x09	=0x0		[H-mirror]
203e41d09dSXin LI>6	byte&0x09	=0x1		[V-mirror]
213e41d09dSXin LI>6	byte&0x02	=0x2		[SRAM]
223e41d09dSXin LI>6	byte&0x04	=0x4		[Trainer]
233e41d09dSXin LI>7	byte&0x03	=0x2		[PC10]
2440427ccaSGordon Tetlow>7	byte&0x03	=0x1		[VS]
253e41d09dSXin LI>>7	byte&0x0C	=0x8
263e41d09dSXin LI# NES 2.0: VS PPU
273e41d09dSXin LI>>>13	byte&0x0F	=0x0		\b, RP2C03B
283e41d09dSXin LI>>>13	byte&0x0F	=0x1		\b, RP2C03G
293e41d09dSXin LI>>>13	byte&0x0F	=0x2		\b, RP2C04-0001
303e41d09dSXin LI>>>13	byte&0x0F	=0x3		\b, RP2C04-0002
313e41d09dSXin LI>>>13	byte&0x0F	=0x4		\b, RP2C04-0003
323e41d09dSXin LI>>>13	byte&0x0F	=0x5		\b, RP2C04-0004
333e41d09dSXin LI>>>13	byte&0x0F	=0x6		\b, RP2C03B
343e41d09dSXin LI>>>13	byte&0x0F	=0x7		\b, RP2C03C
353e41d09dSXin LI>>>13	byte&0x0F	=0x8		\b, RP2C05-01
363e41d09dSXin LI>>>13	byte&0x0F	=0x9		\b, RP2C05-02
373e41d09dSXin LI>>>13	byte&0x0F	=0xA		\b, RP2C05-03
383e41d09dSXin LI>>>13	byte&0x0F	=0xB		\b, RP2C05-04
393e41d09dSXin LI>>>13	byte&0x0F	=0xC		\b, RP2C05-05
403e41d09dSXin LI# TODO: VS protection hardware?
413e41d09dSXin LI>>7	byte		x		\b]
423e41d09dSXin LI# NES 2.0-specific flags.
433e41d09dSXin LI>7	byte&0x0C	=0x8
443e41d09dSXin LI>>12	byte&0x03	=0x0		[NTSC]
453e41d09dSXin LI>>12	byte&0x03	=0x1		[PAL]
463e41d09dSXin LI>>12	byte&0x02	=0x2		[NTSC+PAL]
473e41d09dSXin LI
4840427ccaSGordon Tetlow# Standard iNES ROM header.
4940427ccaSGordon Tetlow0	string		NES\x1A		NES ROM image (iNES)
5040427ccaSGordon Tetlow>0	use		nes-rom-image-ines
5140427ccaSGordon Tetlow
5240427ccaSGordon Tetlow# Wii U Virtual Console iNES ROM header.
5340427ccaSGordon Tetlow0	belong		0x4E455300	NES ROM image (Wii U Virtual Console)
5440427ccaSGordon Tetlow>0	use		nes-rom-image-ines
5540427ccaSGordon Tetlow
563e41d09dSXin LI#------------------------------------------------------------------------------
573e41d09dSXin LI# unif: file(1) magic for UNIF-format Nintendo Entertainment System ROM images
583e41d09dSXin LI# Reference: http://wiki.nesdev.com/w/index.php/UNIF
593e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
603e41d09dSXin LI#
613e41d09dSXin LI# NOTE: The UNIF format uses chunks instead of a fixed header,
623e41d09dSXin LI# so most of the data isn't easily parseable.
633e41d09dSXin LI#
643e41d09dSXin LI0	string	UNIF
6540427ccaSGordon Tetlow>4	lelong	<16	NES ROM image (UNIF v%d format)
66b6cee71dSXin LI
67b6cee71dSXin LI#------------------------------------------------------------------------------
68282e23f0SXin LI# fds: file(1) magic for Famciom Disk System disk images
69282e23f0SXin LI# Reference: http://wiki.nesdev.com/w/index.php/Family_Computer_Disk_System#.FDS_format
70282e23f0SXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
71282e23f0SXin LI# TODO: Check "Disk info block" and get info from that in addition to the optional header.
72282e23f0SXin LI
73282e23f0SXin LI# Disk info block. (block 1)
74282e23f0SXin LI0	name	nintendo-fds-disk-info-block
75282e23f0SXin LI>23	byte	!1		FMC-
76282e23f0SXin LI>23	byte	1		FSC-
77282e23f0SXin LI>16	string	x		\b%.3s
7840427ccaSGordon Tetlow>15	byte	x		\b, mfr %02X
79282e23f0SXin LI>20	byte	x		(Rev.%02u)
80282e23f0SXin LI
81282e23f0SXin LI# Headered version.
82282e23f0SXin LI0	string	FDS\x1A
8340427ccaSGordon Tetlow>0x11	string	*NINTENDO-HVC*	Famicom Disk System disk image:
84282e23f0SXin LI>>0x10	use	nintendo-fds-disk-info-block
85282e23f0SXin LI>4	byte	1	(%u side)
86282e23f0SXin LI>4	byte	!1	(%u sides)
87282e23f0SXin LI
88282e23f0SXin LI# Unheadered version.
8940427ccaSGordon Tetlow1	string	*NINTENDO-HVC*	Famicom Disk System disk image:
90282e23f0SXin LI>0	use	nintendo-fds-disk-info-block
91282e23f0SXin LI
92282e23f0SXin LI#------------------------------------------------------------------------------
9340427ccaSGordon Tetlow# tnes: file(1) magic for TNES-format Nintendo Entertainment System ROM images
9440427ccaSGordon Tetlow# Used by Nintendo 3DS NES Virtual Console games.
9540427ccaSGordon Tetlow# From: David Korth <gerbilsoft@gerbilsoft.com>
9640427ccaSGordon Tetlow#
9740427ccaSGordon Tetlow0		string	TNES	NES ROM image (Nintendo 3DS Virtual Console)
9840427ccaSGordon Tetlow>4		byte	100	\b: FDS,
9940427ccaSGordon Tetlow>>0x2010	use	nintendo-fds-disk-info-block
10040427ccaSGordon Tetlow>4		byte	!100	\b: TNES mapper %u
10140427ccaSGordon Tetlow>>5	byte		x		\b, %ux8k PRG
10240427ccaSGordon Tetlow>>6	byte		x		\b, %ux8k CHR
10340427ccaSGordon Tetlow>>7	byte&0x08	=1		[WRAM]
10440427ccaSGordon Tetlow>>8	byte&0x09	=1		[H-mirror]
10540427ccaSGordon Tetlow>>8	byte&0x09	=2		[V-mirror]
10640427ccaSGordon Tetlow>>8	byte&0x02	=3		[VRAM]
10740427ccaSGordon Tetlow
10840427ccaSGordon Tetlow#------------------------------------------------------------------------------
109b6cee71dSXin LI# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format
1103e41d09dSXin LI# Reference: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header
111b6cee71dSXin LI#
1123e41d09dSXin LI0x104		bequad		0xCEED6666CC0D000B	Game Boy ROM image
1133e41d09dSXin LI>0x143		byte&0x80	0x80
1143e41d09dSXin LI>>0x134		string		>\0			\b: "%.15s"
1153e41d09dSXin LI>0x143		byte&0x80	!0x80
1163e41d09dSXin LI>>0x134		string		>\0			\b: "%.16s"
1173e41d09dSXin LI>0x14c		byte		x			(Rev.%02u)
118b6cee71dSXin LI
1193e41d09dSXin LI# Machine type. (SGB, CGB, SGB+CGB)
1203e41d09dSXin LI>0x14b		byte		0x33
1213e41d09dSXin LI>>0x146		byte		0x03
1223e41d09dSXin LI>>>0x143	byte&0x80	0x80	[SGB+CGB]
1233e41d09dSXin LI>>>0x143	byte&0x80	!0x80	[SGB]
1243e41d09dSXin LI>>0x146		byte		!0x03
1253e41d09dSXin LI>>>0x143	byte&0xC0	0x80	[CGB]
1263e41d09dSXin LI>>>0x143	byte&0xC0	0xC0	[CGB ONLY]
1273e41d09dSXin LI
1283e41d09dSXin LI# Mapper.
1293e41d09dSXin LI>0x147 byte 0x00  [ROM ONLY]
1303e41d09dSXin LI>0x147 byte 0x01  [MBC1]
1313e41d09dSXin LI>0x147 byte 0x02  [MBC1+RAM]
1323e41d09dSXin LI>0x147 byte 0x03  [MBC1+RAM+BATT]
1333e41d09dSXin LI>0x147 byte 0x05  [MBC2]
1343e41d09dSXin LI>0x147 byte 0x06  [MBC2+BATTERY]
1353e41d09dSXin LI>0x147 byte 0x08  [ROM+RAM]
1363e41d09dSXin LI>0x147 byte 0x09  [ROM+RAM+BATTERY]
1373e41d09dSXin LI>0x147 byte 0x0B  [MMM01]
1383e41d09dSXin LI>0x147 byte 0x0C  [MMM01+SRAM]
1393e41d09dSXin LI>0x147 byte 0x0D  [MMM01+SRAM+BATT]
1403e41d09dSXin LI>0x147 byte 0x0F  [MBC3+TIMER+BATT]
1413e41d09dSXin LI>0x147 byte 0x10  [MBC3+TIMER+RAM+BATT]
1423e41d09dSXin LI>0x147 byte 0x11  [MBC3]
1433e41d09dSXin LI>0x147 byte 0x12  [MBC3+RAM]
1443e41d09dSXin LI>0x147 byte 0x13  [MBC3+RAM+BATT]
1453e41d09dSXin LI>0x147 byte 0x19  [MBC5]
1463e41d09dSXin LI>0x147 byte 0x1A  [MBC5+RAM]
1473e41d09dSXin LI>0x147 byte 0x1B  [MBC5+RAM+BATT]
1483e41d09dSXin LI>0x147 byte 0x1C  [MBC5+RUMBLE]
1493e41d09dSXin LI>0x147 byte 0x1D  [MBC5+RUMBLE+SRAM]
1503e41d09dSXin LI>0x147 byte 0x1E  [MBC5+RUMBLE+SRAM+BATT]
1513e41d09dSXin LI>0x147 byte 0xFC  [Pocket Camera]
1523e41d09dSXin LI>0x147 byte 0xFD  [Bandai TAMA5]
1533e41d09dSXin LI>0x147 byte 0xFE  [Hudson HuC-3]
1543e41d09dSXin LI>0x147 byte 0xFF  [Hudson HuC-1]
1553e41d09dSXin LI
1563e41d09dSXin LI# ROM size.
157b6cee71dSXin LI>0x148 byte 0     \b, ROM: 256Kbit
158b6cee71dSXin LI>0x148 byte 1     \b, ROM: 512Kbit
159b6cee71dSXin LI>0x148 byte 2     \b, ROM: 1Mbit
160b6cee71dSXin LI>0x148 byte 3     \b, ROM: 2Mbit
161b6cee71dSXin LI>0x148 byte 4     \b, ROM: 4Mbit
162b6cee71dSXin LI>0x148 byte 5     \b, ROM: 8Mbit
163b6cee71dSXin LI>0x148 byte 6     \b, ROM: 16Mbit
1643e41d09dSXin LI>0x148 byte 7     \b, ROM: 32Mbit
165b6cee71dSXin LI>0x148 byte 0x52  \b, ROM: 9Mbit
166b6cee71dSXin LI>0x148 byte 0x53  \b, ROM: 10Mbit
167b6cee71dSXin LI>0x148 byte 0x54  \b, ROM: 12Mbit
168b6cee71dSXin LI
1693e41d09dSXin LI# RAM size.
170b6cee71dSXin LI>0x149 byte 1     \b, RAM: 16Kbit
171b6cee71dSXin LI>0x149 byte 2     \b, RAM: 64Kbit
172b6cee71dSXin LI>0x149 byte 3     \b, RAM: 128Kbit
173b6cee71dSXin LI>0x149 byte 4     \b, RAM: 1Mbit
1743e41d09dSXin LI>0x149 byte 5     \b, RAM: 512Kbit
175b6cee71dSXin LI
176b6cee71dSXin LI#------------------------------------------------------------------------------
1773e41d09dSXin LI# genesis: file(1) magic for various Sega Mega Drive / Genesis ROM image and disc formats
1783e41d09dSXin LI# Updated by David Korth <gerbilsoft@gerbilsoft.com>
1793e41d09dSXin LI# References:
1803e41d09dSXin LI# - http://www.retrodev.com/segacd.html
1813e41d09dSXin LI# - http://devster.monkeeh.com/sega/32xguide1.txt
182b6cee71dSXin LI#
1833e41d09dSXin LI
1843e41d09dSXin LI# Common Sega Mega Drive header format.
1853e41d09dSXin LI# FIXME: Name fields are 48 bytes, but have spaces for padding instead of 00s.
1863e41d09dSXin LI0		name	sega-mega-drive-header
1873e41d09dSXin LI# ROM title. (Use domestic if present; if not, use international.)
1883e41d09dSXin LI>0x120		byte	>0x20
1893e41d09dSXin LI>>0x120		string	>\0	\b: "%.16s"
1903e41d09dSXin LI>0x120		byte	<0x21
1913e41d09dSXin LI>>0x150		string	>\0	\b: "%.16s"
1923e41d09dSXin LI# Other information.
1933e41d09dSXin LI>0x180		string	>\0	(%.14s
1943e41d09dSXin LI>>0x110		string  >\0	\b, %.16s
1953e41d09dSXin LI>0x180		byte	0
1963e41d09dSXin LI>>0x110		string  >\0	(%.16s
1973e41d09dSXin LI>0		byte	x	\b)
1983e41d09dSXin LI
1993e41d09dSXin LI# TODO: Check for 32X CD?
2003e41d09dSXin LI# Sega Mega CD disc images: 2048-byte sectors.
2013e41d09dSXin LI0	string	SEGADISCSYSTEM\ \ 	Sega Mega CD disc image
2023e41d09dSXin LI>0	use	sega-mega-drive-header
2033e41d09dSXin LI>0	byte	x			\b, 2048-byte sectors
2043e41d09dSXin LI0	string	SEGABOOTDISC\ \ \ \ 	Sega Mega CD disc image
2053e41d09dSXin LI>0	use	sega-mega-drive-header
2063e41d09dSXin LI>0	byte	x			\b, 2048-byte sectors
2073e41d09dSXin LI# Sega Mega CD disc images: 2352-byte sectors.
2083e41d09dSXin LI0x10	string	SEGADISCSYSTEM\ \ 	Sega Mega CD disc image
2093e41d09dSXin LI>0x10	use	sega-mega-drive-header
2103e41d09dSXin LI>0	byte	x			\b, 2352-byte sectors
2113e41d09dSXin LI0x10	string	SEGABOOTDISC\ \ \ \ 	Sega Mega CD disc image
2123e41d09dSXin LI>0x10	use	sega-mega-drive-header
2133e41d09dSXin LI>0	byte	x			\b, 2352-byte sectors
2143e41d09dSXin LI
2153e41d09dSXin LI# Sega Mega Drive, 32X, Pico, and Mega CD Boot ROM images.
2163e41d09dSXin LI0x100		string	SEGA
2173e41d09dSXin LI>0x3C0		bequad	0x4D41525320434845	Sega 32X ROM image
2183e41d09dSXin LI>>0		use	sega-mega-drive-header
2193e41d09dSXin LI>0x3C0		bequad	!0x4D41525320434845
2203e41d09dSXin LI>>0x105		belong	0x5049434F	Sega Pico ROM image
2213e41d09dSXin LI>>>0		use	sega-mega-drive-header
2223e41d09dSXin LI>>0x105		belong	!0x5049434F
2233e41d09dSXin LI>>>0x180	beshort	0x4252		Sega Mega CD Boot ROM image
2243e41d09dSXin LI>>>0x180	beshort	!0x4252		Sega Mega Drive / Genesis ROM image
2253e41d09dSXin LI>>>0		use	sega-mega-drive-header
226b6cee71dSXin LI
227b6cee71dSXin LI#------------------------------------------------------------------------------
228b6cee71dSXin LI# genesis: file(1) magic for the Super MegaDrive ROM dump format
229b6cee71dSXin LI#
2303e41d09dSXin LI
2313e41d09dSXin LI# NOTE: Due to interleaving, we can't display anything
2323e41d09dSXin LI# other than the copier header information.
2333e41d09dSXin LI0      name    sega-genesis-smd-header
234b6cee71dSXin LI>0     byte    x       %dx16k blocks
235b6cee71dSXin LI>2     byte    0       \b, last in series or standalone
236b6cee71dSXin LI>2     byte    >0      \b, split ROM
2373e41d09dSXin LI
2383e41d09dSXin LI# "Sega Genesis" header.
2393e41d09dSXin LI0x280	string EAGN
2403e41d09dSXin LI>8	beshort	0xAABB	Sega Mega Drive / Genesis ROM image (SMD format):
2413e41d09dSXin LI>>0	use     sega-genesis-smd-header
2423e41d09dSXin LI
2433e41d09dSXin LI# "Sega Mega Drive" header.
2443e41d09dSXin LI0x280	string EAMG
2453e41d09dSXin LI>8	beshort	0xAABB	Sega Mega Drive / Genesis ROM image (SMD format):
2463e41d09dSXin LI>>0	use     sega-genesis-smd-header
247b6cee71dSXin LI
248b6cee71dSXin LI#------------------------------------------------------------------------------
2493e41d09dSXin LI# smsgg:  file(1) magic for Sega Master System and Game Gear ROM images
2503e41d09dSXin LI# Detects all Game Gear and export Sega Master System ROM images,
2513e41d09dSXin LI# and some Japanese Sega Master System ROM images.
2523e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
2533e41d09dSXin LI# Reference: http://www.smspower.org/Development/ROMHeader
254b6cee71dSXin LI#
2553e41d09dSXin LI
2563e41d09dSXin LI# General SMS header rule.
2573e41d09dSXin LI# The SMS boot ROM checks the header at three locations.
2583e41d09dSXin LI0	name	sega-master-system-rom-header
2593e41d09dSXin LI# Machine type.
2603e41d09dSXin LI>0x0F	byte&0xF0	0x30	Sega Master System
2613e41d09dSXin LI>0x0F	byte&0xF0	0x40	Sega Master System
2623e41d09dSXin LI>0x0F	byte&0xF0	0x50	Sega Game Gear
2633e41d09dSXin LI>0x0F	byte&0xF0	0x60	Sega Game Gear
2643e41d09dSXin LI>0x0F	byte&0xF0	0x70	Sega Game Gear
2653e41d09dSXin LI>0x0F	byte&0xF0	<0x30	Sega Master System / Game Gear
2663e41d09dSXin LI>0x0F	byte&0xF0	>0x70	Sega Master System / Game Gear
2673e41d09dSXin LI>0	byte		x	ROM image:
2683e41d09dSXin LI# Product code.
2693e41d09dSXin LI>0x0E	byte&0xF0	0x10	1
2703e41d09dSXin LI>0x0E	byte&0xF0	0x20	2
2713e41d09dSXin LI>0x0E	byte&0xF0	0x30	3
2723e41d09dSXin LI>0x0E	byte&0xF0	0x40	4
2733e41d09dSXin LI>0x0E	byte&0xF0	0x50	5
2743e41d09dSXin LI>0x0E	byte&0xF0	0x60	6
2753e41d09dSXin LI>0x0E	byte&0xF0	0x70	7
2763e41d09dSXin LI>0x0E	byte&0xF0	0x80	8
2773e41d09dSXin LI>0x0E	byte&0xF0	0x90	9
2783e41d09dSXin LI>0x0E	byte&0xF0	0xA0	10
2793e41d09dSXin LI>0x0E	byte&0xF0	0xB0	11
2803e41d09dSXin LI>0x0E	byte&0xF0	0xC0	12
2813e41d09dSXin LI>0x0E	byte&0xF0	0xD0	13
2823e41d09dSXin LI>0x0E	byte&0xF0	0xE0	14
2833e41d09dSXin LI>0x0E	byte&0xF0	0xF0	15
2843e41d09dSXin LI# If the product code is 5 digits, we'll need to backspace here.
2853e41d09dSXin LI>0x0E	byte&0xF0	!0
2863e41d09dSXin LI>>0x0C	leshort		x	\b%04x
2873e41d09dSXin LI>0x0E	byte&0xF0	0
2883e41d09dSXin LI>>0x0C	leshort		x	%04x
2893e41d09dSXin LI# Revision.
2903e41d09dSXin LI>0x0E	byte&0x0F	x	(Rev.%02d)
2913e41d09dSXin LI# ROM size. (Used for the boot ROM checksum routine.)
2923e41d09dSXin LI>0x0F	byte&0x0F	0x0A	(8 KB)
2933e41d09dSXin LI>0x0F	byte&0x0F	0x0B	(16 KB)
2943e41d09dSXin LI>0x0F	byte&0x0F	0x0C	(32 KB)
2953e41d09dSXin LI>0x0F	byte&0x0F	0x0D	(48 KB)
2963e41d09dSXin LI>0x0F	byte&0x0F	0x0E	(64 KB)
2973e41d09dSXin LI>0x0F	byte&0x0F	0x0F	(128 KB)
2983e41d09dSXin LI>0x0F	byte&0x0F	0x00	(256 KB)
2993e41d09dSXin LI>0x0F	byte&0x0F	0x01	(512 KB)
3003e41d09dSXin LI>0x0F	byte&0x0F	0x02	(1 MB)
3013e41d09dSXin LI
3023e41d09dSXin LI# SMS/GG header locations.
3033e41d09dSXin LI0x7FF0	string	TMR\ SEGA
3043e41d09dSXin LI>0x7FF0	use	sega-master-system-rom-header
3053e41d09dSXin LI0x3FF0	string	TMR\ SEGA
3063e41d09dSXin LI>0x3FF0	use	sega-master-system-rom-header
3073e41d09dSXin LI0x1FF0	string	TMR\ SEGA
3083e41d09dSXin LI>0x1FF0	use	sega-master-system-rom-header
309b6cee71dSXin LI
310b6cee71dSXin LI#------------------------------------------------------------------------------
3113e41d09dSXin LI# saturn: file(1) magic for the Sega Saturn disc image format.
3123e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
313b6cee71dSXin LI#
3143e41d09dSXin LI
3153e41d09dSXin LI# Common Sega Saturn disc header format.
3163e41d09dSXin LI# NOTE: Title is 112 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-saturn-disc-header
3193e41d09dSXin LI>0x60	string	>\0	\b: "%.32s"
3203e41d09dSXin LI>0x20	string	>\0	(%.10s
3213e41d09dSXin LI>>0x2A	string	>\0	\b, %.6s)
3223e41d09dSXin LI>>0x2A	byte	0	\b)
3233e41d09dSXin LI
3243e41d09dSXin LI# 2048-byte sector version.
3253e41d09dSXin LI0	string	SEGA\ SEGASATURN\ 	Sega Saturn disc image
3263e41d09dSXin LI>0	use	sega-saturn-disc-header
3273e41d09dSXin LI>0	byte	x			(2048-byte sectors)
3283e41d09dSXin LI# 2352-byte sector version.
3293e41d09dSXin LI0x10	string	SEGA\ SEGASATURN\ 	Sega Saturn disc image
3303e41d09dSXin LI>0x10	use	sega-saturn-disc-header
3313e41d09dSXin LI>0	byte	x			(2352-byte sectors)
3323e41d09dSXin LI
3333e41d09dSXin LI#------------------------------------------------------------------------------
3343e41d09dSXin LI# dreamcast: file(1) magic for the Sega Dreamcast disc image format.
3353e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
3363e41d09dSXin LI# Reference: http://mc.pp.se/dc/ip0000.bin.html
337b6cee71dSXin LI#
3383e41d09dSXin LI
3393e41d09dSXin LI# Common Sega Dreamcast disc header format.
3403e41d09dSXin LI# NOTE: Title is 128 bytes, but we're only showing 32 due to space padding.
3413e41d09dSXin LI# TODO: Release date, device information, region code, others?
3423e41d09dSXin LI0	name	sega-dreamcast-disc-header
3433e41d09dSXin LI>0x80	string	>\0	\b: "%.32s"
3443e41d09dSXin LI>0x40	string	>\0	(%.10s
3453e41d09dSXin LI>>0x4A	string	>\0	\b, %.6s)
3463e41d09dSXin LI>>0x4A	byte	0	\b)
3473e41d09dSXin LI
3483e41d09dSXin LI# 2048-byte sector version.
3493e41d09dSXin LI0	string	SEGA\ SEGAKATANA\ 	Sega Dreamcast disc image
3503e41d09dSXin LI>0	use	sega-dreamcast-disc-header
3513e41d09dSXin LI>0	byte	x			(2048-byte sectors)
3523e41d09dSXin LI# 2352-byte sector version.
3533e41d09dSXin LI0x10	string	SEGA\ SEGAKATANA\ 	Sega Dreamcast disc image
3543e41d09dSXin LI>0x10	use	sega-dreamcast-disc-header
3553e41d09dSXin LI>0	byte	x			(2352-byte sectors)
356b6cee71dSXin LI
357b6cee71dSXin LI#------------------------------------------------------------------------------
358b6cee71dSXin LI# dreamcast:  file(1) uncertain magic for the Sega Dreamcast VMU image format
359b6cee71dSXin LI#
360b6cee71dSXin LI0 belong 0x21068028   Sega Dreamcast VMU game image
361b6cee71dSXin LI0 string LCDi         Dream Animator file
362b6cee71dSXin LI
363b6cee71dSXin LI#------------------------------------------------------------------------------
3643e41d09dSXin LI# z64: file(1) magic for the Z64 format N64 ROM dumps
3653e41d09dSXin LI# Reference: http://forum.pj64-emu.com/showthread.php?t=2239
3663e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
367b6cee71dSXin LI#
3683e41d09dSXin LI0	bequad	0x803712400000000F	Nintendo 64 ROM image
3693e41d09dSXin LI>0x20	string	>\0	\b: "%.20s"
3703e41d09dSXin LI>0x3B	string	x	(%.4s
3713e41d09dSXin LI>0x3F	byte	x	\b, Rev.%02u)
372b6cee71dSXin LI
3733e41d09dSXin LI#------------------------------------------------------------------------------
3743e41d09dSXin LI# v64: file(1) magic for the V64 format N64 ROM dumps
3753e41d09dSXin LI# Same as z64 format, but with 16-bit byteswapping.
3763e41d09dSXin LI#
3773e41d09dSXin LI0	bequad	0x3780401200000F00	Nintendo 64 ROM image (V64)
3783e41d09dSXin LI
3793e41d09dSXin LI#------------------------------------------------------------------------------
3803e41d09dSXin LI# n64-swap2: file(1) magic for the swap2 format N64 ROM dumps
3813e41d09dSXin LI# Same as z64 format, but with swapped 16-bit words.
3823e41d09dSXin LI#
3833e41d09dSXin LI0	bequad	0x12408037000F0000	Nintendo 64 ROM image (wordswapped)
3843e41d09dSXin LI
3853e41d09dSXin LI#------------------------------------------------------------------------------
3863e41d09dSXin LI# n64-le32: file(1) magic for the 32-bit byteswapped format N64 ROM dumps
3873e41d09dSXin LI# Same as z64 format, but with 32-bit byteswapping.
3883e41d09dSXin LI#
3893e41d09dSXin LI0	bequad	0x401237800F000000	Nintendo 64 ROM image (32-bit byteswapped)
3903e41d09dSXin LI
3913e41d09dSXin LI#------------------------------------------------------------------------------
3923e41d09dSXin LI# gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format
3933e41d09dSXin LI# Reference: http://problemkaputt.de/gbatek.htm#gbacartridgeheader
3943e41d09dSXin LI#
3953e41d09dSXin LI# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
3963e41d09dSXin LI# Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
3973e41d09dSXin LI#
3983e41d09dSXin LI4	bequad	0x24FFAE51699AA221	Game Boy Advance ROM image
3993e41d09dSXin LI>0xA0	string	>\0	\b: "%.12s"
4003e41d09dSXin LI>0xAC	string	x	(%.6s
4013e41d09dSXin LI>0xBC	byte	x	\b, Rev.%02u)
4023e41d09dSXin LI
4033e41d09dSXin LI#------------------------------------------------------------------------------
4043e41d09dSXin LI# nds: file(1) magic for the Nintendo DS(i) raw ROM format
4053e41d09dSXin LI# Reference: http://problemkaputt.de/gbatek.htm#dscartridgeheader
4063e41d09dSXin LI#
4073e41d09dSXin LI# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
4083e41d09dSXin LI# Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
4093e41d09dSXin LI#
4103e41d09dSXin LI0xC0	bequad	0x24FFAE51699AA221	Nintendo DS ROM image
4113e41d09dSXin LI>0x00	string	>\0		\b: "%.12s"
4123e41d09dSXin LI>0x0C	string	x		(%.6s
4133e41d09dSXin LI>0x1E	byte	x		\b, Rev.%02u)
4143e41d09dSXin LI>0x12	byte	2		(DSi enhanced)
4153e41d09dSXin LI>0x12	byte	3		(DSi only)
41640427ccaSGordon Tetlow# Secure Area check.
41740427ccaSGordon Tetlow>0x20		lelong	<0x4000		(homebrew)
41840427ccaSGordon Tetlow>0x20		lelong	>0x3FFF
41940427ccaSGordon Tetlow>>0x4000	lequad	0x0000000000000000	(multiboot)
42040427ccaSGordon Tetlow>>0x4000	lequad	!0x0000000000000000
42140427ccaSGordon Tetlow>>>0x4000	lequad	0xE7FFDEFFE7FFDEFF	(decrypted)
42240427ccaSGordon Tetlow>>>0x4000	lequad	!0xE7FFDEFFE7FFDEFF
42340427ccaSGordon Tetlow>>>>0x1000	lequad	0x0000000000000000	(encrypted)
42440427ccaSGordon Tetlow>>>>0x1000	lequad	!0x0000000000000000	(mask ROM)
4253e41d09dSXin LI
4263e41d09dSXin LI#------------------------------------------------------------------------------
4273e41d09dSXin LI# nds_passme: file(1) magic for Nintendo DS ROM images for GBA cartridge boot.
4283e41d09dSXin LI# This is also used for loading .nds files using the MSET exploit on 3DS.
4293e41d09dSXin LI# Reference: https://github.com/devkitPro/ndstool/blob/master/source/ndscreate.cpp
4303e41d09dSXin LI0xC0	bequad	0xC8604FE201708FE2	Nintendo DS Slot-2 ROM image (PassMe)
4313e41d09dSXin LI
4323e41d09dSXin LI#------------------------------------------------------------------------------
4333e41d09dSXin LI# ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format.
4343e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
4353e41d09dSXin LI# References:
4363e41d09dSXin LI# - https://neogpc.googlecode.com/svn-history/r10/trunk/src/core/neogpc.cpp
4373e41d09dSXin LI# - http://www.devrs.com/ngp/files/ngpctech.txt
4383e41d09dSXin LI#
4393e41d09dSXin LI0x0A	string	BY\ SNK\ CORPORATION	Neo Geo Pocket
4403e41d09dSXin LI>0x23	byte	0x10			Color
4413e41d09dSXin LI>0	byte	x			ROM image
4423e41d09dSXin LI>0x24	string	>\0			\b: "%.12s"
4433e41d09dSXin LI>0x1F	byte	0xFF			(debug mode enabled)
444b6cee71dSXin LI
445b6cee71dSXin LI#------------------------------------------------------------------------------
446b6cee71dSXin LI# msx: file(1) magic for MSX game cartridge dumps
447b6cee71dSXin LI# Too simple - MPi
448b6cee71dSXin LI#0 beshort 0x4142 MSX game cartridge dump
449b6cee71dSXin LI
450b6cee71dSXin LI#------------------------------------------------------------------------------
451b6cee71dSXin LI# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) :
452b6cee71dSXin LI0	string	PS-X\ EXE	Sony Playstation executable
4533e41d09dSXin LI>16	lelong	x		PC=0x%08x,
4543e41d09dSXin LI>20	lelong	!0		GP=0x%08x,
4553e41d09dSXin LI>24	lelong	!0		.text=[0x%08x,
4563e41d09dSXin LI>>28	lelong	x		\b0x%x],
4573e41d09dSXin LI>32	lelong	!0		.data=[0x%08x,
4583e41d09dSXin LI>>36	lelong	x		\b0x%x],
4593e41d09dSXin LI>40	lelong	!0		.bss=[0x%08x,
4603e41d09dSXin LI>>44	lelong	x		\b0x%x],
4613e41d09dSXin LI>48	lelong	!0		Stack=0x%08x,
4623e41d09dSXin LI>48	lelong	=0		No Stack!,
4633e41d09dSXin LI>52	lelong	!0		StackSize=0x%x,
4643e41d09dSXin LI#>76	string	>\0		(%s)
465b6cee71dSXin LI#  Area:
466b6cee71dSXin LI>113	string	x		(%s)
467b6cee71dSXin LI
4683e41d09dSXin LI# CPE executables
4693e41d09dSXin LI0	string	CPE		CPE executable
4703e41d09dSXin LI>3	byte	x		(version %d)
4713e41d09dSXin LI
472b6cee71dSXin LI#------------------------------------------------------------------------------
473b6cee71dSXin LI# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>)
474b6cee71dSXin LI0       string          XBEH            XBE, Microsoft Xbox executable
475b6cee71dSXin LI# probabilistic checks whether signed or not
476b6cee71dSXin LI>0x0004 ulelong =0x0
477b6cee71dSXin LI>>&2    ulelong =0x0
478b6cee71dSXin LI>>>&2   ulelong =0x0  \b, not signed
479b6cee71dSXin LI>0x0004 ulelong >0
480b6cee71dSXin LI>>&2    ulelong >0
481b6cee71dSXin LI>>>&2   ulelong >0    \b, signed
482b6cee71dSXin LI# expect base address of 0x10000
483b6cee71dSXin LI>0x0104               ulelong =0x10000
484b6cee71dSXin LI>>(0x0118-0x0FF60)    ulelong&0x80000007  0x80000007 \b, all regions
485b6cee71dSXin LI>>(0x0118-0x0FF60)    ulelong&0x80000007  !0x80000007
486b6cee71dSXin LI>>>(0x0118-0x0FF60)   ulelong >0           (regions:
487b6cee71dSXin LI>>>>(0x0118-0x0FF60)  ulelong &0x00000001  NA
488b6cee71dSXin LI>>>>(0x0118-0x0FF60)  ulelong &0x00000002  Japan
489b6cee71dSXin LI>>>>(0x0118-0x0FF60)  ulelong &0x00000004  Rest_of_World
490b6cee71dSXin LI>>>>(0x0118-0x0FF60)  ulelong &0x80000000  Manufacturer
491b6cee71dSXin LI>>>(0x0118-0x0FF60)   ulelong >0           \b)
492b6cee71dSXin LI
493b6cee71dSXin LI# --------------------------------
494b6cee71dSXin LI# Microsoft Xbox data file formats
495b6cee71dSXin LI0       string          XIP0            XIP, Microsoft Xbox data
496b6cee71dSXin LI0       string          XTF0            XTF, Microsoft Xbox data
497b6cee71dSXin LI
498b6cee71dSXin LI# Atari Lynx cartridge dump (EXE/BLL header)
499b6cee71dSXin LI# From: "Stefan A. Haubenthal" <polluks@web.de>
500b6cee71dSXin LI
501b6cee71dSXin LI# Double-check that the image type matches too, 0x8008 conflicts with
502b6cee71dSXin LI# 8 character OMF-86 object file headers.
503b6cee71dSXin LI0	beshort		0x8008
504b6cee71dSXin LI>6	string		BS93		Lynx homebrew cartridge
505b6cee71dSXin LI>>2	beshort		x		\b, RAM start $%04x
506b6cee71dSXin LI>6	string		LYNX		Lynx cartridge
507b6cee71dSXin LI>>2	beshort		x		\b, RAM start $%04x
508b6cee71dSXin LI
509b6cee71dSXin LI# Opera file system that is used on the 3DO console
510b6cee71dSXin LI# From: Serge van den Boom <svdb@stack.nl>
511b6cee71dSXin LI0	string		\x01ZZZZZ\x01	3DO "Opera" file system
512b6cee71dSXin LI
513*58a0f0d0SEitan Adler# From: Alex Myczko <alex@aiei.ch>
5145f0216bdSXin LI# From: David Pflug <david@pflug.email>
5155f0216bdSXin LI# is the offset 12 or the offset 16 correct?
5165f0216bdSXin LI# GBS (Game Boy Sound) magic
5175f0216bdSXin LI# ftp://ftp.modland.com/pub/documents/format_documentation/\
5185f0216bdSXin LI# Gameboy%20Sound%20System%20(.gbs).txt
519b6cee71dSXin LI0	string		GBS		Nintendo Gameboy Music/Audio Data
5205f0216bdSXin LI#12	string		GameBoy\ Music\ Module	Nintendo Gameboy Music Module
5215f0216bdSXin LI>16	string		>\0	("%s" by
5225f0216bdSXin LI>48	string		>\0	%s, copyright
5235f0216bdSXin LI>80	string		>\0	%s),
5245f0216bdSXin LI>3	byte		x	version %d,
5255f0216bdSXin LI>4	byte		x	%d tracks
526b6cee71dSXin LI
52740427ccaSGordon Tetlow# IPS Patch Files from: From: Thomas Klausner <tk@giga.or.at>
52840427ccaSGordon Tetlow# see http://zerosoft.zophar.net/ips.php
52940427ccaSGordon Tetlow0	string	PATCH			IPS patch file
53040427ccaSGordon Tetlow
531b6cee71dSXin LI# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at>
532b6cee71dSXin LI0	string	PPF30			Playstation Patch File version 3.0
533b6cee71dSXin LI>5	byte	0			\b, PPF 1.0 patch
534b6cee71dSXin LI>5	byte	1			\b, PPF 2.0 patch
535b6cee71dSXin LI>5	byte	2			\b, PPF 3.0 patch
536b6cee71dSXin LI>>56	byte	0			\b, Imagetype BIN (any)
537b6cee71dSXin LI>>56	byte	1			\b, Imagetype GI (PrimoDVD)
538b6cee71dSXin LI>>57	byte	0			\b, Blockcheck disabled
539b6cee71dSXin LI>>57	byte	1			\b, Blockcheck enabled
540b6cee71dSXin LI>>58	byte	0			\b, Undo data not available
541b6cee71dSXin LI>>58	byte	1			\b, Undo data available
542b6cee71dSXin LI>6	string	x			\b, description: %s
543b6cee71dSXin LI
544b6cee71dSXin LI0	string	PPF20			Playstation Patch File version 2.0
545b6cee71dSXin LI>5	byte	0			\b, PPF 1.0 patch
546b6cee71dSXin LI>5	byte	1			\b, PPF 2.0 patch
547b6cee71dSXin LI>>56	lelong	>0			\b, size of file to patch %d
548b6cee71dSXin LI>6	string	x			\b, description: %s
549b6cee71dSXin LI
550b6cee71dSXin LI0	string	PPF10			Playstation Patch File version 1.0
551b6cee71dSXin LI>5	byte	0			\b, Simple Encoding
552b6cee71dSXin LI>6	string	x			\b, description: %s
553b6cee71dSXin LI
554b6cee71dSXin LI# From: Daniel Dawson <ddawson@icehouse.net>
555b6cee71dSXin LI# SNES9x .smv "movie" file format.
556b6cee71dSXin LI0		string		SMV\x1A	SNES9x input recording
557b6cee71dSXin LI>0x4		lelong		x	\b, version %d
558b6cee71dSXin LI# version 4 is latest so far
559b6cee71dSXin LI>0x4		lelong		<5
560b6cee71dSXin LI>>0x8		ledate		x	\b, recorded at %s
561b6cee71dSXin LI>>0xc		lelong		>0	\b, rerecorded %d times
562b6cee71dSXin LI>>0x10		lelong		x	\b, %d frames long
563b6cee71dSXin LI>>0x14		byte		>0	\b, data for controller(s):
564b6cee71dSXin LI>>>0x14		byte		&0x1	#1
565b6cee71dSXin LI>>>0x14		byte		&0x2	#2
566b6cee71dSXin LI>>>0x14		byte		&0x4	#3
567b6cee71dSXin LI>>>0x14		byte		&0x8	#4
568b6cee71dSXin LI>>>0x14		byte		&0x10	#5
569b6cee71dSXin LI>>0x15		byte		^0x1	\b, begins from snapshot
570b6cee71dSXin LI>>0x15		byte		&0x1	\b, begins from reset
571b6cee71dSXin LI>>0x15		byte		^0x2	\b, NTSC standard
572b6cee71dSXin LI>>0x15		byte		&0x2	\b, PAL standard
573b6cee71dSXin LI>>0x17		byte		&0x1    \b, settings:
574b6cee71dSXin LI# WIP1Timing not used as of version 4
575b6cee71dSXin LI>>>0x4		lelong		<4
576b6cee71dSXin LI>>>>0x17	byte		&0x2	WIP1Timing
577b6cee71dSXin LI>>>0x17		byte		&0x4	Left+Right
578b6cee71dSXin LI>>>0x17		byte		&0x8	VolumeEnvX
579b6cee71dSXin LI>>>0x17		byte		&0x10	FakeMute
580b6cee71dSXin LI>>>0x17		byte		&0x20	SyncSound
581b6cee71dSXin LI# New flag as of version 4
582b6cee71dSXin LI>>>0x4		lelong		>3
583b6cee71dSXin LI>>>>0x17	byte		&0x80	NoCPUShutdown
584b6cee71dSXin LI>>0x4		lelong		<4
585b6cee71dSXin LI>>>0x18		lelong		>0x23
586b6cee71dSXin LI>>>>0x20	leshort		!0
587b6cee71dSXin LI>>>>>0x20	lestring16	x	\b, metadata: "%s"
588b6cee71dSXin LI>>0x4		lelong		>3
589b6cee71dSXin LI>>>0x24		byte		>0	\b, port 1:
590b6cee71dSXin LI>>>>0x24	byte		1	joypad
591b6cee71dSXin LI>>>>0x24	byte		2	mouse
592b6cee71dSXin LI>>>>0x24	byte		3	SuperScope
593b6cee71dSXin LI>>>>0x24	byte		4	Justifier
594b6cee71dSXin LI>>>>0x24	byte		5	multitap
595b6cee71dSXin LI>>>0x24		byte		>0	\b, port 2:
596b6cee71dSXin LI>>>>0x25	byte		1	joypad
597b6cee71dSXin LI>>>>0x25	byte		2	mouse
598b6cee71dSXin LI>>>>0x25	byte		3	SuperScope
599b6cee71dSXin LI>>>>0x25	byte		4	Justifier
600b6cee71dSXin LI>>>>0x25	byte		5	multitap
601b6cee71dSXin LI>>>0x18		lelong		>0x43
602b6cee71dSXin LI>>>>0x40	leshort		!0
603b6cee71dSXin LI>>>>>0x40	lestring16	x	\b, metadata: "%s"
604b6cee71dSXin LI>>0x17		byte		&0x40   \b, ROM:
605b6cee71dSXin LI>>>(0x18.l-26)	lelong		x	CRC32 0x%08x
606b6cee71dSXin LI>>>(0x18.l-23)	string		x	"%s"
607b6cee71dSXin LI
608b6cee71dSXin LI# Type: scummVM savegame files
609b6cee71dSXin LI# From: Sven Hartge <debian@ds9.argh.org>
610b6cee71dSXin LI0	string	SCVM	ScummVM savegame
611b6cee71dSXin LI>12	string	>\0	"%s"
6123e41d09dSXin LI
6133e41d09dSXin LI#------------------------------------------------------------------------------
6143e41d09dSXin LI# Nintendo GameCube / Wii file formats.
6153e41d09dSXin LI#
6163e41d09dSXin LI
6173e41d09dSXin LI# Type: Nintendo GameCube/Wii common disc header data.
6183e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
6193e41d09dSXin LI# Reference: http://wiibrew.org/wiki/Wii_Disc
6203e41d09dSXin LI0	name	nintendo-gcn-disc-common
6213e41d09dSXin LI>0x20	string	x	"%.64s"
6223e41d09dSXin LI>0x00	string	x	(%.6s
6233e41d09dSXin LI>0x06	byte	>0
6243e41d09dSXin LI>>0x06	byte	1	\b, Disc 2
6253e41d09dSXin LI>>0x06	byte	2	\b, Disc 3
6263e41d09dSXin LI>>0x06	byte	3	\b, Disc 4
6273e41d09dSXin LI>0x07	byte	x	\b, Rev.%02u)
6283e41d09dSXin LI
6293e41d09dSXin LI# Type: Nintendo GameCube disc image
6303e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
6313e41d09dSXin LI# Reference: http://wiibrew.org/wiki/Wii_Disc
6323e41d09dSXin LI0x1C	belong	0xC2339F3D	Nintendo GameCube disc image:
6333e41d09dSXin LI>0	use	nintendo-gcn-disc-common
6343e41d09dSXin LI
635282e23f0SXin LI# Type: Nintendo GameCube embedded disc image
636282e23f0SXin LI# Commonly found on demo discs.
637282e23f0SXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
638282e23f0SXin LI# Reference: http://hitmen.c02.at/files/yagcd/yagcd/index.html#idx14.8
639282e23f0SXin LI0		belong	0xAE0F38A2
640282e23f0SXin LI>0x0C		belong	0x00100000
641282e23f0SXin LI>>(8.L+0x1C)	belong	0xC2339F3D	Nintendo GameCube embedded disc image:
642282e23f0SXin LI>>>(8.L)	use	nintendo-gcn-disc-common
643282e23f0SXin LI
6443e41d09dSXin LI# Type: Nintendo Wii disc image
6453e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
6463e41d09dSXin LI# Reference: http://wiibrew.org/wiki/Wii_Disc
6473e41d09dSXin LI0x18	belong	0x5D1C9EA3	Nintendo Wii disc image:
6483e41d09dSXin LI>0	use	nintendo-gcn-disc-common
6493e41d09dSXin LI
6503e41d09dSXin LI# Type: Nintendo Wii disc image (WBFS format)
6513e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
6523e41d09dSXin LI# Reference: http://wiibrew.org/wiki/Wii_Disc
6533e41d09dSXin LI0	string	WBFS
6543e41d09dSXin LI>0x218	belong	0x5D1C9EA3	Nintendo Wii disc image (WBFS format):
6553e41d09dSXin LI>>0x200	use	nintendo-gcn-disc-common
6563e41d09dSXin LI
65740427ccaSGordon Tetlow# Type: Nintendo GameCube/Wii disc image (CISO format)
65840427ccaSGordon Tetlow# NOTE: This is NOT the same as Compact ISO or PSP CISO,
65940427ccaSGordon Tetlow# though it has the same magic number.
66040427ccaSGordon Tetlow0		string	CISO
66140427ccaSGordon Tetlow# Other fields are used to determine what type of CISO this is:
66240427ccaSGordon Tetlow# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size)
66340427ccaSGordon Tetlow# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size)
66440427ccaSGordon Tetlow# - None of the above: Compact ISO.
66540427ccaSGordon Tetlow>4		lelong	0x200000
66640427ccaSGordon Tetlow>>8		byte	1
66740427ccaSGordon Tetlow>>>0x801C	belong	0xC2339F3D	Nintendo GameCube disc image (CISO format):
66840427ccaSGordon Tetlow>>>>0x8000	use	nintendo-gcn-disc-common
66940427ccaSGordon Tetlow>>>0x8018	belong	0x5D1C9EA3	Nintendo Wii disc image (CISO format):
67040427ccaSGordon Tetlow>>>>0x8000	use	nintendo-gcn-disc-common
67140427ccaSGordon Tetlow
67240427ccaSGordon Tetlow# Type: Nintendo GameCube/Wii disc image (GCZ format)
67340427ccaSGordon Tetlow# Due to zlib compression, we can't get the actual disc information.
67440427ccaSGordon Tetlow0	lelong	0xB10BC001
67540427ccaSGordon Tetlow>4	lelong	0		Nintendo GameCube disc image (GCZ format)
67640427ccaSGordon Tetlow>4	lelong	1		Nintendo Wii disc image (GCZ format)
67740427ccaSGordon Tetlow>4	lelong	>1		Nintendo GameCube/Wii disc image (GCZ format)
67840427ccaSGordon Tetlow
67940427ccaSGordon Tetlow# Type: Nintendo GameCube/Wii disc image (WDF format)
68040427ccaSGordon Tetlow0		string	WII\001DISC
68140427ccaSGordon Tetlow>8		belong	1
68240427ccaSGordon Tetlow# WDFv1
68340427ccaSGordon Tetlow>>0x54		belong	0xC2339F3D	Nintendo GameCube disc image (WDFv1 format):
68440427ccaSGordon Tetlow>>>0x38		use	nintendo-gcn-disc-common
68540427ccaSGordon Tetlow>>0x58		belong	0x5D1C9EA3	Nintendo Wii disc image (WDFv1 format):
68640427ccaSGordon Tetlow>>>0x38		use	nintendo-gcn-disc-common
68740427ccaSGordon Tetlow>8		belong	2
68840427ccaSGordon Tetlow# WDFv2
68940427ccaSGordon Tetlow>>(12.L+0x1C)	belong	0xC2339F3D	Nintendo GameCube disc image (WDFv2 format):
69040427ccaSGordon Tetlow>>>(12.L)	use	nintendo-gcn-disc-common
69140427ccaSGordon Tetlow>>(12.L+0x18)	belong	0x5D1C9EA3	Nintendo Wii disc image (WDFv2 format):
69240427ccaSGordon Tetlow>>>(12.L)	use	nintendo-gcn-disc-common
69340427ccaSGordon Tetlow
69440427ccaSGordon Tetlow# Type: Nintendo GameCube/Wii disc image (WIA format)
69540427ccaSGordon Tetlow0	string	WIA\001	Nintendo
69640427ccaSGordon Tetlow>0x48	belong	0	GameCube/Wii
69740427ccaSGordon Tetlow>0x48	belong	1	GameCube
69840427ccaSGordon Tetlow>0x48	belong	2	Wii
69940427ccaSGordon Tetlow>0x48	belong	>2	GameCube/Wii
70040427ccaSGordon Tetlow>0x48	belong	x	disc image (WIA format):
70140427ccaSGordon Tetlow>>0x58	use	nintendo-gcn-disc-common
70240427ccaSGordon Tetlow
7033e41d09dSXin LI#------------------------------------------------------------------------------
7043e41d09dSXin LI# Nintendo 3DS file formats.
7053e41d09dSXin LI#
7063e41d09dSXin LI
7073e41d09dSXin LI# Type: Nintendo 3DS "NCSD" image. (game cards and eMMC)
7083e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
7093e41d09dSXin LI# Reference: https://www.3dbrew.org/wiki/NCSD
7103e41d09dSXin LI0x100		string		NCSD
7113e41d09dSXin LI>0x118		lequad		0		Nintendo 3DS Game Card image
712282e23f0SXin LI# NCCH header for partition 0. (game data)
713282e23f0SXin LI>>0x1150	string		>\0	\b: "%.16s"
714282e23f0SXin LI>>0x312		byte		x	(Rev.%02u)
715282e23f0SXin LI>>0x118C	byte		2	(New3DS only)
7163e41d09dSXin LI>>0x18D		byte		0		(inner device)
7173e41d09dSXin LI>>0x18D		byte		1		(Card1)
7183e41d09dSXin LI>>0x18D		byte		2		(Card2)
7193e41d09dSXin LI>>0x18D		byte		3		(extended device)
7203e41d09dSXin LI>0x118		bequad		0x0102020202000000	Nintendo 3DS eMMC dump (Old3DS)
7213e41d09dSXin LI>0x118		bequad		0x0102020203000000	Nintendo 3DS eMMC dump (New3DS)
7223e41d09dSXin LI
723282e23f0SXin LI# Nintendo 3DS version code.
724282e23f0SXin LI# Reference: https://www.3dbrew.org/wiki/Titles
725282e23f0SXin LI# Format: leshort containing three fields:
726282e23f0SXin LI# - 6-bit: Major
727282e23f0SXin LI# - 6-bit: Minor
728282e23f0SXin LI# - 4-bit: Revision
729282e23f0SXin LI# NOTE: Only supporting major/minor versions from 0-15 right now.
730282e23f0SXin LI# NOTE: Should be prefixed with "v".
731282e23f0SXin LI0	name	nintendo-3ds-version-code
732282e23f0SXin LI# Raw version.
733282e23f0SXin LI>0	leshort	x	\b%u,
734282e23f0SXin LI# Major version.
735282e23f0SXin LI>0	leshort&0xFC00	0x0000	0
736282e23f0SXin LI>0	leshort&0xFC00	0x0400	1
737282e23f0SXin LI>0	leshort&0xFC00	0x0800	2
738282e23f0SXin LI>0	leshort&0xFC00	0x0C00	3
739282e23f0SXin LI>0	leshort&0xFC00	0x1000	4
740282e23f0SXin LI>0	leshort&0xFC00	0x1400	5
741282e23f0SXin LI>0	leshort&0xFC00	0x1800	6
742282e23f0SXin LI>0	leshort&0xFC00	0x1C00	7
743282e23f0SXin LI>0	leshort&0xFC00	0x2000	8
744282e23f0SXin LI>0	leshort&0xFC00	0x2400	9
745282e23f0SXin LI>0	leshort&0xFC00	0x2800	10
746282e23f0SXin LI>0	leshort&0xFC00	0x2C00	11
747282e23f0SXin LI>0	leshort&0xFC00	0x3000	12
748282e23f0SXin LI>0	leshort&0xFC00	0x3400	13
749282e23f0SXin LI>0	leshort&0xFC00	0x3800	14
750282e23f0SXin LI>0	leshort&0xFC00	0x3C00	15
751282e23f0SXin LI# Minor version.
752282e23f0SXin LI>0	leshort&0x03F0	0x0000	\b.0
753282e23f0SXin LI>0	leshort&0x03F0	0x0010	\b.1
754282e23f0SXin LI>0	leshort&0x03F0	0x0020	\b.2
755282e23f0SXin LI>0	leshort&0x03F0	0x0030	\b.3
756282e23f0SXin LI>0	leshort&0x03F0	0x0040	\b.4
757282e23f0SXin LI>0	leshort&0x03F0	0x0050	\b.5
758282e23f0SXin LI>0	leshort&0x03F0	0x0060	\b.6
759282e23f0SXin LI>0	leshort&0x03F0	0x0070	\b.7
760282e23f0SXin LI>0	leshort&0x03F0	0x0080	\b.8
761282e23f0SXin LI>0	leshort&0x03F0	0x0090	\b.9
762282e23f0SXin LI>0	leshort&0x03F0	0x00A0	\b.10
763282e23f0SXin LI>0	leshort&0x03F0	0x00B0	\b.11
764282e23f0SXin LI>0	leshort&0x03F0	0x00C0	\b.12
765282e23f0SXin LI>0	leshort&0x03F0	0x00D0	\b.13
766282e23f0SXin LI>0	leshort&0x03F0	0x00E0	\b.14
767282e23f0SXin LI>0	leshort&0x03F0	0x00F0	\b.15
768282e23f0SXin LI# Revision.
769282e23f0SXin LI>0	leshort&0x000F	x	\b.%u
770282e23f0SXin LI
7713e41d09dSXin LI# Type: Nintendo 3DS "NCCH" container.
7723e41d09dSXin LI# https://www.3dbrew.org/wiki/NCCH
7733e41d09dSXin LI0x100		string	NCCH	Nintendo 3DS
7743e41d09dSXin LI>0x18D		byte&2	0	File Archive (CFA)
7753e41d09dSXin LI>0x18D		byte&2	2	Executable Image (CXI)
776282e23f0SXin LI>0x150		string	>\0	\b: "%.16s"
777282e23f0SXin LI>0x18D		byte	0x05
778282e23f0SXin LI>>0x10E		leshort	x	(Old3DS System Update v
779282e23f0SXin LI>>0x10E		use	nintendo-3ds-version-code
780282e23f0SXin LI>>0x10E		leshort	x	\b)
781282e23f0SXin LI>0x18D		byte	0x15
782282e23f0SXin LI>>0x10E		leshort	x	(New3DS System Update v
783282e23f0SXin LI>>0x10E		use	nintendo-3ds-version-code
784282e23f0SXin LI>>0x10E		leshort	x	\b)
785282e23f0SXin LI>0x18D		byte	!0x05
786282e23f0SXin LI>>0x18D		byte	!0x15
787282e23f0SXin LI>>>0x112	byte	x	(v
788282e23f0SXin LI>>>0x112	use	nintendo-3ds-version-code
789282e23f0SXin LI>>>0x112	byte	x	\b)
790282e23f0SXin LI>0x18C		byte	2	(New3DS only)
7913e41d09dSXin LI
7923e41d09dSXin LI# Type: Nintendo 3DS "SMDH" file. (application description)
7933e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
7943e41d09dSXin LI# Reference: https://3dbrew.org/wiki/SMDH
7953e41d09dSXin LI0		string		SMDH		Nintendo 3DS SMDH file
7963e41d09dSXin LI>0x208		leshort		!0
7973e41d09dSXin LI>>0x208		lestring16	x		\b: "%.128s"
7983e41d09dSXin LI>>0x388		leshort		!0
7993e41d09dSXin LI>>>0x388	lestring16	x		by %.128s
8003e41d09dSXin LI>0x208		leshort		0
8013e41d09dSXin LI>>0x008		leshort		!0
8023e41d09dSXin LI>>>0x008	lestring16	x		\b: "%.128s"
8033e41d09dSXin LI>>>0x188	leshort		!0
8043e41d09dSXin LI>>>>0x188	lestring16	x		by %.128s
8053e41d09dSXin LI
8063e41d09dSXin LI# Type: Nintendo 3DS Homebrew Application.
8073e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
80840427ccaSGordon Tetlow# Reference: https://3dbrew.org/wiki/3DSX_Format
8093e41d09dSXin LI0	string	3DSX	Nintendo 3DS Homebrew Application (3DSX)
8103e41d09dSXin LI
8113e41d09dSXin LI#------------------------------------------------------------------------------
8123e41d09dSXin LI# a7800: file(1) magic for the Atari 7800 raw ROM format.
8133e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
8143e41d09dSXin LI# Reference: https://sites.google.com/site/atari7800wiki/a78-header
8153e41d09dSXin LI
8163e41d09dSXin LI0	byte	>0
8173e41d09dSXin LI>0	byte	<3
8183e41d09dSXin LI>>1	string	ATARI7800	Atari 7800 ROM image
8193e41d09dSXin LI>>>0x11	string	>\0	\b: "%.32s"
8203e41d09dSXin LI# Display type.
8213e41d09dSXin LI>>>0x39	byte	0	(NTSC)
8223e41d09dSXin LI>>>0x39	byte	1	(PAL)
8233e41d09dSXin LI>>>0x36	byte&1	1	(POKEY)
8243e41d09dSXin LI
8253e41d09dSXin LI#------------------------------------------------------------------------------
8263e41d09dSXin LI# vectrex: file(1) magic for the GCE Vectrex raw ROM format.
8273e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
8283e41d09dSXin LI# Reference: http://www.playvectrex.com/designit/chrissalo/hello1.htm
8293e41d09dSXin LI#
8303e41d09dSXin LI# NOTE: Title is terminated with 0x80, not 0.
8313e41d09dSXin LI# The header is terminated with a 0, so that will
8323e41d09dSXin LI# terminate the title as well.
8333e41d09dSXin LI#
8343e41d09dSXin LI0	string	g\ GCE	Vectrex ROM image
8353e41d09dSXin LI>0x11	string	>\0	\b: "%.16s"
83640427ccaSGordon Tetlow
83740427ccaSGordon Tetlow#------------------------------------------------------------------------------
83840427ccaSGordon Tetlow# amiibo: file(1) magic for Nintendo amiibo NFC dumps.
83940427ccaSGordon Tetlow# From: David Korth <gerbilsoft@gerbilsoft.com>
84040427ccaSGordon Tetlow# Reference: https://www.3dbrew.org/wiki/Amiibo
84140427ccaSGordon Tetlow0x00		byte	0x04
84240427ccaSGordon Tetlow>0x0A		beshort	0x0FE0
84340427ccaSGordon Tetlow>>0x0C		belong	0xF110FFEE
84440427ccaSGordon Tetlow>>>0x208	beshort	0x0100
84540427ccaSGordon Tetlow>>>>0x020A	byte	0x0F
84640427ccaSGordon Tetlow>>>>>0x020C	bequad	0x000000045F000000
84740427ccaSGordon Tetlow>>>>>>0x5B	byte	0x02
84840427ccaSGordon Tetlow>>>>>>>0x54	belong	x	Nintendo amiibo NFC dump - amiibo ID: %08X-
84940427ccaSGordon Tetlow>>>>>>>0x58	belong	x	\b%08X
850