diff --git a/docs/controls.md b/docs/controls.md index 0263fbf4..cb33dad1 100644 --- a/docs/controls.md +++ b/docs/controls.md @@ -203,6 +203,10 @@ On game 1.4.3, while one of the game's menus has its focus box (the frame the d- `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. +### Left click on the map + +On game 1.4.3, while the Purah Pad's map is open (found as above; the Scope is not the map), the left mouse button presses A at the map's cursor instead of the button it is bound to (Y by default). A press is A or the binding from the moment the button goes down until it is released, so a button held as the map opens or closes keeps what it pressed (`poll_merged` in `runtime/input.c`). `map_click = 0` (`TOTK_MAP_CLICK=0`, live; the *Left click on the map* row of the Controls tab) leaves the left button on its binding there. The map is found only while `menu_cursor` is on. + ## Nintendo Switch 2 controllers Windows does not present the Switch 2 Pro Controller as a gamepad SDL can open (the log says `input: no gamepad`), so it needs a bridge program that wakes it and creates a virtual gamepad. The DS4Windows fork by hbashton ([github.com/hbashton/DS4Windows](https://github.com/hbashton/DS4Windows), tested with release VIIPERRC4.5.1, a pre-release) with the output set to an emulated DualSense gives buttons, rumble, gyro and accelerometer, and reads the sticks through the controller's calibration (they rest at 0 to 2%). The game reads its virtual DualSense directly; the log then shows `input: gamepad "DualSense Wireless Controller" (rumble, gyro and accelerometer, ...)` and `input: motion sensors on`. Its release notes also list Joy-Con 2 support, which is untested here. diff --git a/runtime/cfg.c b/runtime/cfg.c index dbb73f7d..06878bcc 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -46,7 +46,7 @@ static const char *const known[] = { "FREEZE_IDLE", "FREE_CORES", "FULLSCREEN", "FXAA", "GPL", "GPL_DRAW_BUILD", "GPU", "GPU_INDEX", "GPU_NAME", "HDR", "HDR_GAME_NITS", "HDR_HUE", "HDR_PEAK_NITS", "HDR_UI_NITS", "HIGHFPS_FIX", "INPUT", "INPUT_RECORD", "INPUT_SCRIPT", "KSPIN_US", "LANG", "LIB_PREBUILD", - "LIB_PREBUILD_KEEP", "LIB_PREBUILD_THREADS", "LOCALE", "LOD_GUARD", "LSTICK_DEADZONE", "MEMORY", "MENU_LANG", "MENU_TEST", + "LIB_PREBUILD_KEEP", "LIB_PREBUILD_THREADS", "LOCALE", "LOD_GUARD", "LSTICK_DEADZONE", "MAP_CLICK", "MEMORY", "MENU_LANG", "MENU_TEST", "MEM_RESERVE_MIB", "MENU_CURSOR", "MENU_CURSOR_LOG", "MENU_TEST_DIR", "MENU_TEST_SET", "MINIMAL_LAYOUT", "MIRROR_GAP", "MODS_DIR", "MODS_DISABLED", "MODS_ORDER", "MODS_REBUILD", "MOTION", "MOUSE_AIM_SCALE", "MOUSE_MODE", "MOUSE_DIRECT_PATCH", "MOUSE_SENS", "MOVIE_ASPECT", "MOVIE_HOST", "MOVIE_PACE", "MVOBJ_ALL", "MVOBJ_BANKS", "MVOBJ_EQUAL", "MVOBJ_EXACT", "MVOBJ_EXEC", "MVOBJ_NOC4", "MVOBJ_ONLY", "MVOBJ_TIMES", "MVPREV_CHECK", "MVPREV_GROW", "MVPREV_SKIP", "MVPREV_TRUST", "MV_CHECK", "MV_SURVEY", @@ -89,7 +89,7 @@ static const struct { const char *key, *section; } sections[] = { {"MOTION", "input"}, {"RUMBLE_STRENGTH", "input"}, {"RUMBLE_CURVE", "input"}, {"RUMBLE_TRIGGERS", "input"}, {"PAD_LAYOUT", "input"}, {"PROMPTS", "input"}, {"STICK_DEADZONE", "input"}, {"LSTICK_DEADZONE", "input"}, {"RSTICK_DEADZONE", "input"}, {"STICK_SENS", "input"}, - {"MENU_CURSOR", "input"}, {"MOUSE_MODE", "input"}, {"MOUSE_SENS", "input"}, {"MOUSE_AIM_SCALE", "input"}, {"WALK_KEY", "input"}, {"WALK_SCALE", "input"}, {"INPUT_RECORD", "input"}, + {"MENU_CURSOR", "input"}, {"MAP_CLICK", "input"}, {"MOUSE_MODE", "input"}, {"MOUSE_SENS", "input"}, {"MOUSE_AIM_SCALE", "input"}, {"WALK_KEY", "input"}, {"WALK_SCALE", "input"}, {"INPUT_RECORD", "input"}, {"BIND_A", "input"}, {"BIND_B", "input"}, {"BIND_X", "input"}, {"BIND_Y", "input"}, {"BIND_LCLICK", "input"}, {"BIND_RCLICK", "input"}, {"BIND_L", "input"}, {"BIND_R", "input"}, {"BIND_ZL", "input"}, {"BIND_ZR", "input"}, {"BIND_PLUS", "input"}, {"BIND_MINUS", "input"}, {"BIND_LEFT", "input"}, {"BIND_UP", "input"}, @@ -156,6 +156,7 @@ static const CfgMeta metas[] = { {"LSTICK_DEADZONE", "", "0..50", LIVE}, {"RSTICK_DEADZONE", "", "0..50", LIVE}, {"MOUSE_MODE", "direct", "stick|direct", LIVE}, {"MOUSE_SENS", "1", "0..10", LIVE}, {"MOUSE_AIM_SCALE", "1", "0.1..3", LIVE}, {"MENU_CURSOR", "1", "0|1", LIVE}, + {"MAP_CLICK", "1", "0|1", LIVE}, // input.c: the left mouse button is A on the Purah Pad's map {"WALK_KEY", "none", NULL, LIVE}, {"WALK_SCALE", "0.51", "0.2..0.9", LIVE}, {"MENU_LANG", "", "en|ru|pt-BR|zh-Hans", LIVE}, {"AMIIBO_DIR", "", NULL, LIVE}, diff --git a/runtime/input.c b/runtime/input.c index 6cfca650..ccf61452 100644 --- a/runtime/input.c +++ b/runtime/input.c @@ -641,6 +641,14 @@ static void poll_merged(uint64_t *buttons, int32_t *lx, int32_t *ly, int32_t *rx if (!counts || mouse_ignore[k]) down[k] = 0; } was_captured = cap; + // On the Purah Pad's map (menu_cursor.c finds it, TOTK_MAP_CLICK) the left mouse button presses A at the + // map's cursor, which the mouse moves there, instead of its binding (Y by default). A press is one or the + // other from the moment it goes down until it is released, so a button held as the map opens or closes + // keeps what it pressed. + static int click_held, click_a; + if (!down[KEY_MOUSE_L]) click_held = click_a = 0; + else if (!click_held) click_held = 1, click_a = menu_cursor_map() && cfg_bool("TOTK_MAP_CLICK"); + if (click_a) down[KEY_MOUSE_L] = 0, b |= 1ull << B_A; b |= input_map_buttons(down); int32_t k[2]; walk_get(); diff --git a/runtime/menu_cursor.c b/runtime/menu_cursor.c index a2d8e093..25bd0afc 100644 --- a/runtime/menu_cursor.c +++ b/runtime/menu_cursor.c @@ -20,6 +20,9 @@ // // Only while keyboard and mouse are the device used last (input_kbm_last): a gamepad player sees the menus unchanged. // TOTK_MENU_CURSOR (live, default 1): 0 leaves the menus to the keys and the pad. +// +// On the map input.c makes the left mouse button A (menu_cursor_map; TOTK_MAP_CLICK, live, default 1), so a click +// acts at the map's cursor. The map is found only while TOTK_MENU_CURSOR is on. #include #include #include diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index 2bed97ed..5ecfa5d3 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -867,6 +867,7 @@ static void tab_controls(float scale) { 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); + opt_toggle("TOTK_MAP_CLICK", UI_MENU_MAP_CLICK, UI_MENU_MAP_CLICK_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 690383b7..ad1c55a9 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -283,6 +283,8 @@ static const char *const text_en[UI_TEXT_COUNT] = { [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_MAP_CLICK] = "Left click on the map", + [UI_MENU_MAP_CLICK_DESC] = "On the Purah Pad's map, the left mouse button presses A at the map's cursor instead of the button it is bound to (Y by default). Needs Mouse in the game's menus (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", @@ -763,6 +765,8 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_MOUSE_DIRECT] = "Прямое", [UI_MENU_MENU_CURSOR] = "Мышь в меню игры", [UI_MENU_MENU_CURSOR_DESC] = "В меню самой игры (заставка, инвентарь, магазины, варианты ответа) появляется указатель: пункт под ним выбирается, левый щелчок подтверждает, правый возвращает назад. Только если последними использовались мышь или клавиатура, поэтому с геймпадом меню не меняются (версия игры 1.4.3).", + [UI_MENU_MAP_CLICK] = "Левый щелчок на карте", + [UI_MENU_MAP_CLICK_DESC] = "На карте игры левая кнопка мыши нажимает A у курсора карты, а не назначенную ей кнопку (по умолчанию Y). Нужна «Мышь в меню игры» (версия игры 1.4.3).", [UI_MENU_MOUSE_SENS] = "Чувствительность мыши", [UI_MENU_MOUSE_SENS_DESC] = "Как быстро мышь поворачивает камеру.", [UI_MENU_WALK_KEY] = "Клавиша шага", @@ -1416,6 +1420,8 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { [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_MAP_CLICK] = "Clique esquerdo no mapa", + [UI_MENU_MAP_CLICK_DESC] = "No mapa do jogo, o botão esquerdo do mouse aperta A no cursor do mapa, em vez do botão ao qual está atribuído (Y por padrão). Requer Mouse nos menus do jogo (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", @@ -2045,6 +2051,8 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_MOUSE_DIRECT] = "直接", [UI_MENU_MENU_CURSOR] = "在游戏菜单中使用鼠标", [UI_MENU_MENU_CURSOR_DESC] = "在游戏自身的菜单中(标题、背包、商店、对话选项)显示指针:指针下的项目被选中,左键确认,右键返回。仅在最后使用的是鼠标或键盘时生效,因此使用手柄时菜单保持不变(游戏 1.4.3)。", + [UI_MENU_MAP_CLICK] = "在地图上左键单击", + [UI_MENU_MAP_CLICK_DESC] = "在游戏地图上,鼠标左键在地图光标处按下 A 键,而不是按下它所绑定的按键(默认为 Y)。需要开启“在游戏菜单中使用鼠标”(游戏 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 3bed8949..c077c608 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -116,6 +116,7 @@ typedef enum { 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_MAP_CLICK, UI_MENU_MAP_CLICK_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 c45a74b2..1aca43cf 100644 --- a/totk.ini.example +++ b/totk.ini.example @@ -348,6 +348,10 @@ # right click is B. On the map the mouse moves the map's cursor and the scroll wheel zooms. 0 leaves the menus and # the map to the keys and the pad. Changes while the game runs. # menu_cursor = 1 +# The left mouse button on the Purah Pad's map, 1.4.3 only: it presses A at the map's cursor instead of the button it +# is bound to (Y by default). Needs menu_cursor = 1, which finds the map. 0 leaves the left button on its binding +# there. Changes while the game runs. +# map_click = 1 # Mouse camera sensitivity (0 to 10; 0 = no mouse camera and no cursor capture). With mouse_mode = direct, 1 turns the # camera 0.08 degrees per count, the same in every camera mode (about 14.3 cm a turn at 800 DPI). # mouse_sens = 1