Skip to content

Commit 5540c02

Browse files
committed
Fix MapInfo parsing for versions 0x19 and 0x1f.
1 parent 1a386d4 commit 5540c02

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

sc2reader/objects.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ def __init__(self, contents):
509509
if self.large_preview_type == 2:
510510
self.large_preview_path = data.read_cstring()
511511

512-
if self.version >= 0x20:
512+
if self.version >= 0x1f:
513513
self.unknown3 = data.read_cstring()
514514
self.unknown4 = data.read_uint32()
515515

@@ -542,7 +542,9 @@ def __init__(self, contents):
542542
#: (Optional) Load screen image path; relative to root of map archive
543543
self.load_screen_path = data.read_cstring()
544544

545-
self.unknown6 = data.read_uint16()
545+
#: Unknown string, usually empty
546+
self.unknown6 = data.read_bytes(data.read_uint16()).decode('utf8')
547+
546548
#: Load screen image scaling strategy: 0 = normal, 1 = aspect scaling, 2 = stretch the image.
547549
self.load_screen_scaling = data.read_uint32()
548550

@@ -585,8 +587,14 @@ def __init__(self, contents):
585587

586588
self.unknown7 = data.read_uint32()
587589

590+
if self.version >= 0x19:
591+
self.unknown8 = data.read_bytes(8)
592+
593+
if self.version >= 0x1f:
594+
self.unknown9 = data.read_bytes(9)
595+
588596
if self.version >= 0x20:
589-
self.unknown9 = data.read_bytes(21)
597+
self.unknown10 = data.read_bytes(4)
590598

591599
#: The number of players enabled via the data editor
592600
self.player_count = data.read_uint32()
@@ -665,7 +673,7 @@ def __init__(self, contents):
665673
# }
666674
# }
667675
#: A bit array of flags mapping out the player enemies.
668-
self.enemy_flags = data.read_uint(int(math.ceil(self.alliance_flags_length/8.0)))
676+
self.enemy_flags = data.read_uint(int(math.ceil(self.enemy_flags_length/8.0)))
669677

670678
if data.length != data.tell():
671679
self.logger.warn("Not all of the MapInfo file was read!")

0 commit comments

Comments
 (0)