Hopefully fixed issue where newer asset bundles would cause crashes
This commit is contained in:
@@ -63,7 +63,11 @@ class AssetEdit:
|
|||||||
def getAssetInfo(self, assets, bundle):
|
def getAssetInfo(self, assets, bundle):
|
||||||
if self.id == None:
|
if self.id == None:
|
||||||
for id, obj in assets.objects.items():
|
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
|
# 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)]
|
data = bundle[obj.data_offset:(obj.data_offset + obj.size)]
|
||||||
length = int.from_bytes(data[0:4], byteorder='little')
|
length = int.from_bytes(data[0:4], byteorder='little')
|
||||||
@@ -71,7 +75,7 @@ class AssetEdit:
|
|||||||
if length + 4 <= len(data):
|
if length + 4 <= len(data):
|
||||||
if self.name == data[4:4+length].decode('utf-8'):
|
if self.name == data[4:4+length].decode('utf-8'):
|
||||||
self.id = id
|
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")
|
print(f"Will replace object #{id} with contents of {self.file} converted to a Texture2D")
|
||||||
self.shouldDecode = True
|
self.shouldDecode = True
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user