feat(input): say in the log which joysticks SDL has no gamepad mapping for #1690
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1690
Loading…
Reference in a new issue
No description provided.
Delete branch "dubzilla/Longshot:feat/log-unmapped-joystick"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 inlongshot_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
hos_sdl_pads_listasks SDL for gamepads, which leaves out a joystick with no mapping, so nothing in the log or docs pointed at the cause.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.tests/test_sdl_unmapped_joystick.py(48 checks, SDL2 and SDL3, fails onmain); the line seen in a real game run with the pad connected.tests/run_all.pyhas failures on this PC that are also onmain(see Testing).Why
With the GameSir Nova Pro (vendor
3537, product100f) 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 inlongshot_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.txtSteps: 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_listlists the joysticks that are not gamepads (SDL3:SDL_GetJoysticksandSDL_IsGamepad; SDL2:SDL_IsGameControllerby 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_joysticksruns 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:
0x9b438000), a development build of this branch on amainbase (dev_build.py base,pack,rt), nolongshot_env.txt, Nova Pro connected: the log has the line twice, one per joystick SDL lists for the pad (two interfaces), withvid=3537 pid=100f; the game still showscontroller "(none)"and does not use the pad, as onmain.python -I -B tests/test_sdl_unmapped_joystick.py --cc gcc: 48 checks pass (GCC, MSYS2 UCRT64); against the basehost/it fails because the new functions are not there, not on the fixture's compilation.tests/test_sdl_pad_diagnostics.pystill passes (64 checks). Both rerun after the rebase on83b161e3.python -I -B tests/run_all.py --jobs 4on Windows at this branch (rebased on83b161e3): 647 passed, 53 failed, 124 skipped. I ran the 53 again on a cleanorigin/mainworktree: 52 fail there too, so they are not from this PR (I did not fix them; most areuse of undeclared identifierin compiled snippets ornot foundfor tools and headers this PC lacks, a few Windows errors such asWinError 1224). The 53rd,test_pcache_stamp.py, failed once under 4 parallel jobs and passes alone and onmain, so I take it as a timing flake. The 52 that also fail onmainaretests/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.tests/test_sdl_unmapped_joystick.py(48 checks) andtests/test_sdl_pad_diagnostics.py(64 checks) pass, compiled with-std=c11 -Wall -Wextra -Werrorlike 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:
hid: SDL lists a joystick it has no gamepad mapping for…line per joystick inlongshot_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
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why.
in Risks.
main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named). (The 52 failures that also fail onmainare named in Testing; nothing new fails.)third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.SDL_GAMECONTROLLERCONFIG.)mainand passing here.-Wall -Wextra -Werrorby the new test, whole files not built; the Test Farm was asked for a Linux build above.)🤖 Generated with Claude Code
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.
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.@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).
@dubzilla only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.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.
WIP: feat(input): say in the log which joysticks SDL has no gamepad mapping forto feat(input): say in the log which joysticks SDL has no gamepad mapping forView 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.