feat(input): say in the log which joysticks SDL has no gamepad mapping for #1690

Open
dubzilla wants to merge 1 commit from dubzilla/Longshot:feat/log-unmapped-joystick into main
First-time contributor

Type: feat · Risk: low · Tested on: Windows 11, RTX 4070 SUPER · Needs: Linux (SDL2 path, any pad)

TL;DR

A controller that SDL sees but has no gamepad mapping for was silently ignored: the log only said controller "(none)" and the Controls page never saw it. This PR logs each such joystick once (name, vendor, product, GUID) and adds a docs section saying how to give SDL a mapping line in longshot_env.txt. It changes no behaviour: no joystick is opened that was not opened before. A new game-free test passes (48 checks), and I saw the line in the game with a GameSir Nova Pro.

Breakdown

  • Who it helps: anyone whose controller works elsewhere but is not found by the game, and whoever reads their log to help them.
  • What was wrong: hos_sdl_pads_list asks SDL for gamepads, which leaves out a joystick with no mapping, so nothing in the log or docs pointed at the cause.
  • What changes: the log says hid: SDL lists a joystick it has no gamepad mapping for… once per such joystick, and the docs have a "A controller is not detected" section.
  • What does not change: which devices the game opens, input handling, defaults, saves, options.
  • How it was checked: tests/test_sdl_unmapped_joystick.py (48 checks, SDL2 and SDL3, fails on main); the line seen in a real game run with the pad connected.
  • What is still open: the SDL2 path and Linux were not run in the game; the whole tests/run_all.py has failures on this PC that are also on main (see Testing).
  • Risk: low: the new SDL calls are optional (null when missing) and only read; at worst the line is missing.

Why

With the GameSir Nova Pro (vendor 3537, product 100f) over Bluetooth in its DirectInput-style mode, SDL 3.4.20 lists two joysticks and neither is a gamepad (no mapping, with the HIDAPI, RawInput and WGI drivers on or off). The game uses only SDL gamepads, so Setup → Controls → Gamepad never saw the pad and nothing said why. A mapping line in longshot_env.txt (SDL_GAMECONTROLLERCONFIG=<guid>,<name>,platform:Windows,a:b0,..., already an allowed name) makes the pad work, including rebinding on the Controls page. Nothing in the tracker covers this (searched "gamepad mapping" and "unmapped joystick").

How to reproduce

Seen on: Windows 11, RTX 4070 SUPER, SDL 3.4.20
Settings and switches: defaults, no longshot_env.txt
Steps: connect a GameSir Nova Pro (Bluetooth, DirectInput-style mode), start the game, open Setup → Controls → Gamepad.
Expected: the game says why it does not use the pad.
Actual: on main: prompts: auto: controller "(none)" and nothing else.

What changed

The game now logs the joysticks SDL lists but cannot use as gamepads, and the docs say what to do about it.

  • host/hos_sdl.c, host/hos_sdl.h: hos_sdl_unmapped_list lists the joysticks that are not gamepads (SDL3: SDL_GetJoysticks and SDL_IsGamepad; SDL2: SDL_IsGameController by index) and describes each. All the new SDL calls are optional (GetProcAddress, null when missing), like the connection-log ones from #2678; without them the list is empty.
  • host/pad_sdl.c: note_unmapped_joysticks runs in the once-a-second scan and logs each joystick instance once (32 remembered).
  • docs/common-issues.md: "A controller is not detected".
  • tests/test_sdl_unmapped_joystick.py: game-free; compiles the real functions against a fake SDL2/SDL3.

Measurements

Verdict: nothing to measure: a log line in a once-a-second scan, no change to what the game opens or draws.

Flags and settings

None.

Testing

