diff --git a/docs/building.md b/docs/building.md index 3718d083..44216cc0 100644 --- a/docs/building.md +++ b/docs/building.md @@ -87,11 +87,11 @@ From the repository root, in PowerShell. Every step that depends on the game ver ``` Lifting takes about 15 s, a clean compile about 200 s on 24 threads; later builds recompile only what changed. + `--patches` builds in the frame-rate, resolution and other patch sets, switchable at run time. The link copies + `SDL3.dll`, `libiconv-2.dll` and `libopus-0.dll` next to the exe. For Xbox button prompts, run `make_romfs_patches.py` once more with `--xbox-prompts`: it writes `build\\romfs-patches-xbox` ([controls.md](controls.md), "Xbox button prompts"); `build_game.py` copies it next to `totk.exe` like `romfs-patches`. - `--patches` builds in the frame-rate, resolution and other patch sets, switchable at run time. The link copies - `SDL3.dll`, `libiconv-2.dll` and `libopus-0.dll` next to the exe. 6. Prepare the shaders (once per build folder and translator). It needs `refs\MacNativeGames` (`tools\fetch_refs.sh`) for the shared shader list: diff --git a/docs/controls.md b/docs/controls.md index 295e655c..df57d17e 100644 --- a/docs/controls.md +++ b/docs/controls.md @@ -11,17 +11,6 @@ Input comes from the first SDL3 gamepad, the keyboard and the mouse, merged into The log names the layout in effect (`input: gamepad layout ...`); the menu shows it under *Automatic*. With `nintendo`, `xbox` and `auto` the game's button prompts stay Switch letters; `xbox_prompts` changes them. -## Xbox button prompts - -`pad_layout = xbox_prompts` (*Xbox prompts (A right)* on the Controls tab) is for an Xbox pad played by position. The buttons work as with `nintendo`: the right button, labelled B, does Switch A (interact, confirm), and the bottom one, labelled A, does Switch B (run, cancel). The letters the game shows are swapped to match the labels, A with B and X with Y, so each prompt names the button to press. The other layouts leave the prompts alone: with `xbox` the Switch letters already match the labels. - -The buttons change at once, but the game reads its UI archive and fonts once at boot, so the prompts change at the next start (the menu says *prompts change after restart*). `xbox_prompts` loads `romfs-patches-xbox` next to `romfs-index.bin` in place of `romfs-patches` (`runtime/romfs.c`, `overlay_init`): the same 60 fps patches, with the swap made from the game's own files by `tools/make_romfs_patches.py --xbox-prompts`, which the setup runs next to the plain one: - -- the action prompt (`DoCommand_00`) draws the letter images `Nt_KeyTexA/B/X/Y_00`, whose image data is swapped, in a diamond that names the other face buttons. 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); both are swapped. The diamond's shape shows the button's position and stays. -- every other prompt is text in the button font (`scft/External.bfotf` in each `Font/Font*.Nin_NX_NVN.bfarc.zs`, glyphs U+E040 to U+E043); the A and B, X and Y glyphs are swapped. - -Without the folder (an install made by an older setup) the menu says the files are missing, the log has `RomFS overlay: pad_layout = xbox_prompts, but ...`, and the Switch prompts stay; running the setup again on the install folder writes it. In a source build, `.venv-py314\Scripts\python tools\make_romfs_patches.py --version --xbox-prompts` writes `build\\romfs-patches-xbox`. - | Switch | Gamepad (by position, Nintendo layout) | Keyboard and mouse | Action in the world | |---|---|---|---| | Left stick | left stick | W A S D | move | @@ -42,6 +31,17 @@ Without the folder (an install made by an older setup) the menu says the files a Esc is unbound in the game; it opens the settings menu and releases the mouse cursor (see Mouse camera). Z and X duplicate ZL and ZR so menu pages turn with two neighbouring keys; the menu tabs (L, R) are Q and R. The mouse wheel is unbound. The bindings are the tables of `input_map` in `runtime/input_map.c`: the keys (platform-neutral key ids) and one gamepad table per layout (gamepad inputs by position); `runtime/input_win.c` translates Win32 virtual keys and SDL buttons. +## Xbox button prompts + +`pad_layout = xbox_prompts` (*Xbox prompts (A right)* on the Controls tab) is for an Xbox pad played by position. The buttons work as with `nintendo`: the right button, labelled B, does Switch A (interact, confirm), and the bottom one, labelled A, does Switch B (run, cancel). The letters the game shows are swapped to match the labels, A with B and X with Y, so each prompt names the button to press. The other layouts leave the prompts alone: with `xbox` the Switch letters already match the labels. + +The buttons change at once, but the game reads its UI archive and fonts once at boot, so the prompts change at the next start (the menu says *prompts change after restart*). `xbox_prompts` loads `romfs-patches-xbox` next to `romfs-index.bin` in place of `romfs-patches` (`runtime/romfs.c`, `overlay_init`): the same 60 fps patches, with the swap made from the game's own files by `tools/make_romfs_patches.py --xbox-prompts`, which the setup runs next to the plain one: + +- the action prompt (`DoCommand_00`) draws the letter images `Nt_KeyTexA/B/X/Y_00`, whose image data is swapped, in a diamond that names the other face buttons. 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); both are swapped. The diamond's shape shows the button's position and stays. +- every other prompt is text in the button font (`scft/External.bfotf` in each `Font/Font*.Nin_NX_NVN.bfarc.zs`, glyphs U+E040 to U+E043); the A and B, X and Y glyphs are swapped. + +Without the folder (an install made by an older setup, or one where the setup could not prepare it and showed a warning) the menu says the files are missing, the log has `RomFS overlay: pad_layout = xbox_prompts, but ...`, and the Switch prompts stay; running the setup again on the install folder writes it. In a source build, `.venv-py314\Scripts\python tools\make_romfs_patches.py --version --xbox-prompts` writes `build\\romfs-patches-xbox`. + ## Window keys | Key | Gamepad | Action | diff --git a/installer/steps.py b/installer/steps.py index 364625d9..07f9f917 100644 --- a/installer/steps.py +++ b/installer/steps.py @@ -596,7 +596,6 @@ class Prepare(Step): dest = ctx.dest xlate = dest / ctx.layout.xlate.name return ((dest / 'shader-prepared.bin').is_file() and (dest / 'romfs-patches' / 'manifest.tsv').is_file() - and (dest / 'romfs-patches-xbox' / 'manifest.tsv').is_file() and xlate.is_file() and file_sha256(xlate) == record.get('xlate_sha256')) def run(self, ctx): @@ -614,15 +613,22 @@ class Prepare(Step): remove(xlate.with_suffix('.id')) rep.progress('prepare', 'romfs_patches', force=True) - # romfs-patches-xbox: the same with the A/B and X/Y prompts swapped, for pad_layout = xbox_prompts (always written, - # so the menu setting works without another run of the setup). - for name, extra in (('romfs-patches', []), ('romfs-patches-xbox', ['--xbox-prompts'])): - remove(dest / name) - code, log = run_tool(ctx, 'prepare', layout.tools / 'make_romfs_patches.py', - ['--version', version_tag(game_version(ctx)), '--romfs', dest / 'romfs', '--out', - dest / name] + extra) - if code: - raise InstallError('prepare.romfs_patches_failed', code=code, log=str(log)) + remove(dest / 'romfs-patches') + code, log = run_tool(ctx, 'prepare', layout.tools / 'make_romfs_patches.py', + ['--version', version_tag(game_version(ctx)), '--romfs', dest / 'romfs', '--out', + dest / 'romfs-patches']) + if code: + raise InstallError('prepare.romfs_patches_failed', code=code, log=str(log)) + # romfs-patches-xbox: the same with the A/B and X/Y prompts swapped, for pad_layout = xbox_prompts (written on + # every install, so the menu choice works without another run of the setup). Optional: when it fails, the game + # keeps the Switch prompts and the menu says the files are missing, so the setup warns and goes on. + remove(dest / 'romfs-patches-xbox') + code, log = run_tool(ctx, 'prepare-xbox', layout.tools / 'make_romfs_patches.py', + ['--version', version_tag(game_version(ctx)), '--romfs', dest / 'romfs', '--out', + dest / 'romfs-patches-xbox', '--xbox-prompts']) + if code: + remove(dest / 'romfs-patches-xbox') + rep.warning('warn.xbox_prompts_failed', code=code, log=str(log)) shader_list = layout.shader_list if not shader_list: diff --git a/installer/text/en.json b/installer/text/en.json index 5e8a5912..c30ea40c 100644 --- a/installer/text/en.json +++ b/installer/text/en.json @@ -82,6 +82,7 @@ "warn.lang_needs_fonts": "Text in {lang} needs the Switch system fonts, which the installer does not extract; some text may not show.", "warn.npdm_differs": "main.npdm differs from the reference {version} dump; only the code modules are used.", + "warn.xbox_prompts_failed": "The Xbox button prompts could not be prepared (exit code {code}); the game keeps the Switch prompts. Details: {log}", "ui.title": "TotK Setup", "ui.version": "version {version}", diff --git a/installer/text/ru.json b/installer/text/ru.json index fa4d3a76..3a325526 100644 --- a/installer/text/ru.json +++ b/installer/text/ru.json @@ -82,6 +82,7 @@ "warn.lang_needs_fonts": "Для языка «{lang}» нужны системные шрифты Switch, которые установка не извлекает; часть текста может не отображаться.", "warn.npdm_differs": "main.npdm отличается от эталонного дампа {version}; используются только модули с кодом.", + "warn.xbox_prompts_failed": "Не удалось подготовить подсказки кнопок Xbox (код выхода {code}); игра оставит подсказки Switch. Подробности: {log}", "ui.title": "Установка TotK", "ui.version": "версия {version}",