pkgsrc/games/plib/patches/patch-ad
ryoon c52272e75a Fix build on OpenBSD/amd64 5.2.
The patches are taken from OpenBSD ports repository.

* Disable joystick on OpenBSD/!i386
* Use sndio on OpenBSD
2013-01-06 00:59:46 +00:00

50 lines
1.5 KiB
Text

$NetBSD: patch-ad,v 1.7 2013/01/06 00:59:47 ryoon Exp $
--- src/js/jsBSD.cxx.orig Tue Mar 11 02:06:21 2008
+++ src/js/jsBSD.cxx
@@ -49,16 +49,13 @@
#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
#include <usbhid.h>
-#else
-#include <usb.h>
-#endif
#elif defined(__FreeBSD__)
extern "C" {
# if __FreeBSD_version < 500000
@@ -85,7 +82,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 +436,7 @@ void jsJoystick::rawRead ( int *buttons, float *axes )
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 +461,7 @@ void jsJoystick::rawRead ( int *buttons, float *axes )
return;
}
+#endif
#ifdef HAVE_USB_JS
while ((len = ::read(os->fd, os->hid_data_buf, os->hid_dlen)) == os->hid_dlen)