Skip to content

Fix crash when learning non-warp songs during Nayru#2557

Merged
fenhl merged 2 commits into
OoTRandomizer:Devfrom
djevangelia:magicsong
Apr 26, 2026
Merged

Fix crash when learning non-warp songs during Nayru#2557
fenhl merged 2 commits into
OoTRandomizer:Devfrom
djevangelia:magicsong

Conversation

@djevangelia

Copy link
Copy Markdown

Fix risk of crashing when learning non-warp songs with cutscenes and playback enabled. Fixes #1089.

Vanilla bug that is actually "fixed" already in randomizer by skipping cutscenes and song playback when learning songs. However I asked in the Discord, and considering it is a fatal crash bug if encountered, I'll send in the fix in case someone would enable the song playback, either in their own build or as a setting.

For more technical background see the issue linked above. Basically increase the number of frames between Nayru killed and Ocarina effect spawning by 1, so they don't overlap.

Testing

Tested in Ares 1.47, Project64 3.0.1 and Mupen64plus 2.8.
Looks like this, before and after: https://www.youtube.com/watch?v=ds8jJb_2iNc

  • I tested only Sun's Song and Saria's song because it was difficult for me getting the other checks to work (Zelda's Lullaby never crashed for me, so I skipped it too; curiously Saria's didn't crash on Mupen). Also, from experience with my decomp fix, this fixes every song (video linked in the issue above).
  • I have not tested this with songs replaced by new songs because I don't know how those options work exactly. This fix is however placed after the song has already been played by the player, so the frame delay shouldn't need to be adjusted. (The delay between Nayru and Ocarina effects is 10 frames when not learning a song)

To re-enable cutscenes and playback for Sun's Song and Saria's song I commented out this code.
In hacks.asm:

"Ocarina Song Cutscene Overrides":
.orga 0xE09F68
    lb  t7,0x0EDE(v1) ; check learned song from sun's song
.skip 4
.skip 4
    andi t8, t7, 0x04
;addiu $t7, $zero, 1
.orga 0xE09FB0
    jal override_suns_song

"Skip Song Playback When Learning Songs"
 .orga 0xB55428
     sh      r0, 0x63ED(at)

In Cutscenes.py, patch_cutscenes:

    # Speed learning Sun's Song
    if songs_as_items:
        (comment out everything)
    else:
        (comment out everything)

    # Speed learning Saria's Song
    if songs_as_items:
        (comment out everything)
    else:
        (comment out everything)

@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 Apr 20, 2026
@fenhl fenhl added Status: Waiting for Release This PR is ready for merge, but we're holding off on it until after the next release and removed Status: Needs Review Someone should be looking at it labels Apr 20, 2026
@fenhl fenhl removed the Status: Waiting for Release This PR is ready for merge, but we're holding off on it until after the next release label Apr 26, 2026
@fenhl fenhl added this to the next milestone Apr 26, 2026
@fenhl fenhl merged commit 82241ab into OoTRandomizer:Dev Apr 26, 2026
6 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.

Crash apparently involving Nayru's and learning Sun's Song?

2 participants