From c65f21d531ad49592f5eb2ee295e375e2eff289f Mon Sep 17 00:00:00 2001 From: chrg6 Date: Sun, 8 Nov 2026 09:14:32 -0500 Subject: [PATCH] Fall back to stick_deadzone when a stick's own dead zone does not read as a number. lstick_deadzone = 8% (or any typo) counted as set, and since that row has no default of its own it read as 0: no dead zone at all, so a drifting stick moved Link. The documented fallback, stick_deadzone, is now used then. Co-Authored-By: Claude Opus 5.5 --- runtime/input_map.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/runtime/input_map.c b/runtime/input_map.c index db7f8850..6a60765c 100644 --- a/runtime/input_map.c +++ b/runtime/input_map.c @@ -2,6 +2,7 @@ // tab's edits (input_map.h). No Win32 or SDL here. #include #include +#include #include #include @@ -361,8 +362,12 @@ void input_pad_stick(int32_t x, int32_t y, float dead, int32_t out[2]) { } float input_pad_deadzone(int stick) { + // the stick's own dead zone when it reads as a number; else (unset, or "8%" and other typos, whose row has no + // default of its own and would read as 0, no dead zone at all) the shared stick_deadzone const char *own = stick ? "NX2NAVI_RSTICK_DEADZONE" : "NX2NAVI_LSTICK_DEADZONE", *set = cfg_get(own); - double v = cfg_double(set && *set ? own : "NX2NAVI_STICK_DEADZONE"); + char *end = NULL; + double v = set && *set ? strtod(set, &end) : 0; + if (!set || !*set || end == set || *end || v != v) v = cfg_double("NX2NAVI_STICK_DEADZONE"); return (float)(v < 0 ? 0 : v > 50 ? 50 : v) / 100.f; }