fix(prompts): the layouts' copy is found once the game has unpacked it, so the Talk ring follows a new face at once #1126
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
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!1126
Loading…
Reference in a new issue
No description provided.
Delete branch "gab9281/Longshot:fix/prompts-layouts-found-early"
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?
Type: fix · Risk: low · Tested on: Linux, Radeon 680M (RADV); Windows build under Wine · Needs: Windows, any GPU
Why
When you change Button prompts (or the controls) while the game runs, the Talk ring around the A/B/X/Y buttons and the ocarina's button hint are meant to change at once. Sometimes they didn't: they stayed on the face the game started with until the next start, while every other icon changed. With a PlayStation pad, that leaves ○ and × on the wrong sides of the Talk ring.
It depends on the order the game loads its files at start. When the layouts are served before the textures (4 of the 20 starts of main builds logged on this PC), the prompts look for the game's copy of the layouts before the game has finished unpacking it. They take the copy with only its header in place, find none of the 176 changed spots there, and drop them all.
See #413 (the PS5 report there: "○ at the bottom, × on the right").
How to reproduce
Seen on: Linux, RTX 3060 Laptop (NVIDIA), main builds from the past days (4 of 20 starts); not on the 680M's one start of main
Settings and switches: Button prompts on any face but Switch's (Auto with a DualSense here)
Steps: start the game (it is a race: not every start), check the log; change Button prompts in the Insert menu and talk to someone
Expected:
prompts: the layouts at …: the Talk ring and the ocarina hint follow at once, and the Talk ring follows the new faceActual: right after that line,
prompts: 176 of the layouts' 176 runs served are no longer as served: left as the game has them; at the change,268 runs written, 0 put back (some outside: at the next start)What changed
find_layoutstakes a copy only once the game has unpacked it whole: the file's last 64 bytes are there (where no change lies; else every change served is). Among whole copies, the one with the most changes as served wins, at once, even when the game has changed some since. With no whole copy, it looks again in 2 s while tries remain (30), then takes the closest copy with the header, as before.find_layouts,run_here,runs_as_servedandunpackedinhost/prompts.c;build_layoutsreads the file's last bytes (lay_tail)lay_startis published beforelay_n, andlay.baseafter the ranges, with release stores (the search runs on the controller's thread, the live change on the menu's)tests/test_prompt_layouts_found.py, game-free: a copy still being unpacked isn't taken (also with no changes served: the Switch face with the default controls); a whole one is, also in a later region and with a change the game made since; when the tries run out, the copy with the header is taken, with the changes still thereMeasurements
Verdict: nothing to measure for speed (one more 64-byte compare for each copy, every 2 s while looking). Correctness, in the game log:
e41de662176 of the layouts' 176 runs served are no longer as served268 runs written, 0 put back (some outside: at the next start)404 runs written, 176 put backBaseline: main @
e41de662is the latest main start on this PC where the layouts came first (it is a race: main @13e90a5edidn't hit it in its one start here, on the 680M); it ran on the RTX 3060 Laptop (NVIDIA), this PR on the Radeon 680M, since the NVIDIA driver could no longer make a device. The 67bf65fe build is this PR's commit with #1125 on main13e90a5e. The numbers still hold on main71b1edd8: no commit sincee41de662touches find_layouts or the order the game serves the layouts and textures in (git log e41de662..71b1edd8 -- host/prompts.cis empty).Hardware: CachyOS (Linux 7.3.4), Radeon 680M (RADV, Mesa 26.2.6), Ryzen 7 6800H, 16 GB
Scene: the kokiri-start save, Link's house; window, 1280x720
Method:
scripts/longshot_ctl.py launch --repo-save kokiri-start, A pressed through the title, thenoption set button_prompts2, 1, 5 with 8 s between; theprompts:lines of the logHow to reproduce: as above; the race shows only on some starts, so read the start's lines first
Flags and settings
None
Testing
Tested:
tests/test_prompt_layouts_found.py(5 cases),test_prompts_live.py,test_prompt_font_bind.py,test_prompt_cache_errors.py,test_menu_hooks.py;tests/run_all.py: 587 passed, 15 failed, 74 skipped; the 15 also fail on main @6c8d6e6a(17 there: test_bug_report and test_hardware_report besides), none reads the promptshost/prompts.ccompiles without warnings for Windows (llvm-mingw) and LinuxNot tested: a start where the layouts come first on the fix build (it is a race; the unit test drives that order instead); a live change and Auto on native Windows (under Wine, the chosen PS5 face loaded from a Chinese-named user folder with zh-Hans: see the comment)
Must be tested:
prompts: the layouts atin longshot_log.txt with nono longer as servedline after it; set Button prompts to PlayStation 5 in the Insert menu and talk to someone, expecting ○ on the right of the Talk ring and × at the bottom (Test Farm: @Beanstalk windows, the Talk ring after a live Button prompts change)Risks
What could break: if a build's Common.blarc had a change over its last 64 bytes and the game never matched every change, the layouts would be found only after 60 s (as on main when not found). Neither is the case for any face today.
Turning it off: revert the commit
Compatibility: Nothing changes
Issues
See #413
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
https://claude.ai/code/session_015KgSKmCc7pkXGyByWtmErh
The layouts are served before the textures, so find_layouts looked for the game's copy before the textures' pool was known: it took the first copy with the file's header, which the game was still unpacking, found none of the runs served there ("176 of the layouts' 176 runs served are no longer as served") and dropped them all. A new face or new controls then changed the Talk ring and the ocarina hint only at the next start. A copy is now taken once it is unpacked whole (the file's last bytes there, where no run served lies; else every run served there): the one with the most runs served, at once, also when the game changed some since. With none unpacked it looks again in 2 s while tries remain, then takes the closest copy with the header, as before. lay_start is published before lay_n, and lay.base after the ranges, with release stores. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015KgSKmCc7pkXGyByWtmErhTested in game: Linux (CachyOS, kernel 7.3.4), Radeon 680M on RADV (Mesa 26.2.6), the kokiri-start save in Link's house, with #1125: the layouts found whole at start (no 'no longer as served' line), then Xbox, Switch and Steam Deck set live through the control bridge each rewrote the Talk ring and the ocarina hint (404/176 runs written, the ones before put back). On main the race shows on 4 of 20 starts logged here (RTX 3060 Laptop). Windows under Wine: running now.
Windows build (llvm-mingw cross-build of this PR with #1125 and #1126 together,
v3.0.0-rc.5-21-g67bf65fe) under Wine on Linux, Radeon 680M (RADV, Mesa 26.2.6): a user folder with a Chinese name,HOS_LANGUAGE=zh-Hans,button_prompts=4(PlayStation 5) seeded, as in #413 and #897:The chosen face is read from the non-ASCII user folder (not Auto), and the layouts are found whole. Not covered under Wine: a live change (the control bridge's named pipe can't be reached from Linux) and Auto with a pad (Wine doesn't pass the DualSense through here); native Windows with a PlayStation pad is still in Must be tested.
Guide screenshotsfails on main @71b1edd8too (gpu/vk/vk_internal.h, from #1107); #1125's second commit records the review that clears it.e6fb99d41c8b1dd9f5e5CI: 9 passed; the one failure, Guide screenshots, is main's own (main @
71b1edd8fails it the same way, ongpu/vk/vk_internal.hfrom #1107; this PR changes no file it reads). #1125's second commit records that review; I'll rebase this one once #1125 merges, which turns it green. Both PRs touchhost/prompts.cin different functions and merge in either order.WIP: fix(prompts): the layouts' copy is found once the game has unpacked it, so the Talk ring follows a new face at onceto fix(prompts): the layouts' copy is found once the game has unpacked it, so the Talk ring follows a new face at onceView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.