Skip to content

Commit

Permalink
Make it build on recent DragonFly release.
Browse files Browse the repository at this point in the history
  • Loading branch information
hasso committed Mar 13, 2009
1 parent 2dda2e9 commit eb029fc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 33 deletions.
5 changes: 1 addition & 4 deletions emulators/snes9x/Makefile
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.44 2008/03/03 19:21:38 jlam Exp $ # $NetBSD: Makefile,v 1.45 2009/03/13 13:33:34 hasso Exp $


SNESVER= 1.43 SNESVER= 1.43
DISTNAME= snes9x-${SNESVER}-src DISTNAME= snes9x-${SNESVER}-src
Expand Down Expand Up @@ -82,9 +82,6 @@ MAKE_ENV+= USBJOY=1
. if exists(/usr/include/usbhid.h) . if exists(/usr/include/usbhid.h)
MAKE_ENV+= USBHID_H=1 MAKE_ENV+= USBHID_H=1
. endif . endif
.elif ${OPSYS} == "DragonFly" && exists(/usr/include/libusbhid.h)
MAKE_ENV+= USBJOY=1
MAKE_ENV+= USBHID_H=1
.endif .endif


BUILDLINK_DEPMETHOD.libXt?= build BUILDLINK_DEPMETHOD.libXt?= build
Expand Down
4 changes: 2 additions & 2 deletions emulators/snes9x/distinfo
@@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.17 2007/02/15 22:53:09 joerg Exp $ $NetBSD: distinfo,v 1.18 2009/03/13 13:33:34 hasso Exp $


SHA1 (snes9x-1.43-src.tar.gz) = c6883c451aeb442030862ec19a8dca25ee02d82c SHA1 (snes9x-1.43-src.tar.gz) = c6883c451aeb442030862ec19a8dca25ee02d82c
RMD160 (snes9x-1.43-src.tar.gz) = d2003f7afb208109405b41f4eec586b93518f9b2 RMD160 (snes9x-1.43-src.tar.gz) = d2003f7afb208109405b41f4eec586b93518f9b2
Expand All @@ -9,7 +9,7 @@ SHA1 (patch-ac) = c1e35daa7e53536d05c1633b78c00d511ae7feb5
SHA1 (patch-ad) = c5febcdd6b5bf0f3b4b5d8b0bc19c4716434a23e SHA1 (patch-ad) = c5febcdd6b5bf0f3b4b5d8b0bc19c4716434a23e
SHA1 (patch-ae) = c4258835925ee3a6e3606ad895ff697f379cb22f SHA1 (patch-ae) = c4258835925ee3a6e3606ad895ff697f379cb22f
SHA1 (patch-af) = 19d86d23e3af2c0cef09b8eeff1303d6f100c2f8 SHA1 (patch-af) = 19d86d23e3af2c0cef09b8eeff1303d6f100c2f8
SHA1 (patch-ag) = 2d934957496d230ce2ec7cf88820254c2ccec36f SHA1 (patch-ag) = 5b2b01add1149f50528ba3ced0c89aa9c35ee3a8
SHA1 (patch-ah) = eb5ff0fed972644f9c8599ec5eb6a3cd3ce160cb SHA1 (patch-ah) = eb5ff0fed972644f9c8599ec5eb6a3cd3ce160cb
SHA1 (patch-ai) = 06bd00790d1a84ee31114de4205bba22b48cd547 SHA1 (patch-ai) = 06bd00790d1a84ee31114de4205bba22b48cd547
SHA1 (patch-aj) = f5cdf8e917f787d7e9fc657ed7197a2c28460375 SHA1 (patch-aj) = f5cdf8e917f787d7e9fc657ed7197a2c28460375
Expand Down
44 changes: 17 additions & 27 deletions emulators/snes9x/patches/patch-ag
@@ -1,7 +1,7 @@
$NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $ $NetBSD: patch-ag,v 1.11 2009/03/13 13:33:34 hasso Exp $


--- unix/unix.cpp.orig 2004-12-30 23:15:47.000000000 +0100 --- unix/unix.cpp.orig 2004-12-31 00:15:47 +0200
+++ unix/unix.cpp 2006-10-18 14:03:16.729013960 +0200 +++ unix/unix.cpp 2009-03-13 15:14:04 +0200
@@ -117,15 +117,25 @@ @@ -117,15 +117,25 @@


