2 #------------------------------------------------------------------------------
3 # $File: console,v 1.40 2018/06/23 16:40:40 christos Exp $
5 # Toby Deshane <hac@shoelace.digivill.net>
7 # ines: file(1) magic for Marat's iNES Nintendo Entertainment System ROM dump format
8 # Updated by David Korth <gerbilsoft@gerbilsoft.com>
10 # - http://wiki.nesdev.com/w/index.php/INES
11 # - http://wiki.nesdev.com/w/index.php/NES_2.0
13 # Common header for iNES, NES 2.0, and Wii U iNES.
14 0 name nes-rom-image-ines
15 >7 byte&0x0C =0x8 (NES 2.0)
16 >4 byte x \b: %ux16k PRG
17 >5 byte x \b, %ux8k CHR
18 >6 byte&0x08 =0x8 [4-Scr]
19 >6 byte&0x09 =0x0 [H-mirror]
20 >6 byte&0x09 =0x1 [V-mirror]
21 >6 byte&0x02 =0x2 [SRAM]
22 >6 byte&0x04 =0x4 [Trainer]
23 >7 byte&0x03 =0x2 [PC10]
24 >7 byte&0x03 =0x1 [VS]
27 >>>13 byte&0x0F =0x0 \b, RP2C03B
28 >>>13 byte&0x0F =0x1 \b, RP2C03G
29 >>>13 byte&0x0F =0x2 \b, RP2C04-0001
30 >>>13 byte&0x0F =0x3 \b, RP2C04-0002
31 >>>13 byte&0x0F =0x4 \b, RP2C04-0003
32 >>>13 byte&0x0F =0x5 \b, RP2C04-0004
33 >>>13 byte&0x0F =0x6 \b, RP2C03B
34 >>>13 byte&0x0F =0x7 \b, RP2C03C
35 >>>13 byte&0x0F =0x8 \b, RP2C05-01
36 >>>13 byte&0x0F =0x9 \b, RP2C05-02
37 >>>13 byte&0x0F =0xA \b, RP2C05-03
38 >>>13 byte&0x0F =0xB \b, RP2C05-04
39 >>>13 byte&0x0F =0xC \b, RP2C05-05
40 # TODO: VS protection hardware?
42 # NES 2.0-specific flags.
44 >>12 byte&0x03 =0x0 [NTSC]
45 >>12 byte&0x03 =0x1 [PAL]
46 >>12 byte&0x02 =0x2 [NTSC+PAL]
48 # Standard iNES ROM header.
49 0 string NES\x1A NES ROM image (iNES)
50 !:mime application/x-nes-rom
51 >0 use nes-rom-image-ines
53 # Wii U Virtual Console iNES ROM header.
54 0 belong 0x4E455300 NES ROM image (Wii U Virtual Console)
55 !:mime application/x-nes-rom
56 >0 use nes-rom-image-ines
58 #------------------------------------------------------------------------------
59 # unif: file(1) magic for UNIF-format Nintendo Entertainment System ROM images
60 # Reference: http://wiki.nesdev.com/w/index.php/UNIF
61 # From: David Korth <gerbilsoft@gerbilsoft.com>
63 # NOTE: The UNIF format uses chunks instead of a fixed header,
64 # so most of the data isn't easily parseable.
67 >4 lelong <16 NES ROM image (UNIF v%d format)
68 !:mime application/x-nes-rom
70 #------------------------------------------------------------------------------
71 # fds: file(1) magic for Famciom Disk System disk images
72 # Reference: http://wiki.nesdev.com/w/index.php/Family_Computer_Disk_System#.FDS_format
73 # From: David Korth <gerbilsoft@gerbilsoft.com>
74 # TODO: Check "Disk info block" and get info from that in addition to the optional header.
76 # Disk info block. (block 1)
77 0 name nintendo-fds-disk-info-block
81 >15 byte x \b, mfr %02X
86 >0x11 string *NINTENDO-HVC* Famicom Disk System disk image:
87 !:mime application/x-fds-disk
88 >>0x10 use nintendo-fds-disk-info-block
93 1 string *NINTENDO-HVC* Famicom Disk System disk image:
94 !:mime application/x-fds-disk
95 >0 use nintendo-fds-disk-info-block
97 #------------------------------------------------------------------------------
98 # tnes: file(1) magic for TNES-format Nintendo Entertainment System ROM images
99 # Used by Nintendo 3DS NES Virtual Console games.
100 # From: David Korth <gerbilsoft@gerbilsoft.com>
102 0 string TNES NES ROM image (Nintendo 3DS Virtual Console)
103 !:mime application/x-nes-rom
105 >>0x2010 use nintendo-fds-disk-info-block
106 >4 byte !100 \b: TNES mapper %u
107 >>5 byte x \b, %ux8k PRG
108 >>6 byte x \b, %ux8k CHR
109 >>7 byte&0x08 =1 [WRAM]
110 >>8 byte&0x09 =1 [H-mirror]
111 >>8 byte&0x09 =2 [V-mirror]
112 >>8 byte&0x02 =3 [VRAM]
114 #------------------------------------------------------------------------------
115 # gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format
116 # Reference: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header
118 0x104 bequad 0xCEED6666CC0D000B Game Boy ROM image
119 # TODO: application/x-gameboy-color-rom for GBC.
120 !:mime application/x-gameboy-rom
121 >0x143 byte&0x80 0x80
122 >>0x134 string >\0 \b: "%.15s"
123 >0x143 byte&0x80 !0x80
124 >>0x134 string >\0 \b: "%.16s"
125 >0x14c byte x (Rev.%02u)
127 # Machine type. (SGB, CGB, SGB+CGB)
130 >>>0x143 byte&0x80 0x80 [SGB+CGB]
131 >>>0x143 byte&0x80 !0x80 [SGB]
133 >>>0x143 byte&0xC0 0x80 [CGB]
134 >>>0x143 byte&0xC0 0xC0 [CGB ONLY]
138 >0x147 byte 0x00 [ROM ONLY]
139 >0x147 byte 0x01 [MBC1]
140 >0x147 byte 0x02 [MBC1+RAM]
141 >0x147 byte 0x03 [MBC1+RAM+BATT]
142 >0x147 byte 0x05 [MBC2]
143 >0x147 byte 0x06 [MBC2+BATTERY]
144 >0x147 byte 0x08 [ROM+RAM]
145 >0x147 byte 0x09 [ROM+RAM+BATTERY]
146 >0x147 byte 0x0B [MMM01]
147 >0x147 byte 0x0C [MMM01+SRAM]
148 >0x147 byte 0x0D [MMM01+SRAM+BATT]
149 >0x147 byte 0x0F [MBC3+TIMER+BATT]
150 >0x147 byte 0x10 [MBC3+TIMER+RAM+BATT]
151 >0x147 byte 0x11 [MBC3]
152 >0x147 byte 0x12 [MBC3+RAM]
153 >0x147 byte 0x13 [MBC3+RAM+BATT]
154 >0x147 byte 0x19 [MBC5]
155 >0x147 byte 0x1A [MBC5+RAM]
156 >0x147 byte 0x1B [MBC5+RAM+BATT]
157 >0x147 byte 0x1C [MBC5+RUMBLE]
158 >0x147 byte 0x1D [MBC5+RUMBLE+SRAM]
159 >0x147 byte 0x1E [MBC5+RUMBLE+SRAM+BATT]
160 >0x147 byte 0xFC [Pocket Camera]
161 >0x147 byte 0xFD [Bandai TAMA5]
162 >0x147 byte 0xFE [Hudson HuC-3]
163 >0x147 byte 0xFF [Hudson HuC-1]
166 >0x148 byte 0 \b, ROM: 256Kbit
167 >0x148 byte 1 \b, ROM: 512Kbit
168 >0x148 byte 2 \b, ROM: 1Mbit
169 >0x148 byte 3 \b, ROM: 2Mbit
170 >0x148 byte 4 \b, ROM: 4Mbit
171 >0x148 byte 5 \b, ROM: 8Mbit
172 >0x148 byte 6 \b, ROM: 16Mbit
173 >0x148 byte 7 \b, ROM: 32Mbit
174 >0x148 byte 0x52 \b, ROM: 9Mbit
175 >0x148 byte 0x53 \b, ROM: 10Mbit
176 >0x148 byte 0x54 \b, ROM: 12Mbit
179 >0x149 byte 1 \b, RAM: 16Kbit
180 >0x149 byte 2 \b, RAM: 64Kbit
181 >0x149 byte 3 \b, RAM: 128Kbit
182 >0x149 byte 4 \b, RAM: 1Mbit
183 >0x149 byte 5 \b, RAM: 512Kbit
185 #------------------------------------------------------------------------------
186 # genesis: file(1) magic for various Sega Mega Drive / Genesis ROM image and disc formats
187 # Updated by David Korth <gerbilsoft@gerbilsoft.com>
189 # - http://www.retrodev.com/segacd.html
190 # - http://devster.monkeeh.com/sega/32xguide1.txt
193 # Common Sega Mega Drive header format.
194 # FIXME: Name fields are 48 bytes, but have spaces for padding instead of 00s.
195 0 name sega-mega-drive-header
196 # ROM title. (Use domestic if present; if not, use international.)
198 >>0x120 string >\0 \b: "%.16s"
200 >>0x150 string >\0 \b: "%.16s"
202 >0x180 string >\0 (%.14s
203 >>0x110 string >\0 \b, %.16s
205 >>0x110 string >\0 (%.16s
208 # TODO: Check for 32X CD?
209 # Sega Mega CD disc images: 2048-byte sectors.
210 0 string SEGADISCSYSTEM\ \ Sega Mega CD disc image
211 !:mime application/x-sega-cd-rom
212 >0 use sega-mega-drive-header
213 >0 byte x \b, 2048-byte sectors
214 0 string SEGABOOTDISC\ \ \ \ Sega Mega CD disc image
215 !:mime application/x-sega-cd-rom
216 >0 use sega-mega-drive-header
217 >0 byte x \b, 2048-byte sectors
218 # Sega Mega CD disc images: 2352-byte sectors.
219 0x10 string SEGADISCSYSTEM\ \ Sega Mega CD disc image
220 !:mime application/x-sega-cd-rom
221 >0x10 use sega-mega-drive-header
222 >0 byte x \b, 2352-byte sectors
223 0x10 string SEGABOOTDISC\ \ \ \ Sega Mega CD disc image
224 !:mime application/x-sega-cd-rom
225 >0x10 use sega-mega-drive-header
226 >0 byte x \b, 2352-byte sectors
228 # Sega Mega Drive, 32X, Pico, and Mega CD Boot ROM images.
230 >0x3C0 bequad 0x4D41525320434845 Sega 32X ROM image
231 !:mime application/x-genesis-32x-rom
232 >>0 use sega-mega-drive-header
233 >0x3C0 bequad !0x4D41525320434845
234 >>0x105 belong 0x5049434F Sega Pico ROM image
235 !:mime application/x-sega-pico-rom
236 >>>0 use sega-mega-drive-header
237 >>0x105 belong !0x5049434F
238 >>>0x180 beshort 0x4252 Sega Mega CD Boot ROM image
239 !:mime application/x-genesis-rom
240 >>>0x180 beshort !0x4252 Sega Mega Drive / Genesis ROM image
241 !:mime application/x-genesis-rom
242 >>>0 use sega-mega-drive-header
244 #------------------------------------------------------------------------------
245 # genesis: file(1) magic for the Super MegaDrive ROM dump format
248 # NOTE: Due to interleaving, we can't display anything
249 # other than the copier header information.
250 0 name sega-genesis-smd-header
251 >0 byte x %dx16k blocks
252 >2 byte 0 \b, last in series or standalone
253 >2 byte >0 \b, split ROM
255 # "Sega Genesis" header.
257 >8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format):
258 !:mime application/x-genesis-rom
259 >>0 use sega-genesis-smd-header
261 # "Sega Mega Drive" header.
263 >8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format):
264 !:mime application/x-genesis-rom
265 >>0 use sega-genesis-smd-header
267 #------------------------------------------------------------------------------
268 # smsgg: file(1) magic for Sega Master System and Game Gear ROM images
269 # Detects all Game Gear and export Sega Master System ROM images,
270 # and some Japanese Sega Master System ROM images.
271 # From: David Korth <gerbilsoft@gerbilsoft.com>
272 # Reference: http://www.smspower.org/Development/ROMHeader
275 # General SMS header rule.
276 # The SMS boot ROM checks the header at three locations.
277 0 name sega-master-system-rom-header
279 >0x0F byte&0xF0 0x30 Sega Master System
280 !:mime application/x-sms-rom
281 >0x0F byte&0xF0 0x40 Sega Master System
282 !:mime application/x-sms-rom
283 >0x0F byte&0xF0 0x50 Sega Game Gear
284 !:mime application/x-gamegear-rom
285 >0x0F byte&0xF0 0x60 Sega Game Gear
286 !:mime application/x-gamegear-rom
287 >0x0F byte&0xF0 0x70 Sega Game Gear
288 !:mime application/x-gamegear-rom
289 >0x0F default x Sega Master System / Game Gear
290 !:mime application/x-sms-rom
293 >0x0E byte&0xF0 0x10 1
294 >0x0E byte&0xF0 0x20 2
295 >0x0E byte&0xF0 0x30 3
296 >0x0E byte&0xF0 0x40 4
297 >0x0E byte&0xF0 0x50 5
298 >0x0E byte&0xF0 0x60 6
299 >0x0E byte&0xF0 0x70 7
300 >0x0E byte&0xF0 0x80 8
301 >0x0E byte&0xF0 0x90 9
302 >0x0E byte&0xF0 0xA0 10
303 >0x0E byte&0xF0 0xB0 11
304 >0x0E byte&0xF0 0xC0 12
305 >0x0E byte&0xF0 0xD0 13
306 >0x0E byte&0xF0 0xE0 14
307 >0x0E byte&0xF0 0xF0 15
308 # If the product code is 5 digits, we'll need to backspace here.
310 >>0x0C leshort x \b%04x
312 >>0x0C leshort x %04x
314 >0x0E byte&0x0F x (Rev.%02d)
315 # ROM size. (Used for the boot ROM checksum routine.)
316 >0x0F byte&0x0F 0x0A (8 KB)
317 >0x0F byte&0x0F 0x0B (16 KB)
318 >0x0F byte&0x0F 0x0C (32 KB)
319 >0x0F byte&0x0F 0x0D (48 KB)
320 >0x0F byte&0x0F 0x0E (64 KB)
321 >0x0F byte&0x0F 0x0F (128 KB)
322 >0x0F byte&0x0F 0x00 (256 KB)
323 >0x0F byte&0x0F 0x01 (512 KB)
324 >0x0F byte&0x0F 0x02 (1 MB)
326 # SMS/GG header locations.
327 0x7FF0 string TMR\ SEGA
328 >0x7FF0 use sega-master-system-rom-header
329 0x3FF0 string TMR\ SEGA
330 >0x3FF0 use sega-master-system-rom-header
331 0x1FF0 string TMR\ SEGA
332 >0x1FF0 use sega-master-system-rom-header
334 #------------------------------------------------------------------------------
335 # saturn: file(1) magic for the Sega Saturn disc image format.
336 # From: David Korth <gerbilsoft@gerbilsoft.com>
339 # Common Sega Saturn disc header format.
340 # NOTE: Title is 112 bytes, but we're only showing 32 due to space padding.
341 # TODO: Release date, device information, region code, others?
342 0 name sega-saturn-disc-header
343 >0x60 string >\0 \b: "%.32s"
344 >0x20 string >\0 (%.10s
345 >>0x2A string >\0 \b, %.6s)
348 # 2048-byte sector version.
349 0 string SEGA\ SEGASATURN\ Sega Saturn disc image
350 !:mime application/x-saturn-rom
351 >0 use sega-saturn-disc-header
352 >0 byte x (2048-byte sectors)
353 # 2352-byte sector version.
354 0x10 string SEGA\ SEGASATURN\ Sega Saturn disc image
355 !:mime application/x-saturn-rom
356 >0x10 use sega-saturn-disc-header
357 >0 byte x (2352-byte sectors)
359 #------------------------------------------------------------------------------
360 # dreamcast: file(1) magic for the Sega Dreamcast disc image format.
361 # From: David Korth <gerbilsoft@gerbilsoft.com>
362 # Reference: http://mc.pp.se/dc/ip0000.bin.html
365 # Common Sega Dreamcast disc header format.
366 # NOTE: Title is 128 bytes, but we're only showing 32 due to space padding.
367 # TODO: Release date, device information, region code, others?
368 0 name sega-dreamcast-disc-header
369 >0x80 string >\0 \b: "%.32s"
370 >0x40 string >\0 (%.10s
371 >>0x4A string >\0 \b, %.6s)
374 # 2048-byte sector version.
375 0 string SEGA\ SEGAKATANA\ Sega Dreamcast disc image
376 !:mime application/x-dc-rom
377 >0 use sega-dreamcast-disc-header
378 >0 byte x (2048-byte sectors)
379 # 2352-byte sector version.
380 0x10 string SEGA\ SEGAKATANA\ Sega Dreamcast disc image
381 !:mime application/x-dc-rom
382 >0x10 use sega-dreamcast-disc-header
383 >0 byte x (2352-byte sectors)
385 #------------------------------------------------------------------------------
386 # dreamcast: file(1) uncertain magic for the Sega Dreamcast VMU image format
388 0 belong 0x21068028 Sega Dreamcast VMU game image
389 0 string LCDi Dream Animator file
391 #------------------------------------------------------------------------------
392 # z64: file(1) magic for the Z64 format N64 ROM dumps
393 # Reference: http://forum.pj64-emu.com/showthread.php?t=2239
394 # From: David Korth <gerbilsoft@gerbilsoft.com>
396 0 bequad 0x803712400000000F Nintendo 64 ROM image
397 !:mime application/x-n64-rom
398 >0x20 string >\0 \b: "%.20s"
400 >0x3F byte x \b, Rev.%02u)
402 #------------------------------------------------------------------------------
403 # v64: file(1) magic for the V64 format N64 ROM dumps
404 # Same as z64 format, but with 16-bit byteswapping.
406 0 bequad 0x3780401200000F00 Nintendo 64 ROM image (V64)
407 !:mime application/x-n64-rom
409 #------------------------------------------------------------------------------
410 # n64-swap2: file(1) magic for the swap2 format N64 ROM dumps
411 # Same as z64 format, but with swapped 16-bit words.
413 0 bequad 0x12408037000F0000 Nintendo 64 ROM image (wordswapped)
414 !:mime application/x-n64-rom
416 #------------------------------------------------------------------------------
417 # n64-le32: file(1) magic for the 32-bit byteswapped format N64 ROM dumps
418 # Same as z64 format, but with 32-bit byteswapping.
420 0 bequad 0x401237800F000000 Nintendo 64 ROM image (32-bit byteswapped)
421 !:mime application/x-n64-rom
423 #------------------------------------------------------------------------------
424 # gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format
425 # Reference: http://problemkaputt.de/gbatek.htm#gbacartridgeheader
427 # Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
428 # Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
430 4 bequad 0x24FFAE51699AA221 Game Boy Advance ROM image
431 !:mime application/x-gba-rom
432 >0xA0 string >\0 \b: "%.12s"
434 >0xBC byte x \b, Rev.%02u)
436 #------------------------------------------------------------------------------
437 # nds: file(1) magic for the Nintendo DS(i) raw ROM format
438 # Reference: http://problemkaputt.de/gbatek.htm#dscartridgeheader
440 # Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
441 # Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
443 0xC0 bequad 0x24FFAE51699AA221 Nintendo DS ROM image
444 !:mime application/x-nintendo-ds-rom
445 >0x00 string >\0 \b: "%.12s"
447 >0x1E byte x \b, Rev.%02u)
448 >0x12 byte 2 (DSi enhanced)
449 >0x12 byte 3 (DSi only)
451 >0x20 lelong <0x4000 (homebrew)
453 >>0x4000 lequad 0x0000000000000000 (multiboot)
454 >>0x4000 lequad !0x0000000000000000
455 >>>0x4000 lequad 0xE7FFDEFFE7FFDEFF (decrypted)
456 >>>0x4000 lequad !0xE7FFDEFFE7FFDEFF
457 >>>>0x1000 lequad 0x0000000000000000 (encrypted)
458 >>>>0x1000 lequad !0x0000000000000000 (mask ROM)
460 #------------------------------------------------------------------------------
461 # nds_passme: file(1) magic for Nintendo DS ROM images for GBA cartridge boot.
462 # This is also used for loading .nds files using the MSET exploit on 3DS.
463 # Reference: https://github.com/devkitPro/ndstool/blob/master/source/ndscreate.cpp
464 0xC0 bequad 0xC8604FE201708FE2 Nintendo DS Slot-2 ROM image (PassMe)
465 !:mime application/x-nintendo-ds-rom
467 #------------------------------------------------------------------------------
468 # ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format.
469 # From: David Korth <gerbilsoft@gerbilsoft.com>
471 # - https://neogpc.googlecode.com/svn-history/r10/trunk/src/core/neogpc.cpp
472 # - http://www.devrs.com/ngp/files/ngpctech.txt
474 0x0A string BY\ SNK\ CORPORATION Neo Geo Pocket
475 !:mime application/x-neo-geo-pocket-rom
476 >0x23 byte 0x10 Color
478 >0x24 string >\0 \b: "%.12s"
479 >0x1F byte 0xFF (debug mode enabled)
481 #------------------------------------------------------------------------------
482 # msx: file(1) magic for MSX game cartridge dumps
484 #0 beshort 0x4142 MSX game cartridge dump
486 #------------------------------------------------------------------------------
487 # Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) :
488 0 string PS-X\ EXE Sony Playstation executable
489 >16 lelong x PC=0x%08x,
490 >20 lelong !0 GP=0x%08x,
491 >24 lelong !0 .text=[0x%08x,
492 >>28 lelong x \b0x%x],
493 >32 lelong !0 .data=[0x%08x,
494 >>36 lelong x \b0x%x],
495 >40 lelong !0 .bss=[0x%08x,
496 >>44 lelong x \b0x%x],
497 >48 lelong !0 Stack=0x%08x,
498 >48 lelong =0 No Stack!,
499 >52 lelong !0 StackSize=0x%x,
505 0 string CPE CPE executable
506 >3 byte x (version %d)
508 #------------------------------------------------------------------------------
509 # Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>)
510 0 string XBEH XBE, Microsoft Xbox executable
511 # probabilistic checks whether signed or not
514 >>>&2 ulelong =0x0 \b, not signed
517 >>>&2 ulelong >0 \b, signed
518 # expect base address of 0x10000
519 >0x0104 ulelong =0x10000
520 >>(0x0118-0x0FF60) ulelong&0x80000007 0x80000007 \b, all regions
521 >>(0x0118-0x0FF60) ulelong&0x80000007 !0x80000007
522 >>>(0x0118-0x0FF60) ulelong >0 (regions:
523 >>>>(0x0118-0x0FF60) ulelong &0x00000001 NA
524 >>>>(0x0118-0x0FF60) ulelong &0x00000002 Japan
525 >>>>(0x0118-0x0FF60) ulelong &0x00000004 Rest_of_World
526 >>>>(0x0118-0x0FF60) ulelong &0x80000000 Manufacturer
527 >>>(0x0118-0x0FF60) ulelong >0 \b)
529 # --------------------------------
530 # Microsoft Xbox data file formats
531 0 string XIP0 XIP, Microsoft Xbox data
532 0 string XTF0 XTF, Microsoft Xbox data
534 # Atari Lynx cartridge dump (EXE/BLL header)
535 # From: "Stefan A. Haubenthal" <polluks@web.de>
537 # Double-check that the image type matches too, 0x8008 conflicts with
538 # 8 character OMF-86 object file headers.
540 >6 string BS93 Lynx homebrew cartridge
541 !:mime application/x-atari-lynx-rom
542 >>2 beshort x \b, RAM start $%04x
543 >6 string LYNX Lynx cartridge
544 !:mime application/x-atari-lynx-rom
545 >>2 beshort x \b, RAM start $%04x
547 # Opera file system that is used on the 3DO console
548 # From: Serge van den Boom <svdb@stack.nl>
549 0 string \x01ZZZZZ\x01 3DO "Opera" file system
551 # From: Alex Myczko <alex@aiei.ch>
552 # From: David Pflug <david@pflug.email>
553 # is the offset 12 or the offset 16 correct?
554 # GBS (Game Boy Sound) magic
555 # ftp://ftp.modland.com/pub/documents/format_documentation/\
556 # Gameboy%20Sound%20System%20(.gbs).txt
557 0 string GBS Nintendo Gameboy Music/Audio Data
558 #12 string GameBoy\ Music\ Module Nintendo Gameboy Music Module
559 >16 string >\0 ("%.32s" by
560 >48 string >\0 %.32s, copyright
561 >80 string >\0 %.32s),
562 >3 byte x version %u,
565 # IPS Patch Files from: From: Thomas Klausner <tk@giga.or.at>
566 # see http://zerosoft.zophar.net/ips.php
567 0 string PATCH IPS patch file
569 # Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at>
570 0 string PPF30 Playstation Patch File version 3.0
571 >5 byte 0 \b, PPF 1.0 patch
572 >5 byte 1 \b, PPF 2.0 patch
573 >5 byte 2 \b, PPF 3.0 patch
574 >>56 byte 0 \b, Imagetype BIN (any)
575 >>56 byte 1 \b, Imagetype GI (PrimoDVD)
576 >>57 byte 0 \b, Blockcheck disabled
577 >>57 byte 1 \b, Blockcheck enabled
578 >>58 byte 0 \b, Undo data not available
579 >>58 byte 1 \b, Undo data available
580 >6 string x \b, description: %s
582 0 string PPF20 Playstation Patch File version 2.0
583 >5 byte 0 \b, PPF 1.0 patch
584 >5 byte 1 \b, PPF 2.0 patch
585 >>56 lelong >0 \b, size of file to patch %d
586 >6 string x \b, description: %s
588 0 string PPF10 Playstation Patch File version 1.0
589 >5 byte 0 \b, Simple Encoding
590 >6 string x \b, description: %s
592 # From: Daniel Dawson <ddawson@icehouse.net>
593 # SNES9x .smv "movie" file format.
594 0 string SMV\x1A SNES9x input recording
595 >0x4 lelong x \b, version %d
596 # version 4 is latest so far
598 >>0x8 ledate x \b, recorded at %s
599 >>0xc lelong >0 \b, rerecorded %d times
600 >>0x10 lelong x \b, %d frames long
601 >>0x14 byte >0 \b, data for controller(s):
606 >>>0x14 byte &0x10 #5
607 >>0x15 byte ^0x1 \b, begins from snapshot
608 >>0x15 byte &0x1 \b, begins from reset
609 >>0x15 byte ^0x2 \b, NTSC standard
610 >>0x15 byte &0x2 \b, PAL standard
611 >>0x17 byte &0x1 \b, settings:
612 # WIP1Timing not used as of version 4
614 >>>>0x17 byte &0x2 WIP1Timing
615 >>>0x17 byte &0x4 Left+Right
616 >>>0x17 byte &0x8 VolumeEnvX
617 >>>0x17 byte &0x10 FakeMute
618 >>>0x17 byte &0x20 SyncSound
619 # New flag as of version 4
621 >>>>0x17 byte &0x80 NoCPUShutdown
625 >>>>>0x20 lestring16 x \b, metadata: "%s"
627 >>>0x24 byte >0 \b, port 1:
628 >>>>0x24 byte 1 joypad
629 >>>>0x24 byte 2 mouse
630 >>>>0x24 byte 3 SuperScope
631 >>>>0x24 byte 4 Justifier
632 >>>>0x24 byte 5 multitap
633 >>>0x24 byte >0 \b, port 2:
634 >>>>0x25 byte 1 joypad
635 >>>>0x25 byte 2 mouse
636 >>>>0x25 byte 3 SuperScope
637 >>>>0x25 byte 4 Justifier
638 >>>>0x25 byte 5 multitap
641 >>>>>0x40 lestring16 x \b, metadata: "%s"
642 >>0x17 byte &0x40 \b, ROM:
643 >>>(0x18.l-26) lelong x CRC32 0x%08x
644 >>>(0x18.l-23) string x "%s"
646 # Type: scummVM savegame files
647 # From: Sven Hartge <debian@ds9.argh.org>
648 0 string SCVM ScummVM savegame
651 #------------------------------------------------------------------------------
652 # Nintendo GameCube / Wii file formats.
655 # Type: Nintendo GameCube/Wii common disc header data.
656 # From: David Korth <gerbilsoft@gerbilsoft.com>
657 # Reference: http://wiibrew.org/wiki/Wii_Disc
658 0 name nintendo-gcn-disc-common
659 >0x20 string x "%.64s"
662 >>0x06 byte 1 \b, Disc 2
663 >>0x06 byte 2 \b, Disc 3
664 >>0x06 byte 3 \b, Disc 4
665 >0x07 byte x \b, Rev.%02u)
666 >0x18 belong 0x5D1C9EA3
667 >>0x60 beshort 0x0101 \b (Unencrypted)
669 # Type: Nintendo GameCube disc image
670 # From: David Korth <gerbilsoft@gerbilsoft.com>
671 # Reference: http://wiibrew.org/wiki/Wii_Disc
672 0x1C belong 0xC2339F3D Nintendo GameCube disc image:
673 !:mime application/x-gamecube-rom
674 >0 use nintendo-gcn-disc-common
676 # Type: Nintendo GameCube embedded disc image
677 # Commonly found on demo discs.
678 # From: David Korth <gerbilsoft@gerbilsoft.com>
679 # Reference: http://hitmen.c02.at/files/yagcd/yagcd/index.html#idx14.8
681 >0x0C belong 0x00100000
682 >>(8.L+0x1C) belong 0xC2339F3D Nintendo GameCube embedded disc image:
683 !:mime application/x-gamecube-rom
684 >>>(8.L) use nintendo-gcn-disc-common
686 # Type: Nintendo Wii disc image
687 # From: David Korth <gerbilsoft@gerbilsoft.com>
688 # Reference: http://wiibrew.org/wiki/Wii_Disc
689 0x18 belong 0x5D1C9EA3 Nintendo Wii disc image:
690 >0 use nintendo-gcn-disc-common
692 # Type: Nintendo Wii disc image (WBFS format)
693 # From: David Korth <gerbilsoft@gerbilsoft.com>
694 # Reference: http://wiibrew.org/wiki/Wii_Disc
696 >0x218 belong 0x5D1C9EA3 Nintendo Wii disc image (WBFS format):
697 !:mime application/x-wii-rom
698 >>0x200 use nintendo-gcn-disc-common
700 # Type: Nintendo GameCube/Wii disc image (CISO format)
701 # NOTE: This is NOT the same as Compact ISO or PSP CISO,
702 # though it has the same magic number.
704 # Other fields are used to determine what type of CISO this is:
705 # - 0x04 == 0x00200000: GameCube/Wii CISO (block_size)
706 # - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size)
707 # - None of the above: Compact ISO.
710 >>>0x801C belong 0xC2339F3D Nintendo GameCube disc image (CISO format):
711 !:mime application/x-wii-rom
712 >>>>0x8000 use nintendo-gcn-disc-common
713 >>>0x8018 belong 0x5D1C9EA3 Nintendo Wii disc image (CISO format):
714 !:mime application/x-wii-rom
715 >>>>0x8000 use nintendo-gcn-disc-common
717 # Type: Nintendo GameCube/Wii disc image (GCZ format)
718 # Due to zlib compression, we can't get the actual disc information.
720 >4 lelong 0 Nintendo GameCube disc image (GCZ format)
721 !:mime application/x-gamecube-rom
722 >4 lelong 1 Nintendo Wii disc image (GCZ format)
723 !:mime application/x-wii-rom
724 >4 default x Nintendo GameCube/Wii disc image (GCZ format)
726 # Type: Nintendo GameCube/Wii disc image (WDF format)
730 >>0x54 belong 0xC2339F3D Nintendo GameCube disc image (WDFv1 format):
731 !:mime application/x-gamecube-rom
732 >>>0x38 use nintendo-gcn-disc-common
733 >>0x58 belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv1 format):
734 !:mime application/x-wii-rom
735 >>>0x38 use nintendo-gcn-disc-common
738 >>(12.L+0x1C) belong 0xC2339F3D Nintendo GameCube disc image (WDFv2 format):
739 !:mime application/x-gamecube-rom
740 >>>(12.L) use nintendo-gcn-disc-common
741 >>(12.L+0x18) belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv2 format):
742 !:mime application/x-wii-rom
743 >>>(12.L) use nintendo-gcn-disc-common
745 # Type: Nintendo GameCube/Wii disc image (WIA format)
746 0 string WIA\001 Nintendo
747 >0x48 belong 1 GameCube
748 !:mime application/x-gamecube-rom
750 !:mime application/x-wii-rom
751 >0x48 default x GameCube/Wii
752 >0x48 belong x disc image (WIA format):
753 >>0x58 use nintendo-gcn-disc-common
755 # Type: Nintendo GameCube/Wii disc image (with SDK header)
756 # From: David Korth <gerbilsoft@gerbilsoft.com>
757 # Reference: http://wiibrew.org/wiki/Wii_Disc
759 >0x18 belong 0x00000000
760 >>0x1C belong 0x00000000
761 >>>0x8018 belong 0x5D1C9EA3 Nintendo Wii SDK disc image:
762 >>>>0x8000 use nintendo-gcn-disc-common
763 >>>0x801C belong 0xC2339F3D Nintendo GameCube SDK disc image:
764 >>>>0x8000 use nintendo-gcn-disc-common
766 #------------------------------------------------------------------------------
767 # Nintendo 3DS file formats.
770 # Type: Nintendo 3DS "NCSD" image. (game cards and eMMC)
771 # From: David Korth <gerbilsoft@gerbilsoft.com>
772 # Reference: https://www.3dbrew.org/wiki/NCSD
774 >0x118 lequad 0 Nintendo 3DS Game Card image
775 # NCCH header for partition 0. (game data)
776 >>0x1150 string >\0 \b: "%.16s"
777 >>0x312 byte x (Rev.%02u)
778 >>0x118C byte 2 (New3DS only)
779 >>0x18D byte 0 (inner device)
780 >>0x18D byte 1 (Card1)
781 >>0x18D byte 2 (Card2)
782 >>0x18D byte 3 (extended device)
783 >0x118 bequad 0x0102020202000000 Nintendo 3DS eMMC dump (Old3DS)
784 >0x118 bequad 0x0102020203000000 Nintendo 3DS eMMC dump (New3DS)
786 # Nintendo 3DS version code.
787 # Reference: https://www.3dbrew.org/wiki/Titles
788 # Format: leshort containing three fields:
792 # NOTE: Only supporting major/minor versions from 0-15 right now.
793 # NOTE: Should be prefixed with "v".
794 0 name nintendo-3ds-version-code
798 >0 leshort&0xFC00 0x0000 0
799 >0 leshort&0xFC00 0x0400 1
800 >0 leshort&0xFC00 0x0800 2
801 >0 leshort&0xFC00 0x0C00 3
802 >0 leshort&0xFC00 0x1000 4
803 >0 leshort&0xFC00 0x1400 5
804 >0 leshort&0xFC00 0x1800 6
805 >0 leshort&0xFC00 0x1C00 7
806 >0 leshort&0xFC00 0x2000 8
807 >0 leshort&0xFC00 0x2400 9
808 >0 leshort&0xFC00 0x2800 10
809 >0 leshort&0xFC00 0x2C00 11
810 >0 leshort&0xFC00 0x3000 12
811 >0 leshort&0xFC00 0x3400 13
812 >0 leshort&0xFC00 0x3800 14
813 >0 leshort&0xFC00 0x3C00 15
815 >0 leshort&0x03F0 0x0000 \b.0
816 >0 leshort&0x03F0 0x0010 \b.1
817 >0 leshort&0x03F0 0x0020 \b.2
818 >0 leshort&0x03F0 0x0030 \b.3
819 >0 leshort&0x03F0 0x0040 \b.4
820 >0 leshort&0x03F0 0x0050 \b.5
821 >0 leshort&0x03F0 0x0060 \b.6
822 >0 leshort&0x03F0 0x0070 \b.7
823 >0 leshort&0x03F0 0x0080 \b.8
824 >0 leshort&0x03F0 0x0090 \b.9
825 >0 leshort&0x03F0 0x00A0 \b.10
826 >0 leshort&0x03F0 0x00B0 \b.11
827 >0 leshort&0x03F0 0x00C0 \b.12
828 >0 leshort&0x03F0 0x00D0 \b.13
829 >0 leshort&0x03F0 0x00E0 \b.14
830 >0 leshort&0x03F0 0x00F0 \b.15
832 >0 leshort&0x000F x \b.%u
834 # Type: Nintendo 3DS "NCCH" container.
835 # https://www.3dbrew.org/wiki/NCCH
836 0x100 string NCCH Nintendo 3DS
837 >0x18D byte&2 0 File Archive (CFA)
838 >0x18D byte&2 2 Executable Image (CXI)
839 >0x150 string >\0 \b: "%.16s"
841 >>0x10E leshort x (Old3DS System Update v
842 >>0x10E use nintendo-3ds-version-code
843 >>0x10E leshort x \b)
845 >>0x10E leshort x (New3DS System Update v
846 >>0x10E use nintendo-3ds-version-code
847 >>0x10E leshort x \b)
851 >>>0x112 use nintendo-3ds-version-code
853 >0x18C byte 2 (New3DS only)
855 # Type: Nintendo 3DS "SMDH" file. (application description)
856 # From: David Korth <gerbilsoft@gerbilsoft.com>
857 # Reference: https://3dbrew.org/wiki/SMDH
858 0 string SMDH Nintendo 3DS SMDH file
860 >>0x208 lestring16 x \b: "%.128s"
862 >>>0x388 lestring16 x by %.128s
865 >>>0x008 lestring16 x \b: "%.128s"
867 >>>>0x188 lestring16 x by %.128s
869 # Type: Nintendo 3DS Homebrew Application.
870 # From: David Korth <gerbilsoft@gerbilsoft.com>
871 # Reference: https://3dbrew.org/wiki/3DSX_Format
872 0 string 3DSX Nintendo 3DS Homebrew Application (3DSX)
874 #------------------------------------------------------------------------------
875 # a7800: file(1) magic for the Atari 7800 raw ROM format.
876 # From: David Korth <gerbilsoft@gerbilsoft.com>
877 # Reference: https://sites.google.com/site/atari7800wiki/a78-header
881 >>1 string ATARI7800 Atari 7800 ROM image
882 !:mime application/x-atari-7800-rom
883 >>>0x11 string >\0 \b: "%.32s"
885 >>>0x39 byte 0 (NTSC)
887 >>>0x36 byte&1 1 (POKEY)
889 #------------------------------------------------------------------------------
890 # vectrex: file(1) magic for the GCE Vectrex raw ROM format.
891 # From: David Korth <gerbilsoft@gerbilsoft.com>
892 # Reference: http://www.playvectrex.com/designit/chrissalo/hello1.htm
894 # NOTE: Title is terminated with 0x80, not 0.
895 # The header is terminated with a 0, so that will
896 # terminate the title as well.
898 0 string g\ GCE Vectrex ROM image
899 >0x11 string >\0 \b: "%.16s"
901 #------------------------------------------------------------------------------
902 # amiibo: file(1) magic for Nintendo amiibo NFC dumps.
903 # From: David Korth <gerbilsoft@gerbilsoft.com>
904 # Reference: https://www.3dbrew.org/wiki/Amiibo
907 >>0x0C belong 0xF110FFEE
908 >>>0x208 beshort 0x0100
910 >>>>>0x020C bequad 0x000000045F000000
912 >>>>>>>0x54 belong x Nintendo amiibo NFC dump - amiibo ID: %08X-
913 >>>>>>>0x58 belong x \b%08X