scopatz / w3g

Access Warcraft 3 replay files from Python 2 or 3
Creative Commons Zero v1.0 Universal
45 stars 16 forks source link

Error with 1.30 replay #5

Closed olegakbarov closed 5 years ago

olegakbarov commented 6 years ago

Thanks for this project!

Not sure if this is due to 1.30 patch, but i got this error:

Traceback (most recent call last):
  File "main.py", line 2, in <module>
    f = w3g.File('replay.w3g')
  File "/Users/oleg/code/w3g/w3g.py", line 2210, in __init__
    self._read_blocks()
  File "/Users/oleg/code/w3g/w3g.py", line 2281, in _read_blocks
    self._parse_blocks(data)
  File "/Users/oleg/code/w3g/w3g.py", line 2299, in _parse_blocks
    offset = self._parse_startup(data)
  File "/Users/oleg/code/w3g/w3g.py", line 2365, in _parse_startup
    self.select_mode = SELECT_MODES[b2i(data[offset])]
KeyError: 32

Any ideas what it might be caused by?

scopatz commented 6 years ago

Hi @olegakbarov! Thanks for reporting. I think the must have added a new mode with v1.30

scopatz commented 6 years ago

Do you know what new mode they added was?

olegakbarov commented 6 years ago

Was not able to find anything about new mode in patch notes... 😔

scopatz commented 6 years ago

yeah, me neither

hhllcks commented 6 years ago

This is the same thing that happened in 1.29. (see #2 ) I think, that the value for the mode has moved to another position and we are getting useless values here. For now I have found: 0x70 (112), 0x98 (152), 0xD8 (216).

Since there are no new modes I think that the position of the mode just has changed.

My solution at the moment is that I removed the line were we read the select_mode.

olegakbarov commented 6 years ago

Oh cool, i will give it a closer look!

olegakbarov commented 6 years ago

@hhllcks commenting out helped! ✨

scopatz commented 6 years ago

I think if we did something like SELECT_MODES.get(b2i(data[offset]), 'unknown mode') would be a good temporary fix. A pull request for this would be great!

Cepheid-UK commented 5 years ago

Confirmed that commenting out self.select_mode = SELECT_MODES[b2i(data[offset])] works as a temp fix in w3g.py for 1.30 replays.