diff --git a/ct_config.json b/ct_config.json index 403e515..e2ea1ef 100644 --- a/ct_config.json +++ b/ct_config.json @@ -2,6 +2,7 @@ "version":"0.11", "name": "Mario Kart Wii Faraphel", "nickname": "MKWF", + "game_variant": "60", "cup":{ "0":{ diff --git a/source/CT_Config.py b/source/CT_Config.py index c9aff2f..4b9d1d3 100644 --- a/source/CT_Config.py +++ b/source/CT_Config.py @@ -30,10 +30,12 @@ def get_cup_icon(cup_id: [str, int], font_path: str = "./file/SuperMario256.ttf" 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.name = 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.unordered_tracks = [] self.all_tracks = [] @@ -161,6 +163,7 @@ class CT_Config: self.name = ctconfig_json["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: """ diff --git a/source/Game.py b/source/Game.py index 4da984f..37b8b21 100644 --- a/source/Game.py +++ b/source/Game.py @@ -108,7 +108,7 @@ class Game: :param format: game format (ISO, WBFS, ...) """ 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) shutil.rmtree(self.path) self.path = path_game_format @@ -118,7 +118,7 @@ class Game: file=self.path, region_ID=self.region_ID, 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: @@ -132,7 +132,7 @@ class Game: # Fiding a directory name that doesn't already exist path_dir = get_next_available_dir( 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) diff --git a/source/wszst/wit.py b/source/wszst/wit.py index 6b5687f..00256e6 100644 --- a/source/wszst/wit.py +++ b/source/wszst/wit.py @@ -16,15 +16,17 @@ def extract(file: str, dst_dir: str) -> None: @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 + :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 region_ID: new region_ID :param name: new name """ 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)