diff --git a/mgz/cli.py b/mgz/cli.py index a49e18a..14c685c 100644 --- a/mgz/cli.py +++ b/mgz/cli.py @@ -75,7 +75,7 @@ async def extract_rec(playback, path, select=None): def print_info(path): """Print basic info.""" with open(path, 'rb') as handle: - summary = Summary(handle, fallback=True) + summary = Summary(handle) dataset = summary.get_dataset() print('-------------') print(tabulate([ diff --git a/mgz/fast/header.py b/mgz/fast/header.py index aca6339..2c22666 100644 --- a/mgz/fast/header.py +++ b/mgz/fast/header.py @@ -278,7 +278,7 @@ def string_block(data): strings = [] while True: crc = unpack(" crc > 0: break strings.append(de_string(data).decode('utf-8').split(':')) return strings diff --git a/mgz/header/de.py b/mgz/header/de.py index 8d69025..9d03b91 100644 --- a/mgz/header/de.py +++ b/mgz/header/de.py @@ -44,9 +44,9 @@ ) string_block = Struct( - "strings"/RepeatUntil(lambda x, lst, ctx: lst[-1].crc == 47, Struct( + "strings"/RepeatUntil(lambda x, lst, ctx: 255 > lst[-1].crc > 0, Struct( "crc"/Int32ul, - "string"/If(lambda ctx: ctx.crc != 47, de_string) + "string"/If(lambda ctx: ctx.crc == 0 or ctx.crc > 255, de_string) )) ) @@ -112,7 +112,7 @@ "lobby_visibility"/Int32ul, "hidden_civs"/Flag, "matchmaking"/Flag, - "spec_delay"/Int32ul, + "spec_delay"/If(lambda ctx: find_save_version(ctx) >= 13.13, Int32ul), "scenario_civ"/If(lambda ctx: find_save_version(ctx) >= 13.13, Byte), "rms_strings"/string_block, Bytes(8),