Advertisement
DashmanGC

Files inside add00dat.bin

Jul 5th, 2014
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 KB | None | 0 0
  1. -----------------
  2. BM files
  3. -----------------
  4.  
  5. All BM files have a 32-byte header, followed by image / colour data.
  6.  
  7. bytes 0 - 2: "BMP"
  8. byte 3: Type.
  9. bytes 4 - 7: Not sure, maybe number of colours?
  10. bytes 8 - 11: Width.
  11. bytes 12 - 15: Height.
  12. bytes 16 - 31: Zeroes.
  13.  
  14. * If the BM file contains image data, it's stored as 8x8 tiles. If it's colour data, they're 4-byte RGBA colours.
  15. * Values are big endian.
  16.  
  17. There's at least 4 types:
  18.  
  19. - BM6: (start with "BMP" and a 06) These are 4bpp bitmaps with no palette. The palette files for BM6s are the BM7 files. If there's no BM7 file after this one, the palette in use is the last one seen (typically, one BM7 can affect several BM6s, like with location cards). There can be several BM7 files after a BM6. BM6s are always followed by either one (or many) SCR file(s) or one (or many) PAT file(s).
  20.  
  21. - BM7: (start with "BMP" and a 07) Palette files with 16 colours. Width and Height are set to 0.
  22.  
  23. - BM9: (start with "BMP" and a 09) These are 8bpp bitmaps, always followed by a BM10 file containing their palette. They're not followed by any other file SCR or PAT).
  24.  
  25. - BM10: (start with "BMP" and a 0a) Palette files with 256 colours. Width and Height have values, but I have no idea what for. There seems to be 2 bytes per colour instead of the usual 4. There can be several BM9s followed by a single BM10 (that supposedly affect all the previous ones).
  26.  
  27. -----------------
  28. SCR files
  29. -----------------
  30.  
  31. SCR files are tile map files. Their header is 32-byte long, like BM files.
  32.  
  33. bytes 0 - 3: "SCR" and 00
  34. bytes 4 - 7: Width (in tiles)
  35. bytes 8 - 11: Height (in tiles)
  36. bytes 12 - 15: If it's 0, you can find "flip codes" among the tile numbers. If it's 1, it's just tile numbers.
  37. bytes 16 - 31: Zeroes.
  38.  
  39. * Values are big endian.
  40.  
  41. The way a tiled image works is more or less like this: Imagine you have an 8x8 image and you want to divide it in 4x4 tiles (basically, cut it in 4 pieces). Counting bytes from 1, the image has bytes 1 to 64. The first tile (top-left) has bytes 1, 2, 3, 4, 9, 10, 11, 12, 17, 18, 19, 20, 25, 26, 27 and 28. Graphically:
  42.  
  43. 1 1 1 1 2 2 2 2
  44. 1 1 1 1 2 2 2 2
  45. 1 1 1 1 2 2 2 2
  46. 1 1 1 1 2 2 2 2
  47. 3 3 3 3 4 4 4 4
  48. 3 3 3 3 4 4 4 4
  49. 3 3 3 3 4 4 4 4
  50. 3 3 3 3 4 4 4 4
  51.  
  52. The tilemap data simply says which tiles are used to form an image. For example, it could make an image like this with the previous example:
  53.  
  54. 1 2 2 2 2 2 2 2 2 2 1
  55. 3 4 4 4 4 4 4 4 4 4 3
  56. 3 4 4 4 4 4 4 4 4 4 3
  57. 3 4 4 4 4 4 4 4 4 4 3
  58. 1 2 2 2 2 2 2 2 2 2 1
  59.  
  60. Data for a tile uses 2 bytes. Usually, both bytes simply indicate the number of the tile, but there's cases in which they hold a value that is outside the number of tiles available. When this happens, the data in the first byte is used as a modifier as well.
  61.  
  62. Modifiers:
  63.  
  64. - 04: Seems to indicate the tile is flipped (mirrored) horizontally.
  65. - 08: Seems to indicate the tile is flipped (mirrored) vertically.
  66. - 0c: Seems to indicate the tile is turned 180 degrees (flipped both horizontally and vertically).
  67.  
  68. Notice how 0c is 12, which is 4 + 8. This means only two bits in the first byte (the one for 4 and 8) are used to indicate the flips. This is a graphical representation of the bits forming the 2 bytes of tile data:
  69.  
  70. xxxx VHAA AAAA AAAA
  71.  
  72. Where 'x' is an unused bit, 'V' is the bit indicating the vertical flips, 'H' indicates horizontal flips and 'A' is a bit used for the address of the tile. The maximum number of tiles that can be addressed in this way is 1023 (0x03ff).
  73.  
  74. SCR files affect the last seen BM6 file. They're always 32-byte aligned (they add padding to ensure it).
  75.  
  76. -----------------
  77. PAT files
  78. -----------------
  79.  
  80. PAT files are likely used for animations. There can be several PAT files after a BM6 (with or without BM7). After a set of PAT files, there's always a TIM file.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement