Difference between revisions of "Sacred"

From XentaxWiki
Jump to: navigation, search
(Format Specifications, added ISO v3 (PAK\Tiles.pak))
m (Change ID into Version. Added place for Headers yet to decode. Wrote which .pak file use which header)
Line 13: Line 13:
 
<tt><b>
 
<tt><b>
 
byte {3}&nbsp;&nbsp;&nbsp;&nbsp; - Header <br>  
 
byte {3}&nbsp;&nbsp;&nbsp;&nbsp; - Header <br>  
byte {1}&nbsp;&nbsp;&nbsp;&nbsp; - Type ID <br>  
+
byte {1}&nbsp;&nbsp;&nbsp;&nbsp; - Version <br>  
 
<br>
 
<br>
<font color="blue"> ''' if (header == TEX && id == 3){ ''' </font> <br>  
+
<font color="blue"> ''' if (header == TEX && version == 3){ ''' </font> <br>
 +
: <font color="purple"> '' // PAK\Texture*.pak '' </font> <br>
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <br>  
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <br>  
 
: uint32 {4}&nbsp;&nbsp; - <font color="red"> '' Unknown '' </font> <br>  
 
: uint32 {4}&nbsp;&nbsp; - <font color="red"> '' Unknown '' </font> <br>  
Line 33: Line 34:
 
:: byte {39}&nbsp;&nbsp;&nbsp; - null Padding <br>  
 
:: byte {39}&nbsp;&nbsp;&nbsp; - null Padding <br>  
 
:: byte {X}&nbsp;&nbsp;&nbsp;&nbsp; - File Data <br>  
 
:: byte {X}&nbsp;&nbsp;&nbsp;&nbsp; - File Data <br>  
<br>
+
<font color="blue"> ''' } ''' </font> <br>  
: <font color="blue"> ''' } ''' </font> <br>
+
<font color="blue"> ''' else if (header == ISO && version == 3){ ''' </font> <br>
<br>
+
: <font color="purple"> '' // PAK\Tiles.pak '' </font> <br>
<font color="blue"> ''' else if (header == ISO && id == 3){ ''' </font> <br>  
 
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <br>  
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <br>  
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <font color="purple"> '' Yep, again '' </font> <br>  
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <font color="purple"> '' Yep, again '' </font> <br>  
Line 48: Line 48:
 
: <font color="blue"> ''' // for each file ''' </font> <br>  
 
: <font color="blue"> ''' // for each file ''' </font> <br>  
 
:: char {32}&nbsp;&nbsp;&nbsp; - Filename <font color="purple">(null)</font> <br>  
 
:: char {32}&nbsp;&nbsp;&nbsp; - Filename <font color="purple">(null)</font> <br>  
:: uint32 {4}&nbsp;&nbsp; - Entry Index within the file PAK\Texture.pak <br>  
+
:: uint32 {4}&nbsp;&nbsp; - Entry Index within the file PAK\Texture.pak (Header = TEX) <br>  
:: uint32 {4}&nbsp;&nbsp; - Tile position within texture <font color="purple"> '' Range from 0 to 17 '' </font> <br>  
+
:: uint32 {4}&nbsp;&nbsp; - Tile position within texture image <font color="purple"> '' Range from 0 to 17 '' </font> <br>  
 
:: byte {6}&nbsp;&nbsp;&nbsp;&nbsp; - null <br>  
 
:: byte {6}&nbsp;&nbsp;&nbsp;&nbsp; - null <br>  
 
:: byte {1}&nbsp;&nbsp;&nbsp;&nbsp; - Tag_1 <font color="purple"> '' Always = 1 '' </font> <br>  
 
:: byte {1}&nbsp;&nbsp;&nbsp;&nbsp; - Tag_1 <font color="purple"> '' Always = 1 '' </font> <br>  
 
:: byte {17}&nbsp;&nbsp;&nbsp; - null <br>  
 
:: byte {17}&nbsp;&nbsp;&nbsp; - null <br>  
<br>
+
<font color="blue"> ''' } ''' </font> <br>  
: <font color="blue"> ''' } ''' </font> <br>
+
<font color="blue"> ''' else if (header == CIF && version == 0){ ''' </font> <br>
<br>
+
: <font color="purple"> '' // PAK\Creature.pak '' </font> <br>
<font color="blue"> ''' else if (header == CIF && id == 0){ ''' </font> <br>  
 
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <br>  
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <br>  
 
: uint32 {4}&nbsp;&nbsp; - <font color="red"> '' Unknown '' </font> <br>  
 
