mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-04 11:48:22 +02:00
added conversion of file to avoid nintendo-copyright problem
changed subprocess.call usage causing a bug with environement path
This commit is contained in:
parent
1b624e1d1e
commit
e79075555a
3 changed files with 86 additions and 11 deletions
2
README.md
Normal file
2
README.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#MKWFaraphel Installateur
|
||||||
|
#MKWFaraphel Installer
|
50
convert_file.json
Normal file
50
convert_file.json
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
"img": {
|
||||||
|
"tt_hatena_64x64.tpl.png": "TPL.RGB5A3",
|
||||||
|
"tt_obi_bottom_curve_000.tpl.png": "TPL.RGB5A3",
|
||||||
|
"tt_obi_bottom_left_000.tpl.png": "TPL.RGB5A3",
|
||||||
|
"tt_obi_bottom_right_000.tpl.png": "TPL.RGB5A3",
|
||||||
|
"tt_obi_check_000.tpl.png": "TPL.RGB5A3",
|
||||||
|
"tt_obi_top_curve_000.tpl.png": "TPL.RGB5A3",
|
||||||
|
"tt_obi_top_left_000.tpl.png": "TPL.RGB5A3",
|
||||||
|
"tt_obi_top_right_000.tpl.png": "TPL.RGB5A3",
|
||||||
|
"strapA_16_9_832x456de.png": "TEX.RGB565",
|
||||||
|
"strapA_16_9_832x456en.png": "TEX.RGB565",
|
||||||
|
"strapA_16_9_832x456es.png": "TEX.RGB565",
|
||||||
|
"strapA_16_9_832x456fr.png": "TEX.RGB565",
|
||||||
|
"strapA_16_9_832x456ge.png": "TEX.RGB565",
|
||||||
|
"strapA_16_9_832x456it.png": "TEX.RGB565",
|
||||||
|
"strapA_608x456de.png": "TEX.RGB565",
|
||||||
|
"strapA_608x456en.png": "TEX.RGB565",
|
||||||
|
"strapA_608x456es.png": "TEX.RGB565",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"bmg": [
|
||||||
|
"Common_E.txt",
|
||||||
|
"Common_F.txt",
|
||||||
|
"Common_G.txt",
|
||||||
|
"Common_I.txt",
|
||||||
|
"Common_S.txt",
|
||||||
|
"Common_RE.txt",
|
||||||
|
"Common_RF.txt",
|
||||||
|
"Common_RG.txt",
|
||||||
|
"Common_RI.txt",
|
||||||
|
"Common_RS.txt"
|
||||||
|
]
|
||||||
|
}
|
45
main.pyw
45
main.pyw
|
@ -11,6 +11,9 @@ def filecopy(src, dst):
|
||||||
with open(dst, "wb") as f2:
|
with open(dst, "wb") as f2:
|
||||||
f2.write(f1.read()) # could be buffered
|
f2.write(f1.read()) # could be buffered
|
||||||
|
|
||||||
|
get_filename = lambda file: ".".join(file.split(".")[:-1])
|
||||||
|
if not(os.path.exists("./file/Track/")):
|
||||||
|
os.makedirs("./file/Track/")
|
||||||
|
|
||||||
class ClassApp():
|
class ClassApp():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -47,7 +50,7 @@ class ClassApp():
|
||||||
while True:
|
while True:
|
||||||
if not(os.path.exists(self.path_mkwf)): break
|
if not(os.path.exists(self.path_mkwf)): break
|
||||||
self.path_mkwf, i = os.path.realpath(path + f"/../MKWiiFaraphel ({i})"), i+1
|
self.path_mkwf, i = os.path.realpath(path + f"/../MKWiiFaraphel ({i})"), i+1
|
||||||
subprocess.call(f'wit EXTRACT "{path}" -d "{self.path_mkwf}"', shell=True)
|
subprocess.call(["wit", "EXTRACT", path, "-d", self.path_mkwf])
|
||||||
else: return messagebox.showerror("Erreur", "Le type de fichier n'est pas reconnu")
|
else: return messagebox.showerror("Erreur", "Le type de fichier n'est pas reconnu")
|
||||||
self.frame_action.grid(row=2, column=1,sticky="NEWS")
|
self.frame_action.grid(row=2, column=1,sticky="NEWS")
|
||||||
|
|
||||||
|
@ -59,8 +62,25 @@ class ClassApp():
|
||||||
Button(self.frame_action, text="Installer le mod", relief=RIDGE, command=self.install_mod, width=45
|
Button(self.frame_action, text="Installer le mod", relief=RIDGE, command=self.install_mod, width=45
|
||||||
).grid(row=1,column=1,sticky="NEWS")
|
).grid(row=1,column=1,sticky="NEWS")
|
||||||
|
|
||||||
|
|
||||||
|
def patch_file(self):
|
||||||
|
with open("./convert_file.json") as f: fc = json.load(f)
|
||||||
|
for file in fc["img"]:
|
||||||
|
if not(os.path.exists("./file/"+get_filename(file))):
|
||||||
|
subprocess.call(["wimgt", "ENCODE", "./file/"+file, "-x", fc["img"][file]])
|
||||||
|
|
||||||
|
for file in fc["bmg"]:
|
||||||
|
if not(os.path.exists("./file/"+get_filename(file))):
|
||||||
|
subprocess.call(["wbmgt", "ENCODE", "./file/"+file])
|
||||||
|
|
||||||
|
subprocess.call(["wszst", "NORMALIZE", "./file/Track-WU8/*.wu8", "-d", "./file/Track/", "--szs", "--overwrite",
|
||||||
|
"--autoadd-path", self.path_mkwf+"/files/Race/Course/"])
|
||||||
|
|
||||||
|
|
||||||
def install_mod(self):
|
def install_mod(self):
|
||||||
with open("fs.json") as f: fs = json.load(f)
|
self.patch_file()
|
||||||
|
|
||||||
|
with open("./fs.json") as f: fs = json.load(f)
|
||||||
extracted_file = []
|
extracted_file = []
|
||||||
|
|
||||||
def replace_file(path, file, subpath="/"):
|
def replace_file(path, file, subpath="/"):
|
||||||
|
@ -69,7 +89,7 @@ class ClassApp():
|
||||||
|
|
||||||
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.call(f'wszst EXTRACT "{path}" -d "{path}.d" --overwrite', shell=True)
|
subprocess.call(["wszst", "EXTRACT", path, "-d", path+".d", "--overwrite"])
|
||||||
extracted_file.append(os.path.realpath(path))
|
extracted_file.append(os.path.realpath(path))
|
||||||
|
|
||||||
szs_extract_path = path+".d"
|
szs_extract_path = path+".d"
|
||||||
|
@ -92,22 +112,25 @@ class ClassApp():
|
||||||
|
|
||||||
print(extracted_file)
|
print(extracted_file)
|
||||||
for file in extracted_file:
|
for file in extracted_file:
|
||||||
subprocess.call(f"wszst CREATE \"{file}.d\" -d \"{file}\" --overwrite", shell=True)
|
subprocess.call(["wszst", "CREATE", file+".d", "-d", "file", "--overwrite"])
|
||||||
if os.path.exists(file+".d"): shutil.rmtree(file+".d")
|
if os.path.exists(file+".d"): shutil.rmtree(file+".d")
|
||||||
|
|
||||||
subprocess.call(f'wstrt patch "{self.path_mkwf}/sys/main.dol" --clean-dol --add-lecode', shell=True)
|
subprocess.call(["wstrt", "patch", self.path_mkwf+"/sys/main.dol", "--clean-dol", "--add-lecode"])
|
||||||
subprocess.call(
|
subprocess.call(
|
||||||
f'wlect patch "./file/lecode-PAL.bin" -od "{self.path_mkwf}/files/rel/lecode-PAL.bin" ' +\
|
["wlect", "patch", "./file/lecode-PAL.bin", "-od", self.path_mkwf+"/files/rel/lecode-PAL.bin",
|
||||||
f'--track-dir "{self.path_mkwf}/files/Race/Course/" --copy-tracks "./file/Track/" ' +\
|
"--track-dir", self.path_mkwf+"/files/Race/Course/", "--copy-tracks", "./file/Track/",
|
||||||
f'--move-tracks "{self.path_mkwf}/files/Race/Course/" --le-define ' +\
|
"--move-tracks", self.path_mkwf+"/files/Race/Course/", "--le-define",
|
||||||
f'"./file/CTFILE.txt" --lpar "./file/lpar-default.txt" --overwrite', shell=True)
|
"./file/CTFILE.txt", "--lpar", "./file/lpar-default.txt", "--overwrite"])
|
||||||
|
|
||||||
messagebox.showinfo("", "L'installation est terminé !")
|
messagebox.showinfo("", "L'installation est terminé !")
|
||||||
|
|
||||||
# TODO: Langue
|
# TODO: Langue
|
||||||
# TODO: Le moins de fichier possible nintendo-copyright
|
|
||||||
# TODO: Icones
|
# TODO: Icones
|
||||||
# TODO: Wiimm's tools fournis
|
# TODO: Wiimm's tools fournis
|
||||||
# TODO:
|
# TODO: Update
|
||||||
|
# TODO: Warning : Already Patched
|
||||||
|
# TODO: Progress bar
|
||||||
|
# TODO: Changer l'ID
|
||||||
|
# TODO: use Shutil to copyfile
|
||||||
App = ClassApp()
|
App = ClassApp()
|
||||||
mainloop()
|
mainloop()
|
Loading…
Reference in a new issue