fix(prompts): serve the game's own size table with the font's entry raised, never a copy made at build time #2092

Merged
HumanBean merged 2 commits from HumanBean/Longshot:fix/prompts-own-size-table into main 2026-11-21 17:23:10 +00:00
Owner

Summary

Some players crash at every start, just after the first texts and the button prompts load: 0xc0000005 (read 0x100000001030, guest 0x1030) on sead::MainThread, guest backtrace 0x83b51a3c 0x83b7b47c 0x83b7aaa4 0x83b79e88 0x802eaad8 0x80966920 ... (rc.3, rc.5, nightly-145, several NVIDIA PCs). One player got past it by deleting
prompts/rsizetable.zs and prompts/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 by nx2/prompt_assets.py from the RomFS table whose name sorts first.
hos_prompts_romfs then served it for any size table the game opened, whatever its name. If the RomFS has another
version's table next to the game's (a base dump with an update laid over it: Product.100 sorts before Product.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 at 0x83b7b478) then builds a component whose system
object was never made. In the reports that component is 0x83b51a00: it loads the global at 0x84ea2ea8, which is
still null, and reads [x8 + 0x1030] at 0x83b51abc. The x1 = 0x805c5690 in the crash record is the callback that
load 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's
raised as before). The game aborts at the start on sead::MainThread with guest backtrace
0x8351c290 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 because
different 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 only
    the font's entry raised (own_sizes, written once per start to cache/prompts/rsizetable.zs). The raise uses the
    real sizes: our font plus the allowance the game's entry gives its own font (hos_prompts_font_entry). If the RomFS
    has 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, the
    game 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 from
    prompts/rsizetable.zs.
  • nx2/prompt_assets.py: the build no longer makes a size table.
  • Docs: docs/dev/reference/mods.md.

Read first: own_sizes, hos_prompts_font_entry and build in host/prompts.c, then fit_sizes in host/mods.c.

Fixes #1109. Fixes #1192.

Testing

Tested: Linux (CachyOS), NVIDIA RTX 3090, driver 620.70.06, this PR @ 0b630e64 as a pack over main 9dd41326's base, through the job queue. A memory tour from kokiri-start: a clean start, in play, Kokiri Forest, clean quit; the log has prompts: 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 as prompts/rsizetable.zs: the same clean start into play and the same log line, so the file is ignored, where main aborts on sead::MainThread with it.

  • main @ 9dd41326 with a size table that isn't the game's in prompts/rsizetable.zs (every entry halved): aborts
    at the start on sead::MainThread, guest backtrace ... 0x83b7b47c 0x83b7aaa4 0x83b79e88 0x802eaad8 ..., the boot
    path of #1109.
  • Checks: new tests/test_prompts_size_table.py (8 cases). It uses tests/test_mods_size_table.py's fixture, which is
    now a function of its own: host/mods.c and host/prompts.c as they are, over real folders. I updated
    tests/test_mods_size_table.py, tests/test_mods_sizes.py and tests/test_mods_list.py for the change: the font's
    real 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.c and host/mods.c pass -fsyntax-only -Wall -Wextra with gcc
    and clang.

