goto-bus-stop / recanalyst

Analyzes Age of Empires 2 recorded game files.
https://goto-bus-stop.github.io/recanalyst/doc/v4.2.0
GNU General Public License v3.0
76 stars 11 forks source link

support Save&Exit-ed multiplayer games #8

Closed goto-bus-stop closed 8 years ago

goto-bus-stop commented 8 years ago

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.

goto-bus-stop commented 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.)

goto-bus-stop commented 8 years ago

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.

goto-bus-stop commented 8 years ago

Yeah, the F4 01 00 00 approach seems really reliable :D