You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix SDL3 joystick enumeration using device indices as instance IDs (#182)
* Fix SDL3 joystick enumeration using device indices as instance IDs
get_joysticks/get_controllers/_get_all passed range(count) indices into
SDL_OpenJoystick/SDL_OpenGamepad/SDL_IsGamepad, which on SDL3 take an
SDL_JoystickID instance ID. _get_number discarded the instance-ID array
that SDL_GetJoysticks returns, so enumeration opened the wrong device or
failed once instance IDs diverged from device indices (e.g. after a pad
was reconnected).
Replace _get_number with _get_instance_ids, which keeps and frees the
SDL_GetJoysticks array, and enumerate by instance ID.
Fixes#181
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kyle Benesch <4b796c65+github@gmail.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,10 @@ This project adheres to [Semantic Versioning](https://semver.org/) since version
11
11
- PyPy wheels switched from PyPy 3.10 to PyPy 3.11.
12
12
- Experimental Pyodide wheels are now uploaded to PyPI.
13
13
14
+
### Fixed
15
+
16
+
-`tcod.sdl.joystick.get_joysticks`, `get_controllers`, and related enumeration passed device indices to SDL3 functions expecting instance IDs, so enumeration could fail or open the wrong device after a joystick was reconnected.
0 commit comments