File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change 88
99from .TypeTreeHelper import TypeTreeNode
1010
11- TPKTYPETREE : TpkTypeTreeBlob = None
12- CLASSES_CACHE : Dict [Tuple [int , tuple ], TypeTreeNode ] = {}
13- NODES_CACHE : Dict [TpkUnityClass , TypeTreeNode ] = {}
14-
1511
16- def init ():
12+ def init_tpk_typetree ():
1713 with open_binary ("UnityPy.resources" , "uncompressed.tpk" ) as f :
1814 data = f .read ()
19-
20- global TPKTYPETREE
2115 with BytesIO (data ) as stream :
22- TPKTYPETREE = TpkFile (stream ).GetDataBlob ()
16+ blob = TpkFile (stream ).GetDataBlob ()
17+ assert isinstance (blob , TpkTypeTreeBlob )
18+ return blob
19+
20+
21+ TPKTYPETREE : TpkTypeTreeBlob = init_tpk_typetree ()
22+ CLASSES_CACHE : Dict [Tuple [int , tuple ], TypeTreeNode ] = {}
23+ NODES_CACHE : Dict [TpkUnityClass , TypeTreeNode ] = {}
2324
2425
2526def get_typetree_node (class_id : int , version : tuple ):
@@ -535,6 +536,3 @@ def get_item_for_version(
535536 if ret :
536537 return ret
537538 raise ValueError ("Could not find exact version" )
538-
539-
540- init ()
You can’t perform that action at this time.
0 commit comments