From fa003e18cb1d856c842e1527079c5ae7fe23e245 Mon Sep 17 00:00:00 2001 From: pkmnsnfrn Date: Thu, 29 Aug 2024 21:49:29 -0700 Subject: [PATCH] FRLG fixes --- .../1.10/frlg_triple_layer_converter.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/migration_scripts/1.10/frlg_triple_layer_converter.py b/migration_scripts/1.10/frlg_triple_layer_converter.py index b8e9b53b4066..99b3529dedf7 100644 --- a/migration_scripts/1.10/frlg_triple_layer_converter.py +++ b/migration_scripts/1.10/frlg_triple_layer_converter.py @@ -38,23 +38,25 @@ if not os.path.exists(metatile_attributes_path): print(f"[SKIP] {tileset_name} skipped because metatile_attributes.bin was not found.") continue - if os.path.getsize(metatiles_path) != 4 * os.path.getsize(metatile_attributes_path): + if os.path.getsize(metatiles_path) != 4*os.path.getsize(metatile_attributes_path): print(f"[SKIP] {tileset_name} skipped because metatiles.bin is not four times the size of metatile_attributes.bin (already converted?)") continue layer_types = [] meta_attributes = [] with open(metatile_attributes_path, 'rb') as fileobj: - while (chunk := fileobj.read(2)): - metatile_attribute = struct.unpack('> layer_type_shift) + for chunk in iter(lambda: fileobj.read(4), ''): + if chunk == b'': + break + metatile_attribute = struct.unpack('