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
This commit is contained in:
drojf
2024-01-25 22:05:37 +11:00
parent bb2ac64e37
commit 33d24e3f38
4 changed files with 4 additions and 6 deletions

View File

@@ -274,9 +274,6 @@ if sys.version_info < (2, 7):
print(">>>> ERROR: This script does not work on Python 2.7") print(">>>> ERROR: This script does not work on Python 2.7")
exit(-1) 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']) Globals.SEVEN_ZIP_EXECUTABLE = findWorkingExecutablePath(["7za", "7z"], ['-h'])
if Globals.SEVEN_ZIP_EXECUTABLE is None: if Globals.SEVEN_ZIP_EXECUTABLE is None:
print(">>>> ERROR: Can't find 7zip as '7z' or '7za'") print(">>>> ERROR: Can't find 7zip as '7z' or '7za'")

View File

@@ -1,3 +1,4 @@
numpy numpy
Pillow Pillow
unitypack 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

View File

@@ -185,7 +185,7 @@ with open(sys.argv[1], "rb") as assetsFile:
bundle = assetsFile.read() bundle = assetsFile.read()
unityVersion = [int(x) for x in bundle[20:28].decode("utf-8").rstrip("\0").split(".")[:2]] unityVersion = [int(x) for x in bundle[20:28].decode("utf-8").rstrip("\0").split(".")[:2]]
assetsFile.seek(0) assetsFile.seek(0)
assets = Asset.from_file(assetsFile) assets = Asset.from_file(assetsFile, legacy_mode=True)
for edit in edits: for edit in edits:
edit.getAssetInfo(assets, bundle) edit.getAssetInfo(assets, bundle)
edits = [x for x in edits if x.id != None] edits = [x for x in edits if x.id != None]

View File

@@ -133,7 +133,7 @@ with open(sys.argv[1], "rb") as assetsFile:
edits = newEdits edits = newEdits
assetsFile.seek(0) assetsFile.seek(0)
assets = Asset.from_file(assetsFile) assets = Asset.from_file(assetsFile, legacy_mode=True)
for id, obj in assets.objects.items(): for id, obj in assets.objects.items():
for edit in edits: for edit in edits:
edit.checkObject(id, obj, bundle) edit.checkObject(id, obj, bundle)