Skip to content

Commit 28849fd

Browse files
committed
Manually enable acquiring the Apex 5 controller if necessary
The FlyDigi Space Station app isn't available on non-Windows platforms, so we need to manually enable acquiring the controller on those platforms.
1 parent 5247399 commit 28849fd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/joystick/hidapi/SDL_hidapi_flydigi.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,22 @@ static bool HIDAPI_DriverFlydigi_InitControllerV2(SDL_HIDAPI_Device *device)
268268
return SDL_SetError("Couldn't get controller status");
269269
}
270270
if (data[10] != 1) {
271+
#ifdef SDL_PLATFORM_WINDOWS
271272
// Click "Allow third-party apps to take over mappings" in the FlyDigi Space Station app
272273
return SDL_SetError("Controller acquiring is disabled");
274+
#else
275+
// The FlyDigi Space Station app isn't available, we need to enable this ourselves
276+
Uint8 enable_acquire[32] = {
277+
FLYDIGI_V2_CMD_REPORT_ID,
278+
FLYDIGI_V2_MAGIC1,
279+
FLYDIGI_V2_MAGIC2,
280+
FLYDIGI_V2_SET_STATUS_COMMAND,
281+
0x07, 0xff, 0xff, 0xff, 0xff, 0x01, 0x15
282+
};
283+
if (SDL_hid_write(device->dev, enable_acquire, sizeof(enable_acquire)) < 0) {
284+
return SDL_SetError("Couldn't set controller status");
285+
}
286+
#endif // SDL_PLATFORM_WINDOWS
273287
}
274288
return true;
275289
}

0 commit comments

Comments
 (0)