Skip to content

Commit 889e478

Browse files
committed
Clarify when we want to auto-enable Apex 5 enhanced functionality
1 parent 3336aa9 commit 889e478

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

src/joystick/hidapi/SDL_hidapi_flydigi.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,7 @@ static bool HIDAPI_DriverFlydigi_InitControllerV2(SDL_HIDAPI_Device *device)
294294
if (data[10] == 1) {
295295
ctx->available = true;
296296
} else {
297-
#ifdef SDL_PLATFORM_WINDOWS
298-
// Click "Allow third-party apps to take over mappings" in the FlyDigi Space Station app
299-
#else
297+
#ifdef SDL_AUTO_ENABLE_ENHANCED_FLYDIGI
300298
// The FlyDigi Space Station app isn't available, we need to enable this ourselves
301299
Uint8 enable_acquire[] = {
302300
FLYDIGI_V2_CMD_REPORT_ID,
@@ -308,7 +306,10 @@ static bool HIDAPI_DriverFlydigi_InitControllerV2(SDL_HIDAPI_Device *device)
308306
if (SDL_hid_write(device->dev, enable_acquire, sizeof(enable_acquire)) < 0) {
309307
return SDL_SetError("Couldn't set controller status");
310308
}
311-
#endif // SDL_PLATFORM_WINDOWS
309+
#else
310+
// Click "Allow third-party apps to take over mappings" in the FlyDigi Space Station app
311+
312+
#endif // SDL_AUTO_ENABLE_ENHANCED_FLYDIGI
312313
}
313314
return true;
314315
}

src/joystick/hidapi/SDL_hidapi_flydigi.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ typedef enum
3636
SDL_FLYDIGI_VADER4_PRO,
3737
} SDL_FlyDigiControllerType;
3838

39+
#ifndef SDL_PLATFORM_WINDOWS
40+
// The FlyDigi Space Station app isn't available on this platform
41+
#define SDL_AUTO_ENABLE_ENHANCED_FLYDIGI
42+
#endif

src/joystick/hidapi/SDL_hidapijoystick.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,10 +1305,19 @@ bool HIDAPI_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version,
13051305
*/
13061306
SDL_LockJoysticks();
13071307
for (device = SDL_HIDAPI_devices; device; device = device->next) {
1308+
#ifdef SDL_AUTO_ENABLE_ENHANCED_FLYDIGI
1309+
// The HIDAPI functionality will always be available, so ignore the XInput interface
1310+
#else
1311+
// The HIDAPI functionality will be available when the FlyDigi Space Station app has
1312+
// enabled third party controller mapping, so the driver needs to be active to watch
1313+
// for that change. Since this is dynamic and we don't have a way to re-trigger device
1314+
// changes when that happens, we'll pretend the driver isn't available so the XInput
1315+
// interface will always show up (but won't have any input when the controller is in
1316+
// enhanced mode)
13081317
if (device->vendor_id == USB_VENDOR_FLYDIGI_V2) {
1309-
// Ignore the Apex 5, as it can dynamically switch between Xbox and HIDAPI mode
13101318
continue;
13111319
}
1320+
#endif // SDL_AUTO_ENABLE_ENHANCED_FLYDIGI
13121321

13131322
if (device->driver &&
13141323
HIDAPI_IsEquivalentToDevice(vendor_id, product_id, device)) {

0 commit comments

Comments
 (0)