various improvements:

- enable fullscreen support
- enable PNG screenshots
- only use esound if USE_ESOUND is yes
- add USB joystick support (okayed by kristerw)

PKGREVISION++
This commit is contained in:
dillo 2004-07-26 17:22:40 +00:00
parent 65b752ebee
commit 63c263d501
12 changed files with 930 additions and 3 deletions

View file

@ -1,8 +1,8 @@
# $NetBSD: Makefile,v 1.45 2004/07/16 22:59:11 kristerw Exp $
# $NetBSD: Makefile,v 1.46 2004/07/26 17:22:40 dillo Exp $
#
DISTNAME= vice-1.14
PKGREVISION= 1
PKGREVISION= 2
CATEGORIES= emulators
MASTER_SITES= ftp://ftp.funet.fi/pub/cbm/crossplatform/emulators/VICE/ \
http://www.nic.funet.fi/pub/cbm/crossplatform/emulators/VICE/
@ -27,10 +27,12 @@ USE_X11= YES
USE_GNU_TOOLS+= make
GNU_CONFIGURE= YES
USE_GCC_SHLIB= YES
CONFIGURE_ARGS+= --enable-fullscreen
INFO_FILES= vice.info
BUILD_DEFS+= VICE_USE_FFMPEG
BUILD_DEFS+= USE_ESOUND
.include "../../mk/bsd.prefs.mk"
@ -53,10 +55,13 @@ post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/html/vice
${MV} ${PREFIX}/share/doc/vice/*.html ${PREFIX}/share/doc/html/vice
.if !empty(USE_ESOUND:M[Yy][Ee][Ss])
.include "../../audio/esound/buildlink3.mk"
.endif
.include "../../devel/readline/buildlink3.mk"
.include "../../devel/gettext-lib/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../graphics/png/buildlink3.mk"
.include "../../graphics/xpm/buildlink3.mk"
.if !empty(VICE_USE_FFMPEG:M[Yy][Ee][Ss])
.include "../../multimedia/ffmpeg/buildlink3.mk"

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.13 2004/07/16 22:59:11 kristerw Exp $
$NetBSD: distinfo,v 1.14 2004/07/26 17:22:40 dillo Exp $
SHA1 (vice-1.14.tar.gz) = 5f2c458533db0b41dd55732e9d9434275904ab29
Size (vice-1.14.tar.gz) = 3794698 bytes
@ -6,3 +6,13 @@ SHA1 (patch-aa) = fa152c1d14aad31c0b50fe96c83b4e5cfa06de5f
SHA1 (patch-ab) = 0be2ec8b98a50e5c879095b1d0327c802b7740e2
SHA1 (patch-ac) = bb648b8dc668a12540eab9f1be6374aab8cda35a
SHA1 (patch-ae) = c2ede31953ebaf033c9ae1aa1985012fb0e5f3b6
SHA1 (patch-ba) = 8f94dd31ef10ae2acc82ed721d71cc9eb7ff13d8
SHA1 (patch-bb) = 15b84e9f7d20b8518ab77b8ae0765227a1ad7a5d
SHA1 (patch-bc) = d34ddf4723b45a844fb6ab96b2924e117934f8f9
SHA1 (patch-bd) = b2f4dca0a259cdb3ffed5ea86c955f47508cdeff
SHA1 (patch-be) = ec8308214c51a50aa948cf064865cd8cd03ee7e3
SHA1 (patch-bf) = e19994029b10c2403b53a575bbfb7523c2966ed2
SHA1 (patch-bg) = 3a396e3cbeddd2c99beebd26bca30e233e89e009
SHA1 (patch-bh) = 97396118e6abecd9dd464cdae7b918ea025f5f0f
SHA1 (patch-bi) = 4d94fff17db834031df3b39148dcefac6f7bf968
SHA1 (patch-bj) = b279df0c6d0700f42fe6cbd1811170171152bf49

View file

@ -0,0 +1,30 @@
$NetBSD: patch-ba,v 1.1 2004/07/26 17:22:40 dillo Exp $
--- configure.in.orig Sun Jan 25 16:42:36 2004
+++ configure.in
@@ -531,8 +531,24 @@ if test x"$host_vendor" != "xgo32" -a x"
AC_DEFINE(BSD_JOYSTICK,,
[Enable support for BSD style joysticks.])
JOY_OBJS='$(ARCHDIR)/joystick.o' ], )
- AC_SUBST(JOY_OBJS)
+ dnl NetBSD/FreeBSD USB joystick support
+ usbhid_header=no
+ AC_CHECK_LIB(usbhid, hid_get_report_desc,
+ [AC_CHECK_HEADER(usbhid.h,
+ [AC_DEFINE(HAVE_USBHID_H,1,
+ [Define to 1 if you have the <usbhid.h> header file.])
+ usb_header=yes],
+ [AC_CHECK_HEADER(libusbhid.h,
+ [AC_DEFINE(HAVE_LIBUSBHID_H,1,
+ [Define to 1 if you have the <libusbhid.h> header file.])],
+ usbhid_header=no)])
+ if test x"$usb_header" = "xyes" ; then
+ AC_DEFINE(HAS_USB_JOYSTICK,,[Enable emulation for USB joysticks.])
+ LIBS="$LIBS -lusbhid"
+ fi])
+
+ AC_SUBST(JOY_OBJS)
fi
dnl Check for math library

View file

@ -0,0 +1,12 @@
$NetBSD: patch-bb,v 1.1 2004/07/26 17:22:40 dillo Exp $
--- src/arch/unix/Makefile.am.orig Sun Nov 23 16:09:36 2003
+++ src/arch/unix/Makefile.am
@@ -36,6 +36,7 @@ libarch_a_SOURCES = \
icon.h \
joy.c \
joy.h \
+ joy_usb.c \
kbd.h \
mousedrv.c \
mousedrv.h \

View file

@ -0,0 +1,34 @@
$NetBSD: patch-bc,v 1.1 2004/07/26 17:22:40 dillo Exp $
--- src/config.h.in.orig Fri May 14 11:30:37 2004
+++ src/config.h.in
@@ -30,6 +30,9 @@
/* Do we have UnlockResource()? */
#undef HAS_UNLOCKRESOURCE
+/* Enable emulation for USB joysticks. */
+#undef HAS_USB_JOYSTICK
+
/* Define to 1 if you have the <allegro.h> header file. */
#undef HAVE_ALLEGRO_H
@@ -134,6 +137,9 @@
/* Define to 1 if you have the `UMSobj' library (-lUMSobj). */
#undef HAVE_LIBUMSOBJ
+/* Define to 1 if you have the <libusbhid.h> header file. */
+#undef HAVE_LIBUSBHID_H
+
/* Is libXpm available? */
#undef HAVE_LIBXPM
@@ -256,6 +262,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define to 1 if you have the <usbhid.h> header file. */
+#undef HAVE_USBHID_H
+
/* Define to 1 if you have the `usleep' function. */
#undef HAVE_USLEEP

