1 2#------------------------------------------------------------------------------ 3# $File: console,v 1.45 2019/04/19 00:42:27 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 Famciom 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 byte x \b, mfr %02X 82>20 byte 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# 1180x104 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) 126 127# Machine type. (SGB, CGB, SGB+CGB) 128>0x14b byte 0x33 129>>0x146 byte 0x03 130>>>0x143 byte&0x80 0x80 [SGB+CGB] 131>>>0x143 byte&0x80 !0x80 [SGB] 132>>0x146 byte !0x03 133>>>0x143 byte&0xC0 0x80 [CGB] 134>>>0x143 byte&0xC0 0xC0 [CGB ONLY] 135>0x14b byte !0x33 136 137# Mapper. 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] 164 165# ROM size. 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 177 178# RAM size. 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 184 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> 188# References: 189# - https://www.retrodev.com/segacd.html 190# - http://devster.monkeeh.com/sega/32xguide1.txt 191# 192 193# Common Sega Mega Drive header format. 194# FIXME: Name fields are 48 bytes, but have spaces for padding instead of 00s. 1950 name sega-mega-drive-header 196# ROM title. (Use domestic if present; if not, use international.) 197>0x120 byte >0x20 198>>0x120 string >\0 \b: "%.16s" 199>0x120 byte <0x21 200>>0x150 string >\0 \b: "%.16s" 201# Other information. 202>0x180 string >\0 (%.14s 203>>0x110 string >\0 \b, %.16s 204>0x180 byte 0 205>>0x110 string >\0 (%.16s 206>0 byte x \b) 207 208# TODO: Check for 32X CD? 209# Sega Mega CD disc images: 2048-byte sectors. 2100 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 2140 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. 2190x10 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 2230x10 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 227 228# Sega Mega Drive, 32X, Pico, and Mega CD Boot ROM images. 2290x100 string SEGA 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 243 244#------------------------------------------------------------------------------ 245# genesis: file(1) magic for the Super MegaDrive ROM dump format 246# 247 248# NOTE: Due to interleaving, we can't display anything 249# other than the copier header information. 2500 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 254 255# "Sega Genesis" header. 2560x280 string EAGN 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 260 261# "Sega Mega Drive" header. 2620x280 string EAMG 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 266 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: https://www.smspower.org/Development/ROMHeader 273# 274 275# General SMS header rule. 276# The SMS boot ROM checks the header at three locations. 2770 name sega-master-system-rom-header 278# Machine type. 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 291>0 byte x ROM image: 292# Product code. 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. 309>0x0E byte&0xF0 !0 310>>0x0C leshort x \b%04x 311>0x0E byte&0xF0 0 312>>0x0C leshort x %04x 313# Revision. 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) 325 326# SMS/GG header locations. 3270x7FF0 string TMR\ SEGA 328>0x7FF0 use sega-master-system-rom-header 3290x3FF0 string TMR\ SEGA 330>0x3FF0 use sega-master-system-rom-header 3310x1FF0 string TMR\ SEGA 332>0x1FF0 use sega-master-system-rom-header 333 334#------------------------------------------------------------------------------ 335# saturn: file(1) magic for the Sega Saturn disc image format. 336# From: David Korth <gerbilsoft@gerbilsoft.com> 337# 338 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? 3420 name sega-saturn-disc-header 343>0x60 string >\0 \b: "%.32s" 344>0x20 string >\0 (%.10s 345>>0x2A string >\0 \b, %.6s) 346>>0x2A byte 0 \b) 347 348# 2048-byte sector version. 3490 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. 3540x10 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) 358 359#------------------------------------------------------------------------------ 360# dreamcast: file(1) magic for the Sega Dreamcast disc image format. 361# From: David Korth <gerbilsoft@gerbilsoft.com> 362# Reference: https://mc.pp.se/dc/ip0000.bin.html 363# 364 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? 3680 name sega-dreamcast-disc-header 369>0x80 string >\0 \b: "%.32s" 370>0x40 string >\0 (%.10s 371>>0x4A string >\0 \b, %.6s) 372>>0x4A byte 0 \b) 373 374# 2048-byte sector version. 3750 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. 3800x10 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) 384 385#------------------------------------------------------------------------------ 386# dreamcast: file(1) uncertain magic for the Sega Dreamcast VMU image format 387# 3880 belong 0x21068028 Sega Dreamcast VMU game image 3890 string LCDi Dream Animator file 390 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> 395# 3960 bequad 0x803712400000000F Nintendo 64 ROM image 397!:mime application/x-n64-rom 398>0x20 string >\0 \b: "%.20s" 399>0x3B string x (%.4s 400>0x3F byte x \b, Rev.%02u) 401 402#------------------------------------------------------------------------------ 403# v64: file(1) magic for the V64 format N64 ROM dumps 404# Same as z64 format, but with 16-bit byteswapping. 405# 4060 bequad 0x3780401200000F00 Nintendo 64 ROM image (V64) 407!:mime application/x-n64-rom 408 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. 412# 4130 bequad 0x12408037000F0000 Nintendo 64 ROM image (wordswapped) 414!:mime application/x-n64-rom 415 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. 419# 4200 bequad 0x401237800F000000 Nintendo 64 ROM image (32-bit byteswapped) 421!:mime application/x-n64-rom 422 423#------------------------------------------------------------------------------ 424# gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format 425# Reference: https://problemkaputt.de/gbatek.htm#gbacartridgeheader 426# 427# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com> 428# Updated version from: David Korth <gerbilsoft@gerbilsoft.com> 429# 4304 bequad 0x24FFAE51699AA221 Game Boy Advance ROM image 431!:mime application/x-gba-rom 432>0xA0 string >\0 \b: "%.12s" 433>0xAC string x (%.6s 434>0xBC byte x \b, Rev.%02u) 435 436#------------------------------------------------------------------------------ 437# nds: file(1) magic for the Nintendo DS(i) raw ROM format 438# Reference: https://problemkaputt.de/gbatek.htm#dscartridgeheader 439# 440# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com> 441# Updated version from: David Korth <gerbilsoft@gerbilsoft.com> 442# 4430xC0 bequad 0x24FFAE51699AA221 Nintendo DS ROM image 444!:mime application/x-nintendo-ds-rom 445>0x00 string >\0 \b: "%.12s" 446>0x0C string x (%.6s 447>0x1E byte x \b, Rev.%02u) 448>0x12 byte 2 (DSi enhanced) 449>0x12 byte 3 (DSi only) 450# Secure Area check. 451>0x20 lelong <0x4000 (homebrew) 452>0x20 lelong >0x3FFF 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) 459 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 4640xC0 bequad 0xC8604FE201708FE2 Nintendo DS Slot-2 ROM image (PassMe) 465!:mime application/x-nintendo-ds-rom 466 467#------------------------------------------------------------------------------ 468# ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format. 469# From: David Korth <gerbilsoft@gerbilsoft.com> 470# References: 471# - https://neogpc.googlecode.com/svn-history/r10/trunk/src/core/neogpc.cpp 472# - https://www.devrs.com/ngp/files/ngpctech.txt 473# 4740x0A string BY\ SNK\ CORPORATION Neo Geo Pocket 475!:mime application/x-neo-geo-pocket-rom 476>0x23 byte 0x10 Color 477>0 byte x ROM image 478>0x24 string >\0 \b: "%.12s" 479>0x1F byte 0xFF (debug mode enabled) 480 481#------------------------------------------------------------------------------ 482# msx: file(1) magic for MSX game cartridge dumps 483# Too simple - MPi 484#0 beshort 0x4142 MSX game cartridge dump 485 486#------------------------------------------------------------------------------ 487# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) : 4880 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, 500#>76 string >\0 (%s) 501# Area: 502>113 string x (%s) 503 504# CPE executables 5050 string CPE CPE executable 506>3 byte x (version %d) 507 508#------------------------------------------------------------------------------ 509# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>) 5100 string XBEH Microsoft Xbox executable 511# expect base address of 0x10000 512>0x0104 ulelong =0x10000 513>>(0x0118.l-0x0FFF4) lestring16 x \b: "%.40s" 514>>(0x0118.l-0x0FFF5) byte x (%c 515>>(0x0118.l-0x0FFF6) byte x \b%c- 516>>(0x0118.l-0x0FFF8) uleshort x \b%03u) 517>>(0x0118.l-0x0FF60) ulelong&0x80000007 0x80000007 \b, all regions 518>>(0x0118.l-0x0FF60) ulelong&0x80000007 !0x80000007 519>>>(0x0118.l-0x0FF60) ulelong >0 (regions: 520>>>>(0x0118.l-0x0FF60) ulelong &0x00000001 NA 521>>>>(0x0118.l-0x0FF60) ulelong &0x00000002 Japan 522>>>>(0x0118.l-0x0FF60) ulelong &0x00000004 Rest_of_World 523>>>>(0x0118.l-0x0FF60) ulelong &0x80000000 Manufacturer 524>>>(0x0118.l-0x0FF60) ulelong >0 \b) 525# probabilistic checks whether signed or not 526>0x0004 ulelong =0x0 527>>&2 ulelong =0x0 528>>>&2 ulelong =0x0 \b, not signed 529>0x0004 ulelong >0 530>>&2 ulelong >0 531>>>&2 ulelong >0 \b, signed 532 533# -------------------------------- 534# Microsoft Xbox data file formats 5350 string XIP0 XIP, Microsoft Xbox data 5360 string XTF0 XTF, Microsoft Xbox data 537 538#------------------------------------------------------------------------------ 539# Microsoft Xbox 360 executables (.xex) 540# From: David Korth <gerbilsoft@gerbilsoft.com> 541# References: 542# - https://free60project.github.io/wiki/XEX.html 543# - https://github.com/xenia-project/xenia/blob/HEAD/src/xenia/kernel/util/xex2_info.h 544 545# Title ID (part of Execution ID section) 5460 name xbox-360-xex-execution-id 547>(0.L+0xC) byte x (%c 548>(0.L+0xD) byte x \b%c 549>(0.L+0xE) beshort x \b-%04u) 550 5510 string XEX2 Microsoft Xbox 360 executable 552>0x18 search/0x100 \x00\x04\x00\x06 553>>&0 use xbox-360-xex-execution-id 554>(0x010.L+0x178) ubelong 0xFFFFFFFF \b, all regions 555>(0x010.L+0x178) ubelong !0xFFFFFFFF 556>>(0x010.L+0x178) ubelong >0 (regions: 557>>(0x010.L+0x178) ubelong&0x000000FF 0x000000FF USA 558>>(0x010.L+0x178) ubelong&0x00000100 0x00000100 Japan 559>>(0x010.L+0x178) ubelong&0x00000200 0x00000200 China 560>>(0x010.L+0x178) ubelong&0x0000FC00 0x0000FC00 Asia 561>>(0x010.L+0x178) ubelong&0x00FF0000 0x00FF0000 PAL 562>>(0x010.L+0x178) ubelong&0x00FF0000 0x00FE0000 PAL [except AU/NZ] 563>>(0x010.L+0x178) ubelong&0x00FF0000 0x00010000 AU/NZ 564>>(0x010.L+0x178) ubelong&0xFF000000 0xFF000000 Other 565>>(0x010.L+0x178) ubelong >0 \b) 566 567 568 569# Atari Lynx cartridge dump (EXE/BLL header) 570# From: "Stefan A. Haubenthal" <polluks@web.de> 571 572# Double-check that the image type matches too, 0x8008 conflicts with 573# 8 character OMF-86 object file headers. 5740 beshort 0x8008 575>6 string BS93 Lynx homebrew cartridge 576!:mime application/x-atari-lynx-rom 577>>2 beshort x \b, RAM start $%04x 578>6 string LYNX Lynx cartridge 579!:mime application/x-atari-lynx-rom 580>>2 beshort x \b, RAM start $%04x 581 582# Opera file system that is used on the 3DO console 583# From: Serge van den Boom <svdb@stack.nl> 5840 string \x01ZZZZZ\x01 3DO "Opera" file system 585 586# From: Alex Myczko <alex@aiei.ch> 587# From: David Pflug <david@pflug.email> 588# is the offset 12 or the offset 16 correct? 589# GBS (Game Boy Sound) magic 590# ftp://ftp.modland.com/pub/documents/format_documentation/\ 591# Gameboy%20Sound%20System%20(.gbs).txt 5920 string GBS Nintendo Gameboy Music/Audio Data 593#12 string GameBoy\ Music\ Module Nintendo Gameboy Music Module 594>16 string >\0 ("%.32s" by 595>48 string >\0 %.32s, copyright 596>80 string >\0 %.32s), 597>3 byte x version %u, 598>4 byte x %u tracks 599 600# IPS Patch Files from: From: Thomas Klausner <tk@giga.or.at> 601# see https://zerosoft.zophar.net/ips.php 6020 string PATCH IPS patch file 603 604# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at> 6050 string PPF30 Playstation Patch File version 3.0 606>5 byte 0 \b, PPF 1.0 patch 607>5 byte 1 \b, PPF 2.0 patch 608>5 byte 2 \b, PPF 3.0 patch 609>>56 byte 0 \b, Imagetype BIN (any) 610>>56 byte 1 \b, Imagetype GI (PrimoDVD) 611>>57 byte 0 \b, Blockcheck disabled 612>>57 byte 1 \b, Blockcheck enabled 613>>58 byte 0 \b, Undo data not available 614>>58 byte 1 \b, Undo data available 615>6 string x \b, description: %s 616 6170 string PPF20 Playstation Patch File version 2.0 618>5 byte 0 \b, PPF 1.0 patch 619>5 byte 1 \b, PPF 2.0 patch 620>>56 lelong >0 \b, size of file to patch %d 621>6 string x \b, description: %s 622 6230 string PPF10 Playstation Patch File version 1.0 624>5 byte 0 \b, Simple Encoding 625>6 string x \b, description: %s 626 627# From: Daniel Dawson <ddawson@icehouse.net> 628# SNES9x .smv "movie" file format. 6290 string SMV\x1A SNES9x input recording 630>0x4 lelong x \b, version %d 631# version 4 is latest so far 632>0x4 lelong <5 633>>0x8 ledate x \b, recorded at %s 634>>0xc lelong >0 \b, rerecorded %d times 635>>0x10 lelong x \b, %d frames long 636>>0x14 byte >0 \b, data for controller(s): 637>>>0x14 byte &0x1 #1 638>>>0x14 byte &0x2 #2 639>>>0x14 byte &0x4 #3 640>>>0x14 byte &0x8 #4 641>>>0x14 byte &0x10 #5 642>>0x15 byte ^0x1 \b, begins from snapshot 643>>0x15 byte &0x1 \b, begins from reset 644>>0x15 byte ^0x2 \b, NTSC standard 645>>0x15 byte &0x2 \b, PAL standard 646>>0x17 byte &0x1 \b, settings: 647# WIP1Timing not used as of version 4 648>>>0x4 lelong <4 649>>>>0x17 byte &0x2 WIP1Timing 650>>>0x17 byte &0x4 Left+Right 651>>>0x17 byte &0x8 VolumeEnvX 652>>>0x17 byte &0x10 FakeMute 653>>>0x17 byte &0x20 SyncSound 654# New flag as of version 4 655>>>0x4 lelong >3 656>>>>0x17 byte &0x80 NoCPUShutdown 657>>0x4 lelong <4 658>>>0x18 lelong >0x23 659>>>>0x20 leshort !0 660>>>>>0x20 lestring16 x \b, metadata: "%s" 661>>0x4 lelong >3 662>>>0x24 byte >0 \b, port 1: 663>>>>0x24 byte 1 joypad 664>>>>0x24 byte 2 mouse 665>>>>0x24 byte 3 SuperScope 666>>>>0x24 byte 4 Justifier 667>>>>0x24 byte 5 multitap 668>>>0x24 byte >0 \b, port 2: 669>>>>0x25 byte 1 joypad 670>>>>0x25 byte 2 mouse 671>>>>0x25 byte 3 SuperScope 672>>>>0x25 byte 4 Justifier 673>>>>0x25 byte 5 multitap 674>>>0x18 lelong >0x43 675>>>>0x40 leshort !0 676>>>>>0x40 lestring16 x \b, metadata: "%s" 677>>0x17 byte &0x40 \b, ROM: 678>>>(0x18.l-26) lelong x CRC32 0x%08x 679>>>(0x18.l-23) string x "%s" 680 681# Type: scummVM savegame files 682# From: Sven Hartge <debian@ds9.argh.org> 6830 string SCVM ScummVM savegame 684>12 string >\0 "%s" 685 686#------------------------------------------------------------------------------ 687# Nintendo GameCube / Wii file formats. 688# 689 690# Type: Nintendo GameCube/Wii common disc header data. 691# From: David Korth <gerbilsoft@gerbilsoft.com> 692# Reference: https://wiibrew.org/wiki/Wii_Disc 6930 name nintendo-gcn-disc-common 694>0x20 string x "%.64s" 695>0x00 string x (%.6s 696>0x06 byte >0 697>>0x06 byte 1 \b, Disc 2 698>>0x06 byte 2 \b, Disc 3 699>>0x06 byte 3 \b, Disc 4 700>0x07 byte x \b, Rev.%02u) 701>0x18 belong 0x5D1C9EA3 702>>0x60 beshort 0x0101 \b (Unencrypted) 703 704# Type: Nintendo GameCube disc image 705# From: David Korth <gerbilsoft@gerbilsoft.com> 706# Reference: https://wiibrew.org/wiki/Wii_Disc 7070x1C belong 0xC2339F3D Nintendo GameCube disc image: 708!:mime application/x-gamecube-rom 709>0 use nintendo-gcn-disc-common 710 711# Type: Nintendo GameCube embedded disc image 712# Commonly found on demo discs. 713# From: David Korth <gerbilsoft@gerbilsoft.com> 714# Reference: http://hitmen.c02.at/files/yagcd/yagcd/index.html#idx14.8 7150 belong 0xAE0F38A2 716>0x0C belong 0x00100000 717>>(8.L+0x1C) belong 0xC2339F3D Nintendo GameCube embedded disc image: 718!:mime application/x-gamecube-rom 719>>>(8.L) use nintendo-gcn-disc-common 720 721# Type: Nintendo Wii disc image 722# From: David Korth <gerbilsoft@gerbilsoft.com> 723# Reference: https://wiibrew.org/wiki/Wii_Disc 7240x18 belong 0x5D1C9EA3 Nintendo Wii disc image: 725>0 use nintendo-gcn-disc-common 726 727# Type: Nintendo Wii disc image (WBFS format) 728# From: David Korth <gerbilsoft@gerbilsoft.com> 729# Reference: https://wiibrew.org/wiki/Wii_Disc 7300 string WBFS 731>0x218 belong 0x5D1C9EA3 Nintendo Wii disc image (WBFS format): 732!:mime application/x-wii-rom 733>>0x200 use nintendo-gcn-disc-common 734 735# Type: Nintendo GameCube/Wii disc image (CISO format) 736# NOTE: This is NOT the same as Compact ISO or PSP CISO, 737# though it has the same magic number. 7380 string CISO 739# Other fields are used to determine what type of CISO this is: 740# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size) 741# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size) 742# - None of the above: Compact ISO. 743>4 lelong 0x200000 744>>8 byte 1 745>>>0x801C belong 0xC2339F3D Nintendo GameCube disc image (CISO format): 746!:mime application/x-wii-rom 747>>>>0x8000 use nintendo-gcn-disc-common 748>>>0x8018 belong 0x5D1C9EA3 Nintendo Wii disc image (CISO format): 749!:mime application/x-wii-rom 750>>>>0x8000 use nintendo-gcn-disc-common 751 752# Type: Nintendo GameCube/Wii disc image (GCZ format) 753# Due to zlib compression, we can't get the actual disc information. 7540 lelong 0xB10BC001 755>4 lelong 0 Nintendo GameCube disc image (GCZ format) 756!:mime application/x-gamecube-rom 757>4 lelong 1 Nintendo Wii disc image (GCZ format) 758!:mime application/x-wii-rom 759>4 default x Nintendo GameCube/Wii disc image (GCZ format) 760 761# Type: Nintendo GameCube/Wii disc image (WDF format) 7620 string WII\001DISC 763>8 belong 1 764# WDFv1 765>>0x54 belong 0xC2339F3D Nintendo GameCube disc image (WDFv1 format): 766!:mime application/x-gamecube-rom 767>>>0x38 use nintendo-gcn-disc-common 768>>0x58 belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv1 format): 769!:mime application/x-wii-rom 770>>>0x38 use nintendo-gcn-disc-common 771>8 belong 2 772# WDFv2 773>>(12.L+0x1C) belong 0xC2339F3D Nintendo GameCube disc image (WDFv2 format): 774!:mime application/x-gamecube-rom 775>>>(12.L) use nintendo-gcn-disc-common 776>>(12.L+0x18) belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv2 format): 777!:mime application/x-wii-rom 778>>>(12.L) use nintendo-gcn-disc-common 779 780# Type: Nintendo GameCube/Wii disc image (WIA format) 7810 string WIA\001 Nintendo 782>0x48 belong 1 GameCube 783!:mime application/x-gamecube-rom 784>0x48 belong 2 Wii 785!:mime application/x-wii-rom 786>0x48 default x GameCube/Wii 787>0x48 belong x disc image (WIA format): 788>>0x58 use nintendo-gcn-disc-common 789 790# Type: Nintendo GameCube/Wii disc image (with SDK header) 791# From: David Korth <gerbilsoft@gerbilsoft.com> 792# Reference: https://wiibrew.org/wiki/Wii_Disc 7930 belong 0xFFFF0000 794>0x18 belong 0x00000000 795>>0x1C belong 0x00000000 796>>>0x8018 belong 0x5D1C9EA3 Nintendo Wii SDK disc image: 797!:mime application/x-wii-rom 798>>>>0x8000 use nintendo-gcn-disc-common 799>>>0x801C belong 0xC2339F3D Nintendo GameCube SDK disc image: 800!:mime application/x-gamecube-rom 801>>>>0x8000 use nintendo-gcn-disc-common 802 803#------------------------------------------------------------------------------ 804# Nintendo 3DS file formats. 805# 806 807# Type: Nintendo 3DS "NCSD" image. (game cards and eMMC) 808# From: David Korth <gerbilsoft@gerbilsoft.com> 809# Reference: https://www.3dbrew.org/wiki/NCSD 8100x100 string NCSD 811>0x118 lequad 0 Nintendo 3DS Game Card image 812# NCCH header for partition 0. (game data) 813>>0x1150 string >\0 \b: "%.16s" 814>>0x312 byte x (Rev.%02u) 815>>0x118C byte 2 (New3DS only) 816>>0x18D byte 0 (inner device) 817>>0x18D byte 1 (Card1) 818>>0x18D byte 2 (Card2) 819>>0x18D byte 3 (extended device) 820>0x118 bequad 0x0102020202000000 Nintendo 3DS eMMC dump (Old3DS) 821>0x118 bequad 0x0102020203000000 Nintendo 3DS eMMC dump (New3DS) 822 823# Nintendo 3DS version code. 824# Reference: https://www.3dbrew.org/wiki/Titles 825# Format: leshort containing three fields: 826# - 6-bit: Major 827# - 6-bit: Minor 828# - 4-bit: Revision 829# NOTE: Only supporting major/minor versions from 0-15 right now. 830# NOTE: Should be prefixed with "v". 8310 name nintendo-3ds-version-code 832# Raw version. 833>0 leshort x \b%u, 834# Major version. 835>0 leshort&0xFC00 0x0000 0 836>0 leshort&0xFC00 0x0400 1 837>0 leshort&0xFC00 0x0800 2 838>0 leshort&0xFC00 0x0C00 3 839>0 leshort&0xFC00 0x1000 4 840>0 leshort&0xFC00 0x1400 5 841>0 leshort&0xFC00 0x1800 6 842>0 leshort&0xFC00 0x1C00 7 843>0 leshort&0xFC00 0x2000 8 844>0 leshort&0xFC00 0x2400 9 845>0 leshort&0xFC00 0x2800 10 846>0 leshort&0xFC00 0x2C00 11 847>0 leshort&0xFC00 0x3000 12 848>0 leshort&0xFC00 0x3400 13 849>0 leshort&0xFC00 0x3800 14 850>0 leshort&0xFC00 0x3C00 15 851# Minor version. 852>0 leshort&0x03F0 0x0000 \b.0 853>0 leshort&0x03F0 0x0010 \b.1 854>0 leshort&0x03F0 0x0020 \b.2 855>0 leshort&0x03F0 0x0030 \b.3 856>0 leshort&0x03F0 0x0040 \b.4 857>0 leshort&0x03F0 0x0050 \b.5 858>0 leshort&0x03F0 0x0060 \b.6 859>0 leshort&0x03F0 0x0070 \b.7 860>0 leshort&0x03F0 0x0080 \b.8 861>0 leshort&0x03F0 0x0090 \b.9 862>0 leshort&0x03F0 0x00A0 \b.10 863>0 leshort&0x03F0 0x00B0 \b.11 864>0 leshort&0x03F0 0x00C0 \b.12 865>0 leshort&0x03F0 0x00D0 \b.13 866>0 leshort&0x03F0 0x00E0 \b.14 867>0 leshort&0x03F0 0x00F0 \b.15 868# Revision. 869>0 leshort&0x000F x \b.%u 870 871# Type: Nintendo 3DS "NCCH" container. 872# https://www.3dbrew.org/wiki/NCCH 8730x100 string NCCH Nintendo 3DS 874>0x18D byte&2 0 File Archive (CFA) 875>0x18D byte&2 2 Executable Image (CXI) 876>0x150 string >\0 \b: "%.16s" 877>0x18D byte 0x05 878>>0x10E leshort x (Old3DS System Update v 879>>0x10E use nintendo-3ds-version-code 880>>0x10E leshort x \b) 881>0x18D byte 0x15 882>>0x10E leshort x (New3DS System Update v 883>>0x10E use nintendo-3ds-version-code 884>>0x10E leshort x \b) 885>0x18D byte !0x05 886>>0x18D byte !0x15 887>>>0x112 byte x (v 888>>>0x112 use nintendo-3ds-version-code 889>>>0x112 byte x \b) 890>0x18C byte 2 (New3DS only) 891 892# Type: Nintendo 3DS "SMDH" file. (application description) 893# From: David Korth <gerbilsoft@gerbilsoft.com> 894# Reference: https://3dbrew.org/wiki/SMDH 8950 string SMDH Nintendo 3DS SMDH file 896>0x208 leshort !0 897>>0x208 lestring16 x \b: "%.128s" 898>>0x388 leshort !0 899>>>0x388 lestring16 x by %.128s 900>0x208 leshort 0 901>>0x008 leshort !0 902>>>0x008 lestring16 x \b: "%.128s" 903>>>0x188 leshort !0 904>>>>0x188 lestring16 x by %.128s 905 906# Type: Nintendo 3DS Homebrew Application. 907# From: David Korth <gerbilsoft@gerbilsoft.com> 908# Reference: https://3dbrew.org/wiki/3DSX_Format 9090 string 3DSX Nintendo 3DS Homebrew Application (3DSX) 910 911#------------------------------------------------------------------------------ 912# a7800: file(1) magic for the Atari 7800 raw ROM format. 913# From: David Korth <gerbilsoft@gerbilsoft.com> 914# Reference: https://sites.google.com/site/atari7800wiki/a78-header 915 9160 byte >0 917>0 byte <3 918>>1 string ATARI7800 Atari 7800 ROM image 919!:mime application/x-atari-7800-rom 920>>>0x11 string >\0 \b: "%.32s" 921# Display type. 922>>>0x39 byte 0 (NTSC) 923>>>0x39 byte 1 (PAL) 924>>>0x36 byte&1 1 (POKEY) 925 926#------------------------------------------------------------------------------ 927# vectrex: file(1) magic for the GCE Vectrex raw ROM format. 928# From: David Korth <gerbilsoft@gerbilsoft.com> 929# Reference: http://www.playvectrex.com/designit/chrissalo/hello1.htm 930# 931# NOTE: Title is terminated with 0x80, not 0. 932# The header is terminated with a 0, so that will 933# terminate the title as well. 934# 9350 string g\ GCE Vectrex ROM image 936>0x11 string >\0 \b: "%.16s" 937 938#------------------------------------------------------------------------------ 939# amiibo: file(1) magic for Nintendo amiibo NFC dumps. 940# From: David Korth <gerbilsoft@gerbilsoft.com> 941# Reference: https://www.3dbrew.org/wiki/Amiibo 9420x00 byte 0x04 943>0x0A beshort 0x0FE0 944>>0x0C belong 0xF110FFEE 945>>>0x208 beshort 0x0100 946>>>>0x020A byte 0x0F 947>>>>>0x020C bequad 0x000000045F000000 948>>>>>>0x5B byte 0x02 949>>>>>>>0x54 belong x Nintendo amiibo NFC dump - amiibo ID: %08X- 950>>>>>>>0x58 belong x \b%08X 951