Skip to content

Commit

Permalink
update UnityPy
Browse files Browse the repository at this point in the history
  • Loading branch information
phstudy committed May 9, 2023
1 parent d6c1270 commit 3d1cd78
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions dsa_downloader/asset_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def extract_asset(self, bundle):
image_dict = {}
for obj in env.objects:
try:
if obj.type in ["Texture2D", "Sprite"]:
if obj.type.name in ["Texture2D", "Sprite"]:
im = obj.read().image
alpha = im.getchannel('A')

Expand Down Expand Up @@ -119,7 +119,7 @@ def extract_asset(self, bundle):
else:
for path, obj in env.container.items():
try:
if obj.type in ["Texture2D", "Sprite"]:
if obj.type.name in ["Texture2D", "Sprite"]:
data = obj.read()
head, tail = os.path.split(path)
dest = os.path.join(destination_folder, file_name, tail)
Expand All @@ -134,7 +134,7 @@ def extract_asset(self, bundle):

for obj in env.objects:
try:
if obj.type in ["Texture2D", "Sprite"]:
if obj.type.name in ["Texture2D", "Sprite"]:
data = obj.read()
dest = os.path.join(destination_folder, file_name, data.name)
os.makedirs(os.path.dirname(dest), exist_ok=True)
Expand All @@ -146,7 +146,7 @@ def extract_asset(self, bundle):
if not os.path.exists(dest):
img = data.image
img.save(dest)
elif obj.type == 'AudioClip':
elif obj.type.name == 'AudioClip':
clip = obj.read()
for name, data in clip.samples.items():
dest = os.path.join(destination_folder, file_name, name)
Expand All @@ -156,7 +156,7 @@ def extract_asset(self, bundle):
f.write(data)

# TODO: unit_XXXX -> .fbx
# elif obj.type == 'Animator':
# elif obj.type.name == 'Animator':
# data = obj.read()
# print(obj.__dict__)
# print(dir(data))
Expand Down
2 changes: 1 addition & 1 deletion dsa_downloader/config_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def bootstrap_extract_config(self, apk_path, output_path):
click.echo("try to find bootstrap_config")

for obj in env.objects:
if obj.type == "TextAsset":
if obj.type.name == "TextAsset":
data = obj.read()
if data.name == "bootstrap_config":
if self.debug:
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ setup_requires =
install_requires =
requests
protobuf==3.19.0
UnityPy==1.6.5.7
protobuf==3.19.5
UnityPy==1.9.28
pip
tqdm
click
Expand Down

0 comments on commit 3d1cd78

Please sign in to comment.