From 0d35cd4679f6f267bfbdb1b91325eb1cb2c6ee39 Mon Sep 17 00:00:00 2001 From: Remy Jette Date: Wed, 18 Sep 2024 11:42:22 -0700 Subject: [PATCH] BizHawkClient: Avoid error launching BizHawkClient via Launcher CLI (#3554) * Core, BizHawkClient: Support launching BizHawkClient via Launcher command line * Revert changes to LauncherComponents.py --- BizHawkClient.py | 3 ++- worlds/_bizhawk/client.py | 2 +- worlds/_bizhawk/context.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/BizHawkClient.py b/BizHawkClient.py index 86c8e519..743785b2 100644 --- a/BizHawkClient.py +++ b/BizHawkClient.py @@ -1,9 +1,10 @@ from __future__ import annotations +import sys import ModuleUpdate ModuleUpdate.update() from worlds._bizhawk.context import launch if __name__ == "__main__": - launch() + launch(*sys.argv[1:]) diff --git a/worlds/_bizhawk/client.py b/worlds/_bizhawk/client.py index 00370c27..415b663e 100644 --- a/worlds/_bizhawk/client.py +++ b/worlds/_bizhawk/client.py @@ -15,7 +15,7 @@ if TYPE_CHECKING: def launch_client(*args) -> None: from .context import launch - launch_subprocess(launch, name="BizHawkClient") + launch_subprocess(launch, name="BizHawkClient", args=args) component = Component("BizHawk Client", "BizHawkClient", component_type=Type.CLIENT, func=launch_client, diff --git a/worlds/_bizhawk/context.py b/worlds/_bizhawk/context.py index 896c8fb7..2a3965a5 100644 --- a/worlds/_bizhawk/context.py +++ b/worlds/_bizhawk/context.py @@ -239,11 +239,11 @@ async def _patch_and_run_game(patch_file: str): logger.exception(exc) -def launch() -> None: +def launch(*launch_args) -> None: async def main(): parser = get_base_parser() parser.add_argument("patch_file", default="", type=str, nargs="?", help="Path to an Archipelago patch file") - args = parser.parse_args() + args = parser.parse_args(launch_args) ctx = BizHawkClientContext(args.connect, args.password) ctx.server_task = asyncio.create_task(server_loop(ctx), name="ServerLoop")