From 20b2ef033f82672732590d8d7b5936492d091e3c Mon Sep 17 00:00:00 2001 From: Brian Feldman Date: Tue, 13 May 2003 17:10:53 +0000 Subject: Correct USB joystick support for 4.x (used the wrong version of the hid_report_size(3) API). Submitted by: Sean Welch --- emulators/snes9x/files/patch-af | 52 +++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 28 deletions(-) (limited to 'emulators') diff --git a/emulators/snes9x/files/patch-af b/emulators/snes9x/files/patch-af index 1520ee82431a..881ab83aa813 100644 --- a/emulators/snes9x/files/patch-af +++ b/emulators/snes9x/files/patch-af @@ -1,5 +1,5 @@ --- unix/unix.cpp.orig Wed Feb 28 16:12:23 2001 -+++ unix/unix.cpp Wed May 7 16:18:26 2003 ++++ unix/unix.cpp Tue May 13 13:07:48 2003 @@ -51,9 +51,11 @@ #include @@ -179,23 +179,9 @@ - if ((t = atoi (argv [++i])) < 15) js_map_button [1][t] = SNES_START_MASK; - if ((t = atoi (argv [++i])) < 15) js_map_button [1][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], "-joymap3") == 0) - { - if (i + 8 < argc) @@ -211,9 +197,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) @@ -272,7 +272,7 @@ void InitJoysticks () { #ifdef JSIOCGVERSION -@@ -730,6 +759,193 @@ +@@ -730,6 +759,189 @@ } #endif } @@ -304,15 +304,11 @@ + return (-1); + } + report_id = 0; -+#if __FreeBSD__ >= 5 -+#if __FreeBSD_version < 500111 ++#if __FreeBSD__ >= 5 && __FreeBSD_version < 500111 + reportlen = hid_report_size(rd, report_id, hid_input); +#else + reportlen = hid_report_size(rd, hid_input, report_id); +#endif -+#else -+ reportlen = hid_report_size(rd, hid_input, &report_id); -+#endif + my_info->buf = (char *)malloc(reportlen); + if (my_info->buf == NULL) + err(1, "malloc"); @@ -466,7 +462,7 @@ #endif // defined (JOYSTICK_SUPPORT) const char *GetHomeDirectory () -@@ -1422,7 +1638,7 @@ +@@ -1422,7 +1634,7 @@ } #endif @@ -475,7 +471,7 @@ static int Rates[8] = { 0, 8192, 11025, 16500, 22050, 29300, 36600, 44000 -@@ -1541,7 +1757,7 @@ +@@ -1541,7 +1753,7 @@ } #endif @@ -484,7 +480,7 @@ void S9xUnixProcessSound (void) { } -@@ -1640,7 +1856,7 @@ +@@ -1640,7 +1852,7 @@ void *S9xProcessSound (void *) { -- cgit v1.2.3