added missing hidapi stuff for os/2 with libusb

This commit is contained in:
Ozkan Sezer 2022-01-09 20:33:32 +03:00
parent 1f32dd8edc
commit f14c7bb443
5 changed files with 34 additions and 0 deletions

View File

@ -4,6 +4,11 @@
# If you have GNU libiconv installed (iconv2.dll), you
# can compile against it by specifying LIBICONV=1, e.g.:
# wmake -f Makefile.os2 LIBICONV=1
#
# If you have libusb-1.0 installed (usb100.dll, libusb.h), you
# can compile hidapi joystick support against it (experimental)
# by specifying HIDAPI=1, e.g.:
# wmake -f Makefile.os2 HIDAPI=1
LIBNAME = SDL2
VERSION = 2.0.20
@ -42,6 +47,10 @@ LIBS+= $(ICONVLIB)
!else
LIBS+= libuls.lib libconv.lib
!endif
# hidapi (libusb):
!ifeq HIDAPI 1
CFLAGS_DLL+= -DHAVE_LIBUSB_H=1
!endif
# building SDL itself (for DECLSPEC):
CFLAGS_DLL+= -DBUILD_SDL

7
configure vendored
View File

@ -25403,6 +25403,9 @@ fi
enable_hidapi_libusb=yes
require_hidapi_libusb=yes
;;
*-*-os2* )
enable_hidapi_libusb=yes
;;
esac
hidapi_support=yes
@ -25513,6 +25516,9 @@ $as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic li
*-*-cygwin* | *-*-mingw* )
libusb_lib="libusb-1.0.dll"
;;
*-*-os2* )
libusb_lib="usb100.dll"
;;
esac
if test x$libusb_lib = x; then
libusb_lib=`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`
@ -26720,6 +26726,7 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
CheckDummyVideo
CheckDiskAudio
CheckDummyAudio
CheckHIDAPI
# Set up the core platform files
SOURCES="$SOURCES $srcdir/src/core/os2/*.c"

View File

@ -3489,6 +3489,9 @@ CheckHIDAPI()
enable_hidapi_libusb=yes
require_hidapi_libusb=yes
;;
*-*-os2* )
enable_hidapi_libusb=yes
;;
esac
hidapi_support=yes
@ -3521,6 +3524,9 @@ CheckHIDAPI()
*-*-cygwin* | *-*-mingw* )
libusb_lib="libusb-1.0.dll"
;;
*-*-os2* )
libusb_lib="usb100.dll"
;;
esac
if test x$libusb_lib = x; then
libusb_lib=[`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
@ -4429,6 +4435,7 @@ case "$host" in
CheckDummyVideo
CheckDiskAudio
CheckDummyAudio
CheckHIDAPI
# Set up the core platform files
SOURCES="$SOURCES $srcdir/src/core/os2/*.c"

View File

@ -38,8 +38,14 @@
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_OS2 1
#define SDL_JOYSTICK_OS2 1
#ifndef HAVE_LIBUSB_H /* see Makefile */
#define SDL_HIDAPI_DISABLED 1
/*#undef SDL_JOYSTICK_HIDAPI */
#else
#define SDL_JOYSTICK_HIDAPI 1
/* dynamically loaded libusb-1.0 dll: */
#define SDL_LIBUSB_DYNAMIC "usb100.dll"
#endif
/*#undef SDL_JOYSTICK_VIRTUAL */
/* Enable OpenGL support */

View File

@ -1036,8 +1036,13 @@ int SDL_hid_init(void)
libusb_ctx.libhandle = SDL_LoadObject(SDL_LIBUSB_DYNAMIC);
if (libusb_ctx.libhandle != NULL) {
SDL_bool loaded = SDL_TRUE;
#ifdef __OS2__
#define LOAD_LIBUSB_SYMBOL(func) \
if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle,"_libusb_" #func))) {loaded = SDL_FALSE;}
#else
#define LOAD_LIBUSB_SYMBOL(func) \
if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle, "libusb_" #func))) {loaded = SDL_FALSE;}
#endif
LOAD_LIBUSB_SYMBOL(init)
LOAD_LIBUSB_SYMBOL(exit)
LOAD_LIBUSB_SYMBOL(get_device_list)