View file

@ -0,0 +1,384 @@
$NetBSD: patch-bd,v 1.1 2004/07/26 17:22:40 dillo Exp $
--- configure.orig Fri May 14 11:30:32 2004
+++ configure
@@ -9127,6 +9793,379 @@ fi
+ usbhid_header=no
+ echo "$as_me:$LINENO: checking for hid_get_report_desc in -lusbhid" >&5
+echo $ECHO_N "checking for hid_get_report_desc in -lusbhid... $ECHO_C" >&6
+if test "${ac_cv_lib_usbhid_hid_get_report_desc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lusbhid $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char hid_get_report_desc ();
+int
+main ()
+{
+hid_get_report_desc ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_usbhid_hid_get_report_desc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_usbhid_hid_get_report_desc=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_usbhid_hid_get_report_desc" >&5
+echo "${ECHO_T}$ac_cv_lib_usbhid_hid_get_report_desc" >&6
+if test $ac_cv_lib_usbhid_hid_get_report_desc = yes; then
+ if test "${ac_cv_header_usbhid_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for usbhid.h" >&5
+echo $ECHO_N "checking for usbhid.h... $ECHO_C" >&6
+if test "${ac_cv_header_usbhid_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_usbhid_h" >&5
+echo "${ECHO_T}$ac_cv_header_usbhid_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking usbhid.h usability" >&5
+echo $ECHO_N "checking usbhid.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <usbhid.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking usbhid.h presence" >&5
+echo $ECHO_N "checking usbhid.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <usbhid.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: usbhid.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: usbhid.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: usbhid.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: usbhid.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: usbhid.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: usbhid.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: usbhid.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: usbhid.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: usbhid.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: usbhid.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: usbhid.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: usbhid.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: usbhid.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: usbhid.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: usbhid.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: usbhid.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for usbhid.h" >&5
+echo $ECHO_N "checking for usbhid.h... $ECHO_C" >&6
+if test "${ac_cv_header_usbhid_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_usbhid_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_usbhid_h" >&5
+echo "${ECHO_T}$ac_cv_header_usbhid_h" >&6
+
+fi
+if test $ac_cv_header_usbhid_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_USBHID_H 1
+_ACEOF
+
+ usb_header=yes
+else
+ if test "${ac_cv_header_libusbhid_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for libusbhid.h" >&5
+echo $ECHO_N "checking for libusbhid.h... $ECHO_C" >&6
+if test "${ac_cv_header_libusbhid_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_libusbhid_h" >&5
+echo "${ECHO_T}$ac_cv_header_libusbhid_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking libusbhid.h usability" >&5
+echo $ECHO_N "checking libusbhid.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <libusbhid.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking libusbhid.h presence" >&5
+echo $ECHO_N "checking libusbhid.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <libusbhid.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: libusbhid.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: libusbhid.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: libusbhid.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: libusbhid.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: libusbhid.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: libusbhid.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: libusbhid.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: libusbhid.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: libusbhid.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: libusbhid.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: libusbhid.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: libusbhid.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: libusbhid.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: libusbhid.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: libusbhid.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: libusbhid.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for libusbhid.h" >&5
+echo $ECHO_N "checking for libusbhid.h... $ECHO_C" >&6
+if test "${ac_cv_header_libusbhid_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_libusbhid_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_libusbhid_h" >&5
+echo "${ECHO_T}$ac_cv_header_libusbhid_h" >&6
+
+fi
+if test $ac_cv_header_libusbhid_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBUSBHID_H 1
+_ACEOF
+
+else
+ usbhid_header=no
+fi
+
+
+fi
+
+
+ if test x"$usb_header" = "xyes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAS_USB_JOYSTICK
+_ACEOF
+
+ LIBS="$LIBS -lusbhid"
+ fi
+fi
+
+
fi

View file

@ -0,0 +1,19 @@
$NetBSD: patch-be,v 1.1 2004/07/26 17:22:40 dillo Exp $
--- src/arch/unix/vic20ui.c.orig Sat Nov 29 22:32:19 2003
+++ src/arch/unix/vic20ui.c
@@ -309,6 +309,14 @@ static ui_menu_entry_t set_joystick_devi
(ui_callback_t)set_joystick_device,
(ui_callback_data_t)JOYDEV_DIGITAL_1, NULL },
#endif
+#ifdef HAS_USB_JOYSTICK
+ { N_("*USB Joystick 0"),
+ (ui_callback_t)set_joystick_device,
+ (ui_callback_data_t)JOYDEV_USB_0, NULL },
+ { N_("*USB Joystick 1"),
+ (ui_callback_t)set_joystick_device,
+ (ui_callback_data_t)JOYDEV_USB_1, NULL },
+#endif
#endif
{ NULL }
};

