pkgsrc/games/plib/patches/patch-ad

53 lines
1.6 KiB
Text

$NetBSD: patch-ad,v 1.9 2019/06/27 14:19:51 hauke Exp $
--- src/js/jsBSD.cxx.orig 2008-03-11 02:06:21.000000000 +0000
+++ src/js/jsBSD.cxx
@@ -49,16 +49,16 @@
#include <sys/ioctl.h>
#if defined(__FreeBSD__)
# include <sys/joystick.h>
-#else
+#elif (defined(__OpenBSD__) && defined(__i386__)) || defined(__NetBSD__) || defined(__DragonFly__)
# include <machine/joystick.h> // For analog joysticks
#endif
#ifdef HAVE_USB_JS
#if defined(__NetBSD__)
-#ifdef HAVE_USBHID_H
+#define HAVE_USBHID_H 1
+# if __NetBSD_Version__ > 899000900
+# include <dev/hid/hid.h>
+# endif
#include <usbhid.h>
-#else
-#include <usb.h>
-#endif
#elif defined(__FreeBSD__)
extern "C" {
# if __FreeBSD_version < 500000
@@ -85,7 +85,9 @@ struct os_specific_s {
int fd;
int is_analog;
// The following structure members are specific to analog joysticks
+#if (defined(__OpenBSD__) && defined(__i386__)) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
struct joystick ajs;
+#endif
#ifdef HAVE_USB_JS
// The following structure members are specific to USB joysticks
struct hid_item *hids;
@@ -437,7 +439,7 @@ void jsJoystick::rawRead ( int *buttons,
return ;
}
-
+#if (defined(__OpenBSD__) && defined(__i386__)) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
if ( os->is_analog )
{
int status = ::read ( os->fd, &os->ajs, sizeof(os->ajs) );
@@ -462,6 +464,7 @@ void jsJoystick::rawRead ( int *buttons,
return;
}
+#endif
#ifdef HAVE_USB_JS
while ((len = ::read(os->fd, os->hid_data_buf, os->hid_dlen)) == os->hid_dlen)