summaryrefslogtreecommitdiff
path: root/games/plib/patches/patch-ad
blob: 22a99d3025b70e39eda4414d27997950571cb1f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
$NetBSD: patch-ad,v 1.10 2021/02/25 08:22:00 nia Exp $

--- src/js/jsBSD.cxx.orig	2008-03-11 02:06:21.000000000 +0000
+++ src/js/jsBSD.cxx
@@ -47,18 +47,18 @@
 #include <string.h>
 #include <errno.h>
 #include <sys/ioctl.h>
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 # include <sys/joystick.h>
-#else
+#elif (defined(__OpenBSD__) && defined(__i386__)) || 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)