Date: Fri, 14 Jun 2002 02:28:36 +0200 (CEST) From: Stefan Krüger <space7@web.de> To: green@freebsd.org Cc: ports@freebsd.org Subject: patch for emulators/snes9x Message-ID: <200206140028.g5E0SaV4019338@dsl-217-9-35-9.berlikomm.net>
next in thread | raw e-mail | index | archive | help
Hi green, hi ports folks, the emulators/snes9x port is broken on 4.6-RELEASE and up, the following patch fixes this, but it's not backward compatible (due to the rename of libusb -> libusbhid) enjoy Stefan Krüger diff -urN snes9x.orig/Makefile snes9x/Makefile --- snes9x.orig/Makefile Fri Jun 14 02:14:30 2002 +++ snes9x/Makefile Fri Jun 14 02:15:41 2002 @@ -27,7 +27,7 @@ USE_ZIP= YES WRKSRC= ${WRKDIR}/release -.if exists(/usr/lib/libusb.a) +.if exists(/usr/lib/libusbhid.a) MAKE_ENV+= USB_JOYSTICK_SUPPORT=yes .endif diff -urN snes9x.orig/files/patch-aa snes9x/files/patch-aa --- snes9x.orig/files/patch-aa Fri Jun 14 02:14:30 2002 +++ snes9x/files/patch-aa Fri Jun 14 02:15:41 2002 @@ -51,7 +51,7 @@ +ifdef USB_JOYSTICK_SUPPORT +CCFLAGS += -DJOYSTICK_SUPPORT -+EXTRALIBS += -lusb ++EXTRALIBS += -lusbhid +endif + #-DSOUND diff -urN snes9x.orig/files/patch-af snes9x/files/patch-af --- snes9x.orig/files/patch-af Fri Jun 14 02:14:30 2002 +++ snes9x/files/patch-af Fri Jun 14 02:17:17 2002 @@ -1,8 +1,12 @@ ---- unix/unix.cpp.orig Wed Jan 10 15:40:14 2001 -+++ unix/unix.cpp Tue Feb 6 01:14:53 2001 -@@ -51,9 +51,11 @@ +--- unix/unix.cpp.orig Wed Feb 28 22:12:23 2001 ++++ unix/unix.cpp Fri Jun 14 02:09:27 2002 +@@ -50,10 +50,15 @@ + #include <sys/types.h> #include <ctype.h> ++#if defined(__FreeBSD__) ++#include <osreldate.h> ++#endif -#if defined(__linux) || defined(__sun) +#if defined(__linux) || defined(__sun) || defined(__FreeBSD__) @@ -13,7 +17,7 @@ #include <unistd.h> #include <sys/types.h> #include <sys/ioctl.h> -@@ -68,8 +70,12 @@ +@@ -68,8 +73,12 @@ pthread_mutex_t mutex; #endif @@ -26,7 +30,7 @@ #include <sys/mman.h> #endif -@@ -85,6 +91,11 @@ +@@ -85,6 +94,11 @@ typedef void (*SIG_PF)(); #endif @@ -38,7 +42,7 @@ #include "snes9x.h" #include "memmap.h" #include "debug.h" -@@ -111,7 +122,10 @@ +@@ -111,7 +125,10 @@ int NumControllers = 5; #ifdef JOYSTICK_SUPPORT @@ -49,7 +53,7 @@ #include <linux/joystick.h> int js_fd [4] = {-1, -1, -1, -1}; int js_map_button [4][16] = { -@@ -158,6 +172,63 @@ +@@ -158,6 +175,63 @@ char *js_device [4] = {"/dev/js0", "/dev/js1", "/dev/js2", "/dev/js3"}; #endif @@ -62,7 +66,7 @@ +#include <dev/usb/usbhid.h> +#undef class + -+#include <libusb.h> ++#include <libusbhid.h> +} + +#define JOYSTICK_MAX_BUTTONS 16 @@ -113,7 +117,7 @@ void InitJoysticks (); void ReadJoysticks (); #endif -@@ -169,7 +240,7 @@ +@@ -168,7 +242,7 @@ char *rom_filename = NULL; char *snapshot_filename = NULL; @@ -122,7 +126,7 @@ static void sigbrkhandler(int) { #ifdef DEBUGGER -@@ -196,91 +267,43 @@ +@@ -195,91 +269,43 @@ if (strcmp (argv [i], "-j") == 0 || strcasecmp (argv [i], "-nojoy") == 0) Settings.JoystickEnabled = FALSE; @@ -155,23 +159,9 @@ - if ((t = atoi (argv [++i])) < 15) js_map_button [0][t] = SNES_START_MASK; - if ((t = atoi (argv [++i])) < 15) js_map_button [0][t] = SNES_SELECT_MASK; - } -+#ifdef __FreeBSD__ -+ else if (strcasecmp(argv[i], "-joyshift") == 0) -+ JoystickShift = 1; -+#endif -+ else if (strncasecmp(argv[i], "-joydev", sizeof("-joydev") - 1) == 0) { -+ char *end, *snum = argv[i] + sizeof("-joydev") - 1; -+ unsigned long num; -+ -+ if (*snum == '\0' || argc < i + 1) -+ S9xUsage(); -+ if ((num = strtoul(snum, &end, 10)) < JOYSTICK_MAX_DEVICES && -+ num > 0 && *end == '\0') -+ js_device[num - 1] = argv[++i]; - else +- else - S9xUsage (); -+ S9xUsage(); - } +- } - else if (strcasecmp (argv [i], "-joymap2") == 0) - { - if (i + 8 < argc) @@ -205,9 +195,23 @@ - if ((t = atoi (argv [++i])) < 15) js_map_button [2][t] = SNES_START_MASK; - if ((t = atoi (argv [++i])) < 15) js_map_button [2][t] = SNES_SELECT_MASK; - } -- else ++#ifdef __FreeBSD__ ++ else if (strcasecmp(argv[i], "-joyshift") == 0) ++ JoystickShift = 1; ++#endif ++ else if (strncasecmp(argv[i], "-joydev", sizeof("-joydev") - 1) == 0) { ++ char *end, *snum = argv[i] + sizeof("-joydev") - 1; ++ unsigned long num; ++ ++ if (*snum == '\0' || argc < i + 1) ++ S9xUsage(); ++ if ((num = strtoul(snum, &end, 10)) < JOYSTICK_MAX_DEVICES && ++ num > 0 && *end == '\0') ++ js_device[num - 1] = argv[++i]; + else - S9xUsage (); -- } ++ S9xUsage(); + } - else if (strcasecmp (argv [i], "-joymap4") == 0) - { - if (i + 8 < argc) @@ -249,7 +253,7 @@ } else #endif -@@ -419,7 +442,7 @@ +@@ -418,7 +444,7 @@ #if !defined(__MSDOS) && defined(DEBUGGER) #if defined(__unix) && !defined(__NeXT__) struct sigaction sa; @@ -258,7 +262,7 @@ sa.sa_handler = sigbrkhandler; #else sa.sa_handler = (SIG_PF) sigbrkhandler; -@@ -611,6 +634,7 @@ +@@ -610,6 +636,7 @@ } #ifdef JOYSTICK_SUPPORT @@ -266,7 +270,7 @@ void InitJoysticks () { #ifdef JSIOCGVERSION -@@ -731,6 +755,184 @@ +@@ -730,6 +757,184 @@ } #endif } @@ -298,7 +302,7 @@ + return (-1); + } + report_id = 0; -+#if __FreeBSD__ >= 5 ++#if __FreeBSD_version >= 460000 + reportlen = hid_report_size(rd, report_id, hid_input); +#else + reportlen = hid_report_size(rd, hid_input, &report_id); @@ -451,7 +455,7 @@ #endif // defined (JOYSTICK_SUPPORT) const char *GetHomeDirectory () -@@ -1423,7 +1625,7 @@ +@@ -1422,7 +1627,7 @@ } #endif @@ -460,7 +464,7 @@ static int Rates[8] = { 0, 8192, 11025, 16500, 22050, 29300, 36600, 44000 -@@ -1542,7 +1744,7 @@ +@@ -1541,7 +1746,7 @@ } #endif @@ -469,7 +473,7 @@ void S9xUnixProcessSound (void) { } -@@ -1641,7 +1843,7 @@ +@@ -1640,7 +1845,7 @@ void *S9xProcessSound (void *) { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206140028.g5E0SaV4019338>