-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathRepack.py
More file actions
54 lines (45 loc) · 3.25 KB
/
Repack.py
File metadata and controls
54 lines (45 loc) · 3.25 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
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
import os
import UnityPy
import json
#Smackteo's BDSP repacker
#2.1
src = "Resources/personal_masterdatas"
directory = r'import'
env = UnityPy.load(src)
if not os.path.exists(src):
input("Error: personal_masterdatas not found \n Ensure personal_masterdatas is in Resources folder and the file name is exact \n if this is intentional press any key to continue")
if os.path.exists(src):
for filename in os.listdir(directory):
checkfile = os.path.splitext(filename)[0]
checkfile2 = checkfile.lower()
for obj in env.objects:
if obj.container == "assets/pml/data/{}.asset".format(checkfile2):
tree = obj.read_typetree()
with open('import/{}'.format(filename), "rt", encoding="utf8") as f:
data = json.load(f)
print('{} updated'.format(checkfile))
obj.save_typetree(data)
with open("output/personal_masterdatas", "wb") as t:
t.write(env.file.save(packer=(64, 2)))
src = "Resources/masterdatas"
if not os.path.exists(src):
input("Error: masterdatas not found \n Ensure masterdatas is in Resources folder and the file name is exact\n if this is intentional press any key to continue")
directory = r'import'
env = UnityPy.load(src)
if os.path.exists(src):
for filename in os.listdir(directory):
checkfile = os.path.splitext(filename)[0]
checkfile2 = checkfile.lower()
for obj in env.objects:
if obj.container == "assets/md/placedata/{}.asset".format(checkfile2) or obj.container == "assets/md/adventurenote/{}.asset".format(checkfile2) or obj.container == "assets/md/characterinfo/{}.asset".format(checkfile2) or obj.container == "assets/md/common/{}.asset".format(checkfile2) or obj.container == "assets/md/honeytree/{}.asset".format(checkfile2) or obj.container == "assets/md/kinomidata/{}.asset".format(checkfile2) or obj.container == "assets/md/localkoukan/{}.asset".format(checkfile2) or obj.container == "assets/md/mapwarpdata/{}.asset".format(checkfile2) or obj.container == "assets/md/msgwindowdata/{}.asset".format(checkfile2) or obj.container == "assets/md/network/{}.asset".format(checkfile2) or obj.container == "assets/md/placetagdata/{}.asset".format(checkfile2) or obj.container == "assets/md/pokemondata/{}.asset".format(checkfile2) or obj.container == "assets/md/shopdata/{}.asset".format(checkfile2) or obj.container == "assets/md/stopdata/{}.asset".format(checkfile2) or obj.container == "assets/md/tower/{}.asset".format(checkfile2) or obj.container == "assets/md/tv/{}.asset".format(checkfile2) or obj.container == "assets/md/underground/{}.asset".format(checkfile2):
tree = obj.read_typetree()
with open('import/{}'.format(filename), "rt", encoding="utf8") as f:
data = json.load(f)
print('{} updated'.format(checkfile))
obj.save_typetree(data)
with open("output/masterdatas", "wb") as t:
t.write(env.file.save(packer=(64, 2)))
print('Please consider joining our discord https://discord.gg/nrZGaRdqvw')
print('Please consider Subscribing to my youtube! https://www.youtube.com/channel/UCXUlKU3oQB0fO0EHfsJKfpg')
print('Or following my twitter! https://twitter.com/smackteo')
input('Repack complete enter any key to exit')