View file

@ -0,0 +1,13 @@
$NetBSD: patch-bf,v 1.1 2004/07/26 17:22:40 dillo Exp $
--- src/arch/unix/joy.h.orig Sat May 25 19:22:33 2002
+++ src/arch/unix/joy.h
@@ -55,6 +55,8 @@ extern int joystick_port_map[2];
#define JOYDEV_ANALOG_1 4
#define JOYDEV_DIGITAL_0 5
#define JOYDEV_DIGITAL_1 6
+#define JOYDEV_USB_0 7
+#define JOYDEV_USB_1 8
#endif

View file

@ -0,0 +1,34 @@
$NetBSD: patch-bg,v 1.1 2004/07/26 17:22:40 dillo Exp $
--- src/arch/unix/uijoystick2.c.orig Sun May 25 19:39:59 2003
+++ src/arch/unix/uijoystick2.c
@@ -99,6 +99,14 @@ static ui_menu_entry_t set_joystick_devi
(ui_callback_t)set_joystick_device_1,
(ui_callback_data_t)JOYDEV_DIGITAL_1, NULL },
#endif
+#ifdef HAS_USB_JOYSTICK
+ { N_("*USB Joystick 0"),
+ (ui_callback_t)set_joystick_device_1,
+ (ui_callback_data_t)JOYDEV_USB_0, NULL },
+ { N_("*USB Joystick 1"),
+ (ui_callback_t)set_joystick_device_1,
+ (ui_callback_data_t)JOYDEV_USB_1, NULL },
+#endif
#endif
{ NULL }
};
@@ -127,6 +135,14 @@ static ui_menu_entry_t set_joystick_devi
{ N_("*Digital Joystick 1"),
(ui_callback_t)set_joystick_device_2,
(ui_callback_data_t)JOYDEV_DIGITAL_1, NULL },
+#endif
+#ifdef HAS_USB_JOYSTICK
+ { N_("*USB Joystick 0"),
+ (ui_callback_t)set_joystick_device_2,
+ (ui_callback_data_t)JOYDEV_USB_0, NULL },
+ { N_("*USB Joystick 1"),
+ (ui_callback_t)set_joystick_device_2,
+ (ui_callback_data_t)JOYDEV_USB_1, NULL },
#endif
#endif /* HAS_JOYSTICK */
{ NULL }

