-
Notifications
You must be signed in to change notification settings - Fork 85
.sc2replay
This file is also an MPQ archive and as such follows the archive format described at devlog.net. To extract the information we need however, you don't need to understand this whole format, only how to parse the first header.
Recall that the file will be parsed as a hexadecimal byte stream (see the byte.stream page).
The first 3 bytes of the file are always 0x4D5051
which mark a valid MPQ file
They are followed by 1 byte, 0x1B
, which marks the start of the first header.
The header then proceeds as follows:
- 4 bytes (little endian): max data size??
- 4 bytes (little endian): # of bytes the second header is offset
- 4 bytes (little endian): data size??
These integer values are not useful unless you are parsing the rest of the archive. Again, see devlog.net for details.
The remaining data in the header is described in a serialized format similar to json documented on the serialized.data page.
Parsing this serialized data produces the following structure:
data = { 0: ??, 1: {0: ??, 1: major version (1), 2: minor version (2), 3: patch number (0), 4: Build Number (17326), 5: ?? }, 2: ??, 3: game length (in frames) }
Where the version string you see when logging into bnet is MajorVersion . MinorVersion . PatchNumber . BuildNumber.
Additionally it is worthwhile noting that there are 16 frames per second of game duration.