# HG changeset patch # User Emmanuel Gil Peyrot # Date 1316797520 25200 # Node ID d3005ebe797a1b16d42833780ae24f31bd67d65f # Parent c53d91300c1c3cb7aea7c0baf51ca1a0de508b4f Fix MSG parsing, use the offsets instead of trying to relate them to the actual data. diff --git a/pytouhou/formats/msg.py b/pytouhou/formats/msg.py --- a/pytouhou/formats/msg.py +++ b/pytouhou/formats/msg.py @@ -50,40 +50,31 @@ class MSG(object): msg = cls() msg.msgs = [] - new_entry = True - while True: - offset = file.tell() + for offset in entry_offsets: + if msg.msgs and offset == entry_offsets[0]: # In EoSD, Reimu’s scripts start at 0, and Marisa’s ones at 10. + continue # If Reimu has less than 10 scripts, the remaining offsets are equal to her first. - try: - time, opcode, size = unpack('