forked from K0lb3/UnityPy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssetBundle.py
More file actions
27 lines (23 loc) · 1 KB
/
Copy pathAssetBundle.py
File metadata and controls
27 lines (23 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from collections import defaultdict
from .NamedObject import NamedObject
from .PPtr import PPtr
class AssetInfo:
def __init__(self, reader):
self.preload_index = reader.read_int()
self.preload_size = reader.read_int()
self.asset = PPtr(reader)
class AssetBundle(NamedObject):
def __init__(self, reader):
super().__init__(reader=reader)
preload_table_size = reader.read_int()
self.m_PreloadTable = [PPtr(reader) for _ in range(preload_table_size)]
container_size = reader.read_int()
self.m_Container = {}
self.list_container = defaultdict(list)
# TODO - m_Container is a multi-dict, multiple values can have the same key
# list_container is a dict of list that workaround the issue temporarily before version 2
for i in range(container_size):
key = reader.read_aligned_string()
info = AssetInfo(reader)
self.m_Container[key] = info
self.list_container[key].append(info)