cmake: Fix building with -DSDL_HAPTIC=Off
parent
fe97f01bc6
commit
b162629546
|
@ -404,6 +404,7 @@ file(GLOB SOURCE_FILES
|
||||||
${SDL2_SOURCE_DIR}/src/dynapi/*.c
|
${SDL2_SOURCE_DIR}/src/dynapi/*.c
|
||||||
${SDL2_SOURCE_DIR}/src/events/*.c
|
${SDL2_SOURCE_DIR}/src/events/*.c
|
||||||
${SDL2_SOURCE_DIR}/src/file/*.c
|
${SDL2_SOURCE_DIR}/src/file/*.c
|
||||||
|
${SDL2_SOURCE_DIR}/src/haptic/*.c
|
||||||
${SDL2_SOURCE_DIR}/src/libm/*.c
|
${SDL2_SOURCE_DIR}/src/libm/*.c
|
||||||
${SDL2_SOURCE_DIR}/src/locale/*.c
|
${SDL2_SOURCE_DIR}/src/locale/*.c
|
||||||
${SDL2_SOURCE_DIR}/src/power/*.c
|
${SDL2_SOURCE_DIR}/src/power/*.c
|
||||||
|
@ -878,8 +879,6 @@ if(SDL_HAPTIC)
|
||||||
# Haptic requires some private functions from the joystick subsystem.
|
# Haptic requires some private functions from the joystick subsystem.
|
||||||
message_error("SDL_HAPTIC requires SDL_JOYSTICK, which is not enabled")
|
message_error("SDL_HAPTIC requires SDL_JOYSTICK, which is not enabled")
|
||||||
endif()
|
endif()
|
||||||
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/*.c)
|
|
||||||
set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ struct haptic_hwdata
|
||||||
/*
|
/*
|
||||||
* Haptic system effect data.
|
* Haptic system effect data.
|
||||||
*/
|
*/
|
||||||
|
#if SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT
|
||||||
struct haptic_hweffect
|
struct haptic_hweffect
|
||||||
{
|
{
|
||||||
#if SDL_HAPTIC_DINPUT
|
#if SDL_HAPTIC_DINPUT
|
||||||
|
@ -60,6 +61,7 @@ struct haptic_hweffect
|
||||||
XINPUT_VIBRATION vibration;
|
XINPUT_VIBRATION vibration;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* List of available haptic devices.
|
* List of available haptic devices.
|
||||||
|
|
|
@ -359,9 +359,13 @@ WINDOWS_JoystickDetect(void)
|
||||||
JoyStick_DeviceData *pListNext = NULL;
|
JoyStick_DeviceData *pListNext = NULL;
|
||||||
|
|
||||||
if (pCurList->bXInputDevice) {
|
if (pCurList->bXInputDevice) {
|
||||||
|
#if SDL_HAPTIC_XINPUT
|
||||||
SDL_XINPUT_MaybeRemoveDevice(pCurList->XInputUserId);
|
SDL_XINPUT_MaybeRemoveDevice(pCurList->XInputUserId);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#if SDL_HAPTIC_DINPUT
|
||||||
SDL_DINPUT_MaybeRemoveDevice(&pCurList->dxdevice);
|
SDL_DINPUT_MaybeRemoveDevice(&pCurList->dxdevice);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_PrivateJoystickRemoved(pCurList->nInstanceID);
|
SDL_PrivateJoystickRemoved(pCurList->nInstanceID);
|
||||||
|
@ -380,9 +384,13 @@ WINDOWS_JoystickDetect(void)
|
||||||
while (pNewJoystick) {
|
while (pNewJoystick) {
|
||||||
if (pNewJoystick->send_add_event) {
|
if (pNewJoystick->send_add_event) {
|
||||||
if (pNewJoystick->bXInputDevice) {
|
if (pNewJoystick->bXInputDevice) {
|
||||||
|
#if SDL_HAPTIC_XINPUT
|
||||||
SDL_XINPUT_MaybeAddDevice(pNewJoystick->XInputUserId);
|
SDL_XINPUT_MaybeAddDevice(pNewJoystick->XInputUserId);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#if SDL_HAPTIC_DINPUT
|
||||||
SDL_DINPUT_MaybeAddDevice(&pNewJoystick->dxdevice);
|
SDL_DINPUT_MaybeAddDevice(&pNewJoystick->dxdevice);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_PrivateJoystickAdded(pNewJoystick->nInstanceID);
|
SDL_PrivateJoystickAdded(pNewJoystick->nInstanceID);
|
||||||
|
|
Loading…
Reference in New Issue