Tested:

  • In the game, Windows 11, RTX 4070 SUPER (NVIDIA driver, Vulkan version code 0x9b438000), a development build of this branch on a main base (dev_build.py base, pack, rt), no longshot_env.txt, Nova Pro connected: the log has the line twice, one per joystick SDL lists for the pad (two interfaces), with vid=3537 pid=100f; the game still shows controller "(none)" and does not use the pad, as on main.
  • python -I -B tests/test_sdl_unmapped_joystick.py --cc gcc: 48 checks pass (GCC, MSYS2 UCRT64); against the base host/ it fails because the new functions are not there, not on the fixture's compilation. tests/test_sdl_pad_diagnostics.py still passes (64 checks). Both rerun after the rebase on 83b161e3.
  • python -I -B tests/run_all.py --jobs 4 on Windows at this branch (rebased on 83b161e3): 647 passed, 53 failed, 124 skipped. I ran the 53 again on a clean origin/main worktree: 52 fail there too, so they are not from this PR (I did not fix them; most are use of undeclared identifier in compiled snippets or not found for tools and headers this PC lacks, a few Windows errors such as WinError 1224). The 53rd, test_pcache_stamp.py, failed once under 4 parallel jobs and passes alone and on main, so I take it as a timing flake. The 52 that also fail on main are tests/test_ + : auto_handheld, bug_report_defaults, build_long_paths, capture_read_once, coverage_run, crash_dialog, crt_options, damage_debug_menu, dev_packs, discover, display_startup_failure, dlss_feature_size, failed_compile_keeps_objects, fastfp_fma, fma_soft, fpx_sticky, fs_path_utf8, guest_imported, high_fps_fixes, host_guest_writes, hud_layout_row, invalidate_quick, job_queue, libc_hooks, lift_lookups, linux_preflight, linux_pressure, missing_nup, oot_state_tap, pads_after_menu, pending_guest_import, pipeline_cache_file, pipeline_play_cache, prepare_cache_save, prepare_stall, present_thread, profiling_mode, psychov35_fsr3_fg, readback_timeout_source, run_all_changed, sdiv_overflow, slow_frames, song_note_cue, spawn_emit, switch_table, tested_configurations, upscaler_rows, vbytes, vcore_escape, vfpx_elem, walk, walk_key.
  • On Linux (WSL2, Ubuntu 26.04, GCC 15.2): tests/test_sdl_unmapped_joystick.py (48 checks) and tests/test_sdl_pad_diagnostics.py (64 checks) pass, compiled with -std=c11 -Wall -Wextra -Werror like the Windows run. This compiles the changed functions only, not the whole files, and runs no game.

Not tested: the host files built whole on Linux (they need the generated headers) and the SDL2 path and Linux in the game (the test covers SDL2 against a fake); whether the docs' mapping steps work for other pads than the Nova Pro (the Nova Pro one was confirmed working by hand).

Must be tested:

  • Linux, any pad SDL has no mapping for (any distribution): start the game with the pad connected, expecting one hid: SDL lists a joystick it has no gamepad mapping for… line per joystick in longshot_log.txt (by hand, or Test Farm: @Beanstalk linux, with a controller connected, if the farm has one)

Risks

What could break: the optional SDL calls are read-only; a build whose SDL lacks them gets no line, as before. A joystick with a very long name is cut to 100 characters in the line.

Turning it off: revert the commit.

Compatibility: Nothing changes.

Issues

None found.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what
    can't be run by hand is in Testing's Not testable by hand, with why.
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and
    in Risks.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named). (The 52 failures that also fail on main are named in Testing; nothing new fails.)
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value. (No new switch; the mapping uses the existing SDL_GAMECONTROLLERCONFIG.)
  • A game-free test added for the fix, failing on main and passing here.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: built and run in the game. Linux: the changed functions compiled with GCC 15.2 in WSL under -Wall -Wextra -Werror by the new test, whole files not built; the Test Farm was asked for a Linux build above.)
  • Docs updated.

🤖 Generated with Claude Code

