fix(game): the first adult night's time lock is cleared in Hyrule Field too, through the game's setter (#1064, #2636) #2678

Merged
HumanBean merged 1 commit from dyst/Longshot:fix/mod-api-first-night into mod-api 2026-11-27 22:59:25 +00:00
Member

Summary

The port of #2655 to mod-api. 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). mod-api's repair, first_night_fix in game/crates/game-core/src/travel.rs, is a straight port of main's #2298 version and has its three faults: it skips Hyrule Field, where players are stuck; it writes the flag's live byte only, so the save keeps the lock and every load needs the repair again; and it calls the flag by another flag's name.

The game holds the clock while quest Meet_DekuTree is not Ready and the saved Bool HrlField_HasEnteredFirstTime_Adult (0x8592aa82) is 1. The Temple of Time's event (Dm_TimeTemple_0055) sets it when Link becomes adult; the only thing that clears it is the arrival event Dm_SY_BancChangeArrive_HyruleField_02, when adult Link walks out of the Market's main gate onto the field. Every other way into the field (a warp song, Farore's Wind, the Debug tab's teleport, a save made in the field with the Bool set) keeps the lock. The findings are in #2655's description.

This does what #2655 does on main, in Rust:

  • the rule is a pure function, first_night_rule: clear the Bool anywhere but where the game keeps the lock itself (the Market's maps, which hold the Temple of Time, and the Chamber of Sages SageRoom, with Link adult or his age not read), never while an event plays (the field's arrival event clears it itself);
  • first_night_fix clears it through the game's own Bool setter, GameData::set_bool_queued, as the teleport's minimap repair in the same file does, so the save's copy is cleared too. A game build without the setter is said once in the log and the Bool is left;
  • the constant's comment, the log line and HOS_GAME_FIRST_NIGHT_FIX's row in gpu/vk/switches.def give the Bool's real name: #2298 called 0x8592aa82 HrlField_isFirstNightTime_Adult, which is another Bool (0xf1024b60) that the clock never reads.

Why it stays a flag clear and not a hook on the lock's check: blocking the Temple's set would take away the game's own first night, and a check that ignores the Bool outside the Market would leave it in the save, so the clock would hold again whenever adult Link is in the Market's maps later (Prelude of Light lands in the Temple).

How to see it on mod-api: load an adult save in Hyrule Field with 0x8592aa82 set to 1 (the repository's castle-gate save with it and HyruleField_ArriveEntrance 0x804aec99 set to 1 in progress.sav); the clock stays at 20:00 and the log has no cleared line.

Files to read first: game/crates/game-core/src/travel.rs (first_night_rule, first_night_fix, and the test the_first_nights_lock_is_cleared_away_from_the_temple_and_the_ruined_market), gpu/vk/switches.def.

See #1064, #2636, #2655 (the same fix on main).

Testing

Tested: not in the game on this branch: opened without a run, at the request of the person I work for. The same rule and the same setter call ran in the game on main in #2655 (Windows 11, Ryzen 9 3900X, RTX 3080, driver 621.14, castle-gate with the Bool set): the repair off held the clock at 72000 (20:00), on cleared the Bool and the clock ran (72259 → 74700 in 20 s).

  • cargo test -p game-core --lib travel:: on Windows (Rust 1.99.1 gnullvm, llvm-mingw): 15 passed, the new one among them. It covers each case of main's tests/test_oot_first_night.py: Hyrule Field (both map names) and another map cleared; the Market's maps and SageRoom as adult left; the Market with the age not read left, the field with it not read cleared; the Market as a child cleared; the Bool already clear or not read, an empty map, an event playing: left; no setter: nothing written. And the Bool's name: flags::hash("HrlField_HasEnteredFirstTime_Adult") is 0x8592aa82, HrlField_isFirstNightTime_Adult's is not.
  • Nine mutations of the rule, each failing that test: the Hyrule Field skip put back (mod-api's rule before this), the Market or SageRoom exemption taken out, the age test inverted, an unread age clearing in the Market, the event check dropped, the Bool not read first, a missing setter ignored, an empty map cleared.
  • cargo fmt -p game-core --check and cargo clippy -p game-core --all-targets -- -D warnings: clean.
  • Not run here: the full suite (mise run test), and the game built from this branch.

Still to test:

  • Windows or Linux, this branch's build, castle-gate with 0x8592aa82 and 0x804aec99 set to 1 in progress.sav: the clock runs in Hyrule Field and the log has game: cleared the first adult night's time lock once; with HOS_GAME_FIRST_NIGHT_FIX=0 it stays at 20:00 (by hand, or @Beanstalk).
  • Windows or Linux, the same save after the repair: a save the game writes (an autosave at a map change) holds the Bool 0, and a later load of it stays clear with HOS_GAME_FIRST_NIGHT_FIX=0 (by hand).
  • Windows or Linux, an adult save walking out of the Temple of Time through the ruined Market for the first time: the night holds in the Market and ends after the gate's arrival, with no cleared line in the Market (by hand).

Measurements

Nothing to measure: a correctness fix; the repair reads one flag twice a second from the refresh that already ran it.

Risks

The repair now calls the game's own Bool setter from the inventory refresh, as the teleport's minimap repair and the Inventory editor's songs do from the game's thread; refresh_inventory already had the GuestCtx it needs. In the Market's maps and the Chamber of Sages it leaves the Bool alone with Link adult, where mod-api's repair cleared it, so the game's own first night in the ruined Market holds again until the gate. HOS_GAME_FIRST_NIGHT_FIX=0 turns the repair off; a revert is enough. No save format, options or cache changes.

Checklist

Ready for review

  • One topic, on current mod-api (d342b879e); the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says. (Not on this branch: opened without a run at the request of the person I work for; the same rule ran in the game on main in #2655.)
  • mise run test passes (any failure that also fails on main is named). (game-core's tests, rustfmt and clippy here; the full suite not run.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here. (On mod-api's rule: its Hyrule Field skip, put back as a mutation, fails the test.)
  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def. (The row's text: what the repair covers and the Bool's name; it stays kill, on by default.)
  • Docs updated. (The functions' comments and the switch's row.)
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary The port of #2655 to `mod-api`. 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). `mod-api`'s repair, `first_night_fix` in `game/crates/game-core/src/travel.rs`, is a straight port of main's #2298 version and has its three faults: it skips Hyrule Field, where players are stuck; it writes the flag's live byte only, so the save keeps the lock and every load needs the repair again; and it calls the flag by another flag's name. The game holds the clock while quest `Meet_DekuTree` is not `Ready` and the saved Bool `HrlField_HasEnteredFirstTime_Adult` (0x8592aa82) is 1. The Temple of Time's event (`Dm_TimeTemple_0055`) sets it when Link becomes adult; the only thing that clears it is the arrival event `Dm_SY_BancChangeArrive_HyruleField_02`, when adult Link walks out of the Market's main gate onto the field. Every other way into the field (a warp song, Farore's Wind, the Debug tab's teleport, a save made in the field with the Bool set) keeps the lock. The findings are in #2655's description. This does what #2655 does on main, in Rust: - the rule is a pure function, `first_night_rule`: clear the Bool anywhere but where the game keeps the lock itself (the Market's maps, which hold the Temple of Time, and the Chamber of Sages `SageRoom`, with Link adult or his age not read), never while an event plays (the field's arrival event clears it itself); - `first_night_fix` clears it through the game's own Bool setter, `GameData::set_bool_queued`, as the teleport's minimap repair in the same file does, so the save's copy is cleared too. A game build without the setter is said once in the log and the Bool is left; - the constant's comment, the log line and `HOS_GAME_FIRST_NIGHT_FIX`'s row in `gpu/vk/switches.def` give the Bool's real name: #2298 called 0x8592aa82 `HrlField_isFirstNightTime_Adult`, which is another Bool (0xf1024b60) that the clock never reads. Why it stays a flag clear and not a hook on the lock's check: blocking the Temple's set would take away the game's own first night, and a check that ignores the Bool outside the Market would leave it in the save, so the clock would hold again whenever adult Link is in the Market's maps later (Prelude of Light lands in the Temple). How to see it on `mod-api`: load an adult save in Hyrule Field with 0x8592aa82 set to 1 (the repository's `castle-gate` save with it and `HyruleField_ArriveEntrance` 0x804aec99 set to 1 in `progress.sav`); the clock stays at 20:00 and the log has no `cleared` line. Files to read first: `game/crates/game-core/src/travel.rs` (`first_night_rule`, `first_night_fix`, and the test `the_first_nights_lock_is_cleared_away_from_the_temple_and_the_ruined_market`), `gpu/vk/switches.def`. See #1064, #2636, #2655 (the same fix on main). ## Testing **Tested:** not in the game on this branch: opened without a run, at the request of the person I work for. The same rule and the same setter call ran in the game on main in #2655 (Windows 11, Ryzen 9 3900X, RTX 3080, driver 621.14, castle-gate with the Bool set): the repair off held the clock at 72000 (20:00), on cleared the Bool and the clock ran (72259 → 74700 in 20 s). - `cargo test -p game-core --lib travel::` on Windows (Rust 1.99.1 gnullvm, llvm-mingw): 15 passed, the new one among them. It covers each case of main's `tests/test_oot_first_night.py`: Hyrule Field (both map names) and another map cleared; the Market's maps and SageRoom as adult left; the Market with the age not read left, the field with it not read cleared; the Market as a child cleared; the Bool already clear or not read, an empty map, an event playing: left; no setter: nothing written. And the Bool's name: `flags::hash("HrlField_HasEnteredFirstTime_Adult")` is 0x8592aa82, `HrlField_isFirstNightTime_Adult`'s is not. - Nine mutations of the rule, each failing that test: the Hyrule Field skip put back (`mod-api`'s rule before this), the Market or SageRoom exemption taken out, the age test inverted, an unread age clearing in the Market, the event check dropped, the Bool not read first, a missing setter ignored, an empty map cleared. - `cargo fmt -p game-core --check` and `cargo clippy -p game-core --all-targets -- -D warnings`: clean. - Not run here: the full suite (`mise run test`), and the game built from this branch. **Still to test:** - Windows or Linux, this branch's build, `castle-gate` with 0x8592aa82 and 0x804aec99 set to 1 in `progress.sav`: the clock runs in Hyrule Field and the log has `game: cleared the first adult night's time lock` once; with `HOS_GAME_FIRST_NIGHT_FIX=0` it stays at 20:00 (by hand, or `@Beanstalk`). - Windows or Linux, the same save after the repair: a save the game writes (an autosave at a map change) holds the Bool 0, and a later load of it stays clear with `HOS_GAME_FIRST_NIGHT_FIX=0` (by hand). - Windows or Linux, an adult save walking out of the Temple of Time through the ruined Market for the first time: the night holds in the Market and ends after the gate's arrival, with no `cleared` line in the Market (by hand). ## Measurements Nothing to measure: a correctness fix; the repair reads one flag twice a second from the refresh that already ran it. ## Risks The repair now calls the game's own Bool setter from the inventory refresh, as the teleport's minimap repair and the Inventory editor's songs do from the game's thread; `refresh_inventory` already had the `GuestCtx` it needs. In the Market's maps and the Chamber of Sages it leaves the Bool alone with Link adult, where `mod-api`'s repair cleared it, so the game's own first night in the ruined Market holds again until the gate. `HOS_GAME_FIRST_NIGHT_FIX=0` turns the repair off; a revert is enough. No save format, options or cache changes. ## Checklist ### Ready for review - [x] One topic, on current `mod-api` (`d342b879e`); the title is a Conventional Commit. - [ ] Tested on my own PC, in the game for a change the game runs, as Testing says. (Not on this branch: opened without a run at the request of the person I work for; the same rule ran in the game on main in #2655.) - [ ] `mise run test` passes (any failure that also fails on `main` is named). (game-core's tests, rustfmt and clippy here; the full suite not run.) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. (On `mod-api`'s rule: its Hyrule Field skip, put back as a mutation, fails the test.) - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. (The row's text: what the repair covers and the Bool's name; it stays `kill`, on by default.) - [x] Docs updated. (The functions' comments and the switch's row.) - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(game): the first adult night's time lock is cleared in Hyrule Field too, through the game's setter (#1064, #2636)
Some checks failed
Third-party parts / The same as upstream (pull_request) Has been skipped
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 26s
Third-party parts / As their notes say (pull_request) Successful in 35s
PR description / Description follows the template (pull_request_target) Failing after 6s
3dc35907b8
The port of #2655 (main's oot_first_night_fix) to game-core's first_night_fix. The flag 0x8592aa82 is
HrlField_HasEnteredFirstTime_Adult: the Temple of Time sets it, and only the arrival from the Market's main gate
onto the field clears it. The repair skipped Hyrule Field, where every other way in (a warp song, Farore's Wind,
the teleport, a save made there) leaves the clock held, and wrote the live byte only, so the save kept the lock.

It now clears the flag anywhere but the Market's maps and the Chamber of Sages with Link adult (the game's own
lock), never during an event, through GameData::set_bool_queued (the save's copy too); a build without the setter
is said once. The rule is first_night_rule, tested with each case of main's tests/test_oot_first_night.py and the
flag's name hash. The switch row says what it covers and the flag's real name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean changed title from WIP: fix(game): the first adult night's time lock is cleared in Hyrule Field too, through the game's setter (#1064, #2636) to fix(game): the first adult night's time lock is cleared in Hyrule Field too, through the game's setter (#1064, #2636) 2026-11-27 22:59:19 +00:00
HumanBean merged commit 391e5aa972 into mod-api 2026-11-27 22:59:25 +00:00
HumanBean deleted branch fix/mod-api-first-night 2026-11-27 22:59:25 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2678
No description provided.