1
0
mirror of synced 2025-01-24 07:04:09 +01:00

tja2fumen.py: Add workaround for deo_n.bin song

I think this file has inaccurate metadata, so I've added a workaround
so that it will still parse.
This commit is contained in:
Viv 2023-06-02 16:33:41 -04:00
parent f586372343
commit 42f302eff0

View File

@ -269,7 +269,12 @@ def readStruct(file, order, format_string, seek=None):
"""
if seek:
file.seek(seek)
byte_string = file.read(struct.calcsize(order + format_string))
expected_size = struct.calcsize(order + format_string)
byte_string = file.read(expected_size)
# One "official" fumen (AC11\deo\deo_n.bin) runs out of data early
# This workaround fixes the issue by appending 0's to get the size to match
if len(byte_string) != expected_size:
byte_string += (b'\x00' * (expected_size - len(byte_string)))
interpreted_string = struct.unpack(order + format_string, byte_string)
return interpreted_string