From 27b8dcb9acbb98750a135b2612f4b601a14820bb Mon Sep 17 00:00:00 2001 From: tellowkrinkle Date: Sat, 25 Aug 2018 16:51:02 -0500 Subject: [PATCH] Hopefully fixed issue where newer asset bundles would cause crashes --- EMIPGenerator.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/EMIPGenerator.py b/EMIPGenerator.py index 0873705..3fdadf3 100644 --- a/EMIPGenerator.py +++ b/EMIPGenerator.py @@ -63,7 +63,11 @@ class AssetEdit: def getAssetInfo(self, assets, bundle): if self.id == None: for id, obj in assets.objects.items(): - if obj.type != self.type: continue + try: + objType = obj.type + except: + continue + if objType != self.type: continue # UnityPack is broken and overreads its buffer if we try to use it to automatically decode things, so instead we use this sometimes-working thing to decode the name data = bundle[obj.data_offset:(obj.data_offset + obj.size)] length = int.from_bytes(data[0:4], byteorder='little') @@ -71,7 +75,7 @@ class AssetEdit: if length + 4 <= len(data): if self.name == data[4:4+length].decode('utf-8'): self.id = id - if obj.type == "Texture2D" and self.file[-4:] == ".png": + if objType == "Texture2D" and self.file[-4:] == ".png": print(f"Will replace object #{id} with contents of {self.file} converted to a Texture2D") self.shouldDecode = True else: