r/NDSHacks • • May 05 '20

Decompression(?) of .bin files

I'm trying to graphically mod StyleSavvy source files. When first scrounging through them in CrystalTile, I noticed that most of the graphical files were not in the normal 3 file formats (NCSR, NGCR, NCLR), but instead in .bin files.

Trying to unpack these with an ISO imager and failing, I opened one in an actual hex editor (one of the startup logos) and realized that it seems to be these 3 file formats stuck together.

This is the bin file, uploaded to dropbox. You can open it in a hex editor to see the familiar headers of NCSR, NGCR, and NCLR

(This is the image that the bin file generates)[https://imgur.com/xX7R2OE]

So I "unpacked" the bin file by getting rid of the header, and copying the bits of the file that looked similar to other NCSR, NGCR, and NCLR files (I could tell where to copy thanks to the magic headers).

These are the files that I got from "unpacking"

This is a set of WORKING NCSR, NGCR, and NCLR files from the game that you can view in Tinke, for reference

So the NCSR and NGCR files do not work, but interestingly the NCLR file is read fine by Tinke. This is the palette that it produces. This makes sense as the headers of the NCSR and NGCR are a little too long (at least when compared to the other example images). Tinke pulls this error:

Unknown color format
at  Ekona.Images.Actions.Get_Color(Byte[] data, Color[] palette, ColorFormat format,  Int32& pos) at Ekona.Images.Actions.Get_Image(Byte[] tiles, Byte[] tile_pal,  Color[][] palette, ColorFormat format, Int32 width, Int32 height, Int32 start)  at Ekona.Images.ImageBase.Get_Image(PaletteBase palette) at  Ekona.Images.MapBase.Get_Image(ImageBase image, PaletteBase palette) at  Ekona.Images.ImageControl.Update_Image() at  Ekona.Images.ImageControl..ctor(IPluginHost pluginHost, ImageBase image,  PaletteBase palette, MapBase map) at Images.Main.Show_Info(sFile file) at  Tinke.Acciones.See_File()

I am wondering if the bin file is compressed (due to the fact that the de facto guide on file formats mentions compression headers at the bottom)? But why would compression make it longer?

Note: I'm not a C# expert. I went into Tinke source files and found the place where the error is being pulled, and found that there were a few types of colors that could be matched. However, I couldn't find *where* the file is defined as one of these ColorFormats, or which byte in the header defines it.

Any help would be appreciated. Thank you.

10 Upvotes

0 comments sorted by