happyleavesaoc / aoc-mgz

Age of Empires II recorded game parsing and summarization in Python 3.
MIT License
197 stars 41 forks source link

added save version 61.5 compatibility #104

Closed Skazu closed 1 month ago

Skazu commented 5 months ago

I've added Save-Version 61.5 compatibility for the fast header+body parser.

This patch is running since a few hours for us now, we could parse hundreds of games with it.

But i have to mention two things which i'm not happy with for now:

Finding Marker at scenario parsing Although this works i couldn't find a way to do it without this marker (as it was before). I think there might be better ways to do it.

Unit tests The different parser implementations support different versions, the fast header parser doesn't seem to support DE save-versions <=13 (at least it didn't at my tests, and i couldn't find the conditional parsings for versions like 13.17 as in the full parser, for example). And since i've now added unit tests for the fast header parser i had to add some ugly guard checks to skip some savegames in some conditions. Maybe it would be better to group the savegames in different folders or smth. like that.

If you already work on your own implementation just skip this pr and we will fetch your upstream changes as soon as they are available.

happyleavesaoc commented 5 months ago

Just a note that I am at a similar place. There are some tough changes in the full object parsing that I have not had time to address yet.

The marker in parse_scenario is failing because the points structure following the players is improperly parsed. This is because the version number for that structure has changed.

-    points_version = header.read().find(b'\x00\x00\x00@')
+    pv = b'\x00\x00\x00@'
+    if save >= 61.5:
+        pv = b'\x66\x66\x06\x40'
+    points_version = header.read().find(pv)
happyleavesaoc commented 1 month ago

See https://github.com/happyleavesaoc/aoc-mgz/commit/deea5c428c2b8c205843c49776b0d78ff51e3261