diff --git a/docs/controls.md b/docs/controls.md index 9e4aee22..168c2c3c 100644 --- a/docs/controls.md +++ b/docs/controls.md @@ -94,7 +94,7 @@ bind_Y = pad:north, key:mouse_l ## Mouse camera -`mouse_mode = direct` enables experimental mouse hooks on game 1.4.3. The free-orbit camera receives raw-count +`mouse_mode = direct` (the default) turns the camera by the raw mouse motion on game 1.4.3, through hooks in the game's camera code (`runtime/mouse_direct.c`, the `mouse_direct` sites of `recomp/patches-v143.txt`). None of them changes a step of the gamepad alone. The free-orbit camera receives raw-count angular increments at its final spherical-angle output: 0.08 degrees per count on both axes at sensitivity 1, with no time multiplier, curve or carry into later frames. The controller's persistent pitch/yaw move with the output. Mouse input is removed from its stick path first, so the camera's later vertical signed-square curve and velocity @@ -102,7 +102,7 @@ filters cannot process it a second time. Other camera modes receive input after clamp and stick response exponent; Ultrahand has a separate hook after its manipulation input's power curves. The game's camera inversion and gamepad response remain in effect. `mouse_sens` scales raw counts; its scale differs from the stick-emulation mode. Start at 1. -The Controls tab can switch between *Stick emulation* (the default, `mouse_mode = stick`) and *Direct (experimental)*. +The Controls tab switches between *Direct* and *Stick emulation* (`mouse_mode = stick`). The orbit camera keeps its desired pitch at the final angular output, including stationary frames, so a later game filter cannot recenter it. The persistent filter state accounts for the camera's current vertical offset instead of accumulating corrections. A gamepad vertical input or the game's lock-on/override releases that mouse target. @@ -117,8 +117,7 @@ or the gamepad's right stick. A mouse gesture for it would also fire while a hel A step of the gamepad alone, with no mouse motion and no pitch the mouse holds, reaches the camera exactly as without the hooks. The mapping below is still used when the camera-input hook is unavailable or the game disables camera input. -This hook needs in-game checks of aiming, Ultrahand and menu transitions before it can be considered complete mouse -support. Games 1.1.0 and 1.2.1 have no hook and keep stick emulation. +Games 1.1.0 and 1.2.1 have no hooks and keep stick emulation whatever `mouse_mode` says. In stick-emulation mode, mouse motion (raw input) becomes right-stick deflection. Each presented frame takes the counts moved since the last frame, divides by the frame time and sets the deflection to `counts per second * TOTK_MOUSE_SENS / 3000` of full, held for that frame, so the turn rate does not depend on the frame rate. This is not mouselook: the game's stick curve and dead zone still apply, so very slow movements do nothing and a fast flick saturates. The mouse deflection competes with the gamepad and arrow keys by the larger-deflection rule. @@ -132,7 +131,7 @@ The stick direction bits (`StickLLeft` to `StickRDown`) are derived from the sti On game 1.4.3, while one of the game's menus has its focus box (the frame the d-pad moves: the title, the save list, the inventory and its System tab, Options, shops, dialogue choices), the cursor is released from the mouse camera and shown in the middle of the window. The item under the pointer takes the focus as if the d-pad had moved there, with the game's highlight, sound and description; a left click is A on it, a right click is B. The keys and the pad keep working, and the focus moves only when the pointer moves. This happens only while the keyboard and mouse are the device used last: after a gamepad button press or a stick pushed past half way the menus are as on the console, with no pointer, until the mouse moves or a key is pressed (`input_kbm_last` in `runtime/input.c`). The ability wheel, the d-pad strips, Autobuild, the Purah Pad's camera and the map stay gameplay: the mouse keeps the camera there. When the menu closes the cursor is captured again. -`runtime/menu_cursor.c` reads eui's screens at each pad read and moves the focus with the writes `eui::BoxCursorMgr::moveBoxCursor` makes, so no game code is called. `menu_cursor = 0` (`TOTK_MENU_CURSOR=0`, live) turns it off; `TOTK_MENU_CURSOR_LOG=1` logs every screen it reads (by default the first six), with the layout size, the node count and the hit panes it uses. +`runtime/menu_cursor.c` reads eui's screens at each pad read and moves the focus with the writes `eui::BoxCursorMgr::moveBoxCursor` makes, so no game code is called. `menu_cursor = 0` (`TOTK_MENU_CURSOR=0`, live; the *Mouse in the game's menus* row of the Controls tab) turns it off; `TOTK_MENU_CURSOR_LOG=1` logs every screen it reads (by default the first six), with the layout size, the node count and the hit panes it uses. ## Nintendo Switch 2 controllers diff --git a/runtime/cfg.c b/runtime/cfg.c index 11ecb679..aa96417b 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -147,7 +147,7 @@ static const CfgMeta metas[] = { {"PROMPTS", "nintendo", "nintendo|xbox|keyboard", RESTART}, {"STICK_DEADZONE", "8", "0..50", LIVE}, {"STICK_SENS", "1", "0.1..3", RESTART}, {"LSTICK_DEADZONE", "", "0..50", LIVE}, {"RSTICK_DEADZONE", "", "0..50", LIVE}, - {"MOUSE_MODE", "stick", "stick|direct", LIVE}, + {"MOUSE_MODE", "direct", "stick|direct", LIVE}, {"MOUSE_SENS", "1", "0..10", LIVE}, {"MENU_CURSOR", "1", "0|1", LIVE}, {"WALK_KEY", "none", NULL, LIVE}, {"WALK_SCALE", "0.51", "0.2..0.9", LIVE}, {"MENU_LANG", "", "en|ru|pt-BR|zh-Hans", LIVE}, diff --git a/runtime/mouse_direct.c b/runtime/mouse_direct.c index f3516ad3..ecafaf06 100644 --- a/runtime/mouse_direct.c +++ b/runtime/mouse_direct.c @@ -194,7 +194,7 @@ static void camera_input(Cpu *c) { static int logged; if (!logged) { logged = 1; - rt_log("mouse: direct camera input after the stick dead zone, clamp and exponent (experimental)"); + rt_log("mouse: direct camera input after the stick dead zone, clamp and exponent"); } } } @@ -304,7 +304,7 @@ static void hand_input(Cpu *c) { static int logged; if (!logged && (m.motion[0] || m.motion[1])) { logged = 1; - rt_log("mouse: held-object input after the manipulation controller's power curves (experimental)"); + rt_log("mouse: held-object input after the manipulation controller's power curves"); } } } diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index f68d4563..a75928ee 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -839,6 +839,7 @@ static void tab_controls(float scale) { static const UiTextId mouse_modes[] = {UI_MENU_MOUSE_STICK, UI_MENU_MOUSE_DIRECT}; opt_choice("TOTK_MOUSE_MODE", UI_MENU_MOUSE_MODE, mouse_modes, 2, UI_MENU_MOUSE_MODE_DESC); opt_slider("TOTK_MOUSE_SENS", UI_MENU_MOUSE_SENS, 0, 10, UI_MENU_MOUSE_SENS_DESC, 0.1f, "%.1f"); + opt_toggle("TOTK_MENU_CURSOR", UI_MENU_MENU_CURSOR, UI_MENU_MENU_CURSOR_DESC); row_walk_key(); opt_slider("TOTK_WALK_SCALE", UI_MENU_WALK_SCALE, 0.2f, 0.9f, UI_MENU_WALK_SCALE_DESC, 0.01f, "%.2f"); // Analog sticks: one dead zone row per stick, falling back to TOTK_STICK_DEADZONE (both sticks) while unset. With diff --git a/runtime/ui_text.c b/runtime/ui_text.c index b4e15e6e..e97d44a4 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -264,9 +264,11 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_STICK_DEADZONE_DESC] = "How far a gamepad stick moves before the game sees it. Raise it if the character or the camera moves on its own: let go of the stick, read \"stick now\" and set the dead zone a few percent above it.", [UI_MENU_STICK_DEADZONE_NOW] = "stick now: %.0f %%", [UI_MENU_MOUSE_MODE] = "Mouse camera", - [UI_MENU_MOUSE_MODE_DESC] = "Direct input bypasses the game's stick dead zone and response curve (experimental, game 1.4.3).", + [UI_MENU_MOUSE_MODE_DESC] = "Direct: the camera turns by how far the mouse moves, as in a PC game, with no stick dead zone or curve (game 1.4.3; other versions use stick emulation). Stick emulation: the mouse acts as the right stick.", [UI_MENU_MOUSE_STICK] = "Stick emulation", - [UI_MENU_MOUSE_DIRECT] = "Direct (experimental)", + [UI_MENU_MOUSE_DIRECT] = "Direct", + [UI_MENU_MENU_CURSOR] = "Mouse in the game's menus", + [UI_MENU_MENU_CURSOR_DESC] = "In the game's own menus (title, inventory, shops, dialogue choices) the pointer shows: the item under it is selected, left click confirms, right click goes back. Only after the mouse or a key was used last, so a gamepad sees the menus unchanged (game 1.4.3).", [UI_MENU_MOUSE_SENS] = "Mouse camera sensitivity", [UI_MENU_MOUSE_SENS_DESC] = "How fast the mouse turns the camera.", [UI_MENU_WALK_KEY] = "Walk key", @@ -721,9 +723,11 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_STICK_DEADZONE_DESC] = "Насколько нужно отклонить стик геймпада, чтобы игра это заметила. Увеличьте, если персонаж или камера двигаются сами: отпустите стик, посмотрите «стик сейчас» и поставьте мёртвую зону на несколько процентов выше.", [UI_MENU_STICK_DEADZONE_NOW] = "стик сейчас: %.0f %%", [UI_MENU_MOUSE_MODE] = "Управление мышью", - [UI_MENU_MOUSE_MODE_DESC] = "Прямой ввод обходит мёртвую зону и кривую стика (экспериментально, версия игры 1.4.3).", + [UI_MENU_MOUSE_MODE_DESC] = "Прямое: камера поворачивается на столько, на сколько сдвинута мышь, как в играх для ПК, без мёртвой зоны и кривой стика (версия игры 1.4.3; на других версиях эмуляция стика). Эмуляция стика: мышь работает как правый стик.", [UI_MENU_MOUSE_STICK] = "Эмуляция стика", - [UI_MENU_MOUSE_DIRECT] = "Прямое (экспериментально)", + [UI_MENU_MOUSE_DIRECT] = "Прямое", + [UI_MENU_MENU_CURSOR] = "Мышь в меню игры", + [UI_MENU_MENU_CURSOR_DESC] = "В меню самой игры (заставка, инвентарь, магазины, варианты ответа) появляется указатель: пункт под ним выбирается, левый щелчок подтверждает, правый возвращает назад. Только если последними использовались мышь или клавиатура, поэтому с геймпадом меню не меняются (версия игры 1.4.3).", [UI_MENU_MOUSE_SENS] = "Чувствительность мыши", [UI_MENU_MOUSE_SENS_DESC] = "Как быстро мышь поворачивает камеру.", [UI_MENU_WALK_KEY] = "Клавиша шага", @@ -1336,6 +1340,12 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { [UI_MENU_PROMPTS_NINTENDO] = "Nintendo", [UI_MENU_PROMPTS_XBOX] = "Xbox", [UI_MENU_PROMPTS_KEYBOARD] = "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", + [UI_MENU_MOUSE_DIRECT] = "Direta", + [UI_MENU_MENU_CURSOR] = "Mouse nos menus do jogo", + [UI_MENU_MENU_CURSOR_DESC] = "Nos menus do próprio jogo (título, inventário, lojas, escolhas de diálogo) o ponteiro aparece: o item sob ele fica selecionado, o clique esquerdo confirma e o direito volta. Só depois de usar o mouse ou uma tecla por último, então com um controle os menus ficam como antes (jogo 1.4.3).", [UI_MENU_PROMPTS_MISSING] = "faltam os arquivos dos ícones: execute a instalação de novo", [UI_MENU_PROMPTS_FAILED] = "arquivos dos ícones danificados: execute a instalação de novo", [UI_MENU_PROMPTS_RESTART] = "os ícones mudam após reiniciar", @@ -1933,6 +1943,12 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_PROMPTS_NINTENDO] = "Nintendo", [UI_MENU_PROMPTS_XBOX] = "Xbox", [UI_MENU_PROMPTS_KEYBOARD] = "键盘和鼠标", + [UI_MENU_MOUSE_MODE] = "鼠标视角", + [UI_MENU_MOUSE_MODE_DESC] = "直接:镜头按鼠标移动的距离转动,与电脑游戏相同,没有摇杆死区和响应曲线(游戏 1.4.3;其他版本使用摇杆模拟)。摇杆模拟:鼠标相当于右摇杆。", + [UI_MENU_MOUSE_STICK] = "摇杆模拟", + [UI_MENU_MOUSE_DIRECT] = "直接", + [UI_MENU_MENU_CURSOR] = "在游戏菜单中使用鼠标", + [UI_MENU_MENU_CURSOR_DESC] = "在游戏自身的菜单中(标题、背包、商店、对话选项)显示指针:指针下的项目被选中,左键确认,右键返回。仅在最后使用的是鼠标或键盘时生效,因此使用手柄时菜单保持不变(游戏 1.4.3)。", [UI_MENU_PROMPTS_MISSING] = "缺少按键提示文件:请重新运行安装程序", [UI_MENU_PROMPTS_FAILED] = "按键提示文件已损坏:请重新运行安装程序", [UI_MENU_PROMPTS_RESTART] = "按键提示重启后生效", diff --git a/runtime/ui_text.h b/runtime/ui_text.h index 478581d3..37b4da8d 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -108,6 +108,7 @@ typedef enum { UI_MENU_GROUP_STICKS, UI_MENU_LSTICK_DEADZONE, UI_MENU_RSTICK_DEADZONE, UI_MENU_STICK_DEADZONE_DESC, UI_MENU_STICK_DEADZONE_NOW, UI_MENU_STICK_SENS, UI_MENU_STICK_SENS_DESC, UI_MENU_MOUSE_MODE, UI_MENU_MOUSE_MODE_DESC, UI_MENU_MOUSE_STICK, UI_MENU_MOUSE_DIRECT, + UI_MENU_MENU_CURSOR, UI_MENU_MENU_CURSOR_DESC, UI_MENU_MOUSE_SENS, UI_MENU_MOUSE_SENS_DESC, UI_MENU_WALK_KEY, UI_MENU_WALK_KEY_DESC, UI_MENU_WALK_KEY_TAKEN, UI_MENU_WALK_SCALE, UI_MENU_WALK_SCALE_DESC, diff --git a/totk.ini.example b/totk.ini.example index eb5c82cf..af264454 100644 --- a/totk.ini.example +++ b/totk.ini.example @@ -298,10 +298,10 @@ # tab shows each stick's deflection now, so a drifting stick's resting value can be read off. # lstick_deadzone = 8 # rstick_deadzone = 8 -# Mouse camera mode: stick (default) or direct (experimental, game 1.4.3 only). Direct free-camera input uses -# raw displacement with equal horizontal/vertical sensitivity and bypasses stick response curves. Other game versions -# keep stick emulation. The Controls tab changes this while the game runs. -# mouse_mode = stick +# Mouse camera mode: direct (default) or stick. Direct turns the camera by the raw mouse motion, the same on both axes, +# with no stick dead zone or response curve (game 1.4.3; other game versions use stick emulation). Stick makes the +# mouse a right stick. Neither changes the gamepad. The Controls tab changes this while the game runs. +# mouse_mode = direct # The mouse in the game's menus, 1.4.3 only (title, inventory, System tab, Options, shops, dialogue choices): while a # menu has the game's focus box the pointer shows, the item under it takes the focus, a left click is A on it and a # right click is B. 0 leaves the menus to the keys and the pad. Changes while the game runs.