console revision 139368
1#------------------------------------------------------------------------------ 2# Console game magic 3# Toby Deshane <hac@shoelace.digivill.net> 4# ines: file(1) magic for Marat's iNES Nintendo Entertainment System 5# ROM dump format 6 70 string NES\032 iNES ROM dump, 8>4 byte x %dx16k PRG 9>5 byte x \b, %dx8k CHR 10>6 byte&0x01 =0x1 \b, [Vert.] 11>6 byte&0x01 =0x0 \b, [Horiz.] 12>6 byte&0x02 =0x2 \b, [SRAM] 13>6 byte&0x04 =0x4 \b, [Trainer] 14>6 byte&0x04 =0x8 \b, [4-Scr] 15 16#------------------------------------------------------------------------------ 17# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format 18# 190x104 belong 0xCEED6666 Gameboy ROM: 20>0x134 string >\0 "%.16s" 21>0x146 byte 0x03 \b,[SGB] 22>0x147 byte 0x00 \b, [ROM ONLY] 23>0x147 byte 0x01 \b, [ROM+MBC1] 24>0x147 byte 0x02 \b, [ROM+MBC1+RAM] 25>0x147 byte 0x03 \b, [ROM+MBC1+RAM+BATT] 26>0x147 byte 0x05 \b, [ROM+MBC2] 27>0x147 byte 0x06 \b, [ROM+MBC2+BATTERY] 28>0x147 byte 0x08 \b, [ROM+RAM] 29>0x147 byte 0x09 \b, [ROM+RAM+BATTERY] 30>0x147 byte 0x0B \b, [ROM+MMM01] 31>0x147 byte 0x0C \b, [ROM+MMM01+SRAM] 32>0x147 byte 0x0D \b, [ROM+MMM01+SRAM+BATT] 33>0x147 byte 0x0F \b, [ROM+MBC3+TIMER+BATT] 34>0x147 byte 0x10 \b, [ROM+MBC3+TIMER+RAM+BATT] 35>0x147 byte 0x11 \b, [ROM+MBC3] 36>0x147 byte 0x12 \b, [ROM+MBC3+RAM] 37>0x147 byte 0x13 \b, [ROM+MBC3+RAM+BATT] 38>0x147 byte 0x19 \b, [ROM+MBC5] 39>0x147 byte 0x1A \b, [ROM+MBC5+RAM] 40>0x147 byte 0x1B \b, [ROM+MBC5+RAM+BATT] 41>0x147 byte 0x1C \b, [ROM+MBC5+RUMBLE] 42>0x147 byte 0x1D \b, [ROM+MBC5+RUMBLE+SRAM] 43>0x147 byte 0x1E \b, [ROM+MBC5+RUMBLE+SRAM+BATT] 44>0x147 byte 0x1F \b, [Pocket Camera] 45>0x147 byte 0xFD \b, [Bandai TAMA5] 46>0x147 byte 0xFE \b, [Hudson HuC-3] 47>0x147 byte 0xFF \b, [Hudson HuC-1] 48 49>0x148 byte 0 \b, ROM: 256Kbit 50>0x148 byte 1 \b, ROM: 512Kbit 51>0x148 byte 2 \b, ROM: 1Mbit 52>0x148 byte 3 \b, ROM: 2Mbit 53>0x148 byte 4 \b, ROM: 4Mbit 54>0x148 byte 5 \b, ROM: 8Mbit 55>0x148 byte 6 \b, ROM: 16Mbit 56>0x148 byte 0x52 \b, ROM: 9Mbit 57>0x148 byte 0x53 \b, ROM: 10Mbit 58>0x148 byte 0x54 \b, ROM: 12Mbit 59 60>0x149 byte 1 \b, RAM: 16Kbit 61>0x149 byte 2 \b, RAM: 64Kbit 62>0x149 byte 3 \b, RAM: 128Kbit 63>0x149 byte 4 \b, RAM: 1Mbit 64 65#>0x14e long x \b, CRC: %x 66 67#------------------------------------------------------------------------------ 68# genesis: file(1) magic for the Sega MegaDrive/Genesis raw ROM format 69# 700x100 string SEGA Sega MegaDrive/Genesis raw ROM dump 71>0x120 string >\0 Name: "%.16s" 72>0x110 string >\0 %.16s 73>0x1B0 string RA with SRAM 74 75#------------------------------------------------------------------------------ 76# genesis: file(1) magic for the Super MegaDrive ROM dump format 77# 780x280 string EAGN Super MagicDrive ROM dump 79>0 byte x %dx16k blocks 80>2 byte 0 \b, last in series or standalone 81>2 byte >0 \b, split ROM 82>8 byte 0xAA 83>9 byte 0xBB 84 85#------------------------------------------------------------------------------ 86# genesis: file(1) alternate magic for the Super MegaDrive ROM dump format 87# 880x280 string EAMG Super MagicDrive ROM dump 89>0 byte x %dx16k blocks 90>2 byte x \b, last in series or standalone 91>8 byte 0xAA 92>9 byte 0xBB 93 94#------------------------------------------------------------------------------ 95# smsgg: file(1) magic for Sega Master System and Game Gear ROM dumps 96# 97# Does not detect all images. Very preliminary guesswork. Need more data 98# on format. 99# 100# FIXME: need a little more info...;P 101# 102#0 byte 0xF3 103#>1 byte 0xED Sega Master System/Game Gear ROM dump 104#>1 byte 0x31 Sega Master System/Game Gear ROM dump 105#>1 byte 0xDB Sega Master System/Game Gear ROM dump 106#>1 byte 0xAF Sega Master System/Game Gear ROM dump 107#>1 byte 0xC3 Sega Master System/Game Gear ROM dump 108 109#------------------------------------------------------------------------------ 110# dreamcast: file(1) uncertain magic for the Sega Dreamcast VMU image format 111# 1120 belong 0x21068028 Sega Dreamcast VMU game image 1130 string LCDi Dream Animator file 114 115#------------------------------------------------------------------------------ 116# v64: file(1) uncertain magic for the V64 format N64 ROM dumps 117# 1180 belong 0x37804012 V64 Nintendo 64 ROM dump 119 120#------------------------------------------------------------------------------ 121# msx: file(1) magic for MSX game cartridge dumps 122# Too simple - MPi 123#0 beshort 0x4142 MSX game cartridge dump 124 125#------------------------------------------------------------------------------ 126# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) : 1270 string PS-X\ EXE Sony Playstation executable 128# Area: 129>113 string x (%s) 130 131#------------------------------------------------------------------------------ 132# Microsoft Xbox executables .xbe (Esa Hyyti�� <ehyytia@cc.hut.fi>) 1330 string XBEH XBE, Microsoft Xbox executable 134# probabilistic checks whether signed or not 135>0x0004 ulelong =0x0 136>>&2 ulelong =0x0 137>>>&2 ulelong =0x0 \b, not signed 138>0x0004 ulelong >0 139>>&2 ulelong >0 140>>>&2 ulelong >0 \b, signed 141# expect base address of 0x10000 142>0x0104 ulelong =0x10000 143>>(0x0118-0x0FF60) ulelong&0x80000007 0x80000007 \b, all regions 144>>(0x0118-0x0FF60) ulelong&0x80000007 !0x80000007 145>>>(0x0118-0x0FF60) ulelong >0 (regions: 146>>>>(0x0118-0x0FF60) ulelong &0x00000001 NA 147>>>>(0x0118-0x0FF60) ulelong &0x00000002 Japan 148>>>>(0x0118-0x0FF60) ulelong &0x00000004 Rest_of_World 149>>>>(0x0118-0x0FF60) ulelong &0x80000000 Manufacturer 150>>>(0x0118-0x0FF60) ulelong >0 \b) 151 152# -------------------------------- 153# Microsoft Xbox data file formats 1540 string XIP0 XIP, Microsoft Xbox data 1550 string XTF0 XTF, Microsoft Xbox data 156 157# Atari Lynx cartridge dump (EXE/BLL header) 158# From: "Stefan A. Haubenthal" <polluks@web.de> 159 1600 beshort 0x8008 Lynx cartridge, 161>2 beshort x RAM start $%04x 162>6 string BS93 163 164#------------------------------------------------------------------------------ 165# Z-machine: file(1) magic for Z-machine binaries. 166# 167# This will match ${TEX_BASE}/texmf/omega/ocp/char2uni/inbig5.ocp which 168# appears to be a version-0 Z-machine binary. 169# 170# The (false match) message is to correct that behavior. Perhaps it is 171# not needed. 172# 173>16 belong&0xfe00f0f0 0x3030 Infocom game data 174>0 ubyte 0 (false match) 175>0 ubyte >0 (Z-machine %d, 176>>2 ubeshort x Release %d / 177>>18 string >\0 Serial %.6s) 178 179#------------------------------------------------------------------------------ 180# Glulx: file(1) magic for Glulx binaries. 181# 182# I haven't checked for false matches yet. 183# 1840 string Glul Glulx game data 185 186 187 188# These go at the end of the iff rules 189# 190# I don't see why these might collide with anything else. 191# 192# Interactive Fiction related formats 193# 194>8 string IFRS \b, Blorb Interactive Fiction 195>>24 string Exec with executable chunk 196>8 string IFZS \b, Z-machine or Glulx saved game file (Quetzal) 197 198