fix(prompts): find the prompts' font on native Windows, kept from its stream's start #2583

Merged
polackangry merged 1 commit from fix/prompts-font-at-stream-start into main 2026-11-12 03:05:35 +00:00
polackangry commented 2026-11-12 00:15:36 +00:00 (Migrated from github.com)

On native Windows the live button prompts (#2366) never find the font, so a change of face or of controls waits for a restart (seen in #2435's testing). The game keeps the font there from its stream's start with the stream's size the file's, and hos_prompts_glyph looked 8 bytes in, for a header that isn't there.

What it does

hos_prompts_glyph (host/prompts.c) takes a stream of the served font's size and looks for the font's head where it looked before (behind the 8-byte header when the size is the file's), then at the stream's start. Whichever holds the head is font.at. A face whose bytes aren't readable yet is looked at again, as before; one with neither head is another font, as before.

Why

A diagnostic build on native Windows 11 (RTX 5060 Ti, the v131072 game) logged each face FreeType draws from, its stream's base and size:

prompts-diag: face 0x107e504c00 stream 0x107e4f9370 base 0x7fd37800e8 size 55088 (want 55088 or 55080)
prompts-diag: face 0x107e504c00 has the size but not the head (00030030 vs 4f54544f)

The size is the served file's (55088), so the code read from base + 8. The bytes there, 00 03 00 30, are the OpenType header's own entrySelector (3) and rangeShift (48): the font starts at base, with no header in front. #2435's description and comment guessed a size mismatch; the size matches and the start is the difference.

Testing

In game, native Windows 11, RTX 5060 Ti, keyboard and mouse, driven with the control bridge (headless), a save in the Fire Temple:

Case Before After
prompts: the font at ... never logged prompts: the font at 0x7fd37800e8: the icons in texts follow at once
Keyboard → Xbox while the game runs (#2435's branch) held for a restart now the xbox icons in texts; the pause menu reopened shows LB/RB, A, B
Xbox → Keyboard while the game runs held for a restart now the keyboard icons in texts; Q/R, E, Shift again

Tests: test_prompts_live, test_prompt_font_bind, test_menu_hooks pass. The fix was tested on top of #2435's branch, the same function as on main.

🤖 Generated with Claude Code

On native Windows the live button prompts (#2366) never find the font, so a change of face or of controls waits for a restart (seen in #2435's testing). The game keeps the font there from its stream's start with the stream's size the file's, and `hos_prompts_glyph` looked 8 bytes in, for a header that isn't there. ## What it does `hos_prompts_glyph` (host/prompts.c) takes a stream of the served font's size and looks for the font's head where it looked before (behind the 8-byte header when the size is the file's), then at the stream's start. Whichever holds the head is `font.at`. A face whose bytes aren't readable yet is looked at again, as before; one with neither head is another font, as before. ## Why A diagnostic build on native Windows 11 (RTX 5060 Ti, the v131072 game) logged each face FreeType draws from, its stream's base and size: ``` prompts-diag: face 0x107e504c00 stream 0x107e4f9370 base 0x7fd37800e8 size 55088 (want 55088 or 55080) prompts-diag: face 0x107e504c00 has the size but not the head (00030030 vs 4f54544f) ``` The size is the served file's (55088), so the code read from `base + 8`. The bytes there, `00 03 00 30`, are the OpenType header's own `entrySelector` (3) and `rangeShift` (48): the font starts at `base`, with no header in front. #2435's description and comment guessed a size mismatch; the size matches and the start is the difference. ## Testing In game, native Windows 11, RTX 5060 Ti, keyboard and mouse, driven with the control bridge (headless), a save in the Fire Temple: | Case | Before | After | |---|---|---| | `prompts: the font at ...` | never logged | `prompts: the font at 0x7fd37800e8: the icons in texts follow at once` | | Keyboard → Xbox while the game runs (#2435's branch) | held for a restart | `now the xbox icons in texts`; the pause menu reopened shows LB/RB, A, B | | Xbox → Keyboard while the game runs | held for a restart | `now the keyboard icons in texts`; Q/R, E, Shift again | Tests: `test_prompts_live`, `test_prompt_font_bind`, `test_menu_hooks` pass. The fix was tested on top of #2435's branch, the same function as on main. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Commenting is not possible because the repository is archived.
No description provided.