SNIClient/LttP: modern SNI prevents payload overflow (#2523)
This commit is contained in:
parent
842a15fd3c
commit
fb1cf26118
16
SNIClient.py
16
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'}
|
PutAddress_Request: SNESRequest = {"Opcode": "PutAddress", "Operands": [], 'Space': 'SNES'}
|
||||||
try:
|
try:
|
||||||
for address, data in write_list:
|
for address, data in write_list:
|
||||||
while data:
|
PutAddress_Request['Operands'] = [hex(address)[2:], hex(min(len(data), 256))[2:]]
|
||||||
# Divide the write into packets of 256 bytes.
|
if ctx.snes_socket is not None:
|
||||||
PutAddress_Request['Operands'] = [hex(address)[2:], hex(min(len(data), 256))[2:]]
|
await ctx.snes_socket.send(dumps(PutAddress_Request))
|
||||||
if ctx.snes_socket is not None:
|
await ctx.snes_socket.send(data)
|
||||||
await ctx.snes_socket.send(dumps(PutAddress_Request))
|
else:
|
||||||
await ctx.snes_socket.send(data[:256])
|
snes_logger.warning(f"Could not send data to SNES: {data}")
|
||||||
address += 256
|
|
||||||
data = data[256:]
|
|
||||||
else:
|
|
||||||
snes_logger.warning(f"Could not send data to SNES: {data}")
|
|
||||||
except ConnectionClosed:
|
except ConnectionClosed:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -716,9 +716,8 @@ class BeemizerTrapChance(BeemizerRange):
|
||||||
display_name = "Beemizer Trap Chance"
|
display_name = "Beemizer Trap Chance"
|
||||||
|
|
||||||
|
|
||||||
class AllowCollect(Toggle):
|
class AllowCollect(DefaultOnToggle):
|
||||||
"""Allows for !collect / co-op to auto-open chests containing items for other players.
|
"""Allows for !collect / co-op to auto-open chests containing items for other players."""
|
||||||
Off by default, because it currently crashes on real hardware."""
|
|
||||||
display_name = "Allow Collection of checks for other players"
|
display_name = "Allow Collection of checks for other players"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue