Switch 2 Pro Controller over USB: turn on SDL's HIDAPI libusb backend
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 74/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- cmake
- 領域
- build-system
調査の方向性
runtime/cmake/gfx_deps.cmakeとset(SDL_VENDOR_INFO ...)付近のSDLオプションから始めます。issueには、FetchContent_MakeAvailable(...)の前に有効にする3つのオプションが指定されています。設定でlibusb 1.0のヘッダーとインポートライブラリをどのように提供しているか、またmake-release.ps1がランタイムファイルをどのように収集するかを確認します。WindowsビルドでUSB接続されたコントローラーが検出され、リリースパッケージに必要なlibusb DLLとライセンスが含まれれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C++
- スター
- 224
- フォーク
- 0
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
featureJosh/Recompia のほかの issue
-
Improve Gardeningオープンenhancement
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
featureJosh/Recompia#535 ·
-
bug low priority
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
featureJosh/Recompia#534 · コメント 2 件 ·
-
Game crashes multiple times at random moments | CachyOS Hyprland対応中かも @featureJosh が今日担当しました。 オープンbug
featureJosh/Recompia#533 · 担当者 1 名 ·
-
Frequent Crashes on Steam Deck: The graphics device was lost, so Pokopia must close対応中かも @featureJosh が今日担当しました。 オープンbug high priority
featureJosh/Recompia#531 · コメント 1 件 · 担当者 1 名 ·
-
Setup log for translator fail for proton対応中かも @featureJosh が今日担当しました。 オープンbug
featureJosh/Recompia#530 · 担当者 1 名 ·
featureJosh/Recompia の issue をすべて見る
似ている issue
-
type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
tensorflow/tflite-micro#3995 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
not for AI lovers
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
VT: Backend
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
contour-terminal/contour#2314 ·
メンテナーはふだん 1 日以内に返信