Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DE version 25.22 fails on header parse #73

Closed
Namek opened this issue Feb 1, 2022 · 11 comments
Closed

DE version 25.22 fails on header parse #73

Namek opened this issue Feb 1, 2022 · 11 comments

Comments

@Namek
Copy link

Namek commented Feb 1, 2022

Fast reader crashes at this line:

lobby = de_string(data)

MP_Replay_v101.101.58259.0_2022.02.01_214243_2.zip

@happyleavesaoc
Copy link
Owner

Hi @Namek fast reader does not yet support 25.22

@Namek
Copy link
Author

Namek commented Feb 1, 2022

but does something? I try with Summary and it fails too.

@Namek
Copy link
Author

Namek commented Feb 1, 2022

The recording comes from another player. I just created a single player recordings on my machine and the Summary goes through that part successfully. It only fails in the parse_metadata on the raise RuntimeError("don't know how to parse ai").

I tried single player both on English and Polish but I still have a slight suspicion on the language.

@Namek
Copy link
Author

Namek commented Feb 1, 2022

JUST FYI:

from mgz.model import parse_match
from mgz.summary import Summary

def get_match_info(data):
    try:
        # some files seems broken for this library when using the `Summary`.
        m = parse_match(data)
        players = [dict(name=p.name, user_id=p.profile_id, number=p.number,
                        civilization=p.civilization) for p in m.players]

        return dict(
            map_name=m.map.name,
            game_version=f"{m.version.name} {m.version.value}",
            game_map_type=m.type,
            players=players,
            teams=m.teams,
            completed=False,
            start_time_seconds=int(m.actions[0].timestamp.seconds),
            duration_seconds=m.duration.seconds,
        )
    except RuntimeError:
        # the `parse_match` method doesn't work for restored recordings, thus, let's try with the `Summary`.
        data.seek(0)
        s = Summary(data)

        return dict(
            map_name=s.get_map()['name'],
            game_version=" ".join(str(x) for x in s.get_version()),
            game_map_type=s.get_settings()['type'][1],
            players=s.get_players(),
            teams=s.get_teams(),
            completed=s.get_completed(),
            start_time_seconds=int(s.get_start_time()/1000),
            duration_seconds=int(s.get_duration()/1000),
        )

This is what I need from recordings. It's basically header information.

@Namek Namek changed the title DE version 25.22 fails on lobby read DE version 25.22 fails on header parse Feb 1, 2022
@happyleavesaoc
Copy link
Owner

Ok, I confirmed it's failing to parse the DE header (in both fast and full). There's an unknown condition that introduces an extra array of bytes. It could be the use of a custom map, but I need more evidence.

@happyleavesaoc
Copy link
Owner

Tested a few custom maps, that was not the issue. Were any unusual settings used for that match?

@Namek
Copy link
Author

Namek commented Feb 2, 2022

the map from the recording is supposed to be "ANT - Arabia" from the mod Ant League 2022 Spring Edition - Mappack. I think it comes from the KtsOTD mappack

@Namek
Copy link
Author

Namek commented Feb 2, 2022

of anything special: players are supposed to use the "hidden civ" setting when hosting

@happyleavesaoc
Copy link
Owner

I am testing a fix for this.

@happyleavesaoc
Copy link
Owner

Please try the latest commit on master. I was able to parse the attached match:

Path        namek.aoe2record
Duration    00:33:39
Completed   True
Restored    False
Postgame    False
Objects     True
Version     DE (VER 9.4, 25.22, 5, 58259)
Dataset     Definitive Edition None
File Hash   9aa4db397aba6fb93cf093b4b1e9625197a9b36f
Match Hash  43c13fc932f42c78e4a08f01aa9a1528172df7e3
Encoding    utf-8
Language    en
Map         ANT - Arabia (-385897673)

@Namek
Copy link
Author

Namek commented Feb 6, 2022

@happyleavesaoc Somehow I have the same issue in the exact same place.

EDIT: OK, I got an error on my side. This finally reads the file with the Summary method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants