Xbb files

Discussion in 'NDS - ROM Hacking and Translations' started by ChaosBoi, Jan 20, 2014.

  1. ChaosBoi
    OP

    ChaosBoi Ushiromiya Battler

    Member
    1,339
    60
    Feb 19, 2007
    United States
    California
    While browsing through the data for Harvest Moon Sunshine Islands, I came across a dozen of xbb format files. I was wondering if anyone knows how to unpack these, as they contain the graphic files of the game that I want to modify.

    I've done a google on xbb file formats for nds, but it yielded no results. The only relevant thing I could find was a really old post here by someone named Gryphon, whom claimed that he made a tool for unpacking these and that these were simpler than narc files. However, he never did upload his tool and I am not quite sure if he is still around (Sent him a PM about it, but realized that his post was dated way back in 2009 or so).

    So my question is, does anyone here know how to unpack xbb files? I can't even find any documentations on them, so I am hoping someone who is more well verse with NDS hacking than I am can help me out. I'd really appreciate :) .
     
  2. Auryn

    Auryn GBAtemp Advanced Fan

    Member
    537
    347
    Jul 21, 2011
    Swaziland
    Well, if they are similar to a NARC, HERE you have some documentation about NARC.
    Try to see if you can find some common things.
     
  3. FAST6191

    FAST6191 Techromancer

    pip Reporter
    23,355
    9,148
    Nov 21, 2005
    For the record I am seeing a lot of NCER, NANR, NCLR, NCBR... the usual graphics and graphics helper formats and the usual suspects as far as 3d goes.

    Still there are lots of .xbb files in it in a folder tree called rom\pics\char\*
    Various sizes exist though there does seem to be a logic at work.

    Took a look. Kind of similar to a lot of archive formats I have worked with over the course of things. If the file names within them are anything to go by then it is also full of NCER, NANR, NCLR, NCBR... type things.

    The file appears to start XBB then 01 in the hex (or 58424201 all in hex) for every thing I saw (I pulled a selection of various sizes for everything). After that is another number which appears to be a hex count of the number of files contained.

    After this there seems to be 00 padding until 20 hex.

    Buttlerfly shadow has two files which is nice so I will have a look at that first.

    Usual 32 bit byte flip

    Unless I miss my guess it is
    File location (100h in this case, for files larger this first value appears to be aligned to the nearest 100h, this normally means 200h or 100h though with the occasional 300h for the really big files)
    File length (0228h, backed up by the internal NCLR length parameter and seen in other formats that are not so uniform in length)
    File name location (the file names do appear to be variable length and end to end with only a 00 between them).
    No there is 32 bits of something I can not determine the use of, it is usually all random and full up (no 0000???? ???????? or anything). It is not memory locations (things that do not exist appear), it is not locations within the ROM (too variable between names), names are obviously next so it is not some reference to that.
    Between the end and the names are the same random values as ended the other files, though here they are in a different order for archives with more than two parts separated by 32 bits. Said other 32 bits are numbers which seem to correspond with the file order (if the random value is followed by a 04 then the random value will be the same as the random value for the file 04, do note like a good programming language things start counting from 00).
    Following this is the file names. Again they are however long they are (you were already told the location) and between each there is a 00, I guess it is location and simple string read that is stopped by a 00 for this (a typical C affair).

    I am seeing compression in some of the files, usual type 10 LZ by the looks of things. This is easy enough to deal with and in my samples the things I saw with it tended to have _LZ in the names.

    The random stuff has me stumped right now, I should compare it between files more but I did not see any matches from a quick scan. You have all the other data about the files so it is not some obfuscated stuff. It only bothers me because I like to figure things out, it might not trouble you though. Best policy is to leave it alone and match it back up as and when you rebuild the files. If the game crashes and you have changed the length of the files you know it is that. I do not think they would be so crazy as to do something like a checksum (or at least not actually use it in game). However this is Marvelous Entertainment we are dealing with so who knows, likewise if they are using an archive format from another platform (entirely possible when it comes to the DS) that is a thing and it is about the only reasonable thing left for me to guess (the matching file number - random value thing also being a good fit for that theory). I tried a few guesses for checksum values but guessing checksum variables (if it is even a standard method at all) is almost like trying to guess a password. The trick will be to see if there are any identical files and if their random values match, there is a good bet for this as palettes might well be the same.

    The random stuff aside I agree it is a simple format. No calculations really even needed to decode or rebuild it which is great really.
     
  4. ChaosBoi
    OP

    ChaosBoi Ushiromiya Battler

    Member
    1,339
    60
    Feb 19, 2007
    United States
    California
    Auryn: Thanks for the link! I will give that a more detailed look through when I wake up later.

    fast: The files in char are the ones I'm specifically looking to try and modify, particularly the ones within Player_M_Raised and Player_W_Raised. It took awhile because I never ran the game on an emulator before, but I finally found out that those two files are the biggest cause of the game crashing whenever I tried to do a sprite replacement hack like the one I did for Island of Happiness.

    If you ever do manage to unpack at least one of these before I can, I'd much like to know how the process is done. I'm still fairly new at this and time is not really on my side at the moment since I'm nearing the end of my trade school, so it's taking me longer than I'd like to.
     
  5. FAST6191

    FAST6191 Techromancer

    pip Reporter
    23,355
    9,148
    Nov 21, 2005
    The info I gave should have been enough for you to get at the NCLR,NCBR, NANR.... files (all common files which crystaltile2, tinke and the like will be able to open and edit) contained within the Xbb archive files.

    Those ones you mention seem to be bigger than most but no deviations or anything.

    Still http://crackerscrap.com/index.php click on projects and get a copy of filecutter. It will be necessary for the batch file I will make to extract everything.

    One for player_m_raise.xbb

    Code:
    filecutter PLAYER_M_RAISE.xbb 5936 player_m_raise_01.NCBR -s 1792
    filecutter PLAYER_M_RAISE.xbb 552 player_m_raise_01.NCER -s 7936
    filecutter PLAYER_M_RAISE.xbb 412 player_m_raise_01.NANR -s 8704
    filecutter PLAYER_M_RAISE.xbb 19504 player_m_raise_02.NCBR -s 9216
    filecutter PLAYER_M_RAISE.xbb 1328 player_m_raise_02.NCER -s 28928
    filecutter PLAYER_M_RAISE.xbb 496 player_m_raise_02.NANR -s 30464
    filecutter PLAYER_M_RAISE.xbb 30000 player_m_raise_03.NCBR -s 30976
    filecutter PLAYER_M_RAISE.xbb 1796 player_m_raise_03.NCER -s 61184
    filecutter PLAYER_M_RAISE.xbb 1180 player_m_raise_03.NANR -s 63232
    filecutter PLAYER_M_RAISE.xbb 29232 player_m_raise_04.NCBR -s 64512
    filecutter PLAYER_M_RAISE.xbb 1808 player_m_raise_04.NCER -s 93952
    filecutter PLAYER_M_RAISE.xbb 1500 player_m_raise_04.NANR -s 96000
    filecutter PLAYER_M_RAISE.xbb 20912 player_m_raise_1.NCBR -s 97536
    filecutter PLAYER_M_RAISE.xbb 1388 player_m_raise_1.NCER -s 118528
    filecutter PLAYER_M_RAISE.xbb 480 player_m_raise_1.NANR -s 120064
    filecutter PLAYER_M_RAISE.xbb 3632 player_m_raise_2.NCBR -s 120576
    filecutter PLAYER_M_RAISE.xbb 308 player_m_raise_2.NCER -s 124416
    filecutter PLAYER_M_RAISE.xbb 240 player_m_raise_2.NANR -s 124928
    filecutter PLAYER_M_RAISE.xbb 17072 player_m_raise_3.NCBR -s 125184
    filecutter PLAYER_M_RAISE.xbb 1136 player_m_raise_3.NCER -s 142336
    filecutter PLAYER_M_RAISE.xbb 496 player_m_raise_3.NANR -s 143616
    filecutter PLAYER_M_RAISE.xbb 15664 player_m_raise_4.NCBR -s 144128
    filecutter PLAYER_M_RAISE.xbb 1068 player_m_raise_4.NCER -s 160000
    filecutter PLAYER_M_RAISE.xbb 404 player_m_raise_4.NANR -s 161280
    filecutter PLAYER_M_RAISE.xbb 6064 player_m_raise_5.NCBR -s 161792
    filecutter PLAYER_M_RAISE.xbb 447 player_m_raise_5.NCER -s 167936
    filecutter PLAYER_M_RAISE.xbb 215 player_m_raise_5.NANR -s 168448
    filecutter PLAYER_M_RAISE.xbb 6064 player_m_raise_6.NCBR -s 168704
    filecutter PLAYER_M_RAISE.xbb 395 player_m_raise_6.NCER -s 174848
    filecutter PLAYER_M_RAISE.xbb 179 player_m_raise_6.NANR -s 175360
    filecutter PLAYER_M_RAISE.xbb 21424 player_m_raise_7.NCBR -s 175616
    filecutter PLAYER_M_RAISE.xbb 1460 player_m_raise_7.NCER -s 197120
    filecutter PLAYER_M_RAISE.xbb 512 player_m_raise_7.NANR -s 198656
    filecutter PLAYER_M_RAISE.xbb 5936 player_m_raise_8.NCBR -s 199168
    filecutter PLAYER_M_RAISE.xbb 439 player_m_raise_8.NCER -s 205312
    filecutter PLAYER_M_RAISE.xbb 171 player_m_raise_8.NANR -s 205824
    filecutter PLAYER_M_RAISE.xbb 552 player_m_raise.NCLR -s 206080
    
    One for player_F_raise.xbb
    Code:
    filecutter PLAYER_W_RAISE.xbb 5424 player_w_raise_01.NCBR -s 1792
    filecutter PLAYER_W_RAISE.xbb 528 player_w_raise_01.NCER -s 7424
    filecutter PLAYER_W_RAISE.xbb 412 player_w_raise_01.NANR -s 8192
    filecutter PLAYER_W_RAISE.xbb 18096 player_w_raise_02.NCBR -s 8704
    filecutter PLAYER_W_RAISE.xbb 1304 player_w_raise_02.NCER -s 26880
    filecutter PLAYER_W_RAISE.xbb 496 player_w_raise_02.NANR -s 28416
    filecutter PLAYER_W_RAISE.xbb 28720 player_w_raise_03.NCBR -s 28928
    filecutter PLAYER_W_RAISE.xbb 1888 player_w_raise_03.NCER -s 57856
    filecutter PLAYER_W_RAISE.xbb 1180 player_w_raise_03.NANR -s 59904
    filecutter PLAYER_W_RAISE.xbb 36144 player_w_raise_04.NCBR -s 61184
    filecutter PLAYER_W_RAISE.xbb 2296 player_w_raise_04.NCER -s 97536
    filecutter PLAYER_W_RAISE.xbb 1124 player_w_raise_04.NANR -s 99840
    filecutter PLAYER_W_RAISE.xbb 20528 player_w_raise_1.NCBR -s 101120
    filecutter PLAYER_W_RAISE.xbb 1280 player_w_raise_1.NCER -s 121856
    filecutter PLAYER_W_RAISE.xbb 480 player_w_raise_1.NANR -s 123136
    filecutter PLAYER_W_RAISE.xbb 6192 player_w_raise_2.NCBR -s 123648
    filecutter PLAYER_W_RAISE.xbb 564 player_w_raise_2.NCER -s 130048
    filecutter PLAYER_W_RAISE.xbb 412 player_w_raise_2.NANR -s 130816
    filecutter PLAYER_W_RAISE.xbb 19760 player_w_raise_3.NCBR -s 131328
    filecutter PLAYER_W_RAISE.xbb 1392 player_w_raise_3.NCER -s 151296
    filecutter PLAYER_W_RAISE.xbb 496 player_w_raise_3.NANR -s 152832
    filecutter PLAYER_W_RAISE.xbb 13744 player_w_raise_4.NCBR -s 153344
    filecutter PLAYER_W_RAISE.xbb 983 player_w_raise_4.NCER -s 167168
    filecutter PLAYER_W_RAISE.xbb 403 player_w_raise_4.NANR -s 168192
    filecutter PLAYER_W_RAISE.xbb 6448 player_w_raise_5.NCBR -s 168704
    filecutter PLAYER_W_RAISE.xbb 463 player_w_raise_5.NCER -s 175360
    filecutter PLAYER_W_RAISE.xbb 215 player_w_raise_5.NANR -s 175872
    filecutter PLAYER_W_RAISE.xbb 4656 player_w_raise_6.NCBR -s 176128
    filecutter PLAYER_W_RAISE.xbb 379 player_w_raise_6.NCER -s 180992
    filecutter PLAYER_W_RAISE.xbb 179 player_w_raise_6.NANR -s 181504
    filecutter PLAYER_W_RAISE.xbb 20528 player_w_raise_7.NCBR -s 181760
    filecutter PLAYER_W_RAISE.xbb 1340 player_w_raise_7.NCER -s 202496
    filecutter PLAYER_W_RAISE.xbb 512 player_w_raise_7.NANR -s 204032
    filecutter PLAYER_W_RAISE.xbb 552 player_w_raise.NCLR -s 204544
    Getting them back in will be fun if you change the sizes as you will also have to change the locations of everything following it. If it is just one file I would consider repointing to the end of the file.
    Alternatively you might not need to unpack the file and instead use the information to direct your tile editor/hex editor to the locations in question and then read off any information contained with the archived files (they are all known for including tile sizes, palettes and whatever else).
    It seems my usual format specs link is not working right now so http://www.romhacking.net/documents/469/ might have to do, I have the later versions of those documents from the same author on my hard drive if it becomes necessary though.

    On sample of what awaits you
    harvestmoonxbbunpackdemo_1.jpg
     
  6. ChaosBoi
    OP

    ChaosBoi Ushiromiya Battler

    Member
    1,339
    60
    Feb 19, 2007
    United States
    California
    Thank you very much Fast! I was wondering, how would I go about repacking it once I split them apart? I have never done repacking before outside of using tools like Tinke for common files and DSBuff for NDS roms.
     
  7. FAST6191

    FAST6191 Techromancer

    pip Reporter
    23,355
    9,148
    Nov 21, 2005
    Ideally you would have to figure out the meaning of the random data. If it turns out the game does not use it then you can ignore it (though at least put something the same length as the random data in there).

    Still repacking. Not with that. You get to make a program to stick them all back together, figure out the new file sizes, the new file locations and the names of the files (you probably will want to put them back in the same order they went in, not sure if it is all alphabetical). Chances are unless Gryphon gets back to you then you will be doing it yourself, it would make a great project to tackle if you are new to programming though. I can not think of a simple way to do this in a spreadsheet or something like that which is all I did for those extraction batch files.

    If you are just editing one file and making it bigger (unless it is compressed or you are adding new animations then you should be OK) you can try editing in place (all the information is there for you to point your hex editor/tile editor at the appropriate location) or you can try adding the file to the end of the archive and then repointing to that file, there is no archive length or anything to get in the way there.
     
  8. I pwned U!

    I pwned U! GBAtemp Advanced Fan

    Member
    833
    1,117
    Jun 14, 2013
    United States
    Would these files, by any chance, be related to the .xbb files in the Mario Vs. Donkey Kong games? I just came across the files in the games recently, and then I just happened to come across this thread about a possibly similar format.
     
  9. FAST6191

    FAST6191 Techromancer

    pip Reporter
    23,355
    9,148
    Nov 21, 2005
    I am not seeing any xbb files in the Euro version of March of the minis. Mbb which appears to be a different file format (mostly type 10 compressed whatever it normally holds, in the samples I took various background imagery).

    Had some nice developer leftovers though which I am picking through so thanks for that.
     
  10. I pwned U!

    I pwned U! GBAtemp Advanced Fan

    Member
    833
    1,117
    Jun 14, 2013
    United States
    Yes, I am sorry about that, I meant to type .mbb, but I got it mixed up. Also, how did you decompress the files? I tried several LZ decompression tools on one file (options.mbb), but none of them worked.
     
  11. FAST6191

    FAST6191 Techromancer

    pip Reporter
    23,355
    9,148
    Nov 21, 2005
    Do you mean the BG_OPTIONS.mbb file in the data/backgrounds directory? Otherwise I only see a bunch of .binc files in the data/menu directory that have the word options in (I am still using the EU version by the way).

    For the former... it looks like standard type compression that has been used since the GBA and handled by everything. It has a 5pl file to go with it which looks like a palette file (it starts with NTPL which I do not think is a standard palette type but I could be wrong, it certainly looks like a standard DS style file format).

    I thought I would try a quick edit and inject
    mariomarchminis_options_demo.jpg
     
  12. I pwned U!

    I pwned U! GBAtemp Advanced Fan

    Member
    833
    1,117
    Jun 14, 2013
    United States
    Sorry, I should have been more specific. The options.mbb file came from the background folder in Mini Land Mayhem. I will try the file you used next.