From fb1cf26118b7e977721f429b55e76a273caa939b Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sun, 14 Apr 2024 20:40:09 +0200 Subject: [PATCH] SNIClient/LttP: modern SNI prevents payload overflow (#2523) --- SNIClient.py | 16 ++++++---------- worlds/alttp/Options.py | 5 ++--- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/SNIClient.py b/SNIClient.py index 062d7a7cbea1..1804ab3cc08d 100644 --- a/SNIClient.py +++ b/SNIClient.py @@ -564,16 +564,12 @@ async def snes_write(ctx: SNIContext, write_list: typing.List[typing.Tuple[int, PutAddress_Request: SNESRequest = {"Opcode": "PutAddress", "Operands": [], 'Space': 'SNES'} try: for address, data in write_list: - while data: - # Divide the write into packets of 256 bytes. - PutAddress_Request['Operands'] = [hex(address)[2:], hex(min(len(data), 256))[2:]] - if ctx.snes_socket is not None: - await ctx.snes_socket.send(dumps(PutAddress_Request)) - await ctx.snes_socket.send(data[:256]) - address += 256 - data = data[256:] - else: - snes_logger.warning(f"Could not send data to SNES: {data}") + PutAddress_Request['Operands'] = [hex(address)[2:], hex(min(len(data), 256))[2:]] + if ctx.snes_socket is not None: + await ctx.snes_socket.send(dumps(PutAddress_Request)) + await ctx.snes_socket.send(data) + else: + snes_logger.warning(f"Could not send data to SNES: {data}") except ConnectionClosed: return False diff --git a/worlds/alttp/Options.py b/worlds/alttp/Options.py index 2b23dc341c43..ff960da66a49 100644 --- a/worlds/alttp/Options.py +++ b/worlds/alttp/Options.py @@ -716,9 +716,8 @@ class BeemizerTrapChance(BeemizerRange): display_name = "Beemizer Trap Chance" -class AllowCollect(Toggle): - """Allows for !collect / co-op to auto-open chests containing items for other players. - Off by default, because it currently crashes on real hardware.""" +class AllowCollect(DefaultOnToggle): + """Allows for !collect / co-op to auto-open chests containing items for other players.""" display_name = "Allow Collection of checks for other players"