mirror of https://github.com/encounter/SDL.git
fix build with --disable-directx
This commit is contained in:
parent
2ea393bd83
commit
f3835702d3
|
@ -1421,26 +1421,6 @@ elseif(WINDOWS)
|
||||||
set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
|
set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(HAVE_WIN32_CC)
|
|
||||||
# xinput.h may need windows.h, but doesn't include it itself.
|
|
||||||
check_c_source_compiles("
|
|
||||||
#include <windows.h>
|
|
||||||
#include <xinput.h>
|
|
||||||
int main(int argc, char **argv) { }" HAVE_XINPUT_H)
|
|
||||||
check_c_source_compiles("
|
|
||||||
#include <windows.h>
|
|
||||||
#include <xinput.h>
|
|
||||||
XINPUT_GAMEPAD_EX x1;
|
|
||||||
int main(int argc, char **argv) { }" HAVE_XINPUT_GAMEPAD_EX)
|
|
||||||
check_c_source_compiles("
|
|
||||||
#include <windows.h>
|
|
||||||
#include <xinput.h>
|
|
||||||
XINPUT_STATE_EX s1;
|
|
||||||
int main(int argc, char **argv) { }" HAVE_XINPUT_STATE_EX)
|
|
||||||
else()
|
|
||||||
check_include_file(xinput.h HAVE_XINPUT_H)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
check_include_file(d3d9.h HAVE_D3D_H)
|
check_include_file(d3d9.h HAVE_D3D_H)
|
||||||
check_include_file(d3d11_1.h HAVE_D3D11_H)
|
check_include_file(d3d11_1.h HAVE_D3D11_H)
|
||||||
check_include_file(ddraw.h HAVE_DDRAW_H)
|
check_include_file(ddraw.h HAVE_DDRAW_H)
|
||||||
|
@ -1461,6 +1441,26 @@ elseif(WINDOWS)
|
||||||
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(HAVE_WIN32_CC)
|
||||||
|
# xinput.h may need windows.h, but does not include it itself.
|
||||||
|
check_c_source_compiles("
|
||||||
|
#include <windows.h>
|
||||||
|
#include <xinput.h>
|
||||||
|
int main(int argc, char **argv) { }" HAVE_XINPUT_H)
|
||||||
|
check_c_source_compiles("
|
||||||
|
#include <windows.h>
|
||||||
|
#include <xinput.h>
|
||||||
|
XINPUT_GAMEPAD_EX x1;
|
||||||
|
int main(int argc, char **argv) { }" HAVE_XINPUT_GAMEPAD_EX)
|
||||||
|
check_c_source_compiles("
|
||||||
|
#include <windows.h>
|
||||||
|
#include <xinput.h>
|
||||||
|
XINPUT_STATE_EX s1;
|
||||||
|
int main(int argc, char **argv) { }" HAVE_XINPUT_STATE_EX)
|
||||||
|
else()
|
||||||
|
check_include_file(xinput.h HAVE_XINPUT_H)
|
||||||
|
endif()
|
||||||
|
|
||||||
# headers needed elsewhere
|
# headers needed elsewhere
|
||||||
check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
|
check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
|
||||||
check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
|
check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
|
||||||
|
|
|
@ -23865,6 +23865,37 @@ if test "x$ac_cv_header_dxgi_h" = xyes; then :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if test x$have_ddraw = xyes; then
|
||||||
|
|
||||||
|
$as_echo "#define HAVE_DDRAW_H 1" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
if test x$have_dinput = xyes; then
|
||||||
|
|
||||||
|
$as_echo "#define HAVE_DINPUT_H 1" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
if test x$have_dsound = xyes; then
|
||||||
|
|
||||||
|
$as_echo "#define HAVE_DSOUND_H 1" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
if test x$have_dxgi = xyes; then
|
||||||
|
|
||||||
|
$as_echo "#define HAVE_DXGI_H 1" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
|
||||||
|
# FIXME: ...so force it off for now.
|
||||||
|
case "$host" in
|
||||||
|
*-*-cygwin*)
|
||||||
|
have_dinput=false
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
ac_fn_c_check_header_mongrel "$LINENO" "xinput.h" "ac_cv_header_xinput_h" "$ac_includes_default"
|
ac_fn_c_check_header_mongrel "$LINENO" "xinput.h" "ac_cv_header_xinput_h" "$ac_includes_default"
|
||||||
if test "x$ac_cv_header_xinput_h" = xyes; then :
|
if test "x$ac_cv_header_xinput_h" = xyes; then :
|
||||||
have_xinput=yes
|
have_xinput=yes
|
||||||
|
@ -23910,26 +23941,6 @@ if ac_fn_c_try_compile "$LINENO"; then :
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
|
||||||
if test x$have_ddraw = xyes; then
|
|
||||||
|
|
||||||
$as_echo "#define HAVE_DDRAW_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
if test x$have_dinput = xyes; then
|
|
||||||
|
|
||||||
$as_echo "#define HAVE_DINPUT_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
if test x$have_dsound = xyes; then
|
|
||||||
|
|
||||||
$as_echo "#define HAVE_DSOUND_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
if test x$have_dxgi = xyes; then
|
|
||||||
|
|
||||||
$as_echo "#define HAVE_DXGI_H 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
if test x$have_xinput = xyes; then
|
if test x$have_xinput = xyes; then
|
||||||
|
|
||||||
$as_echo "#define HAVE_XINPUT_H 1" >>confdefs.h
|
$as_echo "#define HAVE_XINPUT_H 1" >>confdefs.h
|
||||||
|
@ -23946,15 +23957,6 @@ $as_echo "#define HAVE_XINPUT_STATE_EX 1" >>confdefs.h
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
|
|
||||||
# FIXME: ...so force it off for now.
|
|
||||||
case "$host" in
|
|
||||||
*-*-cygwin*)
|
|
||||||
have_dinput=false
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
ac_fn_c_check_header_mongrel "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default"
|
ac_fn_c_check_header_mongrel "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default"
|
||||||
if test "x$ac_cv_header_mmdeviceapi_h" = xyes; then :
|
if test "x$ac_cv_header_mmdeviceapi_h" = xyes; then :
|
||||||
have_wasapi=yes
|
have_wasapi=yes
|
||||||
|
|
43
configure.ac
43
configure.ac
|
@ -3154,17 +3154,6 @@ AS_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[defaul
|
||||||
AC_CHECK_HEADER(dsound.h, have_dsound=yes)
|
AC_CHECK_HEADER(dsound.h, have_dsound=yes)
|
||||||
AC_CHECK_HEADER(dinput.h, have_dinput=yes)
|
AC_CHECK_HEADER(dinput.h, have_dinput=yes)
|
||||||
AC_CHECK_HEADER(dxgi.h, have_dxgi=yes)
|
AC_CHECK_HEADER(dxgi.h, have_dxgi=yes)
|
||||||
AC_CHECK_HEADER(xinput.h, have_xinput=yes)
|
|
||||||
AC_TRY_COMPILE([
|
|
||||||
#include <windows.h>
|
|
||||||
#include <xinput.h>
|
|
||||||
XINPUT_GAMEPAD_EX x1;
|
|
||||||
],[],[have_xinput_gamepadex=yes])
|
|
||||||
AC_TRY_COMPILE([
|
|
||||||
#include <windows.h>
|
|
||||||
#include <xinput.h>
|
|
||||||
XINPUT_STATE_EX s1;
|
|
||||||
],[],[have_xinput_stateex=yes])
|
|
||||||
|
|
||||||
if test x$have_ddraw = xyes; then
|
if test x$have_ddraw = xyes; then
|
||||||
AC_DEFINE(HAVE_DDRAW_H, 1, [ ])
|
AC_DEFINE(HAVE_DDRAW_H, 1, [ ])
|
||||||
|
@ -3178,15 +3167,6 @@ XINPUT_STATE_EX s1;
|
||||||
if test x$have_dxgi = xyes; then
|
if test x$have_dxgi = xyes; then
|
||||||
AC_DEFINE(HAVE_DXGI_H, 1, [ ])
|
AC_DEFINE(HAVE_DXGI_H, 1, [ ])
|
||||||
fi
|
fi
|
||||||
if test x$have_xinput = xyes; then
|
|
||||||
AC_DEFINE(HAVE_XINPUT_H, 1, [ ])
|
|
||||||
fi
|
|
||||||
if test x$have_xinput_gamepadex = xyes; then
|
|
||||||
AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ])
|
|
||||||
fi
|
|
||||||
if test x$have_xinput_stateex = xyes; then
|
|
||||||
AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ])
|
|
||||||
fi
|
|
||||||
|
|
||||||
# FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
|
# FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
|
||||||
# FIXME: ...so force it off for now.
|
# FIXME: ...so force it off for now.
|
||||||
|
@ -3197,6 +3177,29 @@ XINPUT_STATE_EX s1;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl The following are independent of --enable-directx
|
||||||
|
AC_CHECK_HEADER(xinput.h, have_xinput=yes)
|
||||||
|
AC_TRY_COMPILE([
|
||||||
|
#include <windows.h>
|
||||||
|
#include <xinput.h>
|
||||||
|
XINPUT_GAMEPAD_EX x1;
|
||||||
|
],[],[have_xinput_gamepadex=yes])
|
||||||
|
AC_TRY_COMPILE([
|
||||||
|
#include <windows.h>
|
||||||
|
#include <xinput.h>
|
||||||
|
XINPUT_STATE_EX s1;
|
||||||
|
],[],[have_xinput_stateex=yes])
|
||||||
|
|
||||||
|
if test x$have_xinput = xyes; then
|
||||||
|
AC_DEFINE(HAVE_XINPUT_H, 1, [ ])
|
||||||
|
fi
|
||||||
|
if test x$have_xinput_gamepadex = xyes; then
|
||||||
|
AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ])
|
||||||
|
fi
|
||||||
|
if test x$have_xinput_stateex = xyes; then
|
||||||
|
AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
|
AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
|
||||||
if test x$have_wasapi = xyes; then
|
if test x$have_wasapi = xyes; then
|
||||||
AC_DEFINE(HAVE_MMDEVICEAPI_H, 1, [ ])
|
AC_DEFINE(HAVE_MMDEVICEAPI_H, 1, [ ])
|
||||||
|
|
|
@ -44,7 +44,9 @@
|
||||||
#include "../../core/windows/SDL_hid.h"
|
#include "../../core/windows/SDL_hid.h"
|
||||||
#include "../hidapi/SDL_hidapijoystick_c.h"
|
#include "../hidapi/SDL_hidapijoystick_c.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_XINPUT_H
|
||||||
#define SDL_JOYSTICK_RAWINPUT_XINPUT
|
#define SDL_JOYSTICK_RAWINPUT_XINPUT
|
||||||
|
#endif
|
||||||
#ifdef SDL_WINDOWS10_SDK
|
#ifdef SDL_WINDOWS10_SDK
|
||||||
#define SDL_JOYSTICK_RAWINPUT_WGI
|
#define SDL_JOYSTICK_RAWINPUT_WGI
|
||||||
#endif
|
#endif
|
||||||
|
@ -1216,9 +1218,8 @@ RAWINPUT_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uin
|
||||||
{
|
{
|
||||||
#if defined(SDL_JOYSTICK_RAWINPUT_WGI) || defined(SDL_JOYSTICK_RAWINPUT_XINPUT)
|
#if defined(SDL_JOYSTICK_RAWINPUT_WGI) || defined(SDL_JOYSTICK_RAWINPUT_XINPUT)
|
||||||
RAWINPUT_DeviceContext *ctx = joystick->hwdata;
|
RAWINPUT_DeviceContext *ctx = joystick->hwdata;
|
||||||
#endif
|
|
||||||
|
|
||||||
SDL_bool rumbled = SDL_FALSE;
|
SDL_bool rumbled = SDL_FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SDL_JOYSTICK_RAWINPUT_WGI
|
#ifdef SDL_JOYSTICK_RAWINPUT_WGI
|
||||||
if (!rumbled && ctx->wgi_correlated) {
|
if (!rumbled && ctx->wgi_correlated) {
|
||||||
|
|
Loading…
Reference in New Issue