Fifa.fat

From FIFA Manager Modding Wiki

fifa.fat is an index file for zdata archives.

Structure[edit | edit source]

CHAR[4] - Signature - "BFAT"
UINT32  - Hash function base value - usually 142434 (same for FM07-FM14)
UINT32  - Archives count - usually 99 (zdata00 - zdata98)
#FOR Archives count
 CHAR[] - Archive name, null-terminated (and also aligned)
UINT32  - Unknown, usually -1 (probably unused)
UINT32  - Entry size, usually 12
UINT32  - Entries count
#FOR Entries count
 UINT32 - File name hash
 UINT24 - File index in archive (starting from 0)
 UINT7  - Zdata archive ID (1 for zdata_01, for example)
 UINT1  - Compression flag (true/false)
 UINT32 - File size (uncompressed)
UINT32  - Unknown, usually -1 (probably unused)

File name hashes[edit | edit source]

The hashing function for file name hashes is following:

unsigned int FifaFatHash(std::string const &fileName, unsigned int hashFunctionBaseValue) {
    unsigned int hash = hashFunctionBaseValue;
    for (auto c : fileName)
        hash += c + 32 * hash;
    hash += 32 * hash;
    return hash;
}