console 6.7 KB

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