Merge pull request #1 from Faraphel/dev

new pre-release v0.3
This commit is contained in:
Faraphel 2021-05-27 16:42:00 +02:00 committed by GitHub
commit 4799e1315a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
98 changed files with 340 additions and 14426 deletions

29
.gitignore vendored
View file

@ -56,3 +56,32 @@
/.idea/vcs.xml /.idea/vcs.xml
/file/CTFILE.txt /file/CTFILE.txt
/file/tracks.bmg.txt /file/tracks.bmg.txt
/test/Common_I.txt
/test/Common.bmg
/test/Common.txt
/test/file/Common_E.txt
/test/Common_E.txt
/test/Common_F.txt
/test/Common_G.txt
/test/Common_RE.txt
/test/Common_RF.txt
/test/Common_RG.txt
/test/Common_RI.txt
/test/Common_RS.txt
/test/Common_S.txt
/test/file/CTFILE.txt
/file/RCTFILE.txt
/file/strapA_16_9_832x456es.png
/file/strapA_16_9_832x456fr.png
/file/strapA_16_9_832x456de.png
/file/strapA_16_9_832x456en.png
/file/strapA_16_9_832x456ge.png
/file/strapA_16_9_832x456it.png
/file/strapA_608x456de.png
/file/strapA_608x456en.png
/file/strapA_608x456es.png
/file/strapA_608x456fr.png
/file/strapA_608x456ge.png
/file/strapA_608x456it.png
/file/ct_icons.tpl.png
/build/

View file

@ -3,8 +3,8 @@ Cet outil vous permet d'installer Mario Kart Wii Faraphel sans avoir à modifier
## Prérequis ## Prérequis
- Une ROM de Mario Kart Wii dumpé depuis votre console avec votre propre copie (en CISO, ISO, WBFS, FST (Dossier)) - Une ROM de Mario Kart Wii dumpé depuis votre console avec votre propre copie (en CISO, ISO, WBFS, FST (Dossier))
- L'installateur disponible dans https://github.com/Faraphel/MKWF-Install/releases en dans MKWF.v0.1.zip en .exe, - L'installateur disponible dans https://github.com/Faraphel/MKWF-Install/releases -> MKWF.vX.X.zip en .exe,
ou utiliser la source si vous avez python 3.8 et la librairie requests ou utiliser la source si vous avez python 3.8 et la librairie requests ainsi que pillow
## Installations ## Installations
- Lancer l'application MKWF-Install.exe / MKWF-Install.py - Lancer l'application MKWF-Install.exe / MKWF-Install.py
@ -12,7 +12,7 @@ ou utiliser la source si vous avez python 3.8 et la librairie requests
- Appuyez sur "Extraire le fichier", qui va copier votre jeu dans un dossier nommé MKWiiFaraphel - Appuyez sur "Extraire le fichier", qui va copier votre jeu dans un dossier nommé MKWiiFaraphel
- Une fois le fichier extrait, appuyez sur "Préparer les fichiers", cela va convertir beaucoup de fichiers, - Une fois le fichier extrait, appuyez sur "Préparer les fichiers", cela va convertir beaucoup de fichiers,
comprenant les textes, les textures, les fichiers des menus, certains items et les courses. Cela peut prendre comprenant les textes, les textures, les fichiers des menus, certains items et les courses. Cela peut prendre
beaucoup de temps (30min-1h) ! Cette opération n'a besoin d'être faite qu'une seule fois un certains temps (environ 15min). Cette opération n'a besoin d'être faite qu'une seule fois
- Une fois les fichiers prêt, vous pouvez choisir le format de sortie du jeu (ISO, CISO, WBFS, FST (Dossier)) - Une fois les fichiers prêt, vous pouvez choisir le format de sortie du jeu (ISO, CISO, WBFS, FST (Dossier))
et appuyez sur "Installer le mod". Après cette opération, une notification va apparaître vous informant et appuyez sur "Installer le mod". Après cette opération, une notification va apparaître vous informant
que l'installation est terminée que l'installation est terminée

View file

