feat(menu): draw the F1 menu's button prompts from the game's prompt fonts #1882
Open
nicholasgower wants to merge 1 commit from
nicholasgower/feat/menu-button-prompts into main
pull from: nicholasgower/feat/menu-button-prompts
merge into: MagicBeanDev:main
MagicBeanDev:main
MagicBeanDev:github/pr/2893
MagicBeanDev:github/pr/2890
MagicBeanDev:github/pr/2887
MagicBeanDev:github/pr/2878
MagicBeanDev:github/pr/2875
MagicBeanDev:github/pr/2874
MagicBeanDev:github/pr/2873
MagicBeanDev:github/pr/2871
MagicBeanDev:github/pr/2756
MagicBeanDev:github/pr/2897
MagicBeanDev:github/pr/2896
MagicBeanDev:github/pr/2718
MagicBeanDev:github/pr/2842
MagicBeanDev:github/pr/2691
MagicBeanDev:github/pr/2895
MagicBeanDev:github/pr/2743
MagicBeanDev:github/pr/2765
MagicBeanDev:github/pr/2708
MagicBeanDev:github/pr/2732
MagicBeanDev:github/pr/2755
MagicBeanDev:github/pr/2817
MagicBeanDev:github/pr/2876
MagicBeanDev:release-please--branches--main
MagicBeanDev:release-please--branches--main--release-notes
MagicBeanDev:github/pr/2778
MagicBeanDev:github/pr/2888
MagicBeanDev:github/pr/2866
MagicBeanDev:github/pr/2877
MagicBeanDev:github/pr/2800
MagicBeanDev:github/pr/2829
MagicBeanDev:github/pr/2850
MagicBeanDev:github/pr/2889
MagicBeanDev:github/pr/2882
MagicBeanDev:github/pr/2860
MagicBeanDev:github/pr/2849
MagicBeanDev:github/pr/2886
MagicBeanDev:github/pr/2794
MagicBeanDev:github/pr/2840
MagicBeanDev:github/pr/2830
MagicBeanDev:github/pr/2834
MagicBeanDev:github/pr/2719
MagicBeanDev:github/pr/2742
MagicBeanDev:github/pr/2741
MagicBeanDev:github/pr/2820
MagicBeanDev:github/pr/2771
MagicBeanDev:github/pr/2859
MagicBeanDev:github/pr/2858
MagicBeanDev:github/pr/2823
MagicBeanDev:github/pr/2757
MagicBeanDev:github/pr/2769
MagicBeanDev:github/pr/2844
MagicBeanDev:github/pr/2843
MagicBeanDev:github/pr/2673
MagicBeanDev:github/pr/2855
MagicBeanDev:github/pr/2739
MagicBeanDev:github/pr/2807
MagicBeanDev:github/pr/2851
MagicBeanDev:github/pr/2789
MagicBeanDev:github/pr/2814
MagicBeanDev:github/pr/2818
MagicBeanDev:github/pr/2774
MagicBeanDev:github/pr/2772
MagicBeanDev:github/pr/2750
MagicBeanDev:github/pr/2786
MagicBeanDev:github/pr/2785
MagicBeanDev:github/pr/2782
MagicBeanDev:github/pr/2779
MagicBeanDev:github/pr/2775
MagicBeanDev:github/pr/2706
MagicBeanDev:github/pr/2766
MagicBeanDev:github/pr/2747
MagicBeanDev:github/pr/2759
MagicBeanDev:github/pr/2745
MagicBeanDev:github/pr/2740
MagicBeanDev:github/pr/2733
MagicBeanDev:github/pr/2725
MagicBeanDev:github/pr/2727
MagicBeanDev:github/pr/2728
MagicBeanDev:github/pr/2729
MagicBeanDev:github/pr/2721
MagicBeanDev:github/pr/2722
MagicBeanDev:github/pr/2715
MagicBeanDev:github/pr/2714
MagicBeanDev:github/pr/2707
MagicBeanDev:github/pr/2703
MagicBeanDev:github/pr/2705
MagicBeanDev:github/pr/2697
MagicBeanDev:github/pr/2679
MagicBeanDev:github/pr/2676
MagicBeanDev:github/pr/2669
MagicBeanDev:docs/what-hookshot-connects-to
MagicBeanDev:fix/hdr-encode-test
MagicBeanDev:fix/main-tests
MagicBeanDev:fix/play-cache-files
MagicBeanDev:perf/game-barrier-order
MagicBeanDev:feat/heap-lazy
MagicBeanDev:feat/texture-detail
MagicBeanDev:perf/astc-opaque-bc1
MagicBeanDev:fix/fs-dir-lock
MagicBeanDev:fix/framegen-native-kept
MagicBeanDev:fix/update-no-downgrade
MagicBeanDev:port/k10-gcn-f16-mirrors
MagicBeanDev:fix/framegen-mult-cap
MagicBeanDev:chore/release-as-2.1.1
MagicBeanDev:perf/pcache-load-switch
MagicBeanDev:fix/prepare-progress-log
MagicBeanDev:fix/update-closes-stale-game
MagicBeanDev:fix/hdr-scaled-sampled
MagicBeanDev:perf/first-start-preset
MagicBeanDev:perf/zero-upload
MagicBeanDev:fix/vcore-escape-2s
MagicBeanDev:test/fake-gh-atomic
MagicBeanDev:perf/batch-idle-flush
MagicBeanDev:test/finish-stub-a
MagicBeanDev:chore/record-2.1.0
MagicBeanDev:fix/main-red-tests
MagicBeanDev:fix/test-display-startup-driver-cache
MagicBeanDev:feat/mesh-shader-mode
MagicBeanDev:fix/menu-probes-at-startup
MagicBeanDev:fix/fps-counter-classic
MagicBeanDev:fix/test-log-batch-flake
MagicBeanDev:fix/narrow-screen-hud
MagicBeanDev:ci/prereleases
MagicBeanDev:release/v2.0.15
MagicBeanDev:hotfix/v2.0.15
MagicBeanDev:fix/present-ahead-replay
MagicBeanDev:release/v2.0.13
MagicBeanDev:fix/bracket-paths-2013
MagicBeanDev:fix/hdr-overlays-2013
MagicBeanDev:fix/fps-counter-scale-2013
MagicBeanDev:fix/stick-seen-at-rest
MagicBeanDev:hotfix/menu-fits-screen
MagicBeanDev:fix/f1-always-opens-menu
MagicBeanDev:fix/ini-keep-lines
MagicBeanDev:claude/cranky-pike-7cf247
MagicBeanDev:perf/texture-answer-flat
MagicBeanDev:fix/stamp-test-modules
MagicBeanDev:fix/appimage-fonts
MagicBeanDev:fix/display-awake
MagicBeanDev:release/v2.0.12
MagicBeanDev:fix/discord-windows
MagicBeanDev:rc/v2.0.12-tests
MagicBeanDev:fix/dlss-keep-feature
MagicBeanDev:rc/v2.0.12
MagicBeanDev:button-icons
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
autorelease: pending
autorelease: tagged
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
github_actions
Pull requests that update GitHub Actions code
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
question
Further information is requested
testing wanted
wontfix
This will not be worked on
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
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/Hookshot!1882
Loading…
Reference in a new issue
No description provided.
Delete branch "nicholasgower/feat/menu-button-prompts"
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?
Why
The F1/Insert menu's prompt strip drew generic circles and D-pad crosses, so on a DualSense it showed dots where the game shows Cross, Circle, L1/R1 and the D-pad. The menu's prompts should use the same button icons as the game.
What changed
Font2/Scalable/Externalbutton-icon font and the per-faceprompts/<face>/External.bfotffonts (fromnx2/prompt_assets.py) into ImGui.Testing
Hand-tested.
Game-free checks:
test_menu_prompt_icons,test_game_font,test_menu_keys,test_menu_utf8,test_ui_record.Nice change, and the game-asset rules are respected. I checked that: nothing from the game is added to the repo (the diff is code, a test and the readme). The icon font is read at runtime from the user's own files:
Font2/Scalable/External.Nin_Ounce_NVN2.bfotf.zsthrough the existinggame_font::Reader(zstd + XOR in memory), andprompts/<face>/External.bfotfthroughread_file+bfotf_font. Both go toAddFontFromMemoryTTFwith the atlas owning the copy, so nothing is written back out. The new test only reads code points fromnx2/prompt_assets.pyand compiles a cut-out ofvk_ui.hwith a fixture, so no dump is needed. The screenshot is a picture of the menu, which CONTRIBUTING allows.One thing to check:
game_dir()takes the parent ofromfs_dir(), buthost/prompts.cgame_dir()uses the folder of the game executable (hos_game_path_a), and that is wherenx2/prompt_assets.py --out <game folder>/promptswrites. When--romfspoints at a dump folder somewhere else (your own comment says that is allowed), the menu will look forprompts/<face>/External.bfotfin the wrong place and quietly fall back to the ROM's Switch icons, while the game itself shows the face's icons. It would be safer to use the same folder the game uses (a host call, or the executable's folder), or to note why the romfs parent is right. Nothing breaks if it is wrong, the icons are just the Switch's.Smaller points:
prompt_face_fontand theExternalfont are loaded even withRX_VK_UI_GAME_FONT=0. That variable's comment says Libertinus whatever the game's files have, so you may want it to cover the icons too.test_menu_prompt_icons.pygreps for the literal strings0xF700 + padand0xF700, 0xF700 + HOS_PAD_N - 1, which will break on any reformat. Fine as a guard, just brittle.CI: the C++ builds (Windows llvm-mingw, AppImage) pass. The two Python source checks fail, but on tests this PR does not touch (
test_antilagon both,nx2/test_draw_parameterson Linux,test_nup_out_of_spaceandtest_wayland_libdecor_hinton Windows), and the new tests pass. They look like main's own failures, but I did not compare against a finished main run.Heads-up: this conflicts with main now. Could you rebase onto main and resolve the conflicts? Thanks!
Main changed the file this reads. nx2/prompt_assets.py on main now writes a single prompts/External.bfotf with every face in it, each face's pad icons at U+F700 + 32 x HOS_PROMPT_* + HOS_PAD_* (prompt_assets.py:6-10, written at line 966; host/prompts.c's header says the same). prompt_face_font() looks for prompts//External.bfotf with icons at U+F700 + HOS_PAD_*. After a rebase, face_icons() is false for every face and the menu silently shows the ROM's Switch icons, which is the bug this PR sets out to fix. test_menu_prompt_icons only checks the Switch code points, so it won't catch this. Loading the one file and offsetting the code point by 32 x prompt_face would fix it, and a check against prompt_assets.PAD_BASE and the per-face stride would cover it. hckrman101's point about game_dir() using the romfs parent instead of the executable's folder (host/prompts.c game_dir) is still open.