mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-03 19:28:25 +02:00
added Menu.bmg support
This commit is contained in:
parent
444c0f6f92
commit
6e3396ccd5
1 changed files with 116 additions and 94 deletions
|
@ -4,7 +4,11 @@ import os
|
||||||
|
|
||||||
from .definition import *
|
from .definition import *
|
||||||
|
|
||||||
bmgID_track_move = {
|
|
||||||
|
def patch_bmg(self, gamefile): # gamefile est le fichier .szs trouvé dans le /files/Scene/UI/ du jeu
|
||||||
|
try:
|
||||||
|
|
||||||
|
bmgID_track_move = {
|
||||||
"T11": 0x7008, "T12": 0x7001, "T13": 0x7002, "T14": 0x7004,
|
"T11": 0x7008, "T12": 0x7001, "T13": 0x7002, "T14": 0x7004,
|
||||||
"T21": 0x7000, "T22": 0x7005, "T23": 0x7006, "T24": 0x7007,
|
"T21": 0x7000, "T22": 0x7005, "T23": 0x7006, "T24": 0x7007,
|
||||||
"T31": 0x7009, "T32": 0x700f, "T33": 0x700b, "T34": 0x7003,
|
"T31": 0x7009, "T32": 0x700f, "T33": 0x700b, "T34": 0x7003,
|
||||||
|
@ -14,8 +18,8 @@ bmgID_track_move = {
|
||||||
"T61": 0x701b, "T62": 0x701f, "T63": 0x7017, "T64": 0x7012,
|
"T61": 0x701b, "T62": 0x701f, "T63": 0x7017, "T64": 0x7012,
|
||||||
"T71": 0x7015, "T72": 0x701e, "T73": 0x701d, "T74": 0x7011,
|
"T71": 0x7015, "T72": 0x701e, "T73": 0x701d, "T74": 0x7011,
|
||||||
"T81": 0x7018, "T82": 0x7016, "T83": 0x7013, "T84": 0x701c,
|
"T81": 0x7018, "T82": 0x7016, "T83": 0x7013, "T84": 0x701c,
|
||||||
}
|
}
|
||||||
trackname_color = {
|
trackname_color = {
|
||||||
"MSRDS ": "\c{green}MSRDS\c{off} ",
|
"MSRDS ": "\c{green}MSRDS\c{off} ",
|
||||||
"CTR ": "\c{YOR4}CTR\c{off} ",
|
"CTR ": "\c{YOR4}CTR\c{off} ",
|
||||||
"CTTR ": "\c{YOR5}CTTR\c{off} ",
|
"CTTR ": "\c{YOR5}CTTR\c{off} ",
|
||||||
|
@ -82,17 +86,32 @@ trackname_color = {
|
||||||
"★★★!! ": "\c{YOR6}★★★\c{off} ",
|
"★★★!! ": "\c{YOR6}★★★\c{off} ",
|
||||||
"★★☆!! ": "\c{YOR6}★★☆\c{off} ",
|
"★★☆!! ": "\c{YOR6}★★☆\c{off} ",
|
||||||
"★☆☆!! ": "\c{YOR6}★☆☆\c{off} ",
|
"★☆☆!! ": "\c{YOR6}★☆☆\c{off} ",
|
||||||
}
|
}
|
||||||
|
NINTENDO_CWF_REPLACE = "Wiimmfi"
|
||||||
|
MAINMENU_REPLACE = f"MKWFaraphel {self.VERSION}"
|
||||||
|
menu_replacement = {
|
||||||
|
"CWF de Nintendo": NINTENDO_CWF_REPLACE,
|
||||||
|
"CWF Nintendo": NINTENDO_CWF_REPLACE,
|
||||||
|
"Nintendo WFC": NINTENDO_CWF_REPLACE,
|
||||||
|
|
||||||
|
"Menu principal": MAINMENU_REPLACE,
|
||||||
|
"Menú principal": MAINMENU_REPLACE,
|
||||||
|
"Main Menu": MAINMENU_REPLACE,
|
||||||
|
|
||||||
|
"Mario Kart Wii": MAINMENU_REPLACE,
|
||||||
|
}
|
||||||
|
|
||||||
def patch_bmg(self, gamefile): # gamefile est le fichier .szs trouvé dans le /files/Scene/UI/ du jeu
|
|
||||||
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.run(["./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))
|
||||||
|
|
||||||
|
# Menu.bmg
|
||||||
|
bmgmenu = subprocess.run(["./tools/szs/wbmgt", "CAT", get_nodir(gamefile) + ".d/message/Menu.bmg"],
|
||||||
|
creationflags=CREATE_NO_WINDOW, cwd=get_dir(gamefile),
|
||||||
|
check=True, stdout=subprocess.PIPE).stdout.decode()
|
||||||
|
|
||||||
# Common.bmg
|
# Common.bmg
|
||||||
bmgtracks = subprocess.run(["./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),
|
||||||
|
@ -129,10 +148,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.run(["tools/szs/wctct", "bmg", "--le-code", "--long", "./file/CTFILE.txt", "--patch-bmg",
|
bmgcommon = subprocess.run(
|
||||||
|
["tools/szs/wctct", "bmg", "--le-code", "--long", "./file/CTFILE.txt", "--patch-bmg",
|
||||||
"OVERWRITE=./file/tmp/Common.bmg", "--patch-bmg", "OVERWRITE=./file/ExtraCommon.txt"],
|
"OVERWRITE=./file/tmp/Common.bmg", "--patch-bmg", "OVERWRITE=./file/ExtraCommon.txt"],
|
||||||
creationflags=CREATE_NO_WINDOW, check=True, stdout=subprocess.PIPE).stdout.decode()
|
creationflags=CREATE_NO_WINDOW, check=True, stdout=subprocess.PIPE).stdout.decode()
|
||||||
rbmgtext = subprocess.run(["tools/szs/wctct", "bmg", "--le-code", "--long", "./file/RCTFILE.txt", "--patch-bmg",
|
rbmgcommon = subprocess.run(
|
||||||
|
["tools/szs/wctct", "bmg", "--le-code", "--long", "./file/RCTFILE.txt", "--patch-bmg",
|
||||||
"OVERWRITE=./file/tmp/Common.bmg", "--patch-bmg", "OVERWRITE=./file/ExtraCommon.txt"],
|
"OVERWRITE=./file/tmp/Common.bmg", "--patch-bmg", "OVERWRITE=./file/ExtraCommon.txt"],
|
||||||
creationflags=CREATE_NO_WINDOW, check=True, stdout=subprocess.PIPE).stdout.decode()
|
creationflags=CREATE_NO_WINDOW, check=True, stdout=subprocess.PIPE).stdout.decode()
|
||||||
|
|
||||||
|
@ -140,15 +161,16 @@ def patch_bmg(self, gamefile): # gamefile est le fichier .szs trouvé dans le /
|
||||||
os.remove("./file/tmp/Common.bmg")
|
os.remove("./file/tmp/Common.bmg")
|
||||||
os.remove("./file/ExtraCommon.txt")
|
os.remove("./file/ExtraCommon.txt")
|
||||||
|
|
||||||
def finalise(common_file, bmgtext):
|
def finalise(file, bmgtext, replacement_list):
|
||||||
for console in trackname_color: bmgtext = bmgtext.replace(console, trackname_color[console])
|
for text, colored_text in replacement_list.items(): bmgtext = bmgtext.replace(text, colored_text)
|
||||||
with open(common_file, "w", encoding="utf-8") as f: f.write(bmgtext)
|
with open(file, "w", encoding="utf-8") as f: f.write(bmgtext)
|
||||||
subprocess.run(["./tools/szs/wbmgt", "ENCODE", get_nodir(common_file), "--overwrite"],
|
subprocess.run(["./tools/szs/wbmgt", "ENCODE", get_nodir(file), "--overwrite"],
|
||||||
creationflags=CREATE_NO_WINDOW, cwd=get_dir(common_file))
|
creationflags=CREATE_NO_WINDOW, cwd=get_dir(file))
|
||||||
os.remove(common_file)
|
os.remove(file)
|
||||||
|
|
||||||
finalise(f"./file/Common_{bmglang}.txt", bmgtext)
|
finalise(f"./file/Menu_{bmglang}.txt", bmgmenu, menu_replacement)
|
||||||
finalise(f"./file/Common_R{bmglang}.txt", rbmgtext)
|
finalise(f"./file/Common_{bmglang}.txt", bmgcommon, trackname_color)
|
||||||
|
finalise(f"./file/Common_R{bmglang}.txt", rbmgcommon, trackname_color)
|
||||||
|
|
||||||
except:
|
except:
|
||||||
self.log_error()
|
self.log_error()
|
||||||
|
|
Loading…
Reference in a new issue