@ -39,4 +39,7 @@ try:
except Exception as e: except Exception as e:
print(f"Impossible d'effectuer la mise à jour :\n\n{str(e)}") print(f"Impossible d'effectuer la mise à jour :\n\n{str(e)}")
input("Appuyez pour continuer...") input("Appuyez pour continuer...")
# TODO: Use requests.get("https://api.github.com/repos/Faraphel/MKWF-Install/git/trees/master?recursive=1") to avoid
# redownloading the same files again and again

View file

@ -34,17 +34,5 @@
"strapB_608x456it.png": "TEX.RGB565", "strapB_608x456it.png": "TEX.RGB565",
"savebanner.tpl.png": "TPL.RGB565", "savebanner.tpl.png": "TPL.RGB565",
"ct_icons.tpl.png": "TPL.CMPR" "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"
]
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

BIN
file/SuperMario256.ttf Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 KiB

BIN
file/cup_icon/0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
file/cup_icon/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
file/cup_icon/10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
file/cup_icon/11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
file/cup_icon/12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
file/cup_icon/13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
file/cup_icon/14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
file/cup_icon/15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
file/cup_icon/16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
file/cup_icon/17.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
file/cup_icon/18.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

BIN
file/cup_icon/19.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

BIN
file/cup_icon/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
file/cup_icon/20.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

BIN
file/cup_icon/21.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
file/cup_icon/22.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
file/cup_icon/23.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
file/cup_icon/24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
file/cup_icon/25.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
file/cup_icon/26.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
file/cup_icon/27.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
file/cup_icon/28.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
file/cup_icon/29.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
file/cup_icon/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
file/cup_icon/30.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
file/cup_icon/31.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
file/cup_icon/32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
file/cup_icon/33.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
file/cup_icon/34.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
file/cup_icon/35.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
file/cup_icon/36.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
file/cup_icon/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
file/cup_icon/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
file/cup_icon/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
file/cup_icon/7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
file/cup_icon/8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
file/cup_icon/9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
file/cup_icon/left.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

BIN
file/cup_icon/right.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

BIN
file/img_desc/de.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
file/img_desc/en.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
file/img_desc/es.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
file/img_desc/fr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
file/img_desc/ge.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
file/img_desc/it.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

View file

@ -1,4 +1,5 @@
from tkinter import * from tkinter import *
from PIL import Image, ImageFont, ImageDraw
from tkinter import messagebox, filedialog, ttk from tkinter import messagebox, filedialog, ttk
from threading import Thread from threading import Thread
import subprocess import subprocess
@ -19,11 +20,13 @@ class ClassApp():
from source.StateButton import StateButton from source.StateButton import StateButton
from source.create_lecode_config import create_lecode_config from source.create_lecode_config import create_lecode_config
from source.patch_file import patch_file from source.patch_file import patch_file
from source.patch_bmg import patch_bmg
from source.install_mod import install_mod from source.install_mod import install_mod
from source.restart import restart from source.restart import restart
from source.patch_img_desc import patch_img_desc
from source.patch_ct_icon import patch_ct_icon
# TODO: Wiki Github # TODO: Wiki Github
# TODO: Autogénération des bmg
App = ClassApp() App = ClassApp()
App.root.mainloop() App.root.mainloop()

View file

@ -1 +1,2 @@
requests requests
pillow

View file

