-
Notifications
You must be signed in to change notification settings - Fork 32
/
pubg-pak-unpack.py
63 lines (43 loc) · 2.05 KB
/
pubg-pak-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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import argparse
import os.path
import shutil
import subprocess
import sys
parser = argparse.ArgumentParser()
# parser.add_argument('-pubg', '--pubg_path', help = 'PUBG path', default = r'C:\Program Files (x86)\Steam\steamapps\common\PUBG')
parser.add_argument('-tsl', '--pubg_tslgame_path', help = 'TslGame path', default = r'C:\TslGame')
parser.add_argument('-o', '--output_path', help = 'working directory for extracting and stitching assets', default = 'pubg-maps')
parser.add_argument('-m', '--map', help = 'map identifier, either Erangle or Miramar', default = 'erangle')
args = parser.parse_args()
# prepare for action
# pubgPaksPath = r'TslGame\Content\Paks'
# pakFileNamesByMapNames = {
# 'erangle' : 'TslGame-WindowsNoEditor_erangel_heightmap.pak',
# 'miramar' : 'TslGame-WindowsNoEditor_desert_heightmap.pak' }
# ue4unpacker = 'ue4pakunpacker.exe'
# # assert preconditions
# mapIdentifier = args.map.lower()
# if mapIdentifier not in {'erangle', 'miramar'}:
# sys.exit('unknown map identifier \'' + mapIdentifier + '\'')
# assert os.path.isdir(args.pubg_path)
# assert os.path.isdir(os.path.join(args.pubg_path, pubgPaksPath))
# pakFilePath = os.path.abspath(os.path.join(args.pubg_path, pubgPaksPath, pakFileNamesByMapNames[mapIdentifier]))
# assert os.path.isfile(pakFilePath)
# outputPath = args.output_path
# if not os.path.isdir(outputPath):
# os.makedirs(outputPath)
# assert os.path.isdir(outputPath)
# assert os.path.isfile(ue4unpacker)
# ue4unpackerPath = os.path.abspath(ue4unpacker)
# # copy relevant paks
# print ('copy relevant pak(s)')
# shutil.copy2(pakFilePath, outputPath)
# pakFilePathCopied = os.path.join(outputPath, pakFileNamesByMapNames[mapIdentifier])
# # unpack paks
# print ('popen ue4pakunpacker in \'' + outputPath + '\' | wait for it')
# orig_cwd = os.getcwd() # remember our original working directory
# output_cwd = os.path.join(os.path.abspath(sys.path[0]), outputPath)
# os.chdir(output_cwd)
# process = subprocess.Popen(ue4unpackerPath + ' ' + pakFileNamesByMapNames[mapIdentifier])
# process.wait()
# os.chdir(orig_cwd)