preparing bmg patch

This commit is contained in:
Faraphel 2022-07-09 22:09:07 +02:00
parent 093319eece
commit dde5a134a5
9 changed files with 227 additions and 179 deletions

View file

@ -2,23 +2,25 @@
"mode": "edit", "mode": "edit",
"operation": { "operation": {
"bmg-edit": { "bmg-edit": [
"mode": "regex", {
"data": { "mode": "regex",
"CWF de Nintendo": "{{ONLINE_SERVICE}}", "data": {
"Wi-Fi Nintendo": "{{ONLINE_SERVICE}}", "CWF de Nintendo": "{{ONLINE_SERVICE}}",
"CWF Nintendo": "{{ONLINE_SERVICE}}", "Wi-Fi Nintendo": "{{ONLINE_SERVICE}}",
"Nintendo WFC": "{{ONLINE_SERVICE}}", "CWF Nintendo": "{{ONLINE_SERVICE}}",
"Wi-Fi": "{{ONLINE_SERVICE}}", "Nintendo WFC": "{{ONLINE_SERVICE}}",
"インターネット": "{{ONLINE_SERVICE}}", "Wi-Fi": "{{ONLINE_SERVICE}}",
"インターネット": "{{ONLINE_SERVICE}}",
"Menu principal": "{{MOD_NICKNAME}} {{MOD_VERSION}} {{MOD_CUSTOMIZED}}", "Menu principal": "{{MOD_NICKNAME}} {{MOD_VERSION}} {{MOD_CUSTOMIZED}}",
"Menú principal": "{{MOD_NICKNAME}} {{MOD_VERSION}} {{MOD_CUSTOMIZED}}", "Menú principal": "{{MOD_NICKNAME}} {{MOD_VERSION}} {{MOD_CUSTOMIZED}}",
"Main Menu": "{{MOD_NICKNAME}} {{MOD_VERSION}} {{MOD_CUSTOMIZED}}", "Main Menu": "{{MOD_NICKNAME}} {{MOD_VERSION}} {{MOD_CUSTOMIZED}}",
"トップメニュー": "{{MOD_NICKNAME}} {{MOD_VERSION}} {{MOD_CUSTOMIZED}}", "トップメニュー": "{{MOD_NICKNAME}} {{MOD_VERSION}} {{MOD_CUSTOMIZED}}",
"Mario Kart Wii": "{{MOD_NICKNAME}} {{MOD_VERSION}} {{MOD_CUSTOMIZED}}" "Mario Kart Wii": "{{MOD_NICKNAME}} {{MOD_VERSION}} {{MOD_CUSTOMIZED}}"
}
} }
} ]
} }
} }

View file

