1226048Sobrien
268349Sobrien#------------------------------------------------------------------------------
3267843Sdelphij# $File: console,v 1.19 2013/02/06 14:18:52 christos Exp $
468349Sobrien# Console game magic
568349Sobrien# Toby Deshane <hac@shoelace.digivill.net>
668349Sobrien#    ines:  file(1) magic for Marat's iNES Nintendo Entertainment System
768349Sobrien#           ROM dump format
868349Sobrien
968349Sobrien0 string NES\032 iNES ROM dump,
1068349Sobrien>4 byte  x     %dx16k PRG
1168349Sobrien>5 byte  x     \b, %dx8k CHR
1268349Sobrien>6 byte&0x01  =0x1  \b, [Vert.]
1368349Sobrien>6 byte&0x01  =0x0  \b, [Horiz.]
1468349Sobrien>6 byte&0x02  =0x2  \b, [SRAM]
1568349Sobrien>6 byte&0x04  =0x4  \b, [Trainer]
1668349Sobrien>6 byte&0x04  =0x8  \b, [4-Scr]
1768349Sobrien
1868349Sobrien#------------------------------------------------------------------------------
1968349Sobrien# gameboy:  file(1) magic for the Nintendo (Color) Gameboy raw ROM format
2068349Sobrien#
2168349Sobrien0x104 belong 0xCEED6666 Gameboy ROM:
2268349Sobrien>0x134 string >\0 "%.16s"
2368349Sobrien>0x146 byte 0x03  \b,[SGB]
2468349Sobrien>0x147 byte 0x00  \b, [ROM ONLY]
2568349Sobrien>0x147 byte 0x01  \b, [ROM+MBC1]
2668349Sobrien>0x147 byte 0x02  \b, [ROM+MBC1+RAM]
2768349Sobrien>0x147 byte 0x03  \b, [ROM+MBC1+RAM+BATT]
2868349Sobrien>0x147 byte 0x05  \b, [ROM+MBC2]
2968349Sobrien>0x147 byte 0x06  \b, [ROM+MBC2+BATTERY]
3068349Sobrien>0x147 byte 0x08  \b, [ROM+RAM]
3168349Sobrien>0x147 byte 0x09  \b, [ROM+RAM+BATTERY]
3268349Sobrien>0x147 byte 0x0B  \b, [ROM+MMM01]
3368349Sobrien>0x147 byte 0x0C  \b, [ROM+MMM01+SRAM]
3468349Sobrien>0x147 byte 0x0D  \b, [ROM+MMM01+SRAM+BATT]
3568349Sobrien>0x147 byte 0x0F  \b, [ROM+MBC3+TIMER+BATT]
3668349Sobrien>0x147 byte 0x10  \b, [ROM+MBC3+TIMER+RAM+BATT]
3768349Sobrien>0x147 byte 0x11  \b, [ROM+MBC3]
3868349Sobrien>0x147 byte 0x12  \b, [ROM+MBC3+RAM]
3968349Sobrien>0x147 byte 0x13  \b, [ROM+MBC3+RAM+BATT]
4068349Sobrien>0x147 byte 0x19  \b, [ROM+MBC5]
4168349Sobrien>0x147 byte 0x1A  \b, [ROM+MBC5+RAM]
4268349Sobrien>0x147 byte 0x1B  \b, [ROM+MBC5+RAM+BATT]
4368349Sobrien>0x147 byte 0x1C  \b, [ROM+MBC5+RUMBLE]
4468349Sobrien>0x147 byte 0x1D  \b, [ROM+MBC5+RUMBLE+SRAM]
4568349Sobrien>0x147 byte 0x1E  \b, [ROM+MBC5+RUMBLE+SRAM+BATT]
4668349Sobrien>0x147 byte 0x1F  \b, [Pocket Camera]
4768349Sobrien>0x147 byte 0xFD  \b, [Bandai TAMA5]
4868349Sobrien>0x147 byte 0xFE  \b, [Hudson HuC-3]
4968349Sobrien>0x147 byte 0xFF  \b, [Hudson HuC-1]
5068349Sobrien
5168349Sobrien>0x148 byte 0     \b, ROM: 256Kbit
5268349Sobrien>0x148 byte 1     \b, ROM: 512Kbit
5368349Sobrien>0x148 byte 2     \b, ROM: 1Mbit
5468349Sobrien>0x148 byte 3     \b, ROM: 2Mbit
5568349Sobrien>0x148 byte 4     \b, ROM: 4Mbit
5668349Sobrien>0x148 byte 5     \b, ROM: 8Mbit
5768349Sobrien>0x148 byte 6     \b, ROM: 16Mbit
5868349Sobrien>0x148 byte 0x52  \b, ROM: 9Mbit
5968349Sobrien>0x148 byte 0x53  \b, ROM: 10Mbit
6068349Sobrien>0x148 byte 0x54  \b, ROM: 12Mbit
6168349Sobrien
6268349Sobrien>0x149 byte 1     \b, RAM: 16Kbit
6368349Sobrien>0x149 byte 2     \b, RAM: 64Kbit
6468349Sobrien>0x149 byte 3     \b, RAM: 128Kbit
6568349Sobrien>0x149 byte 4     \b, RAM: 1Mbit
6668349Sobrien
6768349Sobrien#>0x14e long  x     \b, CRC: %x
6868349Sobrien
6968349Sobrien#------------------------------------------------------------------------------
7068349Sobrien# genesis:  file(1) magic for the Sega MegaDrive/Genesis raw ROM format
7168349Sobrien#
7268349Sobrien0x100 string SEGA  Sega MegaDrive/Genesis raw ROM dump
7368349Sobrien>0x120 string >\0 Name: "%.16s"
7468349Sobrien>0x110 string >\0 %.16s
7568349Sobrien>0x1B0 string RA with SRAM
7668349Sobrien
7768349Sobrien#------------------------------------------------------------------------------
7868349Sobrien# genesis:  file(1) magic for the Super MegaDrive ROM dump format
7968349Sobrien#
8068349Sobrien0x280 string EAGN  Super MagicDrive ROM dump
8168349Sobrien>0 byte x %dx16k blocks
8268349Sobrien>2 byte 0 \b, last in series or standalone
8368349Sobrien>2 byte >0 \b, split ROM
8468349Sobrien>8 byte 0xAA
8568349Sobrien>9 byte 0xBB
8668349Sobrien
8768349Sobrien#------------------------------------------------------------------------------
8868349Sobrien# genesis:  file(1) alternate magic for the Super MegaDrive ROM dump format
8968349Sobrien#
9068349Sobrien0x280 string EAMG  Super MagicDrive ROM dump
9168349Sobrien>0 byte x %dx16k blocks
9268349Sobrien>2 byte x \b, last in series or standalone
9368349Sobrien>8 byte 0xAA
9468349Sobrien>9 byte 0xBB
9568349Sobrien
9668349Sobrien#------------------------------------------------------------------------------
9768349Sobrien# smsgg:  file(1) magic for Sega Master System and Game Gear ROM dumps
9868349Sobrien#
9968349Sobrien# Does not detect all images.  Very preliminary guesswork.  Need more data
10068349Sobrien# on format.
10168349Sobrien#
10268349Sobrien# FIXME: need a little more info...;P
10368349Sobrien#
10468349Sobrien#0 byte 0xF3
10568349Sobrien#>1 byte 0xED  Sega Master System/Game Gear ROM dump
10668349Sobrien#>1 byte 0x31  Sega Master System/Game Gear ROM dump
10768349Sobrien#>1 byte 0xDB  Sega Master System/Game Gear ROM dump
10868349Sobrien#>1 byte 0xAF  Sega Master System/Game Gear ROM dump
10968349Sobrien#>1 byte 0xC3  Sega Master System/Game Gear ROM dump
11068349Sobrien
11168349Sobrien#------------------------------------------------------------------------------
11268349Sobrien# dreamcast:  file(1) uncertain magic for the Sega Dreamcast VMU image format
11368349Sobrien#
11468349Sobrien0 belong 0x21068028   Sega Dreamcast VMU game image
11568349Sobrien0 string LCDi         Dream Animator file
11668349Sobrien
11768349Sobrien#------------------------------------------------------------------------------
11868349Sobrien# v64: file(1) uncertain magic for the V64 format N64 ROM dumps
11968349Sobrien#
12068349Sobrien0 belong 0x37804012    V64 Nintendo 64 ROM dump
12168349Sobrien
122186690Sobrien# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
123186690Sobrien# Nintendo .nds
124186690Sobrien192	string	\044\377\256Qi\232	Nintendo DS Game ROM Image
125186690Sobrien# Nintendo .gba
126186690Sobrien0	string	\056\000\000\352$\377\256Qi	Nintendo Game Boy Advance ROM Image
127186690Sobrien
12868349Sobrien#------------------------------------------------------------------------------
12968349Sobrien# msx: file(1) magic for MSX game cartridge dumps
130133359Sobrien# Too simple - MPi
131133359Sobrien#0 beshort 0x4142 MSX game cartridge dump 
132133359Sobrien
133133359Sobrien#------------------------------------------------------------------------------
134133359Sobrien# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) :
135133359Sobrien0	string	PS-X\ EXE	Sony Playstation executable
136133359Sobrien#  Area:
137133359Sobrien>113	string	x		(%s)
138133359Sobrien
139133359Sobrien#------------------------------------------------------------------------------
140267843Sdelphij# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>)
141133359Sobrien0       string          XBEH            XBE, Microsoft Xbox executable
142133359Sobrien# probabilistic checks whether signed or not
143133359Sobrien>0x0004 ulelong =0x0
144133359Sobrien>>&2    ulelong =0x0
145133359Sobrien>>>&2   ulelong =0x0  \b, not signed
146133359Sobrien>0x0004 ulelong >0
147133359Sobrien>>&2    ulelong >0
148133359Sobrien>>>&2   ulelong >0    \b, signed
149133359Sobrien# expect base address of 0x10000
150133359Sobrien>0x0104               ulelong =0x10000
151133359Sobrien>>(0x0118-0x0FF60)    ulelong&0x80000007  0x80000007 \b, all regions
152133359Sobrien>>(0x0118-0x0FF60)    ulelong&0x80000007  !0x80000007
153133359Sobrien>>>(0x0118-0x0FF60)   ulelong >0           (regions:
154133359Sobrien>>>>(0x0118-0x0FF60)  ulelong &0x00000001  NA
155133359Sobrien>>>>(0x0118-0x0FF60)  ulelong &0x00000002  Japan
156133359Sobrien>>>>(0x0118-0x0FF60)  ulelong &0x00000004  Rest_of_World
157133359Sobrien>>>>(0x0118-0x0FF60)  ulelong &0x80000000  Manufacturer
158133359Sobrien>>>(0x0118-0x0FF60)   ulelong >0           \b)
159133359Sobrien
160133359Sobrien# --------------------------------
161133359Sobrien# Microsoft Xbox data file formats
162133359Sobrien0       string          XIP0            XIP, Microsoft Xbox data
163133359Sobrien0       string          XTF0            XTF, Microsoft Xbox data
164139368Sobrien
165139368Sobrien# Atari Lynx cartridge dump (EXE/BLL header)
166139368Sobrien# From: "Stefan A. Haubenthal" <polluks@web.de>
167139368Sobrien
168226048Sobrien# Double-check that the image type matches too, 0x8008 conflicts with
169226048Sobrien# 8 character OMF-86 object file headers.
170226048Sobrien0	beshort		0x8008		
171226048Sobrien>6	string		BS93		Lynx homebrew cartridge
172226048Sobrien>>2	beshort		x		\b, RAM start $%04x
173226048Sobrien>6	string		LYNX		Lynx cartridge
174226048Sobrien>>2	beshort		x		\b, RAM start $%04x
175139368Sobrien
176159764Sobrien# Opera file system that is used on the 3DO console
177159764Sobrien# From: Serge van den Boom <svdb@stack.nl>
178159764Sobrien0	string		\x01ZZZZZ\x01	3DO "Opera" file system
179139368Sobrien
180267843Sdelphij# From Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
181169962Sobrien0	string		GBS		Nintendo Gameboy Music/Audio Data
182169962Sobrien12	string		GameBoy\ Music\ Module	Nintendo Gameboy Music Module
183169962Sobrien
184169962Sobrien# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at>
185169962Sobrien0	string	PPF30			Playstation Patch File version 3.0
186169962Sobrien>5	byte	0			\b, PPF 1.0 patch
187169962Sobrien>5	byte	1			\b, PPF 2.0 patch
188169962Sobrien>5	byte	2			\b, PPF 3.0 patch
189169962Sobrien>>56	byte	0			\b, Imagetype BIN (any)
190169962Sobrien>>56	byte	1			\b, Imagetype GI (PrimoDVD)
191169962Sobrien>>57	byte	0			\b, Blockcheck disabled
192169962Sobrien>>57	byte	1			\b, Blockcheck enabled
193169962Sobrien>>58	byte	0			\b, Undo data not available
194169962Sobrien>>58	byte	1			\b, Undo data available
195169962Sobrien>6	string	x			\b, description: %s
196169962Sobrien
197169962Sobrien0	string	PPF20			Playstation Patch File version 2.0
198169962Sobrien>5	byte	0			\b, PPF 1.0 patch
199169962Sobrien>5	byte	1			\b, PPF 2.0 patch
200169962Sobrien>>56	lelong	>0			\b, size of file to patch %d
201169962Sobrien>6	string	x			\b, description: %s
202169962Sobrien
203169962Sobrien0	string	PPF10			Playstation Patch File version 1.0
204169962Sobrien>5	byte	0			\b, Simple Encoding
205169962Sobrien>6	string	x			\b, description: %s
206175296Sobrien
207175296Sobrien# From: Daniel Dawson <ddawson@icehouse.net>
208175296Sobrien# SNES9x .smv "movie" file format.
209175296Sobrien0		string		SMV\x1A	SNES9x input recording
210175296Sobrien>0x4		lelong		x	\b, version %d
211175296Sobrien# version 4 is latest so far 
212175296Sobrien>0x4		lelong		<5
213175296Sobrien>>0x8		ledate		x	\b, recorded at %s
214175296Sobrien>>0xc		lelong		>0	\b, rerecorded %d times
215175296Sobrien>>0x10		lelong		x	\b, %d frames long
216175296Sobrien>>0x14		byte		>0	\b, data for controller(s):
217175296Sobrien>>>0x14		byte		&0x1	#1
218175296Sobrien>>>0x14		byte		&0x2	#2
219175296Sobrien>>>0x14		byte		&0x4	#3
220175296Sobrien>>>0x14		byte		&0x8	#4
221175296Sobrien>>>0x14		byte		&0x10	#5
222175296Sobrien>>0x15		byte		^0x1	\b, begins from snapshot
223175296Sobrien>>0x15		byte		&0x1	\b, begins from reset
224175296Sobrien>>0x15		byte		^0x2	\b, NTSC standard
225175296Sobrien>>0x15		byte		&0x2	\b, PAL standard
226175296Sobrien>>0x17		byte		&0x1    \b, settings:
227175296Sobrien# WIP1Timing not used as of version 4
228175296Sobrien>>>0x4		lelong		<4
229175296Sobrien>>>>0x17	byte		&0x2	WIP1Timing
230175296Sobrien>>>0x17		byte		&0x4	Left+Right
231175296Sobrien>>>0x17		byte		&0x8	VolumeEnvX
232175296Sobrien>>>0x17		byte		&0x10	FakeMute
233175296Sobrien>>>0x17		byte		&0x20	SyncSound
234175296Sobrien# New flag as of version 4
235175296Sobrien>>>0x4		lelong		>3
236175296Sobrien>>>>0x17	byte		&0x80	NoCPUShutdown
237175296Sobrien>>0x4		lelong		<4
238175296Sobrien>>>0x18		lelong		>0x23
239175296Sobrien>>>>0x20	leshort		!0
240175296Sobrien>>>>>0x20	lestring16	x	\b, metadata: "%s"
241175296Sobrien>>0x4		lelong		>3
242175296Sobrien>>>0x24		byte		>0	\b, port 1:
243175296Sobrien>>>>0x24	byte		1	joypad
244175296Sobrien>>>>0x24	byte		2	mouse
245175296Sobrien>>>>0x24	byte		3	SuperScope
246175296Sobrien>>>>0x24	byte		4	Justifier
247175296Sobrien>>>>0x24	byte		5	multitap
248175296Sobrien>>>0x24		byte		>0	\b, port 2:
249175296Sobrien>>>>0x25	byte		1	joypad
250175296Sobrien>>>>0x25	byte		2	mouse
251175296Sobrien>>>>0x25	byte		3	SuperScope
252175296Sobrien>>>>0x25	byte		4	Justifier
253175296Sobrien>>>>0x25	byte		5	multitap
254175296Sobrien>>>0x18		lelong		>0x43
255175296Sobrien>>>>0x40	leshort		!0
256175296Sobrien>>>>>0x40	lestring16	x	\b, metadata: "%s"
257175296Sobrien>>0x17		byte		&0x40   \b, ROM:
258175296Sobrien>>>(0x18.l-26)	lelong		x	CRC32 0x%08x
259175296Sobrien>>>(0x18.l-23)	string		x	"%s"
260175296Sobrien
261226048Sobrien# Type: scummVM savegame files
262226048Sobrien# From: Sven Hartge <debian@ds9.argh.org>
263226048Sobrien0	string	SCVM	ScummVM savegame
264226048Sobrien>12	string	>\0	"%s"
265