View file

@ -0,0 +1,21 @@
$NetBSD: patch-bh,v 1.1 2004/07/26 17:22:40 dillo Exp $
--- src/arch/unix/Makefile.in.orig Fri May 14 15:24:41 2004
+++ src/arch/unix/Makefile.in
@@ -253,6 +253,7 @@ libarch_a_SOURCES = \
icon.h \
joy.c \
joy.h \
+ joy_usb.c \
kbd.h \
mousedrv.c \
mousedrv.h \
@@ -349,7 +349,7 @@ libarch_a_LIBADD =
am_libarch_a_OBJECTS = archdep.$(OBJEXT) blockdev.$(OBJEXT) \
c128ui.$(OBJEXT) c64ui.$(OBJEXT) catweaselmkiii.$(OBJEXT) \
cbm2ui.$(OBJEXT) console.$(OBJEXT) coproc.$(OBJEXT) \
- ffmpeglib.$(OBJEXT) joy.$(OBJEXT) mousedrv.$(OBJEXT) \
+ ffmpeglib.$(OBJEXT) joy.$(OBJEXT) joy_usb.$(OBJEXT) mousedrv.$(OBJEXT) \
petui.$(OBJEXT) plus4ui.$(OBJEXT) rs232.$(OBJEXT) ui.$(OBJEXT) \
uic64cart.$(OBJEXT) uicmdline.$(OBJEXT) uicommands.$(OBJEXT) \
uicrtc.$(OBJEXT) uidatasette.$(OBJEXT) uidrive.$(OBJEXT) \

View file

