console revision 302555
1
2#------------------------------------------------------------------------------
3# $File: console,v 1.26 2016/06/12 15:20:37 christos Exp $
4# Console game magic
5# Toby Deshane <hac@shoelace.digivill.net>
6
7# ines: file(1) magic for Marat's iNES Nintendo Entertainment System ROM dump format
8# Updated by David Korth <gerbilsoft@gerbilsoft.com>
9# References:
10# - http://wiki.nesdev.com/w/index.php/INES
11# - http://wiki.nesdev.com/w/index.php/NES_2.0
120	string		NES\x1A		iNES ROM image
13>7	byte&0x0C	=0x8		(NES 2.0)
14>4	byte		x		\b: %ux16k PRG
15>5	byte		x		\b, %ux16k CHR
16>6	byte&0x08	=0x8		[4-Scr]
17>6	byte&0x09	=0x0		[H-mirror]
18>6	byte&0x09	=0x1		[V-mirror]
19>6	byte&0x02	=0x2		[SRAM]
20>6	byte&0x04	=0x4		[Trainer]
21>7	byte&0x03	=0x2		[PC10]
22>7	byte&0x03	=0x1		[VS
23>>7	byte&0x0C	=0x8
24# NES 2.0: VS PPU
25>>>13	byte&0x0F	=0x0		\b, RP2C03B
26>>>13	byte&0x0F	=0x1		\b, RP2C03G
27>>>13	byte&0x0F	=0x2		\b, RP2C04-0001
28>>>13	byte&0x0F	=0x3		\b, RP2C04-0002
29>>>13	byte&0x0F	=0x4		\b, RP2C04-0003
30>>>13	byte&0x0F	=0x5		\b, RP2C04-0004
31>>>13	byte&0x0F	=0x6		\b, RP2C03B
32>>>13	byte&0x0F	=0x7		\b, RP2C03C
33>>>13	byte&0x0F	=0x8		\b, RP2C05-01
34>>>13	byte&0x0F	=0x9		\b, RP2C05-02
35>>>13	byte&0x0F	=0xA		\b, RP2C05-03
36>>>13	byte&0x0F	=0xB		\b, RP2C05-04
37>>>13	byte&0x0F	=0xC		\b, RP2C05-05
38# TODO: VS protection hardware?
39>>7	byte		x		\b]
40# NES 2.0-specific flags.
41>7	byte&0x0C	=0x8
42>>12	byte&0x03	=0x0		[NTSC]
43>>12	byte&0x03	=0x1		[PAL]
44>>12	byte&0x02	=0x2		[NTSC+PAL]
45
46#------------------------------------------------------------------------------
47# unif: file(1) magic for UNIF-format Nintendo Entertainment System ROM images
48# Reference: http://wiki.nesdev.com/w/index.php/UNIF
49# From: David Korth <gerbilsoft@gerbilsoft.com>
50# TODO commit on 2016/03/21
51#
52# NOTE: The UNIF format uses chunks instead of a fixed header,
53# so most of the data isn't easily parseable.
54#
550	string	UNIF
56>4	lelong	<16	UNIF v%d format NES ROM image
57
58#------------------------------------------------------------------------------
59# fds: file(1) magic for Famciom Disk System disk images
60# Reference: http://wiki.nesdev.com/w/index.php/Family_Computer_Disk_System#.FDS_format
61# From: David Korth <gerbilsoft@gerbilsoft.com>
62# TODO: Check "Disk info block" and get info from that in addition to the optional header.
63
64# Disk info block. (block 1)
650	name	nintendo-fds-disk-info-block
66>1	string	*NINTENDO-HVC*	Famicom Disk System disk image:
67>23	byte	!1		FMC-
68>23	byte	1		FSC-
69>16	string	x		\b%.3s
70>15	byte	x		\b, mfr 0x%02X
71>20	byte	x		(Rev.%02u)
72
73# Headered version.
740	string	FDS\x1A
75>0x11	string	*NINTENDO-HVC*
76>>0x10	use	nintendo-fds-disk-info-block
77>4	byte	1	(%u side)
78>4	byte	!1	(%u sides)
79
80# Unheadered version.
811	string	*NINTENDO-HVC*
82>0	use	nintendo-fds-disk-info-block
83
84#------------------------------------------------------------------------------
85# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format
86# Reference: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header
87#
880x104		bequad		0xCEED6666CC0D000B	Game Boy ROM image
89>0x143		byte&0x80	0x80
90>>0x134		string		>\0			\b: "%.15s"
91>0x143		byte&0x80	!0x80
92>>0x134		string		>\0			\b: "%.16s"
93>0x14c		byte		x			(Rev.%02u)
94
95# Machine type. (SGB, CGB, SGB+CGB)
96>0x14b		byte		0x33
97>>0x146		byte		0x03
98>>>0x143	byte&0x80	0x80	[SGB+CGB]
99>>>0x143	byte&0x80	!0x80	[SGB]
100>>0x146		byte		!0x03
101>>>0x143	byte&0xC0	0x80	[CGB]
102>>>0x143	byte&0xC0	0xC0	[CGB ONLY]
103
104# Mapper.
105>0x147 byte 0x00  [ROM ONLY]
106>0x147 byte 0x01  [MBC1]
107>0x147 byte 0x02  [MBC1+RAM]
108>0x147 byte 0x03  [MBC1+RAM+BATT]
109>0x147 byte 0x05  [MBC2]
110>0x147 byte 0x06  [MBC2+BATTERY]
111>0x147 byte 0x08  [ROM+RAM]
112>0x147 byte 0x09  [ROM+RAM+BATTERY]
113>0x147 byte 0x0B  [MMM01]
114>0x147 byte 0x0C  [MMM01+SRAM]
115>0x147 byte 0x0D  [MMM01+SRAM+BATT]
116>0x147 byte 0x0F  [MBC3+TIMER+BATT]
117>0x147 byte 0x10  [MBC3+TIMER+RAM+BATT]
118>0x147 byte 0x11  [MBC3]
119>0x147 byte 0x12  [MBC3+RAM]
120>0x147 byte 0x13  [MBC3+RAM+BATT]
121>0x147 byte 0x19  [MBC5]
122>0x147 byte 0x1A  [MBC5+RAM]
123>0x147 byte 0x1B  [MBC5+RAM+BATT]
124>0x147 byte 0x1C  [MBC5+RUMBLE]
125>0x147 byte 0x1D  [MBC5+RUMBLE+SRAM]
126>0x147 byte 0x1E  [MBC5+RUMBLE+SRAM+BATT]
127>0x147 byte 0xFC  [Pocket Camera]
128>0x147 byte 0xFD  [Bandai TAMA5]
129>0x147 byte 0xFE  [Hudson HuC-3]
130>0x147 byte 0xFF  [Hudson HuC-1]
131
132# ROM size.
133>0x148 byte 0     \b, ROM: 256Kbit
134>0x148 byte 1     \b, ROM: 512Kbit
135>0x148 byte 2     \b, ROM: 1Mbit
136>0x148 byte 3     \b, ROM: 2Mbit
137>0x148 byte 4     \b, ROM: 4Mbit
138>0x148 byte 5     \b, ROM: 8Mbit
139>0x148 byte 6     \b, ROM: 16Mbit
140>0x148 byte 7     \b, ROM: 32Mbit
141>0x148 byte 0x52  \b, ROM: 9Mbit
142>0x148 byte 0x53  \b, ROM: 10Mbit
143>0x148 byte 0x54  \b, ROM: 12Mbit
144
145# RAM size.
146>0x149 byte 1     \b, RAM: 16Kbit
147>0x149 byte 2     \b, RAM: 64Kbit
148>0x149 byte 3     \b, RAM: 128Kbit
149>0x149 byte 4     \b, RAM: 1Mbit
150>0x149 byte 5     \b, RAM: 512Kbit
151
152#------------------------------------------------------------------------------
153# genesis: file(1) magic for various Sega Mega Drive / Genesis ROM image and disc formats
154# Updated by David Korth <gerbilsoft@gerbilsoft.com>
155# References:
156# - http://www.retrodev.com/segacd.html
157# - http://devster.monkeeh.com/sega/32xguide1.txt
158#
159
160# Common Sega Mega Drive header format.
161# FIXME: Name fields are 48 bytes, but have spaces for padding instead of 00s.
1620		name	sega-mega-drive-header
163# ROM title. (Use domestic if present; if not, use international.)
164>0x120		byte	>0x20
165>>0x120		string	>\0	\b: "%.16s"
166>0x120		byte	<0x21
167>>0x150		string	>\0	\b: "%.16s"
168# Other information.
169>0x180		string	>\0	(%.14s
170>>0x110		string  >\0	\b, %.16s
171>0x180		byte	0
172>>0x110		string  >\0	(%.16s
173>0		byte	x	\b)
174
175# TODO: Check for 32X CD?
176# Sega Mega CD disc images: 2048-byte sectors.
1770	string	SEGADISCSYSTEM\ \ 	Sega Mega CD disc image
178>0	use	sega-mega-drive-header
179>0	byte	x			\b, 2048-byte sectors
1800	string	SEGABOOTDISC\ \ \ \ 	Sega Mega CD disc image
181>0	use	sega-mega-drive-header
182>0	byte	x			\b, 2048-byte sectors
183# Sega Mega CD disc images: 2352-byte sectors.
1840x10	string	SEGADISCSYSTEM\ \ 	Sega Mega CD disc image
185>0x10	use	sega-mega-drive-header
186>0	byte	x			\b, 2352-byte sectors
1870x10	string	SEGABOOTDISC\ \ \ \ 	Sega Mega CD disc image
188>0x10	use	sega-mega-drive-header
189>0	byte	x			\b, 2352-byte sectors
190
191# Sega Mega Drive, 32X, Pico, and Mega CD Boot ROM images.
1920x100		string	SEGA
193>0x3C0		bequad	0x4D41525320434845	Sega 32X ROM image
194>>0		use	sega-mega-drive-header
195>0x3C0		bequad	!0x4D41525320434845
196>>0x105		belong	0x5049434F	Sega Pico ROM image
197>>>0		use	sega-mega-drive-header
198>>0x105		belong	!0x5049434F
199>>>0x180	beshort	0x4252		Sega Mega CD Boot ROM image
200>>>0x180	beshort	!0x4252		Sega Mega Drive / Genesis ROM image
201>>>0		use	sega-mega-drive-header
202
203#------------------------------------------------------------------------------
204# genesis: file(1) magic for the Super MegaDrive ROM dump format
205#
206
207# NOTE: Due to interleaving, we can't display anything
208# other than the copier header information.
2090      name    sega-genesis-smd-header
210>0     byte    x       %dx16k blocks
211>2     byte    0       \b, last in series or standalone
212>2     byte    >0      \b, split ROM
213
214# "Sega Genesis" header.
2150x280	string EAGN
216>8	beshort	0xAABB	Sega Mega Drive / Genesis ROM image (SMD format):
217>>0	use     sega-genesis-smd-header
218
219# "Sega Mega Drive" header.
2200x280	string EAMG
221>8	beshort	0xAABB	Sega Mega Drive / Genesis ROM image (SMD format):
222>>0	use     sega-genesis-smd-header
223
224#------------------------------------------------------------------------------
225# smsgg:  file(1) magic for Sega Master System and Game Gear ROM images
226# Detects all Game Gear and export Sega Master System ROM images,
227# and some Japanese Sega Master System ROM images.
228# From: David Korth <gerbilsoft@gerbilsoft.com>
229# Reference: http://www.smspower.org/Development/ROMHeader
230#
231
232# General SMS header rule.
233# The SMS boot ROM checks the header at three locations.
2340	name	sega-master-system-rom-header
235# Machine type.
236>0x0F	byte&0xF0	0x30	Sega Master System
237>0x0F	byte&0xF0	0x40	Sega Master System
238>0x0F	byte&0xF0	0x50	Sega Game Gear
239>0x0F	byte&0xF0	0x60	Sega Game Gear
240>0x0F	byte&0xF0	0x70	Sega Game Gear
241>0x0F	byte&0xF0	<0x30	Sega Master System / Game Gear
242>0x0F	byte&0xF0	>0x70	Sega Master System / Game Gear
243>0	byte		x	ROM image:
244# Product code.
245>0x0E	byte&0xF0	0x10	1
246>0x0E	byte&0xF0	0x20	2
247>0x0E	byte&0xF0	0x30	3
248>0x0E	byte&0xF0	0x40	4
249>0x0E	byte&0xF0	0x50	5
250>0x0E	byte&0xF0	0x60	6
251>0x0E	byte&0xF0	0x70	7
252>0x0E	byte&0xF0	0x80	8
253>0x0E	byte&0xF0	0x90	9
254>0x0E	byte&0xF0	0xA0	10
255>0x0E	byte&0xF0	0xB0	11
256>0x0E	byte&0xF0	0xC0	12
257>0x0E	byte&0xF0	0xD0	13
258>0x0E	byte&0xF0	0xE0	14
259>0x0E	byte&0xF0	0xF0	15
260# If the product code is 5 digits, we'll need to backspace here.
261>0x0E	byte&0xF0	!0
262>>0x0C	leshort		x	\b%04x
263>0x0E	byte&0xF0	0
264>>0x0C	leshort		x	%04x
265# Revision.
266>0x0E	byte&0x0F	x	(Rev.%02d)
267# ROM size. (Used for the boot ROM checksum routine.)
268>0x0F	byte&0x0F	0x0A	(8 KB)
269>0x0F	byte&0x0F	0x0B	(16 KB)
270>0x0F	byte&0x0F	0x0C	(32 KB)
271>0x0F	byte&0x0F	0x0D	(48 KB)
272>0x0F	byte&0x0F	0x0E	(64 KB)
273>0x0F	byte&0x0F	0x0F	(128 KB)
274>0x0F	byte&0x0F	0x00	(256 KB)
275>0x0F	byte&0x0F	0x01	(512 KB)
276>0x0F	byte&0x0F	0x02	(1 MB)
277
278# SMS/GG header locations.
2790x7FF0	string	TMR\ SEGA
280>0x7FF0	use	sega-master-system-rom-header
2810x3FF0	string	TMR\ SEGA
282>0x3FF0	use	sega-master-system-rom-header
2830x1FF0	string	TMR\ SEGA
284>0x1FF0	use	sega-master-system-rom-header
285
286#------------------------------------------------------------------------------
287# saturn: file(1) magic for the Sega Saturn disc image format.
288# From: David Korth <gerbilsoft@gerbilsoft.com>
289#
290
291# Common Sega Saturn disc header format.
292# NOTE: Title is 112 bytes, but we're only showing 32 due to space padding.
293# TODO: Release date, device information, region code, others?
2940	name	sega-saturn-disc-header
295>0x60	string	>\0	\b: "%.32s"
296>0x20	string	>\0	(%.10s
297>>0x2A	string	>\0	\b, %.6s)
298>>0x2A	byte	0	\b)
299
300# 2048-byte sector version.
3010	string	SEGA\ SEGASATURN\ 	Sega Saturn disc image
302>0	use	sega-saturn-disc-header
303>0	byte	x			(2048-byte sectors)
304# 2352-byte sector version.
3050x10	string	SEGA\ SEGASATURN\ 	Sega Saturn disc image
306>0x10	use	sega-saturn-disc-header
307>0	byte	x			(2352-byte sectors)
308
309#------------------------------------------------------------------------------
310# dreamcast: file(1) magic for the Sega Dreamcast disc image format.
311# From: David Korth <gerbilsoft@gerbilsoft.com>
312# Reference: http://mc.pp.se/dc/ip0000.bin.html
313#
314
315# Common Sega Dreamcast disc header format.
316# NOTE: Title is 128 bytes, but we're only showing 32 due to space padding.
317# TODO: Release date, device information, region code, others?
3180	name	sega-dreamcast-disc-header
319>0x80	string	>\0	\b: "%.32s"
320>0x40	string	>\0	(%.10s
321>>0x4A	string	>\0	\b, %.6s)
322>>0x4A	byte	0	\b)
323
324# 2048-byte sector version.
3250	string	SEGA\ SEGAKATANA\ 	Sega Dreamcast disc image
326>0	use	sega-dreamcast-disc-header
327>0	byte	x			(2048-byte sectors)
328# 2352-byte sector version.
3290x10	string	SEGA\ SEGAKATANA\ 	Sega Dreamcast disc image
330>0x10	use	sega-dreamcast-disc-header
331>0	byte	x			(2352-byte sectors)
332
333#------------------------------------------------------------------------------
334# dreamcast:  file(1) uncertain magic for the Sega Dreamcast VMU image format
335#
3360 belong 0x21068028   Sega Dreamcast VMU game image
3370 string LCDi         Dream Animator file
338
339#------------------------------------------------------------------------------
340# z64: file(1) magic for the Z64 format N64 ROM dumps
341# Reference: http://forum.pj64-emu.com/showthread.php?t=2239
342# From: David Korth <gerbilsoft@gerbilsoft.com>
343#
3440	bequad	0x803712400000000F	Nintendo 64 ROM image
345>0x20	string	>\0	\b: "%.20s"
346>0x3B	string	x	(%.4s
347>0x3F	byte	x	\b, Rev.%02u)
348
349#------------------------------------------------------------------------------
350# v64: file(1) magic for the V64 format N64 ROM dumps
351# Same as z64 format, but with 16-bit byteswapping.
352#
3530	bequad	0x3780401200000F00	Nintendo 64 ROM image (V64)
354
355#------------------------------------------------------------------------------
356# n64-swap2: file(1) magic for the swap2 format N64 ROM dumps
357# Same as z64 format, but with swapped 16-bit words.
358#
3590	bequad	0x12408037000F0000	Nintendo 64 ROM image (wordswapped)
360
361#------------------------------------------------------------------------------
362# n64-le32: file(1) magic for the 32-bit byteswapped format N64 ROM dumps
363# Same as z64 format, but with 32-bit byteswapping.
364#
3650	bequad	0x401237800F000000	Nintendo 64 ROM image (32-bit byteswapped)
366
367#------------------------------------------------------------------------------
368# gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format
369# Reference: http://problemkaputt.de/gbatek.htm#gbacartridgeheader
370#
371# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
372# Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
373#
3744	bequad	0x24FFAE51699AA221	Game Boy Advance ROM image
375>0xA0	string	>\0	\b: "%.12s"
376>0xAC	string	x	(%.6s
377>0xBC	byte	x	\b, Rev.%02u)
378
379#------------------------------------------------------------------------------
380# nds: file(1) magic for the Nintendo DS(i) raw ROM format
381# Reference: http://problemkaputt.de/gbatek.htm#dscartridgeheader
382#
383# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
384# Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
385#
3860xC0	bequad	0x24FFAE51699AA221	Nintendo DS ROM image
387>0x00	string	>\0		\b: "%.12s"
388>0x0C	string	x		(%.6s
389>0x1E	byte	x		\b, Rev.%02u)
390>0x12	byte	2		(DSi enhanced)
391>0x12	byte	3		(DSi only)
392
393#------------------------------------------------------------------------------
394# nds_passme: file(1) magic for Nintendo DS ROM images for GBA cartridge boot.
395# This is also used for loading .nds files using the MSET exploit on 3DS.
396# Reference: https://github.com/devkitPro/ndstool/blob/master/source/ndscreate.cpp
3970xC0	bequad	0xC8604FE201708FE2	Nintendo DS Slot-2 ROM image (PassMe)
398
399#------------------------------------------------------------------------------
400# ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format.
401# From: David Korth <gerbilsoft@gerbilsoft.com>
402# References:
403# - https://neogpc.googlecode.com/svn-history/r10/trunk/src/core/neogpc.cpp
404# - http://www.devrs.com/ngp/files/ngpctech.txt
405#
4060x0A	string	BY\ SNK\ CORPORATION	Neo Geo Pocket
407>0x23	byte	0x10			Color
408>0	byte	x			ROM image
409>0x24	string	>\0			\b: "%.12s"
410>0x1F	byte	0xFF			(debug mode enabled)
411
412#------------------------------------------------------------------------------
413# msx: file(1) magic for MSX game cartridge dumps
414# Too simple - MPi
415#0 beshort 0x4142 MSX game cartridge dump 
416
417#------------------------------------------------------------------------------
418# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) :
4190	string	PS-X\ EXE	Sony Playstation executable
420>16	lelong	x		PC=0x%08x,
421>20	lelong	!0		GP=0x%08x,
422>24	lelong	!0		.text=[0x%08x,
423>>28	lelong	x		\b0x%x],
424>32	lelong	!0		.data=[0x%08x,
425>>36	lelong	x		\b0x%x],
426>40	lelong	!0		.bss=[0x%08x,
427>>44	lelong	x		\b0x%x],
428>48	lelong	!0		Stack=0x%08x,
429>48	lelong	=0		No Stack!,
430>52	lelong	!0		StackSize=0x%x,
431#>76	string	>\0		(%s)
432#  Area:
433>113	string	x		(%s)
434
435# CPE executables
4360	string	CPE		CPE executable
437>3	byte	x		(version %d)
438
439#------------------------------------------------------------------------------
440# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>)
4410       string          XBEH            XBE, Microsoft Xbox executable
442# probabilistic checks whether signed or not
443>0x0004 ulelong =0x0
444>>&2    ulelong =0x0
445>>>&2   ulelong =0x0  \b, not signed
446>0x0004 ulelong >0
447>>&2    ulelong >0
448>>>&2   ulelong >0    \b, signed
449# expect base address of 0x10000
450>0x0104               ulelong =0x10000
451>>(0x0118-0x0FF60)    ulelong&0x80000007  0x80000007 \b, all regions
452>>(0x0118-0x0FF60)    ulelong&0x80000007  !0x80000007
453>>>(0x0118-0x0FF60)   ulelong >0           (regions:
454>>>>(0x0118-0x0FF60)  ulelong &0x00000001  NA
455>>>>(0x0118-0x0FF60)  ulelong &0x00000002  Japan
456>>>>(0x0118-0x0FF60)  ulelong &0x00000004  Rest_of_World
457>>>>(0x0118-0x0FF60)  ulelong &0x80000000  Manufacturer
458>>>(0x0118-0x0FF60)   ulelong >0           \b)
459
460# --------------------------------
461# Microsoft Xbox data file formats
4620       string          XIP0            XIP, Microsoft Xbox data
4630       string          XTF0            XTF, Microsoft Xbox data
464
465# Atari Lynx cartridge dump (EXE/BLL header)
466# From: "Stefan A. Haubenthal" <polluks@web.de>
467
468# Double-check that the image type matches too, 0x8008 conflicts with
469# 8 character OMF-86 object file headers.
4700	beshort		0x8008		
471>6	string		BS93		Lynx homebrew cartridge
472>>2	beshort		x		\b, RAM start $%04x
473>6	string		LYNX		Lynx cartridge
474>>2	beshort		x		\b, RAM start $%04x
475
476# Opera file system that is used on the 3DO console
477# From: Serge van den Boom <svdb@stack.nl>
4780	string		\x01ZZZZZ\x01	3DO "Opera" file system
479
480# From: Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
481# From: David Pflug <david@pflug.email>
482# is the offset 12 or the offset 16 correct?
483# GBS (Game Boy Sound) magic
484# ftp://ftp.modland.com/pub/documents/format_documentation/\
485# Gameboy%20Sound%20System%20(.gbs).txt 
4860	string		GBS		Nintendo Gameboy Music/Audio Data
487#12	string		GameBoy\ Music\ Module	Nintendo Gameboy Music Module
488>16	string		>\0	("%s" by
489>48	string		>\0	%s, copyright
490>80	string		>\0	%s),
491>3	byte		x	version %d,
492>4	byte		x	%d tracks
493
494# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at>
4950	string	PPF30			Playstation Patch File version 3.0
496>5	byte	0			\b, PPF 1.0 patch
497>5	byte	1			\b, PPF 2.0 patch
498>5	byte	2			\b, PPF 3.0 patch
499>>56	byte	0			\b, Imagetype BIN (any)
500>>56	byte	1			\b, Imagetype GI (PrimoDVD)
501>>57	byte	0			\b, Blockcheck disabled
502>>57	byte	1			\b, Blockcheck enabled
503>>58	byte	0			\b, Undo data not available
504>>58	byte	1			\b, Undo data available
505>6	string	x			\b, description: %s
506
5070	string	PPF20			Playstation Patch File version 2.0
508>5	byte	0			\b, PPF 1.0 patch
509>5	byte	1			\b, PPF 2.0 patch
510>>56	lelong	>0			\b, size of file to patch %d
511>6	string	x			\b, description: %s
512
5130	string	PPF10			Playstation Patch File version 1.0
514>5	byte	0			\b, Simple Encoding
515>6	string	x			\b, description: %s
516
517# From: Daniel Dawson <ddawson@icehouse.net>
518# SNES9x .smv "movie" file format.
5190		string		SMV\x1A	SNES9x input recording
520>0x4		lelong		x	\b, version %d
521# version 4 is latest so far 
522>0x4		lelong		<5
523>>0x8		ledate		x	\b, recorded at %s
524>>0xc		lelong		>0	\b, rerecorded %d times
525>>0x10		lelong		x	\b, %d frames long
526>>0x14		byte		>0	\b, data for controller(s):
527>>>0x14		byte		&0x1	#1
528>>>0x14		byte		&0x2	#2
529>>>0x14		byte		&0x4	#3
530>>>0x14		byte		&0x8	#4
531>>>0x14		byte		&0x10	#5
532>>0x15		byte		^0x1	\b, begins from snapshot
533>>0x15		byte		&0x1	\b, begins from reset
534>>0x15		byte		^0x2	\b, NTSC standard
535>>0x15		byte		&0x2	\b, PAL standard
536>>0x17		byte		&0x1    \b, settings:
537# WIP1Timing not used as of version 4
538>>>0x4		lelong		<4
539>>>>0x17	byte		&0x2	WIP1Timing
540>>>0x17		byte		&0x4	Left+Right
541>>>0x17		byte		&0x8	VolumeEnvX
542>>>0x17		byte		&0x10	FakeMute
543>>>0x17		byte		&0x20	SyncSound
544# New flag as of version 4
545>>>0x4		lelong		>3
546>>>>0x17	byte		&0x80	NoCPUShutdown
547>>0x4		lelong		<4
548>>>0x18		lelong		>0x23
549>>>>0x20	leshort		!0
550>>>>>0x20	lestring16	x	\b, metadata: "%s"
551>>0x4		lelong		>3
552>>>0x24		byte		>0	\b, port 1:
553>>>>0x24	byte		1	joypad
554>>>>0x24	byte		2	mouse
555>>>>0x24	byte		3	SuperScope
556>>>>0x24	byte		4	Justifier
557>>>>0x24	byte		5	multitap
558>>>0x24		byte		>0	\b, port 2:
559>>>>0x25	byte		1	joypad
560>>>>0x25	byte		2	mouse
561>>>>0x25	byte		3	SuperScope
562>>>>0x25	byte		4	Justifier
563>>>>0x25	byte		5	multitap
564>>>0x18		lelong		>0x43
565>>>>0x40	leshort		!0
566>>>>>0x40	lestring16	x	\b, metadata: "%s"
567>>0x17		byte		&0x40   \b, ROM:
568>>>(0x18.l-26)	lelong		x	CRC32 0x%08x
569>>>(0x18.l-23)	string		x	"%s"
570
571# Type: scummVM savegame files
572# From: Sven Hartge <debian@ds9.argh.org>
5730	string	SCVM	ScummVM savegame
574>12	string	>\0	"%s"
575
576#------------------------------------------------------------------------------
577# Nintendo GameCube / Wii file formats.
578#
579
580# Type: Nintendo GameCube/Wii common disc header data.
581# From: David Korth <gerbilsoft@gerbilsoft.com>
582# Reference: http://wiibrew.org/wiki/Wii_Disc
5830	name	nintendo-gcn-disc-common
584>0x20	string	x	"%.64s"
585>0x00	string	x	(%.6s
586>0x06	byte	>0
587>>0x06	byte	1	\b, Disc 2
588>>0x06	byte	2	\b, Disc 3
589>>0x06	byte	3	\b, Disc 4
590>0x07	byte	x	\b, Rev.%02u)
591
592# Type: Nintendo GameCube disc image
593# From: David Korth <gerbilsoft@gerbilsoft.com>
594# Reference: http://wiibrew.org/wiki/Wii_Disc
5950x1C	belong	0xC2339F3D	Nintendo GameCube disc image:
596>0	use	nintendo-gcn-disc-common
597
598# Type: Nintendo GameCube embedded disc image
599# Commonly found on demo discs.
600# From: David Korth <gerbilsoft@gerbilsoft.com>
601# Reference: http://hitmen.c02.at/files/yagcd/yagcd/index.html#idx14.8
6020		belong	0xAE0F38A2
603>0x0C		belong	0x00100000
604>>(8.L+0x1C)	belong	0xC2339F3D	Nintendo GameCube embedded disc image:
605>>>(8.L)	use	nintendo-gcn-disc-common
606
607# Type: Nintendo Wii disc image
608# From: David Korth <gerbilsoft@gerbilsoft.com>
609# Reference: http://wiibrew.org/wiki/Wii_Disc
6100x18	belong	0x5D1C9EA3	Nintendo Wii disc image:
611>0	use	nintendo-gcn-disc-common
612
613# Type: Nintendo Wii disc image (WBFS format)
614# From: David Korth <gerbilsoft@gerbilsoft.com>
615# Reference: http://wiibrew.org/wiki/Wii_Disc
6160	string	WBFS
617>0x218	belong	0x5D1C9EA3	Nintendo Wii disc image (WBFS format):
618>>0x200	use	nintendo-gcn-disc-common
619
620#------------------------------------------------------------------------------
621# Nintendo 3DS file formats.
622#
623
624# Type: Nintendo 3DS "NCSD" image. (game cards and eMMC)
625# From: David Korth <gerbilsoft@gerbilsoft.com>
626# Reference: https://www.3dbrew.org/wiki/NCSD
6270x100		string		NCSD
628>0x118		lequad		0		Nintendo 3DS Game Card image
629# NCCH header for partition 0. (game data)
630>>0x1150	string		>\0	\b: "%.16s"
631>>0x312		byte		x	(Rev.%02u)
632>>0x118C	byte		2	(New3DS only)
633>>0x18D		byte		0		(inner device)
634>>0x18D		byte		1		(Card1)
635>>0x18D		byte		2		(Card2)
636>>0x18D		byte		3		(extended device)
637>0x118		bequad		0x0102020202000000	Nintendo 3DS eMMC dump (Old3DS)
638>0x118		bequad		0x0102020203000000	Nintendo 3DS eMMC dump (New3DS)
639
640# Nintendo 3DS version code.
641# Reference: https://www.3dbrew.org/wiki/Titles
642# Format: leshort containing three fields:
643# - 6-bit: Major
644# - 6-bit: Minor
645# - 4-bit: Revision
646# NOTE: Only supporting major/minor versions from 0-15 right now.
647# NOTE: Should be prefixed with "v".
6480	name	nintendo-3ds-version-code
649# Raw version.
650>0	leshort	x	\b%u,
651# Major version.
652>0	leshort&0xFC00	0x0000	0
653>0	leshort&0xFC00	0x0400	1
654>0	leshort&0xFC00	0x0800	2
655>0	leshort&0xFC00	0x0C00	3
656>0	leshort&0xFC00	0x1000	4
657>0	leshort&0xFC00	0x1400	5
658>0	leshort&0xFC00	0x1800	6
659>0	leshort&0xFC00	0x1C00	7
660>0	leshort&0xFC00	0x2000	8
661>0	leshort&0xFC00	0x2400	9
662>0	leshort&0xFC00	0x2800	10
663>0	leshort&0xFC00	0x2C00	11
664>0	leshort&0xFC00	0x3000	12
665>0	leshort&0xFC00	0x3400	13
666>0	leshort&0xFC00	0x3800	14
667>0	leshort&0xFC00	0x3C00	15
668# Minor version.
669>0	leshort&0x03F0	0x0000	\b.0
670>0	leshort&0x03F0	0x0010	\b.1
671>0	leshort&0x03F0	0x0020	\b.2
672>0	leshort&0x03F0	0x0030	\b.3
673>0	leshort&0x03F0	0x0040	\b.4
674>0	leshort&0x03F0	0x0050	\b.5
675>0	leshort&0x03F0	0x0060	\b.6
676>0	leshort&0x03F0	0x0070	\b.7
677>0	leshort&0x03F0	0x0080	\b.8
678>0	leshort&0x03F0	0x0090	\b.9
679>0	leshort&0x03F0	0x00A0	\b.10
680>0	leshort&0x03F0	0x00B0	\b.11
681>0	leshort&0x03F0	0x00C0	\b.12
682>0	leshort&0x03F0	0x00D0	\b.13
683>0	leshort&0x03F0	0x00E0	\b.14
684>0	leshort&0x03F0	0x00F0	\b.15
685# Revision.
686>0	leshort&0x000F	x	\b.%u
687
688# Type: Nintendo 3DS "NCCH" container.
689# https://www.3dbrew.org/wiki/NCCH
6900x100		string	NCCH	Nintendo 3DS
691>0x18D		byte&2	0	File Archive (CFA)
692>0x18D		byte&2	2	Executable Image (CXI)
693>0x150		string	>\0	\b: "%.16s"
694>0x18D		byte	0x05
695>>0x10E		leshort	x	(Old3DS System Update v
696>>0x10E		use	nintendo-3ds-version-code
697>>0x10E		leshort	x	\b)
698>0x18D		byte	0x15
699>>0x10E		leshort	x	(New3DS System Update v
700>>0x10E		use	nintendo-3ds-version-code
701>>0x10E		leshort	x	\b)
702>0x18D		byte	!0x05
703>>0x18D		byte	!0x15
704>>>0x112	byte	x	(v
705>>>0x112	use	nintendo-3ds-version-code
706>>>0x112	byte	x	\b)
707>0x18C		byte	2	(New3DS only)
708
709# Type: Nintendo 3DS "SMDH" file. (application description)
710# From: David Korth <gerbilsoft@gerbilsoft.com>
711# Reference: https://3dbrew.org/wiki/SMDH
7120		string		SMDH		Nintendo 3DS SMDH file
713>0x208		leshort		!0
714>>0x208		lestring16	x		\b: "%.128s"
715>>0x388		leshort		!0
716>>>0x388	lestring16	x		by %.128s
717>0x208		leshort		0
718>>0x008		leshort		!0
719>>>0x008	lestring16	x		\b: "%.128s"
720>>>0x188	leshort		!0
721>>>>0x188	lestring16	x		by %.128s
722
723# Type: Nintendo 3DS Homebrew Application.
724# From: David Korth <gerbilsoft@gerbilsoft.com>
725# Refernece: https://3dbrew.org/wiki/3DSX_Format
7260	string	3DSX	Nintendo 3DS Homebrew Application (3DSX)
727
728#------------------------------------------------------------------------------
729# a7800: file(1) magic for the Atari 7800 raw ROM format.
730# From: David Korth <gerbilsoft@gerbilsoft.com>
731# Reference: https://sites.google.com/site/atari7800wiki/a78-header
732
7330	byte	>0
734>0	byte	<3
735>>1	string	ATARI7800	Atari 7800 ROM image
736>>>0x11	string	>\0	\b: "%.32s"
737# Display type.
738>>>0x39	byte	0	(NTSC)
739>>>0x39	byte	1	(PAL)
740>>>0x36	byte&1	1	(POKEY)
741
742#------------------------------------------------------------------------------
743# vectrex: file(1) magic for the GCE Vectrex raw ROM format.
744# From: David Korth <gerbilsoft@gerbilsoft.com>
745# Reference: http://www.playvectrex.com/designit/chrissalo/hello1.htm
746#
747# NOTE: Title is terminated with 0x80, not 0.
748# The header is terminated with a 0, so that will
749# terminate the title as well.
750#
7510	string	g\ GCE	Vectrex ROM image
752>0x11	string	>\0	\b: "%.16s"
753