ffxiv) and one for each expansion (
ex2, etc.). Consider the following directory structure:
sqpack/is it's own repository. As an aside, when the game tries to access files, it distinguishes which repository to find a file in by parsing the file path and pulling out 2 segments, the repository name and the category.
ffxivrepository. Category is always the first segment and must be present for a path to resolve.
SqPackHeader. It looks like the following:
sizeso you want to seek to the value of
sizebefore you read anything out of the file.
index2to make the difference obvious. Contrary to the retail client shipping with both index variants, benchmarks only ship with
index2files. The reason is unknown.
SqPackIndexHeader(which is only present in index files):
0x400bytes large, but for the purposes of this, we're only interested in the first 16 bytes. From the
indexDataSize, you can determine where to start reading from and how many index elements exist inside an index.
indexDataOffsetis an absolute offset to where the index data is located, and
indexDataSizeis the collective size of every
IndexHashTableEntrythat's in a file. This entry is slightly different in the case of
index2files, so we'll generally cover the two with a focus on
index1files for now.
hashworks like this:
/and split the string with the last
/existing in the first group. The filename needs to have no directory separators
directoryHash << 32 | filenameHash
dataFileIdis to identify which file (on disk) contains the file. Larger categories are split across multiple files (each is capped at 2,000,000,000 bytes, or 2 GB), so this is used to distinguish between
020000.win32.dat1for example, where
1respectively for files located in either dat.
offsetis the absolute number of 8 byte aligned segments that the file is located at within a specific dat file. In a given dat file, a file is located at
offset * 0x8which gives you the absolute offset to start reading a file from.
index2is that the entire path is encoded into one CRC32 hash and does not split the path by folder and filename. Outside of that, everything is identical to