Psychonauts PKG

From XentaxWiki
Jump to: navigation, search

PKG


Format Specifications

// XBOX ONLY
In the xbox version the .pkg file is zlib compressed. There is a 16 byte header then a compressed zlib archive. The format of this header is:

uint32 {4}   - Header (ZLIB)
uint32 {4}   - Version (1)
uint32 {4}   - Size of decompressed file
uint32 {4}   - Size of compressed file (minus the 16 byte header)


// ARCHIVE HEADER

char {4}   - Header (ZPKG)
uint32 {4}   - Version (1)
uint32 {4}   - First File Offset
uint32 {4}   - Number Of Files In Directory 1
uint32 {4}   - Directory 2 Offset
uint32 {4}   - Number Of Records In Directory 2
uint32 {4}   - Filename Directory Offset
uint32 {4}   - Extension Directory Offset
byte {480}   - null Padding to offset 512


// DIRECTORY 1

// for each file in dir 1
byte {1}     - null
uint16 {2}   - File Extension Offset (relative to the start of the Extension Directory)
byte {1}     - null
uint32 {4}   - Filename Offset (relative to the start of the Filename Directory)
uint32 {4}   - File Offset
uint32 {4}   - File Length


// DIRECTORY 2 (Directory structure)

// for each record in dir 2
byte {1}     - One character of a directory name
byte {1}     - null
uint16 {2}   - Unknown (possibly a reference to another record if nonzero)
uint16 {2}   - Unknown (possibly a reference to another record if nonzero)
uint16 {2}   - Record ID (incremental from 1)
uint16 {2}   - Start index (inclusive)
uint16 {2}   - End index (exclusive)


The characters read in each record add up to form a directory name. Start index and and end index are usually zero unless the name is complete. If start index or end index are nonzero, then the directory name is complete and the entries in the file records in the given range belong to the directory name just read. When a new directory name starts with a slash (/), the new name must be appended to the one previously read.
There are a few anomalies, because some directories are missing the first letter(s) of their name.

// FILENAME DIRECTORY

byte {1}     - null


// for each filename
char {X}     - Filename
byte {1}     - null


// EXTENSION DIRECTORY

byte {1}     - null


// for each extension
char {X}     - Extension Name
byte {1}     - null


// FILE DATA

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

MultiEx BMS

Not written yet

Supported Programs