1 2#------------------------------------------------------------------------------ 3# $File: console,v 1.72 2023/06/16 19:24:06 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# 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# Old licensee code 0x33 is required for SGB, but not CGB. 129>0x14b byte 0x33 130>>0x146 byte 0x03 131>>>0x143 byte&0x80 0x80 [SGB+CGB] 132>>>0x143 byte&0x80 !0x80 [SGB] 133>>0x146 byte !0x03 134>>>0x143 byte&0xC0 0x80 [CGB] 135>>>0x143 byte&0xC0 0xC0 [CGB ONLY] 136>0x14b byte !0x33 137>>0x143 byte&0xC0 0x80 [CGB] 138>>0x143 byte&0xC0 0xC0 [CGB ONLY] 139 140# Mapper. 141>0x147 byte 0x00 [ROM ONLY] 142>0x147 byte 0x01 [MBC1] 143>0x147 byte 0x02 [MBC1+RAM] 144>0x147 byte 0x03 [MBC1+RAM+BATT] 145>0x147 byte 0x05 [MBC2] 146>0x147 byte 0x06 [MBC2+BATTERY] 147>0x147 byte 0x08 [ROM+RAM] 148>0x147 byte 0x09 [ROM+RAM+BATTERY] 149>0x147 byte 0x0B [MMM01] 150>0x147 byte 0x0C [MMM01+SRAM] 151>0x147 byte 0x0D [MMM01+SRAM+BATT] 152>0x147 byte 0x0F [MBC3+TIMER+BATT] 153>0x147 byte 0x10 [MBC3+TIMER+RAM+BATT] 154>0x147 byte 0x11 [MBC3] 155>0x147 byte 0x12 [MBC3+RAM] 156>0x147 byte 0x13 [MBC3+RAM+BATT] 157>0x147 byte 0x19 [MBC5] 158>0x147 byte 0x1A [MBC5+RAM] 159>0x147 byte 0x1B [MBC5+RAM+BATT] 160>0x147 byte 0x1C [MBC5+RUMBLE] 161>0x147 byte 0x1D [MBC5+RUMBLE+SRAM] 162>0x147 byte 0x1E [MBC5+RUMBLE+SRAM+BATT] 163>0x147 byte 0xFC [Pocket Camera] 164>0x147 byte 0xFD [Bandai TAMA5] 165>0x147 byte 0xFE [Hudson HuC-3] 166>0x147 byte 0xFF [Hudson HuC-1] 167 168# ROM size. 169>0x148 byte 0 \b, ROM: 256Kbit 170>0x148 byte 1 \b, ROM: 512Kbit 171>0x148 byte 2 \b, ROM: 1Mbit 172>0x148 byte 3 \b, ROM: 2Mbit 173>0x148 byte 4 \b, ROM: 4Mbit 174>0x148 byte 5 \b, ROM: 8Mbit 175>0x148 byte 6 \b, ROM: 16Mbit 176>0x148 byte 7 \b, ROM: 32Mbit 177>0x148 byte 0x52 \b, ROM: 9Mbit 178>0x148 byte 0x53 \b, ROM: 10Mbit 179>0x148 byte 0x54 \b, ROM: 12Mbit 180 181# RAM size. 182>0x149 byte 1 \b, RAM: 16Kbit 183>0x149 byte 2 \b, RAM: 64Kbit 184>0x149 byte 3 \b, RAM: 256Kbit 185>0x149 byte 4 \b, RAM: 1Mbit 186>0x149 byte 5 \b, RAM: 512Kbit 187 188#------------------------------------------------------------------------------ 189# genesis: file(1) magic for various Sega Mega Drive / Genesis ROM image and disc formats 190# Updated by David Korth <gerbilsoft@gerbilsoft.com> 191# References: 192# - https://www.retrodev.com/segacd.html 193# - http://devster.monkeeh.com/sega/32xguide1.txt 194# 195 196# Common Sega Mega Drive header format. 197# FIXME: Name fields are 48 bytes, but have spaces for padding instead of 00s. 1980 name sega-mega-drive-header 199# ROM title. (Use domestic if present; if not, use international.) 200>0x120 byte >0x20 201>>0x120 string >\0 \b: "%.16s" 202>0x120 byte <0x21 203>>0x150 string >\0 \b: "%.16s" 204# Other information. 205>0x180 string >\0 (%.14s 206>>0x110 string >\0 \b, %.16s 207>0x180 byte 0 208>>0x110 string >\0 (%.16s 209>0 byte x \b) 210 211# TODO: Check for 32X CD? 212# Sega Mega CD disc images: 2048-byte sectors. 2130 string SEGADISCSYSTEM\ \ Sega Mega CD disc image 214!:mime application/x-sega-cd-rom 215>0 use sega-mega-drive-header 216>0 byte x \b, 2048-byte sectors 2170 string SEGABOOTDISC\ \ \ \ Sega Mega CD disc image 218!:mime application/x-sega-cd-rom 219>0 use sega-mega-drive-header 220>0 byte x \b, 2048-byte sectors 221# Sega Mega CD disc images: 2352-byte sectors. 2220x10 string SEGADISCSYSTEM\ \ Sega Mega CD disc image 223!:mime application/x-sega-cd-rom 224>0x10 use sega-mega-drive-header 225>0 byte x \b, 2352-byte sectors 2260x10 string SEGABOOTDISC\ \ \ \ Sega Mega CD disc image 227!:mime application/x-sega-cd-rom 228>0x10 use sega-mega-drive-header 229>0 byte x \b, 2352-byte sectors 230 231# Sega Mega Drive: Identify the system ID. 2320x100 string SEGA 233>0x3C0 string MARS\ CHECK\ MODE Sega 32X ROM image 234!:mime application/x-genesis-32x-rom 235>>0 use sega-mega-drive-header 236>0x104 string \ PICO Sega Pico ROM image 237!:mime application/x-sega-pico-rom 238>>0 use sega-mega-drive-header 239>0x104 string TOYS\ PICO Sega Pico ROM image 240!:mime application/x-sega-pico-rom 241>>0 use sega-mega-drive-header 242>0x104 string \ TOYS\ PICO Sega Pico ROM image 243!:mime application/x-sega-pico-rom 244>>0 use sega-mega-drive-header 245>0x104 string \ IAC Sega Pico ROM image 246!:mime application/x-sega-pico-rom 247>>0 use sega-mega-drive-header 248>0x104 string \ TERA68K Sega Teradrive (68K) ROM image 249!:mime application/x-sega-teradrive-rom 250>>0 use sega-mega-drive-header 251>0x104 string \ TERA286 Sega Teradrive (286) ROM image 252!:mime application/x-sega-teradrive-rom 253>>0 use sega-mega-drive-header 254>0x180 string BR Sega Mega CD Boot ROM image 255!:mime application/x-genesis-rom 256>>0 use sega-mega-drive-header 257>0x104 default x Sega Mega Drive / Genesis ROM image 258!:mime application/x-genesis-rom 259>>0 use sega-mega-drive-header 260 261# Sega Mega Drive: Some ROMs have "SEGA" at 0x101, not 0x100. 2620x100 string \ SEGA Sega Mega Drive / Genesis ROM image 263>0 use sega-mega-drive-header 264 265# Sega Pico ROMs that don't start with "SEGA". 2660x100 string SAMSUNG\ PICO Samsung Pico ROM image 267!:mime application/x-sega-pico-rom 268>0 use sega-mega-drive-header 2690x100 string IMA\ IKUNOUJYUKU Samsung Pico ROM image 270!:mime application/x-sega-pico-rom 271>0 use sega-mega-drive-header 2720x100 string IMA IKUNOJYUKU Samsung Pico ROM image 273!:mime application/x-sega-pico-rom 274>0 use sega-mega-drive-header 275 276# Sega Picture Magic (modified 32X) 2770x100 string Picture\ Magic 278>0x3C0 string PICTURE MAGIC-01 Sega 32X ROM image 279!:mime application/x-genesis-32x-rom 280>>0 use sega-mega-drive-header 281 282#------------------------------------------------------------------------------ 283# genesis: file(1) magic for the Super MegaDrive ROM dump format 284# 285 286# NOTE: Due to interleaving, we can't display anything 287# other than the copier header information. 2880 name sega-genesis-smd-header 289>0 byte x %dx16k blocks 290>2 byte 0 \b, last in series or standalone 291>2 byte >0 \b, split ROM 292 293# "Sega Genesis" header. 2940x280 string EAGN 295>8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format): 296!:mime application/x-genesis-rom 297>>0 use sega-genesis-smd-header 298 299# "Sega Mega Drive" header. 3000x280 string EAMG 301>8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format): 302!:mime application/x-genesis-rom 303>>0 use sega-genesis-smd-header 304 305#------------------------------------------------------------------------------ 306# smsgg: file(1) magic for Sega Master System and Game Gear ROM images 307# Detects all Game Gear and export Sega Master System ROM images, 308# and some Japanese Sega Master System ROM images. 309# From: David Korth <gerbilsoft@gerbilsoft.com> 310# Reference: https://www.smspower.org/Development/ROMHeader 311# 312 313# General SMS header rule. 314# The SMS boot ROM checks the header at three locations. 3150 name sega-master-system-rom-header 316# Machine type. 317>0x0F byte&0xF0 0x30 Sega Master System 318!:mime application/x-sms-rom 319>0x0F byte&0xF0 0x40 Sega Master System 320!:mime application/x-sms-rom 321>0x0F byte&0xF0 0x50 Sega Game Gear 322!:mime application/x-gamegear-rom 323>0x0F byte&0xF0 0x60 Sega Game Gear 324!:mime application/x-gamegear-rom 325>0x0F byte&0xF0 0x70 Sega Game Gear 326!:mime application/x-gamegear-rom 327>0x0F default x Sega Master System / Game Gear 328!:mime application/x-sms-rom 329>0 byte x ROM image: 330# Product code. 331>0x0E byte&0xF0 0x10 1 332>0x0E byte&0xF0 0x20 2 333>0x0E byte&0xF0 0x30 3 334>0x0E byte&0xF0 0x40 4 335>0x0E byte&0xF0 0x50 5 336>0x0E byte&0xF0 0x60 6 337>0x0E byte&0xF0 0x70 7 338>0x0E byte&0xF0 0x80 8 339>0x0E byte&0xF0 0x90 9 340>0x0E byte&0xF0 0xA0 10 341>0x0E byte&0xF0 0xB0 11 342>0x0E byte&0xF0 0xC0 12 343>0x0E byte&0xF0 0xD0 13 344>0x0E byte&0xF0 0xE0 14 345>0x0E byte&0xF0 0xF0 15 346# If the product code is 5 digits, we'll need to backspace here. 347>0x0E byte&0xF0 !0 348>>0x0C leshort x \b%04x 349>0x0E byte&0xF0 0 350>>0x0C leshort x %04x 351# Revision. 352>0x0E byte&0x0F x (Rev.%02d) 353# ROM size. (Used for the boot ROM checksum routine.) 354>0x0F byte&0x0F 0x0A (8 KB) 355>0x0F byte&0x0F 0x0B (16 KB) 356>0x0F byte&0x0F 0x0C (32 KB) 357>0x0F byte&0x0F 0x0D (48 KB) 358>0x0F byte&0x0F 0x0E (64 KB) 359>0x0F byte&0x0F 0x0F (128 KB) 360>0x0F byte&0x0F 0x00 (256 KB) 361>0x0F byte&0x0F 0x01 (512 KB) 362>0x0F byte&0x0F 0x02 (1 MB) 363 364# SMS/GG header locations. 3650x7FF0 string TMR\ SEGA 366>0x7FF0 use sega-master-system-rom-header 3670x3FF0 string TMR\ SEGA 368>0x3FF0 use sega-master-system-rom-header 3690x1FF0 string TMR\ SEGA 370>0x1FF0 use sega-master-system-rom-header 371 372#------------------------------------------------------------------------------ 373# saturn: file(1) magic for the Sega Saturn disc image format. 374# From: David Korth <gerbilsoft@gerbilsoft.com> 375# 376 377# Common Sega Saturn disc header format. 378# NOTE: Title is 112 bytes, but we're only showing 32 due to space padding. 379# TODO: Release date, device information, region code, others? 3800 name sega-saturn-disc-header 381>0x60 string >\0 \b: "%.32s" 382>0x20 string >\0 (%.10s 383>>0x2A string >\0 \b, %.6s) 384>>0x2A byte 0 \b) 385 386# 2048-byte sector version. 3870 string SEGA\ SEGASATURN\ Sega Saturn disc image 388!:mime application/x-saturn-rom 389>0 use sega-saturn-disc-header 390>0 byte x (2048-byte sectors) 391# 2352-byte sector version. 3920x10 string SEGA\ SEGASATURN\ Sega Saturn disc image 393!:mime application/x-saturn-rom 394>0x10 use sega-saturn-disc-header 395>0 byte x (2352-byte sectors) 396 397#------------------------------------------------------------------------------ 398# dreamcast: file(1) magic for the Sega Dreamcast disc image format. 399# From: David Korth <gerbilsoft@gerbilsoft.com> 400# Reference: https://mc.pp.se/dc/ip0000.bin.html 401# 402 403# Common Sega Dreamcast disc header format. 404# NOTE: Title is 128 bytes, but we're only showing 32 due to space padding. 405# TODO: Release date, device information, region code, others? 4060 name sega-dreamcast-disc-header 407>0x80 string >\0 \b: "%.32s" 408>0x40 string >\0 (%.10s 409>>0x4A string >\0 \b, %.6s) 410>>0x4A byte 0 \b) 411 412# 2048-byte sector version. 4130 string SEGA\ SEGAKATANA\ Sega Dreamcast disc image 414!:mime application/x-dc-rom 415>0 use sega-dreamcast-disc-header 416>0 byte x (2048-byte sectors) 417# 2352-byte sector version. 4180x10 string SEGA\ SEGAKATANA\ Sega Dreamcast disc image 419!:mime application/x-dc-rom 420>0x10 use sega-dreamcast-disc-header 421>0 byte x (2352-byte sectors) 422 423#------------------------------------------------------------------------------ 424# dreamcast: file(1) uncertain magic for the Sega Dreamcast VMU image format 425# 4260 belong 0x21068028 Sega Dreamcast VMU game image 4270 string LCDi Dream Animator file 428 429#------------------------------------------------------------------------------ 430# z64: file(1) magic for the Z64 format N64 ROM dumps 431# Reference: http://forum.pj64-emu.com/showthread.php?t=2239 432# From: David Korth <gerbilsoft@gerbilsoft.com> 433# 4340 bequad 0x803712400000000F Nintendo 64 ROM image 435!:mime application/x-n64-rom 436>0x20 string >\0 \b: "%.20s" 437>0x3B string x (%.4s 438>0x3F byte x \b, Rev.%02u) 439 440#------------------------------------------------------------------------------ 441# v64: file(1) magic for the V64 format N64 ROM dumps 442# Same as z64 format, but with 16-bit byteswapping. 443# 4440 bequad 0x3780401200000F00 Nintendo 64 ROM image (V64) 445!:mime application/x-n64-rom 446 447#------------------------------------------------------------------------------ 448# n64-swap2: file(1) magic for the swap2 format N64 ROM dumps 449# Same as z64 format, but with swapped 16-bit words. 450# 4510 bequad 0x12408037000F0000 Nintendo 64 ROM image (wordswapped) 452!:mime application/x-n64-rom 453 454#------------------------------------------------------------------------------ 455# n64-le32: file(1) magic for the 32-bit byteswapped format N64 ROM dumps 456# Same as z64 format, but with 32-bit byteswapping. 457# 4580 bequad 0x401237800F000000 Nintendo 64 ROM image (32-bit byteswapped) 459!:mime application/x-n64-rom 460 461#------------------------------------------------------------------------------ 462# gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format 463# Reference: https://problemkaputt.de/gbatek.htm#gbacartridgeheader 464# 465# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com> 466# Updated version from: David Korth <gerbilsoft@gerbilsoft.com> 467# 4684 bequad 0x24FFAE51699AA221 Game Boy Advance ROM image 469!:mime application/x-gba-rom 470>0xA0 string >\0 \b: "%.12s" 471>0xAC string x (%.6s 472>0xBC byte x \b, Rev.%02u) 473 474#------------------------------------------------------------------------------ 475# nds: file(1) magic for the Nintendo DS(i) raw ROM format 476# Reference: https://problemkaputt.de/gbatek.htm#dscartridgeheader 477# 478# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com> 479# Updated version from: David Korth <gerbilsoft@gerbilsoft.com> 480# 4810xC0 bequad 0x24FFAE51699AA221 Nintendo DS ROM image 482!:mime application/x-nintendo-ds-rom 483>0x00 string >\0 \b: "%.12s" 484>0x0C string x (%.6s 485>0x1E byte x \b, Rev.%02u) 486>0x12 byte 2 (DSi enhanced) 487>0x12 byte 3 (DSi only) 488# Secure Area check. 489>0x20 lelong <0x4000 (homebrew) 490>0x20 lelong >0x3FFF 491>>0x4000 lequad 0x0000000000000000 (multiboot) 492>>0x4000 lequad !0x0000000000000000 493>>>0x4000 lequad 0xE7FFDEFFE7FFDEFF (decrypted) 494>>>0x4000 lequad !0xE7FFDEFFE7FFDEFF 495>>>>0x1000 lequad 0x0000000000000000 (encrypted) 496>>>>0x1000 lequad !0x0000000000000000 (mask ROM) 497 498#------------------------------------------------------------------------------ 499# nds_passme: file(1) magic for Nintendo DS ROM images for GBA cartridge boot. 500# This is also used for loading .nds files using the MSET exploit on 3DS. 501# Reference: https://github.com/devkitPro/ndstool/blob/master/source/ndscreate.cpp 5020xC0 bequad 0xC8604FE201708FE2 Nintendo DS Slot-2 ROM image (PassMe) 503!:mime application/x-nintendo-ds-rom 504 505#------------------------------------------------------------------------------ 506# ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format. 507# From: David Korth <gerbilsoft@gerbilsoft.com> 508# References: 509# - https://neogpc.googlecode.com/svn-history/r10/trunk/src/core/neogpc.cpp 510# - https://www.devrs.com/ngp/files/ngpctech.txt 511# 5120x0A string BY\ SNK\ CORPORATION Neo Geo Pocket 513!:mime application/x-neo-geo-pocket-rom 514>0x23 byte 0x10 Color 515>0 byte x ROM image 516>0x24 string >\0 \b: "%.12s" 517>0x21 uleshort x \b, NEOP%04X 518>0x1F ubyte 0xFF (debug mode enabled) 519 520#------------------------------------------------------------------------------ 521# msx: file(1) magic for MSX game cartridge dumps 522# Too simple - MPi 523#0 beshort 0x4142 MSX game cartridge dump 524 525#------------------------------------------------------------------------------ 526# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) : 5270 string PS-X\ EXE Sony Playstation executable 528>16 lelong x PC=%#08x, 529>20 lelong !0 GP=%#08x, 530>24 lelong !0 .text=[%#08x, 531>>28 lelong x \b%#x], 532>32 lelong !0 .data=[%#08x, 533>>36 lelong x \b%#x], 534>40 lelong !0 .bss=[%#08x, 535>>44 lelong x \b%#x], 536>48 lelong !0 Stack=%#08x, 537>48 lelong =0 No Stack!, 538>52 lelong !0 StackSize=%#x, 539#>76 string >\0 (%s) 540# Area: 541>113 string x (%s) 542 543# CPE executables 5440 string CPE CPE executable 545>3 byte x (version %d) 546 547# Sony PlayStation archive (PSARC) 548# From: Alexandre Iooss <erdnaxe@crans.org> 549# URL: https://www.psdevwiki.com/ps3/PlayStation_archive_(PSARC) 5500 string PSAR Sony PlayStation Archive 551!:ext psarc 552>4 ubeshort x \b, version %d. 553>6 ubeshort x \b%d 554>8 string zlib \b, zlib compression 555>8 string lzma \b, LZMA compression 556>28 ubeshort&2 0 \b, relative paths 557>28 ubeshort&2 2 \b, absolute paths 558>28 ubeshort&1 1 \b, ignore case 559 560#------------------------------------------------------------------------------ 561# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>) 5620 string XBEH Microsoft Xbox executable 563!:mime audio/x-xbox-executable 564!:ext xbe 565# expect base address of 0x10000 566>0x0104 ulelong =0x10000 567>>(0x0118.l-0x0FFF4) lestring16 x \b: "%.40s" 568>>(0x0118.l-0x0FFF5) byte x (%c 569>>(0x0118.l-0x0FFF6) byte x \b%c- 570>>(0x0118.l-0x0FFF8) uleshort x \b%03u) 571>>(0x0118.l-0x0FF60) ulelong&0x80000007 0x80000007 \b, all regions 572>>(0x0118.l-0x0FF60) ulelong&0x80000007 !0x80000007 573>>>(0x0118.l-0x0FF60) ulelong >0 (regions: 574>>>>(0x0118.l-0x0FF60) ulelong &0x00000001 NA 575>>>>(0x0118.l-0x0FF60) ulelong &0x00000002 Japan 576>>>>(0x0118.l-0x0FF60) ulelong &0x00000004 Rest_of_World 577>>>>(0x0118.l-0x0FF60) ulelong &0x80000000 Manufacturer 578>>>(0x0118.l-0x0FF60) ulelong >0 \b) 579# probabilistic checks whether signed or not 580>0x0004 ulelong =0x0 581>>&2 ulelong =0x0 582>>>&2 ulelong =0x0 \b, not signed 583>0x0004 ulelong >0 584>>&2 ulelong >0 585>>>&2 ulelong >0 \b, signed 586 587# -------------------------------- 588# Microsoft Xbox data file formats 5890 string XIP0 XIP, Microsoft Xbox data 5900 string XTF0 XTF, Microsoft Xbox data 591 592#------------------------------------------------------------------------------ 593# Microsoft Xbox 360 executables (.xex) 594# From: David Korth <gerbilsoft@gerbilsoft.com> 595# References: 596# - https://free60project.github.io/wiki/XEX.html 597# - https://github.com/xenia-project/xenia/blob/HEAD/src/xenia/kernel/util/xex2_info.h 598 599# Title ID (part of Execution ID section) 6000 name xbox-360-xex-execution-id 601>(0.L+0xC) byte x (%c 602>(0.L+0xD) byte x \b%c 603>(0.L+0xE) beshort x \b-%04u, media ID: 604>(0.L) belong x %08X) 605 606# Region code (part of Security Info) 6070 name xbox-360-xex-region-code 608>0 ubelong 0xFFFFFFFF \b, all regions 609>0 ubelong !0xFFFFFFFF 610>>0 ubelong >0 (regions: 611>>0 ubelong&0x000000FF 0x000000FF USA 612>>0 ubelong&0x00000100 0x00000100 Japan 613>>0 ubelong&0x00000200 0x00000200 China 614>>0 ubelong&0x0000FC00 0x0000FC00 Asia 615>>0 ubelong&0x00FF0000 0x00FF0000 PAL 616>>0 ubelong&0x00FF0000 0x00FE0000 PAL [except AU/NZ] 617>>0 ubelong&0x00FF0000 0x00010000 AU/NZ 618>>0 ubelong&0xFF000000 0xFF000000 Other 619>>0 ubelong >0 \b) 620 6210 string XEX2 Microsoft Xbox 360 executable 622!:mime audio/x-xbox360-executable 623!:ext xex 624>0x18 search/0x100 \x00\x04\x00\x06 625>>&0 use xbox-360-xex-execution-id 626>(0x010.L+0x178) use xbox-360-xex-region-code 627 6280 string XEX1 Microsoft Xbox 360 executable (XEX1) 629!:mime audio/x-xbox360-executable 630!:ext xex 631>0x18 search/0x100 \x00\x04\x00\x06 632>>&0 use xbox-360-xex-execution-id 633>(0x010.L+0x154) use xbox-360-xex-region-code 634 635#------------------------------------------------------------------------------ 636# Microsoft Xbox 360 packages 637# From: David Korth <gerbilsoft@gerbilsoft.com> 638# References: 639# - https://free60project.github.io/wiki/STFS.html 640# - https://github.com/xenia-project/xenia/blob/HEAD/src/xenia/kernel/util/xex2_info.h 641 642# TODO: More information for console-signed packages. 643 6440 name xbox-360-package 645>0x360 byte x (%c 646>0x361 byte x \b%c 647>0x362 beshort x \b-%04u, media ID: 648>0x354 belong x %08X) 649>0x344 belong x \b, content type: 650>>0x344 belong 0x1 Saved Game 651>>0x344 belong 0x2 Marketplace Content 652>>0x344 belong 0x3 Publisher 653>>0x344 belong 0x1000 Xbox 360 Title 654>>0x344 belong 0x2000 IPTV Pause Buffer 655>>0x344 belong 0x4000 Installed Game 656>>0x344 belong 0x5000 Original Xbox Game 657>>0x344 belong 0x9000 Avatar Item 658>>0x344 belong 0x10000 Profile 659>>0x344 belong 0x20000 Gamer Picture 660>>0x344 belong 0x30000 Theme 661>>0x344 belong 0x40000 Cache File 662>>0x344 belong 0x50000 Storage Download 663>>0x344 belong 0x60000 Xbox Saved Game 664>>0x344 belong 0x70000 Xbox Download 665>>0x344 belong 0x80000 Game Demo 666>>0x344 belong 0x90000 Video 667>>0x344 belong 0xA0000 Game 668>>0x344 belong 0xB0000 Installer 669>>0x344 belong 0xC0000 Game Trailer 670>>0x344 belong 0xD0000 Arcade Title 671>>0x344 belong 0xE0000 XNA 672>>0x344 belong 0xF0000 License Store 673>>0x344 belong 0x100000 Movie 674>>0x344 belong 0x200000 TV 675>>0x344 belong 0x300000 Music Video 676>>0x344 belong 0x400000 Game Video 677>>0x344 belong 0x500000 Podcast Video 678>>0x344 belong 0x600000 Viral Video 679>>0x344 belong 0x2000000 Community Game 680 6810 string CON\x20 Microsoft Xbox 360 package (console-signed) 682>0 use xbox-360-package 6830 string PIRS 684>0 belong 0 Microsoft Xbox 360 package (non-Xbox Live) 685>>0 use xbox-360-package 6860 string LIVE 687>0x104 belong 0 Microsoft Xbox 360 package (Xbox Live) 688>>0 use xbox-360-package 689 690# Atari Lynx cartridge dump (EXE/BLL header) 691# From: "Stefan A. Haubenthal" <polluks@sdf.lonestar.org> 692# Reference: 693# https://raw.githubusercontent.com/cc65/cc65/master/libsrc/lynx/exehdr.s 694# Double-check that the image type matches too, 0x8008 conflicts with 695# 8 character OMF-86 object file headers. 6960 beshort 0x8008 697>6 string BS93 Lynx homebrew cartridge 698!:mime application/x-atari-lynx-rom 699>>2 beshort x \b, RAM start $%04x 700# Update: Joerg Jenderek 701# Reference: http://mark0.net/download/triddefs_xml.7z/defs/l/lnx.trid.xml 702# Note: called "Atari Lynx ROM" by TrID 7030 string LYNX Lynx cartridge 704!:mime application/x-atari-lynx-rom 705!:ext lnx 706# bank 0 page size like: 128 256 512 707>4 leshort/4 >0 \b, bank 0 %dk 708>6 leshort/4 >0 \b, bank 1 %dk 709# 32 bytes cart name like: "jconnort.lyx" "viking~1.lyx" "Eye of the Beholder" "C:\EMU\LYNX\ROMS\ULTCHESS.LYX" 710>10 string >\0 \b, "%.32s" 711# 16 bytes manufacturer like: "Atari" "NuFX Inc." "Matthias Domin" 712>42 string >\0 \b, "%.16s" 713# version number 714#>8 leshort !1 \b, version number %u 715# rotation: 1~left Lexis (NA).lnx 2~right Centipede (Prototype).lnx 716>58 ubyte >0 \b, rotation %u 717# spare 718#>59 lelong !0 \b, spare %#x 719 720# Opera file system that is used on the 3DO console 721# From: Serge van den Boom <svdb@stack.nl> 7220 string \x01ZZZZZ\x01 3DO "Opera" file system 723 724# From: Alex Myczko <alex@aiei.ch> 725# From: David Pflug <david@pflug.email> 726# is the offset 12 or the offset 16 correct? 727# GBS (Game Boy Sound) magic 728# ftp://ftp.modland.com/pub/documents/format_documentation/\ 729# Gameboy%20Sound%20System%20(.gbs).txt 7300 string GBS Nintendo Gameboy Music/Audio Data 731#12 string GameBoy\ Music\ Module Nintendo Gameboy Music Module 732>16 string >\0 ("%.32s" by 733>48 string >\0 %.32s, copyright 734>80 string >\0 %.32s), 735>3 byte x version %u, 736>4 byte x %u tracks 737 738# IPS Patch Files from: From: Thomas Klausner <tk@giga.or.at> 739# see https://zerosoft.zophar.net/ips.php 7400 string PATCH IPS patch file 741!:ext ips 742 743# BPS Patch Files - from: David Korth <gerbilsoft@gerbilsoft.com> 744# Reference: https://www.romhacking.net/documents/746/ 7450 string BPS1 BPS patch file 746!:ext bps 747 748# APS Patch Files - from: David Korth <gerbilsoft@gerbilsoft.com> 749# Reference: https://github.com/btimofeev/UniPatcher/wiki/APS-(N64) 7500 string APS10 APS patch file 751!:ext aps 752>5 byte 0 \b, simple patch 753>5 byte 1 \b, N64-specific patch for 754>>58 byte x N%c 755>>59 byte x \b%c 756>>60 byte x \b%c 757>7 byte !0x20 758# FIXME: /T specifier isn't working with a fixed-length string. 759>>7 string x \b: "%.50s" 760 761# UPS Patch Files - from: David Korth <gerbilsoft@gerbilsoft.com> 762# Reference: http://fileformats.archiveteam.org/wiki/UPS_(binary_patch_format) 7630 string UPS1 UPS patch file 764!:ext ups 765 766# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at> 7670 string PPF30 Playstation Patch File version 3.0 768>5 byte 0 \b, PPF 1.0 patch 769>5 byte 1 \b, PPF 2.0 patch 770>5 byte 2 \b, PPF 3.0 patch 771>>56 byte 0 \b, Imagetype BIN (any) 772>>56 byte 1 \b, Imagetype GI (PrimoDVD) 773>>57 byte 0 \b, Blockcheck disabled 774>>57 byte 1 \b, Blockcheck enabled 775>>58 byte 0 \b, Undo data not available 776>>58 byte 1 \b, Undo data available 777>6 string x \b, description: %s 778 7790 string PPF20 Playstation Patch File version 2.0 780>5 byte 0 \b, PPF 1.0 patch 781>5 byte 1 \b, PPF 2.0 patch 782>>56 lelong >0 \b, size of file to patch %d 783>6 string x \b, description: %s 784 7850 string PPF10 Playstation Patch File version 1.0 786>5 byte 0 \b, Simple Encoding 787>6 string x \b, description: %s 788 789# Compressed ISO disc image (used mostly by PSP, PS2 and MegaDrive) 790# From: Alexandre Iooss <erdnaxe@crans.org> 791# URL: https://en.wikipedia.org/wiki/.CSO 792# NOTE: This is NOT the same as Compact ISO or GameCube/Wii disc image, 793# though it has the same magic number. 7940 string CISO 795# Match CISO version 1 with ISO-9660 sector size 796>20 ubyte <2 797>>16 ulelong =2048 CSO v1 disk image 798!:mime application/x-compressed-iso 799!:ext ciso/cso 800>>>8 ulequad x \b, original size %llu bytes 801>>>16 ulelong x \b, datablock size %u bytes 802# Match CISO version 2 803>20 ubyte =2 804>>22 uleshort =0 805>>>4 ulelong =24 CSO v2 disk image 806!:mime application/x-compressed-iso 807!:ext ciso/cso 808>>>>8 ulequad x \b, original size %llu bytes 809>>>>16 ulelong x \b, datablock size %u bytes 810 811# From: Daniel Dawson <ddawson@icehouse.net> 812# SNES9x .smv "movie" file format. 8130 string SMV\x1A SNES9x input recording 814>0x4 lelong x \b, version %d 815# version 4 is latest so far 816>0x4 lelong <5 817>>0x8 ledate x \b, recorded at %s 818>>0xc lelong >0 \b, rerecorded %d times 819>>0x10 lelong x \b, %d frames long 820>>0x14 byte >0 \b, data for controller(s): 821>>>0x14 byte &0x1 #1 822>>>0x14 byte &0x2 #2 823>>>0x14 byte &0x4 #3 824>>>0x14 byte &0x8 #4 825>>>0x14 byte &0x10 #5 826>>0x15 byte ^0x1 \b, begins from snapshot 827>>0x15 byte &0x1 \b, begins from reset 828>>0x15 byte ^0x2 \b, NTSC standard 829>>0x15 byte &0x2 \b, PAL standard 830>>0x17 byte &0x1 \b, settings: 831# WIP1Timing not used as of version 4 832>>>0x4 lelong <4 833>>>>0x17 byte &0x2 WIP1Timing 834>>>0x17 byte &0x4 Left+Right 835>>>0x17 byte &0x8 VolumeEnvX 836>>>0x17 byte &0x10 FakeMute 837>>>0x17 byte &0x20 SyncSound 838# New flag as of version 4 839>>>0x4 lelong >3 840>>>>0x17 byte &0x80 NoCPUShutdown 841>>0x4 lelong <4 842>>>0x18 lelong >0x23 843>>>>0x20 leshort !0 844>>>>>0x20 lestring16 x \b, metadata: "%s" 845>>0x4 lelong >3 846>>>0x24 byte >0 \b, port 1: 847>>>>0x24 byte 1 joypad 848>>>>0x24 byte 2 mouse 849>>>>0x24 byte 3 SuperScope 850>>>>0x24 byte 4 Justifier 851>>>>0x24 byte 5 multitap 852>>>0x24 byte >0 \b, port 2: 853>>>>0x25 byte 1 joypad 854>>>>0x25 byte 2 mouse 855>>>>0x25 byte 3 SuperScope 856>>>>0x25 byte 4 Justifier 857>>>>0x25 byte 5 multitap 858>>>0x18 lelong >0x43 859>>>>0x40 leshort !0 860>>>>>0x40 lestring16 x \b, metadata: "%s" 861>>0x17 byte &0x40 \b, ROM: 862>>>(0x18.l-26) lelong x CRC32 %#08x 863>>>(0x18.l-23) string x "%s" 864 865# Type: scummVM savegame files 866# From: Sven Hartge <debian@ds9.argh.org> 8670 string SCVM ScummVM savegame 868>12 string >\0 "%s" 869 870#------------------------------------------------------------------------------ 871# Nintendo GameCube / Wii file formats. 872# 873 874# Type: Nintendo GameCube/Wii common disc header data. 875# From: David Korth <gerbilsoft@gerbilsoft.com> 876# Reference: https://wiibrew.org/wiki/Wii_Disc 8770 name nintendo-gcn-disc-common 878>0x20 string x "%.64s" 879>0x00 string x (%.6s 880>0x06 byte >0 881>>0x06 byte 1 \b, Disc 2 882>>0x06 byte 2 \b, Disc 3 883>>0x06 byte 3 \b, Disc 4 884>0x07 byte x \b, Rev.%02u) 885>0x18 belong 0x5D1C9EA3 886>>0x60 beshort 0x0101 \b (Unencrypted) 887>0x200 string NKIT \b (NKit compressed) 888 889 890# Type: Nintendo GameCube disc image 891# From: David Korth <gerbilsoft@gerbilsoft.com> 892# Reference: https://wiibrew.org/wiki/Wii_Disc 8930x1C belong 0xC2339F3D Nintendo GameCube disc image: 894!:mime application/x-gamecube-rom 895>0 use nintendo-gcn-disc-common 896 897# Type: Nintendo GameCube embedded disc image 898# Commonly found on demo discs. 899# From: David Korth <gerbilsoft@gerbilsoft.com> 900# Reference: http://hitmen.c02.at/files/yagcd/yagcd/index.html#idx14.8 9010 belong 0xAE0F38A2 902>0x0C belong 0x00100000 903>>(8.L+0x1C) belong 0xC2339F3D Nintendo GameCube embedded disc image: 904!:mime application/x-gamecube-rom 905>>>(8.L) use nintendo-gcn-disc-common 906 907# Type: Nintendo Wii disc image 908# From: David Korth <gerbilsoft@gerbilsoft.com> 909# Reference: https://wiibrew.org/wiki/Wii_Disc 9100x18 belong 0x5D1C9EA3 Nintendo Wii disc image: 911>0 use nintendo-gcn-disc-common 912 913# Type: Nintendo Wii disc image (WBFS format) 914# From: David Korth <gerbilsoft@gerbilsoft.com> 915# Reference: https://wiibrew.org/wiki/Wii_Disc 9160 string WBFS 917>0x218 belong 0x5D1C9EA3 Nintendo Wii disc image (WBFS format): 918!:mime application/x-wii-rom 919>>0x200 use nintendo-gcn-disc-common 920 921# Type: Nintendo GameCube/Wii disc image (CISO format) 922# NOTE: This is NOT the same as Compact ISO or PSP CISO, 923# though it has the same magic number. 9240 string CISO 925# Other fields are used to determine what type of CISO this is: 926# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size) 927# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size) 928# - None of the above: Compact ISO. 929>4 lelong 0x200000 930>>8 byte 1 931>>>0x801C belong 0xC2339F3D Nintendo GameCube disc image (CISO format): 932!:mime application/x-wii-rom 933>>>>0x8000 use nintendo-gcn-disc-common 934>>>0x8018 belong 0x5D1C9EA3 Nintendo Wii disc image (CISO format): 935!:mime application/x-wii-rom 936>>>>0x8000 use nintendo-gcn-disc-common 937 938# Type: Nintendo GameCube/Wii disc image (GCZ format) 939# Due to zlib compression, we can't get the actual disc information. 9400 lelong 0xB10BC001 941>4 lelong 0 Nintendo GameCube disc image (GCZ format) 942!:mime application/x-gamecube-rom 943>4 lelong 1 Nintendo Wii disc image (GCZ format) 944!:mime application/x-wii-rom 945>4 default x Nintendo GameCube/Wii disc image (GCZ format) 946 947# Type: Nintendo GameCube/Wii disc image (WDF format) 9480 string WII\001DISC 949>8 belong 1 950# WDFv1 951>>0x54 belong 0xC2339F3D Nintendo GameCube disc image (WDFv1 format): 952!:mime application/x-gamecube-rom 953>>>0x38 use nintendo-gcn-disc-common 954>>0x58 belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv1 format): 955!:mime application/x-wii-rom 956>>>0x38 use nintendo-gcn-disc-common 957>8 belong 2 958# WDFv2 959>>(12.L+0x1C) belong 0xC2339F3D Nintendo GameCube disc image (WDFv2 format): 960!:mime application/x-gamecube-rom 961>>>(12.L) use nintendo-gcn-disc-common 962>>(12.L+0x18) belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv2 format): 963!:mime application/x-wii-rom 964>>>(12.L) use nintendo-gcn-disc-common 965 966# Type: Nintendo GameCube/Wii disc image (WIA format) 9670 string WIA\001 Nintendo 968>0x48 belong 1 GameCube 969!:mime application/x-gamecube-rom 970>0x48 belong 2 Wii 971!:mime application/x-wii-rom 972>0x48 default x GameCube/Wii 973>0x48 belong x disc image (WIA format): 974>>0x58 use nintendo-gcn-disc-common 975 976# Type: Nintendo GameCube/Wii disc image (with SDK header) 977# From: David Korth <gerbilsoft@gerbilsoft.com> 978# Reference: https://wiibrew.org/wiki/Wii_Disc 9790 belong 0xFFFF0000 980>0x18 belong 0x00000000 981>>0x1C belong 0x00000000 982>>>0x8018 belong 0x5D1C9EA3 Nintendo Wii SDK disc image: 983!:mime application/x-wii-rom 984>>>>0x8000 use nintendo-gcn-disc-common 985>>>0x801C belong 0xC2339F3D Nintendo GameCube SDK disc image: 986!:mime application/x-gamecube-rom 987>>>>0x8000 use nintendo-gcn-disc-common 988 989# Type: Nintendo GameCube/Wii disc image (RVZ format) 9900 string RVZ\001 Nintendo 991>0x48 belong 1 GameCube 992!:mime application/x-gamecube-rom 993>0x48 belong 2 Wii 994!:mime application/x-wii-rom 995>0x48 default x GameCube/Wii 996>0x48 belong x disc image (RVZ format): 997>>0x58 use nintendo-gcn-disc-common 998 999#------------------------------------------------------------------------------ 1000# Nintendo 3DS file formats. 1001# 1002 1003# Type: Nintendo 3DS "NCSD" image. (game cards and eMMC) 1004# From: David Korth <gerbilsoft@gerbilsoft.com> 1005# Reference: https://www.3dbrew.org/wiki/NCSD 10060x100 string NCSD 1007>0x118 lequad 0 Nintendo 3DS Game Card image 1008# NCCH header for partition 0. (game data) 1009>>0x1150 string >\0 \b: "%.16s" 1010>>0x312 byte x (Rev.%02u) 1011>>0x118C byte 2 (New3DS only) 1012>>0x18D byte 0 (inner device) 1013>>0x18D byte 1 (Card1) 1014>>0x18D byte 2 (Card2) 1015>>0x18D byte 3 (extended device) 1016>0x118 bequad 0x0102020202000000 Nintendo 3DS eMMC dump (Old3DS) 1017>0x118 bequad 0x0102020203000000 Nintendo 3DS eMMC dump (New3DS) 1018 1019# Nintendo 3DS version code. 1020# Reference: https://www.3dbrew.org/wiki/Titles 1021# Format: leshort containing three fields: 1022# - 6-bit: Major 1023# - 6-bit: Minor 1024# - 4-bit: Revision 1025# NOTE: Only supporting major/minor versions from 0-15 right now. 1026# NOTE: Should be prefixed with "v". 10270 name nintendo-3ds-version-code 1028# Raw version. 1029>0 leshort x \b%u, 1030# Major version. 1031>0 leshort&0xFC00 0x0000 0 1032>0 leshort&0xFC00 0x0400 1 1033>0 leshort&0xFC00 0x0800 2 1034>0 leshort&0xFC00 0x0C00 3 1035>0 leshort&0xFC00 0x1000 4 1036>0 leshort&0xFC00 0x1400 5 1037>0 leshort&0xFC00 0x1800 6 1038>0 leshort&0xFC00 0x1C00 7 1039>0 leshort&0xFC00 0x2000 8 1040>0 leshort&0xFC00 0x2400 9 1041>0 leshort&0xFC00 0x2800 10 1042>0 leshort&0xFC00 0x2C00 11 1043>0 leshort&0xFC00 0x3000 12 1044>0 leshort&0xFC00 0x3400 13 1045>0 leshort&0xFC00 0x3800 14 1046>0 leshort&0xFC00 0x3C00 15 1047# Minor version. 1048>0 leshort&0x03F0 0x0000 \b.0 1049>0 leshort&0x03F0 0x0010 \b.1 1050>0 leshort&0x03F0 0x0020 \b.2 1051>0 leshort&0x03F0 0x0030 \b.3 1052>0 leshort&0x03F0 0x0040 \b.4 1053>0 leshort&0x03F0 0x0050 \b.5 1054>0 leshort&0x03F0 0x0060 \b.6 1055>0 leshort&0x03F0 0x0070 \b.7 1056>0 leshort&0x03F0 0x0080 \b.8 1057>0 leshort&0x03F0 0x0090 \b.9 1058>0 leshort&0x03F0 0x00A0 \b.10 1059>0 leshort&0x03F0 0x00B0 \b.11 1060>0 leshort&0x03F0 0x00C0 \b.12 1061>0 leshort&0x03F0 0x00D0 \b.13 1062>0 leshort&0x03F0 0x00E0 \b.14 1063>0 leshort&0x03F0 0x00F0 \b.15 1064# Revision. 1065>0 leshort&0x000F x \b.%u 1066 1067# Type: Nintendo 3DS "NCCH" container. 1068# https://www.3dbrew.org/wiki/NCCH 10690x100 string NCCH Nintendo 3DS 1070>0x18D byte&2 0 File Archive (CFA) 1071>0x18D byte&2 2 Executable Image (CXI) 1072>0x150 string >\0 \b: "%.16s" 1073>0x18D byte 0x05 1074>>0x10E leshort x (Old3DS System Update v 1075>>0x10E use nintendo-3ds-version-code 1076>>0x10E leshort x \b) 1077>0x18D byte 0x15 1078>>0x10E leshort x (New3DS System Update v 1079>>0x10E use nintendo-3ds-version-code 1080>>0x10E leshort x \b) 1081>0x18D byte !0x05 1082>>0x18D byte !0x15 1083>>>0x112 byte x (v 1084>>>0x112 use nintendo-3ds-version-code 1085>>>0x112 byte x \b) 1086>0x18C byte 2 (New3DS only) 1087 1088# Type: Nintendo 3DS "SMDH" file. (application description) 1089# From: David Korth <gerbilsoft@gerbilsoft.com> 1090# Reference: https://3dbrew.org/wiki/SMDH 10910 string SMDH Nintendo 3DS SMDH file 1092>0x208 leshort !0 1093>>0x208 lestring16 x \b: "%.128s" 1094>>0x388 leshort !0 1095>>>0x388 lestring16 x by %.128s 1096>0x208 leshort 0 1097>>0x008 leshort !0 1098>>>0x008 lestring16 x \b: "%.128s" 1099>>>0x188 leshort !0 1100>>>>0x188 lestring16 x by %.128s 1101 1102# Type: Nintendo 3DS Homebrew Application. 1103# From: David Korth <gerbilsoft@gerbilsoft.com> 1104# Reference: https://3dbrew.org/wiki/3DSX_Format 11050 string 3DSX Nintendo 3DS Homebrew Application (3DSX) 1106 1107# Type: Nintendo 3DS Banner Model Data. 1108# From: David Korth <gerbilsoft@gerbilsoft.com> 1109# Reference: https://3dbrew.org/wiki/CBMD 11100 string CBMD\0\0\0\0 Nintendo 3DS Banner Model Data 1111 1112#------------------------------------------------------------------------------ 1113# a7800: file(1) magic for the Atari 7800 raw ROM format. 1114# From: David Korth <gerbilsoft@gerbilsoft.com> 1115# Reference: https://sites.google.com/site/atari7800wiki/a78-header 1116 11170 byte >0 1118>0 byte <3 1119>>1 string ATARI7800 Atari 7800 ROM image 1120!:mime application/x-atari-7800-rom 1121>>>0x11 string >\0 \b: "%.32s" 1122# Display type. 1123>>>0x39 byte 0 (NTSC) 1124>>>0x39 byte 1 (PAL) 1125>>>0x36 byte&1 1 (POKEY) 1126 1127#------------------------------------------------------------------------------ 1128# vectrex: file(1) magic for the GCE Vectrex raw ROM format. 1129# From: David Korth <gerbilsoft@gerbilsoft.com> 1130# Reference: http://www.playvectrex.com/designit/chrissalo/hello1.htm 1131# 1132# NOTE: Title is terminated with 0x80, not 0. 1133# The header is terminated with a 0, so that will 1134# terminate the title as well. 1135# 11360 string g\ GCE Vectrex ROM image 1137>0x11 string >\0 \b: "%.16s" 1138 1139#------------------------------------------------------------------------------ 1140# amiibo: file(1) magic for Nintendo amiibo NFC dumps. 1141# From: David Korth <gerbilsoft@gerbilsoft.com> 1142# Reference: https://www.3dbrew.org/wiki/Amiibo 11430x00 byte 0x04 1144>0x0A beshort 0x0FE0 1145>>0x0C belong 0xF110FFEE 1146>>>0x208 beshort 0x0100 1147>>>>0x020A byte 0x0F 1148>>>>>0x020C bequad 0x000000045F000000 1149>>>>>>0x5B byte 0x02 1150>>>>>>>0x54 belong x Nintendo amiibo NFC dump - amiibo ID: %08X- 1151>>>>>>>0x58 belong x \b%08X 1152 1153#------------------------------------------------------------------------------ 1154# Type: Nintendo Switch XCI (Game Cartridge Image) 1155# From: Benjamin Lowry <ben@ben.gmbh> 1156# Reference: https://switchbrew.org/wiki/Gamecard_Format 11570x100 string HEAD 1158>0x10D byte 0xFA Nintendo Switch cartridge image (XCI), 1GB 1159>0x10D byte 0xF8 Nintendo Switch cartridge image (XCI), 2GB 1160>0x10D byte 0xF0 Nintendo Switch cartridge image (XCI), 4GB 1161>0x10D byte 0xE0 Nintendo Switch cartridge image (XCI), 8GB 1162>0x10D byte 0xE1 Nintendo Switch cartridge image (XCI), 16GB 1163>0x10D byte 0xE2 Nintendo Switch cartridge image (XCI), 32GB 1164 1165#------------------------------------------------------------------------------ 1166# Type: Nintendo Switch Executable 1167# From: Benjamin Lowry <ben@ben.gmbh> 1168# Reference: https://switchbrew.org/wiki/NSO 11690x00 string NSO0 Nintendo Switch executable (NSO) 1170 1171#------------------------------------------------------------------------------ 1172# Type: Nintendo Switch PFS0 1173# From: Benjamin Lowry <ben@ben.gmbh> 1174# Reference: https://switchbrew.org/wiki/NCA_Format#PFS0 11750x00 string PFS0 Nintendo Switch partition filesystem (PFS0) 1176>0x04 ulelong x \b, %d files 1177 1178#------------------------------------------------------------------------------ 1179# amiibo: file(1) magic for Nintendo Badge Arcade files. 1180# From: David Korth <gerbilsoft@gerbilsoft.com> 1181# References: 1182# - https://github.com/GerbilSoft/rom-properties/issues/92 1183# - https://github.com/CaitSith2/BadgeArcadeTool 1184# - https://github.com/TheMachinumps/Advanced-badge-editor 1185 1186# PRBS: Individual badge and/or mega badge. 11870 string PRBS 1188>0x44 byte >0x20 Nintendo Badge Arcade 1189>>0xB8 ulelong <2 1190>>>0xBC ulelong <2 badge: 1191>>>0xBC ulelong >1 Mega Badge 1192>>>>0xB8 ulelong x (%ux 1193>>>>0xBC ulelong x \b%u): 1194>>0xB8 ulelong >1 Mega Badge 1195>>>0xB8 ulelong x (%ux 1196>>>0xBC ulelong x \b%u): 1197>0x44 string x "%s" 1198>0x3C ulelong x \b, badge ID: %u 1199>0x74 byte >0x20 1200>>0x74 string x \b, set: "%s" 1201>0xA8 ulelong !0xFFFFFFFF 1202>>0xA8 ulelong x \b, launch title ID: %08X 1203>>0xA4 ulelong x \b-%08X 1204 1205# CABS: Badge set. 12060 string CABS 1207>0x2C byte >0x20 Nintendo Badge Arcade badge set: 1208>>0x2C string x "%.48s" 1209>>0x24 ulelong x \b, set ID: %u 1210 1211#------------------------------------------------------------------------------ 1212# sufami: file(1) magic for Sufami Turbo ROM images. 1213# From: David Korth <gerbilsoft@gerbilsoft.com> 1214# References: 1215# - https://problemkaputt.de/fullsnes.htm#snescartsufamiturbominicartridgeadaptor 12160 string BANDAI\ SFC-ADX 1217>0x10 string !SFC-ADX\ BACKUP Sufami Turbo ROM image: 1218>>0x10 string/T x "%.14s" 1219>>0x30 byte x \b, ID %02X 1220>>0x31 byte x \b%02X 1221>>0x32 byte x \b%02X 1222>>0x33 ubyte >0 \b, series index %u 1223>>0x34 ubyte 0 [SlowROM] 1224>>0x34 ubyte 1 [FastROM] 1225>>0x35 ubyte 1 [SRAM] 1226>>0x35 ubyte 3 [Special] 1227