1 2#------------------------------------------------------------------------------ 3# $File: console,v 1.32 2017/08/13 00:21:47 christos Exp $ 4# Console game magic 5# Toby Deshane <hac@shoelace.digivill.net> 6 7# ines: file(1) magic for Marat's iNES Nintendo Entertainment System ROM dump format 8# Updated by David Korth <gerbilsoft@gerbilsoft.com> 9# References: 10# - http://wiki.nesdev.com/w/index.php/INES 11# - http://wiki.nesdev.com/w/index.php/NES_2.0 12 13# Common header for iNES, NES 2.0, and Wii U iNES. 140 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] 25>>7 byte&0x0C =0x8 26# NES 2.0: VS PPU 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? 41>>7 byte x \b] 42# NES 2.0-specific flags. 43>7 byte&0x0C =0x8 44>>12 byte&0x03 =0x0 [NTSC] 45>>12 byte&0x03 =0x1 [PAL] 46>>12 byte&0x02 =0x2 [NTSC+PAL] 47 48# Standard iNES ROM header. 490 string NES\x1A NES ROM image (iNES) 50>0 use nes-rom-image-ines 51 52# Wii U Virtual Console iNES ROM header. 530 belong 0x4E455300 NES ROM image (Wii U Virtual Console) 54>0 use nes-rom-image-ines 55 56#------------------------------------------------------------------------------ 57# unif: file(1) magic for UNIF-format Nintendo Entertainment System ROM images 58# Reference: http://wiki.nesdev.com/w/index.php/UNIF 59# From: David Korth <gerbilsoft@gerbilsoft.com> 60# 61# NOTE: The UNIF format uses chunks instead of a fixed header, 62# so most of the data isn't easily parseable. 63# 640 string UNIF 65>4 lelong <16 NES ROM image (UNIF v%d format) 66 67#------------------------------------------------------------------------------ 68# fds: file(1) magic for Famciom Disk System disk images 69# Reference: http://wiki.nesdev.com/w/index.php/Family_Computer_Disk_System#.FDS_format 70# From: David Korth <gerbilsoft@gerbilsoft.com> 71# TODO: Check "Disk info block" and get info from that in addition to the optional header. 72 73# Disk info block. (block 1) 740 name nintendo-fds-disk-info-block 75>23 byte !1 FMC- 76>23 byte 1 FSC- 77>16 string x \b%.3s 78>15 byte x \b, mfr %02X 79>20 byte x (Rev.%02u) 80 81# Headered version. 820 string FDS\x1A 83>0x11 string *NINTENDO-HVC* Famicom Disk System disk image: 84>>0x10 use nintendo-fds-disk-info-block 85>4 byte 1 (%u side) 86>4 byte !1 (%u sides) 87 88# Unheadered version. 891 string *NINTENDO-HVC* Famicom Disk System disk image: 90>0 use nintendo-fds-disk-info-block 91 92#------------------------------------------------------------------------------ 93# tnes: file(1) magic for TNES-format Nintendo Entertainment System ROM images 94# Used by Nintendo 3DS NES Virtual Console games. 95# From: David Korth <gerbilsoft@gerbilsoft.com> 96# 970 string TNES NES ROM image (Nintendo 3DS Virtual Console) 98>4 byte 100 \b: FDS, 99>>0x2010 use nintendo-fds-disk-info-block 100>4 byte !100 \b: TNES mapper %u 101>>5 byte x \b, %ux8k PRG 102>>6 byte x \b, %ux8k CHR 103>>7 byte&0x08 =1 [WRAM] 104>>8 byte&0x09 =1 [H-mirror] 105>>8 byte&0x09 =2 [V-mirror] 106>>8 byte&0x02 =3 [VRAM] 107 108#------------------------------------------------------------------------------ 109# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format 110# Reference: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header 111# 1120x104 bequad 0xCEED6666CC0D000B Game Boy ROM image 113>0x143 byte&0x80 0x80 114>>0x134 string >\0 \b: "%.15s" 115>0x143 byte&0x80 !0x80 116>>0x134 string >\0 \b: "%.16s" 117>0x14c byte x (Rev.%02u) 118 119# Machine type. (SGB, CGB, SGB+CGB) 120>0x14b byte 0x33 121>>0x146 byte 0x03 122>>>0x143 byte&0x80 0x80 [SGB+CGB] 123>>>0x143 byte&0x80 !0x80 [SGB] 124>>0x146 byte !0x03 125>>>0x143 byte&0xC0 0x80 [CGB] 126>>>0x143 byte&0xC0 0xC0 [CGB ONLY] 127 128# Mapper. 129>0x147 byte 0x00 [ROM ONLY] 130>0x147 byte 0x01 [MBC1] 131>0x147 byte 0x02 [MBC1+RAM] 132>0x147 byte 0x03 [MBC1+RAM+BATT] 133>0x147 byte 0x05 [MBC2] 134>0x147 byte 0x06 [MBC2+BATTERY] 135>0x147 byte 0x08 [ROM+RAM] 136>0x147 byte 0x09 [ROM+RAM+BATTERY] 137>0x147 byte 0x0B [MMM01] 138>0x147 byte 0x0C [MMM01+SRAM] 139>0x147 byte 0x0D [MMM01+SRAM+BATT] 140>0x147 byte 0x0F [MBC3+TIMER+BATT] 141>0x147 byte 0x10 [MBC3+TIMER+RAM+BATT] 142>0x147 byte 0x11 [MBC3] 143>0x147 byte 0x12 [MBC3+RAM] 144>0x147 byte 0x13 [MBC3+RAM+BATT] 145>0x147 byte 0x19 [MBC5] 146>0x147 byte 0x1A [MBC5+RAM] 147>0x147 byte 0x1B [MBC5+RAM+BATT] 148>0x147 byte 0x1C [MBC5+RUMBLE] 149>0x147 byte 0x1D [MBC5+RUMBLE+SRAM] 150>0x147 byte 0x1E [MBC5+RUMBLE+SRAM+BATT] 151>0x147 byte 0xFC [Pocket Camera] 152>0x147 byte 0xFD [Bandai TAMA5] 153>0x147 byte 0xFE [Hudson HuC-3] 154>0x147 byte 0xFF [Hudson HuC-1] 155 156# ROM size. 157>0x148 byte 0 \b, ROM: 256Kbit 158>0x148 byte 1 \b, ROM: 512Kbit 159>0x148 byte 2 \b, ROM: 1Mbit 160>0x148 byte 3 \b, ROM: 2Mbit 161>0x148 byte 4 \b, ROM: 4Mbit 162>0x148 byte 5 \b, ROM: 8Mbit 163>0x148 byte 6 \b, ROM: 16Mbit 164>0x148 byte 7 \b, ROM: 32Mbit 165>0x148 byte 0x52 \b, ROM: 9Mbit 166>0x148 byte 0x53 \b, ROM: 10Mbit 167>0x148 byte 0x54 \b, ROM: 12Mbit 168 169# RAM size. 170>0x149 byte 1 \b, RAM: 16Kbit 171>0x149 byte 2 \b, RAM: 64Kbit 172>0x149 byte 3 \b, RAM: 128Kbit 173>0x149 byte 4 \b, RAM: 1Mbit 174>0x149 byte 5 \b, RAM: 512Kbit 175 176#------------------------------------------------------------------------------ 177# genesis: file(1) magic for various Sega Mega Drive / Genesis ROM image and disc formats 178# Updated by David Korth <gerbilsoft@gerbilsoft.com> 179# References: 180# - http://www.retrodev.com/segacd.html 181# - http://devster.monkeeh.com/sega/32xguide1.txt 182# 183 184# Common Sega Mega Drive header format. 185# FIXME: Name fields are 48 bytes, but have spaces for padding instead of 00s. 1860 name sega-mega-drive-header 187# ROM title. (Use domestic if present; if not, use international.) 188>0x120 byte >0x20 189>>0x120 string >\0 \b: "%.16s" 190>0x120 byte <0x21 191>>0x150 string >\0 \b: "%.16s" 192# Other information. 193>0x180 string >\0 (%.14s 194>>0x110 string >\0 \b, %.16s 195>0x180 byte 0 196>>0x110 string >\0 (%.16s 197>0 byte x \b) 198 199# TODO: Check for 32X CD? 200# Sega Mega CD disc images: 2048-byte sectors. 2010 string SEGADISCSYSTEM\ \ Sega Mega CD disc image 202>0 use sega-mega-drive-header 203>0 byte x \b, 2048-byte sectors 2040 string SEGABOOTDISC\ \ \ \ Sega Mega CD disc image 205>0 use sega-mega-drive-header 206>0 byte x \b, 2048-byte sectors 207# Sega Mega CD disc images: 2352-byte sectors. 2080x10 string SEGADISCSYSTEM\ \ Sega Mega CD disc image 209>0x10 use sega-mega-drive-header 210>0 byte x \b, 2352-byte sectors 2110x10 string SEGABOOTDISC\ \ \ \ Sega Mega CD disc image 212>0x10 use sega-mega-drive-header 213>0 byte x \b, 2352-byte sectors 214 215# Sega Mega Drive, 32X, Pico, and Mega CD Boot ROM images. 2160x100 string SEGA 217>0x3C0 bequad 0x4D41525320434845 Sega 32X ROM image 218>>0 use sega-mega-drive-header 219>0x3C0 bequad !0x4D41525320434845 220>>0x105 belong 0x5049434F Sega Pico ROM image 221>>>0 use sega-mega-drive-header 222>>0x105 belong !0x5049434F 223>>>0x180 beshort 0x4252 Sega Mega CD Boot ROM image 224>>>0x180 beshort !0x4252 Sega Mega Drive / Genesis ROM image 225>>>0 use sega-mega-drive-header 226 227#------------------------------------------------------------------------------ 228# genesis: file(1) magic for the Super MegaDrive ROM dump format 229# 230 231# NOTE: Due to interleaving, we can't display anything 232# other than the copier header information. 2330 name sega-genesis-smd-header 234>0 byte x %dx16k blocks 235>2 byte 0 \b, last in series or standalone 236>2 byte >0 \b, split ROM 237 238# "Sega Genesis" header. 2390x280 string EAGN 240>8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format): 241>>0 use sega-genesis-smd-header 242 243# "Sega Mega Drive" header. 2440x280 string EAMG 245>8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format): 246>>0 use sega-genesis-smd-header 247 248#------------------------------------------------------------------------------ 249# smsgg: file(1) magic for Sega Master System and Game Gear ROM images 250# Detects all Game Gear and export Sega Master System ROM images, 251# and some Japanese Sega Master System ROM images. 252# From: David Korth <gerbilsoft@gerbilsoft.com> 253# Reference: http://www.smspower.org/Development/ROMHeader 254# 255 256# General SMS header rule. 257# The SMS boot ROM checks the header at three locations. 2580 name sega-master-system-rom-header 259# Machine type. 260>0x0F byte&0xF0 0x30 Sega Master System 261>0x0F byte&0xF0 0x40 Sega Master System 262>0x0F byte&0xF0 0x50 Sega Game Gear 263>0x0F byte&0xF0 0x60 Sega Game Gear 264>0x0F byte&0xF0 0x70 Sega Game Gear 265>0x0F byte&0xF0 <0x30 Sega Master System / Game Gear 266>0x0F byte&0xF0 >0x70 Sega Master System / Game Gear 267>0 byte x ROM image: 268# Product code. 269>0x0E byte&0xF0 0x10 1 270>0x0E byte&0xF0 0x20 2 271>0x0E byte&0xF0 0x30 3 272>0x0E byte&0xF0 0x40 4 273>0x0E byte&0xF0 0x50 5 274>0x0E byte&0xF0 0x60 6 275>0x0E byte&0xF0 0x70 7 276>0x0E byte&0xF0 0x80 8 277>0x0E byte&0xF0 0x90 9 278>0x0E byte&0xF0 0xA0 10 279>0x0E byte&0xF0 0xB0 11 280>0x0E byte&0xF0 0xC0 12 281>0x0E byte&0xF0 0xD0 13 282>0x0E byte&0xF0 0xE0 14 283>0x0E byte&0xF0 0xF0 15 284# If the product code is 5 digits, we'll need to backspace here. 285>0x0E byte&0xF0 !0 286>>0x0C leshort x \b%04x 287>0x0E byte&0xF0 0 288>>0x0C leshort x %04x 289# Revision. 290>0x0E byte&0x0F x (Rev.%02d) 291# ROM size. (Used for the boot ROM checksum routine.) 292>0x0F byte&0x0F 0x0A (8 KB) 293>0x0F byte&0x0F 0x0B (16 KB) 294>0x0F byte&0x0F 0x0C (32 KB) 295>0x0F byte&0x0F 0x0D (48 KB) 296>0x0F byte&0x0F 0x0E (64 KB) 297>0x0F byte&0x0F 0x0F (128 KB) 298>0x0F byte&0x0F 0x00 (256 KB) 299>0x0F byte&0x0F 0x01 (512 KB) 300>0x0F byte&0x0F 0x02 (1 MB) 301 302# SMS/GG header locations. 3030x7FF0 string TMR\ SEGA 304>0x7FF0 use sega-master-system-rom-header 3050x3FF0 string TMR\ SEGA 306>0x3FF0 use sega-master-system-rom-header 3070x1FF0 string TMR\ SEGA 308>0x1FF0 use sega-master-system-rom-header 309 310#------------------------------------------------------------------------------ 311# saturn: file(1) magic for the Sega Saturn disc image format. 312# From: David Korth <gerbilsoft@gerbilsoft.com> 313# 314 315# Common Sega Saturn disc header format. 316# NOTE: Title is 112 bytes, but we're only showing 32 due to space padding. 317# TODO: Release date, device information, region code, others? 3180 name sega-saturn-disc-header 319>0x60 string >\0 \b: "%.32s" 320>0x20 string >\0 (%.10s 321>>0x2A string >\0 \b, %.6s) 322>>0x2A byte 0 \b) 323 324# 2048-byte sector version. 3250 string SEGA\ SEGASATURN\ Sega Saturn disc image 326>0 use sega-saturn-disc-header 327>0 byte x (2048-byte sectors) 328# 2352-byte sector version. 3290x10 string SEGA\ SEGASATURN\ Sega Saturn disc image 330>0x10 use sega-saturn-disc-header 331>0 byte x (2352-byte sectors) 332 333#------------------------------------------------------------------------------ 334# dreamcast: file(1) magic for the Sega Dreamcast disc image format. 335# From: David Korth <gerbilsoft@gerbilsoft.com> 336# Reference: http://mc.pp.se/dc/ip0000.bin.html 337# 338 339# Common Sega Dreamcast disc header format. 340# NOTE: Title is 128 bytes, but we're only showing 32 due to space padding. 341# TODO: Release date, device information, region code, others? 3420 name sega-dreamcast-disc-header 343>0x80 string >\0 \b: "%.32s" 344>0x40 string >\0 (%.10s 345>>0x4A string >\0 \b, %.6s) 346>>0x4A byte 0 \b) 347 348# 2048-byte sector version. 3490 string SEGA\ SEGAKATANA\ Sega Dreamcast disc image 350>0 use sega-dreamcast-disc-header 351>0 byte x (2048-byte sectors) 352# 2352-byte sector version. 3530x10 string SEGA\ SEGAKATANA\ Sega Dreamcast disc image 354>0x10 use sega-dreamcast-disc-header 355>0 byte x (2352-byte sectors) 356 357#------------------------------------------------------------------------------ 358# dreamcast: file(1) uncertain magic for the Sega Dreamcast VMU image format 359# 3600 belong 0x21068028 Sega Dreamcast VMU game image 3610 string LCDi Dream Animator file 362 363#------------------------------------------------------------------------------ 364# z64: file(1) magic for the Z64 format N64 ROM dumps 365# Reference: http://forum.pj64-emu.com/showthread.php?t=2239 366# From: David Korth <gerbilsoft@gerbilsoft.com> 367# 3680 bequad 0x803712400000000F Nintendo 64 ROM image 369>0x20 string >\0 \b: "%.20s" 370>0x3B string x (%.4s 371>0x3F byte x \b, Rev.%02u) 372 373#------------------------------------------------------------------------------ 374# v64: file(1) magic for the V64 format N64 ROM dumps 375# Same as z64 format, but with 16-bit byteswapping. 376# 3770 bequad 0x3780401200000F00 Nintendo 64 ROM image (V64) 378 379#------------------------------------------------------------------------------ 380# n64-swap2: file(1) magic for the swap2 format N64 ROM dumps 381# Same as z64 format, but with swapped 16-bit words. 382# 3830 bequad 0x12408037000F0000 Nintendo 64 ROM image (wordswapped) 384 385#------------------------------------------------------------------------------ 386# n64-le32: file(1) magic for the 32-bit byteswapped format N64 ROM dumps 387# Same as z64 format, but with 32-bit byteswapping. 388# 3890 bequad 0x401237800F000000 Nintendo 64 ROM image (32-bit byteswapped) 390 391#------------------------------------------------------------------------------ 392# gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format 393# Reference: http://problemkaputt.de/gbatek.htm#gbacartridgeheader 394# 395# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com> 396# Updated version from: David Korth <gerbilsoft@gerbilsoft.com> 397# 3984 bequad 0x24FFAE51699AA221 Game Boy Advance ROM image 399>0xA0 string >\0 \b: "%.12s" 400>0xAC string x (%.6s 401>0xBC byte x \b, Rev.%02u) 402 403#------------------------------------------------------------------------------ 404# nds: file(1) magic for the Nintendo DS(i) raw ROM format 405# Reference: http://problemkaputt.de/gbatek.htm#dscartridgeheader 406# 407# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com> 408# Updated version from: David Korth <gerbilsoft@gerbilsoft.com> 409# 4100xC0 bequad 0x24FFAE51699AA221 Nintendo DS ROM image 411>0x00 string >\0 \b: "%.12s" 412>0x0C string x (%.6s 413>0x1E byte x \b, Rev.%02u) 414>0x12 byte 2 (DSi enhanced) 415>0x12 byte 3 (DSi only) 416# Secure Area check. 417>0x20 lelong <0x4000 (homebrew) 418>0x20 lelong >0x3FFF 419>>0x4000 lequad 0x0000000000000000 (multiboot) 420>>0x4000 lequad !0x0000000000000000 421>>>0x4000 lequad 0xE7FFDEFFE7FFDEFF (decrypted) 422>>>0x4000 lequad !0xE7FFDEFFE7FFDEFF 423>>>>0x1000 lequad 0x0000000000000000 (encrypted) 424>>>>0x1000 lequad !0x0000000000000000 (mask ROM) 425 426#------------------------------------------------------------------------------ 427# nds_passme: file(1) magic for Nintendo DS ROM images for GBA cartridge boot. 428# This is also used for loading .nds files using the MSET exploit on 3DS. 429# Reference: https://github.com/devkitPro/ndstool/blob/master/source/ndscreate.cpp 4300xC0 bequad 0xC8604FE201708FE2 Nintendo DS Slot-2 ROM image (PassMe) 431 432#------------------------------------------------------------------------------ 433# ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format. 434# From: David Korth <gerbilsoft@gerbilsoft.com> 435# References: 436# - https://neogpc.googlecode.com/svn-history/r10/trunk/src/core/neogpc.cpp 437# - http://www.devrs.com/ngp/files/ngpctech.txt 438# 4390x0A string BY\ SNK\ CORPORATION Neo Geo Pocket 440>0x23 byte 0x10 Color 441>0 byte x ROM image 442>0x24 string >\0 \b: "%.12s" 443>0x1F byte 0xFF (debug mode enabled) 444 445#------------------------------------------------------------------------------ 446# msx: file(1) magic for MSX game cartridge dumps 447# Too simple - MPi 448#0 beshort 0x4142 MSX game cartridge dump 449 450#------------------------------------------------------------------------------ 451# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) : 4520 string PS-X\ EXE Sony Playstation executable 453>16 lelong x PC=0x%08x, 454>20 lelong !0 GP=0x%08x, 455>24 lelong !0 .text=[0x%08x, 456>>28 lelong x \b0x%x], 457>32 lelong !0 .data=[0x%08x, 458>>36 lelong x \b0x%x], 459>40 lelong !0 .bss=[0x%08x, 460>>44 lelong x \b0x%x], 461>48 lelong !0 Stack=0x%08x, 462>48 lelong =0 No Stack!, 463>52 lelong !0 StackSize=0x%x, 464#>76 string >\0 (%s) 465# Area: 466>113 string x (%s) 467 468# CPE executables 4690 string CPE CPE executable 470>3 byte x (version %d) 471 472#------------------------------------------------------------------------------ 473# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>) 4740 string XBEH XBE, Microsoft Xbox executable 475# probabilistic checks whether signed or not 476>0x0004 ulelong =0x0 477>>&2 ulelong =0x0 478>>>&2 ulelong =0x0 \b, not signed 479>0x0004 ulelong >0 480>>&2 ulelong >0 481>>>&2 ulelong >0 \b, signed 482# expect base address of 0x10000 483>0x0104 ulelong =0x10000 484>>(0x0118-0x0FF60) ulelong&0x80000007 0x80000007 \b, all regions 485>>(0x0118-0x0FF60) ulelong&0x80000007 !0x80000007 486>>>(0x0118-0x0FF60) ulelong >0 (regions: 487>>>>(0x0118-0x0FF60) ulelong &0x00000001 NA 488>>>>(0x0118-0x0FF60) ulelong &0x00000002 Japan 489>>>>(0x0118-0x0FF60) ulelong &0x00000004 Rest_of_World 490>>>>(0x0118-0x0FF60) ulelong &0x80000000 Manufacturer 491>>>(0x0118-0x0FF60) ulelong >0 \b) 492 493# -------------------------------- 494# Microsoft Xbox data file formats 4950 string XIP0 XIP, Microsoft Xbox data 4960 string XTF0 XTF, Microsoft Xbox data 497 498# Atari Lynx cartridge dump (EXE/BLL header) 499# From: "Stefan A. Haubenthal" <polluks@web.de> 500 501# Double-check that the image type matches too, 0x8008 conflicts with 502# 8 character OMF-86 object file headers. 5030 beshort 0x8008 504>6 string BS93 Lynx homebrew cartridge 505>>2 beshort x \b, RAM start $%04x 506>6 string LYNX Lynx cartridge 507>>2 beshort x \b, RAM start $%04x 508 509# Opera file system that is used on the 3DO console 510# From: Serge van den Boom <svdb@stack.nl> 5110 string \x01ZZZZZ\x01 3DO "Opera" file system 512 513# From: Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu 514# From: David Pflug <david@pflug.email> 515# is the offset 12 or the offset 16 correct? 516# GBS (Game Boy Sound) magic 517# ftp://ftp.modland.com/pub/documents/format_documentation/\ 518# Gameboy%20Sound%20System%20(.gbs).txt 5190 string GBS Nintendo Gameboy Music/Audio Data 520#12 string GameBoy\ Music\ Module Nintendo Gameboy Music Module 521>16 string >\0 ("%s" by 522>48 string >\0 %s, copyright 523>80 string >\0 %s), 524>3 byte x version %d, 525>4 byte x %d tracks 526 527# IPS Patch Files from: From: Thomas Klausner <tk@giga.or.at> 528# see http://zerosoft.zophar.net/ips.php 5290 string PATCH IPS patch file 530 531# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at> 5320 string PPF30 Playstation Patch File version 3.0 533>5 byte 0 \b, PPF 1.0 patch 534>5 byte 1 \b, PPF 2.0 patch 535>5 byte 2 \b, PPF 3.0 patch 536>>56 byte 0 \b, Imagetype BIN (any) 537>>56 byte 1 \b, Imagetype GI (PrimoDVD) 538>>57 byte 0 \b, Blockcheck disabled 539>>57 byte 1 \b, Blockcheck enabled 540>>58 byte 0 \b, Undo data not available 541>>58 byte 1 \b, Undo data available 542>6 string x \b, description: %s 543 5440 string PPF20 Playstation Patch File version 2.0 545>5 byte 0 \b, PPF 1.0 patch 546>5 byte 1 \b, PPF 2.0 patch 547>>56 lelong >0 \b, size of file to patch %d 548>6 string x \b, description: %s 549 5500 string PPF10 Playstation Patch File version 1.0 551>5 byte 0 \b, Simple Encoding 552>6 string x \b, description: %s 553 554# From: Daniel Dawson <ddawson@icehouse.net> 555# SNES9x .smv "movie" file format. 5560 string SMV\x1A SNES9x input recording 557>0x4 lelong x \b, version %d 558# version 4 is latest so far 559>0x4 lelong <5 560>>0x8 ledate x \b, recorded at %s 561>>0xc lelong >0 \b, rerecorded %d times 562>>0x10 lelong x \b, %d frames long 563>>0x14 byte >0 \b, data for controller(s): 564>>>0x14 byte &0x1 #1 565>>>0x14 byte &0x2 #2 566>>>0x14 byte &0x4 #3 567>>>0x14 byte &0x8 #4 568>>>0x14 byte &0x10 #5 569>>0x15 byte ^0x1 \b, begins from snapshot 570>>0x15 byte &0x1 \b, begins from reset 571>>0x15 byte ^0x2 \b, NTSC standard 572>>0x15 byte &0x2 \b, PAL standard 573>>0x17 byte &0x1 \b, settings: 574# WIP1Timing not used as of version 4 575>>>0x4 lelong <4 576>>>>0x17 byte &0x2 WIP1Timing 577>>>0x17 byte &0x4 Left+Right 578>>>0x17 byte &0x8 VolumeEnvX 579>>>0x17 byte &0x10 FakeMute 580>>>0x17 byte &0x20 SyncSound 581# New flag as of version 4 582>>>0x4 lelong >3 583>>>>0x17 byte &0x80 NoCPUShutdown 584>>0x4 lelong <4 585>>>0x18 lelong >0x23 586>>>>0x20 leshort !0 587>>>>>0x20 lestring16 x \b, metadata: "%s" 588>>0x4 lelong >3 589>>>0x24 byte >0 \b, port 1: 590>>>>0x24 byte 1 joypad 591>>>>0x24 byte 2 mouse 592>>>>0x24 byte 3 SuperScope 593>>>>0x24 byte 4 Justifier 594>>>>0x24 byte 5 multitap 595>>>0x24 byte >0 \b, port 2: 596>>>>0x25 byte 1 joypad 597>>>>0x25 byte 2 mouse 598>>>>0x25 byte 3 SuperScope 599>>>>0x25 byte 4 Justifier 600>>>>0x25 byte 5 multitap 601>>>0x18 lelong >0x43 602>>>>0x40 leshort !0 603>>>>>0x40 lestring16 x \b, metadata: "%s" 604>>0x17 byte &0x40 \b, ROM: 605>>>(0x18.l-26) lelong x CRC32 0x%08x 606>>>(0x18.l-23) string x "%s" 607 608# Type: scummVM savegame files 609# From: Sven Hartge <debian@ds9.argh.org> 6100 string SCVM ScummVM savegame 611>12 string >\0 "%s" 612 613#------------------------------------------------------------------------------ 614# Nintendo GameCube / Wii file formats. 615# 616 617# Type: Nintendo GameCube/Wii common disc header data. 618# From: David Korth <gerbilsoft@gerbilsoft.com> 619# Reference: http://wiibrew.org/wiki/Wii_Disc 6200 name nintendo-gcn-disc-common 621>0x20 string x "%.64s" 622>0x00 string x (%.6s 623>0x06 byte >0 624>>0x06 byte 1 \b, Disc 2 625>>0x06 byte 2 \b, Disc 3 626>>0x06 byte 3 \b, Disc 4 627>0x07 byte x \b, Rev.%02u) 628 629# Type: Nintendo GameCube disc image 630# From: David Korth <gerbilsoft@gerbilsoft.com> 631# Reference: http://wiibrew.org/wiki/Wii_Disc 6320x1C belong 0xC2339F3D Nintendo GameCube disc image: 633>0 use nintendo-gcn-disc-common 634 635# Type: Nintendo GameCube embedded disc image 636# Commonly found on demo discs. 637# From: David Korth <gerbilsoft@gerbilsoft.com> 638# Reference: http://hitmen.c02.at/files/yagcd/yagcd/index.html#idx14.8 6390 belong 0xAE0F38A2 640>0x0C belong 0x00100000 641>>(8.L+0x1C) belong 0xC2339F3D Nintendo GameCube embedded disc image: 642>>>(8.L) use nintendo-gcn-disc-common 643 644# Type: Nintendo Wii disc image 645# From: David Korth <gerbilsoft@gerbilsoft.com> 646# Reference: http://wiibrew.org/wiki/Wii_Disc 6470x18 belong 0x5D1C9EA3 Nintendo Wii disc image: 648>0 use nintendo-gcn-disc-common 649 650# Type: Nintendo Wii disc image (WBFS format) 651# From: David Korth <gerbilsoft@gerbilsoft.com> 652# Reference: http://wiibrew.org/wiki/Wii_Disc 6530 string WBFS 654>0x218 belong 0x5D1C9EA3 Nintendo Wii disc image (WBFS format): 655>>0x200 use nintendo-gcn-disc-common 656 657# Type: Nintendo GameCube/Wii disc image (CISO format) 658# NOTE: This is NOT the same as Compact ISO or PSP CISO, 659# though it has the same magic number. 6600 string CISO 661# Other fields are used to determine what type of CISO this is: 662# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size) 663# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size) 664# - None of the above: Compact ISO. 665>4 lelong 0x200000 666>>8 byte 1 667>>>0x801C belong 0xC2339F3D Nintendo GameCube disc image (CISO format): 668>>>>0x8000 use nintendo-gcn-disc-common 669>>>0x8018 belong 0x5D1C9EA3 Nintendo Wii disc image (CISO format): 670>>>>0x8000 use nintendo-gcn-disc-common 671 672# Type: Nintendo GameCube/Wii disc image (GCZ format) 673# Due to zlib compression, we can't get the actual disc information. 6740 lelong 0xB10BC001 675>4 lelong 0 Nintendo GameCube disc image (GCZ format) 676>4 lelong 1 Nintendo Wii disc image (GCZ format) 677>4 lelong >1 Nintendo GameCube/Wii disc image (GCZ format) 678 679# Type: Nintendo GameCube/Wii disc image (WDF format) 6800 string WII\001DISC 681>8 belong 1 682# WDFv1 683>>0x54 belong 0xC2339F3D Nintendo GameCube disc image (WDFv1 format): 684>>>0x38 use nintendo-gcn-disc-common 685>>0x58 belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv1 format): 686>>>0x38 use nintendo-gcn-disc-common 687>8 belong 2 688# WDFv2 689>>(12.L+0x1C) belong 0xC2339F3D Nintendo GameCube disc image (WDFv2 format): 690>>>(12.L) use nintendo-gcn-disc-common 691>>(12.L+0x18) belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv2 format): 692>>>(12.L) use nintendo-gcn-disc-common 693 694# Type: Nintendo GameCube/Wii disc image (WIA format) 6950 string WIA\001 Nintendo 696>0x48 belong 0 GameCube/Wii 697>0x48 belong 1 GameCube 698>0x48 belong 2 Wii 699>0x48 belong >2 GameCube/Wii 700>0x48 belong x disc image (WIA format): 701>>0x58 use nintendo-gcn-disc-common 702 703#------------------------------------------------------------------------------ 704# Nintendo 3DS file formats. 705# 706 707# Type: Nintendo 3DS "NCSD" image. (game cards and eMMC) 708# From: David Korth <gerbilsoft@gerbilsoft.com> 709# Reference: https://www.3dbrew.org/wiki/NCSD 7100x100 string NCSD 711>0x118 lequad 0 Nintendo 3DS Game Card image 712# NCCH header for partition 0. (game data) 713>>0x1150 string >\0 \b: "%.16s" 714>>0x312 byte x (Rev.%02u) 715>>0x118C byte 2 (New3DS only) 716>>0x18D byte 0 (inner device) 717>>0x18D byte 1 (Card1) 718>>0x18D byte 2 (Card2) 719>>0x18D byte 3 (extended device) 720>0x118 bequad 0x0102020202000000 Nintendo 3DS eMMC dump (Old3DS) 721>0x118 bequad 0x0102020203000000 Nintendo 3DS eMMC dump (New3DS) 722 723# Nintendo 3DS version code. 724# Reference: https://www.3dbrew.org/wiki/Titles 725# Format: leshort containing three fields: 726# - 6-bit: Major 727# - 6-bit: Minor 728# - 4-bit: Revision 729# NOTE: Only supporting major/minor versions from 0-15 right now. 730# NOTE: Should be prefixed with "v". 7310 name nintendo-3ds-version-code 732# Raw version. 733>0 leshort x \b%u, 734# Major version. 735>0 leshort&0xFC00 0x0000 0 736>0 leshort&0xFC00 0x0400 1 737>0 leshort&0xFC00 0x0800 2 738>0 leshort&0xFC00 0x0C00 3 739>0 leshort&0xFC00 0x1000 4 740>0 leshort&0xFC00 0x1400 5 741>0 leshort&0xFC00 0x1800 6 742>0 leshort&0xFC00 0x1C00 7 743>0 leshort&0xFC00 0x2000 8 744>0 leshort&0xFC00 0x2400 9 745>0 leshort&0xFC00 0x2800 10 746>0 leshort&0xFC00 0x2C00 11 747>0 leshort&0xFC00 0x3000 12 748>0 leshort&0xFC00 0x3400 13 749>0 leshort&0xFC00 0x3800 14 750>0 leshort&0xFC00 0x3C00 15 751# Minor version. 752>0 leshort&0x03F0 0x0000 \b.0 753>0 leshort&0x03F0 0x0010 \b.1 754>0 leshort&0x03F0 0x0020 \b.2 755>0 leshort&0x03F0 0x0030 \b.3 756>0 leshort&0x03F0 0x0040 \b.4 757>0 leshort&0x03F0 0x0050 \b.5 758>0 leshort&0x03F0 0x0060 \b.6 759>0 leshort&0x03F0 0x0070 \b.7 760>0 leshort&0x03F0 0x0080 \b.8 761>0 leshort&0x03F0 0x0090 \b.9 762>0 leshort&0x03F0 0x00A0 \b.10 763>0 leshort&0x03F0 0x00B0 \b.11 764>0 leshort&0x03F0 0x00C0 \b.12 765>0 leshort&0x03F0 0x00D0 \b.13 766>0 leshort&0x03F0 0x00E0 \b.14 767>0 leshort&0x03F0 0x00F0 \b.15 768# Revision. 769>0 leshort&0x000F x \b.%u 770 771# Type: Nintendo 3DS "NCCH" container. 772# https://www.3dbrew.org/wiki/NCCH 7730x100 string NCCH Nintendo 3DS 774>0x18D byte&2 0 File Archive (CFA) 775>0x18D byte&2 2 Executable Image (CXI) 776>0x150 string >\0 \b: "%.16s" 777>0x18D byte 0x05 778>>0x10E leshort x (Old3DS System Update v 779>>0x10E use nintendo-3ds-version-code 780>>0x10E leshort x \b) 781>0x18D byte 0x15 782>>0x10E leshort x (New3DS System Update v 783>>0x10E use nintendo-3ds-version-code 784>>0x10E leshort x \b) 785>0x18D byte !0x05 786>>0x18D byte !0x15 787>>>0x112 byte x (v 788>>>0x112 use nintendo-3ds-version-code 789>>>0x112 byte x \b) 790>0x18C byte 2 (New3DS only) 791 792# Type: Nintendo 3DS "SMDH" file. (application description) 793# From: David Korth <gerbilsoft@gerbilsoft.com> 794# Reference: https://3dbrew.org/wiki/SMDH 7950 string SMDH Nintendo 3DS SMDH file 796>0x208 leshort !0 797>>0x208 lestring16 x \b: "%.128s" 798>>0x388 leshort !0 799>>>0x388 lestring16 x by %.128s 800>0x208 leshort 0 801>>0x008 leshort !0 802>>>0x008 lestring16 x \b: "%.128s" 803>>>0x188 leshort !0 804>>>>0x188 lestring16 x by %.128s 805 806# Type: Nintendo 3DS Homebrew Application. 807# From: David Korth <gerbilsoft@gerbilsoft.com> 808# Reference: https://3dbrew.org/wiki/3DSX_Format 8090 string 3DSX Nintendo 3DS Homebrew Application (3DSX) 810 811#------------------------------------------------------------------------------ 812# a7800: file(1) magic for the Atari 7800 raw ROM format. 813# From: David Korth <gerbilsoft@gerbilsoft.com> 814# Reference: https://sites.google.com/site/atari7800wiki/a78-header 815 8160 byte >0 817>0 byte <3 818>>1 string ATARI7800 Atari 7800 ROM image 819>>>0x11 string >\0 \b: "%.32s" 820# Display type. 821>>>0x39 byte 0 (NTSC) 822>>>0x39 byte 1 (PAL) 823>>>0x36 byte&1 1 (POKEY) 824 825#------------------------------------------------------------------------------ 826# vectrex: file(1) magic for the GCE Vectrex raw ROM format. 827# From: David Korth <gerbilsoft@gerbilsoft.com> 828# Reference: http://www.playvectrex.com/designit/chrissalo/hello1.htm 829# 830# NOTE: Title is terminated with 0x80, not 0. 831# The header is terminated with a 0, so that will 832# terminate the title as well. 833# 8340 string g\ GCE Vectrex ROM image 835>0x11 string >\0 \b: "%.16s" 836 837#------------------------------------------------------------------------------ 838# amiibo: file(1) magic for Nintendo amiibo NFC dumps. 839# From: David Korth <gerbilsoft@gerbilsoft.com> 840# Reference: https://www.3dbrew.org/wiki/Amiibo 8410x00 byte 0x04 842>0x0A beshort 0x0FE0 843>>0x0C belong 0xF110FFEE 844>>>0x208 beshort 0x0100 845>>>>0x020A byte 0x0F 846>>>>>0x020C bequad 0x000000045F000000 847>>>>>>0x5B byte 0x02 848>>>>>>>0x54 belong x Nintendo amiibo NFC dump - amiibo ID: %08X- 849>>>>>>>0x58 belong x \b%08X 850