don't click here

B2N File Format

Discussion in 'Technical Discussion' started by Herm the Germ, Sep 23, 2011.

  1. Herm the Germ

    Herm the Germ

    Hmm, not bad. Well done, doctor! Member
    1,482
    0
    0
    Dresden, Saxony, Germany
    MIDI-to-SMPS-conversions, mostly. Takin' requests, too.
    So, I'm trying to figure out aforementioned format, found (so far solely) in "All Kamen Rider: Rider Generation" for Nintendo DS. It's a sprite-collection, essentially, but it's different from regular Nintendo DS sprite format. If anyone could help me figure this out and make things more convenient than "shift pixels constantly in CrystalTile to be able to rip anything" that would be much appreciated and I'd basically love you forever (platonically, anywho :v: ).

    Here's what I have figured out so far (as per usual, any unprofessional terminology can be attributed to me being a n00blet with these things 8D ) :

    Byte (80)
    WORD (varies from file to file, unknown purpose)
    Byte (0)
    WORD (20)
    WORD (0)
    Byte (60)
    WORD (varies from file to file, identical to the variable one above)
    Byte (0)
    DWORD (0)
    WORD (4)
    WORD (varies)
    WORD (1)
    QUAD (0)

    After that follows 512 bytes in Palette data. This palette data can be inserted into any standard Nintendo DS NCLR-Palette file, meaning it's essentially the same format.

    Following that is a block of data which I have not determined a purpose for yet. The block varies in size from file to file, but usually has data in the format "WORD (variable), WORD (0)." Could be some kind of address-lookup-table?

    Past that block of data begins sprite data, from what I can gather. Each sprite graphic has some header of it's own.

    WORD (width)
    WORD (height)
    WORD (varies, unknown purpose)
    WORD (varies, unknown purpose)
    WORD (size in byte)
    WORD (0)

    Then follows the actual sprite-data, and after that, the next file until it's all done.

    So, uh… can anyone here pretty please help me with this, maybe? xD; I know it's an obscure game and all that, but, yeah, I would really like to know stuff here. D:
    If it helps, here be an example file
     
  2. ValleyBell

    ValleyBell

    Tech Member
    246
    25
    28
    researching PC-98/X68000 sound drivers
    I took some minutes and looked a little at the format. (although 2 files are always better than only one, so you can compare what differs)

    Header:
    DWORD: Buffer Size for data of whole file
    DWORD: Palette Offset
    DWORD: Buffer Size for palette + sprite data
    DWORD: decompressed data (maybe) - first DWORD is with, second one without header data
    WORD: (no idea)
    WORD: Sprite Count (here 0x68)
    WORD: (no idea)
    the other header bytes are 0

    then there's 0x200 bytes of palette data

    at 0x220 there's a pointer table with [Sprite Count] DWORD pointers to some location (maybe data offset after loading them into NDS memory)

    after these 0x1A0 bytes (0x68 DWORDs) at 0x3C0 the actual data begins, which consists of [Sprite Count] Sprites

    each sprite consists of Sprite Header + Sprite Data
    Sprite Header:
    WORD: Sprite Width
    WORD: Sprite Height
    WORD: X-Offset (maybe similar to the HotSpot attribute in TGF)
    WORD: Y-Offset (same as above)
    DWORD: Sprite Data Size
    Note: there are lots of sprites that have all bytes in the header zeroed out, but they take some memory. I wrote a small tool to make the following list:
    Code (Text):
    1.  
    2. FileID  FileOfs DataLen MemOfs  MemLen
    3. 00  03C0    0000    00220   038C
    4. 01  03CC    0380    005AC   038C
    5. 02  0758    0380    00938   038C
    6. 03  0AE4    0000    00CC4   03CC
    7. 04  0AF0    0000    01090   038C
    8. 05  0AFC    0000    0141C   038C
    9. 06  0B08    0000    017A8   03CC
    10. 07  0B14    0440    01B74   044C
    11. 08  0F60    0380    01FC0   038C
    12. 09  12EC    0000    0234C   03CC
    13. 0A  12F8    0000    02718   040C
    14. 0B  1304    0000    02B24   040C
    15. 0C  1310    0000    02F30   044C
    16. 0D  131C    0000    0337C   044C
    17. 0E  1328    0000    037C8   040C
    18. 0F  1334    0380    03BD4   038C
    19. 10  16C0    0340    03F60   034C
    20. 11  1A0C    0000    042AC   03CC
    21. 12  1A18    03C0    04678   03CC
    22. 13  1DE4    0280    04A44   028C
    23. 14  2070    0000    04CD0   014C
    24. 15  207C    0000    04E1C   028C
    25. 16  2088    0000    050A8   014C
    26. 17  2094    0000    051F4   012C
    27. 18  20A0    0000    05320   01CC
    28. 19  20AC    0000    054EC   020C
    29. 1A  20B8    0000    056F8   02CC
    30. 1B  20C4    0000    059C4   018C
    31. 1C  20D0    0000    05B50   014C
    32. 1D  20DC    0000    05C9C   014C
    33. 1E  20E8    0000    05DE8   020C
    34. 1F  20F4    0000    05FF4   018C
    35. 20  2100    0000    06180   028C
    36. 21  210C    0120    0640C   012C
    37. 22  2238    0000    06538   024C
    38. 23  2244    0000    06784   03CC
    39. 24  2250    0300    06B50   030C
    40. 25  255C    0280    06E5C   028C
    41. 26  27E8    0000    070E8   028C
    42. 27  27F4    0000    07374   014C
    43. 28  2800    0000    074C0   028C
    44. 29  280C    0000    0774C   01CC
    45. 2A  2818    0000    07918   02CC
    46. 2B  2824    0000    07BE4   020C
    47. 2C  2830    0000    07DF0   00EC
    48. 2D  283C    03C0    07EDC   03CC
    49. 2E  2C08    0000    082A8   00EC
    50. 2F  2C14    0300    08394   030C
    51. 30  2F20    0280    086A0   028C
    52. 31  31AC    0000    0892C   01CC
    53. 32  31B8    0240    08AF8   024C
    54. 33  3404    0000    08D44   024C
    55. 34  3410    0000    08F90   012C
    56. 35  341C    0000    090BC   01CC
    57. 36  3428    0000    09288   02CC
    58. 37  3434    0000    09554   010C
    59. 38  3440    0280    09660   028C
    60. 39  36CC    0100    098EC   010C
    61. 3A  37D8    0240    099F8   024C
    62. 3B  3A24    0280    09C44   028C
    63. 3C  3CB0    0000    09ED0   016C
    64. 3D  3CBC    0000    0A03C   02CC
    65. 3E  3CC8    0000    0A308   01AC
    66. 3F  3CD4    0000    0A4B4   012C
    67. 40  3CE0    0000    0A5E0   024C
    68. 41  3CEC    0000    0A82C   020C
    69. 42  3CF8    0000    0AA38   024C
    70. 43  3D04    0000    0AC84   018C
    71. 44  3D10    0000    0AE10   01AC
    72. 45  3D1C    0000    0AFBC   01AC
    73. 46  3D28    0280    0B168   028C
    74. 47  3FB4    0280    0B3F4   028C
    75. 48  4240    0240    0B680   024C
    76. 49  448C    0240    0B8CC   024C
    77. 4A  46D8    0000    0BB18   020C
    78. 4B  46E4    0000    0BD24   020C
    79. 4C  46F0    0000    0BF30   01EC
    80. 4D  46FC    02C0    0C11C   02CC
    81. 4E  49C8    0000    0C3E8   034C
    82. 4F  49D4    0000    0C734   02CC
    83. 50  49E0    0000    0CA00   034C
    84. 51  49EC    0000    0CD4C   028C
    85. 52  49F8    0000    0CFD8   020C
    86. 53  4A04    0000    0D1E4   016C
    87. 54  4A10    0200    0D350   020C
    88. 55  4C1C    02C0    0D55C   02CC
    89. 56  4EE8    0000    0D828   016C
    90. 57  4EF4    00C0    0D994   00CC
    91. 58  4FC0    0000    0DA60   00CC
    92. 59  4FCC    0000    0DB2C   018C
    93. 5A  4FD8    0180    0DCB8   018C
    94. 5B  5164    0100    0DE44   010C
    95. 5C  5270    0000    0DF50   020C
    96. 5D  527C    0100    0E15C   010C
    97. 5E  5388    0000    0E268   012C
    98. 5F  5394    0000    0E394   01CC
    99. 60  53A0    00E0    0E560   00EC
    100. 61  548C    0000    0E64C   080C
    101. 62  5498    0000    0EE58   0E0C
    102. 63  54A4    0000    0FC64   030C
    103. 64  54B0    0240    0FF70   024C
    104. 65  56FC    2500    101BC   250C
    105. 66  7C08    2500    126C8   250C
    106. 67  A114    1200    14BD4   128C
    FileOfs is the offset of the sprite header in the file, DataLen is the length of the sprite data excluding the header, MemOfs is the memory offset from the pointer table and MemLen the amount of memory the sprite takes including sprite header

    The last sprite takes 0x80 bytes too much memory (based on [Buffer Size] - [Memory Offset]), so the game might store some additional data.


    Note: I never did even a little NDS hacking, so I don't know how useful that information is. But I had some fun.
     
  3. Herm the Germ

    Herm the Germ

    Hmm, not bad. Well done, doctor! Member
    1,482
    0
    0
    Dresden, Saxony, Germany
    MIDI-to-SMPS-conversions, mostly. Takin' requests, too.
    Why, uh, thank you, fellow countryman. o.o;
    Well, uh, This at least gives me a few pointers (pun not intended) with this, so maybe I'll figure something out later down the road -- much appreciated, at any rate. o.o

    The X and Y offset thingies might have something to do with rotational axis', because in this game, a character's head, body, arms, hands, legs, feet, etc. are all their own sprites and able to Mode7-rotate so as to be easy to pose flexibly.