diff --git a/docs/controls.md b/docs/controls.md index dc3232f5..4edaa318 100644 --- a/docs/controls.md +++ b/docs/controls.md @@ -23,21 +23,25 @@ letters unless *Button prompts* says otherwise (below). ## Button prompts -`NX2NAVI_PROMPTS` (`prompts`, the *Button prompts* row on the Controls tab) picks the controller whose buttons the game's prompts show: `nintendo` (default, the game's own), `xbox` or `playstation`. It changes three things the game draws: +`NX2NAVI_PROMPTS` (`prompts`, the *Button prompts* row on the Controls tab) picks the buttons the game's prompts show: `nintendo` (default, the game's own), `xbox`, `playstation` or `pc` (*Keyboard and mouse*). It changes three things the game draws: -- the button font every prompt in text uses (dialogue, the button guides, the controls screen): A B X Y, L R ZL ZR, Plus and Minus, the d-pad and the sticks with their directions become that pad's buttons (LB RB LT RT, Menu and View; L1 R1 L2 R2, Options and Create; its d-pad and sticks). Power, Home and the console stay; +- the button font every prompt in text uses (dialogue, the button guides, the controls screen): A B X Y, L R ZL ZR, Plus and Minus, the d-pad and the sticks with their directions become that pad's buttons (LB RB LT RT, Menu and View; L1 R1 L2 R2, Options and Create; its d-pad and sticks), or the keys. Power, Home and the console stay; - the letter in the action prompt (top right); - the ocarina's note buttons. -A, B, X and Y show the button the *Button layout* presses: with `nintendo` (by position) Switch A is the right face button, so its prompts show B or circle, B shows A or cross, X shows Y or triangle and Y shows X or square; with `xbox`, `playstation` and `automatic` (by label) A shows A or cross, B shows B or circle, X shows X or square and Y shows Y or triangle. The game reads the font and the interface textures once at start, so a change shows after a restart (the row says so; the menu's Restart button restarts). A button remapped on this tab keeps its old prompt. +A, B, X and Y show the button the *Button layout* presses: with `nintendo` (by position) Switch A is the right face button, so its prompts show B or circle, B shows A or cross, X shows Y or triangle and Y shows X or square; with `xbox`, `playstation` and `automatic` (by label) A shows A or cross, B shows B or circle, X shows X or square and Y shows Y or triangle. -The prompts live in four overlay folders next to the exe, `romfs-patches-xbox`, `romfs-patches-xbox-label`, `romfs-patches-playstation` and `romfs-patches-playstation-label` (by position and by label), which `runtime/romfs.c` loads in place of the game's files. `tools/pad_prompts.py` draws them on the player's machine from the player's own RomFS and a folder of button art, which the repository does not hold: +`pc` shows the first key each Switch button has (the table above, or the `bind_` lines of `nx2navi.ini` when the tool runs): E, Ctrl, Space, the mouse with its left button for Y, Q, R, the mouse with its right button for ZL, F, Tab, M, V and C for the stick clicks, 1 to 4 for the d-pad, and W A S D for moving, the directions the prompt means set out as on the keyboard. The camera's prompts show the mouse moving. It follows no *Button layout*. + +The game reads the font and the interface textures once at start, so a change shows after a restart (the row says so; the menu's Restart button restarts). A button or key remapped on this tab keeps its old prompt until the folders are made again. + +The prompts live in overlay folders next to the exe, `romfs-patches-xbox`, `romfs-patches-xbox-label`, `romfs-patches-playstation` and `romfs-patches-playstation-label` (by position and by label) and `romfs-patches-pc`, which `runtime/romfs.c` loads in place of the game's files. `tools/pad_prompts.py` draws them on the player's machine from the player's own RomFS and a folder of button art, which the repository does not hold: ``` python tools\pad_prompts.py --art \Source --game ``` -The art folder holds `XGamepad/Default`, `XGamepad/Light`, `P5Gamepad/Default` and `P5Gamepad/Light` with the file names of `STYLES` in the tool. Without the folders the row says *prompt files missing* and the Switch prompts stay; so they do when a RomFS mod replaces one of the same files (*off: a RomFS mod replaces their files*). The log has a `RomFS overlay: ... button prompts` line for the folder in use. The tool needs fontTools, Pillow and zstandard (`tools/requirements-py314.txt`). +`--style xbox|playstation|pc` makes one style; the keys come from `\nx2navi.ini` (`--binds` names another). The art folder holds `XGamepad/Default`, `XGamepad/Light`, `P5Gamepad/Default`, `P5Gamepad/Light`, `Keyboard_Mouse/Dark` and `Keyboard_Mouse/White` with the file names of `STYLES` and `KEY_ART` in the tool; a key it has no picture of is written on `Keyboard_Mouse/Blanks`. Without the folders the row says *prompt files missing* and the Switch prompts stay; so they do when a RomFS mod replaces one of the same files (*off: a RomFS mod replaces their files*). The log has a `RomFS overlay: ... button prompts` line for the folder in use. The tool needs fontTools, Pillow and zstandard (`tools/requirements-py314.txt`). The actions are the game's own, as its *Basic Controls* screen (Plus menu, System) names them: diff --git a/nx2navi.ini.example b/nx2navi.ini.example index 772df507..5645d008 100644 --- a/nx2navi.ini.example +++ b/nx2navi.ini.example @@ -345,8 +345,8 @@ # pad_layout = nintendo # The buttons the game's prompts show: nintendo (the game's own), xbox (LB RB LT RT, Menu, View) or playstation (L1 R1 # L2 R2, Options, Create), with A B X Y as the button pad_layout presses is labelled: with nintendo, A shows as B or -# circle and X as Y or triangle. Read at start; their files come from tools/pad_prompts.py (docs/controls.md, "Button -# prompts"). pc, the keys and mouse buttons, has no files for this game. +# circle and X as Y or triangle. pc: the key each button has (the bind_ lines below when the files are made), WASD +# and the mouse. Read at start; their files come from tools/pad_prompts.py (docs/controls.md, "Button prompts"). # prompts = nintendo # Gamepad stick dead zone in percent of full deflection (0 to 50). Raise it for a stick that drifts: inside the circle # the stick reads centred, and the rest of its travel is scaled to start there. diff --git a/runtime/romfs.c b/runtime/romfs.c index cf0e2cec..c2923bb9 100644 --- a/runtime/romfs.c +++ b/runtime/romfs.c @@ -898,7 +898,6 @@ static void overlay_init(void) { "(tools/make_romfs_patches.py --prompts pc --aspect)" : "the game resolution takes its own UI layout") : prompts_off == ROMFS_PROMPTS_PATCHES ? "NX2NAVI_ROMFS_PATCHES is set" - : pick == PROMPTS_PC ? "their folder has no manifest.tsv (run the setup again)" : "their folder has no manifest.tsv (tools/pad_prompts.py writes it)"); } size_t prompts_end = noverlay; diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index 6f2ee373..89b12d43 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -1089,12 +1089,12 @@ static void tab_controls(float scale) { static const UiTextId layout[] = {UI_MENU_PAD_LAYOUT_AUTO, UI_MENU_PAD_LAYOUT_NINTENDO, UI_MENU_PAD_LAYOUT_XBOX, UI_MENU_PAD_LAYOUT_PLAYSTATION}; opt_choice("NX2NAVI_PAD_LAYOUT", UI_MENU_PAD_LAYOUT, layout, 4, UI_MENU_PAD_LAYOUT_DESC, pad_layout_note()); - // The first three values of the setting (cfg.c): pc stays readable in nx2navi.ini, but nothing makes its files for - // this game, so the row leaves it out. The game reads its prompts at start: the row's note says when a restart - // would bring others, and the bar's Restart button does it. - static const UiTextId prompts[] = {UI_MENU_PROMPTS_NINTENDO, UI_MENU_PROMPTS_XBOX, UI_MENU_PROMPTS_PLAYSTATION}; + // The setting's values in their cfg.c order (nintendo, xbox, playstation, pc). The game reads its prompts at start: + // the row's note says when a restart would bring others, and the bar's Restart button does it. + static const UiTextId prompts[] = {UI_MENU_PROMPTS_NINTENDO, UI_MENU_PROMPTS_XBOX, UI_MENU_PROMPTS_PLAYSTATION, + UI_MENU_PROMPTS_PC}; bool restart; - opt_choice("NX2NAVI_PROMPTS", UI_MENU_PROMPTS, prompts, 3, UI_MENU_PROMPTS_DESC, prompts_note(&restart)); + opt_choice("NX2NAVI_PROMPTS", UI_MENU_PROMPTS, prompts, 4, UI_MENU_PROMPTS_DESC, prompts_note(&restart)); opt_toggle("NX2NAVI_MOTION", UI_MENU_MOTION, UI_MENU_MOTION_DESC); opt_slider("NX2NAVI_RUMBLE_STRENGTH", UI_MENU_RUMBLE_STRENGTH, 0, 300, UI_MENU_RUMBLE_STRENGTH_DESC, 10, "%.0f %%"); opt_slider("NX2NAVI_RUMBLE_CURVE", UI_MENU_RUMBLE_CURVE, 0.2f, 1.5f, UI_MENU_RUMBLE_CURVE_DESC, 0.05f, "%.2f"); diff --git a/runtime/ui_text.c b/runtime/ui_text.c index b4a866d2..b46b3bae 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -251,16 +251,18 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_PAD_LAYOUT_XBOX] = "Xbox (A bottom)", [UI_MENU_PAD_LAYOUT_PLAYSTATION] = "PlayStation (A bottom)", [UI_MENU_PAD_LAYOUT_IN_USE] = "in use: %s", [UI_MENU_PROMPTS] = "Button prompts", - [UI_MENU_PROMPTS_DESC] = "Which controller's buttons the game's prompts show, in text, in the action prompt and on " - "the ocarina's notes. Nintendo: the game's own. Xbox and PlayStation: that pad's buttons " - "(LB, RB, LT, RT, Menu, View; L1, R1, L2, R2, Options, Create), and A, B, X and Y as the " + [UI_MENU_PROMPTS_DESC] = "Which buttons the game's prompts show, in text, in the action prompt and on the " + "ocarina's notes. Nintendo: the game's own. Xbox and PlayStation: that pad's buttons (LB, " + "RB, LT, RT, Menu, View; L1, R1, L2, R2, Options, Create), and A, B, X and Y as the " "button the layout above presses (with Nintendo (A right) the right button does A, so the " - "prompts for A show B, or circle). The prompt files are made from button art with " - "tools/pad_prompts.py. The game reads its prompts at start, so they change after a " - "restart. They are part of the game's files, so a button you remap in Controls keeps its " - "old prompt on screen.", + "prompts for A show B, or circle). Keyboard and mouse: the key each button has (E, Ctrl, " + "Space, left click...), WASD for moving and the mouse for the camera. The prompt files " + "are made from button art with tools/pad_prompts.py, the keys as nx2navi.ini binds them " + "when it runs. The game reads its prompts at start, so they change after a restart. They " + "are part of the game's files, so a button you remap in Controls keeps its old prompt on " + "screen until the files are made again.", [UI_MENU_PROMPTS_NINTENDO] = "Nintendo", [UI_MENU_PROMPTS_XBOX] = "Xbox", - [UI_MENU_PROMPTS_PLAYSTATION] = "PlayStation", [UI_MENU_PROMPTS_PC] = "PC", + [UI_MENU_PROMPTS_PLAYSTATION] = "PlayStation", [UI_MENU_PROMPTS_PC] = "Keyboard and mouse", [UI_MENU_PROMPTS_MISSING] = "prompt files missing: tools/pad_prompts.py makes them", [UI_MENU_PROMPTS_FAILED] = "prompt files damaged: make them again with tools/pad_prompts.py", [UI_MENU_PROMPTS_RESTART] = "prompts change after restart", @@ -748,16 +750,18 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_PAD_LAYOUT_XBOX] = "Xbox (A снизу)", [UI_MENU_PAD_LAYOUT_PLAYSTATION] = "PlayStation (A снизу)", [UI_MENU_PAD_LAYOUT_IN_USE] = "сейчас: %s", [UI_MENU_PROMPTS] = "Подсказки кнопок", - [UI_MENU_PROMPTS_DESC] = "Кнопки какого контроллера показывают подсказки игры: в тексте, в подсказке действия и на " - "нотах окарины. Nintendo: как в самой игре. Xbox и PlayStation: кнопки этого контроллера " - "(LB, RB, LT, RT, Menu, View; L1, R1, L2, R2, Options, Create), а A, B, X и Y показаны " - "той кнопкой, которую нажимает раскладка выше (в Nintendo (A справа) A делает правая " - "кнопка, и подсказки A показывают B или круг). Файлы подсказок создаются из картинок " - "кнопок программой tools/pad_prompts.py. Игра читает подсказки при запуске, так что они " - "меняются после перезапуска. Подсказки записаны в файлах игры, поэтому у кнопки, " - "переназначенной на вкладке управления, на экране остаётся прежняя подсказка.", + [UI_MENU_PROMPTS_DESC] = "Какие кнопки показывают подсказки игры: в тексте, в подсказке действия и на нотах " + "окарины. Nintendo: как в самой игре. Xbox и PlayStation: кнопки этого контроллера (LB, " + "RB, LT, RT, Menu, View; L1, R1, L2, R2, Options, Create), а A, B, X и Y показаны той " + "кнопкой, которую нажимает раскладка выше (в Nintendo (A справа) A делает правая кнопка, " + "и подсказки A показывают B или круг). Клавиатура и мышь: клавиша каждой кнопки (E, Ctrl, " + "пробел, левый клик...), WASD для движения и мышь для камеры. Файлы подсказок создаются " + "из картинок кнопок программой tools/pad_prompts.py, клавиши берутся из nx2navi.ini на " + "момент её запуска. Игра читает подсказки при запуске, так что они меняются после " + "перезапуска. Подсказки записаны в файлах игры, поэтому у кнопки, переназначенной на " + "вкладке управления, на экране остаётся прежняя подсказка, пока файлы не созданы заново.", [UI_MENU_PROMPTS_NINTENDO] = "Nintendo", [UI_MENU_PROMPTS_XBOX] = "Xbox", - [UI_MENU_PROMPTS_PLAYSTATION] = "PlayStation", [UI_MENU_PROMPTS_PC] = "PC", + [UI_MENU_PROMPTS_PLAYSTATION] = "PlayStation", [UI_MENU_PROMPTS_PC] = "Клавиатура и мышь", [UI_MENU_PROMPTS_MISSING] = "нет файлов подсказок: их создаёт tools/pad_prompts.py", [UI_MENU_PROMPTS_FAILED] = "файлы подсказок повреждены: создайте их снова tools/pad_prompts.py", [UI_MENU_PROMPTS_RESTART] = "подсказки сменятся после перезапуска", @@ -1382,18 +1386,21 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { [UI_MENU_HDR_UI] = "Brilho do HUD e do menu", [UI_MENU_HDR_UI_DESC] = "Brilho da interface e deste menu, em nits.", [UI_MENU_PROMPTS] = "Ícones de botões", - [UI_MENU_PROMPTS_DESC] = "Os botões de qual controle os ícones do jogo mostram: no texto, no ícone de ação e nas " - "notas da ocarina. Nintendo: os do próprio jogo. Xbox e PlayStation: os botões desse " - "controle (LB, RB, LT, RT, Menu, Exibir; L1, R1, L2, R2, Options, Create), e A, B, X e Y " - "aparecem como o botão que o layout acima aperta (com Nintendo (A à direita) o botão da " - "direita faz A, então os ícones de A mostram B, ou círculo). Os arquivos dos ícones são " - "feitos a partir de imagens de botões com tools/pad_prompts.py. O jogo lê os ícones ao " - "iniciar, então eles mudam depois de reiniciar. Eles fazem parte dos arquivos do jogo, " - "então um botão remapeado em Controles continua com o ícone antigo na tela.", + [UI_MENU_PROMPTS_DESC] = "Quais botões os ícones do jogo mostram: no texto, no ícone de ação e nas notas da " + "ocarina. Nintendo: os do próprio jogo. Xbox e PlayStation: os botões desse controle (LB, " + "RB, LT, RT, Menu, Exibir; L1, R1, L2, R2, Options, Create), e A, B, X e Y aparecem como " + "o botão que o layout acima aperta (com Nintendo (A à direita) o botão da direita faz A, " + "então os ícones de A mostram B, ou círculo). Teclado e mouse: a tecla de cada botão (E, " + "Ctrl, Espaço, clique esquerdo...), WASD para andar e o mouse para a câmera. Os arquivos " + "dos ícones são feitos a partir de imagens de botões com tools/pad_prompts.py, com as " + "teclas como o nx2navi.ini as define quando ele roda. O jogo lê os ícones ao iniciar, " + "então eles mudam depois de reiniciar. Eles fazem parte dos arquivos do jogo, então um " + "botão remapeado em Controles continua com o ícone antigo na tela até os arquivos serem " + "feitos de novo.", [UI_MENU_PROMPTS_NINTENDO] = "Nintendo", [UI_MENU_PROMPTS_XBOX] = "Xbox", [UI_MENU_PROMPTS_PLAYSTATION] = "PlayStation", - [UI_MENU_PROMPTS_PC] = "PC", + [UI_MENU_PROMPTS_PC] = "Teclado e mouse", [UI_MENU_MOUSE_MODE] = "Câmera com o mouse", [UI_MENU_MOUSE_MODE_DESC] = "Direta: a câmera gira o quanto o mouse se move, como num jogo de PC, sem zona morta nem curva do analógico (jogo 1.4.3; as outras versões usam a emulação do analógico). Emulação do analógico: o mouse age como o analógico direito.", [UI_MENU_MOUSE_STICK] = "Emulação do analógico", @@ -2004,15 +2011,17 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_HDR_UI] = "HUD 和菜单亮度", [UI_MENU_HDR_UI_DESC] = "界面和本菜单的亮度(尼特)。", [UI_MENU_PROMPTS] = "按键提示", - [UI_MENU_PROMPTS_DESC] = "游戏的按键提示显示哪种手柄的按键:包括文字、动作提示和陶笛的音符。Nintendo:游戏原有的提示。Xbox 和 Pla" - "yStation:该手柄的按键(LB、RB、LT、RT、Menu、View;L1、R1、L2、R2、Options、Cr" - "eate),A、B、X、Y 显示为上方布局所按下的按键(使用 Nintendo(A 在右)时由右侧按键执行 A,因此 A" - " 的提示显示 B 或圆圈)。提示文件由 tools/pad_prompts.py 根据按键图片生成。游戏在启动时读取按键" - "提示,因此重启后才会改变。提示属于游戏文件,在“操作”中重新映射的按键在屏幕上仍显示原来的提示。", + [UI_MENU_PROMPTS_DESC] = "游戏的按键提示显示哪种按键:包括文字、动作提示和陶笛的音符。Nintendo:游戏原有的提示。" + "Xbox 和 PlayStation:该手柄的按键(LB、RB、LT、RT、Menu、View;L1、R1、L2、R2、Options、Create)," + "A、B、X、Y 显示为上方布局所按下的按键(使用 Nintendo(A 在右)时由右侧按键执行 A,因此 A 的提示显示 B 或圆圈)。" + "键盘和鼠标:每个按键对应的键(E、Ctrl、空格、左键……),WASD 移动,鼠标控制镜头。" + "提示文件由 tools/pad_prompts.py 根据按键图片生成,键位以生成时 nx2navi.ini 中的设置为准。" + "游戏在启动时读取按键提示,因此重启后才会改变。" + "提示属于游戏文件,在“操作”中重新映射的按键在重新生成文件之前仍显示原来的提示。", [UI_MENU_PROMPTS_NINTENDO] = "Nintendo", [UI_MENU_PROMPTS_XBOX] = "Xbox", [UI_MENU_PROMPTS_PLAYSTATION] = "PlayStation", - [UI_MENU_PROMPTS_PC] = "PC", + [UI_MENU_PROMPTS_PC] = "键盘和鼠标", [UI_MENU_MOUSE_MODE] = "鼠标视角", [UI_MENU_MOUSE_MODE_DESC] = "直接:镜头按鼠标移动的距离转动,与电脑游戏相同,没有摇杆死区和响应曲线(游戏 1.4.3;其他版本使用摇杆模拟)。摇杆模拟:鼠标相当于右摇杆。", [UI_MENU_MOUSE_STICK] = "摇杆模拟", diff --git a/tools/pad_prompts.py b/tools/pad_prompts.py index 507894ac..1148afd7 100644 --- a/tools/pad_prompts.py +++ b/tools/pad_prompts.py @@ -1,23 +1,29 @@ -"""Xbox and PlayStation button prompts for Ocarina of Time (Switch 2), drawn from button art on the player's machine. +"""Xbox, PlayStation and keyboard-and-mouse button prompts for Ocarina of Time (Switch 2), drawn from button art on the +player's machine. - python tools/pad_prompts.py --art FOLDER --game FOLDER [--style xbox|playstation] [--layout position|label] + python tools/pad_prompts.py --art FOLDER --game FOLDER [--style xbox|playstation|pc] [--layout position|label] + [--binds nx2navi.ini] ---art is a folder of button art with the file names of STYLES below: the Source folder of a button prompt art pack, -which holds XGamepad/Default, XGamepad/Light, P5Gamepad/Default and P5Gamepad/Light (128x128 PNGs: a dark button with -a white letter or symbol, or a light button with a coloured one). The art is read where it lies and never enters the -repository. +--art is a folder of button art with the file names of STYLES and KEY_ART below: the Source folder of a button prompt +art pack, which holds XGamepad/Default, XGamepad/Light, P5Gamepad/Default, P5Gamepad/Light, Keyboard_Mouse/Dark and +Keyboard_Mouse/White (128x128 PNGs: a dark button or key with a white label, or a light one with a dark or coloured +label). The art is read where it lies and never enters the repository. --game is the folder of the port's exe and romfs-index.bin. The RomFS is read from its romfs folder (index.json and -romfs.bin, as the setup writes them); --romfs names another, which may also be a folder of extracted files. Each +romfs.bin, as the setup writes them); --romfs names another, which may also be a folder of extracted files. Each pad style and layout becomes the overlay folder /romfs-patches-