Here's what I know so far about the SBA.
The file structure itself is very straight-forward:
int32 fileIdentifier //"SBIN"
int32 dataIdentifier; //4byte string
int32 dataLength; //not including identifier, length or checksum
This structure is looped until the end of the file, and each one is aligned to 4 bytes (although only CDAT needs it)
There are several types:
- "ENUM", "STRU": groups of shorts(usually 6) that may give additional information about the other structures that follow
- "FIEL": group of shorts; unknown at this point
- "OHDR": presumably acts like a header with reading instructions for the "DATA" that follows
- "DATA": contains texture properties such as format, width, height, mipmaps
- "CHDR": header for the "char data block"; contains pairs of int32 offsets and lengths used to read strings
- "CDAT": char data block from which strings are read using "CHDR"; the strings are null-terminated, but that's probably part of the writing process, not the reading
Examples: ImageFormatType, TextureFilterType, TextureWrapType, Image, format, data, width, height, Texture, mipmaps, filter_min, filter_mag, wrap_s, wrap_t, default, RGB, RGBA, PVRTC_2BPP_RGB, PVRTC_2BPP_RGBA, PVRTC_4BPP_RGBA, PVRTC_4BPP_RGB, DXT1, DXT3, DXT5, ATC_RGB, ATC_RGBA_Explicit, ATC_RGBA_Interpolated, ETC_RGB, PNG, JPEG, Nearest, Linear, NearestMipmapNearest, NearestMipmapLinear, LinearMipmapNearest, LinearMipmapLinear, Repeat, ClampToEdge
- "BULK": unknown at this point; could be used to link everything together
- "ALGN": used for the sole purpose of aligning the image data
- "BARG" contains the actual image data
In case of PNG textrues the image data inside "BARG" is the whole PNG file and just needs to be extracted. That's why Dragon Unpacker can find them easily.
In case of DXT or PVR, the texture headers need to be rebuilt, that's why it's important to parse "DATA" properly and read everything.
The way I see it, property strings from CHDR need to be linked to property types and then to actual values from DATA in order to have enough information to rebuild texture headers.
It's just a matter oh "how"