Skip to content

Commit

Permalink
set metadata properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Silvris committed Dec 9, 2024
1 parent e3b5451 commit e095075
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions worlds/_bizhawk/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -245,16 +247,18 @@ 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")

if gui_enabled:
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:
Expand Down

0 comments on commit e095075

Please sign in to comment.