Skip to content

Fix learning Saria's song multiple times#2573

Merged
fenhl merged 1 commit into
OoTRandomizer:Devfrom
djevangelia:sariaflag
May 31, 2026
Merged

Fix learning Saria's song multiple times#2573
fenhl merged 1 commit into
OoTRandomizer:Devfrom
djevangelia:sariaflag

Conversation

@djevangelia
Copy link
Copy Markdown

Ensure flag for learning Saria's song gets set for no double song learning. Fixes #239.

The set_saria_song_flag hook is in the action function that Saria switches to after a cutscene ends (in decomp, func_80AF68E4 into func_80AF6B20), placed there presumably because that's where player receives the song item in vanilla. There is a one frame window after the cutscene where player can pause, save and quit, and will have received the song but not the flag, and will learn the song again on next SFM visit.

(gameplayframe: 647) Checking Saria Byte for item: 0x0
- Byte 0x0 & 0x80 -> 0
(gameplayframe: 798) Pausing (Kaleido update) <--- save and quit = item OK, no flag
(gameplayframe: 799) Setting Saria Byte for item: 0x80
- Byte 0x80 & 0x80 -> 128

The fix moves the hook to the previous action function (i.e. one frame earlier) and checks for the same condition as the old function (that the scene is SFM).

I would really have liked to put it at cutscene start (as part of override_saria_song_check) together with receiving the item so that item and flag are handled together at the start for ease of modifying, because it's impossible anyway for player to save and quit out of a cutscene to shorten it (barring voiding out). I couldn't figure the Python out though and moving the flag there by itself risks player losing the check if voiding out before receiving the song.

Disassembly

NTSC 1.0 matching disassembly for func_80AF68E4 here
Saria actor decomp code En_Sa

Testing

Tested in Ares recent nightly build and Project64 3.0.1
Looks like this: https://www.youtube.com/watch?v=o0oshMtzxH8
Tested both songs as songs and songs as items.

0x8011b4af is flag address. Pause on holding D left:

KaleidoSetup_Update = 0x8005b860;
extern void KaleidoSetup_Update(z64_game_t* play);

if (z64_game.common.input[0].raw.pad.dl) {
    z64_game.common.input[0].pad_pressed.s = 1;
    KaleidoSetup_Update(&z64_game);
}

@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 May 10, 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 May 10, 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 May 31, 2026
@fenhl fenhl added this to the next milestone May 31, 2026
@fenhl fenhl merged commit 468f0ec into OoTRandomizer:Dev May 31, 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.

Learn Saria's Twice

2 participants