Switch 2 Pro Controller over USB: turn on SDL's HIDAPI libusb backend
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 74/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- cmake
- Lĩnh vực
- build-system
Hướng nghiên cứu
Bắt đầu với runtime/cmake/gfx_deps.cmake và các tùy chọn SDL gần set(SDL_VENDOR_INFO ...); issue chỉ rõ ba tùy chọn cần bật trước FetchContent_MakeAvailable(...). Kiểm tra cách cấu hình cung cấp các header và thư viện nhập của libusb 1.0, cũng như cách make-release.ps1 thu thập các tệp runtime. Công việc hoàn tất khi bản build Windows phát hiện bộ điều khiển được kết nối qua USB và gói phát hành bao gồm DLL libusb cần thiết cùng giấy phép.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What you would like
On Windows, a Switch 2 Pro Controller (USB 057e:2069) connected by USB cable is not picked up. SDL 3.4.18 already has a driver for it (SDL_hidapi_switch2.c), but on Windows it reaches the controller through its libusb path, and that path is off in Recompia's SDL build.
Turning it on works. Add three lines to runtime/cmake/gfx_deps.cmake. Anywhere among the other SDL options works, as long as they come before FetchContent_MakeAvailable(...). We put them after set(SDL_VENDOR_INFO ...):
set(SDL_HIDAPI ON CACHE BOOL "" FORCE)
set(SDL_HIDAPI_LIBUSB ON CACHE BOOL "" FORCE)
set(SDL_HIDAPI_LIBUSB_SHARED ON CACHE BOOL "" FORCE)
The configure step also needs libusb 1.0 headers and an import library (LibUSB_INCLUDE_PATH, LibUSB_LIBRARY), and libusb-1.0.dll goes next to pkp.exe. With _SHARED, SDL loads libusb-1.0.dll at run time, so pkp_rt.dll's import table stays the same as today.
We rebuilt pkp_rt.dll from v0.10.3 with only these lines and libusb 1.0.30, then did the same with v0.10.4-beta.1. On Windows 11, with the Switch 2 Pro Controller connected by USB cable and Steam closed:
- With the change, on both:
gamepad 4 added: "Nintendo Switch Pro Controller" kind=Switch rumble=1 gyro=1. Switch button prompts show and the controls work. The beta's new capabilities line also showsgamepad 4 caps: type=7 real_type=7 vid=057e pid=2069 .... - With
v0.10.4-beta.1's own releasepkp_rt.dll, same PC and controller: nogamepad ... addedline, and the prompts stay on keyboard.
Anything else
The release package would need libusb-1.0.dll and its licence (LGPL-2.1). make-release.ps1 takes files like that from the base package, so packaging is your call. This covers USB only, not Bluetooth.
Recommended as a precaution: ship libusb-1.0.dll in the same folder as pkp.exe rather than leaving it to the player's system. SDL loads it by name only (LoadLibraryW("libusb-1.0.dll")), so Windows looks next to the exe first, then the system folders, then PATH. Without a bundled copy, another program's libusb-1.0.dll on PATH could get loaded instead.
This change and its testing were done with the help of Claude (the AI assistant); the build and controller tests were run on real hardware.
Before you send
- I searched the open and closed issues and this is not already requested.
- Ngôn ngữ chính
- C++
- Star
- 224
- Fork
- 0
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của featureJosh/Recompia
-
Improve GardeningĐang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
featureJosh/Recompia#535 ·
-
bug low priority
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
featureJosh/Recompia#534 · 2 bình luận ·
-
Game crashes multiple times at random moments | CachyOS HyprlandCó thể đã có người làm @featureJosh đã nhận hôm nay. Đang mởbug
featureJosh/Recompia#533 · 1 người được giao ·
-
Frequent Crashes on Steam Deck: The graphics device was lost, so Pokopia must closeCó thể đã có người làm @featureJosh đã nhận hôm nay. Đang mởbug high priority
featureJosh/Recompia#531 · 1 bình luận · 1 người được giao ·
-
Setup log for translator fail for protonCó thể đã có người làm @featureJosh đã nhận hôm nay. Đang mởbug
featureJosh/Recompia#530 · 1 người được giao ·
Tất cả issue của featureJosh/Recompia
Issue tương tự
-
type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
tensorflow/tflite-micro#3995 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
not for AI lovers
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
OSGeo/gdal#15515 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
VT: Backend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
contour-terminal/contour#2314 ·
Maintainer thường phản hồi trong vòng 1 ngày