Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def handle_uri(path: str) -> tuple[list[Component], Component]:
text_client_component = None
game = queries["game"][0]
for component in components:
if component.supports_uri and component.game_name == game:
if component.supports_uri and game in component.game_name:
client_components.append(component)
elif component.display_name == "Text Client":
text_client_component = component
Expand Down
11 changes: 8 additions & 3 deletions worlds/LauncherComponents.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ class Component:
Function that is run against patch file arg to identify which component is appropriate to launch
If the function is an Instance of SuffixIdentifier the suffixes will also be valid for the Open Patch component
"""
game_name: Optional[str]
game_name: list[str]
"""Game name to identify component when handling launch links from WebHost"""
supports_uri: Optional[bool]
"""Bool to identify if a component supports being launched by launch links from WebHost"""

def __init__(self, display_name: str, script_name: Optional[str] = None, frozen_name: Optional[str] = None,
cli: bool = False, icon: str = 'icon', component_type: Optional[Type] = None,
func: Optional[Callable] = None, file_identifier: Optional[Callable[[str], bool]] = None,
game_name: Optional[str] = None, supports_uri: Optional[bool] = False, description: str = "") -> None:
game_name: Optional[str | list[str]] = None, supports_uri: Optional[bool] = False, description: str = "") -> None:
self.display_name = display_name
self.description = description
self.script_name = script_name
Expand All @@ -77,7 +77,12 @@ def __init__(self, display_name: str, script_name: Optional[str] = None, frozen_
Type.ADJUSTER if "Adjuster" in display_name else Type.MISC)
self.func = func
self.file_identifier = file_identifier
self.game_name = game_name
if game_name is None:
self.game_name = []
elif isinstance(game_name, str):
self.game_name = [game_name]
else:
self.game_name = game_name
self.supports_uri = supports_uri

def handles_file(self, path: str):
Expand Down
3 changes: 2 additions & 1 deletion worlds/_bizhawk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def launch_client(*args) -> None:


component = Component("BizHawk Client", "BizHawkClient", component_type=Type.CLIENT, func=launch_client,
file_identifier=SuffixIdentifier(),
file_identifier=SuffixIdentifier(), supports_uri=True,
description="Open the BizHawk client, to play games using the Bizhawk emulator.")
components.append(component)

Expand All @@ -38,6 +38,7 @@ def __new__(cls, name: str, bases: tuple[type, ...], namespace: dict[str, Any])

if "game" in namespace:
AutoBizHawkClientRegister.game_handlers[systems][namespace["game"]] = new_class()
component.game_name.append(namespace["game"])

# Update launcher component's suffixes
if "patch_suffix" in namespace:
Expand Down
11 changes: 10 additions & 1 deletion worlds/_bizhawk/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
import enum
import subprocess
from typing import Any
import urllib

import settings

from CommonClient import CommonContext, ClientCommandProcessor, get_base_parser, server_loop, logger, gui_enabled
import Patch
import Utils
Expand Down Expand Up @@ -352,7 +354,14 @@ 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 != "":
if args.patch_file.startswith("archipelago://"):
url = urllib.parse.urlparse(args.patch_file)
args.connect = url.netloc
if url.username:
args.name = urllib.parse.unquote(url.username)
if url.password:
args.password = urllib.parse.unquote(url.password)
elif args.patch_file != "":
metadata = _patch_and_run_game(args.patch_file)
if "server" in metadata:
args.connect = metadata["server"]
Expand Down
Loading