-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patharchive_unpack.py
32 lines (26 loc) · 1.18 KB
/
archive_unpack.py
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
28
29
30
31
32
import mmap
import os
from pathlib import Path
from struct import pack
import tqdm
from ProjectDecima import ArchiveManager, Archive
from ProjectDecima.utils.decryption import hash_string, decrypt_chunk_data
from ProjectDecima.archive.archive import ArchiveEntry, ArchiveChunk
from ProjectDecima.utils.oodle_wrapper import Oodle
def dump_archive(archive_path: str, dump_path: str):
dump_path = Path(dump_path)
archive_path = Path(archive_path)
archive_dump_path = dump_path / archive_path.stem
archive = Archive(archive_path)
archive.parse()
os.makedirs(archive_dump_path, exist_ok=True)
total = len(archive.entries)
for n, entry in tqdm.tqdm(enumerate(archive.entries), desc='Unpacking files', unit_scale=1, unit=' files',
total=total):
data = archive.get_file_data(entry)
with open(archive_dump_path / f'{entry.hash}.bin', 'wb') as f:
f.write(data)
if __name__ == '__main__':
dump_path = Path(r'F:\SteamLibrary\steamapps\common\Death Stranding\dump')
archive_path = r"F:\SteamLibrary\steamapps\common\Death Stranding\data\7017f9bb9d52fc1c4433599203cc51b1.bin"
dump_archive(archive_path, dump_path)