removed some MKWFaraphel specific non-modulable text

This commit is contained in:
Faraphel 2022-01-11 19:39:51 +01:00
parent 1b8d7fa7fc
commit b7f87d6a31
4 changed files with 12 additions and 6 deletions

View file

@ -2,6 +2,7 @@
"version":"0.11", "version":"0.11",
"name": "Mario Kart Wii Faraphel", "name": "Mario Kart Wii Faraphel",
"nickname": "MKWF", "nickname": "MKWF",
"game_variant": "60",
"cup":{ "cup":{
"0":{ "0":{

View file

@ -30,10 +30,12 @@ def get_cup_icon(cup_id: [str, int], font_path: str = "./file/SuperMario256.ttf"
class CT_Config: class CT_Config:
def __init__(self, version: str = None, name: str = None, nickname: str = None, gui=None): def __init__(self, version: str = None, name: str = None, nickname: str = None, game_variant: str = None, gui=None):
self.version = version self.version = version
self.name = name self.name = name
self.nickname = nickname if nickname else name self.nickname = nickname if nickname else name
self.game_variant = game_variant # this is the "60" part in RMCP60 for example
self.ordered_cups = [] self.ordered_cups = []
self.unordered_tracks = [] self.unordered_tracks = []
self.all_tracks = [] self.all_tracks = []
@ -161,6 +163,7 @@ class CT_Config:
self.name = ctconfig_json["name"] self.name = ctconfig_json["name"]
self.nickname = ctconfig_json["nickname"] if "nickname" in ctconfig_json else self.name self.nickname = ctconfig_json["nickname"] if "nickname" in ctconfig_json else self.name
self.game_variant = ctconfig_json["game_variant"] if "game_variant" in ctconfig_json else "01"
def search_tracks(self, values_list=False, not_value=False, only_unordered_track=False, **kwargs) -> list: def search_tracks(self, values_list=False, not_value=False, only_unordered_track=False, **kwargs) -> list:
""" """

View file

@ -108,7 +108,7 @@ class Game:
:param format: game format (ISO, WBFS, ...) :param format: game format (ISO, WBFS, ...)
""" """
if format in ["ISO", "WBFS", "CISO"]: if format in ["ISO", "WBFS", "CISO"]:
path_game_format: str = os.path.realpath(self.path + f"/../MKWFaraphel v{self.ctconfig.version}." + format.lower()) path_game_format: str = os.path.realpath(self.path + f"/../{self.ctconfig.nickname} v{self.ctconfig.version}." + format.lower())
wit.copy(src_path=self.path, dst_path=path_game_format, format=format) wit.copy(src_path=self.path, dst_path=path_game_format, format=format)
shutil.rmtree(self.path) shutil.rmtree(self.path)
self.path = path_game_format self.path = path_game_format
@ -118,7 +118,7 @@ class Game:
file=self.path, file=self.path,
region_ID=self.region_ID, region_ID=self.region_ID,
game_variant=self.ctconfig.game_variant, game_variant=self.ctconfig.game_variant,
name=f"Mario Kart Wii Faraphel {self.ctconfig.version}" name=f"{self.ctconfig.name} {self.ctconfig.version}"
) )
def extract(self) -> None: def extract(self) -> None:
@ -132,7 +132,7 @@ class Game:
# Fiding a directory name that doesn't already exist # Fiding a directory name that doesn't already exist
path_dir = get_next_available_dir( path_dir = get_next_available_dir(
parent_dir=self.path + f"/../", parent_dir=self.path + f"/../",
dir_name=f"MKWiiFaraphel v{self.ctconfig.version}" dir_name=f"{self.ctconfig.nickname} v{self.ctconfig.version}"
) )
wit.extract(file=self.path, dst_dir=path_dir) wit.extract(file=self.path, dst_dir=path_dir)

View file

@ -16,15 +16,17 @@ def extract(file: str, dst_dir: str) -> None:
@error.better_wszst_error(wszst_tools=WIT_PATH) @error.better_wszst_error(wszst_tools=WIT_PATH)
def edit(file: str, region_ID: str = "P", name: str = "Mario Kart Wii") -> None: def edit(file: str, game_code: str = "RMC", region_ID: str = "P", game_variant: str = "01", name: str = "Mario Kart Wii") -> None:
""" """
Edit game property like region or name Edit game property like region or name
:param game_variant: for example, the 60 in RMCP60
:param game_code: code for the game. MKWii is RMC.
:param file: game's file :param file: game's file
:param region_ID: new region_ID :param region_ID: new region_ID
:param name: new name :param name: new name
""" """
subprocess.run( subprocess.run(
[WIT_PATH, "EDIT", file, "--id", f"RMC{region_ID}60", "--name", name, "--modify", "ALL"], [WIT_PATH, "EDIT", file, "--id", f"{game_code}{region_ID}{game_variant}", "--name", name, "--modify", "ALL"],
creationflags=subprocess.CREATE_NO_WINDOW, check=True, stdout=subprocess.PIPE) creationflags=subprocess.CREATE_NO_WINDOW, check=True, stdout=subprocess.PIPE)