@ -1,6 +1,5 @@
from cx_Freeze import setup, Executable from cx_Freeze import setup, Executable
import sys import sys
import glob
include_files = [ include_files = [
"./icon.ico", "./icon.ico",
@ -9,30 +8,44 @@ include_files = [
"./version", "./version",
"./ct_config.json", "./ct_config.json",
"./convert_file.json", "./convert_file.json",
"./translation.json",
"./fs.json", "./fs.json",
"./tools", "./tools",
"./source",
("./file/Track-WU8", "./file/Track-WU8"),
("./file/cup_icon", "./file/cup_icon"),
("./file/img_desc", "./file/img_desc"),
("./file/video.thp", "./file/video.thp"),
("./file/SuperMario256.ttf", "./file/SuperMario256.ttf"),
("./file/Back.brctr", "./file/Back.brctr"),
("./file/cup_icon_64x64_common.brlyt", "./file/cup_icon_64x64_common.brlyt"),
("./file/CupSelectCup.brctr", "./file/CupSelectCup.brctr"),
("./file/CourseSelectCup.brctr", "./file/CourseSelectCup.brctr"),
("./file/course_name.brlyt", "./file/course_name.brlyt"),
("./file/lecode-PAL.bin", "./file/lecode-PAL.bin"),
("./file/itemBoxNiseRtpa.brres", "./file/itemBoxNiseRtpa.brres"),
("./file/lpar-default.txt", "./file/lpar-default.txt"),
("./file/RKRace.breff", "./file/RKRace.breff"),
("./file/tt_hatena_64x64.tpl.png", "./file/tt_hatena_64x64.tpl.png"),
("./file/tt_obi_bottom_curve_000.tpl.png", "./file/tt_obi_bottom_curve_000.tpl.png"),
("./file/tt_obi_bottom_left_000.tpl.png", "./file/tt_obi_bottom_left_000.tpl.png"),
("./file/tt_obi_bottom_right_000.tpl.png", "./file/tt_obi_bottom_right_000.tpl.png"),
("./file/tt_obi_check_000.tpl.png", "./file/tt_obi_check_000.tpl.png"),
("./file/tt_obi_top_curve_000.tpl.png", "./file/tt_obi_top_curve_000.tpl.png"),
("./file/tt_obi_top_left_000.tpl.png", "./file/tt_obi_top_left_000.tpl.png"),
("./file/tt_obi_top_right_000.tpl.png", "./file/tt_obi_top_right_000.tpl.png"),
("./file/savebanner.tpl.png", "./file/savebanner.tpl.png"),
("./file/Track-WU8","./file/Track-WU8"),
("./file/video.thp","./file/video.thp"),
("./file/Back.brctr","./file/Back.brctr"),
("./file/cup_icon_64x64_common.brlyt","./file/cup_icon_64x64_common.brlyt"),
("./file/CupSelectCup.brctr","./file/CupSelectCup.brctr"),
("./file/CourseSelectCup.brctr","./file/CourseSelectCup.brctr"),
("./file/course_name.brlyt","./file/course_name.brlyt"),
("./file/lecode-PAL.bin","./file/lecode-PAL.bin"),
("./file/itemBoxNiseRtpa.brres","./file/itemBoxNiseRtpa.brres"),
("./file/RKRace.breff","./file/RKRace.breff"),
sys.exec_prefix + "\\DLLs\\tcl86t.dll", sys.exec_prefix + "\\DLLs\\tcl86t.dll",
sys.exec_prefix + "\\DLLs\\tk86t.dll", sys.exec_prefix + "\\DLLs\\tk86t.dll",
] ]
include_files.extend([(x, x) for x in glob.glob("./file/*.txt")])
include_files.extend([(x, x) for x in glob.glob("./file/*.png")])
options = { options = {
"build_exe":{ "build_exe": {
"include_files": include_files, "include_files": include_files,
"includes": ["tkinter", "requests"], "includes": ["tkinter", "requests"],
"packages": [], "packages": [],
@ -43,16 +56,16 @@ options = {
setup( setup(
options=options, options=options,
name='MKWF-Install', name='MKWF-Install',
version='0.1', version='0.3',
url='https://github.com/Faraphel/MKWF-Install', url='https://github.com/Faraphel/MKWF-Install',
license='Apache-2.0', license='Apache-2.0',
author='Faraphel', author='Faraphel',
author_email='rc60650@hotmail.com', author_email='rc60650@hotmail.com',
description='Installateur pour Mario Kart Wii Faraphel.', description='Installateur pour Mario Kart Wii Faraphel.',
executables = [Executable("./main.pyw", executables=[Executable("./main.pyw",
icon = "./icon.ico", icon="./icon.ico",
base = "win32gui", base="win32gui",
target_name = "MKWF-Install.exe", target_name="MKWF-Install.exe",
shortcut_name = "MKWF-Install", shortcut_name="MKWF-Install",
shortcut_dir = "DesktopFolder")], shortcut_dir="DesktopFolder")],
) )

View file

@ -4,24 +4,41 @@ import json
def create_lecode_config(self): def create_lecode_config(self):
with open("./ct_config.json") as f: with open("./ct_config.json") as f:
ctconfig = json.load(f) ctconfig = json.load(f)
with open("./file/CTFILE.txt", "w") as ctfile: with open("./file/CTFILE.txt", "w", encoding="utf-8") as ctfile, \
ctfile.write( open("./file/RCTFILE.txt", "w", encoding="utf-8") as rctfile:
"#CT-CODE\n" +
"[RACING-TRACK-LIST]\n" + header = "#CT-CODE\n" +\
"%LE-FLAGS=1\n" + "[RACING-TRACK-LIST]\n" +\
"%WIIMM-CUP=1\n" + "%LE-FLAGS=1\n" +\
"N N$SWAP | N$F_WII\n\n") "%WIIMM-CUP=1\n" +\
"N N$SWAP | N$F_WII\n\n"
ctfile.write(header)
rctfile.write(header)
for cup in ctconfig["cup"]: for cup in ctconfig["cup"]:
_cup_config = ctconfig["cup"][cup] _cup_config = ctconfig["cup"][cup]
if int(cup) >= 9: # Course qui ne sont ni les originales, ni les courses aléatoires. if int(cup) >= 9: # Course qui ne sont ni les originales, ni les courses aléatoires.
ctfile.write(f'\nC "{_cup_config["name"]}"\n') cup = f'\nC "{_cup_config["name"]}"\n'
ctfile.write(cup)
rctfile.write(cup)
for course in _cup_config["courses"]: for course in _cup_config["courses"]:
_course_config = _cup_config["courses"][course] _course_config = _cup_config["courses"][course]
ctfile.write(f'T {_course_config["music"]}; ' + star = ""
if "score" in _course_config:
if _course_config["score"] > 0:
star = ""*_course_config["score"]+""*(3-_course_config["score"])+" "
ctfile.write(f' T {_course_config["music"]}; ' +
f'{_course_config["special"]}; ' + f'{_course_config["special"]}; ' +
f'{"0x01" if _course_config["new"] else "0x00"}; ' + f'{"0x01" if _course_config["new"] else "0x00"}; ' +
f'"{_course_config["name"]}"; ' + f'"{_course_config["name"]}"; ' +
f'"{_course_config["name"]}"; ' + f'"{star}{_course_config["name"]}"; ' +
f'"-"\n') f'"-"\n')
rctfile.write(f' T {_course_config["music"]}; ' +
f'{_course_config["special"]}; ' +
f'{"0x01" if _course_config["new"] else "0x00"}; ' +
f'"-"; ' +
f'"{star}{_course_config["name"]}\\n{_course_config["author"]}"; ' +
f'"-"\n')

View file

@ -44,7 +44,6 @@ def install_mod(self):
def replace_file(path, file, subpath="/"): def replace_file(path, file, subpath="/"):
self.Progress(statut=self.translate("Modification de")+f"\n{get_nodir(path)}", add=1) self.Progress(statut=self.translate("Modification de")+f"\n{get_nodir(path)}", add=1)
# print(path, subpath, file)
extension = get_extension(path) extension = get_extension(path)
if extension == "szs": if extension == "szs":

143
source/patch_bmg.py Normal file
View file

@ -0,0 +1,143 @@
import subprocess
import shutil
import os
from .definition import *
bmgID_track_move = {
"T11": 0x7008, "T12": 0x7001, "T13": 0x7002, "T14": 0x7004,
"T21": 0x7000, "T22": 0x7005, "T23": 0x7006, "T24": 0x7007,
"T31": 0x7009, "T32": 0x700f, "T33": 0x700b, "T34": 0x7003,
"T41": 0x700e, "T42": 0x700a, "T43": 0x700c, "T44": 0x700d,
"T51": 0x7010, "T52": 0x7014, "T53": 0x7019, "T54": 0x701a,
"T61": 0x701b, "T62": 0x701f, "T63": 0x7017, "T64": 0x7012,
"T71": 0x7015, "T72": 0x701e, "T73": 0x701d, "T74": 0x7011,
"T81": 0x7018, "T82": 0x7016, "T83": 0x7013, "T84": 0x701c,
}
trackname_color = {
"MSRDS ": "\c{green}MSRDS\c{off} ",
"CTR ": "\c{YOR4}CTR\c{off} ",
"CTTR ": "\c{YOR5}CTTR\c{off} ",
"CNR ": "\c{YOR5}CNR\c{off} ",
"DKR ": "\c{YOR6}DKR\c{off} ",
"LCP ": "\c{green}LCP\c{off} ",
"LEGO-R ": "\c{red2}LEGO-R\c{off} ",
"MP9 ": "\c{YOR0}MP9\c{off} ",
"MSUSA ": "\c{green}MSUSA\c{off} ",
"FZMV ": "\c{YOR2}FZMV\c{off} ",
"KAR ": "\c{green}KAR\c{off} ",
"KO ": "\c{YOR5}KO\c{off} ",
"FZ ": "\c{YOR2}FZ\c{off} ",
"RV ": "\c{white}RV\c{off} ",
"SADX ": "\c{blue2}SADX\c{off} ",
"SCR ": "\c{YOR2}SCR\c{off} ",
"SH ": "\c{red}SH\c{off} ",
"SM64 ": "\c{red1}SM64\c{off} ",
"SMB1 ": "\c{red2}SMB1\c{off} ",
"SMB2 ": "\c{red3}SMB2\c{off} ",
"SSBB ": "\c{red4}SSBB\c{off} ",
"SMS ": "\c{YOR6}SMS\c{off} ",
"SMO ": "\c{YOR7}SMO\c{off} ",
"VVVVVV ": "\c{blue}VVVVVV\c{off} ",
"WF ": "\c{green}WF\c{off} ",
"WP ": "\c{yellow}WP\c{off} ",
"Zelda OoT ": "\c{green}Zelda OoT\c{off} ",
"Zelda TP ": "\c{green}Zelda TP\c{off} ",
"Zelda WW ": "\c{green}Zelda WW\c{off} ",
"PMWR ": "\c{yellow}PMWR\c{off} ",
"SHR ": "\c{green}SHR\c{off} ",
"SK64 ": "\c{green}SK64\c{off} ",
"SMG ": "\c{red2}SMG\c{off} ",
"Spyro 1 ": "\c{blue}Spyro 1\c{off} ",
"Aléatoire: ": "\c{white}Aléatoire: ",
"Random: ": "\c{white}Random: ",
"Zufällig: ": "\c{white}Zufällig: ",
"Casuale: ": "\c{white}Casuale: ",
"Aleatorio: ": "\c{white}Aleatorio: ",
"Wii U ": "WiiU ",
"Wii ": "\c{blue}Wii\c{off} ",
"WiiU ": "\c{red4}Wii U\c{off} ", # Permet d'éviter que Wii et Wii U se mélange
"3DS ": "\c{YOR3}3DS\c{off} ",
"DS ": "\c{white}DS\c{off} ",
"GCN ": "\c{blue2}GCN\c{off} ",
"GBA ": "\c{blue1}GBA\c{off} ",
"N64 ": "\c{red}N64\c{off} ",
"SNES ": "\c{green}SNES\c{off} ",
"RMX ": "\c{YOR4}RMX\c{off} ",
"MKT ": "\c{YOR5}MKT\c{off} ",
"GP ": "\c{YOR6}GP\c{off} ",
"(Boost)": "\c{YOR3}(Boost)\c{off}",
"(Nuit)": "\c{white}(Nuit)\c{off}",
"(Jour)": "\c{white}(Jour)\c{off}",
"(Vide)": "\c{white}(Vide)\c{off}",
"★★★ ": "\c{YOR2}★★★ \c{off}",
"★★☆ ": "\c{YOR2}★★☆ \c{off}",
"★☆☆ ": "\c{YOR2}★☆☆ \c{off}",
}
def patch_bmg(self, gamefile): # gamefile est le fichier .szs trouvé dans le /files/Scene/UI/ du jeu
bmglang = gamefile[-len("E.txt"):-len(".txt")] # Langue du fichier
self.Progress(statut=self.translate("Patch des textes " + bmglang), add=1)
subprocess.call(["./tools/szs/wszst", "EXTRACT", gamefile, "-d", gamefile + ".d", "--overwrite"]
, creationflags=CREATE_NO_WINDOW)
bmgtracks = subprocess.check_output(["./tools/szs/wbmgt", "CAT", gamefile + ".d/message/Common.bmg"],
creationflags=CREATE_NO_WINDOW)
bmgtracks = bmgtracks.decode()
trackheader = "#--- standard track names"
trackend = "2328"
bmgtracks = bmgtracks[bmgtracks.find(trackheader) + len(trackheader):bmgtracks.find(trackend)]
with open("./file/ExtraCommon.txt", "w") 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"
f" 7040\t= {self.translate('Aléatoire: Custom Tracks', lang=bmglang)}\n"
f" 7041\t= {self.translate('Aléatoire: Pistes Nouvelles', lang=bmglang)}\n")
for bmgtrack in bmgtracks.split("\n"):
if "=" in bmgtrack:
prefix = ""
if "T" in bmgtrack[:bmgtrack.find("=")]:
sTid = bmgtrack.find("T")
Tid = bmgtrack[sTid:sTid + 3]
if Tid[1] in "1234": prefix = "Wii " # Si la course est original à la wii
Tid = hex(bmgID_track_move[Tid])[2:]
else: # Arena
sTid = bmgtrack.find("U") + 1
Tid = bmgtrack[sTid:sTid + 2]
Tid = hex((int(Tid[0]) - 1) * 5 + (int(Tid[1]) - 1) + 0x7020)[2:]
Tname = bmgtrack[bmgtrack.find("= ") + 2:]
f.write(f" {Tid}\t= {prefix}{Tname}\n")
bmgtext = subprocess.check_output(["tools/szs/wctct", "bmg", "--le-code", "--long", "./file/CTFILE.txt",
"--patch-bmg", "OVERWRITE=" + gamefile + ".d/message/Common.bmg",
"--patch-bmg", "OVERWRITE=./file/ExtraCommon.txt"],
creationflags=CREATE_NO_WINDOW).decode()
rbmgtext = subprocess.check_output(["tools/szs/wctct", "bmg", "--le-code", "--long", "./file/RCTFILE.txt",
"--patch-bmg", "OVERWRITE=" + gamefile + ".d/message/Common.bmg",
"--patch-bmg", "OVERWRITE=./file/ExtraCommon.txt"],
creationflags=CREATE_NO_WINDOW).decode()
shutil.rmtree(gamefile + ".d")
os.remove("./file/ExtraCommon.txt")
def finalise(common_file, bmgtext):
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)
subprocess.call(["./tools/szs/wbmgt", "ENCODE", common_file, "--overwrite"], creationflags=CREATE_NO_WINDOW)
os.remove(common_file)
finalise(f"./file/Common_{bmglang}.txt", bmgtext)
finalise(f"./file/Common_R{bmglang}.txt", rbmgtext)

37
source/patch_ct_icon.py Normal file
View file

@ -0,0 +1,37 @@
from PIL import Image, ImageFont, ImageDraw
import json
import os
def patch_ct_icon(self):
with open("./ct_config.json") as f: config = json.load(f)
ct_icon = Image.new("RGBA", (128, 128 * (len(config["cup"]) + 2)))
files = ["left", "right"]
files.extend(config["cup"].keys())
for i, id in enumerate(files):
if os.path.exists(f"./file/cup_icon/{id}.png"):
cup_icon = Image.open(f"./file/cup_icon/{id}.png").resize((128, 128))
else:
cup_icon = Image.new("RGBA", (128, 128))
draw = ImageDraw.Draw(cup_icon)
font = ImageFont.truetype("./file/SuperMario256.ttf", 90)
draw.text((4 - 2, 4 - 2), "CT", (0, 0, 0), font=font)
draw.text((4 + 2, 4 - 2), "CT", (0, 0, 0), font=font)
draw.text((4 - 2, 4 + 2), "CT", (0, 0, 0), font=font)
draw.text((4 + 2, 4 + 2), "CT", (0, 0, 0), font=font)
draw.text((4, 4), "CT", (255, 165, 0), font=font)
font = ImageFont.truetype("./file/SuperMario256.ttf", 60)
draw.text((5 - 2, 80 - 2), "%03i" % (i-10), (0, 0, 0), font=font) # i-10 car on ne compte pas les 8 coupes
draw.text((5 + 2, 80 - 2), "%03i" % (i-10), (0, 0, 0), font=font) # de base (0-7), la coupe aléatoire, et
draw.text((5 - 2, 80 + 2), "%03i" % (i-10), (0, 0, 0), font=font) # les icones droite et gauche.
draw.text((5 + 2, 80 + 2), "%03i" % (i-10), (0, 0, 0), font=font)
draw.text((5, 80), "%03i" % (i-10), (255, 165, 0), font=font)
ct_icon.paste(cup_icon, (0, i * 128))
ct_icon.save("./file/ct_icons.tpl.png")

View file

@ -1,6 +1,7 @@
from threading import Thread from threading import Thread
import subprocess import subprocess
import json import json
import glob
import os import os
from .definition import * from .definition import *
@ -14,20 +15,25 @@ def patch_file(self):
total_track = 0 total_track = 0
with open("./convert_file.json") as f: with open("./convert_file.json") as f:
fc = json.load(f) fc = json.load(f)
max_step = len(fc["img"]) + len(fc["bmg"]) + total_track + 1 max_step = len(fc["img"]) + total_track + 3 + len("EGFIS")
self.Progress(show=True, indeter=False, statut=self.translate("Conversion des fichiers"), max=max_step, step=0) self.Progress(show=True, indeter=False, statut=self.translate("Conversion des fichiers"), max=max_step, step=0)
self.Progress(statut=self.translate("Configuration de LE-CODE"), add=1)
self.create_lecode_config()
self.Progress(statut=self.translate("Création de ct_icon.png"), add=1)
self.patch_ct_icon()
self.Progress(statut=self.translate("Création des images descriptives"), add=1)
self.patch_img_desc()
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)
if not (os.path.exists("./file/" + get_filename(file))): subprocess.call(["./tools/szs/wimgt", "ENCODE", "./file/" + file, "-x", fc["img"][file], "--overwrite"]
subprocess.call(["./tools/szs/wimgt", "ENCODE", "./file/" + file, "-x", fc["img"][file]] , creationflags=CREATE_NO_WINDOW)
, creationflags=CREATE_NO_WINDOW)
for i, file in enumerate(fc["bmg"]): for file in glob.glob(self.path_mkwf+"/files/Scene/UI/MenuSingle_?.szs"):
self.Progress(statut=self.translate("Conversion des textes")+f"\n({i + 1}/{len(fc['bmg'])}) {file}", add=1) self.patch_bmg(file)
if not (os.path.exists("./file/" + get_filename(file) + ".bmg")):
subprocess.call(["./tools/szs/wbmgt", "ENCODE", "./file/" + file]
, creationflags=CREATE_NO_WINDOW)
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.call(["./tools/szs/wszst", "AUTOADD", self.path_mkwf + "/files/Race/Course/", "--DEST",
@ -59,9 +65,6 @@ def patch_file(self):
process_list.pop(process) process_list.pop(process)
break break
self.Progress(statut=self.translate("Configuration de LE-CODE"), add=1)
self.create_lecode_config()
self.Progress(show=False) self.Progress(show=False)
self.button_install_mod.grid(row=2, column=1, sticky="NEWS") self.button_install_mod.grid(row=2, column=1, sticky="NEWS")
self.listbox_outputformat.grid(row=2, column=2, sticky="NEWS") self.listbox_outputformat.grid(row=2, column=2, sticky="NEWS")

25
source/patch_img_desc.py Normal file
View file

@ -0,0 +1,25 @@
from PIL import Image
import glob
from .definition import *
def patch_img_desc(self):
il = Image.open("./file/img_desc/illustration.png")
il_16_9 = il.resize((832, 456))
il_4_3 = il.resize((608, 456))
for file_lang in glob.glob("./file/img_desc/??.png"):
img_lang = Image.open(file_lang)
img_lang_16_9 = img_lang.resize((832, 456))
img_lang_4_3 = img_lang.resize((608, 456))
new_16_9 = Image.new("RGBA", (832, 456), (0, 0, 0, 255))
new_16_9.paste(il_16_9, (0, 0), il_16_9)
new_16_9.paste(img_lang_16_9, (0, 0), img_lang_16_9)
new_16_9.save(f"./file/strapA_16_9_832x456{get_filename(get_nodir(file_lang))}.png")
new_4_3 = Image.new("RGBA", (608, 456), (0, 0, 0, 255))
new_4_3.paste(il_4_3, (0, 0), il_4_3)
new_4_3.paste(img_lang_4_3, (0, 0), img_lang_4_3)
new_4_3.save(f"./file/strapA_608x456{get_filename(get_nodir(file_lang))}.png")

View file

@ -1,11 +1,17 @@
import json import json
def translate(self, text): def translate(self, text, lang = None):
if lang == None: lang = self.language
elif lang == "E": lang = "en"
elif lang == "G": lang = "ge"
elif lang == "I": lang = "it"
elif lang == "S": lang = "sp"
with open("./translation.json", encoding="utf-8") as f: with open("./translation.json", encoding="utf-8") as f:
translation = json.load(f) translation = json.load(f)
if self.language in translation: if lang in translation:
_lang_trad = translation[self.language] _lang_trad = translation[lang]
if text in _lang_trad: return _lang_trad[text] if text in _lang_trad: return _lang_trad[text]
return text return text

View file

@ -1 +1 @@
{"en": {"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"}, "selected": "en"} {"en": {"Création des images descriptives": "Creating descriptives images", "Création de ct_icon.png":"Creating ct_icon.png", "Création des images descriptives": "Creation of descriptive images","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"}

View file

@ -1,7 +1,7 @@
{ {
"version": "0.2", "version": "0.3",
"subversion": "0", "subversion": "0",
"changelog": "- CTFILE.txt est maintenant automatiquement créé depuis ct_config.json, rendant le jeu plus simple pour moi à mettre à jour.\n- La conversion des courses peut maintenant être effectué en parallèle.\n- Les mises à jours affichent à présent une barre de chargement.\n- Les mises à jours sont à présent enregistré par chunk pour soulager la RAM.", "changelog": "- La traduction anglaise est à présent disponible\n- Le code est à présent divisé en module, le rendant infiniment plus simple à naviguer\n- Les fichiers Common.bmg (responsable des textes des courses et personnages) sont à présent automatiquement généré par l'application, les rendant plus simple à mettre à jour\n- Les fichiers strapA(...) (responsable des explications au lancement) sont à présent automatiquement généré par l'application, les rendant plus simple à mettre à jour\n- Le fichier ct_icon.tpl (responsable des icones des coupes) sont à présent automatiquement généré par l'application, les rendant plus simple à mettre à jour",
"download_bin": "https://github.com/Faraphel/MKWF-Install/releases/download/0.2/MKWF.v0.2.zip", "download_bin": "https://github.com/Faraphel/MKWF-Install/releases/download/0.3/MKWF.v0.3.zip",
"updater_bin": "https://github.com/Faraphel/MKWF-Install/raw/master/Updater/Updater.zip" "updater_bin": "https://github.com/Faraphel/MKWF-Install/raw/master/Updater/Updater.zip"
} }