#ifdef USE_THREADS #ifdef USE_THREADS
Expand Down Expand Up @@ -39,16 +39,12 @@ $NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $


#include "snes9x.h" #include "snes9x.h"
#include "memmap.h" #include "memmap.h"
@@ -168,6 +181,62 @@ uint32 joypads [5] = {0}; @@ -168,6 +181,58 @@ uint32 joypads [5] = {0};
int NumControllers = 5; int NumControllers = 5;


#ifdef JOYSTICK_SUPPORT #ifdef JOYSTICK_SUPPORT
+#if defined(__NetBSD__) || defined(__DragonFly__) +#if defined(__NetBSD__) || defined(__DragonFly__)
+#if defined(__DragonFly__) +#if defined(HAVE_USBHID_H)
+extern "C" {
+#include <libusbhid.h>
+}
+#elif defined(HAVE_USBHID_H)
+START_EXTERN_C +START_EXTERN_C
+#include <usbhid.h> +#include <usbhid.h>
+END_EXTERN_C +END_EXTERN_C
Expand Down Expand Up @@ -102,7 +98,7 @@ $NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $
#if defined(__linux) #if defined(__linux)
#include <linux/joystick.h> #include <linux/joystick.h>
int js_fd [4] = {-1, -1, -1, -1}; int js_fd [4] = {-1, -1, -1, -1};
@@ -227,7 +296,7 @@ char *snapshot_filename = NULL; @@ -227,7 +292,7 @@ char *snapshot_filename = NULL;
char *SDD1_pack = NULL; char *SDD1_pack = NULL;


