From 63cbe06bf31561794700a1d7c003a6616cf3924e Mon Sep 17 00:00:00 2001 From: Faraphel Date: Mon, 18 Jul 2022 13:17:15 +0200 Subject: [PATCH] original tracks are now moved to original-tracks in the .cache --- source/mkw/ExtractedGame.py | 12 +++++++++++- source/mkw/Game.py | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/source/mkw/ExtractedGame.py b/source/mkw/ExtractedGame.py index 0f6e252..75bd45e 100644 --- a/source/mkw/ExtractedGame.py +++ b/source/mkw/ExtractedGame.py @@ -23,11 +23,21 @@ class ExtractedGame: """ Extract all the autoadd files from the game to destination_path :param destination_path: directory where the autoadd files will be extracted - :return: directory where the autoadd files were extracted """ yield {"description": "Extracting autoadd files...", "determinate": False} szs.autoadd(self.path / "files/Race/Course/", destination_path) + def extract_original_tracks(self, destination_path: "Path | str") -> Generator[dict, None, None]: + """ + Move all the original tracks to the destination path + :param destination_path: destination of the track + """ + destination_path = Path(destination_path) + destination_path.mkdir(parents=True, exist_ok=True) + yield {"description": "Extracting original tracks...", "determinate": False} + for track_file in (self.path / "files/Race/Course/").glob("*.szs"): + track_file.rename(destination_path / track_file.name) + def install_mystuff(self) -> Generator[dict, None, None]: """ Install mystuff directory diff --git a/source/mkw/Game.py b/source/mkw/Game.py index 74efe9e..1c2417d 100644 --- a/source/mkw/Game.py +++ b/source/mkw/Game.py @@ -104,8 +104,14 @@ class Game: if not self.is_mkw(): raise NotMKWGameError(self.wit_path.path) if not self.is_vanilla(): raise NotVanillaError(self.wit_path.path) + # extract the game yield from self.extract(extracted_game.path) + + # prepare the cache yield from extracted_game.extract_autoadd(cache_directory / "autoadd/") + yield from extracted_game.extract_original_tracks(cache_directory / "original-tracks/") + + # patch the game yield from extracted_game.install_mystuff() yield from extracted_game.prepare_dol() yield from extracted_game.install_all_patch(mod_config)