diff --git a/source/wt/bmg.py b/source/wt/bmg.py index 9ebd762..2fb230d 100644 --- a/source/wt/bmg.py +++ b/source/wt/bmg.py @@ -1,6 +1,6 @@ from source.wt import * -tools_path = tools_szs_dir / ("wbmgt.exe" if system == "win64" else "wbmgt") +tools_path = tools_szs_dir / "wbmgt" _tools_run = get_tools_run_function(tools_path) diff --git a/source/wt/img.py b/source/wt/img.py index 00b925e..42fd02f 100644 --- a/source/wt/img.py +++ b/source/wt/img.py @@ -1,6 +1,6 @@ from source.wt import * -tools_path = tools_szs_dir / ("wimgt.exe" if system == "win64" else "wimgt") +tools_path = tools_szs_dir / "wimgt" _tools_run = get_tools_run_function(tools_path) diff --git a/source/wt/lec.py b/source/wt/lec.py new file mode 100644 index 0000000..b5a4821 --- /dev/null +++ b/source/wt/lec.py @@ -0,0 +1,31 @@ +from source.wt import * + +tools_path = tools_szs_dir / "wlect" + + +_tools_run = get_tools_run_function(tools_path) +_tools_run_popen = get_tools_run_popen_function(tools_path) + + +def patch_data(lecode_data: bytes, game_tracks_directory: Path | str, + copy_tracks_directory: Path | str, move_tracks_directory: Path | str, + ct_file: Path | str, lpar: Path | str) -> bytes: + """ + Patch a LECODE.bin file content + :param lpar: parameter that can be applied to the lecode configuration + :param ct_file: file defining track and arena slots + :param move_tracks_directory: tracks to move inside the game + :param copy_tracks_directory: tracks to copy inside the game + :param game_tracks_directory: directory to all the game tracks + :param lecode_data: LECODE.bin file content + :return: patched LECODE.bin file content + """ + args = [] + # TODO: implement args + + process = _tools_run_popen("PATCH", "-", "--DEST", "-", *args) + stdout, _ = process.communicate(input=lecode_data) + if process.returncode != 0: + raise WTError(tools_path, process.returncode) + + return stdout diff --git a/source/wt/szs.py b/source/wt/szs.py index 9561f6b..cd7fd50 100644 --- a/source/wt/szs.py +++ b/source/wt/szs.py @@ -1,7 +1,7 @@ from source.wt import * from source.wt import _run, _run_dict -tools_path = tools_szs_dir / ("wszst.exe" if system == "win64" else "wszst") +tools_path = tools_szs_dir / "wszst" _tools_run = get_tools_run_function(tools_path) diff --git a/source/wt/wit.py b/source/wt/wit.py index c73db7a..7079b7b 100644 --- a/source/wt/wit.py +++ b/source/wt/wit.py @@ -5,7 +5,7 @@ from typing import Generator from source.wt import * -tools_path = tools_wit_dir / ("wit.exe" if system == "win64" else "wit") +tools_path = tools_wit_dir / "wit" _tools_run = get_tools_run_function(tools_path) diff --git a/source/wt/wstrt.py b/source/wt/wstrt.py index 3323093..5c083df 100644 --- a/source/wt/wstrt.py +++ b/source/wt/wstrt.py @@ -1,6 +1,6 @@ from source.wt import * -tools_path = tools_szs_dir / ("wstrt.exe" if system == "win64" else "wstrt") +tools_path = tools_szs_dir / "wstrt" _tools_run = get_tools_run_function(tools_path)