-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.py
62 lines (46 loc) · 1.52 KB
/
build.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
62
import os
import urllib
import subprocess
import platform
from distutils.dir_util import copy_tree
default_dir = "C:\Program Files (x86)\Katawa Shoujo"
patch_dir = "KatawaShoujoHD"
languages_dir = "Languages"
out_dir = "bin"
#Determine the base game install path
if os.path.exists("paths.txt"):
f = open("paths.txt", "r")
path = f.read().rstrip()
f.close()
elif os.path.exists(default_dir):
path = default_dir
else:
while True:
path = input("Enter the base game's directory: ")
if os.path.exists(path):
break
print("Invalid directory entered.")
print("Found the game files at:", path)
#Copy the base game files to the output directory
copy_tree(path, out_dir)
print("Copied base game files")
#Hand the call to rpaExtract to wine if not on windows
user_os = platform.system()
rpa_path = os.path.join(path, 'game/data.rpa')
extract_path = os.path.join(out_dir, 'game')
if user_os == "Windows":
subprocess.call(['rpatool.exe', '-x', rpa_path, '-o', extract_path])
else:
subprocess.call(['wine', 'rpatool.exe', '-x', rpa_path, '-o', extract_path])
print("Extracted rpa")
#Remove the rpa
os.remove(os.path.join(out_dir, "game/data.rpa"))
print("Removed redundant files")
copy_tree(patch_dir, out_dir)
print("Patched the game files, the game is now playable in the folder", out_dir, "by running KatawaShoujo.exe")
russian = input("Install the Russian patch? (Y/N)")
if russian.lower() == 'y':
copy_tree(os.path.join(languages_dir,"Russian"), out_dir)
print("Installed Russian patch")
print("Installation complete")
input()