From 2af42ccf0d85e789afbf4e145d7800857066e7dd Mon Sep 17 00:00:00 2001 From: Valiantsin Dzerakh Date: Sun, 1 Nov 2026 18:15:41 +0300 Subject: [PATCH] Use plat_setenv and strcasecmp where the stick dead zone code called Windows-only functions _putenv_s in cfg_probe.c and _stricmp in the menu's key binding row stopped the Linux runtime library from compiling. Co-Authored-By: Claude Opus 5.5 --- runtime/cfg_probe.c | 16 ++++++++-------- runtime/ui/menu.cpp | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/runtime/cfg_probe.c b/runtime/cfg_probe.c index 866f4cc5..3aafcbfa 100644 --- a/runtime/cfg_probe.c +++ b/runtime/cfg_probe.c @@ -273,19 +273,19 @@ 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", ""); + plat_setenv("TOTK_STICK_DEADZONE", "12"); + plat_setenv("TOTK_LSTICK_DEADZONE", NULL); + plat_setenv("TOTK_RSTICK_DEADZONE", NULL); 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"); + plat_setenv("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"); + plat_setenv("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", ""); + plat_setenv("TOTK_STICK_DEADZONE", NULL); + plat_setenv("TOTK_LSTICK_DEADZONE", NULL); + plat_setenv("TOTK_RSTICK_DEADZONE", NULL); 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"); diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index 58d67755..151354e0 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -740,7 +740,7 @@ static void row_walk_key(void) { InputMap m; input_map_snapshot(&m); for (int k = KEY_A; k < KEY_COUNT && !n; k++) { - if (!input_key_name(k) || _stricmp(input_key_name(k), cur)) continue; + if (!input_key_name(k) || strcasecmp(input_key_name(k), cur)) continue; int a = key_action(&m, k); if (a >= 0 && input_action_name(a)) snprintf(note, sizeof note, menu_text(UI_MENU_WALK_KEY_TAKEN), input_action_name(a)), n = note; }