LttPClient: add snes write command
This commit is contained in:
parent
10837e75b2
commit
e4838f6d2b
|
@ -479,6 +479,7 @@ async def process_server_cmd(ctx: CommonContext, args: dict):
|
||||||
|
|
||||||
elif cmd == "Bounced":
|
elif cmd == "Bounced":
|
||||||
tags = args.get("tags", [])
|
tags = args.get("tags", [])
|
||||||
|
# we can skip checking "DeathLink" in ctx.tags, as otherwise we wouldn't have been send this
|
||||||
if "DeathLink" in tags and ctx.last_death_link != args["data"]["time"]:
|
if "DeathLink" in tags and ctx.last_death_link != args["data"]["time"]:
|
||||||
ctx.on_deathlink(args["data"])
|
ctx.on_deathlink(args["data"])
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,18 @@ class LttPCommandProcessor(ClientCommandProcessor):
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _cmd_snes_write(self, address, data):
|
||||||
|
"""Write the specified byte (base10) to the SNES' memory address (base16)."""
|
||||||
|
if self.ctx.snes_state != SNESState.SNES_ATTACHED:
|
||||||
|
self.output("No attached SNES Device.")
|
||||||
|
return False
|
||||||
|
|
||||||
|
snes_buffered_write(self.ctx, int(address, 16), bytes([int(data)]))
|
||||||
|
asyncio.create_task(snes_flush_writes(self.ctx))
|
||||||
|
self.output("Data Sent")
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
class Context(CommonContext):
|
class Context(CommonContext):
|
||||||
command_processor = LttPCommandProcessor
|
command_processor = LttPCommandProcessor
|
||||||
game = "A Link to the Past"
|
game = "A Link to the Past"
|
||||||
|
|
Loading…
Reference in New Issue