@@ -307,7 +307,7 @@ async def _give_item(ctx: SSContext, item_name: str) -> bool:
307
307
:param item_name: Name of the item to give.
308
308
:return: Whether the item was successfully given.
309
309
"""
310
- if not (check_link_state_for_giveitem () and check_alive ()):
310
+ if not (check_link_state_for_giveitem () and check_alive () and not check_on_title_screen () ):
311
311
return False
312
312
313
313
item_id = ITEM_TABLE [item_name ].item_id # In game item ID
@@ -331,7 +331,7 @@ async def give_items(ctx: SSContext) -> None:
331
331
332
332
:param ctx: The SS client context.
333
333
"""
334
- if check_link_state_for_giveitem () and check_alive ():
334
+ if check_link_state_for_giveitem () and check_alive () and not check_on_title_screen () :
335
335
# Read the expected index of the player, which is the index of the latest item they've received.
336
336
expected_idx = dme_read_short (EXPECTED_INDEX_ADDR )
337
337
@@ -460,15 +460,23 @@ def check_ingame() -> bool:
460
460
461
461
:return: `True` if the player is in-game, otherwise `False`.
462
462
"""
463
- return dolphin_memory_engine .read_bytes (CURR_STATE_ADDR , 3 ) != 0x0
463
+ return int .from_bytes (dolphin_memory_engine .read_bytes (CURR_STATE_ADDR , 3 )) != 0x0
464
+
465
+ def check_on_title_screen () -> bool :
466
+ """
467
+ Check if the player is on the Title Screen.
468
+
469
+ :return: `True` if the player is on the title screen, otherwise `False`.
470
+ """
471
+ return int .from_bytes (dolphin_memory_engine .read_bytes (GLOBAL_TITLE_LOADER_ADDR , 1 )) != 0x0
464
472
465
473
def check_link_state_for_giveitem () -> bool :
466
474
"""
467
475
Returns a bool determining whether Link is in a valid or invalid state to receive items.
468
476
469
477
:return: True if Link is in a valid state, False if Link is in an invalid state
470
478
"""
471
- linkstate = dolphin_memory_engine .read_bytes (CURR_STATE_ADDR , 4 ) != 0x0
479
+ linkstate = dolphin_memory_engine .read_bytes (CURR_STATE_ADDR , 3 )
472
480
if linkstate in LINK_INVALID_STATES :
473
481
return False
474
482
else :
0 commit comments