refractor(Tpk): use lzma.tpk instead of uncompressed.tpk to reduce wh… · SNWCreations/UnityPy@636e264 · GitHub
Skip to content

Commit 636e264

Browse files
committed
refractor(Tpk): use lzma.tpk instead of uncompressed.tpk to reduce wheel and sdist size
1 parent 28de417 commit 636e264

4 files changed

Lines changed: 11 additions & 7 deletions

File tree

‎UnityPy/cli/update_tpk.py‎

Lines changed: 4 additions & 2 deletions

‎UnityPy/helpers/Tpk.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from struct import Struct
77
from typing import Any, Dict, List, Optional, Tuple, TypeVar
88

9+
from .CompressionHelper import decompress_lzma
910
from .TypeTreeHelper import TypeTreeNode
1011
from .UnityVersion import UnityVersion
1112

@@ -17,7 +18,7 @@
1718

1819

1920
def init():
20-
with open_binary("UnityPy.resources", "uncompressed.tpk") as f:
21+
with open_binary("UnityPy.resources", "lzma.tpk") as f:
2122
data = f.read()
2223

2324
global TPKTYPETREE
@@ -172,9 +173,7 @@ def GetDataBlob(self) -> TpkDataBlob:
172173
decompressed = lz4.block.decompress(self.CompressedBytes, self.UncompressedSize)
173174

174175
elif self.CompressionType == TpkCompressionType.Lzma:
175-
import lzma
176-
177-
decompressed = lzma.decompress(self.CompressedBytes)
176+
decompressed = decompress_lzma(self.CompressedBytes)
178177

179178
elif self.CompressionType == TpkCompressionType.Brotli:
180179
import brotli

‎UnityPy/resources/lzma.tpk‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:fc67b99c06dd7575431c70207a2f78624501b17d5150092b511783bfe6db2127
3+
size 187318

‎setup.py‎

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)