@@ -187,17 +187,18 @@ def close(self):
187187 self .transport = None
188188
189189
190- async def write_bytes (self , address , data , timeout = 2 ):
191- command = struct .pack ('>BII' , 0x02 , address , len (data )) + data
192- checksum = sum (command ) & 0xFF
193- command += checksum .to_bytes (1 , 'big' )
190+ async def write_bytes (self , data , timeout = 2 ):
191+ data_len = len (data )
192+ command = data_len .to_bytes (data_len ) + data
193+
194+ logger .info (f"Command: { command } | Data Length: { data_len } | Data: { data } " )
194195
195196 response = await self ._send_command_queued (command , timeout )
196197
197198 if len (response ) == 1 :
198199 return True
199200 else :
200- raise Exception (f"Write failed at address { address } " )
201+ raise Exception (f"Write failed with data { data } " )
201202
202203class WSRCommandProcessor (ClientCommandProcessor ):
203204 """
@@ -318,8 +319,13 @@ async def _give_item(self, item_name: str) -> bool:
318319
319320 item_id = wsr_items [item_name ].item_id
320321
322+ logger .info (f"item id: { item_id } " )
323+
324+ item_id_byte : bytes = item_id .to_bytes (2 , byteorder = "big" )
325+
326+ logger .info (f"item id in bytes: { item_id_byte } " )
321327
322- if await self .wii_memory_client .write_bytes (0x80532020 , item_id . to_bytes ( 1 , byteorder = "big" ) ):
328+ if await self .wii_memory_client .write_bytes (item_id_byte ):
323329 logger .info ("sent item" )
324330 return True
325331
@@ -344,7 +350,6 @@ async def do_sync_task(ctx: WSRContext) -> None:
344350 while not ctx .exit_event .is_set ():
345351 try :
346352 if ctx .is_hooked ():
347-
348353 await ctx .give_items ()
349354 #await ctx.check_locations()
350355 if ctx .awaiting_rom :
0 commit comments