diff --git a/inno_setup.iss b/inno_setup.iss index 8611c849..1891cf83 100644 --- a/inno_setup.iss +++ b/inno_setup.iss @@ -180,8 +180,8 @@ Root: HKCR; Subkey: "{#MyAppName}mm2patch\shell\open\command"; ValueData: """{a Root: HKCR; Subkey: ".apladx"; ValueData: "{#MyAppName}ladxpatch"; Flags: uninsdeletevalue; ValueType: string; ValueName: ""; Root: HKCR; Subkey: "{#MyAppName}ladxpatch"; ValueData: "Archipelago Links Awakening DX Patch"; Flags: uninsdeletekey; ValueType: string; ValueName: ""; -Root: HKCR; Subkey: "{#MyAppName}ladxpatch\DefaultIcon"; ValueData: "{app}\ArchipelagoLinksAwakeningClient.exe,0"; ValueType: string; ValueName: ""; -Root: HKCR; Subkey: "{#MyAppName}ladxpatch\shell\open\command"; ValueData: """{app}\ArchipelagoLinksAwakeningClient.exe"" ""%1"""; ValueType: string; ValueName: ""; +Root: HKCR; Subkey: "{#MyAppName}ladxpatch\DefaultIcon"; ValueData: "{app}\ArchipelagoLauncher.exe,0"; ValueType: string; ValueName: ""; +Root: HKCR; Subkey: "{#MyAppName}ladxpatch\shell\open\command"; ValueData: """{app}\ArchipelagoLauncher.exe"" ""%1"""; ValueType: string; ValueName: ""; Root: HKCR; Subkey: ".aptloz"; ValueData: "{#MyAppName}tlozpatch"; Flags: uninsdeletevalue; ValueType: string; ValueName: ""; Root: HKCR; Subkey: "{#MyAppName}tlozpatch"; ValueData: "Archipelago The Legend of Zelda Patch"; Flags: uninsdeletekey; ValueType: string; ValueName: ""; diff --git a/worlds/LauncherComponents.py b/worlds/LauncherComponents.py index be58b048..1bc78be1 100644 --- a/worlds/LauncherComponents.py +++ b/worlds/LauncherComponents.py @@ -217,8 +217,6 @@ components: List[Component] = [ description="Install an APWorld to play games not included with Archipelago by default."), Component('Text Client', 'CommonClient', 'ArchipelagoTextClient', func=launch_textclient, description="Connect to a multiworld using the text client."), - Component('Links Awakening DX Client', 'LinksAwakeningClient', - file_identifier=SuffixIdentifier('.apladx')), Component('LttP Adjuster', 'LttPAdjuster'), # Ocarina of Time Component('OoT Client', 'OoTClient', diff --git a/LinksAwakeningClient.py b/worlds/ladx/LinksAwakeningClient.py similarity index 91% rename from LinksAwakeningClient.py rename to worlds/ladx/LinksAwakeningClient.py index 293e782f..62b1a274 100644 --- a/LinksAwakeningClient.py +++ b/worlds/ladx/LinksAwakeningClient.py @@ -3,9 +3,6 @@ ModuleUpdate.update() import Utils -if __name__ == "__main__": - Utils.init_logging("LinksAwakeningContext", exception_logger="Client") - import asyncio import base64 import binascii @@ -26,16 +23,14 @@ import typing from CommonClient import (CommonContext, get_base_parser, gui_enabled, logger, server_loop) from NetUtils import ClientStatus -from worlds.ladx import LinksAwakeningWorld -from worlds.ladx.Common import BASE_ID as LABaseID -from worlds.ladx.GpsTracker import GpsTracker -from worlds.ladx.TrackerConsts import storage_key -from worlds.ladx.ItemTracker import ItemTracker -from worlds.ladx.LADXR.checkMetadata import checkMetadataTable -from worlds.ladx.Locations import get_locations_to_id, meta_to_name -from worlds.ladx.Tracker import LocationTracker, MagpieBridge, Check - - +from . import LinksAwakeningWorld +from .Common import BASE_ID as LABaseID +from .GpsTracker import GpsTracker +from .TrackerConsts import storage_key +from .ItemTracker import ItemTracker +from .LADXR.checkMetadata import checkMetadataTable +from .Locations import get_locations_to_id, meta_to_name +from .Tracker import LocationTracker, MagpieBridge, Check class GameboyException(Exception): pass @@ -760,42 +755,44 @@ def run_game(romfile: str) -> None: except FileNotFoundError: logger.error(f"Couldn't launch ROM, {args[0]} is missing") -async def main(): - parser = get_base_parser(description="Link's Awakening Client.") - parser.add_argument("--url", help="Archipelago connection url") - parser.add_argument("--no-magpie", dest='magpie', default=True, action='store_false', help="Disable magpie bridge") - parser.add_argument('diff_file', default="", type=str, nargs="?", - help='Path to a .apladx Archipelago Binary Patch file') +def launch(*launch_args): + async def main(): + parser = get_base_parser(description="Link's Awakening Client.") + parser.add_argument("--url", help="Archipelago connection url") + parser.add_argument("--no-magpie", dest='magpie', default=True, action='store_false', help="Disable magpie bridge") + parser.add_argument('diff_file', default="", type=str, nargs="?", + help='Path to a .apladx Archipelago Binary Patch file') - args = parser.parse_args() + args = parser.parse_args(launch_args) - if args.diff_file: - import Patch - logger.info("patch file was supplied - creating rom...") - meta, rom_file = Patch.create_rom_file(args.diff_file) - if "server" in meta and not args.connect: - args.connect = meta["server"] - logger.info(f"wrote rom file to {rom_file}") + if args.diff_file: + import Patch + logger.info("patch file was supplied - creating rom...") + meta, rom_file = Patch.create_rom_file(args.diff_file) + if "server" in meta and not args.connect: + args.connect = meta["server"] + logger.info(f"wrote rom file to {rom_file}") - ctx = LinksAwakeningContext(args.connect, args.password, args.magpie) + ctx = LinksAwakeningContext(args.connect, args.password, args.magpie) - ctx.server_task = asyncio.create_task(server_loop(ctx), name="server loop") + ctx.server_task = asyncio.create_task(server_loop(ctx), name="server loop") - # TODO: nothing about the lambda about has to be in a lambda - ctx.la_task = create_task_log_exception(ctx.run_game_loop()) - if gui_enabled: - ctx.run_gui() - ctx.run_cli() + # TODO: nothing about the lambda about has to be in a lambda + ctx.la_task = create_task_log_exception(ctx.run_game_loop()) + if gui_enabled: + ctx.run_gui() + ctx.run_cli() - # Down below run_gui so that we get errors out of the process - if args.diff_file: - run_game(rom_file) + # Down below run_gui so that we get errors out of the process + if args.diff_file: + run_game(rom_file) - await ctx.exit_event.wait() - await ctx.shutdown() + await ctx.exit_event.wait() + await ctx.shutdown() + + Utils.init_logging("LinksAwakeningContext", exception_logger="Client") -if __name__ == '__main__': colorama.just_fix_windows_console() asyncio.run(main()) colorama.deinit() diff --git a/worlds/ladx/__init__.py b/worlds/ladx/__init__.py index 58d6c168..a00076a6 100644 --- a/worlds/ladx/__init__.py +++ b/worlds/ladx/__init__.py @@ -9,6 +9,7 @@ import settings from BaseClasses import CollectionState, Entrance, Item, ItemClassification, Location, Tutorial from Fill import fill_restrictive from worlds.AutoWorld import WebWorld, World +from worlds.LauncherComponents import Component, components, SuffixIdentifier, Type, launch, icon_paths from .Common import * from . import ItemIconGuessing from .Items import (DungeonItemData, DungeonItemType, ItemName, LinksAwakeningItem, TradeItemData, @@ -29,6 +30,19 @@ from .Rom import LADXProcedurePatch, write_patch_data DEVELOPER_MODE = False +def launch_client(*args): + from .LinksAwakeningClient import launch as ladx_launch + launch(ladx_launch, name=f"{LINKS_AWAKENING} Client", args=args) + +components.append(Component(f"{LINKS_AWAKENING} Client", + func=launch_client, + component_type=Type.CLIENT, + icon=LINKS_AWAKENING, + file_identifier=SuffixIdentifier('.apladx'))) + +icon_paths[LINKS_AWAKENING] = "ap:worlds.ladx/assets/MarinV-3_small.png" + + class LinksAwakeningSettings(settings.Group): class RomFile(settings.UserFilePath): """File name of the Link's Awakening DX rom""" diff --git a/worlds/ladx/assets/MarinV-3.png b/worlds/ladx/assets/MarinV-3.png new file mode 100644 index 00000000..9174a632 Binary files /dev/null and b/worlds/ladx/assets/MarinV-3.png differ diff --git a/worlds/ladx/assets/MarinV-3_small.png b/worlds/ladx/assets/MarinV-3_small.png new file mode 100644 index 00000000..3c87601f Binary files /dev/null and b/worlds/ladx/assets/MarinV-3_small.png differ