CPK/CSB Doucmentation? by Azu at 8:40 PM EST on November 11, 2011
So, I'm looking to see if anyone has any documentation this that would help in creating a file browser (like an ISO Tool i.e WInImage, etc) that would browser, extract and replace files in the CPK/CSB without actually unpacking them.
As snakemeat says, my code is probably the best explanation at the moment (aluigi has converted a lot of it to QuickBMS). If you want some tables, here's something I wrote up back when I was working on it (January 1 2009). Not sure how accurate it is relative to the newer utf_tab stuff.
CRI CSB/CPK
0x00-0x03: "@UTF" - chunk name 0x04-0x07: chunk size (big-endian) __ proper start of chunk 0x08-0x0b: (values?) 0x0C-0x0f: offset of string table (from proper start) 0x10-0x13: end of string table? start of whatever is next?
then entries: 0x00-0x03: string table offset of entry name 0x04: flags? 0 = special header inline? __ inline 0x05: size (counting from 4) --- __not inline 0x05: ? single byte
____________________________
(sizes and offsets within chunks are from byte 8 of the chunk, just after the header and size, and big endian) TBLCSB format (.csb file): 0x00-0x03: @UTF 0x04-0x07: chunk size 0x08-0x0b: subchunk list? 0x0c-0x0f: offset of string table 0x10-0x13: offset of contents 0x14-0x17: string table offset of chunk name ("TBLCSB")
0x18-0x1b: 0x0003000D 0x1c-0x1f: 6 (number of subchunks to follow?) 0x20: 0x5a ? 0x21-0x24: string table offset of "name" 0x25: 0x50 ? 0x26-0x29: string table offset of "ttype" 0x2a: 0x5b ? 0x2b-0x2e: string table offset of "utf"
(further unmarked "offsets" are within the TBLCSB contents) 0x2f-0x32: string table offset of info chunk name ("INFO") 0x33: 07 ? 0x34-0x37: offset of info chunk 0x38-0x3b: size of info chunk
0x3c-0x3f: string table offset of cue chunk name ("CUE") 0x40: 01 ? 0x41-0x44: offset of cue chunk 0x45-0x48: size of cue chunk
0x49-0x4c: string table offset of synth chunk name ("SYNTH") 0x4d: 02 ? 0x4e-0x51: offset of synth chunk 0x52-0x55: size of synth chunk
0x56-0x59: string table offset of sound element chunk name ("SOUND_ELEMENT") 0x5a: 04 ? 0x5b-0x5e: offset of sound element chunk 0x5f-0x62: size of sound element chunk
0x63-0x66: string table offset of Isaac chunk name ("ISAAC") 0x67: 05 ? 0x68-0x6b: offset of Isaac chunk 0x6c-0x6f: size of Isaac chunk
0x70-0x73: string table offset of voice limit group chunk name ("VOICE_LIMIT_GROUP") 0x74: 06 0x75-0x78: offset of voice limit group chunk name 0x79-0x7c: size of voice limit group chunk
_______ TBL_INFO format 0x00-0x03: @UTF 0x04-0x07: chunk size 0x08-0x0b: 0x22 ? 0x0c-0x0f: offset of string table 0x10-0x13: offset of contents 0x14-0x17: string table offset of chunk name ("TBL_INFO")
TBLSDL (SOUND_ELEMENT) 0x00-0x03: @UTF 0x04-0x07: chunk size 0x00-0x03: offset of sound element list 0x04-0x07: offset of string table 0x08-0x0b: offset of contents 0x0c-0x0f: string table offset of chunk name ("TBLSDL") 0x10-0x11: 0x07 number of fields 0x12-0x13: 0x17 or 0x15 size of whole structure 0x14-0x17: number of elements 0x18: 0x5a ? 0x19-0x1c: string offset of "name" 0x1d: 0x5b ? 0x1e-0x21: string offset of "data" 0x22: 0x30 or 0x50 ? 0x23-0x26: string offset of "fmt" 0x27-0x28: 0x0050 ? 0x29-0x2c: string offset of "nch" 0x2d: 0x30 or 0x50? 0x2e-0x31: string offset of "stmflg" 0x32-0x33: 0x0054 ? 0x34-0x37: string offset of "sfreq" 0x38: 0x54 0x39-0x3c: string offset of "nsmpl"
___
general table structure 0x00-0x03: @UTF 0x04-0x07: table size 0x08-0x0b: offset of rows (from 8) 0x0c-0x0f: offset of string table (from 8) 0x10-0x13: offset of data/contents (from 8) 0x14-0x17: string table offset of table name 0x18-0x19: number of fields 0x1a-0x1b: size of each field 0x1c-0x1f: number of rows
field type description: starts with a single byte, indicates type 0x00: type 0x01-0x04: string table offset of field name 0x05-: constant value