@ -1,46 +1,48 @@
{ {
"mode": "edit", "mode": "edit",
"operation": { "operation": {
"bmg-edit": { "bmg-edit": [
"mode": "id", {
"data": { "mode": "id",
"0x703e": "\\c{white}Random: All tracks", "data": {
"0x703f": "\\c{white}Random: Original tracks", "0x703e": "\\c{white}Random: All tracks",
"0x7040": "\\c{white}Random: Custom Tracks", "0x703f": "\\c{white}Random: Original tracks",
"0x7041": "\\c{white}Random: New tracks", "0x7040": "\\c{white}Random: Custom Tracks",
"0x7041": "\\c{white}Random: New tracks",
"M37": "\\c{YOR4}Reset options", "M37": "\\c{YOR4}Reset options",
"M38": "\\c{YOR4}Vote : by players", "M38": "\\c{YOR4}Vote : by players",
"M39": "\\c{YOR4}Vote : by host", "M39": "\\c{YOR4}Vote : by host",
"M40": "\\c{YOR4}Blocking : reset", "M40": "\\c{YOR4}Blocking : reset",
"M41": "\\c{YOR4}Blocking : disable", "M41": "\\c{YOR4}Blocking : disable",
"M42": "\\c{YOR4}Blocking : enable", "M42": "\\c{YOR4}Blocking : enable",
"M43": "\\c{YOR4}Vehicle : all", "M43": "\\c{YOR4}Vehicle : all",
"M44": "\\c{YOR4}Vehicle : all weight", "M44": "\\c{YOR4}Vehicle : all weight",
"M45": "\\c{YOR4}Vehicle : light only", "M45": "\\c{YOR4}Vehicle : light only",
"M46": "\\c{YOR4}Vehicle : all except light", "M46": "\\c{YOR4}Vehicle : all except light",
"M47": "\\c{YOR4}Vehicle : medium only", "M47": "\\c{YOR4}Vehicle : medium only",
"M48": "\\c{YOR4}Vehicle : all except medium", "M48": "\\c{YOR4}Vehicle : all except medium",
"M49": "\\c{YOR4}Vehicle : heavy only", "M49": "\\c{YOR4}Vehicle : heavy only",
"M50": "\\c{YOR4}Vehicle : all except heavy", "M50": "\\c{YOR4}Vehicle : all except heavy",
"M51": "\\c{YOR4}Vehicle : all type", "M51": "\\c{YOR4}Vehicle : all type",
"M52": "\\c{YOR4}Vehicle : kart only", "M52": "\\c{YOR4}Vehicle : kart only",
"M53": "\\c{YOR4}Vehicle : bike only", "M53": "\\c{YOR4}Vehicle : bike only",
"M54": "\\c{YOR4}Engine : reset", "M54": "\\c{YOR4}Engine : reset",
"M55": "\\c{YOR4}Engine : 100cc", "M55": "\\c{YOR4}Engine : 100cc",
"M56": "\\c{YOR4}Engine : 150cc", "M56": "\\c{YOR4}Engine : 150cc",
"M57": "\\c{YOR4}Engine : 150cc mirror", "M57": "\\c{YOR4}Engine : 150cc mirror",
"M58": "\\c{YOR4}Game : 1 race", "M58": "\\c{YOR4}Game : 1 race",
"M59": "\\c{YOR4}Game : 2 races", "M59": "\\c{YOR4}Game : 2 races",
"M60": "\\c{YOR4}Game : 4 races", "M60": "\\c{YOR4}Game : 4 races",
"M61": "\\c{YOR4}Game : 8 races", "M61": "\\c{YOR4}Game : 8 races",
"M62": "\\c{YOR4}Game : 12 races", "M62": "\\c{YOR4}Game : 12 races",
"M63": "\\c{YOR4}Game : 16 races", "M63": "\\c{YOR4}Game : 16 races",
"M64": "\\c{YOR4}Game : 24 races", "M64": "\\c{YOR4}Game : 24 races",
"M65": "\\c{YOR4}Game : 32 races", "M65": "\\c{YOR4}Game : 32 races",
"M66": "\\c{YOR4}Game : 48 races", "M66": "\\c{YOR4}Game : 48 races",
"M67": "\\c{YOR4}Game : 64 races" "M67": "\\c{YOR4}Game : 64 races"
}
} }
} ]
} }
} }

View file

@ -1,9 +1,10 @@
{ {
"mode": "edit", "mode": "edit",
"operation": { "operation": {
"bmg-edit": { "bmg-edit": [
"mode": "id", {
"data": { "mode": "id",
"data": {
"0x703e": "\\c{white}Aleatorio: Todas las pistas", "0x703e": "\\c{white}Aleatorio: Todas las pistas",
"0x703f": "\\c{white}Aleatorio: Pistas originales", "0x703f": "\\c{white}Aleatorio: Pistas originales",
"0x7040": "\\c{white}Aleatorio: Custom Tracks", "0x7040": "\\c{white}Aleatorio: Custom Tracks",
@ -41,6 +42,7 @@
"M66": "\\c{YOR4}Partido : 48 pistas", "M66": "\\c{YOR4}Partido : 48 pistas",
"M67": "\\c{YOR4}Partido : 64 pistas" "M67": "\\c{YOR4}Partido : 64 pistas"
} }
} }
]
} }
} }

View file