**Type:** feat · **Risk:** low · **Tested on:** Windows 11, RTX 4070 SUPER · **Needs:** Linux (SDL2 path, any pad) ## TL;DR A controller that SDL sees but has no gamepad mapping for was silently ignored: the log only said `controller "(none)"` and the Controls page never saw it. This PR logs each such joystick once (name, vendor, product, GUID) and adds a docs section saying how to give SDL a mapping line in `longshot_env.txt`. It changes no behaviour: no joystick is opened that was not opened before. A new game-free test passes (48 checks), and I saw the line in the game with a GameSir Nova Pro. ## Breakdown - **Who it helps:** anyone whose controller works elsewhere but is not found by the game, and whoever reads their log to help them. - **What was wrong:** `hos_sdl_pads_list` asks SDL for gamepads, which leaves out a joystick with no mapping, so nothing in the log or docs pointed at the cause. - **What changes:** the log says `hid: SDL lists a joystick it has no gamepad mapping for…` once per such joystick, and the docs have a "A controller is not detected" section. - **What does not change:** which devices the game opens, input handling, defaults, saves, options. - **How it was checked:** `tests/test_sdl_unmapped_joystick.py` (48 checks, SDL2 and SDL3, fails on `main`); the line seen in a real game run with the pad connected. - **What is still open:** the SDL2 path and Linux were not run in the game; the whole `tests/run_all.py` has failures on this PC that are also on `main` (see Testing). - **Risk:** low: the new SDL calls are optional (null when missing) and only read; at worst the line is missing. ## Why With the GameSir Nova Pro (vendor `3537`, product `100f`) over Bluetooth in its DirectInput-style mode, SDL 3.4.20 lists two joysticks and neither is a gamepad (no mapping, with the HIDAPI, RawInput and WGI drivers on or off). The game uses only SDL gamepads, so Setup → Controls → Gamepad never saw the pad and nothing said why. A mapping line in `longshot_env.txt` (`SDL_GAMECONTROLLERCONFIG=<guid>,<name>,platform:Windows,a:b0,...`, already an allowed name) makes the pad work, including rebinding on the Controls page. Nothing in the tracker covers this (searched "gamepad mapping" and "unmapped joystick"). ## How to reproduce **Seen on:** Windows 11, RTX 4070 SUPER, SDL 3.4.20 **Settings and switches:** defaults, no `longshot_env.txt` **Steps:** connect a GameSir Nova Pro (Bluetooth, DirectInput-style mode), start the game, open Setup → Controls → Gamepad. **Expected:** the game says why it does not use the pad. **Actual:** on main: `prompts: auto: controller "(none)"` and nothing else. ## What changed The game now logs the joysticks SDL lists but cannot use as gamepads, and the docs say what to do about it. - `host/hos_sdl.c`, `host/hos_sdl.h`: `hos_sdl_unmapped_list` lists the joysticks that are not gamepads (SDL3: `SDL_GetJoysticks` and `SDL_IsGamepad`; SDL2: `SDL_IsGameController` by index) and describes each. All the new SDL calls are optional (`GetProcAddress`, null when missing), like the connection-log ones from #2678; without them the list is empty. - `host/pad_sdl.c`: `note_unmapped_joysticks` runs in the once-a-second scan and logs each joystick instance once (32 remembered). - `docs/common-issues.md`: "A controller is not detected". - `tests/test_sdl_unmapped_joystick.py`: game-free; compiles the real functions against a fake SDL2/SDL3. ## Measurements **Verdict:** nothing to measure: a log line in a once-a-second scan, no change to what the game opens or draws. ### Flags and settings None. ## Testing **Tested:** - In the game, Windows 11, RTX 4070 SUPER (NVIDIA driver, Vulkan version code `0x9b438000`), a development build of this branch on a `main` base (`dev_build.py base`, `pack`, `rt`), no `longshot_env.txt`, Nova Pro connected: the log has the line twice, one per joystick SDL lists for the pad (two interfaces), with `vid=3537 pid=100f`; the game still shows `controller "(none)"` and does not use the pad, as on `main`. - `python -I -B tests/test_sdl_unmapped_joystick.py --cc gcc`: 48 checks pass (GCC, MSYS2 UCRT64); against the base `host/` it fails because the new functions are not there, not on the fixture's compilation. `tests/test_sdl_pad_diagnostics.py` still passes (64 checks). Both rerun after the rebase on `83b161e3`. - `python -I -B tests/run_all.py --jobs 4` on Windows at this branch (rebased on `83b161e3`): 647 passed, 53 failed, 124 skipped. I ran the 53 again on a clean `origin/main` worktree: 52 fail there too, so they are not from this PR (I did not fix them; most are `use of undeclared identifier` in compiled snippets or `not found` for tools and headers this PC lacks, a few Windows errors such as `WinError 1224`). The 53rd, `test_pcache_stamp.py`, failed once under 4 parallel jobs and passes alone and on `main`, so I take it as a timing flake. The 52 that also fail on `main` are `tests/test_` + : auto_handheld, bug_report_defaults, build_long_paths, capture_read_once, coverage_run, crash_dialog, crt_options, damage_debug_menu, dev_packs, discover, display_startup_failure, dlss_feature_size, failed_compile_keeps_objects, fastfp_fma, fma_soft, fpx_sticky, fs_path_utf8, guest_imported, high_fps_fixes, host_guest_writes, hud_layout_row, invalidate_quick, job_queue, libc_hooks, lift_lookups, linux_preflight, linux_pressure, missing_nup, oot_state_tap, pads_after_menu, pending_guest_import, pipeline_cache_file, pipeline_play_cache, prepare_cache_save, prepare_stall, present_thread, profiling_mode, psychov35_fsr3_fg, readback_timeout_source, run_all_changed, sdiv_overflow, slow_frames, song_note_cue, spawn_emit, switch_table, tested_configurations, upscaler_rows, vbytes, vcore_escape, vfpx_elem, walk, walk_key. - On Linux (WSL2, Ubuntu 26.04, GCC 15.2): `tests/test_sdl_unmapped_joystick.py` (48 checks) and `tests/test_sdl_pad_diagnostics.py` (64 checks) pass, compiled with `-std=c11 -Wall -Wextra -Werror` like the Windows run. This compiles the changed functions only, not the whole files, and runs no game. **Not tested:** the host files built whole on Linux (they need the generated headers) and the SDL2 path and Linux in the game (the test covers SDL2 against a fake); whether the docs' mapping steps work for other pads than the Nova Pro (the Nova Pro one was confirmed working by hand). **Must be tested:** - Linux, any pad SDL has no mapping for (any distribution): start the game with the pad connected, expecting one `hid: SDL lists a joystick it has no gamepad mapping for…` line per joystick in `longshot_log.txt` (by hand, or Test Farm: @Beanstalk linux, with a controller connected, if the farm has one) ## Risks **What could break:** the optional SDL calls are read-only; a build whose SDL lacks them gets no line, as before. A joystick with a very long name is cut to 100 characters in the line. **Turning it off:** revert the commit. **Compatibility:** Nothing changes. ## Issues None found. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). *(The 52 failures that also fail on `main` are named in Testing; nothing new fails.)* - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value. *(No new switch; the mapping uses the existing `SDL_GAMECONTROLLERCONFIG`.)* - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. *(Windows: built and run in the game. Linux: the changed functions compiled with GCC 15.2 in WSL under `-Wall -Wextra -Werror` by the new test, whole files not built; the Test Farm was asked for a Linux build above.)* - [x] Docs updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(input): say in the log which joysticks SDL has no gamepad mapping for
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 4s
02227a5aff
A controller SDL lists but has no gamepad mapping for is never offered by
SDL_GetGamepads, so the game ignores it and the log only says
`controller "(none)"`. Log each such joystick once (name, vendor and
product, GUID) with a pointer to the new "A controller is not detected"
section of docs/common-issues.md, which says to try the pad's Xbox or
Switch mode or to give SDL a mapping line through longshot_env.txt.