@ -0,0 +1,310 @@
$NetBSD: patch-bi,v 1.1 2004/07/26 17:22:40 dillo Exp $
--- src/arch/unix/joy_usb.c.orig 2004-07-26 14:35:45.000000000 +0200
+++ src/arch/unix/joy_usb.c
@@ -0,0 +1,305 @@
+/*
+ * joy_usb.c - NetBSD/FreeBSD USB joystick support.
+ *
+ * Written by
+ * Dieter Baron <dillo@nih.at>
+ *
+ * This file is part of VICE, the Versatile Commodore Emulator.
+ * See README for copyright notice.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA.
+ *
+ */
+
+#include "vice.h"
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "cmdline.h"
+#include "joy.h"
+#include "joystick.h"
+#include "keyboard.h"
+#include "log.h"
+#include "resources.h"
+#include "types.h"
+
+#if defined(HAS_JOYSTICK) && defined(HAS_USB_JOYSTICK)
+
+#define ITEM_AXIS 0
+#define ITEM_BUTTON 1
+#define ITEM_HAT 2
+
+int hat_or[] = {
+ 1, 9, 8, 10, 2, 6, 4, 5,
+};
+
+extern log_t joystick_log;
+
+#include <dev/usb/usb.h>
+#include <dev/usb/usbhid.h>
+#include <errno.h>
+#include <stdlib.h>
+#ifdef HAVE_USBHID_H
+#include <usbhid.h>
+#else
+#include <libusbhid.h>
+#endif
+
+#define MAX_DEV 4 /* number of uhid devices to try */
+
+struct usb_joy_item {
+ struct hid_item item;
+ struct usb_joy_item *next;
+
+ int is_hat;
+ int min_or;
+ int min_val;
+ int max_or;
+ int max_val;
+};
+
+static struct usb_joy_item *usb_joy_item[2];
+
+static int usb_joy_fd[2] = { -1, -1 };
+static int usb_joy_size[2];
+static char *usb_joy_buf[2];
+
+static int usb_joy_add_item(struct usb_joy_item **item, struct hid_item *hi,
+ int orval, int type)
+{
+ struct usb_joy_item *it;
+ int w;
+
+ if ((it=malloc(sizeof(*it))) == NULL) {
+ /* XXX */
+ return -1;
+ }
+
+ it->next = *item;
+ *item = it;
+
+ memcpy(&it->item, hi, sizeof(*hi));
+ switch (type) {
+ case ITEM_AXIS:
+ w = (hi->logical_maximum-hi->logical_minimum)/3;
+ it->is_hat = 0;
+ it->min_or = orval;
+ it->min_val = hi->logical_minimum+w;
+ it->max_or = orval*2;
+ it->max_val = hi->logical_maximum-w;
+ break;
+
+ case ITEM_BUTTON:
+ it->is_hat = 0;
+ it->min_or = 0;
+ it->min_val = -1;
+ it->max_or = orval;
+ it->max_val = hi->logical_maximum-1;
+ break;
+
+ case ITEM_HAT:
+ it->is_hat = 1;
+ it->min_val = hi->logical_minimum;
+ break;
+ }
+
+ return 0;
+}
+
+static void usb_free_item(struct usb_joy_item **item)
+{
+ struct usb_joy_item *it, *it2;
+
+ it=*item;
+ while (it) {
+ it2 = it;
+ it = it->next;
+ free(it2);
+ }
+ *item = NULL;
+}
+
+int usb_joystick_init(void)
+{
+ int i, j, id, fd;
+ report_desc_t report;
+ struct hid_item h;
+ struct hid_data *d;
+ int is_joy, found;
+ char dev[32];
+
+ for (j=i=0; i<2 && j<MAX_DEV; j++) {
+ sprintf(dev, "/dev/uhid%d", j);
+ fd = open(dev, O_RDONLY|O_NONBLOCK);
+ if (fd < 0)
+ continue;
+
+ if (ioctl(fd, USB_GET_REPORT_ID, &id) < 0) {
+ log_warning(joystick_log,
+ _("Cannot get report id for joystick device `%s'."),
+ dev);
+ close(fd);
+ }
+
+ if ((report=hid_get_report_desc(fd)) == NULL) {
+ log_warning(joystick_log,
+ _("Cannot report description for joystick device `%s'."),
+ dev);
+ close(fd);
+ continue;
+ }
+ usb_joy_size[i] = hid_report_size(report, hid_input, id);
+
+ usb_joy_item[i] = NULL;
+
+ found = 0;
+ is_joy = 0;
+ for (d=hid_start_parse(report, 1<<hid_input, id);
+ hid_get_item(d, &h);) {
+ if (h.kind == hid_collection
+ && HID_PAGE(h.usage) == HUP_GENERIC_DESKTOP
+ && (HID_USAGE(h.usage) == HUG_JOYSTICK
+ || HID_USAGE(h.usage) == HUG_GAME_PAD)) {
+ is_joy = 1;
+ continue;
+ }
+ if (!is_joy)
+ continue;
+
+ switch (HID_PAGE(h.usage)) {
+ case HUP_GENERIC_DESKTOP:
+ switch (HID_USAGE(h.usage)) {
+ case HUG_X:
+ case HUG_RX:
+ if (usb_joy_add_item(usb_joy_item+i, &h,
+ 4, ITEM_AXIS) == 0)
+ found |= 4;
+ break;
+
+ case HUG_Y:
+ case HUG_RY:
+ if (usb_joy_add_item(usb_joy_item+i, &h,
+ 1, ITEM_AXIS) == 0)
+ found |= 1;
+ break;
+ case HUG_HAT_SWITCH:
+ if (usb_joy_add_item(usb_joy_item+i, &h,
+ 0, ITEM_HAT) == 0)
+ found |= 5;
+ break;
+ }
+ break;
+
+ case HUP_BUTTON:
+ if (usb_joy_add_item(usb_joy_item+i, &h,
+ 16, ITEM_BUTTON) == 0)
+ found |= 16;
+ break;
+ }
+ }
+ hid_end_parse(d);
+
+ if (found != 21) {
+ close(fd);
+ usb_free_item(usb_joy_item+i);
+ log_message(joystick_log,
+ _("Not all axes found in joystick device `%s'."), dev);
+ continue;
+ }
+
+ if ((usb_joy_buf[i]=malloc(usb_joy_size[i])) == NULL) {
+ log_warning(joystick_log,
+ _("Cannot allocate buffer for joystick device `%s'."),
+ dev);
+ close(fd);
+ usb_free_item(usb_joy_item+i);
+ continue;
+ }
+
+ log_message(joystick_log,
+ _("USB joystick found: `%s'."), dev);
+ usb_joy_fd[i] = fd;
+ i++;
+ }
+}
+
+void usb_joystick_close(void)
+{
+ int i;
+
+ for (i=0; i<2; i++) {
+ if (usb_joy_fd[i] < 0)
+ continue;
+
+ close(usb_joy_fd[i]);
+ usb_joy_fd[i] = -1;
+ usb_free_item(usb_joy_item+i);
+ }
+}
+
+void usb_joystick(void)
+{
+ int i, jp, val, ret;
+ struct usb_joy_item *it;
+
+ for (i=0; i<2; i++) {
+ jp = joystick_port_map[i];
+ if (jp != JOYDEV_USB_0 && jp != JOYDEV_USB_1)
+ continue;
+
+ jp -= JOYDEV_USB_0;
+
+ if (usb_joy_fd[jp] < 0)
+ continue;
+
+ val = 0;
+ while ((ret=read(usb_joy_fd[jp], usb_joy_buf[jp], usb_joy_size[jp]))
+ == usb_joy_size[jp])
+ val = 1;
+ if (ret != -1 && errno != EAGAIN) {
+ /* XXX */
+ printf("strange read return: %d/%d\n",
+ ret, errno);
+ continue;
+ }
+ if (!val)
+ continue;
+
+ joystick_set_value_absolute(i+1, 0);
+
+ for (it=usb_joy_item[jp]; it; it=it->next) {
+ val = hid_get_data(usb_joy_buf[jp], &it->item);
+ if (it->is_hat) {
+ val -= it->min_val;
+ if (val >= 0 && val <= 7)
+ joystick_set_value_or(i+1, hat_or[val]);
+ }
+ else {
+ if (val <= it->min_val) {
+ joystick_set_value_or(i+1, it->min_or);
+ }
+ else if (val > it->max_val) {
+ joystick_set_value_or(i+1, it->max_or);
+ }
+ }
+ }
+ }
+}
+
+#endif /* HAS_JOYSTICK && HAS_USB_JOYSTICK */
+