: uint32 {4}&nbsp;&nbsp; - <font color="red"> '' Unknown '' </font> <br>  
Line 63: Line 62:
 
: <font color="blue"> ''' // for each file ''' </font> <br>  
 
: <font color="blue"> ''' // for each file ''' </font> <br>  
 
:: byte {64}&nbsp;&nbsp;&nbsp; - File Data <br>  
 
:: byte {64}&nbsp;&nbsp;&nbsp; - File Data <br>  
<br>
+
<font color="blue"> ''' } ''' </font> <br>  
: <font color="blue"> ''' } ''' </font> <br>
+
<font color="blue"> ''' else if (header == WPN && version == 8){ ''' </font> <br>
<br>
+
: <font color="purple"> '' // PAK\Weapon.pak '' </font> <br>
<font color="blue"> ''' else if (header == WPN && id == 8){ ''' </font> <br>  
 
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <br>  
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <br>  
 
: uint32 {4}&nbsp;&nbsp; - <font color="red"> '' Unknown '' </font> <br>  
 
: uint32 {4}&nbsp;&nbsp; - <font color="red"> '' Unknown '' </font> <br>  
Line 72: Line 70:
 
: <font color="blue"> ''' // for each file ''' </font> <br>  
 
: <font color="blue"> ''' // for each file ''' </font> <br>  
 
:: byte {322}&nbsp;&nbsp; - File Data <br>  
 
:: byte {322}&nbsp;&nbsp; - File Data <br>  
<br>
+
<font color="blue"> ''' } ''' </font> <br>  
: <font color="blue"> ''' } ''' </font> <br>
+
<font color="blue"> ''' else if (header == SND && version == 1){ ''' </font> <br>
<br>
+
: <font color="purple"> '' // PAK\Sound.pak '' </font> <br>
<font color="blue"> ''' else if (header == SND && id == 1){ ''' </font> <br>  
 
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <br>  
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <br>  
 
: uint32 {4}&nbsp;&nbsp; - <font color="red"> '' Unknown '' </font> <br>  
 
: uint32 {4}&nbsp;&nbsp; - <font color="red"> '' Unknown '' </font> <br>  
Line 84: Line 81:
 
:: uint32 {4}&nbsp;&nbsp; - Offset <br>  
 
:: uint32 {4}&nbsp;&nbsp; - Offset <br>  
 
:: uint32 {4}&nbsp;&nbsp; - Compressed Size <br>  
 
:: uint32 {4}&nbsp;&nbsp; - Compressed Size <br>  
<br>
+
<font color="blue"> ''' } ''' </font> <br>  
: <font color="blue"> ''' } ''' </font> <br>
+
<font color="blue"> ''' else if (header == ITM && version == 5){ ''' </font> <br>
<br>
+
: <font color="purple"> '' // PAK\Items*.pak '' </font> <br>
<font color="blue"> ''' else if (header == ITM && id == 5){ ''' </font> <br>  
 
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <br>  
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <br>  
 
: uint32 {4}&nbsp;&nbsp; - <font color="red"> '' Unknown '' </font> <br>  
 
: uint32 {4}&nbsp;&nbsp; - <font color="red"> '' Unknown '' </font> <br>  
Line 101: Line 97:
 
:: char {32}&nbsp;&nbsp;&nbsp; - Filename <font color="purple">(null)</font> <br>  
 
:: char {32}&nbsp;&nbsp;&nbsp; - Filename <font color="purple">(null)</font> <br>  
 
:: byte {X}&nbsp;&nbsp;&nbsp;&nbsp; - File Data <br>  
 
:: byte {X}&nbsp;&nbsp;&nbsp;&nbsp; - File Data <br>  
<br>
+
<font color="blue"> ''' } ''' </font> <br>  
: <font color="blue"> ''' } ''' </font> <br>
+
<font color="blue"> ''' else if (header == ITM && version == 3){ ''' </font> <br>
<br>
+
: <font color="purple"> '' // PAK\Items*.pak ? I don't have ITM file(s) with version = 3, in Sacred+'' </font> <br>
<font color="blue"> ''' else if (header == ITM && id == 3){ ''' </font> <br>  
 
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <br>  
 
: uint32 {4}&nbsp;&nbsp; - Number Of Files <br>  
 
: uint32 {4}&nbsp;&nbsp; - <font color="red"> '' Unknown '' </font> <br>  
 
: uint32 {4}&nbsp;&nbsp; - <font color="red"> '' Unknown '' </font> <br>  
Line 117: Line 112:
 
