From c193b2aefac0c62c1e49088f8d6c8ad3dbeb288f Mon Sep 17 00:00:00 2001 From: applezra Date: Fri, 30 Oct 2026 21:58:22 -0700 Subject: [PATCH] Give each gamepad stick its own dead zone and show where the stick rests stick_deadzone sets one dead zone for both sticks, and finding the value that stops a drift means guessing. A worn stick usually drifts on its own while the other one is fine. lstick_deadzone and rstick_deadzone (0 to 50 percent, live) set one stick each and fall back to stick_deadzone while unset, so existing totk.ini files behave as before. input_pad_deadzone in input_map.c picks the value; input_pad_stick and its scaling stay as they are. The Controls tab shows Left and Right stick dead zone rows in place of the single one. With a gamepad connected each row shows its stick's deflection now, before the dead zone ("stick now"), so a drifting stick's resting value can be read off and the zone set just above it. opt_slider takes the note line and a fallback key for that: a row whose key is unset shows the fallback's value, and a change sets the key. probe-cfg checks the fallback, the clamp and input_stick_percent. The menu text is in English and Russian. Co-Authored-By: Claude Opus 5.5 --- docs/controls.md | 2 +- runtime/cfg.c | 9 +++++---- runtime/cfg_probe.c | 17 +++++++++++++++++ runtime/input.h | 4 ++++ runtime/input_map.c | 10 ++++++++++ runtime/input_map.h | 6 ++++++ runtime/input_win.c | 35 +++++++++++++++++++++++++---------- runtime/ui/menu.cpp | 11 ++++++++++- runtime/ui/option_rows.cpp | 11 +++++++---- runtime/ui/option_rows.h | 4 +++- runtime/ui_text.c | 10 ++++++---- runtime/ui_text.h | 2 +- totk.ini.example | 4 ++++ 13 files changed, 99 insertions(+), 26 deletions(-) diff --git a/docs/controls.md b/docs/controls.md index b80fc89c..2333d41c 100644 --- a/docs/controls.md +++ b/docs/controls.md @@ -68,7 +68,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 e9d8fc13..f51a5eda 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", "FPS60", "FPS_LIMIT", "FREEZE_IDLE", "FREE_CORES", "FULLSCREEN", "GPL", "GPL_DRAW_BUILD", "GPU", "GPU_INDEX", "GPU_NAME", "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", "PUSH_SKIP", "PUSH_STAGE", "RDOC", "RDOC_DIR", "RDOC_DLL", "REALTIME", "REC_END", "REEXEC", "RENDER_SCALE", "REPLAY_ASYNC", "REPLAY_CHECK", "RESOLVE_CHECK", "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", "SHARED_FONTS", "SHARPNESS", "SHOTS", "SHOTS_DIR", "SHOTS_FULL", "SPEED_PROBE", "SPIN", "SPIN_HANDOFF_US", "SPLIT_DRAWS", "SPLIT_US", "STICK_DEADZONE", "SWKBD_ANSWER", "SWKBD_TEST", "TEST_PREPARE_SHADERS", "TEX_ALIAS", "TEX_MEMO", "TEX_VRAM_PRESSURE", "TIMER_1MS", "TRACE", "UBO_SNAPSHOT", "UPSCALER", "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", @@ -63,7 +63,7 @@ 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"}, {"STICK_DEADZONE", "input"}, {"MOUSE_SENS", "input"}, {"INPUT_RECORD", "input"}, + {"PAD_LAYOUT", "input"}, {"STICK_DEADZONE", "input"}, {"LSTICK_DEADZONE", "input"}, {"RSTICK_DEADZONE", "input"}, {"MOUSE_SENS", "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"}, @@ -104,7 +104,8 @@ static const CfgMeta metas[] = { {"VOLUME", "100", "0..100", LIVE}, {"MOTION", "1", "0|1", LIVE}, {"RUMBLE_STRENGTH", "130", "0..300", LIVE}, {"RUMBLE_CURVE", "0.6", "0.2..1.5", LIVE}, {"RUMBLE_TRIGGERS", "0", "0|1", LIVE}, {"PAD_LAYOUT", "auto", "auto|nintendo|xbox", LIVE}, - {"STICK_DEADZONE", "8", "0..50", LIVE}, {"MOUSE_SENS", "1", "0..10", LIVE}, + {"STICK_DEADZONE", "8", "0..50", LIVE}, + {"LSTICK_DEADZONE", "", "0..50", LIVE}, {"RSTICK_DEADZONE", "", "0..50", LIVE}, {"MOUSE_SENS", "1", "0..10", LIVE}, {"MENU_LANG", "", "en|ru", LIVE}, // Advanced: scheduling {"ASYNC_PREEMPT", "1", "0|1|2", RESTART}, {"REPLAY_ASYNC", "0", "0|1", RESTART}, diff --git a/runtime/cfg_probe.c b/runtime/cfg_probe.c index 0fc40a42..6f733469 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.h b/runtime/input.h index 5efc17ac..7bf0a37e 100644 --- a/runtime/input.h +++ b/runtime/input.h @@ -23,6 +23,10 @@ int input_menu_gate(int *held, int menu_open, uint64_t *buttons, int32_t sticks[ 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 5c5e06c8..780114a7 100644 --- a/runtime/input_map.c +++ b/runtime/input_map.c @@ -334,6 +334,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 fe524fa6..18db80df 100644 --- a/runtime/input_map.h +++ b/runtime/input_map.h @@ -95,6 +95,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/input_win.c b/runtime/input_win.c index 096fef53..14041341 100644 --- a/runtime/input_win.c +++ b/runtime/input_win.c @@ -428,16 +428,17 @@ static void mouse_camera(int32_t out[2]) { out[1] = held[1]; } -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. @@ -557,12 +558,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; + AcquireSRWLockExclusive(&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; + } + ReleaseSRWLockExclusive(&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/ui/menu.cpp b/runtime/ui/menu.cpp index 86c2bc5f..d6b7dd80 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -573,7 +573,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_MOUSE_SENS", UI_MENU_MOUSE_SENS, 0, 10, UI_MENU_MOUSE_SENS_DESC, 0.1f, "%.1f"); binds_rows(scale); opt_end(); diff --git a/runtime/ui/option_rows.cpp b/runtime/ui/option_rows.cpp index f0f82b36..895c14b1 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 b17ebb02..2bd03bb1 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -97,8 +97,9 @@ static const char *const text_en[UI_TEXT_COUNT] = { "Nintendo for controllers with Nintendo labels and Xbox for the others.", [UI_MENU_PAD_LAYOUT_AUTO] = "Automatic", [UI_MENU_PAD_LAYOUT_NINTENDO] = "Nintendo (A right)", [UI_MENU_PAD_LAYOUT_XBOX] = "Xbox (A bottom)", [UI_MENU_PAD_LAYOUT_IN_USE] = "in use: %s", - [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.", @@ -317,8 +318,9 @@ static const char *const text_ru[UI_TEXT_COUNT] = { "Nintendo для контроллеров с подписями Nintendo, Xbox для остальных.", [UI_MENU_PAD_LAYOUT_AUTO] = "Автоматически", [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_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] = "Как быстро мышь поворачивает камеру.", diff --git a/runtime/ui_text.h b/runtime/ui_text.h index 24975758..d7250b02 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -57,7 +57,7 @@ typedef enum { UI_MENU_RUMBLE_TRIGGERS, UI_MENU_RUMBLE_TRIGGERS_DESC, UI_MENU_PAD_LAYOUT, UI_MENU_PAD_LAYOUT_DESC, UI_MENU_PAD_LAYOUT_AUTO, UI_MENU_PAD_LAYOUT_NINTENDO, UI_MENU_PAD_LAYOUT_XBOX, UI_MENU_PAD_LAYOUT_IN_USE, - 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, UI_MENU_MOUSE_SENS, UI_MENU_MOUSE_SENS_DESC, // Controls tab: the remapping rows (ui/binds_page.cpp) diff --git a/totk.ini.example b/totk.ini.example index 522e247b..03a4d0e1 100644 --- a/totk.ini.example +++ b/totk.ini.example @@ -153,6 +153,10 @@ # 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. # stick_deadzone = 8 +# 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 # Write the input of this run to a file that replays as a script (docs/controls.md, "Scripted input"). Default: off.