Difference between revisions of "Settlers VI - Rise Of An Empire BBA"

From XentaxWiki
Jump to: navigation, search
 
(No difference)

Revision as of 19:12, 12 October 2007

Back to index | Edit this page

FILE EXTENSION

Format Specifications

char {3}      - Archive Header (BAF)

byte {1}      - Version (4)
uint32 {4}    - Unknown (5)
uint32 {4}    - Header Size (64)
uint32 {4}    - Header Encryption Identifier (0x29D58DC5)


// Header (encrpyted)

uint32 {4}    - Directory Offset Low
uint32 {4}    - Directory Offset High (null)
uint32 {4}    - Directory Length
uint32 {4}    - Directory CRC32 Checksum
uint32 {4}    - Directory Encryption Identifier
byte {44}     - null


// For each file

if (File Type Identifier == 1) {
// The first 16 Bytes are encrypted)
uint32 {4}    - Compressed Size
uint32 {4}    - Decompressed Size
byte {x}      - Compressed Filedata
} else {
byte {x}      - Uncompressed Filedata
}


// Directory (encrypted, compressed)

uint32 {4}    - Directory Header Size (64)
uint32 {4}    - Offset File Entries
uint32 {4}    - Offset File Hashtable
byte {52}     - null


char {3}      - Archive Header (BAF)
byte {1}      - Version (4)
uint32 {4}    - Unknown (5)
uint32 {4}    - Header Size (64)
uint32 {4}    - Header Encryption Identifier (0x29D58DC5)


uint32 {16}   - null
uint32 {4}    - Directory Encryption Identifier
byte {44}     - null


uint32 {32}   - Encryption Table
uint32 {32}   - null
uint32 {32}   - null
uint32 {32}   - null


uint32 {4}    - Number of Files
// For each file
uint32 {8}    - Timestamp
uint32 {4}    - Decompressed Filesize
uint32 {4}    - CRC32 Checksum
uint32 {4}    - Filetype Identifier
uint32 {4}    - null
uint32 {4}    - Offset
uint32 {4}    - null
uint32 {4}    - Compressed Filesize
uint32 {4}    - CRC32 Checksum
uint32 {8}    - null
uint32 {4}    - Filename Length
uint32 {4}    - Filename Offset
int32 {4}     - First Offset
int32 {4}     - Next Offset
char {x}      - Filename
byte {0-3}    - Padding


uint32 {4}    - Hashtable Size
// For each hashtable element
uint32 {4}    - Hash of a Filename
uint32 {4}    - File Entry Offset

Notes and Comments

  • Some files and the directory are compressed using zlib
  • Filetype Identifiers:
    • 0 - Uncompressed file
    • 1 - Compressed file
    • 256 - Directory
  • Initial value for the CRC32 Checksums is 0
  • The encryption algorithm is a modified TEA version (it has the same characteristic bitshifts)
    • There exists multiple versions of the same algorithm but with different 128-bit keys and different deltas
    • The Encryption Identifier will tell you which algorithm to use
  • The hashfunction for the filenames is crc32()
  • The Timestamp is the Windows FILETIME struct

Encryption Table

The data of some files may be compressed or encrypted. The Encryption Table maps the Filetype Identifier to an algorithm that can handle the data. The table has 8 available slots. The Filetype Identifier 0 is mapped to slot 0, Filetype Identifier 1 is mapped to slot 1 and so on...

If a slot is null, the data is neither compressed nor encrypted. Otherwise the slot contains an Encryption Identifier that tells you how to handle the data.

Example: We have a file with File Type Identifier 1. We look at slot 1 of the encryption table and will find the value: 0x9BB3F065. This tells us that we have a file that is compressed and that the first 16 Bytes of the filedata are encrypted with a simple XOR-algorithm.

MultiEx BMS Script

None written yet.

Supported by Programs

Unknown

Links

None

Games

None