| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378 | 
#------------------------------------------------------------------------------# $File: console,v 1.80 2024/11/09 23:55:02 christos Exp $# Console game magic# Toby Deshane <hac@shoelace.digivill.net># ines: file(1) magic for Marat's iNES Nintendo Entertainment System ROM dump format# Updated by David Korth <gerbilsoft@gerbilsoft.com># References:# - https://wiki.nesdev.com/w/index.php/INES# - https://wiki.nesdev.com/w/index.php/NES_2.0# Common header for iNES, NES 2.0, and Wii U iNES.0	name		nes-rom-image-ines>7	byte&0x0C	=0x8		(NES 2.0)>4	byte		x		\b: %ux16k PRG>5	byte		x		\b, %ux8k CHR>6	byte&0x08	=0x8		[4-Scr]>6	byte&0x09	=0x0		[H-mirror]>6	byte&0x09	=0x1		[V-mirror]>6	byte&0x02	=0x2		[SRAM]>6	byte&0x04	=0x4		[Trainer]>7	byte&0x03	=0x2		[PC10]>7	byte&0x03	=0x1		[VS]>>7	byte&0x0C	=0x8# NES 2.0: VS PPU>>>13	byte&0x0F	=0x0		\b, RP2C03B>>>13	byte&0x0F	=0x1		\b, RP2C03G>>>13	byte&0x0F	=0x2		\b, RP2C04-0001>>>13	byte&0x0F	=0x3		\b, RP2C04-0002>>>13	byte&0x0F	=0x4		\b, RP2C04-0003>>>13	byte&0x0F	=0x5		\b, RP2C04-0004>>>13	byte&0x0F	=0x6		\b, RP2C03B>>>13	byte&0x0F	=0x7		\b, RP2C03C>>>13	byte&0x0F	=0x8		\b, RP2C05-01>>>13	byte&0x0F	=0x9		\b, RP2C05-02>>>13	byte&0x0F	=0xA		\b, RP2C05-03>>>13	byte&0x0F	=0xB		\b, RP2C05-04>>>13	byte&0x0F	=0xC		\b, RP2C05-05# TODO: VS protection hardware?>>7	byte		x		\b]# NES 2.0-specific flags.>7	byte&0x0C	=0x8>>12	byte&0x03	=0x0		[NTSC]>>12	byte&0x03	=0x1		[PAL]>>12	byte&0x02	=0x2		[NTSC+PAL]# Standard iNES ROM header.0	string		NES\x1A		NES ROM image (iNES)!:mime	application/x-nes-rom>0	use		nes-rom-image-ines# Wii U Virtual Console iNES ROM header.0	belong		0x4E455300	NES ROM image (Wii U Virtual Console)!:mime	application/x-nes-rom>0	use		nes-rom-image-ines#------------------------------------------------------------------------------# unif: file(1) magic for UNIF-format Nintendo Entertainment System ROM images# Reference: https://wiki.nesdev.com/w/index.php/UNIF# From: David Korth <gerbilsoft@gerbilsoft.com>## NOTE: The UNIF format uses chunks instead of a fixed header,# so most of the data isn't easily parseable.#0	string	UNIF>4	lelong	<16	NES ROM image (UNIF v%d format)!:mime	application/x-nes-rom#------------------------------------------------------------------------------# fds: file(1) magic for Famicom Disk System disk images# Reference: https://wiki.nesdev.com/w/index.php/Family_Computer_Disk_System#.FDS_format# From: David Korth <gerbilsoft@gerbilsoft.com># TODO: Check "Disk info block" and get info from that in addition to the optional header.# Disk info block. (block 1)0	name	nintendo-fds-disk-info-block>23	byte	!1		FMC->23	byte	1		FSC->16	string	x		\b%.3s>15	ubyte	x		\b, mfr %02X>20	ubyte	x		(Rev.%02u)# Headered version.0	string	FDS\x1A>0x11	string	*NINTENDO-HVC*	Famicom Disk System disk image:!:mime	application/x-fds-disk>>0x10	use	nintendo-fds-disk-info-block>4	byte	1	(%u side)>4	byte	!1	(%u sides)# Unheadered version.1	string	*NINTENDO-HVC*	Famicom Disk System disk image:!:mime	application/x-fds-disk>0	use	nintendo-fds-disk-info-block#------------------------------------------------------------------------------# tnes: file(1) magic for TNES-format Nintendo Entertainment System ROM images# Used by Nintendo 3DS NES Virtual Console games.# From: David Korth <gerbilsoft@gerbilsoft.com>#0		string	TNES	NES ROM image (Nintendo 3DS Virtual Console)!:mime		application/x-nes-rom>4		byte	100	\b: FDS,>>0x2010	use	nintendo-fds-disk-info-block>4		byte	!100	\b: TNES mapper %u>>5	byte		x		\b, %ux8k PRG>>6	byte		x		\b, %ux8k CHR>>7	byte&0x08	=1		[WRAM]>>8	byte&0x09	=1		[H-mirror]>>8	byte&0x09	=2		[V-mirror]>>8	byte&0x02	=3		[VRAM]#------------------------------------------------------------------------------# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format# Reference: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header## Title (16 chars for GB; 15 chars for CGB)0		name		gameboy-title>0x143		byte&0x80	0x80>>0x134		string		>\0			\b: "%.15s">0x143		byte&0x80	!0x80>>0x134		string		>\0			\b: "%.16s">0x14c		byte		x			(Rev.%02u)# Machine type (SGB, CGB, SGB+CGB)# Old licensee code 0x33 is required for SGB, but not CGB.0		name		gameboy-machine-type>0x14b		byte		0x33>>0x146		byte		0x03>>>0x143	byte&0x80	0x80	[SGB+CGB]>>>0x143	byte&0x80	!0x80	[SGB]>>0x146		byte		!0x03>>>0x143	byte&0xC0	0x80	[CGB]>>>0x143	byte&0xC0	0xC0	[CGB ONLY]>0x14b		byte		!0x33>>0x143		byte&0xC0	0x80	[CGB]>>0x143		byte&0xC0	0xC0	[CGB ONLY]# Mapper0	name gameboy-mapper>0	byte 0x00  [ROM ONLY]>0	byte 0x01  [MBC1]>0	byte 0x02  [MBC1+RAM]>0	byte 0x03  [MBC1+RAM+BATT]>0	byte 0x05  [MBC2]>0	byte 0x06  [MBC2+BATTERY]>0	byte 0x08  [ROM+RAM]>0	byte 0x09  [ROM+RAM+BATTERY]>0	byte 0x0B  [MMM01]>0	byte 0x0C  [MMM01+SRAM]>0	byte 0x0D  [MMM01+SRAM+BATT]>0	byte 0x0F  [MBC3+TIMER+BATT]>0	byte 0x10  [MBC3+TIMER+RAM+BATT]>0	byte 0x11  [MBC3]>0	byte 0x12  [MBC3+RAM]>0	byte 0x13  [MBC3+RAM+BATT]>0	byte 0x19  [MBC5]>0	byte 0x1A  [MBC5+RAM]>0	byte 0x1B  [MBC5+RAM+BATT]>0	byte 0x1C  [MBC5+RUMBLE]>0	byte 0x1D  [MBC5+RUMBLE+SRAM]>0	byte 0x1E  [MBC5+RUMBLE+SRAM+BATT]>0	byte 0xFC  [Pocket Camera]>0	byte 0xFD  [Bandai TAMA5]>0	byte 0xFE  [Hudson HuC-3]>0	byte 0xFF  [Hudson HuC-1]# ROM size0	name gameboy-rom-size>0	byte 0     \b, ROM: 256Kbit>0	byte 1     \b, ROM: 512Kbit>0	byte 2     \b, ROM: 1Mbit>0	byte 3     \b, ROM: 2Mbit>0	byte 4     \b, ROM: 4Mbit>0	byte 5     \b, ROM: 8Mbit>0	byte 6     \b, ROM: 16Mbit>0	byte 7     \b, ROM: 32Mbit>0	byte 0x52  \b, ROM: 9Mbit>0	byte 0x53  \b, ROM: 10Mbit>0	byte 0x54  \b, ROM: 12Mbit# RAM size0	name	gameboy-ram-size>0	byte 1     \b, RAM: 16Kbit>0	byte 2     \b, RAM: 64Kbit>0	byte 3     \b, RAM: 256Kbit>0	byte 4     \b, RAM: 1Mbit>0	byte 5     \b, RAM: 512Kbit# Game Boy (Color)0x104		bequad		0xCEED6666CC0D000B>0x143		byte&0x80	0x80	Game Boy Color ROM image!:mime		application/x-gameboy-color-rom>0x143		byte&0x80	!0x80	Game Boy ROM image!:mime		application/x-gameboy-rom>0		use		gameboy-title>0		use		gameboy-machine-type>0x147		use		gameboy-mapper>0x148		use		gameboy-rom-size>0x149		use		gameboy-ram-size# Analogue Pocket0x104		bequad		0x0110CEEF000044AA>0		byte		x	Analogue Pocket ROM image!:mime		application/x-analogue-pocket-rom>0		use		gameboy-title>0		use		gameboy-machine-type>0x147		use		gameboy-mapper>0x148		use		gameboy-rom-size>0x149		use		gameboy-ram-size#------------------------------------------------------------------------------# genesis: file(1) magic for various Sega Mega Drive / Genesis ROM image and disc formats# Updated by David Korth <gerbilsoft@gerbilsoft.com># References:# - https://www.retrodev.com/segacd.html# - http://devster.monkeeh.com/sega/32xguide1.txt## Common Sega Mega Drive header format.# FIXME: Name fields are 48 bytes, but have spaces for padding instead of 00s.0		name	sega-mega-drive-header# ROM title. (Use domestic if present; if not, use international.)>0x120		byte	>0x20>>0x120		string	>\0	\b: "%.16s">0x120		byte	<0x21>>0x150		string	>\0	\b: "%.16s"# Other information.>0x180		string	>\0	(%.14s>>0x110		string  >\0	\b, %.16s>0x180		byte	0>>0x110		string  >\0	(%.16s>0		byte	x	\b)# TODO: Check for 32X CD?# Sega Mega CD disc images: 2048-byte sectors.0	string	SEGADISCSYSTEM\040\040	Sega Mega CD disc image!:mime	application/x-sega-cd-rom>0	use	sega-mega-drive-header>0	byte	x			\b, 2048-byte sectors0	string	SEGABOOTDISC\040\040\040\040	Sega Mega CD disc image!:mime	application/x-sega-cd-rom>0	use	sega-mega-drive-header>0	byte	x			\b, 2048-byte sectors# Sega Mega CD disc images: 2352-byte sectors.0x10	string	SEGADISCSYSTEM\040\040	Sega Mega CD disc image!:mime	application/x-sega-cd-rom>0x10	use	sega-mega-drive-header>0	byte	x			\b, 2352-byte sectors0x10	string	SEGABOOTDISC\040\040\040\040	Sega Mega CD disc image!:mime	application/x-sega-cd-rom>0x10	use	sega-mega-drive-header>0	byte	x			\b, 2352-byte sectors# Sega Mega Drive: Identify the system ID.0x100		string	SEGA>0x3C0		string	MARS\040CHECK\040MODE	Sega 32X ROM image!:mime		application/x-genesis-32x-rom>>0		use	sega-mega-drive-header>0x104		string	\040PICO			Sega Pico ROM image!:mime		application/x-sega-pico-rom>>0		use	sega-mega-drive-header>0x104		string	TOYS\040PICO		Sega Pico ROM image!:mime		application/x-sega-pico-rom>>0		use	sega-mega-drive-header>0x104		string	\040TOYS\040PICO		Sega Pico ROM image!:mime		application/x-sega-pico-rom>>0		use	sega-mega-drive-header>0x104		string	\040IAC			Sega Pico ROM image!:mime		application/x-sega-pico-rom>>0		use	sega-mega-drive-header>0x104		string	\040TERA68K		Sega Teradrive (68K) ROM image!:mime		application/x-sega-teradrive-rom>>0		use	sega-mega-drive-header>0x104		string	\040TERA286		Sega Teradrive (286) ROM image!:mime		application/x-sega-teradrive-rom>>0		use	sega-mega-drive-header>0x180		string	BR			Sega Mega CD Boot ROM image!:mime		application/x-genesis-rom>>0		use	sega-mega-drive-header>0x104		default	x			Sega Mega Drive / Genesis ROM image!:mime		application/x-genesis-rom>>0		use	sega-mega-drive-header# Sega Mega Drive: Some ROMs have "SEGA" at 0x101, not 0x100.0x100		string	\040SEGA			Sega Mega Drive / Genesis ROM image>0		use	sega-mega-drive-header# Sega Pico ROMs that don't start with "SEGA".0x100		string	SAMSUNG\040PICO		Samsung Pico ROM image!:mime		application/x-sega-pico-rom>0		use	sega-mega-drive-header0x100		string	IMA\040IKUNOUJYUKU	Samsung Pico ROM image!:mime		application/x-sega-pico-rom>0		use	sega-mega-drive-header0x100		string	IMA\040IKUNOJYUKU	Samsung Pico ROM image!:mime		application/x-sega-pico-rom>0		use	sega-mega-drive-header# Sega Picture Magic (modified 32X)0x100		string	Picture\040Magic>0x3C0		string	PICTURE\040MAGIC-01	Sega 32X ROM image!:mime		application/x-genesis-32x-rom>>0		use	sega-mega-drive-header#------------------------------------------------------------------------------# genesis: file(1) magic for the Super MegaDrive ROM dump format## NOTE: Due to interleaving, we can't display anything# other than the copier header information.0      name    sega-genesis-smd-header>0     byte    x       %dx16k blocks>2     byte    0       \b, last in series or standalone>2     byte    >0      \b, split ROM# "Sega Genesis" header.0x280	string EAGN>8	beshort	0xAABB	Sega Mega Drive / Genesis ROM image (SMD format):!:mime	application/x-genesis-rom>>0	use     sega-genesis-smd-header# "Sega Mega Drive" header.0x280	string EAMG>8	beshort	0xAABB	Sega Mega Drive / Genesis ROM image (SMD format):!:mime	application/x-genesis-rom>>0	use     sega-genesis-smd-header#------------------------------------------------------------------------------# smsgg:  file(1) magic for Sega Master System and Game Gear ROM images# Detects all Game Gear and export Sega Master System ROM images,# and some Japanese Sega Master System ROM images.# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://www.smspower.org/Development/ROMHeader## General SMS header rule.# The SMS boot ROM checks the header at three locations.0	name	sega-master-system-rom-header# Machine type.>0x0F	ubyte&0xF0	0x30	Sega Master System!:mime	application/x-sms-rom>0x0F	ubyte&0xF0	0x40	Sega Master System!:mime	application/x-sms-rom>0x0F	ubyte&0xF0	0x50	Sega Game Gear!:mime	application/x-gamegear-rom>0x0F	ubyte&0xF0	0x60	Sega Game Gear!:mime	application/x-gamegear-rom>0x0F	ubyte&0xF0	0x70	Sega Game Gear!:mime	application/x-gamegear-rom>0x0F	default		x	Sega Master System / Game Gear!:mime	application/x-sms-rom>0	byte		x	ROM image:# Product code.>0x0E	ubyte&0xF0	0x10	1>0x0E	ubyte&0xF0	0x20	2>0x0E	ubyte&0xF0	0x30	3>0x0E	ubyte&0xF0	0x40	4>0x0E	ubyte&0xF0	0x50	5>0x0E	ubyte&0xF0	0x60	6>0x0E	ubyte&0xF0	0x70	7>0x0E	ubyte&0xF0	0x80	8>0x0E	ubyte&0xF0	0x90	9>0x0E	ubyte&0xF0	0xA0	10>0x0E	ubyte&0xF0	0xB0	11>0x0E	ubyte&0xF0	0xC0	12>0x0E	ubyte&0xF0	0xD0	13>0x0E	ubyte&0xF0	0xE0	14>0x0E	ubyte&0xF0	0xF0	15# If the product code is 5 digits, we'll need to backspace here.>0x0E	ubyte&0xF0	!0>>0x0C	uleshort	x	\b%04x>0x0E	ubyte&0xF0	0>>0x0C	uleshort	x	%04x# Revision.>0x0E	ubyte&0x0F	x	(Rev.%02d)# ROM size. (Used for the boot ROM checksum routine.)>0x0F	ubyte&0x0F	0x0A	(8 KB)>0x0F	ubyte&0x0F	0x0B	(16 KB)>0x0F	ubyte&0x0F	0x0C	(32 KB)>0x0F	ubyte&0x0F	0x0D	(48 KB)>0x0F	ubyte&0x0F	0x0E	(64 KB)>0x0F	ubyte&0x0F	0x0F	(128 KB)>0x0F	ubyte&0x0F	0x00	(256 KB)>0x0F	ubyte&0x0F	0x01	(512 KB)>0x0F	ubyte&0x0F	0x02	(1 MB)# SMS/GG header locations.0x7FF0	string	TMR\040SEGA>0x7FF0	use	sega-master-system-rom-header0x3FF0	string	TMR\040SEGA>0x3FF0	use	sega-master-system-rom-header0x1FF0	string	TMR\040SEGA>0x1FF0	use	sega-master-system-rom-header#------------------------------------------------------------------------------# saturn: file(1) magic for the Sega Saturn disc image format.# From: David Korth <gerbilsoft@gerbilsoft.com>## Common Sega Saturn disc header format.# NOTE: Title is 112 bytes, but we're only showing 32 due to space padding.# TODO: Release date, device information, region code, others?0	name	sega-saturn-disc-header>0x60	string	>\0	\b: "%.32s">0x20	string	>\0	(%.10s>>0x2A	string	>\0	\b, %.6s)>>0x2A	byte	0	\b)# 2048-byte sector version.0	string	SEGA\040SEGASATURN\040	Sega Saturn disc image!:mime	application/x-saturn-rom>0	use	sega-saturn-disc-header>0	byte	x			(2048-byte sectors)# 2352-byte sector version.0x10	string	SEGA\040SEGASATURN\040	Sega Saturn disc image!:mime	application/x-saturn-rom>0x10	use	sega-saturn-disc-header>0	byte	x			(2352-byte sectors)#------------------------------------------------------------------------------# dreamcast: file(1) magic for the Sega Dreamcast disc image format.# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://mc.pp.se/dc/ip0000.bin.html## Common Sega Dreamcast disc header format.# NOTE: Title is 128 bytes, but we're only showing 32 due to space padding.# TODO: Release date, device information, region code, others?0	name	sega-dreamcast-disc-header>0x80	string	>\0	\b: "%.32s">0x40	string	>\0	(%.10s>>0x4A	string	>\0	\b, %.6s)>>0x4A	byte	0	\b)# 2048-byte sector version.0	string	SEGA\040SEGAKATANA\040	Sega Dreamcast disc image!:mime	application/x-dc-rom>0	use	sega-dreamcast-disc-header>0	byte	x			(2048-byte sectors)# 2352-byte sector version.0x10	string	SEGA\040SEGAKATANA\040	Sega Dreamcast disc image!:mime	application/x-dc-rom>0x10	use	sega-dreamcast-disc-header>0	byte	x			(2352-byte sectors)#------------------------------------------------------------------------------# dreamcast:  file(1) uncertain magic for the Sega Dreamcast VMU image format#0 belong 0x21068028   Sega Dreamcast VMU game image0 string LCDi         Dream Animator file#------------------------------------------------------------------------------# z64: file(1) magic for the Z64 format N64 ROM dumps# Reference: http://forum.pj64-emu.com/showthread.php?t=2239# From: David Korth <gerbilsoft@gerbilsoft.com>#0	bequad	0x803712400000000F	Nintendo 64 ROM image!:mime	application/x-n64-rom>0x20	string	>\0	\b: "%.20s">0x3B	string	x	(%.4s>0x3F	byte	x	\b, Rev.%02u)#------------------------------------------------------------------------------# v64: file(1) magic for the V64 format N64 ROM dumps# Same as z64 format, but with 16-bit byteswapping.#0	bequad	0x3780401200000F00	Nintendo 64 ROM image (V64)!:mime	application/x-n64-rom#------------------------------------------------------------------------------# n64-swap2: file(1) magic for the swap2 format N64 ROM dumps# Same as z64 format, but with swapped 16-bit words.#0	bequad	0x12408037000F0000	Nintendo 64 ROM image (wordswapped)!:mime	application/x-n64-rom#------------------------------------------------------------------------------# n64-le32: file(1) magic for the 32-bit byteswapped format N64 ROM dumps# Same as z64 format, but with 32-bit byteswapping.#0	bequad	0x401237800F000000	Nintendo 64 ROM image (32-bit byteswapped)!:mime	application/x-n64-rom#------------------------------------------------------------------------------# gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format# Reference: https://problemkaputt.de/gbatek.htm#gbacartridgeheader## Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com># Updated version from: David Korth <gerbilsoft@gerbilsoft.com>#4	bequad	0x24FFAE51699AA221	Game Boy Advance ROM image!:mime	application/x-gba-rom>0xA0	string	>\0	\b: "%.12s">0xAC	string	x	(%.6s>0xBC	byte	x	\b, Rev.%02u)#------------------------------------------------------------------------------# nds: file(1) magic for the Nintendo DS(i) raw ROM format# Reference: https://problemkaputt.de/gbatek.htm#dscartridgeheader## Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com># Updated version from: David Korth <gerbilsoft@gerbilsoft.com>#0xC0	bequad	0x24FFAE51699AA221	Nintendo DS ROM image!:mime	application/x-nintendo-ds-rom>0x00	string	>\0		\b: "%.12s">0x0C	string	x		(%.6s>0x1E	byte	x		\b, Rev.%02u)>0x12	byte	2		(DSi enhanced)>0x12	byte	3		(DSi only)# Secure Area check.>0x20		lelong	<0x4000		(homebrew)>0x20		lelong	>0x3FFF>>0x4000	lequad	0x0000000000000000	(multiboot)>>0x4000	lequad	!0x0000000000000000>>>0x4000	lequad	0xE7FFDEFFE7FFDEFF	(decrypted)>>>0x4000	lequad	!0xE7FFDEFFE7FFDEFF>>>>0x1000	lequad	0x0000000000000000	(encrypted)>>>>0x1000	lequad	!0x0000000000000000	(mask ROM)#------------------------------------------------------------------------------# nds_passme: file(1) magic for Nintendo DS ROM images for GBA cartridge boot.# This is also used for loading .nds files using the MSET exploit on 3DS.# Reference: https://github.com/devkitPro/ndstool/blob/master/source/ndscreate.cpp0xC0	bequad	0xC8604FE201708FE2	Nintendo DS Slot-2 ROM image (PassMe)!:mime	application/x-nintendo-ds-rom#------------------------------------------------------------------------------# ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format.# From: David Korth <gerbilsoft@gerbilsoft.com># References:# - https://neogpc.googlecode.com/svn-history/r10/trunk/src/core/neogpc.cpp# - https://www.devrs.com/ngp/files/ngpctech.txt#0x0A	string		BY\040SNK\040CORPORATION	Neo Geo Pocket!:mime	application/x-neo-geo-pocket-rom>0x23	byte		0x10			Color>0	byte		x			ROM image>0x24	string		>\0			\b: "%.12s">0x21	uleshort	x			\b, NEOP%04X>0x1F	ubyte		0xFF			(debug mode enabled)#------------------------------------------------------------------------------# msx: file(1) magic for MSX game cartridge dumps# Too simple - MPi#0 beshort 0x4142 MSX game cartridge dump#------------------------------------------------------------------------------# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) :0	string	PS-X\040EXE	Sony Playstation executable>16	lelong	x		PC=%#08x,>20	lelong	!0		GP=%#08x,>24	lelong	!0		.text=[%#08x,>>28	lelong	x		\b%#x],>32	lelong	!0		.data=[%#08x,>>36	lelong	x		\b%#x],>40	lelong	!0		.bss=[%#08x,>>44	lelong	x		\b%#x],>48	lelong	!0		Stack=%#08x,>48	lelong	=0		No Stack!,>52	lelong	!0		StackSize=%#x,#>76	string	>\0		(%s)#  Area:>113	string	x		(%s)# CPE executables0	string	CPE		CPE executable>3	byte	x		(version %d)# Sony PlayStation archive (PSARC)# From: Alexandre Iooss <erdnaxe@crans.org># URL: https://www.psdevwiki.com/ps3/PlayStation_archive_(PSARC)0	string		PSAR	Sony PlayStation Archive!:ext	psarc>4	ubeshort	x	\b, version %d.>6	ubeshort	x	\b%d>8	string		zlib	\b, zlib compression>8	string		lzma	\b, LZMA compression>28	ubeshort&2	0	\b, relative paths>28	ubeshort&2	2	\b, absolute paths>28	ubeshort&1	1	\b, ignore case#------------------------------------------------------------------------------# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>)0	string	XBEH	Microsoft Xbox executable!:mime	audio/x-xbox-executable!:ext	xbe# expect base address of 0x10000>0x0104                 ulelong =0x10000>>(0x0118.l-0x0FFF4)    lestring16 x       \b: "%.40s">>(0x0118.l-0x0FFF5)    byte     x         (%c>>(0x0118.l-0x0FFF6)    byte     x         \b%c->>(0x0118.l-0x0FFF8)    uleshort x         \b%03u)>>(0x0118.l-0x0FF60)    ulelong&0x80000007  0x80000007 \b, all regions>>(0x0118.l-0x0FF60)    ulelong&0x80000007  !0x80000007>>>(0x0118.l-0x0FF60)   ulelong >0           (regions:>>>>(0x0118.l-0x0FF60)  ulelong &0x00000001  NA>>>>(0x0118.l-0x0FF60)  ulelong &0x00000002  Japan>>>>(0x0118.l-0x0FF60)  ulelong &0x00000004  Rest_of_World>>>>(0x0118.l-0x0FF60)  ulelong &0x80000000  Manufacturer>>>(0x0118.l-0x0FF60)   ulelong >0           \b)# probabilistic checks whether signed or not>0x0004 ulelong =0x0>>&2    ulelong =0x0>>>&2   ulelong =0x0  \b, not signed>0x0004 ulelong >0>>&2    ulelong >0>>>&2   ulelong >0    \b, signed# --------------------------------# Microsoft Xbox data file formats0       string          XIP0            XIP, Microsoft Xbox data0       string          XTF0            XTF, Microsoft Xbox data#------------------------------------------------------------------------------# Microsoft Xbox 360 executables (.xex)# From: David Korth <gerbilsoft@gerbilsoft.com># References:# - https://free60project.github.io/wiki/XEX.html# - https://github.com/xenia-project/xenia/blob/HEAD/src/xenia/kernel/util/xex2_info.h# Title ID (part of Execution ID section)0		name	xbox-360-xex-execution-id>(0.L+0xC)	byte	x	(%c>(0.L+0xD)	byte	x	\b%c>(0.L+0xE)	beshort	x	\b-%04u, media ID:>(0.L)		belong	x	%08X)# Region code (part of Security Info)0	name	xbox-360-xex-region-code>0	ubelong	0xFFFFFFFF	\b, all regions>0	ubelong	!0xFFFFFFFF>>0	ubelong	>0		(regions:>>0	ubelong&0x000000FF	0x000000FF	USA>>0	ubelong&0x00000100	0x00000100	Japan>>0	ubelong&0x00000200	0x00000200	China>>0	ubelong&0x0000FC00	0x0000FC00	Asia>>0	ubelong&0x00FF0000	0x00FF0000	PAL>>0	ubelong&0x00FF0000	0x00FE0000	PAL [except AU/NZ]>>0	ubelong&0x00FF0000	0x00010000	AU/NZ>>0	ubelong&0xFF000000	0xFF000000	Other>>0	ubelong	>0		\b)0	string	XEX2	Microsoft Xbox 360 executable!:mime	audio/x-xbox360-executable!:ext	xex>0x18	search/0x100	\x00\x04\x00\x06>>&0	use	xbox-360-xex-execution-id>(0x010.L+0x178)	use	xbox-360-xex-region-code0	string	XEX1	Microsoft Xbox 360 executable (XEX1)!:mime	audio/x-xbox360-executable!:ext	xex>0x18	search/0x100	\x00\x04\x00\x06>>&0	use	xbox-360-xex-execution-id>(0x010.L+0x154)	use	xbox-360-xex-region-code#------------------------------------------------------------------------------# Microsoft Xbox 360 packages# From: David Korth <gerbilsoft@gerbilsoft.com># References:# - https://free60project.github.io/wiki/STFS.html# - https://github.com/xenia-project/xenia/blob/HEAD/src/xenia/kernel/util/xex2_info.h# TODO: More information for console-signed packages.0	name	xbox-360-package>0x360	byte	x	(%c>0x361	byte	x	\b%c>0x362	beshort	x	\b-%04u, media ID:>0x354	belong	x	%08X)>0x344	belong	x	\b, content type:>>0x344	belong	0x1		Saved Game>>0x344	belong	0x2		Marketplace Content>>0x344	belong	0x3		Publisher>>0x344	belong	0x1000		Xbox 360 Title>>0x344	belong	0x2000		IPTV Pause Buffer>>0x344	belong	0x4000		Installed Game>>0x344	belong	0x5000		Original Xbox Game>>0x344	belong	0x9000		Avatar Item>>0x344	belong	0x10000		Profile>>0x344	belong	0x20000		Gamer Picture>>0x344	belong	0x30000		Theme>>0x344	belong	0x40000		Cache File>>0x344	belong	0x50000		Storage Download>>0x344	belong	0x60000		Xbox Saved Game>>0x344	belong	0x70000		Xbox Download>>0x344	belong	0x80000		Game Demo>>0x344	belong	0x90000		Video>>0x344	belong	0xA0000		Game>>0x344	belong	0xB0000		Installer>>0x344	belong	0xC0000		Game Trailer>>0x344	belong	0xD0000		Arcade Title>>0x344	belong	0xE0000		XNA>>0x344	belong	0xF0000		License Store>>0x344	belong	0x100000	Movie>>0x344	belong	0x200000	TV>>0x344	belong	0x300000	Music Video>>0x344	belong	0x400000	Game Video>>0x344	belong	0x500000	Podcast Video>>0x344	belong	0x600000	Viral Video>>0x344	belong	0x2000000	Community Game0	string	CON\x20	Microsoft Xbox 360 package (console-signed)>0	use	xbox-360-package0	string	PIRS>0	belong	0	Microsoft Xbox 360 package (non-Xbox Live)>>0	use	xbox-360-package0	string	LIVE>0x104	belong	0	Microsoft Xbox 360 package (Xbox Live)>>0	use	xbox-360-package# Atari Lynx cartridge dump (EXE/BLL header)# From: "Stefan A. Haubenthal" <polluks@sdf.lonestar.org># Reference:# https://raw.githubusercontent.com/cc65/cc65/master/libsrc/lynx/exehdr.s# Double-check that the image type matches too, 0x8008 conflicts with# 8 character OMF-86 object file headers.0	beshort		0x8008>6	string		BS93		Lynx homebrew cartridge!:mime	application/x-atari-lynx-rom>>2	beshort		x		\b, RAM start $%04x# Update:	Joerg Jenderek# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/l/lnx.trid.xml# Note:		called "Atari Lynx ROM" by TrID0	string		LYNX		Lynx cartridge!:mime	application/x-atari-lynx-rom!:ext	lnx# bank 0 page size like: 128 256 512>4	leshort/4	>0		\b, bank 0 %dk>6	leshort/4	>0		\b, bank 1 %dk# 32 bytes cart name like: "jconnort.lyx" "viking~1.lyx" "Eye of the Beholder" "C:\EMU\LYNX\ROMS\ULTCHESS.LYX">10	string		>\0		\b, "%.32s"# 16 bytes manufacturer like: "Atari" "NuFX Inc." "Matthias Domin">42	string		>\0		\b, "%.16s"# version number#>8	leshort		!1		\b, version number %u# rotation: 1~left Lexis (NA).lnx 2~right Centipede (Prototype).lnx>58	ubyte		>0		\b, rotation %u# spare#>59	lelong		!0		\b, spare %#x# Opera file system that is used on the 3DO console# From: Serge van den Boom <svdb@stack.nl>0	string		\x01ZZZZZ\x01	3DO "Opera" file system# From: Alex Myczko <alex@aiei.ch># From: David Pflug <david@pflug.email># Update:	Joerg Jenderek# URL:		http://fileformats.archiveteam.org/wiki/Game_Boy_Sound#		http://en.wikipedia.org/wiki/Game_Boy_Sound_System# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/g/gbs.trid.xml# Note:		called "GameBoy Sound System dump" by TrID,#		"Gameboy GBS rom image" by X11 Gameboy sound player xgbsplay and#		verified by gbsplay `LANG=C gbsinfo /usr/share/doc/gbsplay/examples/nightmode.gbs`# is the offset 12 or the offset 16 correct?# GBS (Game Boy Sound) magic# http://ftp.modland.com/pub/documents/format_documentation/\# Gameboy%20Sound%20System%20(.gbs).txt# skip Grand Theft Auto 2 Style data (*.sty via sty-gta2.trid.xml) and Opera (*.patch) by check for valid "low" version0	string		GBS\001		Nintendo Gameboy Music/Audio Data!:mime		audio/x-nintendo-gbs# by gbsplay or xgbsplay tools#!:mime		audio/gbs#!:mime		audio/prs.gbs!:ext	gbs# fields are right null-filled; no terminating \0 if all bytes are used; if field unknown, should be set to a single ?# title string like: "Blues Brothers" "Bugs Bunny Crazy Castle 3"#12	string		GameBoy\040Music\040Module	Nintendo Gameboy Music Module>16	string		>\0	("%.32s" by# author string like: <?>, by Laxity, Justin Muir, 1993 Ocean>48	string		>\0	%.32s, copyright# copyright string like: empty "1991 Titus" "2001 Imagineer/KT.Kodansha/P&B" "2000 Newline, Ubisoft, D. Eclip.">80	string		>\0	%.32s# GBSVersion; 1 #>3	byte		!1	version %u,# number of songs (1-255)>4	ubyte		x	\b), %u track# plural s>4	ubyte		>1	\bs# default subsong; like: 1 (often) 2 29 60 79 82>5	ubyte		!1	\b, %u first# load address (400h-7fffh)>6	uleshort	x	\b, load address %#4.4x# init address (400h-7fffh)>8	uleshort	x	\b, init address %#4.4x# play address (400-7fffh)>10	uleshort	x	\b, play address %#4.4x# stack pointer; like: FFFEh (default) CFFFh DCFEh DDFEh DDFFh DEFFh E000h FFF4h>12	uleshort	x	\b, stack pointer %#4.4x# timer modulo; often 0>14	ubyte		!0	\b, timer modulo %#x# timer control; often 0>15	ubyte		!0	\b, timer control %#x# code and Data (see RST VECTORS)#>0x70	ubequad		x	\b, data %#16.16llx...# IPS Patch Files from: From: Thomas Klausner <tk@giga.or.at># see https://zerosoft.zophar.net/ips.php0	string	PATCH			IPS patch file!:ext	ips# BPS Patch Files - from: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://www.romhacking.net/documents/746/0	string	BPS1			BPS patch file!:ext	bps# APS Patch Files - from: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://github.com/btimofeev/UniPatcher/wiki/APS-(N64)0	string	APS10			APS patch file!:ext	aps>5	byte	0			\b, simple patch>5	byte	1			\b, N64-specific patch for>>58	byte	x			N%c>>59	byte	x			\b%c>>60	byte	x			\b%c>7	byte	!0x20# FIXME: /T specifier isn't working with a fixed-length string.>>7	string	x			\b: "%.50s"# UPS Patch Files - from: David Korth <gerbilsoft@gerbilsoft.com># Reference: http://fileformats.archiveteam.org/wiki/UPS_(binary_patch_format)0	string	UPS1			UPS patch file!:ext	ups# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at>0	string	PPF30			Playstation Patch File version 3.0>5	byte	0			\b, PPF 1.0 patch>5	byte	1			\b, PPF 2.0 patch>5	byte	2			\b, PPF 3.0 patch>>56	byte	0			\b, Imagetype BIN (any)>>56	byte	1			\b, Imagetype GI (PrimoDVD)>>57	byte	0			\b, Blockcheck disabled>>57	byte	1			\b, Blockcheck enabled>>58	byte	0			\b, Undo data not available>>58	byte	1			\b, Undo data available>6	string	x			\b, description: %s0	string	PPF20			Playstation Patch File version 2.0>5	byte	0			\b, PPF 1.0 patch>5	byte	1			\b, PPF 2.0 patch>>56	lelong	>0			\b, size of file to patch %d>6	string	x			\b, description: %s0	string	PPF10			Playstation Patch File version 1.0>5	byte	0			\b, Simple Encoding>6	string	x			\b, description: %s# Compressed ISO disc image (used mostly by PSP, PS2 and MegaDrive)# From: Alexandre Iooss <erdnaxe@crans.org># URL: https://en.wikipedia.org/wiki/.CSO# NOTE: This is NOT the same as Compact ISO or GameCube/Wii disc image,# though it has the same magic number.0               string                  CISO# Match CISO version 1 with ISO-9660 sector size>20             ubyte                   <2>>16            ulelong                 =2048           CSO v1 disk image!:mime  application/x-compressed-iso!:ext   ciso/cso>>>8            ulequad                 x               \b, original size %llu bytes>>>16           ulelong                 x               \b, datablock size %u bytes# Match CISO version 2>20             ubyte                   =2>>22            uleshort                =0>>>4            ulelong                 =24             CSO v2 disk image!:mime  application/x-compressed-iso!:ext   ciso/cso>>>>8           ulequad                 x               \b, original size %llu bytes>>>>16          ulelong                 x               \b, datablock size %u bytes# Type: Nintendo GameCube/Wii disc image (CISO format)# NOTE: This is NOT the same as Compact ISO or PSP CISO,# though it has the same magic number.# Other fields are used to determine what type of CISO this is:# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size)# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size)# - None of the above: Compact ISO.>4		lelong	0x200000>>8		byte	1>>>0x801C	belong	0xC2339F3D	Nintendo GameCube disc image (CISO format):!:mime	application/x-wii-rom>>>>0x8000	use	nintendo-gcn-disc-common>>>0x8018	belong	0x5D1C9EA3	Nintendo Wii disc image (CISO format):!:mime	application/x-wii-rom>>>>0x8000	use	nintendo-gcn-disc-common# .cso files# Reference: https://pismotec.com/ciso/ciso.h# NOTE: There are two other formats with the same magic but# completely incompatible specifications:# - GameCube/Wii CISO: https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/DiscIO/CISOBlob.h# - PSP CISO: https://github.com/jamie/ciso/blob/master/ciso.h# Other fields are used to determine what type of CISO this is:# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size)# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size)# - 0x10 == 0x00004000: For >2GB files using maxcso...# 			https://github.com/unknownbrackets/maxcso/issues/26# - None of the above: Compact ISO.>4	lelong	!0>>4	lelong	!0x200000>>>16	lelong	!0x800>>>>16	lelong	!0x4000		Compressed ISO CD image# From: Daniel Dawson <ddawson@icehouse.net># SNES9x .smv "movie" file format.0		string		SMV\x1A	SNES9x input recording>0x4		lelong		x	\b, version %d# version 4 is latest so far>0x4		lelong		<5>>0x8		ledate		x	\b, recorded at %s>>0xc		lelong		>0	\b, rerecorded %d times>>0x10		lelong		x	\b, %d frames long>>0x14		byte		>0	\b, data for controller(s):>>>0x14		byte		&0x1	#1>>>0x14		byte		&0x2	#2>>>0x14		byte		&0x4	#3>>>0x14		byte		&0x8	#4>>>0x14		byte		&0x10	#5>>0x15		byte		^0x1	\b, begins from snapshot>>0x15		byte		&0x1	\b, begins from reset>>0x15		byte		^0x2	\b, NTSC standard>>0x15		byte		&0x2	\b, PAL standard>>0x17		byte		&0x1    \b, settings:# WIP1Timing not used as of version 4>>>0x4		lelong		<4>>>>0x17	byte		&0x2	WIP1Timing>>>0x17		byte		&0x4	Left+Right>>>0x17		byte		&0x8	VolumeEnvX>>>0x17		byte		&0x10	FakeMute>>>0x17		byte		&0x20	SyncSound# New flag as of version 4>>>0x4		lelong		>3>>>>0x17	byte		&0x80	NoCPUShutdown>>0x4		lelong		<4>>>0x18		lelong		>0x23>>>>0x20	leshort		!0>>>>>0x20	lestring16	x	\b, metadata: "%s">>0x4		lelong		>3>>>0x24		byte		>0	\b, port 1:>>>>0x24	byte		1	joypad>>>>0x24	byte		2	mouse>>>>0x24	byte		3	SuperScope>>>>0x24	byte		4	Justifier>>>>0x24	byte		5	multitap>>>0x24		byte		>0	\b, port 2:>>>>0x25	byte		1	joypad>>>>0x25	byte		2	mouse>>>>0x25	byte		3	SuperScope>>>>0x25	byte		4	Justifier>>>>0x25	byte		5	multitap>>>0x18		lelong		>0x43>>>>0x40	leshort		!0>>>>>0x40	lestring16	x	\b, metadata: "%s">>0x17		byte		&0x40   \b, ROM:>>>(0x18.l-26)	lelong		x	CRC32 %#08x>>>(0x18.l-23)	string		x	"%s"# Type: scummVM savegame files# From: Sven Hartge <debian@ds9.argh.org>0	string	SCVM	ScummVM savegame>12	string	>\0	"%s"#------------------------------------------------------------------------------# Nintendo GameCube / Wii file formats.## Type: Nintendo GameCube/Wii common disc header data.# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://wiibrew.org/wiki/Wii_Disc0	name	nintendo-gcn-disc-common>0x20	string	x	"%.64s">0x00	string	x	(%.6s>0x06	byte	>0>>0x06	byte	1	\b, Disc 2>>0x06	byte	2	\b, Disc 3>>0x06	byte	3	\b, Disc 4>0x07	byte	x	\b, Rev.%02u)>0x18	belong	0x5D1C9EA3>>0x60	beshort	0x0101	\b (Unencrypted)>0x200	string	NKIT	\b (NKit compressed)# Type: Nintendo GameCube disc image# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://wiibrew.org/wiki/Wii_Disc0x1C	belong	0xC2339F3D	Nintendo GameCube disc image:!:mime	application/x-gamecube-rom>0	use	nintendo-gcn-disc-common# Type: Nintendo GameCube embedded disc image# Commonly found on demo discs.# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: http://hitmen.c02.at/files/yagcd/yagcd/index.html#idx14.80		belong	0xAE0F38A2>0x0C		belong	0x00100000>>(8.L+0x1C)	belong	0xC2339F3D	Nintendo GameCube embedded disc image:!:mime	application/x-gamecube-rom>>>(8.L)	use	nintendo-gcn-disc-common# Type: Nintendo Wii disc image# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://wiibrew.org/wiki/Wii_Disc0x18	belong	0x5D1C9EA3	Nintendo Wii disc image:>0	use	nintendo-gcn-disc-common# Type: Nintendo Wii disc image (WBFS format)# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://wiibrew.org/wiki/Wii_Disc0	string	WBFS>0x218	belong	0x5D1C9EA3	Nintendo Wii disc image (WBFS format):!:mime	application/x-wii-rom>>0x200	use	nintendo-gcn-disc-common# Type: Nintendo GameCube/Wii disc image (GCZ format)# Due to zlib compression, we can't get the actual disc information.0	lelong	0xB10BC001>4	lelong	0		Nintendo GameCube disc image (GCZ format)!:mime	application/x-gamecube-rom>4	lelong	1		Nintendo Wii disc image (GCZ format)!:mime	application/x-wii-rom>4	default	x		Nintendo GameCube/Wii disc image (GCZ format)# Type: Nintendo GameCube/Wii disc image (WDF format)0		string	WII\001DISC>8		belong	1# WDFv1>>0x54		belong	0xC2339F3D	Nintendo GameCube disc image (WDFv1 format):!:mime	application/x-gamecube-rom>>>0x38		use	nintendo-gcn-disc-common>>0x58		belong	0x5D1C9EA3	Nintendo Wii disc image (WDFv1 format):!:mime	application/x-wii-rom>>>0x38		use	nintendo-gcn-disc-common>8		belong	2# WDFv2>>(12.L+0x1C)	belong	0xC2339F3D	Nintendo GameCube disc image (WDFv2 format):!:mime	application/x-gamecube-rom>>>(12.L)	use	nintendo-gcn-disc-common>>(12.L+0x18)	belong	0x5D1C9EA3	Nintendo Wii disc image (WDFv2 format):!:mime	application/x-wii-rom>>>(12.L)	use	nintendo-gcn-disc-common# Type: Nintendo GameCube/Wii disc image (WIA format)0	string	WIA\001	Nintendo>0x48	belong	1	GameCube!:mime	application/x-gamecube-rom>0x48	belong	2	Wii!:mime	application/x-wii-rom>0x48	default	x	GameCube/Wii>0x48	belong	x	disc image (WIA format):>>0x58	use	nintendo-gcn-disc-common# Type: Nintendo GameCube/Wii disc image (with SDK header)# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://wiibrew.org/wiki/Wii_Disc0		belong	0xFFFF0000>0x18		belong	0x00000000>>0x1C		belong	0x00000000>>>0x8018	belong	0x5D1C9EA3	Nintendo Wii SDK disc image:!:mime	application/x-wii-rom>>>>0x8000	use	nintendo-gcn-disc-common>>>0x801C	belong	0xC2339F3D	Nintendo GameCube SDK disc image:!:mime	application/x-gamecube-rom>>>>0x8000	use	nintendo-gcn-disc-common# Type: Nintendo GameCube/Wii disc image (RVZ format)0	string		RVZ\001	Nintendo>0x48	belong		1	GameCube!:mime	application/x-gamecube-rom>0x48	belong		2	Wii!:mime	application/x-wii-rom>0x48	default		x	GameCube/Wii>0x48	belong		x	disc image (RVZ format):>>0x58	use		nintendo-gcn-disc-common#------------------------------------------------------------------------------# Nintendo 3DS file formats.## Type: Nintendo 3DS "NCSD" image. (game cards and eMMC)# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://www.3dbrew.org/wiki/NCSD0x100		string		NCSD>0x118		lequad		0		Nintendo 3DS Game Card image# NCCH header for partition 0. (game data)>>0x1150	string		>\0	\b: "%.16s">>0x312		byte		x	(Rev.%02u)>>0x118C	byte		2	(New3DS only)>>0x18D		byte		0		(inner device)>>0x18D		byte		1		(Card1)>>0x18D		byte		2		(Card2)>>0x18D		byte		3		(extended device)>0x118		bequad		0x0102020202000000	Nintendo 3DS eMMC dump (Old3DS)>0x118		bequad		0x0102020203000000	Nintendo 3DS eMMC dump (New3DS)# Nintendo 3DS version code.# Reference: https://www.3dbrew.org/wiki/Titles# Format: leshort containing three fields:# - 6-bit: Major# - 6-bit: Minor# - 4-bit: Revision# NOTE: Only supporting major/minor versions from 0-15 right now.# NOTE: Should be prefixed with "v".0	name	nintendo-3ds-version-code# Raw version.>0	leshort	x	\b%u,# Major version.>0	leshort&0xFC00	0x0000	0>0	leshort&0xFC00	0x0400	1>0	leshort&0xFC00	0x0800	2>0	leshort&0xFC00	0x0C00	3>0	leshort&0xFC00	0x1000	4>0	leshort&0xFC00	0x1400	5>0	leshort&0xFC00	0x1800	6>0	leshort&0xFC00	0x1C00	7>0	leshort&0xFC00	0x2000	8>0	leshort&0xFC00	0x2400	9>0	leshort&0xFC00	0x2800	10>0	leshort&0xFC00	0x2C00	11>0	leshort&0xFC00	0x3000	12>0	leshort&0xFC00	0x3400	13>0	leshort&0xFC00	0x3800	14>0	leshort&0xFC00	0x3C00	15# Minor version.>0	leshort&0x03F0	0x0000	\b.0>0	leshort&0x03F0	0x0010	\b.1>0	leshort&0x03F0	0x0020	\b.2>0	leshort&0x03F0	0x0030	\b.3>0	leshort&0x03F0	0x0040	\b.4>0	leshort&0x03F0	0x0050	\b.5>0	leshort&0x03F0	0x0060	\b.6>0	leshort&0x03F0	0x0070	\b.7>0	leshort&0x03F0	0x0080	\b.8>0	leshort&0x03F0	0x0090	\b.9>0	leshort&0x03F0	0x00A0	\b.10>0	leshort&0x03F0	0x00B0	\b.11>0	leshort&0x03F0	0x00C0	\b.12>0	leshort&0x03F0	0x00D0	\b.13>0	leshort&0x03F0	0x00E0	\b.14>0	leshort&0x03F0	0x00F0	\b.15# Revision.>0	leshort&0x000F	x	\b.%u# Type: Nintendo 3DS "NCCH" container.# https://www.3dbrew.org/wiki/NCCH0x100		string	NCCH	Nintendo 3DS>0x18D		byte&2	0	File Archive (CFA)>0x18D		byte&2	2	Executable Image (CXI)>0x150		string	>\0	\b: "%.16s">0x18D		byte	0x05>>0x10E		leshort	x	(Old3DS System Update v>>0x10E		use	nintendo-3ds-version-code>>0x10E		leshort	x	\b)>0x18D		byte	0x15>>0x10E		leshort	x	(New3DS System Update v>>0x10E		use	nintendo-3ds-version-code>>0x10E		leshort	x	\b)>0x18D		byte	!0x05>>0x18D		byte	!0x15>>>0x112	byte	x	(v>>>0x112	use	nintendo-3ds-version-code>>>0x112	byte	x	\b)>0x18C		byte	2	(New3DS only)# Type: Nintendo 3DS "SMDH" file. (application description)# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://3dbrew.org/wiki/SMDH0		string		SMDH		Nintendo 3DS SMDH file>0x208		leshort		!0>>0x208		lestring16	x		\b: "%.128s">>0x388		leshort		!0>>>0x388	lestring16	x		by %.128s>0x208		leshort		0>>0x008		leshort		!0>>>0x008	lestring16	x		\b: "%.128s">>>0x188	leshort		!0>>>>0x188	lestring16	x		by %.128s# Type: Nintendo 3DS Homebrew Application.# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://3dbrew.org/wiki/3DSX_Format0	string	3DSX	Nintendo 3DS Homebrew Application (3DSX)# Type: Nintendo 3DS Banner Model Data.# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://3dbrew.org/wiki/CBMD0	string	CBMD\0\0\0\0	Nintendo 3DS Banner Model Data#------------------------------------------------------------------------------# a7800: file(1) magic for the Atari 7800 raw ROM format.# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://sites.google.com/site/atari7800wiki/a78-header0	byte	>0>0	byte	<3>>1	string	ATARI7800	Atari 7800 ROM image!:mime	application/x-atari-7800-rom>>>0x11	string	>\0	\b: "%.32s"# Display type.>>>0x39	byte	0	(NTSC)>>>0x39	byte	1	(PAL)>>>0x36	byte&1	1	(POKEY)#------------------------------------------------------------------------------# vectrex: file(1) magic for the GCE Vectrex raw ROM format.# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: http://www.playvectrex.com/designit/chrissalo/hello1.htm## NOTE: Title is terminated with 0x80, not 0.# The header is terminated with a 0, so that will# terminate the title as well.#0	string	g\040GCE	Vectrex ROM image>0x11	string	>\0	\b: "%.16s"#------------------------------------------------------------------------------# amiibo: file(1) magic for Nintendo amiibo NFC dumps.# From: David Korth <gerbilsoft@gerbilsoft.com># Reference: https://www.3dbrew.org/wiki/Amiibo0x00		byte	0x04>0x0A		beshort	0x0FE0>>0x0C		belong	0xF110FFEE>>>0x208	beshort	0x0100>>>>0x020A	byte	0x0F>>>>>0x020C	bequad	0x000000045F000000>>>>>>0x5B	byte	0x02>>>>>>>0x54	belong	x	Nintendo amiibo NFC dump - amiibo ID: %08X->>>>>>>0x58	belong	x	\b%08X#------------------------------------------------------------------------------# Type: Nintendo Switch XCI (Game Cartridge Image)# From: Benjamin Lowry <ben@ben.gmbh># Reference: https://switchbrew.org/wiki/Gamecard_Format0x100		string	HEAD>0x10D		byte	0xFA	Nintendo Switch cartridge image (XCI), 1GB>0x10D		byte	0xF8	Nintendo Switch cartridge image (XCI), 2GB>0x10D		byte	0xF0	Nintendo Switch cartridge image (XCI), 4GB>0x10D		byte	0xE0	Nintendo Switch cartridge image (XCI), 8GB>0x10D		byte	0xE1	Nintendo Switch cartridge image (XCI), 16GB>0x10D		byte	0xE2	Nintendo Switch cartridge image (XCI), 32GB#------------------------------------------------------------------------------# Type: Nintendo Switch Executable# From: Benjamin Lowry <ben@ben.gmbh># Reference: https://switchbrew.org/wiki/NSO0x00		string	NSO0	Nintendo Switch executable (NSO)#------------------------------------------------------------------------------# Type: Nintendo Switch PFS0# From: Benjamin Lowry <ben@ben.gmbh># Reference: https://switchbrew.org/wiki/NCA_Format#PFS00x00		string	PFS0	Nintendo Switch partition filesystem (PFS0)>0x04		ulelong	x	\b, %d files#------------------------------------------------------------------------------# amiibo: file(1) magic for Nintendo Badge Arcade files.# From: David Korth <gerbilsoft@gerbilsoft.com># References:# - https://github.com/GerbilSoft/rom-properties/issues/92# - https://github.com/CaitSith2/BadgeArcadeTool# - https://github.com/TheMachinumps/Advanced-badge-editor# PRBS: Individual badge and/or mega badge.0		string	PRBS>0x44		byte	>0x20	Nintendo Badge Arcade>>0xB8		ulelong	<2>>>0xBC		ulelong	<2	badge:>>>0xBC		ulelong	>1	Mega Badge>>>>0xB8	ulelong	x	(%ux>>>>0xBC	ulelong	x	\b%u):>>0xB8		ulelong	>1	Mega Badge>>>0xB8		ulelong	x	(%ux>>>0xBC		ulelong	x	\b%u):>0x44		string	x	"%s">0x3C		ulelong	x	\b, badge ID: %u>0x74		byte	>0x20>>0x74		string	x	\b, set: "%s">0xA8		ulelong	!0xFFFFFFFF>>0xA8		ulelong	x	\b, launch title ID: %08X>>0xA4		ulelong	x	\b-%08X# CABS: Badge set.0	string	CABS>0x2C	byte	>0x20	Nintendo Badge Arcade badge set:>>0x2C	string	x	"%.48s">>0x24	ulelong	x	\b, set ID: %u#------------------------------------------------------------------------------# sufami: file(1) magic for Sufami Turbo ROM images.# From: David Korth <gerbilsoft@gerbilsoft.com># References:# - https://problemkaputt.de/fullsnes.htm#snescartsufamiturbominicartridgeadaptor0	string		BANDAI\040SFC-ADX>0x10	string		!SFC-ADX\040BACKUP	Sufami Turbo ROM image:>>0x10	string/T	x	"%.14s">>0x30	byte		x	\b, ID %02X>>0x31	byte		x	\b%02X>>0x32	byte		x	\b%02X>>0x33	ubyte		>0	\b, series index %u>>0x34	ubyte		0	[SlowROM]>>0x34	ubyte		1	[FastROM]>>0x35	ubyte		1	[SRAM]>>0x35	ubyte		3	[Special]#------------------------------------------------------------------------------# Type: Super NES ROM image# From: Alexandre Iooss <erdnaxe@crans.org># Reference: https://snes.nesdev.org/wiki/ROM_header0		name		snes-rom-hdr# cartridge title is encoded in JIS X 0201, 21 chars padded with spaces>0		ubyte-0x20	<0xC0>>1		ubyte-0x20	<0xC0>>>2		ubyte-0x20	<0xC0>>>>3		ubyte-0x20	<0xC0>>>>>4		ubyte-0x20	<0xC0>>>>>>5		ubyte-0x20	<0xC0>>>>>>>6	ubyte-0x20	<0xC0>>>>>>>>7	ubyte-0x20	<0xC0>>>>>>>>>8	ubyte-0x20	<0xC0>>>>>>>>>>9	ubyte-0x20	<0xC0>>>>>>>>>>>10	ubyte-0x20	<0xC0>>>>>>>>>>>>21	ubyte-0x20	<0xC0		Super NES ROM image>>>>>>>>>>>>>0	string/21/T	x		"%s">>>>>>>>>>>>>25	byte		0		(Japan)>>>>>>>>>>>>>25	byte		1		(USA)>>>>>>>>>>>>>25	byte		2		(Europe)>>>>>>>>>>>>>25	byte		6		(France)>>>>>>>>>>>>>25	byte		7		(Netherlands)>>>>>>>>>>>>>25	byte		9		(Germany)>>>>>>>>>>>>>25	byte		10		(Brazil)>>>>>>>>>>>>>27	byte		>0		(Rev.%02u)>>>>>>>>>>>>>21	byte&0xF	0x0		\b, LoROM>>>>>>>>>>>>>21	byte&0xF	0x1		\b, HiROM>>>>>>>>>>>>>21	byte&0x10	0x10		\b, FastROM>>>>>>>>>>>>>23	byte		8		\b, ROM size: 256KB>>>>>>>>>>>>>23	byte		9		\b, ROM size: 512KB>>>>>>>>>>>>>23	byte		10		\b, ROM size: 1024KB>>>>>>>>>>>>>23	byte		11		\b, ROM size: 2048KB>>>>>>>>>>>>>23	byte		12		\b, ROM size: 4096KB>>>>>>>>>>>>>24	byte		0		\b, RAM size: 1KB>>>>>>>>>>>>>24	byte		1		\b, RAM size: 2KB>>>>>>>>>>>>>24	byte		2		\b, RAM size: 4KB>>>>>>>>>>>>>24	byte		3		\b, RAM size: 8KB>>>>>>>>>>>>>24	byte		4		\b, RAM size: 16KB>>>>>>>>>>>>>24	byte		5		\b, RAM size: 32KB>>>>>>>>>>>>>24	byte		6		\b, RAM size: 64KB# header position for LoROM: $007FC032725		ubyte&0xEF	0x20# ROM is <=4096KB, RAM is <=64KB and country<=10>32727		ubyte		<13>>32728		ubyte		<7>>>32729	ubyte		<11>>>>32704	use		snes-rom-hdr# HiROM header at $00FFC065493		ubyte&0xEF	0x21# ROM is <=4096KB, RAM is <=64KB and country<=10>65495		ubyte		<13>>65496		ubyte		<7>>>65497	ubyte		<11>>>>65472	use		snes-rom-hdr#------------------------------------------------------------------------------# ancast: file(1) magic for Wii U firmware images, aka "ancast" images.# From: David Korth <gerbilsoft@gerbilsoft.com># References:# - https://wiiubrew.org/wiki/Ancast_image0	ubelong	0xEFA282D9	Wii U firmware image:>0x20	ubelong	2		ARM>>0x1A4	ubelong	0x21		\b, NAND boot>>0x1A4	ubelong	0x22		\b, SD boot>>0x1A8	ubelong	1		\b, for devkits>>0x1A8	ubelong	2		\b, for retail>0x20	ubelong	1		PowerPC>>0xA4	ubelong	0x11		\b, Wii U mode>>0xA4	ubelong	0x12		\b, Wii mode
 |