diff --git a/docs/controls.md b/docs/controls.md index c1c9cead..8263c8ed 100644 --- a/docs/controls.md +++ b/docs/controls.md @@ -94,7 +94,7 @@ Mouse motion (raw input) becomes right-stick deflection. Each presented frame ta `TOTK_MOUSE_SENS` (0 to 10, default 1; higher turns faster, 0 turns the mouse camera and the cursor capture off). While the window is the foreground window the cursor is hidden and confined to the client area. It is released on focus loss, minimise, while F11 changes the window, during a size or move loop and while a text entry is open. Esc releases it by hand: the cursor shows, the mouse camera and mouse buttons stop, and the window can be moved, minimised or closed. A mouse click inside the client area captures it again; that click does not reach the game. Activating the window by a click on its title bar or border does not capture, so it can be dragged or closed right away; Alt+Tab or a click in the client area captures as before. `TOTK_INPUT=none` disables the capture too. -`TOTK_STICK_DEADZONE` (0 to 50, default 8) is the gamepad stick dead zone in percent of full deflection, the same for both sticks. It is round: a stick inside the circle reads centred, and the rest of its travel is scaled to start at 0 at the edge, so full deflection still reaches full. Raise it for a stick that drifts. The game's own dead zone applies after it. +`TOTK_STICK_DEADZONE` (0 to 50, default 8) is the gamepad stick dead zone in percent of full deflection, the same for both sticks. It is round: a stick inside the circle reads centred, and the rest of its travel is scaled to start at 0 at the edge, so full deflection still reaches full. Raise it for a stick that drifts. The game's own dead zone applies after it. `TOTK_LSTICK_DEADZONE` and `TOTK_RSTICK_DEADZONE` (the *Left/Right stick dead zone* rows on the Controls tab) set one stick each and fall back to `TOTK_STICK_DEADZONE` while unset, so a worn stick can get a larger zone than the other. With a gamepad connected each row shows its stick's deflection now, before the dead zone (*stick now*): let go of the stick and set the row a few percent above the value it rests at. The stick direction bits (`StickLLeft` to `StickRDown`) are derived from the sticks at 50% deflection. A gamepad plugged in later is picked up within one second; with none connected the log says `input: no gamepad`. diff --git a/runtime/cfg.c b/runtime/cfg.c index d1fc9085..b9d0ce95 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -39,14 +39,14 @@ static const char *const known[] = { "EXEFS", "FEEDBACK", "FIX_C0", "FIX_ZERO", "FLIGHT", "FLIGHT_AT", "FLIGHT_DIR", "FLIGHT_FRAMES", "FLIGHT_SPIKE_MS", "FLIGHT_THUMBS", "FOV", "FOV_PATCH", "FPS60", "FPS_LIMIT", "FREEZE_IDLE", "FREE_CORES", "FULLSCREEN", "GPL", "GPL_DRAW_BUILD", "GPU", "GPU_INDEX", "GPU_NAME", "HDR", "HDR_GAME_NITS", "HDR_PEAK_NITS", "HDR_UI_NITS", "HIGHFPS_FIX", "INPUT", "INPUT_RECORD", "INPUT_SCRIPT", "LANG", "LIB_PREBUILD", - "LIB_PREBUILD_KEEP", "LIB_PREBUILD_THREADS", "LOCALE", "LOD_GUARD", "MEMORY", "MENU_LANG", "MENU_TEST", + "LIB_PREBUILD_KEEP", "LIB_PREBUILD_THREADS", "LOCALE", "LOD_GUARD", "LSTICK_DEADZONE", "MEMORY", "MENU_LANG", "MENU_TEST", "MENU_TEST_DIR", "MENU_TEST_SET", "MINIMAL_LAYOUT", "MIRROR_GAP", "MOTION", "MOUSE_SENS", "MOVIE_HOST", "MOVIE_PACE", "ONE_PER_CORE", "OPERATION_MODE", "OUTPUT_RES", "PAD_LAYOUT", "PATCH_OUTPUT", "PATCH_SCENE", "PERF_OVERLAY", "PERF_SLOW_MS", "PIPELINE_CACHE", "PIPE_MEMO", "PIPE_PREBUILD", "PIPE_SKIP", "PIPE_SYNC", "PIPE_WAIT", "PREWARM_XLATE", "PROBE_MOVIE", "PROBE_MOVIE_SHOT", "PROFILE", "PROFILE_CHAINS", "PROFILE_DIR", "PROFILE_FRAMES", "PROFILE_MAIN", "PROFILE_RENDER", "PROMPTS", "PUSH_SKIP", "PUSH_STAGE", "RDOC", "RDOC_DIR", "RDOC_DLL", "REALTIME", "REC_END", "REEXEC", "RENDER_SCALE", "REPLAY_ASYNC", "REPLAY_CHECK", "RESOLVE_CHECK", "RESTART_WAIT", "ROMFS", "ROMFS_INDEX", "ROMFS_MMAP", "ROMFS_MODS", "ROMFS_PATCHES", - "ROMFS_PROOF_DIR", "ROMFS_VERIFY", "RUMBLE", "RUMBLE_CURVE", "RUMBLE_STRENGTH", "RUMBLE_TRIGGERS", "SHADER_CACHE", + "ROMFS_PROOF_DIR", "ROMFS_VERIFY", "RSTICK_DEADZONE", "RUMBLE", "RUMBLE_CURVE", "RUMBLE_STRENGTH", "RUMBLE_TRIGGERS", "SHADER_CACHE", "SHADER_MEMO", "SHADOW_RES", "SHARED_FONTS", "SHARPNESS", "SHOTS", "SHOTS_DIR", "SHOTS_FULL", "SPEED_PROBE", "SPIN", "SPIN_HANDOFF_US", "SPLIT_DRAWS", "SPLIT_US", "STICK_DEADZONE", "STICK_SENS", "SWKBD_ANSWER", "SWKBD_TEST", "TEST_PAD", "TEST_PREPARE_SHADERS", "TEX_ALIAS", "TEX_MEMO", "TEX_VRAM_PRESSURE", "TIMER_1MS", "TRACE", "UBO_SNAPSHOT", "UPSCALER", "VK_DYN_A2C", "VK_DYN_VERTEX", "VK_NO_FLOAT64", "VK_PRESENT", "VK_RECORDER", "VK_SSBO_ALIGN", "VK_SUBGROUP", "VK_SUBGROUP_PIN", "VK_VALIDATION", "VOLUME", "VRAM_HEADROOM", "VS_OUTS", @@ -69,7 +69,8 @@ static const struct { const char *key, *section; } sections[] = { {"MENU_LANG", "language"}, {"LANG", "language"}, {"OPERATION_MODE", "language"}, {"VOLUME", "audio"}, {"MOTION", "input"}, {"RUMBLE_STRENGTH", "input"}, {"RUMBLE_CURVE", "input"}, {"RUMBLE_TRIGGERS", "input"}, - {"PAD_LAYOUT", "input"}, {"PROMPTS", "input"}, {"STICK_DEADZONE", "input"}, {"STICK_SENS", "input"}, + {"PAD_LAYOUT", "input"}, {"PROMPTS", "input"}, {"STICK_DEADZONE", "input"}, {"LSTICK_DEADZONE", "input"}, {"RSTICK_DEADZONE", "input"}, + {"STICK_SENS", "input"}, {"MOUSE_SENS", "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"}, @@ -125,6 +126,7 @@ static const CfgMeta metas[] = { {"RUMBLE_TRIGGERS", "0", "0|1", LIVE}, {"PAD_LAYOUT", "auto", "auto|nintendo|xbox", LIVE}, {"PROMPTS", "nintendo", "nintendo|xbox", 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_SENS", "1", "0..10", 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/cfg_probe.c b/runtime/cfg_probe.c index 0473ce5a..815bc811 100644 --- a/runtime/cfg_probe.c +++ b/runtime/cfg_probe.c @@ -1,4 +1,5 @@ // --probe-cfg: totk.ini parsing, the environment override and a missing file (cfg.c). Needs no game files. +#include #include #include #include @@ -272,6 +273,22 @@ int probe_cfg(void) { "pad stick: a square gate's corner stays on the unit circle"); input_pad_stick(0, 32767 / 2 + 1, 0.2f, st); CHECK(abs(st[1] - 32767 * 3 / 8) <= 3, "pad stick: half deflection past a 20% zone is (0.5 - 0.2) / 0.8 of full"); + _putenv_s("TOTK_STICK_DEADZONE", "12"); + _putenv_s("TOTK_LSTICK_DEADZONE", ""); + _putenv_s("TOTK_RSTICK_DEADZONE", ""); + CHECK(fabsf(input_pad_deadzone(0) - 0.12f) < 1e-6f && fabsf(input_pad_deadzone(1) - 0.12f) < 1e-6f, + "pad dead zone: both sticks follow stick_deadzone while lstick/rstick are unset"); + _putenv_s("TOTK_RSTICK_DEADZONE", "20"); + CHECK(fabsf(input_pad_deadzone(0) - 0.12f) < 1e-6f && fabsf(input_pad_deadzone(1) - 0.20f) < 1e-6f, + "pad dead zone: rstick_deadzone sets the right stick alone"); + _putenv_s("TOTK_LSTICK_DEADZONE", "80"); + CHECK(fabsf(input_pad_deadzone(0) - 0.5f) < 1e-6f, "pad dead zone: clamped to 50%"); + _putenv_s("TOTK_STICK_DEADZONE", ""); + _putenv_s("TOTK_LSTICK_DEADZONE", ""); + _putenv_s("TOTK_RSTICK_DEADZONE", ""); + CHECK(input_stick_percent(32767, 0) > 99.99 && input_stick_percent(32767, 0) < 100.01 && + input_stick_percent(0, 0) == 0 && fabs(input_stick_percent(3000, -4000) - 5000 * 100.0 / 32767) < 1e-9, + "stick percent: an axis's end is 100%, the centre 0%, round in between"); // Gamepad layouts (input_map.c) CHECK(input_pad_layout_pick("auto", 1) == PAD_LAYOUT_NINTENDO && input_pad_layout_pick(NULL, 0) == PAD_LAYOUT_XBOX, "pad layout: automatic is Nintendo for an east button labelled A, Xbox otherwise"); diff --git a/runtime/input.c b/runtime/input.c index 4980dac1..0e2e4647 100644 --- a/runtime/input.c +++ b/runtime/input.c @@ -314,16 +314,17 @@ static void mouse_camera(int32_t out[2]) { out[1] = (int32_t)lround(y); } -static float stick_dead = -1; // TOTK_STICK_DEADZONE as a fraction of full deflection; live (cfg_version) +static float stick_dead[2] = {-1, -1}; // input_pad_deadzone of the left and right stick; live (cfg_version) static unsigned stick_dead_seen; -static float stick_dead_get(void) { +static float stick_dead_get(int s) { unsigned ver = cfg_version(); - if (stick_dead >= 0 && ver == stick_dead_seen) return stick_dead; - stick_dead_seen = ver; - double v = cfg_double("TOTK_STICK_DEADZONE"); - stick_dead = (float)(v < 0 ? 0 : v > 50 ? 50 : v) / 100.f; - return stick_dead; + if (stick_dead[0] < 0 || ver != stick_dead_seen) { + stick_dead_seen = ver; + stick_dead[0] = input_pad_deadzone(0); + stick_dead[1] = input_pad_deadzone(1); + } + return stick_dead[s]; } // One gamepad stick through the dead zone; SDL's Y grows downwards, the Switch's upwards. @@ -476,12 +477,26 @@ static int pad_read(uint64_t *b, int32_t sl[2], int32_t sr[2]) { uint8_t pd[PAD_COUNT] = {0}; if (!pad_physical(pd)) return 0; *b |= input_map_pad_buttons(pd, pad_layout_get()); - float dead = stick_dead_get(); - stick(SDL_GAMEPAD_AXIS_LEFTX, SDL_GAMEPAD_AXIS_LEFTY, dead, sl); - stick(SDL_GAMEPAD_AXIS_RIGHTX, SDL_GAMEPAD_AXIS_RIGHTY, dead, sr); + stick(SDL_GAMEPAD_AXIS_LEFTX, SDL_GAMEPAD_AXIS_LEFTY, stick_dead_get(0), sl); + stick(SDL_GAMEPAD_AXIS_RIGHTX, SDL_GAMEPAD_AXIS_RIGHTY, stick_dead_get(1), sr); return 1; } +int input_pad_stick_percent(double pct[2]) { + int ok = 0; + pct[0] = pct[1] = 0; + plat_mutex_lock(&lock); + if (state == 1 && pad && SDL_GamepadConnected(pad)) { // the game's poll keeps the state fresh (SDL_UpdateGamepads) + pct[0] = input_stick_percent(SDL_GetGamepadAxis(pad, SDL_GAMEPAD_AXIS_LEFTX), + SDL_GetGamepadAxis(pad, SDL_GAMEPAD_AXIS_LEFTY)); + pct[1] = input_stick_percent(SDL_GetGamepadAxis(pad, SDL_GAMEPAD_AXIS_RIGHTX), + SDL_GetGamepadAxis(pad, SDL_GAMEPAD_AXIS_RIGHTY)); + ok = 1; + } + plat_mutex_unlock(&lock); + return ok; +} + static void poll_merged(uint64_t *buttons, int32_t *lx, int32_t *ly, int32_t *rx, int32_t *ry) { uint64_t b = 0; int32_t sl[2] = {0, 0}, sr[2] = {0, 0}; diff --git a/runtime/input.h b/runtime/input.h index 8fe24377..36ca52a0 100644 --- a/runtime/input.h +++ b/runtime/input.h @@ -21,6 +21,10 @@ int input_overlay_gate(int *held, uint64_t *buttons); // L3+R3: 1 in the poll int input_pad_read(uint64_t *buttons, int32_t *lx, int32_t *ly); // The gamepad layout in effect (PAD_LAYOUT_*, input_map.h; TOTK_PAD_LAYOUT, live); -1 without a gamepad. Any thread. int input_pad_layout(void); +// How far the open gamepad's left (pct[0]) and right (pct[1]) sticks are from the centre now, in percent of full +// deflection, before the dead zone: the menu shows it on the dead zone rows, so a drifting stick's resting value can be +// read off. 0 (and both 0) without a connected gamepad. Any thread. +int input_pad_stick_percent(double pct[2]); // The label on a face button of the open gamepad (input_map.h PAD_SOUTH..PAD_NORTH, as SDL reports it); PAD_LABEL_NONE for another // button, an unknown label or no gamepad. Any thread. enum { PAD_LABEL_NONE, PAD_LABEL_A, PAD_LABEL_B, PAD_LABEL_X, PAD_LABEL_Y, PAD_LABEL_CROSS, PAD_LABEL_CIRCLE, diff --git a/runtime/input_map.c b/runtime/input_map.c index 5bce90ef..5ed1e005 100644 --- a/runtime/input_map.c +++ b/runtime/input_map.c @@ -346,6 +346,16 @@ void input_pad_stick(int32_t x, int32_t y, float dead, int32_t out[2]) { out[1] = (int32_t)lrint(fmax(-1, fmin(1, fy * k)) * STICK_MAX); } +float input_pad_deadzone(int stick) { + const char *own = stick ? "TOTK_RSTICK_DEADZONE" : "TOTK_LSTICK_DEADZONE", *set = cfg_get(own); + double v = cfg_double(set && *set ? own : "TOTK_STICK_DEADZONE"); + return (float)(v < 0 ? 0 : v > 50 ? 50 : v) / 100.f; +} + +double input_stick_percent(int32_t x, int32_t y) { + return sqrt((double)x * x + (double)y * y) * 100.0 / STICK_MAX; +} + // Minus and Plus held together open or close the menu. *held: latched from the poll where both go down until neither is // down (the caller keeps it). Every poll of the latch reports neither to the game, so releasing one button first does not // leak the other; Minus alone before Plus reaches the game unchanged. With the menu open the game sees a neutral pad. diff --git a/runtime/input_map.h b/runtime/input_map.h index 545eae89..c400320f 100644 --- a/runtime/input_map.h +++ b/runtime/input_map.h @@ -112,6 +112,12 @@ void input_mouse_stick(int32_t dx, int32_t dy, double dt_s, float sens, int32_t // 0..0.5): inside the circle the stick reads 0, and the rest of the travel is scaled to start at 0 at the edge, so a // drifting stick rests at 0 and full deflection still reaches full. The result stays inside the unit square. void input_pad_stick(int32_t x, int32_t y, float dead, int32_t out[2]); +// The dead zone of gamepad stick 0 (left) or 1 (right) for input_pad_stick, as a fraction of full deflection: +// TOTK_LSTICK_DEADZONE or TOTK_RSTICK_DEADZONE when set, else TOTK_STICK_DEADZONE (both sticks), percent clamped to 0..50. +float input_pad_deadzone(int stick); +// How far a stick (x, y in -32768..32767) is from the centre, in percent of full deflection (100 at an axis's end; a +// square gate's corner reads more). +double input_stick_percent(int32_t x, int32_t y); // ---- the remapping rows' edits, on a copy of input_map. Pure. // action's keys (table order) / its gamepad buttons in layout, at most max; returns how many. diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index ef806392..7efee12a 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -792,7 +792,16 @@ static void tab_controls(float scale) { opt_slider("TOTK_RUMBLE_STRENGTH", UI_MENU_RUMBLE_STRENGTH, 0, 300, UI_MENU_RUMBLE_STRENGTH_DESC, 10, "%.0f %%"); opt_slider("TOTK_RUMBLE_CURVE", UI_MENU_RUMBLE_CURVE, 0.2f, 1.5f, UI_MENU_RUMBLE_CURVE_DESC, 0.05f, "%.2f"); opt_toggle("TOTK_RUMBLE_TRIGGERS", UI_MENU_RUMBLE_TRIGGERS, UI_MENU_RUMBLE_TRIGGERS_DESC); - opt_slider("TOTK_STICK_DEADZONE", UI_MENU_STICK_DEADZONE, 0, 50, UI_MENU_STICK_DEADZONE_DESC, 1, "%.0f %%"); + // One row per stick, falling back to TOTK_STICK_DEADZONE (both sticks) while unset. With a gamepad connected each + // row shows its stick's deflection now, before the dead zone: a drifting stick's resting value, to set it above. + double now[2]; + bool pad = input_pad_stick_percent(now) != 0; + char note[2][64]; + for (int s = 0; s < 2; s++) snprintf(note[s], sizeof note[s], menu_text(UI_MENU_STICK_DEADZONE_NOW), now[s]); + opt_slider("TOTK_LSTICK_DEADZONE", UI_MENU_LSTICK_DEADZONE, 0, 50, UI_MENU_STICK_DEADZONE_DESC, 1, "%.0f %%", + pad ? note[0] : nullptr, "TOTK_STICK_DEADZONE"); + opt_slider("TOTK_RSTICK_DEADZONE", UI_MENU_RSTICK_DEADZONE, 0, 50, UI_MENU_STICK_DEADZONE_DESC, 1, "%.0f %%", + pad ? note[1] : nullptr, "TOTK_STICK_DEADZONE"); opt_slider("TOTK_STICK_SENS", UI_MENU_STICK_SENS, 0.1f, 3, UI_MENU_STICK_SENS_DESC, 0.05f, "%.2f"); opt_slider("TOTK_MOUSE_SENS", UI_MENU_MOUSE_SENS, 0, 10, UI_MENU_MOUSE_SENS_DESC, 0.1f, "%.1f"); row_walk_key(); diff --git a/runtime/ui/option_rows.cpp b/runtime/ui/option_rows.cpp index 04199d01..bf6a6241 100644 --- a/runtime/ui/option_rows.cpp +++ b/runtime/ui/option_rows.cpp @@ -294,12 +294,15 @@ bool opt_choice(const char *key, UiTextId label, const UiTextId *names, int n, U return opt_choice_list(key, label, values, shown, n, desc, -1, note); } -bool opt_slider(const char *key, UiTextId label, float lo, float hi, UiTextId desc, float step, const char *fmt) { - const CfgMeta *m = cfg_meta(key); - double v = cfg_double(key), def = m ? strtod(m->def, NULL) : lo; +bool opt_slider(const char *key, UiTextId label, float lo, float hi, UiTextId desc, float step, const char *fmt, + const char *note, const char *fallback) { + const char *set = cfg_get(key); + const char *src = fallback && !(set && *set) ? fallback : key; // unset: show the value in effect, the fallback's + const CfgMeta *m = cfg_meta(src); + double v = cfg_double(src), def = m ? strtod(m->def, NULL) : lo; char shown[48]; snprintf(shown, sizeof shown, fmt, v); - RowView rv = {shown, fabs(v - def) < step * 0.01, true, NULL}; + RowView rv = {shown, fabs(v - def) < step * 0.01, true, note}; int s = row(key, label, desc, rv); if (!s) return false; int steps = g_held && (hi - lo) > 40 * step ? 10 : 1; // held: ten steps at a time over a long range diff --git a/runtime/ui/option_rows.h b/runtime/ui/option_rows.h index 6e03faf8..07f32ddc 100644 --- a/runtime/ui/option_rows.h +++ b/runtime/ui/option_rows.h @@ -46,8 +46,10 @@ bool opt_choice_list(const char *key, UiTextId label, const char *const *values, // shown on the right ("" none). bool opt_button(const char *id, UiTextId label, UiTextId desc, const char *value = ""); // lo..hi in steps of step (left and right held for a second go ten times as fast); fmt formats the value ("%.0f %%"). +// note: a short line under the value in place of the "default" mark (NULL: none). fallback: the setting that applies +// while key is unset; the row shows its value then, and a change sets key. bool opt_slider(const char *key, UiTextId label, float lo, float hi, UiTextId desc, float step = 1, - const char *fmt = "%g"); + const char *fmt = "%g", const char *note = nullptr, const char *fallback = nullptr); // Binding rows (remapping on the Controls tab): a label and three cells, each selectable on its own (left / right move between them). // opt_bind_header: the column titles above them. opt_bind_row: key is the setting's name without TOTK_ (BIND_A; the diff --git a/runtime/ui_text.c b/runtime/ui_text.c index cfdfc8bd..1d94450e 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -170,8 +170,9 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_RESTART_CONFIRM] = "Restart the game now? Progress since your last save is lost.", [UI_MENU_RESTART_YES] = "Restart", [UI_MENU_RESTART_SAVING] = "The game is saving: Restart is possible in a moment.", - [UI_MENU_STICK_DEADZONE] = "Stick dead zone", - [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.", + [UI_MENU_LSTICK_DEADZONE] = "Left stick dead zone", [UI_MENU_RSTICK_DEADZONE] = "Right stick dead zone", + [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_SENS] = "Mouse camera sensitivity", [UI_MENU_MOUSE_SENS_DESC] = "How fast the mouse turns the camera.", [UI_MENU_WALK_KEY] = "Walk key", @@ -477,8 +478,9 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_RESTART_CONFIRM] = "Перезапустить игру сейчас? Прогресс после последнего сохранения будет потерян.", [UI_MENU_RESTART_YES] = "Перезапустить", [UI_MENU_RESTART_SAVING] = "Игра сохраняется: перезапуск будет доступен через мгновение.", - [UI_MENU_STICK_DEADZONE] = "Мёртвая зона стиков", - [UI_MENU_STICK_DEADZONE_DESC] = "Насколько нужно отклонить стик геймпада, чтобы игра это заметила. Увеличьте, если персонаж или камера двигаются сами.", + [UI_MENU_LSTICK_DEADZONE] = "Мёртвая зона левого стика", [UI_MENU_RSTICK_DEADZONE] = "Мёртвая зона правого стика", + [UI_MENU_STICK_DEADZONE_DESC] = "Насколько нужно отклонить стик геймпада, чтобы игра это заметила. Увеличьте, если персонаж или камера двигаются сами: отпустите стик, посмотрите «стик сейчас» и поставьте мёртвую зону на несколько процентов выше.", + [UI_MENU_STICK_DEADZONE_NOW] = "стик сейчас: %.0f %%", [UI_MENU_MOUSE_SENS] = "Чувствительность мыши", [UI_MENU_MOUSE_SENS_DESC] = "Как быстро мышь поворачивает камеру.", [UI_MENU_WALK_KEY] = "Клавиша шага", @@ -736,8 +738,12 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { [UI_MENU_PAD_LAYOUT_AUTO] = "Automático", [UI_MENU_PAD_LAYOUT_NINTENDO] = "Nintendo (A à direita)", [UI_MENU_PAD_LAYOUT_XBOX] = "Xbox (A embaixo)", [UI_MENU_PAD_LAYOUT_IN_USE] = "em uso: %s", - [UI_MENU_STICK_DEADZONE] = "Zona morta dos analógicos", - [UI_MENU_STICK_DEADZONE_DESC] = "Quanto um analógico do controle precisa se mover antes que o jogo perceba. Aumente se o personagem ou a câmera se moverem sozinhos.", + [UI_MENU_LSTICK_DEADZONE] = "Zona morta do analógico esquerdo", + [UI_MENU_RSTICK_DEADZONE] = "Zona morta do analógico direito", + [UI_MENU_STICK_DEADZONE_DESC] = "Quanto um analógico do controle precisa se mover antes que o jogo perceba. Aumente " + "se o personagem ou a câmera se moverem sozinhos: solte o analógico, leia \"analógico " + "agora\" e coloque a zona morta alguns por cento acima.", + [UI_MENU_STICK_DEADZONE_NOW] = "analógico agora: %.0f %%", [UI_MENU_MOUSE_SENS] = "Sensibilidade da câmera no mouse", [UI_MENU_MOUSE_SENS_DESC] = "Quão rápido o mouse gira a câmera.", @@ -1116,9 +1122,10 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_PAD_LAYOUT_NINTENDO] = "Nintendo(A 在右)", [UI_MENU_PAD_LAYOUT_XBOX] = "Xbox(A 在下)", [UI_MENU_PAD_LAYOUT_IN_USE] = "使用中:%s", - [UI_MENU_STICK_DEADZONE] = "摇杆死区", + [UI_MENU_LSTICK_DEADZONE] = "左摇杆死区", [UI_MENU_RSTICK_DEADZONE] = "右摇杆死区", [UI_MENU_STICK_DEADZONE_DESC] = "手柄摇杆要推动多远游戏才会响应。如果角色或视角会自己移动," - "请调高此值。", + "请调高此值:松开摇杆,查看“当前摇杆”,把死区设得比它高几个百分点。", + [UI_MENU_STICK_DEADZONE_NOW] = "当前摇杆:%.0f %%", [UI_MENU_MOUSE_SENS] = "鼠标视角灵敏度", [UI_MENU_MOUSE_SENS_DESC] = "鼠标转动视角的速度。", diff --git a/runtime/ui_text.h b/runtime/ui_text.h index 76b9cfd3..684b5ca9 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -77,7 +77,8 @@ typedef enum { UI_MENU_PROMPTS_OFF_MODS, UI_MENU_PROMPTS_OFF_PATCHES, // "Restart now" under the prompts while they change after restart, and its confirmation (Cancel: UI_MENU_RESET_NO) UI_MENU_RESTART, UI_MENU_RESTART_DESC, UI_MENU_RESTART_CONFIRM, UI_MENU_RESTART_YES, UI_MENU_RESTART_SAVING, - UI_MENU_STICK_DEADZONE, UI_MENU_STICK_DEADZONE_DESC, UI_MENU_STICK_SENS, UI_MENU_STICK_SENS_DESC, + 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_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 4c64d4c7..8437df6c 100644 --- a/totk.ini.example +++ b/totk.ini.example @@ -216,6 +216,10 @@ # five camera sensitivities in the game's Options. Keys bound to the right stick follow it; the mouse keeps mouse_sens. # Read at start. # stick_sens = 1 +# The dead zone of one stick, in place of stick_deadzone for that stick (0 to 50; unset = stick_deadzone). The Controls +# 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 sensitivity (0 to 10; 0 = no mouse camera and no cursor capture). # mouse_sens = 1 # The keyboard's sticks are all or nothing, so the game only sees a full tilt from them; while this key is held the