From e06c847349d3767e4282f0465ff54a5f18f9fc9e Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 09:04:55 +0200 Subject: [PATCH 01/20] preparing next version file --- version | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version b/version index 8c60d8a..825e80b 100644 --- a/version +++ b/version @@ -1,7 +1,7 @@ { "version": "0.6", - "subversion": "0", - "changelog": "- The image of the score system explanation now have explain the star's color\n- Microsoft Visual C++ should now be included with the installer, avoiding an error with vcruntime140.dll\n- Update will now be detected by the installer when changing subversion (0.5.1 -> 0.5.2 will be detected)\n- A new file named \"error.log\" can now be generated when an error is occurring, helping debugging\n- Updated cx_freeze so that having special character in path don't cause issue (.exe version)\n- Fixed an issue where having a dump with a DATA directory would cause the installer to not work", + "subversion": "1", + "changelog": "", "download_bin": "https://github.com/Faraphel/MKWF-Install/releases/download/0.6/MKWF.v0.6.zip", "updater_bin": "https://github.com/Faraphel/MKWF-Install/raw/master/Updater/Updater.zip" } From 47694554d999269cdb8562ab41f78d01d5403267 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 09:06:21 +0200 Subject: [PATCH 02/20] added other lecode.bin file to build --- setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.py b/setup.py index 481a9c4..506b3c3 100644 --- a/setup.py +++ b/setup.py @@ -27,6 +27,9 @@ include_files = [ ("./file/CourseSelectCup.brctr", "./file/CourseSelectCup.brctr"), ("./file/course_name.brlyt", "./file/course_name.brlyt"), ("./file/lecode-PAL.bin", "./file/lecode-PAL.bin"), + ("./file/lecode-USA.bin", "./file/lecode-USA.bin"), + ("./file/lecode-JAP.bin", "./file/lecode-JAP.bin"), + ("./file/lecode-KOR.bin", "./file/lecode-KOR.bin"), ("./file/itemBoxNiseRtpa.brres", "./file/itemBoxNiseRtpa.brres"), ("./file/lpar-default.txt", "./file/lpar-default.txt"), ("./file/RKRace.breff", "./file/RKRace.breff"), From 6dfcedca228b6e228ef9d08a578450aa81f08b0e Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 09:07:15 +0200 Subject: [PATCH 03/20] added USA's bmg file --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index d2f7e77..412c05f 100644 --- a/.gitignore +++ b/.gitignore @@ -88,3 +88,9 @@ /test/ /distribution.txt /error.log +/file/Common_RU.bmg +/file/Common_U.bmg +/file/Common_RQ.bmg +/file/Common_RM.bmg +/file/Common_Q.bmg +/file/Common_M.bmg From 77bf9541461134f20d7f8162529bdd2c97afd9f1 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 09:20:22 +0200 Subject: [PATCH 04/20] fixed Common.bmg file --- fs.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs.json b/fs.json index 9c992ef..b4c140a 100644 --- a/fs.json +++ b/fs.json @@ -25,22 +25,22 @@ "Scene/UI/*_E.szs": {"/message/Common.bmg": "Common_E.bmg"}, - "Scene/UI/*_U.szs": {"/message/Common.bmg": "Common_E.bmg"}, + "Scene/UI/*_U.szs": {"/message/Common.bmg": "Common_U.bmg"}, "Scene/UI/*_F.szs": {"/message/Common.bmg": "Common_F.bmg"}, - "Scene/UI/*_Q.szs": {"/message/Common.bmg": "Common_F.bmg"}, + "Scene/UI/*_Q.szs": {"/message/Common.bmg": "Common_Q.bmg"}, "Scene/UI/*_G.szs": {"/message/Common.bmg": "Common_G.bmg"}, "Scene/UI/*_I.szs": {"/message/Common.bmg": "Common_I.bmg"}, "Scene/UI/*_S.szs": {"/message/Common.bmg": "Common_S.bmg"}, - "Scene/UI/*_M.szs": {"/message/Common.bmg": "Common_S.bmg"}, + "Scene/UI/*_M.szs": {"/message/Common.bmg": "Common_M.bmg"}, "Scene/UI/Race_E.szs": {"/message/Common.bmg": "Common_RE.bmg"}, - "Scene/UI/Race_U.szs": {"/message/Common.bmg": "Common_RE.bmg"}, + "Scene/UI/Race_U.szs": {"/message/Common.bmg": "Common_RU.bmg"}, "Scene/UI/Race_F.szs": {"/message/Common.bmg": "Common_RF.bmg"}, - "Scene/UI/Race_Q.szs": {"/message/Common.bmg": "Common_RF.bmg"}, + "Scene/UI/Race_Q.szs": {"/message/Common.bmg": "Common_RQ.bmg"}, "Scene/UI/Race_G.szs": {"/message/Common.bmg": "Common_RG.bmg"}, "Scene/UI/Race_I.szs": {"/message/Common.bmg": "Common_RI.bmg"}, "Scene/UI/Race_S.szs": {"/message/Common.bmg": "Common_RS.bmg"}, - "Scene/UI/Race_M.szs": {"/message/Common.bmg": "Common_RS.bmg"}, + "Scene/UI/Race_M.szs": {"/message/Common.bmg": "Common_RM.bmg"}, "Boot/Strap/eu/Dutch.szs": { "/Textures(NW4R)/strapA_16_9_832x456": "strapA_16_9_832x456de", From c5fd91f416fa63c5866eed05f601b465a09b447c Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 10:45:29 +0200 Subject: [PATCH 05/20] added Japan file --- fs.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs.json b/fs.json index b4c140a..56865cd 100644 --- a/fs.json +++ b/fs.json @@ -25,6 +25,7 @@ "Scene/UI/*_E.szs": {"/message/Common.bmg": "Common_E.bmg"}, + "Scene/UI/*_J.szs": {"/message/Common.bmg": "Common_J.bmg"}, "Scene/UI/*_U.szs": {"/message/Common.bmg": "Common_U.bmg"}, "Scene/UI/*_F.szs": {"/message/Common.bmg": "Common_F.bmg"}, "Scene/UI/*_Q.szs": {"/message/Common.bmg": "Common_Q.bmg"}, @@ -34,6 +35,7 @@ "Scene/UI/*_M.szs": {"/message/Common.bmg": "Common_M.bmg"}, "Scene/UI/Race_E.szs": {"/message/Common.bmg": "Common_RE.bmg"}, + "Scene/UI/Race_J.szs": {"/message/Common.bmg": "Common_RJ.bmg"}, "Scene/UI/Race_U.szs": {"/message/Common.bmg": "Common_RU.bmg"}, "Scene/UI/Race_F.szs": {"/message/Common.bmg": "Common_RF.bmg"}, "Scene/UI/Race_Q.szs": {"/message/Common.bmg": "Common_RQ.bmg"}, @@ -60,6 +62,12 @@ "/Textures(NW4R)/strapA_608x456": "strapA_608x456en", "/Textures(NW4R)/strapB_608x456": "strapA_608x456en" }, + "Boot/Strap/jp/jp.szs": { + "/Textures(NW4R)/strapA_16_9_832x456": "strapA_16_9_832x456en", + "/Textures(NW4R)/strapB_16_9_832x456": "strapA_16_9_832x456en", + "/Textures(NW4R)/strapA_608x456": "strapA_608x456en", + "/Textures(NW4R)/strapB_608x456": "strapA_608x456en" + }, "Boot/Strap/eu/French.szs": { "/Textures(NW4R)/strapA_16_9_832x456": "strapA_16_9_832x456fr", "/Textures(NW4R)/strapB_16_9_832x456": "strapA_16_9_832x456fr", From 3b1294133d2ebbc47d3658262e4ee887e71bb08e Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 10:51:23 +0200 Subject: [PATCH 06/20] added support for utf8 to avoid problem with JAP and KOR bmg files --- source/patch_bmg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/patch_bmg.py b/source/patch_bmg.py index 3a70a6d..e229243 100644 --- a/source/patch_bmg.py +++ b/source/patch_bmg.py @@ -102,7 +102,7 @@ def patch_bmg(self, gamefile): # gamefile est le fichier .szs trouvé dans le / trackend = "2328" bmgtracks = bmgtracks[bmgtracks.find(trackheader) + len(trackheader):bmgtracks.find(trackend)] - with open("./file/ExtraCommon.txt", "w") as f: + with open("./file/ExtraCommon.txt", "w", encoding="utf8") as f: f.write("#BMG\n\n" f" 703e\t= {self.translate('Aléatoire: Toutes les pistes', lang=bmglang)}\n" f" 703f\t= {self.translate('Aléatoire: Pistes Originales', lang=bmglang)}\n" From 63456239e145f9f7eff32e6d0d8698c5c5812e12 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 10:52:16 +0200 Subject: [PATCH 07/20] added support for all other lecode region --- source/__init__.py | 27 ++++++++++++++++++++++++--- source/install_mod.py | 13 +++++++------ 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/source/__init__.py b/source/__init__.py index 5a7c80e..fee0fa9 100644 --- a/source/__init__.py +++ b/source/__init__.py @@ -2,6 +2,7 @@ from tkinter import * from tkinter import messagebox, filedialog, ttk from threading import Thread import subprocess +import glob import os from .definition import * @@ -46,7 +47,7 @@ def __init__(self): Button(self.frame_game_path, text="...", relief=RIDGE, command=select_path).grid(row=1, column=2, sticky="NEWS") - self.frame_game_path_action = Frame(self.frame_game_path) # Action Extraire & Tout faire + self.frame_game_path_action = Frame(self.frame_game_path) # Extract and do everything button self.frame_game_path_action.grid(row=2, column=1, columnspan=2, sticky="NEWS") self.frame_game_path_action.columnconfigure(1, weight=1) @@ -65,6 +66,7 @@ def __init__(self): self.translate("Ce dossier sera écrasé si vous installer le mod !\n" + "Êtes-vous sûr de vouloir l'utiliser ?")): self.path_mkwf = os.path.realpath(path + "/../../") + else: return elif extension.upper() in ["ISO", "WBFS", "WIA", "CSIO"]: # Fiding a directory name that dosen't already exist directory_name, i = "MKWiiFaraphel", 1 @@ -86,14 +88,33 @@ def __init__(self): self.Progress(show=False) return - if os.path.exists(self.path_mkwf + "/files/rel/lecode-PAL.bin"): + if glob.glob(self.path_mkwf + "/files/rel/lecode-???.bin"): # if a LECODE file is already here messagebox.showwarning(self.translate("Attention"), self.translate("Cette ROM est déjà moddé, " + "il est déconseillé de l'utiliser pour installer le mod")) + region_ID = { + "J": "JAP", + "P": "PAL", + "K": "KOR", + "E": "USA" + } + try: + with open(self.path_mkwf + "/setup.txt") as f: setup = f.read() + setup = setup[setup.find("!part-id = ")+len("!part-id = "):] + self.original_game_ID = setup[:setup.find("\n")] + except: + messagebox.showwarning(self.translate("Attention"), + self.transate("Impossible de trouver la région de votre jeu.\n" + "la région PAL sera utilisé par défaut.")) + self.original_game_ID = "RMCP01" + try: self.original_region = region_ID[self.original_game_ID[3]] + except: self.original_region = "PAL" + + self.frame_action.grid(row=3, column=1, sticky="NEWS") + except: self.log_error() finally: - self.frame_action.grid(row=3, column=1, sticky="NEWS") self.Progress(show=False) t = Thread(target=func) diff --git a/source/install_mod.py b/source/install_mod.py index 1444cd2..bca954b 100644 --- a/source/install_mod.py +++ b/source/install_mod.py @@ -89,18 +89,19 @@ def install_mod(self): "--add-lecode"], creationflags=CREATE_NO_WINDOW, 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.bin"), add=1) shutil.copytree("./file/Track/", self.path_mkwf+"/files/Race/Course/", dirs_exist_ok=True) if not(os.path.exists(self.path_mkwf+"/tmp/")): os.makedirs(self.path_mkwf+"/tmp/") filecopy("./file/CTFILE.txt", self.path_mkwf+"/tmp/CTFILE.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(f"./file/lecode-{self.original_region}.bin", self.path_mkwf + f"/tmp/lecode-{self.original_region}.bin") subprocess.run( - ["./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", - "./tmp/CTFILE.txt", "--lpar", "./tmp/lpar-default.txt", "--overwrite"], + ["./tools/szs/wlect", "patch", f"./tmp/lecode-{self.original_region}.bin", "-od", + f"./files/rel/lecode-{self.original_region}.bin", "--track-dir", "./files/Race/Course/", + "--move-tracks", "./files/Race/Course/", "--le-define", "./tmp/CTFILE.txt", "--lpar", + "./tmp/lpar-default.txt", "--overwrite"], creationflags=CREATE_NO_WINDOW, cwd=self.path_mkwf, check=True, stdout=subprocess.PIPE) shutil.rmtree(self.path_mkwf + "/tmp/") @@ -117,7 +118,7 @@ def install_mod(self): shutil.rmtree(self.path_mkwf) self.Progress(statut=self.translate("Changement de l'ID du jeu"), add=1) - subprocess.run(["./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"], # see to maybe change ID to MKWF creationflags=CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf_format), check=True, stdout=subprocess.PIPE) From 63602cdc4667500e73a85989bba6e01bd1cdd5ca Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 10:53:29 +0200 Subject: [PATCH 08/20] added JAP bmg file to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 412c05f..0163cc4 100644 --- a/.gitignore +++ b/.gitignore @@ -94,3 +94,5 @@ /file/Common_RM.bmg /file/Common_Q.bmg /file/Common_M.bmg +/file/Common_RJ.bmg +/file/Common_J.bmg From 966e3d1967e788225596ff1a02863f5335d2a62d Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 11:25:34 +0200 Subject: [PATCH 09/20] added support for KOR files --- fs.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fs.json b/fs.json index 56865cd..a45940b 100644 --- a/fs.json +++ b/fs.json @@ -25,6 +25,7 @@ "Scene/UI/*_E.szs": {"/message/Common.bmg": "Common_E.bmg"}, + "Scene/UI/*_K.szs": {"/message/Common.bmg": "Common_K.bmg"}, "Scene/UI/*_J.szs": {"/message/Common.bmg": "Common_J.bmg"}, "Scene/UI/*_U.szs": {"/message/Common.bmg": "Common_U.bmg"}, "Scene/UI/*_F.szs": {"/message/Common.bmg": "Common_F.bmg"}, @@ -35,6 +36,7 @@ "Scene/UI/*_M.szs": {"/message/Common.bmg": "Common_M.bmg"}, "Scene/UI/Race_E.szs": {"/message/Common.bmg": "Common_RE.bmg"}, + "Scene/UI/Race_K.szs": {"/message/Common.bmg": "Common_RK.bmg"}, "Scene/UI/Race_J.szs": {"/message/Common.bmg": "Common_RJ.bmg"}, "Scene/UI/Race_U.szs": {"/message/Common.bmg": "Common_RU.bmg"}, "Scene/UI/Race_F.szs": {"/message/Common.bmg": "Common_RF.bmg"}, @@ -68,6 +70,18 @@ "/Textures(NW4R)/strapA_608x456": "strapA_608x456en", "/Textures(NW4R)/strapB_608x456": "strapA_608x456en" }, + "Boot/Strap/kr/Korean.szs": { + "/Textures(NW4R)/strapA_16_9_832x456": "strapA_16_9_832x456en", + "/Textures(NW4R)/strapB_16_9_832x456": "strapA_16_9_832x456en", + "/Textures(NW4R)/strapA_608x456": "strapA_608x456en", + "/Textures(NW4R)/strapB_608x456": "strapA_608x456en" + }, + "Boot/Strap/ch/Chinese.szs": { + "/Textures(NW4R)/strapA_16_9_832x456": "strapA_16_9_832x456en", + "/Textures(NW4R)/strapB_16_9_832x456": "strapA_16_9_832x456en", + "/Textures(NW4R)/strapA_608x456": "strapA_608x456en", + "/Textures(NW4R)/strapB_608x456": "strapA_608cccx456en" + }, "Boot/Strap/eu/French.szs": { "/Textures(NW4R)/strapA_16_9_832x456": "strapA_16_9_832x456fr", "/Textures(NW4R)/strapB_16_9_832x456": "strapA_16_9_832x456fr", From 094613681513c228f4af064d85bdbee66d1c2716 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 11:59:37 +0200 Subject: [PATCH 10/20] added changelog and fixed download link --- version | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version b/version index 825e80b..73b3bea 100644 --- a/version +++ b/version @@ -1,7 +1,7 @@ { "version": "0.6", "subversion": "1", - "changelog": "", - "download_bin": "https://github.com/Faraphel/MKWF-Install/releases/download/0.6/MKWF.v0.6.zip", + "changelog": "- JAP, USA and KOR version are now supported by the installer !", + "download_bin": "https://github.com/Faraphel/MKWF-Install/releases/download/0.6.1/MKWF.v0.6.1.zip", "updater_bin": "https://github.com/Faraphel/MKWF-Install/raw/master/Updater/Updater.zip" } From 4f21d6ef50ee1d70c97f6f0d543c1b901407b721 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 13:58:20 +0200 Subject: [PATCH 11/20] if track aren't correctly converted, show warning and an error after 3 warning. AUTOADD step will now work in non-ascii directory --- source/patch_file.py | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/source/patch_file.py b/source/patch_file.py index b6b6b99..f23e6ef 100644 --- a/source/patch_file.py +++ b/source/patch_file.py @@ -1,3 +1,4 @@ +from tkinter import messagebox from threading import Thread import subprocess import json @@ -31,17 +32,19 @@ def patch_file(self): 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) subprocess.run(["./tools/szs/wimgt", "ENCODE", "./file/" + file, "-x", fc["img"][file], "--overwrite"], - creationflags=CREATE_NO_WINDOW) + creationflags=CREATE_NO_WINDOW, check=True, stdout=subprocess.PIPE) for file in glob.glob(self.path_mkwf+"/files/Scene/UI/MenuSingle_?.szs"): self.patch_bmg(file) if not(os.path.exists("./file/auto-add/")): - subprocess.run(["./tools/szs/wszst", "AUTOADD", self.path_mkwf + "/files/Race/Course/", "--DEST", - "./file/auto-add/"], creationflags=CREATE_NO_WINDOW) + subprocess.run(["./tools/szs/wszst", "AUTOADD", get_nodir(self.path_mkwf) + "/files/Race/Course/", + "--DEST", "./file/auto-add/"], creationflags=CREATE_NO_WINDOW, + cwd=get_dir(self.path_mkwf), check=True, stdout=subprocess.PIPE) max_process = 8 process_list = {} + error_count, error_max = 0, 3 for i, file in enumerate(os.listdir("./file/Track-WU8/")): while True: @@ -50,7 +53,7 @@ def patch_file(self): self.Progress(statut=self.translate("Conversion des courses")+f"\n({i + 1}/{total_track})\n" + "\n".join(process_list.keys()), add=1) - if not (os.path.exists("./file/Track/" + get_filename(file) + ".szs")): + if not(os.path.exists("./file/Track/" + get_filename(file) + ".szs")): process_list[file] = subprocess.Popen([ "./tools/szs/wszst", "NORMALIZE", "./file/Track-WU8/" + file, "--DEST", "./file/Track/%N.szs", "--szs", "--overwrite", "--autoadd-path", @@ -59,9 +62,27 @@ def patch_file(self): else: for process in process_list: if process_list[process] is not None: - if not (process_list[process].poll() is None): + returncode = process_list[process].poll() + if not(returncode == None): process_list.pop(process) break + else: + process_list.pop(process) + os.remove(f"./file/Track/{get_filename(process)}.szs") + error_count += 1 + if error_count > error_max: + messagebox.showerror( + self.translate("Erreur"), + self.translate("Trop de course ont eu une erreur de conversion.")) + return + else: + messagebox.showwarning( + self.translate("Attention"), + self.translate("La course ") + + process + + self.translate(" n'a pas été correctement converti. (") + + str(error_count) + "/"+str(error_max)+")") + break else: process_list.pop(process) break From 08207369928115d7a0de65ce55b32e117f51e34d Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 13:58:37 +0200 Subject: [PATCH 12/20] added patch_file.py translation --- translation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translation.json b/translation.json index 9947b74..dafdd3d 100644 --- a/translation.json +++ b/translation.json @@ -1 +1 @@ -{"en": {"Une erreur est survenue :": "An error occured :", "Cette action va extraire / utiliser la ROM s\u00e9lectionn\u00e9, pr\u00e9parer les fichiers et installer le mod. Voulez-vous continuer ?": "This will extract the selected ROM, prepare files and install mod. Do you wish to continue ?", "Fonctionnalit\u00e9 exp\u00e9rimentale": "Experimental functionality", "Tout faire": "Do everything", "Cr\u00e9ation des images descriptives": "Creation of descriptive images", "Cr\u00e9ation de ct_icon.png": "Creating ct_icon.png", "Patch des textes ": "Patching text ", "Al\u00e9atoire: Toutes les pistes": "Random: All tracks", "Al\u00e9atoire: Pistes Originales": "Random: Original tracks", "Al\u00e9atoire: Custom Tracks": "Random: Custom Tracks", "Al\u00e9atoire: Pistes Nouvelles": "Random: New tracks", "MKWFaraphel Installateur": "MKWFaraphel Installer", "Jeu Wii": "Wii game", "Jeu original": "Original game", "Erreur": "Error", "Le chemin de fichier est invalide": "The file path in invalid", "Attention": "Warning", "Ce dossier sera \u00e9cras\u00e9 si vous installer le mod !\n\u00cates-vous s\u00fbr de vouloir l'utiliser ?": "This directory will be overwritten if you install the mod !\nAre you sure you want to use it ?", "Extraction du jeu...": "Extracting the game...", "Le type de fichier n'est pas reconnu": "This file type is not supported", "Cette ROM est d\u00e9j\u00e0 modd\u00e9, il est d\u00e9conseill\u00e9 de l'utiliser pour installer le mod": "This game is already modded, it is not recommended to use it to install the mod", "Extraire le fichier": "Extract file", "Preparer les fichiers": "Prepare files", "Action": "Action", "Installer le mod": "Install mod", "Dossier": "Directory", "Langage : ": "Language : ", "Mise \u00e0 jour disponible !": "Update available !", "Une mise \u00e0 jour est disponible, souhaitez-vous l'installer ?": "An update is available, do you want to install it ?", "T\u00e9l\u00e9chargement de Updater en cours...": "Downloading the Updater...", "fin du t\u00e9l\u00e9chargement, d\u00e9but de l'extraction...": "end of the download, extracting...", "fin de l'extraction": "finished extracting", "lancement de l'application...": "starting application...", "Modification de": "Modifying", "Recompilation de": "Recompilating", "Conversion en": "Converting to", "Changement de l'ID du jeu": "editing game's ID", "Fin": "End", "L'installation est termin\u00e9 !": "The mod has been installed !", "Conversion des fichiers": "Converting files", "Conversion des images": "Converting images", "Conversion des textes": "Converting texts", "Conversion des courses": "Converting races", "Configuration de LE-CODE": "Configurating LE-CODE"}, "ge": {"Al\u00e9atoire: Toutes les pistes": "Zuf\u00e4llig: Alle Spuren", "Al\u00e9atoire: Pistes Originales": "Zuf\u00e4llig: Original-Spuren", "Al\u00e9atoire: Custom Tracks": "Zuf\u00e4llig: Custom Tracks", "Al\u00e9atoire: Pistes Nouvelles": "Zuf\u00e4llig: Neue Spuren"}, "it": {"Al\u00e9atoire: Toutes les pistes": "Casuale: Tutte le tracce", "Al\u00e9atoire: Pistes Originales": "Casuale: Tracce originali", "Al\u00e9atoire: Custom Tracks": "Casuale: Custom Tracks", "Al\u00e9atoire: Pistes Nouvelles": "Casuale: Nuovi brani"}, "sp": {"Al\u00e9atoire: Toutes les pistes": "Aleatorio: Todas las pistas", "Al\u00e9atoire: Pistes Originales": "Aleatorio: Pistas originales", "Al\u00e9atoire: Custom Tracks": "Aleatorio: Custom Tracks", "Al\u00e9atoire: Pistes Nouvelles": "Aleatorio: Pistas nuevas"}, "selected": "fr"} \ No newline at end of file +{"en": {"La course ": "The track ", " n'a pas été correctement converti. (": "hasn't been correctly converted. (", "Trop de course ont eu une erreur de conversion.": "Too much track had a conversion issue.", "Une erreur est survenue :": "An error occured :", "Cette action va extraire / utiliser la ROM s\u00e9lectionn\u00e9, pr\u00e9parer les fichiers et installer le mod. Voulez-vous continuer ?": "This will extract the selected ROM, prepare files and install mod. Do you wish to continue ?", "Fonctionnalit\u00e9 exp\u00e9rimentale": "Experimental functionality", "Tout faire": "Do everything", "Cr\u00e9ation des images descriptives": "Creation of descriptive images", "Cr\u00e9ation de ct_icon.png": "Creating ct_icon.png", "Patch des textes ": "Patching text ", "Al\u00e9atoire: Toutes les pistes": "Random: All tracks", "Al\u00e9atoire: Pistes Originales": "Random: Original tracks", "Al\u00e9atoire: Custom Tracks": "Random: Custom Tracks", "Al\u00e9atoire: Pistes Nouvelles": "Random: New tracks", "MKWFaraphel Installateur": "MKWFaraphel Installer", "Jeu Wii": "Wii game", "Jeu original": "Original game", "Erreur": "Error", "Le chemin de fichier est invalide": "The file path in invalid", "Attention": "Warning", "Ce dossier sera \u00e9cras\u00e9 si vous installer le mod !\n\u00cates-vous s\u00fbr de vouloir l'utiliser ?": "This directory will be overwritten if you install the mod !\nAre you sure you want to use it ?", "Extraction du jeu...": "Extracting the game...", "Le type de fichier n'est pas reconnu": "This file type is not supported", "Cette ROM est d\u00e9j\u00e0 modd\u00e9, il est d\u00e9conseill\u00e9 de l'utiliser pour installer le mod": "This game is already modded, it is not recommended to use it to install the mod", "Extraire le fichier": "Extract file", "Preparer les fichiers": "Prepare files", "Action": "Action", "Installer le mod": "Install mod", "Dossier": "Directory", "Langage : ": "Language : ", "Mise \u00e0 jour disponible !": "Update available !", "Une mise \u00e0 jour est disponible, souhaitez-vous l'installer ?": "An update is available, do you want to install it ?", "T\u00e9l\u00e9chargement de Updater en cours...": "Downloading the Updater...", "fin du t\u00e9l\u00e9chargement, d\u00e9but de l'extraction...": "end of the download, extracting...", "fin de l'extraction": "finished extracting", "lancement de l'application...": "starting application...", "Modification de": "Modifying", "Recompilation de": "Recompilating", "Conversion en": "Converting to", "Changement de l'ID du jeu": "editing game's ID", "Fin": "End", "L'installation est termin\u00e9 !": "The mod has been installed !", "Conversion des fichiers": "Converting files", "Conversion des images": "Converting images", "Conversion des textes": "Converting texts", "Conversion des courses": "Converting races", "Configuration de LE-CODE": "Configurating LE-CODE"}, "ge": {"Al\u00e9atoire: Toutes les pistes": "Zuf\u00e4llig: Alle Spuren", "Al\u00e9atoire: Pistes Originales": "Zuf\u00e4llig: Original-Spuren", "Al\u00e9atoire: Custom Tracks": "Zuf\u00e4llig: Custom Tracks", "Al\u00e9atoire: Pistes Nouvelles": "Zuf\u00e4llig: Neue Spuren"}, "it": {"Al\u00e9atoire: Toutes les pistes": "Casuale: Tutte le tracce", "Al\u00e9atoire: Pistes Originales": "Casuale: Tracce originali", "Al\u00e9atoire: Custom Tracks": "Casuale: Custom Tracks", "Al\u00e9atoire: Pistes Nouvelles": "Casuale: Nuovi brani"}, "sp": {"Al\u00e9atoire: Toutes les pistes": "Aleatorio: Todas las pistas", "Al\u00e9atoire: Pistes Originales": "Aleatorio: Pistas originales", "Al\u00e9atoire: Custom Tracks": "Aleatorio: Custom Tracks", "Al\u00e9atoire: Pistes Nouvelles": "Aleatorio: Pistas nuevas"}, "selected": "fr"} \ No newline at end of file From c5c95d3718ef53f445f91d2fb1454fb6c0e7e657 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 14:02:17 +0200 Subject: [PATCH 13/20] removed strapB file for title screen that wasn't used --- convert_file.json | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/convert_file.json b/convert_file.json index 98ec4a3..c3a8fe2 100644 --- a/convert_file.json +++ b/convert_file.json @@ -20,18 +20,6 @@ "strapA_608x456fr.png": "TEX.RGB565", "strapA_608x456ge.png": "TEX.RGB565", "strapA_608x456it.png": "TEX.RGB565", - "strapB_16_9_832x456de.png": "TEX.RGB565", - "strapB_16_9_832x456en.png": "TEX.RGB565", - "strapB_16_9_832x456es.png": "TEX.RGB565", - "strapB_16_9_832x456fr.png": "TEX.RGB565", - "strapB_16_9_832x456ge.png": "TEX.RGB565", - "strapB_16_9_832x456it.png": "TEX.RGB565", - "strapB_608x456de.png": "TEX.RGB565", - "strapB_608x456en.png": "TEX.RGB565", - "strapB_608x456es.png": "TEX.RGB565", - "strapB_608x456fr.png": "TEX.RGB565", - "strapB_608x456ge.png": "TEX.RGB565", - "strapB_608x456it.png": "TEX.RGB565", "savebanner.tpl.png": "TPL.RGB565", "ct_icons.tpl.png": "TPL.CMPR" } From 0fb8eb0b8f2adae768567709f432beb779a18480 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 14:04:08 +0200 Subject: [PATCH 14/20] the conversion is successfull only if returncode is 0 --- source/patch_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/patch_file.py b/source/patch_file.py index f23e6ef..d55983e 100644 --- a/source/patch_file.py +++ b/source/patch_file.py @@ -63,7 +63,7 @@ def patch_file(self): for process in process_list: if process_list[process] is not None: returncode = process_list[process].poll() - if not(returncode == None): + if not(returncode == 0): process_list.pop(process) break else: From ae5e3e59871a2c7d6d3f6c2764a9badc17355fb4 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 15:17:12 +0200 Subject: [PATCH 15/20] auto-add will now always regenerate if track is corrupted, it will be reconverted if too much track aren't properly converted, the installation stop. --- source/patch_file.py | 68 ++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/source/patch_file.py b/source/patch_file.py index d55983e..800e844 100644 --- a/source/patch_file.py +++ b/source/patch_file.py @@ -1,6 +1,7 @@ from tkinter import messagebox from threading import Thread import subprocess +import shutil import json import glob import os @@ -37,10 +38,14 @@ def patch_file(self): for file in glob.glob(self.path_mkwf+"/files/Scene/UI/MenuSingle_?.szs"): self.patch_bmg(file) - if not(os.path.exists("./file/auto-add/")): - subprocess.run(["./tools/szs/wszst", "AUTOADD", get_nodir(self.path_mkwf) + "/files/Race/Course/", - "--DEST", "./file/auto-add/"], creationflags=CREATE_NO_WINDOW, - cwd=get_dir(self.path_mkwf), check=True, stdout=subprocess.PIPE) + shutil.rmtree("./file/auto-add") + if not(os.path.exists(self.path_mkwf + "/tmp/")): os.makedirs(self.path_mkwf + "/tmp/") + subprocess.run(["./tools/szs/wszst", "AUTOADD", get_nodir(self.path_mkwf) + "/files/Race/Course/", + "--DEST", get_nodir(self.path_mkwf) + "/tmp/auto-add/"], + creationflags=CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf), + check=True, stdout=subprocess.PIPE) + shutil.move(self.path_mkwf + "/tmp/auto-add/", "./file/auto-add/") + shutil.rmtree(self.path_mkwf + "/tmp/") max_process = 8 process_list = {} @@ -53,46 +58,55 @@ def patch_file(self): self.Progress(statut=self.translate("Conversion des courses")+f"\n({i + 1}/{total_track})\n" + "\n".join(process_list.keys()), add=1) - if not(os.path.exists("./file/Track/" + get_filename(file) + ".szs")): + track_szs_file = f"./file/Track/{get_filename(file)}.szs" + if os.path.exists(track_szs_file): + if os.path.getsize(track_szs_file) < 1000: # File under this size are corrupted + os.remove(track_szs_file) + + if not(os.path.exists(track_szs_file)): process_list[file] = subprocess.Popen([ "./tools/szs/wszst", "NORMALIZE", "./file/Track-WU8/" + file, "--DEST", "./file/Track/%N.szs", "--szs", "--overwrite", "--autoadd-path", - "./file/auto-add/"], creationflags=CREATE_NO_WINDOW) + "./file/auto-add/"], creationflags=CREATE_NO_WINDOW, stderr=subprocess.PIPE) break else: for process in process_list: if process_list[process] is not None: returncode = process_list[process].poll() - if not(returncode == 0): - process_list.pop(process) - break - else: - process_list.pop(process) - os.remove(f"./file/Track/{get_filename(process)}.szs") - error_count += 1 - if error_count > error_max: - messagebox.showerror( - self.translate("Erreur"), - self.translate("Trop de course ont eu une erreur de conversion.")) - return + if returncode is None: pass # if the process is still running + else: # process ended + stderr = process_list[process].stderr.read() + if b"wszst: ERROR" in stderr: # Error occured + process_list.pop(process) + os.remove(f"./file/Track/{get_filename(process)}.szs") + error_count += 1 + if error_count > error_max: # Too much track wasn't correctly converted + messagebox.showerror( + self.translate("Erreur"), + self.translate("Trop de course ont eu une erreur de conversion.")) + return + else: # if the error max hasn't been reach + messagebox.showwarning( + self.translate("Attention"), + self.translate("La course ") + + process + + self.translate(" n'a pas été correctement converti. (") + + str(error_count) + "/"+str(error_max)+")") + break + else: - messagebox.showwarning( - self.translate("Attention"), - self.translate("La course ") + - process + - self.translate(" n'a pas été correctement converti. (") + - str(error_count) + "/"+str(error_max)+")") + process_list.pop(process) break else: process_list.pop(process) break - self.Progress(show=False) self.button_install_mod.grid(row=2, column=1, sticky="NEWS") self.listbox_outputformat.grid(row=2, column=2, sticky="NEWS") - except: - self.log_error() + except: self.log_error() + finally: self.Progress(show=False) + t = Thread(target=func) t.setDaemon(True) From 06c3a5174c232190120e02a11fc1b6bd1f3656e9 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 15:55:59 +0200 Subject: [PATCH 16/20] only remove auto-add dir if it exist --- source/patch_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/patch_file.py b/source/patch_file.py index 800e844..7ac60eb 100644 --- a/source/patch_file.py +++ b/source/patch_file.py @@ -38,7 +38,7 @@ def patch_file(self): for file in glob.glob(self.path_mkwf+"/files/Scene/UI/MenuSingle_?.szs"): self.patch_bmg(file) - shutil.rmtree("./file/auto-add") + if os.path.exists("./file/auto-add"): shutil.rmtree("./file/auto-add") if not(os.path.exists(self.path_mkwf + "/tmp/")): os.makedirs(self.path_mkwf + "/tmp/") subprocess.run(["./tools/szs/wszst", "AUTOADD", get_nodir(self.path_mkwf) + "/files/Race/Course/", "--DEST", get_nodir(self.path_mkwf) + "/tmp/auto-add/"], From d19fbdb8c3ac1796503626e3f6b17e88b41cebee Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 16:31:09 +0200 Subject: [PATCH 17/20] WIT console wasn't invisible --- source/install_mod.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/install_mod.py b/source/install_mod.py index bca954b..2397b8f 100644 --- a/source/install_mod.py +++ b/source/install_mod.py @@ -113,7 +113,7 @@ def install_mod(self): self.path_mkwf_format = os.path.realpath(self.path_mkwf + "/../MKWFaraphel." + outputformat.lower()) subprocess.run(["./tools/wit/wit", "COPY", get_nodir(self.path_mkwf), "--DEST", get_nodir(self.path_mkwf_format), f"--{outputformat.lower()}", "--overwrite"], - CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf), + creationflag=CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf), check=True, stdout=subprocess.PIPE) shutil.rmtree(self.path_mkwf) From d2f182749f968686e15bb3336c8eda3e7026200a Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 16:32:19 +0200 Subject: [PATCH 18/20] forgot s to creationflags --- source/install_mod.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/install_mod.py b/source/install_mod.py index 2397b8f..1e0a0eb 100644 --- a/source/install_mod.py +++ b/source/install_mod.py @@ -113,8 +113,8 @@ def install_mod(self): self.path_mkwf_format = os.path.realpath(self.path_mkwf + "/../MKWFaraphel." + outputformat.lower()) subprocess.run(["./tools/wit/wit", "COPY", get_nodir(self.path_mkwf), "--DEST", get_nodir(self.path_mkwf_format), f"--{outputformat.lower()}", "--overwrite"], - creationflag=CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf), - check=True, stdout=subprocess.PIPE) + creationflags=CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf), + check=True, stdout=subprocess.PIPE) shutil.rmtree(self.path_mkwf) self.Progress(statut=self.translate("Changement de l'ID du jeu"), add=1) From 772f786179084ab95d1590d48ac24c485c42e9a6 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 16:32:59 +0200 Subject: [PATCH 19/20] get_nodir instead of get_dir to change id --- source/install_mod.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/install_mod.py b/source/install_mod.py index 1e0a0eb..1863661 100644 --- a/source/install_mod.py +++ b/source/install_mod.py @@ -118,7 +118,7 @@ def install_mod(self): shutil.rmtree(self.path_mkwf) self.Progress(statut=self.translate("Changement de l'ID du jeu"), add=1) - subprocess.run(["./tools/wit/wit", "EDIT", get_dir(self.path_mkwf_format), "--id", "RMCP60"], # see to maybe change ID to MKWF + subprocess.run(["./tools/wit/wit", "EDIT", get_nodir(self.path_mkwf_format), "--id", "RMCP60"], # see to maybe change ID to MKWF creationflags=CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf_format), check=True, stdout=subprocess.PIPE) From 98a36c5d7c584b1524d2fab95246efe998ccd466 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Wed, 16 Jun 2021 16:44:53 +0200 Subject: [PATCH 20/20] removed space --- source/install_mod.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/install_mod.py b/source/install_mod.py index 1863661..c1a02ad 100644 --- a/source/install_mod.py +++ b/source/install_mod.py @@ -112,9 +112,9 @@ def install_mod(self): if outputformat in ["ISO", "WBFS", "CISO"]: self.path_mkwf_format = os.path.realpath(self.path_mkwf + "/../MKWFaraphel." + outputformat.lower()) subprocess.run(["./tools/wit/wit", "COPY", get_nodir(self.path_mkwf), "--DEST", - get_nodir(self.path_mkwf_format), f"--{outputformat.lower()}", "--overwrite"], - creationflags=CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf), - check=True, stdout=subprocess.PIPE) + get_nodir(self.path_mkwf_format), f"--{outputformat.lower()}", "--overwrite"], + creationflags=CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf), + check=True, stdout=subprocess.PIPE) shutil.rmtree(self.path_mkwf) self.Progress(statut=self.translate("Changement de l'ID du jeu"), add=1)