fix(oot): the first adult night's time lock is cleared in Hyrule Field too, and kept where the game keeps it #2655
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2655
Loading…
Reference in a new issue
No description provided.
Delete branch "dyst/Longshot:fix/oot-first-night-field"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adult Link's clock can stay at 20:00 for good in Hyrule Field: the Sun's Song and Debug tools > Set time change it for a moment, then it snaps back (#1064, #2636). #2298 fixed the case of a save outside the field and left the field alone on purpose; that is where players are still stuck.
The game holds the clock (
f_8347c020, called fromf_803edf70) while questMeet_DekuTree(0x4dbca27f) is notReadyand the saved BoolHrlField_HasEnteredFirstTime_Adult(0x8592aa82) is 1. The Temple of Time's event (Dm_TimeTemple_0055) sets the Bool when Link becomes adult; the only thing that clears it is the arrival eventDm_SY_BancChangeArrive_HyruleField_02, which plays when adult Link walks out of the Market's main gate (Market_EntrancetoHyruleField_FrontOfMarket). So the lock belongs to the Temple and the ruined Market; reaching the field any other way (a warp song, Farore's Wind, the Debug tools' teleport, or a save made in the field with the Bool set) keeps it there. #2636's log shows the second half: #2298's repair clears the Bool three times in one session, each after a load away from the field, and every load of the player's adult save inHyruleField_Adultis back at night.This turns the repair around:
oot_first_night_fixnow clears the Bool in Hyrule Field and everywhere else, and leaves it alone only where the game keeps the lock: the Market's maps (the Temple of Time is inside them) and the Chamber of Sages (SageRoom), with Link adult. As before, never while an event is running (the field's arrival event clears it itself) andHOS_OOT_FIRST_NIGHT_FIX=0turns it off. It now clears through the game's own Bool setter (oot_gamedata_queue_bool, as the teleport's minimap repair does), which queues the save's copy too: #2298 wrote the live byte only (game_flag_set_bool), so the save kept the lock and every load needed the repair again, which is what #2636's log shows. A game build without that setter is said once in the log and the Bool is left. It also names the Bool by its real name: #2298 called 0x8592aa82HrlField_isFirstNightTime_Adult, which is another Bool (0xf1024b60) that the clock never reads.How to see it on main: load an adult save in Hyrule Field with 0x8592aa82 set to 1 (or the repository's
castle-gatesave with it, andHyruleField_ArriveEntrance0x804aec99, set to 1 inprogress.sav: each is a {hash, u32 value} pair); the clock stays at 20:00 and the log has noclearedline.Files to read first:
game/oot_tools.c(oot_first_night_fix),tests/test_oot_first_night.py,gpu/vk/switches.def.Fixes #1064, fixes #2636. Follows #2298.
Testing
Tested: Windows 11 Pro (22631), AMD Ryzen 9 3900X, NVIDIA GeForce RTX 3080 (driver 621.14), the game packed over main's shared base
09dea503awith this branch (longshot v3.2.0-58-gfd29ab9e1), through the job queue, one game at a time, test profile, headless, through the control bridge. The save: the repository'scastle-gate(Hyrule Field) withHrlField_HasEnteredFirstTime_AdultandHyruleField_ArriveEntranceset to 1 inprogress.sav(the save was made by teleport, so it lacks the arrival Bool, which holds the clock by itself). After A into play, 20 s of samples: the Bool throughsubscribeflags, and the world clock's seconds of the day throughmem_read(HOS_CONTROL_MEM=ro) at[[[0x84c9e898]] + 0x510] + 0x28.HOS_OOT_FIRST_NIGHT_FIX=0(main's repair does the same in the field: it returns before reading the Bool there): the Bool 1 in all 36 samples, the clock 72000 → 72000 (20:00, held), noclearedline.oot: cleared the first adult night's time lock (the save was in HyruleField_Child, away from the Temple and the ruined Market)once.465828c0c, live byte only) and once more at this head gave the same: held at 72000 with the repair off, running (72140 → 74544, 72281 → 74687) with it on.tests/test_oot_first_night.py: on mainFAIL: the flag is cleared in Hyrule Field: flag 1 (want 0), clears 0 (want 1); here PASS with clang and llvm-mingw's gcc, the repair on and off. Twelve mutations of the fix, each caught by its own case: the Hyrule Field skip put back, the Market or SageRoom exemption taken out, the age test inverted or an unreadable age clearing in the Market, the event or switch check dropped, a write without reading the Bool first, a missing setter ignored or logged every refresh, the live byte written instead of the queued setter (the save's copy is cleared too), and 1 written.tests/run_all.py --changedat465828c0c(the checks reading the changed files, 860 of them:switches.defis read widely): 665 passed, 66 failed, 129 skipped; the same 66 fail on main86b3b9e4fthrough the runner (0 of them pass there).tests/run_all.py --jobs 6(every check, not--strict) atfd29ab9e1: 665 passed, 66 failed, 129 skipped (tools missing on Windows: spirv-val, the Vulkan headers); the 66 are the same files that fail on main86b3b9e4fthrough the runner (0 of them pass there).Still to test:
HOS_OOT_FIRST_NIGHT_FIX=0(by hand; the run here cleared the live value through the game's setter but no autosave came in it).clearedline in the Market (by hand; the game-free test covers the rule, no save in the repository is adult).@Beanstalka Linux run of castle-gate with the Bool set, or by hand). The change is host C with no OS-specific code.Measurements
Verdict: fixed in Hyrule Field: the Bool goes 1 → 0 and the clock runs (72259 → 74700 in 20 s) where it stood at 72000 with the repair doing what main does there.
Setup: as in Tested; one run each side, the same runtime with the switch off and on (the A/B's other side is the switch, since main's repair returns before reading the Bool in Hyrule Field).
Baseline: this PR's runtime with
HOS_OOT_FIRST_NIGHT_FIX=0, not a build of main. In Hyrule Field main'soot_first_night_fixreturns before it reads the Bool, so the switch off runs main's path there; the game-free test shows main itself failing at the same case (the flag is cleared in Hyrule Field: flag 1).HOS_OOT_FIRST_NIGHT_FIX=0) @fd29ab9e1fd29ab9e10x8592aa82over 20 s in HyruleField_Childcleared the first adult night's time locklineRisks
The repair calls the game's own Bool setter, as the teleport's minimap repair and the Inventory editor's songs do, from the same per-frame hook; the save should keep the cleared Bool from the game's next save on (the setter's own behaviour, as the minimap repair relies on; seen in the game here only as the live value: in Still to test). In the Market's maps and the Chamber of Sages it now leaves the Bool alone with Link adult, where #2298 cleared it, so the game's own first night in the ruined Market holds again until the gate (as the game designed it). A child in the Market with the Bool set (a state the game itself doesn't leave) is still cleared. If the age can't be read there, the Bool is left (the lock's own maps keep it).
HOS_OOT_FIRST_NIGHT_FIX=0turns the repair off; a revert is enough. No save format, options or cache changes.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (CI's strict suite on Linux, run 55763 atfd29ab9e1: part 1/2 passed; part 2/2 422 passed, 2 failed:tests/test_lifter.py, which fails on main's own run 55611 at86b3b9e4ftoo, andtests/test_control.py, whoserelaunchcase timed out after 180 s on the runner after all its other cases passed; it passed on main in 15.7 s and builds none of the files this changes (tests/control_test.ccompiles nogame/oot_tools.cand reads noswitches.def): a re-run of that job is asked for in a comment. The CI's guide-screenshot and Rust jobs fail on main's run 55611 the same way.)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.gpu/vk/switches.def. (The row's text changed: what the repair covers and the Bool's name; it stayskill, on by default.)tests/that reads changed source is updated, not weakened. (tests/test_oot_first_night.py;tests/perf_pose_test.c's stub ofoot_first_night_fixkeeps its signature and needs no change.)strncmpand the flag helpers it already used.)Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in the game: Windows 11 Pro, Ryzen 9 3900X, RTX 3080 (NVIDIA 621.14), at
fd29ab9e1packed over main's base09dea503a, through the queue and the control bridge: the repository's castle-gate save in Hyrule Field withHrlField_HasEnteredFirstTime_Adult(0x8592aa82) andHyruleField_ArriveEntranceset to 1. WithHOS_OOT_FIRST_NIGHT_FIX=0(main's path in the field) the Bool stayed 1 and the clock stood at 72000 s (20:00) for 20 s; with the repair the Bool was 0 from the first sample, the log saidoot: cleared the first adult night's time lockonce, and the clock ran 72259 → 74700 in 20 s.CI at
fd29ab9e1(run 55763), against main's own run 55611 at86b3b9e4f:settings-graphics.png:gpu/vk/device_policy.hchanged since its reviewed revision); the same output here.tests/test_lifter.pyfails on main too.tests/test_control.pypassed every case, then itsrelaunchcase timed out after 180 s; it passed on main in 15.7 s, andtests/control_test.cbuilds none of the files this changes (nogame/oot_tools.c, noswitches.def). A runner hiccup by all signs: could a maintainer re-run that job?WIP: fix(oot): the first adult night's time lock is cleared in Hyrule Field too, and kept where the game keeps itto fix(oot): the first adult night's time lock is cleared in Hyrule Field too, and kept where the game keeps itThe same fix for
mod-api, whose Rust repair (game/crates/game-core/src/travel.rs) is a straight port of #2298's and has the same three faults: #2678 (WIP, not yet run in the game). Whoever mergesmainintomod-apiafter this one can takeoot_tools.c's side as deleted: #2678 carries the change.