1b6cee71dSXin LI 2b6cee71dSXin LI#------------------------------------------------------------------------------ 3*ae316d1dSXin LI# $File: console,v 1.80 2024/11/09 23:55:02 christos Exp $ 4b6cee71dSXin LI# Console game magic 5b6cee71dSXin LI# Toby Deshane <hac@shoelace.digivill.net> 6b6cee71dSXin LI 73e41d09dSXin LI# ines: file(1) magic for Marat's iNES Nintendo Entertainment System ROM dump format 83e41d09dSXin LI# Updated by David Korth <gerbilsoft@gerbilsoft.com> 93e41d09dSXin LI# References: 1048c779cdSXin LI# - https://wiki.nesdev.com/w/index.php/INES 1148c779cdSXin LI# - https://wiki.nesdev.com/w/index.php/NES_2.0 1240427ccaSGordon Tetlow 1340427ccaSGordon Tetlow# Common header for iNES, NES 2.0, and Wii U iNES. 1440427ccaSGordon Tetlow0 name nes-rom-image-ines 153e41d09dSXin LI>7 byte&0x0C =0x8 (NES 2.0) 163e41d09dSXin LI>4 byte x \b: %ux16k PRG 1740427ccaSGordon Tetlow>5 byte x \b, %ux8k CHR 183e41d09dSXin LI>6 byte&0x08 =0x8 [4-Scr] 193e41d09dSXin LI>6 byte&0x09 =0x0 [H-mirror] 203e41d09dSXin LI>6 byte&0x09 =0x1 [V-mirror] 213e41d09dSXin LI>6 byte&0x02 =0x2 [SRAM] 223e41d09dSXin LI>6 byte&0x04 =0x4 [Trainer] 233e41d09dSXin LI>7 byte&0x03 =0x2 [PC10] 2440427ccaSGordon Tetlow>7 byte&0x03 =0x1 [VS] 253e41d09dSXin LI>>7 byte&0x0C =0x8 263e41d09dSXin LI# NES 2.0: VS PPU 273e41d09dSXin LI>>>13 byte&0x0F =0x0 \b, RP2C03B 283e41d09dSXin LI>>>13 byte&0x0F =0x1 \b, RP2C03G 293e41d09dSXin LI>>>13 byte&0x0F =0x2 \b, RP2C04-0001 303e41d09dSXin LI>>>13 byte&0x0F =0x3 \b, RP2C04-0002 313e41d09dSXin LI>>>13 byte&0x0F =0x4 \b, RP2C04-0003 323e41d09dSXin LI>>>13 byte&0x0F =0x5 \b, RP2C04-0004 333e41d09dSXin LI>>>13 byte&0x0F =0x6 \b, RP2C03B 343e41d09dSXin LI>>>13 byte&0x0F =0x7 \b, RP2C03C 353e41d09dSXin LI>>>13 byte&0x0F =0x8 \b, RP2C05-01 363e41d09dSXin LI>>>13 byte&0x0F =0x9 \b, RP2C05-02 373e41d09dSXin LI>>>13 byte&0x0F =0xA \b, RP2C05-03 383e41d09dSXin LI>>>13 byte&0x0F =0xB \b, RP2C05-04 393e41d09dSXin LI>>>13 byte&0x0F =0xC \b, RP2C05-05 403e41d09dSXin LI# TODO: VS protection hardware? 413e41d09dSXin LI>>7 byte x \b] 423e41d09dSXin LI# NES 2.0-specific flags. 433e41d09dSXin LI>7 byte&0x0C =0x8 443e41d09dSXin LI>>12 byte&0x03 =0x0 [NTSC] 453e41d09dSXin LI>>12 byte&0x03 =0x1 [PAL] 463e41d09dSXin LI>>12 byte&0x02 =0x2 [NTSC+PAL] 473e41d09dSXin LI 4840427ccaSGordon Tetlow# Standard iNES ROM header. 4940427ccaSGordon Tetlow0 string NES\x1A NES ROM image (iNES) 502dc4dbb9SEitan Adler!:mime application/x-nes-rom 5140427ccaSGordon Tetlow>0 use nes-rom-image-ines 5240427ccaSGordon Tetlow 5340427ccaSGordon Tetlow# Wii U Virtual Console iNES ROM header. 5440427ccaSGordon Tetlow0 belong 0x4E455300 NES ROM image (Wii U Virtual Console) 552dc4dbb9SEitan Adler!:mime application/x-nes-rom 5640427ccaSGordon Tetlow>0 use nes-rom-image-ines 5740427ccaSGordon Tetlow 583e41d09dSXin LI#------------------------------------------------------------------------------ 593e41d09dSXin LI# unif: file(1) magic for UNIF-format Nintendo Entertainment System ROM images 6048c779cdSXin LI# Reference: https://wiki.nesdev.com/w/index.php/UNIF 613e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 623e41d09dSXin LI# 633e41d09dSXin LI# NOTE: The UNIF format uses chunks instead of a fixed header, 643e41d09dSXin LI# so most of the data isn't easily parseable. 653e41d09dSXin LI# 663e41d09dSXin LI0 string UNIF 6740427ccaSGordon Tetlow>4 lelong <16 NES ROM image (UNIF v%d format) 682dc4dbb9SEitan Adler!:mime application/x-nes-rom 69b6cee71dSXin LI 70b6cee71dSXin LI#------------------------------------------------------------------------------ 71898496eeSXin LI# fds: file(1) magic for Famicom Disk System disk images 7248c779cdSXin LI# Reference: https://wiki.nesdev.com/w/index.php/Family_Computer_Disk_System#.FDS_format 73282e23f0SXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 74282e23f0SXin LI# TODO: Check "Disk info block" and get info from that in addition to the optional header. 75282e23f0SXin LI 76282e23f0SXin LI# Disk info block. (block 1) 77282e23f0SXin LI0 name nintendo-fds-disk-info-block 78282e23f0SXin LI>23 byte !1 FMC- 79282e23f0SXin LI>23 byte 1 FSC- 80282e23f0SXin LI>16 string x \b%.3s 81a4d6d3b8SXin LI>15 ubyte x \b, mfr %02X 82a4d6d3b8SXin LI>20 ubyte x (Rev.%02u) 83282e23f0SXin LI 84282e23f0SXin LI# Headered version. 85282e23f0SXin LI0 string FDS\x1A 8640427ccaSGordon Tetlow>0x11 string *NINTENDO-HVC* Famicom Disk System disk image: 872dc4dbb9SEitan Adler!:mime application/x-fds-disk 88282e23f0SXin LI>>0x10 use nintendo-fds-disk-info-block 89282e23f0SXin LI>4 byte 1 (%u side) 90282e23f0SXin LI>4 byte !1 (%u sides) 91282e23f0SXin LI 92282e23f0SXin LI# Unheadered version. 9340427ccaSGordon Tetlow1 string *NINTENDO-HVC* Famicom Disk System disk image: 942dc4dbb9SEitan Adler!:mime application/x-fds-disk 95282e23f0SXin LI>0 use nintendo-fds-disk-info-block 96282e23f0SXin LI 97282e23f0SXin LI#------------------------------------------------------------------------------ 9840427ccaSGordon Tetlow# tnes: file(1) magic for TNES-format Nintendo Entertainment System ROM images 9940427ccaSGordon Tetlow# Used by Nintendo 3DS NES Virtual Console games. 10040427ccaSGordon Tetlow# From: David Korth <gerbilsoft@gerbilsoft.com> 10140427ccaSGordon Tetlow# 10240427ccaSGordon Tetlow0 string TNES NES ROM image (Nintendo 3DS Virtual Console) 1032dc4dbb9SEitan Adler!:mime application/x-nes-rom 10440427ccaSGordon Tetlow>4 byte 100 \b: FDS, 10540427ccaSGordon Tetlow>>0x2010 use nintendo-fds-disk-info-block 10640427ccaSGordon Tetlow>4 byte !100 \b: TNES mapper %u 10740427ccaSGordon Tetlow>>5 byte x \b, %ux8k PRG 10840427ccaSGordon Tetlow>>6 byte x \b, %ux8k CHR 10940427ccaSGordon Tetlow>>7 byte&0x08 =1 [WRAM] 11040427ccaSGordon Tetlow>>8 byte&0x09 =1 [H-mirror] 11140427ccaSGordon Tetlow>>8 byte&0x09 =2 [V-mirror] 11240427ccaSGordon Tetlow>>8 byte&0x02 =3 [VRAM] 11340427ccaSGordon Tetlow 11440427ccaSGordon Tetlow#------------------------------------------------------------------------------ 115b6cee71dSXin LI# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format 1163e41d09dSXin LI# Reference: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header 117b6cee71dSXin LI# 118*ae316d1dSXin LI 119*ae316d1dSXin LI# Title (16 chars for GB; 15 chars for CGB) 120*ae316d1dSXin LI0 name gameboy-title 1213e41d09dSXin LI>0x143 byte&0x80 0x80 1223e41d09dSXin LI>>0x134 string >\0 \b: "%.15s" 1233e41d09dSXin LI>0x143 byte&0x80 !0x80 1243e41d09dSXin LI>>0x134 string >\0 \b: "%.16s" 1253e41d09dSXin LI>0x14c byte x (Rev.%02u) 126b6cee71dSXin LI 127*ae316d1dSXin LI# Machine type (SGB, CGB, SGB+CGB) 12843a5ec4eSXin LI# Old licensee code 0x33 is required for SGB, but not CGB. 129*ae316d1dSXin LI0 name gameboy-machine-type 1303e41d09dSXin LI>0x14b byte 0x33 1313e41d09dSXin LI>>0x146 byte 0x03 1323e41d09dSXin LI>>>0x143 byte&0x80 0x80 [SGB+CGB] 1333e41d09dSXin LI>>>0x143 byte&0x80 !0x80 [SGB] 1343e41d09dSXin LI>>0x146 byte !0x03 1353e41d09dSXin LI>>>0x143 byte&0xC0 0x80 [CGB] 1363e41d09dSXin LI>>>0x143 byte&0xC0 0xC0 [CGB ONLY] 1372dc4dbb9SEitan Adler>0x14b byte !0x33 13843a5ec4eSXin LI>>0x143 byte&0xC0 0x80 [CGB] 13943a5ec4eSXin LI>>0x143 byte&0xC0 0xC0 [CGB ONLY] 1403e41d09dSXin LI 141*ae316d1dSXin LI# Mapper 142*ae316d1dSXin LI0 name gameboy-mapper 143*ae316d1dSXin LI>0 byte 0x00 [ROM ONLY] 144*ae316d1dSXin LI>0 byte 0x01 [MBC1] 145*ae316d1dSXin LI>0 byte 0x02 [MBC1+RAM] 146*ae316d1dSXin LI>0 byte 0x03 [MBC1+RAM+BATT] 147*ae316d1dSXin LI>0 byte 0x05 [MBC2] 148*ae316d1dSXin LI>0 byte 0x06 [MBC2+BATTERY] 149*ae316d1dSXin LI>0 byte 0x08 [ROM+RAM] 150*ae316d1dSXin LI>0 byte 0x09 [ROM+RAM+BATTERY] 151*ae316d1dSXin LI>0 byte 0x0B [MMM01] 152*ae316d1dSXin LI>0 byte 0x0C [MMM01+SRAM] 153*ae316d1dSXin LI>0 byte 0x0D [MMM01+SRAM+BATT] 154*ae316d1dSXin LI>0 byte 0x0F [MBC3+TIMER+BATT] 155*ae316d1dSXin LI>0 byte 0x10 [MBC3+TIMER+RAM+BATT] 156*ae316d1dSXin LI>0 byte 0x11 [MBC3] 157*ae316d1dSXin LI>0 byte 0x12 [MBC3+RAM] 158*ae316d1dSXin LI>0 byte 0x13 [MBC3+RAM+BATT] 159*ae316d1dSXin LI>0 byte 0x19 [MBC5] 160*ae316d1dSXin LI>0 byte 0x1A [MBC5+RAM] 161*ae316d1dSXin LI>0 byte 0x1B [MBC5+RAM+BATT] 162*ae316d1dSXin LI>0 byte 0x1C [MBC5+RUMBLE] 163*ae316d1dSXin LI>0 byte 0x1D [MBC5+RUMBLE+SRAM] 164*ae316d1dSXin LI>0 byte 0x1E [MBC5+RUMBLE+SRAM+BATT] 165*ae316d1dSXin LI>0 byte 0xFC [Pocket Camera] 166*ae316d1dSXin LI>0 byte 0xFD [Bandai TAMA5] 167*ae316d1dSXin LI>0 byte 0xFE [Hudson HuC-3] 168*ae316d1dSXin LI>0 byte 0xFF [Hudson HuC-1] 1693e41d09dSXin LI 170*ae316d1dSXin LI# ROM size 171*ae316d1dSXin LI0 name gameboy-rom-size 172*ae316d1dSXin LI>0 byte 0 \b, ROM: 256Kbit 173*ae316d1dSXin LI>0 byte 1 \b, ROM: 512Kbit 174*ae316d1dSXin LI>0 byte 2 \b, ROM: 1Mbit 175*ae316d1dSXin LI>0 byte 3 \b, ROM: 2Mbit 176*ae316d1dSXin LI>0 byte 4 \b, ROM: 4Mbit 177*ae316d1dSXin LI>0 byte 5 \b, ROM: 8Mbit 178*ae316d1dSXin LI>0 byte 6 \b, ROM: 16Mbit 179*ae316d1dSXin LI>0 byte 7 \b, ROM: 32Mbit 180*ae316d1dSXin LI>0 byte 0x52 \b, ROM: 9Mbit 181*ae316d1dSXin LI>0 byte 0x53 \b, ROM: 10Mbit 182*ae316d1dSXin LI>0 byte 0x54 \b, ROM: 12Mbit 183b6cee71dSXin LI 184*ae316d1dSXin LI# RAM size 185*ae316d1dSXin LI0 name gameboy-ram-size 186*ae316d1dSXin LI>0 byte 1 \b, RAM: 16Kbit 187*ae316d1dSXin LI>0 byte 2 \b, RAM: 64Kbit 188*ae316d1dSXin LI>0 byte 3 \b, RAM: 256Kbit 189*ae316d1dSXin LI>0 byte 4 \b, RAM: 1Mbit 190*ae316d1dSXin LI>0 byte 5 \b, RAM: 512Kbit 191*ae316d1dSXin LI 192*ae316d1dSXin LI# Game Boy (Color) 193*ae316d1dSXin LI0x104 bequad 0xCEED6666CC0D000B 194*ae316d1dSXin LI>0x143 byte&0x80 0x80 Game Boy Color ROM image 195*ae316d1dSXin LI!:mime application/x-gameboy-color-rom 196*ae316d1dSXin LI>0x143 byte&0x80 !0x80 Game Boy ROM image 197*ae316d1dSXin LI!:mime application/x-gameboy-rom 198*ae316d1dSXin LI>0 use gameboy-title 199*ae316d1dSXin LI>0 use gameboy-machine-type 200*ae316d1dSXin LI>0x147 use gameboy-mapper 201*ae316d1dSXin LI>0x148 use gameboy-rom-size 202*ae316d1dSXin LI>0x149 use gameboy-ram-size 203*ae316d1dSXin LI 204*ae316d1dSXin LI# Analogue Pocket 205*ae316d1dSXin LI0x104 bequad 0x0110CEEF000044AA 206*ae316d1dSXin LI>0 byte x Analogue Pocket ROM image 207*ae316d1dSXin LI!:mime application/x-analogue-pocket-rom 208*ae316d1dSXin LI>0 use gameboy-title 209*ae316d1dSXin LI>0 use gameboy-machine-type 210*ae316d1dSXin LI>0x147 use gameboy-mapper 211*ae316d1dSXin LI>0x148 use gameboy-rom-size 212*ae316d1dSXin LI>0x149 use gameboy-ram-size 213b6cee71dSXin LI 214b6cee71dSXin LI#------------------------------------------------------------------------------ 2153e41d09dSXin LI# genesis: file(1) magic for various Sega Mega Drive / Genesis ROM image and disc formats 2163e41d09dSXin LI# Updated by David Korth <gerbilsoft@gerbilsoft.com> 2173e41d09dSXin LI# References: 21848c779cdSXin LI# - https://www.retrodev.com/segacd.html 2193e41d09dSXin LI# - http://devster.monkeeh.com/sega/32xguide1.txt 220b6cee71dSXin LI# 2213e41d09dSXin LI 2223e41d09dSXin LI# Common Sega Mega Drive header format. 2233e41d09dSXin LI# FIXME: Name fields are 48 bytes, but have spaces for padding instead of 00s. 2243e41d09dSXin LI0 name sega-mega-drive-header 2253e41d09dSXin LI# ROM title. (Use domestic if present; if not, use international.) 2263e41d09dSXin LI>0x120 byte >0x20 2273e41d09dSXin LI>>0x120 string >\0 \b: "%.16s" 2283e41d09dSXin LI>0x120 byte <0x21 2293e41d09dSXin LI>>0x150 string >\0 \b: "%.16s" 2303e41d09dSXin LI# Other information. 2313e41d09dSXin LI>0x180 string >\0 (%.14s 2323e41d09dSXin LI>>0x110 string >\0 \b, %.16s 2333e41d09dSXin LI>0x180 byte 0 2343e41d09dSXin LI>>0x110 string >\0 (%.16s 2353e41d09dSXin LI>0 byte x \b) 2363e41d09dSXin LI 2373e41d09dSXin LI# TODO: Check for 32X CD? 2383e41d09dSXin LI# Sega Mega CD disc images: 2048-byte sectors. 239*ae316d1dSXin LI0 string SEGADISCSYSTEM\040\040 Sega Mega CD disc image 2402dc4dbb9SEitan Adler!:mime application/x-sega-cd-rom 2413e41d09dSXin LI>0 use sega-mega-drive-header 2423e41d09dSXin LI>0 byte x \b, 2048-byte sectors 243*ae316d1dSXin LI0 string SEGABOOTDISC\040\040\040\040 Sega Mega CD disc image 2442dc4dbb9SEitan Adler!:mime application/x-sega-cd-rom 2453e41d09dSXin LI>0 use sega-mega-drive-header 2463e41d09dSXin LI>0 byte x \b, 2048-byte sectors 2473e41d09dSXin LI# Sega Mega CD disc images: 2352-byte sectors. 248*ae316d1dSXin LI0x10 string SEGADISCSYSTEM\040\040 Sega Mega CD disc image 2492dc4dbb9SEitan Adler!:mime application/x-sega-cd-rom 2503e41d09dSXin LI>0x10 use sega-mega-drive-header 2513e41d09dSXin LI>0 byte x \b, 2352-byte sectors 252*ae316d1dSXin LI0x10 string SEGABOOTDISC\040\040\040\040 Sega Mega CD disc image 2532dc4dbb9SEitan Adler!:mime application/x-sega-cd-rom 2543e41d09dSXin LI>0x10 use sega-mega-drive-header 2553e41d09dSXin LI>0 byte x \b, 2352-byte sectors 2563e41d09dSXin LI 257a4d6d3b8SXin LI# Sega Mega Drive: Identify the system ID. 2583e41d09dSXin LI0x100 string SEGA 259*ae316d1dSXin LI>0x3C0 string MARS\040CHECK\040MODE Sega 32X ROM image 2602dc4dbb9SEitan Adler!:mime application/x-genesis-32x-rom 2613e41d09dSXin LI>>0 use sega-mega-drive-header 262*ae316d1dSXin LI>0x104 string \040PICO Sega Pico ROM image 2632dc4dbb9SEitan Adler!:mime application/x-sega-pico-rom 264a4d6d3b8SXin LI>>0 use sega-mega-drive-header 265*ae316d1dSXin LI>0x104 string TOYS\040PICO Sega Pico ROM image 266a4d6d3b8SXin LI!:mime application/x-sega-pico-rom 267a4d6d3b8SXin LI>>0 use sega-mega-drive-header 268*ae316d1dSXin LI>0x104 string \040TOYS\040PICO Sega Pico ROM image 269a4d6d3b8SXin LI!:mime application/x-sega-pico-rom 270a4d6d3b8SXin LI>>0 use sega-mega-drive-header 271*ae316d1dSXin LI>0x104 string \040IAC Sega Pico ROM image 272a4d6d3b8SXin LI!:mime application/x-sega-pico-rom 273a4d6d3b8SXin LI>>0 use sega-mega-drive-header 274*ae316d1dSXin LI>0x104 string \040TERA68K Sega Teradrive (68K) ROM image 275a4d6d3b8SXin LI!:mime application/x-sega-teradrive-rom 276a4d6d3b8SXin LI>>0 use sega-mega-drive-header 277*ae316d1dSXin LI>0x104 string \040TERA286 Sega Teradrive (286) ROM image 278a4d6d3b8SXin LI!:mime application/x-sega-teradrive-rom 279a4d6d3b8SXin LI>>0 use sega-mega-drive-header 280a4d6d3b8SXin LI>0x180 string BR Sega Mega CD Boot ROM image 2812dc4dbb9SEitan Adler!:mime application/x-genesis-rom 282a4d6d3b8SXin LI>>0 use sega-mega-drive-header 283a4d6d3b8SXin LI>0x104 default x Sega Mega Drive / Genesis ROM image 2842dc4dbb9SEitan Adler!:mime application/x-genesis-rom 285a4d6d3b8SXin LI>>0 use sega-mega-drive-header 286a4d6d3b8SXin LI 287a4d6d3b8SXin LI# Sega Mega Drive: Some ROMs have "SEGA" at 0x101, not 0x100. 288*ae316d1dSXin LI0x100 string \040SEGA Sega Mega Drive / Genesis ROM image 289a4d6d3b8SXin LI>0 use sega-mega-drive-header 290a4d6d3b8SXin LI 291a4d6d3b8SXin LI# Sega Pico ROMs that don't start with "SEGA". 292*ae316d1dSXin LI0x100 string SAMSUNG\040PICO Samsung Pico ROM image 293a4d6d3b8SXin LI!:mime application/x-sega-pico-rom 294a4d6d3b8SXin LI>0 use sega-mega-drive-header 295*ae316d1dSXin LI0x100 string IMA\040IKUNOUJYUKU Samsung Pico ROM image 296a4d6d3b8SXin LI!:mime application/x-sega-pico-rom 297a4d6d3b8SXin LI>0 use sega-mega-drive-header 298*ae316d1dSXin LI0x100 string IMA\040IKUNOJYUKU Samsung Pico ROM image 299a4d6d3b8SXin LI!:mime application/x-sega-pico-rom 300a4d6d3b8SXin LI>0 use sega-mega-drive-header 301a4d6d3b8SXin LI 302a4d6d3b8SXin LI# Sega Picture Magic (modified 32X) 303*ae316d1dSXin LI0x100 string Picture\040Magic 304*ae316d1dSXin LI>0x3C0 string PICTURE\040MAGIC-01 Sega 32X ROM image 305a4d6d3b8SXin LI!:mime application/x-genesis-32x-rom 306a4d6d3b8SXin LI>>0 use sega-mega-drive-header 307b6cee71dSXin LI 308b6cee71dSXin LI#------------------------------------------------------------------------------ 309b6cee71dSXin LI# genesis: file(1) magic for the Super MegaDrive ROM dump format 310b6cee71dSXin LI# 3113e41d09dSXin LI 3123e41d09dSXin LI# NOTE: Due to interleaving, we can't display anything 3133e41d09dSXin LI# other than the copier header information. 3143e41d09dSXin LI0 name sega-genesis-smd-header 315b6cee71dSXin LI>0 byte x %dx16k blocks 316b6cee71dSXin LI>2 byte 0 \b, last in series or standalone 317b6cee71dSXin LI>2 byte >0 \b, split ROM 3183e41d09dSXin LI 3193e41d09dSXin LI# "Sega Genesis" header. 3203e41d09dSXin LI0x280 string EAGN 3213e41d09dSXin LI>8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format): 3222dc4dbb9SEitan Adler!:mime application/x-genesis-rom 3233e41d09dSXin LI>>0 use sega-genesis-smd-header 3243e41d09dSXin LI 3253e41d09dSXin LI# "Sega Mega Drive" header. 3263e41d09dSXin LI0x280 string EAMG 3273e41d09dSXin LI>8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format): 3282dc4dbb9SEitan Adler!:mime application/x-genesis-rom 3293e41d09dSXin LI>>0 use sega-genesis-smd-header 330b6cee71dSXin LI 331b6cee71dSXin LI#------------------------------------------------------------------------------ 3323e41d09dSXin LI# smsgg: file(1) magic for Sega Master System and Game Gear ROM images 3333e41d09dSXin LI# Detects all Game Gear and export Sega Master System ROM images, 3343e41d09dSXin LI# and some Japanese Sega Master System ROM images. 3353e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 33648c779cdSXin LI# Reference: https://www.smspower.org/Development/ROMHeader 337b6cee71dSXin LI# 3383e41d09dSXin LI 3393e41d09dSXin LI# General SMS header rule. 3403e41d09dSXin LI# The SMS boot ROM checks the header at three locations. 3413e41d09dSXin LI0 name sega-master-system-rom-header 3423e41d09dSXin LI# Machine type. 343*ae316d1dSXin LI>0x0F ubyte&0xF0 0x30 Sega Master System 3442dc4dbb9SEitan Adler!:mime application/x-sms-rom 345*ae316d1dSXin LI>0x0F ubyte&0xF0 0x40 Sega Master System 3462dc4dbb9SEitan Adler!:mime application/x-sms-rom 347*ae316d1dSXin LI>0x0F ubyte&0xF0 0x50 Sega Game Gear 3482dc4dbb9SEitan Adler!:mime application/x-gamegear-rom 349*ae316d1dSXin LI>0x0F ubyte&0xF0 0x60 Sega Game Gear 3502dc4dbb9SEitan Adler!:mime application/x-gamegear-rom 351*ae316d1dSXin LI>0x0F ubyte&0xF0 0x70 Sega Game Gear 3522dc4dbb9SEitan Adler!:mime application/x-gamegear-rom 3532dc4dbb9SEitan Adler>0x0F default x Sega Master System / Game Gear 3542dc4dbb9SEitan Adler!:mime application/x-sms-rom 3553e41d09dSXin LI>0 byte x ROM image: 3563e41d09dSXin LI# Product code. 357*ae316d1dSXin LI>0x0E ubyte&0xF0 0x10 1 358*ae316d1dSXin LI>0x0E ubyte&0xF0 0x20 2 359*ae316d1dSXin LI>0x0E ubyte&0xF0 0x30 3 360*ae316d1dSXin LI>0x0E ubyte&0xF0 0x40 4 361*ae316d1dSXin LI>0x0E ubyte&0xF0 0x50 5 362*ae316d1dSXin LI>0x0E ubyte&0xF0 0x60 6 363*ae316d1dSXin LI>0x0E ubyte&0xF0 0x70 7 364*ae316d1dSXin LI>0x0E ubyte&0xF0 0x80 8 365*ae316d1dSXin LI>0x0E ubyte&0xF0 0x90 9 366*ae316d1dSXin LI>0x0E ubyte&0xF0 0xA0 10 367*ae316d1dSXin LI>0x0E ubyte&0xF0 0xB0 11 368*ae316d1dSXin LI>0x0E ubyte&0xF0 0xC0 12 369*ae316d1dSXin LI>0x0E ubyte&0xF0 0xD0 13 370*ae316d1dSXin LI>0x0E ubyte&0xF0 0xE0 14 371*ae316d1dSXin LI>0x0E ubyte&0xF0 0xF0 15 3723e41d09dSXin LI# If the product code is 5 digits, we'll need to backspace here. 373*ae316d1dSXin LI>0x0E ubyte&0xF0 !0 374*ae316d1dSXin LI>>0x0C uleshort x \b%04x 375*ae316d1dSXin LI>0x0E ubyte&0xF0 0 376*ae316d1dSXin LI>>0x0C uleshort x %04x 3773e41d09dSXin LI# Revision. 378*ae316d1dSXin LI>0x0E ubyte&0x0F x (Rev.%02d) 3793e41d09dSXin LI# ROM size. (Used for the boot ROM checksum routine.) 380*ae316d1dSXin LI>0x0F ubyte&0x0F 0x0A (8 KB) 381*ae316d1dSXin LI>0x0F ubyte&0x0F 0x0B (16 KB) 382*ae316d1dSXin LI>0x0F ubyte&0x0F 0x0C (32 KB) 383*ae316d1dSXin LI>0x0F ubyte&0x0F 0x0D (48 KB) 384*ae316d1dSXin LI>0x0F ubyte&0x0F 0x0E (64 KB) 385*ae316d1dSXin LI>0x0F ubyte&0x0F 0x0F (128 KB) 386*ae316d1dSXin LI>0x0F ubyte&0x0F 0x00 (256 KB) 387*ae316d1dSXin LI>0x0F ubyte&0x0F 0x01 (512 KB) 388*ae316d1dSXin LI>0x0F ubyte&0x0F 0x02 (1 MB) 3893e41d09dSXin LI 3903e41d09dSXin LI# SMS/GG header locations. 391*ae316d1dSXin LI0x7FF0 string TMR\040SEGA 3923e41d09dSXin LI>0x7FF0 use sega-master-system-rom-header 393*ae316d1dSXin LI0x3FF0 string TMR\040SEGA 3943e41d09dSXin LI>0x3FF0 use sega-master-system-rom-header 395*ae316d1dSXin LI0x1FF0 string TMR\040SEGA 3963e41d09dSXin LI>0x1FF0 use sega-master-system-rom-header 397b6cee71dSXin LI 398b6cee71dSXin LI#------------------------------------------------------------------------------ 3993e41d09dSXin LI# saturn: file(1) magic for the Sega Saturn disc image format. 4003e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 401b6cee71dSXin LI# 4023e41d09dSXin LI 4033e41d09dSXin LI# Common Sega Saturn disc header format. 4043e41d09dSXin LI# NOTE: Title is 112 bytes, but we're only showing 32 due to space padding. 4053e41d09dSXin LI# TODO: Release date, device information, region code, others? 4063e41d09dSXin LI0 name sega-saturn-disc-header 4073e41d09dSXin LI>0x60 string >\0 \b: "%.32s" 4083e41d09dSXin LI>0x20 string >\0 (%.10s 4093e41d09dSXin LI>>0x2A string >\0 \b, %.6s) 4103e41d09dSXin LI>>0x2A byte 0 \b) 4113e41d09dSXin LI 4123e41d09dSXin LI# 2048-byte sector version. 413*ae316d1dSXin LI0 string SEGA\040SEGASATURN\040 Sega Saturn disc image 4142dc4dbb9SEitan Adler!:mime application/x-saturn-rom 4153e41d09dSXin LI>0 use sega-saturn-disc-header 4163e41d09dSXin LI>0 byte x (2048-byte sectors) 4173e41d09dSXin LI# 2352-byte sector version. 418*ae316d1dSXin LI0x10 string SEGA\040SEGASATURN\040 Sega Saturn disc image 4192dc4dbb9SEitan Adler!:mime application/x-saturn-rom 4203e41d09dSXin LI>0x10 use sega-saturn-disc-header 4213e41d09dSXin LI>0 byte x (2352-byte sectors) 4223e41d09dSXin LI 4233e41d09dSXin LI#------------------------------------------------------------------------------ 4243e41d09dSXin LI# dreamcast: file(1) magic for the Sega Dreamcast disc image format. 4253e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 42648c779cdSXin LI# Reference: https://mc.pp.se/dc/ip0000.bin.html 427b6cee71dSXin LI# 4283e41d09dSXin LI 4293e41d09dSXin LI# Common Sega Dreamcast disc header format. 4303e41d09dSXin LI# NOTE: Title is 128 bytes, but we're only showing 32 due to space padding. 4313e41d09dSXin LI# TODO: Release date, device information, region code, others? 4323e41d09dSXin LI0 name sega-dreamcast-disc-header 4333e41d09dSXin LI>0x80 string >\0 \b: "%.32s" 4343e41d09dSXin LI>0x40 string >\0 (%.10s 4353e41d09dSXin LI>>0x4A string >\0 \b, %.6s) 4363e41d09dSXin LI>>0x4A byte 0 \b) 4373e41d09dSXin LI 4383e41d09dSXin LI# 2048-byte sector version. 439*ae316d1dSXin LI0 string SEGA\040SEGAKATANA\040 Sega Dreamcast disc image 4402dc4dbb9SEitan Adler!:mime application/x-dc-rom 4413e41d09dSXin LI>0 use sega-dreamcast-disc-header 4423e41d09dSXin LI>0 byte x (2048-byte sectors) 4433e41d09dSXin LI# 2352-byte sector version. 444*ae316d1dSXin LI0x10 string SEGA\040SEGAKATANA\040 Sega Dreamcast disc image 4452dc4dbb9SEitan Adler!:mime application/x-dc-rom 4463e41d09dSXin LI>0x10 use sega-dreamcast-disc-header 4473e41d09dSXin LI>0 byte x (2352-byte sectors) 448b6cee71dSXin LI 449b6cee71dSXin LI#------------------------------------------------------------------------------ 450b6cee71dSXin LI# dreamcast: file(1) uncertain magic for the Sega Dreamcast VMU image format 451b6cee71dSXin LI# 452b6cee71dSXin LI0 belong 0x21068028 Sega Dreamcast VMU game image 453b6cee71dSXin LI0 string LCDi Dream Animator file 454b6cee71dSXin LI 455b6cee71dSXin LI#------------------------------------------------------------------------------ 4563e41d09dSXin LI# z64: file(1) magic for the Z64 format N64 ROM dumps 4573e41d09dSXin LI# Reference: http://forum.pj64-emu.com/showthread.php?t=2239 4583e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 459b6cee71dSXin LI# 4603e41d09dSXin LI0 bequad 0x803712400000000F Nintendo 64 ROM image 4612dc4dbb9SEitan Adler!:mime application/x-n64-rom 4623e41d09dSXin LI>0x20 string >\0 \b: "%.20s" 4633e41d09dSXin LI>0x3B string x (%.4s 4643e41d09dSXin LI>0x3F byte x \b, Rev.%02u) 465b6cee71dSXin LI 4663e41d09dSXin LI#------------------------------------------------------------------------------ 4673e41d09dSXin LI# v64: file(1) magic for the V64 format N64 ROM dumps 4683e41d09dSXin LI# Same as z64 format, but with 16-bit byteswapping. 4693e41d09dSXin LI# 4703e41d09dSXin LI0 bequad 0x3780401200000F00 Nintendo 64 ROM image (V64) 4712dc4dbb9SEitan Adler!:mime application/x-n64-rom 4723e41d09dSXin LI 4733e41d09dSXin LI#------------------------------------------------------------------------------ 4743e41d09dSXin LI# n64-swap2: file(1) magic for the swap2 format N64 ROM dumps 4753e41d09dSXin LI# Same as z64 format, but with swapped 16-bit words. 4763e41d09dSXin LI# 4773e41d09dSXin LI0 bequad 0x12408037000F0000 Nintendo 64 ROM image (wordswapped) 4782dc4dbb9SEitan Adler!:mime application/x-n64-rom 4793e41d09dSXin LI 4803e41d09dSXin LI#------------------------------------------------------------------------------ 4813e41d09dSXin LI# n64-le32: file(1) magic for the 32-bit byteswapped format N64 ROM dumps 4823e41d09dSXin LI# Same as z64 format, but with 32-bit byteswapping. 4833e41d09dSXin LI# 4843e41d09dSXin LI0 bequad 0x401237800F000000 Nintendo 64 ROM image (32-bit byteswapped) 4852dc4dbb9SEitan Adler!:mime application/x-n64-rom 4863e41d09dSXin LI 4873e41d09dSXin LI#------------------------------------------------------------------------------ 4883e41d09dSXin LI# gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format 48948c779cdSXin LI# Reference: https://problemkaputt.de/gbatek.htm#gbacartridgeheader 4903e41d09dSXin LI# 4913e41d09dSXin LI# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com> 4923e41d09dSXin LI# Updated version from: David Korth <gerbilsoft@gerbilsoft.com> 4933e41d09dSXin LI# 4943e41d09dSXin LI4 bequad 0x24FFAE51699AA221 Game Boy Advance ROM image 4952dc4dbb9SEitan Adler!:mime application/x-gba-rom 4963e41d09dSXin LI>0xA0 string >\0 \b: "%.12s" 4973e41d09dSXin LI>0xAC string x (%.6s 4983e41d09dSXin LI>0xBC byte x \b, Rev.%02u) 4993e41d09dSXin LI 5003e41d09dSXin LI#------------------------------------------------------------------------------ 5013e41d09dSXin LI# nds: file(1) magic for the Nintendo DS(i) raw ROM format 50248c779cdSXin LI# Reference: https://problemkaputt.de/gbatek.htm#dscartridgeheader 5033e41d09dSXin LI# 5043e41d09dSXin LI# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com> 5053e41d09dSXin LI# Updated version from: David Korth <gerbilsoft@gerbilsoft.com> 5063e41d09dSXin LI# 5073e41d09dSXin LI0xC0 bequad 0x24FFAE51699AA221 Nintendo DS ROM image 5082dc4dbb9SEitan Adler!:mime application/x-nintendo-ds-rom 5093e41d09dSXin LI>0x00 string >\0 \b: "%.12s" 5103e41d09dSXin LI>0x0C string x (%.6s 5113e41d09dSXin LI>0x1E byte x \b, Rev.%02u) 5123e41d09dSXin LI>0x12 byte 2 (DSi enhanced) 5133e41d09dSXin LI>0x12 byte 3 (DSi only) 51440427ccaSGordon Tetlow# Secure Area check. 51540427ccaSGordon Tetlow>0x20 lelong <0x4000 (homebrew) 51640427ccaSGordon Tetlow>0x20 lelong >0x3FFF 51740427ccaSGordon Tetlow>>0x4000 lequad 0x0000000000000000 (multiboot) 51840427ccaSGordon Tetlow>>0x4000 lequad !0x0000000000000000 51940427ccaSGordon Tetlow>>>0x4000 lequad 0xE7FFDEFFE7FFDEFF (decrypted) 52040427ccaSGordon Tetlow>>>0x4000 lequad !0xE7FFDEFFE7FFDEFF 52140427ccaSGordon Tetlow>>>>0x1000 lequad 0x0000000000000000 (encrypted) 52240427ccaSGordon Tetlow>>>>0x1000 lequad !0x0000000000000000 (mask ROM) 5233e41d09dSXin LI 5243e41d09dSXin LI#------------------------------------------------------------------------------ 5253e41d09dSXin LI# nds_passme: file(1) magic for Nintendo DS ROM images for GBA cartridge boot. 5263e41d09dSXin LI# This is also used for loading .nds files using the MSET exploit on 3DS. 5273e41d09dSXin LI# Reference: https://github.com/devkitPro/ndstool/blob/master/source/ndscreate.cpp 5283e41d09dSXin LI0xC0 bequad 0xC8604FE201708FE2 Nintendo DS Slot-2 ROM image (PassMe) 5292dc4dbb9SEitan Adler!:mime application/x-nintendo-ds-rom 5303e41d09dSXin LI 5313e41d09dSXin LI#------------------------------------------------------------------------------ 5323e41d09dSXin LI# ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format. 5333e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 5343e41d09dSXin LI# References: 5353e41d09dSXin LI# - https://neogpc.googlecode.com/svn-history/r10/trunk/src/core/neogpc.cpp 53648c779cdSXin LI# - https://www.devrs.com/ngp/files/ngpctech.txt 5373e41d09dSXin LI# 538*ae316d1dSXin LI0x0A string BY\040SNK\040CORPORATION Neo Geo Pocket 5392dc4dbb9SEitan Adler!:mime application/x-neo-geo-pocket-rom 5403e41d09dSXin LI>0x23 byte 0x10 Color 5413e41d09dSXin LI>0 byte x ROM image 5423e41d09dSXin LI>0x24 string >\0 \b: "%.12s" 543a4d6d3b8SXin LI>0x21 uleshort x \b, NEOP%04X 544a4d6d3b8SXin LI>0x1F ubyte 0xFF (debug mode enabled) 545b6cee71dSXin LI 546b6cee71dSXin LI#------------------------------------------------------------------------------ 547b6cee71dSXin LI# msx: file(1) magic for MSX game cartridge dumps 548b6cee71dSXin LI# Too simple - MPi 549b6cee71dSXin LI#0 beshort 0x4142 MSX game cartridge dump 550b6cee71dSXin LI 551b6cee71dSXin LI#------------------------------------------------------------------------------ 552b6cee71dSXin LI# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) : 553*ae316d1dSXin LI0 string PS-X\040EXE Sony Playstation executable 55443a5ec4eSXin LI>16 lelong x PC=%#08x, 55543a5ec4eSXin LI>20 lelong !0 GP=%#08x, 55643a5ec4eSXin LI>24 lelong !0 .text=[%#08x, 55743a5ec4eSXin LI>>28 lelong x \b%#x], 55843a5ec4eSXin LI>32 lelong !0 .data=[%#08x, 55943a5ec4eSXin LI>>36 lelong x \b%#x], 56043a5ec4eSXin LI>40 lelong !0 .bss=[%#08x, 56143a5ec4eSXin LI>>44 lelong x \b%#x], 56243a5ec4eSXin LI>48 lelong !0 Stack=%#08x, 5633e41d09dSXin LI>48 lelong =0 No Stack!, 56443a5ec4eSXin LI>52 lelong !0 StackSize=%#x, 5653e41d09dSXin LI#>76 string >\0 (%s) 566b6cee71dSXin LI# Area: 567b6cee71dSXin LI>113 string x (%s) 568b6cee71dSXin LI 5693e41d09dSXin LI# CPE executables 5703e41d09dSXin LI0 string CPE CPE executable 5713e41d09dSXin LI>3 byte x (version %d) 5723e41d09dSXin LI 573898496eeSXin LI# Sony PlayStation archive (PSARC) 574898496eeSXin LI# From: Alexandre Iooss <erdnaxe@crans.org> 575898496eeSXin LI# URL: https://www.psdevwiki.com/ps3/PlayStation_archive_(PSARC) 576898496eeSXin LI0 string PSAR Sony PlayStation Archive 577898496eeSXin LI!:ext psarc 578898496eeSXin LI>4 ubeshort x \b, version %d. 579898496eeSXin LI>6 ubeshort x \b%d 580898496eeSXin LI>8 string zlib \b, zlib compression 581898496eeSXin LI>8 string lzma \b, LZMA compression 582898496eeSXin LI>28 ubeshort&2 0 \b, relative paths 583898496eeSXin LI>28 ubeshort&2 2 \b, absolute paths 584898496eeSXin LI>28 ubeshort&1 1 \b, ignore case 585898496eeSXin LI 586b6cee71dSXin LI#------------------------------------------------------------------------------ 587b6cee71dSXin LI# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>) 58848c779cdSXin LI0 string XBEH Microsoft Xbox executable 589d38c30c0SXin LI!:mime audio/x-xbox-executable 590d38c30c0SXin LI!:ext xbe 59148c779cdSXin LI# expect base address of 0x10000 59248c779cdSXin LI>0x0104 ulelong =0x10000 59348c779cdSXin LI>>(0x0118.l-0x0FFF4) lestring16 x \b: "%.40s" 59448c779cdSXin LI>>(0x0118.l-0x0FFF5) byte x (%c 59548c779cdSXin LI>>(0x0118.l-0x0FFF6) byte x \b%c- 59648c779cdSXin LI>>(0x0118.l-0x0FFF8) uleshort x \b%03u) 59748c779cdSXin LI>>(0x0118.l-0x0FF60) ulelong&0x80000007 0x80000007 \b, all regions 59848c779cdSXin LI>>(0x0118.l-0x0FF60) ulelong&0x80000007 !0x80000007 59948c779cdSXin LI>>>(0x0118.l-0x0FF60) ulelong >0 (regions: 60048c779cdSXin LI>>>>(0x0118.l-0x0FF60) ulelong &0x00000001 NA 60148c779cdSXin LI>>>>(0x0118.l-0x0FF60) ulelong &0x00000002 Japan 60248c779cdSXin LI>>>>(0x0118.l-0x0FF60) ulelong &0x00000004 Rest_of_World 60348c779cdSXin LI>>>>(0x0118.l-0x0FF60) ulelong &0x80000000 Manufacturer 60448c779cdSXin LI>>>(0x0118.l-0x0FF60) ulelong >0 \b) 605b6cee71dSXin LI# probabilistic checks whether signed or not 606b6cee71dSXin LI>0x0004 ulelong =0x0 607b6cee71dSXin LI>>&2 ulelong =0x0 608b6cee71dSXin LI>>>&2 ulelong =0x0 \b, not signed 609b6cee71dSXin LI>0x0004 ulelong >0 610b6cee71dSXin LI>>&2 ulelong >0 611b6cee71dSXin LI>>>&2 ulelong >0 \b, signed 612b6cee71dSXin LI 613b6cee71dSXin LI# -------------------------------- 614b6cee71dSXin LI# Microsoft Xbox data file formats 615b6cee71dSXin LI0 string XIP0 XIP, Microsoft Xbox data 616b6cee71dSXin LI0 string XTF0 XTF, Microsoft Xbox data 617b6cee71dSXin LI 61848c779cdSXin LI#------------------------------------------------------------------------------ 61948c779cdSXin LI# Microsoft Xbox 360 executables (.xex) 62048c779cdSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 62148c779cdSXin LI# References: 62248c779cdSXin LI# - https://free60project.github.io/wiki/XEX.html 62348c779cdSXin LI# - https://github.com/xenia-project/xenia/blob/HEAD/src/xenia/kernel/util/xex2_info.h 62448c779cdSXin LI 62548c779cdSXin LI# Title ID (part of Execution ID section) 62648c779cdSXin LI0 name xbox-360-xex-execution-id 62748c779cdSXin LI>(0.L+0xC) byte x (%c 62848c779cdSXin LI>(0.L+0xD) byte x \b%c 629d38c30c0SXin LI>(0.L+0xE) beshort x \b-%04u, media ID: 630d38c30c0SXin LI>(0.L) belong x %08X) 631d38c30c0SXin LI 632d38c30c0SXin LI# Region code (part of Security Info) 633d38c30c0SXin LI0 name xbox-360-xex-region-code 634d38c30c0SXin LI>0 ubelong 0xFFFFFFFF \b, all regions 635d38c30c0SXin LI>0 ubelong !0xFFFFFFFF 636d38c30c0SXin LI>>0 ubelong >0 (regions: 637d38c30c0SXin LI>>0 ubelong&0x000000FF 0x000000FF USA 638d38c30c0SXin LI>>0 ubelong&0x00000100 0x00000100 Japan 639d38c30c0SXin LI>>0 ubelong&0x00000200 0x00000200 China 640d38c30c0SXin LI>>0 ubelong&0x0000FC00 0x0000FC00 Asia 641d38c30c0SXin LI>>0 ubelong&0x00FF0000 0x00FF0000 PAL 642d38c30c0SXin LI>>0 ubelong&0x00FF0000 0x00FE0000 PAL [except AU/NZ] 643d38c30c0SXin LI>>0 ubelong&0x00FF0000 0x00010000 AU/NZ 644d38c30c0SXin LI>>0 ubelong&0xFF000000 0xFF000000 Other 645d38c30c0SXin LI>>0 ubelong >0 \b) 64648c779cdSXin LI 64748c779cdSXin LI0 string XEX2 Microsoft Xbox 360 executable 648d38c30c0SXin LI!:mime audio/x-xbox360-executable 649d38c30c0SXin LI!:ext xex 65048c779cdSXin LI>0x18 search/0x100 \x00\x04\x00\x06 65148c779cdSXin LI>>&0 use xbox-360-xex-execution-id 652d38c30c0SXin LI>(0x010.L+0x178) use xbox-360-xex-region-code 65348c779cdSXin LI 654d38c30c0SXin LI0 string XEX1 Microsoft Xbox 360 executable (XEX1) 655d38c30c0SXin LI!:mime audio/x-xbox360-executable 656d38c30c0SXin LI!:ext xex 657d38c30c0SXin LI>0x18 search/0x100 \x00\x04\x00\x06 658d38c30c0SXin LI>>&0 use xbox-360-xex-execution-id 659d38c30c0SXin LI>(0x010.L+0x154) use xbox-360-xex-region-code 66048c779cdSXin LI 661d38c30c0SXin LI#------------------------------------------------------------------------------ 662d38c30c0SXin LI# Microsoft Xbox 360 packages 663d38c30c0SXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 664d38c30c0SXin LI# References: 665d38c30c0SXin LI# - https://free60project.github.io/wiki/STFS.html 666d38c30c0SXin LI# - https://github.com/xenia-project/xenia/blob/HEAD/src/xenia/kernel/util/xex2_info.h 667d38c30c0SXin LI 668d38c30c0SXin LI# TODO: More information for console-signed packages. 669d38c30c0SXin LI 670d38c30c0SXin LI0 name xbox-360-package 671d38c30c0SXin LI>0x360 byte x (%c 672d38c30c0SXin LI>0x361 byte x \b%c 673d38c30c0SXin LI>0x362 beshort x \b-%04u, media ID: 674d38c30c0SXin LI>0x354 belong x %08X) 675d38c30c0SXin LI>0x344 belong x \b, content type: 676d38c30c0SXin LI>>0x344 belong 0x1 Saved Game 677d38c30c0SXin LI>>0x344 belong 0x2 Marketplace Content 678d38c30c0SXin LI>>0x344 belong 0x3 Publisher 679d38c30c0SXin LI>>0x344 belong 0x1000 Xbox 360 Title 680d38c30c0SXin LI>>0x344 belong 0x2000 IPTV Pause Buffer 681d38c30c0SXin LI>>0x344 belong 0x4000 Installed Game 682d38c30c0SXin LI>>0x344 belong 0x5000 Original Xbox Game 683d38c30c0SXin LI>>0x344 belong 0x9000 Avatar Item 684d38c30c0SXin LI>>0x344 belong 0x10000 Profile 685d38c30c0SXin LI>>0x344 belong 0x20000 Gamer Picture 686d38c30c0SXin LI>>0x344 belong 0x30000 Theme 687d38c30c0SXin LI>>0x344 belong 0x40000 Cache File 688d38c30c0SXin LI>>0x344 belong 0x50000 Storage Download 689d38c30c0SXin LI>>0x344 belong 0x60000 Xbox Saved Game 690d38c30c0SXin LI>>0x344 belong 0x70000 Xbox Download 691d38c30c0SXin LI>>0x344 belong 0x80000 Game Demo 692d38c30c0SXin LI>>0x344 belong 0x90000 Video 693d38c30c0SXin LI>>0x344 belong 0xA0000 Game 694d38c30c0SXin LI>>0x344 belong 0xB0000 Installer 695d38c30c0SXin LI>>0x344 belong 0xC0000 Game Trailer 696d38c30c0SXin LI>>0x344 belong 0xD0000 Arcade Title 697d38c30c0SXin LI>>0x344 belong 0xE0000 XNA 698d38c30c0SXin LI>>0x344 belong 0xF0000 License Store 699d38c30c0SXin LI>>0x344 belong 0x100000 Movie 700d38c30c0SXin LI>>0x344 belong 0x200000 TV 701d38c30c0SXin LI>>0x344 belong 0x300000 Music Video 702d38c30c0SXin LI>>0x344 belong 0x400000 Game Video 703d38c30c0SXin LI>>0x344 belong 0x500000 Podcast Video 704d38c30c0SXin LI>>0x344 belong 0x600000 Viral Video 705d38c30c0SXin LI>>0x344 belong 0x2000000 Community Game 706d38c30c0SXin LI 707d38c30c0SXin LI0 string CON\x20 Microsoft Xbox 360 package (console-signed) 708d38c30c0SXin LI>0 use xbox-360-package 7092726a701SXin LI0 string PIRS 7102726a701SXin LI>0 belong 0 Microsoft Xbox 360 package (non-Xbox Live) 7112726a701SXin LI>>0 use xbox-360-package 7122726a701SXin LI0 string LIVE 7132726a701SXin LI>0x104 belong 0 Microsoft Xbox 360 package (Xbox Live) 7142726a701SXin LI>>0 use xbox-360-package 71548c779cdSXin LI 716b6cee71dSXin LI# Atari Lynx cartridge dump (EXE/BLL header) 717a4d6d3b8SXin LI# From: "Stefan A. Haubenthal" <polluks@sdf.lonestar.org> 718a4d6d3b8SXin LI# Reference: 719a4d6d3b8SXin LI# https://raw.githubusercontent.com/cc65/cc65/master/libsrc/lynx/exehdr.s 720b6cee71dSXin LI# Double-check that the image type matches too, 0x8008 conflicts with 721b6cee71dSXin LI# 8 character OMF-86 object file headers. 722b6cee71dSXin LI0 beshort 0x8008 723b6cee71dSXin LI>6 string BS93 Lynx homebrew cartridge 7242dc4dbb9SEitan Adler!:mime application/x-atari-lynx-rom 725b6cee71dSXin LI>>2 beshort x \b, RAM start $%04x 726898496eeSXin LI# Update: Joerg Jenderek 727898496eeSXin LI# Reference: http://mark0.net/download/triddefs_xml.7z/defs/l/lnx.trid.xml 728898496eeSXin LI# Note: called "Atari Lynx ROM" by TrID 729a4d6d3b8SXin LI0 string LYNX Lynx cartridge 7302dc4dbb9SEitan Adler!:mime application/x-atari-lynx-rom 731898496eeSXin LI!:ext lnx 732898496eeSXin LI# bank 0 page size like: 128 256 512 733a4d6d3b8SXin LI>4 leshort/4 >0 \b, bank 0 %dk 734a4d6d3b8SXin LI>6 leshort/4 >0 \b, bank 1 %dk 735898496eeSXin LI# 32 bytes cart name like: "jconnort.lyx" "viking~1.lyx" "Eye of the Beholder" "C:\EMU\LYNX\ROMS\ULTCHESS.LYX" 736a4d6d3b8SXin LI>10 string >\0 \b, "%.32s" 737898496eeSXin LI# 16 bytes manufacturer like: "Atari" "NuFX Inc." "Matthias Domin" 738a4d6d3b8SXin LI>42 string >\0 \b, "%.16s" 739898496eeSXin LI# version number 740898496eeSXin LI#>8 leshort !1 \b, version number %u 741898496eeSXin LI# rotation: 1~left Lexis (NA).lnx 2~right Centipede (Prototype).lnx 742898496eeSXin LI>58 ubyte >0 \b, rotation %u 743898496eeSXin LI# spare 744898496eeSXin LI#>59 lelong !0 \b, spare %#x 745b6cee71dSXin LI 746b6cee71dSXin LI# Opera file system that is used on the 3DO console 747b6cee71dSXin LI# From: Serge van den Boom <svdb@stack.nl> 748b6cee71dSXin LI0 string \x01ZZZZZ\x01 3DO "Opera" file system 749b6cee71dSXin LI 75058a0f0d0SEitan Adler# From: Alex Myczko <alex@aiei.ch> 7515f0216bdSXin LI# From: David Pflug <david@pflug.email> 752*ae316d1dSXin LI# Update: Joerg Jenderek 753*ae316d1dSXin LI# URL: http://fileformats.archiveteam.org/wiki/Game_Boy_Sound 754*ae316d1dSXin LI# http://en.wikipedia.org/wiki/Game_Boy_Sound_System 755*ae316d1dSXin LI# Reference: http://mark0.net/download/triddefs_xml.7z/defs/g/gbs.trid.xml 756*ae316d1dSXin LI# Note: called "GameBoy Sound System dump" by TrID, 757*ae316d1dSXin LI# "Gameboy GBS rom image" by X11 Gameboy sound player xgbsplay and 758*ae316d1dSXin LI# verified by gbsplay `LANG=C gbsinfo /usr/share/doc/gbsplay/examples/nightmode.gbs` 7595f0216bdSXin LI# is the offset 12 or the offset 16 correct? 7605f0216bdSXin LI# GBS (Game Boy Sound) magic 761*ae316d1dSXin LI# http://ftp.modland.com/pub/documents/format_documentation/\ 7625f0216bdSXin LI# Gameboy%20Sound%20System%20(.gbs).txt 763*ae316d1dSXin LI# skip Grand Theft Auto 2 Style data (*.sty via sty-gta2.trid.xml) and Opera (*.patch) by check for valid "low" version 764*ae316d1dSXin LI0 string GBS\001 Nintendo Gameboy Music/Audio Data 765*ae316d1dSXin LI!:mime audio/x-nintendo-gbs 766*ae316d1dSXin LI# by gbsplay or xgbsplay tools 767*ae316d1dSXin LI#!:mime audio/gbs 768*ae316d1dSXin LI#!:mime audio/prs.gbs 769*ae316d1dSXin LI!:ext gbs 770*ae316d1dSXin LI# fields are right null-filled; no terminating \0 if all bytes are used; if field unknown, should be set to a single ? 771*ae316d1dSXin LI# title string like: "Blues Brothers" "Bugs Bunny Crazy Castle 3" 772*ae316d1dSXin LI#12 string GameBoy\040Music\040Module Nintendo Gameboy Music Module 7732dc4dbb9SEitan Adler>16 string >\0 ("%.32s" by 774*ae316d1dSXin LI# author string like: <?>, by Laxity, Justin Muir, 1993 Ocean 7752dc4dbb9SEitan Adler>48 string >\0 %.32s, copyright 776*ae316d1dSXin LI# copyright string like: empty "1991 Titus" "2001 Imagineer/KT.Kodansha/P&B" "2000 Newline, Ubisoft, D. Eclip." 777*ae316d1dSXin LI>80 string >\0 %.32s 778*ae316d1dSXin LI# GBSVersion; 1 779*ae316d1dSXin LI#>3 byte !1 version %u, 780*ae316d1dSXin LI# number of songs (1-255) 781*ae316d1dSXin LI>4 ubyte x \b), %u track 782*ae316d1dSXin LI# plural s 783*ae316d1dSXin LI>4 ubyte >1 \bs 784*ae316d1dSXin LI# default subsong; like: 1 (often) 2 29 60 79 82 785*ae316d1dSXin LI>5 ubyte !1 \b, %u first 786*ae316d1dSXin LI# load address (400h-7fffh) 787*ae316d1dSXin LI>6 uleshort x \b, load address %#4.4x 788*ae316d1dSXin LI# init address (400h-7fffh) 789*ae316d1dSXin LI>8 uleshort x \b, init address %#4.4x 790*ae316d1dSXin LI# play address (400-7fffh) 791*ae316d1dSXin LI>10 uleshort x \b, play address %#4.4x 792*ae316d1dSXin LI# stack pointer; like: FFFEh (default) CFFFh DCFEh DDFEh DDFFh DEFFh E000h FFF4h 793*ae316d1dSXin LI>12 uleshort x \b, stack pointer %#4.4x 794*ae316d1dSXin LI# timer modulo; often 0 795*ae316d1dSXin LI>14 ubyte !0 \b, timer modulo %#x 796*ae316d1dSXin LI# timer control; often 0 797*ae316d1dSXin LI>15 ubyte !0 \b, timer control %#x 798*ae316d1dSXin LI# code and Data (see RST VECTORS) 799*ae316d1dSXin LI#>0x70 ubequad x \b, data %#16.16llx... 800b6cee71dSXin LI 80140427ccaSGordon Tetlow# IPS Patch Files from: From: Thomas Klausner <tk@giga.or.at> 80248c779cdSXin LI# see https://zerosoft.zophar.net/ips.php 80340427ccaSGordon Tetlow0 string PATCH IPS patch file 8042726a701SXin LI!:ext ips 8052726a701SXin LI 8062726a701SXin LI# BPS Patch Files - from: David Korth <gerbilsoft@gerbilsoft.com> 8072726a701SXin LI# Reference: https://www.romhacking.net/documents/746/ 8082726a701SXin LI0 string BPS1 BPS patch file 8092726a701SXin LI!:ext bps 8102726a701SXin LI 8112726a701SXin LI# APS Patch Files - from: David Korth <gerbilsoft@gerbilsoft.com> 8122726a701SXin LI# Reference: https://github.com/btimofeev/UniPatcher/wiki/APS-(N64) 8132726a701SXin LI0 string APS10 APS patch file 8142726a701SXin LI!:ext aps 8152726a701SXin LI>5 byte 0 \b, simple patch 8162726a701SXin LI>5 byte 1 \b, N64-specific patch for 8172726a701SXin LI>>58 byte x N%c 8182726a701SXin LI>>59 byte x \b%c 8192726a701SXin LI>>60 byte x \b%c 8202726a701SXin LI>7 byte !0x20 8212726a701SXin LI# FIXME: /T specifier isn't working with a fixed-length string. 8222726a701SXin LI>>7 string x \b: "%.50s" 8232726a701SXin LI 8242726a701SXin LI# UPS Patch Files - from: David Korth <gerbilsoft@gerbilsoft.com> 8252726a701SXin LI# Reference: http://fileformats.archiveteam.org/wiki/UPS_(binary_patch_format) 8262726a701SXin LI0 string UPS1 UPS patch file 8272726a701SXin LI!:ext ups 82840427ccaSGordon Tetlow 829b6cee71dSXin LI# Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at> 830b6cee71dSXin LI0 string PPF30 Playstation Patch File version 3.0 831b6cee71dSXin LI>5 byte 0 \b, PPF 1.0 patch 832b6cee71dSXin LI>5 byte 1 \b, PPF 2.0 patch 833b6cee71dSXin LI>5 byte 2 \b, PPF 3.0 patch 834b6cee71dSXin LI>>56 byte 0 \b, Imagetype BIN (any) 835b6cee71dSXin LI>>56 byte 1 \b, Imagetype GI (PrimoDVD) 836b6cee71dSXin LI>>57 byte 0 \b, Blockcheck disabled 837b6cee71dSXin LI>>57 byte 1 \b, Blockcheck enabled 838b6cee71dSXin LI>>58 byte 0 \b, Undo data not available 839b6cee71dSXin LI>>58 byte 1 \b, Undo data available 840b6cee71dSXin LI>6 string x \b, description: %s 841b6cee71dSXin LI 842b6cee71dSXin LI0 string PPF20 Playstation Patch File version 2.0 843b6cee71dSXin LI>5 byte 0 \b, PPF 1.0 patch 844b6cee71dSXin LI>5 byte 1 \b, PPF 2.0 patch 845b6cee71dSXin LI>>56 lelong >0 \b, size of file to patch %d 846b6cee71dSXin LI>6 string x \b, description: %s 847b6cee71dSXin LI 848b6cee71dSXin LI0 string PPF10 Playstation Patch File version 1.0 849b6cee71dSXin LI>5 byte 0 \b, Simple Encoding 850b6cee71dSXin LI>6 string x \b, description: %s 851b6cee71dSXin LI 852898496eeSXin LI# Compressed ISO disc image (used mostly by PSP, PS2 and MegaDrive) 853898496eeSXin LI# From: Alexandre Iooss <erdnaxe@crans.org> 854898496eeSXin LI# URL: https://en.wikipedia.org/wiki/.CSO 855898496eeSXin LI# NOTE: This is NOT the same as Compact ISO or GameCube/Wii disc image, 856898496eeSXin LI# though it has the same magic number. 857898496eeSXin LI0 string CISO 858898496eeSXin LI# Match CISO version 1 with ISO-9660 sector size 859898496eeSXin LI>20 ubyte <2 860898496eeSXin LI>>16 ulelong =2048 CSO v1 disk image 861898496eeSXin LI!:mime application/x-compressed-iso 862898496eeSXin LI!:ext ciso/cso 863898496eeSXin LI>>>8 ulequad x \b, original size %llu bytes 864898496eeSXin LI>>>16 ulelong x \b, datablock size %u bytes 865898496eeSXin LI# Match CISO version 2 866898496eeSXin LI>20 ubyte =2 867898496eeSXin LI>>22 uleshort =0 868898496eeSXin LI>>>4 ulelong =24 CSO v2 disk image 869898496eeSXin LI!:mime application/x-compressed-iso 870898496eeSXin LI!:ext ciso/cso 871898496eeSXin LI>>>>8 ulequad x \b, original size %llu bytes 872898496eeSXin LI>>>>16 ulelong x \b, datablock size %u bytes 873*ae316d1dSXin LI# Type: Nintendo GameCube/Wii disc image (CISO format) 874*ae316d1dSXin LI# NOTE: This is NOT the same as Compact ISO or PSP CISO, 875*ae316d1dSXin LI# though it has the same magic number. 876*ae316d1dSXin LI# Other fields are used to determine what type of CISO this is: 877*ae316d1dSXin LI# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size) 878*ae316d1dSXin LI# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size) 879*ae316d1dSXin LI# - None of the above: Compact ISO. 880*ae316d1dSXin LI>4 lelong 0x200000 881*ae316d1dSXin LI>>8 byte 1 882*ae316d1dSXin LI>>>0x801C belong 0xC2339F3D Nintendo GameCube disc image (CISO format): 883*ae316d1dSXin LI!:mime application/x-wii-rom 884*ae316d1dSXin LI>>>>0x8000 use nintendo-gcn-disc-common 885*ae316d1dSXin LI>>>0x8018 belong 0x5D1C9EA3 Nintendo Wii disc image (CISO format): 886*ae316d1dSXin LI!:mime application/x-wii-rom 887*ae316d1dSXin LI>>>>0x8000 use nintendo-gcn-disc-common 888*ae316d1dSXin LI# .cso files 889*ae316d1dSXin LI# Reference: https://pismotec.com/ciso/ciso.h 890*ae316d1dSXin LI# NOTE: There are two other formats with the same magic but 891*ae316d1dSXin LI# completely incompatible specifications: 892*ae316d1dSXin LI# - GameCube/Wii CISO: https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/DiscIO/CISOBlob.h 893*ae316d1dSXin LI# - PSP CISO: https://github.com/jamie/ciso/blob/master/ciso.h 894*ae316d1dSXin LI# Other fields are used to determine what type of CISO this is: 895*ae316d1dSXin LI# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size) 896*ae316d1dSXin LI# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size) 897*ae316d1dSXin LI# - 0x10 == 0x00004000: For >2GB files using maxcso... 898*ae316d1dSXin LI# https://github.com/unknownbrackets/maxcso/issues/26 899*ae316d1dSXin LI# - None of the above: Compact ISO. 900*ae316d1dSXin LI>4 lelong !0 901*ae316d1dSXin LI>>4 lelong !0x200000 902*ae316d1dSXin LI>>>16 lelong !0x800 903*ae316d1dSXin LI>>>>16 lelong !0x4000 Compressed ISO CD image 904898496eeSXin LI 905b6cee71dSXin LI# From: Daniel Dawson <ddawson@icehouse.net> 906b6cee71dSXin LI# SNES9x .smv "movie" file format. 907b6cee71dSXin LI0 string SMV\x1A SNES9x input recording 908b6cee71dSXin LI>0x4 lelong x \b, version %d 909b6cee71dSXin LI# version 4 is latest so far 910b6cee71dSXin LI>0x4 lelong <5 911b6cee71dSXin LI>>0x8 ledate x \b, recorded at %s 912b6cee71dSXin LI>>0xc lelong >0 \b, rerecorded %d times 913b6cee71dSXin LI>>0x10 lelong x \b, %d frames long 914b6cee71dSXin LI>>0x14 byte >0 \b, data for controller(s): 915b6cee71dSXin LI>>>0x14 byte &0x1 #1 916b6cee71dSXin LI>>>0x14 byte &0x2 #2 917b6cee71dSXin LI>>>0x14 byte &0x4 #3 918b6cee71dSXin LI>>>0x14 byte &0x8 #4 919b6cee71dSXin LI>>>0x14 byte &0x10 #5 920b6cee71dSXin LI>>0x15 byte ^0x1 \b, begins from snapshot 921b6cee71dSXin LI>>0x15 byte &0x1 \b, begins from reset 922b6cee71dSXin LI>>0x15 byte ^0x2 \b, NTSC standard 923b6cee71dSXin LI>>0x15 byte &0x2 \b, PAL standard 924b6cee71dSXin LI>>0x17 byte &0x1 \b, settings: 925b6cee71dSXin LI# WIP1Timing not used as of version 4 926b6cee71dSXin LI>>>0x4 lelong <4 927b6cee71dSXin LI>>>>0x17 byte &0x2 WIP1Timing 928b6cee71dSXin LI>>>0x17 byte &0x4 Left+Right 929b6cee71dSXin LI>>>0x17 byte &0x8 VolumeEnvX 930b6cee71dSXin LI>>>0x17 byte &0x10 FakeMute 931b6cee71dSXin LI>>>0x17 byte &0x20 SyncSound 932b6cee71dSXin LI# New flag as of version 4 933b6cee71dSXin LI>>>0x4 lelong >3 934b6cee71dSXin LI>>>>0x17 byte &0x80 NoCPUShutdown 935b6cee71dSXin LI>>0x4 lelong <4 936b6cee71dSXin LI>>>0x18 lelong >0x23 937b6cee71dSXin LI>>>>0x20 leshort !0 938b6cee71dSXin LI>>>>>0x20 lestring16 x \b, metadata: "%s" 939b6cee71dSXin LI>>0x4 lelong >3 940b6cee71dSXin LI>>>0x24 byte >0 \b, port 1: 941b6cee71dSXin LI>>>>0x24 byte 1 joypad 942b6cee71dSXin LI>>>>0x24 byte 2 mouse 943b6cee71dSXin LI>>>>0x24 byte 3 SuperScope 944b6cee71dSXin LI>>>>0x24 byte 4 Justifier 945b6cee71dSXin LI>>>>0x24 byte 5 multitap 946b6cee71dSXin LI>>>0x24 byte >0 \b, port 2: 947b6cee71dSXin LI>>>>0x25 byte 1 joypad 948b6cee71dSXin LI>>>>0x25 byte 2 mouse 949b6cee71dSXin LI>>>>0x25 byte 3 SuperScope 950b6cee71dSXin LI>>>>0x25 byte 4 Justifier 951b6cee71dSXin LI>>>>0x25 byte 5 multitap 952b6cee71dSXin LI>>>0x18 lelong >0x43 953b6cee71dSXin LI>>>>0x40 leshort !0 954b6cee71dSXin LI>>>>>0x40 lestring16 x \b, metadata: "%s" 955b6cee71dSXin LI>>0x17 byte &0x40 \b, ROM: 95643a5ec4eSXin LI>>>(0x18.l-26) lelong x CRC32 %#08x 957b6cee71dSXin LI>>>(0x18.l-23) string x "%s" 958b6cee71dSXin LI 959b6cee71dSXin LI# Type: scummVM savegame files 960b6cee71dSXin LI# From: Sven Hartge <debian@ds9.argh.org> 961b6cee71dSXin LI0 string SCVM ScummVM savegame 962b6cee71dSXin LI>12 string >\0 "%s" 9633e41d09dSXin LI 9643e41d09dSXin LI#------------------------------------------------------------------------------ 9653e41d09dSXin LI# Nintendo GameCube / Wii file formats. 9663e41d09dSXin LI# 9673e41d09dSXin LI 9683e41d09dSXin LI# Type: Nintendo GameCube/Wii common disc header data. 9693e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 97048c779cdSXin LI# Reference: https://wiibrew.org/wiki/Wii_Disc 9713e41d09dSXin LI0 name nintendo-gcn-disc-common 9723e41d09dSXin LI>0x20 string x "%.64s" 9733e41d09dSXin LI>0x00 string x (%.6s 9743e41d09dSXin LI>0x06 byte >0 9753e41d09dSXin LI>>0x06 byte 1 \b, Disc 2 9763e41d09dSXin LI>>0x06 byte 2 \b, Disc 3 9773e41d09dSXin LI>>0x06 byte 3 \b, Disc 4 9783e41d09dSXin LI>0x07 byte x \b, Rev.%02u) 9792dc4dbb9SEitan Adler>0x18 belong 0x5D1C9EA3 9802dc4dbb9SEitan Adler>>0x60 beshort 0x0101 \b (Unencrypted) 9812726a701SXin LI>0x200 string NKIT \b (NKit compressed) 9822726a701SXin LI 9833e41d09dSXin LI 9843e41d09dSXin LI# Type: Nintendo GameCube disc image 9853e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 98648c779cdSXin LI# Reference: https://wiibrew.org/wiki/Wii_Disc 9873e41d09dSXin LI0x1C belong 0xC2339F3D Nintendo GameCube disc image: 9882dc4dbb9SEitan Adler!:mime application/x-gamecube-rom 9893e41d09dSXin LI>0 use nintendo-gcn-disc-common 9903e41d09dSXin LI 991282e23f0SXin LI# Type: Nintendo GameCube embedded disc image 992282e23f0SXin LI# Commonly found on demo discs. 993282e23f0SXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 994282e23f0SXin LI# Reference: http://hitmen.c02.at/files/yagcd/yagcd/index.html#idx14.8 995282e23f0SXin LI0 belong 0xAE0F38A2 996282e23f0SXin LI>0x0C belong 0x00100000 997282e23f0SXin LI>>(8.L+0x1C) belong 0xC2339F3D Nintendo GameCube embedded disc image: 9982dc4dbb9SEitan Adler!:mime application/x-gamecube-rom 999282e23f0SXin LI>>>(8.L) use nintendo-gcn-disc-common 1000282e23f0SXin LI 10013e41d09dSXin LI# Type: Nintendo Wii disc image 10023e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 100348c779cdSXin LI# Reference: https://wiibrew.org/wiki/Wii_Disc 10043e41d09dSXin LI0x18 belong 0x5D1C9EA3 Nintendo Wii disc image: 10053e41d09dSXin LI>0 use nintendo-gcn-disc-common 10063e41d09dSXin LI 10073e41d09dSXin LI# Type: Nintendo Wii disc image (WBFS format) 10083e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 100948c779cdSXin LI# Reference: https://wiibrew.org/wiki/Wii_Disc 10103e41d09dSXin LI0 string WBFS 10113e41d09dSXin LI>0x218 belong 0x5D1C9EA3 Nintendo Wii disc image (WBFS format): 10122dc4dbb9SEitan Adler!:mime application/x-wii-rom 10133e41d09dSXin LI>>0x200 use nintendo-gcn-disc-common 10143e41d09dSXin LI 101540427ccaSGordon Tetlow 101640427ccaSGordon Tetlow# Type: Nintendo GameCube/Wii disc image (GCZ format) 101740427ccaSGordon Tetlow# Due to zlib compression, we can't get the actual disc information. 101840427ccaSGordon Tetlow0 lelong 0xB10BC001 101940427ccaSGordon Tetlow>4 lelong 0 Nintendo GameCube disc image (GCZ format) 10202dc4dbb9SEitan Adler!:mime application/x-gamecube-rom 102140427ccaSGordon Tetlow>4 lelong 1 Nintendo Wii disc image (GCZ format) 10222dc4dbb9SEitan Adler!:mime application/x-wii-rom 10232dc4dbb9SEitan Adler>4 default x Nintendo GameCube/Wii disc image (GCZ format) 102440427ccaSGordon Tetlow 102540427ccaSGordon Tetlow# Type: Nintendo GameCube/Wii disc image (WDF format) 102640427ccaSGordon Tetlow0 string WII\001DISC 102740427ccaSGordon Tetlow>8 belong 1 102840427ccaSGordon Tetlow# WDFv1 102940427ccaSGordon Tetlow>>0x54 belong 0xC2339F3D Nintendo GameCube disc image (WDFv1 format): 10302dc4dbb9SEitan Adler!:mime application/x-gamecube-rom 103140427ccaSGordon Tetlow>>>0x38 use nintendo-gcn-disc-common 103240427ccaSGordon Tetlow>>0x58 belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv1 format): 10332dc4dbb9SEitan Adler!:mime application/x-wii-rom 103440427ccaSGordon Tetlow>>>0x38 use nintendo-gcn-disc-common 103540427ccaSGordon Tetlow>8 belong 2 103640427ccaSGordon Tetlow# WDFv2 103740427ccaSGordon Tetlow>>(12.L+0x1C) belong 0xC2339F3D Nintendo GameCube disc image (WDFv2 format): 10382dc4dbb9SEitan Adler!:mime application/x-gamecube-rom 103940427ccaSGordon Tetlow>>>(12.L) use nintendo-gcn-disc-common 104040427ccaSGordon Tetlow>>(12.L+0x18) belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv2 format): 10412dc4dbb9SEitan Adler!:mime application/x-wii-rom 104240427ccaSGordon Tetlow>>>(12.L) use nintendo-gcn-disc-common 104340427ccaSGordon Tetlow 104440427ccaSGordon Tetlow# Type: Nintendo GameCube/Wii disc image (WIA format) 104540427ccaSGordon Tetlow0 string WIA\001 Nintendo 104640427ccaSGordon Tetlow>0x48 belong 1 GameCube 10472dc4dbb9SEitan Adler!:mime application/x-gamecube-rom 104840427ccaSGordon Tetlow>0x48 belong 2 Wii 10492dc4dbb9SEitan Adler!:mime application/x-wii-rom 10502dc4dbb9SEitan Adler>0x48 default x GameCube/Wii 105140427ccaSGordon Tetlow>0x48 belong x disc image (WIA format): 105240427ccaSGordon Tetlow>>0x58 use nintendo-gcn-disc-common 105340427ccaSGordon Tetlow 10542dc4dbb9SEitan Adler# Type: Nintendo GameCube/Wii disc image (with SDK header) 10552dc4dbb9SEitan Adler# From: David Korth <gerbilsoft@gerbilsoft.com> 105648c779cdSXin LI# Reference: https://wiibrew.org/wiki/Wii_Disc 10572dc4dbb9SEitan Adler0 belong 0xFFFF0000 10582dc4dbb9SEitan Adler>0x18 belong 0x00000000 10592dc4dbb9SEitan Adler>>0x1C belong 0x00000000 10602dc4dbb9SEitan Adler>>>0x8018 belong 0x5D1C9EA3 Nintendo Wii SDK disc image: 106148c779cdSXin LI!:mime application/x-wii-rom 10622dc4dbb9SEitan Adler>>>>0x8000 use nintendo-gcn-disc-common 10632dc4dbb9SEitan Adler>>>0x801C belong 0xC2339F3D Nintendo GameCube SDK disc image: 106448c779cdSXin LI!:mime application/x-gamecube-rom 10652dc4dbb9SEitan Adler>>>>0x8000 use nintendo-gcn-disc-common 10662dc4dbb9SEitan Adler 1067a4d6d3b8SXin LI# Type: Nintendo GameCube/Wii disc image (RVZ format) 1068a4d6d3b8SXin LI0 string RVZ\001 Nintendo 1069a4d6d3b8SXin LI>0x48 belong 1 GameCube 1070a4d6d3b8SXin LI!:mime application/x-gamecube-rom 1071a4d6d3b8SXin LI>0x48 belong 2 Wii 1072a4d6d3b8SXin LI!:mime application/x-wii-rom 1073a4d6d3b8SXin LI>0x48 default x GameCube/Wii 1074a4d6d3b8SXin LI>0x48 belong x disc image (RVZ format): 1075a4d6d3b8SXin LI>>0x58 use nintendo-gcn-disc-common 1076a4d6d3b8SXin LI 10773e41d09dSXin LI#------------------------------------------------------------------------------ 10783e41d09dSXin LI# Nintendo 3DS file formats. 10793e41d09dSXin LI# 10803e41d09dSXin LI 10813e41d09dSXin LI# Type: Nintendo 3DS "NCSD" image. (game cards and eMMC) 10823e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 10833e41d09dSXin LI# Reference: https://www.3dbrew.org/wiki/NCSD 10843e41d09dSXin LI0x100 string NCSD 10853e41d09dSXin LI>0x118 lequad 0 Nintendo 3DS Game Card image 1086282e23f0SXin LI# NCCH header for partition 0. (game data) 1087282e23f0SXin LI>>0x1150 string >\0 \b: "%.16s" 1088282e23f0SXin LI>>0x312 byte x (Rev.%02u) 1089282e23f0SXin LI>>0x118C byte 2 (New3DS only) 10903e41d09dSXin LI>>0x18D byte 0 (inner device) 10913e41d09dSXin LI>>0x18D byte 1 (Card1) 10923e41d09dSXin LI>>0x18D byte 2 (Card2) 10933e41d09dSXin LI>>0x18D byte 3 (extended device) 10943e41d09dSXin LI>0x118 bequad 0x0102020202000000 Nintendo 3DS eMMC dump (Old3DS) 10953e41d09dSXin LI>0x118 bequad 0x0102020203000000 Nintendo 3DS eMMC dump (New3DS) 10963e41d09dSXin LI 1097282e23f0SXin LI# Nintendo 3DS version code. 1098282e23f0SXin LI# Reference: https://www.3dbrew.org/wiki/Titles 1099282e23f0SXin LI# Format: leshort containing three fields: 1100282e23f0SXin LI# - 6-bit: Major 1101282e23f0SXin LI# - 6-bit: Minor 1102282e23f0SXin LI# - 4-bit: Revision 1103282e23f0SXin LI# NOTE: Only supporting major/minor versions from 0-15 right now. 1104282e23f0SXin LI# NOTE: Should be prefixed with "v". 1105282e23f0SXin LI0 name nintendo-3ds-version-code 1106282e23f0SXin LI# Raw version. 1107282e23f0SXin LI>0 leshort x \b%u, 1108282e23f0SXin LI# Major version. 1109282e23f0SXin LI>0 leshort&0xFC00 0x0000 0 1110282e23f0SXin LI>0 leshort&0xFC00 0x0400 1 1111282e23f0SXin LI>0 leshort&0xFC00 0x0800 2 1112282e23f0SXin LI>0 leshort&0xFC00 0x0C00 3 1113282e23f0SXin LI>0 leshort&0xFC00 0x1000 4 1114282e23f0SXin LI>0 leshort&0xFC00 0x1400 5 1115282e23f0SXin LI>0 leshort&0xFC00 0x1800 6 1116282e23f0SXin LI>0 leshort&0xFC00 0x1C00 7 1117282e23f0SXin LI>0 leshort&0xFC00 0x2000 8 1118282e23f0SXin LI>0 leshort&0xFC00 0x2400 9 1119282e23f0SXin LI>0 leshort&0xFC00 0x2800 10 1120282e23f0SXin LI>0 leshort&0xFC00 0x2C00 11 1121282e23f0SXin LI>0 leshort&0xFC00 0x3000 12 1122282e23f0SXin LI>0 leshort&0xFC00 0x3400 13 1123282e23f0SXin LI>0 leshort&0xFC00 0x3800 14 1124282e23f0SXin LI>0 leshort&0xFC00 0x3C00 15 1125282e23f0SXin LI# Minor version. 1126282e23f0SXin LI>0 leshort&0x03F0 0x0000 \b.0 1127282e23f0SXin LI>0 leshort&0x03F0 0x0010 \b.1 1128282e23f0SXin LI>0 leshort&0x03F0 0x0020 \b.2 1129282e23f0SXin LI>0 leshort&0x03F0 0x0030 \b.3 1130282e23f0SXin LI>0 leshort&0x03F0 0x0040 \b.4 1131282e23f0SXin LI>0 leshort&0x03F0 0x0050 \b.5 1132282e23f0SXin LI>0 leshort&0x03F0 0x0060 \b.6 1133282e23f0SXin LI>0 leshort&0x03F0 0x0070 \b.7 1134282e23f0SXin LI>0 leshort&0x03F0 0x0080 \b.8 1135282e23f0SXin LI>0 leshort&0x03F0 0x0090 \b.9 1136282e23f0SXin LI>0 leshort&0x03F0 0x00A0 \b.10 1137282e23f0SXin LI>0 leshort&0x03F0 0x00B0 \b.11 1138282e23f0SXin LI>0 leshort&0x03F0 0x00C0 \b.12 1139282e23f0SXin LI>0 leshort&0x03F0 0x00D0 \b.13 1140282e23f0SXin LI>0 leshort&0x03F0 0x00E0 \b.14 1141282e23f0SXin LI>0 leshort&0x03F0 0x00F0 \b.15 1142282e23f0SXin LI# Revision. 1143282e23f0SXin LI>0 leshort&0x000F x \b.%u 1144282e23f0SXin LI 11453e41d09dSXin LI# Type: Nintendo 3DS "NCCH" container. 11463e41d09dSXin LI# https://www.3dbrew.org/wiki/NCCH 11473e41d09dSXin LI0x100 string NCCH Nintendo 3DS 11483e41d09dSXin LI>0x18D byte&2 0 File Archive (CFA) 11493e41d09dSXin LI>0x18D byte&2 2 Executable Image (CXI) 1150282e23f0SXin LI>0x150 string >\0 \b: "%.16s" 1151282e23f0SXin LI>0x18D byte 0x05 1152282e23f0SXin LI>>0x10E leshort x (Old3DS System Update v 1153282e23f0SXin LI>>0x10E use nintendo-3ds-version-code 1154282e23f0SXin LI>>0x10E leshort x \b) 1155282e23f0SXin LI>0x18D byte 0x15 1156282e23f0SXin LI>>0x10E leshort x (New3DS System Update v 1157282e23f0SXin LI>>0x10E use nintendo-3ds-version-code 1158282e23f0SXin LI>>0x10E leshort x \b) 1159282e23f0SXin LI>0x18D byte !0x05 1160282e23f0SXin LI>>0x18D byte !0x15 1161282e23f0SXin LI>>>0x112 byte x (v 1162282e23f0SXin LI>>>0x112 use nintendo-3ds-version-code 1163282e23f0SXin LI>>>0x112 byte x \b) 1164282e23f0SXin LI>0x18C byte 2 (New3DS only) 11653e41d09dSXin LI 11663e41d09dSXin LI# Type: Nintendo 3DS "SMDH" file. (application description) 11673e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 11683e41d09dSXin LI# Reference: https://3dbrew.org/wiki/SMDH 11693e41d09dSXin LI0 string SMDH Nintendo 3DS SMDH file 11703e41d09dSXin LI>0x208 leshort !0 11713e41d09dSXin LI>>0x208 lestring16 x \b: "%.128s" 11723e41d09dSXin LI>>0x388 leshort !0 11733e41d09dSXin LI>>>0x388 lestring16 x by %.128s 11743e41d09dSXin LI>0x208 leshort 0 11753e41d09dSXin LI>>0x008 leshort !0 11763e41d09dSXin LI>>>0x008 lestring16 x \b: "%.128s" 11773e41d09dSXin LI>>>0x188 leshort !0 11783e41d09dSXin LI>>>>0x188 lestring16 x by %.128s 11793e41d09dSXin LI 11803e41d09dSXin LI# Type: Nintendo 3DS Homebrew Application. 11813e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 118240427ccaSGordon Tetlow# Reference: https://3dbrew.org/wiki/3DSX_Format 11833e41d09dSXin LI0 string 3DSX Nintendo 3DS Homebrew Application (3DSX) 11843e41d09dSXin LI 118543a5ec4eSXin LI# Type: Nintendo 3DS Banner Model Data. 118643a5ec4eSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 118743a5ec4eSXin LI# Reference: https://3dbrew.org/wiki/CBMD 118843a5ec4eSXin LI0 string CBMD\0\0\0\0 Nintendo 3DS Banner Model Data 118943a5ec4eSXin LI 11903e41d09dSXin LI#------------------------------------------------------------------------------ 11913e41d09dSXin LI# a7800: file(1) magic for the Atari 7800 raw ROM format. 11923e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 11933e41d09dSXin LI# Reference: https://sites.google.com/site/atari7800wiki/a78-header 11943e41d09dSXin LI 11953e41d09dSXin LI0 byte >0 11963e41d09dSXin LI>0 byte <3 11973e41d09dSXin LI>>1 string ATARI7800 Atari 7800 ROM image 11982dc4dbb9SEitan Adler!:mime application/x-atari-7800-rom 11993e41d09dSXin LI>>>0x11 string >\0 \b: "%.32s" 12003e41d09dSXin LI# Display type. 12013e41d09dSXin LI>>>0x39 byte 0 (NTSC) 12023e41d09dSXin LI>>>0x39 byte 1 (PAL) 12033e41d09dSXin LI>>>0x36 byte&1 1 (POKEY) 12043e41d09dSXin LI 12053e41d09dSXin LI#------------------------------------------------------------------------------ 12063e41d09dSXin LI# vectrex: file(1) magic for the GCE Vectrex raw ROM format. 12073e41d09dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 12083e41d09dSXin LI# Reference: http://www.playvectrex.com/designit/chrissalo/hello1.htm 12093e41d09dSXin LI# 12103e41d09dSXin LI# NOTE: Title is terminated with 0x80, not 0. 12113e41d09dSXin LI# The header is terminated with a 0, so that will 12123e41d09dSXin LI# terminate the title as well. 12133e41d09dSXin LI# 1214*ae316d1dSXin LI0 string g\040GCE Vectrex ROM image 12153e41d09dSXin LI>0x11 string >\0 \b: "%.16s" 121640427ccaSGordon Tetlow 121740427ccaSGordon Tetlow#------------------------------------------------------------------------------ 121840427ccaSGordon Tetlow# amiibo: file(1) magic for Nintendo amiibo NFC dumps. 121940427ccaSGordon Tetlow# From: David Korth <gerbilsoft@gerbilsoft.com> 122040427ccaSGordon Tetlow# Reference: https://www.3dbrew.org/wiki/Amiibo 122140427ccaSGordon Tetlow0x00 byte 0x04 122240427ccaSGordon Tetlow>0x0A beshort 0x0FE0 122340427ccaSGordon Tetlow>>0x0C belong 0xF110FFEE 122440427ccaSGordon Tetlow>>>0x208 beshort 0x0100 122540427ccaSGordon Tetlow>>>>0x020A byte 0x0F 122640427ccaSGordon Tetlow>>>>>0x020C bequad 0x000000045F000000 122740427ccaSGordon Tetlow>>>>>>0x5B byte 0x02 122840427ccaSGordon Tetlow>>>>>>>0x54 belong x Nintendo amiibo NFC dump - amiibo ID: %08X- 122940427ccaSGordon Tetlow>>>>>>>0x58 belong x \b%08X 12302726a701SXin LI 12312726a701SXin LI#------------------------------------------------------------------------------ 12322726a701SXin LI# Type: Nintendo Switch XCI (Game Cartridge Image) 12332726a701SXin LI# From: Benjamin Lowry <ben@ben.gmbh> 12342726a701SXin LI# Reference: https://switchbrew.org/wiki/Gamecard_Format 12352726a701SXin LI0x100 string HEAD 12362726a701SXin LI>0x10D byte 0xFA Nintendo Switch cartridge image (XCI), 1GB 12372726a701SXin LI>0x10D byte 0xF8 Nintendo Switch cartridge image (XCI), 2GB 12382726a701SXin LI>0x10D byte 0xF0 Nintendo Switch cartridge image (XCI), 4GB 12392726a701SXin LI>0x10D byte 0xE0 Nintendo Switch cartridge image (XCI), 8GB 12402726a701SXin LI>0x10D byte 0xE1 Nintendo Switch cartridge image (XCI), 16GB 12412726a701SXin LI>0x10D byte 0xE2 Nintendo Switch cartridge image (XCI), 32GB 12422726a701SXin LI 12432726a701SXin LI#------------------------------------------------------------------------------ 12442726a701SXin LI# Type: Nintendo Switch Executable 12452726a701SXin LI# From: Benjamin Lowry <ben@ben.gmbh> 12462726a701SXin LI# Reference: https://switchbrew.org/wiki/NSO 12472726a701SXin LI0x00 string NSO0 Nintendo Switch executable (NSO) 12482726a701SXin LI 12492726a701SXin LI#------------------------------------------------------------------------------ 12502726a701SXin LI# Type: Nintendo Switch PFS0 12512726a701SXin LI# From: Benjamin Lowry <ben@ben.gmbh> 12522726a701SXin LI# Reference: https://switchbrew.org/wiki/NCA_Format#PFS0 12532726a701SXin LI0x00 string PFS0 Nintendo Switch partition filesystem (PFS0) 12542726a701SXin LI>0x04 ulelong x \b, %d files 12552726a701SXin LI 12562726a701SXin LI#------------------------------------------------------------------------------ 12572726a701SXin LI# amiibo: file(1) magic for Nintendo Badge Arcade files. 12582726a701SXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 12592726a701SXin LI# References: 12602726a701SXin LI# - https://github.com/GerbilSoft/rom-properties/issues/92 12612726a701SXin LI# - https://github.com/CaitSith2/BadgeArcadeTool 12622726a701SXin LI# - https://github.com/TheMachinumps/Advanced-badge-editor 12632726a701SXin LI 12642726a701SXin LI# PRBS: Individual badge and/or mega badge. 12652726a701SXin LI0 string PRBS 12662726a701SXin LI>0x44 byte >0x20 Nintendo Badge Arcade 12672726a701SXin LI>>0xB8 ulelong <2 12682726a701SXin LI>>>0xBC ulelong <2 badge: 12692726a701SXin LI>>>0xBC ulelong >1 Mega Badge 12702726a701SXin LI>>>>0xB8 ulelong x (%ux 12712726a701SXin LI>>>>0xBC ulelong x \b%u): 12722726a701SXin LI>>0xB8 ulelong >1 Mega Badge 12732726a701SXin LI>>>0xB8 ulelong x (%ux 12742726a701SXin LI>>>0xBC ulelong x \b%u): 12752726a701SXin LI>0x44 string x "%s" 12762726a701SXin LI>0x3C ulelong x \b, badge ID: %u 12772726a701SXin LI>0x74 byte >0x20 12782726a701SXin LI>>0x74 string x \b, set: "%s" 12792726a701SXin LI>0xA8 ulelong !0xFFFFFFFF 12802726a701SXin LI>>0xA8 ulelong x \b, launch title ID: %08X 12812726a701SXin LI>>0xA4 ulelong x \b-%08X 12822726a701SXin LI 12832726a701SXin LI# CABS: Badge set. 12842726a701SXin LI0 string CABS 12852726a701SXin LI>0x2C byte >0x20 Nintendo Badge Arcade badge set: 12862726a701SXin LI>>0x2C string x "%.48s" 12872726a701SXin LI>>0x24 ulelong x \b, set ID: %u 128843a5ec4eSXin LI 128943a5ec4eSXin LI#------------------------------------------------------------------------------ 129043a5ec4eSXin LI# sufami: file(1) magic for Sufami Turbo ROM images. 129143a5ec4eSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 129243a5ec4eSXin LI# References: 129343a5ec4eSXin LI# - https://problemkaputt.de/fullsnes.htm#snescartsufamiturbominicartridgeadaptor 1294*ae316d1dSXin LI0 string BANDAI\040SFC-ADX 1295*ae316d1dSXin LI>0x10 string !SFC-ADX\040BACKUP Sufami Turbo ROM image: 129643a5ec4eSXin LI>>0x10 string/T x "%.14s" 129743a5ec4eSXin LI>>0x30 byte x \b, ID %02X 129843a5ec4eSXin LI>>0x31 byte x \b%02X 129943a5ec4eSXin LI>>0x32 byte x \b%02X 130043a5ec4eSXin LI>>0x33 ubyte >0 \b, series index %u 130143a5ec4eSXin LI>>0x34 ubyte 0 [SlowROM] 130243a5ec4eSXin LI>>0x34 ubyte 1 [FastROM] 130343a5ec4eSXin LI>>0x35 ubyte 1 [SRAM] 130443a5ec4eSXin LI>>0x35 ubyte 3 [Special] 1305*ae316d1dSXin LI 1306*ae316d1dSXin LI#------------------------------------------------------------------------------ 1307*ae316d1dSXin LI# Type: Super NES ROM image 1308*ae316d1dSXin LI# From: Alexandre Iooss <erdnaxe@crans.org> 1309*ae316d1dSXin LI# Reference: https://snes.nesdev.org/wiki/ROM_header 1310*ae316d1dSXin LI0 name snes-rom-hdr 1311*ae316d1dSXin LI# cartridge title is encoded in JIS X 0201, 21 chars padded with spaces 1312*ae316d1dSXin LI>0 ubyte-0x20 <0xC0 1313*ae316d1dSXin LI>>1 ubyte-0x20 <0xC0 1314*ae316d1dSXin LI>>>2 ubyte-0x20 <0xC0 1315*ae316d1dSXin LI>>>>3 ubyte-0x20 <0xC0 1316*ae316d1dSXin LI>>>>>4 ubyte-0x20 <0xC0 1317*ae316d1dSXin LI>>>>>>5 ubyte-0x20 <0xC0 1318*ae316d1dSXin LI>>>>>>>6 ubyte-0x20 <0xC0 1319*ae316d1dSXin LI>>>>>>>>7 ubyte-0x20 <0xC0 1320*ae316d1dSXin LI>>>>>>>>>8 ubyte-0x20 <0xC0 1321*ae316d1dSXin LI>>>>>>>>>>9 ubyte-0x20 <0xC0 1322*ae316d1dSXin LI>>>>>>>>>>>10 ubyte-0x20 <0xC0 1323*ae316d1dSXin LI>>>>>>>>>>>>21 ubyte-0x20 <0xC0 Super NES ROM image 1324*ae316d1dSXin LI>>>>>>>>>>>>>0 string/21/T x "%s" 1325*ae316d1dSXin LI>>>>>>>>>>>>>25 byte 0 (Japan) 1326*ae316d1dSXin LI>>>>>>>>>>>>>25 byte 1 (USA) 1327*ae316d1dSXin LI>>>>>>>>>>>>>25 byte 2 (Europe) 1328*ae316d1dSXin LI>>>>>>>>>>>>>25 byte 6 (France) 1329*ae316d1dSXin LI>>>>>>>>>>>>>25 byte 7 (Netherlands) 1330*ae316d1dSXin LI>>>>>>>>>>>>>25 byte 9 (Germany) 1331*ae316d1dSXin LI>>>>>>>>>>>>>25 byte 10 (Brazil) 1332*ae316d1dSXin LI>>>>>>>>>>>>>27 byte >0 (Rev.%02u) 1333*ae316d1dSXin LI>>>>>>>>>>>>>21 byte&0xF 0x0 \b, LoROM 1334*ae316d1dSXin LI>>>>>>>>>>>>>21 byte&0xF 0x1 \b, HiROM 1335*ae316d1dSXin LI>>>>>>>>>>>>>21 byte&0x10 0x10 \b, FastROM 1336*ae316d1dSXin LI>>>>>>>>>>>>>23 byte 8 \b, ROM size: 256KB 1337*ae316d1dSXin LI>>>>>>>>>>>>>23 byte 9 \b, ROM size: 512KB 1338*ae316d1dSXin LI>>>>>>>>>>>>>23 byte 10 \b, ROM size: 1024KB 1339*ae316d1dSXin LI>>>>>>>>>>>>>23 byte 11 \b, ROM size: 2048KB 1340*ae316d1dSXin LI>>>>>>>>>>>>>23 byte 12 \b, ROM size: 4096KB 1341*ae316d1dSXin LI>>>>>>>>>>>>>24 byte 0 \b, RAM size: 1KB 1342*ae316d1dSXin LI>>>>>>>>>>>>>24 byte 1 \b, RAM size: 2KB 1343*ae316d1dSXin LI>>>>>>>>>>>>>24 byte 2 \b, RAM size: 4KB 1344*ae316d1dSXin LI>>>>>>>>>>>>>24 byte 3 \b, RAM size: 8KB 1345*ae316d1dSXin LI>>>>>>>>>>>>>24 byte 4 \b, RAM size: 16KB 1346*ae316d1dSXin LI>>>>>>>>>>>>>24 byte 5 \b, RAM size: 32KB 1347*ae316d1dSXin LI>>>>>>>>>>>>>24 byte 6 \b, RAM size: 64KB 1348*ae316d1dSXin LI 1349*ae316d1dSXin LI# header position for LoROM: $007FC0 1350*ae316d1dSXin LI32725 ubyte&0xEF 0x20 1351*ae316d1dSXin LI# ROM is <=4096KB, RAM is <=64KB and country<=10 1352*ae316d1dSXin LI>32727 ubyte <13 1353*ae316d1dSXin LI>>32728 ubyte <7 1354*ae316d1dSXin LI>>>32729 ubyte <11 1355*ae316d1dSXin LI>>>>32704 use snes-rom-hdr 1356*ae316d1dSXin LI 1357*ae316d1dSXin LI# HiROM header at $00FFC0 1358*ae316d1dSXin LI65493 ubyte&0xEF 0x21 1359*ae316d1dSXin LI# ROM is <=4096KB, RAM is <=64KB and country<=10 1360*ae316d1dSXin LI>65495 ubyte <13 1361*ae316d1dSXin LI>>65496 ubyte <7 1362*ae316d1dSXin LI>>>65497 ubyte <11 1363*ae316d1dSXin LI>>>>65472 use snes-rom-hdr 1364*ae316d1dSXin LI 1365*ae316d1dSXin LI#------------------------------------------------------------------------------ 1366*ae316d1dSXin LI# ancast: file(1) magic for Wii U firmware images, aka "ancast" images. 1367*ae316d1dSXin LI# From: David Korth <gerbilsoft@gerbilsoft.com> 1368*ae316d1dSXin LI# References: 1369*ae316d1dSXin LI# - https://wiiubrew.org/wiki/Ancast_image 1370*ae316d1dSXin LI0 ubelong 0xEFA282D9 Wii U firmware image: 1371*ae316d1dSXin LI>0x20 ubelong 2 ARM 1372*ae316d1dSXin LI>>0x1A4 ubelong 0x21 \b, NAND boot 1373*ae316d1dSXin LI>>0x1A4 ubelong 0x22 \b, SD boot 1374*ae316d1dSXin LI>>0x1A8 ubelong 1 \b, for devkits 1375*ae316d1dSXin LI>>0x1A8 ubelong 2 \b, for retail 1376*ae316d1dSXin LI>0x20 ubelong 1 PowerPC 1377*ae316d1dSXin LI>>0xA4 ubelong 0x11 \b, Wii U mode 1378*ae316d1dSXin LI>>0xA4 ubelong 0x12 \b, Wii mode 1379