feat: DualSense + Switch Pro types + thin-catalog default-to-first - #31
Merged
emir-hasanbegovic merged 2 commits intoJul 23, 2026
Merged
Conversation
Auto-detect two new sender-side controller types from the physical SDL pad, riding only the REST descriptor (no user picker, no protocolVersion bump): - id 2 dualsense: SDL PS5 pads. Touchpad → touchpadMode=ds4. - id 3 switchpro: SDL Switch Pro pads. No trackpad → touchpadMode=off. sdlTypeToControllerType now splits PS5 out to DualSense and maps SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO to SwitchPro; PS3/PS4 stay PlayStation (DS4), everything else Xbox. The type→touchpadMode rule in desiredDescriptor() is widened via a small helper so DualSense also routes its trackpad as ds4.
Fetch GET /api/catalog when a session opens and default the sent controller type to the first offered type, replacing the SDL-derived type decision. The chosen type's catalog entry also drives touchpadMode (ds4 when advertised, else off). Physical-pad matching stays deferred; an unreachable/older satellite falls back to type 0 / touchpad off. - Models: CatalogType / ServerCatalog DTO + lenient parser (id + whether features.touchpad.modes contains "ds4"; tolerates an emulates block). - HTTPClient::getCatalog -- unauthenticated GET, clones getSession. - WifiConnection caches the catalog (fetched once per connection, before the PUT) and sources desiredDescriptor's type + touchpadMode from it. - WifiConnectionManager gates openSession on the catalog fetch. - Remove sdlTypeToControllerType, the ConnectionHub controller-type seam, AppModel's setControllerTypeFn, and the bridge's per-device type map. A user-facing type picker is a separate follow-up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds two sender-side controller types that auto-detect from the physical SDL pad. Dish is a sender — it never materializes pads — so the type is purely cosmetic metadata that rides the REST descriptor to the receiver, which picks a matching virtual pad. No user picker; no
protocolVersionbump (additive contract ids).dualsenseswitchpro(id 0 xbox, id 1 playstation/DS4 unchanged.)
Changes
Protocol.h— addkControllerTypeDualSense = 2,kControllerTypeSwitchPro = 3.SDLGamepadBridge.cpp—sdlTypeToControllerTypesplitsSDL_CONTROLLER_TYPE_PS5out to DualSense and mapsSDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PROto SwitchPro. PS3/PS4 stay PlayStation (DS4); everything else stays Xbox. (This TU keeps its own copy of the type constants, extended to match.) Refreshed the now-stale mapping comments.WifiConnection.cpp—desiredDescriptor()'s type→touchpadModerule is widened via a smalltouchpadModeForTypehelper: DualSense has a trackpad so it also maps tods4; Switch Pro has none so staysoff.test_models.cpp— mirrored assertions: a DualSense descriptor emitstype==2&touchpadMode=="ds4"; a Switch Pro descriptor emitstype==3&touchpadMode=="off".Verification
scripts/ci_local.sh --no-tidyall green natively (macOS, Homebrew Qt6/SDL2/libsodium): clang-format, Debug configure+build, ctest 235/235 passed, Release build. clang-tidy and the container/GCC pass (GCC-only-Wshadow) are the follow-up; no shadowing introduced here (the new helper is a free function with atypeparam and no enclosingtype).Thin-catalog update (default-to-first; gains a catalog fetch)
This branch now also carries the thin-catalog client change.
HTTPClient::getCatalog(unauthenticated GET/api/catalog) + a smallServerCatalogDTO/parser, fetched once per connection before the session PUT.controllerTypes[0]and sourcestouchpadModefrom that type's catalog features. RemovedsdlTypeToControllerTypeand the pad-derived type plumbing.emulateshint preserves the info for a later matcher). A user picker is a separate follow-up. Falls back to type 0 / touchpad off when no catalog.emulatesfield. Verified:ci_local.shctest (native macOS/clang) and g++ in the dish-linux-ci container (239/239).