From 39dcc0a73c561850279be1d6d1ff548cd443ee6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= <159546+serprex@users.noreply.github.com> Date: Sat, 18 Apr 2026 21:21:29 +0000 Subject: [PATCH] Triforce Hunt: drain queue before credits (#6519) --- soh/soh/Enhancements/randomizer/hook_handlers.cpp | 10 ++++++++-- soh/soh/Enhancements/randomizer/randomizer.cpp | 8 +------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index ee2aecd551..d6ff0dc5be 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -2629,8 +2629,14 @@ void RandomizerOnPlayerUpdateHandler() { } if (!GameInteractor::IsGameplayPaused() && RAND_GET_OPTION(RSK_TRIFORCE_HUNT).IsNot(RO_TRIFORCE_HUNT_OFF)) { - // Warp to credits - if (GameInteractor::State::TriforceHuntCreditsWarpActive) { + // Warp to credits once item queue has drained to avoid losing queued items + if (GameInteractor::State::TriforceHuntCreditsWarpActive && randomizerQueuedChecks.empty() && + randomizerQueuedCheck == RC_UNKNOWN_CHECK) { + gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_TRIFORCE_COMPLETED] = + static_cast(GAMEPLAYSTAT_TOTAL_TIME); + gSaveContext.ship.stats.gameComplete = 1; + Play_PerformSave(gPlayState); + Notification::Emit({ .message = "Game autosaved" }); gPlayState->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; gSaveContext.nextCutsceneIndex = 0xFFF2; gPlayState->transitionTrigger = TRANS_TRIGGER_START; diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 924d22ab66..71f88e67d3 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3902,13 +3902,7 @@ extern "C" u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) { if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT) == RO_TRIFORCE_HUNT_WIN) { - gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_TRIFORCE_COMPLETED] = - static_cast(GAMEPLAYSTAT_TOTAL_TIME); - gSaveContext.ship.stats.gameComplete = 1; - Play_PerformSave(play); - Notification::Emit({ - .message = "Game autosaved", - }); + // Save and warp are deferred until item queue drains GameInteractor_SetTriforceHuntCreditsWarpActive(true); } }