Closed goto-bus-stop closed 8 years ago
The compressed header always ends in a 0 byte. 0x04
is the game start command, and that's always immediately at the start of the body in mgx
files and newer, but not in mgl
files. (in mgl
the game start command is implicit.)
A more accurate Game Start marker seems to be the F4 01 00 00
sequence that comes right after 0x04
in the game start command, and at the very start of the recorded game body in mgl
files. It's already used to determine whether a 0x04
is really a game start command here. So could fall back to strpos
-ing that if header length is set to 0.
Yeah, the F4 01 00 00
approach seems really reliable :D
Usually the first four bytes of a recorded game store the size of the compressed header of the file, but save/exited multiplayer games store 0 instead. They are actually valid recorded game files, though. RecAnalyst should attempt to guess the compressed header size somehow.