Fixed build on Android and iOS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c
index 365ebe8..4cffde0 100644
--- a/src/hidapi/SDL_hidapi.c
+++ b/src/hidapi/SDL_hidapi.c
@@ -955,6 +955,7 @@ HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *device)
return wrapper->backend->hid_error(wrapper->device);
}
+#ifdef HAVE_ENABLE_GAMECUBE_ADAPTORS
/* This is needed to enable input for Nyko and EVORETRO GameCube adaptors */
void SDL_EnableGameCubeAdaptors(void)
{
@@ -1009,6 +1010,7 @@ void SDL_EnableGameCubeAdaptors(void)
}
#endif /* SDL_LIBUSB_DYNAMIC */
}
+#endif /* HAVE_ENABLE_GAMECUBE_ADAPTORS */
#endif /* SDL_JOYSTICK_HIDAPI */
diff --git a/src/hidapi/SDL_hidapi.h b/src/hidapi/SDL_hidapi.h
index 305a00a..7435390 100644
--- a/src/hidapi/SDL_hidapi.h
+++ b/src/hidapi/SDL_hidapi.h
@@ -21,7 +21,13 @@
#ifdef SDL_JOYSTICK_HIDAPI
+#ifdef SDL_LIBUSB_DYNAMIC
+#define HAVE_ENABLE_GAMECUBE_ADAPTORS
+#endif
+
+#ifdef HAVE_ENABLE_GAMECUBE_ADAPTORS
extern void SDL_EnableGameCubeAdaptors(void);
+#endif
#endif /* SDL_JOYSTICK_HIDAPI */
diff --git a/src/joystick/hidapi/SDL_hidapi_gamecube.c b/src/joystick/hidapi/SDL_hidapi_gamecube.c
index 3f275c8..51e8ba9 100644
--- a/src/joystick/hidapi/SDL_hidapi_gamecube.c
+++ b/src/joystick/hidapi/SDL_hidapi_gamecube.c
@@ -130,7 +130,9 @@ HIDAPI_DriverGameCube_InitDevice(SDL_HIDAPI_Device *device)
Uint8 initMagic = 0x13;
Uint8 rumbleMagic = 0x11;
+#ifdef HAVE_ENABLE_GAMECUBE_ADAPTORS
SDL_EnableGameCubeAdaptors();
+#endif
ctx = (SDL_DriverGameCube_Context *)SDL_calloc(1, sizeof(*ctx));
if (!ctx) {