xref: /freebsd/contrib/file/magic/Magdir/console (revision 2dc4dbb9673c9a3309c2dad59cb588c6f04beaea)
1b6cee71dSXin LI
2b6cee71dSXin LI#------------------------------------------------------------------------------
3*2dc4dbb9SEitan Adler# $File: console,v 1.40 2018/06/23 16:40:40 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)
50*2dc4dbb9SEitan Adler!:mime	application/x-nes-rom
5140427ccaSGordon Tetlow>0	use		nes-rom-image-ines
5240427ccaSGordon Tetlow
5340427ccaSGordon Tetlow# Wii U Virtual Console iNES ROM header.
5440427ccaSGordon Tetlow0	belong		0x4E455300	NES ROM image (Wii U Virtual Console)
55*2dc4dbb9SEitan Adler!:mime	application/x-nes-rom
5640427ccaSGordon Tetlow>0	use		nes-rom-image-ines
5740427ccaSGordon Tetlow
583e41d09dSXin LI#------------------------------------------------------------------------------
593e41d09dSXin LI# unif: file(1) magic for UNIF-format Nintendo Entertainment System ROM images
603e41d09dSXin LI# Reference: http://wiki.nesdev.com/w/index.php/UNIF
613e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
623e41d09dSXin LI#
633e41d09dSXin LI# NOTE: The UNIF format uses chunks instead of a fixed header,
643e41d09dSXin LI# so most of the data isn't easily parseable.
653e41d09dSXin LI#
663e41d09dSXin LI0	string	UNIF
6740427ccaSGordon Tetlow>4	lelong	<16	NES ROM image (UNIF v%d format)
68*2dc4dbb9SEitan Adler!:mime	application/x-nes-rom
69b6cee71dSXin LI
70b6cee71dSXin LI#------------------------------------------------------------------------------
71282e23f0SXin LI# fds: file(1) magic for Famciom Disk System disk images
72282e23f0SXin LI# Reference: http://wiki.nesdev.com/w/index.php/Family_Computer_Disk_System#.FDS_format
73282e23f0SXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
74282e23f0SXin LI# TODO: Check "Disk info block" and get info from that in addition to the optional header.
75282e23f0SXin LI
76282e23f0SXin LI# Disk info block. (block 1)
77282e23f0SXin LI0	name	nintendo-fds-disk-info-block
78282e23f0SXin LI>23	byte	!1		FMC-
79282e23f0SXin LI>23	byte	1		FSC-
80282e23f0SXin LI>16	string	x		\b%.3s
8140427ccaSGordon Tetlow>15	byte	x		\b, mfr %02X
82282e23f0SXin LI>20	byte	x		(Rev.%02u)
83282e23f0SXin LI
84282e23f0SXin LI# Headered version.
85282e23f0SXin LI0	string	FDS\x1A
8640427ccaSGordon Tetlow>0x11	string	*NINTENDO-HVC*	Famicom Disk System disk image:
87*2dc4dbb9SEitan Adler!:mime	application/x-fds-disk
88282e23f0SXin LI>>0x10	use	nintendo-fds-disk-info-block
89282e23f0SXin LI>4	byte	1	(%u side)
90282e23f0SXin LI>4	byte	!1	(%u sides)
91282e23f0SXin LI
92282e23f0SXin LI# Unheadered version.
9340427ccaSGordon Tetlow1	string	*NINTENDO-HVC*	Famicom Disk System disk image:
94*2dc4dbb9SEitan Adler!:mime	application/x-fds-disk
95282e23f0SXin LI>0	use	nintendo-fds-disk-info-block
96282e23f0SXin LI
97282e23f0SXin LI#------------------------------------------------------------------------------
9840427ccaSGordon Tetlow# tnes: file(1) magic for TNES-format Nintendo Entertainment System ROM images
9940427ccaSGordon Tetlow# Used by Nintendo 3DS NES Virtual Console games.
10040427ccaSGordon Tetlow# From: David Korth <gerbilsoft@gerbilsoft.com>
10140427ccaSGordon Tetlow#
10240427ccaSGordon Tetlow0		string	TNES	NES ROM image (Nintendo 3DS Virtual Console)
103*2dc4dbb9SEitan Adler!:mime		application/x-nes-rom
10440427ccaSGordon Tetlow>4		byte	100	\b: FDS,
10540427ccaSGordon Tetlow>>0x2010	use	nintendo-fds-disk-info-block
10640427ccaSGordon Tetlow>4		byte	!100	\b: TNES mapper %u
10740427ccaSGordon Tetlow>>5	byte		x		\b, %ux8k PRG
10840427ccaSGordon Tetlow>>6	byte		x		\b, %ux8k CHR
10940427ccaSGordon Tetlow>>7	byte&0x08	=1		[WRAM]
11040427ccaSGordon Tetlow>>8	byte&0x09	=1		[H-mirror]
11140427ccaSGordon Tetlow>>8	byte&0x09	=2		[V-mirror]
11240427ccaSGordon Tetlow>>8	byte&0x02	=3		[VRAM]
11340427ccaSGordon Tetlow
11440427ccaSGordon Tetlow#------------------------------------------------------------------------------
115b6cee71dSXin LI# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format
1163e41d09dSXin LI# Reference: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header
117b6cee71dSXin LI#
1183e41d09dSXin LI0x104		bequad		0xCEED6666CC0D000B	Game Boy ROM image
119*2dc4dbb9SEitan Adler# TODO: application/x-gameboy-color-rom for GBC.
120*2dc4dbb9SEitan Adler!:mime		application/x-gameboy-rom
1213e41d09dSXin LI>0x143		byte&0x80	0x80
1223e41d09dSXin LI>>0x134		string		>\0			\b: "%.15s"
1233e41d09dSXin LI>0x143		byte&0x80	!0x80
1243e41d09dSXin LI>>0x134		string		>\0			\b: "%.16s"
1253e41d09dSXin LI>0x14c		byte		x			(Rev.%02u)
126b6cee71dSXin LI
1273e41d09dSXin LI# Machine type. (SGB, CGB, SGB+CGB)
1283e41d09dSXin LI>0x14b		byte		0x33
1293e41d09dSXin LI>>0x146		byte		0x03
1303e41d09dSXin LI>>>0x143	byte&0x80	0x80	[SGB+CGB]
1313e41d09dSXin LI>>>0x143	byte&0x80	!0x80	[SGB]
1323e41d09dSXin LI>>0x146		byte		!0x03
1333e41d09dSXin LI>>>0x143	byte&0xC0	0x80	[CGB]
1343e41d09dSXin LI>>>0x143	byte&0xC0	0xC0	[CGB ONLY]
135*2dc4dbb9SEitan Adler>0x14b		byte		!0x33
1363e41d09dSXin LI
1373e41d09dSXin LI# Mapper.
1383e41d09dSXin LI>0x147 byte 0x00  [ROM ONLY]
1393e41d09dSXin LI>0x147 byte 0x01  [MBC1]
1403e41d09dSXin LI>0x147 byte 0x02  [MBC1+RAM]
1413e41d09dSXin LI>0x147 byte 0x03  [MBC1+RAM+BATT]
1423e41d09dSXin LI>0x147 byte 0x05  [MBC2]
1433e41d09dSXin LI>0x147 byte 0x06  [MBC2+BATTERY]
1443e41d09dSXin LI>0x147 byte 0x08  [ROM+RAM]
1453e41d09dSXin LI>0x147 byte 0x09  [ROM+RAM+BATTERY]
1463e41d09dSXin LI>0x147 byte 0x0B  [MMM01]
1473e41d09dSXin LI>0x147 byte 0x0C  [MMM01+SRAM]
1483e41d09dSXin LI>0x147 byte 0x0D  [MMM01+SRAM+BATT]
1493e41d09dSXin LI>0x147 byte 0x0F  [MBC3+TIMER+BATT]
1503e41d09dSXin LI>0x147 byte 0x10  [MBC3+TIMER+RAM+BATT]
1513e41d09dSXin LI>0x147 byte 0x11  [MBC3]
1523e41d09dSXin LI>0x147 byte 0x12  [MBC3+RAM]
1533e41d09dSXin LI>0x147 byte 0x13  [MBC3+RAM+BATT]
1543e41d09dSXin LI>0x147 byte 0x19  [MBC5]
1553e41d09dSXin LI>0x147 byte 0x1A  [MBC5+RAM]
1563e41d09dSXin LI>0x147 byte 0x1B  [MBC5+RAM+BATT]
1573e41d09dSXin LI>0x147 byte 0x1C  [MBC5+RUMBLE]
1583e41d09dSXin LI>0x147 byte 0x1D  [MBC5+RUMBLE+SRAM]
1593e41d09dSXin LI>0x147 byte 0x1E  [MBC5+RUMBLE+SRAM+BATT]
1603e41d09dSXin LI>0x147 byte 0xFC  [Pocket Camera]
1613e41d09dSXin LI>0x147 byte 0xFD  [Bandai TAMA5]
1623e41d09dSXin LI>0x147 byte 0xFE  [Hudson HuC-3]
1633e41d09dSXin LI>0x147 byte 0xFF  [Hudson HuC-1]
1643e41d09dSXin LI
1653e41d09dSXin LI# ROM size.
166b6cee71dSXin LI>0x148 byte 0     \b, ROM: 256Kbit
167b6cee71dSXin LI>0x148 byte 1     \b, ROM: 512Kbit
168b6cee71dSXin LI>0x148 byte 2     \b, ROM: 1Mbit
169b6cee71dSXin LI>0x148 byte 3     \b, ROM: 2Mbit
170b6cee71dSXin LI>0x148 byte 4     \b, ROM: 4Mbit
171b6cee71dSXin LI>0x148 byte 5     \b, ROM: 8Mbit
172b6cee71dSXin LI>0x148 byte 6     \b, ROM: 16Mbit
1733e41d09dSXin LI>0x148 byte 7     \b, ROM: 32Mbit
174b6cee71dSXin LI>0x148 byte 0x52  \b, ROM: 9Mbit
175b6cee71dSXin LI>0x148 byte 0x53  \b, ROM: 10Mbit
176b6cee71dSXin LI>0x148 byte 0x54  \b, ROM: 12Mbit
177b6cee71dSXin LI
1783e41d09dSXin LI# RAM size.
179b6cee71dSXin LI>0x149 byte 1     \b, RAM: 16Kbit
180b6cee71dSXin LI>0x149 byte 2     \b, RAM: 64Kbit
181b6cee71dSXin LI>0x149 byte 3     \b, RAM: 128Kbit
182b6cee71dSXin LI>0x149 byte 4     \b, RAM: 1Mbit
1833e41d09dSXin LI>0x149 byte 5     \b, RAM: 512Kbit
184b6cee71dSXin LI
185b6cee71dSXin LI#------------------------------------------------------------------------------
1863e41d09dSXin LI# genesis: file(1) magic for various Sega Mega Drive / Genesis ROM image and disc formats
1873e41d09dSXin LI# Updated by David Korth <gerbilsoft@gerbilsoft.com>
1883e41d09dSXin LI# References:
1893e41d09dSXin LI# - http://www.retrodev.com/segacd.html
1903e41d09dSXin LI# - http://devster.monkeeh.com/sega/32xguide1.txt
191b6cee71dSXin LI#
1923e41d09dSXin LI
1933e41d09dSXin LI# Common Sega Mega Drive header format.
1943e41d09dSXin LI# FIXME: Name fields are 48 bytes, but have spaces for padding instead of 00s.
1953e41d09dSXin LI0		name	sega-mega-drive-header
1963e41d09dSXin LI# ROM title. (Use domestic if present; if not, use international.)
1973e41d09dSXin LI>0x120		byte	>0x20
1983e41d09dSXin LI>>0x120		string	>\0	\b: "%.16s"
1993e41d09dSXin LI>0x120		byte	<0x21
2003e41d09dSXin LI>>0x150		string	>\0	\b: "%.16s"
2013e41d09dSXin LI# Other information.
2023e41d09dSXin LI>0x180		string	>\0	(%.14s
2033e41d09dSXin LI>>0x110		string  >\0	\b, %.16s
2043e41d09dSXin LI>0x180		byte	0
2053e41d09dSXin LI>>0x110		string  >\0	(%.16s
2063e41d09dSXin LI>0		byte	x	\b)
2073e41d09dSXin LI
2083e41d09dSXin LI# TODO: Check for 32X CD?
2093e41d09dSXin LI# Sega Mega CD disc images: 2048-byte sectors.
2103e41d09dSXin LI0	string	SEGADISCSYSTEM\ \ 	Sega Mega CD disc image
211*2dc4dbb9SEitan Adler!:mime	application/x-sega-cd-rom
2123e41d09dSXin LI>0	use	sega-mega-drive-header
2133e41d09dSXin LI>0	byte	x			\b, 2048-byte sectors
2143e41d09dSXin LI0	string	SEGABOOTDISC\ \ \ \ 	Sega Mega CD disc image
215*2dc4dbb9SEitan Adler!:mime	application/x-sega-cd-rom
2163e41d09dSXin LI>0	use	sega-mega-drive-header
2173e41d09dSXin LI>0	byte	x			\b, 2048-byte sectors
2183e41d09dSXin LI# Sega Mega CD disc images: 2352-byte sectors.
2193e41d09dSXin LI0x10	string	SEGADISCSYSTEM\ \ 	Sega Mega CD disc image
220*2dc4dbb9SEitan Adler!:mime	application/x-sega-cd-rom
2213e41d09dSXin LI>0x10	use	sega-mega-drive-header
2223e41d09dSXin LI>0	byte	x			\b, 2352-byte sectors
2233e41d09dSXin LI0x10	string	SEGABOOTDISC\ \ \ \ 	Sega Mega CD disc image
224*2dc4dbb9SEitan Adler!:mime	application/x-sega-cd-rom
2253e41d09dSXin LI>0x10	use	sega-mega-drive-header
2263e41d09dSXin LI>0	byte	x			\b, 2352-byte sectors
2273e41d09dSXin LI
2283e41d09dSXin LI# Sega Mega Drive, 32X, Pico, and Mega CD Boot ROM images.
2293e41d09dSXin LI0x100		string	SEGA
2303e41d09dSXin LI>0x3C0		bequad	0x4D41525320434845	Sega 32X ROM image
231*2dc4dbb9SEitan Adler!:mime		application/x-genesis-32x-rom
2323e41d09dSXin LI>>0		use	sega-mega-drive-header
2333e41d09dSXin LI>0x3C0		bequad	!0x4D41525320434845
2343e41d09dSXin LI>>0x105		belong	0x5049434F	Sega Pico ROM image
235*2dc4dbb9SEitan Adler!:mime		application/x-sega-pico-rom
2363e41d09dSXin LI>>>0		use	sega-mega-drive-header
2373e41d09dSXin LI>>0x105		belong	!0x5049434F
2383e41d09dSXin LI>>>0x180	beshort	0x4252		Sega Mega CD Boot ROM image
239*2dc4dbb9SEitan Adler!:mime		application/x-genesis-rom
2403e41d09dSXin LI>>>0x180	beshort	!0x4252		Sega Mega Drive / Genesis ROM image
241*2dc4dbb9SEitan Adler!:mime		application/x-genesis-rom
2423e41d09dSXin LI>>>0		use	sega-mega-drive-header
243b6cee71dSXin LI
244b6cee71dSXin LI#------------------------------------------------------------------------------
245b6cee71dSXin LI# genesis: file(1) magic for the Super MegaDrive ROM dump format
246b6cee71dSXin LI#
2473e41d09dSXin LI
2483e41d09dSXin LI# NOTE: Due to interleaving, we can't display anything
2493e41d09dSXin LI# other than the copier header information.
2503e41d09dSXin LI0      name    sega-genesis-smd-header
251b6cee71dSXin LI>0     byte    x       %dx16k blocks
252b6cee71dSXin LI>2     byte    0       \b, last in series or standalone
253b6cee71dSXin LI>2     byte    >0      \b, split ROM
2543e41d09dSXin LI
2553e41d09dSXin LI# "Sega Genesis" header.
2563e41d09dSXin LI0x280	string EAGN
2573e41d09dSXin LI>8	beshort	0xAABB	Sega Mega Drive / Genesis ROM image (SMD format):
258*2dc4dbb9SEitan Adler!:mime	application/x-genesis-rom
2593e41d09dSXin LI>>0	use     sega-genesis-smd-header
2603e41d09dSXin LI
2613e41d09dSXin LI# "Sega Mega Drive" header.
2623e41d09dSXin LI0x280	string EAMG
2633e41d09dSXin LI>8	beshort	0xAABB	Sega Mega Drive / Genesis ROM image (SMD format):
264*2dc4dbb9SEitan Adler!:mime	application/x-genesis-rom
2653e41d09dSXin LI>>0	use     sega-genesis-smd-header
266b6cee71dSXin LI
267b6cee71dSXin LI#------------------------------------------------------------------------------
2683e41d09dSXin LI# smsgg:  file(1) magic for Sega Master System and Game Gear ROM images
2693e41d09dSXin LI# Detects all Game Gear and export Sega Master System ROM images,
2703e41d09dSXin LI# and some Japanese Sega Master System ROM images.
2713e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
2723e41d09dSXin LI# Reference: http://www.smspower.org/Development/ROMHeader
273b6cee71dSXin LI#
2743e41d09dSXin LI
2753e41d09dSXin LI# General SMS header rule.
2763e41d09dSXin LI# The SMS boot ROM checks the header at three locations.
2773e41d09dSXin LI0	name	sega-master-system-rom-header
2783e41d09dSXin LI# Machine type.
2793e41d09dSXin LI>0x0F	byte&0xF0	0x30	Sega Master System
280*2dc4dbb9SEitan Adler!:mime	application/x-sms-rom
2813e41d09dSXin LI>0x0F	byte&0xF0	0x40	Sega Master System
282*2dc4dbb9SEitan Adler!:mime	application/x-sms-rom
2833e41d09dSXin LI>0x0F	byte&0xF0	0x50	Sega Game Gear
284*2dc4dbb9SEitan Adler!:mime	application/x-gamegear-rom
2853e41d09dSXin LI>0x0F	byte&0xF0	0x60	Sega Game Gear
286*2dc4dbb9SEitan Adler!:mime	application/x-gamegear-rom
2873e41d09dSXin LI>0x0F	byte&0xF0	0x70	Sega Game Gear
288*2dc4dbb9SEitan Adler!:mime	application/x-gamegear-rom
289*2dc4dbb9SEitan Adler>0x0F	default		x	Sega Master System / Game Gear
290*2dc4dbb9SEitan Adler!:mime	application/x-sms-rom
2913e41d09dSXin LI>0	byte		x	ROM image:
2923e41d09dSXin LI# Product code.
2933e41d09dSXin LI>0x0E	byte&0xF0	0x10	1
2943e41d09dSXin LI>0x0E	byte&0xF0	0x20	2
2953e41d09dSXin LI>0x0E	byte&0xF0	0x30	3
2963e41d09dSXin LI>0x0E	byte&0xF0	0x40	4
2973e41d09dSXin LI>0x0E	byte&0xF0	0x50	5
2983e41d09dSXin LI>0x0E	byte&0xF0	0x60	6
2993e41d09dSXin LI>0x0E	byte&0xF0	0x70	7
3003e41d09dSXin LI>0x0E	byte&0xF0	0x80	8
3013e41d09dSXin LI>0x0E	byte&0xF0	0x90	9
3023e41d09dSXin LI>0x0E	byte&0xF0	0xA0	10
3033e41d09dSXin LI>0x0E	byte&0xF0	0xB0	11
3043e41d09dSXin LI>0x0E	byte&0xF0	0xC0	12
3053e41d09dSXin LI>0x0E	byte&0xF0	0xD0	13
3063e41d09dSXin LI>0x0E	byte&0xF0	0xE0	14
3073e41d09dSXin LI>0x0E	byte&0xF0	0xF0	15
3083e41d09dSXin LI# If the product code is 5 digits, we'll need to backspace here.
3093e41d09dSXin LI>0x0E	byte&0xF0	!0
3103e41d09dSXin LI>>0x0C	leshort		x	\b%04x
3113e41d09dSXin LI>0x0E	byte&0xF0	0
3123e41d09dSXin LI>>0x0C	leshort		x	%04x
3133e41d09dSXin LI# Revision.
3143e41d09dSXin LI>0x0E	byte&0x0F	x	(Rev.%02d)
3153e41d09dSXin LI# ROM size. (Used for the boot ROM checksum routine.)
3163e41d09dSXin LI>0x0F	byte&0x0F	0x0A	(8 KB)
3173e41d09dSXin LI>0x0F	byte&0x0F	0x0B	(16 KB)
3183e41d09dSXin LI>0x0F	byte&0x0F	0x0C	(32 KB)
3193e41d09dSXin LI>0x0F	byte&0x0F	0x0D	(48 KB)
3203e41d09dSXin LI>0x0F	byte&0x0F	0x0E	(64 KB)
3213e41d09dSXin LI>0x0F	byte&0x0F	0x0F	(128 KB)
3223e41d09dSXin LI>0x0F	byte&0x0F	0x00	(256 KB)
3233e41d09dSXin LI>0x0F	byte&0x0F	0x01	(512 KB)
3243e41d09dSXin LI>0x0F	byte&0x0F	0x02	(1 MB)
3253e41d09dSXin LI
3263e41d09dSXin LI# SMS/GG header locations.
3273e41d09dSXin LI0x7FF0	string	TMR\ SEGA
3283e41d09dSXin LI>0x7FF0	use	sega-master-system-rom-header
3293e41d09dSXin LI0x3FF0	string	TMR\ SEGA
3303e41d09dSXin LI>0x3FF0	use	sega-master-system-rom-header
3313e41d09dSXin LI0x1FF0	string	TMR\ SEGA
3323e41d09dSXin LI>0x1FF0	use	sega-master-system-rom-header
333b6cee71dSXin LI
334b6cee71dSXin LI#------------------------------------------------------------------------------
3353e41d09dSXin LI# saturn: file(1) magic for the Sega Saturn disc image format.
3363e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
337b6cee71dSXin LI#
3383e41d09dSXin LI
3393e41d09dSXin LI# Common Sega Saturn disc header format.
3403e41d09dSXin LI# NOTE: Title is 112 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-saturn-disc-header
3433e41d09dSXin LI>0x60	string	>\0	\b: "%.32s"
3443e41d09dSXin LI>0x20	string	>\0	(%.10s
3453e41d09dSXin LI>>0x2A	string	>\0	\b, %.6s)
3463e41d09dSXin LI>>0x2A	byte	0	\b)
3473e41d09dSXin LI
3483e41d09dSXin LI# 2048-byte sector version.
3493e41d09dSXin LI0	string	SEGA\ SEGASATURN\ 	Sega Saturn disc image
350*2dc4dbb9SEitan Adler!:mime	application/x-saturn-rom
3513e41d09dSXin LI>0	use	sega-saturn-disc-header
3523e41d09dSXin LI>0	byte	x			(2048-byte sectors)
3533e41d09dSXin LI# 2352-byte sector version.
3543e41d09dSXin LI0x10	string	SEGA\ SEGASATURN\ 	Sega Saturn disc image
355*2dc4dbb9SEitan Adler!:mime	application/x-saturn-rom
3563e41d09dSXin LI>0x10	use	sega-saturn-disc-header
3573e41d09dSXin LI>0	byte	x			(2352-byte sectors)
3583e41d09dSXin LI
3593e41d09dSXin LI#------------------------------------------------------------------------------
3603e41d09dSXin LI# dreamcast: file(1) magic for the Sega Dreamcast disc image format.
3613e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
3623e41d09dSXin LI# Reference: http://mc.pp.se/dc/ip0000.bin.html
363b6cee71dSXin LI#
3643e41d09dSXin LI
3653e41d09dSXin LI# Common Sega Dreamcast disc header format.
3663e41d09dSXin LI# NOTE: Title is 128 bytes, but we're only showing 32 due to space padding.
3673e41d09dSXin LI# TODO: Release date, device information, region code, others?
3683e41d09dSXin LI0	name	sega-dreamcast-disc-header
3693e41d09dSXin LI>0x80	string	>\0	\b: "%.32s"
3703e41d09dSXin LI>0x40	string	>\0	(%.10s
3713e41d09dSXin LI>>0x4A	string	>\0	\b, %.6s)
3723e41d09dSXin LI>>0x4A	byte	0	\b)
3733e41d09dSXin LI
3743e41d09dSXin LI# 2048-byte sector version.
3753e41d09dSXin LI0	string	SEGA\ SEGAKATANA\ 	Sega Dreamcast disc image
376*2dc4dbb9SEitan Adler!:mime	application/x-dc-rom
3773e41d09dSXin LI>0	use	sega-dreamcast-disc-header
3783e41d09dSXin LI>0	byte	x			(2048-byte sectors)
3793e41d09dSXin LI# 2352-byte sector version.
3803e41d09dSXin LI0x10	string	SEGA\ SEGAKATANA\ 	Sega Dreamcast disc image
381*2dc4dbb9SEitan Adler!:mime	application/x-dc-rom
3823e41d09dSXin LI>0x10	use	sega-dreamcast-disc-header
3833e41d09dSXin LI>0	byte	x			(2352-byte sectors)
384b6cee71dSXin LI
385b6cee71dSXin LI#------------------------------------------------------------------------------
386b6cee71dSXin LI# dreamcast:  file(1) uncertain magic for the Sega Dreamcast VMU image format
387b6cee71dSXin LI#
388b6cee71dSXin LI0 belong 0x21068028   Sega Dreamcast VMU game image
389b6cee71dSXin LI0 string LCDi         Dream Animator file
390b6cee71dSXin LI
391b6cee71dSXin LI#------------------------------------------------------------------------------
3923e41d09dSXin LI# z64: file(1) magic for the Z64 format N64 ROM dumps
3933e41d09dSXin LI# Reference: http://forum.pj64-emu.com/showthread.php?t=2239
3943e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
395b6cee71dSXin LI#
3963e41d09dSXin LI0	bequad	0x803712400000000F	Nintendo 64 ROM image
397*2dc4dbb9SEitan Adler!:mime	application/x-n64-rom
3983e41d09dSXin LI>0x20	string	>\0	\b: "%.20s"
3993e41d09dSXin LI>0x3B	string	x	(%.4s
4003e41d09dSXin LI>0x3F	byte	x	\b, Rev.%02u)
401b6cee71dSXin LI
4023e41d09dSXin LI#------------------------------------------------------------------------------
4033e41d09dSXin LI# v64: file(1) magic for the V64 format N64 ROM dumps
4043e41d09dSXin LI# Same as z64 format, but with 16-bit byteswapping.
4053e41d09dSXin LI#
4063e41d09dSXin LI0	bequad	0x3780401200000F00	Nintendo 64 ROM image (V64)
407*2dc4dbb9SEitan Adler!:mime	application/x-n64-rom
4083e41d09dSXin LI
4093e41d09dSXin LI#------------------------------------------------------------------------------
4103e41d09dSXin LI# n64-swap2: file(1) magic for the swap2 format N64 ROM dumps
4113e41d09dSXin LI# Same as z64 format, but with swapped 16-bit words.
4123e41d09dSXin LI#
4133e41d09dSXin LI0	bequad	0x12408037000F0000	Nintendo 64 ROM image (wordswapped)
414*2dc4dbb9SEitan Adler!:mime	application/x-n64-rom
4153e41d09dSXin LI
4163e41d09dSXin LI#------------------------------------------------------------------------------
4173e41d09dSXin LI# n64-le32: file(1) magic for the 32-bit byteswapped format N64 ROM dumps
4183e41d09dSXin LI# Same as z64 format, but with 32-bit byteswapping.
4193e41d09dSXin LI#
4203e41d09dSXin LI0	bequad	0x401237800F000000	Nintendo 64 ROM image (32-bit byteswapped)
421*2dc4dbb9SEitan Adler!:mime	application/x-n64-rom
4223e41d09dSXin LI
4233e41d09dSXin LI#------------------------------------------------------------------------------
4243e41d09dSXin LI# gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format
4253e41d09dSXin LI# Reference: http://problemkaputt.de/gbatek.htm#gbacartridgeheader
4263e41d09dSXin LI#
4273e41d09dSXin LI# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
4283e41d09dSXin LI# Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
4293e41d09dSXin LI#
4303e41d09dSXin LI4	bequad	0x24FFAE51699AA221	Game Boy Advance ROM image
431*2dc4dbb9SEitan Adler!:mime	application/x-gba-rom
4323e41d09dSXin LI>0xA0	string	>\0	\b: "%.12s"
4333e41d09dSXin LI>0xAC	string	x	(%.6s
4343e41d09dSXin LI>0xBC	byte	x	\b, Rev.%02u)
4353e41d09dSXin LI
4363e41d09dSXin LI#------------------------------------------------------------------------------
4373e41d09dSXin LI# nds: file(1) magic for the Nintendo DS(i) raw ROM format
4383e41d09dSXin LI# Reference: http://problemkaputt.de/gbatek.htm#dscartridgeheader
4393e41d09dSXin LI#
4403e41d09dSXin LI# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
4413e41d09dSXin LI# Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
4423e41d09dSXin LI#
4433e41d09dSXin LI0xC0	bequad	0x24FFAE51699AA221	Nintendo DS ROM image
444*2dc4dbb9SEitan Adler!:mime	application/x-nintendo-ds-rom
4453e41d09dSXin LI>0x00	string	>\0		\b: "%.12s"
4463e41d09dSXin LI>0x0C	string	x		(%.6s
4473e41d09dSXin LI>0x1E	byte	x		\b, Rev.%02u)
4483e41d09dSXin LI>0x12	byte	2		(DSi enhanced)
4493e41d09dSXin LI>0x12	byte	3		(DSi only)
45040427ccaSGordon Tetlow# Secure Area check.
45140427ccaSGordon Tetlow>0x20		lelong	<0x4000		(homebrew)
45240427ccaSGordon Tetlow>0x20		lelong	>0x3FFF
45340427ccaSGordon Tetlow>>0x4000	lequad	0x0000000000000000	(multiboot)
45440427ccaSGordon Tetlow>>0x4000	lequad	!0x0000000000000000
45540427ccaSGordon Tetlow>>>0x4000	lequad	0xE7FFDEFFE7FFDEFF	(decrypted)
45640427ccaSGordon Tetlow>>>0x4000	lequad	!0xE7FFDEFFE7FFDEFF
45740427ccaSGordon Tetlow>>>>0x1000	lequad	0x0000000000000000	(encrypted)
45840427ccaSGordon Tetlow>>>>0x1000	lequad	!0x0000000000000000	(mask ROM)
4593e41d09dSXin LI
4603e41d09dSXin LI#------------------------------------------------------------------------------
4613e41d09dSXin LI# nds_passme: file(1) magic for Nintendo DS ROM images for GBA cartridge boot.
4623e41d09dSXin LI# This is also used for loading .nds files using the MSET exploit on 3DS.
4633e41d09dSXin LI# Reference: https://github.com/devkitPro/ndstool/blob/master/source/ndscreate.cpp
4643e41d09dSXin LI0xC0	bequad	0xC8604FE201708FE2	Nintendo DS Slot-2 ROM image (PassMe)
465*2dc4dbb9SEitan Adler!:mime	application/x-nintendo-ds-rom
4663e41d09dSXin LI
4673e41d09dSXin LI#------------------------------------------------------------------------------
4683e41d09dSXin LI# ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format.
4693e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
4703e41d09dSXin LI# References:
4713e41d09dSXin LI# - https://neogpc.googlecode.com/svn-history/r10/trunk/src/core/neogpc.cpp
4723e41d09dSXin LI# - http://www.devrs.com/ngp/files/ngpctech.txt
4733e41d09dSXin LI#
4743e41d09dSXin LI0x0A	string	BY\ SNK\ CORPORATION	Neo Geo Pocket
475*2dc4dbb9SEitan Adler!:mime	application/x-neo-geo-pocket-rom
4763e41d09dSXin LI>0x23	byte	0x10			Color
4773e41d09dSXin LI>0	byte	x			ROM image
4783e41d09dSXin LI>0x24	string	>\0			\b: "%.12s"
4793e41d09dSXin LI>0x1F	byte	0xFF			(debug mode enabled)
480b6cee71dSXin LI
481b6cee71dSXin LI#------------------------------------------------------------------------------
482b6cee71dSXin LI# msx: file(1) magic for MSX game cartridge dumps
483b6cee71dSXin LI# Too simple - MPi
484b6cee71dSXin LI#0 beshort 0x4142 MSX game cartridge dump
485b6cee71dSXin LI
486b6cee71dSXin LI#------------------------------------------------------------------------------
487b6cee71dSXin LI# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) :
488b6cee71dSXin LI0	string	PS-X\ EXE	Sony Playstation executable
4893e41d09dSXin LI>16	lelong	x		PC=0x%08x,
4903e41d09dSXin LI>20	lelong	!0		GP=0x%08x,
4913e41d09dSXin LI>24	lelong	!0		.text=[0x%08x,
4923e41d09dSXin LI>>28	lelong	x		\b0x%x],
4933e41d09dSXin LI>32	lelong	!0		.data=[0x%08x,
4943e41d09dSXin LI>>36	lelong	x		\b0x%x],
4953e41d09dSXin LI>40	lelong	!0		.bss=[0x%08x,
4963e41d09dSXin LI>>44	lelong	x		\b0x%x],
4973e41d09dSXin LI>48	lelong	!0		Stack=0x%08x,
4983e41d09dSXin LI>48	lelong	=0		No Stack!,
4993e41d09dSXin LI>52	lelong	!0		StackSize=0x%x,
5003e41d09dSXin LI#>76	string	>\0		(%s)
501b6cee71dSXin LI#  Area:
502b6cee71dSXin LI>113	string	x		(%s)
503b6cee71dSXin LI
5043e41d09dSXin LI# CPE executables
5053e41d09dSXin LI0	string	CPE		CPE executable
5063e41d09dSXin LI>3	byte	x		(version %d)
5073e41d09dSXin LI
508b6cee71dSXin LI#------------------------------------------------------------------------------
509b6cee71dSXin LI# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>)
510b6cee71dSXin LI0       string          XBEH            XBE, Microsoft Xbox executable
511b6cee71dSXin LI# probabilistic checks whether signed or not
512b6cee71dSXin LI>0x0004 ulelong =0x0
513b6cee71dSXin LI>>&2    ulelong =0x0
514b6cee71dSXin LI>>>&2   ulelong =0x0  \b, not signed
515b6cee71dSXin LI>0x0004 ulelong >0
516b6cee71dSXin LI>>&2    ulelong >0
517b6cee71dSXin LI>>>&2   ulelong >0    \b, signed
518b6cee71dSXin LI# expect base address of 0x10000
519b6cee71dSXin LI>0x0104               ulelong =0x10000
520b6cee71dSXin LI>>(0x0118-0x0FF60)    ulelong&0x80000007  0x80000007 \b, all regions
521b6cee71dSXin LI>>(0x0118-0x0FF60)    ulelong&0x80000007  !0x80000007
522b6cee71dSXin LI>>>(0x0118-0x0FF60)   ulelong >0           (regions:
523b6cee71dSXin LI>>>>(0x0118-0x0FF60)  ulelong &0x00000001  NA
524b6cee71dSXin LI>>>>(0x0118-0x0FF60)  ulelong &0x00000002  Japan
525b6cee71dSXin LI>>>>(0x0118-0x0FF60)  ulelong &0x00000004  Rest_of_World
526b6cee71dSXin LI>>>>(0x0118-0x0FF60)  ulelong &0x80000000  Manufacturer
527b6cee71dSXin LI>>>(0x0118-0x0FF60)   ulelong >0           \b)
528b6cee71dSXin LI
529b6cee71dSXin LI# --------------------------------
530b6cee71dSXin LI# Microsoft Xbox data file formats
531b6cee71dSXin LI0       string          XIP0            XIP, Microsoft Xbox data
532b6cee71dSXin LI0       string          XTF0            XTF, Microsoft Xbox data
533b6cee71dSXin LI
534b6cee71dSXin LI# Atari Lynx cartridge dump (EXE/BLL header)
535b6cee71dSXin LI# From: "Stefan A. Haubenthal" <polluks@web.de>
536b6cee71dSXin LI
537b6cee71dSXin LI# Double-check that the image type matches too, 0x8008 conflicts with
538b6cee71dSXin LI# 8 character OMF-86 object file headers.
539b6cee71dSXin LI0	beshort		0x8008
540b6cee71dSXin LI>6	string		BS93		Lynx homebrew cartridge
541*2dc4dbb9SEitan Adler!:mime	application/x-atari-lynx-rom
542b6cee71dSXin LI>>2	beshort		x		\b, RAM start $%04x
543b6cee71dSXin LI>6	string		LYNX		Lynx cartridge
544*2dc4dbb9SEitan Adler!:mime	application/x-atari-lynx-rom
545b6cee71dSXin LI>>2	beshort		x		\b, RAM start $%04x
546b6cee71dSXin LI
547b6cee71dSXin LI# Opera file system that is used on the 3DO console
548b6cee71dSXin LI# From: Serge van den Boom <svdb@stack.nl>
549b6cee71dSXin LI0	string		\x01ZZZZZ\x01	3DO "Opera" file system
550b6cee71dSXin LI
55158a0f0d0SEitan Adler# From: Alex Myczko <alex@aiei.ch>
5525f0216bdSXin LI# From: David Pflug <david@pflug.email>
5535f0216bdSXin LI# is the offset 12 or the offset 16 correct?
5545f0216bdSXin LI# GBS (Game Boy Sound) magic
5555f0216bdSXin LI# ftp://ftp.modland.com/pub/documents/format_documentation/\
5565f0216bdSXin LI# Gameboy%20Sound%20System%20(.gbs).txt
557b6cee71dSXin LI0	string		GBS		Nintendo Gameboy Music/Audio Data
5585f0216bdSXin LI#12	string		GameBoy\ Music\ Module	Nintendo Gameboy Music Module
559*2dc4dbb9SEitan Adler>16	string		>\0	("%.32s" by
560*2dc4dbb9SEitan Adler>48	string		>\0	%.32s, copyright
561*2dc4dbb9SEitan Adler>80	string		>\0	%.32s),
562*2dc4dbb9SEitan Adler>3	byte		x	version %u,
563*2dc4dbb9SEitan Adler>4	byte		x	%u tracks
564b6cee71dSXin LI
56540427ccaSGordon Tetlow# IPS Patch Files from: From: Thomas Klausner <tk@giga.or.at>
56640427ccaSGordon Tetlow# see http://zerosoft.zophar.net/ips.php
56740427ccaSGordon Tetlow0	string	PATCH			IPS patch file
56840427ccaSGordon Tetlow
569b6cee71dSXin LI# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at>
570b6cee71dSXin LI0	string	PPF30			Playstation Patch File version 3.0
571b6cee71dSXin LI>5	byte	0			\b, PPF 1.0 patch
572b6cee71dSXin LI>5	byte	1			\b, PPF 2.0 patch
573b6cee71dSXin LI>5	byte	2			\b, PPF 3.0 patch
574b6cee71dSXin LI>>56	byte	0			\b, Imagetype BIN (any)
575b6cee71dSXin LI>>56	byte	1			\b, Imagetype GI (PrimoDVD)
576b6cee71dSXin LI>>57	byte	0			\b, Blockcheck disabled
577b6cee71dSXin LI>>57	byte	1			\b, Blockcheck enabled
578b6cee71dSXin LI>>58	byte	0			\b, Undo data not available
579b6cee71dSXin LI>>58	byte	1			\b, Undo data available
580b6cee71dSXin LI>6	string	x			\b, description: %s
581b6cee71dSXin LI
582b6cee71dSXin LI0	string	PPF20			Playstation Patch File version 2.0
583b6cee71dSXin LI>5	byte	0			\b, PPF 1.0 patch
584b6cee71dSXin LI>5	byte	1			\b, PPF 2.0 patch
585b6cee71dSXin LI>>56	lelong	>0			\b, size of file to patch %d
586b6cee71dSXin LI>6	string	x			\b, description: %s
587b6cee71dSXin LI
588b6cee71dSXin LI0	string	PPF10			Playstation Patch File version 1.0
589b6cee71dSXin LI>5	byte	0			\b, Simple Encoding
590b6cee71dSXin LI>6	string	x			\b, description: %s
591b6cee71dSXin LI
592b6cee71dSXin LI# From: Daniel Dawson <ddawson@icehouse.net>
593b6cee71dSXin LI# SNES9x .smv "movie" file format.
594b6cee71dSXin LI0		string		SMV\x1A	SNES9x input recording
595b6cee71dSXin LI>0x4		lelong		x	\b, version %d
596b6cee71dSXin LI# version 4 is latest so far
597b6cee71dSXin LI>0x4		lelong		<5
598b6cee71dSXin LI>>0x8		ledate		x	\b, recorded at %s
599b6cee71dSXin LI>>0xc		lelong		>0	\b, rerecorded %d times
600b6cee71dSXin LI>>0x10		lelong		x	\b, %d frames long
601b6cee71dSXin LI>>0x14		byte		>0	\b, data for controller(s):
602b6cee71dSXin LI>>>0x14		byte		&0x1	#1
603b6cee71dSXin LI>>>0x14		byte		&0x2	#2
604b6cee71dSXin LI>>>0x14		byte		&0x4	#3
605b6cee71dSXin LI>>>0x14		byte		&0x8	#4
606b6cee71dSXin LI>>>0x14		byte		&0x10	#5
607b6cee71dSXin LI>>0x15		byte		^0x1	\b, begins from snapshot
608b6cee71dSXin LI>>0x15		byte		&0x1	\b, begins from reset
609b6cee71dSXin LI>>0x15		byte		^0x2	\b, NTSC standard
610b6cee71dSXin LI>>0x15		byte		&0x2	\b, PAL standard
611b6cee71dSXin LI>>0x17		byte		&0x1    \b, settings:
612b6cee71dSXin LI# WIP1Timing not used as of version 4
613b6cee71dSXin LI>>>0x4		lelong		<4
614b6cee71dSXin LI>>>>0x17	byte		&0x2	WIP1Timing
615b6cee71dSXin LI>>>0x17		byte		&0x4	Left+Right
616b6cee71dSXin LI>>>0x17		byte		&0x8	VolumeEnvX
617b6cee71dSXin LI>>>0x17		byte		&0x10	FakeMute
618b6cee71dSXin LI>>>0x17		byte		&0x20	SyncSound
619b6cee71dSXin LI# New flag as of version 4
620b6cee71dSXin LI>>>0x4		lelong		>3
621b6cee71dSXin LI>>>>0x17	byte		&0x80	NoCPUShutdown
622b6cee71dSXin LI>>0x4		lelong		<4
623b6cee71dSXin LI>>>0x18		lelong		>0x23
624b6cee71dSXin LI>>>>0x20	leshort		!0
625b6cee71dSXin LI>>>>>0x20	lestring16	x	\b, metadata: "%s"
626b6cee71dSXin LI>>0x4		lelong		>3
627b6cee71dSXin LI>>>0x24		byte		>0	\b, port 1:
628b6cee71dSXin LI>>>>0x24	byte		1	joypad
629b6cee71dSXin LI>>>>0x24	byte		2	mouse
630b6cee71dSXin LI>>>>0x24	byte		3	SuperScope
631b6cee71dSXin LI>>>>0x24	byte		4	Justifier
632b6cee71dSXin LI>>>>0x24	byte		5	multitap
633b6cee71dSXin LI>>>0x24		byte		>0	\b, port 2:
634b6cee71dSXin LI>>>>0x25	byte		1	joypad
635b6cee71dSXin LI>>>>0x25	byte		2	mouse
636b6cee71dSXin LI>>>>0x25	byte		3	SuperScope
637b6cee71dSXin LI>>>>0x25	byte		4	Justifier
638b6cee71dSXin LI>>>>0x25	byte		5	multitap
639b6cee71dSXin LI>>>0x18		lelong		>0x43
640b6cee71dSXin LI>>>>0x40	leshort		!0
641b6cee71dSXin LI>>>>>0x40	lestring16	x	\b, metadata: "%s"
642b6cee71dSXin LI>>0x17		byte		&0x40   \b, ROM:
643b6cee71dSXin LI>>>(0x18.l-26)	lelong		x	CRC32 0x%08x
644b6cee71dSXin LI>>>(0x18.l-23)	string		x	"%s"
645b6cee71dSXin LI
646b6cee71dSXin LI# Type: scummVM savegame files
647b6cee71dSXin LI# From: Sven Hartge <debian@ds9.argh.org>
648b6cee71dSXin LI0	string	SCVM	ScummVM savegame
649b6cee71dSXin LI>12	string	>\0	"%s"
6503e41d09dSXin LI
6513e41d09dSXin LI#------------------------------------------------------------------------------
6523e41d09dSXin LI# Nintendo GameCube / Wii file formats.
6533e41d09dSXin LI#
6543e41d09dSXin LI
6553e41d09dSXin LI# Type: Nintendo GameCube/Wii common disc header data.
6563e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
6573e41d09dSXin LI# Reference: http://wiibrew.org/wiki/Wii_Disc
6583e41d09dSXin LI0	name	nintendo-gcn-disc-common
6593e41d09dSXin LI>0x20	string	x	"%.64s"
6603e41d09dSXin LI>0x00	string	x	(%.6s
6613e41d09dSXin LI>0x06	byte	>0
6623e41d09dSXin LI>>0x06	byte	1	\b, Disc 2
6633e41d09dSXin LI>>0x06	byte	2	\b, Disc 3
6643e41d09dSXin LI>>0x06	byte	3	\b, Disc 4
6653e41d09dSXin LI>0x07	byte	x	\b, Rev.%02u)
666*2dc4dbb9SEitan Adler>0x18	belong	0x5D1C9EA3
667*2dc4dbb9SEitan Adler>>0x60	beshort	0x0101	\b (Unencrypted)
6683e41d09dSXin LI
6693e41d09dSXin LI# Type: Nintendo GameCube disc image
6703e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
6713e41d09dSXin LI# Reference: http://wiibrew.org/wiki/Wii_Disc
6723e41d09dSXin LI0x1C	belong	0xC2339F3D	Nintendo GameCube disc image:
673*2dc4dbb9SEitan Adler!:mime	application/x-gamecube-rom
6743e41d09dSXin LI>0	use	nintendo-gcn-disc-common
6753e41d09dSXin LI
676282e23f0SXin LI# Type: Nintendo GameCube embedded disc image
677282e23f0SXin LI# Commonly found on demo discs.
678282e23f0SXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
679282e23f0SXin LI# Reference: http://hitmen.c02.at/files/yagcd/yagcd/index.html#idx14.8
680282e23f0SXin LI0		belong	0xAE0F38A2
681282e23f0SXin LI>0x0C		belong	0x00100000
682282e23f0SXin LI>>(8.L+0x1C)	belong	0xC2339F3D	Nintendo GameCube embedded disc image:
683*2dc4dbb9SEitan Adler!:mime	application/x-gamecube-rom
684282e23f0SXin LI>>>(8.L)	use	nintendo-gcn-disc-common
685282e23f0SXin LI
6863e41d09dSXin LI# Type: Nintendo Wii disc image
6873e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
6883e41d09dSXin LI# Reference: http://wiibrew.org/wiki/Wii_Disc
6893e41d09dSXin LI0x18	belong	0x5D1C9EA3	Nintendo Wii disc image:
6903e41d09dSXin LI>0	use	nintendo-gcn-disc-common
6913e41d09dSXin LI
6923e41d09dSXin LI# Type: Nintendo Wii disc image (WBFS format)
6933e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
6943e41d09dSXin LI# Reference: http://wiibrew.org/wiki/Wii_Disc
6953e41d09dSXin LI0	string	WBFS
6963e41d09dSXin LI>0x218	belong	0x5D1C9EA3	Nintendo Wii disc image (WBFS format):
697*2dc4dbb9SEitan Adler!:mime	application/x-wii-rom
6983e41d09dSXin LI>>0x200	use	nintendo-gcn-disc-common
6993e41d09dSXin LI
70040427ccaSGordon Tetlow# Type: Nintendo GameCube/Wii disc image (CISO format)
70140427ccaSGordon Tetlow# NOTE: This is NOT the same as Compact ISO or PSP CISO,
70240427ccaSGordon Tetlow# though it has the same magic number.
70340427ccaSGordon Tetlow0		string	CISO
70440427ccaSGordon Tetlow# Other fields are used to determine what type of CISO this is:
70540427ccaSGordon Tetlow# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size)
70640427ccaSGordon Tetlow# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size)
70740427ccaSGordon Tetlow# - None of the above: Compact ISO.
70840427ccaSGordon Tetlow>4		lelong	0x200000
70940427ccaSGordon Tetlow>>8		byte	1
71040427ccaSGordon Tetlow>>>0x801C	belong	0xC2339F3D	Nintendo GameCube disc image (CISO format):
711*2dc4dbb9SEitan Adler!:mime	application/x-wii-rom
71240427ccaSGordon Tetlow>>>>0x8000	use	nintendo-gcn-disc-common
71340427ccaSGordon Tetlow>>>0x8018	belong	0x5D1C9EA3	Nintendo Wii disc image (CISO format):
714*2dc4dbb9SEitan Adler!:mime	application/x-wii-rom
71540427ccaSGordon Tetlow>>>>0x8000	use	nintendo-gcn-disc-common
71640427ccaSGordon Tetlow
71740427ccaSGordon Tetlow# Type: Nintendo GameCube/Wii disc image (GCZ format)
71840427ccaSGordon Tetlow# Due to zlib compression, we can't get the actual disc information.
71940427ccaSGordon Tetlow0	lelong	0xB10BC001
72040427ccaSGordon Tetlow>4	lelong	0		Nintendo GameCube disc image (GCZ format)
721*2dc4dbb9SEitan Adler!:mime	application/x-gamecube-rom
72240427ccaSGordon Tetlow>4	lelong	1		Nintendo Wii disc image (GCZ format)
723*2dc4dbb9SEitan Adler!:mime	application/x-wii-rom
724*2dc4dbb9SEitan Adler>4	default	x		Nintendo GameCube/Wii disc image (GCZ format)
72540427ccaSGordon Tetlow
72640427ccaSGordon Tetlow# Type: Nintendo GameCube/Wii disc image (WDF format)
72740427ccaSGordon Tetlow0		string	WII\001DISC
72840427ccaSGordon Tetlow>8		belong	1
72940427ccaSGordon Tetlow# WDFv1
73040427ccaSGordon Tetlow>>0x54		belong	0xC2339F3D	Nintendo GameCube disc image (WDFv1 format):
731*2dc4dbb9SEitan Adler!:mime	application/x-gamecube-rom
73240427ccaSGordon Tetlow>>>0x38		use	nintendo-gcn-disc-common
73340427ccaSGordon Tetlow>>0x58		belong	0x5D1C9EA3	Nintendo Wii disc image (WDFv1 format):
734*2dc4dbb9SEitan Adler!:mime	application/x-wii-rom
73540427ccaSGordon Tetlow>>>0x38		use	nintendo-gcn-disc-common
73640427ccaSGordon Tetlow>8		belong	2
73740427ccaSGordon Tetlow# WDFv2
73840427ccaSGordon Tetlow>>(12.L+0x1C)	belong	0xC2339F3D	Nintendo GameCube disc image (WDFv2 format):
739*2dc4dbb9SEitan Adler!:mime	application/x-gamecube-rom
74040427ccaSGordon Tetlow>>>(12.L)	use	nintendo-gcn-disc-common
74140427ccaSGordon Tetlow>>(12.L+0x18)	belong	0x5D1C9EA3	Nintendo Wii disc image (WDFv2 format):
742*2dc4dbb9SEitan Adler!:mime	application/x-wii-rom
74340427ccaSGordon Tetlow>>>(12.L)	use	nintendo-gcn-disc-common
74440427ccaSGordon Tetlow
74540427ccaSGordon Tetlow# Type: Nintendo GameCube/Wii disc image (WIA format)
74640427ccaSGordon Tetlow0	string	WIA\001	Nintendo
74740427ccaSGordon Tetlow>0x48	belong	1	GameCube
748*2dc4dbb9SEitan Adler!:mime	application/x-gamecube-rom
74940427ccaSGordon Tetlow>0x48	belong	2	Wii
750*2dc4dbb9SEitan Adler!:mime	application/x-wii-rom
751*2dc4dbb9SEitan Adler>0x48	default	x	GameCube/Wii
75240427ccaSGordon Tetlow>0x48	belong	x	disc image (WIA format):
75340427ccaSGordon Tetlow>>0x58	use	nintendo-gcn-disc-common
75440427ccaSGordon Tetlow
755*2dc4dbb9SEitan Adler# Type: Nintendo GameCube/Wii disc image (with SDK header)
756*2dc4dbb9SEitan Adler# From: David Korth <gerbilsoft@gerbilsoft.com>
757*2dc4dbb9SEitan Adler# Reference: http://wiibrew.org/wiki/Wii_Disc
758*2dc4dbb9SEitan Adler0		belong	0xFFFF0000
759*2dc4dbb9SEitan Adler>0x18		belong	0x00000000
760*2dc4dbb9SEitan Adler>>0x1C		belong	0x00000000
761*2dc4dbb9SEitan Adler>>>0x8018	belong	0x5D1C9EA3	Nintendo Wii SDK disc image:
762*2dc4dbb9SEitan Adler>>>>0x8000	use	nintendo-gcn-disc-common
763*2dc4dbb9SEitan Adler>>>0x801C	belong	0xC2339F3D	Nintendo GameCube SDK disc image:
764*2dc4dbb9SEitan Adler>>>>0x8000	use	nintendo-gcn-disc-common
765*2dc4dbb9SEitan Adler
7663e41d09dSXin LI#------------------------------------------------------------------------------
7673e41d09dSXin LI# Nintendo 3DS file formats.
7683e41d09dSXin LI#
7693e41d09dSXin LI
7703e41d09dSXin LI# Type: Nintendo 3DS "NCSD" image. (game cards and eMMC)
7713e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
7723e41d09dSXin LI# Reference: https://www.3dbrew.org/wiki/NCSD
7733e41d09dSXin LI0x100		string		NCSD
7743e41d09dSXin LI>0x118		lequad		0		Nintendo 3DS Game Card image
775282e23f0SXin LI# NCCH header for partition 0. (game data)
776282e23f0SXin LI>>0x1150	string		>\0	\b: "%.16s"
777282e23f0SXin LI>>0x312		byte		x	(Rev.%02u)
778282e23f0SXin LI>>0x118C	byte		2	(New3DS only)
7793e41d09dSXin LI>>0x18D		byte		0		(inner device)
7803e41d09dSXin LI>>0x18D		byte		1		(Card1)
7813e41d09dSXin LI>>0x18D		byte		2		(Card2)
7823e41d09dSXin LI>>0x18D		byte		3		(extended device)
7833e41d09dSXin LI>0x118		bequad		0x0102020202000000	Nintendo 3DS eMMC dump (Old3DS)
7843e41d09dSXin LI>0x118		bequad		0x0102020203000000	Nintendo 3DS eMMC dump (New3DS)
7853e41d09dSXin LI
786282e23f0SXin LI# Nintendo 3DS version code.
787282e23f0SXin LI# Reference: https://www.3dbrew.org/wiki/Titles
788282e23f0SXin LI# Format: leshort containing three fields:
789282e23f0SXin LI# - 6-bit: Major
790282e23f0SXin LI# - 6-bit: Minor
791282e23f0SXin LI# - 4-bit: Revision
792282e23f0SXin LI# NOTE: Only supporting major/minor versions from 0-15 right now.
793282e23f0SXin LI# NOTE: Should be prefixed with "v".
794282e23f0SXin LI0	name	nintendo-3ds-version-code
795282e23f0SXin LI# Raw version.
796282e23f0SXin LI>0	leshort	x	\b%u,
797282e23f0SXin LI# Major version.
798282e23f0SXin LI>0	leshort&0xFC00	0x0000	0
799282e23f0SXin LI>0	leshort&0xFC00	0x0400	1
800282e23f0SXin LI>0	leshort&0xFC00	0x0800	2
801282e23f0SXin LI>0	leshort&0xFC00	0x0C00	3
802282e23f0SXin LI>0	leshort&0xFC00	0x1000	4
803282e23f0SXin LI>0	leshort&0xFC00	0x1400	5
804282e23f0SXin LI>0	leshort&0xFC00	0x1800	6
805282e23f0SXin LI>0	leshort&0xFC00	0x1C00	7
806282e23f0SXin LI>0	leshort&0xFC00	0x2000	8
807282e23f0SXin LI>0	leshort&0xFC00	0x2400	9
808282e23f0SXin LI>0	leshort&0xFC00	0x2800	10
809282e23f0SXin LI>0	leshort&0xFC00	0x2C00	11
810282e23f0SXin LI>0	leshort&0xFC00	0x3000	12
811282e23f0SXin LI>0	leshort&0xFC00	0x3400	13
812282e23f0SXin LI>0	leshort&0xFC00	0x3800	14
813282e23f0SXin LI>0	leshort&0xFC00	0x3C00	15
814282e23f0SXin LI# Minor version.
815282e23f0SXin LI>0	leshort&0x03F0	0x0000	\b.0
816282e23f0SXin LI>0	leshort&0x03F0	0x0010	\b.1
817282e23f0SXin LI>0	leshort&0x03F0	0x0020	\b.2
818282e23f0SXin LI>0	leshort&0x03F0	0x0030	\b.3
819282e23f0SXin LI>0	leshort&0x03F0	0x0040	\b.4
820282e23f0SXin LI>0	leshort&0x03F0	0x0050	\b.5
821282e23f0SXin LI>0	leshort&0x03F0	0x0060	\b.6
822282e23f0SXin LI>0	leshort&0x03F0	0x0070	\b.7
823282e23f0SXin LI>0	leshort&0x03F0	0x0080	\b.8
824282e23f0SXin LI>0	leshort&0x03F0	0x0090	\b.9
825282e23f0SXin LI>0	leshort&0x03F0	0x00A0	\b.10
826282e23f0SXin LI>0	leshort&0x03F0	0x00B0	\b.11
827282e23f0SXin LI>0	leshort&0x03F0	0x00C0	\b.12
828282e23f0SXin LI>0	leshort&0x03F0	0x00D0	\b.13
829282e23f0SXin LI>0	leshort&0x03F0	0x00E0	\b.14
830282e23f0SXin LI>0	leshort&0x03F0	0x00F0	\b.15
831282e23f0SXin LI# Revision.
832282e23f0SXin LI>0	leshort&0x000F	x	\b.%u
833282e23f0SXin LI
8343e41d09dSXin LI# Type: Nintendo 3DS "NCCH" container.
8353e41d09dSXin LI# https://www.3dbrew.org/wiki/NCCH
8363e41d09dSXin LI0x100		string	NCCH	Nintendo 3DS
8373e41d09dSXin LI>0x18D		byte&2	0	File Archive (CFA)
8383e41d09dSXin LI>0x18D		byte&2	2	Executable Image (CXI)
839282e23f0SXin LI>0x150		string	>\0	\b: "%.16s"
840282e23f0SXin LI>0x18D		byte	0x05
841282e23f0SXin LI>>0x10E		leshort	x	(Old3DS System Update v
842282e23f0SXin LI>>0x10E		use	nintendo-3ds-version-code
843282e23f0SXin LI>>0x10E		leshort	x	\b)
844282e23f0SXin LI>0x18D		byte	0x15
845282e23f0SXin LI>>0x10E		leshort	x	(New3DS System Update v
846282e23f0SXin LI>>0x10E		use	nintendo-3ds-version-code
847282e23f0SXin LI>>0x10E		leshort	x	\b)
848282e23f0SXin LI>0x18D		byte	!0x05
849282e23f0SXin LI>>0x18D		byte	!0x15
850282e23f0SXin LI>>>0x112	byte	x	(v
851282e23f0SXin LI>>>0x112	use	nintendo-3ds-version-code
852282e23f0SXin LI>>>0x112	byte	x	\b)
853282e23f0SXin LI>0x18C		byte	2	(New3DS only)
8543e41d09dSXin LI
8553e41d09dSXin LI# Type: Nintendo 3DS "SMDH" file. (application description)
8563e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
8573e41d09dSXin LI# Reference: https://3dbrew.org/wiki/SMDH
8583e41d09dSXin LI0		string		SMDH		Nintendo 3DS SMDH file
8593e41d09dSXin LI>0x208		leshort		!0
8603e41d09dSXin LI>>0x208		lestring16	x		\b: "%.128s"
8613e41d09dSXin LI>>0x388		leshort		!0
8623e41d09dSXin LI>>>0x388	lestring16	x		by %.128s
8633e41d09dSXin LI>0x208		leshort		0
8643e41d09dSXin LI>>0x008		leshort		!0
8653e41d09dSXin LI>>>0x008	lestring16	x		\b: "%.128s"
8663e41d09dSXin LI>>>0x188	leshort		!0
8673e41d09dSXin LI>>>>0x188	lestring16	x		by %.128s
8683e41d09dSXin LI
8693e41d09dSXin LI# Type: Nintendo 3DS Homebrew Application.
8703e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
87140427ccaSGordon Tetlow# Reference: https://3dbrew.org/wiki/3DSX_Format
8723e41d09dSXin LI0	string	3DSX	Nintendo 3DS Homebrew Application (3DSX)
8733e41d09dSXin LI
8743e41d09dSXin LI#------------------------------------------------------------------------------
8753e41d09dSXin LI# a7800: file(1) magic for the Atari 7800 raw ROM format.
8763e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
8773e41d09dSXin LI# Reference: https://sites.google.com/site/atari7800wiki/a78-header
8783e41d09dSXin LI
8793e41d09dSXin LI0	byte	>0
8803e41d09dSXin LI>0	byte	<3
8813e41d09dSXin LI>>1	string	ATARI7800	Atari 7800 ROM image
882*2dc4dbb9SEitan Adler!:mime	application/x-atari-7800-rom
8833e41d09dSXin LI>>>0x11	string	>\0	\b: "%.32s"
8843e41d09dSXin LI# Display type.
8853e41d09dSXin LI>>>0x39	byte	0	(NTSC)
8863e41d09dSXin LI>>>0x39	byte	1	(PAL)
8873e41d09dSXin LI>>>0x36	byte&1	1	(POKEY)
8883e41d09dSXin LI
8893e41d09dSXin LI#------------------------------------------------------------------------------
8903e41d09dSXin LI# vectrex: file(1) magic for the GCE Vectrex raw ROM format.
8913e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com>
8923e41d09dSXin LI# Reference: http://www.playvectrex.com/designit/chrissalo/hello1.htm
8933e41d09dSXin LI#
8943e41d09dSXin LI# NOTE: Title is terminated with 0x80, not 0.
8953e41d09dSXin LI# The header is terminated with a 0, so that will
8963e41d09dSXin LI# terminate the title as well.
8973e41d09dSXin LI#
8983e41d09dSXin LI0	string	g\ GCE	Vectrex ROM image
8993e41d09dSXin LI>0x11	string	>\0	\b: "%.16s"
90040427ccaSGordon Tetlow
90140427ccaSGordon Tetlow#------------------------------------------------------------------------------
90240427ccaSGordon Tetlow# amiibo: file(1) magic for Nintendo amiibo NFC dumps.
90340427ccaSGordon Tetlow# From: David Korth <gerbilsoft@gerbilsoft.com>
90440427ccaSGordon Tetlow# Reference: https://www.3dbrew.org/wiki/Amiibo
90540427ccaSGordon Tetlow0x00		byte	0x04
90640427ccaSGordon Tetlow>0x0A		beshort	0x0FE0
90740427ccaSGordon Tetlow>>0x0C		belong	0xF110FFEE
90840427ccaSGordon Tetlow>>>0x208	beshort	0x0100
90940427ccaSGordon Tetlow>>>>0x020A	byte	0x0F
91040427ccaSGordon Tetlow>>>>>0x020C	bequad	0x000000045F000000
91140427ccaSGordon Tetlow>>>>>>0x5B	byte	0x02
91240427ccaSGordon Tetlow>>>>>>>0x54	belong	x	Nintendo amiibo NFC dump - amiibo ID: %08X-
91340427ccaSGordon Tetlow>>>>>>>0x58	belong	x	\b%08X
914