fix(oot): a reused box light starts neutral, so it no longer keeps another light's dimming (Ganon's Castle's dark squares) #2666
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2666
Loading…
Reference in a new issue
No description provided.
Delete branch "PirateKingIsh/Longshot:fix/box-light-reuse"
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
In Ganon's Tower, defeat the two Iron Knuckles, leave their room through the corridor, then return. On the affected build, the corridor can flicker and a large dark rectangle appears across the room's floor, with a sharp straight boundary. Loading the saved corridor and walking back into the room also reproduces it. This change stops a reused box light from inheriting another light's dimming. The tested corridor and room remained normally lit after entry.
Box lights come from a pool. Reuse preserves the previous owner's rotation, half-extents, blend vectors and dimming factor when the new owner has no parameter resource to replace them. The observed corner box inherited a ceiling dimmer's half-extents of 17,4,17 and factor 0.1 at its own position, darkening a 34×8×34 region.
Read
game/oot_box_light.cfirst, then thelight.boxAcquiredsite andtests/test_box_light_reuse.py. The hook runs after the acquire callback, while both pool and light locks are held and before the new owner can load parameters. For the box-light class only, it restores the constructor's 52 parameter bytes and sets the transform's dirty bit. It preserves ownership, position and cached matrices; the game's transform update rebuilds the matrices, and an owner with parameters still loads them afterward.How the cause was established (all on this PC; the raw captures and memory reads are game-derived and stay local):
HOS_switches set back and one with 41RX_renderer switches set back both still gave the dark room.HOS_CONTROL_MEM=ro) then caught the reuse described above, twice, on main.Refs #886, #1305, #2458. The gameplay result covers the corridor and two-Iron-Knuckle room; other reported locations have not been verified fixed.
Testing
Tested: PirateKingIsh, Windows 11, RTX 5090, NVIDIA 621.40. Built main
86b3b9e4and candidatec6f30aea2with llvm-mingw clang 23.1.5 and the same translator revision; played the candidate in the room and both builds in Hyrule Field.09dea503(nine commits before86b3b9e4, none of them ingame/,host/or the hook-site files): the room had the dark area with a sharp straight edge in the first capture, in both door-timeline runs and in the sampler run. The sampler saw pool slots 99 and 110 go from the ceiling dimmer (half-extents 17,4,17, factor 0.1) through a released state to corner boxes with all 52 parameter bytes unchanged. Two pictures of that room on main are attached.09dea503a2efwith the same reset code, recorded two real slot reuses: both returned to neutral parameters while the legitimate ceiling dimmer retained its own parameters. Those internal observations are separate from the current candidate's visual check.getf(i) == expected; the candidate passes. It covers reset under both locks, later owner parameters, repeated reuse, another class, null input, the disabled site and preserved registers. All 142 existing site placements are unchanged; the candidate adds exactly one. Both full Windows builds completed with zero failed units.The changed-check collection returned 34 passed / 1 failed / 3 skipped;
test_site_chain.pyalso fails on clean main. The full candidate collection returned 609 passed / 68 failed / 184 skipped. Running those 68 failing checks unchanged on clean main gave 67 failures and one pass. These are directpython -I tests/run_all.pyresults, not a successful strictmise run testrun. Skips are not passes.Of the 67 shared failures, 65 have equal normalized error signals.
test_job_queue.pyfails the same two assertions with different process IDs.test_sampler_admission.pyreaches the samecreates == 1 && live.size() == 1assertion in different concurrent arms. The site-chain environment check still failed on both trees with the pinned compiler first on PATH; no test or compiler flags were changed to obtain a pass.The remaining check,
test_longshot_ctl.py, initially failed on the candidate and passed on main: expected a normal quit but observed an exit, followed by a log-file cleanup error. Its source and client scripts are identical between builds. A predeclared isolated repeat passed on both. The initial result remains an intermittent failure; no persistent candidate-only failure was established.The 67 checks that also failed on clean main
All names below are under
tests/:Still to test:
scripts/parity_gates.py ab), which hooks.md asks of a new site: Linux-only bydocs/dev/reference/parity-gates.md, so not run here, expecting the same map, positions and flags as main (by hand on a Linux machine).Measurements
Verdict: The room-entry check no longer showed the corridor flicker or dark boundary. The six completed Hyrule Field runs show no speed difference beyond their spread: median 179.8 FPS on main and 179.7 here, a measured difference of −0.043%. The automatic comparison did not produce a verdict; these are manually audited measurements with the limits below.
Setup: Windows 11, RTX 5090, NVIDIA 621.40; the same private save and stationary child-Link Hyrule Field scene. Repository default comparison settings: Render 67%, frame generation off, V-Sync off, cap setting 1000. Order main, candidate, main, candidate, main, candidate; each measured window lasted 60 seconds after at least 10 seconds of warm-up. No screenshots or profiling in these six runs. All windows were warm, with zero cold frames, and all six games exited normally. Values below are measured; settings describe configuration. Summary rows are medians of three runs per build.
86b3b9e4c6f30aea2Individual mean FPS values from the recorded frame traces:
The unmodified
dev.py abreturned 3, refusing to validate the comparison. It treats each generatedHOS_CONTROLpipe name as a settings difference; comparing main's three runs against one another reproduces that refusal. It also sampled four turf labels before warm-up: one run had settled values while the others still saidLoad an area. All six private settings files were byte-identical, had no turf override, and their logs named the same installed Hyrule Field profile. The transient-label explanation is an inference from those records and the code; no post-warm-up option snapshot was taken. The raw refusal is preserved, with no bypass or automatic-pass claim. No performance gain is claimed.Risks
The reset applies whenever this box-light class is acquired from the pool, including unvisited areas. A wrong hook position or constructor default could clear a legitimate owner's lighting parameters or leave an outdated transform. The hook runs before owner parameter loading, under both locks; the regression checks the order and preservation, and the earlier gameplay observer confirmed a legitimate dimmer retained its values. Other light classes are excluded.
Each acquisition of a box light performs a fixed small parameter reset; the field comparison found no speed difference beyond its spread, subject to the comparison limits above. No new switch, shader change, save migration or settings migration. Reverting the commit removes the reset. No player configuration change is required.
Checklist
Ready for review
mainas tested at86b3b9e4; the title is a Conventional Commit. Refresh upstream status before submission.mise run testpasses (any failure that also fails onmainis named): the named-failure exception is used here. Direct Windows runner results, skips and the intermittent check are disclosed above; no successful strict task or all-green result is claimed.main, or Measurements says why there is nothing to measure. The automatic comparison's refusal is disclosed.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened: the new regression exercises the hook and callback; existing checks are unchanged.mainand here, for a change that shows on screen: three matched field pairs, two current-candidate room views and two views of the same room on main at09dea503with the boundary. The field pairs are lighting sanity checks, not proof of the reported field bug being fixed.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Windows 11, RTX 5090, NVIDIA 621.40. Played candidate
c6f30aea2with Render resolution explicitly set and read back at 100%, cap 60 and Debug tools off. Walked from the corridor into the two-Iron-Knuckle room in Ganon's Tower: no corridor flicker noticed and no dark square or sharp boundary visible, including beside the chest. Three matched ordinary Hyrule Field views looked normal on main86b3b9e4and this candidate; the field report itself was not reproduced. Six separate alternating default-settings runs measured median 179.8 FPS on main and 179.7 here. The description discloses the automatic comparison refusal, shared test failures and remaining coverage.@rebase
I rebased this pull request onto
main(6a0636e9e7): the new head is76608c0458.Conflicts resolved
Nothing was built or run: read the resolution before merging.
Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
c6f30aea2a76608c0458Recommendation: Approve. The code is ready: only testing is left. The reported Windows run supports the fix for the dark boundary in the tested room, and the synthetic regression exercises the reset. The new hook affects box lights throughout the game, so Linux and broader gameplay coverage remain before merge. Recommend approval; not approved on the forge.
Resets recycled box-light parameters to neutral before the next owner loads its parameters, preventing a previous owner's dimming from carrying over. The change is small and targeted, but applies to box-light acquisitions in areas beyond the reported room.
Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
game/oot_box_light.c:18: The reset applies to every acquisition of this box-light class, while gameplay coverage is limited to one Windows NVIDIA system and a few locations. (more on the line) Do: Run the affected route and representative box-lit areas on Linux and the remaining applicable Tier 1 systems, and complete hook parity gate 3; record the results before merge.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the reported room on the tested Windows PC: the boundary appeared on main and was not visible on the candidate. Three alternating Hyrule Field runs per build measured median 179.8 versus 179.7 FPS, within their spread; the automatic settings comparison refused the runs, so that performance comparison has limits.
Other systems: The hook runs on worker threads under the game’s pool and light locks and affects box-light acquisitions in all areas. Windows gameplay was checked on NVIDIA; Linux, other Tier 1 hardware and additional affected locations remain untested. The fixture does not model game resource loading, scheduling or rendering.
Switches: None added, changed or removed.
Reviewed:
76608c0458against6a0636e9e7: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards and relevant hook documentation; the full diff and commit; game/oot_box_light.c and tests/test_box_light_reuse.py in full; and the changed site entries and surrounding hook registration and test helpers. Skimmed the remaining portions of the large site tables, hook documentation and test helpers. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review).Checked and fine:
Testing: No code or tests were run during this review. The author reports the targeted Windows gameplay run, baseline and candidate regression results, shared test failures and an intermittent control-check failure. CI is still running, and the pull request reports mergeable as false.
Overlaps and merge order: Not checked; network access is unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.
@ -0,0 +15,4 @@/* Rotation, half-extents, the two blend vectors and the dimming factor.Keep identity, ownership, position and the cached matrices; dirty bit 0makes the game's transform update rebuild those matrices. */for (unsigned off = 580; off < 632; off += 4)L1 (should fix): The reset applies to every acquisition of this box-light class, while gameplay coverage is limited to one Windows NVIDIA system and a few locations.
When: A box light in an unvisited area can be reused with parameters or transform behavior different from the tested castle lights; the synthetic fixture assumes the owner-loading order and cannot show the resulting lighting.
Do: Run the affected route and representative box-lit areas on Linux and the remaining applicable Tier 1 systems, and complete hook parity gate 3; record the results before merge.