console 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017
  1. #------------------------------------------------------------------------------
  2. # $File: console,v 1.49 2019/05/27 01:33:32 christos Exp $
  3. # Console game magic
  4. # Toby Deshane <hac@shoelace.digivill.net>
  5. # ines: file(1) magic for Marat's iNES Nintendo Entertainment System ROM dump format
  6. # Updated by David Korth <gerbilsoft@gerbilsoft.com>
  7. # References:
  8. # - https://wiki.nesdev.com/w/index.php/INES
  9. # - https://wiki.nesdev.com/w/index.php/NES_2.0
  10. # Common header for iNES, NES 2.0, and Wii U iNES.
  11. 0 name nes-rom-image-ines
  12. >7 byte&0x0C =0x8 (NES 2.0)
  13. >4 byte x \b: %ux16k PRG
  14. >5 byte x \b, %ux8k CHR
  15. >6 byte&0x08 =0x8 [4-Scr]
  16. >6 byte&0x09 =0x0 [H-mirror]
  17. >6 byte&0x09 =0x1 [V-mirror]
  18. >6 byte&0x02 =0x2 [SRAM]
  19. >6 byte&0x04 =0x4 [Trainer]
  20. >7 byte&0x03 =0x2 [PC10]
  21. >7 byte&0x03 =0x1 [VS]
  22. >>7 byte&0x0C =0x8
  23. # NES 2.0: VS PPU
  24. >>>13 byte&0x0F =0x0 \b, RP2C03B
  25. >>>13 byte&0x0F =0x1 \b, RP2C03G
  26. >>>13 byte&0x0F =0x2 \b, RP2C04-0001
  27. >>>13 byte&0x0F =0x3 \b, RP2C04-0002
  28. >>>13 byte&0x0F =0x4 \b, RP2C04-0003
  29. >>>13 byte&0x0F =0x5 \b, RP2C04-0004
  30. >>>13 byte&0x0F =0x6 \b, RP2C03B
  31. >>>13 byte&0x0F =0x7 \b, RP2C03C
  32. >>>13 byte&0x0F =0x8 \b, RP2C05-01
  33. >>>13 byte&0x0F =0x9 \b, RP2C05-02
  34. >>>13 byte&0x0F =0xA \b, RP2C05-03
  35. >>>13 byte&0x0F =0xB \b, RP2C05-04
  36. >>>13 byte&0x0F =0xC \b, RP2C05-05
  37. # TODO: VS protection hardware?
  38. >>7 byte x \b]
  39. # NES 2.0-specific flags.
  40. >7 byte&0x0C =0x8
  41. >>12 byte&0x03 =0x0 [NTSC]
  42. >>12 byte&0x03 =0x1 [PAL]
  43. >>12 byte&0x02 =0x2 [NTSC+PAL]
  44. # Standard iNES ROM header.
  45. 0 string NES\x1A NES ROM image (iNES)
  46. !:mime application/x-nes-rom
  47. >0 use nes-rom-image-ines
  48. # Wii U Virtual Console iNES ROM header.
  49. 0 belong 0x4E455300 NES ROM image (Wii U Virtual Console)
  50. !:mime application/x-nes-rom
  51. >0 use nes-rom-image-ines
  52. #------------------------------------------------------------------------------
  53. # unif: file(1) magic for UNIF-format Nintendo Entertainment System ROM images
  54. # Reference: https://wiki.nesdev.com/w/index.php/UNIF
  55. # From: David Korth <gerbilsoft@gerbilsoft.com>
  56. #
  57. # NOTE: The UNIF format uses chunks instead of a fixed header,
  58. # so most of the data isn't easily parseable.
  59. #
  60. 0 string UNIF
  61. >4 lelong <16 NES ROM image (UNIF v%d format)
  62. !:mime application/x-nes-rom
  63. #------------------------------------------------------------------------------
  64. # fds: file(1) magic for Famciom Disk System disk images
  65. # Reference: https://wiki.nesdev.com/w/index.php/Family_Computer_Disk_System#.FDS_format
  66. # From: David Korth <gerbilsoft@gerbilsoft.com>
  67. # TODO: Check "Disk info block" and get info from that in addition to the optional header.
  68. # Disk info block. (block 1)
  69. 0 name nintendo-fds-disk-info-block
  70. >23 byte !1 FMC-
  71. >23 byte 1 FSC-
  72. >16 string x \b%.3s
  73. >15 byte x \b, mfr %02X
  74. >20 byte x (Rev.%02u)
  75. # Headered version.
  76. 0 string FDS\x1A
  77. >0x11 string *NINTENDO-HVC* Famicom Disk System disk image:
  78. !:mime application/x-fds-disk
  79. >>0x10 use nintendo-fds-disk-info-block
  80. >4 byte 1 (%u side)
  81. >4 byte !1 (%u sides)
  82. # Unheadered version.
  83. 1 string *NINTENDO-HVC* Famicom Disk System disk image:
  84. !:mime application/x-fds-disk
  85. >0 use nintendo-fds-disk-info-block
  86. #------------------------------------------------------------------------------
  87. # tnes: file(1) magic for TNES-format Nintendo Entertainment System ROM images
  88. # Used by Nintendo 3DS NES Virtual Console games.
  89. # From: David Korth <gerbilsoft@gerbilsoft.com>
  90. #
  91. 0 string TNES NES ROM image (Nintendo 3DS Virtual Console)
  92. !:mime application/x-nes-rom
  93. >4 byte 100 \b: FDS,
  94. >>0x2010 use nintendo-fds-disk-info-block
  95. >4 byte !100 \b: TNES mapper %u
  96. >>5 byte x \b, %ux8k PRG
  97. >>6 byte x \b, %ux8k CHR
  98. >>7 byte&0x08 =1 [WRAM]
  99. >>8 byte&0x09 =1 [H-mirror]
  100. >>8 byte&0x09 =2 [V-mirror]
  101. >>8 byte&0x02 =3 [VRAM]
  102. #------------------------------------------------------------------------------
  103. # gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format
  104. # Reference: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header
  105. #
  106. 0x104 bequad 0xCEED6666CC0D000B Game Boy ROM image
  107. # TODO: application/x-gameboy-color-rom for GBC.
  108. !:mime application/x-gameboy-rom
  109. >0x143 byte&0x80 0x80
  110. >>0x134 string >\0 \b: "%.15s"
  111. >0x143 byte&0x80 !0x80
  112. >>0x134 string >\0 \b: "%.16s"
  113. >0x14c byte x (Rev.%02u)
  114. # Machine type. (SGB, CGB, SGB+CGB)
  115. >0x14b byte 0x33
  116. >>0x146 byte 0x03
  117. >>>0x143 byte&0x80 0x80 [SGB+CGB]
  118. >>>0x143 byte&0x80 !0x80 [SGB]
  119. >>0x146 byte !0x03
  120. >>>0x143 byte&0xC0 0x80 [CGB]
  121. >>>0x143 byte&0xC0 0xC0 [CGB ONLY]
  122. >0x14b byte !0x33
  123. # Mapper.
  124. >0x147 byte 0x00 [ROM ONLY]
  125. >0x147 byte 0x01 [MBC1]
  126. >0x147 byte 0x02 [MBC1+RAM]
  127. >0x147 byte 0x03 [MBC1+RAM+BATT]
  128. >0x147 byte 0x05 [MBC2]
  129. >0x147 byte 0x06 [MBC2+BATTERY]
  130. >0x147 byte 0x08 [ROM+RAM]
  131. >0x147 byte 0x09 [ROM+RAM+BATTERY]
  132. >0x147 byte 0x0B [MMM01]
  133. >0x147 byte 0x0C [MMM01+SRAM]
  134. >0x147 byte 0x0D [MMM01+SRAM+BATT]
  135. >0x147 byte 0x0F [MBC3+TIMER+BATT]
  136. >0x147 byte 0x10 [MBC3+TIMER+RAM+BATT]
  137. >0x147 byte 0x11 [MBC3]
  138. >0x147 byte 0x12 [MBC3+RAM]
  139. >0x147 byte 0x13 [MBC3+RAM+BATT]
  140. >0x147 byte 0x19 [MBC5]
  141. >0x147 byte 0x1A [MBC5+RAM]
  142. >0x147 byte 0x1B [MBC5+RAM+BATT]
  143. >0x147 byte 0x1C [MBC5+RUMBLE]
  144. >0x147 byte 0x1D [MBC5+RUMBLE+SRAM]
  145. >0x147 byte 0x1E [MBC5+RUMBLE+SRAM+BATT]
  146. >0x147 byte 0xFC [Pocket Camera]
  147. >0x147 byte 0xFD [Bandai TAMA5]
  148. >0x147 byte 0xFE [Hudson HuC-3]
  149. >0x147 byte 0xFF [Hudson HuC-1]
  150. # ROM size.
  151. >0x148 byte 0 \b, ROM: 256Kbit
  152. >0x148 byte 1 \b, ROM: 512Kbit
  153. >0x148 byte 2 \b, ROM: 1Mbit
  154. >0x148 byte 3 \b, ROM: 2Mbit
  155. >0x148 byte 4 \b, ROM: 4Mbit
  156. >0x148 byte 5 \b, ROM: 8Mbit
  157. >0x148 byte 6 \b, ROM: 16Mbit
  158. >0x148 byte 7 \b, ROM: 32Mbit
  159. >0x148 byte 0x52 \b, ROM: 9Mbit
  160. >0x148 byte 0x53 \b, ROM: 10Mbit
  161. >0x148 byte 0x54 \b, ROM: 12Mbit
  162. # RAM size.
  163. >0x149 byte 1 \b, RAM: 16Kbit
  164. >0x149 byte 2 \b, RAM: 64Kbit
  165. >0x149 byte 3 \b, RAM: 128Kbit
  166. >0x149 byte 4 \b, RAM: 1Mbit
  167. >0x149 byte 5 \b, RAM: 512Kbit
  168. #------------------------------------------------------------------------------
  169. # genesis: file(1) magic for various Sega Mega Drive / Genesis ROM image and disc formats
  170. # Updated by David Korth <gerbilsoft@gerbilsoft.com>
  171. # References:
  172. # - https://www.retrodev.com/segacd.html
  173. # - http://devster.monkeeh.com/sega/32xguide1.txt
  174. #
  175. # Common Sega Mega Drive header format.
  176. # FIXME: Name fields are 48 bytes, but have spaces for padding instead of 00s.
  177. 0 name sega-mega-drive-header
  178. # ROM title. (Use domestic if present; if not, use international.)
  179. >0x120 byte >0x20
  180. >>0x120 string >\0 \b: "%.16s"
  181. >0x120 byte <0x21
  182. >>0x150 string >\0 \b: "%.16s"
  183. # Other information.
  184. >0x180 string >\0 (%.14s
  185. >>0x110 string >\0 \b, %.16s
  186. >0x180 byte 0
  187. >>0x110 string >\0 (%.16s
  188. >0 byte x \b)
  189. # TODO: Check for 32X CD?
  190. # Sega Mega CD disc images: 2048-byte sectors.
  191. 0 string SEGADISCSYSTEM\ \ Sega Mega CD disc image
  192. !:mime application/x-sega-cd-rom
  193. >0 use sega-mega-drive-header
  194. >0 byte x \b, 2048-byte sectors
  195. 0 string SEGABOOTDISC\ \ \ \ Sega Mega CD disc image
  196. !:mime application/x-sega-cd-rom
  197. >0 use sega-mega-drive-header
  198. >0 byte x \b, 2048-byte sectors
  199. # Sega Mega CD disc images: 2352-byte sectors.
  200. 0x10 string SEGADISCSYSTEM\ \ Sega Mega CD disc image
  201. !:mime application/x-sega-cd-rom
  202. >0x10 use sega-mega-drive-header
  203. >0 byte x \b, 2352-byte sectors
  204. 0x10 string SEGABOOTDISC\ \ \ \ Sega Mega CD disc image
  205. !:mime application/x-sega-cd-rom
  206. >0x10 use sega-mega-drive-header
  207. >0 byte x \b, 2352-byte sectors
  208. # Sega Mega Drive, 32X, Pico, and Mega CD Boot ROM images.
  209. 0x100 string SEGA
  210. >0x3C0 bequad 0x4D41525320434845 Sega 32X ROM image
  211. !:mime application/x-genesis-32x-rom
  212. >>0 use sega-mega-drive-header
  213. >0x3C0 bequad !0x4D41525320434845
  214. >>0x105 belong 0x5049434F Sega Pico ROM image
  215. !:mime application/x-sega-pico-rom
  216. >>>0 use sega-mega-drive-header
  217. >>0x105 belong !0x5049434F
  218. >>>0x180 beshort 0x4252 Sega Mega CD Boot ROM image
  219. !:mime application/x-genesis-rom
  220. >>>0x180 beshort !0x4252 Sega Mega Drive / Genesis ROM image
  221. !:mime application/x-genesis-rom
  222. >>>0 use sega-mega-drive-header
  223. #------------------------------------------------------------------------------
  224. # genesis: file(1) magic for the Super MegaDrive ROM dump format
  225. #
  226. # NOTE: Due to interleaving, we can't display anything
  227. # other than the copier header information.
  228. 0 name sega-genesis-smd-header
  229. >0 byte x %dx16k blocks
  230. >2 byte 0 \b, last in series or standalone
  231. >2 byte >0 \b, split ROM
  232. # "Sega Genesis" header.
  233. 0x280 string EAGN
  234. >8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format):
  235. !:mime application/x-genesis-rom
  236. >>0 use sega-genesis-smd-header
  237. # "Sega Mega Drive" header.
  238. 0x280 string EAMG
  239. >8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format):
  240. !:mime application/x-genesis-rom
  241. >>0 use sega-genesis-smd-header
  242. #------------------------------------------------------------------------------
  243. # smsgg: file(1) magic for Sega Master System and Game Gear ROM images
  244. # Detects all Game Gear and export Sega Master System ROM images,
  245. # and some Japanese Sega Master System ROM images.
  246. # From: David Korth <gerbilsoft@gerbilsoft.com>
  247. # Reference: https://www.smspower.org/Development/ROMHeader
  248. #
  249. # General SMS header rule.
  250. # The SMS boot ROM checks the header at three locations.
  251. 0 name sega-master-system-rom-header
  252. # Machine type.
  253. >0x0F byte&0xF0 0x30 Sega Master System
  254. !:mime application/x-sms-rom
  255. >0x0F byte&0xF0 0x40 Sega Master System
  256. !:mime application/x-sms-rom
  257. >0x0F byte&0xF0 0x50 Sega Game Gear
  258. !:mime application/x-gamegear-rom
  259. >0x0F byte&0xF0 0x60 Sega Game Gear
  260. !:mime application/x-gamegear-rom
  261. >0x0F byte&0xF0 0x70 Sega Game Gear
  262. !:mime application/x-gamegear-rom
  263. >0x0F default x Sega Master System / Game Gear
  264. !:mime application/x-sms-rom
  265. >0 byte x ROM image:
  266. # Product code.
  267. >0x0E byte&0xF0 0x10 1
  268. >0x0E byte&0xF0 0x20 2
  269. >0x0E byte&0xF0 0x30 3
  270. >0x0E byte&0xF0 0x40 4
  271. >0x0E byte&0xF0 0x50 5
  272. >0x0E byte&0xF0 0x60 6
  273. >0x0E byte&0xF0 0x70 7
  274. >0x0E byte&0xF0 0x80 8
  275. >0x0E byte&0xF0 0x90 9
  276. >0x0E byte&0xF0 0xA0 10
  277. >0x0E byte&0xF0 0xB0 11
  278. >0x0E byte&0xF0 0xC0 12
  279. >0x0E byte&0xF0 0xD0 13
  280. >0x0E byte&0xF0 0xE0 14
  281. >0x0E byte&0xF0 0xF0 15
  282. # If the product code is 5 digits, we'll need to backspace here.
  283. >0x0E byte&0xF0 !0
  284. >>0x0C leshort x \b%04x
  285. >0x0E byte&0xF0 0
  286. >>0x0C leshort x %04x
  287. # Revision.
  288. >0x0E byte&0x0F x (Rev.%02d)
  289. # ROM size. (Used for the boot ROM checksum routine.)
  290. >0x0F byte&0x0F 0x0A (8 KB)
  291. >0x0F byte&0x0F 0x0B (16 KB)
  292. >0x0F byte&0x0F 0x0C (32 KB)
  293. >0x0F byte&0x0F 0x0D (48 KB)
  294. >0x0F byte&0x0F 0x0E (64 KB)
  295. >0x0F byte&0x0F 0x0F (128 KB)
  296. >0x0F byte&0x0F 0x00 (256 KB)
  297. >0x0F byte&0x0F 0x01 (512 KB)
  298. >0x0F byte&0x0F 0x02 (1 MB)
  299. # SMS/GG header locations.
  300. 0x7FF0 string TMR\ SEGA
  301. >0x7FF0 use sega-master-system-rom-header
  302. 0x3FF0 string TMR\ SEGA
  303. >0x3FF0 use sega-master-system-rom-header
  304. 0x1FF0 string TMR\ SEGA
  305. >0x1FF0 use sega-master-system-rom-header
  306. #------------------------------------------------------------------------------
  307. # saturn: file(1) magic for the Sega Saturn disc image format.
  308. # From: David Korth <gerbilsoft@gerbilsoft.com>
  309. #
  310. # Common Sega Saturn disc header format.
  311. # NOTE: Title is 112 bytes, but we're only showing 32 due to space padding.
  312. # TODO: Release date, device information, region code, others?
  313. 0 name sega-saturn-disc-header
  314. >0x60 string >\0 \b: "%.32s"
  315. >0x20 string >\0 (%.10s
  316. >>0x2A string >\0 \b, %.6s)
  317. >>0x2A byte 0 \b)
  318. # 2048-byte sector version.
  319. 0 string SEGA\ SEGASATURN\ Sega Saturn disc image
  320. !:mime application/x-saturn-rom
  321. >0 use sega-saturn-disc-header
  322. >0 byte x (2048-byte sectors)
  323. # 2352-byte sector version.
  324. 0x10 string SEGA\ SEGASATURN\ Sega Saturn disc image
  325. !:mime application/x-saturn-rom
  326. >0x10 use sega-saturn-disc-header
  327. >0 byte x (2352-byte sectors)
  328. #------------------------------------------------------------------------------
  329. # dreamcast: file(1) magic for the Sega Dreamcast disc image format.
  330. # From: David Korth <gerbilsoft@gerbilsoft.com>
  331. # Reference: https://mc.pp.se/dc/ip0000.bin.html
  332. #
  333. # Common Sega Dreamcast disc header format.
  334. # NOTE: Title is 128 bytes, but we're only showing 32 due to space padding.
  335. # TODO: Release date, device information, region code, others?
  336. 0 name sega-dreamcast-disc-header
  337. >0x80 string >\0 \b: "%.32s"
  338. >0x40 string >\0 (%.10s
  339. >>0x4A string >\0 \b, %.6s)
  340. >>0x4A byte 0 \b)
  341. # 2048-byte sector version.
  342. 0 string SEGA\ SEGAKATANA\ Sega Dreamcast disc image
  343. !:mime application/x-dc-rom
  344. >0 use sega-dreamcast-disc-header
  345. >0 byte x (2048-byte sectors)
  346. # 2352-byte sector version.
  347. 0x10 string SEGA\ SEGAKATANA\ Sega Dreamcast disc image
  348. !:mime application/x-dc-rom
  349. >0x10 use sega-dreamcast-disc-header
  350. >0 byte x (2352-byte sectors)
  351. #------------------------------------------------------------------------------
  352. # dreamcast: file(1) uncertain magic for the Sega Dreamcast VMU image format
  353. #
  354. 0 belong 0x21068028 Sega Dreamcast VMU game image
  355. 0 string LCDi Dream Animator file
  356. #------------------------------------------------------------------------------
  357. # z64: file(1) magic for the Z64 format N64 ROM dumps
  358. # Reference: http://forum.pj64-emu.com/showthread.php?t=2239
  359. # From: David Korth <gerbilsoft@gerbilsoft.com>
  360. #
  361. 0 bequad 0x803712400000000F Nintendo 64 ROM image
  362. !:mime application/x-n64-rom
  363. >0x20 string >\0 \b: "%.20s"
  364. >0x3B string x (%.4s
  365. >0x3F byte x \b, Rev.%02u)
  366. #------------------------------------------------------------------------------
  367. # v64: file(1) magic for the V64 format N64 ROM dumps
  368. # Same as z64 format, but with 16-bit byteswapping.
  369. #
  370. 0 bequad 0x3780401200000F00 Nintendo 64 ROM image (V64)
  371. !:mime application/x-n64-rom
  372. #------------------------------------------------------------------------------
  373. # n64-swap2: file(1) magic for the swap2 format N64 ROM dumps
  374. # Same as z64 format, but with swapped 16-bit words.
  375. #
  376. 0 bequad 0x12408037000F0000 Nintendo 64 ROM image (wordswapped)
  377. !:mime application/x-n64-rom
  378. #------------------------------------------------------------------------------
  379. # n64-le32: file(1) magic for the 32-bit byteswapped format N64 ROM dumps
  380. # Same as z64 format, but with 32-bit byteswapping.
  381. #
  382. 0 bequad 0x401237800F000000 Nintendo 64 ROM image (32-bit byteswapped)
  383. !:mime application/x-n64-rom
  384. #------------------------------------------------------------------------------
  385. # gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format
  386. # Reference: https://problemkaputt.de/gbatek.htm#gbacartridgeheader
  387. #
  388. # Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
  389. # Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
  390. #
  391. 4 bequad 0x24FFAE51699AA221 Game Boy Advance ROM image
  392. !:mime application/x-gba-rom
  393. >0xA0 string >\0 \b: "%.12s"
  394. >0xAC string x (%.6s
  395. >0xBC byte x \b, Rev.%02u)
  396. #------------------------------------------------------------------------------
  397. # nds: file(1) magic for the Nintendo DS(i) raw ROM format
  398. # Reference: https://problemkaputt.de/gbatek.htm#dscartridgeheader
  399. #
  400. # Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
  401. # Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
  402. #
  403. 0xC0 bequad 0x24FFAE51699AA221 Nintendo DS ROM image
  404. !:mime application/x-nintendo-ds-rom
  405. >0x00 string >\0 \b: "%.12s"
  406. >0x0C string x (%.6s
  407. >0x1E byte x \b, Rev.%02u)
  408. >0x12 byte 2 (DSi enhanced)
  409. >0x12 byte 3 (DSi only)
  410. # Secure Area check.
  411. >0x20 lelong <0x4000 (homebrew)
  412. >0x20 lelong >0x3FFF
  413. >>0x4000 lequad 0x0000000000000000 (multiboot)
  414. >>0x4000 lequad !0x0000000000000000
  415. >>>0x4000 lequad 0xE7FFDEFFE7FFDEFF (decrypted)
  416. >>>0x4000 lequad !0xE7FFDEFFE7FFDEFF
  417. >>>>0x1000 lequad 0x0000000000000000 (encrypted)
  418. >>>>0x1000 lequad !0x0000000000000000 (mask ROM)
  419. #------------------------------------------------------------------------------
  420. # nds_passme: file(1) magic for Nintendo DS ROM images for GBA cartridge boot.
  421. # This is also used for loading .nds files using the MSET exploit on 3DS.
  422. # Reference: https://github.com/devkitPro/ndstool/blob/master/source/ndscreate.cpp
  423. 0xC0 bequad 0xC8604FE201708FE2 Nintendo DS Slot-2 ROM image (PassMe)
  424. !:mime application/x-nintendo-ds-rom
  425. #------------------------------------------------------------------------------
  426. # ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format.
  427. # From: David Korth <gerbilsoft@gerbilsoft.com>
  428. # References:
  429. # - https://neogpc.googlecode.com/svn-history/r10/trunk/src/core/neogpc.cpp
  430. # - https://www.devrs.com/ngp/files/ngpctech.txt
  431. #
  432. 0x0A string BY\ SNK\ CORPORATION Neo Geo Pocket
  433. !:mime application/x-neo-geo-pocket-rom
  434. >0x23 byte 0x10 Color
  435. >0 byte x ROM image
  436. >0x24 string >\0 \b: "%.12s"
  437. >0x1F byte 0xFF (debug mode enabled)
  438. #------------------------------------------------------------------------------
  439. # msx: file(1) magic for MSX game cartridge dumps
  440. # Too simple - MPi
  441. #0 beshort 0x4142 MSX game cartridge dump
  442. #------------------------------------------------------------------------------
  443. # Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) :
  444. 0 string PS-X\ EXE Sony Playstation executable
  445. >16 lelong x PC=0x%08x,
  446. >20 lelong !0 GP=0x%08x,
  447. >24 lelong !0 .text=[0x%08x,
  448. >>28 lelong x \b0x%x],
  449. >32 lelong !0 .data=[0x%08x,
  450. >>36 lelong x \b0x%x],
  451. >40 lelong !0 .bss=[0x%08x,
  452. >>44 lelong x \b0x%x],
  453. >48 lelong !0 Stack=0x%08x,
  454. >48 lelong =0 No Stack!,
  455. >52 lelong !0 StackSize=0x%x,
  456. #>76 string >\0 (%s)
  457. # Area:
  458. >113 string x (%s)
  459. # CPE executables
  460. 0 string CPE CPE executable
  461. >3 byte x (version %d)
  462. #------------------------------------------------------------------------------
  463. # Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>)
  464. 0 string XBEH Microsoft Xbox executable
  465. !:mime audio/x-xbox-executable
  466. !:ext xbe
  467. # expect base address of 0x10000
  468. >0x0104 ulelong =0x10000
  469. >>(0x0118.l-0x0FFF4) lestring16 x \b: "%.40s"
  470. >>(0x0118.l-0x0FFF5) byte x (%c
  471. >>(0x0118.l-0x0FFF6) byte x \b%c-
  472. >>(0x0118.l-0x0FFF8) uleshort x \b%03u)
  473. >>(0x0118.l-0x0FF60) ulelong&0x80000007 0x80000007 \b, all regions
  474. >>(0x0118.l-0x0FF60) ulelong&0x80000007 !0x80000007
  475. >>>(0x0118.l-0x0FF60) ulelong >0 (regions:
  476. >>>>(0x0118.l-0x0FF60) ulelong &0x00000001 NA
  477. >>>>(0x0118.l-0x0FF60) ulelong &0x00000002 Japan
  478. >>>>(0x0118.l-0x0FF60) ulelong &0x00000004 Rest_of_World
  479. >>>>(0x0118.l-0x0FF60) ulelong &0x80000000 Manufacturer
  480. >>>(0x0118.l-0x0FF60) ulelong >0 \b)
  481. # probabilistic checks whether signed or not
  482. >0x0004 ulelong =0x0
  483. >>&2 ulelong =0x0
  484. >>>&2 ulelong =0x0 \b, not signed
  485. >0x0004 ulelong >0
  486. >>&2 ulelong >0
  487. >>>&2 ulelong >0 \b, signed
  488. # --------------------------------
  489. # Microsoft Xbox data file formats
  490. 0 string XIP0 XIP, Microsoft Xbox data
  491. 0 string XTF0 XTF, Microsoft Xbox data
  492. #------------------------------------------------------------------------------
  493. # Microsoft Xbox 360 executables (.xex)
  494. # From: David Korth <gerbilsoft@gerbilsoft.com>
  495. # References:
  496. # - https://free60project.github.io/wiki/XEX.html
  497. # - https://github.com/xenia-project/xenia/blob/HEAD/src/xenia/kernel/util/xex2_info.h
  498. # Title ID (part of Execution ID section)
  499. 0 name xbox-360-xex-execution-id
  500. >(0.L+0xC) byte x (%c
  501. >(0.L+0xD) byte x \b%c
  502. >(0.L+0xE) beshort x \b-%04u, media ID:
  503. >(0.L) belong x %08X)
  504. # Region code (part of Security Info)
  505. 0 name xbox-360-xex-region-code
  506. >0 ubelong 0xFFFFFFFF \b, all regions
  507. >0 ubelong !0xFFFFFFFF
  508. >>0 ubelong >0 (regions:
  509. >>0 ubelong&0x000000FF 0x000000FF USA
  510. >>0 ubelong&0x00000100 0x00000100 Japan
  511. >>0 ubelong&0x00000200 0x00000200 China
  512. >>0 ubelong&0x0000FC00 0x0000FC00 Asia
  513. >>0 ubelong&0x00FF0000 0x00FF0000 PAL
  514. >>0 ubelong&0x00FF0000 0x00FE0000 PAL [except AU/NZ]
  515. >>0 ubelong&0x00FF0000 0x00010000 AU/NZ
  516. >>0 ubelong&0xFF000000 0xFF000000 Other
  517. >>0 ubelong >0 \b)
  518. 0 string XEX2 Microsoft Xbox 360 executable
  519. !:mime audio/x-xbox360-executable
  520. !:ext xex
  521. >0x18 search/0x100 \x00\x04\x00\x06
  522. >>&0 use xbox-360-xex-execution-id
  523. >(0x010.L+0x178) use xbox-360-xex-region-code
  524. 0 string XEX1 Microsoft Xbox 360 executable (XEX1)
  525. !:mime audio/x-xbox360-executable
  526. !:ext xex
  527. >0x18 search/0x100 \x00\x04\x00\x06
  528. >>&0 use xbox-360-xex-execution-id
  529. >(0x010.L+0x154) use xbox-360-xex-region-code
  530. #------------------------------------------------------------------------------
  531. # Microsoft Xbox 360 packages
  532. # From: David Korth <gerbilsoft@gerbilsoft.com>
  533. # References:
  534. # - https://free60project.github.io/wiki/STFS.html
  535. # - https://github.com/xenia-project/xenia/blob/HEAD/src/xenia/kernel/util/xex2_info.h
  536. # TODO: More information for console-signed packages.
  537. 0 name xbox-360-package
  538. >0x360 byte x (%c
  539. >0x361 byte x \b%c
  540. >0x362 beshort x \b-%04u, media ID:
  541. >0x354 belong x %08X)
  542. >0x344 belong x \b, content type:
  543. >>0x344 belong 0x1 Saved Game
  544. >>0x344 belong 0x2 Marketplace Content
  545. >>0x344 belong 0x3 Publisher
  546. >>0x344 belong 0x1000 Xbox 360 Title
  547. >>0x344 belong 0x2000 IPTV Pause Buffer
  548. >>0x344 belong 0x4000 Installed Game
  549. >>0x344 belong 0x5000 Original Xbox Game
  550. >>0x344 belong 0x9000 Avatar Item
  551. >>0x344 belong 0x10000 Profile
  552. >>0x344 belong 0x20000 Gamer Picture
  553. >>0x344 belong 0x30000 Theme
  554. >>0x344 belong 0x40000 Cache File
  555. >>0x344 belong 0x50000 Storage Download
  556. >>0x344 belong 0x60000 Xbox Saved Game
  557. >>0x344 belong 0x70000 Xbox Download
  558. >>0x344 belong 0x80000 Game Demo
  559. >>0x344 belong 0x90000 Video
  560. >>0x344 belong 0xA0000 Game
  561. >>0x344 belong 0xB0000 Installer
  562. >>0x344 belong 0xC0000 Game Trailer
  563. >>0x344 belong 0xD0000 Arcade Title
  564. >>0x344 belong 0xE0000 XNA
  565. >>0x344 belong 0xF0000 License Store
  566. >>0x344 belong 0x100000 Movie
  567. >>0x344 belong 0x200000 TV
  568. >>0x344 belong 0x300000 Music Video
  569. >>0x344 belong 0x400000 Game Video
  570. >>0x344 belong 0x500000 Podcast Video
  571. >>0x344 belong 0x600000 Viral Video
  572. >>0x344 belong 0x2000000 Community Game
  573. 0 string CON\x20 Microsoft Xbox 360 package (console-signed)
  574. >0 use xbox-360-package
  575. 0 string PIRS Microsoft Xbox 360 package (non-Xbox Live)
  576. >0 use xbox-360-package
  577. 0 string LIVE Microsoft Xbox 360 package (Xbox Live)
  578. >0 use xbox-360-package
  579. # Atari Lynx cartridge dump (EXE/BLL header)
  580. # From: "Stefan A. Haubenthal" <polluks@web.de>
  581. # Double-check that the image type matches too, 0x8008 conflicts with
  582. # 8 character OMF-86 object file headers.
  583. 0 beshort 0x8008
  584. >6 string BS93 Lynx homebrew cartridge
  585. !:mime application/x-atari-lynx-rom
  586. >>2 beshort x \b, RAM start $%04x
  587. >6 string LYNX Lynx cartridge
  588. !:mime application/x-atari-lynx-rom
  589. >>2 beshort x \b, RAM start $%04x
  590. # Opera file system that is used on the 3DO console
  591. # From: Serge van den Boom <svdb@stack.nl>
  592. 0 string \x01ZZZZZ\x01 3DO "Opera" file system
  593. # From: Alex Myczko <alex@aiei.ch>
  594. # From: David Pflug <david@pflug.email>
  595. # is the offset 12 or the offset 16 correct?
  596. # GBS (Game Boy Sound) magic
  597. # ftp://ftp.modland.com/pub/documents/format_documentation/\
  598. # Gameboy%20Sound%20System%20(.gbs).txt
  599. 0 string GBS Nintendo Gameboy Music/Audio Data
  600. #12 string GameBoy\ Music\ Module Nintendo Gameboy Music Module
  601. >16 string >\0 ("%.32s" by
  602. >48 string >\0 %.32s, copyright
  603. >80 string >\0 %.32s),
  604. >3 byte x version %u,
  605. >4 byte x %u tracks
  606. # IPS Patch Files from: From: Thomas Klausner <tk@giga.or.at>
  607. # see https://zerosoft.zophar.net/ips.php
  608. 0 string PATCH IPS patch file
  609. # Playstations Patch Files from: From: Thomas Klausner <tk@giga.or.at>
  610. 0 string PPF30 Playstation Patch File version 3.0
  611. >5 byte 0 \b, PPF 1.0 patch
  612. >5 byte 1 \b, PPF 2.0 patch
  613. >5 byte 2 \b, PPF 3.0 patch
  614. >>56 byte 0 \b, Imagetype BIN (any)
  615. >>56 byte 1 \b, Imagetype GI (PrimoDVD)
  616. >>57 byte 0 \b, Blockcheck disabled
  617. >>57 byte 1 \b, Blockcheck enabled
  618. >>58 byte 0 \b, Undo data not available
  619. >>58 byte 1 \b, Undo data available
  620. >6 string x \b, description: %s
  621. 0 string PPF20 Playstation Patch File version 2.0
  622. >5 byte 0 \b, PPF 1.0 patch
  623. >5 byte 1 \b, PPF 2.0 patch
  624. >>56 lelong >0 \b, size of file to patch %d
  625. >6 string x \b, description: %s
  626. 0 string PPF10 Playstation Patch File version 1.0
  627. >5 byte 0 \b, Simple Encoding
  628. >6 string x \b, description: %s
  629. # From: Daniel Dawson <ddawson@icehouse.net>
  630. # SNES9x .smv "movie" file format.
  631. 0 string SMV\x1A SNES9x input recording
  632. >0x4 lelong x \b, version %d
  633. # version 4 is latest so far
  634. >0x4 lelong <5
  635. >>0x8 ledate x \b, recorded at %s
  636. >>0xc lelong >0 \b, rerecorded %d times
  637. >>0x10 lelong x \b, %d frames long
  638. >>0x14 byte >0 \b, data for controller(s):
  639. >>>0x14 byte &0x1 #1
  640. >>>0x14 byte &0x2 #2
  641. >>>0x14 byte &0x4 #3
  642. >>>0x14 byte &0x8 #4
  643. >>>0x14 byte &0x10 #5
  644. >>0x15 byte ^0x1 \b, begins from snapshot
  645. >>0x15 byte &0x1 \b, begins from reset
  646. >>0x15 byte ^0x2 \b, NTSC standard
  647. >>0x15 byte &0x2 \b, PAL standard
  648. >>0x17 byte &0x1 \b, settings:
  649. # WIP1Timing not used as of version 4
  650. >>>0x4 lelong <4
  651. >>>>0x17 byte &0x2 WIP1Timing
  652. >>>0x17 byte &0x4 Left+Right
  653. >>>0x17 byte &0x8 VolumeEnvX
  654. >>>0x17 byte &0x10 FakeMute
  655. >>>0x17 byte &0x20 SyncSound
  656. # New flag as of version 4
  657. >>>0x4 lelong >3
  658. >>>>0x17 byte &0x80 NoCPUShutdown
  659. >>0x4 lelong <4
  660. >>>0x18 lelong >0x23
  661. >>>>0x20 leshort !0
  662. >>>>>0x20 lestring16 x \b, metadata: "%s"
  663. >>0x4 lelong >3
  664. >>>0x24 byte >0 \b, port 1:
  665. >>>>0x24 byte 1 joypad
  666. >>>>0x24 byte 2 mouse
  667. >>>>0x24 byte 3 SuperScope
  668. >>>>0x24 byte 4 Justifier
  669. >>>>0x24 byte 5 multitap
  670. >>>0x24 byte >0 \b, port 2:
  671. >>>>0x25 byte 1 joypad
  672. >>>>0x25 byte 2 mouse
  673. >>>>0x25 byte 3 SuperScope
  674. >>>>0x25 byte 4 Justifier
  675. >>>>0x25 byte 5 multitap
  676. >>>0x18 lelong >0x43
  677. >>>>0x40 leshort !0
  678. >>>>>0x40 lestring16 x \b, metadata: "%s"
  679. >>0x17 byte &0x40 \b, ROM:
  680. >>>(0x18.l-26) lelong x CRC32 0x%08x
  681. >>>(0x18.l-23) string x "%s"
  682. # Type: scummVM savegame files
  683. # From: Sven Hartge <debian@ds9.argh.org>
  684. 0 string SCVM ScummVM savegame
  685. >12 string >\0 "%s"
  686. #------------------------------------------------------------------------------
  687. # Nintendo GameCube / Wii file formats.
  688. #
  689. # Type: Nintendo GameCube/Wii common disc header data.
  690. # From: David Korth <gerbilsoft@gerbilsoft.com>
  691. # Reference: https://wiibrew.org/wiki/Wii_Disc
  692. 0 name nintendo-gcn-disc-common
  693. >0x20 string x "%.64s"
  694. >0x00 string x (%.6s
  695. >0x06 byte >0
  696. >>0x06 byte 1 \b, Disc 2
  697. >>0x06 byte 2 \b, Disc 3
  698. >>0x06 byte 3 \b, Disc 4
  699. >0x07 byte x \b, Rev.%02u)
  700. >0x18 belong 0x5D1C9EA3
  701. >>0x60 beshort 0x0101 \b (Unencrypted)
  702. # Type: Nintendo GameCube disc image
  703. # From: David Korth <gerbilsoft@gerbilsoft.com>
  704. # Reference: https://wiibrew.org/wiki/Wii_Disc
  705. 0x1C belong 0xC2339F3D Nintendo GameCube disc image:
  706. !:mime application/x-gamecube-rom
  707. >0 use nintendo-gcn-disc-common
  708. # Type: Nintendo GameCube embedded disc image
  709. # Commonly found on demo discs.
  710. # From: David Korth <gerbilsoft@gerbilsoft.com>
  711. # Reference: http://hitmen.c02.at/files/yagcd/yagcd/index.html#idx14.8
  712. 0 belong 0xAE0F38A2
  713. >0x0C belong 0x00100000
  714. >>(8.L+0x1C) belong 0xC2339F3D Nintendo GameCube embedded disc image:
  715. !:mime application/x-gamecube-rom
  716. >>>(8.L) use nintendo-gcn-disc-common
  717. # Type: Nintendo Wii disc image
  718. # From: David Korth <gerbilsoft@gerbilsoft.com>
  719. # Reference: https://wiibrew.org/wiki/Wii_Disc
  720. 0x18 belong 0x5D1C9EA3 Nintendo Wii disc image:
  721. >0 use nintendo-gcn-disc-common
  722. # Type: Nintendo Wii disc image (WBFS format)
  723. # From: David Korth <gerbilsoft@gerbilsoft.com>
  724. # Reference: https://wiibrew.org/wiki/Wii_Disc
  725. 0 string WBFS
  726. >0x218 belong 0x5D1C9EA3 Nintendo Wii disc image (WBFS format):
  727. !:mime application/x-wii-rom
  728. >>0x200 use nintendo-gcn-disc-common
  729. # Type: Nintendo GameCube/Wii disc image (CISO format)
  730. # NOTE: This is NOT the same as Compact ISO or PSP CISO,
  731. # though it has the same magic number.
  732. 0 string CISO
  733. # Other fields are used to determine what type of CISO this is:
  734. # - 0x04 == 0x00200000: GameCube/Wii CISO (block_size)
  735. # - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size)
  736. # - None of the above: Compact ISO.
  737. >4 lelong 0x200000
  738. >>8 byte 1
  739. >>>0x801C belong 0xC2339F3D Nintendo GameCube disc image (CISO format):
  740. !:mime application/x-wii-rom
  741. >>>>0x8000 use nintendo-gcn-disc-common
  742. >>>0x8018 belong 0x5D1C9EA3 Nintendo Wii disc image (CISO format):
  743. !:mime application/x-wii-rom
  744. >>>>0x8000 use nintendo-gcn-disc-common
  745. # Type: Nintendo GameCube/Wii disc image (GCZ format)
  746. # Due to zlib compression, we can't get the actual disc information.
  747. 0 lelong 0xB10BC001
  748. >4 lelong 0 Nintendo GameCube disc image (GCZ format)
  749. !:mime application/x-gamecube-rom
  750. >4 lelong 1 Nintendo Wii disc image (GCZ format)
  751. !:mime application/x-wii-rom
  752. >4 default x Nintendo GameCube/Wii disc image (GCZ format)
  753. # Type: Nintendo GameCube/Wii disc image (WDF format)
  754. 0 string WII\001DISC
  755. >8 belong 1
  756. # WDFv1
  757. >>0x54 belong 0xC2339F3D Nintendo GameCube disc image (WDFv1 format):
  758. !:mime application/x-gamecube-rom
  759. >>>0x38 use nintendo-gcn-disc-common
  760. >>0x58 belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv1 format):
  761. !:mime application/x-wii-rom
  762. >>>0x38 use nintendo-gcn-disc-common
  763. >8 belong 2
  764. # WDFv2
  765. >>(12.L+0x1C) belong 0xC2339F3D Nintendo GameCube disc image (WDFv2 format):
  766. !:mime application/x-gamecube-rom
  767. >>>(12.L) use nintendo-gcn-disc-common
  768. >>(12.L+0x18) belong 0x5D1C9EA3 Nintendo Wii disc image (WDFv2 format):
  769. !:mime application/x-wii-rom
  770. >>>(12.L) use nintendo-gcn-disc-common
  771. # Type: Nintendo GameCube/Wii disc image (WIA format)
  772. 0 string WIA\001 Nintendo
  773. >0x48 belong 1 GameCube
  774. !:mime application/x-gamecube-rom
  775. >0x48 belong 2 Wii
  776. !:mime application/x-wii-rom
  777. >0x48 default x GameCube/Wii
  778. >0x48 belong x disc image (WIA format):
  779. >>0x58 use nintendo-gcn-disc-common
  780. # Type: Nintendo GameCube/Wii disc image (with SDK header)
  781. # From: David Korth <gerbilsoft@gerbilsoft.com>
  782. # Reference: https://wiibrew.org/wiki/Wii_Disc
  783. 0 belong 0xFFFF0000
  784. >0x18 belong 0x00000000
  785. >>0x1C belong 0x00000000
  786. >>>0x8018 belong 0x5D1C9EA3 Nintendo Wii SDK disc image:
  787. !:mime application/x-wii-rom
  788. >>>>0x8000 use nintendo-gcn-disc-common
  789. >>>0x801C belong 0xC2339F3D Nintendo GameCube SDK disc image:
  790. !:mime application/x-gamecube-rom
  791. >>>>0x8000 use nintendo-gcn-disc-common
  792. #------------------------------------------------------------------------------
  793. # Nintendo 3DS file formats.
  794. #
  795. # Type: Nintendo 3DS "NCSD" image. (game cards and eMMC)
  796. # From: David Korth <gerbilsoft@gerbilsoft.com>
  797. # Reference: https://www.3dbrew.org/wiki/NCSD
  798. 0x100 string NCSD
  799. >0x118 lequad 0 Nintendo 3DS Game Card image
  800. # NCCH header for partition 0. (game data)
  801. >>0x1150 string >\0 \b: "%.16s"
  802. >>0x312 byte x (Rev.%02u)
  803. >>0x118C byte 2 (New3DS only)
  804. >>0x18D byte 0 (inner device)
  805. >>0x18D byte 1 (Card1)
  806. >>0x18D byte 2 (Card2)
  807. >>0x18D byte 3 (extended device)
  808. >0x118 bequad 0x0102020202000000 Nintendo 3DS eMMC dump (Old3DS)
  809. >0x118 bequad 0x0102020203000000 Nintendo 3DS eMMC dump (New3DS)
  810. # Nintendo 3DS version code.
  811. # Reference: https://www.3dbrew.org/wiki/Titles
  812. # Format: leshort containing three fields:
  813. # - 6-bit: Major
  814. # - 6-bit: Minor
  815. # - 4-bit: Revision
  816. # NOTE: Only supporting major/minor versions from 0-15 right now.
  817. # NOTE: Should be prefixed with "v".
  818. 0 name nintendo-3ds-version-code
  819. # Raw version.
  820. >0 leshort x \b%u,
  821. # Major version.
  822. >0 leshort&0xFC00 0x0000 0
  823. >0 leshort&0xFC00 0x0400 1
  824. >0 leshort&0xFC00 0x0800 2
  825. >0 leshort&0xFC00 0x0C00 3
  826. >0 leshort&0xFC00 0x1000 4
  827. >0 leshort&0xFC00 0x1400 5
  828. >0 leshort&0xFC00 0x1800 6
  829. >0 leshort&0xFC00 0x1C00 7
  830. >0 leshort&0xFC00 0x2000 8
  831. >0 leshort&0xFC00 0x2400 9
  832. >0 leshort&0xFC00 0x2800 10
  833. >0 leshort&0xFC00 0x2C00 11
  834. >0 leshort&0xFC00 0x3000 12
  835. >0 leshort&0xFC00 0x3400 13
  836. >0 leshort&0xFC00 0x3800 14
  837. >0 leshort&0xFC00 0x3C00 15
  838. # Minor version.
  839. >0 leshort&0x03F0 0x0000 \b.0
  840. >0 leshort&0x03F0 0x0010 \b.1
  841. >0 leshort&0x03F0 0x0020 \b.2
  842. >0 leshort&0x03F0 0x0030 \b.3
  843. >0 leshort&0x03F0 0x0040 \b.4
  844. >0 leshort&0x03F0 0x0050 \b.5
  845. >0 leshort&0x03F0 0x0060 \b.6
  846. >0 leshort&0x03F0 0x0070 \b.7
  847. >0 leshort&0x03F0 0x0080 \b.8
  848. >0 leshort&0x03F0 0x0090 \b.9
  849. >0 leshort&0x03F0 0x00A0 \b.10
  850. >0 leshort&0x03F0 0x00B0 \b.11
  851. >0 leshort&0x03F0 0x00C0 \b.12
  852. >0 leshort&0x03F0 0x00D0 \b.13
  853. >0 leshort&0x03F0 0x00E0 \b.14
  854. >0 leshort&0x03F0 0x00F0 \b.15
  855. # Revision.
  856. >0 leshort&0x000F x \b.%u
  857. # Type: Nintendo 3DS "NCCH" container.
  858. # https://www.3dbrew.org/wiki/NCCH
  859. 0x100 string NCCH Nintendo 3DS
  860. >0x18D byte&2 0 File Archive (CFA)
  861. >0x18D byte&2 2 Executable Image (CXI)
  862. >0x150 string >\0 \b: "%.16s"
  863. >0x18D byte 0x05
  864. >>0x10E leshort x (Old3DS System Update v
  865. >>0x10E use nintendo-3ds-version-code
  866. >>0x10E leshort x \b)
  867. >0x18D byte 0x15
  868. >>0x10E leshort x (New3DS System Update v
  869. >>0x10E use nintendo-3ds-version-code
  870. >>0x10E leshort x \b)
  871. >0x18D byte !0x05
  872. >>0x18D byte !0x15
  873. >>>0x112 byte x (v
  874. >>>0x112 use nintendo-3ds-version-code
  875. >>>0x112 byte x \b)
  876. >0x18C byte 2 (New3DS only)
  877. # Type: Nintendo 3DS "SMDH" file. (application description)
  878. # From: David Korth <gerbilsoft@gerbilsoft.com>
  879. # Reference: https://3dbrew.org/wiki/SMDH
  880. 0 string SMDH Nintendo 3DS SMDH file
  881. >0x208 leshort !0
  882. >>0x208 lestring16 x \b: "%.128s"
  883. >>0x388 leshort !0
  884. >>>0x388 lestring16 x by %.128s
  885. >0x208 leshort 0
  886. >>0x008 leshort !0
  887. >>>0x008 lestring16 x \b: "%.128s"
  888. >>>0x188 leshort !0
  889. >>>>0x188 lestring16 x by %.128s
  890. # Type: Nintendo 3DS Homebrew Application.
  891. # From: David Korth <gerbilsoft@gerbilsoft.com>
  892. # Reference: https://3dbrew.org/wiki/3DSX_Format
  893. 0 string 3DSX Nintendo 3DS Homebrew Application (3DSX)
  894. #------------------------------------------------------------------------------
  895. # a7800: file(1) magic for the Atari 7800 raw ROM format.
  896. # From: David Korth <gerbilsoft@gerbilsoft.com>
  897. # Reference: https://sites.google.com/site/atari7800wiki/a78-header
  898. 0 byte >0
  899. >0 byte <3
  900. >>1 string ATARI7800 Atari 7800 ROM image
  901. !:mime application/x-atari-7800-rom
  902. >>>0x11 string >\0 \b: "%.32s"
  903. # Display type.
  904. >>>0x39 byte 0 (NTSC)
  905. >>>0x39 byte 1 (PAL)
  906. >>>0x36 byte&1 1 (POKEY)
  907. #------------------------------------------------------------------------------
  908. # vectrex: file(1) magic for the GCE Vectrex raw ROM format.
  909. # From: David Korth <gerbilsoft@gerbilsoft.com>
  910. # Reference: http://www.playvectrex.com/designit/chrissalo/hello1.htm
  911. #
  912. # NOTE: Title is terminated with 0x80, not 0.
  913. # The header is terminated with a 0, so that will
  914. # terminate the title as well.
  915. #
  916. 0 string g\ GCE Vectrex ROM image
  917. >0x11 string >\0 \b: "%.16s"
  918. #------------------------------------------------------------------------------
  919. # amiibo: file(1) magic for Nintendo amiibo NFC dumps.
  920. # From: David Korth <gerbilsoft@gerbilsoft.com>
  921. # Reference: https://www.3dbrew.org/wiki/Amiibo
  922. 0x00 byte 0x04
  923. >0x0A beshort 0x0FE0
  924. >>0x0C belong 0xF110FFEE
  925. >>>0x208 beshort 0x0100
  926. >>>>0x020A byte 0x0F
  927. >>>>>0x020C bequad 0x000000045F000000
  928. >>>>>>0x5B byte 0x02
  929. >>>>>>>0x54 belong x Nintendo amiibo NFC dump - amiibo ID: %08X-
  930. >>>>>>>0x58 belong x \b%08X