:: char {32}&nbsp;&nbsp;&nbsp; - Filename <font color="purple">(null)</font> <br>  
 
:: char {32}&nbsp;&nbsp;&nbsp; - Filename <font color="purple">(null)</font> <br>  
 
:: byte {X}&nbsp;&nbsp;&nbsp;&nbsp; - File Data <br>  
 
:: byte {X}&nbsp;&nbsp;&nbsp;&nbsp; - File Data <br>  
<br>
+
<font color="blue"> ''' } ''' </font> <br>
: <font color="blue"> ''' } ''' </font> <br>  
+
<font color="blue"> ''' else if (header == MDL && version == 3){ ''' </font> <br>
<br>
+
: <font color="purple"> '' // PAK\Models*.pak '' </font> <br>
 +
: <font color="red"> '' Unknown '' </font>
 +
<font color="blue"> ''' } ''' </font> <br>
 +
<font color="blue"> ''' else if (header == MHP && version == 1){ ''' </font> <br>
 +
: <font color="purple"> '' // PAK\Motions.pak '' </font> <br>
 +
: <font color="red"> '' Unknown '' </font>
 +
<font color="blue"> ''' } ''' </font> <br>
 +
<font color="blue"> ''' else if (header == MIX && version == 0){ ''' </font> <br>  
 +
: <font color="purple"> '' // PAK\Mixed.pak '' </font> <br>
 +
: <font color="red"> '' Unknown '' </font>
 +
<font color="blue"> ''' } ''' </font> <br>  
 +
<font color="blue"> ''' else if (header == OBJ && version == 1){ ''' </font> <br>
 +
: <font color="purple"> '' // World\Floor.pak, World\Static.pak, '' </font> <br>
 +
: <font color="red"> '' Unknown '' </font>
 +
<font color="blue"> ''' } ''' </font> <br>
 +
<font color="blue"> ''' else if (header == SPF && version == 1){ ''' </font> <br>
 +
: <font color="purple"> '' // PAK\sndProfiles.pak '' </font> <br>
 +
: <font color="red"> '' Unknown '' </font>
 +
<font color="blue"> ''' } ''' </font> <br>
 +
<font color="blue"> ''' else if (header == TRG && version == 1){ ''' </font> <br>
 +
: <font color="purple"> '' // World\Triggers.pak '' </font> <br>
 +
: <font color="red"> '' Unknown '' </font>
 +
<font color="blue"> ''' } ''' </font> <br>  
 
</b></tt>
 
</b></tt>
 
<br>
 
<br>

Revision as of 11:56, 26 October 2005

Choose archive extension:

PAK


Format Specifications

byte {3}     - Header
byte {1}     - Version

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

// PAK\Texture*.pak
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 == ISO && version == 3){

// PAK\Tiles.pak
uint32 {4}   - Number Of Files
uint32 {4}   - Number Of Files Yep, again
byte {244}   - null


// for each file
uint32 {4}   - Tag_66 Always = 66
uint32 {4}   - Offset
uint32 {4}   - Tag_64 Always = 64


// for each file
char {32}    - Filename (null)
uint32 {4}   - Entry Index within the file PAK\Texture.pak (Header = TEX)
uint32 {4}   - Tile position within texture image Range from 0 to 17
byte {6}     - null
byte {1}     - Tag_1 Always = 1
byte {17}    - null

}
else if (header == CIF && version == 0){

// PAK\Creature.pak
uint32 {4}   - Number Of Files
uint32 {4}   - Unknown
byte {244}   - null


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

}
else if (header == WPN && version == 8){

// PAK\Weapon.pak
uint32 {4}   - Number Of Files
uint32 {4}   - Unknown


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

}
else if (header == SND && version == 1){

// PAK\Sound.pak
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 && version == 5){

// PAK\Items*.pak
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 && version == 3){

// PAK\Items*.pak ? I don't have ITM file(s) with version = 3, in Sacred+
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

}
else if (header == MDL && version == 3){

// PAK\Models*.pak
Unknown

}
else if (header == MHP && version == 1){

// PAK\Motions.pak
Unknown

}
else if (header == MIX && version == 0){

// PAK\Mixed.pak
Unknown

}
else if (header == OBJ && version == 1){

// World\Floor.pak, World\Static.pak,
Unknown

}
else if (header == SPF && version == 1){

// PAK\sndProfiles.pak
Unknown

}
else if (header == TRG && version == 1){

// World\Triggers.pak
Unknown

}

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