fix(prompts): serve the game's own size table with the font's entry raised, never a copy made at build time #2092
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2092
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:fix/prompts-own-size-table"
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
Some players crash at every start, just after the first texts and the button prompts load:
0xc0000005 (read 0x100000001030, guest 0x1030)onsead::MainThread, guest backtrace0x83b51a3c 0x83b7b47c 0x83b7aaa4 0x83b79e88 0x802eaad8 0x80966920 ...(rc.3, rc.5, nightly-145, several NVIDIA PCs). One player got past it by deletingprompts/rsizetable.zsandprompts/External.bfotf.Why. The button prompts' font is bigger than the game's, and the game drops any file that is bigger than its entry
in the resource size table. So the prompts served a copy of the table with the font's entry raised. That copy,
prompts/rsizetable.zs, was made at build time bynx2/prompt_assets.pyfrom the RomFS table whose name sorts first.hos_prompts_romfsthen served it for any size table the game opened, whatever its name. If the RomFS has anotherversion's table next to the game's (a base dump with an update laid over it:
Product.100sorts beforeProduct.111),or the RomFS is a different dump from the one the build read, the game gets a table that isn't its own. Files that are
bigger in this version than that table allows get dropped. The boot code that builds the game's systems
(
0x83b79e88 → 0x83b7aaa4 → 0x83b7b47c, the virtual create at0x83b7b478) then builds a component whose systemobject was never made. In the reports that component is
0x83b51a00: it loads the global at0x84ea2ea8, which isstill null, and reads
[x8 + 0x1030]at0x83b51abc. Thex1 = 0x805c5690in the crash record is the callback thatload passes on. Without the prompts' copy, the game reads its own table and starts normally.
Reproduced on
main: I served a table whose entries are smaller than the game's (every entry halved, the font'sraised as before). The game aborts at the start on
sead::MainThreadwith guest backtrace0x8351c290 0x80810728 0x83b7b47c 0x83b7aaa4 0x83b79e88 0x802eaad8 0x80966920 0x80966840 0x80966780 0x80f48d04 0x81223200. That is the same boot path as the reports, from the same create call. The leaf is different becausedifferent files were dropped.
What changes
host/prompts.c: the table served for the one the game opens is the RomFS's own table of that name with onlythe font's entry raised (
own_sizes, written once per start tocache/prompts/rsizetable.zs). The raise uses thereal sizes: our font plus the allowance the game's entry gives its own font (
hos_prompts_font_entry). If the RomFShas no table of that name (another game version), the table can't be read, or it has no font entry, the game gets its
own table and the prompts' font is left out (the Switch icons in texts). A mod's own table gets this table merged in,
as before (
sizes).host/prompts.c: the prompts' copies of the game's layouts and textures (prompts/Common.blarc,prompts/Common.bntx) are served only when they are the same size as the RomFS's files (same_as_game). If not, thegame gets its own files.
host/mods.c: the merged table for mods starts from the game's own table with the same font raise, never fromprompts/rsizetable.zs.nx2/prompt_assets.py: the build no longer makes a size table.docs/dev/reference/mods.md.Read first:
own_sizes,hos_prompts_font_entryandbuildinhost/prompts.c, thenfit_sizesinhost/mods.c.Fixes #1109. Fixes #1192.
Testing
Tested: Linux (CachyOS), NVIDIA RTX 3090, driver 620.70.06, this PR @
0b630e64as a pack over main 9dd41326's base, through the job queue. A memory tour fromkokiri-start: a clean start, in play, Kokiri Forest, clean quit; the log hasprompts: System/Resource/ResourceSizeTable.Product.111.Nin_Ounce_NVN2.rsizetable.zs: the game's own table, the font's entry raised from 14856 to 55376 bytes, and the prompts load their Switch icons. Then the same with main's reproduction file (a table with every entry halved) left in the runtime asprompts/rsizetable.zs: the same clean start into play and the same log line, so the file is ignored, where main aborts onsead::MainThreadwith it.main@9dd41326with a size table that isn't the game's inprompts/rsizetable.zs(every entry halved): abortsat the start on
sead::MainThread, guest backtrace... 0x83b7b47c 0x83b7aaa4 0x83b79e88 0x802eaad8 ..., the bootpath of #1109.
tests/test_prompts_size_table.py(8 cases). It usestests/test_mods_size_table.py's fixture, which isnow a function of its own:
host/mods.candhost/prompts.cas they are, over real folders. I updatedtests/test_mods_size_table.py,tests/test_mods_sizes.pyandtests/test_mods_list.pyfor the change: the font'sreal table key, the RomFS font, and a stub for the new function. I didn't run any test suite on this PC (this
PC's rule); CI on the forge runs them.
host/prompts.candhost/mods.cpass-fsyntax-only -Wall -Wextrawith gccand clang.
Still to test:
clean start, the controller's icons in texts, and
prompts: System/Resource/ResourceSizeTable.Product.111...: the game's own table, the font's entry raised from ... to ... bytesin the log (@Beanstalk start the game on WindowsNVIDIA with button prompts set to Xbox and check the start reaches the title screen with Xbox icons in the texts)
prompts/rsizetable.zsandprompts/External.bfotfif they deleted them(or rebuild), then start. Expect no crash (by hand)
Measurements
Verdict: the crash's cause is gone: the game is never served a table that isn't its own. Nothing per frame
changes. At the start, one ~1.7 MB table is read, decompressed and written once.
Setup: Linux, RTX 3090. The bug reproduced on
mainwith a table that isn't the game's, against this PR with the samefolder; the game-free test failing on
main(it servesgame/prompts/rsizetable.zs) and passing here (CI).9dd413260b630e64prompts/rsizetable.zsthat isn't the game'ssead::MainThread, the #1109 boot pathtests/test_prompts_size_table.pyRisks
start on the loader thread. Small, but not measured.
icons instead of crashing. The log says why (
prompts: ...: the game's own size table and its own icons in texts).and the log says so.
host/prompts.candnx2/prompt_assets.py) and writes noprompts/rsizetable.zs. A leftover one is ignored. Saves and settings don'tchange.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (Not run on this PC, by its rule; CI on the forge runs it.)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here. (Written to fail onmainbecausemainserves the build's table for any name; not run here, CI runs it.)tests/that reads changed source is updated, not weakened.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
https://claude.ai/code/session_017vw8e2uxGKQxzDeQ15jjNK
Tested in game: Linux, RTX 3090, NVIDIA 620.70.06, this PR @
0b630e64over main 9dd41326's base, through the job queue: kokiri-start into play in Kokiri Forest, clean quit; log: the game's own size table served with the font's entry raised 14856 -> 55376 bytes; prompts' icons load. Again with main's crashing (halved) prompts/rsizetable.zs left in the runtime: the same clean start, the file ignored.@Beanstalk start the game on Windows NVIDIA with button prompts set to Xbox and check the start reaches the title screen with Xbox icons in the texts; the log should have 'prompts: System/Resource/ResourceSizeTable.Product.111...: the game's own table, the font's entry raised from ... to ... bytes'. Also a start on Windows AMD and Intel: expect the same line and a clean start.
Beanstalk test farm · 🔄 testing (0 of 3 reports so far)
Commit
0b630e6· approved by HumanBean (reviewed) · dashboard⚠️ Note: The title screenshot is compared with main; it cannot independently establish that the displayed icons are Xbox icons if both builds show the same wrong icons.
⚠️ Note: The requested log line is conditional on the resource-table path taken, so its absence is unjudged. The farm cannot construct the stale-table or mod fixtures needed to reproduce the reported mismatch.
Done (started 17:13 UTC). Comment
@Beanstalkto run it again.windows+nvidiawindows+amdwindows+intelWhat was tested
What will be tested · AI plan (
gpt-6.1-terra)On Windows NVIDIA, AMD and Intel PCs, start the game with Xbox button prompts and capture the title screen for comparison with main. Each target takes about 10 minutes. A crash or title-screen visual regression fails; the requested resource-table log line is checked when that path is reached.
WIP: fix(prompts): serve the game's own size table with the font's entry raised, never a copy made at build timeto fix(prompts): serve the game's own size table with the font's entry raised, never a copy made at build time