Sacred

From XentaxWiki
Revision as of 09:00, 26 October 2005 by Paul Siramy (talk | contribs) (244 bytes of padding were forgoten in CIF header)

Jump to: navigation, search

Choose archive extension:

PAK


Format Specifications

byte {3}     - Header
byte {1}     - Type ID

if (header == TEX && id == 3){

uint32 {4}   - Number Of Files
uint32 {4}   - Unknown
byte {244}   - null


// for each file
uint32 {4}   - Type ID
uint32 {4}   - Offset
uint32 {4}   - Compressed Size


// for each file
char {32}    - Filename (null)
uint16 {2}   - X Image Size
uint16 {2}   - Y Image Size
byte {1}     - Type ID
uint32 {4}   - Compressed Size
byte {39}    - null Padding
byte {X}     - File Data


}


else if (header == CIF && id == 0){

uint32 {4}   - Number Of Files
uint32 {4}   - Unknown
byte {244}   - null


// for each file
byte {64}    - File Data


}


else if (header == WPN && id == 8){

uint32 {4}   - Number Of Files
uint32 {4}   - Unknown


// for each file
byte {322}   - File Data


}


else if (header == SND && id == 1){

uint32 {4}   - Number Of Files
uint32 {4}   - Unknown
byte {244}   - null


// for each file
uint32 {4}   - Type ID
uint32 {4}   - Offset
uint32 {4}   - Compressed Size


}


else if (header == ITM && id == 5){

uint32 {4}   - Number Of Files
uint32 {4}   - Unknown
byte {244}   - null


// for each file
uint32 {4}   - Type ID
uint32 {4}   - Offset
uint32 {4}   - Compressed Size


// for each file
byte {56}    - Unknown
char {32}    - Filename (null)
byte {X}     - File Data


}


else if (header == ITM && id == 3){

uint32 {4}   - Number Of Files
uint32 {4}   - Unknown
byte {244}   - null


// for each file
uint32 {4}   - Type ID
uint32 {4}   - Offset
uint32 {4}   - Compressed Size


// for each file
char {32}    - Filename (null)
byte {X}     - File Data


}



File Data Format in TEX (textures) PAK

This is a simple zlib-compressed image, as the first character of the File Data indicates (it's an 'x'). The size of this File Data is 'Compressed Size' bytes, the size of the uncompressed file is :

   Uncompressed File Data Size = (X Image Size) * (Y Image Size) * 2

Once uncompressed, you have directly the pixels. Each pixel is an unsigned word (16 bits). It contains Alpha, Red, Green and Blue componant values, and each are 4 bits. A mapping of these bits would give :

   (highest bit) AAAARRRRGGGGBBBB (lowest bit)

The encoding of the pixel is Top to Bottom, and for each line is Left to Right. Note : the Alpha channel IS really used (it's not just for padding), check H_KEULE_02_1.TGA from texture00.pak for a good example (16 levels of alpha here)

MultiEx BMS Script

Not written yet

Compatible Programs