No joystick is opened that was not opened before. The new SDL calls are
optional, so an SDL without them logs nothing.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Author
First-time contributor

Tested in game: Windows 11, RTX 4070 SUPER, dev build of this branch on a main base, no longshot_env.txt, GameSir Nova Pro (vid 3537 pid 100f) connected over Bluetooth: longshot_log.txt has the new 'hid: SDL lists a joystick it has no gamepad mapping for' line twice (the pad is two joysticks to SDL) with name, vid, pid and GUID; the game still shows controller (none) and does not use the pad, as on main, so no behaviour change.

Tested in game: Windows 11, RTX 4070 SUPER, dev build of this branch on a main base, no longshot_env.txt, GameSir Nova Pro (vid 3537 pid 100f) connected over Bluetooth: longshot_log.txt has the new 'hid: SDL lists a joystick it has no gamepad mapping for' line twice (the pad is two joysticks to SDL) with name, vid, pid and GUID; the game still shows controller (none) and does not use the pad, as on main, so no behaviour change.
Author
First-time contributor

Full run after the rebase on 83b161e3: run_all.py (Windows, 4 jobs) 647 passed, 53 failed, 124 skipped. The same 53 on a clean origin/main worktree: 52 fail there too (named in the description's Testing); test_pcache_stamp failed once under parallel load and passes alone and on main. The checklist box is ticked; the Linux build box is still open.

Full run after the rebase on 83b161e3: run_all.py (Windows, 4 jobs) 647 passed, 53 failed, 124 skipped. The same 53 on a clean origin/main worktree: 52 fail there too (named in the description's Testing); test_pcache_stamp failed once under parallel load and passes alone and on main. The checklist box is ticked; the Linux build box is still open.
Author
First-time contributor

@Beanstalk linux: please build this branch and run tests/test_sdl_unmapped_joystick.py and tests/test_sdl_pad_diagnostics.py with the Linux compiler, then start the game and check that the once-a-second pad scan (host/pad_sdl.c) logs nothing odd. Expected: both tests pass, the game starts and plays as on main. If the farm has a controller SDL has no gamepad mapping for, expect one 'hid: SDL lists a joystick it has no gamepad mapping for' line per joystick in longshot_log.txt. Windows is already tested by hand (see the first comment).

@Beanstalk linux: please build this branch and run tests/test_sdl_unmapped_joystick.py and tests/test_sdl_pad_diagnostics.py with the Linux compiler, then start the game and check that the once-a-second pad scan (host/pad_sdl.c) logs nothing odd. Expected: both tests pass, the game starts and plays as on main. If the farm has a controller SDL has no gamepad mapping for, expect one 'hid: SDL lists a joystick it has no gamepad mapping for' line per joystick in longshot_log.txt. Windows is already tested by hand (see the first comment).
Member

@dubzilla only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@dubzilla only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
Author
First-time contributor

Linux check done by hand: WSL2 Ubuntu 26.04, GCC 15.2. tests/test_sdl_unmapped_joystick.py 48 checks and tests/test_sdl_pad_diagnostics.py 64 checks pass with -std=c11 -Wall -Wextra -Werror. Not a whole-file Linux build (that needs the generated headers); the Test Farm request above still stands.

Linux check done by hand: WSL2 Ubuntu 26.04, GCC 15.2. tests/test_sdl_unmapped_joystick.py 48 checks and tests/test_sdl_pad_diagnostics.py 64 checks pass with -std=c11 -Wall -Wextra -Werror. Not a whole-file Linux build (that needs the generated headers); the Test Farm request above still stands.
dubzilla changed title from WIP: feat(input): say in the log which joysticks SDL has no gamepad mapping for to feat(input): say in the log which joysticks SDL has no gamepad mapping for 2026-11-19 02:47:12 +00:00
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 4s
This pull request has changes conflicting with the target branch.
  • host/hos_sdl.c
  • host/pad_sdl.c
Some workflows are waiting to be reviewed.
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/log-unmapped-joystick:dubzilla-feat/log-unmapped-joystick'
git switch 'dubzilla-feat/log-unmapped-joystick'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!1690
No description provided.