happyleavesaoc / aoc-mgz

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

jump before object section in players parsing in fast header parser #102

Closed Skazu closed 1 month ago

Skazu commented 1 year ago

I have found several matches in which errors occurred during the "objects" parsing, and subsequently the parser was unable to find the player-end marker. Unfortunately, I could not solve the actual problem, but maybe you have an idea. I have checked in a recorded game and added a unit test. However, in order to make the parsing more reliable, I have added a workaround that jumps back to the position before the objects in every case and searches for the player-end marker from there, which works in all cases, but is of course more unperformant, as a lot of data has to be loaded into the RAM.

happyleavesaoc commented 10 months ago

I think this is fixed in https://github.com/happyleavesaoc/aoc-mgz/commit/d56fc623eb7b3da98e0068fea55a3f4be41d25ad

This rec (and some others) had \x0a as the wildcard byte in pattern match for the object start. That byte happens to be the newline \n which re does not match by default. So we didn't find the object start and the problems cascaded from there.