Fix tools/unnamed.py for new rgbds object format

This commit is contained in:
mid-kid 2020-02-04 23:19:41 +01:00
parent ed44d1cdb7
commit 24c058bc0a

View File

@ -73,8 +73,16 @@ if not objects:
files = {}
for objfile in objects:
f = open(objfile, "rb")
if unpack_file("4s", f)[0] != b'RGB6':
print("Error: File '%s' is of an unknown format." % filename, file=stderr)
obj_ver = None
magic = unpack_file("4s", f)[0]
if magic == b'RGB6':
obj_ver = 6
elif magic == b'RGB9':
obj_ver = 10 + unpack_file("<I", f)[0]
if obj_ver not in [6, 10]:
print("Error: File '%s' is of an unknown format." % objfile, file=stderr)
exit(1)
num_symbols = unpack_file("<II", f)[0]