@ -1,46 +1,48 @@
{ {
"mode": "edit", "mode": "edit",
"operation": { "operation": {
"bmg-edit": { "bmg-edit": [
"mode": "id", {
"data": { "mode": "id",
"0x703e": "\\c{white}Aléatoire: Toutes les pistes", "data": {
"0x703f": "\\c{white}Aléatoire: Pistes Originales", "0x703e": "\\c{white}Aléatoire: Toutes les pistes",
"0x7040": "\\c{white}Aléatoire: Custom Tracks", "0x703f": "\\c{white}Aléatoire: Pistes Originales",
"0x7041": "\\c{white}Aléatoire: Nouvelles pistes", "0x7040": "\\c{white}Aléatoire: Custom Tracks",
"0x7041": "\\c{white}Aléatoire: Nouvelles pistes",
"M37": "\\c{YOR4}Réinitialiser les options", "M37": "\\c{YOR4}Réinitialiser les options",
"M38": "\\c{YOR4}Vote : par les joueurs", "M38": "\\c{YOR4}Vote : par les joueurs",
"M39": "\\c{YOR4}Vote : par l'hôte", "M39": "\\c{YOR4}Vote : par l'hôte",
"M40": "\\c{YOR4}Blocage : réinitialiser", "M40": "\\c{YOR4}Blocage : réinitialiser",
"M41": "\\c{YOR4}Blocage : désactiver", "M41": "\\c{YOR4}Blocage : désactiver",
"M42": "\\c{YOR4}Blocage : activer", "M42": "\\c{YOR4}Blocage : activer",
"M43": "\\c{YOR4}Véhicule : tout", "M43": "\\c{YOR4}Véhicule : tout",
"M44": "\\c{YOR4}Véhicule : tout poids", "M44": "\\c{YOR4}Véhicule : tout poids",
"M45": "\\c{YOR4}Véhicule : seulement léger", "M45": "\\c{YOR4}Véhicule : seulement léger",
"M46": "\\c{YOR4}Véhicule : tout sauf léger", "M46": "\\c{YOR4}Véhicule : tout sauf léger",
"M47": "\\c{YOR4}Véhicule : seulement moyen", "M47": "\\c{YOR4}Véhicule : seulement moyen",
"M48": "\\c{YOR4}Véhicule : tout sauf moyen", "M48": "\\c{YOR4}Véhicule : tout sauf moyen",
"M49": "\\c{YOR4}Véhicule : seulement lourd", "M49": "\\c{YOR4}Véhicule : seulement lourd",
"M50": "\\c{YOR4}Véhicule : tout sauf lourd", "M50": "\\c{YOR4}Véhicule : tout sauf lourd",
"M51": "\\c{YOR4}Véhicule : tout type", "M51": "\\c{YOR4}Véhicule : tout type",
"M52": "\\c{YOR4}Véhicule : seulement kart", "M52": "\\c{YOR4}Véhicule : seulement kart",
"M53": "\\c{YOR4}Véhicule : seulement moto", "M53": "\\c{YOR4}Véhicule : seulement moto",
"M54": "\\c{YOR4}Cylindrée : réinitialiser", "M54": "\\c{YOR4}Cylindrée : réinitialiser",
"M55": "\\c{YOR4}Cylindrée : 100cc", "M55": "\\c{YOR4}Cylindrée : 100cc",
"M56": "\\c{YOR4}Cylindrée : 150cc", "M56": "\\c{YOR4}Cylindrée : 150cc",
"M57": "\\c{YOR4}Cylindrée : 150cc mirroir", "M57": "\\c{YOR4}Cylindrée : 150cc mirroir",
"M58": "\\c{YOR4}Partie : 1 course", "M58": "\\c{YOR4}Partie : 1 course",
"M59": "\\c{YOR4}Partie : 2 courses", "M59": "\\c{YOR4}Partie : 2 courses",
"M60": "\\c{YOR4}Partie : 4 courses", "M60": "\\c{YOR4}Partie : 4 courses",
"M61": "\\c{YOR4}Partie : 8 courses", "M61": "\\c{YOR4}Partie : 8 courses",
"M62": "\\c{YOR4}Partie : 12 courses", "M62": "\\c{YOR4}Partie : 12 courses",
"M63": "\\c{YOR4}Partie : 16 courses", "M63": "\\c{YOR4}Partie : 16 courses",
"M64": "\\c{YOR4}Partie : 24 courses", "M64": "\\c{YOR4}Partie : 24 courses",
"M65": "\\c{YOR4}Partie : 32 courses", "M65": "\\c{YOR4}Partie : 32 courses",
"M66": "\\c{YOR4}Partie : 48 courses", "M66": "\\c{YOR4}Partie : 48 courses",
"M67": "\\c{YOR4}Partie : 64 courses" "M67": "\\c{YOR4}Partie : 64 courses"
}
} }
} ]
} }
} }

