CBGT image to TGA converter
cbgt2tga [<options>] <cbgt> <pal> <2da> <tga>
cbgt2tga converts CBGT image files into common TGA images. CBGT, Compressed BackGround Tiles, are used as area background images in BioWare's Nintendo DS game Sonic Chronicles: The Dark Brotherhood.
Internally, a CBGT consists of a collection of 64x64 pixel cells, divided into tiles of 8x8 pixels. Each cell is compressed using Nintendo's 0x10 LZSS algorithm. Moreover, PAL files with the same name as the CBGT file contain the palette data, and 2DA files with the same name yet again contain the mapping of palette indices onto cells.
The width and height of the final image is not stored within the CBGT file, but the palette mapping 2DA does contain the number cells in X and Y direction, since it stores the palette indices in a two-dimensional array of those dimensions. Therefore, multi- plying the number of columns and rows in said 2DA by 64 yields the width and height, respectively, of the final image.
- Show a help text and exit.
- Show version information and exit.
- The name of the CBGT file to read. The CBGT contains the pixel graphics part of the image.
- The name of the PAL file to use. The PAL file contains the palette part of the image.
- The name of the 2DA file to use. The 2DA file contains information on which palette to use for each part of the CBGT, and on how many parts are in the CBGT in the first place.
- The resulting TGA file will be written there.
Convert a CBGT+PAL+2DA into a TGA:
cbgt2tga a.cbgt a.pal a.2da result.tga