From 4c27e35445f434f31ca37f5722e6257f7b078229 Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Wed, 4 Feb 2026 18:41:48 -0500 Subject: [PATCH] TWW: Support launcher command line arguments (#5806) * Support launcher command line arguments * Use `launch` instead of `launch_subprocess` * Remove old runner code --- worlds/tww/TWWClient.py | 16 ++++++---------- worlds/tww/__init__.py | 8 +++++--- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/worlds/tww/TWWClient.py b/worlds/tww/TWWClient.py index cb4c25685d..b71f43d569 100644 --- a/worlds/tww/TWWClient.py +++ b/worlds/tww/TWWClient.py @@ -696,12 +696,11 @@ async def dolphin_sync_task(ctx: TWWContext) -> None: continue -def main(connect: Optional[str] = None, password: Optional[str] = None) -> None: +def main(*args: str) -> None: """ Run the main async loop for the Wind Waker client. - :param connect: Address of the Archipelago server. - :param password: Password for server authentication. + :param *args: Command line arguments passed to the client. """ Utils.init_logging("The Wind Waker Client") @@ -726,14 +725,11 @@ def main(connect: Optional[str] = None, password: Optional[str] = None) -> None: if ctx.dolphin_sync_task: await ctx.dolphin_sync_task + parser = get_base_parser() + parsed_args = parser.parse_args(args) + import colorama colorama.init() - asyncio.run(_main(connect, password)) + asyncio.run(_main(parsed_args.connect, parsed_args.password)) colorama.deinit() - - -if __name__ == "__main__": - parser = get_base_parser() - args = parser.parse_args() - main(args.connect, args.password) diff --git a/worlds/tww/__init__.py b/worlds/tww/__init__.py index 58e752b5c9..f4418c698b 100644 --- a/worlds/tww/__init__.py +++ b/worlds/tww/__init__.py @@ -13,7 +13,7 @@ from Options import Toggle from worlds.AutoWorld import WebWorld, World from worlds.Files import APPlayerContainer from worlds.generic.Rules import add_item_rule -from worlds.LauncherComponents import Component, SuffixIdentifier, Type, components, icon_paths, launch_subprocess +from worlds.LauncherComponents import Component, SuffixIdentifier, Type, components, icon_paths, launch from .Items import ISLAND_NUMBER_TO_CHART_NAME, ITEM_TABLE, TWWItem, item_name_groups from .Locations import LOCATION_TABLE, TWWFlag, TWWLocation @@ -29,14 +29,16 @@ from .Rules import set_rules VERSION: tuple[int, int, int] = (3, 0, 0) -def run_client() -> None: +def run_client(*args: str) -> None: """ Launch the The Wind Waker client. + + :param *args: Variable length argument list passed to the client. """ print("Running The Wind Waker Client") from .TWWClient import main - launch_subprocess(main, name="TheWindWakerClient") + launch(main, name="TheWindWakerClient", args=args) components.append(