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

7
configure vendored
View File

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

View File

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

View File

@ -38,8 +38,14 @@
#define SDL_VIDEO_DRIVER_DUMMY 1 #define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_OS2 1 #define SDL_VIDEO_DRIVER_OS2 1
#define SDL_JOYSTICK_OS2 1 #define SDL_JOYSTICK_OS2 1
#ifndef HAVE_LIBUSB_H /* see Makefile */
#define SDL_HIDAPI_DISABLED 1 #define SDL_HIDAPI_DISABLED 1
/*#undef SDL_JOYSTICK_HIDAPI */ /*#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 */ /*#undef SDL_JOYSTICK_VIRTUAL */
/* Enable OpenGL support */ /* Enable OpenGL support */

View File

@ -1036,8 +1036,13 @@ int SDL_hid_init(void)
libusb_ctx.libhandle = SDL_LoadObject(SDL_LIBUSB_DYNAMIC); libusb_ctx.libhandle = SDL_LoadObject(SDL_LIBUSB_DYNAMIC);
if (libusb_ctx.libhandle != NULL) { if (libusb_ctx.libhandle != NULL) {
SDL_bool loaded = SDL_TRUE; 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) \ #define LOAD_LIBUSB_SYMBOL(func) \
if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle, "libusb_" #func))) {loaded = SDL_FALSE;} if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle, "libusb_" #func))) {loaded = SDL_FALSE;}
#endif
LOAD_LIBUSB_SYMBOL(init) LOAD_LIBUSB_SYMBOL(init)
LOAD_LIBUSB_SYMBOL(exit) LOAD_LIBUSB_SYMBOL(exit)
LOAD_LIBUSB_SYMBOL(get_device_list) LOAD_LIBUSB_SYMBOL(get_device_list)