Skip to content

Commit

Permalink
Fixed build on Android and iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 24, 2021
1 parent 19236b4 commit 9e45372
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/hidapi/SDL_hidapi.c
Expand Up @@ -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)
{
Expand Down Expand Up @@ -1009,6 +1010,7 @@ void SDL_EnableGameCubeAdaptors(void)
}
#endif /* SDL_LIBUSB_DYNAMIC */
}
#endif /* HAVE_ENABLE_GAMECUBE_ADAPTORS */

#endif /* SDL_JOYSTICK_HIDAPI */

Expand Down
6 changes: 6 additions & 0 deletions src/hidapi/SDL_hidapi.h
Expand Up @@ -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 */

Expand Down
2 changes: 2 additions & 0 deletions src/joystick/hidapi/SDL_hidapi_gamecube.c
Expand Up @@ -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) {
Expand Down

0 comments on commit 9e45372

Please sign in to comment.