From fb34177cfd2629fdfb24b8ecb66955e543f07a20 Mon Sep 17 00:00:00 2001 From: Carlos Donato Date: Tue, 10 Nov 2026 15:49:54 +0100 Subject: [PATCH] Make the Xbox prompts for every game resolution the setup lays the UI out for (#378) The setup wrote romfs-patches-xbox and romfs-patches-xbox-label for 16:9 only, so prompts = xbox on a 21:9, 32:9, 16:10 or 3:2 screen (the Steam Deck's 1280x800 among them) kept the game resolution at 1920x1080 (cfg.c) or, with output_res set to the screen's shape, fell back to the Switch prompts. #979 fixed this for prompts = pc; this extends the same mechanism to both Xbox folders, the shared-files option of #378 by way of #979's --reuse. - The setup builds romfs-patches-xbox-x and romfs-patches-xbox-label-x for each of ASPECT_SIZES, from their 16:9 folder with --reuse, as it does for romfs-patches-pc-x. - romfs.c overlay_init: at a game resolution of another shape any prompts' folder loads from -x in place of romfs-patches-x, not only the PC one; without it the Switch prompts stay, and the log names the missing folder and the command that makes it. romfs_shaped_pc_ready becomes romfs_shaped_prompts_ready(folder, w, h). - cfg.c: the display-shaped output_res default applies with prompts = xbox when the folder of the pad layout (romfs-patches-xbox with the Nintendo layout, romfs-patches-xbox-label with any other) is there for that size. - The menu's note for a missing shaped folder reads "off at this game resolution (no layout made for it)" in every menu language, since 16:9 is no longer the only shape with prompts. Co-Authored-By: Claude Opus 5.5 --- docs/controls.md | 6 ++-- docs/installer.md | 8 ++--- installer/steps.py | 38 ++++++++++---------- runtime/cfg.c | 29 ++++++++++------ runtime/host.h | 3 +- runtime/romfs.c | 69 +++++++++++++++++++------------------ runtime/ui/menu.cpp | 4 +-- runtime/ui_text.c | 8 ++--- tools/build_game.py | 4 +-- tools/make_romfs_patches.py | 8 +++-- totk.ini.example | 4 +-- 11 files changed, 99 insertions(+), 82 deletions(-) diff --git a/docs/controls.md b/docs/controls.md index 0fd4d567..0263fbf4 100644 --- a/docs/controls.md +++ b/docs/controls.md @@ -55,7 +55,9 @@ The game reads its UI archive and fonts once at boot, so the prompts change at t - every prompt but the button guide in play is text in the button font, `scft/External.bfotf` in each `Font/Font*.Nin_NX_NVN.bfarc.zs`: glyphs U+E040 to U+E043 (A B X Y), U+E044 to U+E047 (L R ZL ZR), U+E04B and U+E04C (Plus, Minus), U+E049 and U+E060 to U+E065 (the d-pad). fontTools writes the font again, so the archives grow and the folder also carries the resource size table (`System/Resource/ResourceSizeTable.Product....rsizetable.zs`) with their entries raised by as much; without that the game stops at start. - the button guide in play draws L and ZL from the images `Nt_KeyTexL_00` and `Nt_KeyTexZL_00` of the Common archive's `timg/__Combined.bntx`, painted with the same icons. The action prompt draws its button from `Nt_KeyTexA/B/X/Y_00`, whose image data is swapped for `nintendo`, and the diamond's letters are text the game takes from `LayoutMsg/DoCommand_00.msbt` of each language's `Mals` archive (and the layout's own text panes behind it), swapped the same way. -The Switch prompts stay, with a note under *Button prompts* and a `RomFS overlay: ...` line in the log, when the folder is missing (an install made by an older setup, or one where the setup could not prepare it and showed a warning; running the setup again on the install folder writes it), when it fails its check, with a game resolution of another shape than 16:9 (its own UI layout wins; 16:10 and 21:9), and when the `romfs_mods` folder replaces one of its files: `romfs-patches` then loads in its place, where two overlays replacing one file would stop the game. In a source build, `.venv-py314\Scripts\python tools\make_romfs_patches.py --version --prompts xbox` (and `--prompts xbox-label`) writes `build\\romfs-patches-xbox` (`-label`); it needs fontTools from `tools/requirements-py314.txt`. `--xbox-prompts` is the older name of `--prompts xbox`. +The Switch prompts stay, with a note under *Button prompts* and a `RomFS overlay: ...` line in the log, when the folder is missing (an install made by an older setup, or one where the setup could not prepare it and showed a warning; running the setup again on the install folder writes it), when it fails its check, with a game resolution of another shape than 16:9 that has no folder of its own (below), and when the `romfs_mods` folder replaces one of its files: `romfs-patches` then loads in its place, where two overlays replacing one file would stop the game. In a source build, `.venv-py314\Scripts\python tools\make_romfs_patches.py --version --prompts xbox` (and `--prompts xbox-label`) writes `build\\romfs-patches-xbox` (`-label`); it needs fontTools from `tools/requirements-py314.txt`. `--xbox-prompts` is the older name of `--prompts xbox`. + +At a game resolution of another shape than 16:9 the game loads `romfs-patches-xbox-x` (or `romfs-patches-xbox-label-x`) in place of `romfs-patches-x`: the same prompts with that shape's UI layout, `make_romfs_patches.py --prompts xbox --aspect x --reuse \romfs-patches-xbox --out \romfs-patches-xbox-x`. The setup writes both for each of the fifteen sizes it lays the UI out for, as for the PC prompts below, so on a display of one of those shapes the game resolution follows the display with these prompts too. At another size, without that folder, the Switch prompts stay (*off at this game resolution*). ## PC button prompts @@ -73,7 +75,7 @@ The Switch prompts stay, with a note under *Button prompts* and a `RomFS overlay - The glyphs keep the width of the game's own, so the right-aligned guides do not run into their text. A key is a rounded square with its label cut out in the game's own text fonts (Shift: an arrow over its name); a mouse button is a mouse with that button filled and the others hollow. - The button guide in play draws every button from images of the Common archive (`Nt_KeyTexA/B/X/Y/L/ZL_00`, `Nt_KeyTexLSt_00` and `_01`, the stick tilted and pressed): all of them are painted with the same icons. The letters of the action prompt's diamond are one character of the Normal font each: E, an arrow for Shift, a bar for Space, L and R for the mouse buttons. - Like the Xbox prompts they follow the defaults and not the bindings. `--binds ` draws the first key of each `bind_` line of that file instead, for a folder made by hand. -- At a game resolution of another shape than 16:9 the game loads `romfs-patches-pc-x` in place of `romfs-patches-x`: the same prompts with that shape's UI layout, `make_romfs_patches.py --prompts pc --aspect x --reuse \romfs-patches-pc --out \romfs-patches-pc-x`. The setup writes one for each of the fifteen sizes it lays the UI out for, so on a display of one of those shapes the game resolution follows the display with these prompts too. At another size, without that folder, the Switch prompts stay (*off at a game resolution not 16:9*). +- At a game resolution of another shape than 16:9 the game loads `romfs-patches-pc-x` in place of `romfs-patches-x`: the same prompts with that shape's UI layout, `make_romfs_patches.py --prompts pc --aspect x --reuse \romfs-patches-pc --out \romfs-patches-pc-x`. The setup writes one for each of the fifteen sizes it lays the UI out for, so on a display of one of those shapes the game resolution follows the display with these prompts too. At another size, without that folder, the Switch prompts stay (*off at this game resolution*). ## Window keys diff --git a/docs/installer.md b/docs/installer.md index 5a8806ad..cbfcbd08 100644 --- a/docs/installer.md +++ b/docs/installer.md @@ -74,10 +74,10 @@ loads the saves 1.4.3 wrote. writes the translations it makes in play as loose files; running the tool again with the game closed folds those in. The patches are written four times: `romfs-patches`, `romfs-patches-xbox` and `romfs-patches-xbox-label` (`--prompts`: Xbox button prompts for `prompts = xbox`, the first for `pad_layout = nintendo`, the second for `xbox` - and `auto`), and `romfs-patches-pc` (keyboard and mouse prompts for `prompts = pc`). The PC prompts are then laid - out once more for each game resolution of another shape, `romfs-patches-pc-x` (`--prompts pc --aspect`). - Those differ from `romfs-patches-pc` in the UI archive only, and `--reuse` hard-links the other files from it, so - the fifteen folders take seconds and a few MiB each. The prompt folders are optional: when one cannot be made, the + and `auto`), and `romfs-patches-pc` (keyboard and mouse prompts for `prompts = pc`). Each of the three prompt + folders is then laid out once more for each game resolution of another shape, `romfs-patches-