Repository navigation
Prevent softlock when Hookshot cannot spawn on equip - #2571
Conversation
Hook into Player_InitHookshotIA Asm check if Hookshot actor is NULL If so, Player_UseItem item none
copying this new comment from the issue since this does not actually resolve the hyrule field glitch from occuring, I dont know if this is worth. You could pull any actor and cause a weird interaction. It reacts in weird ways, from sound to explosives or removing cutscene parts from what I've read. Hookshot being extra special it would be worth scrolling thru discord to see how many times just loading the boulder coming from the bottom of the map to remote grotto generating a crash would be. It's been awhile since hearing about it (and I've only experienced it maybe 1-2 times myself in rando). Not really in favor of the force unequipping as a quick and dirty fix for this issue. some discussion from fig on how the memory overflow and heap with hookshot interaction. also would be nice to determine how this affects the heap fragmentation usage in other locations in gameplay_keep. Which was my other question. devs can review it and determine if they want this or not, this is just my opinion. |
Difference being that Hookshot softlocks the game, making the player unable to continue playing.
The issue is not the memory shortage. The issue is that the game doesn't check if the Hookshot actor spawns or not, which results in a softlock that prevents the player from playing the game. This does not depend on why the actor cannot spawn - memory shortage, or the correct object not being loaded, will cause this. As for memory shortage/Hyrule Field glitch, considering this has been a known problem for over 20 years and considering no fix has been made for it yet, I believe it is better to start off with a short fix that isn't specific to the memory shortage issue (and honestly just is what should have been in the base game - see below regarding MM) that prevents one fatal consequence of it. (This is not in any way intended to undermine the hard work of all contributors here and to other hacks! Merely an observation that a fix to prevent memory shortage problems will not come soon.)
Thanks for informational link. It is also revealed in the discussion that Majora's Mask actually already has exactly this change, it's as if copy-pasted.
If the actor doesn't spawn there is no change of the heap. |
|
I only want to point out that it can softlock the game if you have no momentum or if your momentum doesn't take you anywhere that eventually results in a scene transition. I don't think anyone has ever done anything useful with the glitched state though, so that probably doesn't matter too much. |
If Hookshot actor cannot spawn, use item none to prevent softlock. Half-fixes #2006.
If the Hookshot item overlay or actor cannot spawn when changing item, player gets softlocked. This can occur due to memory shortage (such as the Hyrule Field glitch) or the object not being loaded (if child; it requires adult Link object). The function that spawns the Hookshot,
Player_InitHookshotIA, doesn't check whether the actor was successfully spawned.This fix makes so that if the actor doesn't spawn,
Player_UseItemis called with item none (0xFF) to change to a different item. This fixes both adult Link and child Link softlocking.Disassembly
NTSC 1.0 matching disassembly for
Player_InitHookshotIAhereDecomp C code:
Testing
Tested in Ares recent nightly build and Project64 3.0.1.
Looks like this: https://www.youtube.com/watch?v=kXxg5GH9IZc
It can be tested as child by force-equipping Hookshot to C button, such as pressing D left with this added to
debug_utilities:For Hyrule Field, I spawned extra actors to fill memory. I used the object loading function from my Ice Trap PR to spawn Like Likes (take enormous memory due to a 0x2000 unused space in their actor), and extra trees.