1 2#------------------------------------------------------------------------------ 3# $File: console,v 1.80 2024/11/09 23:55:02 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# - https://wiki.nesdev.com/w/index.php/INES 11# - https://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!:mime application/x-nes-rom 51>0 use nes-rom-image-ines 52 53# Wii U Virtual Console iNES ROM header. 540 belong 0x4E455300 NES ROM image (Wii U Virtual Console) 55!:mime application/x-nes-rom 56>0 use nes-rom-image-ines 57 58#------------------------------------------------------------------------------ 59# unif: file(1) magic for UNIF-format Nintendo Entertainment System ROM images 60# Reference: https://wiki.nesdev.com/w/index.php/UNIF 61# From: David Korth <gerbilsoft@gerbilsoft.com> 62# 63# NOTE: The UNIF format uses chunks instead of a fixed header, 64# so most of the data isn't easily parseable. 65# 660 string UNIF 67>4 lelong <16 NES ROM image (UNIF v%d format) 68!:mime application/x-nes-rom 69 70#------------------------------------------------------------------------------ 71# fds: file(1) magic for Famicom Disk System disk images 72# Reference: https://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. 75 76# Disk info block. (block 1) 770 name nintendo-fds-disk-info-block 78>23 byte !1 FMC- 79>23 byte 1 FSC- 80>16 string x \b%.3s 81>15 ubyte x \b, mfr %02X 82>20 ubyte x (Rev.%02u) 83 84# Headered version. 850 string FDS\x1A 86>0x11 string *NINTENDO-HVC* Famicom Disk System disk image: 87!:mime application/x-fds-disk 88>>0x10 use nintendo-fds-disk-info-block 89>4 byte 1 (%u side) 90>4 byte !1 (%u sides) 91 92# Unheadered version. 931 string *NINTENDO-HVC* Famicom Disk System disk image: 94!:mime application/x-fds-disk 95>0 use nintendo-fds-disk-info-block 96 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> 101# 1020 string TNES NES ROM image (Nintendo 3DS Virtual Console) 103!:mime application/x-nes-rom 104>4 byte 100 \b: FDS, 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] 113 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 117# 118 119# Title (16 chars for GB; 15 chars for CGB) 1200 name gameboy-title 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) 126 127# Machine type (SGB, CGB, SGB+CGB) 128# Old licensee code 0x33 is required for SGB, but not CGB. 1290 name gameboy-machine-type 130>0x14b byte 0x33 131>>0x146 byte 0x03 132>>>0x143 byte&0x80 0x80 [SGB+CGB] 133>>>0x143 byte&0x80 !0x80 [SGB] 134>>0x146 byte !0x03 135>>>0x143 byte&0xC0 0x80 [CGB] 136>>>0x143 byte&0xC0 0xC0 [CGB ONLY] 137>0x14b byte !0x33 138>>0x143 byte&0xC0 0x80 [CGB] 139>>0x143 byte&0xC0 0xC0 [CGB ONLY] 140 141# Mapper 1420 name gameboy-mapper 143>0 byte 0x00 [ROM ONLY] 144>0 byte 0x01 [MBC1] 145>0 byte 0x02 [MBC1+RAM] 146>0 byte 0x03 [MBC1+RAM+BATT] 147>0 byte 0x05 [MBC2] 148>0 byte 0x06 [MBC2+BATTERY] 149>0 byte 0x08 [ROM+RAM] 150>0 byte 0x09 [ROM+RAM+BATTERY] 151>0 byte 0x0B [MMM01] 152>0 byte 0x0C [MMM01+SRAM] 153>0 byte 0x0D [MMM01+SRAM+BATT] 154>0 byte 0x0F [MBC3+TIMER+BATT] 155>0 byte 0x10 [MBC3+TIMER+RAM+BATT] 156>0 byte 0x11 [MBC3] 157>0 byte 0x12 [MBC3+RAM] 158>0 byte 0x13 [MBC3+RAM+BATT] 159>0 byte 0x19 [MBC5] 160>0 byte 0x1A [MBC5+RAM] 161>0 byte 0x1B [MBC5+RAM+BATT] 162>0 byte 0x1C [MBC5+RUMBLE] 163>0 byte 0x1D [MBC5+RUMBLE+SRAM] 164>0 byte 0x1E [MBC5+RUMBLE+SRAM+BATT] 165>0 byte 0xFC [Pocket Camera] 166>0 byte 0xFD [Bandai TAMA5] 167>0 byte 0xFE [Hudson HuC-3] 168>0 byte 0xFF [Hudson HuC-1] 169 170# ROM size 1710 name gameboy-rom-size 172>0 byte 0 \b, ROM: 256Kbit 173>0 byte 1 \b, ROM: 512Kbit 174>0 byte 2 \b, ROM: 1Mbit 175>0 byte 3 \b, ROM: 2Mbit 176>0 byte 4 \b, ROM: 4Mbit 177>0 byte 5 \b, ROM: 8Mbit 178>0 byte 6 \b, ROM: 16Mbit 179>0 byte 7 \b, ROM: 32Mbit 180>0 byte 0x52 \b, ROM: 9Mbit 181>0 byte 0x53 \b, ROM: 10Mbit 182>0 byte 0x54 \b, ROM: 12Mbit 183 184# RAM size 1850 name gameboy-ram-size 186>0 byte 1 \b, RAM: 16Kbit 187>0 byte 2 \b, RAM: 64Kbit 188>0 byte 3 \b, RAM: 256Kbit 189>0 byte 4 \b, RAM: 1Mbit 190>0 byte 5 \b, RAM: 512Kbit 191 192# Game Boy (Color) 1930x104 bequad 0xCEED6666CC0D000B 194>0x143 byte&0x80 0x80 Game Boy Color ROM image 195!:mime application/x-gameboy-color-rom 196>0x143 byte&0x80 !0x80 Game Boy ROM image 197!:mime application/x-gameboy-rom 198>0 use gameboy-title 199>0 use gameboy-machine-type 200>0x147 use gameboy-mapper 201>0x148 use gameboy-rom-size 202>0x149 use gameboy-ram-size 203 204# Analogue Pocket 2050x104 bequad 0x0110CEEF000044AA 206>0 byte x Analogue Pocket ROM image 207!:mime application/x-analogue-pocket-rom 208>0 use gameboy-title 209>0 use gameboy-machine-type 210>0x147 use gameboy-mapper 211>0x148 use gameboy-rom-size 212>0x149 use gameboy-ram-size 213 214#------------------------------------------------------------------------------ 215# genesis: file(1) magic for various Sega Mega Drive / Genesis ROM image and disc formats 216# Updated by David Korth <gerbilsoft@gerbilsoft.com> 217# References: 218# - https://www.retrodev.com/segacd.html 219# - http://devster.monkeeh.com/sega/32xguide1.txt 220# 221 222# Common Sega Mega Drive header format. 223# FIXME: Name fields are 48 bytes, but have spaces for padding instead of 00s. 2240 name sega-mega-drive-header 225# ROM title. (Use domestic if present; if not, use international.) 226>0x120 byte >0x20 227>>0x120 string >\0 \b: "%.16s" 228>0x120 byte <0x21 229>>0x150 string >\0 \b: "%.16s" 230# Other information. 231>0x180 string >\0 (%.14s 232>>0x110 string >\0 \b, %.16s 233>0x180 byte 0 234>>0x110 string >\0 (%.16s 235>0 byte x \b) 236 237# TODO: Check for 32X CD? 238# Sega Mega CD disc images: 2048-byte sectors. 2390 string SEGADISCSYSTEM\040\040 Sega Mega CD disc image 240!:mime application/x-sega-cd-rom 241>0 use sega-mega-drive-header 242>0 byte x \b, 2048-byte sectors 2430 string SEGABOOTDISC\040\040\040\040 Sega Mega CD disc image 244!:mime application/x-sega-cd-rom 245>0 use sega-mega-drive-header 246>0 byte x \b, 2048-byte sectors 247# Sega Mega CD disc images: 2352-byte sectors. 2480x10 string SEGADISCSYSTEM\040\040 Sega Mega CD disc image 249!:mime application/x-sega-cd-rom 250>0x10 use sega-mega-drive-header 251>0 byte x \b, 2352-byte sectors 2520x10 string SEGABOOTDISC\040\040\040\040 Sega Mega CD disc image 253!:mime application/x-sega-cd-rom 254>0x10 use sega-mega-drive-header 255>0 byte x \b, 2352-byte sectors 256 257# Sega Mega Drive: Identify the system ID. 2580x100 string SEGA 259>0x3C0 string MARS\040CHECK\040MODE Sega 32X ROM image 260!:mime application/x-genesis-32x-rom 261>>0 use sega-mega-drive-header 262>0x104 string \040PICO Sega Pico ROM image 263!:mime application/x-sega-pico-rom 264>>0 use sega-mega-drive-header 265>0x104 string TOYS\040PICO Sega Pico ROM image 266!:mime application/x-sega-pico-rom 267>>0 use sega-mega-drive-header 268>0x104 string \040TOYS\040PICO Sega Pico ROM image 269!:mime application/x-sega-pico-rom 270>>0 use sega-mega-drive-header 271>0x104 string \040IAC Sega Pico ROM image 272!:mime application/x-sega-pico-rom 273>>0 use sega-mega-drive-header 274>0x104 string \040TERA68K Sega Teradrive (68K) ROM image 275!:mime application/x-sega-teradrive-rom 276>>0 use sega-mega-drive-header 277>0x104 string \040TERA286 Sega Teradrive (286) ROM image 278!:mime application/x-sega-teradrive-rom 279>>0 use sega-mega-drive-header 280>0x180 string BR Sega Mega CD Boot ROM image 281!:mime application/x-genesis-rom 282>>0 use sega-mega-drive-header 283>0x104 default x Sega Mega Drive / Genesis ROM image 284!:mime application/x-genesis-rom 285>>0 use sega-mega-drive-header 286 287# Sega Mega Drive: Some ROMs have "SEGA" at 0x101, not 0x100. 2880x100 string \040SEGA Sega Mega Drive / Genesis ROM image 289>0 use sega-mega-drive-header 290 291# Sega Pico ROMs that don't start with "SEGA". 2920x100 string SAMSUNG\040PICO Samsung Pico ROM image 293!:mime application/x-sega-pico-rom 294>0 use sega-mega-drive-header 2950x100 string IMA\040IKUNOUJYUKU Samsung Pico ROM image 296!:mime application/x-sega-pico-rom 297>0 use sega-mega-drive-header 2980x100 string IMA\040IKUNOJYUKU Samsung Pico ROM image 299!:mime application/x-sega-pico-rom 300>0 use sega-mega-drive-header 301 302# Sega Picture Magic (modified 32X) 3030x100 string Picture\040Magic 304>0x3C0 string PICTURE\040MAGIC-01 Sega 32X ROM image 305!:mime application/x-genesis-32x-rom 306>>0 use sega-mega-drive-header 307 308#------------------------------------------------------------------------------ 309# genesis: file(1) magic for the Super MegaDrive ROM dump format 310# 311 312# NOTE: Due to interleaving, we can't display anything 313# other than the copier header information. 3140 name sega-genesis-smd-header 315>0 byte x %dx16k blocks 316>2 byte 0 \b, last in series or standalone 317>2 byte >0 \b, split ROM 318 319# "Sega Genesis" header. 3200x280 string EAGN 321>8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format): 322!:mime application/x-genesis-rom 323>>0 use sega-genesis-smd-header 324 325# "Sega Mega Drive" header. 3260x280 string EAMG 327>8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format): 328!:mime application/x-genesis-rom 329>>0 use sega-genesis-smd-header 330 331#------------------------------------------------------------------------------ 332# smsgg: file(1) magic for Sega Master System and Game Gear ROM images 333# Detects all Game Gear and export Sega Master System ROM images, 334# and some Japanese Sega Master System ROM images. 335# From: David Korth <gerbilsoft@gerbilsoft.com> 336# Reference: https://www.smspower.org/Development/ROMHeader 337# 338 339# General SMS header rule. 340# The SMS boot ROM checks the header at three locations. 3410 name sega-master-system-rom-header 342# Machine type. 343>0x0F ubyte&0xF0 0x30 Sega Master System 344!:mime application/x-sms-rom 345>0x0F ubyte&0xF0 0x40 Sega Master System 346!:mime application/x-sms-rom 347>0x0F ubyte&0xF0 0x50 Sega Game Gear 348!:mime application/x-gamegear-rom 349>0x0F ubyte&0xF0 0x60 Sega Game Gear 350!:mime application/x-gamegear-rom 351>0x0F ubyte&0xF0 0x70 Sega Game Gear 352!:mime application/x-gamegear-rom 353>0x0F default x Sega Master System / Game Gear 354!:mime application/x-sms-rom 355>0 byte x ROM image: 356# Product code. 357>0x0E ubyte&0xF0 0x10 1 358>0x0E ubyte&0xF0 0x20 2 359>0x0E ubyte&0xF0 0x30 3 360>0x0E ubyte&0xF0 0x40 4 361>0x0E ubyte&0xF0 0x50 5 362>0x0E ubyte&0xF0 0x60 6 363>0x0E ubyte&0xF0 0x70 7 364>0x0E ubyte&0xF0 0x80 8 365>0x0E ubyte&0xF0 0x90 9 366>0x0E ubyte&0xF0 0xA0 10 367>0x0E ubyte&0xF0 0xB0 11 368>0x0E ubyte&0xF0 0xC0 12 369>0x0E ubyte&0xF0 0xD0 13 370>0x0E ubyte&0xF0 0xE0 14 371>0x0E ubyte&0xF0 0xF0 15 372# If the product code is 5 digits, we'll need to backspace here. 373>0x0E ubyte&0xF0 !0 374>>0x0C uleshort x \b%04x 375>0x0E ubyte&0xF0 0 376>>0x0C uleshort x %04x 377# Revision. 378>0x0E ubyte&0x0F x (Rev.%02d) 379# ROM size. (Used for the boot ROM checksum routine.) 380>0x0F ubyte&0x0F 0x0A (8 KB) 381>0x0F ubyte&0x0F 0x0B (16 KB) 382>0x0F ubyte&0x0F 0x0C (32 KB) 383>0x0F ubyte&0x0F 0x0D (48 KB) 384>0x0F ubyte&0x0F 0x0E (64 KB) 385>0x0F ubyte&0x0F 0x0F (128 KB) 386>0x0F ubyte&0x0F 0x00 (256 KB) 387>0x0F ubyte&0x0F 0x01 (512 KB) 388>0x0F ubyte&0x0F 0x02 (1 MB) 389 390# SMS/GG header locations. 3910x7FF0 string TMR\040SEGA 392>0x7FF0 use sega-master-system-rom-header 3930x3FF0 string TMR\040SEGA 394>0x3FF0 use sega-master-system-rom-header 3950x1FF0 string TMR\040SEGA 396>0x1FF0 use sega-master-system-rom-header 397 398#------------------------------------------------------------------------------ 399# saturn: file(1) magic for the Sega Saturn disc image format. 400# From: David Korth <gerbilsoft@gerbilsoft.com> 401# 402 403# Common Sega Saturn disc header format. 404# NOTE: Title is 112 bytes, but we're only showing 32 due to space padding. 405# TODO: Release date, device information, region code, others? 4060 name sega-saturn-disc-header 407>0x60 string >\0 \b: "%.32s" 408>0x20 string >\0 (%.10s 409>>0x2A string >\0 \b, %.6s) 410>>0x2A byte 0 \b) 411 412# 2048-byte sector version. 4130 string SEGA\040SEGASATURN\040 Sega Saturn disc image 414!:mime application/x-saturn-rom 415>0 use sega-saturn-disc-header 416>0 byte x (2048-byte sectors) 417# 2352-byte sector version. 4180x10 string SEGA\040SEGASATURN\040 Sega Saturn disc image 419!:mime application/x-saturn-rom 420>0x10 use sega-saturn-disc-header 421>0 byte x (2352-byte sectors) 422 423#------------------------------------------------------------------------------ 424# dreamcast: file(1) magic for the Sega Dreamcast disc image format. 425# From: David Korth <gerbilsoft@gerbilsoft.com> 426# Reference: https://mc.pp.se/dc/ip0000.bin.html 427# 428 429# Common Sega Dreamcast disc header format. 430# NOTE: Title is 128 bytes, but we're only showing 32 due to space padding. 431# TODO: Release date, device information, region code, others? 4320 name sega-dreamcast-disc-header 433>0x80 string >\0 \b: "%.32s" 434>0x40 string >\0 (%.10s 435>>0x4A string >\0 \b, %.6s) 436>>0x4A byte 0 \b) 437 438# 2048-byte sector version. 4390 string SEGA\040SEGAKATANA\040 Sega Dreamcast disc image 440!:mime application/x-dc-rom 441>0 use sega-dreamcast-disc-header 442>0 byte x (2048-byte sectors) 443# 2352-byte sector version. 4440x10 string SEGA\040SEGAKATANA\040 Sega Dreamcast disc image 445!:mime application/x-dc-rom 446>0x10 use sega-dreamcast-disc-header 447>0 byte x (2352-byte sectors) 448 449#------------------------------------------------------------------------------ 450# dreamcast: file(1) uncertain magic for the Sega Dreamcast VMU image format 451# 4520 belong 0x21068028 Sega Dreamcast VMU game image 4530 string LCDi Dream Animator file 454 455#------------------------------------------------------------------------------ 456# z64: file(1) magic for the Z64 format N64 ROM dumps 457# Reference: http://forum.pj64-emu.com/showthread.php?t=2239 458# From: David Korth <gerbilsoft@gerbilsoft.com> 459# 4600 bequad 0x803712400000000F Nintendo 64 ROM image 461!:mime application/x-n64-rom 462>0x20 string >\0 \b: "%.20s" 463>0x3B string x (%.4s 464>0x3F byte x \b, Rev.%02u) 465 466#------------------------------------------------------------------------------ 467# v64: file(1) magic for the V64 format N64 ROM dumps 468# Same as z64 format, but with 16-bit byteswapping. 469# 4700 bequad 0x3780401200000F00 Nintendo 64 ROM image (V64) 471!:mime application/x-n64-rom 472 473#------------------------------------------------------------------------------ 474# n64-swap2: file(1) magic for the swap2 format N64 ROM dumps 475# Same as z64 format, but with swapped 16-bit words. 476# 4770 bequad 0x12408037000F0000 Nintendo 64 ROM image (wordswapped) 478!:mime application/x-n64-rom 479 480#------------------------------------------------------------------------------ 481# n64-le32: file(1) magic for the 32-bit byteswapped format N64 ROM dumps 482# Same as z64 format, but with 32-bit byteswapping. 483# 4840 bequad 0x401237800F000000 Nintendo 64 ROM image (32-bit byteswapped) 485!:mime application/x-n64-rom 486 487#------------------------------------------------------------------------------ 488# gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format 489# Reference: https://problemkaputt.de/gbatek.htm#gbacartridgeheader 490# 491# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com> 492# Updated version from: David Korth <gerbilsoft@gerbilsoft.com> 493# 4944 bequad 0x24FFAE51699AA221 Game Boy Advance ROM image 495!:mime application/x-gba-rom 496>0xA0 string >\0 \b: "%.12s" 497>0xAC string x (%.6s 498>0xBC byte x \b, Rev.%02u) 499 500#------------------------------------------------------------------------------ 501# nds: file(1) magic for the Nintendo DS(i) raw ROM format 502# Reference: https://problemkaputt.de/gbatek.htm#dscartridgeheader 503# 504# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com> 505# Updated version from: David Korth <gerbilsoft@gerbilsoft.com> 506# 5070xC0 bequad 0x24FFAE51699AA221 Nintendo DS ROM image 508!:mime application/x-nintendo-ds-rom 509>0x00 string >\0 \b: "%.12s" 510>0x0C string x (%.6s 511>0x1E byte x \b, Rev.%02u) 512>0x12 byte 2 (DSi enhanced) 513>0x12 byte 3 (DSi only) 514# Secure Area check. 515>0x20 lelong <0x4000 (homebrew) 516>0x20 lelong >0x3FFF 517>>0x4000 lequad 0x0000000000000000 (multiboot) 518>>0x4000 lequad !0x0000000000000000 519>>>0x4000 lequad 0xE7FFDEFFE7FFDEFF (decrypted) 520>>>0x4000 lequad !0xE7FFDEFFE7FFDEFF 521>>>>0x1000 lequad 0x0000000000000000 (encrypted) 522>>>>0x1000 lequad !0x0000000000000000 (mask ROM) 523 524#------------------------------------------------------------------------------ 525# nds_passme: file(1) magic for Nintendo DS ROM images for GBA cartridge boot. 526# This is also used for loading .nds files using the MSET exploit on 3DS. 527# Reference: https://github.com/devkitPro/ndstool/blob/master/source/ndscreate.cpp 5280xC0 bequad 0xC8604FE201708FE2 Nintendo DS Slot-2 ROM image (PassMe) 529!:mime application/x-nintendo-ds-rom 530 531#------------------------------------------------------------------------------ 532# ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format. 533# From: David Korth <gerbilsoft@gerbilsoft.com> 534# References: 535# - https://neogpc.googlecode.com/svn-history/r10/trunk/src/core/neogpc.cpp 536# - https://www.devrs.com/ngp/files/ngpctech.txt 537# 5380x0A string BY\040SNK\040CORPORATION Neo Geo Pocket 539!:mime application/x-neo-geo-pocket-rom 540>0x23 byte 0x10 Color 541>0 byte x ROM image 542>0x24 string >\0 \b: "%.12s" 543>0x21 uleshort x \b, NEOP%04X 544>0x1F ubyte 0xFF (debug mode enabled) 545 546#------------------------------------------------------------------------------ 547# msx: file(1) magic for MSX game cartridge dumps 548# Too simple - MPi 549#0 beshort 0x4142 MSX game cartridge dump 550 551#------------------------------------------------------------------------------ 552# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) : 5530 string PS-X\040EXE Sony Playstation executable 554>16 lelong x PC=%#08x, 555>20 lelong !0 GP=%#08x, 556>24 lelong !0 .text=[%#08x, 557>>28 lelong x \b%#x], 558>32 lelong !0 .data=[%#08x, 559>>36 lelong x \b%#x], 560>40 lelong !0 .bss=[%#08x, 561>>44 lelong x \b%#x], 562>48 lelong !0 Stack=%#08x, 563>48 lelong =0 No Stack!, 564>52 lelong !0 StackSize=%#x, 565#>76 string >\0 (%s) 566# Area: 567>113 string x (%s) 568 569# CPE executables 5700 string CPE CPE executable 571>3 byte x (version %d) 572 573# Sony PlayStation archive (PSARC) 574# From: Alexandre Iooss <erdnaxe@crans.org> 575# URL: https://www.psdevwiki.com/ps3/PlayStation_archive_(PSARC) 5760 string PSAR Sony PlayStation Archive 577!:ext psarc 578>4 ubeshort x \b, version %d. 579>6 ubeshort x \b%d 580>8 string zlib \b, zlib compression 581>8 string lzma \b, LZMA compression 582>28 ubeshort&2 0 \b, relative paths 583>28 ubeshort&2 2 \b, absolute paths 584>28 ubeshort&1 1 \b, ignore case 585 586#------------------------------------------------------------------------------ 587# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>) 5880 string XBEH Microsoft Xbox executable 589!:mime audio/x-xbox-executable 590!:ext xbe 591# expect base address of 0x10000 592>0x0104 ulelong =0x10000 593>>(0x0118.l-0x0FFF4) lestring16 x \b: "%.40s" 594>>(0x0118.l-0x0FFF5) byte x (%c 595>>(0x0118.l-0x0FFF6) byte x \b%c- 596>>(0x0118.l-0x0FFF8) uleshort x \b%03u) 597>>(0x0118.l-0x0FF60) ulelong&0x80000007 0x80000007 \b, all regions 598>>(0x0118.l-0x0FF60) ulelong&0x80000007 !0x80000007 599>>>(0x0118.l-0x0FF60) ulelong >0 (regions: 600>>>>(0x0118.l-0x0FF60) ulelong &0x00000001 NA 601>>>>(0x0118.l-0x0FF60) ulelong &0x00000002 Japan 602>>>>(0x0118.l-0x0FF60) ulelong &0x00000004 Rest_of_World 603>>>>(0x0118.l-0x0FF60) ulelong &0x80000000 Manufacturer 604>>>(0x0118.l-0x0FF60) ulelong >0 \b) 605# probabilistic checks whether signed or not 606>0x0004 ulelong =0x0 607>>&2 ulelong =0x0 608>>>&2 ulelong =0x0 \b, not signed 609>0x0004 ulelong >0 610>>&2 ulelong >0 611>>>&2 ulelong >0 \b, signed 612 613# -------------------------------- 614# Microsoft Xbox data file formats 6150 string XIP0 XIP, Microsoft Xbox data 6160 string XTF0 XTF, Microsoft Xbox data 617 618#------------------------------------------------------------------------------ 619# Microsoft Xbox 360 executables (.xex) 620# From: David Korth <gerbilsoft@gerbilsoft.com> 621# References: 622# - https://free60project.github.io/wiki/XEX.html 623# - https://github.com/xenia-project/xenia/blob/HEAD/src/xenia/kernel/util/xex2_info.h 624 625# Title ID (part of Execution ID section) 6260 name xbox-360-xex-execution-id 627>(0.L+0xC) byte x (%c 628>(0.L+0xD) byte x \b%c 629>(0.L+0xE) beshort x \b-%04u, media ID: 630>(0.L) belong x %08X) 631 632# Region code (part of Security Info) 6330 name xbox-360-xex-region-code 634>0 ubelong 0xFFFFFFFF \b, all regions 635>0 ubelong !0xFFFFFFFF 636>>0 ubelong >0 (regions: 637>>0 ubelong&0x000000FF 0x000000FF USA 638>>0 ubelong&0x00000100 0x00000100 Japan 639>>0 ubelong&0x00000200 0x00000200 China 640>>0 ubelong&0x0000FC00 0x0000FC00 Asia 641>>0 ubelong&0x00FF0000 0x00FF0000 PAL 642>>0 ubelong&0x00FF0000 0x00FE0000 PAL [except AU/NZ] 643>>0 ubelong&0x00FF0000 0x00010000 AU/NZ 644>>0 ubelong&0xFF000000 0xFF000000 Other 645>>0 ubelong >0 \b) 646 6470 string XEX2 Microsoft Xbox 360 executable 648!:mime audio/x-xbox360-executable 649!:ext xex 650>0x18 search/0x100 \x00\x04\x00\x06 651>>&0 use xbox-360-xex-execution-id 652>(0x010.L+0x178) use xbox-360-xex-region-code 653 6540 string XEX1 Microsoft Xbox 360 executable (XEX1) 655!:mime audio/x-xbox360-executable 656!:ext xex 657>0x18 search/0x100 \x00\x04\x00\x06 658>>&0 use xbox-360-xex-execution-id 659>(0x010.L+0x154) use xbox-360-xex-region-code 660 661#------------------------------------------------------------------------------ 662# Microsoft Xbox 360 packages 663# From: David Korth <gerbilsoft@gerbilsoft.com> 664# References: 665# - https://free60project.github.io/wiki/STFS.html 666# - https://github.com/xenia-project/xenia/blob/HEAD/src/xenia/kernel/util/xex2_info.h 667 668# TODO: More information for console-signed packages. 669 6700 name xbox-360-package 671>0x360 byte x (%c 672>0x361 byte x \b%c 673>0x362 beshort x \b-%04u, media ID: 674>0x354 belong x %08X) 675>0x344 belong x \b, content type: 676>>0x344 belong 0x1 Saved Game 677>>0x344 belong 0x2 Marketplace Content 678>>0x344 belong 0x3 Publisher 679>>0x344 belong 0x1000 Xbox 360 Title 680>>0x344 belong 0x2000 IPTV Pause Buffer 681>>0x344 belong 0x4000 Installed Game 682>>0x344 belong 0x5000 Original Xbox Game 683>>0x344 belong 0x9000 Avatar Item 684>>0x344 belong 0x10000 Profile 685>>0x344 belong 0x20000 Gamer Picture 686>>0x344 belong 0x30000 Theme 687>>0x344 belong 0x40000 Cache File 688>>0x344 belong 0x50000 Storage Download 689>>0x344 belong 0x60000 Xbox Saved Game 690>>0x344 belong 0x70000 Xbox Download 691>>0x344 belong 0x80000 Game Demo 692>>0x344 belong 0x90000 Video 693>>0x344 belong 0xA0000 Game 694>>0x344 belong 0xB0000 Installer 695>>0x344 belong 0xC0000 Game Trailer 696>>0x344 belong 0xD0000 Arcade Title 697>>0x344 belong 0xE0000 XNA 698>>0x344 belong 0xF0000 License Store 699>>0x344 belong 0x100000 Movie 700>>0x344 belong 0x200000 TV 701>>0x344 belong 0x300000 Music Video 702>>0x344 belong 0x400000 Game Video 703>>0x344 belong 0x500000 Podcast Video 704>>0x344 belong 0x600000 Viral Video 705>>0x344 belong 0x2000000 Community Game 706 7070 string CON\x20 Microsoft Xbox 360 package (console-signed) 708>0 use xbox-360-package 7090 string PIRS 710>0 belong 0 Microsoft Xbox 360 package (non-Xbox Live) 711>>0 use xbox-360-package 7120 string LIVE 713>0x104 belong 0 Microsoft Xbox 360 package (Xbox Live) 714>>0 use xbox-360-package 715 716# Atari Lynx cartridge dump (EXE/BLL header) 717# From: "Stefan A. Haubenthal" <polluks@sdf.lonestar.org> 718# Reference: 719# https://raw.githubusercontent.com/cc65/cc65/master/libsrc/lynx/exehdr.s 720# Double-check that the image type matches too, 0x8008 conflicts with 721# 8 character OMF-86 object file headers. 7220 beshort 0x8008 723>6 string BS93 Lynx homebrew cartridge 724!:mime application/x-atari-lynx-rom 725>>2 beshort x \b, RAM start $%04x 726# Update: Joerg Jenderek 727# Reference: http://mark0.net/download/triddefs_xml.7z/defs/l/lnx.trid.xml 728# Note: called "Atari Lynx ROM" by TrID 7290 string LYNX Lynx cartridge 730!:mime application/x-atari-lynx-rom 731!:ext lnx 732# bank 0 page size like: 128 256 512 733>4 leshort/4 >0 \b, bank 0 %dk 734>6 leshort/4 >0 \b, bank 1 %dk 735# 32 bytes cart name like: "jconnort.lyx" "viking~1.lyx" "Eye of the Beholder" "C:\EMU\LYNX\ROMS\ULTCHESS.LYX" 736>10 string >\0 \b, "%.32s" 737# 16 bytes manufacturer like: "Atari" "NuFX Inc." "Matthias Domin" 738>42 string >\0 \b, "%.16s" 739# version number 740#>8 leshort !1 \b, version number %u 741# rotation: 1~left Lexis (NA).lnx 2~right Centipede (Prototype).lnx 742>58 ubyte >0 \b, rotation %u 743# spare 744#>59 lelong !0 \b, spare %#x 745 746# Opera file system that is used on the 3DO console 747# From: Serge van den Boom <svdb@stack.nl> 7480 string \x01ZZZZZ\x01 3DO "Opera" file system 749 750# From: Alex Myczko <alex@aiei.ch> 751# From: David Pflug <david@pflug.email> 752# Update: Joerg Jenderek 753# URL: http://fileformats.archiveteam.org/wiki/Game_Boy_Sound 754# http://en.wikipedia.org/wiki/Game_Boy_Sound_System 755# Reference: http://mark0.net/download/triddefs_xml.7z/defs/g/gbs.trid.xml 756# Note: called "GameBoy Sound System dump" by TrID, 757# "Gameboy GBS rom image" by X11 Gameboy sound player xgbsplay and 758# verified by gbsplay `LANG=C gbsinfo /usr/share/doc/gbsplay/examples/nightmode.gbs` 759# is the offset 12 or the offset 16 correct? 760# GBS (Game Boy Sound) magic 761# http://ftp.modland.com/pub/documents/format_documentation/\ 762# Gameboy%20Sound%20System%20(.gbs).txt 763# skip Grand Theft Auto 2 Style data (*.sty via sty-gta2.trid.xml) and Opera (*.patch) by check for valid "low" version 7640 string GBS\001 Nintendo Gameboy Music/Audio Data 765!:mime audio/x-nintendo-gbs 766# by gbsplay or xgbsplay tools 767#!:mime audio/gbs 768#!:mime audio/prs.gbs 769!:ext gbs 770# fields are right null-filled; no terminating \0 if all bytes are used; if field unknown, should be set to a single ? 771# title string like: "Blues Brothers" "Bugs Bunny Crazy Castle 3" 772#12 string GameBoy\040Music\040Module Nintendo Gameboy Music Module 773>16 string >\0 ("%.32s" by 774# author string like: <?>, by Laxity, Justin Muir, 1993 Ocean 775>48 string >\0 %.32s, copyright 776# copyright string like: empty "1991 Titus" "2001 Imagineer/KT.Kodansha/P&B" "2000 Newline, Ubisoft, D. Eclip." 777>80 string >\0 %.32s 778# GBSVersion; 1 779#>3 byte !1 version %u, 780# number of songs (1-255) 781>4 ubyte x \b), %u track 782# plural s 783>4 ubyte >1 \bs 784# default subsong; like: 1 (often) 2 29 60 79 82 785>5 ubyte !1 \b, %u first 786# load address (400h-7fffh) 787>6 uleshort x \b, load address %#4.4x 788# init address (400h-7fffh) 789>8 uleshort x \b, init address %#4.4x 790# play address (400-7fffh) 791>10 uleshort x \b, play address %#4.4x 792# stack pointer; like: FFFEh (default) CFFFh DCFEh DDFEh DDFFh DEFFh E000h FFF4h 793>12 uleshort x \b, stack pointer %#4.4x 794# timer modulo; often 0 795>14 ubyte !0 \b, timer modulo %#x 796# timer control; often 0 797>15 ubyte !0 \b, timer control %#x 798# code and Data (see RST VECTORS) 799#>0x70 ubequad x \b, data %#16.16llx... 800 801# IPS Patch Files from: From: Thomas Klausner <tk@giga.or.at> 802# see https://zerosoft.zophar.net/ips.php 8030 string PATCH IPS patch file 804!:ext ips 805 806# BPS Patch Files - from: David Korth <gerbilsoft@gerbilsoft.com> 807# Reference: https://www.romhacking.net/documents/746/ 8080 string BPS1 BPS patch file 809!:ext bps 810 811# APS Patch Files - from: David Korth <gerbilsoft@gerbilsoft.com> 812# Reference: https://github.com/btimofeev/UniPatcher/wiki/APS-(N64) 8130 string APS10 APS patch file 814!:ext aps 815>5 byte 0 \b, simple patch 816>5 byte 1 \b, N64-specific patch for 817>>58 byte x N%c 818>>59 byte x \b%c 819>>60 byte x \b%c 820>7 byte !0x20 821# FIXME: /T specifier isn't working with a fixed-length string. 822>>7 string x \b: "%.50s" 823 824# UPS Patch Files - from: David Korth <gerbilsoft@gerbilsoft.com> 825# Reference: http://fileformats.archiveteam.org/wiki/UPS_(binary_patch_format) 8260 string UPS1 UPS patch file 827!:ext ups 828 829# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at> 8300 string PPF30 Playstation Patch File version 3.0 831>5 byte 0 \b, PPF 1.0 patch 832>5 byte 1 \b, PPF 2.0 patch 833>5 byte 2 \b, PPF 3.0 patch 834>>56 byte 0 \b, Imagetype BIN (any) 835>>56 byte 1 \b, Imagetype GI (PrimoDVD) 836>>57 byte 0 \b, Blockcheck disabled 837>>57 byte 1 \b, Blockcheck enabled 838>>58 byte 0 \b, Undo data not available 839>>58 byte 1 \b, Undo data available 840>6 string x \b, description: %s 841 8420 string PPF20 Playstation Patch File version 2.0 843>5 byte 0 \b, PPF 1.0 patch 844>5 byte 1 \b, PPF 2.0 patch 845>>56 lelong >0 \b, size of file to patch %d 846>6 string x \b, description: %s 847 8480 string PPF10 Playstation Patch File version 1.0 849>5 byte 0 \b, Simple Encoding 850>6 string x \b, description: %s 851 852# Compressed ISO disc image (used mostly by PSP, PS2 and MegaDrive) 853# From: Alexandre Iooss <erdnaxe@crans.org> 854# URL: https://en.wikipedia.org/wiki/.CSO 855# NOTE: This is NOT the same as Compact ISO or GameCube/Wii disc image, 856# though it has the same magic number. 8570 string CISO 858# Match CISO version 1 with ISO-9660 sector size 859>20 ubyte <2 860>>16 ulelong =2048 CSO v1 disk image 861!:mime application/x-compressed-iso 862!:ext ciso/cso 863>>>8 ulequad x \b, original size %llu bytes 864>>>16 ulelong x \b, datablock size %u bytes 865# Match CISO version 2 866>20 ubyte =2 867>>22 uleshort =0 868>>>4 ulelong =24 CSO v2 disk image 869!:mime application/x-compressed-iso 870!:ext ciso/cso 871>>>>8 ulequad x \b, original size %llu bytes 872>>>>16 ulelong x \b, datablock size %u bytes 873# Type: Nintendo GameCube/Wii disc image (CISO format) 874# NOTE: This is NOT the same as Compact ISO or PSP CISO, 875# though it has the same magic number. 876# Other fields are used to determine what type of CISO this is: 877# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size) 878# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size) 879# - None of the above: Compact ISO. 880>4 lelong 0x200000 881>>8 byte 1 882>>>0x801C belong 0xC2339F3D Nintendo GameCube disc image (CISO format): 883!:mime application/x-wii-rom 884>>>>0x8000 use nintendo-gcn-disc-common 885>>>0x8018 belong 0x5D1C9EA3 Nintendo Wii disc image (CISO format): 886!:mime application/x-wii-rom 887>>>>0x8000 use nintendo-gcn-disc-common 888# .cso files 889# Reference: https://pismotec.com/ciso/ciso.h 890# NOTE: There are two other formats with the same magic but 891# completely incompatible specifications: 892# - GameCube/Wii CISO: https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/DiscIO/CISOBlob.h 893# - PSP CISO: https://github.com/jamie/ciso/blob/master/ciso.h 894# Other fields are used to determine what type of CISO this is: 895# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size) 896# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size) 897# - 0x10 == 0x00004000: For >2GB files using maxcso... 898# https://github.com/unknownbrackets/maxcso/issues/26 899# - None of the above: Compact ISO. 900>4 lelong !0 901>>4 lelong !0x200000 902>>>16 lelong !0x800 903>>>>16 lelong !0x4000 Compressed ISO CD image 904 905# From: Daniel Dawson <ddawson@icehouse.net> 906# SNES9x .smv "movie" file format. 9070 string SMV\x1A SNES9x input recording 908>0x4 lelong x \b, version %d 909# version 4 is latest so far 910>0x4 lelong <5 911>>0x8 ledate x \b, recorded at %s 912>>0xc lelong >0 \b, rerecorded %d times 913>>0x10 lelong x \b, %d frames long 914>>0x14 byte >0 \b, data for controller(s): 915>>>0x14 byte &0x1 #1 916>>>0x14 byte &0x2 #2 917>>>0x14 byte &0x4 #3 918>>>0x14 byte &0x8 #4 919>>>0x14 byte &0x10 #5 920>>0x15 byte ^0x1 \b, begins from snapshot 921>>0x15 byte &0x1 \b, begins from reset 922>>0x15 byte ^0x2 \b, NTSC standard 923>>0x15 byte &0x2 \b, PAL standard 924>>0x17 byte &0x1 \b, settings: 925# WIP1Timing not used as of version 4 926>>>0x4 lelong <4 927>>>>0x17 byte &0x2 WIP1Timing 928>>>0x17 byte &0x4 Left+Right 929>>>0x17 byte &0x8 VolumeEnvX 930>>>0x17 byte &0x10 FakeMute 931>>>0x17 byte &0x20 SyncSound 932# New flag as of version 4 933>>>0x4 lelong >3 934>>>>0x17 byte &0x80 NoCPUShutdown 935>>0x4 lelong <4 936>>>0x18 lelong >0x23 937>>>>0x20 leshort !0 938>>>>>0x20 lestring16 x \b, metadata: "%s" 939>>0x4 lelong >3 940>>>0x24 byte >0 \b, port 1: 941>>>>0x24 byte 1 joypad 942>>>>0x24 byte 2 mouse 943>>>>0x24 byte 3 SuperScope 944>>>>0x24 byte 4 Justifier 945>>>>0x24 byte 5 multitap 946>>>0x24 byte >0 \b, port 2: 947>>>>0x25 byte 1 joypad 948>>>>0x25 byte 2 mouse 949>>>>0x25 byte 3 SuperScope 950>>>>0x25 byte 4 Justifier 951>>>>0x25 byte 5 multitap 952>>>0x18 lelong >0x43 953>>>>0x40 leshort !0 954>>>>>0x40 lestring16 x \b, metadata: "%s" 955>>0x17 byte &0x40 \b, ROM: 956>>>(0x18.l-26) lelong x CRC32 %#08x 957>>>(0x18.l-23) string x "%s" 958 959# Type: scummVM savegame files 960# From: Sven Hartge <debian@ds9.argh.org> 9610 string SCVM ScummVM savegame 962>12 string >\0 "%s" 963 964#------------------------------------------------------------------------------ 965# Nintendo GameCube / Wii file formats. 966# 967 968# Type: Nintendo GameCube/Wii common disc header data. 969# From: David Korth <gerbilsoft@gerbilsoft.com> 970# Reference: https://wiibrew.org/wiki/Wii_Disc 9710 name nintendo-gcn-disc-common 972>0x20 string x "%.64s" 973>0x00 string x (%.6s 974>0x06 byte >0 975>>0x06 byte 1 \b, Disc 2 976>>0x06 byte 2 \b, Disc 3 977>>0x06 byte 3 \b, Disc 4 978>0x07 byte x \b, Rev.%02u) 979>0x18 belong 0x5D1C9EA3 980>>0x60 beshort 0x0101 \b (Unencrypted) 981>0x200 string NKIT \b (NKit compressed) 982 983 984# Type: Nintendo GameCube disc image 985# From: David Korth <gerbilsoft@gerbilsoft.com> 986# Reference: https://wiibrew.org/wiki/Wii_Disc 9870x1C belong 0xC2339F3D Nintendo GameCube disc image: 988!:mime application/x-gamecube-rom 989>0 use nintendo-gcn-disc-common 990 991# Type: Nintendo GameCube embedded disc image 992# Commonly found on demo discs. 993# From: David Korth <gerbilsoft@gerbilsoft.com> 994# Reference: http://hitmen.c02.at/files/yagcd/yagcd/index.html#idx14.8 9950 belong 0xAE0F38A2 996>0x0C belong 0x00100000 997>>(8.L+0x1C) belong 0xC2339F3D Nintendo GameCube embedded disc image: 998!:mime application/x-gamecube-rom 999>>>(8.L) use nintendo-gcn-disc-common 1000 1001# Type: Nintendo Wii disc image 1002# From: David Korth <gerbilsoft@gerbilsoft.com> 1003# Reference: https://wiibrew.org/wiki/Wii_Disc 10040x18 belong 0x5D1C9EA3 Nintendo Wii disc image: 1005>0 use nintendo-gcn-disc-common 1006 1007# Type: Nintendo Wii disc image (WBFS format) 1008# From: David Korth <gerbilsoft@gerbilsoft.com> 1009# Reference: https://wiibrew.org/wiki/Wii_Disc 10100 string WBFS 1011>0x218 belong 0x5D1C9EA3 Nintendo Wii disc image (WBFS format): 1012!:mime application/x-wii-rom 1013>>0x200 use nintendo-gcn-disc-common 1014 1015 1016# Type: Nintendo GameCube/Wii disc image (GCZ format) 1017# Due to zlib compression, we can't get the actual disc information. 10180 lelong 0xB10BC001 1019>4 lelong 0 Nintendo GameCube disc image (GCZ format) 1020!:mime application/x-gamecube-rom 1021>4 lelong 1 Nintendo Wii disc image (GCZ format) 1022!:mime application/x-wii-rom 1023>4 default x Nintendo GameCube/Wii disc image (GCZ format) 1024 1025# Type: Nintendo GameCube/Wii disc image (WDF format) 10260 string WII\001DISC 1027>8 belong 1 1028# WDFv1 1029>>0x54 belong 0xC2339F3D Nintendo GameCube disc image (WDFv1 format): 1030!:mime application/x-gamecube-rom 1031>>>0x38 use nintendo-gcn-disc-common 1032>>0x58 belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv1 format): 1033!:mime application/x-wii-rom 1034>>>0x38 use nintendo-gcn-disc-common 1035>8 belong 2 1036# WDFv2 1037>>(12.L+0x1C) belong 0xC2339F3D Nintendo GameCube disc image (WDFv2 format): 1038!:mime application/x-gamecube-rom 1039>>>(12.L) use nintendo-gcn-disc-common 1040>>(12.L+0x18) belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv2 format): 1041!:mime application/x-wii-rom 1042>>>(12.L) use nintendo-gcn-disc-common 1043 1044# Type: Nintendo GameCube/Wii disc image (WIA format) 10450 string WIA\001 Nintendo 1046>0x48 belong 1 GameCube 1047!:mime application/x-gamecube-rom 1048>0x48 belong 2 Wii 1049!:mime application/x-wii-rom 1050>0x48 default x GameCube/Wii 1051>0x48 belong x disc image (WIA format): 1052>>0x58 use nintendo-gcn-disc-common 1053 1054# Type: Nintendo GameCube/Wii disc image (with SDK header) 1055# From: David Korth <gerbilsoft@gerbilsoft.com> 1056# Reference: https://wiibrew.org/wiki/Wii_Disc 10570 belong 0xFFFF0000 1058>0x18 belong 0x00000000 1059>>0x1C belong 0x00000000 1060>>>0x8018 belong 0x5D1C9EA3 Nintendo Wii SDK disc image: 1061!:mime application/x-wii-rom 1062>>>>0x8000 use nintendo-gcn-disc-common 1063>>>0x801C belong 0xC2339F3D Nintendo GameCube SDK disc image: 1064!:mime application/x-gamecube-rom 1065>>>>0x8000 use nintendo-gcn-disc-common 1066 1067# Type: Nintendo GameCube/Wii disc image (RVZ format) 10680 string RVZ\001 Nintendo 1069>0x48 belong 1 GameCube 1070!:mime application/x-gamecube-rom 1071>0x48 belong 2 Wii 1072!:mime application/x-wii-rom 1073>0x48 default x GameCube/Wii 1074>0x48 belong x disc image (RVZ format): 1075>>0x58 use nintendo-gcn-disc-common 1076 1077#------------------------------------------------------------------------------ 1078# Nintendo 3DS file formats. 1079# 1080 1081# Type: Nintendo 3DS "NCSD" image. (game cards and eMMC) 1082# From: David Korth <gerbilsoft@gerbilsoft.com> 1083# Reference: https://www.3dbrew.org/wiki/NCSD 10840x100 string NCSD 1085>0x118 lequad 0 Nintendo 3DS Game Card image 1086# NCCH header for partition 0. (game data) 1087>>0x1150 string >\0 \b: "%.16s" 1088>>0x312 byte x (Rev.%02u) 1089>>0x118C byte 2 (New3DS only) 1090>>0x18D byte 0 (inner device) 1091>>0x18D byte 1 (Card1) 1092>>0x18D byte 2 (Card2) 1093>>0x18D byte 3 (extended device) 1094>0x118 bequad 0x0102020202000000 Nintendo 3DS eMMC dump (Old3DS) 1095>0x118 bequad 0x0102020203000000 Nintendo 3DS eMMC dump (New3DS) 1096 1097# Nintendo 3DS version code. 1098# Reference: https://www.3dbrew.org/wiki/Titles 1099# Format: leshort containing three fields: 1100# - 6-bit: Major 1101# - 6-bit: Minor 1102# - 4-bit: Revision 1103# NOTE: Only supporting major/minor versions from 0-15 right now. 1104# NOTE: Should be prefixed with "v". 11050 name nintendo-3ds-version-code 1106# Raw version. 1107>0 leshort x \b%u, 1108# Major version. 1109>0 leshort&0xFC00 0x0000 0 1110>0 leshort&0xFC00 0x0400 1 1111>0 leshort&0xFC00 0x0800 2 1112>0 leshort&0xFC00 0x0C00 3 1113>0 leshort&0xFC00 0x1000 4 1114>0 leshort&0xFC00 0x1400 5 1115>0 leshort&0xFC00 0x1800 6 1116>0 leshort&0xFC00 0x1C00 7 1117>0 leshort&0xFC00 0x2000 8 1118>0 leshort&0xFC00 0x2400 9 1119>0 leshort&0xFC00 0x2800 10 1120>0 leshort&0xFC00 0x2C00 11 1121>0 leshort&0xFC00 0x3000 12 1122>0 leshort&0xFC00 0x3400 13 1123>0 leshort&0xFC00 0x3800 14 1124>0 leshort&0xFC00 0x3C00 15 1125# Minor version. 1126>0 leshort&0x03F0 0x0000 \b.0 1127>0 leshort&0x03F0 0x0010 \b.1 1128>0 leshort&0x03F0 0x0020 \b.2 1129>0 leshort&0x03F0 0x0030 \b.3 1130>0 leshort&0x03F0 0x0040 \b.4 1131>0 leshort&0x03F0 0x0050 \b.5 1132>0 leshort&0x03F0 0x0060 \b.6 1133>0 leshort&0x03F0 0x0070 \b.7 1134>0 leshort&0x03F0 0x0080 \b.8 1135>0 leshort&0x03F0 0x0090 \b.9 1136>0 leshort&0x03F0 0x00A0 \b.10 1137>0 leshort&0x03F0 0x00B0 \b.11 1138>0 leshort&0x03F0 0x00C0 \b.12 1139>0 leshort&0x03F0 0x00D0 \b.13 1140>0 leshort&0x03F0 0x00E0 \b.14 1141>0 leshort&0x03F0 0x00F0 \b.15 1142# Revision. 1143>0 leshort&0x000F x \b.%u 1144 1145# Type: Nintendo 3DS "NCCH" container. 1146# https://www.3dbrew.org/wiki/NCCH 11470x100 string NCCH Nintendo 3DS 1148>0x18D byte&2 0 File Archive (CFA) 1149>0x18D byte&2 2 Executable Image (CXI) 1150>0x150 string >\0 \b: "%.16s" 1151>0x18D byte 0x05 1152>>0x10E leshort x (Old3DS System Update v 1153>>0x10E use nintendo-3ds-version-code 1154>>0x10E leshort x \b) 1155>0x18D byte 0x15 1156>>0x10E leshort x (New3DS System Update v 1157>>0x10E use nintendo-3ds-version-code 1158>>0x10E leshort x \b) 1159>0x18D byte !0x05 1160>>0x18D byte !0x15 1161>>>0x112 byte x (v 1162>>>0x112 use nintendo-3ds-version-code 1163>>>0x112 byte x \b) 1164>0x18C byte 2 (New3DS only) 1165 1166# Type: Nintendo 3DS "SMDH" file. (application description) 1167# From: David Korth <gerbilsoft@gerbilsoft.com> 1168# Reference: https://3dbrew.org/wiki/SMDH 11690 string SMDH Nintendo 3DS SMDH file 1170>0x208 leshort !0 1171>>0x208 lestring16 x \b: "%.128s" 1172>>0x388 leshort !0 1173>>>0x388 lestring16 x by %.128s 1174>0x208 leshort 0 1175>>0x008 leshort !0 1176>>>0x008 lestring16 x \b: "%.128s" 1177>>>0x188 leshort !0 1178>>>>0x188 lestring16 x by %.128s 1179 1180# Type: Nintendo 3DS Homebrew Application. 1181# From: David Korth <gerbilsoft@gerbilsoft.com> 1182# Reference: https://3dbrew.org/wiki/3DSX_Format 11830 string 3DSX Nintendo 3DS Homebrew Application (3DSX) 1184 1185# Type: Nintendo 3DS Banner Model Data. 1186# From: David Korth <gerbilsoft@gerbilsoft.com> 1187# Reference: https://3dbrew.org/wiki/CBMD 11880 string CBMD\0\0\0\0 Nintendo 3DS Banner Model Data 1189 1190#------------------------------------------------------------------------------ 1191# a7800: file(1) magic for the Atari 7800 raw ROM format. 1192# From: David Korth <gerbilsoft@gerbilsoft.com> 1193# Reference: https://sites.google.com/site/atari7800wiki/a78-header 1194 11950 byte >0 1196>0 byte <3 1197>>1 string ATARI7800 Atari 7800 ROM image 1198!:mime application/x-atari-7800-rom 1199>>>0x11 string >\0 \b: "%.32s" 1200# Display type. 1201>>>0x39 byte 0 (NTSC) 1202>>>0x39 byte 1 (PAL) 1203>>>0x36 byte&1 1 (POKEY) 1204 1205#------------------------------------------------------------------------------ 1206# vectrex: file(1) magic for the GCE Vectrex raw ROM format. 1207# From: David Korth <gerbilsoft@gerbilsoft.com> 1208# Reference: http://www.playvectrex.com/designit/chrissalo/hello1.htm 1209# 1210# NOTE: Title is terminated with 0x80, not 0. 1211# The header is terminated with a 0, so that will 1212# terminate the title as well. 1213# 12140 string g\040GCE Vectrex ROM image 1215>0x11 string >\0 \b: "%.16s" 1216 1217#------------------------------------------------------------------------------ 1218# amiibo: file(1) magic for Nintendo amiibo NFC dumps. 1219# From: David Korth <gerbilsoft@gerbilsoft.com> 1220# Reference: https://www.3dbrew.org/wiki/Amiibo 12210x00 byte 0x04 1222>0x0A beshort 0x0FE0 1223>>0x0C belong 0xF110FFEE 1224>>>0x208 beshort 0x0100 1225>>>>0x020A byte 0x0F 1226>>>>>0x020C bequad 0x000000045F000000 1227>>>>>>0x5B byte 0x02 1228>>>>>>>0x54 belong x Nintendo amiibo NFC dump - amiibo ID: %08X- 1229>>>>>>>0x58 belong x \b%08X 1230 1231#------------------------------------------------------------------------------ 1232# Type: Nintendo Switch XCI (Game Cartridge Image) 1233# From: Benjamin Lowry <ben@ben.gmbh> 1234# Reference: https://switchbrew.org/wiki/Gamecard_Format 12350x100 string HEAD 1236>0x10D byte 0xFA Nintendo Switch cartridge image (XCI), 1GB 1237>0x10D byte 0xF8 Nintendo Switch cartridge image (XCI), 2GB 1238>0x10D byte 0xF0 Nintendo Switch cartridge image (XCI), 4GB 1239>0x10D byte 0xE0 Nintendo Switch cartridge image (XCI), 8GB 1240>0x10D byte 0xE1 Nintendo Switch cartridge image (XCI), 16GB 1241>0x10D byte 0xE2 Nintendo Switch cartridge image (XCI), 32GB 1242 1243#------------------------------------------------------------------------------ 1244# Type: Nintendo Switch Executable 1245# From: Benjamin Lowry <ben@ben.gmbh> 1246# Reference: https://switchbrew.org/wiki/NSO 12470x00 string NSO0 Nintendo Switch executable (NSO) 1248 1249#------------------------------------------------------------------------------ 1250# Type: Nintendo Switch PFS0 1251# From: Benjamin Lowry <ben@ben.gmbh> 1252# Reference: https://switchbrew.org/wiki/NCA_Format#PFS0 12530x00 string PFS0 Nintendo Switch partition filesystem (PFS0) 1254>0x04 ulelong x \b, %d files 1255 1256#------------------------------------------------------------------------------ 1257# amiibo: file(1) magic for Nintendo Badge Arcade files. 1258# From: David Korth <gerbilsoft@gerbilsoft.com> 1259# References: 1260# - https://github.com/GerbilSoft/rom-properties/issues/92 1261# - https://github.com/CaitSith2/BadgeArcadeTool 1262# - https://github.com/TheMachinumps/Advanced-badge-editor 1263 1264# PRBS: Individual badge and/or mega badge. 12650 string PRBS 1266>0x44 byte >0x20 Nintendo Badge Arcade 1267>>0xB8 ulelong <2 1268>>>0xBC ulelong <2 badge: 1269>>>0xBC ulelong >1 Mega Badge 1270>>>>0xB8 ulelong x (%ux 1271>>>>0xBC ulelong x \b%u): 1272>>0xB8 ulelong >1 Mega Badge 1273>>>0xB8 ulelong x (%ux 1274>>>0xBC ulelong x \b%u): 1275>0x44 string x "%s" 1276>0x3C ulelong x \b, badge ID: %u 1277>0x74 byte >0x20 1278>>0x74 string x \b, set: "%s" 1279>0xA8 ulelong !0xFFFFFFFF 1280>>0xA8 ulelong x \b, launch title ID: %08X 1281>>0xA4 ulelong x \b-%08X 1282 1283# CABS: Badge set. 12840 string CABS 1285>0x2C byte >0x20 Nintendo Badge Arcade badge set: 1286>>0x2C string x "%.48s" 1287>>0x24 ulelong x \b, set ID: %u 1288 1289#------------------------------------------------------------------------------ 1290# sufami: file(1) magic for Sufami Turbo ROM images. 1291# From: David Korth <gerbilsoft@gerbilsoft.com> 1292# References: 1293# - https://problemkaputt.de/fullsnes.htm#snescartsufamiturbominicartridgeadaptor 12940 string BANDAI\040SFC-ADX 1295>0x10 string !SFC-ADX\040BACKUP Sufami Turbo ROM image: 1296>>0x10 string/T x "%.14s" 1297>>0x30 byte x \b, ID %02X 1298>>0x31 byte x \b%02X 1299>>0x32 byte x \b%02X 1300>>0x33 ubyte >0 \b, series index %u 1301>>0x34 ubyte 0 [SlowROM] 1302>>0x34 ubyte 1 [FastROM] 1303>>0x35 ubyte 1 [SRAM] 1304>>0x35 ubyte 3 [Special] 1305 1306#------------------------------------------------------------------------------ 1307# Type: Super NES ROM image 1308# From: Alexandre Iooss <erdnaxe@crans.org> 1309# Reference: https://snes.nesdev.org/wiki/ROM_header 13100 name snes-rom-hdr 1311# cartridge title is encoded in JIS X 0201, 21 chars padded with spaces 1312>0 ubyte-0x20 <0xC0 1313>>1 ubyte-0x20 <0xC0 1314>>>2 ubyte-0x20 <0xC0 1315>>>>3 ubyte-0x20 <0xC0 1316>>>>>4 ubyte-0x20 <0xC0 1317>>>>>>5 ubyte-0x20 <0xC0 1318>>>>>>>6 ubyte-0x20 <0xC0 1319>>>>>>>>7 ubyte-0x20 <0xC0 1320>>>>>>>>>8 ubyte-0x20 <0xC0 1321>>>>>>>>>>9 ubyte-0x20 <0xC0 1322>>>>>>>>>>>10 ubyte-0x20 <0xC0 1323>>>>>>>>>>>>21 ubyte-0x20 <0xC0 Super NES ROM image 1324>>>>>>>>>>>>>0 string/21/T x "%s" 1325>>>>>>>>>>>>>25 byte 0 (Japan) 1326>>>>>>>>>>>>>25 byte 1 (USA) 1327>>>>>>>>>>>>>25 byte 2 (Europe) 1328>>>>>>>>>>>>>25 byte 6 (France) 1329>>>>>>>>>>>>>25 byte 7 (Netherlands) 1330>>>>>>>>>>>>>25 byte 9 (Germany) 1331>>>>>>>>>>>>>25 byte 10 (Brazil) 1332>>>>>>>>>>>>>27 byte >0 (Rev.%02u) 1333>>>>>>>>>>>>>21 byte&0xF 0x0 \b, LoROM 1334>>>>>>>>>>>>>21 byte&0xF 0x1 \b, HiROM 1335>>>>>>>>>>>>>21 byte&0x10 0x10 \b, FastROM 1336>>>>>>>>>>>>>23 byte 8 \b, ROM size: 256KB 1337>>>>>>>>>>>>>23 byte 9 \b, ROM size: 512KB 1338>>>>>>>>>>>>>23 byte 10 \b, ROM size: 1024KB 1339>>>>>>>>>>>>>23 byte 11 \b, ROM size: 2048KB 1340>>>>>>>>>>>>>23 byte 12 \b, ROM size: 4096KB 1341>>>>>>>>>>>>>24 byte 0 \b, RAM size: 1KB 1342>>>>>>>>>>>>>24 byte 1 \b, RAM size: 2KB 1343>>>>>>>>>>>>>24 byte 2 \b, RAM size: 4KB 1344>>>>>>>>>>>>>24 byte 3 \b, RAM size: 8KB 1345>>>>>>>>>>>>>24 byte 4 \b, RAM size: 16KB 1346>>>>>>>>>>>>>24 byte 5 \b, RAM size: 32KB 1347>>>>>>>>>>>>>24 byte 6 \b, RAM size: 64KB 1348 1349# header position for LoROM: $007FC0 135032725 ubyte&0xEF 0x20 1351# ROM is <=4096KB, RAM is <=64KB and country<=10 1352>32727 ubyte <13 1353>>32728 ubyte <7 1354>>>32729 ubyte <11 1355>>>>32704 use snes-rom-hdr 1356 1357# HiROM header at $00FFC0 135865493 ubyte&0xEF 0x21 1359# ROM is <=4096KB, RAM is <=64KB and country<=10 1360>65495 ubyte <13 1361>>65496 ubyte <7 1362>>>65497 ubyte <11 1363>>>>65472 use snes-rom-hdr 1364 1365#------------------------------------------------------------------------------ 1366# ancast: file(1) magic for Wii U firmware images, aka "ancast" images. 1367# From: David Korth <gerbilsoft@gerbilsoft.com> 1368# References: 1369# - https://wiiubrew.org/wiki/Ancast_image 13700 ubelong 0xEFA282D9 Wii U firmware image: 1371>0x20 ubelong 2 ARM 1372>>0x1A4 ubelong 0x21 \b, NAND boot 1373>>0x1A4 ubelong 0x22 \b, SD boot 1374>>0x1A8 ubelong 1 \b, for devkits 1375>>0x1A8 ubelong 2 \b, for retail 1376>0x20 ubelong 1 PowerPC 1377>>0xA4 ubelong 0x11 \b, Wii U mode 1378>>0xA4 ubelong 0x12 \b, Wii mode 1379