Skip to content

Conversation

@mracsys
Copy link

@mracsys mracsys commented Jan 8, 2025

The previous hack in EnKo_CanSpawn saved register $ra to temp register t3 before jumping to a custom function controlling Fado's spawn behavior. While the N64 and emulators handled this without problems, Wii VC and Dolphin frequently but inconsistently crash with this code. The spawn hacks are revised to move the custom function call to the end of EnKo_Init after EnKo_CanSpawn is called, eliminating the need for caching any registers.

The crash is difficult to reproduce consistently, but with these changes it hasn't happened through >100 actor spawns using the attached plando. Odd Potion is in the top left chest of Mido's House for easy tests for all of Fado's spawn conditions.

trade-quest-rework-adult-fado.txt

Thanks to RealRob, flagrama, and Retropolis for identifying the possible cause.

@fenhl fenhl added Type: Bug Something isn't working Component: ASM/C Changes some internals of the ASM/C libraries Status: Needs Review Someone should be looking at it labels Jan 8, 2025
Copy link

@rrealmuto rrealmuto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming the original theory on why this crashes in the first place was correct, this new hack looks like it should fix the problem. However I'm concerned that without some additional checks it may inadvertently prevent spawning other kokiri actors.

@fenhl fenhl requested a review from rrealmuto January 27, 2025 21:07
Copy link

@rrealmuto rrealmuto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only request would be, in the spirit of improving how we organize the hacks, to move the new fado hacks out into their own file. Otherwise these hacks look good.

@mracsys
Copy link
Author

mracsys commented Jan 27, 2025

Is there a preferred filename to move it to? Or put it with the rest of the trade quest hacks in trade_quests.asm?

@rrealmuto
Copy link

so my preferred way of organizing hacks is placing them in ASM/hacks/ovl_nameofoverlay.asm and then including that at the bottom of hacks.asm

so for this, a new file ASM/hacks/ovl_en_ko.asm

@rrealmuto
Copy link

Looking at reorganizing things a bit with #2354 but that name should be good to go along with that

@mracsys mracsys force-pushed the fado_spawn_wiivc_fix branch from 3a83f43 to deb0b8d Compare January 28, 2025 01:04
@rrealmuto
Copy link

🥰

@fenhl fenhl requested a review from rrealmuto February 2, 2025 09:28
Copy link

@rrealmuto rrealmuto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Also Rebbacus offered a pretty good explanation of the original crash over in the discord.

@fenhl fenhl removed the Status: Needs Review Someone should be looking at it label Feb 2, 2025
@fenhl fenhl added this to the next milestone Feb 2, 2025
@fenhl fenhl merged commit b1160a3 into OoTRandomizer:Dev Feb 2, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: ASM/C Changes some internals of the ASM/C libraries Type: Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants