mirror of https://github.com/encounter/SDL.git
Probable fix for compile errors on Mac OS and (non-VS) Win32
This commit is contained in:
parent
dc36f133b4
commit
417713a75c
|
@ -3291,6 +3291,10 @@ CheckHIDAPI()
|
||||||
*-*-*bsd* )
|
*-*-*bsd* )
|
||||||
onlylibusb=yes
|
onlylibusb=yes
|
||||||
;;
|
;;
|
||||||
|
# RAWINPUT is only available on Win32, but can be enabled if HIDAPI is
|
||||||
|
*-*-cygwin* | *-*-mingw32*)
|
||||||
|
userawinput=yes
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AC_ARG_ENABLE(hidapi,
|
AC_ARG_ENABLE(hidapi,
|
||||||
|
@ -3316,7 +3320,9 @@ AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[d
|
||||||
|
|
||||||
if test x$hidapi_support = xyes; then
|
if test x$hidapi_support = xyes; then
|
||||||
AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
|
AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
|
||||||
|
if test x$userawinput = xyes; then
|
||||||
AC_DEFINE(SDL_JOYSTICK_RAWINPUT, 1, [ ])
|
AC_DEFINE(SDL_JOYSTICK_RAWINPUT, 1, [ ])
|
||||||
|
fi
|
||||||
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
|
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
|
||||||
SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
|
SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/hidapi/SDL_hidapi.c"
|
SOURCES="$SOURCES $srcdir/src/hidapi/SDL_hidapi.c"
|
||||||
|
|
|
@ -241,6 +241,7 @@ static SDL_HIDAPI_DeviceDriver *
|
||||||
RAWINPUT_GetDeviceDriver(SDL_RAWINPUT_Device *device)
|
RAWINPUT_GetDeviceDriver(SDL_RAWINPUT_Device *device)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
SDL_GameControllerType type;
|
||||||
|
|
||||||
if (SDL_ShouldIgnoreJoystick(device->name, device->guid)) {
|
if (SDL_ShouldIgnoreJoystick(device->name, device->guid)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -253,7 +254,7 @@ RAWINPUT_GetDeviceDriver(SDL_RAWINPUT_Device *device)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_GameControllerType type = SDL_GetJoystickGameControllerType("", device->vendor_id, device->product_id, -1, 0, 0, 0);
|
type = SDL_GetJoystickGameControllerType("", device->vendor_id, device->product_id, -1, 0, 0, 0);
|
||||||
|
|
||||||
for (i = 0; i < SDL_arraysize(SDL_RAWINPUT_drivers); ++i) {
|
for (i = 0; i < SDL_arraysize(SDL_RAWINPUT_drivers); ++i) {
|
||||||
SDL_HIDAPI_DeviceDriver *driver = SDL_RAWINPUT_drivers[i];
|
SDL_HIDAPI_DeviceDriver *driver = SDL_RAWINPUT_drivers[i];
|
||||||
|
@ -365,6 +366,7 @@ RAWINPUT_DelDevice(SDL_RAWINPUT_Device *device, SDL_bool send_event)
|
||||||
SDL_RAWINPUT_Device *curr, *last;
|
SDL_RAWINPUT_Device *curr, *last;
|
||||||
for (curr = SDL_RAWINPUT_devices, last = NULL; curr; last = curr, curr = curr->next) {
|
for (curr = SDL_RAWINPUT_devices, last = NULL; curr; last = curr, curr = curr->next) {
|
||||||
if (curr == device) {
|
if (curr == device) {
|
||||||
|
SDL_Joystick *joystick;
|
||||||
if (last) {
|
if (last) {
|
||||||
last->next = curr->next;
|
last->next = curr->next;
|
||||||
} else {
|
} else {
|
||||||
|
@ -372,7 +374,7 @@ RAWINPUT_DelDevice(SDL_RAWINPUT_Device *device, SDL_bool send_event)
|
||||||
}
|
}
|
||||||
--SDL_RAWINPUT_numjoysticks;
|
--SDL_RAWINPUT_numjoysticks;
|
||||||
|
|
||||||
SDL_Joystick *joystick = device->joystick;
|
joystick = device->joystick;
|
||||||
if (joystick) {
|
if (joystick) {
|
||||||
/* Detach from joystick */
|
/* Detach from joystick */
|
||||||
RAWINPUT_JoystickClose(joystick);
|
RAWINPUT_JoystickClose(joystick);
|
||||||
|
|
Loading…
Reference in New Issue