View file

@ -1,46 +1,48 @@
{ {
"mode": "edit", "mode": "edit",
"operation": { "operation": {
"bmg-edit": { "bmg-edit": [
"mode": "id", {
"data": { "mode": "id",
"0x703e": "\\c{white}Zufällig: Alle Tracks", "data": {
"0x703f": "\\c{white}Zufällig: Original-Tracks", "0x703e": "\\c{white}Zufällig: Alle Tracks",
"0x7040": "\\c{white}Zufällig: Custom Tracks", "0x703f": "\\c{white}Zufällig: Original-Tracks",
"0x7041": "\\c{white}Zufällig: Neue Tracks", "0x7040": "\\c{white}Zufällig: Custom Tracks",
"0x7041": "\\c{white}Zufällig: Neue Tracks",
"M37": "\\c{YOR4}Optionen zurücksetzen", "M37": "\\c{YOR4}Optionen zurücksetzen",
"M38": "\\c{YOR4}Abstimmung : von Spielern", "M38": "\\c{YOR4}Abstimmung : von Spielern",
"M39": "\\c{YOR4}Abstimmung : vom Gastgeber", "M39": "\\c{YOR4}Abstimmung : vom Gastgeber",
"M40": "\\c{YOR4}Blockierung : reset", "M40": "\\c{YOR4}Blockierung : reset",
"M41": "\\c{YOR4}Blockierung : disable", "M41": "\\c{YOR4}Blockierung : disable",
"M42": "\\c{YOR4}Blockierung : enable", "M42": "\\c{YOR4}Blockierung : enable",
"M43": "\\c{YOR4}Fahrzeug : alle", "M43": "\\c{YOR4}Fahrzeug : alle",
"M44": "\\c{YOR4}Fahrzeug : alles Gewicht", "M44": "\\c{YOR4}Fahrzeug : alles Gewicht",
"M45": "\\c{YOR4}Fahrzeug : nur leicht", "M45": "\\c{YOR4}Fahrzeug : nur leicht",
"M46": "\\c{YOR4}Fahrzeug : alles außer leicht", "M46": "\\c{YOR4}Fahrzeug : alles außer leicht",
"M47": "\\c{YOR4}Fahrzeug : nur Mittel", "M47": "\\c{YOR4}Fahrzeug : nur Mittel",
"M48": "\\c{YOR4}Fahrzeug : alles außer Mittel", "M48": "\\c{YOR4}Fahrzeug : alles außer Mittel",
"M49": "\\c{YOR4}Fahrzeug : nur schwer", "M49": "\\c{YOR4}Fahrzeug : nur schwer",
"M50": "\\c{YOR4}Fahrzeug : alles außer schwer", "M50": "\\c{YOR4}Fahrzeug : alles außer schwer",
"M51": "\\c{YOR4}Fahrzeug : alle Arten", "M51": "\\c{YOR4}Fahrzeug : alle Arten",
"M52": "\\c{YOR4}Fahrzeug : nur Kart", "M52": "\\c{YOR4}Fahrzeug : nur Kart",
"M53": "\\c{YOR4}Fahrzeug : nur Fahrrad", "M53": "\\c{YOR4}Fahrzeug : nur Fahrrad",
"M54": "\\c{YOR4}Motor : zurücksetzen", "M54": "\\c{YOR4}Motor : zurücksetzen",
"M55": "\\c{YOR4}Motor : 100cc", "M55": "\\c{YOR4}Motor : 100cc",
"M56": "\\c{YOR4}Motor : 150cc", "M56": "\\c{YOR4}Motor : 150cc",
"M57": "\\c{YOR4}Motor : 150cc Spiegel", "M57": "\\c{YOR4}Motor : 150cc Spiegel",
"M58": "\\c{YOR4}Spiel : 1 Track", "M58": "\\c{YOR4}Spiel : 1 Track",
"M59": "\\c{YOR4}Spiel : 2 Tracks", "M59": "\\c{YOR4}Spiel : 2 Tracks",
"M60": "\\c{YOR4}Spiel : 4 Tracks", "M60": "\\c{YOR4}Spiel : 4 Tracks",
"M61": "\\c{YOR4}Spiel : 8 Tracks", "M61": "\\c{YOR4}Spiel : 8 Tracks",
"M62": "\\c{YOR4}Spiel : 12 Tracks", "M62": "\\c{YOR4}Spiel : 12 Tracks",
"M63": "\\c{YOR4}Spiel : 16 Tracks", "M63": "\\c{YOR4}Spiel : 16 Tracks",
"M64": "\\c{YOR4}Spiel : 24 Tracks", "M64": "\\c{YOR4}Spiel : 24 Tracks",
"M65": "\\c{YOR4}Spiel : 32 Tracks", "M65": "\\c{YOR4}Spiel : 32 Tracks",
"M66": "\\c{YOR4}Spiel : 48 Tracks", "M66": "\\c{YOR4}Spiel : 48 Tracks",
"M67": "\\c{YOR4}Spiel : 64 Tracks" "M67": "\\c{YOR4}Spiel : 64 Tracks"
}
} }
} ]
} }
} }

View file

@ -1,46 +1,48 @@
{ {
"mode": "edit", "mode": "edit",
"operation": { "operation": {
"bmg-edit": { "bmg-edit": [
"mode": "id", {
"data": { "mode": "id",
"0x703e": "\\c{white}Casuale: Tutte le tracce", "data": {
"0x703f": "\\c{white}Casuale: Tracce originali", "0x703e": "\\c{white}Casuale: Tutte le tracce",
"0x7040": "\\c{white}Casuale: Custom Tracks", "0x703f": "\\c{white}Casuale: Tracce originali",
"0x7041": "\\c{white}Casuale: Nuovi brani", "0x7040": "\\c{white}Casuale: Custom Tracks",
"0x7041": "\\c{white}Casuale: Nuovi brani",
"M37": "\\c{YOR4}Ripristina opzioni", "M37": "\\c{YOR4}Ripristina opzioni",
"M38": "\\c{YOR4}Votazione : dei giocatori", "M38": "\\c{YOR4}Votazione : dei giocatori",
"M39": "\\c{YOR4}Votazione : per ospite", "M39": "\\c{YOR4}Votazione : per ospite",
"M40": "\\c{YOR4}Blocco : Ripristina", "M40": "\\c{YOR4}Blocco : Ripristina",
"M41": "\\c{YOR4}Blocco : disattivare", "M41": "\\c{YOR4}Blocco : disattivare",
"M42": "\\c{YOR4}Blocco : abilitare", "M42": "\\c{YOR4}Blocco : abilitare",
"M43": "\\c{YOR4}Veicolo : tutto", "M43": "\\c{YOR4}Veicolo : tutto",
"M44": "\\c{YOR4}Veicolo : tutto peso", "M44": "\\c{YOR4}Veicolo : tutto peso",
"M45": "\\c{YOR4}Veicolo : solo leggero", "M45": "\\c{YOR4}Veicolo : solo leggero",
"M46": "\\c{YOR4}Veicolo : tutto tranne leggero", "M46": "\\c{YOR4}Veicolo : tutto tranne leggero",
"M47": "\\c{YOR4}Veicolo : solo medio", "M47": "\\c{YOR4}Veicolo : solo medio",
"M48": "\\c{YOR4}Veicolo : tutto tranne medio", "M48": "\\c{YOR4}Veicolo : tutto tranne medio",
"M49": "\\c{YOR4}Veicolo : solo pesante", "M49": "\\c{YOR4}Veicolo : solo pesante",
"M50": "\\c{YOR4}Veicolo : tutto tranne pesante", "M50": "\\c{YOR4}Veicolo : tutto tranne pesante",
"M51": "\\c{YOR4}Veicolo : tutti i tipi", "M51": "\\c{YOR4}Veicolo : tutti i tipi",
"M52": "\\c{YOR4}Veicolo : solo kart", "M52": "\\c{YOR4}Veicolo : solo kart",
"M53": "\\c{YOR4}Veicolo : solo bici", "M53": "\\c{YOR4}Veicolo : solo bici",
"M54": "\\c{YOR4}Motore : Ripristina", "M54": "\\c{YOR4}Motore : Ripristina",
"M55": "\\c{YOR4}Motore : 100cc", "M55": "\\c{YOR4}Motore : 100cc",
"M56": "\\c{YOR4}Motore : 150cc", "M56": "\\c{YOR4}Motore : 150cc",
"M57": "\\c{YOR4}Motore : 150cc specchio", "M57": "\\c{YOR4}Motore : 150cc specchio",
"M58": "\\c{YOR4}Gioco : 1 pista", "M58": "\\c{YOR4}Gioco : 1 pista",
"M59": "\\c{YOR4}Gioco : 2 pistas", "M59": "\\c{YOR4}Gioco : 2 pistas",
"M60": "\\c{YOR4}Gioco : 4 pistas", "M60": "\\c{YOR4}Gioco : 4 pistas",
"M61": "\\c{YOR4}Gioco : 8 pistas", "M61": "\\c{YOR4}Gioco : 8 pistas",
"M62": "\\c{YOR4}Gioco : 12 pistas", "M62": "\\c{YOR4}Gioco : 12 pistas",
"M63": "\\c{YOR4}Gioco : 16 pistas", "M63": "\\c{YOR4}Gioco : 16 pistas",
"M64": "\\c{YOR4}Gioco : 24 pistas", "M64": "\\c{YOR4}Gioco : 24 pistas",
"M65": "\\c{YOR4}Gioco : 32 pistas", "M65": "\\c{YOR4}Gioco : 32 pistas",
"M66": "\\c{YOR4}Gioco : 48 pistas", "M66": "\\c{YOR4}Gioco : 48 pistas",
"M67": "\\c{YOR4}Gioco : 64 pistas" "M67": "\\c{YOR4}Gioco : 64 pistas"
}
} }
} ]
} }
} }

View file

@ -249,8 +249,13 @@ class PatchOperation:
type = "bmg-edit" type = "bmg-edit"
def __init__(self, *args, **kwargs): def __init__(self, layers: list[dict]):
print(args, kwargs) """
:param layers: all the bmg patch to apply
"""
self.layers = layers
def patch(self, patch: "Patch", file_name: str, file_content: IO) -> (str, IO): def patch(self, patch: "Patch", file_name: str, file_content: IO) -> (str, IO):
print(file_content)
return file_name, file_content return file_name, file_content

View file

@ -0,0 +1,31 @@
from source.wt import *
from source.wt import _run
tools_path = tools_szs_dir / ("wimgt.exe" if system == "win64" else "wimgt")
@better_wt_error(tools_path)
class BMGPath:
"""
Represent a path to a bmg file (game file containing text data)
"""
__slots__ = ("path",)
def __init__(self, path: Path | str):
self.path: Path = Path(path)
@better_wt_error(tools_path)
def _run(self, *args) -> bytes:
"""
Return a command with wbmgt and return the output
:param args: command arguments
:return: the output of the command
"""
return _run(tools_path, *args)
def get_decoded_data(self):
"""
Return the decoded content of the bmg file
:return:
"""
return self._run("DECODE", self.path, "--DEST", "-")

View file

@ -7,7 +7,7 @@ tools_path = tools_szs_dir / ("wimgt.exe" if system == "win64" else "wimgt")
@better_wt_error(tools_path) @better_wt_error(tools_path)
class IMGPath: class IMGPath:
""" """
Represent a path to an image Represent a path to a normal image, that can be converted into game image data
""" """
__slots__ = ("path", ) __slots__ = ("path", )
@ -17,7 +17,7 @@ class IMGPath:
@better_wt_error(tools_path) @better_wt_error(tools_path)
def _run(self, *args) -> bytes: def _run(self, *args) -> bytes:
""" """
Return a command with wszst and return the output Return a command with wimgt and return the output
:param args: command arguments :param args: command arguments
:return: the output of the command :return: the output of the command
""" """