View file

@ -0,0 +1,55 @@
$NetBSD: patch-bj,v 1.1 2004/07/26 17:22:40 dillo Exp $
--- src/arch/unix/joy.c.orig Sun Dec 28 19:08:37 2003
+++ src/arch/unix/joy.c
@@ -80,9 +80,9 @@ static const resource_t resources[] = {
static const cmdline_option_t cmdline_options[] = {
{ "-joydev1", SET_RESOURCE, 1, NULL, NULL, "JoyDevice1", NULL,
- "<0-6>", N_("Set device for joystick port 1") },
+ "<0-8>", N_("Set device for joystick port 1") },
{ "-joydev2", SET_RESOURCE, 1, NULL, NULL, "JoyDevice2", NULL,
- "<0-6>", N_("Set device for joystick port 2") },
+ "<0-8>", N_("Set device for joystick port 2") },
{ NULL },
};
@@ -135,7 +135,7 @@ static int joyxmax[2];
static int joyymin[2];
static int joyymax[2];
-static log_t joystick_log = LOG_ERR;
+log_t joystick_log = LOG_ERR;
/* ------------------------------------------------------------------------- */
@@ -148,6 +148,9 @@ int joy_arch_init(void)
old_joystick_init();
else
new_joystick_init();
+#ifdef HAS_USB_JOYSTICK
+ usb_joystick_init();
+#endif
return 0;
}
@@ -157,6 +160,9 @@ void joystick_close(void)
old_joystick_close();
else
new_joystick_close();
+#ifdef HAS_USB_JOYSTICK
+ usb_joystick_close();
+#endif
}
void joystick(void)
@@ -165,6 +171,9 @@ void joystick(void)
old_joystick();
else
new_joystick();
+#ifdef HAS_USB_JOYSTICK
+ usb_joystick();
+#endif
}
/**********************************************************