Still to test:

  • Windows, NVIDIA (the reporters' setup): start a game built from this branch with the button prompts on. Expect a
    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 ... bytes in the log (@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 reporters of #1109 / #1192: restore prompts/rsizetable.zs and prompts/External.bfotf if 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 main with a table that isn't the game's, against this PR with the same
folder; the game-free test failing on main (it serves game/prompts/rsizetable.zs) and passing here (CI).

Before: main @ 9dd41326 After: this PR @ 0b630e64
Start with a prompts/rsizetable.zs that isn't the game's abort on sead::MainThread, the #1109 boot path clean start into play; the game's own table served
tests/test_prompts_size_table.py fails: the build's table served for any table name passes (CI)

Risks

  • Start time: the game's table (~1.7 MB) is decompressed, the font's entry is raised, and the table is written once per
    start on the loader thread. Small, but not measured.
  • If the RomFS has no table of the name the game opens, or the table has no font entry, the texts show the Switch's
    icons instead of crashing. The log says why (prompts: ...: the game's own size table and its own icons in texts).
  • Copies of the textures or layouts that are a different size from the RomFS's are left out (the game's own pictures),
    and the log says so.
  • After updating: the next build makes the prompts again (their key covers host/prompts.c and
    nx2/prompt_assets.py) and writes no prompts/rsizetable.zs. A leftover one is ignored. Saves and settings don't
    change.
  • To undo: a revert. There is no switch.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (Not run on this PC, by its rule; CI on the forge runs it.)
  • 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. (Written to fail on main because main serves the build's table for any name; not run here, CI runs it.)
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Built on Linux; Windows by CI.)
  • Docs updated.
  • 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.ai/code/session_017vw8e2uxGKQxzDeQ15jjNK

## Summary Some players crash at every start, just after the first texts and the button prompts load: `0xc0000005 (read 0x100000001030, guest 0x1030)` on `sead::MainThread`, guest backtrace `0x83b51a3c 0x83b7b47c 0x83b7aaa4 0x83b79e88 0x802eaad8 0x80966920 ...` (rc.3, rc.5, nightly-145, several NVIDIA PCs). One player got past it by deleting `prompts/rsizetable.zs` and `prompts/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 by `nx2/prompt_assets.py` from the RomFS table whose name sorts first. `hos_prompts_romfs` then served it for **any** size table the game opened, whatever its name. If the RomFS has another version's table next to the game's (a base dump with an update laid over it: `Product.100` sorts before `Product.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 at `0x83b7b478`) then builds a component whose system object was never made. In the reports that component is `0x83b51a00`: it loads the global at `0x84ea2ea8`, which is still null, and reads `[x8 + 0x1030]` at `0x83b51abc`. The `x1 = 0x805c5690` in the crash record is the callback that load 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's raised as before). The game aborts at the start on `sead::MainThread` with guest backtrace `0x8351c290 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 because different 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 only the font's entry raised (`own_sizes`, written once per start to `cache/prompts/rsizetable.zs`). The raise uses the real sizes: our font plus the allowance the game's entry gives its own font (`hos_prompts_font_entry`). If the RomFS has 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, the game 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 from `prompts/rsizetable.zs`. - `nx2/prompt_assets.py`: the build no longer makes a size table. - Docs: `docs/dev/reference/mods.md`. Read first: `own_sizes`, `hos_prompts_font_entry` and `build` in `host/prompts.c`, then `fit_sizes` in `host/mods.c`. Fixes #1109. Fixes #1192. ## Testing **Tested:** Linux (CachyOS), NVIDIA RTX 3090, driver 620.70.06, this PR @ 0b630e64 as a pack over main 9dd41326's base, through the job queue. A memory tour from `kokiri-start`: a clean start, in play, Kokiri Forest, clean quit; the log has `prompts: 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 as `prompts/rsizetable.zs`: the same clean start into play and the same log line, so the file is ignored, where main aborts on `sead::MainThread` with it. - `main` @ 9dd41326 with a size table that isn't the game's in `prompts/rsizetable.zs` (every entry halved): aborts at the start on `sead::MainThread`, guest backtrace `... 0x83b7b47c 0x83b7aaa4 0x83b79e88 0x802eaad8 ...`, the boot path of #1109. - Checks: new `tests/test_prompts_size_table.py` (8 cases). It uses `tests/test_mods_size_table.py`'s fixture, which is now a function of its own: `host/mods.c` and `host/prompts.c` as they are, over real folders. I updated `tests/test_mods_size_table.py`, `tests/test_mods_sizes.py` and `tests/test_mods_list.py` for the change: the font's real 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.c` and `host/mods.c` pass `-fsyntax-only -Wall -Wextra` with gcc and clang. **Still to test:** - Windows, NVIDIA (the reporters' setup): start a game built from this branch with the button prompts on. Expect a 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 ... bytes` in the log (@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 reporters of #1109 / #1192: restore `prompts/rsizetable.zs` and `prompts/External.bfotf` if 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 `main` with a table that isn't the game's, against this PR with the same folder; the game-free test failing on `main` (it serves `game/prompts/rsizetable.zs`) and passing here (CI). | | Before: main @ 9dd41326 | After: this PR @ 0b630e64 | |---|---|---| | Start with a `prompts/rsizetable.zs` that isn't the game's | abort on `sead::MainThread`, the #1109 boot path | clean start into play; the game's own table served | | `tests/test_prompts_size_table.py` | fails: the build's table served for any table name | passes (CI) | ## Risks - Start time: the game's table (~1.7 MB) is decompressed, the font's entry is raised, and the table is written once per start on the loader thread. Small, but not measured. - If the RomFS has no table of the name the game opens, or the table has no font entry, the texts show the Switch's icons instead of crashing. The log says why (`prompts: ...: the game's own size table and its own icons in texts`). - Copies of the textures or layouts that are a different size from the RomFS's are left out (the game's own pictures), and the log says so. - After updating: the next build makes the prompts again (their key covers `host/prompts.c` and `nx2/prompt_assets.py`) and writes no `prompts/rsizetable.zs`. A leftover one is ignored. Saves and settings don't change. - To undo: a revert. There is no switch. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). (Not run on this PC, by its rule; CI on the forge runs it.) - [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 - [ ] A fix: a game-free test that fails on `main` and passes here. (Written to fail on `main` because `main` serves the build's table for any name; not run here, CI runs it.) - [x] A check under `tests/` that reads changed source is updated, not weakened. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Built on Linux; Windows by CI.) - [x] Docs updated. - [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) https://claude.ai/code/session_017vw8e2uxGKQxzDeQ15jjNK
A game-free check over host/mods.c and host/prompts.c as they are (tests/test_mods_size_table.py's
fixture, now a function of its own): a table the build made from another dump or version is never
served, the one the game opens is, its font entry raised; a name the RomFS has not, or a table without
a font entry, gets the game's own table and icons; the layouts' copy only when the size of the RomFS's.
It fails on main: prompts/rsizetable.zs is served for any size table the game opens.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(prompts): serve the game's own size table, its font entry raised, never the build's copy (#1109)
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 14s
CI / Workflow lint (actionlint) (pull_request) Successful in 15s
Third-party parts / As their notes say (pull_request) Successful in 19s
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Failing after 17s
beanstalk/approval approved by HumanBean (reviewed)
beanstalk/windows+nvidia 0/1 pass, 0 running, 0 queued
beanstalk/windows+amd 0/1 pass, 0 running, 0 queued
beanstalk/windows+intel 0/1 pass, 0 running, 0 queued
CI / Website build and checks (pull_request) Successful in 4m32s
0b630e643a
The button prompts served prompts/rsizetable.zs, made at the build from the RomFS's table whose
name sorts first, for any size table the game opened. A RomFS with another version's table beside
the game's, or another dump than the build read, gave the game a table that is not its own: it
dropped files it needs and crashed at the start reading guest 0x1030. Players deleted
prompts/rsizetable.zs and External.bfotf to get past it.

host/prompts.c now serves the RomFS's own table of the name the game opens with the font's entry
raised (own_sizes, cache/prompts/rsizetable.zs, made at the start); a mod's table gets that merged
in, and host/mods.c merges from the game's own table with the same raise
(hos_prompts_font_entry). Without a table of that name, or without a font entry in it, the game
gets its own table and its own icons. The prompts' copies of the layouts and textures are served
only when they are the size of the RomFS's. nx2/prompt_assets.py makes no table any more.

Fixes #1109, #1192.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

Tested in game: Linux, RTX 3090, NVIDIA 620.70.06, this PR @ 0b630e64 over 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.

Tested in game: Linux, RTX 3090, NVIDIA 620.70.06, this PR @ 0b630e64 over 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.
Author
Owner

@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 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.
Member

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 @Beanstalk to run it again.

Target Result Reports Frame time p99 (ms), main → PR VRAM peak (MB) Crashes
windows+nvidia ⏳ queued 0 of 1 — — —
windows+amd ⏳ queued 0 of 1 — — —
windows+intel ⏳ queued 0 of 1 — — —
What 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.

  • Where: windows+nvidia (1-2 reports), windows+amd (1-2 reports), windows+intel (1-2 reports).
  • xbox-title: from the title screen (settings button_prompts=2), then take the picture title-xbox to compare with main; 1 run on each side.
  • Measured: crashes, the game's log (an expected line that never appears: could not be judged).
  • The PR fails if: it crashes; or a picture differs from main by more than 5%; or expected log lines missing is above 0.
  • Time: about 10 min of game runs per tester (2 game starts), plus the two builds.
<!-- beanstalk:sticky --> ### Beanstalk test farm · 🔄 testing (0 of 3 reports so far) Commit `0b630e6` · approved by HumanBean (reviewed) · [dashboard](https://beanstalk.magicbean.dev/prs/2092) ⚠️ **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 `@Beanstalk` to run it again. | Target | Result | Reports | Frame time p99 (ms), main → PR | VRAM peak (MB) | Crashes | | --- | --- | --- | --- | --- | --- | | `windows+nvidia` | ⏳ queued | 0 of 1 | — | — | — | | `windows+amd` | ⏳ queued | 0 of 1 | — | — | — | | `windows+intel` | ⏳ queued | 0 of 1 | — | — | — | <details><summary>What was tested</summary> **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. - **Where:** windows+nvidia (1-2 reports), windows+amd (1-2 reports), windows+intel (1-2 reports). - **xbox-title:** from the title screen (settings button_prompts=2), then take the picture title-xbox to compare with main; 1 run on each side. - **Measured:** crashes, the game's log (an expected line that never appears: could not be judged). - **The PR fails if:** it crashes; or a picture differs from main by more than 5%; or expected log lines missing is above 0. - **Time:** about 10 min of game runs per tester (2 game starts), plus the two builds. </details>
HumanBean changed title from WIP: fix(prompts): serve the game's own size table with the font's entry raised, never a copy made at build time to fix(prompts): serve the game's own size table with the font's entry raised, never a copy made at build time 2026-11-21 17:22:58 +00:00
HumanBean deleted branch fix/prompts-own-size-table 2026-11-21 17:23:14 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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!2092
No description provided.