Skip to content

Commit

Permalink
SoE/SNIClient: auto launch SNI before browser when SNIClient patched (A…
Browse files Browse the repository at this point in the history
…rchipelagoMW#1861)

* auto launch SNI before browser

* launch emulator too :)

* don't infinitely await sni connection
  • Loading branch information
alwaysintreble authored and Witchybun committed Jun 26, 2023
1 parent 4f0d0f6 commit fb94b29
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion SNIClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def launch_sni() -> None:
f"please start it yourself if it is not running")


async def _snes_connect(ctx: SNIContext, address: str) -> WebSocketClientProtocol:
async def _snes_connect(ctx: SNIContext, address: str, retry: bool = True) -> WebSocketClientProtocol:
address = f"ws://{address}" if "://" not in address else address
snes_logger.info("Connecting to SNI at %s ..." % address)
seen_problems: typing.Set[str] = set()
Expand All @@ -336,6 +336,8 @@ async def _snes_connect(ctx: SNIContext, address: str) -> WebSocketClientProtoco
await asyncio.sleep(1)
else:
return snes_socket
if not retry:
break


class SNESRequest(typing.TypedDict):
Expand Down Expand Up @@ -684,6 +686,8 @@ async def main() -> None:
logging.info(f"Wrote rom file to {romfile}")
if args.diff_file.endswith(".apsoe"):
import webbrowser
async_start(run_game(romfile))
await _snes_connect(SNIContext(args.snes, args.connect, args.password), args.snes, False)
webbrowser.open(f"http://www.evermizer.com/apclient/#server={meta['server']}")
logging.info("Starting Evermizer Client in your Browser...")
import time
Expand Down

0 comments on commit fb94b29

Please sign in to comment.