Rage Software XFS

From XentaxWiki
Jump to: navigation, search

XFS


Format Specifications

// XFS file format
// E-racer DEMO PC

// little endian

//header (16 bytes)
8 bytes (char) - magic // "DID DAT\x1A"
4 bytes (uint32) - section table checksum // "64" + "\xFF\xFF"
4 bytes (uint32) - section table size/8   // "8"   // 8*8=64

// section table (64 bytes)
4 bytes (uint32) - number of sections // "3"
4 bytes (uint32) - data start offset // "80"
4 bytes (uint32) - section ID // "0"
4 bytes (uint32) - data end offset / DAT info start offset
4 bytes (uint32) - section ID // "1"
4 bytes (uint32) - some structure offset
4 bytes (uint32) - section ID // "2"
4 bytes (uint32) - hash index offset
32 bytes - reserved  // sections that are not used
                     // probably left for future engine development


// file data section
num_of_entries *
{
   4 bytes (uint32) - file size-8 / uncompressed file size
   4 bytes (uint32) - compression flag  // "0" - uncompressed, 
                                        // "1" - compressed with RA compression
   x bytes - file data
}


// DAT information section (16 bytes)
4 bytes (uint32) - section size-4 // "12"
4 bytes (uint32) - number of hash entries-1 / number of files
8 bytes - nulls

// some data (?)
// Note: This section is not used by game at all.
//       It is probably some random padding data.
4 bytes (uint32) - section size-1
x bytes - data

// hash index section (8 bytes per entry)
num_of_files+1 *
{
   4 bytes (uint32) - hash entry
   4 bytes (uint32) - file offset
}

MultiEx BMS Script

Not written yet.

Notes and Comments

  • This file format occurs in games from Rage Software studio.
    It was probably designed by Digital Image Design before company was sold to Rage Games Limited.
  • This file format uses custom RA compression method which is implementation of LZ77-based algorithm.
  • XFS files seems to be enhanced version of "DID.DAT" archives from older Digital Image Design games.

Related structures

RA compressed data format:

// little endian

2 bytes (uint16) - magic // "RA"
2 bytes (uint16) - version // "\x00\x02"
2 bytes (uint16) - uncompressed file size
2 bytes (uint16) - checksum of the uncompressed data
x bytes - compressed data

Hash calculation

Hash entries can be calculated using custom algorithm. Below is Python implementation of it:

def calculate_eracer_hash(in_filename):
    len_filename = len(in_filename)
    curr_char_IDX = 0
    hash_part_LAST = 0
    curr_char = ""
    hash_part3 = 0
    
    for i in range(len_filename-1):
        if curr_char_IDX < len_filename:
            curr_char = int(ord(in_filename[i]))
            part_hash1 = curr_char + curr_char_IDX 
            part_hash2 = curr_char + 7
            
            while 1:
                hash_part3 = part_hash1 * part_hash2 * (int(ord(in_filename[curr_char_IDX])) + 19) * (int(ord(in_filename[curr_char_IDX])) + curr_char_IDX)
                curr_char_IDX += 1
                hash_part_LAST += hash_part3
                if curr_char_IDX >= len_filename:
                    break
                
            curr_char_IDX = i
        curr_char_IDX += 1
    
    conv = int(str(hex(hash_part_LAST))[-8:], 16) # workaround!
    hash_part_LAST = conv
     
    OUT_HASH = hash_part_LAST % 0xEE6B2800
    return OUT_HASH

Games

List of games using this file format:

  • E-Racer / eRacer
  • Rage Rally
  • Lamborghini (cancelled xbox game)
  • Eurofighter Typhoon

Compatible Programs