From e0950755922889795baa48c7d41cd2e2723c9bb2 Mon Sep 17 00:00:00 2001 From: Silvris <58583688+Silvris@users.noreply.github.com> Date: Sun, 8 Dec 2024 18:29:27 -0600 Subject: [PATCH] set metadata properly --- worlds/_bizhawk/context.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/worlds/_bizhawk/context.py b/worlds/_bizhawk/context.py index 2a3965a54fcd..8d029f92ec71 100644 --- a/worlds/_bizhawk/context.py +++ b/worlds/_bizhawk/context.py @@ -231,12 +231,14 @@ async def _run_game(rom: str): ) -async def _patch_and_run_game(patch_file: str): +def _patch_and_run_game(patch_file: str): try: metadata, output_file = Patch.create_rom_file(patch_file) Utils.async_start(_run_game(output_file)) + return metadata except Exception as exc: logger.exception(exc) + return {} def launch(*launch_args) -> None: @@ -245,6 +247,11 @@ async def main(): parser.add_argument("patch_file", default="", type=str, nargs="?", help="Path to an Archipelago patch file") args = parser.parse_args(launch_args) + if args.patch_file != "": + metadata = _patch_and_run_game(args.patch_file) + if "server" in metadata: + args.connect = metadata["server"] + ctx = BizHawkClientContext(args.connect, args.password) ctx.server_task = asyncio.create_task(server_loop(ctx), name="ServerLoop") @@ -252,9 +259,6 @@ async def main(): ctx.run_gui() ctx.run_cli() - if args.patch_file != "": - Utils.async_start(_patch_and_run_game(args.patch_file)) - watcher_task = asyncio.create_task(_game_watcher(ctx), name="GameWatcher") try: