From 33d24e3f38aea8eb1e89ffc6430610811215ef71 Mon Sep 17 00:00:00 2001 From: drojf <1249449+drojf@users.noreply.github.com> Date: Thu, 25 Jan 2024 22:05:37 +1100 Subject: [PATCH] Remove requirement of using Python 3.10 and below - I added a 'legacy mode' flag to revert https://github.com/HearthSim/UnityPack/pull/101 as it caused problems on Rei - I tested the new setup (using custom unitypack) vs old one, and the output .asset files were bit-for-bit identical --- build.py | 3 --- requirements.txt | 3 ++- scripts/EMIPGenerator.py | 2 +- scripts/UnityTextModifier.py | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/build.py b/build.py index 3c833fa..b6090bd 100644 --- a/build.py +++ b/build.py @@ -274,9 +274,6 @@ if sys.version_info < (2, 7): print(">>>> ERROR: This script does not work on Python 2.7") exit(-1) -if not (sys.version_info < (3, 11)): - print(">>>> WARNING: This script probably does not work on Python 3.11 because unitypack uses old version of decrunch which does not build. Use Python 3.10 or below if you have this error.") - Globals.SEVEN_ZIP_EXECUTABLE = findWorkingExecutablePath(["7za", "7z"], ['-h']) if Globals.SEVEN_ZIP_EXECUTABLE is None: print(">>>> ERROR: Can't find 7zip as '7z' or '7za'") diff --git a/requirements.txt b/requirements.txt index 1fc36b0..089e95c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ numpy Pillow -unitypack \ No newline at end of file +unitypack @ git+https://github.com/drojf/UnityPack@master # custom build of unitypack which does not require 'decrunch' +setuptools # required for unitypack or else get `pkg_resources` error \ No newline at end of file diff --git a/scripts/EMIPGenerator.py b/scripts/EMIPGenerator.py index d45bbeb..d7ddbf3 100644 --- a/scripts/EMIPGenerator.py +++ b/scripts/EMIPGenerator.py @@ -185,7 +185,7 @@ with open(sys.argv[1], "rb") as assetsFile: bundle = assetsFile.read() unityVersion = [int(x) for x in bundle[20:28].decode("utf-8").rstrip("\0").split(".")[:2]] assetsFile.seek(0) - assets = Asset.from_file(assetsFile) + assets = Asset.from_file(assetsFile, legacy_mode=True) for edit in edits: edit.getAssetInfo(assets, bundle) edits = [x for x in edits if x.id != None] diff --git a/scripts/UnityTextModifier.py b/scripts/UnityTextModifier.py index 69119c1..dbee96e 100644 --- a/scripts/UnityTextModifier.py +++ b/scripts/UnityTextModifier.py @@ -133,7 +133,7 @@ with open(sys.argv[1], "rb") as assetsFile: edits = newEdits assetsFile.seek(0) - assets = Asset.from_file(assetsFile) + assets = Asset.from_file(assetsFile, legacy_mode=True) for id, obj in assets.objects.items(): for edit in edits: edit.checkObject(id, obj, bundle)