//FIXME: I see no reason not to configureenable this for all Unixen //FIXME: I see no reason not to configureenable this for all Unixen
Expand All @@ -111,7 +107,7 @@ $NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $
static void sigbrkhandler(int) static void sigbrkhandler(int)
{ {
CPU.Flags |= DEBUG_MODE_FLAG; CPU.Flags |= DEBUG_MODE_FLAG;
@@ -700,6 +769,110 @@ void S9xInitInputDevices () @@ -700,6 +765,104 @@ void S9xInitInputDevices ()
#ifdef JOYSTICK_SUPPORT #ifdef JOYSTICK_SUPPORT
void InitJoysticks () void InitJoysticks ()
{ {
Expand Down Expand Up @@ -142,11 +138,7 @@ $NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $
+ close (js_fd [i]); + close (js_fd [i]);
+ } + }
+ +
+#if defined(__DragonFly__)
+ size = hid_report_size(rd, report_id, hid_input);
+#else
+ size = hid_report_size(rd, hid_input, report_id); + size = hid_report_size(rd, hid_input, report_id);
+#endif
+ priv_joy_data[i].offset = 0; + priv_joy_data[i].offset = 0;
+#else +#else
+ size = hid_report_size(rd, hid_input, &report_id); + size = hid_report_size(rd, hid_input, &report_id);
Expand All @@ -160,10 +152,8 @@ $NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $
+ priv_joy_data[i].dlen = size; + priv_joy_data[i].dlen = size;
+ +
+ is_joystick = 0; + is_joystick = 0;
+#if defined(HAVE_USBHID_H) && !defined(__DragonFly__) +#if defined(HAVE_USBHID_H)
+ for (d = hid_start_parse(rd, 1 << hid_input, report_id); hid_get_item(d, &h); ) + for (d = hid_start_parse(rd, 1 << hid_input, report_id); hid_get_item(d, &h); )
+#else
+ for (d = hid_start_parse(rd, 1 << hid_input); hid_get_item(d, &h); )
+#endif +#endif
+ { + {
+ int axes = 0, buttons = 0, usage, page, interesting_hid; + int axes = 0, buttons = 0, usage, page, interesting_hid;
Expand Down Expand Up @@ -222,7 +212,7 @@ $NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $
#ifdef JSIOCGVERSION #ifdef JSIOCGVERSION
int version; int version;
unsigned char axes, buttons; unsigned char axes, buttons;
@@ -756,6 +929,77 @@ void InitJoysticks () @@ -756,6 +919,77 @@ void InitJoysticks ()


void ReadJoysticks () void ReadJoysticks ()
{ {
Expand Down Expand Up @@ -300,7 +290,7 @@ $NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $
#ifdef JSIOCGVERSION #ifdef JSIOCGVERSION
struct js_event js_ev; struct js_event js_ev;
int i; int i;
@@ -1129,11 +1373,11 @@ void _splitpath (const char *path, char @@ -1129,11 +1363,11 @@ void _splitpath (const char *path, char
{ {
*drive = 0; *drive = 0;


Expand All @@ -314,7 +304,7 @@ $NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $


if (dot && slash && dot < slash) if (dot && slash && dot < slash)
dot = NULL; dot = NULL;
@@ -1646,7 +1890,7 @@ bool8 S9xOpenSoundDevice (int mode, bool @@ -1646,7 +1880,7 @@ bool8 S9xOpenSoundDevice (int mode, bool
} }
#endif #endif


Expand All @@ -323,7 +313,7 @@ $NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $
static int Rates[8] = static int Rates[8] =
{ {
0, 8000, 11025, 16000, 22050, 32000, 44100, 48000 0, 8000, 11025, 16000, 22050, 32000, 44100, 48000
@@ -1662,12 +1906,19 @@ bool8 S9xOpenSoundDevice (int mode, bool @@ -1662,12 +1896,19 @@ bool8 S9xOpenSoundDevice (int mode, bool
/* Linux version (OSS) */ /* Linux version (OSS) */
int J, K; int J, K;


Expand All @@ -344,7 +334,7 @@ $NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $
#ifdef MMAP_SOUND #ifdef MMAP_SOUND
if (ioctl (so.sound_fd, SNDCTL_DSP_GETCAPS, &J) < 0) if (ioctl (so.sound_fd, SNDCTL_DSP_GETCAPS, &J) < 0)
{ {
@@ -1711,14 +1962,14 @@ bool8 S9xOpenSoundDevice (int mode, bool @@ -1711,14 +1952,14 @@ bool8 S9xOpenSoundDevice (int mode, bool
so.sixteen_bit = TRUE; so.sixteen_bit = TRUE;


so.stereo = stereo; so.stereo = stereo;
Expand All @@ -361,7 +351,7 @@ $NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $
{ {
perror ("ioctl SNDCTL_DSP_SPEED"); perror ("ioctl SNDCTL_DSP_SPEED");
return (FALSE); return (FALSE);
@@ -1743,7 +1994,7 @@ bool8 S9xOpenSoundDevice (int mode, bool @@ -1743,7 +1984,7 @@ bool8 S9xOpenSoundDevice (int mode, bool
perror ("ioctl SNDCTL_DSP_SETFRAGMENT"); perror ("ioctl SNDCTL_DSP_SETFRAGMENT");
return (FALSE); return (FALSE);
} }
Expand All @@ -370,7 +360,7 @@ $NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $


#ifdef MMAP_SOUND #ifdef MMAP_SOUND
J = PCM_ENABLE_OUTPUT; J = PCM_ENABLE_OUTPUT;
@@ -1768,7 +2019,7 @@ bool8 S9xOpenSoundDevice (int mode, bool @@ -1768,7 +2009,7 @@ bool8 S9xOpenSoundDevice (int mode, bool
#endif #endif




Expand All @@ -379,7 +369,7 @@ $NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $
void S9xUnixProcessSound (void) void S9xUnixProcessSound (void)
{ {
} }
@@ -1810,7 +2061,7 @@ void *S9xProcessSound (void *) @@ -1810,7 +2051,7 @@ void *S9xProcessSound (void *)
} }
#endif #endif


Expand All @@ -388,7 +378,7 @@ $NetBSD: patch-ag,v 1.10 2006/10/18 13:11:59 rillig Exp $
void S9xGenerateSound () void S9xGenerateSound ()
{ {
/* Linux and Sun versions */ /* Linux and Sun versions */
@@ -1902,7 +2153,7 @@ void *S9xProcessSound (void *) @@ -1902,7 +2143,7 @@ void *S9xProcessSound (void *)
/* If threads in use, this is to loop indefinitely */ /* If threads in use, this is to loop indefinitely */
/* If not, this will be called by timer */ /* If not, this will be called by timer */


Expand Down

0 comments on commit eb029fc

Please sign in to comment.