Skip to content

Commit

Permalink
TLOZ: Conversion to use BizHawkClient
Browse files Browse the repository at this point in the history
First steps:
- Create worlds/tloz/Client.py, currently able to patch .aptloz files, vailidate ROM on connection, and successfuly connect to a multiworld server with BizHawkClient
- import Client to __init__.py so it properly loads
- Remove Zelda1Client from LauncherComponents.py
- Update inno_setup.iss to delete old Zelda1Client and connector_tloz.lua, as well as associate .aptloz files with BizhHawkClient instead of Zelda1Client
  • Loading branch information
t3hf1gm3nt committed Nov 29, 2023
1 parent 6c5f825 commit 2fde3a1
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
6 changes: 4 additions & 2 deletions inno_setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ Type: files; Name: "{app}\lib\worlds\_bizhawk.apworld"
Type: files; Name: "{app}\ArchipelagoLttPClient.exe"
Type: files; Name: "{app}\ArchipelagoPokemonClient.exe"
Type: files; Name: "{app}\data\lua\connector_pkmn_rb.lua"
Type: files; Name: "{app}\ArchipelagoZelda1Client.exe"
Type: files; Name: "{app}\data\lua\connector_tloz.lua"
Type: filesandordirs; Name: "{app}\lib\worlds\rogue-legacy*"
Type: filesandordirs; Name: "{app}\SNI\lua*"
Type: filesandordirs; Name: "{app}\EnemizerCLI*"
Expand Down Expand Up @@ -168,8 +170,8 @@ Root: HKCR; Subkey: "{#MyAppName}ladxpatch\shell\open\command"; ValueData: """{

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: "";
Root: HKCR; Subkey: "{#MyAppName}tlozpatch\DefaultIcon"; ValueData: "{app}\ArchipelagoZelda1Client.exe,0"; ValueType: string; ValueName: "";
Root: HKCR; Subkey: "{#MyAppName}tlozpatch\shell\open\command"; ValueData: """{app}\ArchipelagoZelda1Client.exe"" ""%1"""; ValueType: string; ValueName: "";
Root: HKCR; Subkey: "{#MyAppName}tlozpatch\DefaultIcon"; ValueData: "{app}\ArchipelagoBizHawkClient.exe,0"; ValueType: string; ValueName: "";
Root: HKCR; Subkey: "{#MyAppName}tlozpatch\shell\open\command"; ValueData: """{app}\ArchipelagoBizHawkClient.exe"" ""%1"""; ValueType: string; ValueName: "";

Root: HKCR; Subkey: ".apadvn"; ValueData: "{#MyAppName}advnpatch"; Flags: uninsdeletevalue; ValueType: string; ValueName: "";
Root: HKCR; Subkey: "{#MyAppName}advnpatch"; ValueData: "Archipelago Adventure Patch"; Flags: uninsdeletekey; ValueType: string; ValueName: "";
Expand Down
2 changes: 0 additions & 2 deletions worlds/LauncherComponents.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ def launch_textclient():
Component('OoT Adjuster', 'OoTAdjuster'),
# FF1
Component('FF1 Client', 'FF1Client'),
# TLoZ
Component('Zelda 1 Client', 'Zelda1Client', file_identifier=SuffixIdentifier('.aptloz')),
# ChecksFinder
Component('ChecksFinder Client', 'ChecksFinderClient'),
# Starcraft 2
Expand Down
31 changes: 31 additions & 0 deletions worlds/tloz/Client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import logging
from worlds._bizhawk.client import BizHawkClient
from worlds._bizhawk import read

logger = logging.getLogger("Client")

class TLOZClient(BizHawkClient):
system = "NES"
patch_suffix = ".aptloz"
game = "The Legend of Zelda"

def __init__(self):
super().__init__()

async def validate_rom(self, ctx):
game_name = await read(ctx.bizhawk_ctx, [(0x0, 3, "PRG ROM")])
game_name = game_name[0].decode("ascii")
if game_name in "LOZ":
ctx.game = self.game
ctx.items_handling = 0b101 # get sent remote and starting items
return True
return False

async def set_auth(self, ctx):
auth_name = await read(ctx.bizhawk_ctx, [(0x20, 16, "PRG ROM")])
auth_name = auth_name[0].decode("ascii").split("\x00")[0]
ctx.auth = auth_name

async def game_watcher(self, ctx):
#TODO
pass
2 changes: 1 addition & 1 deletion worlds/tloz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from .Rules import set_rules
from worlds.AutoWorld import World, WebWorld
from worlds.generic.Rules import add_rule

from .Client import TLOZClient

class TLoZSettings(settings.Group):
class RomFile(settings.UserFilePath):
Expand Down

0 comments on commit 2fde3a1

Please sign in to comment.