Clarify when we want to auto-enable Apex 5 enhanced functionality

This commit is contained in:
Sam Lantinga
2025-11-02 11:14:41 -08:00
parent 3336aa95f1
commit 889e4787d6
3 changed files with 19 additions and 5 deletions

View File

@@ -294,9 +294,7 @@ static bool HIDAPI_DriverFlydigi_InitControllerV2(SDL_HIDAPI_Device *device)
if (data[10] == 1) { if (data[10] == 1) {
ctx->available = true; ctx->available = true;
} else { } else {
#ifdef SDL_PLATFORM_WINDOWS #ifdef SDL_AUTO_ENABLE_ENHANCED_FLYDIGI
// Click "Allow third-party apps to take over mappings" in the FlyDigi Space Station app
#else
// The FlyDigi Space Station app isn't available, we need to enable this ourselves // The FlyDigi Space Station app isn't available, we need to enable this ourselves
Uint8 enable_acquire[] = { Uint8 enable_acquire[] = {
FLYDIGI_V2_CMD_REPORT_ID, FLYDIGI_V2_CMD_REPORT_ID,
@@ -308,7 +306,10 @@ static bool HIDAPI_DriverFlydigi_InitControllerV2(SDL_HIDAPI_Device *device)
if (SDL_hid_write(device->dev, enable_acquire, sizeof(enable_acquire)) < 0) { if (SDL_hid_write(device->dev, enable_acquire, sizeof(enable_acquire)) < 0) {
return SDL_SetError("Couldn't set controller status"); return SDL_SetError("Couldn't set controller status");
} }
#endif // SDL_PLATFORM_WINDOWS #else
// Click "Allow third-party apps to take over mappings" in the FlyDigi Space Station app
#endif // SDL_AUTO_ENABLE_ENHANCED_FLYDIGI
} }
return true; return true;
} }

View File

@@ -36,3 +36,7 @@ typedef enum
SDL_FLYDIGI_VADER4_PRO, SDL_FLYDIGI_VADER4_PRO,
} SDL_FlyDigiControllerType; } SDL_FlyDigiControllerType;
#ifndef SDL_PLATFORM_WINDOWS
// The FlyDigi Space Station app isn't available on this platform
#define SDL_AUTO_ENABLE_ENHANCED_FLYDIGI
#endif

View File

@@ -1305,10 +1305,19 @@ bool HIDAPI_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version,
*/ */
SDL_LockJoysticks(); SDL_LockJoysticks();
for (device = SDL_HIDAPI_devices; device; device = device->next) { for (device = SDL_HIDAPI_devices; device; device = device->next) {
#ifdef SDL_AUTO_ENABLE_ENHANCED_FLYDIGI
// The HIDAPI functionality will always be available, so ignore the XInput interface
#else
// The HIDAPI functionality will be available when the FlyDigi Space Station app has
// enabled third party controller mapping, so the driver needs to be active to watch
// for that change. Since this is dynamic and we don't have a way to re-trigger device
// changes when that happens, we'll pretend the driver isn't available so the XInput
// interface will always show up (but won't have any input when the controller is in
// enhanced mode)
if (device->vendor_id == USB_VENDOR_FLYDIGI_V2) { if (device->vendor_id == USB_VENDOR_FLYDIGI_V2) {
// Ignore the Apex 5, as it can dynamically switch between Xbox and HIDAPI mode
continue; continue;
} }
#endif // SDL_AUTO_ENABLE_ENHANCED_FLYDIGI
if (device->driver && if (device->driver &&
HIDAPI_IsEquivalentToDevice(vendor_id, product_id, device)) { HIDAPI_IsEquivalentToDevice(vendor_id, product_id, device)) {