mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-12 23:58:22 +02:00
now using subprocess.run instead of subprocess.call or subprocess.check_output
This commit is contained in:
parent
98d6a4ab95
commit
0232587691
3 changed files with 36 additions and 33 deletions
|
@ -49,9 +49,9 @@ def install_mod(self):
|
||||||
|
|
||||||
if extension == "szs":
|
if extension == "szs":
|
||||||
if not (os.path.realpath(path) in extracted_file):
|
if not (os.path.realpath(path) in extracted_file):
|
||||||
subprocess.check_output(["./tools/szs/wszst", "EXTRACT", get_nodir(path), "-d",
|
subprocess.run(["./tools/szs/wszst", "EXTRACT", get_nodir(path), "-d", get_nodir(path) + ".d",
|
||||||
get_nodir(path) + ".d", "--overwrite"],
|
"--overwrite"], creationflags=CREATE_NO_WINDOW, cwd=get_dir(path),
|
||||||
creationflags=CREATE_NO_WINDOW, cwd=get_dir(path))
|
check=True, stdout=subprocess.PIPE)
|
||||||
extracted_file.append(os.path.realpath(path))
|
extracted_file.append(os.path.realpath(path))
|
||||||
|
|
||||||
szs_extract_path = path + ".d"
|
szs_extract_path = path + ".d"
|
||||||
|
@ -79,14 +79,15 @@ def install_mod(self):
|
||||||
|
|
||||||
for file in extracted_file:
|
for file in extracted_file:
|
||||||
self.Progress(statut=self.translate("Recompilation de")+f"\n{get_nodir(file)}", add=1)
|
self.Progress(statut=self.translate("Recompilation de")+f"\n{get_nodir(file)}", add=1)
|
||||||
subprocess.check_output(["./tools/szs/wszst", "CREATE", get_nodir(file) + ".d", "-d", get_nodir(file),
|
subprocess.run(["./tools/szs/wszst", "CREATE", get_nodir(file) + ".d", "-d", get_nodir(file),
|
||||||
"--overwrite"], creationflags=CREATE_NO_WINDOW, cwd=get_dir(file))
|
"--overwrite"], creationflags=CREATE_NO_WINDOW, cwd=get_dir(file),
|
||||||
|
check=True, stdout=subprocess.PIPE)
|
||||||
if os.path.exists(file + ".d"): shutil.rmtree(file + ".d")
|
if os.path.exists(file + ".d"): shutil.rmtree(file + ".d")
|
||||||
|
|
||||||
self.Progress(statut=self.translate("Patch main.dol"), add=1)
|
self.Progress(statut=self.translate("Patch main.dol"), add=1)
|
||||||
subprocess.check_output(["./tools/szs/wstrt", "patch", get_nodir(self.path_mkwf) + "/sys/main.dol",
|
subprocess.run(["./tools/szs/wstrt", "patch", get_nodir(self.path_mkwf) + "/sys/main.dol", "--clean-dol",
|
||||||
"--clean-dol", "--add-lecode"], creationflags=CREATE_NO_WINDOW,
|
"--add-lecode"], creationflags=CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf),
|
||||||
cwd=get_dir(self.path_mkwf))
|
check=True, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
self.Progress(statut=self.translate("Patch lecode-PAL.bin"), add=1)
|
self.Progress(statut=self.translate("Patch lecode-PAL.bin"), add=1)
|
||||||
|
|
||||||
|
@ -96,11 +97,11 @@ def install_mod(self):
|
||||||
filecopy("./file/lpar-default.txt", self.path_mkwf + "/tmp/lpar-default.txt")
|
filecopy("./file/lpar-default.txt", self.path_mkwf + "/tmp/lpar-default.txt")
|
||||||
filecopy("./file/lecode-PAL.bin", self.path_mkwf + "/tmp/lecode-PAL.bin")
|
filecopy("./file/lecode-PAL.bin", self.path_mkwf + "/tmp/lecode-PAL.bin")
|
||||||
|
|
||||||
subprocess.check_output(
|
subprocess.run(
|
||||||
["./tools/szs/wlect", "patch", "./tmp/lecode-PAL.bin", "-od", "./files/rel/lecode-PAL.bin",
|
["./tools/szs/wlect", "patch", "./tmp/lecode-PAL.bin", "-od", "./files/rel/lecode-PAL.bin",
|
||||||
"--track-dir", "./files/Race/Course/", "--move-tracks", "./files/Race/Course/", "--le-define",
|
"--track-dir", "./files/Race/Course/", "--move-tracks", "./files/Race/Course/", "--le-define",
|
||||||
"./tmp/CTFILE.txt", "--lpar", "./tmp/lpar-default.txt", "--overwrite"],
|
"./tmp/CTFILE.txt", "--lpar", "./tmp/lpar-default.txt", "--overwrite"],
|
||||||
creationflags=CREATE_NO_WINDOW, cwd=self.path_mkwf)
|
creationflags=CREATE_NO_WINDOW, cwd=self.path_mkwf, check=True, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
shutil.rmtree(self.path_mkwf + "/tmp/")
|
shutil.rmtree(self.path_mkwf + "/tmp/")
|
||||||
|
|
||||||
|
@ -109,14 +110,16 @@ def install_mod(self):
|
||||||
|
|
||||||
if outputformat in ["ISO", "WBFS", "CISO"]:
|
if outputformat in ["ISO", "WBFS", "CISO"]:
|
||||||
self.path_mkwf_format = os.path.realpath(self.path_mkwf + "/../MKWFaraphel." + outputformat.lower())
|
self.path_mkwf_format = os.path.realpath(self.path_mkwf + "/../MKWFaraphel." + outputformat.lower())
|
||||||
subprocess.check_output(["./tools/wit/wit", "COPY", get_nodir(self.path_mkwf), "--DEST",
|
subprocess.run(["./tools/wit/wit", "COPY", get_nodir(self.path_mkwf), "--DEST",
|
||||||
get_nodir(self.path_mkwf_format), f"--{outputformat.lower()}", "--overwrite"],
|
get_nodir(self.path_mkwf_format), f"--{outputformat.lower()}", "--overwrite"],
|
||||||
creationflags=CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf))
|
CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf),
|
||||||
|
check=True, stdout=subprocess.PIPE)
|
||||||
shutil.rmtree(self.path_mkwf)
|
shutil.rmtree(self.path_mkwf)
|
||||||
|
|
||||||
self.Progress(statut=self.translate("Changement de l'ID du jeu"), add=1)
|
self.Progress(statut=self.translate("Changement de l'ID du jeu"), add=1)
|
||||||
subprocess.check_output(["./tools/wit/wit", "EDIT", get_dir(self.path_mkwf_format), "--id", "RMCP60"],
|
subprocess.run(["./tools/wit/wit", "EDIT", get_dir(self.path_mkwf_format), "--id", "RMCP60"],
|
||||||
creationflags=CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf_format))
|
creationflags=CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf_format),
|
||||||
|
check=True, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
messagebox.showinfo(self.translate("Fin"), self.translate("L'installation est terminé !"))
|
messagebox.showinfo(self.translate("Fin"), self.translate("L'installation est terminé !"))
|
||||||
|
|
||||||
|
|
|
@ -84,17 +84,19 @@ trackname_color = {
|
||||||
"★☆☆!! ": "\c{YOR6}★☆☆\c{off} ",
|
"★☆☆!! ": "\c{YOR6}★☆☆\c{off} ",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def patch_bmg(self, gamefile): # gamefile est le fichier .szs trouvé dans le /files/Scene/UI/ du jeu
|
def patch_bmg(self, gamefile): # gamefile est le fichier .szs trouvé dans le /files/Scene/UI/ du jeu
|
||||||
try:
|
try:
|
||||||
bmglang = gamefile[-len("E.txt"):-len(".txt")] # Langue du fichier
|
bmglang = gamefile[-len("E.txt"):-len(".txt")] # Langue du fichier
|
||||||
self.Progress(statut=self.translate("Patch des textes " + bmglang), add=1)
|
self.Progress(statut=self.translate("Patch des textes " + bmglang), add=1)
|
||||||
|
|
||||||
subprocess.call(["./tools/szs/wszst", "EXTRACT", get_nodir(gamefile), "-d", get_nodir(gamefile) + ".d",
|
subprocess.run(["./tools/szs/wszst", "EXTRACT", get_nodir(gamefile), "-d", get_nodir(gamefile) + ".d",
|
||||||
"--overwrite"], creationflags=CREATE_NO_WINDOW, cwd=get_dir(gamefile))
|
"--overwrite"], creationflags=CREATE_NO_WINDOW, cwd=get_dir(gamefile))
|
||||||
|
|
||||||
# Common.bmg
|
# Common.bmg
|
||||||
bmgtracks = subprocess.check_output(["./tools/szs/wbmgt", "CAT", get_nodir(gamefile) + ".d/message/Common.bmg"],
|
bmgtracks = subprocess.run(["./tools/szs/wbmgt", "CAT", get_nodir(gamefile) + ".d/message/Common.bmg"],
|
||||||
creationflags=CREATE_NO_WINDOW, cwd=get_dir(gamefile))
|
creationflags=CREATE_NO_WINDOW, cwd=get_dir(gamefile),
|
||||||
|
check=True, stdout=subprocess.PIPE).stdout
|
||||||
bmgtracks = bmgtracks.decode()
|
bmgtracks = bmgtracks.decode()
|
||||||
trackheader = "#--- standard track names"
|
trackheader = "#--- standard track names"
|
||||||
trackend = "2328"
|
trackend = "2328"
|
||||||
|
@ -128,14 +130,12 @@ def patch_bmg(self, gamefile): # gamefile est le fichier .szs trouvé dans le /
|
||||||
if not(os.path.exists("./file/tmp/")): os.makedirs("./file/tmp/")
|
if not(os.path.exists("./file/tmp/")): os.makedirs("./file/tmp/")
|
||||||
|
|
||||||
filecopy(gamefile+".d/message/Common.bmg", "./file/tmp/Common.bmg")
|
filecopy(gamefile+".d/message/Common.bmg", "./file/tmp/Common.bmg")
|
||||||
bmgtext = subprocess.check_output(["tools/szs/wctct", "bmg", "--le-code", "--long", "./file/CTFILE.txt",
|
bmgtext = subprocess.run(["tools/szs/wctct", "bmg", "--le-code", "--long", "./file/CTFILE.txt", "--patch-bmg",
|
||||||
"--patch-bmg", "OVERWRITE=./file/tmp/Common.bmg",
|
"OVERWRITE=./file/tmp/Common.bmg", "--patch-bmg", "OVERWRITE=./file/ExtraCommon.txt"],
|
||||||
"--patch-bmg", "OVERWRITE=./file/ExtraCommon.txt"],
|
creationflags=CREATE_NO_WINDOW, check=True, stdout=subprocess.PIPE).stdout.decode()
|
||||||
creationflags=CREATE_NO_WINDOW).decode()
|
rbmgtext = subprocess.run(["tools/szs/wctct", "bmg", "--le-code", "--long", "./file/RCTFILE.txt", "--patch-bmg",
|
||||||
rbmgtext = subprocess.check_output(["tools/szs/wctct", "bmg", "--le-code", "--long", "./file/RCTFILE.txt",
|
"OVERWRITE=./file/tmp/Common.bmg", "--patch-bmg", "OVERWRITE=./file/ExtraCommon.txt"],
|
||||||
"--patch-bmg", "OVERWRITE=./file/tmp/Common.bmg",
|
creationflags=CREATE_NO_WINDOW, check=True, stdout=subprocess.PIPE).stdout.decode()
|
||||||
"--patch-bmg", "OVERWRITE=./file/ExtraCommon.txt"],
|
|
||||||
creationflags=CREATE_NO_WINDOW).decode()
|
|
||||||
|
|
||||||
shutil.rmtree(gamefile + ".d")
|
shutil.rmtree(gamefile + ".d")
|
||||||
os.remove("./file/tmp/Common.bmg")
|
os.remove("./file/tmp/Common.bmg")
|
||||||
|
@ -144,8 +144,8 @@ def patch_bmg(self, gamefile): # gamefile est le fichier .szs trouvé dans le /
|
||||||
def finalise(common_file, bmgtext):
|
def finalise(common_file, bmgtext):
|
||||||
for console in trackname_color: bmgtext = bmgtext.replace(console, trackname_color[console])
|
for console in trackname_color: bmgtext = bmgtext.replace(console, trackname_color[console])
|
||||||
with open(common_file, "w", encoding="utf-8") as f: f.write(bmgtext)
|
with open(common_file, "w", encoding="utf-8") as f: f.write(bmgtext)
|
||||||
subprocess.call(["./tools/szs/wbmgt", "ENCODE", get_nodir(common_file), "--overwrite"],
|
subprocess.run(["./tools/szs/wbmgt", "ENCODE", get_nodir(common_file), "--overwrite"],
|
||||||
creationflags=CREATE_NO_WINDOW, cwd=get_dir(common_file))
|
creationflags=CREATE_NO_WINDOW, cwd=get_dir(common_file))
|
||||||
os.remove(common_file)
|
os.remove(common_file)
|
||||||
|
|
||||||
finalise(f"./file/Common_{bmglang}.txt", bmgtext)
|
finalise(f"./file/Common_{bmglang}.txt", bmgtext)
|
||||||
|
|
|
@ -30,15 +30,15 @@ def patch_file(self):
|
||||||
|
|
||||||
for i, file in enumerate(fc["img"]):
|
for i, file in enumerate(fc["img"]):
|
||||||
self.Progress(statut=self.translate("Conversion des images")+f"\n({i + 1}/{len(fc['img'])}) {file}", add=1)
|
self.Progress(statut=self.translate("Conversion des images")+f"\n({i + 1}/{len(fc['img'])}) {file}", add=1)
|
||||||
subprocess.call(["./tools/szs/wimgt", "ENCODE", "./file/" + file, "-x", fc["img"][file], "--overwrite"]
|
subprocess.run(["./tools/szs/wimgt", "ENCODE", "./file/" + file, "-x", fc["img"][file], "--overwrite"],
|
||||||
, creationflags=CREATE_NO_WINDOW)
|
creationflags=CREATE_NO_WINDOW)
|
||||||
|
|
||||||
for file in glob.glob(self.path_mkwf+"/files/Scene/UI/MenuSingle_?.szs"):
|
for file in glob.glob(self.path_mkwf+"/files/Scene/UI/MenuSingle_?.szs"):
|
||||||
self.patch_bmg(file)
|
self.patch_bmg(file)
|
||||||
|
|
||||||
if not(os.path.exists("./file/auto-add/")):
|
if not(os.path.exists("./file/auto-add/")):
|
||||||
subprocess.call(["./tools/szs/wszst", "AUTOADD", self.path_mkwf + "/files/Race/Course/", "--DEST",
|
subprocess.run(["./tools/szs/wszst", "AUTOADD", self.path_mkwf + "/files/Race/Course/", "--DEST",
|
||||||
"./file/auto-add/"], creationflags=CREATE_NO_WINDOW)
|
"./file/auto-add/"], creationflags=CREATE_NO_WINDOW)
|
||||||
|
|
||||||
max_process = 8
|
max_process = 8
|
||||||
process_list = {}
|
process_list = {}
|
||||||
|
|
Loading…
Reference in a new issue