diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/aclocal.m4 /tmp/4ejbOOI7Zw/desmume-0.7.3/aclocal.m4 --- /tmp/bSLAZZZKhC/desmume-0.6.0/aclocal.m4 2007-02-03 16:50:17.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/aclocal.m4 2007-09-03 12:31:37.000000000 -0500 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.9.6 -*- Autoconf -*- +# generated automatically by aclocal 1.10 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005 Free Software Foundation, Inc. +# 2005, 2006 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,6 +11,643 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +m4_if(m4_PACKAGE_VERSION, [2.61],, +[m4_fatal([this file was generated for autoconf 2.61. +You have another version of autoconf. If you want to use that, +you should regenerate the build system entirely.], [63])]) + +# Copyright (C) 1995-2002 Free Software Foundation, Inc. +# Copyright (C) 2001-2003,2004 Red Hat, Inc. +# +# This file is free software, distributed under the terms of the GNU +# General Public License. As a special exception to the GNU General +# Public License, this file may be distributed as part of a program +# that contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995, 1996 +# +# Modified to never use included libintl. +# Owen Taylor , 12/15/1998 +# +# Major rework to remove unused code +# Owen Taylor , 12/11/2002 +# +# Added better handling of ALL_LINGUAS from GNU gettext version +# written by Bruno Haible, Owen Taylor 5/30/3002 +# +# Modified to require ngettext +# Matthias Clasen 08/06/2004 +# +# We need this here as well, since someone might use autoconf-2.5x +# to configure GLib then an older version to configure a package +# using AM_GLIB_GNU_GETTEXT +AC_PREREQ(2.53) + +dnl +dnl We go to great lengths to make sure that aclocal won't +dnl try to pull in the installed version of these macros +dnl when running aclocal in the glib directory. +dnl +m4_copy([AC_DEFUN],[glib_DEFUN]) +m4_copy([AC_REQUIRE],[glib_REQUIRE]) +dnl +dnl At the end, if we're not within glib, we'll define the public +dnl definitions in terms of our private definitions. +dnl + +# GLIB_LC_MESSAGES +#-------------------- +glib_DEFUN([GLIB_LC_MESSAGES], + [AC_CHECK_HEADERS([locale.h]) + if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, + [Define if your file defines LC_MESSAGES.]) + fi + fi]) + +# GLIB_PATH_PROG_WITH_TEST +#---------------------------- +dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +glib_DEFUN([GLIB_PATH_PROG_WITH_TEST], +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + +# GLIB_WITH_NLS +#----------------- +glib_DEFUN([GLIB_WITH_NLS], + dnl NLS is obligatory + [AC_REQUIRE([AC_CANONICAL_HOST])dnl + USE_NLS=yes + AC_SUBST(USE_NLS) + + gt_cv_have_gettext=no + + CATOBJEXT=NONE + XGETTEXT=: + INTLLIBS= + + AC_CHECK_HEADER(libintl.h, + [gt_cv_func_dgettext_libintl="no" + libintl_extra_libs="" + + # + # First check in libc + # + AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc, + [AC_TRY_LINK([ +#include +], + [return !ngettext ("","", 1)], + gt_cv_func_ngettext_libc=yes, + gt_cv_func_ngettext_libc=no) + ]) + + if test "$gt_cv_func_ngettext_libc" = "yes" ; then + AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc, + [AC_TRY_LINK([ +#include +], + [return !dgettext ("","")], + gt_cv_func_dgettext_libc=yes, + gt_cv_func_dgettext_libc=no) + ]) + fi + + if test "$gt_cv_func_ngettext_libc" = "yes" ; then + AC_CHECK_FUNCS(bind_textdomain_codeset) + fi + + # + # If we don't have everything we want, check in libintl + # + if test "$gt_cv_func_dgettext_libc" != "yes" \ + || test "$gt_cv_func_ngettext_libc" != "yes" \ + || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then + + AC_CHECK_LIB(intl, bindtextdomain, + [AC_CHECK_LIB(intl, ngettext, + [AC_CHECK_LIB(intl, dgettext, + gt_cv_func_dgettext_libintl=yes)])]) + + if test "$gt_cv_func_dgettext_libintl" != "yes" ; then + AC_MSG_CHECKING([if -liconv is needed to use gettext]) + AC_MSG_RESULT([]) + AC_CHECK_LIB(intl, ngettext, + [AC_CHECK_LIB(intl, dcgettext, + [gt_cv_func_dgettext_libintl=yes + libintl_extra_libs=-liconv], + :,-liconv)], + :,-liconv) + fi + + # + # If we found libintl, then check in it for bind_textdomain_codeset(); + # we'll prefer libc if neither have bind_textdomain_codeset(), + # and both have dgettext and ngettext + # + if test "$gt_cv_func_dgettext_libintl" = "yes" ; then + glib_save_LIBS="$LIBS" + LIBS="$LIBS -lintl $libintl_extra_libs" + unset ac_cv_func_bind_textdomain_codeset + AC_CHECK_FUNCS(bind_textdomain_codeset) + LIBS="$glib_save_LIBS" + + if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then + gt_cv_func_dgettext_libc=no + else + if test "$gt_cv_func_dgettext_libc" = "yes" \ + && test "$gt_cv_func_ngettext_libc" = "yes"; then + gt_cv_func_dgettext_libintl=no + fi + fi + fi + fi + + if test "$gt_cv_func_dgettext_libc" = "yes" \ + || test "$gt_cv_func_dgettext_libintl" = "yes"; then + gt_cv_have_gettext=yes + fi + + if test "$gt_cv_func_dgettext_libintl" = "yes"; then + INTLLIBS="-lintl $libintl_extra_libs" + fi + + if test "$gt_cv_have_gettext" = "yes"; then + AC_DEFINE(HAVE_GETTEXT,1, + [Define if the GNU gettext() function is already present or preinstalled.]) + GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl + if test "$MSGFMT" != "no"; then + glib_save_LIBS="$LIBS" + LIBS="$LIBS $INTLLIBS" + AC_CHECK_FUNCS(dcgettext) + MSGFMT_OPTS= + AC_MSG_CHECKING([if msgfmt accepts -c]) + GLIB_RUN_PROG([$MSGFMT -c -o /dev/null],[ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: test 1.0\n" +"PO-Revision-Date: 2007-02-15 12:01+0100\n" +"Last-Translator: test \n" +"Language-Team: C \n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" +], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) + AC_SUBST(MSGFMT_OPTS) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr], + [CATOBJEXT=.gmo + DATADIRNAME=share], + [case $host in + *-*-solaris*) + dnl On Solaris, if bind_textdomain_codeset is in libc, + dnl GNU format message catalog is always supported, + dnl since both are added to the libc all together. + dnl Hence, we'd like to go with DATADIRNAME=share and + dnl and CATOBJEXT=.gmo in this case. + AC_CHECK_FUNC(bind_textdomain_codeset, + [CATOBJEXT=.gmo + DATADIRNAME=share], + [CATOBJEXT=.mo + DATADIRNAME=lib]) + ;; + *) + CATOBJEXT=.mo + DATADIRNAME=lib + ;; + esac]) + LIBS="$glib_save_LIBS" + INSTOBJEXT=.mo + else + gt_cv_have_gettext=no + fi + fi + ]) + + if test "$gt_cv_have_gettext" = "yes" ; then + AC_DEFINE(ENABLE_NLS, 1, + [always defined to indicate that i18n is enabled]) + fi + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is not GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + + AC_OUTPUT_COMMANDS( + [case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac]) + + dnl These rules are solely for the distribution goal. While doing this + dnl we only have to keep exactly one list of the available catalogs + dnl in configure.in. + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + dnl Make all variables we use known to autoconf. + AC_SUBST(CATALOGS) + AC_SUBST(CATOBJEXT) + AC_SUBST(DATADIRNAME) + AC_SUBST(GMOFILES) + AC_SUBST(INSTOBJEXT) + AC_SUBST(INTLLIBS) + AC_SUBST(PO_IN_DATADIR_TRUE) + AC_SUBST(PO_IN_DATADIR_FALSE) + AC_SUBST(POFILES) + AC_SUBST(POSUB) + ]) + +# AM_GLIB_GNU_GETTEXT +# ------------------- +# Do checks necessary for use of gettext. If a suitable implementation +# of gettext is found in either in libintl or in the C library, +# it will set INTLLIBS to the libraries needed for use of gettext +# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable +# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST() +# on various variables needed by the Makefile.in.in installed by +# glib-gettextize. +dnl +glib_DEFUN([GLIB_GNU_GETTEXT], + [AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + + GLIB_LC_MESSAGES + GLIB_WITH_NLS + + if test "$gt_cv_have_gettext" = "yes"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + NEW_LINGUAS="$NEW_LINGUAS $presentlang" + fi + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but ($top_srcdir). + dnl Try to locate is. + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) + + dnl Generate list of files to be processed by xgettext which will + dnl be included in po/Makefile. + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + rm -f po/POTFILES + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + ]) + +# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE) +# ------------------------------- +# Define VARIABLE to the location where catalog files will +# be installed by po/Makefile. +glib_DEFUN([GLIB_DEFINE_LOCALEDIR], +[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl +glib_save_prefix="$prefix" +glib_save_exec_prefix="$exec_prefix" +glib_save_datarootdir="$datarootdir" +test "x$prefix" = xNONE && prefix=$ac_default_prefix +test "x$exec_prefix" = xNONE && exec_prefix=$prefix +datarootdir=`eval echo "${datarootdir}"` +if test "x$CATOBJEXT" = "x.mo" ; then + localedir=`eval echo "${libdir}/locale"` +else + localedir=`eval echo "${datadir}/locale"` +fi +prefix="$glib_save_prefix" +exec_prefix="$glib_save_exec_prefix" +datarootdir="$glib_save_datarootdir" +AC_DEFINE_UNQUOTED($1, "$localedir", + [Define the location where the catalogs will be installed]) +]) + +dnl +dnl Now the definitions that aclocal will find +dnl +ifdef(glib_configure_in,[],[ +AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)]) +AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)]) +])dnl + +# GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL]) +# +# Create a temporary file with TEST-FILE as its contents and pass the +# file name to PROGRAM. Perform ACTION-IF-PASS if PROGRAM exits with +# 0 and perform ACTION-IF-FAIL for any other exit status. +AC_DEFUN([GLIB_RUN_PROG], +[cat >conftest.foo <<_ACEOF +$2 +_ACEOF +if AC_RUN_LOG([$1 conftest.foo]); then + m4_ifval([$3], [$3], [:]) +m4_ifvaln([$4], [else $4])dnl +echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD +sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD +fi]) + + + +dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml]) +# serial 36 IT_PROG_INTLTOOL +AC_DEFUN([IT_PROG_INTLTOOL], +[AC_PREREQ([2.50])dnl + +case "$am__api_version" in + 1.[01234]) + AC_MSG_ERROR([Automake 1.5 or newer is required to use intltool]) + ;; + *) + ;; +esac + +if test -n "$1"; then + AC_MSG_CHECKING([for intltool >= $1]) + + INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` + INTLTOOL_APPLIED_VERSION=`awk -F\" '/\\$VERSION / { print $ 2; }' ${ac_aux_dir}/intltool-update.in` + [INTLTOOL_APPLIED_VERSION_AS_INT=`awk -F\" '/\\$VERSION / { split($ 2, VERSION, "."); print VERSION[1] * 1000 + VERSION[2] * 100 + VERSION[3];}' ${ac_aux_dir}/intltool-update.in` + ] + AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found]) + test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || + AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.]) +fi + + INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -p $(top_srcdir)/po $< [$]@' + INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< [$]@' + INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + +AC_SUBST(INTLTOOL_DESKTOP_RULE) +AC_SUBST(INTLTOOL_DIRECTORY_RULE) +AC_SUBST(INTLTOOL_KEYS_RULE) +AC_SUBST(INTLTOOL_PROP_RULE) +AC_SUBST(INTLTOOL_OAF_RULE) +AC_SUBST(INTLTOOL_PONG_RULE) +AC_SUBST(INTLTOOL_SERVER_RULE) +AC_SUBST(INTLTOOL_SHEET_RULE) +AC_SUBST(INTLTOOL_SOUNDLIST_RULE) +AC_SUBST(INTLTOOL_UI_RULE) +AC_SUBST(INTLTOOL_XAM_RULE) +AC_SUBST(INTLTOOL_KBD_RULE) +AC_SUBST(INTLTOOL_XML_RULE) +AC_SUBST(INTLTOOL_XML_NOMERGE_RULE) +AC_SUBST(INTLTOOL_CAVES_RULE) +AC_SUBST(INTLTOOL_SCHEMAS_RULE) +AC_SUBST(INTLTOOL_THEME_RULE) +AC_SUBST(INTLTOOL_SERVICE_RULE) +AC_SUBST(INTLTOOL_POLICY_RULE) + +# Use the tools built into the package, not the ones that are installed. +AC_SUBST(INTLTOOL_EXTRACT, '$(top_builddir)/intltool-extract') +AC_SUBST(INTLTOOL_MERGE, '$(top_builddir)/intltool-merge') +AC_SUBST(INTLTOOL_UPDATE, '$(top_builddir)/intltool-update') + +AC_PATH_PROG(INTLTOOL_PERL, perl) +if test -z "$INTLTOOL_PERL"; then + AC_MSG_ERROR([perl not found; required for intltool]) +fi +if test -z "`$INTLTOOL_PERL -v | fgrep '5.' 2> /dev/null`"; then + AC_MSG_ERROR([perl 5.x required for intltool]) +fi +if test "x$2" != "xno-xml"; then + AC_MSG_CHECKING([for XML::Parser]) + if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then + AC_MSG_RESULT([ok]) + else + AC_MSG_ERROR([XML::Parser perl module is required for intltool]) + fi +fi + +# Substitute ALL_LINGUAS so we can use it in po/Makefile +AC_SUBST(ALL_LINGUAS) + +# Set DATADIRNAME correctly if it is not set yet +# (copied from glib-gettext.m4) +if test -z "$DATADIRNAME"; then + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[]], + [[extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr]])], + [DATADIRNAME=share], + [case $host in + *-*-solaris*) + dnl On Solaris, if bind_textdomain_codeset is in libc, + dnl GNU format message catalog is always supported, + dnl since both are added to the libc all together. + dnl Hence, we'd like to go with DATADIRNAME=share + dnl in this case. + AC_CHECK_FUNC(bind_textdomain_codeset, + [DATADIRNAME=share], [DATADIRNAME=lib]) + ;; + *) + [DATADIRNAME=lib] + ;; + esac]) +fi +AC_SUBST(DATADIRNAME) + +IT_PO_SUBDIR([po]) + +dnl The following is very similar to +dnl +dnl AC_CONFIG_FILES([intltool-extract intltool-merge intltool-update]) +dnl +dnl with the following slight differences: +dnl - the *.in files are in ac_aux_dir, +dnl - if the file haven't changed upon reconfigure, it's not touched, +dnl - the evaluation of the third parameter enables a hack which computes +dnl the actual value of $libdir, +dnl - the user sees "executing intltool commands", instead of +dnl "creating intltool-extract" and such. +dnl +dnl Nothing crucial here, and we could use AC_CONFIG_FILES, if there were +dnl a reason for it. + +AC_CONFIG_COMMANDS([intltool], [ + +for file in intltool-extract intltool-merge intltool-update; do + sed -e "s|@INTLTOOL_EXTRACT@|`pwd`/intltool-extract|g" \ + -e "s|@INTLTOOL_LIBDIR@|${INTLTOOL_LIBDIR}|g" \ + -e "s|@INTLTOOL_PERL@|${INTLTOOL_PERL}|g" \ + < ${ac_aux_dir}/${file}.in > ${file}.out + if cmp -s ${file} ${file}.out 2>/dev/null; then + rm -f ${file}.out + else + mv -f ${file}.out ${file} + fi + chmod ugo+x ${file} + chmod u+w ${file} +done + +], +[INTLTOOL_PERL='${INTLTOOL_PERL}' ac_aux_dir='${ac_aux_dir}' +prefix="$prefix" exec_prefix="$exec_prefix" INTLTOOL_LIBDIR="$libdir" +INTLTOOL_EXTRACT='${INTLTOOL_EXTRACT}']) + +]) + + +# IT_PO_SUBDIR(DIRNAME) +# --------------------- +# All po subdirs have to be declared with this macro; the subdir "po" is +# declared by IT_PROG_INTLTOOL. +# +AC_DEFUN([IT_PO_SUBDIR], +[AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS. +dnl +dnl The following CONFIG_COMMANDS should be exetuted at the very end +dnl of config.status. +AC_CONFIG_COMMANDS_PRE([ + AC_CONFIG_COMMANDS([$1/stamp-it], [ + rm -f "$1/stamp-it" "$1/stamp-it.tmp" "$1/POTFILES" "$1/Makefile.tmp" + >"$1/stamp-it.tmp" + [sed '/^#/d + s/^[[].*] *// + /^[ ]*$/d + '"s|^| $ac_top_srcdir/|" \ + "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES" + ] + if test ! -f "$1/Makefile"; then + AC_MSG_ERROR([$1/Makefile is not ready.]) + fi + mv "$1/Makefile" "$1/Makefile.tmp" + [sed '/^POTFILES =/,/[^\\]$/ { + /^POTFILES =/!d + r $1/POTFILES + } + ' "$1/Makefile.tmp" >"$1/Makefile"] + rm -f "$1/Makefile.tmp" + mv "$1/stamp-it.tmp" "$1/stamp-it" + ]) +])dnl +]) + + +# deprecated macros +AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL]) +# A hint is needed for aclocal from Automake <= 1.9.4: +# AC_DEFUN([AC_PROG_INTLTOOL], ...) + + # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # # Copyright © 2004 Scott James Remnant . @@ -149,7 +786,8 @@ _PKG_TEXT ])], - [$4]) + [AC_MSG_RESULT([no]) + $4]) elif test $pkg_failed = untried; then ifelse([$4], , [AC_MSG_FAILURE(dnl [The pkg-config script could not be found or is too old. Make sure it @@ -158,7 +796,7 @@ _PKG_TEXT -To get pkg-config, see .])], +To get pkg-config, see .])], [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS @@ -168,7 +806,7 @@ fi[]dnl ])# PKG_CHECK_MODULES -# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -178,14 +816,29 @@ # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. -AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.10' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.10], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- -# Call AM_AUTOMAKE_VERSION so it can be traced. +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.9.6])]) +[AM_AUTOMAKE_VERSION([1.10])dnl +_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- @@ -242,14 +895,14 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 7 +# serial 8 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- @@ -258,8 +911,10 @@ [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE]) -AC_SUBST([$1_FALSE]) +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl if $2; then $1_TRUE= $1_FALSE='#' @@ -273,15 +928,14 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 8 +# serial 9 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, @@ -309,6 +963,7 @@ ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) @@ -374,6 +1029,7 @@ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then @@ -426,7 +1082,8 @@ AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- @@ -451,8 +1108,9 @@ # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue @@ -499,8 +1157,8 @@ # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -523,16 +1181,20 @@ # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.58])dnl +[AC_PREREQ([2.60])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi fi # test whether we have cygpath @@ -552,6 +1214,9 @@ AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl @@ -587,6 +1252,10 @@ [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) ]) @@ -622,7 +1291,7 @@ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"$am_aux_dir/install-sh"} +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. @@ -729,14 +1398,14 @@ # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 4 +# serial 5 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -752,6 +1421,7 @@ # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then @@ -762,7 +1432,7 @@ fi ]) -# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -770,60 +1440,23 @@ # AM_PROG_MKDIR_P # --------------- -# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. -# -# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories -# created by `make install' are always world readable, even if the -# installer happens to have an overly restrictive umask (e.g. 077). -# This was a mistake. There are at least two reasons why we must not -# use `-m 0755': -# - it causes special bits like SGID to be ignored, -# - it may be too restrictive (some setups expect 775 directories). -# -# Do not use -m 0755 and let people choose whatever they expect by -# setting umask. -# -# We cannot accept any implementation of `mkdir' that recognizes `-p'. -# Some implementations (such as Solaris 8's) are not thread-safe: if a -# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' -# concurrently, both version can detect that a/ is missing, but only -# one can create it and the other will error out. Consequently we -# restrict ourselves to GNU make (using the --version option ensures -# this.) +# Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], -[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi -AC_SUBST([mkdir_p])]) +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) # Helper functions for option handling. -*- Autoconf -*- @@ -935,9 +1568,21 @@ if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/AUTHORS /tmp/4ejbOOI7Zw/desmume-0.7.3/AUTHORS --- /tmp/bSLAZZZKhC/desmume-0.6.0/AUTHORS 2007-01-27 05:03:46.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/AUTHORS 2007-08-11 14:23:44.000000000 -0500 @@ -17,7 +17,10 @@ Tim Seidel (Mighty Max) Damien Nozay (damdoum) Pascal Giard (evilynux) +Ben Jaques (masscat) +Jeff Bland Contributors ------------ Anthony Molinaro +snkmad diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/autogen.sh /tmp/4ejbOOI7Zw/desmume-0.7.3/autogen.sh --- /tmp/bSLAZZZKhC/desmume-0.6.0/autogen.sh 2007-01-08 14:59:57.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/autogen.sh 2007-07-26 12:25:42.000000000 -0500 @@ -1,4 +1,14 @@ #!/bin/sh -aclocal -automake -a -c --gnu -autoconf +# intltoolize is optionnal as it's only required for the gtk-glade UI. + +if test ! "x$(which intltoolize)" = "x"; then + echo "Running intltoolize" + intltoolize --copy --force --automake +else + if test ! "x$(which gintltoolize)" = "x"; then + echo "Running gintltoolize" + gintltoolize --copy --force --automake + fi +fi + +autoreconf --install --force --verbose diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/ChangeLog /tmp/4ejbOOI7Zw/desmume-0.7.3/ChangeLog --- /tmp/bSLAZZZKhC/desmume-0.6.0/ChangeLog 2007-02-03 17:27:48.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/ChangeLog 2007-08-11 18:50:56.000000000 -0500 @@ -1,3 +1,59 @@ +0.7.2 -> 0.7.3 + gtk-glade: + - Full localization using intltool/gettext. [evilynux] + general: + - Added a README.TRANSLATION documenting the localization process. [evilynux] + MacOS X: + - Initial version of the Mac interface added. [Jeff B] + +0.7.1 -> 0.7.2 + spu: + - big endian fixes. [cyberwarriorx] + gpu: + - big endian fixes. [marcus_c] + gtk-glade: + - opengl improvements. [masscat] + general: + - Added support for setting NDS firmware language value. [masscat] + - Function added for setting firmware language. [masscat] + - Mac/msys compilation fixes. [cyberwarriorx] + - Fix compilation when pkg-config macros are not available [evilynux] + +0.7.0 -> 0.7.1 + general: + - Added GDB debugger stub [masscat] + - Added new/different GBAMP CFlash image reader/writer [masscat] + gpu: + - Major speedup to the 2D core [shash] + gtk-glade: + - Added command line options. [masscat] + - Added FPS limiter [masscat] + cli: + - Added command line options. [masscat] + - Added FPS limiter [masscat] + - Added option to use OpenGl to render window (allows resizing). [masscat] + windows port: + - Added command line options. [masscat] + - Added multiple language support [cyberwarriorx] + - Added Danish language translation [thomas-2007] + +0.6.0 -> 0.7.0 + general: + - Added support for *.duc files [cyberwarriorx] + gpu: + - Added support for sprite rotation/scaling [shash] + - Added support for the 3D core (openGL and null plugins) [shash] + windows port: + - A bunch of fixes [Dmitry Krutskih] + - Fixed a bug in sound that was causing it to still not work for some + people [cyberwarriorx] + gtk: + - Added 3D emulation + - Added command line options. + - Added option to use OpenGL to render window (allows resizing). + gtk-glade: + - Added 3D emulation + 0.5.0 -> 0.6.0 general: - Added zipped (based on zziplib) and gzipped (based on zlib) rom support. diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/config.guess /tmp/4ejbOOI7Zw/desmume-0.7.3/config.guess --- /tmp/bSLAZZZKhC/desmume-0.6.0/config.guess 2007-09-25 00:07:16.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/config.guess 2007-09-25 00:07:16.000000000 -0500 @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. -timestamp='2006-07-02' +timestamp='2007-03-06' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -161,6 +161,7 @@ arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched @@ -780,7 +781,7 @@ i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; - i*:MINGW*:*) + *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) @@ -790,12 +791,15 @@ i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; - x86:Interix*:[3456]*) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T:Interix*:[3456]*) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; @@ -950,6 +954,9 @@ x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; + xtensa:Linux:*:*) + echo xtensa-unknown-linux-gnu + exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent @@ -1208,6 +1215,15 @@ SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/config.sub /tmp/4ejbOOI7Zw/desmume-0.7.3/config.sub --- /tmp/bSLAZZZKhC/desmume-0.6.0/config.sub 2007-09-25 00:07:16.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/config.sub 2007-09-25 00:07:16.000000000 -0500 @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. -timestamp='2006-09-20' +timestamp='2007-01-18' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -245,12 +245,12 @@ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore \ + | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -324,7 +324,7 @@ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ @@ -925,6 +925,9 @@ basic_machine=sh-hitachi os=-hms ;; + sh5el) + basic_machine=sh5le-unknown + ;; sh64) basic_machine=sh64-unknown ;; @@ -1219,7 +1222,7 @@ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1414,6 +1417,9 @@ m68*-cisco) os=-aout ;; + mep-*) + os=-elf + ;; mips*-cisco) os=-elf ;; diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/configure /tmp/4ejbOOI7Zw/desmume-0.7.3/configure --- /tmp/bSLAZZZKhC/desmume-0.6.0/configure 2007-02-03 16:50:17.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/configure 2007-09-03 12:31:39.000000000 -0500 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60 for desmume 0.6.0. +# Generated by GNU Autoconf 2.61 for desmume 0.7.3. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -10,7 +10,8 @@ ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -19,10 +20,13 @@ alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + + # PATH needs CR @@ -215,7 +219,7 @@ else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. @@ -233,7 +237,6 @@ # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF -# Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -242,10 +245,12 @@ alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + : _ASEOF @@ -253,7 +258,6 @@ CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF -# Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -262,10 +266,12 @@ alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + : (as_func_return () { @@ -512,19 +518,28 @@ as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' else - as_executable_p=: + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' fi -rm -f conf$$.file +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -557,43 +572,43 @@ # Identity of this package. PACKAGE_NAME='desmume' PACKAGE_TARNAME='desmume' -PACKAGE_VERSION='0.6.0' -PACKAGE_STRING='desmume 0.6.0' +PACKAGE_VERSION='0.7.3' +PACKAGE_STRING='desmume 0.7.3' PACKAGE_BUGREPORT='' # Factoring default headers for most tests. ac_includes_default="\ #include -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include #endif -#if HAVE_SYS_STAT_H +#ifdef HAVE_SYS_STAT_H # include #endif -#if STDC_HEADERS +#ifdef STDC_HEADERS # include # include #else -# if HAVE_STDLIB_H +# ifdef HAVE_STDLIB_H # include # endif #endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif -#if HAVE_STRINGS_H +#ifdef HAVE_STRINGS_H # include #endif -#if HAVE_INTTYPES_H +#ifdef HAVE_INTTYPES_H # include #endif -#if HAVE_STDINT_H +#ifdef HAVE_STDINT_H # include #endif -#if HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H # include #endif" @@ -634,9 +649,23 @@ build_alias host_alias target_alias +build +build_cpu +build_vendor +build_os +host +host_cpu +host_vendor +host_os +target +target_cpu +target_vendor +target_os +desmume_arch INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA +am__isrc CYGPATH_W PACKAGE VERSION @@ -655,24 +684,11 @@ AMTAR am__tar am__untar -build -build_cpu -build_vendor -build_os -host -host_cpu -host_vendor -host_os -target -target_cpu -target_vendor -target_os -desmume_arch -CXX -CXXFLAGS +CC +CFLAGS LDFLAGS CPPFLAGS -ac_ct_CXX +ac_ct_CC EXEEXT OBJEXT DEPDIR @@ -681,29 +697,72 @@ AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH -CXXDEPMODE -am__fastdepCXX_TRUE -am__fastdepCXX_FALSE -RANLIB -CC -CFLAGS -ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE +RANLIB CPP GREP EGREP +PKG_CONFIG +INTLTOOL_DESKTOP_RULE +INTLTOOL_DIRECTORY_RULE +INTLTOOL_KEYS_RULE +INTLTOOL_PROP_RULE +INTLTOOL_OAF_RULE +INTLTOOL_PONG_RULE +INTLTOOL_SERVER_RULE +INTLTOOL_SHEET_RULE +INTLTOOL_SOUNDLIST_RULE +INTLTOOL_UI_RULE +INTLTOOL_XAM_RULE +INTLTOOL_KBD_RULE +INTLTOOL_XML_RULE +INTLTOOL_XML_NOMERGE_RULE +INTLTOOL_CAVES_RULE +INTLTOOL_SCHEMAS_RULE +INTLTOOL_THEME_RULE +INTLTOOL_SERVICE_RULE +INTLTOOL_POLICY_RULE +INTLTOOL_EXTRACT +INTLTOOL_MERGE +INTLTOOL_UPDATE +INTLTOOL_PERL +ALL_LINGUAS +DATADIRNAME SDLCONFIG SDL_CFLAGS SDL_LIBS HAVE_PKG -PKG_CONFIG GTK_CFLAGS GTK_LIBS +GTKGLEXT_CFLAGS +GTKGLEXT_LIBS +GTHREAD_CFLAGS +GTHREAD_LIBS LIBGLADE_CFLAGS LIBGLADE_LIBS +GLADEUI_UNINSTALLED_DIR +GETTEXT_PACKAGE +USE_NLS +MSGFMT +MSGFMT_OPTS +GMSGFMT +XGETTEXT +CATALOGS +CATOBJEXT +GMOFILES +INSTOBJEXT +INTLLIBS +PO_IN_DATADIR_TRUE +PO_IN_DATADIR_FALSE +POFILES +POSUB +MKINSTALLDIRS UI_DIR +PO_DIR +PO_FILES +PO_FILES_IN MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT @@ -714,17 +773,19 @@ ac_precious_vars='build_alias host_alias target_alias -CXX -CXXFLAGS -LDFLAGS -CPPFLAGS -CCC CC CFLAGS +LDFLAGS +LIBS +CPPFLAGS CPP PKG_CONFIG GTK_CFLAGS GTK_LIBS +GTKGLEXT_CFLAGS +GTKGLEXT_LIBS +GTHREAD_CFLAGS +GTHREAD_LIBS LIBGLADE_CFLAGS LIBGLADE_LIBS' @@ -832,10 +893,10 @@ -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) @@ -851,10 +912,10 @@ -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ @@ -1048,19 +1109,19 @@ -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) @@ -1229,7 +1290,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures desmume 0.6.0 to adapt to many kinds of systems. +\`configure' configures desmume 0.7.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1300,7 +1361,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of desmume 0.6.0:";; + short | recursive ) echo "Configuration of desmume 0.7.3:";; esac cat <<\_ACEOF @@ -1315,18 +1376,25 @@ (and sometimes confusing) to the casual installer Some influential environment variables: - CXX C++ compiler command - CXXFLAGS C++ compiler flags + CC C compiler command + CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory + LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CC C compiler command - CFLAGS C compiler flags CPP C preprocessor PKG_CONFIG path to pkg-config utility GTK_CFLAGS C compiler flags for GTK, overriding pkg-config GTK_LIBS linker flags for GTK, overriding pkg-config + GTKGLEXT_CFLAGS + C compiler flags for GTKGLEXT, overriding pkg-config + GTKGLEXT_LIBS + linker flags for GTKGLEXT, overriding pkg-config + GTHREAD_CFLAGS + C compiler flags for GTHREAD, overriding pkg-config + GTHREAD_LIBS + linker flags for GTHREAD, overriding pkg-config LIBGLADE_CFLAGS C compiler flags for LIBGLADE, overriding pkg-config LIBGLADE_LIBS @@ -1395,8 +1463,8 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -desmume configure 0.6.0 -generated by GNU Autoconf 2.60 +desmume configure 0.7.3 +generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -1409,8 +1477,8 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by desmume $as_me 0.6.0, which was -generated by GNU Autoconf 2.60. Invocation command line was +It was created by desmume $as_me 0.7.3, which was +generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1762,7 +1830,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version="1.9" + ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then @@ -1794,6 +1862,142 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } + +{ echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6; } +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6; } +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 +echo "$as_me: error: invalid value of canonical target" >&2;} + { (exit 1); exit 1; }; };; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- +case $target in + *linux*) desmume_arch=linux;; + *mingw*) desmume_arch=windows;; + *darwin*) desmume_arch=linux;; + *bsd*) desmume_arch=linux;; +esac + + +am__api_version='1.10' + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -1830,7 +2034,7 @@ # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -1945,38 +2149,53 @@ echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi -if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' +{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done +done +IFS=$as_save_IFS + +fi + + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" else - mkdir_p='$(install_sh) -d' + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" fi fi +{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +echo "${ECHO_T}$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac for ac_prog in gawk mawk nawk awk do @@ -1996,7 +2215,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2059,12 +2278,16 @@ fi rmdir .tst 2>/dev/null -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } + fi fi # test whether we have cygpath @@ -2079,7 +2302,7 @@ # Define the identity of the package. PACKAGE='desmume' - VERSION='0.6.0' + VERSION='0.7.3' cat >>confdefs.h <<_ACEOF @@ -2107,7 +2330,7 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} -install_sh=${install_sh-"$am_aux_dir/install-sh"} +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right @@ -2131,7 +2354,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2171,7 +2394,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2211,7 +2434,7 @@ fi fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. @@ -2226,161 +2449,118 @@ -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 -echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} - { (exit 1); exit 1; }; } - -{ echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6; } -if test "${ac_cv_build+set}" = set; then +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 -echo "$as_me: error: invalid value of canonical build" >&2;} - { (exit 1); exit 1; }; };; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6; } -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} - { (exit 1); exit 1; }; } -fi +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS fi -{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 -echo "$as_me: error: invalid value of canonical host" >&2;} - { (exit 1); exit 1; }; };; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi -{ echo "$as_me:$LINENO: checking target system type" >&5 -echo $ECHO_N "checking target system type... $ECHO_C" >&6; } -if test "${ac_cv_target+set}" = set; then +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} - { (exit 1); exit 1; }; } -fi +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS fi -{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5 -echo "${ECHO_T}$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 -echo "$as_me: error: invalid value of canonical target" >&2;} - { (exit 1); exit 1; }; };; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- -case $target in - *linux*) desmume_arch=linux;; - *mingw*) desmume_arch=windows;; - *darwin*) desmume_arch=linux;; - *bsd*) desmume_arch=linux;; + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then +if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2388,8 +2568,8 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2399,41 +2579,42 @@ fi fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6; } +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi - test -n "$CXX" && break - done + fi fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then +if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else + ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CXX="$ac_prog" + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2441,42 +2622,147 @@ done IFS=$as_save_IFS +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi fi fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6; } +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi - test -n "$ac_ct_CXX" && break +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi done +done +IFS=$as_save_IFS - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi fi - - fi fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + # Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C++ compiler version" >&5 +echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in @@ -2529,8 +2815,8 @@ # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ echo "$as_me:$LINENO: checking for C++ compiler default output file name" >&5 -echo $ECHO_N "checking for C++ compiler default output file name... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # # List of possible output files, starting from the most likely. @@ -2566,7 +2852,7 @@ # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. -for ac_file in $ac_files +for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in @@ -2594,24 +2880,28 @@ test "$ac_cv_exeext" = no && ac_cv_exeext= else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: C++ compiler cannot create executables +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 -echo "$as_me: error: C++ compiler cannot create executables +echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether the C++ compiler works" >&5 -echo $ECHO_N "checking whether the C++ compiler works... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then @@ -2630,10 +2920,10 @@ if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { echo "$as_me:$LINENO: error: cannot run C++ compiled programs. + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C++ compiled programs. +echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } @@ -2748,9 +3038,9 @@ echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -2784,27 +3074,10 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 @@ -2814,23 +3087,23 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu +ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -2859,33 +3132,16 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cxx_g=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - CXXFLAGS="" + CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -2914,34 +3170,17 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -2970,28 +3209,11 @@ rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cxx_g=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -3006,44 +3228,159 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag + ac_c_werror_flag=$ac_save_c_werror_flag fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" else - CXXFLAGS="-g" + CFLAGS="-g" fi else - if test "$GXX" = yes; then - CXXFLAGS="-O2" + if test "$GCC" = yes; then + CFLAGS="-O2" else - CXXFLAGS= + CFLAGS= fi fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} -ac_config_commands="$ac_config_commands depfiles" +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } am__include="#" am__quote= _am_result=none @@ -3083,9 +3420,7 @@ am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi - - -if test "x$enable_dependency_tracking" != xno; then + if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else @@ -3095,12 +3430,11 @@ - -depcc="$CXX" am_compiler_list= +depcc="$CC" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } -if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -3122,7 +3456,7 @@ # directory. mkdir sub - am_cv_CXX_dependencies_compiler_type=none + am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi @@ -3163,6 +3497,7 @@ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then @@ -3175,7 +3510,7 @@ # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode + am_cv_CC_dependencies_compiler_type=$depmode break fi fi @@ -3184,24 +3519,22 @@ cd .. rm -rf conftest.dir else - am_cv_CXX_dependencies_compiler_type=none + am_cv_CC_dependencies_compiler_type=none fi fi -{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; } -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - +{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type -if + if test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= fi @@ -3223,7 +3556,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3263,7 +3596,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3303,355 +3636,403 @@ fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break fi +rm -f conftest.err conftest.$ac_ext -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done done -IFS=$as_save_IFS - +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break fi + + done + ac_cv_prog_CPP=$CPP + fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } + CPP=$ac_cv_prog_CPP else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + ac_cv_prog_CPP=$CPP fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; esac - CC=$ac_ct_CC - fi +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : else - CC="$ac_cv_prog_CC" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_prog_rejected=no + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done done + done IFS=$as_save_IFS -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi + fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + ac_cv_path_GREP=$GREP fi fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac - test -n "$CC" && break + $ac_path_EGREP_found && break 3 done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi done + done IFS=$as_save_IFS -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi +fi - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } fi +else + ac_cv_path_EGREP=$EGREP fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -3660,13 +4041,14 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include +#include +#include +#include int main () { -#ifndef __GNUC__ - choke me -#endif ; return 0; @@ -3685,83 +4067,109 @@ 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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_compiler_gnu=no + ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include -int -main () -{ +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* - ; - return 0; -} +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 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' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -3770,33 +4178,123 @@ (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (case "(($ac_try" in + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + 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 <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&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); }; }; then - ac_cv_prog_cc_g=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include +#include int main () { +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ + && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) + bogus endian macros +#endif ; return 0; @@ -3815,45 +4313,81 @@ 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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&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); }; }; then - : + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF + ac_cv_c_bigendian=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - +short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () { - + _ascii (); _ebcdic (); ; return 0; } @@ -3871,18 +4405,65 @@ 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' - { (case "(($ac_try" in + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + 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 +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 + (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; @@ -3892,712 +4473,1587 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes + ac_cv_c_bigendian=no else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - +( exit $ac_status ) +ac_cv_c_bigendian=yes fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done +done +IFS=$as_save_IFS + + ;; +esac fi -{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6; } else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_c89=$ac_arg + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + PKG_CONFIG="" + fi fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC +case "$am__api_version" in + 1.01234) + { { echo "$as_me:$LINENO: error: Automake 1.5 or newer is required to use intltool" >&5 +echo "$as_me: error: Automake 1.5 or newer is required to use intltool" >&2;} + { (exit 1); exit 1; }; } + ;; + *) + ;; +esac +if test -n ""; then + { echo "$as_me:$LINENO: checking for intltool >= " >&5 +echo $ECHO_N "checking for intltool >= ... $ECHO_C" >&6; } + + INTLTOOL_REQUIRED_VERSION_AS_INT=`echo | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` + INTLTOOL_APPLIED_VERSION=`awk -F\" '/\\$VERSION / { print $ 2; }' ${ac_aux_dir}/intltool-update.in` + INTLTOOL_APPLIED_VERSION_AS_INT=`awk -F\" '/\\$VERSION / { split($ 2, VERSION, "."); print VERSION[1] * 1000 + VERSION[2] * 100 + VERSION[3];}' ${ac_aux_dir}/intltool-update.in` + + { echo "$as_me:$LINENO: result: $INTLTOOL_APPLIED_VERSION found" >&5 +echo "${ECHO_T}$INTLTOOL_APPLIED_VERSION found" >&6; } + test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || + { { echo "$as_me:$LINENO: error: Your intltool is too old. You need intltool or later." >&5 +echo "$as_me: error: Your intltool is too old. You need intltool or later." >&2;} + { (exit 1); exit 1; }; } fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; - xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; + + INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' +INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -p $(top_srcdir)/po $< $@' + INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' +INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< $@' + INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + + + + + + + + + + + + + + + + + + + + + +# Use the tools built into the package, not the ones that are installed. +INTLTOOL_EXTRACT='$(top_builddir)/intltool-extract' + +INTLTOOL_MERGE='$(top_builddir)/intltool-merge' + +INTLTOOL_UPDATE='$(top_builddir)/intltool-update' + + +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_INTLTOOL_PERL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $INTLTOOL_PERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_INTLTOOL_PERL="$INTLTOOL_PERL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_INTLTOOL_PERL="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +INTLTOOL_PERL=$ac_cv_path_INTLTOOL_PERL +if test -n "$INTLTOOL_PERL"; then + { echo "$as_me:$LINENO: result: $INTLTOOL_PERL" >&5 +echo "${ECHO_T}$INTLTOOL_PERL" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +if test -z "$INTLTOOL_PERL"; then + { { echo "$as_me:$LINENO: error: perl not found; required for intltool" >&5 +echo "$as_me: error: perl not found; required for intltool" >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "`$INTLTOOL_PERL -v | fgrep '5.' 2> /dev/null`"; then + { { echo "$as_me:$LINENO: error: perl 5.x required for intltool" >&5 +echo "$as_me: error: perl 5.x required for intltool" >&2;} + { (exit 1); exit 1; }; } +fi +if test "x" != "xno-xml"; then + { echo "$as_me:$LINENO: checking for XML::Parser" >&5 +echo $ECHO_N "checking for XML::Parser... $ECHO_C" >&6; } + if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then + { echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6; } + else + { { echo "$as_me:$LINENO: error: XML::Parser perl module is required for intltool" >&5 +echo "$as_me: error: XML::Parser perl module is required for intltool" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +# Substitute ALL_LINGUAS so we can use it in po/Makefile + + +# Set DATADIRNAME correctly if it is not set yet +# (copied from glib-gettext.m4) +if test -z "$DATADIRNAME"; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + DATADIRNAME=share +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + case $host in + *-*-solaris*) + { echo "$as_me:$LINENO: checking for bind_textdomain_codeset" >&5 +echo $ECHO_N "checking for bind_textdomain_codeset... $ECHO_C" >&6; } +if test "${ac_cv_func_bind_textdomain_codeset+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define bind_textdomain_codeset to an innocuous variant, in case declares bind_textdomain_codeset. + For example, HP-UX 11i declares gettimeofday. */ +#define bind_textdomain_codeset innocuous_bind_textdomain_codeset + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char bind_textdomain_codeset (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef bind_textdomain_codeset + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char bind_textdomain_codeset (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_bind_textdomain_codeset || defined __stub___bind_textdomain_codeset +choke me +#endif + +int +main () +{ +return bind_textdomain_codeset (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_bind_textdomain_codeset=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_bind_textdomain_codeset=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_bind_textdomain_codeset" >&5 +echo "${ECHO_T}$ac_cv_func_bind_textdomain_codeset" >&6; } +if test $ac_cv_func_bind_textdomain_codeset = yes; then + DATADIRNAME=share +else + DATADIRNAME=lib +fi + + ;; + *) + DATADIRNAME=lib + ;; + esac +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi + + + + + +ac_config_commands="$ac_config_commands intltool" + + + + + +{ echo "$as_me:$LINENO: checking for gzopen in -lz" >&5 +echo $ECHO_N "checking for gzopen in -lz... $ECHO_C" >&6; } +if test "${ac_cv_lib_z_gzopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $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 GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gzopen (); +int +main () +{ +return gzopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_z_gzopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_z_gzopen=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzopen" >&5 +echo "${ECHO_T}$ac_cv_lib_z_gzopen" >&6; } +if test $ac_cv_lib_z_gzopen = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBZ 1 +_ACEOF + + LIBS="-lz $LIBS" + +fi + + + +{ echo "$as_me:$LINENO: checking for zzip_open in -lzzip" >&5 +echo $ECHO_N "checking for zzip_open in -lzzip... $ECHO_C" >&6; } +if test "${ac_cv_lib_zzip_zzip_open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lzzip $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 GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char zzip_open (); +int +main () +{ +return zzip_open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_zzip_zzip_open=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_zzip_zzip_open=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_zzip_zzip_open" >&5 +echo "${ECHO_T}$ac_cv_lib_zzip_zzip_open" >&6; } +if test $ac_cv_lib_zzip_zzip_open = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBZZIP 1 +_ACEOF + + LIBS="-lzzip $LIBS" + +fi + + +for ac_prog in sdl-config sdl11-config +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_SDLCONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $SDLCONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_SDLCONFIG="$SDLCONFIG" # Let the user override the test with a path. + ;; *) - CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_SDLCONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +SDLCONFIG=$ac_cv_path_SDLCONFIG +if test -n "$SDLCONFIG"; then + { echo "$as_me:$LINENO: result: $SDLCONFIG" >&5 +echo "${ECHO_T}$SDLCONFIG" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$SDLCONFIG" && break +done + +if test ! "x$SDLCONFIG" = "x" ; then + SDL_CFLAGS=`$SDLCONFIG --cflags` + SDL_LIBS=`$SDLCONFIG --libs` + + + HAVE_SDL="yes" +else + HAVE_SDL="no" +fi + + +for ac_header in GL/gl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header 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 <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 core 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 $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header 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 <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.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: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in GL/glu.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header 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 <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 core 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 $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header 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 <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.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: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +fi -depcc="$CC" am_compiler_list= +done -{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_HAVE_PKG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub + if test -n "$HAVE_PKG"; then + ac_cv_prog_HAVE_PKG="$HAVE_PKG" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_HAVE_PKG="${ac_tool_prefix}pkg-config" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` +fi +fi +HAVE_PKG=$ac_cv_prog_HAVE_PKG +if test -n "$HAVE_PKG"; then + { echo "$as_me:$LINENO: result: $HAVE_PKG" >&5 +echo "${ECHO_T}$HAVE_PKG" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_HAVE_PKG"; then + ac_ct_HAVE_PKG=$HAVE_PKG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_HAVE_PKG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_HAVE_PKG"; then + ac_cv_prog_ac_ct_HAVE_PKG="$ac_ct_HAVE_PKG" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_HAVE_PKG="pkg-config" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf +done +done +IFS=$as_save_IFS - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done +fi +fi +ac_ct_HAVE_PKG=$ac_cv_prog_ac_ct_HAVE_PKG +if test -n "$ac_ct_HAVE_PKG"; then + { echo "$as_me:$LINENO: result: $ac_ct_HAVE_PKG" >&5 +echo "${ECHO_T}$ac_ct_HAVE_PKG" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi - cd .. - rm -rf conftest.dir + if test "x$ac_ct_HAVE_PKG" = x; then + HAVE_PKG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + HAVE_PKG=$ac_ct_HAVE_PKG + fi else - am_cv_CC_dependencies_compiler_type=none + HAVE_PKG="$ac_cv_prog_HAVE_PKG" fi + + if test ! "x$HAVE_PKG" = "x" ; then + +pkg_failed=no +{ echo "$as_me:$LINENO: checking for GTK" >&5 +echo $ECHO_N "checking for GTK... $ECHO_C" >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$GTK_CFLAGS"; then + pkg_cv_GTK_CFLAGS="$GTK_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\"gtk+-2.0\"\"") >&5 + ($PKG_CONFIG --exists --print-errors ""gtk+-2.0"") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GTK_CFLAGS=`$PKG_CONFIG --cflags ""gtk+-2.0"" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$GTK_LIBS"; then + pkg_cv_GTK_LIBS="$GTK_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\"gtk+-2.0\"\"") >&5 + ($PKG_CONFIG --exists --print-errors ""gtk+-2.0"") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GTK_LIBS=`$PKG_CONFIG --libs ""gtk+-2.0"" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried fi -{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GTK_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors ""gtk+-2.0""` + else + GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors ""gtk+-2.0""` + fi + # Put the nasty error message in config.log where it belongs + echo "$GTK_PKG_ERRORS" >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + HAVE_GTK=no +elif test $pkg_failed = untried; then + HAVE_GTK=no else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= + GTK_CFLAGS=$pkg_cv_GTK_CFLAGS + GTK_LIBS=$pkg_cv_GTK_LIBS + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + HAVE_GTK=yes fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= + +pkg_failed=no +{ echo "$as_me:$LINENO: checking for GTKGLEXT" >&5 +echo $ECHO_N "checking for GTKGLEXT... $ECHO_C" >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$GTKGLEXT_CFLAGS"; then + pkg_cv_GTKGLEXT_CFLAGS="$GTKGLEXT_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\"gtkglext-1.0\"\"") >&5 + ($PKG_CONFIG --exists --print-errors ""gtkglext-1.0"") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GTKGLEXT_CFLAGS=`$PKG_CONFIG --cflags ""gtkglext-1.0"" 2>/dev/null` +else + pkg_failed=yes fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + fi else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$GTKGLEXT_LIBS"; then + pkg_cv_GTKGLEXT_LIBS="$GTKGLEXT_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\"gtkglext-1.0\"\"") >&5 + ($PKG_CONFIG --exists --print-errors ""gtkglext-1.0"") 2>&5 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 + (exit $ac_status); }; then + pkg_cv_GTKGLEXT_LIBS=`$PKG_CONFIG --libs ""gtkglext-1.0"" 2>/dev/null` else - ac_cpp_err=yes + pkg_failed=yes fi -if test -z "$ac_cpp_err"; then - : + fi else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue + pkg_failed=untried fi -rm -f conftest.err conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes else - ac_cpp_err=yes + _pkg_short_errors_supported=no fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + if test $_pkg_short_errors_supported = yes; then + GTKGLEXT_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors ""gtkglext-1.0""` + else + GTKGLEXT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors ""gtkglext-1.0""` + fi + # Put the nasty error message in config.log where it belongs + echo "$GTKGLEXT_PKG_ERRORS" >&5 - # Passes both tests. -ac_preproc_ok=: -break + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + HAVE_GTKGLEXT=no +elif test $pkg_failed = untried; then + HAVE_GTKGLEXT=no +else + GTKGLEXT_CFLAGS=$pkg_cv_GTKGLEXT_CFLAGS + GTKGLEXT_LIBS=$pkg_cv_GTKGLEXT_LIBS + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + HAVE_GTKGLEXT=yes fi -rm -f conftest.err conftest.$ac_ext -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - done - ac_cv_prog_CPP=$CPP +pkg_failed=no +{ echo "$as_me:$LINENO: checking for GTHREAD" >&5 +echo $ECHO_N "checking for GTHREAD... $ECHO_C" >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$GTHREAD_CFLAGS"; then + pkg_cv_GTHREAD_CFLAGS="$GTHREAD_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\"gthread-2.0\"\"") >&5 + ($PKG_CONFIG --exists --print-errors ""gthread-2.0"") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GTHREAD_CFLAGS=`$PKG_CONFIG --cflags ""gthread-2.0"" 2>/dev/null` +else + pkg_failed=yes fi - CPP=$ac_cv_prog_CPP + fi else - ac_cv_prog_CPP=$CPP + pkg_failed=untried fi -{ echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 +if test -n "$PKG_CONFIG"; then + if test -n "$GTHREAD_LIBS"; then + pkg_cv_GTHREAD_LIBS="$GTHREAD_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\"gthread-2.0\"\"") >&5 + ($PKG_CONFIG --exists --print-errors ""gthread-2.0"") 2>&5 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 + (exit $ac_status); }; then + pkg_cv_GTHREAD_LIBS=`$PKG_CONFIG --libs ""gthread-2.0"" 2>/dev/null` else - ac_cpp_err=yes + pkg_failed=yes fi -if test -z "$ac_cpp_err"; then - : + fi else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + pkg_failed=untried +fi - # Broken: fails on valid input. -continue + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GTHREAD_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors ""gthread-2.0""` + else + GTHREAD_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors ""gthread-2.0""` + fi + # Put the nasty error message in config.log where it belongs + echo "$GTHREAD_PKG_ERRORS" >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + HAVE_GTHREAD=no +elif test $pkg_failed = untried; then + HAVE_GTHREAD=no +else + GTHREAD_CFLAGS=$pkg_cv_GTHREAD_CFLAGS + GTHREAD_LIBS=$pkg_cv_GTHREAD_LIBS + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + HAVE_GTHREAD=yes fi -rm -f conftest.err conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF + + + +{ echo "$as_me:$LINENO: checking for gdk_gl_init in -lgdkglext-x11-1.0" >&5 +echo $ECHO_N "checking for gdk_gl_init in -lgdkglext-x11-1.0... $ECHO_C" >&6; } +if test "${ac_cv_lib_gdkglext_x11_1_0_gdk_gl_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgdkglext-x11-1.0 $LIBS" +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gdk_gl_init (); +int +main () +{ +return gdk_gl_init (); + ; + return 0; +} _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + (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); } >/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 - # Broken: success on invalid input. -continue + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_gdkglext_x11_1_0_gdk_gl_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. -ac_preproc_ok=: -break + ac_cv_lib_gdkglext_x11_1_0_gdk_gl_init=no fi -rm -f conftest.err conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_gdkglext_x11_1_0_gdk_gl_init" >&5 +echo "${ECHO_T}$ac_cv_lib_gdkglext_x11_1_0_gdk_gl_init" >&6; } +if test $ac_cv_lib_gdkglext_x11_1_0_gdk_gl_init = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBGDKGLEXT_X11_1_0 1 +_ACEOF + + LIBS="-lgdkglext-x11-1.0 $LIBS" -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +pkg_failed=no +{ echo "$as_me:$LINENO: checking for LIBGLADE" >&5 +echo $ECHO_N "checking for LIBGLADE... $ECHO_C" >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$LIBGLADE_CFLAGS"; then + pkg_cv_LIBGLADE_CFLAGS="$LIBGLADE_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\"libglade-2.0\"\"") >&5 + ($PKG_CONFIG --exists --print-errors ""libglade-2.0"") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBGLADE_CFLAGS=`$PKG_CONFIG --cflags ""libglade-2.0"" 2>/dev/null` else - # Extract the first word of "grep ggrep" to use in msg output -if test -z "$GREP"; then -set dummy grep ggrep; ac_prog_name=$2 -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + pkg_failed=yes +fi + fi else - ac_path_GREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue - # Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$LIBGLADE_LIBS"; then + pkg_cv_LIBGLADE_LIBS="$LIBGLADE_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\"libglade-2.0\"\"") >&5 + ($PKG_CONFIG --exists --print-errors ""libglade-2.0"") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBGLADE_LIBS=`$PKG_CONFIG --libs ""libglade-2.0"" 2>/dev/null` +else + pkg_failed=yes +fi fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_GREP_found && break 3 - done -done +else + pkg_failed=untried +fi -done -IFS=$as_save_IFS -fi +if test $pkg_failed = yes; then -GREP="$ac_cv_path_GREP" -if test -z "$GREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no fi + if test $_pkg_short_errors_supported = yes; then + LIBGLADE_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors ""libglade-2.0""` + else + LIBGLADE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors ""libglade-2.0""` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBGLADE_PKG_ERRORS" >&5 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + HAVE_LIBGLADE=no +elif test $pkg_failed = untried; then + HAVE_LIBGLADE=no else - ac_cv_path_GREP=$GREP + LIBGLADE_CFLAGS=$pkg_cv_LIBGLADE_CFLAGS + LIBGLADE_LIBS=$pkg_cv_LIBGLADE_LIBS + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + HAVE_LIBGLADE=yes fi + + +cat >>confdefs.h <<_ACEOF +#define GLADEUI_UNINSTALLED_DIR "`pwd`/src/gtk-glade/glade/" +_ACEOF + + + fi + + +if test "x$HAVE_GTKGLEXT" = "xyes"; then + cat >>confdefs.h <<\_ACEOF +#define GTKGLEXT_AVAILABLE 1 +_ACEOF + fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" +PO_DIR="" +PO_FILES="" +PO_FILES_IN="" +if test "x$HAVE_SDL" = "xyes"; then + # SDL adds just a cli + UI_DIR="cli $UI_DIR" + if test "x$HAVE_GTK" = "xyes"; then + # GTK requires SDL + UI_DIR="gtk $UI_DIR" + fi + + if test "x$HAVE_LIBGLADE" = "xyes"; then -{ echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - # Extract the first word of "egrep" to use in msg output -if test -z "$EGREP"; then -set dummy egrep; ac_prog_name=$2 -if test "${ac_cv_path_EGREP+set}" = set; then + # libglade requires SDL too + UI_DIR="gtk-glade $UI_DIR" + + GETTEXT_PACKAGE=desmume + +cat >>confdefs.h <<_ACEOF +#define GETTEXT_PACKAGE "$GETTEXT_PACKAGE" +_ACEOF + + + ALL_LINGUAS="fr" + + +for ac_header in locale.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } else - ac_path_EGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue - # Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header 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 <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_compiler=no +fi - $ac_path_EGREP_found && break 3 - done -done - -done -IFS=$as_save_IFS +rm -f core 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 $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header 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 <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.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 -EGREP="$ac_cv_path_EGREP" -if test -z "$EGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -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: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_path_EGREP=$EGREP + eval "$as_ac_Header=\$ac_header_preproc" fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF - fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" +done -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then + if test $ac_cv_header_locale_h = yes; then + { echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5 +echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6; } +if test "${am_cv_val_LC_MESSAGES+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -4606,109 +6062,199 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include -#include -#include - +#include int main () { - +return LC_MESSAGES ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + am_cv_val_LC_MESSAGES=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + am_cv_val_LC_MESSAGES=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $am_cv_val_LC_MESSAGES" >&5 +echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6; } + if test $am_cv_val_LC_MESSAGES = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LC_MESSAGES 1 +_ACEOF + + fi + fi + USE_NLS=yes + + + gt_cv_have_gettext=no + + CATOBJEXT=NONE + XGETTEXT=: + INTLLIBS= + + if test "${ac_cv_header_libintl_h+set}" = set; then + { echo "$as_me:$LINENO: checking for libintl.h" >&5 +echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6; } +if test "${ac_cv_header_libintl_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5 +echo "${ECHO_T}$ac_cv_header_libintl_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking libintl.h usability" >&5 +echo $ECHO_N "checking libintl.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 +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&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); }; }; then - ac_cv_header_stdc=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_header_stdc=no + ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF +# Is the header present? +{ echo "$as_me:$LINENO: checking libintl.h presence" >&5 +echo $ECHO_N "checking libintl.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 - +#include _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes else - ac_cv_header_stdc=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_preproc=no fi -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : +# 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: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: libintl.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: libintl.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: libintl.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: libintl.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: libintl.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: libintl.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: libintl.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: libintl.h: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ echo "$as_me:$LINENO: checking for libintl.h" >&5 +echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6; } +if test "${ac_cv_header_libintl_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_header_stdc=no + ac_cv_header_libintl_h=$ac_header_preproc fi -rm -f conftest* +{ echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5 +echo "${ECHO_T}$ac_cv_header_libintl_h" >&6; } fi +if test $ac_cv_header_libintl_h = yes; then + gt_cv_func_dgettext_libintl="no" + libintl_extra_libs="" -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : + # + # First check in libc + # + { echo "$as_me:$LINENO: checking for ngettext in libc" >&5 +echo $ECHO_N "checking for ngettext in libc... $ECHO_C" >&6; } +if test "${gt_cv_func_ngettext_libc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -4716,93 +6262,54 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +#include + int main () { - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; +return !ngettext ("","", 1) + ; return 0; } _ACEOF -rm -f conftest$ac_exeext +rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gt_cv_func_ngettext_libc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + gt_cv_func_ngettext_libc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $gt_cv_func_ngettext_libc" >&5 +echo "${ECHO_T}$gt_cv_func_ngettext_libc" >&6; } -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + if test "$gt_cv_func_ngettext_libc" = "yes" ; then + { echo "$as_me:$LINENO: checking for dgettext in libc" >&5 +echo $ECHO_N "checking for dgettext in libc... $ECHO_C" >&6; } +if test "${gt_cv_func_dgettext_libc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -4811,363 +6318,361 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +#include + +int +main () +{ +return !dgettext ("","") + ; + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gt_cv_func_dgettext_libc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_Header=no" + gt_cv_func_dgettext_libc=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi +{ echo "$as_me:$LINENO: result: $gt_cv_func_dgettext_libc" >&5 +echo "${ECHO_T}$gt_cv_func_dgettext_libc" >&6; } + fi -done - + if test "$gt_cv_func_ngettext_libc" = "yes" ; then -{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 -echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then +for ac_func in bind_textdomain_codeset +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - # See if sys/param.h defines the BYTE_ORDER macro. -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif int main () { -#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN - bogus endian macros -#endif - +return $ac_func (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - # It does; now see whether it defined to BIG_ENDIAN or not. + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + fi + + # + # If we don't have everything we want, check in libintl + # + if test "$gt_cv_func_dgettext_libc" != "yes" \ + || test "$gt_cv_func_ngettext_libc" != "yes" \ + || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then + + { echo "$as_me:$LINENO: checking for bindtextdomain in -lintl" >&5 +echo $ECHO_N "checking for bindtextdomain in -lintl... $ECHO_C" >&6; } +if test "${ac_cv_lib_intl_bindtextdomain+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char bindtextdomain (); int main () { -#if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif - +return bindtextdomain (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_bigendian=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_intl_bindtextdomain=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_c_bigendian=no + ac_cv_lib_intl_bindtextdomain=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_intl_bindtextdomain" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_bindtextdomain" >&6; } +if test $ac_cv_lib_intl_bindtextdomain = yes; then + { echo "$as_me:$LINENO: checking for ngettext in -lintl" >&5 +echo $ECHO_N "checking for ngettext in -lintl... $ECHO_C" >&6; } +if test "${ac_cv_lib_intl_ngettext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # It does not; compile a test program. -if test "$cross_compiling" = yes; then - # try to guess the endianness by grepping values into an object file - ac_cv_c_bigendian=unknown - cat >conftest.$ac_ext <<_ACEOF + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl $LIBS" +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; -short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; -void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } -short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; -short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; -void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ngettext (); int main () { - _ascii (); _ebcdic (); +return ngettext (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then - ac_cv_c_bigendian=yes -fi -if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi -fi + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_intl_ngettext=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_cv_lib_intl_ngettext=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_intl_ngettext" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_ngettext" >&6; } +if test $ac_cv_lib_intl_ngettext = yes; then + { echo "$as_me:$LINENO: checking for dgettext in -lintl" >&5 +echo $ECHO_N "checking for dgettext in -lintl... $ECHO_C" >&6; } +if test "${ac_cv_lib_intl_dgettext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl $LIBS" +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 -int -main () -{ - - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dgettext (); +int +main () +{ +return dgettext (); ; return 0; } _ACEOF -rm -f conftest$ac_exeext +rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&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); }; }; then - ac_cv_c_bigendian=no + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_intl_dgettext=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_cv_c_bigendian=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + ac_cv_lib_intl_dgettext=no fi - +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_cv_lib_intl_dgettext" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_dgettext" >&6; } +if test $ac_cv_lib_intl_dgettext = yes; then + gt_cv_func_dgettext_libintl=yes fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 -echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } -case $ac_cv_c_bigendian in - yes) - -cat >>confdefs.h <<\_ACEOF -#define WORDS_BIGENDIAN 1 -_ACEOF - ;; - no) - ;; - *) - { { echo "$as_me:$LINENO: error: unknown endianness -presetting ac_cv_c_bigendian=no (or yes) will help" >&5 -echo "$as_me: error: unknown endianness -presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} - { (exit 1); exit 1; }; } ;; -esac +fi +fi -{ echo "$as_me:$LINENO: checking for gzopen in -lz" >&5 -echo $ECHO_N "checking for gzopen in -lz... $ECHO_C" >&6; } -if test "${ac_cv_lib_z_gzopen+set}" = set; then + if test "$gt_cv_func_dgettext_libintl" != "yes" ; then + { echo "$as_me:$LINENO: checking if -liconv is needed to use gettext" >&5 +echo $ECHO_N "checking if -liconv is needed to use gettext... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: result: " >&5 +echo "${ECHO_T}" >&6; } + { echo "$as_me:$LINENO: checking for ngettext in -lintl" >&5 +echo $ECHO_N "checking for ngettext in -lintl... $ECHO_C" >&6; } +if test "${ac_cv_lib_intl_ngettext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lz $LIBS" +LIBS="-lintl -liconv $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5181,11 +6686,11 @@ #ifdef __cplusplus extern "C" #endif -char gzopen (); +char ngettext (); int main () { -return gzopen (); +return ngettext (); ; return 0; } @@ -5203,59 +6708,33 @@ 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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_z_gzopen=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_intl_ngettext=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_z_gzopen=no + ac_cv_lib_intl_ngettext=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_gzopen" >&5 -echo "${ECHO_T}$ac_cv_lib_z_gzopen" >&6; } -if test $ac_cv_lib_z_gzopen = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBZ 1 -_ACEOF - - LIBS="-lz $LIBS" - -fi - - - -{ echo "$as_me:$LINENO: checking for zzip_open in -lzzip" >&5 -echo $ECHO_N "checking for zzip_open in -lzzip... $ECHO_C" >&6; } -if test "${ac_cv_lib_zzip_zzip_open+set}" = set; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_intl_ngettext" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_ngettext" >&6; } +if test $ac_cv_lib_intl_ngettext = yes; then + { echo "$as_me:$LINENO: checking for dcgettext in -lintl" >&5 +echo $ECHO_N "checking for dcgettext in -lintl... $ECHO_C" >&6; } +if test "${ac_cv_lib_intl_dcgettext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lzzip $LIBS" +LIBS="-lintl -liconv $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5269,11 +6748,11 @@ #ifdef __cplusplus extern "C" #endif -char zzip_open (); +char dcgettext (); int main () { -return zzip_open (); +return dcgettext (); ; return 0; } @@ -5291,217 +6770,340 @@ 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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_zzip_zzip_open=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_intl_dcgettext=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_zzip_zzip_open=no + ac_cv_lib_intl_dcgettext=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_zzip_zzip_open" >&5 -echo "${ECHO_T}$ac_cv_lib_zzip_zzip_open" >&6; } -if test $ac_cv_lib_zzip_zzip_open = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBZZIP 1 -_ACEOF - - LIBS="-lzzip $LIBS" - -fi - - -for ac_prog in sdl-config sdl11-config -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_SDLCONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_lib_intl_dcgettext" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_dcgettext" >&6; } +if test $ac_cv_lib_intl_dcgettext = yes; then + gt_cv_func_dgettext_libintl=yes + libintl_extra_libs=-liconv else - case $SDLCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_SDLCONFIG="$SDLCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_SDLCONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - - ;; -esac + : fi -SDLCONFIG=$ac_cv_path_SDLCONFIG -if test -n "$SDLCONFIG"; then - { echo "$as_me:$LINENO: result: $SDLCONFIG" >&5 -echo "${ECHO_T}$SDLCONFIG" >&6; } + else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + : fi + fi - test -n "$SDLCONFIG" && break -done + # + # If we found libintl, then check in it for bind_textdomain_codeset(); + # we'll prefer libc if neither have bind_textdomain_codeset(), + # and both have dgettext and ngettext + # + if test "$gt_cv_func_dgettext_libintl" = "yes" ; then + glib_save_LIBS="$LIBS" + LIBS="$LIBS -lintl $libintl_extra_libs" + unset ac_cv_func_bind_textdomain_codeset + +for ac_func in bind_textdomain_codeset +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -if test ! "x$SDLCONFIG" = "x" ; then - SDL_CFLAGS=`$SDLCONFIG --cflags` - SDL_LIBS=`$SDLCONFIG --libs` +#ifdef __STDC__ +# include +#else +# include +#endif +#undef $ac_func - HAVE_SDL="yes" -else - HAVE_SDL="no" -fi +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_HAVE_PKG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$HAVE_PKG"; then - ac_cv_prog_HAVE_PKG="$HAVE_PKG" # Let the user override the test. +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_HAVE_PKG="${ac_tool_prefix}pkg-config" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + eval "$as_ac_var=no" fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -HAVE_PKG=$ac_cv_prog_HAVE_PKG -if test -n "$HAVE_PKG"; then - { echo "$as_me:$LINENO: result: $HAVE_PKG" >&5 -echo "${ECHO_T}$HAVE_PKG" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi +done + LIBS="$glib_save_LIBS" -fi -if test -z "$ac_cv_prog_HAVE_PKG"; then - ac_ct_HAVE_PKG=$HAVE_PKG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 + if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then + gt_cv_func_dgettext_libc=no + else + if test "$gt_cv_func_dgettext_libc" = "yes" \ + && test "$gt_cv_func_ngettext_libc" = "yes"; then + gt_cv_func_dgettext_libintl=no + fi + fi + fi + fi + + if test "$gt_cv_func_dgettext_libc" = "yes" \ + || test "$gt_cv_func_dgettext_libintl" = "yes"; then + gt_cv_have_gettext=yes + fi + + if test "$gt_cv_func_dgettext_libintl" = "yes"; then + INTLLIBS="-lintl $libintl_extra_libs" + fi + + if test "$gt_cv_have_gettext" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETTEXT 1 +_ACEOF + + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_HAVE_PKG+set}" = set; then +if test "${ac_cv_path_MSGFMT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$ac_ct_HAVE_PKG"; then - ac_cv_prog_ac_ct_HAVE_PKG="$ac_ct_HAVE_PKG" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_HAVE_PKG="pkg-config" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" + ;; +esac fi -ac_ct_HAVE_PKG=$ac_cv_prog_ac_ct_HAVE_PKG -if test -n "$ac_ct_HAVE_PKG"; then - { echo "$as_me:$LINENO: result: $ac_ct_HAVE_PKG" >&5 -echo "${ECHO_T}$ac_ct_HAVE_PKG" >&6; } +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != "no"; then + { echo "$as_me:$LINENO: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi + if test "$MSGFMT" != "no"; then + glib_save_LIBS="$LIBS" + LIBS="$LIBS $INTLLIBS" + +for ac_func in dcgettext +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ - if test "x$ac_ct_HAVE_PKG" = x; then - HAVE_PKG="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; esac - HAVE_PKG=$ac_ct_HAVE_PKG - fi +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" else - HAVE_PKG="$ac_cv_prog_HAVE_PKG" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" fi -if test ! "x$HAVE_PKG" = "x" ; then +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + MSGFMT_OPTS= + { echo "$as_me:$LINENO: checking if msgfmt accepts -c" >&5 +echo $ECHO_N "checking if msgfmt accepts -c... $ECHO_C" >&6; } + cat >conftest.foo <<_ACEOF -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: test 1.0\n" +"PO-Revision-Date: 2007-02-15 12:01+0100\n" +"Last-Translator: test \n" +"Language-Team: C \n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" + +_ACEOF +if { (echo "$as_me:$LINENO: \$MSGFMT -c -o /dev/null conftest.foo") >&5 + ($MSGFMT -c -o /dev/null conftest.foo) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + MSGFMT_OPTS=-c; { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +echo "$as_me: failed input was:" >&5 +sed 's/^/| /' conftest.foo >&5 +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_PKG_CONFIG+set}" = set; then +if test "${ac_cv_path_GMSGFMT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case $PKG_CONFIG in + case $GMSGFMT in [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -5510,8 +7112,8 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5519,265 +7121,337 @@ done IFS=$as_save_IFS + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6; } +GMSGFMT=$ac_cv_path_GMSGFMT +if test -n "$GMSGFMT"; then + { echo "$as_me:$LINENO: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then +if test "${ac_cv_path_XGETTEXT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. ;; *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" ;; esac fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG -if test -n "$ac_pt_PKG_CONFIG"; then - { echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 -echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6; } +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + { echo "$as_me:$LINENO: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi - - if test "x$ac_pt_PKG_CONFIG" = x; then - PKG_CONFIG="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - PKG_CONFIG=$ac_pt_PKG_CONFIG - fi + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + CATOBJEXT=.gmo + DATADIRNAME=share +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + case $host in + *-*-solaris*) + { echo "$as_me:$LINENO: checking for bind_textdomain_codeset" >&5 +echo $ECHO_N "checking for bind_textdomain_codeset... $ECHO_C" >&6; } +if test "${ac_cv_func_bind_textdomain_codeset+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define bind_textdomain_codeset to an innocuous variant, in case declares bind_textdomain_codeset. + For example, HP-UX 11i declares gettimeofday. */ +#define bind_textdomain_codeset innocuous_bind_textdomain_codeset + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char bind_textdomain_codeset (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef bind_textdomain_codeset + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char bind_textdomain_codeset (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_bind_textdomain_codeset || defined __stub___bind_textdomain_codeset +choke me +#endif + +int +main () +{ +return bind_textdomain_codeset (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_bind_textdomain_codeset=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_bind_textdomain_codeset=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_bind_textdomain_codeset" >&5 +echo "${ECHO_T}$ac_cv_func_bind_textdomain_codeset" >&6; } +if test $ac_cv_func_bind_textdomain_codeset = yes; then + CATOBJEXT=.gmo + DATADIRNAME=share else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" + CATOBJEXT=.mo + DATADIRNAME=lib fi + ;; + *) + CATOBJEXT=.mo + DATADIRNAME=lib + ;; + esac fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - { echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 -echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6; } - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$glib_save_LIBS" + INSTOBJEXT=.mo else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - PKG_CONFIG="" + gt_cv_have_gettext=no fi + fi fi -pkg_failed=no -{ echo "$as_me:$LINENO: checking for GTK" >&5 -echo $ECHO_N "checking for GTK... $ECHO_C" >&6; } -if test -n "$PKG_CONFIG"; then - if test -n "$GTK_CFLAGS"; then - pkg_cv_GTK_CFLAGS="$GTK_CFLAGS" - else - if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\"gtk+-2.0\"\"") >&5 - ($PKG_CONFIG --exists --print-errors ""gtk+-2.0"") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_GTK_CFLAGS=`$PKG_CONFIG --cflags ""gtk+-2.0"" 2>/dev/null` -else - pkg_failed=yes -fi + + if test "$gt_cv_have_gettext" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_NLS 1 +_ACEOF + fi -else - pkg_failed=untried -fi -if test -n "$PKG_CONFIG"; then - if test -n "$GTK_LIBS"; then - pkg_cv_GTK_LIBS="$GTK_LIBS" - else - if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\"gtk+-2.0\"\"") >&5 - ($PKG_CONFIG --exists --print-errors ""gtk+-2.0"") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_GTK_LIBS=`$PKG_CONFIG --libs ""gtk+-2.0"" 2>/dev/null` -else - pkg_failed=yes -fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + { echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 +echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6; } + XGETTEXT=":" + fi fi -else - pkg_failed=untried -fi + # We need to process the po/ directory. + POSUB=po + ac_config_commands="$ac_config_commands default-1" -if test $pkg_failed = yes; then -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - GTK_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors ""gtk+-2.0""` - else - GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors ""gtk+-2.0""` - fi - # Put the nasty error message in config.log where it belongs - echo "$GTK_PKG_ERRORS" >&5 + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done - HAVE_GTK=no -elif test $pkg_failed = untried; then - HAVE_GTK=no -else - GTK_CFLAGS=$pkg_cv_GTK_CFLAGS - GTK_LIBS=$pkg_cv_GTK_LIBS - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - HAVE_GTK=yes -fi -pkg_failed=no -{ echo "$as_me:$LINENO: checking for LIBGLADE" >&5 -echo $ECHO_N "checking for LIBGLADE... $ECHO_C" >&6; } -if test -n "$PKG_CONFIG"; then - if test -n "$LIBGLADE_CFLAGS"; then - pkg_cv_LIBGLADE_CFLAGS="$LIBGLADE_CFLAGS" - else - if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\"libglade-2.0\"\"") >&5 - ($PKG_CONFIG --exists --print-errors ""libglade-2.0"") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_LIBGLADE_CFLAGS=`$PKG_CONFIG --cflags ""libglade-2.0"" 2>/dev/null` -else - pkg_failed=yes -fi - fi -else - pkg_failed=untried -fi -if test -n "$PKG_CONFIG"; then - if test -n "$LIBGLADE_LIBS"; then - pkg_cv_LIBGLADE_LIBS="$LIBGLADE_LIBS" - else - if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\"libglade-2.0\"\"") >&5 - ($PKG_CONFIG --exists --print-errors ""libglade-2.0"") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_LIBGLADE_LIBS=`$PKG_CONFIG --libs ""libglade-2.0"" 2>/dev/null` -else - pkg_failed=yes -fi - fi -else - pkg_failed=untried -fi -if test $pkg_failed = yes; then -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - LIBGLADE_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors ""libglade-2.0""` - else - LIBGLADE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors ""libglade-2.0""` - fi - # Put the nasty error message in config.log where it belongs - echo "$LIBGLADE_PKG_ERRORS" >&5 - HAVE_LIBGLADE=no -elif test $pkg_failed = untried; then - HAVE_LIBGLADE=no -else - LIBGLADE_CFLAGS=$pkg_cv_LIBGLADE_CFLAGS - LIBGLADE_LIBS=$pkg_cv_LIBGLADE_LIBS - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - HAVE_LIBGLADE=yes -fi -fi + if test "$gt_cv_have_gettext" = "yes"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + { echo "$as_me:$LINENO: checking for catalogs to be installed" >&5 +echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6; } + NEW_LINGUAS= + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + NEW_LINGUAS="$NEW_LINGUAS $presentlang" + fi + done + LINGUAS=$NEW_LINGUAS + { echo "$as_me:$LINENO: result: $LINGUAS" >&5 +echo "${ECHO_T}$LINGUAS" >&6; } + fi -if test "x$HAVE_SDL" = "xyes"; then - # SDL adds just a cli - UI_DIR="cli $UI_DIR" - if test "x$HAVE_GTK" = "xyes"; then - # GTK requires SDL - UI_DIR="gtk $UI_DIR" - fi + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + rm -f po/POTFILES + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + + PO_DIR="po" + PO_FILES="intltool-extract intltool-merge intltool-update" + PO_FILES_IN="intltool-extract.in intltool-merge.in intltool-update.in" + PO_MAKEFILE="po/Makefile.in" - if test "x$HAVE_LIBGLADE" = "xyes"; then - # libglade requires SDL too - UI_DIR="gtk-glade $UI_DIR" fi fi case $target in + *linux* | *bsd*) + LIBS="$LIBS -lGL -lGLU" + ;; *mingw*) - LIBS="$LIBS -ldxguid -ldxerr8 -ldsound -mwindows" + LIBS="$LIBS -ldxguid -ldxerr8 -ldsound -lopengl32 -lws2_32 -mwindows" UI_DIR="windows" ;; + *darwin*) + LIBS="$LIBS -framework OpenGL" + ;; esac + + # for developer use, enable lots of compile warnings, # but don't require this generally, because some system's # header files (BSD) can't handle it @@ -5825,9 +7499,7 @@ { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; } - - -if test $USE_MAINTAINER_MODE = yes; then + if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else @@ -5841,7 +7513,7 @@ -ac_config_files="$ac_config_files Makefile src/Makefile src/cli/Makefile src/gtk/Makefile src/gtk-glade/Makefile src/windows/Makefile autopackage/default.apspec" +ac_config_files="$ac_config_files Makefile ${PO_MAKEFILE} src/Makefile src/cli/Makefile src/cocoa/Makefile src/gtk/Makefile src/gtk/desmume.desktop src/gtk-glade/Makefile src/gtk-glade/desmume-glade.desktop src/windows/Makefile src/gdbstub/Makefile autopackage/default.apspec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -5976,13 +7648,6 @@ Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -5990,6 +7655,10 @@ Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi + + ac_config_commands="$ac_config_commands po/stamp-it" + + if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -6021,7 +7690,8 @@ ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -6030,10 +7700,13 @@ alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + + # PATH needs CR @@ -6257,19 +7930,28 @@ as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' else - as_executable_p=: + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' fi -rm -f conf$$.file +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -6284,8 +7966,8 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by desmume $as_me 0.6.0, which was -generated by GNU Autoconf 2.60. Invocation command line was +This file was extended by desmume $as_me 0.7.3, which was +generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -6313,7 +7995,7 @@ Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit - -V, --version print version number, then exit + -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions @@ -6331,8 +8013,8 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -desmume config.status 0.6.0 -configured by $0, generated by GNU Autoconf 2.60, +desmume config.status 0.7.3 +configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. @@ -6342,6 +8024,7 @@ ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF @@ -6426,6 +8109,10 @@ # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +INTLTOOL_PERL='${INTLTOOL_PERL}' ac_aux_dir='${ac_aux_dir}' +prefix="$prefix" exec_prefix="$exec_prefix" INTLTOOL_LIBDIR="$libdir" +INTLTOOL_EXTRACT='${INTLTOOL_EXTRACT}' + _ACEOF @@ -6436,13 +8123,21 @@ do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "intltool") CONFIG_COMMANDS="$CONFIG_COMMANDS intltool" ;; + "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "${PO_MAKEFILE}") CONFIG_FILES="$CONFIG_FILES ${PO_MAKEFILE}" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/cli/Makefile") CONFIG_FILES="$CONFIG_FILES src/cli/Makefile" ;; + "src/cocoa/Makefile") CONFIG_FILES="$CONFIG_FILES src/cocoa/Makefile" ;; "src/gtk/Makefile") CONFIG_FILES="$CONFIG_FILES src/gtk/Makefile" ;; + "src/gtk/desmume.desktop") CONFIG_FILES="$CONFIG_FILES src/gtk/desmume.desktop" ;; "src/gtk-glade/Makefile") CONFIG_FILES="$CONFIG_FILES src/gtk-glade/Makefile" ;; + "src/gtk-glade/desmume-glade.desktop") CONFIG_FILES="$CONFIG_FILES src/gtk-glade/desmume-glade.desktop" ;; "src/windows/Makefile") CONFIG_FILES="$CONFIG_FILES src/windows/Makefile" ;; + "src/gdbstub/Makefile") CONFIG_FILES="$CONFIG_FILES src/gdbstub/Makefile" ;; "autopackage/default.apspec") CONFIG_FILES="$CONFIG_FILES autopackage/default.apspec" ;; + "po/stamp-it") CONFIG_COMMANDS="$CONFIG_COMMANDS po/stamp-it" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} @@ -6541,9 +8236,23 @@ build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim +build!$build$ac_delim +build_cpu!$build_cpu$ac_delim +build_vendor!$build_vendor$ac_delim +build_os!$build_os$ac_delim +host!$host$ac_delim +host_cpu!$host_cpu$ac_delim +host_vendor!$host_vendor$ac_delim +host_os!$host_os$ac_delim +target!$target$ac_delim +target_cpu!$target_cpu$ac_delim +target_vendor!$target_vendor$ac_delim +target_os!$target_os$ac_delim +desmume_arch!$desmume_arch$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim +am__isrc!$am__isrc$ac_delim CYGPATH_W!$CYGPATH_W$ac_delim PACKAGE!$PACKAGE$ac_delim VERSION!$VERSION$ac_delim @@ -6562,24 +8271,11 @@ AMTAR!$AMTAR$ac_delim am__tar!$am__tar$ac_delim am__untar!$am__untar$ac_delim -build!$build$ac_delim -build_cpu!$build_cpu$ac_delim -build_vendor!$build_vendor$ac_delim -build_os!$build_os$ac_delim -host!$host$ac_delim -host_cpu!$host_cpu$ac_delim -host_vendor!$host_vendor$ac_delim -host_os!$host_os$ac_delim -target!$target$ac_delim -target_cpu!$target_cpu$ac_delim -target_vendor!$target_vendor$ac_delim -target_os!$target_os$ac_delim -desmume_arch!$desmume_arch$ac_delim -CXX!$CXX$ac_delim -CXXFLAGS!$CXXFLAGS$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim -ac_ct_CXX!$ac_ct_CXX$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim DEPDIR!$DEPDIR$ac_delim @@ -6588,19 +8284,18 @@ AMDEP_TRUE!$AMDEP_TRUE$ac_delim AMDEP_FALSE!$AMDEP_FALSE$ac_delim AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim -CXXDEPMODE!$CXXDEPMODE$ac_delim -am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim -am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim -RANLIB!$RANLIB$ac_delim -CC!$CC$ac_delim -CFLAGS!$CFLAGS$ac_delim -ac_ct_CC!$ac_ct_CC$ac_delim CCDEPMODE!$CCDEPMODE$ac_delim am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim +RANLIB!$RANLIB$ac_delim CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim +PKG_CONFIG!$PKG_CONFIG$ac_delim +INTLTOOL_DESKTOP_RULE!$INTLTOOL_DESKTOP_RULE$ac_delim +INTLTOOL_DIRECTORY_RULE!$INTLTOOL_DIRECTORY_RULE$ac_delim +INTLTOOL_KEYS_RULE!$INTLTOOL_KEYS_RULE$ac_delim +INTLTOOL_PROP_RULE!$INTLTOOL_PROP_RULE$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -6642,16 +8337,60 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +INTLTOOL_OAF_RULE!$INTLTOOL_OAF_RULE$ac_delim +INTLTOOL_PONG_RULE!$INTLTOOL_PONG_RULE$ac_delim +INTLTOOL_SERVER_RULE!$INTLTOOL_SERVER_RULE$ac_delim +INTLTOOL_SHEET_RULE!$INTLTOOL_SHEET_RULE$ac_delim +INTLTOOL_SOUNDLIST_RULE!$INTLTOOL_SOUNDLIST_RULE$ac_delim +INTLTOOL_UI_RULE!$INTLTOOL_UI_RULE$ac_delim +INTLTOOL_XAM_RULE!$INTLTOOL_XAM_RULE$ac_delim +INTLTOOL_KBD_RULE!$INTLTOOL_KBD_RULE$ac_delim +INTLTOOL_XML_RULE!$INTLTOOL_XML_RULE$ac_delim +INTLTOOL_XML_NOMERGE_RULE!$INTLTOOL_XML_NOMERGE_RULE$ac_delim +INTLTOOL_CAVES_RULE!$INTLTOOL_CAVES_RULE$ac_delim +INTLTOOL_SCHEMAS_RULE!$INTLTOOL_SCHEMAS_RULE$ac_delim +INTLTOOL_THEME_RULE!$INTLTOOL_THEME_RULE$ac_delim +INTLTOOL_SERVICE_RULE!$INTLTOOL_SERVICE_RULE$ac_delim +INTLTOOL_POLICY_RULE!$INTLTOOL_POLICY_RULE$ac_delim +INTLTOOL_EXTRACT!$INTLTOOL_EXTRACT$ac_delim +INTLTOOL_MERGE!$INTLTOOL_MERGE$ac_delim +INTLTOOL_UPDATE!$INTLTOOL_UPDATE$ac_delim +INTLTOOL_PERL!$INTLTOOL_PERL$ac_delim +ALL_LINGUAS!$ALL_LINGUAS$ac_delim +DATADIRNAME!$DATADIRNAME$ac_delim SDLCONFIG!$SDLCONFIG$ac_delim SDL_CFLAGS!$SDL_CFLAGS$ac_delim SDL_LIBS!$SDL_LIBS$ac_delim HAVE_PKG!$HAVE_PKG$ac_delim -PKG_CONFIG!$PKG_CONFIG$ac_delim GTK_CFLAGS!$GTK_CFLAGS$ac_delim GTK_LIBS!$GTK_LIBS$ac_delim +GTKGLEXT_CFLAGS!$GTKGLEXT_CFLAGS$ac_delim +GTKGLEXT_LIBS!$GTKGLEXT_LIBS$ac_delim +GTHREAD_CFLAGS!$GTHREAD_CFLAGS$ac_delim +GTHREAD_LIBS!$GTHREAD_LIBS$ac_delim LIBGLADE_CFLAGS!$LIBGLADE_CFLAGS$ac_delim LIBGLADE_LIBS!$LIBGLADE_LIBS$ac_delim +GLADEUI_UNINSTALLED_DIR!$GLADEUI_UNINSTALLED_DIR$ac_delim +GETTEXT_PACKAGE!$GETTEXT_PACKAGE$ac_delim +USE_NLS!$USE_NLS$ac_delim +MSGFMT!$MSGFMT$ac_delim +MSGFMT_OPTS!$MSGFMT_OPTS$ac_delim +GMSGFMT!$GMSGFMT$ac_delim +XGETTEXT!$XGETTEXT$ac_delim +CATALOGS!$CATALOGS$ac_delim +CATOBJEXT!$CATOBJEXT$ac_delim +GMOFILES!$GMOFILES$ac_delim +INSTOBJEXT!$INSTOBJEXT$ac_delim +INTLLIBS!$INTLLIBS$ac_delim +PO_IN_DATADIR_TRUE!$PO_IN_DATADIR_TRUE$ac_delim +PO_IN_DATADIR_FALSE!$PO_IN_DATADIR_FALSE$ac_delim +POFILES!$POFILES$ac_delim +POSUB!$POSUB$ac_delim +MKINSTALLDIRS!$MKINSTALLDIRS$ac_delim UI_DIR!$UI_DIR$ac_delim +PO_DIR!$PO_DIR$ac_delim +PO_FILES!$PO_FILES$ac_delim +PO_FILES_IN!$PO_FILES_IN$ac_delim MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim MAINT!$MAINT$ac_delim @@ -6660,7 +8399,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 16; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 60; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -6887,6 +8626,11 @@ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF @@ -6940,6 +8684,7 @@ s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out @@ -6974,8 +8719,9 @@ # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ @@ -7089,6 +8835,49 @@ done done ;; + "intltool":C) + +for file in intltool-extract intltool-merge intltool-update; do + sed -e "s|@INTLTOOL_EXTRACT@|`pwd`/intltool-extract|g" \ + -e "s|@INTLTOOL_LIBDIR@|${INTLTOOL_LIBDIR}|g" \ + -e "s|@INTLTOOL_PERL@|${INTLTOOL_PERL}|g" \ + < ${ac_aux_dir}/${file}.in > ${file}.out + if cmp -s ${file} ${file}.out 2>/dev/null; then + rm -f ${file}.out + else + mv -f ${file}.out ${file} + fi + chmod ugo+x ${file} + chmod u+w ${file} +done + + ;; + "default-1":C) case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac ;; + "po/stamp-it":C) + rm -f "po/stamp-it" "po/stamp-it.tmp" "po/POTFILES" "po/Makefile.tmp" + >"po/stamp-it.tmp" + sed '/^#/d + s/^[[].*] *// + /^[ ]*$/d + '"s|^| $ac_top_srcdir/|" \ + "$srcdir/po/POTFILES.in" | sed '$!s/$/ \\/' >"po/POTFILES" + + if test ! -f "po/Makefile"; then + { { echo "$as_me:$LINENO: error: po/Makefile is not ready." >&5 +echo "$as_me: error: po/Makefile is not ready." >&2;} + { (exit 1); exit 1; }; } + fi + mv "po/Makefile" "po/Makefile.tmp" + sed '/^POTFILES =/,/[^\\]$/ { + /^POTFILES =/!d + r po/POTFILES + } + ' "po/Makefile.tmp" >"po/Makefile" + rm -f "po/Makefile.tmp" + mv "po/stamp-it.tmp" "po/stamp-it" + ;; esac done # for ac_tag diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/configure.ac /tmp/4ejbOOI7Zw/desmume-0.7.3/configure.ac --- /tmp/bSLAZZZKhC/desmume-0.6.0/configure.ac 2007-02-03 16:50:17.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/configure.ac 2007-08-11 18:45:06.000000000 -0500 @@ -1,8 +1,7 @@ dnl --- Package name is first argument to AC_INIT dnl --- Release version is second argument to AC_INIT -AC_INIT(desmume, [0.6.0]) -AM_INIT_AUTOMAKE +AC_INIT(desmume, [0.7.3]) dnl -- find target architecture for some os specific libraries AC_CANONICAL_TARGET @@ -14,8 +13,10 @@ esac AC_SUBST(desmume_arch) -dnl -- make sure we have a C++ compiler -AC_PROG_CXX +AM_INIT_AUTOMAKE + +dnl -- make sure we have a C compiler +AC_PROG_CC dnl -- use ranlib for libraries AC_PROG_RANLIB @@ -24,6 +25,10 @@ AC_C_BIGENDIAN dnl --- Other prerequisites --- +dnl - Check for pkg-config macros +m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG]) +dnl - Check for intltool/gettext macros +m4_ifdef([IT_PROG_INTLTOOL],[IT_PROG_INTLTOOL]) dnl - Check for zlib AC_CHECK_LIB(z, gzopen) @@ -43,25 +48,62 @@ HAVE_SDL="no" fi +dnl - Check for the OpenGL includes +AC_CHECK_HEADERS([GL/gl.h]) +AC_CHECK_HEADERS([GL/glu.h]) + dnl - Check for GTK and/or libglade AC_CHECK_TOOL(HAVE_PKG, pkg-config) -if test ! "x$HAVE_PKG" = "x" ; then - PKG_CHECK_MODULES(GTK, - "gtk+-2.0", - HAVE_GTK=yes, - HAVE_GTK=no) - AC_SUBST(GTK_CFLAGS) - AC_SUBST(GTK_LIBS) - - PKG_CHECK_MODULES(LIBGLADE, - "libglade-2.0", - HAVE_LIBGLADE=yes, - HAVE_LIBGLADE=no) - AC_SUBST(LIBGLADE_CFLAGS) - AC_SUBST(LIBGLADE_LIBS) +AC_PROVIDE_IFELSE([PKG_PROG_PKG_CONFIG], [ + if test ! "x$HAVE_PKG" = "x" ; then + PKG_CHECK_MODULES(GTK, + "gtk+-2.0", + HAVE_GTK=yes, + HAVE_GTK=no) + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) + + PKG_CHECK_MODULES(GTKGLEXT, + "gtkglext-1.0", + HAVE_GTKGLEXT=yes, + HAVE_GTKGLEXT=no) + AC_SUBST(GTKGLEXT_CFLAGS) + AC_SUBST(GTKGLEXT_LIBS) + + PKG_CHECK_MODULES(GTHREAD, + "gthread-2.0", + HAVE_GTHREAD=yes, + HAVE_GTHREAD=no) + AC_SUBST(GTHREAD_CFLAGS) + AC_SUBST(GTHREAD_LIBS) + + + AC_CHECK_LIB(gdkglext-x11-1.0, gdk_gl_init) + + PKG_CHECK_MODULES(LIBGLADE, + "libglade-2.0", + HAVE_LIBGLADE=yes, + HAVE_LIBGLADE=no) + AC_SUBST(LIBGLADE_CFLAGS) + AC_SUBST(LIBGLADE_LIBS) + + dnl uninstalled glade ui dir + AC_DEFINE_UNQUOTED(GLADEUI_UNINSTALLED_DIR,"`pwd`/src/gtk-glade/glade/",[path to glade ui dir]) + AC_SUBST(GLADEUI_UNINSTALLED_DIR) + fi +],[ + echo "WARNING: pkg-config is not available therefore gtk and gtk-glade UIs are not available either." +]) + +dnl - If the gtkGLext package is available define the corresponding C macro +if test "x$HAVE_GTKGLEXT" = "xyes"; then + AC_DEFINE([GTKGLEXT_AVAILABLE], [1]) fi -dnl - Determine which UI's to build +dnl - Determine which UIs to build and if po/ should be included +PO_DIR="" +PO_FILES="" +PO_FILES_IN="" if test "x$HAVE_SDL" = "xyes"; then # SDL adds just a cli UI_DIR="cli $UI_DIR" @@ -71,20 +113,44 @@ fi if test "x$HAVE_LIBGLADE" = "xyes"; then - # libglade requires SDL too - UI_DIR="gtk-glade $UI_DIR" + AC_PROVIDE_IFELSE([IT_PROG_INTLTOOL],[ + # libglade requires SDL too + UI_DIR="gtk-glade $UI_DIR" + + dnl -- localization for gtk-glade UI + GETTEXT_PACKAGE=desmume + AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Define to the gettext package name]) + AC_SUBST(GETTEXT_PACKAGE) + ALL_LINGUAS="fr" + AM_GLIB_GNU_GETTEXT + PO_DIR="po" + PO_FILES="intltool-extract intltool-merge intltool-update" + PO_FILES_IN="intltool-extract.in intltool-merge.in intltool-update.in" + PO_MAKEFILE="po/Makefile.in" + ],[ + echo "WARNING: intltool and/or gettext are not available therefore the gtk-glade interface won't be installed. The gtk-glade UI requires intltool and gettext." + ]) fi fi +dnl Set compiler library flags per target. case $target in + *linux* | *bsd*) + LIBS="$LIBS -lGL -lGLU" + ;; *mingw*) - LIBS="$LIBS -ldxguid -ldxerr8 -ldsound -mwindows" + LIBS="$LIBS -ldxguid -ldxerr8 -ldsound -lopengl32 -lws2_32 -mwindows" UI_DIR="windows" ;; + *darwin*) + LIBS="$LIBS -framework OpenGL" + ;; esac AC_SUBST(UI_DIR) - +AC_SUBST(PO_DIR) +AC_SUBST(PO_FILES) +AC_SUBST(PO_FILES_IN) dnl - Compiler warnings @@ -122,11 +188,16 @@ dnl --- Finally, output all the makefiles AC_CONFIG_FILES([Makefile + ${PO_MAKEFILE} src/Makefile src/cli/Makefile + src/cocoa/Makefile src/gtk/Makefile + src/gtk/desmume.desktop src/gtk-glade/Makefile + src/gtk-glade/desmume-glade.desktop src/windows/Makefile + src/gdbstub/Makefile autopackage/default.apspec ]) AC_OUTPUT diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/debian/changelog /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/changelog --- /tmp/bSLAZZZKhC/desmume-0.6.0/debian/changelog 2007-09-25 00:07:16.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/changelog 2007-09-25 00:07:16.000000000 -0500 @@ -1,3 +1,88 @@ +desmume (0.7.3-3ubuntu0) gutsy; urgency=low + + * Sync with debian (LP #144389) + * Modify Maintainer value to match the DebianMaintainerField + specification. + + -- Justin Dugger Mon, 24 Sep 2007 04:33:55 -0500 + +desmume (0.7.3-3) unstable; urgency=low + + * [debian/control]: Added Build-Dep on quilt. + * [debian/rules]: Apply/unapply patches using quilt. + * [debian/patches/fix-64bit-segfault.diff]: + - Fix possible segfault on 64bit CPUs (closes: #435763). + + -- Pascal Giard Sun, 09 Sep 2007 18:07:02 -0400 + +desmume (0.7.3-2) unstable; urgency=low + + * [debian/control]: + - Added Build-Dep on intltool. + + -- Pascal Giard Tue, 04 Sep 2007 18:44:56 -0400 + +desmume (0.7.3-1) unstable; urgency=low + + * [debian/rules]: + - Removed dos2unix/unix2dos calls, no longer needed (closes: #435531). + - Specified localedir to workaround intltool Makefile.in.in weird behavior. + * [debian/control]: Removed Build-Dep on tofrodos, no longer needed. + * [debian/docs]: Added README.TRANSLATION. + * [debian/dirs]: Added localization directory. + + -- Pascal Giard Mon, 03 Sep 2007 13:35:50 -0400 + +desmume (0.7.2-3) unstable; urgency=low + + [ Cyril Brulebois ] + * [debian/control]: + - Added a B-D on tofrodos, which solves the FTBFS due to a missing + `unix2dos', thanks Kartik Mistry (Closes: #435217). + + [ Reinhard Tartler ] + - Add Cyril to uploaders + - M-x whitespace-cleanup debian/rules + - don't fail when Makefile fails in clean target. Thanks to lintian for + finding this. + + -- Reinhard Tartler Mon, 03 Sep 2007 09:47:25 +0200 + +desmume (0.7.2-2) unstable; urgency=low + + * [debian/rules]: + - Fixed gnome menu entries (upstream tarball encoding problem). + - Added debian menu entries. + * [debian/menu]: + - Added debian menu entries. + + -- Pascal Giard Sun, 29 Jul 2007 23:55:59 -0400 + +desmume (0.7.2-1) unstable; urgency=low + + [ Pascal Giard ] + * Upload to unstable (closes: #405616). + * [debian/README.Debian]: + - Procedure updated reflecting previous changes. + - Clarified CVS build instructions. + * [debian/rules]: + - Removed CFLAGS="-D_REENTRANT" as it was slowing things down considerably. + - Install glade interfaces. + - Install desktop menu files. + * [debian/docs]: + - Removed empty files. + - Added AUTHORS file. + * [debian/dirs]: Added directories for glade interfaces. + * [debian/desmume-cli.1, debian/desmume-glade.1]: + Added manpages for command-line and glade binairies. + * [debian/copyright]: + - Added LGPL license note for glade-xml.c and gtk/dev-cpp/* . + + [ Reinhard Tartler ] + * Change maintainer to 'Debian Games Team' + + -- Pascal Giard Fri, 27 Jul 2007 16:27:43 -0400 + desmume (0.6.0-0ubuntu1) feisty; urgency=low * Initial release (Closes: #405616) diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/debian/control /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/control --- /tmp/bSLAZZZKhC/desmume-0.6.0/debian/control 2007-09-25 00:07:16.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/control 2007-09-25 00:07:16.000000000 -0500 @@ -1,14 +1,22 @@ Source: desmume -Section: games +Section: universe/games Priority: extra -Maintainer: Reinhard Tartler -Build-Depends: debhelper (>= 5), libglade2-dev, libgtk2.0-dev, libsdl1.2-dev +Maintainer: Ubuntu MOTU Developers +XSBC-Original-Maintainer: Debian Games Team +Uploaders: Reinhard Tartler , Pascal Giard , Cyril Brulebois +Build-Depends: debhelper (>= 5), libglade2-dev, libgtk2.0-dev, libsdl1.2-dev, libgtkglext1-dev, intltool, quilt Standards-Version: 3.7.2 Package: desmume Architecture: any Depends: ${shlibs:Depends} Description: Nintendo DS emulator - DeSmuME is a Nintendo DS emulator running homebrew demos and - commercial games. + DeSmuME is a Nintendo DS emulator running homebrew demos and commercial games. + . + This package includes all three binaries: + * desmume: gtk user interface; + * desmume-glade: gtk-glade user interface; + * desmume-cli: command line user interface. + . + Homepage: http://desmume.org diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/debian/copyright /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/copyright --- /tmp/bSLAZZZKhC/desmume-0.6.0/debian/copyright 2007-09-25 00:07:16.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/copyright 2007-09-25 00:07:16.000000000 -0500 @@ -1,68 +1,24 @@ -This package was debianized by Reinhard Tartler on -Sat, 10 Feb 2007 19:22:16 +0100. +This is the Debian GNU/Linux packaged version of DeSmuME, a is a Nintendo DS emulator. -It was downloaded from http://sourceforge.net/projects/desmume +This package was put together by Reinhard Tartler and +Pascal Giard with sources obtained from: + http://desmume.sf.net -Upstream Author: +Copyright: GNU General Public Licence, Version 2 -Copyright (C) 2006 yopyop -Copyright (C) 2006-2007 DeSmuME team + DeSmuME 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. -Team members include (taken from AUTHORs file) +Exception to this are src/gtk-glade/glade-xml.c and the files in gtk/dev-cpp/ +which are licensed under the less restrictive license LGPL. -Original author ---------------- -yopyop +On Debian systems, the complete text of the GNU General Public License +can be found in the '/usr/share/common-licenses/GPL' file. +Similarly, the complete text of the GNU Lesser General Public License +can be found in the '/usr/share/common-licenses/LGPL' file. -Current team ------------- -Allustar -amponzi -ape -delfare -Guillaume Duhamel -Normmatt -Romain Vallet -shash -Theo Berkau -thoduv -Tim Seidel (Mighty Max) -Damien Nozay (damdoum) -Pascal Giard (evilynux) - -Contributors ------------- -Anthony Molinaro - -Contact information: - -E-mail: guillaume.duhamel@gmail.com -Web: http://desmume.sourceforge.net -IRC: irc://irc.freenode.net/desmume - -Please don't ask for roms, bios files or any other -copyrighted stuff. - - -License: - - This package 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 package 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 package; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -On Debian systems, the complete text of the GNU General -Public License can be found in `/usr/share/common-licenses/GPL'. - -The Debian packaging is (C) 2007, Reinhard Tartler and -is licensed under the GPL, see above. +The original copyright owner was a French developer known as YopYop156 . +Current upstream development is being made by the DeSmuME team, see /usr/share/doc/desmume/AUTHORS. diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/debian/desmume.1 /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/desmume.1 --- /tmp/bSLAZZZKhC/desmume-0.6.0/debian/desmume.1 2007-09-25 00:07:16.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/desmume.1 2007-09-25 00:07:16.000000000 -0500 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH DESMUME SECTION "Februar 10, 2007" +.TH DESMUME 1 "June 26, 2007" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -16,30 +16,49 @@ .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME -desmume \- Emulator for Nintendo DS ROMs +desmume \- Nintendo DS emulator .SH SYNOPSIS .B desmume .RI [ options ] " files" ... -.br -.B bar -.RI [ options ] " files" ... .SH DESCRIPTION This manual page documents briefly the .B desmume -Programm +program .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. -\fBdesmume\fP emulates software for the Nintendo DS. Please note that -most software is proprietary, but there is also some homebrew software -for the DS out there. +\fBdesmume\fP is a Nintendo DS emulator running homebrew demos and commercial games. .SH OPTIONS These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For a complete description, see the Info files. .TP +.B \-\-opengl-2d +Enables using OpenGL for screen rendering +.TP +.B \-\-soft-convert +Use software colour conversion during OpenGL screen rendering. May produce better or worse frame rates depending on hardware. +.TP +.B \-\-disable-3d +Disables the 3D emulation +.TP +.B \-\-disable-sound +Disables the sound emulation +.TP +.B \-\-disable-limiter +Disables the 60 fps limiter +.TP +.B \-\-arm9gdb=PORT_NUM +Enable the ARM9 GDB stub on the given port +.TP +.B \-\-arm7gdb=PORT_NUM +Enable the ARM7 GDB stub on the given port +.TP +.B \-\-cflash=PATH_TO_DISK_IMAGE +Enable disk image GBAMP compact flash emulation +.TP .B \-h, \-\-help Show summary of options. .TP @@ -52,5 +71,4 @@ desmume was written by DeSmuME team (http://sourceforge.net/projects/desmume). .PP -This manual page was written by Reinhard Tartler , -for the Debian project (but may be used by others). +This manual page was written by Reinhard Tartler and modified by Pascal Giard , for the Debian project (but may be used by others). diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/debian/desmume-cli.1 /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/desmume-cli.1 --- /tmp/bSLAZZZKhC/desmume-0.6.0/debian/desmume-cli.1 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/desmume-cli.1 2007-09-25 00:07:16.000000000 -0500 @@ -0,0 +1,71 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH DESMUME 1 "June 26, 2007" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +desmume-cli \- Nintendo DS emulator +.SH SYNOPSIS +.B desmume-cli +.RI [ options ] " files" ... +.SH DESCRIPTION +This manual page documents briefly the +.B desmume-cli +program +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBdesmume\fP is a Nintendo DS emulator running homebrew demos and commercial games. +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +For a complete description, see the Info files. +.TP +.B \-\-opengl-2d +Enables using OpenGL for screen rendering +.TP +.B \-\-soft-convert +Use software colour conversion during OpenGL screen rendering. May produce better or worse frame rates depending on hardware. +.TP +.B \-\-disable-sound +Disables the sound emulation +.TP +.B \-\-disable-limiter +Disables the 60 fps limiter +.TP +.B \-\-arm9gdb=PORT_NUM +Enable the ARM9 GDB stub on the given port +.TP +.B \-\-arm7gdb=PORT_NUM +Enable the ARM7 GDB stub on the given port +.TP +.B \-\-cflash=PATH_TO_DISK_IMAGE +Enable disk image GBAMP compact flash emulation +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. +.SH SEE ALSO +.BR undocumented (7) +.br +.SH AUTHOR +desmume was written by DeSmuME team +(http://sourceforge.net/projects/desmume). +.PP +This manual page was written by Pascal Giard , for the Debian project (but may be used by others). diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/debian/desmume-glade.1 /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/desmume-glade.1 --- /tmp/bSLAZZZKhC/desmume-0.6.0/debian/desmume-glade.1 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/desmume-glade.1 2007-09-25 00:07:16.000000000 -0500 @@ -0,0 +1,65 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH DESMUME 1 "June 26, 2007" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +desmume-glade \- Nintendo DS emulator +.SH SYNOPSIS +.B desmume-glade +.RI [ options ] " files" ... +.SH DESCRIPTION +This manual page documents briefly the +.B desmume-glade +program +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBdesmume\fP is a Nintendo DS emulator running homebrew demos and commercial games. +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +For a complete description, see the Info files. +.TP +.B \-\-soft-convert +Use software colour conversion during OpenGL screen rendering. May produce better or worse frame rates depending on hardware. +.TP +.B \-\-disable-3d +Disables the 3D emulation +.TP +.B \-\-disable-limiter +Disables the 60 fps limiter +.TP +.B \-\-arm9gdb=PORT_NUM +Enable the ARM9 GDB stub on the given port +.TP +.B \-\-arm7gdb=PORT_NUM +Enable the ARM7 GDB stub on the given port +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. +.SH SEE ALSO +.BR undocumented (7) +.br +.SH AUTHOR +desmume was written by DeSmuME team +(http://sourceforge.net/projects/desmume). +.PP +This manual page was written by Pascal Giard , for the Debian project (but may be used by others). diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/debian/dirs /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/dirs --- /tmp/bSLAZZZKhC/desmume-0.6.0/debian/dirs 2007-09-25 00:07:16.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/dirs 2007-09-25 00:07:16.000000000 -0500 @@ -1 +1,5 @@ usr/games +usr/share/games +usr/share/locale +usr/share/pixmaps +usr/share/applications diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/debian/docs /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/docs --- /tmp/bSLAZZZKhC/desmume-0.6.0/debian/docs 2007-09-25 00:07:16.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/docs 2007-09-25 00:07:16.000000000 -0500 @@ -1,5 +1,4 @@ -NEWS README README.LIN -README.WIN -TODO +README.TRANSLATION +AUTHORS diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/debian/menu /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/menu --- /tmp/bSLAZZZKhC/desmume-0.6.0/debian/menu 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/menu 2007-09-25 00:07:16.000000000 -0500 @@ -0,0 +1,15 @@ +?package(desmume): \ + needs="X11" \ + section="Apps/Emulators" \ + title="DeSmuME (Gtk)" \ + icon="/usr/share/pixmaps/DeSmuME.xpm"\ + command="/usr/games/desmume" \ + longtitle="DeSmuME Gtk User Interface" + +?package(desmume): \ + needs="X11" \ + section="Apps/Emulators" \ + title="DeSmuME (Gtk-Glade)" \ + icon="/usr/share/pixmaps/DeSmuME.xpm"\ + command="/usr/games/desmume-glade" \ + longtitle="DeSmuME Gtk-Glade User Interface" diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/debian/patches/fix-64bit-segfault.diff /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/patches/fix-64bit-segfault.diff --- /tmp/bSLAZZZKhC/desmume-0.6.0/debian/patches/fix-64bit-segfault.diff 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/patches/fix-64bit-segfault.diff 2007-09-25 00:07:16.000000000 -0500 @@ -0,0 +1,16 @@ +Index: desmume-0.7.3/src/ROMReader.h +=================================================================== +--- desmume-0.7.3.orig/src/ROMReader.h 2007-09-09 17:59:43.000000000 -0400 ++++ desmume-0.7.3/src/ROMReader.h 2007-09-09 18:00:04.000000000 -0400 +@@ -17,6 +17,11 @@ + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + ++#ifdef HAVE_LIBZ ++#include ++#endif ++#include ++ + #include "types.h" + + #define ROMREADER_DEFAULT -1 diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/debian/patches/series /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/patches/series --- /tmp/bSLAZZZKhC/desmume-0.6.0/debian/patches/series 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/patches/series 2007-09-25 00:07:16.000000000 -0500 @@ -0,0 +1 @@ +fix-64bit-segfault.diff diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/debian/README.Debian /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/README.Debian --- /tmp/bSLAZZZKhC/desmume-0.6.0/debian/README.Debian 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/README.Debian 2007-09-25 00:07:16.000000000 -0500 @@ -0,0 +1,15 @@ +DeSmuME from CVS +---------------- +If you downloaded DeSmuME from the CVS, you may build the package by: +1) Making sure you are in DeSmuME toplevel directory (the one that contains + the configure.ac files). +2) Generating the autotools files: ./autogen.sh +3) Generating the build files: ./configure +4) Building the package: debuild -B + +If you get an error about a version mismatch: +1) Find out the current version reading the first lines of configure.ac . +2) Update the first line of debian/changelog . +3) Redo the procedure above. + + -- Pascal Giard Fri, 29 Jun 2007 05:20:22 -0400 diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/debian/rules /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/rules --- /tmp/bSLAZZZKhC/desmume-0.6.0/debian/rules 2007-09-25 00:07:16.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/debian/rules 2007-09-25 00:07:16.000000000 -0500 @@ -1,6 +1,8 @@ #!/usr/bin/make -f # -*- makefile -*- +include /usr/share/quilt/quilt.make + # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 @@ -22,21 +24,22 @@ dh_testdir ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr --mandir=\$${prefix}/share/man \ - --bindir=/usr/games \ + --bindir=/usr/games --datadir=/usr/share/games \ + --localedir=/usr/share/locale \ CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" -build: build-stamp +build: patch build-stamp build-stamp: config.status dh_testdir $(MAKE) touch $@ -clean: +clean: unpatch dh_testdir dh_testroot - rm -f build-stamp - -$(MAKE) distclean + rm -f build-stamp + [ ! -f Makefile ] || $(MAKE) distclean ifneq "$(wildcard /usr/share/misc/config.sub)" "" cp -f /usr/share/misc/config.sub config.sub @@ -44,15 +47,20 @@ ifneq "$(wildcard /usr/share/misc/config.guess)" "" cp -f /usr/share/misc/config.guess config.guess endif - dh_clean + dh_clean install: build dh_testdir dh_testroot - dh_clean -k + dh_clean -k dh_installdirs $(MAKE) DESTDIR=$(CURDIR)/debian/desmume install - + mv debian/desmume/usr/share/games/pixmaps/DeSmuME.xpm \ + debian/desmume/usr/share/pixmaps/ + rm -rf debian/desmume/usr/share/games/pixmaps + mv debian/desmume/usr/share/games/applications/desmume*.desktop \ + debian/desmume/usr/share/applications/ + rm -rf debian/desmume/usr/share/games/applications # Build architecture-independent files here. binary-indep: build install @@ -64,7 +72,9 @@ dh_testroot dh_installchangelogs ChangeLog dh_installdocs - dh_installman + dh_installmenu + dh_installman debian/desmume.1 debian/desmume-cli.1 debian/desmume-glade.1 + dh_desktop dh_link dh_strip dh_compress @@ -76,4 +86,4 @@ dh_builddeb binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install +.PHONY: build clean binary-indep binary-arch binary install diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/depcomp /tmp/4ejbOOI7Zw/desmume-0.7.3/depcomp --- /tmp/bSLAZZZKhC/desmume-0.6.0/depcomp 2006-04-06 15:41:55.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/depcomp 2007-09-03 12:31:41.000000000 -0500 @@ -1,9 +1,10 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2005-02-09.22 +scriptversion=2006-10-15.18 -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software +# Foundation, Inc. # 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 @@ -17,8 +18,8 @@ # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -91,7 +92,20 @@ ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" stat=$? if test $stat -eq 0; then : else @@ -276,6 +290,46 @@ rm -f "$tmpdepfile" ;; +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. @@ -288,13 +342,13 @@ if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a - # static library. This mecanism is used in libtool 1.4 series to + # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in in $dir.libs/$base.o.d and + # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is @@ -467,7 +521,8 @@ done "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/INSTALL /tmp/4ejbOOI7Zw/desmume-0.7.3/INSTALL --- /tmp/bSLAZZZKhC/desmume-0.6.0/INSTALL 2006-04-05 15:14:28.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/INSTALL 2007-09-03 12:31:41.000000000 -0500 @@ -0,0 +1,234 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006 Free Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + +Installation Names +================== + +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/install-sh /tmp/4ejbOOI7Zw/desmume-0.7.3/install-sh --- /tmp/bSLAZZZKhC/desmume-0.6.0/install-sh 2006-04-06 15:41:55.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/install-sh 2007-09-03 12:31:40.000000000 -0500 @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2005-02-02.21 +scriptversion=2006-10-14.15 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -39,15 +39,24 @@ # when there is no Makefile. # # This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. +# from scratch. + +nl=' +' +IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi -# put in absolute paths if you don't have them in your path; or use env. vars. +# Put in absolute file names if you don't have them in your path; +# or use environment vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" @@ -58,7 +67,13 @@ rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" -chmodcmd="$chmodprog 0755" +posix_glob= +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chmodcmd=$chmodprog chowncmd= chgrpcmd= stripcmd= @@ -95,7 +110,7 @@ CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " -while test -n "$1"; do +while test $# -ne 0; do case $1 in -c) shift continue;; @@ -111,9 +126,15 @@ --help) echo "$usage"; exit $?;; - -m) chmodcmd="$chmodprog $2" + -m) mode=$2 shift shift + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac continue;; -o) chowncmd="$chownprog $2" @@ -136,25 +157,33 @@ --version) echo "$0 $scriptversion"; exit $?;; - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done + --) shift break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; esac done -if test -z "$1"; then +if test $# -ne 0 && test -z "$dir_arg$dstarg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done +fi + +if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 @@ -164,6 +193,33 @@ exit 0 fi +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + for src do # Protect names starting with `-'. @@ -173,15 +229,11 @@ if test -n "$dir_arg"; then dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. @@ -208,53 +260,188 @@ echo "$0: $dstarg: Is a directory" >&2 exit 1 fi - dst=$dst/`basename "$src"` + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? fi fi - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` - - # Make sure that the destination directory exists. + obsolete_mkdir_used=false - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac - pathcomp= + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix=/ ;; + -*) prefix=./ ;; + *) prefix= ;; + esac + + case $posix_glob in + '') + if (set -f) 2>/dev/null; then + posix_glob=true + else + posix_glob=false + fi ;; + esac + + oIFS=$IFS + IFS=/ + $posix_glob && set -f + set fnord $dstdir shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit + $posix_glob && set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true fi - pathcomp=$pathcomp/ - done + fi fi if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else - dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ @@ -262,10 +449,9 @@ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -276,10 +462,10 @@ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not @@ -291,11 +477,12 @@ # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + if test -f "$dst"; then + $doit $rmcmd -f "$dst" 2>/dev/null \ + || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ + && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } else @@ -304,16 +491,13 @@ } && # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + $doit $mvcmd "$dsttmp" "$dst" } - } - fi || { (exit 1); exit 1; } -done + } || exit 1 -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} + trap '' 0 + fi +done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/intltool-extract.in /tmp/4ejbOOI7Zw/desmume-0.7.3/intltool-extract.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/intltool-extract.in 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/intltool-extract.in 2007-09-03 12:31:32.000000000 -0500 @@ -0,0 +1,861 @@ +#!@INTLTOOL_PERL@ -w +# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- + +# +# The Intltool Message Extractor +# +# Copyright (C) 2000-2001, 2003 Free Software Foundation. +# +# Intltool 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. +# +# Intltool 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. +# +# Authors: Kenneth Christiansen +# Darin Adler +# + +## Release information +my $PROGRAM = "intltool-extract"; +my $PACKAGE = "intltool"; +my $VERSION = "0.36.0"; + +## Loaded modules +use strict; +use File::Basename; +use Getopt::Long; + +## Scalars used by the option stuff +my $TYPE_ARG = "0"; +my $LOCAL_ARG = "0"; +my $HELP_ARG = "0"; +my $VERSION_ARG = "0"; +my $UPDATE_ARG = "0"; +my $QUIET_ARG = "0"; +my $SRCDIR_ARG = "."; + +my $FILE; +my $OUTFILE; + +my $gettext_type = ""; +my $input; +my %messages = (); +my %loc = (); +my %count = (); +my %comments = (); +my $strcount = 0; + +my $XMLCOMMENT = ""; + +## Use this instead of \w for XML files to handle more possible characters. +my $w = "[-A-Za-z0-9._:]"; + +## Always print first +$| = 1; + +## Handle options +GetOptions ( + "type=s" => \$TYPE_ARG, + "local|l" => \$LOCAL_ARG, + "help|h" => \$HELP_ARG, + "version|v" => \$VERSION_ARG, + "update" => \$UPDATE_ARG, + "quiet|q" => \$QUIET_ARG, + "srcdir=s" => \$SRCDIR_ARG, + ) or &error; + +&split_on_argument; + + +## Check for options. +## This section will check for the different options. + +sub split_on_argument { + + if ($VERSION_ARG) { + &version; + + } elsif ($HELP_ARG) { + &help; + + } elsif ($LOCAL_ARG) { + &place_local; + &extract; + + } elsif ($UPDATE_ARG) { + &place_normal; + &extract; + + } elsif (@ARGV > 0) { + &place_normal; + &message; + &extract; + + } else { + &help; + + } +} + +sub place_normal { + $FILE = $ARGV[0]; + $OUTFILE = "$FILE.h"; + + my $dirname = dirname ($OUTFILE); + if (! -d "$dirname" && $dirname ne "") { + system ("mkdir -p $dirname"); + } +} + +sub place_local { + $FILE = $ARGV[0]; + $OUTFILE = fileparse($FILE, ()); + if (!-e "tmp/") { + system("mkdir tmp/"); + } + $OUTFILE = "./tmp/$OUTFILE.h" +} + +sub determine_type { + if ($TYPE_ARG =~ /^gettext\/(.*)/) { + $gettext_type=$1 + } +} + +## Sub for printing release information +sub version{ + print <<_EOF_; +${PROGRAM} (${PACKAGE}) $VERSION +Copyright (C) 2000, 2003 Free Software Foundation, Inc. +Written by Kenneth Christiansen, 2000. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +_EOF_ + exit; +} + +## Sub for printing usage information +sub help { + print <<_EOF_; +Usage: ${PROGRAM} [OPTION]... [FILENAME] +Generates a header file from an XML source file. + +It grabs all strings between <_translatable_node> and its end tag in +XML files. Read manpage (man ${PROGRAM}) for more info. + + --type=TYPE Specify the file type of FILENAME. Currently supports: + "gettext/glade", "gettext/ini", "gettext/keys" + "gettext/rfc822deb", "gettext/schemas", + "gettext/scheme", "gettext/xml", "gettext/quoted" + -l, --local Writes output into current working directory + (conflicts with --update) + --update Writes output into the same directory the source file + reside (conflicts with --local) + --srcdir Root of the source tree + -v, --version Output version information and exit + -h, --help Display this help and exit + -q, --quiet Quiet mode + +Report bugs to http://bugzilla.gnome.org/ (product name "$PACKAGE") +or send email to . +_EOF_ + exit; +} + +## Sub for printing error messages +sub error{ + print STDERR "Try `${PROGRAM} --help' for more information.\n"; + exit; +} + +sub message { + print "Generating C format header file for translation.\n" unless $QUIET_ARG; +} + +sub extract { + &determine_type; + + &convert; + + open OUT, ">$OUTFILE"; + binmode (OUT) if $^O eq 'MSWin32'; + &msg_write; + close OUT; + + print "Wrote $OUTFILE\n" unless $QUIET_ARG; +} + +sub convert { + + ## Reading the file + { + local (*IN); + local $/; #slurp mode + open (IN, "<$SRCDIR_ARG/$FILE") || die "can't open $SRCDIR_ARG/$FILE: $!"; + $input = ; + } + + &type_ini if $gettext_type eq "ini"; + &type_keys if $gettext_type eq "keys"; + &type_xml if $gettext_type eq "xml"; + &type_glade if $gettext_type eq "glade"; + &type_scheme if $gettext_type eq "scheme"; + &type_schemas if $gettext_type eq "schemas"; + &type_rfc822deb if $gettext_type eq "rfc822deb"; + &type_quoted if $gettext_type eq "quoted"; +} + +sub entity_decode_minimal +{ + local ($_) = @_; + + s/'/'/g; # ' + s/"/"/g; # " + s/&/&/g; + + return $_; +} + +sub entity_decode +{ + local ($_) = @_; + + s/'/'/g; # ' + s/"/"/g; # " + s/<//g; + s/&/&/g; + + return $_; +} + +sub escape_char +{ + return '\"' if $_ eq '"'; + return '\n' if $_ eq "\n"; + return '\\\\' if $_ eq '\\'; + + return $_; +} + +sub escape +{ + my ($string) = @_; + return join "", map &escape_char, split //, $string; +} + +sub type_ini { + ### For generic translatable desktop files ### + while ($input =~ /^(#(.+)\n)?^_.*=(.*)$/mg) { + if (defined($2)) { + $comments{$3} = $2; + } + $messages{$3} = []; + } +} + +sub type_keys { + ### For generic translatable mime/keys files ### + while ($input =~ /^\s*_\w+=(.*)$/mg) { + $messages{$1} = []; + } +} + +sub type_xml { + ### For generic translatable XML files ### + my $tree = readXml($input); + parseTree(0, $tree); +} + +sub print_var { + my $var = shift; + my $vartype = ref $var; + + if ($vartype =~ /ARRAY/) { + my @arr = @{$var}; + print "[ "; + foreach my $el (@arr) { + print_var($el); + print ", "; + } + print "] "; + } elsif ($vartype =~ /HASH/) { + my %hash = %{$var}; + print "{ "; + foreach my $key (keys %hash) { + print "$key => "; + print_var($hash{$key}); + print ", "; + } + print "} "; + } else { + print $var; + } +} + +# Same syntax as getAttributeString in intltool-merge.in.in, similar logic (look for ## differences comment) +sub getAttributeString +{ + my $sub = shift; + my $do_translate = shift || 1; + my $language = shift || ""; + my $translate = shift; + my $result = ""; + foreach my $e (reverse(sort(keys %{ $sub }))) { + my $key = $e; + my $string = $sub->{$e}; + my $quote = '"'; + + $string =~ s/^[\s]+//; + $string =~ s/[\s]+$//; + + if ($string =~ /^'.*'$/) + { + $quote = "'"; + } + $string =~ s/^['"]//g; + $string =~ s/['"]$//g; + + ## differences from intltool-merge.in.in + if ($key =~ /^_/) { + $comments{entity_decode($string)} = $XMLCOMMENT if $XMLCOMMENT; + $messages{entity_decode($string)} = []; + $$translate = 2; + } + ## differences end here from intltool-merge.in.in + $result .= " $key=$quote$string$quote"; + } + return $result; +} + +# Verbatim copy from intltool-merge.in.in +sub getXMLstring +{ + my $ref = shift; + my $spacepreserve = shift || 0; + my @list = @{ $ref }; + my $result = ""; + + my $count = scalar(@list); + my $attrs = $list[0]; + my $index = 1; + + $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); + $spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/)); + + while ($index < $count) { + my $type = $list[$index]; + my $content = $list[$index+1]; + if (! $type ) { + # We've got CDATA + if ($content) { + # lets strip the whitespace here, and *ONLY* here + $content =~ s/\s+/ /gs if (!$spacepreserve); + $result .= $content; + } + } elsif ( "$type" ne "1" ) { + # We've got another element + $result .= "<$type"; + $result .= getAttributeString(@{$content}[0], 0); # no nested translatable elements + if ($content) { + my $subresult = getXMLstring($content, $spacepreserve); + if ($subresult) { + $result .= ">".$subresult . ""; + } else { + $result .= "/>"; + } + } else { + $result .= "/>"; + } + } + $index += 2; + } + return $result; +} + +# Verbatim copy from intltool-merge.in.in, except for MULTIPLE_OUTPUT handling removed +# Translate list of nodes if necessary +sub translate_subnodes +{ + my $fh = shift; + my $content = shift; + my $language = shift || ""; + my $singlelang = shift || 0; + my $spacepreserve = shift || 0; + + my @nodes = @{ $content }; + + my $count = scalar(@nodes); + my $index = 0; + while ($index < $count) { + my $type = $nodes[$index]; + my $rest = $nodes[$index+1]; + traverse($fh, $type, $rest, $language, $spacepreserve); + $index += 2; + } +} + +# Based on traverse() in intltool-merge.in.in +sub traverse +{ + my $fh = shift; # unused, to allow us to sync code between -merge and -extract + my $nodename = shift; + my $content = shift; + my $language = shift || ""; + my $spacepreserve = shift || 0; + + if ($nodename && "$nodename" eq "1") { + $XMLCOMMENT = $content; + } elsif ($nodename) { + # element + my @all = @{ $content }; + my $attrs = shift @all; + my $translate = 0; + my $outattr = getAttributeString($attrs, 1, $language, \$translate); + + if ($nodename =~ /^_/) { + $translate = 1; + $nodename =~ s/^_//; + } + my $lookup = ''; + + $spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/)); + $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); + + if ($translate) { + $lookup = getXMLstring($content, $spacepreserve); + if (!$spacepreserve) { + $lookup =~ s/^\s+//s; + $lookup =~ s/\s+$//s; + } + + if ($lookup && $translate != 2) { + $comments{$lookup} = $XMLCOMMENT if $XMLCOMMENT; + $messages{$lookup} = []; + } elsif ($translate == 2) { + translate_subnodes($fh, \@all, $language, 1, $spacepreserve); + } + } else { + $XMLCOMMENT = ""; + my $count = scalar(@all); + if ($count > 0) { + my $index = 0; + while ($index < $count) { + my $type = $all[$index]; + my $rest = $all[$index+1]; + traverse($fh, $type, $rest, $language, $spacepreserve); + $index += 2; + } + } + } + $XMLCOMMENT = ""; + } +} + + +# Verbatim copy from intltool-merge.in.in, $fh for compatibility +sub parseTree +{ + my $fh = shift; + my $ref = shift; + my $language = shift || ""; + + my $name = shift @{ $ref }; + my $cont = shift @{ $ref }; + + while (!$name || "$name" eq "1") { + $name = shift @{ $ref }; + $cont = shift @{ $ref }; + } + + my $spacepreserve = 0; + my $attrs = @{$cont}[0]; + $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); + + traverse($fh, $name, $cont, $language, $spacepreserve); +} + +# Verbatim copy from intltool-merge.in.in +sub intltool_tree_comment +{ + my $expat = shift; + my $data = $expat->original_string(); + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + $data =~ s/^$//s; + push @$clist, 1 => $data; +} + +# Verbatim copy from intltool-merge.in.in +sub intltool_tree_cdatastart +{ + my $expat = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + push @$clist, 0 => $expat->original_string(); +} + +# Verbatim copy from intltool-merge.in.in +sub intltool_tree_cdataend +{ + my $expat = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + $clist->[$pos] .= $expat->original_string(); +} + +# Verbatim copy from intltool-merge.in.in +sub intltool_tree_char +{ + my $expat = shift; + my $text = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + # Use original_string so that we retain escaped entities + # in CDATA sections. + # + if ($pos > 0 and $clist->[$pos - 1] eq '0') { + $clist->[$pos] .= $expat->original_string(); + } else { + push @$clist, 0 => $expat->original_string(); + } +} + +# Verbatim copy from intltool-merge.in.in +sub intltool_tree_start +{ + my $expat = shift; + my $tag = shift; + my @origlist = (); + + # Use original_string so that we retain escaped entities + # in attribute values. We must convert the string to an + # @origlist array to conform to the structure of the Tree + # Style. + # + my @original_array = split /\x/, $expat->original_string(); + my $source = $expat->original_string(); + + # Remove leading tag. + # + $source =~ s|^\s*<\s*(\S+)||s; + + # Grab attribute key/value pairs and push onto @origlist array. + # + while ($source) + { + if ($source =~ /^\s*([\w:-]+)\s*[=]\s*["]/) + { + $source =~ s|^\s*([\w:-]+)\s*[=]\s*["]([^"]*)["]||s; + push @origlist, $1; + push @origlist, '"' . $2 . '"'; + } + elsif ($source =~ /^\s*([\w:-]+)\s*[=]\s*[']/) + { + $source =~ s|^\s*([\w:-]+)\s*[=]\s*[']([^']*)[']||s; + push @origlist, $1; + push @origlist, "'" . $2 . "'"; + } + else + { + last; + } + } + + my $ol = [ { @origlist } ]; + + push @{ $expat->{Lists} }, $expat->{Curlist}; + push @{ $expat->{Curlist} }, $tag => $ol; + $expat->{Curlist} = $ol; +} + +# Copied from intltool-merge.in.in and added comment handler. +sub readXml +{ + my $xmldoc = shift || return; + my $ret = eval 'require XML::Parser'; + if(!$ret) { + die "You must have XML::Parser installed to run $0\n\n"; + } + my $xp = new XML::Parser(Style => 'Tree'); + $xp->setHandlers(Char => \&intltool_tree_char); + $xp->setHandlers(Start => \&intltool_tree_start); + $xp->setHandlers(CdataStart => \&intltool_tree_cdatastart); + $xp->setHandlers(CdataEnd => \&intltool_tree_cdataend); + + ## differences from intltool-merge.in.in + $xp->setHandlers(Comment => \&intltool_tree_comment); + ## differences end here from intltool-merge.in.in + + my $tree = $xp->parse($xmldoc); + #print_var($tree); + +# Hello thereHowdydo +# would be: +# [foo, [{}, 1, "comment", head, [{id => "a"}, 0, "Hello ", em, [{}, 0, "there"]], bar, +# [{}, 0, "Howdy", ref, [{}]], 0, "do" ] ] + + return $tree; +} + +sub type_schemas { + ### For schemas XML files ### + + # FIXME: We should handle escaped < (less than) + while ($input =~ / + \s* + (\s*(?:\s*)?(.*?)\s*<\/default>\s*)? + (\s*(?:\s*)?(.*?)\s*<\/short>\s*)? + (\s*(?:\s*)?(.*?)\s*<\/long>\s*)? + <\/locale> + /sgx) { + my @totranslate = ($3,$6,$9); + my @eachcomment = ($2,$5,$8); + foreach (@totranslate) { + my $currentcomment = shift @eachcomment; + next if !$_; + s/\s+/ /g; + $messages{entity_decode_minimal($_)} = []; + $comments{entity_decode_minimal($_)} = $currentcomment if (defined($currentcomment)); + } + } +} + +sub type_rfc822deb { + ### For rfc822-style Debian configuration files ### + + my $lineno = 1; + my $type = ''; + while ($input =~ /\G(.*?)(^|\n)(_+)([^:]+):[ \t]*(.*?)(?=\n\S|$)/sg) + { + my ($pre, $newline, $underscore, $tag, $text) = ($1, $2, $3, $4, $5); + while ($pre =~ m/\n/g) + { + $lineno ++; + } + $lineno += length($newline); + my @str_list = rfc822deb_split(length($underscore), $text); + for my $str (@str_list) + { + $strcount++; + $messages{$str} = []; + $loc{$str} = $lineno; + $count{$str} = $strcount; + my $usercomment = ''; + while($pre =~ s/(^|\n)#([^\n]*)$//s) + { + $usercomment = "\n" . $2 . $usercomment; + } + $comments{$str} = $tag . $usercomment; + } + $lineno += ($text =~ s/\n//g); + } +} + +sub rfc822deb_split { + # Debian defines a special way to deal with rfc822-style files: + # when a value contain newlines, it consists of + # 1. a short form (first line) + # 2. a long description, all lines begin with a space, + # and paragraphs are separated by a single dot on a line + # This routine returns an array of all paragraphs, and reformat + # them. + # When first argument is 2, the string is a comma separated list of + # values. + my $type = shift; + my $text = shift; + $text =~ s/^[ \t]//mg; + return (split(/, */, $text, 0)) if $type ne 1; + return ($text) if $text !~ /\n/; + + $text =~ s/([^\n]*)\n//; + my @list = ($1); + my $str = ''; + for my $line (split (/\n/, $text)) + { + chomp $line; + if ($line =~ /^\.\s*$/) + { + # New paragraph + $str =~ s/\s*$//; + push(@list, $str); + $str = ''; + } + elsif ($line =~ /^\s/) + { + # Line which must not be reformatted + $str .= "\n" if length ($str) && $str !~ /\n$/; + $line =~ s/\s+$//; + $str .= $line."\n"; + } + else + { + # Continuation line, remove newline + $str .= " " if length ($str) && $str !~ /\n$/; + $str .= $line; + } + } + $str =~ s/\s*$//; + push(@list, $str) if length ($str); + return @list; +} + +sub type_quoted { + while ($input =~ /\"(([^\"]|\\\")*[^\\\"])\"/g) { + my $message = $1; + my $before = $`; + $message =~ s/\\\"/\"/g; + $before =~ s/[^\n]//g; + $messages{$message} = []; + $loc{$message} = length ($before) + 2; + } +} + +sub type_glade { + ### For translatable Glade XML files ### + + my $tags = "label|title|text|format|copyright|comments|preview_text|tooltip|message"; + + while ($input =~ /<($tags)>([^<]+)<\/($tags)>/sg) { + # Glade sometimes uses tags that normally mark translatable things for + # little bits of non-translatable content. We work around this by not + # translating strings that only includes something like label4 or window1. + $messages{entity_decode($2)} = [] unless $2 =~ /^(window|label|dialog)[0-9]+$/; + } + + while ($input =~ /(..[^<]*)<\/items>/sg) { + for my $item (split (/\n/, $1)) { + $messages{entity_decode($item)} = []; + } + } + + ## handle new glade files + while ($input =~ /<(property|atkproperty)\s+[^>]*translatable\s*=\s*"yes"(?:\s+[^>]*comments\s*=\s*"([^"]*)")?[^>]*>([^<]+)<\/\1>/sg) { + $messages{entity_decode($3)} = [] unless $3 =~ /^(window|label)[0-9]+$/; + if (defined($2) and !($3 =~ /^(window|label)[0-9]+$/)) { + $comments{entity_decode($3)} = entity_decode($2) ; + } + } + while ($input =~ /]*)"\s+description="([^>]+)"\/>/sg) { + $messages{entity_decode_minimal($2)} = []; + } +} + +sub type_scheme { + my ($line, $i, $state, $str, $trcomment, $char); + for $line (split(/\n/, $input)) { + $i = 0; + $state = 0; # 0 - nothing, 1 - string, 2 - translatable string + while ($i < length($line)) { + if (substr($line,$i,1) eq "\"") { + if ($state == 2) { + $comments{$str} = $trcomment if ($trcomment); + $messages{$str} = []; + $str = ''; + $state = 0; $trcomment = ""; + } elsif ($state == 1) { + $str = ''; + $state = 0; $trcomment = ""; + } else { + $state = 1; + $str = ''; + if ($i>0 && substr($line,$i-1,1) eq '_') { + $state = 2; + } + } + } elsif (!$state) { + if (substr($line,$i,1) eq ";") { + $trcomment = substr($line,$i+1); + $trcomment =~ s/^;*\s*//; + $i = length($line); + } elsif ($trcomment && substr($line,$i,1) !~ /\s|\(|\)|_/) { + $trcomment = ""; + } + } else { + if (substr($line,$i,1) eq "\\") { + $char = substr($line,$i+1,1); + if ($char ne "\"" && $char ne "\\") { + $str = $str . "\\"; + } + $i++; + } + $str = $str . substr($line,$i,1); + } + $i++; + } + } +} + +sub msg_write { + my @msgids; + if (%count) + { + @msgids = sort { $count{$a} <=> $count{$b} } keys %count; + } + else + { + @msgids = sort keys %messages; + } + for my $message (@msgids) + { + my $offsetlines = 1; + $offsetlines++ if $message =~ /%/; + if (defined ($comments{$message})) + { + while ($comments{$message} =~ m/\n/g) + { + $offsetlines++; + } + } + print OUT "# ".($loc{$message} - $offsetlines). " \"$FILE\"\n" + if defined $loc{$message}; + print OUT "/* ".$comments{$message}." */\n" + if defined $comments{$message}; + print OUT "/* xgettext:no-c-format */\n" if $message =~ /%/; + + my @lines = split (/\n/, $message, -1); + for (my $n = 0; $n < @lines; $n++) + { + if ($n == 0) + { + print OUT "char *s = N_(\""; + } + else + { + print OUT " \""; + } + + print OUT escape($lines[$n]); + + if ($n < @lines - 1) + { + print OUT "\\n\"\n"; + } + else + { + print OUT "\");\n"; + } + } + } +} + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/intltool-merge.in /tmp/4ejbOOI7Zw/desmume-0.7.3/intltool-merge.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/intltool-merge.in 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/intltool-merge.in 2007-09-03 12:31:32.000000000 -0500 @@ -0,0 +1,1428 @@ +#!@INTLTOOL_PERL@ -w +# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- + +# +# The Intltool Message Merger +# +# Copyright (C) 2000, 2003 Free Software Foundation. +# Copyright (C) 2000, 2001 Eazel, Inc +# +# Intltool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# version 2 published by the Free Software Foundation. +# +# Intltool 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. +# +# Authors: Maciej Stachowiak +# Kenneth Christiansen +# Darin Adler +# +# Proper XML UTF-8'ification written by Cyrille Chepelov +# + +## Release information +my $PROGRAM = "intltool-merge"; +my $PACKAGE = "intltool"; +my $VERSION = "0.36.0"; + +## Loaded modules +use strict; +use Getopt::Long; +use Text::Wrap; +use File::Basename; + +my $must_end_tag = -1; +my $last_depth = -1; +my $translation_depth = -1; +my @tag_stack = (); +my @entered_tag = (); +my @translation_strings = (); +my $leading_space = ""; + +## Scalars used by the option stuff +my $HELP_ARG = 0; +my $VERSION_ARG = 0; +my $BA_STYLE_ARG = 0; +my $XML_STYLE_ARG = 0; +my $KEYS_STYLE_ARG = 0; +my $DESKTOP_STYLE_ARG = 0; +my $SCHEMAS_STYLE_ARG = 0; +my $RFC822DEB_STYLE_ARG = 0; +my $QUOTED_STYLE_ARG = 0; +my $QUIET_ARG = 0; +my $PASS_THROUGH_ARG = 0; +my $UTF8_ARG = 0; +my $MULTIPLE_OUTPUT = 0; +my $cache_file; + +## Handle options +GetOptions +( + "help" => \$HELP_ARG, + "version" => \$VERSION_ARG, + "quiet|q" => \$QUIET_ARG, + "oaf-style|o" => \$BA_STYLE_ARG, ## for compatibility + "ba-style|b" => \$BA_STYLE_ARG, + "xml-style|x" => \$XML_STYLE_ARG, + "keys-style|k" => \$KEYS_STYLE_ARG, + "desktop-style|d" => \$DESKTOP_STYLE_ARG, + "schemas-style|s" => \$SCHEMAS_STYLE_ARG, + "rfc822deb-style|r" => \$RFC822DEB_STYLE_ARG, + "quoted-style" => \$QUOTED_STYLE_ARG, + "pass-through|p" => \$PASS_THROUGH_ARG, + "utf8|u" => \$UTF8_ARG, + "multiple-output|m" => \$MULTIPLE_OUTPUT, + "cache|c=s" => \$cache_file + ) or &error; + +my $PO_DIR; +my $FILE; +my $OUTFILE; + +my %po_files_by_lang = (); +my %translations = (); +my $iconv = $ENV{"ICONV"} || "iconv"; +my $devnull = ($^O eq 'MSWin32' ? 'NUL:' : '/dev/null'); + +sub isProgramInPath +{ + my ($file) = @_; + # If either a file exists, or when run it returns 0 exit status + return 1 if ((-x $file) or (system("$file --version >$devnull") == 0)); + return 0; +} + +sub isGNUGettextTool +{ + my ($file) = @_; + # Check that we are using GNU gettext tools + if (isProgramInPath ($file)) { + my $version = `$file --version`; + return 1 if ($version =~ m/.*\(GNU .*\).*/); + } + return 0; +} + +if (! isGNUGettextTool ("$iconv")) +{ + print STDERR " *** GNU iconv is not found on this system!\n". + " *** Without it, intltool-merge can not convert encodings.\n"; + exit; +} + +# Use this instead of \w for XML files to handle more possible characters. +my $w = "[-A-Za-z0-9._:]"; + +# XML quoted string contents +my $q = "[^\\\"]*"; + +## Check for options. + +if ($VERSION_ARG) +{ + &print_version; +} +elsif ($HELP_ARG) +{ + &print_help; +} +elsif ($BA_STYLE_ARG && @ARGV > 2) +{ + &utf8_sanity_check; + &preparation; + &print_message; + &ba_merge_translations; + &finalize; +} +elsif ($XML_STYLE_ARG && @ARGV > 2) +{ + &utf8_sanity_check; + &preparation; + &print_message; + &xml_merge_output; + &finalize; +} +elsif ($KEYS_STYLE_ARG && @ARGV > 2) +{ + &utf8_sanity_check; + &preparation; + &print_message; + &keys_merge_translations; + &finalize; +} +elsif ($DESKTOP_STYLE_ARG && @ARGV > 2) +{ + &utf8_sanity_check; + &preparation; + &print_message; + &desktop_merge_translations; + &finalize; +} +elsif ($SCHEMAS_STYLE_ARG && @ARGV > 2) +{ + &utf8_sanity_check; + &preparation; + &print_message; + &schemas_merge_translations; + &finalize; +} +elsif ($RFC822DEB_STYLE_ARG && @ARGV > 2) +{ + &preparation; + &print_message; + &rfc822deb_merge_translations; + &finalize; +} +elsif ($QUOTED_STYLE_ARG && @ARGV > 2) +{ + &utf8_sanity_check; + &preparation; + &print_message; + "ed_merge_translations; + &finalize; +} +else +{ + &print_help; +} + +exit; + +## Sub for printing release information +sub print_version +{ + print <<_EOF_; +${PROGRAM} (${PACKAGE}) ${VERSION} +Written by Maciej Stachowiak, Darin Adler and Kenneth Christiansen. + +Copyright (C) 2000-2003 Free Software Foundation, Inc. +Copyright (C) 2000-2001 Eazel, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +_EOF_ + exit; +} + +## Sub for printing usage information +sub print_help +{ + print <<_EOF_; +Usage: ${PROGRAM} [OPTION]... PO_DIRECTORY FILENAME OUTPUT_FILE +Generates an output file that includes some localized attributes from an +untranslated source file. + +Mandatory options: (exactly one must be specified) + -b, --ba-style includes translations in the bonobo-activation style + -d, --desktop-style includes translations in the desktop style + -k, --keys-style includes translations in the keys style + -s, --schemas-style includes translations in the schemas style + -r, --rfc822deb-style includes translations in the RFC822 style + --quoted-style includes translations in the quoted string style + -x, --xml-style includes translations in the standard xml style + +Other options: + -u, --utf8 convert all strings to UTF-8 before merging + (default for everything except RFC822 style) + -p, --pass-through deprecated, does nothing and issues a warning + -m, --multiple-output output one localized file per locale, instead of + a single file containing all localized elements + -c, --cache=FILE specify cache file name + (usually \$top_builddir/po/.intltool-merge-cache) + -q, --quiet suppress most messages + --help display this help and exit + --version output version information and exit + +Report bugs to http://bugzilla.gnome.org/ (product name "$PACKAGE") +or send email to . +_EOF_ + exit; +} + + +## Sub for printing error messages +sub print_error +{ + print STDERR "Try `${PROGRAM} --help' for more information.\n"; + exit; +} + + +sub print_message +{ + print "Merging translations into $OUTFILE.\n" unless $QUIET_ARG; +} + + +sub preparation +{ + $PO_DIR = $ARGV[0]; + $FILE = $ARGV[1]; + $OUTFILE = $ARGV[2]; + + &gather_po_files; + &get_translation_database; +} + +# General-purpose code for looking up translations in .po files + +sub po_file2lang +{ + my ($tmp) = @_; + $tmp =~ s/^.*\/(.*)\.po$/$1/; + return $tmp; +} + +sub gather_po_files +{ + for my $po_file (glob "$PO_DIR/*.po") { + $po_files_by_lang{po_file2lang($po_file)} = $po_file; + } +} + +sub get_local_charset +{ + my ($encoding) = @_; + my $alias_file = $ENV{"G_CHARSET_ALIAS"} || "@INTLTOOL_LIBDIR@/charset.alias"; + + # seek character encoding aliases in charset.alias (glib) + + if (open CHARSET_ALIAS, $alias_file) + { + while () + { + next if /^\#/; + return $1 if (/^\s*([-._a-zA-Z0-9]+)\s+$encoding\b/i) + } + + close CHARSET_ALIAS; + } + + # if not found, return input string + + return $encoding; +} + +sub get_po_encoding +{ + my ($in_po_file) = @_; + my $encoding = ""; + + open IN_PO_FILE, $in_po_file or die; + while () + { + ## example: "Content-Type: text/plain; charset=ISO-8859-1\n" + if (/Content-Type\:.*charset=([-a-zA-Z0-9]+)\\n/) + { + $encoding = $1; + last; + } + } + close IN_PO_FILE; + + if (!$encoding) + { + print STDERR "Warning: no encoding found in $in_po_file. Assuming ISO-8859-1\n" unless $QUIET_ARG; + $encoding = "ISO-8859-1"; + } + + system ("$iconv -f $encoding -t UTF-8 <$devnull 2>$devnull"); + if ($?) { + $encoding = get_local_charset($encoding); + } + + return $encoding +} + +sub utf8_sanity_check +{ + print STDERR "Warning: option --pass-through has been removed.\n" if $PASS_THROUGH_ARG; + $UTF8_ARG = 1; +} + +sub get_translation_database +{ + if ($cache_file) { + &get_cached_translation_database; + } else { + &create_translation_database; + } +} + +sub get_newest_po_age +{ + my $newest_age; + + foreach my $file (values %po_files_by_lang) + { + my $file_age = -M $file; + $newest_age = $file_age if !$newest_age || $file_age < $newest_age; + } + + $newest_age = 0 if !$newest_age; + + return $newest_age; +} + +sub create_cache +{ + print "Generating and caching the translation database\n" unless $QUIET_ARG; + + &create_translation_database; + + open CACHE, ">$cache_file" || die; + print CACHE join "\x01", %translations; + close CACHE; +} + +sub load_cache +{ + print "Found cached translation database\n" unless $QUIET_ARG; + + my $contents; + open CACHE, "<$cache_file" || die; + { + local $/; + $contents = ; + } + close CACHE; + %translations = split "\x01", $contents; +} + +sub get_cached_translation_database +{ + my $cache_file_age = -M $cache_file; + if (defined $cache_file_age) + { + if ($cache_file_age <= &get_newest_po_age) + { + &load_cache; + return; + } + print "Found too-old cached translation database\n" unless $QUIET_ARG; + } + + &create_cache; +} + +sub create_translation_database +{ + for my $lang (keys %po_files_by_lang) + { + my $po_file = $po_files_by_lang{$lang}; + + if ($UTF8_ARG) + { + my $encoding = get_po_encoding ($po_file); + + if (lc $encoding eq "utf-8") + { + open PO_FILE, "<$po_file"; + } + else + { + print "NOTICE: $po_file is not in UTF-8 but $encoding, converting...\n" unless $QUIET_ARG;; + + open PO_FILE, "$iconv -f $encoding -t UTF-8 $po_file|"; + } + } + else + { + open PO_FILE, "<$po_file"; + } + + my $nextfuzzy = 0; + my $inmsgid = 0; + my $inmsgstr = 0; + my $msgid = ""; + my $msgstr = ""; + + while () + { + $nextfuzzy = 1 if /^#, fuzzy/; + + if (/^msgid "((\\.|[^\\]+)*)"/ ) + { + $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr; + $msgid = ""; + $msgstr = ""; + + if ($nextfuzzy) { + $inmsgid = 0; + } else { + $msgid = unescape_po_string($1); + $inmsgid = 1; + } + $inmsgstr = 0; + $nextfuzzy = 0; + } + + if (/^msgstr "((\\.|[^\\]+)*)"/) + { + $msgstr = unescape_po_string($1); + $inmsgstr = 1; + $inmsgid = 0; + } + + if (/^"((\\.|[^\\]+)*)"/) + { + $msgid .= unescape_po_string($1) if $inmsgid; + $msgstr .= unescape_po_string($1) if $inmsgstr; + } + } + $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr; + } +} + +sub finalize +{ +} + +sub unescape_one_sequence +{ + my ($sequence) = @_; + + return "\\" if $sequence eq "\\\\"; + return "\"" if $sequence eq "\\\""; + return "\n" if $sequence eq "\\n"; + return "\r" if $sequence eq "\\r"; + return "\t" if $sequence eq "\\t"; + return "\b" if $sequence eq "\\b"; + return "\f" if $sequence eq "\\f"; + return "\a" if $sequence eq "\\a"; + return chr(11) if $sequence eq "\\v"; # vertical tab, see ascii(7) + + return chr(hex($1)) if ($sequence =~ /\\x([0-9a-fA-F]{2})/); + return chr(oct($1)) if ($sequence =~ /\\([0-7]{3})/); + + # FIXME: Is \0 supported as well? Kenneth and Rodney don't want it, see bug #48489 + + return $sequence; +} + +sub unescape_po_string +{ + my ($string) = @_; + + $string =~ s/(\\x[0-9a-fA-F]{2}|\\[0-7]{3}|\\.)/unescape_one_sequence($1)/eg; + + return $string; +} + +sub entity_decode +{ + local ($_) = @_; + + s/'/'/g; # ' + s/"/"/g; # " + s/<//g; + s/&/&/g; + + return $_; +} + +# entity_encode: (string) +# +# Encode the given string to XML format (encode '<' etc). + +sub entity_encode +{ + my ($pre_encoded) = @_; + + my @list_of_chars = unpack ('C*', $pre_encoded); + + # with UTF-8 we only encode minimalistic + return join ('', map (&entity_encode_int_minimalist, @list_of_chars)); +} + +sub entity_encode_int_minimalist +{ + return """ if $_ == 34; + return "&" if $_ == 38; + return "'" if $_ == 39; + return "<" if $_ == 60; + return chr $_; +} + +sub entity_encoded_translation +{ + my ($lang, $string) = @_; + + my $translation = $translations{$lang, $string}; + return $string if !$translation; + return entity_encode ($translation); +} + +## XML (bonobo-activation specific) merge code + +sub ba_merge_translations +{ + my $source; + + { + local $/; # slurp mode + open INPUT, "<$FILE" or die "can't open $FILE: $!"; + $source = ; + close INPUT; + } + + open OUTPUT, ">$OUTFILE" or die "can't open $OUTFILE: $!"; + # Binmode so that selftest works ok if using a native Win32 Perl... + binmode (OUTPUT) if $^O eq 'MSWin32'; + + while ($source =~ s|^(.*?)([ \t]*<\s*$w+\s+($w+\s*=\s*"$q"\s*)+/?>)([ \t]*\n)?||s) + { + print OUTPUT $1; + + my $node = $2 . "\n"; + + my @strings = (); + $_ = $node; + while (s/(\s)_($w+\s*=\s*"($q)")/$1$2/s) { + push @strings, entity_decode($3); + } + print OUTPUT; + + my %langs; + for my $string (@strings) + { + for my $lang (keys %po_files_by_lang) + { + $langs{$lang} = 1 if $translations{$lang, $string}; + } + } + + for my $lang (sort keys %langs) + { + $_ = $node; + s/(\sname\s*=\s*)"($q)"/$1"$2-$lang"/s; + s/(\s)_($w+\s*=\s*")($q)"/$1 . $2 . entity_encoded_translation($lang, $3) . '"'/seg; + print OUTPUT; + } + } + + print OUTPUT $source; + + close OUTPUT; +} + + +## XML (non-bonobo-activation) merge code + + +# Process tag attributes +# Only parameter is a HASH containing attributes -> values mapping +sub getAttributeString +{ + my $sub = shift; + my $do_translate = shift || 0; + my $language = shift || ""; + my $result = ""; + my $translate = shift; + foreach my $e (reverse(sort(keys %{ $sub }))) { + my $key = $e; + my $string = $sub->{$e}; + my $quote = '"'; + + $string =~ s/^[\s]+//; + $string =~ s/[\s]+$//; + + if ($string =~ /^'.*'$/) + { + $quote = "'"; + } + $string =~ s/^['"]//g; + $string =~ s/['"]$//g; + + if ($do_translate && $key =~ /^_/) { + $key =~ s|^_||g; + if ($language) { + # Handle translation + my $decode_string = entity_decode($string); + my $translation = $translations{$language, $decode_string}; + if ($translation) { + $translation = entity_encode($translation); + $string = $translation; + } + $$translate = 2; + } else { + $$translate = 2 if ($translate && (!$$translate)); # watch not to "overwrite" $translate + } + } + + $result .= " $key=$quote$string$quote"; + } + return $result; +} + +# Returns a translatable string from XML node, it works on contents of every node in XML::Parser tree +sub getXMLstring +{ + my $ref = shift; + my $spacepreserve = shift || 0; + my @list = @{ $ref }; + my $result = ""; + + my $count = scalar(@list); + my $attrs = $list[0]; + my $index = 1; + + $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); + $spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/)); + + while ($index < $count) { + my $type = $list[$index]; + my $content = $list[$index+1]; + if (! $type ) { + # We've got CDATA + if ($content) { + # lets strip the whitespace here, and *ONLY* here + $content =~ s/\s+/ /gs if (!$spacepreserve); + $result .= $content; + } + } elsif ( "$type" ne "1" ) { + # We've got another element + $result .= "<$type"; + $result .= getAttributeString(@{$content}[0], 0); # no nested translatable elements + if ($content) { + my $subresult = getXMLstring($content, $spacepreserve); + if ($subresult) { + $result .= ">".$subresult . ""; + } else { + $result .= "/>"; + } + } else { + $result .= "/>"; + } + } + $index += 2; + } + return $result; +} + +# Translate list of nodes if necessary +sub translate_subnodes +{ + my $fh = shift; + my $content = shift; + my $language = shift || ""; + my $singlelang = shift || 0; + my $spacepreserve = shift || 0; + + my @nodes = @{ $content }; + + my $count = scalar(@nodes); + my $index = 0; + while ($index < $count) { + my $type = $nodes[$index]; + my $rest = $nodes[$index+1]; + if ($singlelang) { + my $oldMO = $MULTIPLE_OUTPUT; + $MULTIPLE_OUTPUT = 1; + traverse($fh, $type, $rest, $language, $spacepreserve); + $MULTIPLE_OUTPUT = $oldMO; + } else { + traverse($fh, $type, $rest, $language, $spacepreserve); + } + $index += 2; + } +} + +sub isWellFormedXmlFragment +{ + my $ret = eval 'require XML::Parser'; + if(!$ret) { + die "You must have XML::Parser installed to run $0\n\n"; + } + + my $fragment = shift; + return 0 if (!$fragment); + + $fragment = "$fragment"; + my $xp = new XML::Parser(Style => 'Tree'); + my $tree = 0; + eval { $tree = $xp->parse($fragment); }; + return $tree; +} + +sub traverse +{ + my $fh = shift; + my $nodename = shift; + my $content = shift; + my $language = shift || ""; + my $spacepreserve = shift || 0; + + if (!$nodename) { + if ($content =~ /^[\s]*$/) { + $leading_space .= $content; + } + print $fh $content; + } else { + # element + my @all = @{ $content }; + my $attrs = shift @all; + my $translate = 0; + my $outattr = getAttributeString($attrs, 1, $language, \$translate); + + if ($nodename =~ /^_/) { + $translate = 1; + $nodename =~ s/^_//; + } + my $lookup = ''; + + $spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/)); + $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); + + print $fh "<$nodename", $outattr; + if ($translate) { + $lookup = getXMLstring($content, $spacepreserve); + if (!$spacepreserve) { + $lookup =~ s/^\s+//s; + $lookup =~ s/\s+$//s; + } + + if ($lookup || $translate == 2) { + my $translation = $translations{$language, $lookup} if isWellFormedXmlFragment($translations{$language, $lookup}); + if ($MULTIPLE_OUTPUT && ($translation || $translate == 2)) { + $translation = $lookup if (!$translation); + print $fh " xml:lang=\"", $language, "\"" if $language; + print $fh ">"; + if ($translate == 2) { + translate_subnodes($fh, \@all, $language, 1, $spacepreserve); + } else { + print $fh $translation; + } + print $fh ""; + + return; # this means there will be no same translation with xml:lang="$language"... + # if we want them both, just remove this "return" + } else { + print $fh ">"; + if ($translate == 2) { + translate_subnodes($fh, \@all, $language, 1, $spacepreserve); + } else { + print $fh $lookup; + } + print $fh ""; + } + } else { + print $fh "/>"; + } + + for my $lang (sort keys %po_files_by_lang) { + if ($MULTIPLE_OUTPUT && $lang ne "$language") { + next; + } + if ($lang) { + # Handle translation + # + my $translate = 0; + my $localattrs = getAttributeString($attrs, 1, $lang, \$translate); + my $translation = $translations{$lang, $lookup} if isWellFormedXmlFragment($translations{$lang, $lookup}); + if ($translate && !$translation) { + $translation = $lookup; + } + + if ($translation || $translate) { + print $fh "\n"; + $leading_space =~ s/.*\n//g; + print $fh $leading_space; + print $fh "<", $nodename, " xml:lang=\"", $lang, "\"", $localattrs, ">"; + if ($translate == 2) { + translate_subnodes($fh, \@all, $lang, 1, $spacepreserve); + } else { + print $fh $translation; + } + print $fh ""; + } + } + } + + } else { + my $count = scalar(@all); + if ($count > 0) { + print $fh ">"; + my $index = 0; + while ($index < $count) { + my $type = $all[$index]; + my $rest = $all[$index+1]; + traverse($fh, $type, $rest, $language, $spacepreserve); + $index += 2; + } + print $fh ""; + } else { + print $fh "/>"; + } + } + } +} + +sub intltool_tree_comment +{ + my $expat = shift; + my $data = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + push @$clist, 1 => $data; +} + +sub intltool_tree_cdatastart +{ + my $expat = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + push @$clist, 0 => $expat->original_string(); +} + +sub intltool_tree_cdataend +{ + my $expat = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + $clist->[$pos] .= $expat->original_string(); +} + +sub intltool_tree_char +{ + my $expat = shift; + my $text = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + # Use original_string so that we retain escaped entities + # in CDATA sections. + # + if ($pos > 0 and $clist->[$pos - 1] eq '0') { + $clist->[$pos] .= $expat->original_string(); + } else { + push @$clist, 0 => $expat->original_string(); + } +} + +sub intltool_tree_start +{ + my $expat = shift; + my $tag = shift; + my @origlist = (); + + # Use original_string so that we retain escaped entities + # in attribute values. We must convert the string to an + # @origlist array to conform to the structure of the Tree + # Style. + # + my @original_array = split /\x/, $expat->original_string(); + my $source = $expat->original_string(); + + # Remove leading tag. + # + $source =~ s|^\s*<\s*(\S+)||s; + + # Grab attribute key/value pairs and push onto @origlist array. + # + while ($source) + { + if ($source =~ /^\s*([\w:-]+)\s*[=]\s*["]/) + { + $source =~ s|^\s*([\w:-]+)\s*[=]\s*["]([^"]*)["]||s; + push @origlist, $1; + push @origlist, '"' . $2 . '"'; + } + elsif ($source =~ /^\s*([\w:-]+)\s*[=]\s*[']/) + { + $source =~ s|^\s*([\w:-]+)\s*[=]\s*[']([^']*)[']||s; + push @origlist, $1; + push @origlist, "'" . $2 . "'"; + } + else + { + last; + } + } + + my $ol = [ { @origlist } ]; + + push @{ $expat->{Lists} }, $expat->{Curlist}; + push @{ $expat->{Curlist} }, $tag => $ol; + $expat->{Curlist} = $ol; +} + +sub readXml +{ + my $filename = shift || return; + if(!-f $filename) { + die "ERROR Cannot find filename: $filename\n"; + } + + my $ret = eval 'require XML::Parser'; + if(!$ret) { + die "You must have XML::Parser installed to run $0\n\n"; + } + my $xp = new XML::Parser(Style => 'Tree'); + $xp->setHandlers(Char => \&intltool_tree_char); + $xp->setHandlers(Start => \&intltool_tree_start); + $xp->setHandlers(CdataStart => \&intltool_tree_cdatastart); + $xp->setHandlers(CdataEnd => \&intltool_tree_cdataend); + my $tree = $xp->parsefile($filename); + +# Hello thereHowdydo +# would be: +# [foo, [{}, head, [{id => "a"}, 0, "Hello ", em, [{}, 0, "there"]], bar, [{}, +# 0, "Howdy", ref, [{}]], 0, "do" ] ] + + return $tree; +} + +sub print_header +{ + my $infile = shift; + my $fh = shift; + my $source; + + if(!-f $infile) { + die "ERROR Cannot find filename: $infile\n"; + } + + print $fh qq{\n}; + { + local $/; + open DOCINPUT, "<${FILE}" or die; + $source = ; + close DOCINPUT; + } + if ($source =~ /()/s) + { + print $fh "$1\n"; + } + elsif ($source =~ /(]*>)/s) + { + print $fh "$1\n"; + } +} + +sub parseTree +{ + my $fh = shift; + my $ref = shift; + my $language = shift || ""; + + my $name = shift @{ $ref }; + my $cont = shift @{ $ref }; + + while (!$name || "$name" eq "1") { + $name = shift @{ $ref }; + $cont = shift @{ $ref }; + } + + my $spacepreserve = 0; + my $attrs = @{$cont}[0]; + $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); + + traverse($fh, $name, $cont, $language, $spacepreserve); +} + +sub xml_merge_output +{ + my $source; + + if ($MULTIPLE_OUTPUT) { + for my $lang (sort keys %po_files_by_lang) { + if ( ! -d $lang ) { + mkdir $lang or -d $lang or die "Cannot create subdirectory $lang: $!\n"; + } + open OUTPUT, ">$lang/$OUTFILE" or die "Cannot open $lang/$OUTFILE: $!\n"; + binmode (OUTPUT) if $^O eq 'MSWin32'; + my $tree = readXml($FILE); + print_header($FILE, \*OUTPUT); + parseTree(\*OUTPUT, $tree, $lang); + close OUTPUT; + print "CREATED $lang/$OUTFILE\n" unless $QUIET_ARG; + } + } + open OUTPUT, ">$OUTFILE" or die "Cannot open $OUTFILE: $!\n"; + binmode (OUTPUT) if $^O eq 'MSWin32'; + my $tree = readXml($FILE); + print_header($FILE, \*OUTPUT); + parseTree(\*OUTPUT, $tree); + close OUTPUT; + print "CREATED $OUTFILE\n" unless $QUIET_ARG; +} + +sub keys_merge_translations +{ + open INPUT, "<${FILE}" or die; + open OUTPUT, ">${OUTFILE}" or die; + binmode (OUTPUT) if $^O eq 'MSWin32'; + + while () + { + if (s/^(\s*)_(\w+=(.*))/$1$2/) + { + my $string = $3; + + print OUTPUT; + + my $non_translated_line = $_; + + for my $lang (sort keys %po_files_by_lang) + { + my $translation = $translations{$lang, $string}; + next if !$translation; + + $_ = $non_translated_line; + s/(\w+)=.*/[$lang]$1=$translation/; + print OUTPUT; + } + } + else + { + print OUTPUT; + } + } + + close OUTPUT; + close INPUT; +} + +sub desktop_merge_translations +{ + open INPUT, "<${FILE}" or die; + open OUTPUT, ">${OUTFILE}" or die; + binmode (OUTPUT) if $^O eq 'MSWin32'; + + while () + { + if (s/^(\s*)_(\w+=(.*))/$1$2/) + { + my $string = $3; + + print OUTPUT; + + my $non_translated_line = $_; + + for my $lang (sort keys %po_files_by_lang) + { + my $translation = $translations{$lang, $string}; + next if !$translation; + + $_ = $non_translated_line; + s/(\w+)=.*/${1}[$lang]=$translation/; + print OUTPUT; + } + } + else + { + print OUTPUT; + } + } + + close OUTPUT; + close INPUT; +} + +sub schemas_merge_translations +{ + my $source; + + { + local $/; # slurp mode + open INPUT, "<$FILE" or die "can't open $FILE: $!"; + $source = ; + close INPUT; + } + + open OUTPUT, ">$OUTFILE" or die; + binmode (OUTPUT) if $^O eq 'MSWin32'; + + # FIXME: support attribute translations + + # Empty nodes never need translation, so unmark all of them. + # For example, <_foo/> is just replaced by . + $source =~ s|<\s*_($w+)\s*/>|<$1/>|g; + + while ($source =~ s/ + (.*?) + (\s+)((\s*) + (\s*(?:\s*)?(.*?)\s*<\/default>)?(\s*) + (\s*(?:\s*)?(.*?)\s*<\/short>)?(\s*) + (\s*(?:\s*)?(.*?)\s*<\/long>)?(\s*) + <\/locale>) + //sx) + { + print OUTPUT $1; + + my $locale_start_spaces = $2 ? $2 : ''; + my $default_spaces = $4 ? $4 : ''; + my $short_spaces = $7 ? $7 : ''; + my $long_spaces = $10 ? $10 : ''; + my $locale_end_spaces = $13 ? $13 : ''; + my $c_default_block = $3 ? $3 : ''; + my $default_string = $6 ? $6 : ''; + my $short_string = $9 ? $9 : ''; + my $long_string = $12 ? $12 : ''; + + print OUTPUT "$locale_start_spaces$c_default_block"; + + $default_string =~ s/\s+/ /g; + $default_string = entity_decode($default_string); + $short_string =~ s/\s+/ /g; + $short_string = entity_decode($short_string); + $long_string =~ s/\s+/ /g; + $long_string = entity_decode($long_string); + + for my $lang (sort keys %po_files_by_lang) + { + my $default_translation = $translations{$lang, $default_string}; + my $short_translation = $translations{$lang, $short_string}; + my $long_translation = $translations{$lang, $long_string}; + + next if (!$default_translation && !$short_translation && + !$long_translation); + + print OUTPUT "\n$locale_start_spaces"; + + print OUTPUT "$default_spaces"; + + if ($default_translation) + { + $default_translation = entity_encode($default_translation); + print OUTPUT "$default_translation"; + } + + print OUTPUT "$short_spaces"; + + if ($short_translation) + { + $short_translation = entity_encode($short_translation); + print OUTPUT "$short_translation"; + } + + print OUTPUT "$long_spaces"; + + if ($long_translation) + { + $long_translation = entity_encode($long_translation); + print OUTPUT "$long_translation"; + } + + print OUTPUT "$locale_end_spaces"; + } + } + + print OUTPUT $source; + + close OUTPUT; +} + +sub rfc822deb_merge_translations +{ + my %encodings = (); + for my $lang (keys %po_files_by_lang) { + $encodings{$lang} = ($UTF8_ARG ? 'UTF-8' : get_po_encoding($po_files_by_lang{$lang})); + } + + my $source; + + $Text::Wrap::huge = 'overflow'; + $Text::Wrap::break = qr/\n|\s(?=\S)/; + + { + local $/; # slurp mode + open INPUT, "<$FILE" or die "can't open $FILE: $!"; + $source = ; + close INPUT; + } + + open OUTPUT, ">${OUTFILE}" or die; + binmode (OUTPUT) if $^O eq 'MSWin32'; + + while ($source =~ /(^|\n+)(_*)([^:\s]+)(:[ \t]*)(.*?)(?=\n[\S\n]|$)/sg) + { + my $sep = $1; + my $non_translated_line = $3.$4; + my $string = $5; + my $underscore = length($2); + next if $underscore eq 0 && $non_translated_line =~ /^#/; + # Remove [] dummy strings + my $stripped = $string; + $stripped =~ s/\[\s[^\[\]]*\],/,/g if $underscore eq 2; + $stripped =~ s/\[\s[^\[\]]*\]$//; + $non_translated_line .= $stripped; + + print OUTPUT $sep.$non_translated_line; + + if ($underscore) + { + my @str_list = rfc822deb_split($underscore, $string); + + for my $lang (sort keys %po_files_by_lang) + { + my $is_translated = 1; + my $str_translated = ''; + my $first = 1; + + for my $str (@str_list) + { + my $translation = $translations{$lang, $str}; + + if (!$translation) + { + $is_translated = 0; + last; + } + + # $translation may also contain [] dummy + # strings, mostly to indicate an empty string + $translation =~ s/\[\s[^\[\]]*\]$//; + + if ($first) + { + if ($underscore eq 2) + { + $str_translated .= $translation; + } + else + { + $str_translated .= + Text::Tabs::expand($translation) . + "\n"; + } + } + else + { + if ($underscore eq 2) + { + $str_translated .= ', ' . $translation; + } + else + { + $str_translated .= Text::Tabs::expand( + Text::Wrap::wrap(' ', ' ', $translation)) . + "\n .\n"; + } + } + $first = 0; + + # To fix some problems with Text::Wrap::wrap + $str_translated =~ s/(\n )+\n/\n .\n/g; + } + next unless $is_translated; + + $str_translated =~ s/\n \.\n$//; + $str_translated =~ s/\s+$//; + + $_ = $non_translated_line; + s/^(\w+):\s*.*/$sep${1}-$lang.$encodings{$lang}: $str_translated/s; + print OUTPUT; + } + } + } + print OUTPUT "\n"; + + close OUTPUT; + close INPUT; +} + +sub rfc822deb_split +{ + # Debian defines a special way to deal with rfc822-style files: + # when a value contain newlines, it consists of + # 1. a short form (first line) + # 2. a long description, all lines begin with a space, + # and paragraphs are separated by a single dot on a line + # This routine returns an array of all paragraphs, and reformat + # them. + # When first argument is 2, the string is a comma separated list of + # values. + my $type = shift; + my $text = shift; + $text =~ s/^[ \t]//mg; + return (split(/, */, $text, 0)) if $type ne 1; + return ($text) if $text !~ /\n/; + + $text =~ s/([^\n]*)\n//; + my @list = ($1); + my $str = ''; + + for my $line (split (/\n/, $text)) + { + chomp $line; + if ($line =~ /^\.\s*$/) + { + # New paragraph + $str =~ s/\s*$//; + push(@list, $str); + $str = ''; + } + elsif ($line =~ /^\s/) + { + # Line which must not be reformatted + $str .= "\n" if length ($str) && $str !~ /\n$/; + $line =~ s/\s+$//; + $str .= $line."\n"; + } + else + { + # Continuation line, remove newline + $str .= " " if length ($str) && $str !~ /\n$/; + $str .= $line; + } + } + + $str =~ s/\s*$//; + push(@list, $str) if length ($str); + + return @list; +} + +sub quoted_translation +{ + my ($lang, $string) = @_; + + $string =~ s/\\\"/\"/g; + + my $translation = $translations{$lang, $string}; + $translation = $string if !$translation; + + $translation =~ s/\"/\\\"/g; + return $translation +} + +sub quoted_merge_translations +{ + if (!$MULTIPLE_OUTPUT) { + print "Quoted only supports Multiple Output.\n"; + exit(1); + } + + for my $lang (sort keys %po_files_by_lang) { + if ( ! -d $lang ) { + mkdir $lang or -d $lang or die "Cannot create subdirectory $lang: $!\n"; + } + open INPUT, "<${FILE}" or die; + open OUTPUT, ">$lang/$OUTFILE" or die "Cannot open $lang/$OUTFILE: $!\n"; + binmode (OUTPUT) if $^O eq 'MSWin32'; + while () + { + s/\"(([^\"]|\\\")*[^\\\"])\"/"\"" . "ed_translation($lang, $1) . "\""/ge; + print OUTPUT; + } + close OUTPUT; + close INPUT; + } +} diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/intltool-update.in /tmp/4ejbOOI7Zw/desmume-0.7.3/intltool-update.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/intltool-update.in 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/intltool-update.in 2007-09-03 12:31:32.000000000 -0500 @@ -0,0 +1,1164 @@ +#!@INTLTOOL_PERL@ -w +# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- + +# +# The Intltool Message Updater +# +# Copyright (C) 2000-2003 Free Software Foundation. +# +# Intltool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# version 2 published by the Free Software Foundation. +# +# Intltool 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. +# +# Authors: Kenneth Christiansen +# Maciej Stachowiak +# Darin Adler + +## Release information +my $PROGRAM = "intltool-update"; +my $VERSION = "0.36.0"; +my $PACKAGE = "intltool"; + +## Loaded modules +use strict; +use Getopt::Long; +use Cwd; +use File::Copy; +use File::Find; + +## Scalars used by the option stuff +my $HELP_ARG = 0; +my $VERSION_ARG = 0; +my $DIST_ARG = 0; +my $POT_ARG = 0; +my $HEADERS_ARG = 0; +my $MAINTAIN_ARG = 0; +my $REPORT_ARG = 0; +my $VERBOSE = 0; +my $GETTEXT_PACKAGE = ""; +my $OUTPUT_FILE = ""; + +my @languages; +my %varhash = (); +my %po_files_by_lang = (); + +# Regular expressions to categorize file types. +# FIXME: Please check if the following is correct + +my $xml_support = +"xml(?:\\.in)*|". # http://www.w3.org/XML/ (Note: .in is not required) +"ui|". # Bonobo specific - User Interface desc. files +"lang|". # ? +"glade2?(?:\\.in)*|". # Glade specific - User Interface desc. files (Note: .in is not required) +"scm(?:\\.in)*|". # ? (Note: .in is not required) +"oaf(?:\\.in)+|". # DEPRECATED: Replaces by Bonobo .server files +"etspec|". # ? +"server(?:\\.in)+|". # Bonobo specific +"sheet(?:\\.in)+|". # ? +"schemas(?:\\.in)+|". # GConf specific +"pong(?:\\.in)+|". # DEPRECATED: PONG is not used [by GNOME] any longer. +"kbd(?:\\.in)+|". # GOK specific. +"policy(?:\\.in)+"; # PolicyKit files + +my $ini_support = +"icon(?:\\.in)+|". # http://www.freedesktop.org/Standards/icon-theme-spec +"desktop(?:\\.in)+|". # http://www.freedesktop.org/Standards/menu-spec +"caves(?:\\.in)+|". # GNOME Games specific +"directory(?:\\.in)+|". # http://www.freedesktop.org/Standards/menu-spec +"soundlist(?:\\.in)+|". # GNOME specific +"keys(?:\\.in)+|". # GNOME Mime database specific +"theme(?:\\.in)+|". # http://www.freedesktop.org/Standards/icon-theme-spec +"service(?:\\.in)+"; # DBus specific + +my $buildin_gettext_support = +"c|y|cs|cc|cpp|c\\+\\+|h|hh|gob|py"; + +## Always flush buffer when printing +$| = 1; + +## Sometimes the source tree will be rooted somewhere else. +my $SRCDIR = $ENV{"srcdir"} || "."; +my $POTFILES_in; + +$POTFILES_in = "<$SRCDIR/POTFILES.in"; + +my $devnull = ($^O eq 'MSWin32' ? 'NUL:' : '/dev/null'); + +## Handle options +GetOptions +( + "help" => \$HELP_ARG, + "version" => \$VERSION_ARG, + "dist|d" => \$DIST_ARG, + "pot|p" => \$POT_ARG, + "headers|s" => \$HEADERS_ARG, + "maintain|m" => \$MAINTAIN_ARG, + "report|r" => \$REPORT_ARG, + "verbose|x" => \$VERBOSE, + "gettext-package|g=s" => \$GETTEXT_PACKAGE, + "output-file|o=s" => \$OUTPUT_FILE, + ) or &Console_WriteError_InvalidOption; + +&Console_Write_IntltoolHelp if $HELP_ARG; +&Console_Write_IntltoolVersion if $VERSION_ARG; + +my $arg_count = ($DIST_ARG > 0) + + ($POT_ARG > 0) + + ($HEADERS_ARG > 0) + + ($MAINTAIN_ARG > 0) + + ($REPORT_ARG > 0); + +&Console_Write_IntltoolHelp if $arg_count > 1; + +my $PKGNAME = FindPackageName (); + +# --version and --help don't require a module name +my $MODULE = $GETTEXT_PACKAGE || $PKGNAME || "unknown"; + +if ($POT_ARG) +{ + &GenerateHeaders; + &GeneratePOTemplate; +} +elsif ($HEADERS_ARG) +{ + &GenerateHeaders; +} +elsif ($MAINTAIN_ARG) +{ + &FindLeftoutFiles; +} +elsif ($REPORT_ARG) +{ + &GenerateHeaders; + &GeneratePOTemplate; + &Console_Write_CoverageReport; +} +elsif ((defined $ARGV[0]) && $ARGV[0] =~ /^[a-z]/) +{ + my $lang = $ARGV[0]; + + ## Report error if the language file supplied + ## to the command line is non-existent + &Console_WriteError_NotExisting("$SRCDIR/$lang.po") + if ! -s "$SRCDIR/$lang.po"; + + if (!$DIST_ARG) + { + print "Working, please wait..." if $VERBOSE; + &GenerateHeaders; + &GeneratePOTemplate; + } + &POFile_Update ($lang, $OUTPUT_FILE); + &Console_Write_TranslationStatus ($lang, $OUTPUT_FILE); +} +else +{ + &Console_Write_IntltoolHelp; +} + +exit; + +######### + +sub Console_Write_IntltoolVersion +{ + print <<_EOF_; +${PROGRAM} (${PACKAGE}) $VERSION +Written by Kenneth Christiansen, Maciej Stachowiak, and Darin Adler. + +Copyright (C) 2000-2003 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +_EOF_ + exit; +} + +sub Console_Write_IntltoolHelp +{ + print <<_EOF_; +Usage: ${PROGRAM} [OPTION]... LANGCODE +Updates PO template files and merge them with the translations. + +Mode of operation (only one is allowed): + -p, --pot generate the PO template only + -s, --headers generate the header files in POTFILES.in + -m, --maintain search for left out files from POTFILES.in + -r, --report display a status report for the module + -d, --dist merge LANGCODE.po with existing PO template + +Extra options: + -g, --gettext-package=NAME override PO template name, useful with --pot + -o, --output-file=FILE write merged translation to FILE + -x, --verbose display lots of feedback + --help display this help and exit + --version output version information and exit + +Examples of use: +${PROGRAM} --pot just create a new PO template +${PROGRAM} xy create new PO template and merge xy.po with it + +Report bugs to http://bugzilla.gnome.org/ (product name "$PACKAGE") +or send email to . +_EOF_ + exit; +} + +sub echo_n +{ + my $str = shift; + my $ret = `echo "$str"`; + + $ret =~ s/\n$//; # do we need the "s" flag? + + return $ret; +} + +sub POFile_DetermineType ($) +{ + my $type = $_; + my $gettext_type; + + my $xml_regex = "(?:" . $xml_support . ")"; + my $ini_regex = "(?:" . $ini_support . ")"; + my $buildin_regex = "(?:" . $buildin_gettext_support . ")"; + + if ($type =~ /\[type: gettext\/([^\]].*)]/) + { + $gettext_type=$1; + } + elsif ($type =~ /schemas(\.in)+$/) + { + $gettext_type="schemas"; + } + elsif ($type =~ /glade2?(\.in)*$/) + { + $gettext_type="glade"; + } + elsif ($type =~ /scm(\.in)*$/) + { + $gettext_type="scheme"; + } + elsif ($type =~ /keys(\.in)+$/) + { + $gettext_type="keys"; + } + + # bucket types + + elsif ($type =~ /$xml_regex$/) + { + $gettext_type="xml"; + } + elsif ($type =~ /$ini_regex$/) + { + $gettext_type="ini"; + } + elsif ($type =~ /$buildin_regex$/) + { + $gettext_type="buildin"; + } + else + { + $gettext_type="unknown"; + } + + return "gettext\/$gettext_type"; +} + +sub TextFile_DetermineEncoding ($) +{ + my $gettext_code="ASCII"; # All files are ASCII by default + my $filetype=`file $_ | cut -d ' ' -f 2`; + + if ($? eq "0") + { + if ($filetype =~ /^(ISO|UTF)/) + { + chomp ($gettext_code = $filetype); + } + elsif ($filetype =~ /^XML/) + { + $gettext_code="UTF-8"; # We asume that .glade and other .xml files are UTF-8 + } + } + + return $gettext_code; +} + +sub isNotValidMissing +{ + my ($file) = @_; + + return if $file =~ /^\{arch\}\/.*$/; + return if $file =~ /^$varhash{"PACKAGE"}-$varhash{"VERSION"}\/.*$/; +} + +sub FindLeftoutFiles +{ + my (@buf_i18n_plain, + @buf_i18n_xml, + @buf_i18n_xml_unmarked, + @buf_i18n_ini, + @buf_potfiles, + @buf_potfiles_ignore, + @buf_allfiles, + @buf_allfiles_sorted, + @buf_potfiles_sorted, + @buf_potfiles_ignore_sorted + ); + + ## Search and find all translatable files + find sub { + push @buf_i18n_plain, "$File::Find::name" if /\.($buildin_gettext_support)$/; + push @buf_i18n_xml, "$File::Find::name" if /\.($xml_support)$/; + push @buf_i18n_ini, "$File::Find::name" if /\.($ini_support)$/; + push @buf_i18n_xml_unmarked, "$File::Find::name" if /\.(schemas(\.in)+)$/; + }, ".."; + find sub { + push @buf_i18n_plain, "$File::Find::name" if /\.($buildin_gettext_support)$/; + push @buf_i18n_xml, "$File::Find::name" if /\.($xml_support)$/; + push @buf_i18n_ini, "$File::Find::name" if /\.($ini_support)$/; + push @buf_i18n_xml_unmarked, "$File::Find::name" if /\.(schemas(\.in)+)$/; + }, "$SRCDIR/.."; + + open POTFILES, $POTFILES_in or die "$PROGRAM: there's no POTFILES.in!\n"; + @buf_potfiles = grep !/^(#|\s*$)/, ; + close POTFILES; + + foreach (@buf_potfiles) { + s/^\[.*]\s*//; + } + + print "Searching for missing translatable files...\n" if $VERBOSE; + + ## Check if we should ignore some found files, when + ## comparing with POTFILES.in + foreach my $ignore ("POTFILES.skip", "POTFILES.ignore") + { + (-s "$SRCDIR/$ignore") or next; + + if ("$ignore" eq "POTFILES.ignore") + { + print "The usage of POTFILES.ignore is deprecated. Please consider moving the\n". + "content of this file to POTFILES.skip.\n"; + } + + print "Found $ignore: Ignoring files...\n" if $VERBOSE; + open FILE, "<$SRCDIR/$ignore" or die "ERROR: Failed to open $SRCDIR/$ignore!\n"; + + while () + { + push @buf_potfiles_ignore, $_ unless /^(#|\s*$)/; + } + close FILE; + + @buf_potfiles_ignore_sorted = sort (@buf_potfiles_ignore); + } + + foreach my $file (@buf_i18n_plain) + { + my $in_comment = 0; + my $in_macro = 0; + + open FILE, "<$file"; + while () + { + # Handle continued multi-line comment. + if ($in_comment) + { + next unless s-.*\*/--; + $in_comment = 0; + } + + # Handle continued macro. + if ($in_macro) + { + $in_macro = 0 unless /\\$/; + next; + } + + # Handle start of macro (or any preprocessor directive). + if (/^\s*\#/) + { + $in_macro = 1 if /^([^\\]|\\.)*\\$/; + next; + } + + # Handle comments and quoted text. + while (m-(/\*|//|\'|\")-) # \' and \" keep emacs perl mode happy + { + my $match = $1; + if ($match eq "/*") + { + if (!s-/\*.*?\*/--) + { + s-/\*.*--; + $in_comment = 1; + } + } + elsif ($match eq "//") + { + s-//.*--; + } + else # ' or " + { + if (!s-$match([^\\]|\\.)*?$match-QUOTEDTEXT-) + { + warn "mismatched quotes at line $. in $file\n"; + s-$match.*--; + } + } + } + + if (/\w\.GetString *\(QUOTEDTEXT/) + { + if (defined isNotValidMissing (unpack("x3 A*", $file))) { + ## Remove the first 3 chars and add newline + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + } + last; + } + + ## N_ Q_ and _ are the three macros defined in gi8n.h + if (/[NQ]?_ *\(QUOTEDTEXT/) + { + if (defined isNotValidMissing (unpack("x3 A*", $file))) { + ## Remove the first 3 chars and add newline + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + } + last; + } + } + close FILE; + } + + foreach my $file (@buf_i18n_xml) + { + open FILE, "<$file"; + + while () + { + # FIXME: share the pattern matching code with intltool-extract + if (/\s_[-A-Za-z0-9._:]+\s*=\s*\"([^"]+)\"/ || /<_[^>]+>/ || /translatable=\"yes\"/) + { + if (defined isNotValidMissing (unpack("x3 A*", $file))) { + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + } + last; + } + } + close FILE; + } + + foreach my $file (@buf_i18n_ini) + { + open FILE, "<$file"; + while () + { + if (/_(.*)=/) + { + if (defined isNotValidMissing (unpack("x3 A*", $file))) { + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + } + last; + } + } + close FILE; + } + + foreach my $file (@buf_i18n_xml_unmarked) + { + if (defined isNotValidMissing (unpack("x3 A*", $file))) { + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + } + } + + + @buf_allfiles_sorted = sort (@buf_allfiles); + @buf_potfiles_sorted = sort (@buf_potfiles); + + my %in2; + foreach (@buf_potfiles_sorted) + { + s#^$SRCDIR/../##; + s#^$SRCDIR/##; + $in2{$_} = 1; + } + + foreach (@buf_potfiles_ignore_sorted) + { + s#^$SRCDIR/../##; + s#^$SRCDIR/##; + $in2{$_} = 1; + } + + my @result; + + foreach (@buf_allfiles_sorted) + { + my $dummy = $_; + my $srcdir = $SRCDIR; + + $srcdir =~ s#^../##; + $dummy =~ s#^$srcdir/../##; + $dummy =~ s#^$srcdir/##; + $dummy =~ s#_build/##; + if (!exists($in2{$dummy})) + { + push @result, $dummy + } + } + + my @buf_potfiles_notexist; + + foreach (@buf_potfiles_sorted) + { + chomp (my $dummy = $_); + if ("$dummy" ne "" and !(-f "$SRCDIR/../$dummy" or -f "../$dummy")) + { + push @buf_potfiles_notexist, $_; + } + } + + ## Save file with information about the files missing + ## if any, and give information about this procedure. + if (@result + @buf_potfiles_notexist > 0) + { + if (@result) + { + print "\n" if $VERBOSE; + unlink "missing"; + open OUT, ">missing"; + print OUT @result; + close OUT; + warn "\e[1mThe following files contain translations and are currently not in use. Please\e[0m\n". + "\e[1mconsider adding these to the POTFILES.in file, located in the po/ directory.\e[0m\n\n"; + print STDERR @result, "\n"; + warn "If some of these files are left out on purpose then please add them to\n". + "POTFILES.skip instead of POTFILES.in. A file \e[1m'missing'\e[0m containing this list\n". + "of left out files has been written in the current directory.\n"; + } + if (@buf_potfiles_notexist) + { + unlink "notexist"; + open OUT, ">notexist"; + print OUT @buf_potfiles_notexist; + close OUT; + warn "\n" if ($VERBOSE or @result); + warn "\e[1mThe following files do not exist anymore:\e[0m\n\n"; + warn @buf_potfiles_notexist, "\n"; + warn "Please remove them from POTFILES.in. A file \e[1m'notexist'\e[0m\n". + "containing this list of absent files has been written in the current directory.\n"; + } + } + + ## If there is nothing to complain about, notify the user + else { + print "\nAll files containing translations are present in POTFILES.in.\n" if $VERBOSE; + } +} + +sub Console_WriteError_InvalidOption +{ + ## Handle invalid arguments + print STDERR "Try `${PROGRAM} --help' for more information.\n"; + exit 1; +} + +sub isProgramInPath +{ + my ($file) = @_; + # If either a file exists, or when run it returns 0 exit status + return 1 if ((-x $file) or (system("$file --version >$devnull") == 0)); + return 0; +} + +sub isGNUGettextTool +{ + my ($file) = @_; + # Check that we are using GNU gettext tools + if (isProgramInPath ($file)) + { + my $version = `$file --version`; + return 1 if ($version =~ m/.*\(GNU .*\).*/); + } + return 0; +} + +sub GenerateHeaders +{ + my $EXTRACT = $ENV{"INTLTOOL_EXTRACT"} || "intltool-extract"; + + ## Generate the .h header files, so we can allow glade and + ## xml translation support + if (! isProgramInPath ("$EXTRACT")) + { + print STDERR "\n *** The intltool-extract script wasn't found!" + ."\n *** Without it, intltool-update can not generate files.\n"; + exit; + } + else + { + open (FILE, $POTFILES_in) or die "$PROGRAM: POTFILES.in not found.\n"; + + while () + { + chomp; + next if /^\[\s*encoding/; + + ## Find xml files in POTFILES.in and generate the + ## files with help from the extract script + + my $gettext_type= &POFile_DetermineType ($1); + + if (/\.($xml_support|$ini_support)$/ || /^\[/) + { + s/^\[[^\[].*]\s*//; + + my $filename = "../$_"; + + if ($VERBOSE) + { + system ($EXTRACT, "--update", "--srcdir=$SRCDIR", + "--type=$gettext_type", $filename); + } + else + { + system ($EXTRACT, "--update", "--type=$gettext_type", + "--srcdir=$SRCDIR", "--quiet", $filename); + } + } + } + close FILE; + } +} + +# +# Generate .pot file from POTFILES.in +# +sub GeneratePOTemplate +{ + my $XGETTEXT = $ENV{"XGETTEXT"} || "xgettext"; + my $XGETTEXT_ARGS = $ENV{"XGETTEXT_ARGS"} || ''; + chomp $XGETTEXT; + + if (! isGNUGettextTool ("$XGETTEXT")) + { + print STDERR " *** GNU xgettext is not found on this system!\n". + " *** Without it, intltool-update can not extract strings.\n"; + exit; + } + + print "Building $MODULE.pot...\n" if $VERBOSE; + + open INFILE, $POTFILES_in; + unlink "POTFILES.in.temp"; + open OUTFILE, ">POTFILES.in.temp" or die("Cannot open POTFILES.in.temp for writing"); + + my $gettext_support_nonascii = 0; + + # checks for GNU gettext >= 0.12 + my $dummy = `$XGETTEXT --version --from-code=UTF-8 >$devnull 2>$devnull`; + if ($? == 0) + { + $gettext_support_nonascii = 1; + } + else + { + # urge everybody to upgrade gettext + print STDERR "WARNING: This version of gettext does not support extracting non-ASCII\n". + " strings. That means you should install a version of gettext\n". + " that supports non-ASCII strings (such as GNU gettext >= 0.12),\n". + " or have to let non-ASCII strings untranslated. (If there is any)\n"; + } + + my $encoding = "ASCII"; + my $forced_gettext_code; + my @temp_headers; + my $encoding_problem_is_reported = 0; + + while () + { + next if (/^#/ or /^\s*$/); + + chomp; + + my $gettext_code; + + if (/^\[\s*encoding:\s*(.*)\s*\]/) + { + $forced_gettext_code=$1; + } + elsif (/\.($xml_support|$ini_support)$/ || /^\[/) + { + s/^\[.*]\s*//; + print OUTFILE "../$_.h\n"; + push @temp_headers, "../$_.h"; + $gettext_code = &TextFile_DetermineEncoding ("../$_.h") if ($gettext_support_nonascii and not defined $forced_gettext_code); + } + else + { + print OUTFILE "$SRCDIR/../$_\n"; + $gettext_code = &TextFile_DetermineEncoding ("$SRCDIR/../$_") if ($gettext_support_nonascii and not defined $forced_gettext_code); + } + + next if (! $gettext_support_nonascii); + + if (defined $forced_gettext_code) + { + $encoding=$forced_gettext_code; + } + elsif (defined $gettext_code and "$encoding" ne "$gettext_code") + { + if ($encoding eq "ASCII") + { + $encoding=$gettext_code; + } + elsif ($gettext_code ne "ASCII") + { + # Only report once because the message is quite long + if (! $encoding_problem_is_reported) + { + print STDERR "WARNING: You should use the same file encoding for all your project files,\n". + " but $PROGRAM thinks that most of the source files are in\n". + " $encoding encoding, while \"$_\" is (likely) in\n". + " $gettext_code encoding. If you are sure that all translatable strings\n". + " are in same encoding (say UTF-8), please \e[1m*prepend*\e[0m the following\n". + " line to POTFILES.in:\n\n". + " [encoding: UTF-8]\n\n". + " and make sure that configure.in/ac checks for $PACKAGE >= 0.27 .\n". + "(such warning message will only be reported once.)\n"; + $encoding_problem_is_reported = 1; + } + } + } + } + + close OUTFILE; + close INFILE; + + unlink "$MODULE.pot"; + my @xgettext_argument=("$XGETTEXT", + "--add-comments", + "--directory\=.", + "--default-domain\=$MODULE", + "--flag\=g_strdup_printf:1:c-format", + "--flag\=g_string_printf:2:c-format", + "--flag\=g_string_append_printf:2:c-format", + "--flag\=g_error_new:3:c-format", + "--flag\=g_set_error:4:c-format", + "--flag\=g_markup_printf_escaped:1:c-format", + "--flag\=g_log:3:c-format", + "--flag\=g_print:1:c-format", + "--flag\=g_printerr:1:c-format", + "--flag\=g_printf:1:c-format", + "--flag\=g_fprintf:2:c-format", + "--flag\=g_sprintf:2:c-format", + "--flag\=g_snprintf:3:c-format", + "--flag\=g_scanner_error:2:c-format", + "--flag\=g_scanner_warn:2:c-format", + "--output\=$MODULE\.pot", + "--files-from\=\.\/POTFILES\.in\.temp"); + my $XGETTEXT_KEYWORDS = &FindPOTKeywords; + push @xgettext_argument, $XGETTEXT_KEYWORDS; + my $MSGID_BUGS_ADDRESS = &FindMakevarsBugAddress; + push @xgettext_argument, "--msgid-bugs-address\=$MSGID_BUGS_ADDRESS" if $MSGID_BUGS_ADDRESS; + push @xgettext_argument, "--from-code\=$encoding" if ($gettext_support_nonascii); + push @xgettext_argument, $XGETTEXT_ARGS if $XGETTEXT_ARGS; + my $xgettext_command = join ' ', @xgettext_argument; + + # intercept xgettext error message + print "Running $xgettext_command\n" if $VERBOSE; + my $xgettext_error_msg = `$xgettext_command 2>\&1`; + my $command_failed = $?; + + unlink "POTFILES.in.temp"; + + print "Removing generated header (.h) files..." if $VERBOSE; + unlink foreach (@temp_headers); + print "done.\n" if $VERBOSE; + + if (! $command_failed) + { + if (! -e "$MODULE.pot") + { + print "None of the files in POTFILES.in contain strings marked for translation.\n" if $VERBOSE; + } + else + { + print "Wrote $MODULE.pot\n" if $VERBOSE; + } + } + else + { + if ($xgettext_error_msg =~ /--from-code/) + { + # replace non-ASCII error message with a more useful one. + print STDERR "ERROR: xgettext failed to generate PO template file because there is non-ASCII\n". + " string marked for translation. Please make sure that all strings marked\n". + " for translation are in uniform encoding (say UTF-8), then \e[1m*prepend*\e[0m the\n". + " following line to POTFILES.in and rerun $PROGRAM:\n\n". + " [encoding: UTF-8]\n\n"; + } + else + { + print STDERR "$xgettext_error_msg"; + if (-e "$MODULE.pot") + { + # is this possible? + print STDERR "ERROR: xgettext failed but still managed to generate PO template file.\n". + " Please consult error message above if there is any.\n"; + } + else + { + print STDERR "ERROR: xgettext failed to generate PO template file. Please consult\n". + " error message above if there is any.\n"; + } + } + exit (1); + } +} + +sub POFile_Update +{ + -f "$MODULE.pot" or die "$PROGRAM: $MODULE.pot does not exist.\n"; + + my $MSGMERGE = $ENV{"MSGMERGE"} || "msgmerge"; + my ($lang, $outfile) = @_; + + if (! isGNUGettextTool ("$MSGMERGE")) + { + print STDERR " *** GNU msgmerge is not found on this system!\n". + " *** Without it, intltool-update can not extract strings.\n"; + exit; + } + + print "Merging $SRCDIR/$lang.po with $MODULE.pot..." if $VERBOSE; + + my $infile = "$SRCDIR/$lang.po"; + $outfile = "$SRCDIR/$lang.po" if ($outfile eq ""); + + # I think msgmerge won't overwrite old file if merge is not successful + system ("$MSGMERGE", "-o", $outfile, $infile, "$MODULE.pot"); +} + +sub Console_WriteError_NotExisting +{ + my ($file) = @_; + + ## Report error if supplied language file is non-existing + print STDERR "$PROGRAM: $file does not exist!\n"; + print STDERR "Try '$PROGRAM --help' for more information.\n"; + exit; +} + +sub GatherPOFiles +{ + my @po_files = glob ("./*.po"); + + @languages = map (&POFile_GetLanguage, @po_files); + + foreach my $lang (@languages) + { + $po_files_by_lang{$lang} = shift (@po_files); + } +} + +sub POFile_GetLanguage ($) +{ + s/^(.*\/)?(.+)\.po$/$2/; + return $_; +} + +sub Console_Write_TranslationStatus +{ + my ($lang, $output_file) = @_; + my $MSGFMT = $ENV{"MSGFMT"} || "msgfmt"; + + if (! isGNUGettextTool ("$MSGFMT")) + { + print STDERR " *** GNU msgfmt is not found on this system!\n". + " *** Without it, intltool-update can not extract strings.\n"; + exit; + } + + $output_file = "$SRCDIR/$lang.po" if ($output_file eq ""); + + system ("$MSGFMT", "-o", "$devnull", "--verbose", $output_file); +} + +sub Console_Write_CoverageReport +{ + my $MSGFMT = $ENV{"MSGFMT"} || "msgfmt"; + + if (! isGNUGettextTool ("$MSGFMT")) + { + print STDERR " *** GNU msgfmt is not found on this system!\n". + " *** Without it, intltool-update can not extract strings.\n"; + exit; + } + + &GatherPOFiles; + + foreach my $lang (@languages) + { + print "$lang: "; + &POFile_Update ($lang, ""); + } + + print "\n\n * Current translation support in $MODULE \n\n"; + + foreach my $lang (@languages) + { + print "$lang: "; + system ("$MSGFMT", "-o", "$devnull", "--verbose", "$SRCDIR/$lang.po"); + } +} + +sub SubstituteVariable +{ + my ($str) = @_; + + # always need to rewind file whenever it has been accessed + seek (CONF, 0, 0); + + # cache each variable. varhash is global to we can add + # variables elsewhere. + while () + { + if (/^(\w+)=(.*)$/) + { + ($varhash{$1} = $2) =~ s/^["'](.*)["']$/$1/; + } + } + + if ($str =~ /^(.*)\${?([A-Z_]+)}?(.*)$/) + { + my $rest = $3; + my $untouched = $1; + my $sub = ""; + # Ignore recursive definitions of variables + $sub = $varhash{$2} if defined $varhash{$2} and $varhash{$2} !~ /\${?$2}?/; + + return SubstituteVariable ("$untouched$sub$rest"); + } + + # We're using Perl backticks ` and "echo -n" here in order to + # expand any shell escapes (such as backticks themselves) in every variable + return echo_n ($str); +} + +sub CONF_Handle_Open +{ + my $base_dirname = getcwd(); + $base_dirname =~ s@.*/@@; + + my ($conf_in, $src_dir); + + if ($base_dirname =~ /^po(-.+)?$/) + { + if (-f "Makevars") + { + my $makefile_source; + + local (*IN); + open (IN, ") + { + if (/^top_builddir[ \t]*=/) + { + $src_dir = $_; + $src_dir =~ s/^top_builddir[ \t]*=[ \t]*([^ \t\n\r]*)/$1/; + + chomp $src_dir; + if (-f "$src_dir" . "/configure.ac") { + $conf_in = "$src_dir" . "/configure.ac" . "\n"; + } else { + $conf_in = "$src_dir" . "/configure.in" . "\n"; + } + last; + } + } + close IN; + + $conf_in || die "Cannot find top_builddir in Makevars."; + } + elsif (-f "$SRCDIR/../configure.ac") + { + $conf_in = "$SRCDIR/../configure.ac"; + } + elsif (-f "$SRCDIR/../configure.in") + { + $conf_in = "$SRCDIR/../configure.in"; + } + else + { + my $makefile_source; + + local (*IN); + open (IN, ") + { + if (/^top_srcdir[ \t]*=/) + { + $src_dir = $_; + $src_dir =~ s/^top_srcdir[ \t]*=[ \t]*([^ \t\n\r]*)/$1/; + + chomp $src_dir; + $conf_in = "$src_dir" . "/configure.in" . "\n"; + + last; + } + } + close IN; + + $conf_in || die "Cannot find top_srcdir in Makefile."; + } + + open (CONF, "<$conf_in"); + } + else + { + print STDERR "$PROGRAM: Unable to proceed.\n" . + "Make sure to run this script inside the po directory.\n"; + exit; + } +} + +sub FindPackageName +{ + my $version; + my $domain = &FindMakevarsDomain; + my $name = $domain || "untitled"; + + &CONF_Handle_Open; + + my $conf_source; { + local (*IN); + open (IN, "<&CONF") || return $name; + seek (IN, 0, 0); + local $/; # slurp mode + $conf_source = ; + close IN; + } + + # priority for getting package name: + # 1. GETTEXT_PACKAGE + # 2. first argument of AC_INIT (with >= 2 arguments) + # 3. first argument of AM_INIT_AUTOMAKE (with >= 2 argument) + + # /^AM_INIT_AUTOMAKE\([\s\[]*([^,\)\s\]]+)/m + # the \s makes this not work, why? + if ($conf_source =~ /^AM_INIT_AUTOMAKE\(([^,\)]+),([^,\)]+)/m) + { + ($name, $version) = ($1, $2); + $name =~ s/[\[\]\s]//g; + $version =~ s/[\[\]\s]//g; + $varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\${?AC_PACKAGE_NAME}?/); + $varhash{"PACKAGE"} = $name if (not $name =~ /\${?PACKAGE}?/); + $varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\${?AC_PACKAGE_VERSION}?/); + $varhash{"VERSION"} = $version if (not $name =~ /\${?VERSION}?/); + } + + if ($conf_source =~ /^AC_INIT\(([^,\)]+),([^,\)]+)/m) + { + ($name, $version) = ($1, $2); + $name =~ s/[\[\]\s]//g; + $version =~ s/[\[\]\s]//g; + $varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\${?AC_PACKAGE_NAME}?/); + $varhash{"PACKAGE"} = $name if (not $name =~ /\${?PACKAGE}?/); + $varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\${?AC_PACKAGE_VERSION}?/); + $varhash{"VERSION"} = $version if (not $name =~ /\${?VERSION}?/); + } + + # \s makes this not work, why? + $name = $1 if $conf_source =~ /^GETTEXT_PACKAGE=\[?([^\n\]]+)/m; + + # m4 macros AC_PACKAGE_NAME, AC_PACKAGE_VERSION etc. have same value + # as corresponding $PACKAGE_NAME, $PACKAGE_VERSION etc. shell variables. + $name =~ s/\bAC_PACKAGE_/\$PACKAGE_/g; + + $name = $domain if $domain; + + $name = SubstituteVariable ($name); + $name =~ s/^["'](.*)["']$/$1/; + + return $name if $name; +} + + +sub FindPOTKeywords +{ + + my $keywords = "--keyword\=\_ --keyword\=N\_ --keyword\=U\_ --keyword\=Q\_"; + my $varname = "XGETTEXT_OPTIONS"; + my $make_source; { + local (*IN); + open (IN, "; + close IN; + } + + $keywords = $1 if $make_source =~ /^$varname[ ]*=\[?([^\n\]]+)/m; + + return $keywords; +} + +sub FindMakevarsDomain +{ + + my $domain = ""; + my $makevars_source; { + local (*IN); + open (IN, "; + close IN; + } + + $domain = $1 if $makevars_source =~ /^DOMAIN[ ]*=\[?([^\n\]\$]+)/m; + $domain =~ s/^\s+//; + $domain =~ s/\s+$//; + + return $domain; +} + +sub FindMakevarsBugAddress +{ + + my $address = ""; + my $makevars_source; { + local (*IN); + open (IN, "; + close IN; + } + + $address = $1 if $makevars_source =~ /^MSGID_BUGS_ADDRESS[ ]*=\[?([^\n\]\$]+)/m; + $address =~ s/^\s+//; + $address =~ s/\s+$//; + + return $address; +} diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/Makefile.am /tmp/4ejbOOI7Zw/desmume-0.7.3/Makefile.am --- /tmp/bSLAZZZKhC/desmume-0.6.0/Makefile.am 2007-02-04 15:35:50.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/Makefile.am 2007-08-11 18:45:06.000000000 -0500 @@ -1,2 +1,5 @@ -EXTRA_DIST = README.LIN README.WIN autogen.sh -SUBDIRS = src +EXTRA_DIST = README.LIN README.MAC README.WIN README.TRANSLATION autogen.sh \ + $(PO_FILES_IN) +DISTCLEANFILES = $(PO_FILES) +SUBDIRS = $(PO_DIR) src + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/Makefile.in /tmp/4ejbOOI7Zw/desmume-0.7.3/Makefile.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/Makefile.in 2007-02-04 15:35:50.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/Makefile.in 2007-09-03 12:31:41.000000000 -0500 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,15 +13,11 @@ # PARTICULAR PURPOSE. @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -36,29 +32,32 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ +subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in \ $(top_srcdir)/autopackage/default.apspec.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ TODO compile config.guess config.sub depcomp install-sh \ - missing mkinstalldirs -subdir = . + missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno configure.status.lineno -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = autopackage/default.apspec SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) @@ -74,22 +73,21 @@ distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ +ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ @@ -97,14 +95,48 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLADEUI_UNINSTALLED_DIR = @GLADEUI_UNINSTALLED_DIR@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ GREP = @GREP@ +GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ +GTHREAD_LIBS = @GTHREAD_LIBS@ +GTKGLEXT_CFLAGS = @GTKGLEXT_CFLAGS@ +GTKGLEXT_LIBS = @GTKGLEXT_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ HAVE_PKG = @HAVE_PKG@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ +INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ +INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ +INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ +INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ +INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ +INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ +INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ +INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ +INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ +INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ +INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ +INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ +INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ +INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ LDFLAGS = @LDFLAGS@ LIBGLADE_CFLAGS = @LIBGLADE_CFLAGS@ LIBGLADE_LIBS = @LIBGLADE_LIBS@ @@ -112,9 +144,11 @@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -124,6 +158,13 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_DIR = @PO_DIR@ +PO_FILES = @PO_FILES@ +PO_FILES_IN = @PO_FILES_IN@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RANLIB = @RANLIB@ SDLCONFIG = @SDLCONFIG@ SDL_CFLAGS = @SDL_CFLAGS@ @@ -133,13 +174,14 @@ STRIP = @STRIP@ UI_DIR = @UI_DIR@ USE_MAINTAINER_MODE = @USE_MAINTAINER_MODE@ +USE_NLS = @USE_NLS@ VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -151,6 +193,7 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ desmume_arch = @desmume_arch@ @@ -179,14 +222,20 @@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -EXTRA_DIST = README.LIN README.WIN autogen.sh -SUBDIRS = src +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = README.LIN README.MAC README.WIN README.TRANSLATION autogen.sh \ + $(PO_FILES_IN) + +DISTCLEANFILES = $(PO_FILES) +SUBDIRS = $(PO_DIR) src all: all-recursive .SUFFIXES: @@ -225,7 +274,6 @@ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) autopackage/default.apspec: $(top_builddir)/config.status $(top_srcdir)/autopackage/default.apspec.in cd $(top_builddir) && $(SHELL) ./config.status $@ -uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -258,8 +306,7 @@ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: +$(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ @@ -361,24 +408,22 @@ distdir: $(DISTFILES) $(am__remove_distdir) - mkdir $(distdir) - $(mkdir_p) $(distdir)/autopackage - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + test -d $(distdir) || mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -392,7 +437,7 @@ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ @@ -400,6 +445,8 @@ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ distdir) \ || exit 1; \ fi; \ @@ -407,7 +454,7 @@ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz @@ -482,7 +529,7 @@ $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ @@ -526,6 +573,7 @@ distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -551,12 +599,20 @@ install-data-am: +install-dvi: install-dvi-recursive + install-exec-am: +install-html: install-html-recursive + install-info: install-info-recursive install-man: +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + installcheck-am: maintainer-clean: maintainer-clean-recursive @@ -577,23 +633,25 @@ ps-am: -uninstall-am: uninstall-info-am +uninstall-am: -uninstall-info: uninstall-info-recursive +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ - check-am clean clean-generic clean-recursive ctags \ - ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ - dist-tarZ dist-zip distcheck distclean distclean-generic \ - distclean-recursive distclean-tags distcleancheck distdir \ +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-generic distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am uninstall-info-am + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-recursive uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/missing /tmp/4ejbOOI7Zw/desmume-0.7.3/missing --- /tmp/bSLAZZZKhC/desmume-0.6.0/missing 2006-04-06 15:41:55.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/missing 2007-09-03 12:31:40.000000000 -0500 @@ -1,9 +1,9 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2005-02-08.22 +scriptversion=2006-05-10.23 -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. @@ -19,8 +19,8 @@ # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -33,6 +33,8 @@ fi run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. @@ -44,7 +46,7 @@ msg="missing on your system" -case "$1" in +case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= @@ -77,6 +79,7 @@ aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c @@ -106,7 +109,7 @@ # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). -case "$1" in +case $1 in lex|yacc) # Not GNU programs, they don't have --version. ;; @@ -135,7 +138,7 @@ # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. -case "$1" in +case $1 in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if @@ -164,7 +167,7 @@ test -z "$files" && files="config.h" touch_files= for f in $files; do - case "$f" in + case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; @@ -192,8 +195,8 @@ You can get \`$1' as part of \`Autoconf' from any GNU archive site." - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else @@ -214,25 +217,25 @@ in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then + if test $# -ne 1; then eval LASTARG="\${$#}" - case "$LASTARG" in + case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi - if [ ! -f y.tab.h ]; then + if test ! -f y.tab.h; then echo >y.tab.h fi - if [ ! -f y.tab.c ]; then + if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; @@ -244,18 +247,18 @@ in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c - if [ $# -ne 1 ]; then + if test $# -ne 1; then eval LASTARG="\${$#}" - case "$LASTARG" in + case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi - if [ ! -f lex.yy.c ]; then + if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; @@ -267,11 +270,9 @@ \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then touch $file else test -z "$file" || exec >$file @@ -289,14 +290,23 @@ DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 touch $file ;; @@ -314,13 +324,13 @@ fi firstarg="$1" if shift; then - case "$firstarg" in + case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac - case "$firstarg" in + case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/mkinstalldirs /tmp/4ejbOOI7Zw/desmume-0.7.3/mkinstalldirs --- /tmp/bSLAZZZKhC/desmume-0.6.0/mkinstalldirs 2006-04-06 15:41:55.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/mkinstalldirs 1969-12-31 18:00:00.000000000 -0600 @@ -1,99 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -errstatus=0 -dirmode="" - -usage="\ -Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." - -# process command line arguments -while test $# -gt 0 ; do - case "${1}" in - -h | --help | --h* ) # -h for help - echo "${usage}" 1>&2; exit 0 ;; - -m ) # -m PERM arg - shift - test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } - dirmode="${1}" - shift ;; - -- ) shift; break ;; # stop option processing - -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option - * ) break ;; # first non-opt arg - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in -0) exit 0 ;; -esac - -case $dirmode in -'') - if mkdir -p -- . 2>/dev/null; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - fi ;; -*) - if mkdir -m "$dirmode" -p -- . 2>/dev/null; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - fi ;; -esac - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 3 -# End: -# mkinstalldirs ends here diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/po/fr.po /tmp/4ejbOOI7Zw/desmume-0.7.3/po/fr.po --- /tmp/bSLAZZZKhC/desmume-0.6.0/po/fr.po 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/po/fr.po 2007-07-17 19:13:19.000000000 -0500 @@ -0,0 +1,592 @@ +# French translation for the desmume-glade UI. +# Copyright (C) 2007 The DeSmuME Team. +# Pascal Giard , 2007. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2007-07-17 01:38-0400\n" +"PO-Revision-Date: 2007-07-17 05:27-0400\n" +"Last-Translator: Pascal Giard \n" +"Language-Team: DeSmuME Team \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Creating the selection window +#: ../src/gtk-glade/callbacks.c:91 +msgid "Open..." +msgstr "Ouvrir..." + +#: ../src/gtk-glade/callbacks.c:100 +msgid "Nds binary (.nds)" +msgstr "Binaire NDS (.nds)" + +#: ../src/gtk-glade/callbacks.c:101 +msgid "Nds binary with loader (.ds.gba)" +msgstr "Binaire NDS avec lanceur (.ds.gba)" + +#: ../src/gtk-glade/callbacks.c:102 +msgid "All files" +msgstr "Tous les fichiers" + +#: ../src/gtk-glade/callbacks.c:117 ../src/gtk-glade/main.c:532 +#, c-format +msgid "" +"Unable to load :\n" +"%s" +msgstr "" +"Impossible de charger:\n" +"%s" + +#: ../src/gtk-glade/callbacks.c:291 +msgid "You don't have any joystick!" +msgstr "Aucune manette de jeu n'est connectée!" + +#: ../src/gtk-glade/callbacks.c:293 +msgid "Can't configure joystick while the game is running!" +msgstr "Vous ne pouvez pas configurer la manette de jeux pendant l'exécution du jeu!" + +#: ../src/gtk-glade/gdk_3Demu.c:64 +#, c-format +msgid "*** Cannot get %s attribute value\n" +msgstr "*** Impossible d'obtenir la valeur de l'attribut %s\n" + +#: ../src/gtk-glade/gdk_3Demu.c:158 +msgid "*** Failed to create pixmap.\n" +msgstr "*** Échec lors de la création du pixmap.\n" + +#: ../src/gtk-glade/gdk_3Demu.c:168 +msgid "*** No appropriate OpenGL-capable visual found.\n" +msgstr "*** Aucun affichage supportant OpenGL n'est détecté.\n" + +#: ../src/gtk-glade/gdk_3Demu.c:181 +msgid "Failed to create the GdkGLPixmap\n" +msgstr "Échec lors de la création du GdkGLPixmap\n" + +#: ../src/gtk-glade/gdk_3Demu.c:191 +msgid "Connot create the OpenGL rendering context\n" +msgstr "Impossible de créer le contexte d'affichage OpenGL\n" + +#: ../src/gtk-glade/glade-xml.c:113 +#, c-format +msgid "could not find signal handler '%s'." +msgstr "impossible de trouver la fonction associé au signal '%s'." + +#: ../src/gtk-glade/main.c:106 +#, c-format +msgid "USAGE: %s [OPTIONS] [nds-file]\n" +msgstr "UTILISATION: %s [OPTIONS] [fichier-nds]\n" + +#: ../src/gtk-glade/main.c:107 +msgid "OPTIONS:\n" +msgstr "OPTIONS:\n" + +#: ../src/gtk-glade/main.c:109 +msgid "" +" --soft-convert Use software colour conversion during OpenGL\n" +" screen rendering. May produce better or worse\n" +" frame rates depending on hardware.\n" +" \n" +" --disable-3d Disables the 3D emulation\n" +"\n" +msgstr "" +" --soft-convert Utiliser la conversion logiciel des couleurs lors de\n" +" l'affichage OpenGL. Peut améliorer ou détériorer les\n" +" performances dépendamment de la carte vidéo.\n" +"\n" +" --disable-3d Désactiver l'émulation 3D.\n" +"\n" + +#: ../src/gtk-glade/main.c:116 +msgid "" +" --disable-limiter Disables the 60 fps limiter\n" +" \n" +" --fwlang=LANG Set the language in the firmware, LANG as follows:\n" +" 0 = Japanese\n" +" 1 = English\n" +" 2 = French\n" +" 3 = German\n" +" 4 = Italian\n" +" 5 = Spanish\n" +"\n" +" --arm9gdb=PORT_NUM Enable the ARM9 GDB stub on the given port\n" +" --arm7gdb=PORT_NUM Enable the ARM7 GDB stub on the given port\n" +" \n" +" --help Display this message\n" +msgstr "" +" --disable-limiter Désactiver la limitation de 60 images/seconde.\n" +" \n" +" --fwlang=LANG Configurer la langue du firmware où LANG est:\n" +" 0 = Japanais\n" +" 1 = Anglais\n" +" 2 = Français\n" +" 3 = Allemand\n" +" 4 = Italien\n" +" 5 = Espagnol\n" +"\n" +" --arm9gdb=PORT_NUM Activer le stub GDB du ARM9 sur le port PORT_NUM.\n" +" --arm7gdb=PORT_NUM Activer le stub GDB du ARM7 sur le port PORT_NUM.\n" +" \n" +" --help Afficher ce message d'aide.\n" + +#: ../src/gtk-glade/main.c:149 +msgid "Firmware language must be set to a value from 0 to 5.\n" +msgstr "La langue du firmware doit être une valeur entre 0 et 5.\n" + +#: ../src/gtk-glade/main.c:161 +msgid "ARM9 GDB stub port must be in the range 1 to 65535\n" +msgstr "Le numéro de port du stub GDB du ARM9 doit être entre 1 et 65535\n" + +#: ../src/gtk-glade/main.c:173 +msgid "ARM7 GDB stub port must be in the range 1 to 65535\n" +msgstr "Le numéro de port du stub GDB du ARM7 doit être entre 1 et 65535\n" + +#: ../src/gtk-glade/main.c:185 +#, c-format +msgid "NDS file (\"%s\") already set\n" +msgstr "Fichier NDS (\"%s\") déjà configuré\n" + +#: ../src/gtk-glade/main.c:198 +#, fuzzy, c-format +msgid "USAGE: %s [options] [nds-file]\n" +msgstr "UTILISATION: %s [OPTIONS] [fichier-nds]\n" + +#: ../src/gtk-glade/main.c:199 +#, c-format +msgid "USAGE: %s --help - for help\n" +msgstr "UTILISATION: %s --help - pour l'aide\n" + +#: ../src/gtk-glade/main.c:332 +#, c-format +msgid "State %d (empty)" +msgstr "État %d (vide)" + +#: ../src/gtk-glade/main.c:459 +#, c-format +msgid "Failed to create ARM9 gdbstub on port %d\n" +msgstr "" + +#: ../src/gtk-glade/main.c:470 +#, c-format +msgid "Failed to create ARM7 gdbstub on port %d\n" +msgstr "" + +#: ../src/gtk-glade/main.c:479 +#, c-format +msgid "Error trying to initialize SDL: %s\n" +msgstr "" + +#: ../src/gtk-glade/main.c:551 +#, c-format +msgid "Failed to initialise openGL 3D emulation; removing 3D support\n" +msgstr "" + +#: ../src/gtk-glade/main.c:557 +#, c-format +msgid "Failed to setup openGL 3D emulation; removing 3D support\n" +msgstr "" + +#: ../src/gtk-glade/main.c:584 +#, c-format +msgid "Error trying to start FPS limiter timer: %s\n" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:1 +msgid "0" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:2 +msgid "1" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:3 +msgid "1x" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:4 +msgid "2" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:5 +msgid "2x" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:6 +msgid "3" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:7 +msgid "3D operation detected" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:8 +msgid "3D rom" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:9 +msgid "3x" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:10 +msgid "4" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:11 +msgid "5" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:12 +msgid "6" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:13 +msgid "7" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:14 +msgid "8" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:15 +msgid "9" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:16 +msgid "?" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:17 +msgid "A : " +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:18 +msgid "Audio On" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:19 +msgid "Axis :" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:20 +msgid "B : " +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:21 +msgid "BG0" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:22 +msgid "BG1" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:23 +msgid "BG2" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:24 +msgid "BG3" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:25 +msgid "Boost : " +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:26 +msgid "Config" +msgstr "_Config." + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:27 +msgid "DeSmuME" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:28 +msgid "DeSmuMe" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:29 +msgid "Debug : " +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:30 +msgid "Down : " +msgstr "Bas: " + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:31 +msgid "FrameSkip" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:32 +msgid "IO regs" +msgstr "Registres d'E/S" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:33 +msgid "Joystick Config" +msgstr "Configuration de la manette de jeu" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:34 +msgid "Joystick controls" +msgstr "Manette de jeu" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:35 +msgid "Key definition" +msgstr "Valeur de la touche" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:36 +msgid "Keyboard Config" +msgstr "Configuration du clavier" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:37 +msgid "Keyboard controls" +msgstr "Clavier" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:38 +msgid "L : " +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:39 +msgid "Layers" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:40 +msgid "Left : " +msgstr "Gaucher: " + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:41 +msgid "Load State" +msgstr "Chargement d'un état" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:42 +msgid "Nintendo DS emulator based on work by Yopyop" +msgstr "Émulateur de Nintendo DS basé sur le travail de Yopyop" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:43 +msgid "OBJ" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:44 +msgid "Press a button..." +msgstr "Appuyez sur un bouton..." + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:45 +msgid "Press a key..." +msgstr "Appuyez sur une touche..." + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:46 +msgid "R : " +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:47 +msgid "Reset" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:48 +msgid "Right : " +msgstr "Droite: " + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:49 +msgid "Right Screen" +msgstr "Écran à droite" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:50 +msgid "Rotate Screen 0" +msgstr "Rotation de l'écran 0" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:51 +msgid "Rotate Screen 180" +msgstr "Rotation de l'écran 180" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:52 +msgid "Rotate Screen 270" +msgstr "Rotation de l'écran 270" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:53 +msgid "Rotate Screen 90" +msgstr "Rotation de l'écran 90" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:54 +msgid "Save State" +msgstr "Sauvegarder l'état" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:55 +msgid "Select : " +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:56 +msgid "Size" +msgstr "Taille" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:57 +msgid "Start : " +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:58 +msgid "State 1" +msgstr "État 1" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:59 +msgid "State 10" +msgstr "État 10" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:60 +msgid "State 2" +msgstr "État 2" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:61 +msgid "State 3" +msgstr "État 3" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:62 +msgid "State 4" +msgstr "État 4" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:63 +msgid "State 5" +msgstr "État 5" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:64 +msgid "State 6" +msgstr "État 6" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:65 +msgid "State 7" +msgstr "État 7" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:66 +msgid "State 8" +msgstr "État 8" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:67 +msgid "State 9" +msgstr "État 9" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:68 +msgid "TYPE: Auto (1B)" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:69 +msgid "TYPE: EEPROM1 (4kB)" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:70 +msgid "TYPE: EEPROM2 (512kB)" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:71 +msgid "TYPE: EEPROM2 (64kB)" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:72 +msgid "TYPE: FLASH (256kB)" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:73 +msgid "TYPE: FRAM (2MB)" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:74 +msgid "Tools" +msgstr "Outils" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:75 +msgid "True Gap" +msgstr "Espace entre les écrans" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:76 +msgid "Up : " +msgstr "Haut: " + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:77 +msgid "View Memory" +msgstr "Afficher la mémoire" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:78 +msgid "View Palette" +msgstr "Afficher la palette de couleur" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:79 +msgid "View Tiles" +msgstr "Afficher les tuiles" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:80 +msgid "X : " +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:81 +msgid "Y : " +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:82 +msgid "_Emulation" +msgstr "_Émul." + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:83 +msgid "_File" +msgstr "_Fichier" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:84 +msgid "_PrintScreen" +msgstr "_Capture d'écran" + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:85 +msgid "_Saves" +msgstr "_Sauv." + +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:86 +msgid "http://desmume.sf.net" +msgstr "" + +#. TRANSLATORS: Replace this string with your names, one name per line. +#: ../src/gtk-glade/glade/DeSmuMe.glade.h:88 +msgid "translator-credits" +msgstr "fr: Pascal Giard" + +#: ../src/gtk-glade/glade/DeSmuMe_Dtools.glade.h:1 +msgid " GoTo: " +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe_Dtools.glade.h:2 +msgid " Palette : " +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe_Dtools.glade.h:3 +msgid "16 bit" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe_Dtools.glade.h:4 +msgid "16c" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe_Dtools.glade.h:5 +msgid "256c" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe_Dtools.glade.h:6 +msgid "32 bit" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe_Dtools.glade.h:7 +msgid "8 bit" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe_Dtools.glade.h:8 +msgid "" +"ARM9 cpu\n" +"ARM7 cpu" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe_Dtools.glade.h:10 +msgid "BMP" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe_Dtools.glade.h:11 +msgid "Go!" +msgstr "" + +#: ../src/gtk-glade/glade/DeSmuMe_Dtools.glade.h:12 +msgid "" +"cpu : ARM9\n" +"cpu : ARM7" +msgstr "" diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/po/LINGUAS /tmp/4ejbOOI7Zw/desmume-0.7.3/po/LINGUAS --- /tmp/bSLAZZZKhC/desmume-0.6.0/po/LINGUAS 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/po/LINGUAS 2007-07-15 17:21:11.000000000 -0500 @@ -0,0 +1 @@ +fr diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/po/Makefile.in.in /tmp/4ejbOOI7Zw/desmume-0.7.3/po/Makefile.in.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/po/Makefile.in.in 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/po/Makefile.in.in 2007-09-03 12:31:32.000000000 -0500 @@ -0,0 +1,218 @@ +# Makefile for program source directory in GNU NLS utilities package. +# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper +# +# This file file be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. +# +# - Modified by Owen Taylor to use GETTEXT_PACKAGE +# instead of PACKAGE and to look for po2tbl in ./ not in intl/ +# +# - Modified by jacob berkman to install +# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize +# +# - Modified by Rodney Dawes for use with intltool +# +# We have the following line for use by intltoolize: +# INTLTOOL_MAKEFILE + +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SHELL = /bin/sh + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = @top_builddir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datadir = @datadir@ +datarootdir = @datarootdir@ +libdir = @libdir@ +DATADIRNAME = @DATADIRNAME@ +itlocaledir = $(prefix)/$(DATADIRNAME)/locale +subdir = po +install_sh = @install_sh@ +# Automake >= 1.8 provides @mkdir_p@. +# Until it can be supposed, use the safe fallback: +mkdir_p = $(install_sh) -d + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +GMSGFMT = @GMSGFMT@ +MSGFMT = @MSGFMT@ +XGETTEXT = @XGETTEXT@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist +GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot + +ALL_LINGUAS = @ALL_LINGUAS@ + +PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; fi) + +USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep ^$$lang$$ $(srcdir)/LINGUAS`" -o -n "`echo $$ALINGUAS|grep ' ?$$lang ?'`"; then printf "$$lang "; fi; done; fi) + +USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done) + +POFILES=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done) + +DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(POFILES) +EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS + +POTFILES = \ +# This comment gets stripped out + +CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done) + +.SUFFIXES: +.SUFFIXES: .po .pox .gmo .mo .msg .cat + +.po.pox: + $(MAKE) $(GETTEXT_PACKAGE).pot + $(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox + +.po.mo: + $(MSGFMT) -o $@ $< + +.po.gmo: + file=`echo $* | sed 's,.*/,,'`.gmo \ + && rm -f $$file && $(GMSGFMT) -o $$file $< + +.po.cat: + sed -f ../intl/po2msg.sed < $< > $*.msg \ + && rm -f $@ && gencat $@ $*.msg + + +all: all-@USE_NLS@ + +all-yes: $(CATALOGS) +all-no: + +$(GETTEXT_PACKAGE).pot: $(POTFILES) + $(GENPOT) + +install: install-data +install-data: install-data-@USE_NLS@ +install-data-no: all +install-data-yes: all + $(mkdir_p) $(DESTDIR)$(itlocaledir) + linguas="$(USE_LINGUAS)"; \ + for lang in $$linguas; do \ + dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $$dir; \ + if test -r $$lang.gmo; then \ + $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \ + echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \ + else \ + $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \ + echo "installing $(srcdir)/$$lang.gmo as" \ + "$$dir/$(GETTEXT_PACKAGE).mo"; \ + fi; \ + if test -r $$lang.gmo.m; then \ + $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \ + echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \ + else \ + if test -r $(srcdir)/$$lang.gmo.m ; then \ + $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \ + $$dir/$(GETTEXT_PACKAGE).mo.m; \ + echo "installing $(srcdir)/$$lang.gmo.m as" \ + "$$dir/$(GETTEXT_PACKAGE).mo.m"; \ + else \ + true; \ + fi; \ + fi; \ + done + +# Empty stubs to satisfy archaic automake needs +dvi info tags TAGS ID: + +# Define this as empty until I found a useful application. +install-exec installcheck: + +uninstall: + linguas="$(USE_LINGUAS)"; \ + for lang in $$linguas; do \ + rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \ + rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \ + done + +check: all $(GETTEXT_PACKAGE).pot + rm -f missing notexist + srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m + if [ -r missing -o -r notexist ]; then \ + exit 1; \ + fi + +mostlyclean: + rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp + rm -f .intltool-merge-cache + +clean: mostlyclean + +distclean: clean + rm -f Makefile Makefile.in POTFILES stamp-it + rm -f *.mo *.msg *.cat *.cat.m *.gmo + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f Makefile.in.in + +distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: $(DISTFILES) + dists="$(DISTFILES)"; \ + extra_dists="$(EXTRA_DISTFILES)"; \ + for file in $$extra_dists; do \ + test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \ + done; \ + for file in $$dists; do \ + test -f $$file || file="$(srcdir)/$$file"; \ + ln $$file $(distdir) 2> /dev/null \ + || cp -p $$file $(distdir); \ + done + +update-po: Makefile + $(MAKE) $(GETTEXT_PACKAGE).pot + tmpdir=`pwd`; \ + linguas="$(USE_LINGUAS)"; \ + for lang in $$linguas; do \ + echo "$$lang:"; \ + result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \ + if $$result; then \ + if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "msgmerge for $$lang.gmo failed!"; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi; \ + done + +Makefile POTFILES: stamp-it + @if test ! -f $@; then \ + rm -f stamp-it; \ + $(MAKE) stamp-it; \ + fi + +stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \ + $(SHELL) ./config.status + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/po/POTFILES.in /tmp/4ejbOOI7Zw/desmume-0.7.3/po/POTFILES.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/po/POTFILES.in 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/po/POTFILES.in 2007-07-15 17:21:35.000000000 -0500 @@ -0,0 +1,8 @@ +[encoding: UTF-8] +src/gtk-glade/callbacks.c +src/gtk-glade/gdk_3Demu.c +src/gtk-glade/glade-xml.c +src/gtk-glade/keyval_names.c +src/gtk-glade/main.c +src/gtk-glade/glade/DeSmuMe.glade +src/gtk-glade/glade/DeSmuMe_Dtools.glade diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/README.LIN /tmp/4ejbOOI7Zw/desmume-0.7.3/README.LIN --- /tmp/bSLAZZZKhC/desmume-0.6.0/README.LIN 2007-02-03 17:30:14.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/README.LIN 2007-07-15 16:54:05.000000000 -0500 @@ -5,14 +5,14 @@ 1) Compiling instructions...................................13 -2) How to use DeSmuME.......................................43 -3) Contact information......................................57 -4) Disclaimer...............................................76 +2) How to use DeSmuME.......................................53 +3) Contact information......................................142 +4) Disclaimer...............................................161 1 Compiling instructions______________________________________ -Yabause is written in C using the gtk+ and SDL libraries. +DeSmuME is written in C using the gtk+ and SDL libraries. So you need a working C compiler, such as gcc and the above libraries runtime and development packages: @@ -28,31 +28,116 @@ * http://glade.gnome.org/ -Uncompress the DeSmuME. source archive, move to the newly -created directory, type "./configure", then "make", -it will generate two programs: "desmume" in the "src/gtk" -directory and "desmume-cli" in the "src/cli" directory. +1.1 From a release archive____________________________________ + +Uncompress the DeSmuME archive, move to the newly created +directory, type "./configure", then "make". +It will generate three programs: +1) "desmume" in the "src/gtk" directory; +2) "desmume-cli" in the "src/cli" directory. If glade is installed on your system, you'll get a third -binary: "desmume-glade" in the "src/gtk-glade" directory. +binary: +3) "desmume-glade" in the "src/gtk-glade" directory. You can even type "make install" to install those programs on your system (in /usr/local/ by default), then uninstalling is done by typing "make uninstall". +1.2 From a CVS copy___________________________________________ + +Move to the toplevel directory (the one that contains the +configure.ac file). Type "./autogen.sh" to generate the +configure/install scripts and needed Makefiles. Then you can follow the +same procedure as in 1.1 . 2 How to use DeSmuME__________________________________________ +There are three versions of DeSmuME under Linux. These are a +Gtk+ build, a Glade build and a CLI SDL build. All these builds +have some common command line options: + +--disable-limiter Disables the 60 fps limiter +--soft-convert Use software colour conversion during OpenGL + screen rendering. May produce better or worse + frame rates depending on hardware. + +--arm9gdb=PORT_NUM Enable the ARM9 GDB stub on the given port +--arm7gdb=PORT_NUM Enable the ARM7 GDB stub on the given port + +--cflash=PATH_TO_DISK_IMAGE + Enable disk image GBAMP compact flash emulation + +--help Display this message + + +NOTE: +The Gtk+ and Glade builds use gtkGLext to handle the OpenGL +rendering and contexts. You may get improved performance by +also passing the argument --gdk-gl-force-indirect. This has +been seen to improve things for Nvidia based graphics cards +under Linux. + + +GDB Debugger Stubs: +Source level debugging of ARM9 and/or ARM7 code is supported +using a GDB/Insight debugger. +The GDB stubs are enabled from the command line using the +following options: + +--arm9gdb= (for the ARM9) +--arm7gdb= (for the ARM7) + +The PORT_NUM is the TCP port upon which the stub will listen for +connections. Once enabled you can connect to the stub using the +following command at the GDB debugger prompt (assuming GDB and +DeSmuME are running on the same machine): + +target remote : + +NOTE: there are problems with the ARM support when stepping code +with GDB versions prior to version 6.6. It is recommended that +you use at least version 6.6 if possible. + + +GBAMP compact flash emulation: + +The default behaviour of DeSmumME is to attempt to emulate the +FAT image for the contents of the directory where the running +.nds file was located. +This behaviour can be altered using the +--cflash= command line option. Using this +option DeSmuME will emulation a GBAMP and read and write sectors +from/to the disk image file. +The disk image file must be created and populated with files +using some external tool. +NOTE: currently if desmume fails to open the disk image file it +will silently continue minus a working GBAMP emulation. + + 2.1 Gtk+ version______________________________________________ Type "desmume" in a shell, a window should appear, then open a rom file using the "open" button, next use the "run" button to start emulation. +The following command line options are specific to the Gtk+ +build: -2.2 CLI version_______________________________________________ +--opengl-2d Enables using OpenGL for screen rendering +--disable-sound Disables the sound emulation +--disable-3d Disables the 3D emulation + + +2.2 CLI SDL version_______________________________________________ Just type "desmume-cli path-to-a-rom" in a shell. +The following command line options are specific to the CLI +build: + +--opengl-2d Enables using OpenGL for screen rendering +--disable-sound Disables the sound emulation + 3 Contact information_________________________________________ diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/README.MAC /tmp/4ejbOOI7Zw/desmume-0.7.3/README.MAC --- /tmp/bSLAZZZKhC/desmume-0.6.0/README.MAC 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/README.MAC 2007-08-11 14:29:29.000000000 -0500 @@ -0,0 +1,94 @@ + DeSmuME + _________________________________________ + Copyright (C) 2006 yopyop + Copyright (C) 2006-2007 DeSmuME team + + +1) Compiling instructions...................................13 +2) How to use DeSmuME.......................................51 +3) Contact information.....................................166 +4) Disclaimer..............................................185 + + +1 Compiling instructions______________________________________ + +DeSmuME is written in C, and the Cocoa interface was written +in Objective-C. It uses the Cocoa, OpenGL, and zlib libraries. +So you need a working C and Objective-C compiler, such as +GCC for Mac OS X. + + * Cocoa and OpenGL come standard with Mac OS X + + * zlib can be found at http://www.zlib.net, and may + also come with Mac OS X. + +DeSmuME for Mac OS X is being developed with the CodeBlocks +IDE, but one may also use Apple's Xcode Interface. + +2 How to use DeSmuME__________________________________________ + +DeSmuME for Mac OS X does not support all the features of the +Linux and Windows versions. + +To install DeSmuME, copy DeSmuME.app into the folder of your choice +(Applications folder is recommended). + +Double click the application to launch DeSmuME. + +Most options can be found in the menu's at the top of the screen. + +Click the lower screen for DS touch-screen input. + +Here are the default key mappings(they may be subject to change): +Up arrow - Up +Left arrow - Left +Down arrow - Down +right arrow - Right +v - A button +b - B button +g - X button +h - Y button +c - Left Trigger +n - Right Trigger +enter - Start button +space - Select button + +Shift + F1 (through F10) will save the state with the corresponding number. +F1 (through F10) will load the state with the corresponding number. + +3 Contact information_________________________________________ + +General inquiries should go to: +E-mail: guillaume.duhamel@gmail.com + +Mac OS X Port-related inquiries should go to: +E-mail: reversegecko@gmail.com + +Web: http://desmume.sourceforge.net + +Please don't ask for roms, bios files or any other copyrighted +stuff. + +If you want to submit a bug report, please run desmume, go into +the "Help" menu, and click on "Submit a bug report". If you're +having trouble with it, please feel free to email. + + +4 Disclaimer__________________________________________________ + +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 + +See the GNU General Public License details in COPYING. diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/README.TRANSLATION /tmp/4ejbOOI7Zw/desmume-0.7.3/README.TRANSLATION --- /tmp/bSLAZZZKhC/desmume-0.6.0/README.TRANSLATION 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/README.TRANSLATION 2007-08-11 16:56:15.000000000 -0500 @@ -0,0 +1,154 @@ +__________________________ Localization of DeSmuME _____________________________ + +Users and translators: +1) Supported UIs +2) Starting a new translation +3) Editors +4) Contact Us + +Developpers: +5) Creating translation friendly strings (gtk-glade) +6) Updating the template (gtk-glade) +7) Integrating new translations + + +1 Supported UIs ________________________________________________________________ + +Although there are 4 UIs, only 3 currently support localization: +windows and gtk-glade. + +To translate DeSmuME, see "Starting a new translation" below. + + 1.1 gtk-glade UI _____________________________________________________________ + + Localization is done with gettext. gettext uses po files. + The po files are located in the po/ folder. + Note that there is one po file per language. + + To use the available translations, set up your environment properly. + e.g. under GNU/Linux you can verify that the value of your LANG variable. + + 1.2 Windows UI ______________________________________________________________ + + Localization is located in one single file: src/windows/resources.rc . + + 1.3 Mac OS X (Cocoa) UI _____________________________________________________ + + Localization is located within the application bundle (in Finder right click on DeSmuME and select "Show Package Contents"). Within the Contents/Resources folder there is a folder for each localization. + +2 Starting a new translation ___________________________________________________ + + 2.1 gtk-glade UI _____________________________________________________________ + + Grab a copy of po/desmume.pot and rename it. + You can use the two letter iso code of the language as the filename + e.g. fr.po + or you can specify the country code as well + e.g. fr_CA.po + + Open the newly created file with an editor: see "Editors" below. + Translate the strings. + Send us your translation by getting in touch with us: see "Contact Us" below. + + 2.2 Windows UI _______________________________________________________________ + + Grab a copy of src/windows/resources.rc . + Create a section for your language by looking at another language e.g. french. + Translate the strings. + Send us your translation by getting in touch with us: see "Contact Us" below. + + 2.3 Max OS X (Cocoa) UI ______________________________________________________________ + + Copy one of the localization folders mentioned in section one, and paste it into the same folder. + Rename the part before ".lproj" to the language of the translation. + Within your newly created folder edit "Localizable.strings". + Send us your translation by getting in touch with us: see "Contact Us" below. + +3 Editors ______________________________________________________________________ + +You can use plain text editors but there are many po file editors. +Here are some recommanded po editors, in no particular order. + + 3.1 GNU/Linux ________________________________________________________________ + + - gtranslator: http://gtranslator.sourceforge.net/ + - KBabel: http://kbabel.kde.org/ + + 3.2 OSX ______________________________________________________________________ + + - LocFactory Editor: + http://www.triplespin.com/en/products/locfactoryeditor.html + + 3.3 All platforms ____________________________________________________________ + + - poEdit: http://www.poedit.net/ + - OmegaT: http://www.omegat.org/omegat/omegat.html + - GNUEmacs/XEmacs/AquaEmacs with po-mode + - Vim with PO ftplugin + - Eclipse with gted + + +4 Contact Us ___________________________________________________________________ + +As there isn't many translations so far, we're still asking you to get in touch +via the forum located at http://forums.desmume.org/ . + +You can upload your translation files to your favorite sharing site and paste +the link in a post under General. + + +5 Creating translation friendly strings (gtk-glade) ____________________________ + + 5.1 In the code ______________________________________________________________ + + Make sure libintl.h is included and that _() is defined. + e.g. see src/gtk-glade/globals.h + Add the filename to po/POTFILES.in if it's not already there. + + Where you would use "my text", use _("my text"). + For long strings, for translators' sanity, please do something like: + + printf( _(" This is a\n\ + very long text\n") ); + + 5.2 Glade interface __________________________________________________________ + + You have nothing special to do aside from adding the filename to + po/POTFILES.in. + + +6 Updating the template (gtk-glade) ____________________________________________ + +To update po/desmume.pot, move to the po/ folder and execute "make update-po". + + +7 Integrating new translations + + 7.1 gtk-glade UI _____________________________________________________________ + + Add the new po file to po/ . + Add the new language to ALL_LINGUAS in configure.ac . + Regenerated the build files (./autogen.sh) and rebuild (./configure && make). + You can also add the language to po/LINGUAS (it's a convention? it has no effect). + + 7.2 Windows UI _______________________________________________________________ + + Update the src/windows/resource.rc . + Add the new language to to the list in src/windows/resource.h . + Rebuild. + + 7.3 Max OS X (Cocoa) UI ______________________________________________________________ + + After following the steps in 2.3, your translation is ready to go. You can set the DeSmuME + language one of three ways: + + 1) Set the system language (System Preferences -> International). + + 2) Right click on DeSmuME in Finder, select Get Info and disable the other translations. + + 3) From a command line, run the following line after replacing LANG with the language of choice: + + DeSmuME.app/Contents/MacOS/DeSmuME -AppleLanguages 'LANG' + + + All of these methods require a restart of DeSmuME. diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/README.WIN /tmp/4ejbOOI7Zw/desmume-0.7.3/README.WIN --- /tmp/bSLAZZZKhC/desmume-0.6.0/README.WIN 2007-02-03 19:07:20.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/README.WIN 2007-06-07 07:37:43.000000000 -0500 @@ -5,17 +5,31 @@ 1) Compiling instructions...................................13 -2) How to use DeSmuME.......................................37 -3) Contact information.....................................116 -4) Disclaimer..............................................135 +2) How to use DeSmuME.......................................51 +3) Contact information.....................................166 +4) Disclaimer..............................................185 1 Compiling instructions______________________________________ -DeSmuME is written in C, so you need a working C compiler(such -as mingw). Other supported compilers include Visual C++ 2005 and +DeSmuME is written in C, using the DirectX 8.0, OpenGL, zlib, +zziplib libraries, so you need a working C compiler(such as +mingw). Other supported compilers include Visual C++ 2005 and dev-cpp. + * You can find DirectX headers and libraries(for mingw) at + http://alleg.sourceforge.net/wip.html as the file + "dx80_mgw.zip". The actual runtime libraries(or + headers/libraries for MSVC) can be gotten from + http://www.microsoft.com/DirectX + + * OpenGL should be included with your compiler, if it isn't, + check on your compiler's website for links. + + * zlib can be found at http://www.zlib.net + + * zziplib can be found at http://zziplib.sourceforge.net + mingw: All you have to do now is go into your mingw shell environment, go into the directory where you extracted DeSmuME, @@ -113,6 +127,42 @@ a correct ratio so it looks correct. +GDB Debugger Stubs: +Source level debugging of ARM9 and/or ARM7 code is supported +using a GDB/Insight debugger. +The GDB stubs are enabled from the command line using the +following options: + +--arm9gdb= (for the ARM9) +--arm7gdb= (for the ARM7) + +The PORT_NUM is the TCP port upon which the stub will listen for +connections. Once enabled you can connect to the stub using the +following command at the GDB debugger prompt (assuming GDB and +DeSmuME are running on the same machine): + +target remote : + +NOTE: there are problems with the ARM support when stepping code +with GDB versions prior to version 6.6. It is recommended that +you use at least version 6.6 if possible. + + +GBAMP compact flash emulation: + +The default behaviour of DeSmumME is to attempt to emulate the +FAT image for the contents of the directory where the running +.nds file was located. +This behaviour can be altered using the +--cflash= command line option. Using this +option DeSmuME will emulation a GBAMP and read and write sectors +from/to the disk image file. +The disk image file must be created and populated with files +using some external tool. +NOTE: currently if desmume fails to open the disk image file it +will silently continue minus a working GBAMP emulation. + + 3 Contact information_________________________________________ General inquiries should go to: diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/ARM9.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/ARM9.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/ARM9.h 2006-10-15 09:11:13.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/ARM9.h 2007-04-25 11:30:40.000000000 -0500 @@ -22,6 +22,10 @@ u8 * ExtPal[2][4]; u8 * ObjExtPal[2][2]; u8 * texPalSlot[4]; + + const u8 *textureSlotAddr[4]; + + u8 *blank_memory[0x20000]; } ARM9_struct; extern ARM9_struct ARM9Mem; diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/armcpu.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/armcpu.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/armcpu.c 2007-01-28 05:02:13.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/armcpu.c 2007-06-07 04:56:12.000000000 -0500 @@ -29,6 +29,8 @@ armcpu_t NDS_ARM7; armcpu_t NDS_ARM9; +#define STALLED_CYCLE_COUNT 10 + #define SWAP(a, b, c) do \ { \ c=a; \ @@ -36,14 +38,98 @@ b=c; \ } \ while(0) + +static void +stall_cpu( void *instance) { + armcpu_t *armcpu = (armcpu_t *)instance; + + armcpu->stalled = 1; +} + + +static void +unstall_cpu( void *instance) { + armcpu_t *armcpu = (armcpu_t *)instance; + + armcpu->stalled = 0; +} + +static void +install_post_exec_fn( void *instance, + void (*ex_fn)( void *, u32 adr, int thumb), + void *fn_data) { + armcpu_t *armcpu = (armcpu_t *)instance; + + armcpu->post_ex_fn = ex_fn; + armcpu->post_ex_fn_data = fn_data; +} + +static void +remove_post_exec_fn( void *instance) { + armcpu_t *armcpu = (armcpu_t *)instance; + + armcpu->post_ex_fn = NULL; +} + +static u32 +read_cpu_reg( void *instance, u32 reg_num) { + armcpu_t *armcpu = (armcpu_t *)instance; + u32 reg_value = 0; + + if ( reg_num <= 14) { + reg_value = armcpu->R[reg_num]; + } + else if ( reg_num == 15) { + reg_value = armcpu->next_instruction; + } + else if ( reg_num == 16) { + /* CPSR */ + reg_value = armcpu->CPSR.val; + } + + return reg_value; +} + +static void +set_cpu_reg( void *instance, u32 reg_num, u32 value) { + armcpu_t *armcpu = (armcpu_t *)instance; + + if ( reg_num <= 14) { + armcpu->R[reg_num] = value; + } + else if ( reg_num == 15) { + armcpu->next_instruction = value; + } + else if ( reg_num == 16) { + /* FIXME: setting the CPSR */ + } +} + -int armcpu_new(armcpu_t *armcpu, u32 id) +int armcpu_new( armcpu_t *armcpu, u32 id, + struct armcpu_memory_iface *mem_if, + struct armcpu_ctrl_iface **ctrl_iface_ret) { armcpu->proc_ID = id; if(id==0) armcpu->swi_tab = ARM9_swi_tab; else armcpu->swi_tab = ARM7_swi_tab; + armcpu->mem_if = mem_if; + + /* populate the control interface */ + armcpu->ctrl_iface.stall = stall_cpu; + armcpu->ctrl_iface.unstall = unstall_cpu; + armcpu->ctrl_iface.read_reg = read_cpu_reg; + armcpu->ctrl_iface.set_reg = set_cpu_reg; + armcpu->ctrl_iface.install_post_ex_fn = install_post_exec_fn; + armcpu->ctrl_iface.remove_post_ex_fn = remove_post_exec_fn; + armcpu->ctrl_iface.data = armcpu; + + *ctrl_iface_ret = &armcpu->ctrl_iface; + + armcpu->stalled = 0; + armcpu->post_ex_fn = NULL; armcpu_init(armcpu, 0); @@ -58,7 +144,8 @@ armcpu->intVector = 0xFFFF0000 * (armcpu->proc_ID==0); armcpu->waitIRQ = FALSE; armcpu->wirq = FALSE; - + armcpu->irq_flag = 0; + if(armcpu->coproc[15]) free(armcpu->coproc[15]); for(i = 0; i < 15; ++i) @@ -77,11 +164,12 @@ armcpu->R8_fiq = armcpu->R9_fiq = armcpu->R10_fiq = armcpu->R11_fiq = armcpu->R12_fiq = armcpu->R13_fiq = armcpu->R14_fiq = 0; armcpu->SPSR_svc.val = armcpu->SPSR_abt.val = armcpu->SPSR_und.val = armcpu->SPSR_irq.val = armcpu->SPSR_fiq.val = 0; + armcpu->instruct_adr = adr; armcpu->next_instruction = adr; - armcpu->R[15] = adr; + armcpu->R[15] = adr + 8; armcpu->coproc[15] = (armcp_t*)armcp15_new(armcpu); - - armcpu_prefetch(armcpu); + + //armcpu_prefetch(armcpu); } u32 armcpu_switchMode(armcpu_t *armcpu, u8 mode) @@ -191,20 +279,34 @@ return oldmode; } -u32 armcpu_prefetch(armcpu_t *armcpu) +static u32 +armcpu_prefetch(armcpu_t *armcpu) { + u32 temp_instruction; + if(armcpu->CPSR.bits.T == 0) { - armcpu->instruction = MMU_readWordACL(armcpu->proc_ID, armcpu->next_instruction,CP15_ACCESS_EXECUTE); - armcpu->instruct_adr = armcpu->next_instruction; - armcpu->next_instruction += 4; - armcpu->R[15] = armcpu->next_instruction + 4; - return MMU.MMU_WAIT32[armcpu->proc_ID][(armcpu->instruct_adr>>24)&0xF]; + temp_instruction = + armcpu->mem_if->prefetch32( armcpu->mem_if->data, + armcpu->next_instruction); + + if ( !armcpu->stalled) { + armcpu->instruction = temp_instruction; + armcpu->instruct_adr = armcpu->next_instruction; + armcpu->next_instruction += 4; + armcpu->R[15] = armcpu->next_instruction + 4; + } + return MMU.MMU_WAIT32[armcpu->proc_ID][(armcpu->instruct_adr>>24)&0xF]; } - armcpu->instruction = MMU_readHWordACL(armcpu->proc_ID, armcpu->next_instruction,CP15_ACCESS_EXECUTE); - armcpu->instruct_adr = armcpu->next_instruction; - armcpu->next_instruction = armcpu->next_instruction + 2; - armcpu->R[15] = armcpu->next_instruction + 2; + temp_instruction = + armcpu->mem_if->prefetch16( armcpu->mem_if->data, + armcpu->next_instruction); + if ( !armcpu->stalled) { + armcpu->instruction = temp_instruction; + armcpu->instruct_adr = armcpu->next_instruction; + armcpu->next_instruction = armcpu->next_instruction + 2; + armcpu->R[15] = armcpu->next_instruction + 2; + } return MMU.MMU_WAIT16[armcpu->proc_ID][(armcpu->instruct_adr>>24)&0xF]; } @@ -238,54 +340,89 @@ #define TEST_COND2(cond, CPSR) \ (cond<15&&test_conditions[cond](CPSR)) -u32 armcpu_exec(armcpu_t *armcpu) -{ - u32 c = 1; - if(armcpu->CPSR.bits.T == 0) - { - if((TEST_COND(CONDITION(armcpu->instruction), armcpu->CPSR)) || ((CONDITION(armcpu->instruction)==0xF)&&(CODE(armcpu->instruction)==0x5))) - { - c = arm_instructions_set[INSTRUCTION_INDEX(armcpu->instruction)](armcpu); - } - c += armcpu_prefetch(armcpu); - return c; - } - c = thumb_instructions_set[armcpu->instruction>>6](armcpu); - c += armcpu_prefetch(armcpu); - return c; -} -BOOL armcpu_irqExeption(armcpu_t *armcpu) +static BOOL armcpu_irqExeption(armcpu_t *armcpu) { Status_Reg tmp; if(armcpu->CPSR.bits.I) return FALSE; + armcpu->irq_flag = 0; tmp = armcpu->CPSR; armcpu_switchMode(armcpu, IRQ); - armcpu->R[14] = armcpu->instruct_adr + 4; + armcpu->R[14] = armcpu->next_instruction + 4; armcpu->SPSR = tmp; armcpu->CPSR.bits.T = 0; armcpu->CPSR.bits.I = 1; armcpu->next_instruction = armcpu->intVector + 0x18; - armcpu->R[15] = armcpu->next_instruction; + //armcpu->R[15] = armcpu->next_instruction + 8; armcpu->waitIRQ = 0; - armcpu_prefetch(armcpu); return TRUE; } -BOOL armcpu_prefetchExeption(armcpu_t *armcpu) +static BOOL armcpu_prefetchExeption(armcpu_t *armcpu) { Status_Reg tmp; if(armcpu->CPSR.bits.I) return FALSE; tmp = armcpu->CPSR; armcpu_switchMode(armcpu, ABT); - armcpu->R[14] = armcpu->instruct_adr + 4; + armcpu->R[14] = armcpu->next_instruction + 4; armcpu->SPSR = tmp; armcpu->CPSR.bits.T = 0; armcpu->CPSR.bits.I = 1; armcpu->next_instruction = armcpu->intVector + 0xC; - armcpu->R[15] = armcpu->next_instruction; + armcpu->R[15] = armcpu->next_instruction + 8; armcpu->waitIRQ = 0; - armcpu_prefetch(armcpu); return TRUE; } +BOOL +armcpu_flagIrq( armcpu_t *armcpu) { + if(armcpu->CPSR.bits.I) return FALSE; + + armcpu->waitIRQ = 0; + armcpu->irq_flag = 1; + return TRUE; +} + + +u32 armcpu_exec(armcpu_t *armcpu) +{ + u32 c; + if ( armcpu->stalled) + return STALLED_CYCLE_COUNT; + + /* check for interrupts */ + if ( armcpu->irq_flag) { + armcpu_irqExeption( armcpu); + } + + c = armcpu_prefetch(armcpu); + + if ( armcpu->stalled) { + return c; + } + + if(armcpu->CPSR.bits.T == 0) + { + if((TEST_COND(CONDITION(armcpu->instruction), armcpu->CPSR)) || ((CONDITION(armcpu->instruction)==0xF)&&(CODE(armcpu->instruction)==0x5))) + { + c += arm_instructions_set[INSTRUCTION_INDEX(armcpu->instruction)](armcpu); + } + + if ( armcpu->post_ex_fn != NULL) { + /* call the external post execute function */ + armcpu->post_ex_fn( armcpu->post_ex_fn_data, + armcpu->instruct_adr, 0); + } + + return c; + } + c += thumb_instructions_set[armcpu->instruction>>6](armcpu); + + if ( armcpu->post_ex_fn != NULL) { + /* call the external post execute function */ + armcpu->post_ex_fn( armcpu->post_ex_fn_data, armcpu->instruct_adr, 1); + } + + return c; +} + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/armcpu.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/armcpu.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/armcpu.h 2007-01-28 05:02:13.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/armcpu.h 2007-06-07 04:56:12.000000000 -0500 @@ -135,6 +135,35 @@ } Status_Reg; #endif +/** + * The control interface to a CPU + */ +struct armcpu_ctrl_iface { + /** stall the processor */ + void (*stall)( void *instance); + + /** unstall the processor */ + void (*unstall)( void *instance); + + /** read a register value */ + u32 (*read_reg)( void *instance, u32 reg_num); + + /** set a register value */ + void (*set_reg)( void *instance, u32 reg_num, u32 value); + + /** install the post execute function */ + void (*install_post_ex_fn)( void *instance, + void (*fn)( void *, u32 adr, int thumb), + void *fn_data); + + /** remove the post execute function */ + void (*remove_post_ex_fn)( void *instance); + + /** the private data passed to all interface functions */ + void *data; +}; + + typedef void* armcp_t; typedef struct armcpu_t @@ -164,27 +193,50 @@ BOOL wIRQ; BOOL wirq; - u32 (* *swi_tab)(struct armcpu_t * cpu); - + + /** there is a pending irq for the cpu */ + int irq_flag; + + /** the post executed function (if installed) */ + void (*post_ex_fn)( void *, u32 adr, int thumb); + + /** data for the post executed function */ + void *post_ex_fn_data; + + /** flag indicating if the processor is stalled */ + int stalled; + + /** the memory interface */ + struct armcpu_memory_iface *mem_if; + + /** the ctrl interface */ + struct armcpu_ctrl_iface ctrl_iface; } armcpu_t; - -int armcpu_new(armcpu_t *armcpu, u32 id); + + +int armcpu_new( armcpu_t *armcpu, u32 id, struct armcpu_memory_iface *mem_if, + struct armcpu_ctrl_iface **ctrl_iface_ret); void armcpu_init(armcpu_t *armcpu, u32 adr); u32 armcpu_switchMode(armcpu_t *armcpu, u8 mode); -u32 armcpu_prefetch(armcpu_t *armcpu); +//u32 armcpu_prefetch(armcpu_t *armcpu); u32 armcpu_exec(armcpu_t *armcpu); -BOOL armcpu_irqExeption(armcpu_t *armcpu); -BOOL armcpu_prefetchExeption(armcpu_t *armcpu); +//BOOL armcpu_irqExeption(armcpu_t *armcpu); +//BOOL armcpu_prefetchExeption(armcpu_t *armcpu); +BOOL +armcpu_flagIrq( armcpu_t *armcpu); extern armcpu_t NDS_ARM7; extern armcpu_t NDS_ARM9; static INLINE void NDS_makeARM9Int(u32 num) { + /* flag the interrupt request source */ + MMU.reg_IF[0] |= (1<R[REG_POS(i,0)]<<((i>>7)&0x1F); @@ -251,7 +251,7 @@ SPSR = cpu->SPSR;\ armcpu_switchMode(cpu, SPSR.bits.mode);\ cpu->CPSR=SPSR;\ - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1));\ + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1));\ cpu->next_instruction = cpu->R[15];\ return b;\ }\ @@ -407,7 +407,7 @@ Status_Reg SPSR = cpu->SPSR;\ armcpu_switchMode(cpu, SPSR.bits.mode);\ cpu->CPSR=SPSR;\ - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1));\ + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1));\ cpu->next_instruction = cpu->R[15];\ return b;\ }\ @@ -562,7 +562,7 @@ Status_Reg SPSR = cpu->SPSR;\ armcpu_switchMode(cpu, SPSR.bits.mode);\ cpu->CPSR=SPSR;\ - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1));\ + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1));\ cpu->next_instruction = cpu->R[15];\ return b;\ }\ @@ -731,7 +731,7 @@ Status_Reg SPSR = cpu->SPSR;\ armcpu_switchMode(cpu, SPSR.bits.mode);\ cpu->CPSR=SPSR;\ - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1));\ + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1));\ cpu->next_instruction = cpu->R[15];\ return b;\ }\ @@ -967,7 +967,7 @@ Status_Reg SPSR = cpu->SPSR;\ armcpu_switchMode(cpu, SPSR.bits.mode);\ cpu->CPSR=SPSR;\ - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1));\ + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1));\ cpu->next_instruction = cpu->R[15];\ return b;\ }\ @@ -1139,7 +1139,7 @@ Status_Reg SPSR = cpu->SPSR;\ armcpu_switchMode(cpu, SPSR.bits.mode);\ cpu->CPSR=SPSR;\ - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1));\ + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1));\ cpu->next_instruction = cpu->R[15];\ return b;\ }\ @@ -1312,7 +1312,7 @@ Status_Reg SPSR = cpu->SPSR;\ armcpu_switchMode(cpu, SPSR.bits.mode);\ cpu->CPSR=SPSR;\ - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1));\ + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1));\ cpu->next_instruction = cpu->R[15];\ return b;\ }\ @@ -1485,7 +1485,7 @@ Status_Reg SPSR = cpu->SPSR;\ armcpu_switchMode(cpu, SPSR.bits.mode);\ cpu->CPSR=SPSR;\ - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1));\ + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1));\ cpu->next_instruction = cpu->R[15];\ return b;\ }\ @@ -1965,7 +1965,7 @@ Status_Reg SPSR = cpu->SPSR; armcpu_switchMode(cpu, SPSR.bits.mode); cpu->CPSR=SPSR; - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1)); + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1)); cpu->next_instruction = cpu->R[15]; return 4; } @@ -1985,7 +1985,7 @@ Status_Reg SPSR = cpu->SPSR; armcpu_switchMode(cpu, SPSR.bits.mode); cpu->CPSR=SPSR; - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1)); + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1)); cpu->next_instruction = cpu->R[15]; return 5; } @@ -2005,7 +2005,7 @@ Status_Reg SPSR = cpu->SPSR; armcpu_switchMode(cpu, SPSR.bits.mode); cpu->CPSR=SPSR; - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1)); + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1)); cpu->next_instruction = cpu->R[15]; return 4; } @@ -2025,7 +2025,7 @@ Status_Reg SPSR = cpu->SPSR; armcpu_switchMode(cpu, SPSR.bits.mode); cpu->CPSR=SPSR; - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1)); + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1)); cpu->next_instruction = cpu->R[15]; return 5; } @@ -2045,7 +2045,7 @@ Status_Reg SPSR = cpu->SPSR; armcpu_switchMode(cpu, SPSR.bits.mode); cpu->CPSR=SPSR; - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1)); + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1)); cpu->next_instruction = cpu->R[15]; return 4; } @@ -2065,7 +2065,7 @@ Status_Reg SPSR = cpu->SPSR; armcpu_switchMode(cpu, SPSR.bits.mode); cpu->CPSR=SPSR; - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1)); + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1)); cpu->next_instruction = cpu->R[15]; return 5; } @@ -2085,7 +2085,7 @@ Status_Reg SPSR = cpu->SPSR; armcpu_switchMode(cpu, SPSR.bits.mode); cpu->CPSR=SPSR; - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1)); + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1)); cpu->next_instruction = cpu->R[15]; return 4; } @@ -2105,7 +2105,7 @@ Status_Reg SPSR = cpu->SPSR; armcpu_switchMode(cpu, SPSR.bits.mode); cpu->CPSR=SPSR; - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1)); + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1)); cpu->next_instruction = cpu->R[15]; return 5; } @@ -2125,7 +2125,7 @@ Status_Reg SPSR = cpu->SPSR; armcpu_switchMode(cpu, SPSR.bits.mode); cpu->CPSR=SPSR; - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1)); + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1)); cpu->next_instruction = cpu->R[15]; return 4; } @@ -2151,7 +2151,7 @@ Status_Reg SPSR = cpu->SPSR;\ armcpu_switchMode(cpu, SPSR.bits.mode);\ cpu->CPSR=SPSR;\ - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1));\ + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1));\ cpu->next_instruction = cpu->R[15];\ return b;\ }\ @@ -2309,7 +2309,7 @@ Status_Reg SPSR = cpu->SPSR;\ armcpu_switchMode(cpu, SPSR.bits.mode);\ cpu->CPSR=SPSR;\ - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1));\ + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1));\ cpu->next_instruction = cpu->R[15];\ return b;\ }\ @@ -2463,7 +2463,7 @@ Status_Reg SPSR = cpu->SPSR;\ armcpu_switchMode(cpu, SPSR.bits.mode);\ cpu->CPSR=SPSR;\ - cpu->R[15] &= (0X0FFFFFFC|(((u32)SPSR.bits.T)<<1));\ + cpu->R[15] &= (0XFFFFFFFC|(((u32)SPSR.bits.T)<<1));\ cpu->next_instruction = cpu->R[15];\ return b;\ }\ @@ -2790,9 +2790,9 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - u32 tmp = ROR(MMU_readWord(cpu->proc_ID, adr), ((cpu->R[REG_POS(i,16)]&3)<<3)); + u32 tmp = ROR(cpu->mem_if->read32(cpu->mem_if->data, adr), ((cpu->R[REG_POS(i,16)]&3)<<3)); - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,0)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,0)]); cpu->R[REG_POS(i,12)] = tmp; return 4 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]*2; @@ -2802,8 +2802,8 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - u8 tmp = MMU_readByte(cpu->proc_ID, adr); - MMU_writeByte(cpu->proc_ID, adr, (u8)(cpu->R[REG_POS(i,0)]&0xFF)); + u8 tmp = cpu->mem_if->read8(cpu->mem_if->data, adr); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)(cpu->R[REG_POS(i,0)]&0xFF)); cpu->R[REG_POS(i,12)] = tmp; return 4 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]*2; @@ -2815,7 +2815,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF; - cpu->R[REG_POS(i,12)] = (u32)MMU_readHWordACL(cpu->proc_ID, adr,CP15_ACCESS_READ); + cpu->R[REG_POS(i,12)] = (u32)cpu->mem_if->read16(cpu->mem_if->data, adr); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -2824,7 +2824,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF; - cpu->R[REG_POS(i,12)] = (u32)MMU_readHWordACL(cpu->proc_ID, adr,CP15_ACCESS_READ); + cpu->R[REG_POS(i,12)] = (u32)cpu->mem_if->read16(cpu->mem_if->data, adr); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -2833,7 +2833,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + cpu->R[REG_POS(i,0)]; - cpu->R[REG_POS(i,12)] = (u32)MMU_readHWordACL(cpu->proc_ID, adr,CP15_ACCESS_READ); + cpu->R[REG_POS(i,12)] = (u32)cpu->mem_if->read16(cpu->mem_if->data, adr); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -2842,7 +2842,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - cpu->R[REG_POS(i,0)]; - cpu->R[REG_POS(i,12)] = (u32)MMU_readHWordACL(cpu->proc_ID, adr,CP15_ACCESS_READ); + cpu->R[REG_POS(i,12)] = (u32)cpu->mem_if->read16(cpu->mem_if->data, adr); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -2852,7 +2852,7 @@ u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF; cpu->R[REG_POS(i,16)] = adr; - cpu->R[REG_POS(i,12)] = (u32)MMU_readHWordACL(cpu->proc_ID, adr,CP15_ACCESS_READ); + cpu->R[REG_POS(i,12)] = (u32)cpu->mem_if->read16(cpu->mem_if->data, adr); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -2862,7 +2862,7 @@ u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF; cpu->R[REG_POS(i,16)] = adr; - cpu->R[REG_POS(i,12)] = (u32)MMU_readHWordACL(cpu->proc_ID, adr,CP15_ACCESS_READ); + cpu->R[REG_POS(i,12)] = (u32)cpu->mem_if->read16(cpu->mem_if->data, adr); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -2873,7 +2873,7 @@ u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + cpu->R[REG_POS(i,0)]; cpu->R[REG_POS(i,16)] = adr; - cpu->R[REG_POS(i,12)] =(u32)MMU_readHWordACL(cpu->proc_ID, adr,CP15_ACCESS_READ); + cpu->R[REG_POS(i,12)] =(u32)cpu->mem_if->read16(cpu->mem_if->data, adr); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -2883,7 +2883,7 @@ u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - cpu->R[REG_POS(i,0)]; cpu->R[REG_POS(i,16)] = adr; - cpu->R[REG_POS(i,12)] = (u32)MMU_readHWordACL(cpu->proc_ID, adr,CP15_ACCESS_READ); + cpu->R[REG_POS(i,12)] = (u32)cpu->mem_if->read16(cpu->mem_if->data, adr); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -2892,7 +2892,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - cpu->R[REG_POS(i,12)] = (u32)MMU_readHWordACL(cpu->proc_ID, adr,CP15_ACCESS_READ); + cpu->R[REG_POS(i,12)] = (u32)cpu->mem_if->read16(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] += IMM_OFF; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -2902,7 +2902,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - cpu->R[REG_POS(i,12)] = (u32)MMU_readHWordACL(cpu->proc_ID, adr,CP15_ACCESS_READ); + cpu->R[REG_POS(i,12)] = (u32)cpu->mem_if->read16(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] -= IMM_OFF; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -2912,7 +2912,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - cpu->R[REG_POS(i,12)] = (u32)MMU_readHWordACL(cpu->proc_ID, adr,CP15_ACCESS_READ); + cpu->R[REG_POS(i,12)] = (u32)cpu->mem_if->read16(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] += cpu->R[REG_POS(i,0)]; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -2922,7 +2922,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - cpu->R[REG_POS(i,12)] = (u32)MMU_readHWordACL(cpu->proc_ID, adr,CP15_ACCESS_READ); + cpu->R[REG_POS(i,12)] = (u32)cpu->mem_if->read16(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] -= cpu->R[REG_POS(i,0)]; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -2934,7 +2934,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF; - MMU_writeHWordACL(cpu->proc_ID, adr, (u16)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write16(cpu->mem_if->data, adr, (u16)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -2943,7 +2943,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF; - MMU_writeHWordACL(cpu->proc_ID, adr, (u16)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write16(cpu->mem_if->data, adr, (u16)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -2952,7 +2952,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + cpu->R[REG_POS(i,0)]; - MMU_writeHWordACL(cpu->proc_ID, adr, (u16)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write16(cpu->mem_if->data, adr, (u16)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -2961,7 +2961,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - cpu->R[REG_POS(i,0)]; - MMU_writeHWordACL(cpu->proc_ID, adr, (u16)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write16(cpu->mem_if->data, adr, (u16)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -2971,7 +2971,7 @@ u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF; cpu->R[REG_POS(i,16)] = adr; - MMU_writeHWordACL(cpu->proc_ID, adr, (u16)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write16(cpu->mem_if->data, adr, (u16)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -2980,7 +2980,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF; - MMU_writeHWordACL(cpu->proc_ID, adr, (u16)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write16(cpu->mem_if->data, adr, (u16)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -2990,7 +2990,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + cpu->R[REG_POS(i,0)]; - MMU_writeHWordACL(cpu->proc_ID, adr, (u16)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write16(cpu->mem_if->data, adr, (u16)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3000,7 +3000,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - cpu->R[REG_POS(i,0)]; - MMU_writeHWordACL(cpu->proc_ID, adr, (u16)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write16(cpu->mem_if->data, adr, (u16)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3010,7 +3010,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - MMU_writeHWordACL(cpu->proc_ID, adr, (u16)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write16(cpu->mem_if->data, adr, (u16)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] += IMM_OFF; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3020,7 +3020,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - MMU_writeHWordACL(cpu->proc_ID, adr, (u16)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write16(cpu->mem_if->data, adr, (u16)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] -= IMM_OFF; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3030,7 +3030,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - MMU_writeHWordACL(cpu->proc_ID, adr, (u16)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write16(cpu->mem_if->data, adr, (u16)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] += cpu->R[REG_POS(i,0)]; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3040,7 +3040,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - MMU_writeHWordACL(cpu->proc_ID, adr, (u16)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write16(cpu->mem_if->data, adr, (u16)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] -= cpu->R[REG_POS(i,0)]; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3052,7 +3052,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF; - cpu->R[REG_POS(i,12)] = (s32)((s16)MMU_readHWord(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s16)cpu->mem_if->read16(cpu->mem_if->data, adr)); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -3061,7 +3061,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF; - cpu->R[REG_POS(i,12)] = (s32)((s16)MMU_readHWord(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s16)cpu->mem_if->read16(cpu->mem_if->data, adr)); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -3070,7 +3070,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + cpu->R[REG_POS(i,0)]; - cpu->R[REG_POS(i,12)] = (s32)((s16)MMU_readHWord(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s16)cpu->mem_if->read16(cpu->mem_if->data, adr)); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -3079,7 +3079,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - cpu->R[REG_POS(i,0)]; - cpu->R[REG_POS(i,12)] = (s32)((s16)MMU_readHWord(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s16)cpu->mem_if->read16(cpu->mem_if->data, adr)); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -3088,7 +3088,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF; - cpu->R[REG_POS(i,12)] = (s32)((s16)MMU_readHWord(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s16)cpu->mem_if->read16(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] = adr; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3098,7 +3098,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF; - cpu->R[REG_POS(i,12)] = (s32)((s16)MMU_readHWord(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s16)cpu->mem_if->read16(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] = adr; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3108,7 +3108,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + cpu->R[REG_POS(i,0)]; - cpu->R[REG_POS(i,12)] = (s32)((s16)MMU_readHWord(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s16)cpu->mem_if->read16(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] = adr; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3118,7 +3118,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - cpu->R[REG_POS(i,0)]; - cpu->R[REG_POS(i,12)] = (s32)((s16)MMU_readHWord(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s16)cpu->mem_if->read16(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] = adr; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3128,7 +3128,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - cpu->R[REG_POS(i,12)] = (s32)((s16)MMU_readHWord(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s16)cpu->mem_if->read16(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] += IMM_OFF; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3138,7 +3138,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - cpu->R[REG_POS(i,12)] = (s32)((s16)MMU_readHWord(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s16)cpu->mem_if->read16(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] -= IMM_OFF; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3148,7 +3148,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - cpu->R[REG_POS(i,12)] = (s32)((s16)MMU_readHWord(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s16)cpu->mem_if->read16(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] += cpu->R[REG_POS(i,0)]; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3158,7 +3158,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - cpu->R[REG_POS(i,12)] = (s32)((s16)MMU_readHWord(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s16)cpu->mem_if->read16(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] -= cpu->R[REG_POS(i,0)]; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3170,7 +3170,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF; - cpu->R[REG_POS(i,12)] = (s32)((s8)MMU_readByte(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s8)cpu->mem_if->read8(cpu->mem_if->data, adr)); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -3179,7 +3179,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF; - cpu->R[REG_POS(i,12)] = (s32)((s8)MMU_readByte(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s8)cpu->mem_if->read8(cpu->mem_if->data, adr)); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -3188,7 +3188,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + cpu->R[REG_POS(i,0)]; - cpu->R[REG_POS(i,12)] = (s32)((s8)MMU_readByte(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s8)cpu->mem_if->read8(cpu->mem_if->data, adr)); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -3197,7 +3197,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - cpu->R[REG_POS(i,0)]; - cpu->R[REG_POS(i,12)] = (s32)((s8)MMU_readByte(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s8)cpu->mem_if->read8(cpu->mem_if->data, adr)); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -3206,7 +3206,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF; - cpu->R[REG_POS(i,12)] = (s32)((s8)MMU_readByte(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s8)cpu->mem_if->read8(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] = adr; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3216,7 +3216,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF; - cpu->R[REG_POS(i,12)] = (s32)((s8)MMU_readByte(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s8)cpu->mem_if->read8(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] = adr; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3226,7 +3226,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + cpu->R[REG_POS(i,0)]; - cpu->R[REG_POS(i,12)] = (s32)((s8)MMU_readByte(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s8)cpu->mem_if->read8(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] = adr; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3236,7 +3236,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - cpu->R[REG_POS(i,0)]; - cpu->R[REG_POS(i,12)] = (s32)((s8)MMU_readByte(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s8)cpu->mem_if->read8(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] = adr; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3246,7 +3246,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - cpu->R[REG_POS(i,12)] = (s32)((s8)MMU_readByte(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s8)cpu->mem_if->read8(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] += IMM_OFF; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3256,7 +3256,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - cpu->R[REG_POS(i,12)] = (s32)((s8)MMU_readByte(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s8)cpu->mem_if->read8(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] -= IMM_OFF; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3266,7 +3266,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - cpu->R[REG_POS(i,12)] = (s32)((s8)MMU_readByte(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s8)cpu->mem_if->read8(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] += cpu->R[REG_POS(i,0)]; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3276,7 +3276,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - cpu->R[REG_POS(i,12)] = (s32)((s8)MMU_readByte(cpu->proc_ID, adr)); + cpu->R[REG_POS(i,12)] = (s32)((s8)cpu->mem_if->read8(cpu->mem_if->data, adr)); cpu->R[REG_POS(i,16)] -= cpu->R[REG_POS(i,0)]; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -3508,7 +3508,7 @@ cpu->R[REG_POS(i,12)]=res; if(REG_POS(i,12)==15) { - cpu->R[15] &= 0X0FFFFFFC; + cpu->R[15] &= 0XFFFFFFFC; cpu->next_instruction = cpu->R[15]; return 3; } @@ -3530,7 +3530,7 @@ cpu->R[REG_POS(i,12)]=res; if(REG_POS(i,12)==15) { - cpu->R[15] &= 0X0FFFFFFC; + cpu->R[15] &= 0XFFFFFFFC; cpu->next_instruction = cpu->R[15]; return 3; } @@ -3561,7 +3561,7 @@ cpu->R[REG_POS(i,12)]=res; if(REG_POS(i,12)==15) { - cpu->R[15] &= 0X0FFFFFFC; + cpu->R[15] &= 0XFFFFFFFC; cpu->next_instruction = cpu->R[15]; return 3; } @@ -3592,7 +3592,7 @@ cpu->R[REG_POS(i,12)]=res; if(REG_POS(i,12)==15) { - cpu->R[15] &= 0X0FFFFFFC; + cpu->R[15] &= 0XFFFFFFFC; cpu->next_instruction = cpu->R[15]; return 3; } @@ -3828,14 +3828,14 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF_12; - u32 val = MMU_readWord(cpu->proc_ID, adr); + u32 val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; return 5 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -3849,14 +3849,14 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF_12; - u32 val = MMU_readWord(cpu->proc_ID, adr); + u32 val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; return 5 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -3875,14 +3875,14 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; return 5 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -3901,14 +3901,14 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; return 5 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -3927,14 +3927,14 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; return 5 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -3953,14 +3953,14 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; return 5 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -3979,14 +3979,14 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; return 5 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -4005,14 +4005,14 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; return 5 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -4031,14 +4031,14 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; return 5 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -4057,14 +4057,14 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; return 5 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -4080,14 +4080,14 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF_12; - u32 val = MMU_readWord(cpu->proc_ID, adr); + u32 val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr; @@ -4104,14 +4104,14 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF_12; - u32 val = MMU_readWord(cpu->proc_ID, adr); + u32 val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr; @@ -4133,14 +4133,14 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr; @@ -4162,14 +4162,14 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr; @@ -4191,14 +4191,14 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr; @@ -4220,14 +4220,14 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr; @@ -4249,14 +4249,14 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr; @@ -4278,14 +4278,14 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr; @@ -4307,14 +4307,14 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr; @@ -4336,14 +4336,14 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr; @@ -4360,14 +4360,14 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - u32 val = MMU_readWord(cpu->proc_ID, adr); + u32 val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr + IMM_OFF_12; @@ -4386,14 +4386,14 @@ u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - u32 val = MMU_readWord(cpu->proc_ID, adr); + u32 val = cpu->mem_if->read32(cpu->mem_if->data, adr); u32 old; if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr + IMM_OFF_12; @@ -4415,14 +4415,14 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - u32 val = MMU_readWord(cpu->proc_ID, adr); + u32 val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr - IMM_OFF_12; @@ -4443,14 +4443,14 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr + shift_op; @@ -4471,14 +4471,14 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr - shift_op; @@ -4499,14 +4499,14 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr + shift_op; @@ -4527,14 +4527,14 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr - shift_op; @@ -4555,14 +4555,14 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr + shift_op; @@ -4583,14 +4583,14 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr - shift_op; @@ -4611,14 +4611,14 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr + shift_op; @@ -4639,14 +4639,14 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readWord(cpu->proc_ID, adr); + val = cpu->mem_if->read32(cpu->mem_if->data, adr); if(adr&3) val = ROR(val, 8*(adr&3)); if(REG_POS(i,12)==15) { - cpu->R[15] = val & (0X0FFFFFFC | (((u32)cpu->LDTBit)<<1)); + cpu->R[15] = val & (0XFFFFFFFC | (((u32)cpu->LDTBit)<<1)); cpu->CPSR.bits.T = BIT0(val) & cpu->LDTBit; cpu->next_instruction = cpu->R[15]; cpu->R[REG_POS(i,16)] = adr - shift_op; @@ -4665,7 +4665,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF_12; - u32 val = MMU_readByte(cpu->proc_ID, adr); + u32 val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -4675,7 +4675,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF_12; - u32 val = MMU_readByte(cpu->proc_ID, adr); + u32 val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -4689,7 +4689,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -4703,7 +4703,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -4717,7 +4717,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -4731,7 +4731,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -4745,7 +4745,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -4759,7 +4759,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -4773,7 +4773,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -4787,7 +4787,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; cpu->R[REG_POS(i,16)] = adr; @@ -4798,7 +4798,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF_12; - u32 val = MMU_readByte(cpu->proc_ID, adr); + u32 val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr; cpu->R[REG_POS(i,12)] = val; @@ -4811,7 +4811,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF_12; - u32 val = MMU_readByte(cpu->proc_ID, adr); + u32 val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr; cpu->R[REG_POS(i,12)] = val; @@ -4827,7 +4827,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr; cpu->R[REG_POS(i,12)] = val; @@ -4844,7 +4844,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr; cpu->R[REG_POS(i,12)] = val; @@ -4860,7 +4860,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr; cpu->R[REG_POS(i,12)] = val; @@ -4875,7 +4875,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr; cpu->R[REG_POS(i,12)] = val; @@ -4890,7 +4890,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr; cpu->R[REG_POS(i,12)] = val; @@ -4905,7 +4905,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr; cpu->R[REG_POS(i,12)] = val; @@ -4920,7 +4920,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr; cpu->R[REG_POS(i,12)] = val; @@ -4935,7 +4935,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr; cpu->R[REG_POS(i,12)] = val; @@ -4946,7 +4946,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - u32 val = MMU_readByte(cpu->proc_ID, adr); + u32 val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr + IMM_OFF_12; cpu->R[REG_POS(i,12)] = val; @@ -4957,7 +4957,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - u32 val = MMU_readByte(cpu->proc_ID, adr); + u32 val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr - IMM_OFF_12; cpu->R[REG_POS(i,12)] = val; @@ -4972,7 +4972,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr + shift_op; cpu->R[REG_POS(i,12)] = val; @@ -4987,7 +4987,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr - shift_op; cpu->R[REG_POS(i,12)] = val; @@ -5002,7 +5002,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr + shift_op; cpu->R[REG_POS(i,12)] = val; @@ -5017,7 +5017,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr - shift_op; cpu->R[REG_POS(i,12)] = val; @@ -5032,7 +5032,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr + shift_op; cpu->R[REG_POS(i,12)] = val; @@ -5047,7 +5047,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr - shift_op; cpu->R[REG_POS(i,12)] = val; @@ -5062,7 +5062,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr + shift_op; cpu->R[REG_POS(i,12)] = val; @@ -5077,7 +5077,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,16)] = adr - shift_op; cpu->R[REG_POS(i,12)] = val; @@ -5090,7 +5090,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF_12; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); // execute = false; @@ -5101,7 +5101,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF_12; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5113,7 +5113,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5125,7 +5125,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5137,7 +5137,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5149,7 +5149,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5161,7 +5161,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5173,7 +5173,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5185,7 +5185,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5197,7 +5197,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5207,7 +5207,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF_12; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5217,7 +5217,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF_12; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5230,7 +5230,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5243,7 +5243,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5256,7 +5256,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5269,7 +5269,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5282,7 +5282,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5295,7 +5295,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5308,7 +5308,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5321,7 +5321,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5331,7 +5331,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + IMM_OFF_12; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5341,7 +5341,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - IMM_OFF_12; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5354,7 +5354,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + shift_op; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5367,7 +5367,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - shift_op; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5380,7 +5380,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + shift_op; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5393,7 +5393,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - shift_op; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5406,7 +5406,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + shift_op; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5419,7 +5419,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - shift_op; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5432,7 +5432,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + shift_op; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5445,7 +5445,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - shift_op; return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; @@ -5457,7 +5457,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF_12; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5466,7 +5466,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF_12; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5478,7 +5478,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5490,7 +5490,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5502,7 +5502,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5514,7 +5514,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5526,7 +5526,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5538,7 +5538,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5550,7 +5550,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5562,7 +5562,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -5571,7 +5571,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] + IMM_OFF_12; - MMU_writeByte(cpu->proc_ID, adr, cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5581,7 +5581,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)] - IMM_OFF_12; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5594,7 +5594,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5607,7 +5607,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5620,7 +5620,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5633,7 +5633,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5646,7 +5646,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5659,7 +5659,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5672,7 +5672,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] + shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5685,7 +5685,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)] - shift_op; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5695,7 +5695,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + IMM_OFF_12; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5705,7 +5705,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - IMM_OFF_12; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5718,7 +5718,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + shift_op; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5731,7 +5731,7 @@ u32 shift_op; LSL_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - shift_op; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5744,7 +5744,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + shift_op; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5757,7 +5757,7 @@ u32 shift_op; LSR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - shift_op; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5770,7 +5770,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + shift_op; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5783,7 +5783,7 @@ u32 shift_op; ASR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - shift_op; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5796,7 +5796,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + shift_op; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5809,7 +5809,7 @@ u32 shift_op; ROR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - shift_op; return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; @@ -5830,7 +5830,7 @@ i = cpu->instruction; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; cpu->R[REG_POS(i,16)] = adr + IMM_OFF_12; @@ -5854,7 +5854,7 @@ i = cpu->instruction; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; cpu->R[REG_POS(i,16)] = adr - IMM_OFF_12; @@ -5879,7 +5879,7 @@ i = cpu->instruction; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; cpu->R[REG_POS(i,16)] = adr + cpu->R[REG_POS(i,0)]; @@ -5905,7 +5905,7 @@ i = cpu->instruction; LSL_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; cpu->R[REG_POS(i,16)] = adr + shift_op; @@ -5932,7 +5932,7 @@ i = cpu->instruction; LSL_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; cpu->R[REG_POS(i,16)] = adr - shift_op; @@ -5959,7 +5959,7 @@ i = cpu->instruction; LSR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; cpu->R[REG_POS(i,16)] = adr + shift_op; @@ -5986,7 +5986,7 @@ i = cpu->instruction; LSR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; cpu->R[REG_POS(i,16)] = adr - shift_op; @@ -6013,7 +6013,7 @@ i = cpu->instruction; ASR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; cpu->R[REG_POS(i,16)] = adr + shift_op; @@ -6040,7 +6040,7 @@ i = cpu->instruction; ASR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; cpu->R[REG_POS(i,16)] = adr - shift_op; @@ -6067,7 +6067,7 @@ i = cpu->instruction; ROR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; cpu->R[REG_POS(i,16)] = adr + shift_op; @@ -6094,7 +6094,7 @@ i = cpu->instruction; ROR_IMM; adr = cpu->R[REG_POS(i,16)]; - val = MMU_readByte(cpu->proc_ID, adr); + val = cpu->mem_if->read8(cpu->mem_if->data, adr); cpu->R[REG_POS(i,12)] = val; cpu->R[REG_POS(i,16)] = adr - shift_op; @@ -6119,7 +6119,7 @@ i = cpu->instruction; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + IMM_OFF_12; armcpu_switchMode(cpu, oldmode); @@ -6141,7 +6141,7 @@ i = cpu->instruction; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - IMM_OFF_12; armcpu_switchMode(cpu, oldmode); @@ -6163,7 +6163,7 @@ i = cpu->instruction; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + cpu->R[REG_POS(i,0)]; armcpu_switchMode(cpu, oldmode); @@ -6185,7 +6185,7 @@ i = cpu->instruction; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - cpu->R[REG_POS(i,0)]; armcpu_switchMode(cpu, oldmode); @@ -6209,7 +6209,7 @@ i = cpu->instruction; LSL_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + shift_op; armcpu_switchMode(cpu, oldmode); @@ -6233,7 +6233,7 @@ i = cpu->instruction; LSL_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - shift_op; armcpu_switchMode(cpu, oldmode); @@ -6257,7 +6257,7 @@ i = cpu->instruction; LSR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + shift_op; armcpu_switchMode(cpu, oldmode); @@ -6281,7 +6281,7 @@ i = cpu->instruction; LSR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - shift_op; armcpu_switchMode(cpu, oldmode); @@ -6305,7 +6305,7 @@ i = cpu->instruction; ASR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + shift_op; armcpu_switchMode(cpu, oldmode); @@ -6329,7 +6329,7 @@ i = cpu->instruction; ASR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - shift_op; armcpu_switchMode(cpu, oldmode); @@ -6353,7 +6353,7 @@ i = cpu->instruction; ROR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr + shift_op; armcpu_switchMode(cpu, oldmode); @@ -6377,7 +6377,7 @@ i = cpu->instruction; ROR_IMM; adr = cpu->R[REG_POS(i,16)]; - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_POS(i,12)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_POS(i,12)]); cpu->R[REG_POS(i,16)] = adr - shift_op; armcpu_switchMode(cpu, oldmode); @@ -6389,7 +6389,7 @@ #define OP_L_IA(reg, adr) if(BIT##reg(i))\ {\ - registres[reg] = MMU_readWord(cpu->proc_ID, start);\ + registres[reg] = cpu->mem_if->read32(cpu->mem_if->data, start);\ c += waitState[(start>>24)&0xF];\ adr += 4;\ } @@ -6397,13 +6397,13 @@ #define OP_L_IB(reg, adr) if(BIT##reg(i))\ {\ adr += 4;\ - registres[reg] = MMU_readWord(cpu->proc_ID, start);\ + registres[reg] = cpu->mem_if->read32(cpu->mem_if->data, start);\ c += waitState[(start>>24)&0xF];\ } #define OP_L_DA(reg, adr) if(BIT##reg(i))\ {\ - registres[reg] = MMU_readWord(cpu->proc_ID, start);\ + registres[reg] = cpu->mem_if->read32(cpu->mem_if->data, start);\ c += waitState[(start>>24)&0xF];\ adr -= 4;\ } @@ -6411,7 +6411,7 @@ #define OP_L_DB(reg, adr) if(BIT##reg(i))\ {\ adr -= 4;\ - registres[reg] = MMU_readWord(cpu->proc_ID, start);\ + registres[reg] = cpu->mem_if->read32(cpu->mem_if->data, start);\ c += waitState[(start>>24)&0xF];\ } @@ -6442,8 +6442,8 @@ if(BIT15(i)) { - u32 tmp = MMU_readWord(cpu->proc_ID, start); - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + u32 tmp = cpu->mem_if->read32(cpu->mem_if->data, start); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); cpu->CPSR.bits.T = BIT0(tmp); //start += 4; cpu->next_instruction = registres[15]; @@ -6483,8 +6483,8 @@ u32 tmp; start += 4; c += waitState[(start>>24)&0xF]; - tmp = MMU_readWord(cpu->proc_ID, start); - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + tmp = cpu->mem_if->read32(cpu->mem_if->data, start); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); cpu->CPSR.bits.T = BIT0(tmp); cpu->next_instruction = registres[15]; c += 2 + (c==0); @@ -6504,8 +6504,8 @@ if(BIT15(i)) { - u32 tmp = MMU_readWord(cpu->proc_ID, start); - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + u32 tmp = cpu->mem_if->read32(cpu->mem_if->data, start); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); cpu->CPSR.bits.T = BIT0(tmp); c += waitState[(start>>24)&0xF]; start -= 4; @@ -6544,8 +6544,8 @@ { u32 tmp; start -= 4; - tmp = MMU_readWord(cpu->proc_ID, start); - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + tmp = cpu->mem_if->read32(cpu->mem_if->data, start); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); cpu->CPSR.bits.T = BIT0(tmp); cpu->next_instruction = registres[15]; c += waitState[(start>>24)&0xF]; @@ -6603,8 +6603,8 @@ if(BIT15(i)) { - u32 tmp = MMU_readWord(cpu->proc_ID, start); - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + u32 tmp = cpu->mem_if->read32(cpu->mem_if->data, start); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); cpu->CPSR.bits.T = BIT0(tmp); c += waitState[(start>>24)&0xF]; start += 4; @@ -6657,8 +6657,8 @@ u32 tmp; start += 4; c += waitState[(start>>24)&0xF]; - tmp = MMU_readWord(cpu->proc_ID, start); - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + tmp = cpu->mem_if->read32(cpu->mem_if->data, start); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); cpu->CPSR.bits.T = BIT0(tmp); cpu->next_instruction = registres[15]; c += 2 + (c==0); @@ -6691,8 +6691,8 @@ if(BIT15(i)) { - u32 tmp = MMU_readWord(cpu->proc_ID, start); - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + u32 tmp = cpu->mem_if->read32(cpu->mem_if->data, start); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); cpu->CPSR.bits.T = BIT0(tmp); c += waitState[(start>>24)&0xF]; start -= 4; @@ -6738,8 +6738,8 @@ { u32 tmp; start -= 4; - tmp = MMU_readWord(cpu->proc_ID, start); - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + tmp = cpu->mem_if->read32(cpu->mem_if->data, start); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); cpu->CPSR.bits.T = BIT0(tmp); cpu->next_instruction = registres[15]; c += waitState[(start>>24)&0xF]; @@ -6804,9 +6804,9 @@ if(BIT15(i)) { - u32 tmp = MMU_readWord(cpu->proc_ID, start); + u32 tmp = cpu->mem_if->read32(cpu->mem_if->data, start); Status_Reg SPSR; - cpu->R[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + cpu->R[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); SPSR = cpu->SPSR; armcpu_switchMode(cpu, SPSR.bits.mode); cpu->CPSR=SPSR; @@ -6862,8 +6862,8 @@ u32 tmp; Status_Reg SPSR; start += 4; - tmp = MMU_readWord(cpu->proc_ID, start); - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + tmp = cpu->mem_if->read32(cpu->mem_if->data, start); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); SPSR = cpu->SPSR; armcpu_switchMode(cpu, SPSR.bits.mode); cpu->CPSR=SPSR; @@ -6900,8 +6900,8 @@ if(BIT15(i)) { - u32 tmp = MMU_readWord(cpu->proc_ID, start); - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + u32 tmp = cpu->mem_if->read32(cpu->mem_if->data, start); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); cpu->CPSR = cpu->SPSR; c += waitState[(start>>24)&0xF]; start -= 4; @@ -6962,8 +6962,8 @@ { u32 tmp; start -= 4; - tmp = MMU_readWord(cpu->proc_ID, start); - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + tmp = cpu->mem_if->read32(cpu->mem_if->data, start); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); cpu->CPSR = cpu->SPSR; cpu->next_instruction = registres[15]; c += waitState[(start>>24)&0xF]; @@ -7045,8 +7045,8 @@ } registres[REG_POS(i,16)] = start + 4; - tmp = MMU_readWord(cpu->proc_ID, start); - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + tmp = cpu->mem_if->read32(cpu->mem_if->data, start); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); SPSR = cpu->SPSR; armcpu_switchMode(cpu, SPSR.bits.mode); cpu->CPSR=SPSR; @@ -7103,8 +7103,8 @@ } registres[REG_POS(i,16)] = start + 4; - tmp = MMU_readWord(cpu->proc_ID, start + 4); - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + tmp = cpu->mem_if->read32(cpu->mem_if->data, start + 4); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); cpu->CPSR = cpu->SPSR; cpu->next_instruction = registres[15]; SPSR = cpu->SPSR; @@ -7138,8 +7138,8 @@ if(BIT15(i)) { - u32 tmp = MMU_readWord(cpu->proc_ID, start); - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + u32 tmp = cpu->mem_if->read32(cpu->mem_if->data, start); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); c += waitState[(start>>24)&0xF]; start -= 4; cpu->next_instruction = registres[15]; @@ -7200,9 +7200,9 @@ { u32 tmp; start -= 4; - tmp = MMU_readWord(cpu->proc_ID, start); + tmp = cpu->mem_if->read32(cpu->mem_if->data, start); c += waitState[(start>>24)&0xF]; - registres[15] = tmp & (0X0FFFFFFC | (BIT0(tmp)<<1)); + registres[15] = tmp & (0XFFFFFFFC | (BIT0(tmp)<<1)); cpu->CPSR = cpu->SPSR; cpu->next_instruction = registres[15]; } @@ -7248,7 +7248,7 @@ { if(BIT_N(i, b)) { - MMU_writeWord(cpu->proc_ID, start, cpu->R[b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; start += 4; } @@ -7266,7 +7266,7 @@ if(BIT_N(i, b)) { start += 4; - MMU_writeWord(cpu->proc_ID, start, cpu->R[b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; } } @@ -7282,7 +7282,7 @@ { if(BIT_N(i, 15-b)) { - MMU_writeWord(cpu->proc_ID, start, cpu->R[15-b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[15-b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; start -= 4; } @@ -7300,7 +7300,7 @@ if(BIT_N(i, 15-b)) { start -= 4; - MMU_writeWord(cpu->proc_ID, start, cpu->R[15-b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[15-b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; } } @@ -7316,7 +7316,7 @@ { if(BIT_N(i, b)) { - MMU_writeWord(cpu->proc_ID, start, cpu->R[b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; start += 4; } @@ -7336,7 +7336,7 @@ if(BIT_N(i, b)) { start += 4; - MMU_writeWord(cpu->proc_ID, start, cpu->R[b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; } } @@ -7353,7 +7353,7 @@ { if(BIT_N(i, 15-b)) { - MMU_writeWord(cpu->proc_ID, start, cpu->R[15-b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[15-b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; start -= 4; } @@ -7373,7 +7373,7 @@ if(BIT_N(i, 15-b)) { start -= 4; - MMU_writeWord(cpu->proc_ID, start, cpu->R[15-b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[15-b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; } } @@ -7402,7 +7402,7 @@ { if(BIT_N(i, b)) { - MMU_writeWord(cpu->proc_ID, start, cpu->R[b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; start += 4; } @@ -7433,7 +7433,7 @@ if(BIT_N(i, b)) { start += 4; - MMU_writeWord(cpu->proc_ID, start, cpu->R[b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; } } @@ -7462,7 +7462,7 @@ { if(BIT_N(i, 15-b)) { - MMU_writeWord(cpu->proc_ID, start, cpu->R[15-b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[15-b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; start -= 4; } @@ -7490,7 +7490,7 @@ if(BIT_N(i, 15-b)) { start -= 4; - MMU_writeWord(cpu->proc_ID, start, cpu->R[15-b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[15-b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; } } @@ -7519,7 +7519,7 @@ { if(BIT_N(i, b)) { - MMU_writeWord(cpu->proc_ID, start, cpu->R[b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; start += 4; } @@ -7549,7 +7549,7 @@ if(BIT_N(i, b)) { start += 4; - MMU_writeWord(cpu->proc_ID, start, cpu->R[b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; } } @@ -7578,7 +7578,7 @@ { if(BIT_N(i, 15-b)) { - MMU_writeWord(cpu->proc_ID, start, cpu->R[15-b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[15-b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; start -= 4; } @@ -7612,7 +7612,7 @@ if(BIT_N(i, 15-b)) { start -= 4; - MMU_writeWord(cpu->proc_ID, start, cpu->R[15-b]); + cpu->mem_if->write32(cpu->mem_if->data, start, cpu->R[15-b]); c += MMU.MMU_WAIT32[cpu->proc_ID][(start>>24)&0xF]; } } @@ -7623,6 +7623,91 @@ return c + 1; } +/* + * + * The Enhanced DSP Extension LDRD and STRD instructions. + * + */ +static u32 FASTCALL +OP_LDRD_STRD_POST_INDEX( armcpu_t *cpu) { + u32 i = cpu->instruction; + u32 Rd_num = REG_POS( i, 12); + u32 addr = cpu->R[REG_POS(i,16)]; + u32 index; + + /* I bit - immediate or register */ + if ( BIT22(i)) + index = IMM_OFF; + else + index = cpu->R[REG_POS(i,0)]; + + /* U bit - add or subtract */ + if ( BIT23(i)) + cpu->R[REG_POS(i,16)] += index; + else + cpu->R[REG_POS(i,16)] -= index; + + if ( !(Rd_num & 0x1)) { + /* Store/Load */ + if ( BIT5(i)) { + cpu->mem_if->write32(cpu->mem_if->data, addr, cpu->R[Rd_num]); + cpu->mem_if->write32(cpu->mem_if->data, addr + 4, cpu->R[Rd_num + 1]); + } + else { + cpu->R[Rd_num] = cpu->mem_if->read32(cpu->mem_if->data, addr); + cpu->R[Rd_num + 1] = cpu->mem_if->read32(cpu->mem_if->data, addr + 4); + } + } + + return 3 + (MMU.MMU_WAIT32[cpu->proc_ID][(addr>>24)&0xF] * 2); +} + +static u32 FASTCALL +OP_LDRD_STRD_OFFSET_PRE_INDEX( armcpu_t *cpu) { + u32 i = cpu->instruction; + u32 Rd_num = REG_POS( i, 12); + u32 addr = cpu->R[REG_POS(i,16)]; + u32 index; + + /* I bit - immediate or register */ + if ( BIT22(i)) + index = IMM_OFF; + else + index = cpu->R[REG_POS(i,0)]; + + /* U bit - add or subtract */ + if ( BIT23(i)) { + addr += index; + + /* W bit - writeback */ + if ( BIT21(i)) + cpu->R[REG_POS(i,16)] = addr; + } + else { + addr -= index; + + /* W bit - writeback */ + if ( BIT21(i)) + cpu->R[REG_POS(i,16)] = addr; + } + + if ( !(Rd_num & 0x1)) { + /* Store/Load */ + if ( BIT5(i)) { + cpu->mem_if->write32(cpu->mem_if->data, addr, cpu->R[Rd_num]); + cpu->mem_if->write32(cpu->mem_if->data, addr + 4, cpu->R[Rd_num + 1]); + } + else { + cpu->R[Rd_num] = cpu->mem_if->read32(cpu->mem_if->data, addr); + cpu->R[Rd_num + 1] = cpu->mem_if->read32(cpu->mem_if->data, addr + 4); + } + } + + return 3 + (MMU.MMU_WAIT32[cpu->proc_ID][(addr>>24)&0xF] * 2); +} + + + //---------------------STC---------------------------------- static u32 FASTCALL OP_STC_P_IMM_OFF(armcpu_t *cpu) diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/bios.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/bios.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/bios.c 2006-11-18 19:45:22.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/bios.c 2007-05-23 06:44:10.000000000 -0500 @@ -22,6 +22,7 @@ #include "cp15.h" #include #include "MMU.h" +#include "SPU.h" #include "debug.h" extern BOOL execute; @@ -878,7 +879,7 @@ source += 4; if(((source & 0xe000000) == 0) || - ((source + ((header >> 8) & 0x1fffff) & 0xe000000) == 0)) + (( (source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0)) return 0; len = header >> 8; @@ -963,18 +964,29 @@ u32 getCRC16(armcpu_t* cpu) { - int i,j; - u32 crc; + unsigned int i,j; - u16 start = cpu->R[0]; - u16 datap = cpu->R[1]; + u32 crc = cpu->R[0]; + u32 datap = cpu->R[1]; u32 size = cpu->R[2]; static u16 val[] = { 0xC0C1,0xC181,0xC301,0xC601,0xCC01,0xD801,0xF001,0xA001 }; - for(i=datap; i<(datap+size); i++) + for(i = 0; i < size; i++) { - crc=crc ^ MMU_readHWord(cpu->proc_ID,datap+i); - for(j=0; j<7; j++) crc=crc >> 1; if(crc) crc=crc ^ (val[j] << (7-j)); + crc = crc ^ MMU_readByte( cpu->proc_ID, datap + i); + + for(j = 0; j < 8; j++) { + int do_bit = 0; + + if ( crc & 0x1) + do_bit = 1; + + crc = crc >> 1; + + if ( do_bit) { + crc = crc ^ (val[j] << (7-j)); + } + } } cpu->R[0] = crc; return 1; diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/cflash.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cflash.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/cflash.c 2007-01-31 15:54:55.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cflash.c 2007-06-07 04:47:34.000000000 -0500 @@ -19,13 +19,89 @@ */ +#include +#include +#include #include + +#include +#include +#ifdef WIN32 +#include +#define OPEN_MODE _O_RDWR | _O_BINARY + +#define OPEN_FN _open +#define CLOSE_FN _close +#define LSEEK_FN _lseek +#define WRITE_FN _write +#define READ_FN _read +#else +#define OPEN_MODE O_RDWR + +#define OPEN_FN open +#define CLOSE_FN close +#define LSEEK_FN lseek +#define WRITE_FN write +#define READ_FN read +#endif + +#include "types.h" #include "fs.h" +#include "MMU.h" #include "cflash.h" #include "NDSSystem.h" -#include -#include +#ifdef WIN32 +#include +#include +static void +debug_output( const char *fmt, ...) { + char debug_string[2048]; + va_list ap; + va_start( ap, fmt); + + vsprintf( debug_string, fmt, ap); + OutputDebugStringA( debug_string); + + va_end( ap); +} +#endif + +#if 0 +#ifdef WIN32 +#define LOCAL_LOG debug_output +#else +#define LOCAL_LOG( fmt, ...) printf("CFLASH: ");printf( fmt, ##__VA_ARGS__) +#endif +#else +#define LOCAL_LOG( fmt, ...) +#endif + +static int use_disk_image_file = 0; + +/* Set up addresses for GBAMP */ +#define CF_REG_DATA 0x9000000 +#define CF_REG_ERR 0x9020000 +#define CF_REG_SEC 0x9040000 +#define CF_REG_LBA1 0x9060000 +#define CF_REG_LBA2 0x9080000 +#define CF_REG_LBA3 0x90A0000 +#define CF_REG_LBA4 0x90C0000 +#define CF_REG_CMD 0x90E0000 +#define CF_REG_STS 0x98C0000 + +// CF Card commands +#define CF_CMD_LBA 0xE0 +#define CF_CMD_READ 0x20 +#define CF_CMD_WRITE 0x30 + + +static int disk_image = -1; +static u32 file_size; + +static u16 cf_reg_sts, cf_reg_lba1, cf_reg_lba2, + cf_reg_lba3, cf_reg_lba4, cf_reg_cmd; +static u32 currLBA; #define SECPERFAT 128 #define SECPERCLUS 16 @@ -37,53 +113,45 @@ #define DIRENTSPERCLUS ((BYTESPERCLUS)/32) -u16 cf_reg_data,cf_reg_err,cf_reg_sec,cf_reg_lba1,cf_reg_lba2, - cf_reg_lba3,cf_reg_lba4,cf_reg_cmd,cf_reg_sts; -unsigned int CF_REG_DATA,CF_REG_ERR,CF_REG_SEC,CF_REG_LBA1,CF_REG_LBA2, - CF_REG_LBA3,CF_REG_LBA4,CF_REG_CMD,CF_REG_STS; - -BOOT_RECORD MBR; -DIR_ENT *files,*dirEntries,**dirEntryPtr; -FILE_INFO *fileLink,*dirEntryLink; -u32 currLBA; -u32 filesysFAT,filesysRootDir,filesysData; -u16 FAT16[SECPERFAT*256]; -u16 numExtraEntries[SECPERFAT*256]; -DIR_ENT *extraDirEntries[SECPERFAT*256]; -int numFiles,maxLevel,dirNum,numRootFiles; -int *dirEntriesInCluster,clusterNum, - firstDirEntCluster,lastDirEntCluster, - lastFileDataCluster; -char *sRomPath; -int activeDirEnt=-1; -u32 bufferStart; -u32 fileStartLBA,fileEndLBA; -u16 freadBuffer[256]; -u32 dwBytesRead; -FILE * hFile; -char fpath[255+1]; -BOOL cflashDeviceEnabled = FALSE; -char buffer[256]; -u32 dummy; - +static BOOT_RECORD MBR; +static DIR_ENT *files,*dirEntries,**dirEntryPtr; +static FILE_INFO *fileLink,*dirEntryLink; +static u32 filesysFAT,filesysRootDir,filesysData; +static u16 FAT16[SECPERFAT*256]; +static u16 numExtraEntries[SECPERFAT*256]; +static DIR_ENT *extraDirEntries[SECPERFAT*256]; +static int numFiles,maxLevel,dirNum,numRootFiles; +static int *dirEntriesInCluster, clusterNum, firstDirEntCluster, + lastDirEntCluster, lastFileDataCluster; +static char *sRomPath; +static int activeDirEnt=-1; +static u32 bufferStart; +static u32 fileStartLBA,fileEndLBA; +static u16 freadBuffer[256]; +static u32 dwBytesRead; +static FILE * hFile; +static char fpath[255+1]; +static BOOL cflashDeviceEnabled = FALSE; +static char buffer[256]; +static u32 dummy; -int lfn_checksum() { +static int lfn_checksum( void) { int i; u8 chk; chk = 0; - for (i=0; i < 11; i++) { - chk = ((chk & 1) ? 0x80 : 0) + (chk >> 1) + (i < 8 ? files[numFiles].name[i] : files[numFiles].ext[i - 8]); + for (i=0; i < (NAME_LEN + EXT_LEN); i++) { + chk = ((chk & 1) ? 0x80 : 0) + (chk >> 1) + (i < NAME_LEN ? files[numFiles].name[i] : files[numFiles].ext[i - NAME_LEN]); } return chk; } -const int lfnPos[13] = {1,3,5,7,9,14,16,18,20,22,24,28,30}; +static const int lfnPos[13] = {1,3,5,7,9,14,16,18,20,22,24,28,30}; /* Add a DIR_ENT for the files */ -void add_file(char *fname, FsEntry * entry, int fileLevel) { +static void add_file(char *fname, FsEntry * entry, int fileLevel) { int i,j,k,n; u8 chk; char *p; @@ -96,9 +164,9 @@ if (i<0) i = strlen(fname); for (j=0; j=strlen(fname)) break; files[numFiles].ext[j] = fname[j+i+1]; } @@ -142,9 +210,9 @@ if (i<0) i = strlen(fname); for (j=0; j=strlen(fname)) break; files[numFiles].ext[j] = fname[j+i+1]; } @@ -152,8 +220,7 @@ files[numFiles].ext[j] = 0x20; } - //files[numFiles].fileSize = entry->nFileSizeLow; - files[numFiles].fileSize = 0; + files[numFiles].fileSize = entry->fileSize; if (entry->flags & FS_IS_DIR) { if (strcmp(fname,".")==0) @@ -170,8 +237,8 @@ numFiles++; } else if (fileLevel > 0) { fileLink[fileLevel].filesInDir += 1; - strncpy((char*)&files[numFiles].name[0],".. ",8); - strncpy((char*)&files[numFiles].ext[0]," ",3); + strncpy((char*)&files[numFiles].name[0],".. ",NAME_LEN); + strncpy((char*)&files[numFiles].ext[0]," ",EXT_LEN); fileLink[numFiles].parent = fileLevel; files[numFiles].attrib = 0x10; numFiles++; @@ -181,7 +248,7 @@ /* List all files and subdirectories recursively */ -void list_files(char *fpath) { +static void list_files(char *fpath) { void * hFind; FsEntry entry; char DirSpec[255 + 1],SubDir[255+1]; @@ -237,7 +304,7 @@ /* Set up the MBR, FAT and DIR_ENTs */ -BOOL cflash_build_fat() { +static BOOL cflash_build_fat( void) { int i,j,k,l, clust,baseCluster,numClusters, clusterNum2,rootCluster; @@ -296,9 +363,9 @@ dirEntries[k++] = files[j]; if ((files[j].attrib & ATTRIB_LFN)==0) { if (files[j].attrib & ATTRIB_DIR) { - if (strncmp((char*)&files[j].name[0],". ",8)==0) { + if (strncmp((char*)&files[j].name[0],". ",NAME_LEN)==0) { dirEntries[k-1].startCluster = dirEntryLink[k-1].level; - } else if (strncmp((char*)&files[j].name[0],".. ",8)==0) { + } else if (strncmp((char*)&files[j].name[0],".. ",NAME_LEN)==0) { dirEntries[k-1].startCluster = dirEntryLink[k-1].parent; } else { clust++; @@ -405,49 +472,58 @@ } - - -BOOL cflash_init() { - cflashDeviceEnabled = FALSE; - currLBA = 0; - - /* Set up addresses for M3CF */ - /*CF_REG_DATA = 0x8800000; - CF_REG_ERR = 0x8820000; - CF_REG_SEC = 0x8840000; - CF_REG_LBA1 = 0x8860000; - CF_REG_LBA2 = 0x8880000; - CF_REG_LBA3 = 0x88A0000; - CF_REG_LBA4 = 0x88C0000; - CF_REG_CMD = 0x88E0000; - CF_REG_STS = 0x80C0000;*/ - - /* Set up addresses for GBAMP */ - CF_REG_DATA = 0x9000000; - CF_REG_ERR = 0x9020000; - CF_REG_SEC = 0x9040000; - CF_REG_LBA1 = 0x9060000; - CF_REG_LBA2 = 0x9080000; - CF_REG_LBA3 = 0x90A0000; - CF_REG_LBA4 = 0x90C0000; - CF_REG_CMD = 0x90E0000; - CF_REG_STS = 0x98C0000; +BOOL +cflash_init( const char *disk_image_filename) { + BOOL init_good = FALSE; + + if ( disk_image_filename != NULL) { + LOCAL_LOG("Using CFlash disk image file %s\n", disk_image_filename); + use_disk_image_file = 1; + disk_image = OPEN_FN( disk_image_filename, OPEN_MODE); + + if ( disk_image != -1) { + file_size = LSEEK_FN( disk_image, 0, SEEK_END); + LSEEK_FN( disk_image, 0, SEEK_SET); + + LOCAL_LOG( "Disk image size = %d (%d sectors)\n", + file_size, file_size / 512); + init_good = TRUE; + } + else { + LOCAL_LOG("Failed to open file %s: \"%s\"\n", + disk_image_filename, + strerror( errno)); + } + } + else { + cflashDeviceEnabled = FALSE; + currLBA = 0; - if (activeDirEnt != -1) - fclose(hFile); - activeDirEnt = -1; - fileStartLBA = fileEndLBA = 0xFFFFFFFF; - if (!cflash_build_fat()) - return FALSE; - cf_reg_sts = 0x58; // READY + if (activeDirEnt != -1) + fclose(hFile); + activeDirEnt = -1; + fileStartLBA = fileEndLBA = 0xFFFFFFFF; + if (!cflash_build_fat()) + return FALSE; + cf_reg_sts = 0x58; // READY + + cflashDeviceEnabled = TRUE; + init_good = TRUE; + } + + // READY + cf_reg_sts = 0x58; + + currLBA = 0; + cf_reg_lba1 = cf_reg_lba2 = + cf_reg_lba3 = cf_reg_lba4 = 0; - cflashDeviceEnabled = TRUE; - return TRUE; + return init_good; } /* Convert a space-padded 8.3 filename into an asciiz string */ -void fatstring_to_asciiz(int dirent,char *out,DIR_ENT *d) { +static void fatstring_to_asciiz(int dirent,char *out,DIR_ENT *d) { int i,j; DIR_ENT *pd; @@ -456,13 +532,13 @@ else pd = d; - for (i=0; i<8; i++) { + for (i=0; iname[i] == ' ') break; out[i] = pd->name[i]; } if ((pd->attrib & 0x10)==0) { out[i++] = '.'; - for (j=0; j<3; j++) { + for (j=0; jext[j] == ' ') break; out[i++] = pd->ext[j]; } @@ -473,7 +549,7 @@ /* Resolve the path of a files by working backwards through the directory entries */ -void resolve_path(int dirent) { +static void resolve_path(int dirent) { int i; char dirname[128]; @@ -483,7 +559,7 @@ ((dirEntries[i].attrib&ATTRIB_DIR)!=0)) { fatstring_to_asciiz(i,dirname,NULL); strncat(fpath,dirname,256-strlen(fpath)); - strncat(fpath,"\\",256-strlen(fpath)); + strncat(fpath,DIR_SEP,256-strlen(fpath)); dirent = i; break; } @@ -492,9 +568,10 @@ } + /* Read from a file using a 512 byte buffer */ -u16 fread_buffered(int dirent,u32 cluster,u32 offset) { - char fname[32]; +static u16 fread_buffered(int dirent,u32 cluster,u32 offset) { + char fname[2*NAME_LEN+EXT_LEN]; int i,j; offset += cluster*512*SECPERCLUS; @@ -516,16 +593,17 @@ /* replaced strcpy/cat with strncpy/strcat to fixed possible buffer overruns */ strncpy(fpath,sRomPath,256); - strncat(fpath,"\\",256-strlen(fpath)); + strncat(fpath,DIR_SEP,256-strlen(fpath)); resolve_path(dirent); fatstring_to_asciiz(dirent,fname,NULL); strncat(fpath,fname,256-strlen(fpath)); - hFile = fopen(fpath, "w"); - if (!hFile) - return 0; + hFile = fopen(fpath, "rb"); + if (!hFile) return 0; + bufferStart = offset; + fseek(hFile, offset, SEEK_SET); fread(&freadBuffer, 1, 512, hFile); bufferStart = offset; @@ -536,147 +614,238 @@ return freadBuffer[(offset-bufferStart)>>1]; } -/* Read from one of the CF device registers */ -unsigned int cflash_read(unsigned int address) { +unsigned int +cflash_read(unsigned int address) { + unsigned int ret_value = 0; +#define BUFFERED_BLOCK_SIZE 512 + static u8 block_buffer[BUFFERED_BLOCK_SIZE]; + static s32 buffered_start_index = -1; + + switch ( address) { + case CF_REG_STS: + ret_value = cf_reg_sts; + break; + + case CF_REG_DATA: + if (cf_reg_cmd == CF_CMD_READ) { + if ( use_disk_image_file) { + if ( disk_image != -1) { + u8 data[2]; +#if 1 + if ( currLBA < buffered_start_index || + currLBA >= (buffered_start_index + BUFFERED_BLOCK_SIZE)) { + size_t read_bytes = 0; + LSEEK_FN( disk_image, currLBA, SEEK_SET); + + while ( read_bytes < BUFFERED_BLOCK_SIZE) { + size_t cur_read = + READ_FN( disk_image, &block_buffer[read_bytes], + BUFFERED_BLOCK_SIZE - read_bytes); + + if ( cur_read == -1) { + break; + } + read_bytes += cur_read; + } + + LOCAL_LOG( "Read %d bytes\n", read_bytes); + + buffered_start_index = currLBA; + } + data[0] = block_buffer[currLBA - buffered_start_index]; + data[1] = block_buffer[currLBA + 1 - buffered_start_index]; +#else + lseek( disk_image, currLBA, SEEK_SET); + read( disk_image, data, 2); + +#endif + ret_value = data[1] << 8 | + data[0]; + } + currLBA += 2; + } + else { unsigned char *p; - u16 s; int i; u32 cluster,cluster2,cluster3,fileLBA; + cluster = (currLBA / (512 * SECPERCLUS)); + cluster2 = (((currLBA/512) - filesysData) / SECPERCLUS) + 2; - if (address == CF_REG_STS) { - s = cf_reg_sts; - return s; - - } else if (address == CF_REG_DATA) { - cluster = (currLBA / (512 * SECPERCLUS)); - cluster2 = (((currLBA/512) - filesysData) / SECPERCLUS) + 2; - - if (cf_reg_cmd == 0x20) { - // Reading from the MBR - if (currLBA < 512) { - p = (unsigned char*)&MBR; - s = T1ReadWord(p, currLBA); - - // Reading the FAT - } else if ((currLBA >= filesysFAT*512) && (currLBA < filesysRootDir*512)) { - p = (unsigned char*)&FAT16[0]; - s = T1ReadWord(p, currLBA - filesysFAT * 512); - - // Reading directory entries - } else if ((currLBA >= filesysRootDir*512) && - (cluster <= lastDirEntCluster)) { - cluster3 = ((currLBA - (SECRESV * 512)) / (512 * SECPERCLUS)); - i = (currLBA-(((cluster3-(filesysRootDir/SECPERCLUS))*SECPERCLUS+filesysRootDir)*512)); //(currLBA - cluster*BYTESPERCLUS); - if (i < (dirEntriesInCluster[cluster3]*32)) { - - p = (unsigned char*)dirEntryPtr[cluster3]; - s = T1ReadWord(p, i); - } else { - i /= 32; - i -= dirEntriesInCluster[cluster3]; - if ((i>=0)&&(i lastDirEntCluster) && (cluster2 <= lastFileDataCluster)) { //else if ((cluster>lastDirEntCluster)&&(cluster<=lastFileDataCluster)) { - fileLBA = currLBA - (filesysData-32)*512; // 32 = # sectors used for the root entries - - // Check if the read is from the currently opened file - if ((fileLBA >= fileStartLBA) && (fileLBA < fileEndLBA)) { - cluster = (fileLBA / (512 * SECPERCLUS)); - s = fread_buffered(activeDirEnt,cluster-dirEntries[activeDirEnt].startCluster,(fileLBA-fileStartLBA)&(BYTESPERCLUS-1)); - } else { - for (i=0; i=(dirEntries[i].startCluster*512*SECPERCLUS)) && - (fileLBA <(dirEntries[i].startCluster*512*SECPERCLUS)+dirEntries[i].fileSize) && - ((dirEntries[i].attrib & (ATTRIB_DIR|ATTRIB_LFN))==0)) { - cluster = (fileLBA / (512 * SECPERCLUS)); - s = fread_buffered(i,cluster-dirEntries[i].startCluster,fileLBA&(BYTESPERCLUS-1)); - break; - } - } - } - } - currLBA += 2; - return s; - } - - } else if (address == CF_REG_CMD) { - s = 0; - return 0; - - } else if (address == CF_REG_LBA1) { - s = cf_reg_lba1; - return s; - } - return 0; -} - - - - -/* Write to one of the CF device registers */ -void cflash_write(unsigned int address,unsigned int data) { - u32 cluster,cluster2,cluster3,fileLBA; - int i,j,k,l; - unsigned char *p; - u16 s; - DIR_ENT *d; - - if (address==CF_REG_STS) { - cf_reg_sts = data&0xFFFF; - - } else if (address==CF_REG_DATA) { - - } else if (address==CF_REG_CMD) { - cf_reg_cmd = data&0xFF; - cf_reg_sts = 0x58; // READY - - } else if (address==CF_REG_LBA1) { - cf_reg_lba1 = data&0xFF; - currLBA = (currLBA&0xFFFFFF00)|cf_reg_lba1; - - } else if (address==CF_REG_LBA2) { - cf_reg_lba2 = data&0xFF; - currLBA = (currLBA&0xFFFF00FF)|(cf_reg_lba2<<8); - - } else if (address==CF_REG_LBA3) { - cf_reg_lba3 = data&0xFF; - currLBA = (currLBA&0xFF00FFFF)|(cf_reg_lba3<<16); - - } else if (address==CF_REG_LBA4) { - cf_reg_lba4 = data&0xFF; - currLBA = (currLBA&0x00FFFFFF)|((cf_reg_lba4&0x0F)<<24); - currLBA *= 512; - } + // Reading from the MBR + if (currLBA < 512) { + p = (unsigned char*)&MBR; + ret_value = T1ReadWord(p, currLBA); + + // Reading the FAT + } else if ((currLBA >= filesysFAT*512) && (currLBA < filesysRootDir*512)) { + p = (unsigned char*)&FAT16[0]; + ret_value = T1ReadWord(p, currLBA - filesysFAT * 512); + + // Reading directory entries + } else if ((currLBA >= filesysRootDir*512) && + (cluster <= lastDirEntCluster)) { + cluster3 = ((currLBA - (SECRESV * 512)) / (512 * SECPERCLUS)); + i = (currLBA-(((cluster3-(filesysRootDir/SECPERCLUS))*SECPERCLUS+filesysRootDir)*512)); //(currLBA - cluster*BYTESPERCLUS); + if (i < (dirEntriesInCluster[cluster3]*32)) { + + p = (unsigned char*)dirEntryPtr[cluster3]; + ret_value = T1ReadWord(p, i); + } else { + i /= 32; + i -= dirEntriesInCluster[cluster3]; + if ((i>=0)&&(i lastDirEntCluster) && (cluster2 <= lastFileDataCluster)) { //else if ((cluster>lastDirEntCluster)&&(cluster<=lastFileDataCluster)) { + fileLBA = currLBA - (filesysData-32)*512; // 32 = # sectors used for the root entries + + // Check if the read is from the currently opened file + if ((fileLBA >= fileStartLBA) && (fileLBA < fileEndLBA)) { + cluster = (fileLBA / (512 * SECPERCLUS)); + ret_value = fread_buffered(activeDirEnt,cluster-dirEntries[activeDirEnt].startCluster,(fileLBA-fileStartLBA)&(BYTESPERCLUS-1)); + } else { + for (i=0; i=(dirEntries[i].startCluster*512*SECPERCLUS)) && + (fileLBA <(dirEntries[i].startCluster*512*SECPERCLUS)+dirEntries[i].fileSize) && + ((dirEntries[i].attrib & (ATTRIB_DIR|ATTRIB_LFN))==0)) { + cluster = (fileLBA / (512 * SECPERCLUS)); + ret_value = fread_buffered(i,cluster-dirEntries[i].startCluster,fileLBA&(BYTESPERCLUS-1)); + break; + } + } + } + } + currLBA += 2; + } + } + break; + + case CF_REG_CMD: + break; + + case CF_REG_LBA1: + ret_value = cf_reg_lba1; + break; + } + + return ret_value; +} + +void +cflash_write(unsigned int address,unsigned int data) { + static u8 sector_data[512]; + static u32 sector_write_index = 0; + + switch ( address) { + case CF_REG_STS: + cf_reg_sts = data&0xFFFF; + break; + + case CF_REG_DATA: + if ( use_disk_image_file) { + if (cf_reg_cmd == CF_CMD_WRITE) { + sector_data[sector_write_index] = (data >> 0) & 0xff; + sector_data[sector_write_index + 1] = (data >> 8) & 0xff; + + sector_write_index += 2; + + if ( sector_write_index == 512) { + LOCAL_LOG( "Write sector to %d\n", currLBA); + + if ( currLBA + 512 < file_size) { + size_t written = 0; + int i; + + if ( disk_image != -1) { + LSEEK_FN( disk_image, currLBA, SEEK_SET); + + while( written < 512) { + size_t cur_write = + WRITE_FN( disk_image, §or_data[written], 512 - written); + written += cur_write; + + if ( cur_write == -1) { + break; + } + } + } + + LOCAL_LOG("Wrote %u bytes\n", written); + } + currLBA += 512; + sector_write_index = 0; + } + } + } + break; + + case CF_REG_CMD: + cf_reg_cmd = data&0xFF; + cf_reg_sts = 0x58; // READY + break; + + case CF_REG_LBA1: + cf_reg_lba1 = data&0xFF; + currLBA = (currLBA&0xFFFFFF00)| cf_reg_lba1; + break; + + case CF_REG_LBA2: + cf_reg_lba2 = data&0xFF; + currLBA = (currLBA&0xFFFF00FF)|(cf_reg_lba2<<8); + break; + + case CF_REG_LBA3: + cf_reg_lba3 = data&0xFF; + currLBA = (currLBA&0xFF00FFFF)|(cf_reg_lba3<<16); + break; + + case CF_REG_LBA4: + cf_reg_lba4 = data&0xFF; + + if ( (cf_reg_lba4 & 0xf0) == CF_CMD_LBA) { + currLBA = (currLBA&0x00FFFFFF)|((cf_reg_lba4&0x0F)<<24); + currLBA *= 512; + sector_write_index = 0; + } + break; + } +} + +void +cflash_close( void) { + if ( use_disk_image_file) { + if ( disk_image != -1) { + CLOSE_FN( disk_image); + disk_image = -1; + } + } + else { + int i; + + if (cflashDeviceEnabled) { + cflashDeviceEnabled = FALSE; + + for (i=0; i #include #include + +#ifndef VERSION +#define VERSION "Unknown version" +#endif + +/* + * FIXME: Not sure how to detect OpenGL in a platform portable way. + */ +#ifdef HAVE_GL_GL_H +#define INCLUDE_OPENGL_2D 1 +#endif + +#ifdef INCLUDE_OPENGL_2D +#include +#include +#endif + #ifndef CLI_UI #define CLI_UI #endif @@ -33,10 +51,26 @@ #include "../debug.h" #include "../sndsdl.h" #include "../ctrlssdl.h" +#include "../render3D.h" +#include "../gdbstub.h" volatile BOOL execute = FALSE; -SDL_Surface * surface; +static float nds_screen_size_ratio = 1.0f; + +#define DISPLAY_FPS 1 + +#ifdef DISPLAY_FPS +#define NUM_FRAMES_TO_TIME 60 +#endif + + +#define FPS_LIMITER_FRAME_PERIOD 8 + +static SDL_Surface * surface; + +/* Flags to pass to SDL_SetVideoMode */ +static int sdl_videoFlags = 0; SoundInterface_struct *SNDCoreList[] = { &SNDDummy, @@ -45,6 +79,11 @@ NULL }; +GPU3DInterface *core3DList[] = { +&gpu3DNull +}; + + /* Our keyboard config is different because of the directional keys */ const u16 cli_kb_cfg[NB_KEYS] = { SDLK_c, // A @@ -63,37 +102,538 @@ SDLK_o // BOOST }; -int Draw() { +struct my_config { + u16 arm9_gdb_port; + u16 arm7_gdb_port; + + int disable_sound; + +#ifdef INCLUDE_OPENGL_2D + int opengl_2d; + int soft_colour_convert; +#endif + int disable_limiter; + + int firmware_language; + + const char *nds_file; + const char *cflash_disk_image_file; +}; + +static void +init_config( struct my_config *config) { + config->arm9_gdb_port = 0; + config->arm7_gdb_port = 0; + + config->disable_sound = 0; + + config->disable_limiter = 0; + + config->nds_file = NULL; + + config->cflash_disk_image_file = NULL; + +#ifdef INCLUDE_OPENGL_2D + config->opengl_2d = 0; + config->soft_colour_convert = 0; +#endif + + /* use the default language */ + config->firmware_language = -1; +} + + +static int +fill_config( struct my_config *config, + int argc, char ** argv) { + int good_args = 1; + int print_usage = 0; + int i; + + for ( i = 1; i < argc && good_args; i++) { + if ( strcmp( argv[i], "--help") == 0) { + printf( "USAGE: %s \n", argv[0]); + printf( "OPTIONS:\n"); + printf( " --disable-sound Disables the sound emulation\n"); + printf( " --disable-limiter Disables the 60 fps limiter\n"); +#ifdef INCLUDE_OPENGL_2D + printf( " --opengl-2d Enables using OpenGL for screen rendering\n"); + printf( " --soft-convert Use software colour conversion during OpenGL\n"); + printf( " screen rendering. May produce better or worse\n"); + printf( " frame rates depending on hardware.\n"); +#endif + printf( "\n"); + printf( " --fwlang=LANG Set the language in the firmware, LANG as follows:\n"); + printf( " 0 = Japanese\n"); + printf( " 1 = English\n"); + printf( " 2 = French\n"); + printf( " 3 = German\n"); + printf( " 4 = Italian\n"); + printf( " 5 = Spanish\n"); + printf( "\n"); + printf( " --arm9gdb=PORT_NUM Enable the ARM9 GDB stub on the given port\n"); + printf( " --arm7gdb=PORT_NUM Enable the ARM7 GDB stub on the given port\n"); + //printf( " --sticky Enable sticky keys and stylus\n"); + printf( "\n"); + printf( " --cflash=PATH_TO_DISK_IMAGE\n"); + printf( " Enable disk image GBAMP compact flash emulation\n"); + printf( "\n"); + printf( " --help Display this message\n"); + printf( " --version Display the version\n"); + good_args = 0; + } + else if ( strcmp( argv[i], "--version") == 0) { + printf( "%s\n", VERSION); + good_args = 0; + } + else if ( strcmp( argv[i], "--disable-sound") == 0) { + config->disable_sound = 1; + } +#ifdef INCLUDE_OPENGL_2D + else if ( strcmp( argv[i], "--opengl-2d") == 0) { + config->opengl_2d = 1; + } + else if ( strcmp( argv[i], "--soft-convert") == 0) { + config->soft_colour_convert = 1; + } +#endif + else if ( strcmp( argv[i], "--disable-limiter") == 0) { + config->disable_limiter = 1; + } + else if ( strncmp( argv[i], "--fwlang=", 9) == 0) { + char *end_char; + int lang = strtoul( &argv[i][9], &end_char, 10); + + if ( lang >= 0 && lang <= 5) { + config->firmware_language = lang; + } + else { + fprintf( stderr, "Firmware language must be set to a value from 0 to 5.\n"); + good_args = 0; + } + } + else if ( strncmp( argv[i], "--arm9gdb=", 10) == 0) { + char *end_char; + unsigned long port_num = strtoul( &argv[i][10], &end_char, 10); + + if ( port_num > 0 && port_num < 65536) { + config->arm9_gdb_port = port_num; + } + else { + fprintf( stderr, "ARM9 GDB stub port must be in the range 1 to 65535\n"); + good_args = 0; + } + } + else if ( strncmp( argv[i], "--arm7gdb=", 10) == 0) { + char *end_char; + unsigned long port_num = strtoul( &argv[i][10], &end_char, 10); + + if ( port_num > 0 && port_num < 65536) { + config->arm7_gdb_port = port_num; + } + else { + fprintf( stderr, "ARM7 GDB stub port must be in the range 1 to 65535\n"); + good_args = 0; + } + } + else if ( strncmp( argv[i], "--cflash=", 9) == 0) { + if ( config->cflash_disk_image_file == NULL) { + config->cflash_disk_image_file = &argv[i][9]; + } + else { + fprintf( stderr, "CFlash disk image file (\"%s\") already set\n", + config->cflash_disk_image_file); + good_args = 0; + } + } + else { + if ( config->nds_file == NULL) { + config->nds_file = argv[i]; + } + else { + fprintf( stderr, "NDS file (\"%s\") already set\n", config->nds_file); + good_args = 0; + } + } + } + + if ( good_args) { + if ( config->nds_file == NULL) { + print_usage = 1; + good_args = 0; + } + } + + if ( print_usage) { + fprintf( stderr, "USAGE: %s \n", argv[0]); + } + + return good_args; +} + + +/* + * The thread handling functions needed by the GDB stub code. + */ +void * +createThread_gdb( void (*thread_function)( void *data), + void *thread_data) { + SDL_Thread *new_thread = SDL_CreateThread( (int (*)(void *data))thread_function, + thread_data); + + return new_thread; +} + +void +joinThread_gdb( void *thread_handle) { + int ignore; + SDL_WaitThread( thread_handle, &ignore); +} + + + +/** + * A SDL timer callback function. Signals the supplied SDL semaphore + * if its value is small. + * + * @param interval The interval since the last call (in ms) + * @param param The pointer to the semaphore. + * + * @return The interval to the next call (required by SDL) + */ +static Uint32 +fps_limiter_fn( Uint32 interval, void *param) { + SDL_sem *sdl_semaphore = (SDL_sem *)param; + + /* signal the semaphore if it is getting low */ + if ( SDL_SemValue( sdl_semaphore) < 4) { + SDL_SemPost( sdl_semaphore); + } + + return interval; +} + + +#ifdef INCLUDE_OPENGL_2D +/* initialization openGL function */ +static int +initGL( GLuint *screen_texture) { + GLenum errCode; + int init_good = 1; + int i; + u16 blank_texture[256 * 512]; + + for ( i = 0; i < 256 * 512; i++) { + blank_texture[i] = 0x001f; + } + + + /* Enable Texture Mapping */ + glEnable( GL_TEXTURE_2D ); + + /* Set the background black */ + glClearColor( 0.0f, 0.0f, 0.0f, 0.5f ); + + /* Depth buffer setup */ + glClearDepth( 1.0f ); + + /* Enables Depth Testing */ + glEnable( GL_DEPTH_TEST ); + + /* The Type Of Depth Test To Do */ + glDepthFunc( GL_LEQUAL ); + + /* Create The Texture */ + glGenTextures( 1, &screen_texture[0]); + + glBindTexture( GL_TEXTURE_2D, screen_texture[0]); + + /* Generate The Texture */ + glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, 256, 512, + 0, GL_RGBA, + GL_UNSIGNED_SHORT_1_5_5_5_REV, + blank_texture); + + /* Linear Filtering */ + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + + if ((errCode = glGetError()) != GL_NO_ERROR) { + const GLubyte *errString; + + errString = gluErrorString(errCode); + fprintf( stderr, "Failed to init GL: %s\n", errString); + + init_good = 0; + } + + return init_good; +} + +static void +resizeWindow( u16 width, u16 height) { + int comp_width = 3 * width; + int comp_height = 2 * height; + int use_width = 1; + GLenum errCode; + + /* Height / width ration */ + GLfloat ratio; + + if ( comp_width > comp_height) { + use_width = 0; + } + + /* Protect against a divide by zero */ + if ( height == 0 ) + height = 1; + if ( width == 0) + width = 1; + + ratio = ( GLfloat )width / ( GLfloat )height; + + /* Setup our viewport. */ + glViewport( 0, 0, ( GLint )width, ( GLint )height ); + + /* + * change to the projection matrix and set + * our viewing volume. + */ + glMatrixMode( GL_PROJECTION ); + glLoadIdentity( ); + + { + double left; + double right; + double bottom; + double top; + double other_dimen; + + if ( use_width) { + left = 0.0; + right = 256.0; + + nds_screen_size_ratio = 256.0 / (double)width; + + other_dimen = (double)width * 3.0 / 2.0; + + top = 0.0; + bottom = 384.0 * ((double)height / other_dimen); + } + else { + top = 0.0; + bottom = 384.0; + + nds_screen_size_ratio = 384.0 / (double)height; + + other_dimen = (double)height * 2.0 / 3.0; + + left = 0.0; + right = 256.0 * ((double)width / other_dimen); + } + + /* + printf("%d,%d\n", width, height); + printf("l %lf, r %lf, t %lf, b %lf, other dimen %lf\n", + left, right, top, bottom, other_dimen); + */ + + /* get the area (0,0) to (256,384) into the middle of the viewport */ + gluOrtho2D( left, right, bottom, top); + } + + /* Make sure we're chaning the model view and not the projection */ + glMatrixMode( GL_MODELVIEW ); + + /* Reset The View */ + glLoadIdentity( ); + + if ((errCode = glGetError()) != GL_NO_ERROR) { + const GLubyte *errString; + + errString = gluErrorString(errCode); + fprintf( stderr, "GL resize failed: %s\n", errString); + } + + surface = SDL_SetVideoMode( width, height, 32, + sdl_videoFlags ); +} + + +static void +opengl_Draw( GLuint *texture, int software_convert) { + GLenum errCode; + + /* Clear The Screen And The Depth Buffer */ + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + /* Move Into The Screen 5 Units */ + glLoadIdentity( ); + + /* Select screen Texture */ + glBindTexture( GL_TEXTURE_2D, texture[0]); + if ( software_convert) { + int i; + u8 converted[256 * 384 * 3]; + + for ( i = 0; i < (256 * 384); i++) { + converted[(i * 3) + 0] = ((*((u16 *)&GPU_screen[(i<<1)]) >> 0) & 0x1f) << 3; + converted[(i * 3) + 1] = ((*((u16 *)&GPU_screen[(i<<1)]) >> 5) & 0x1f) << 3; + converted[(i * 3) + 2] = ((*((u16 *)&GPU_screen[(i<<1)]) >> 10) & 0x1f) << 3; + } + + glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 256, 384, + GL_RGB, + GL_UNSIGNED_BYTE, + converted); + } + else { + glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 256, 384, + GL_RGBA, + GL_UNSIGNED_SHORT_1_5_5_5_REV, + &GPU_screen); + } + + if ((errCode = glGetError()) != GL_NO_ERROR) { + const GLubyte *errString; + + errString = gluErrorString(errCode); + fprintf( stderr, "GL subimage failed: %s\n", errString); + } + + + /* Draw the screen as a textured quad */ + glBegin( GL_QUADS); + glTexCoord2f( 0.0f, 0.0f ); glVertex3f( 0.0f, 0.0f, 0.0f ); + glTexCoord2f( 1.0f, 0.0f ); glVertex3f( 256.0f, 0.0f, 0.0f ); + glTexCoord2f( 1.0f, 0.75f ); glVertex3f( 256.0f, 384.0f, 0.0f ); + glTexCoord2f( 0.0f, 0.75f ); glVertex3f( 0.0f, 384.0f, 0.0f ); + glEnd( ); + + if ((errCode = glGetError()) != GL_NO_ERROR) { + const GLubyte *errString; + + errString = gluErrorString(errCode); + fprintf( stderr, "GL draw failed: %s\n", errString); + } + + /* Draw it to the screen */ + SDL_GL_SwapBuffers( ); +} +#endif + +static void +Draw( void) { SDL_Surface *rawImage; rawImage = SDL_CreateRGBSurfaceFrom((void*)&GPU_screen, 256, 384, 16, 512, 0x001F, 0x03E0, 0x7C00, 0); - if(rawImage == NULL) return 1; + if(rawImage == NULL) return; SDL_BlitSurface(rawImage, 0, surface, 0); + SDL_UpdateRect(surface, 0, 0, 0, 0); SDL_FreeSurface(rawImage); - return 1; + return; } + int main(int argc, char ** argv) { static unsigned short keypad = 0; - u32 last_cycle; + struct my_config my_config; + u32 last_cycle = 0; + gdbstub_handle_t arm9_gdb_stub; + gdbstub_handle_t arm7_gdb_stub; + struct armcpu_memory_iface *arm9_memio = &arm9_base_memory_iface; + struct armcpu_memory_iface *arm7_memio = &arm7_base_memory_iface; + struct armcpu_ctrl_iface *arm9_ctrl_iface; + struct armcpu_ctrl_iface *arm7_ctrl_iface; + + int limiter_frame_counter = 0; + SDL_sem *fps_limiter_semaphore; + SDL_TimerID limiter_timer; + int sdl_quit = 0; + +#ifdef DISPLAY_FPS + u32 fps_timing = 0; + u32 fps_frame_counter = 0; + u32 fps_previous_time = 0; + u32 fps_temp_time; +#endif + +#ifdef INCLUDE_OPENGL_2D + GLuint screen_texture[1]; +#endif + /* this holds some info about our display */ + const SDL_VideoInfo *videoInfo; + + /* the firmware settings */ + struct NDS_fw_config_data fw_config; + + /* default the firmware settings, they may get changed later */ + NDS_FillDefaultFirmwareConfigData( &fw_config); + + init_config( &my_config); + + if ( !fill_config( &my_config, argc, argv)) { + exit(1); + } + + /* use any language set on the command line */ + if ( my_config.firmware_language != -1) { + fw_config.language = my_config.firmware_language; + } + + if ( my_config.arm9_gdb_port != 0) { + arm9_gdb_stub = createStub_gdb( my_config.arm9_gdb_port, + &arm9_memio, + &arm9_direct_memory_iface); + + if ( arm9_gdb_stub == NULL) { + fprintf( stderr, "Failed to create ARM9 gdbstub on port %d\n", + my_config.arm9_gdb_port); + exit( 1); + } + } + if ( my_config.arm7_gdb_port != 0) { + arm7_gdb_stub = createStub_gdb( my_config.arm7_gdb_port, + &arm7_memio, + &arm7_base_memory_iface); + + if ( arm7_gdb_stub == NULL) { + fprintf( stderr, "Failed to create ARM7 gdbstub on port %d\n", + my_config.arm7_gdb_port); + exit( 1); + } + } #ifdef DEBUG LogStart(); #endif - NDS_Init(); - SPU_ChangeSoundCore(SNDCORE_SDL, 735 * 4); + NDS_Init( arm9_memio, &arm9_ctrl_iface, + arm7_memio, &arm7_ctrl_iface); + + /* Create the dummy firmware */ + NDS_CreateDummyFirmware( &fw_config); - if (argc < 2) { - fprintf(stderr, "usage: %s filename\n", argv[0]); - return 1; + if ( !my_config.disable_sound) { + SPU_ChangeSoundCore(SNDCORE_SDL, 735 * 4); } - if (NDS_LoadROM(argv[1], MC_TYPE_AUTODETECT, 1) < 0) { - fprintf(stderr, "error while loading %s\n", argv[1]); - return 2; + if (NDS_LoadROM( my_config.nds_file, MC_TYPE_AUTODETECT, 1, my_config.cflash_disk_image_file) < 0) { + fprintf(stderr, "error while loading %s\n", my_config.nds_file); + exit(-1); + } + + /* + * Activate the GDB stubs + * This has to come after the NDS_Init where the cpus are set up. + */ + if ( my_config.arm9_gdb_port != 0) { + activateStub_gdb( arm9_gdb_stub, arm9_ctrl_iface); + } + if ( my_config.arm7_gdb_port != 0) { + activateStub_gdb( arm7_gdb_stub, arm7_ctrl_iface); } /* // This has to get fixed yet @@ -104,7 +644,7 @@ execute = TRUE; - if(SDL_Init(SDL_INIT_VIDEO) == -1) + if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) == -1) { fprintf(stderr, "Error trying to initialize SDL: %s\n", SDL_GetError()); @@ -112,16 +652,100 @@ } SDL_WM_SetCaption("Desmume SDL", NULL); + /* Fetch the video info */ + videoInfo = SDL_GetVideoInfo( ); + if ( !videoInfo ) { + fprintf( stderr, "Video query failed: %s\n", SDL_GetError( ) ); + exit( -1); + } + + /* This checks if hardware blits can be done */ + if ( videoInfo->blit_hw ) + sdl_videoFlags |= SDL_HWACCEL; + +#ifdef INCLUDE_OPENGL_2D + if ( my_config.opengl_2d) { + /* the flags to pass to SDL_SetVideoMode */ + sdl_videoFlags = SDL_OPENGL; /* Enable OpenGL in SDL */ + sdl_videoFlags |= SDL_GL_DOUBLEBUFFER; /* Enable double buffering */ + sdl_videoFlags |= SDL_HWPALETTE; /* Store the palette in hardware */ + sdl_videoFlags |= SDL_RESIZABLE; /* Enable window resizing */ + + + /* This checks to see if surfaces can be stored in memory */ + if ( videoInfo->hw_available ) + sdl_videoFlags |= SDL_HWSURFACE; + else + sdl_videoFlags |= SDL_SWSURFACE; + + + /* Sets up OpenGL double buffering */ + SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); + + surface = SDL_SetVideoMode( 256, 192 * 2, 32, + sdl_videoFlags ); + + /* Verify there is a surface */ + if ( !surface ) { + fprintf( stderr, "Video mode set failed: %s\n", SDL_GetError( ) ); + exit( -1); + } + + + /* initialize OpenGL */ + if ( !initGL( screen_texture)) { + fprintf( stderr, "Failed to init GL, fall back to software render\n"); + + my_config.opengl_2d = 0; + } + } + + if ( !my_config.opengl_2d) { +#endif + sdl_videoFlags |= SDL_SWSURFACE; + surface = SDL_SetVideoMode(256, 384, 32, sdl_videoFlags); + + if ( !surface ) { + fprintf( stderr, "Video mode set failed: %s\n", SDL_GetError( ) ); + exit( -1); + } +#ifdef INCLUDE_OPENGL_2D + } + + /* set the initial window size */ + if ( my_config.opengl_2d) { + resizeWindow( 256, 192*2); + } +#endif + /* Initialize joysticks */ if(!init_joy()) return 1; /* Load our own keyboard configuration */ set_kb_keys(cli_kb_cfg); - surface = SDL_SetVideoMode(256, 384, 32, SDL_SWSURFACE); + if ( !my_config.disable_limiter) { + /* create the semaphore used for fps limiting */ + fps_limiter_semaphore = SDL_CreateSemaphore( 1); + + /* start a SDL timer for every FPS_LIMITER_FRAME_PERIOD frames to keep us at 60 fps */ + limiter_timer = SDL_AddTimer( 16 * FPS_LIMITER_FRAME_PERIOD, + fps_limiter_fn, fps_limiter_semaphore); + if ( limiter_timer == NULL) { + fprintf( stderr, "Error trying to start FPS limiter timer: %s\n", + SDL_GetError()); + return 1; + } + } + + while(!sdl_quit) { /* Look for queued events and update keypad status */ - keypad = process_ctrls_events(keypad); +#ifdef INCLUDE_OPENGL_2D + sdl_quit = process_ctrls_events( &keypad, resizeWindow, nds_screen_size_ratio); +#else + sdl_quit = process_ctrls_events( &keypad, NULL, nds_screen_size_ratio); +#endif /* Update mouse position and click */ if(mouse.down) NDS_setTouchPos(mouse.x, mouse.y); if(mouse.click) @@ -133,14 +757,69 @@ update_keypad(keypad); /* Update keypad */ last_cycle = NDS_exec((560190 << 1) - last_cycle, FALSE); SPU_Emulate(); - Draw(); + +#ifdef INCLUDE_OPENGL_2D + if ( my_config.opengl_2d) { + opengl_Draw( screen_texture, my_config.soft_colour_convert); + } + else +#endif + Draw(); + + if ( !my_config.disable_limiter) { + limiter_frame_counter += 1; + if ( limiter_frame_counter >= FPS_LIMITER_FRAME_PERIOD) { + limiter_frame_counter = 0; + + /* wait for the timer to expire */ + SDL_SemWait( fps_limiter_semaphore); + } + } + +#ifdef DISPLAY_FPS + fps_frame_counter += 1; + fps_temp_time = SDL_GetTicks(); + fps_timing += fps_temp_time - fps_previous_time; + fps_previous_time = fps_temp_time; + + if ( fps_frame_counter == NUM_FRAMES_TO_TIME) { + char win_title[100]; + float fps = (float)fps_timing; + fps /= NUM_FRAMES_TO_TIME * 1000.f; + fps = 1.0f / fps; + + //printf("fps %f\n", fps); + fps_frame_counter = 0; + fps_timing = 0; + + sprintf( win_title, "Desmume %f", fps); + + SDL_WM_SetCaption( win_title, NULL); + } +#endif } + + /* Unload joystick */ uninit_joy(); + if ( !my_config.disable_limiter) { + /* tidy up the FPS limiter timer and semaphore */ + SDL_RemoveTimer( limiter_timer); + SDL_DestroySemaphore( fps_limiter_semaphore); + } + SDL_Quit(); NDS_DeInit(); + + if ( my_config.arm9_gdb_port != 0) { + destroyStub_gdb( arm9_gdb_stub); + } + if ( my_config.arm7_gdb_port != 0) { + destroyStub_gdb( arm7_gdb_stub); + } + #ifdef DEBUG LogStop(); #endif diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/cli/Makefile.am /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cli/Makefile.am --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/cli/Makefile.am 2007-01-10 00:37:55.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cli/Makefile.am 2007-07-01 14:26:24.000000000 -0500 @@ -1,4 +1,7 @@ +include $(top_srcdir)/src/desmume.mk + +AM_CFLAGS += $(SDL_CFLAGS) + bin_PROGRAMS = desmume-cli desmume_cli_SOURCES = main.c ../sndsdl.c ../ctrlssdl.h ../ctrlssdl.c -desmume_cli_LDADD = ../libdesmume.a $(SDL_LIBS) -desmume_cli_CFLAGS = $(SDL_CFLAGS) +desmume_cli_LDADD = ../libdesmume.a ../gdbstub/libgdbstub.a $(SDL_LIBS) diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/cli/Makefile.in /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cli/Makefile.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/cli/Makefile.in 2007-01-18 23:47:54.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cli/Makefile.in 2007-09-03 12:31:41.000000000 -0500 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,15 +14,11 @@ @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -37,24 +33,26 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/src/desmume.mk bin_PROGRAMS = desmume-cli$(EXEEXT) subdir = src/cli -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) -am_desmume_cli_OBJECTS = desmume_cli-main.$(OBJEXT) \ - desmume_cli-sndsdl.$(OBJEXT) desmume_cli-ctrlssdl.$(OBJEXT) +am_desmume_cli_OBJECTS = main.$(OBJEXT) sndsdl.$(OBJEXT) \ + ctrlssdl.$(OBJEXT) desmume_cli_OBJECTS = $(am_desmume_cli_OBJECTS) am__DEPENDENCIES_1 = -desmume_cli_DEPENDENCIES = ../libdesmume.a $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I. -I$(srcdir) +desmume_cli_DEPENDENCIES = ../libdesmume.a ../gdbstub/libgdbstub.a \ + $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -67,22 +65,21 @@ CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ +ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ @@ -90,14 +87,48 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLADEUI_UNINSTALLED_DIR = @GLADEUI_UNINSTALLED_DIR@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ GREP = @GREP@ +GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ +GTHREAD_LIBS = @GTHREAD_LIBS@ +GTKGLEXT_CFLAGS = @GTKGLEXT_CFLAGS@ +GTKGLEXT_LIBS = @GTKGLEXT_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ HAVE_PKG = @HAVE_PKG@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ +INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ +INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ +INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ +INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ +INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ +INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ +INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ +INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ +INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ +INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ +INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ +INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ +INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ +INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ LDFLAGS = @LDFLAGS@ LIBGLADE_CFLAGS = @LIBGLADE_CFLAGS@ LIBGLADE_LIBS = @LIBGLADE_LIBS@ @@ -105,9 +136,11 @@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -117,6 +150,13 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_DIR = @PO_DIR@ +PO_FILES = @PO_FILES@ +PO_FILES_IN = @PO_FILES_IN@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RANLIB = @RANLIB@ SDLCONFIG = @SDLCONFIG@ SDL_CFLAGS = @SDL_CFLAGS@ @@ -126,13 +166,14 @@ STRIP = @STRIP@ UI_DIR = @UI_DIR@ USE_MAINTAINER_MODE = @USE_MAINTAINER_MODE@ +USE_NLS = @USE_NLS@ VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -144,6 +185,7 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ desmume_arch = @desmume_arch@ @@ -172,20 +214,25 @@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CFLAGS = $(SDL_CFLAGS) +AM_CPPFLAGS = -I$(top_srcdir)/src +AM_LDFLAGS = desmume_cli_SOURCES = main.c ../sndsdl.c ../ctrlssdl.h ../ctrlssdl.c -desmume_cli_LDADD = ../libdesmume.a $(SDL_LIBS) -desmume_cli_CFLAGS = $(SDL_CFLAGS) +desmume_cli_LDADD = ../libdesmume.a ../gdbstub/libgdbstub.a $(SDL_LIBS) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/src/desmume.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -216,7 +263,7 @@ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ @@ -239,7 +286,7 @@ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) desmume-cli$(EXEEXT): $(desmume_cli_OBJECTS) $(desmume_cli_DEPENDENCIES) @rm -f desmume-cli$(EXEEXT) - $(LINK) $(desmume_cli_LDFLAGS) $(desmume_cli_OBJECTS) $(desmume_cli_LDADD) $(LIBS) + $(LINK) $(desmume_cli_OBJECTS) $(desmume_cli_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -247,66 +294,51 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume_cli-ctrlssdl.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume_cli-main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume_cli-sndsdl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctrlssdl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndsdl.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -desmume_cli-main.o: main.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_cli_CFLAGS) $(CFLAGS) -MT desmume_cli-main.o -MD -MP -MF "$(DEPDIR)/desmume_cli-main.Tpo" -c -o desmume_cli-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_cli-main.Tpo" "$(DEPDIR)/desmume_cli-main.Po"; else rm -f "$(DEPDIR)/desmume_cli-main.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='desmume_cli-main.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_cli_CFLAGS) $(CFLAGS) -c -o desmume_cli-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c - -desmume_cli-main.obj: main.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_cli_CFLAGS) $(CFLAGS) -MT desmume_cli-main.obj -MD -MP -MF "$(DEPDIR)/desmume_cli-main.Tpo" -c -o desmume_cli-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_cli-main.Tpo" "$(DEPDIR)/desmume_cli-main.Po"; else rm -f "$(DEPDIR)/desmume_cli-main.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='desmume_cli-main.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_cli_CFLAGS) $(CFLAGS) -c -o desmume_cli-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` - -desmume_cli-sndsdl.o: ../sndsdl.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_cli_CFLAGS) $(CFLAGS) -MT desmume_cli-sndsdl.o -MD -MP -MF "$(DEPDIR)/desmume_cli-sndsdl.Tpo" -c -o desmume_cli-sndsdl.o `test -f '../sndsdl.c' || echo '$(srcdir)/'`../sndsdl.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_cli-sndsdl.Tpo" "$(DEPDIR)/desmume_cli-sndsdl.Po"; else rm -f "$(DEPDIR)/desmume_cli-sndsdl.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../sndsdl.c' object='desmume_cli-sndsdl.o' libtool=no @AMDEPBACKSLASH@ +sndsdl.o: ../sndsdl.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sndsdl.o -MD -MP -MF $(DEPDIR)/sndsdl.Tpo -c -o sndsdl.o `test -f '../sndsdl.c' || echo '$(srcdir)/'`../sndsdl.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/sndsdl.Tpo $(DEPDIR)/sndsdl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../sndsdl.c' object='sndsdl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_cli_CFLAGS) $(CFLAGS) -c -o desmume_cli-sndsdl.o `test -f '../sndsdl.c' || echo '$(srcdir)/'`../sndsdl.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sndsdl.o `test -f '../sndsdl.c' || echo '$(srcdir)/'`../sndsdl.c -desmume_cli-sndsdl.obj: ../sndsdl.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_cli_CFLAGS) $(CFLAGS) -MT desmume_cli-sndsdl.obj -MD -MP -MF "$(DEPDIR)/desmume_cli-sndsdl.Tpo" -c -o desmume_cli-sndsdl.obj `if test -f '../sndsdl.c'; then $(CYGPATH_W) '../sndsdl.c'; else $(CYGPATH_W) '$(srcdir)/../sndsdl.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_cli-sndsdl.Tpo" "$(DEPDIR)/desmume_cli-sndsdl.Po"; else rm -f "$(DEPDIR)/desmume_cli-sndsdl.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../sndsdl.c' object='desmume_cli-sndsdl.obj' libtool=no @AMDEPBACKSLASH@ +sndsdl.obj: ../sndsdl.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sndsdl.obj -MD -MP -MF $(DEPDIR)/sndsdl.Tpo -c -o sndsdl.obj `if test -f '../sndsdl.c'; then $(CYGPATH_W) '../sndsdl.c'; else $(CYGPATH_W) '$(srcdir)/../sndsdl.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/sndsdl.Tpo $(DEPDIR)/sndsdl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../sndsdl.c' object='sndsdl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_cli_CFLAGS) $(CFLAGS) -c -o desmume_cli-sndsdl.obj `if test -f '../sndsdl.c'; then $(CYGPATH_W) '../sndsdl.c'; else $(CYGPATH_W) '$(srcdir)/../sndsdl.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sndsdl.obj `if test -f '../sndsdl.c'; then $(CYGPATH_W) '../sndsdl.c'; else $(CYGPATH_W) '$(srcdir)/../sndsdl.c'; fi` -desmume_cli-ctrlssdl.o: ../ctrlssdl.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_cli_CFLAGS) $(CFLAGS) -MT desmume_cli-ctrlssdl.o -MD -MP -MF "$(DEPDIR)/desmume_cli-ctrlssdl.Tpo" -c -o desmume_cli-ctrlssdl.o `test -f '../ctrlssdl.c' || echo '$(srcdir)/'`../ctrlssdl.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_cli-ctrlssdl.Tpo" "$(DEPDIR)/desmume_cli-ctrlssdl.Po"; else rm -f "$(DEPDIR)/desmume_cli-ctrlssdl.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ctrlssdl.c' object='desmume_cli-ctrlssdl.o' libtool=no @AMDEPBACKSLASH@ +ctrlssdl.o: ../ctrlssdl.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ctrlssdl.o -MD -MP -MF $(DEPDIR)/ctrlssdl.Tpo -c -o ctrlssdl.o `test -f '../ctrlssdl.c' || echo '$(srcdir)/'`../ctrlssdl.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ctrlssdl.Tpo $(DEPDIR)/ctrlssdl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ctrlssdl.c' object='ctrlssdl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_cli_CFLAGS) $(CFLAGS) -c -o desmume_cli-ctrlssdl.o `test -f '../ctrlssdl.c' || echo '$(srcdir)/'`../ctrlssdl.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ctrlssdl.o `test -f '../ctrlssdl.c' || echo '$(srcdir)/'`../ctrlssdl.c -desmume_cli-ctrlssdl.obj: ../ctrlssdl.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_cli_CFLAGS) $(CFLAGS) -MT desmume_cli-ctrlssdl.obj -MD -MP -MF "$(DEPDIR)/desmume_cli-ctrlssdl.Tpo" -c -o desmume_cli-ctrlssdl.obj `if test -f '../ctrlssdl.c'; then $(CYGPATH_W) '../ctrlssdl.c'; else $(CYGPATH_W) '$(srcdir)/../ctrlssdl.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_cli-ctrlssdl.Tpo" "$(DEPDIR)/desmume_cli-ctrlssdl.Po"; else rm -f "$(DEPDIR)/desmume_cli-ctrlssdl.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ctrlssdl.c' object='desmume_cli-ctrlssdl.obj' libtool=no @AMDEPBACKSLASH@ +ctrlssdl.obj: ../ctrlssdl.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ctrlssdl.obj -MD -MP -MF $(DEPDIR)/ctrlssdl.Tpo -c -o ctrlssdl.obj `if test -f '../ctrlssdl.c'; then $(CYGPATH_W) '../ctrlssdl.c'; else $(CYGPATH_W) '$(srcdir)/../ctrlssdl.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ctrlssdl.Tpo $(DEPDIR)/ctrlssdl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ctrlssdl.c' object='ctrlssdl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_cli_CFLAGS) $(CFLAGS) -c -o desmume_cli-ctrlssdl.obj `if test -f '../ctrlssdl.c'; then $(CYGPATH_W) '../ctrlssdl.c'; else $(CYGPATH_W) '$(srcdir)/../ctrlssdl.c'; fi` -uninstall-info-am: +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ctrlssdl.obj `if test -f '../ctrlssdl.c'; then $(CYGPATH_W) '../ctrlssdl.c'; else $(CYGPATH_W) '$(srcdir)/../ctrlssdl.c'; fi` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -357,22 +389,21 @@ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -388,7 +419,7 @@ all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -436,12 +467,20 @@ install-data-am: +install-dvi: install-dvi-am + install-exec-am: install-binPROGRAMS +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -461,18 +500,22 @@ ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-info-am +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-info-am + uninstall-am uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/cocoa_util.m /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/cocoa_util.m --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/cocoa_util.m 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/cocoa_util.m 2007-08-11 14:23:45.000000000 -0500 @@ -0,0 +1,96 @@ +/* Copyright (C) 2007 Jeff Bland + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#import "globals.h" + +//////////////////////////////////////////////////////////////// +//Menu Item implementation-------------------------------------- +//////////////////////////////////////////////////////////////// + +@implementation NSMenu (localization) + +- (id )addItemWithTitle:(NSString *)aString action:(SEL)aSelector keyEquivalent:(NSString *)keyEquiv +{ + NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:localizedString(aString, nil) action:aSelector keyEquivalent:keyEquiv]; + [self addItem:item]; + + return item; +} + +- (id )addItemWithTitle:(NSString *)aString withInt:(int)number action:(SEL)aSelector keyEquivalent:(NSString *)keyEquiv +{ + NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:localizedString(aString, nil),number] action:aSelector keyEquivalent:keyEquiv]; + [self addItem:item]; + + return item; +} + +@end + +//////////////////////////////////////////////////////////////// +//Dialog Boxes------------------------------------------------- +//////////////////////////////////////////////////////////////// + +void messageDialogBlank() +{ + NSRunAlertPanel(@"Click OK", @" ", nil/*OK*/, nil, nil); +} + +void messageDialog(NSString *title, NSString *text) +{ + NSRunAlertPanel(title, text, nil/*OK*/, nil, nil); +} + +BOOL messageDialogYN(NSString *title, NSString *text) +{ + return NSRunAlertPanel(title, text, @"Yes", @"No", nil) != 0; +} + +//does an open dialog to choose an NDS file +//returns the filename or NULL if the user selected cancel +NSOpenPanel* panel; +NSString* openDialog(NSArray *file_types) +{ + panel = [NSOpenPanel openPanel]; + + [panel setCanChooseDirectories:NO]; + [panel setCanChooseFiles:YES]; + [panel setAllowsMultipleSelection:NO]; + + if([panel runModalForDirectory:@"/Users/gecko/nds" file:nil types:file_types] == NSOKButton) + { + //a file was selected + + id selected_file = [[panel filenames] lastObject]; //hopefully also the first object + + return selected_file; + } + + //a file wasn't selected + return NULL; +} + +//////////////////////////////////////////////////////////////// +//Language Stuff----------------------------------------------- +//////////////////////////////////////////////////////////////// + +NSString *localizedString(NSString *string, NSString *comment) +{ + return NSLocalizedString(string,nil); +} diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/DeSmuME.cbp /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/DeSmuME.cbp --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/DeSmuME.cbp 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/DeSmuME.cbp 2007-08-11 14:23:45.000000000 -0500 @@ -0,0 +1,173 @@ + + + + + + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/globals.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/globals.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/globals.h 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/globals.h 2007-08-11 14:23:45.000000000 -0500 @@ -0,0 +1,145 @@ +/* Copyright (C) 2007 Jeff Bland + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +//fixme headers conform to desmume? +#ifndef GLOBALS_H_INCLUDED +#define GLOBALS_H_INCLUDED + +#import + +//fixme +#define desmume_TRUE TRUE + +//Nintendo DS constants--------------------------------------------------------------------------- + +//This just improves legibility throughut the code +//by showing you names instead of numbers + +#define DS_SCREEN_WIDTH 256 +#define DS_SCREEN_HEIGHT 192 +#define DS_SCREEN_HEIGHT_COMBINED (192*2) /*height of the two screens*/ +#define DS_SCREEN_X_RATIO (256.0 / (192.0 * 2.0)) +#define DS_SCREEN_Y_RATIO ((192.0 * 2.0) / 256.0) + +//Cocoa Util------------------------------------------------------------------------------------ +//These are just useful little functions to help with stuff +//defined in cocoa_util.m + +//c string to NSString +#define NSSTRc(x) ([[NSString alloc] initWithCString:(x) encoding:NSASCIIStringEncoding]) + +//these class extensions do the localstring lookup so we dont have to type it over and over again +/* +@interface NSMenuItem (localization) +- (id)initWithTitle:(NSString *)not_localized_name action:(SEL)action keyEquivalent:(NSString*)key; +@end +*/ +@interface NSMenu (localization) +- (id )addItemWithTitle:(NSString *)aString action:(SEL)aSelector keyEquivalent:(NSString *)keyEquiv; +- (id )addItemWithTitle:(NSString *)aString withInt:(int)number action:(SEL)aSelector keyEquivalent:(NSString *)keyEquiv; +@end + +//dialogs + +void messageDialogBlank(); +void messageDialog(NSString *title, NSString *text); +BOOL messageDialogYN(NSString *title, NSString *text); +NSString* openDialog(NSArray *file_types); + +// + +NSString* localizedString(NSString *stuff, NSString *comment); + +//Menus ------------------------------------------------------------------------------------------- +//These are all the menu items that need checkmarks +//or their enabled status managed + +//global menu (defined in main.m) +extern NSMenu *menu; + +//view (defined/managed in main_window.m) +extern NSMenuItem *resize1x; +extern NSMenuItem *resize2x; +extern NSMenuItem *resize3x; +extern NSMenuItem *resize4x; + +extern NSMenuItem *allows_resize_item; +extern NSMenuItem *constrain_item; +extern NSMenuItem *min_size_item; + +extern NSMenuItem *rotation0_item; +extern NSMenuItem *rotation90_item; +extern NSMenuItem *rotation180_item; +extern NSMenuItem *rotation270_item; + +extern NSMenuItem *topBG0_item; +extern NSMenuItem *topBG1_item; +extern NSMenuItem *topBG2_item; +extern NSMenuItem *topBG3_item; +extern NSMenuItem *subBG0_item; +extern NSMenuItem *subBG1_item; +extern NSMenuItem *subBG2_item; +extern NSMenuItem *subBG3_item; + +//execution control (defined/managed in nds_control.m) +extern NSMenuItem *close_rom_item; + +extern NSMenuItem *execute_item; +extern NSMenuItem *pause_item; +extern NSMenuItem *reset_item; + +extern NSMenuItem *save_state_as_item; +extern NSMenuItem *load_state_from_item; + +#define SAVE_SLOTS 10 //this should never be more than NB_SAVES in saves.h +extern NSMenuItem *saveSlot_item[SAVE_SLOTS]; +extern NSMenuItem *loadSlot_item[SAVE_SLOTS]; + +#define MAX_FRAME_SKIP 10 //this is actually 1 more than the highest frame skip +extern NSMenuItem *frame_skip_auto_item; +extern NSMenuItem *frame_skip_item[SAVE_SLOTS]; + +//extern NSMenuItem *clear_all_saves_item; waiting for more functionality from saves.h + +extern NSMenuItem *rom_info_item; + +//Cocoa Port Stuff --------------------------------------------------------------------------------- + +//Enable this to multithread the program +//#define MULTITHREADED + +//prototype for our NintendoDS class (defined in nds_control.h) +// +@class NintendoDS; + +//Here's our global DS object +//which controls things like pausing and whatnot +extern NintendoDS *NDS; + +@class VideoOutputWindow; +extern VideoOutputWindow *main_window; + +//-------------------------------------------------------------------------------------------------- + +extern volatile int /*desmume_BOOL*/ execute; + +extern volatile BOOL finished; +extern volatile BOOL paused; + +#endif // GLOBALS_H_INCLUDED diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/main.m /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/main.m --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/main.m 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/main.m 2007-08-11 14:51:07.000000000 -0500 @@ -0,0 +1,630 @@ +/* Copyright (C) 2007 Jeff Bland + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* +This file is part of the Cocoa (Mac OS X) port of DeSmuME emulator +By Jeff Bland (reversegecko@gmail.com) +Based on work by yopyop and the DeSmuME team! +*/ + +//DeSmuME Cocoa includes +#import "globals.h" +#import "main_window.h" +#import "nds_control.h" + +//DeSmuME general includes +#define OBJ_C +#include "../SPU.h" +#include "../render3D.h" +#include "../GPU.h" +#include "../Windows/OGLRender.h" +#include "../NDSSystem.h" +#undef BOOL + +/* +FIXME: Apple+Q during open dialog = badness +FIXME: Live resize needs to work without pausing emulator +FIXME: Hardware acceleration for openglrender.c ?? +FIXME: When cross-platform (core) components end emulation due to error - pause should be called (set the menu checkmark) +FIXME: Multi-threaded version needs to do some sleep()-ing when not running game +FIXME: Some bug where states get messed up and hitting execute does nothing...... +FIXME: single threaded version requires an additional event to quit (after you tell the program to exit you gotta click or press something) +FIXME: .nds.gba extensions don't work in open panels +FIXME: Traveling windows when constantly resizing with hotkey +*/ + +//Globals---------------------------------------------------------------------------------------- + +NSMenu *menu; + +//Interfaces-------------------------------------------------------------------------------------- + +@interface NSApplication(custom) + +//this prototype was removed from the mac os headers +- (void)setAppleMenu:(NSMenu*)menu; + +//here we extend NSApplication +- (void)about; +- (void)preferences; + +//help menu +- (void)launchWebsite; +- (void)launchForums; +- (void)bugReport; + +@end + +@interface NSApplication(delegate) + +//delegate methods +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; +- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames; +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification; +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; + +@end + +//Global access gui constructs +VideoOutputWindow *main_window; + +//Desmume globals--------------------------------------------------------------------------------------- + +//accessed from other files +volatile desmume_BOOL execute = FALSE; + +// +volatile BOOL finished = FALSE; +volatile BOOL paused = TRUE; + +SoundInterface_struct *SNDCoreList[] = { +&SNDDummy, +//&SNDFile, +//&SNDDIRECTX, +NULL +}; + +GPU3DInterface *core3DList[] = { +&gpu3DNull, +&gpu3Dgl +}; + +//NDS/Emulator control----------------------------------------------------------------------------------------- +//These functions should be called by GUI handling mechanisms to change the state of the emulator or emulation + +NintendoDS *NDS; + +void Quit() +{ + //stop emulation if it's going + [NDS pause]; + + // + finished = true; + + // + [NSApp stop:NSApp]; +} + +void AskForQuit() +{ + BOOL was_paused = paused; + + //pause while we prompt the user + [NDS pause]; + + //ask the user if quitting is acceptable + if(messageDialogYN(localizedString(@"DeSmuME Emulator", nil), localizedString(@"Are you sure you want to quit?", nil))) + Quit(); + else + if(!was_paused)[NDS execute]; //unpaused if we weren't paused before +} + +NSEvent *current_event; + +//if wait is true then it will sit around waiting for an +//event for a short period of time taking up very little CPU +//(use when game is not running) +inline void clearEvents(bool wait) +{ + //wait for the next event + while((current_event = [NSApp nextEventMatchingMask:0 untilDate:wait?[NSDate dateWithTimeIntervalSinceNow:.2]:nil inMode:NSDefaultRunLoopMode dequeue:YES])) + [NSApp sendEvent: current_event]; +} + +/////////////////////////////// + +//This generates and sets the entire menubar (and sets defaults) +//call after objects (ie NDS main_window) are inited +void CreateMenu() +{ + NSMenuItem *temp; + + NSMenu* application_menu; + NSMenu* services_menu; + NSMenu* file; + NSMenu* emulation; + NSMenu* view; + //NSMenu* window; + NSMenu* help; + + NSMenu* frame_skip_menu; + + SEL action = nil;//@selector(method:); + + //Create the outermost menu that contains all the others + menu = [[NSMenu alloc] initWithTitle:@"DeSmuME"]; + + //Create the "DeSmuME" (application) menu + application_menu = [[NSMenu alloc] initWithTitle:@"DeSmuME"]; + + //Create the sevices menu + services_menu = [[NSMenu alloc] initWithTitle:@"Services"]; + [NSApp setServicesMenu:services_menu]; + + //Add the about menu + temp = [application_menu addItemWithTitle:@"About DeSmuME" action:@selector(about) keyEquivalent:@""]; + [temp setTarget:NSApp]; + + // + [application_menu addItem: [NSMenuItem separatorItem]]; + + //Add the preferences menu + //temp = [application_menu addItemWithTitle:@"Preferences..." action:@selector(preferences) keyEquivalent:@","]; + //[temp setTarget:NSApp]; + + // + [application_menu addItem: [NSMenuItem separatorItem]]; + + //add the services menu to the application menu (after preferences) + temp = [application_menu addItemWithTitle:@"Services" action:nil keyEquivalent:@""]; + [temp setSubmenu:services_menu]; + + // + [application_menu addItem: [NSMenuItem separatorItem]]; + + //standard hide option + temp = [application_menu addItemWithTitle:@"Hide DeSmuME" action:@selector(hide:) keyEquivalent:@""]; + [temp setTarget:NSApp]; + + //standard hide others option + temp = [application_menu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@""]; + [temp setTarget:NSApp]; + + //standard show all option + temp = [application_menu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; + [temp setTarget:NSApp]; + + // + [application_menu addItem: [NSMenuItem separatorItem]]; + + //standard quit option + temp = [application_menu addItemWithTitle:@"Quit DeSmuME" action:@selector(terminate:) keyEquivalent:@"q"]; + [temp setTarget: NSApp]; + + //finally call setAppleMenu to have all our stuff working + [NSApp setAppleMenu:application_menu]; + + temp = [menu addItemWithTitle:@"" action:nil keyEquivalent:@""]; + [temp setSubmenu:application_menu]; + [temp release]; + + NSMenuItem *file_item = [menu addItemWithTitle:@"File" action:action keyEquivalent:@""]; + NSMenuItem *emulation_item = [menu addItemWithTitle:@"Emulation" action:action keyEquivalent:@""]; + NSMenuItem *view_item = [menu addItemWithTitle:@"View" action:action keyEquivalent:@""]; + //NSMenuItem *window_item = [menu addItemWithTitle:@"Window" action:action keyEquivalent:@""]; + NSMenuItem *help_item = [menu addItemWithTitle:@"Help" action:action keyEquivalent:@""]; + + //Create the File Menu + file = [[NSMenu alloc] initWithTitle:@"File"]; + [file setAutoenablesItems:NO]; + [menu setSubmenu:file forItem:file_item]; + + temp = [file addItemWithTitle:@"Open ROM..." action:@selector(pickROM) keyEquivalent:@"o"]; + [temp setTarget:NDS]; + + //recent items menu + temp = [file addItemWithTitle:@"Open Recent" action:nil keyEquivalent:@""]; + + NSMenu *recent_menu = [[NSMenu alloc] initWithTitle:@""]; + [temp setSubmenu:recent_menu]; + + [recent_menu addItemWithTitle:@"Blar" action:nil keyEquivalent:@""]; + + [file addItem:[NSMenuItem separatorItem]]; + + rom_info_item = [file addItemWithTitle:@"ROM Info..." action:@selector(showRomInfo) keyEquivalent:@""]; + [rom_info_item setEnabled:NO]; + [rom_info_item setTarget:NDS]; + +#ifdef HAVE_LIBZ //internally, save states only work when zlib is there + + [file addItem:[NSMenuItem separatorItem]]; + + save_state_as_item = [file addItemWithTitle:@"Save State As..." action:@selector(saveStateAs) keyEquivalent:@""]; + [save_state_as_item setEnabled:NO]; + [save_state_as_item setTarget:NDS]; + + load_state_from_item = [file addItemWithTitle:@"Load State From..." action:@selector(loadStateFrom) keyEquivalent:@""]; + [load_state_from_item setEnabled:NO]; + [load_state_from_item setTarget:NDS]; + + [file addItem:[NSMenuItem separatorItem]]; + + temp = [file addItemWithTitle:@"Save State" action:@selector(saveTo:) keyEquivalent:@""]; + NSMenu *save_state_menu = [[NSMenu alloc] initWithTitle:@"Save State"]; + [save_state_menu setAutoenablesItems:NO]; + [temp setSubmenu:save_state_menu]; + + temp = [file addItemWithTitle:@"Load State" action:nil keyEquivalent:@""]; + NSMenu *load_state_menu = [[NSMenu alloc] initWithTitle:@"Load State"]; + [load_state_menu setAutoenablesItems:NO]; + [temp setSubmenu:load_state_menu]; + + int i; + for(i = 0; i < SAVE_SLOTS; i++) + { + saveSlot_item[i] = [save_state_menu addItemWithTitle:@"Slot %d" withInt:i action:@selector(saveToSlot:) keyEquivalent:@""]; + [saveSlot_item[i] setEnabled:NO]; + [saveSlot_item[i] setTarget:NDS]; + + loadSlot_item[i] = [load_state_menu addItemWithTitle:@"Slot %d" withInt:i action:@selector(loadFromSlot:) keyEquivalent:@""]; + [loadSlot_item[i] setEnabled:NO]; + [loadSlot_item[i] setTarget:NDS]; + } + +/* To be implemented when saves.h provides +a way to get the time of a save that's not string/human formatted... + + [save_state_menu addItem:[NSMenuItem separatorItem]]; + + temp = [save_state_menu addItemWithTitle:@"Save Over Oldest" action:nil keyEquivalent:@""]; + [temp setEnabled:NO]; + [temp setTarget:NDS]; + + temp = [save_state_menu addItemWithTitle:@"Save Over Latest" action:nil keyEquivalent:@""]; + [temp setEnabled:NO]; + [temp setTarget:NDS]; +*/ +/* to be implemented after saves.h provides a way to delete saves... + + [save_state_menu addItem:[NSMenuItem separatorItem]]; + + clear_all_saves_item = [save_state_menu addItemWithTitle:@"Clear All" action:@selector(askAndClearStates) keyEquivalent:@""]; + [clear_all_saves_item setEnabled:NO]; + [clear_all_saves_item setTarget:NDS]; +*/ +/* + [save_state_menu addItem:[NSMenuItem separatorItem]]; + + temp = [save_state_menu addItemWithTitle:@"View States" action:nil keyEquivalent:@""]; + [temp setEnabled:NO]; + [temp setTarget:NDS]; +*/ +/* To be implemented when saves.h provides +a way to get the time of a save that's not a string / human formatted... + + [load_state_menu addItem:[NSMenuItem separatorItem]]; + + temp = [load_state_menu addItemWithTitle:@"Load Oldest" action:nil keyEquivalent:@""]; + [temp setEnabled:NO]; + [temp setTarget:NDS]; + + temp = [load_state_menu addItemWithTitle:@"Load Latest" action:nil keyEquivalent:@""]; + [temp setEnabled:NO]; + [temp setTarget:NDS]; +*/ +/* + [load_state_menu addItem:[NSMenuItem separatorItem]]; + + temp = [load_state_menu addItemWithTitle:@"View States" action:nil keyEquivalent:@""]; + [temp setEnabled:NO]; + [temp setTarget:NDS]; +*/ +#endif + + [file addItem:[NSMenuItem separatorItem]]; + + close_rom_item = [file addItemWithTitle:@"Close ROM" action:@selector(askAndCloseROM) keyEquivalent:@"w"]; + [close_rom_item setEnabled:NO]; + [close_rom_item setTarget:NDS]; + + //Create the Emulation Menu + emulation = [[NSMenu alloc] initWithTitle:localizedString(@"Emulation", nil)]; + [emulation setAutoenablesItems:NO]; + [menu setSubmenu:emulation forItem:emulation_item]; + + execute_item = [emulation addItemWithTitle:@"Execute" action:@selector(execute) keyEquivalent:@""]; + [execute_item setTarget:NDS]; + [execute_item setEnabled:NO]; + + pause_item = [emulation addItemWithTitle:@"Pause" action:@selector(pause) keyEquivalent:@""]; + [pause_item setTarget:NDS]; + [pause_item setEnabled:NO]; + + reset_item = [emulation addItemWithTitle:@"Reset" action:@selector(reset) keyEquivalent:@""]; + [reset_item setTarget:NDS]; + [reset_item setEnabled:NO]; + + [emulation addItem:[NSMenuItem separatorItem]]; + + temp = [emulation addItemWithTitle:@"Frame Skip" action:nil keyEquivalent:@""]; + frame_skip_menu = [[NSMenu alloc] initWithTitle:localizedString(@"Frame Skip", nil)]; + [temp setSubmenu:frame_skip_menu]; + + frame_skip_auto_item = [frame_skip_menu addItemWithTitle:@"Auto" action:@selector(setFrameSkip:) keyEquivalent:@""]; + [frame_skip_auto_item setTarget:NDS]; + [frame_skip_auto_item setState:NSOnState]; + [frame_skip_auto_item setEnabled:YES]; + + [frame_skip_menu addItem:[NSMenuItem separatorItem]]; + + frame_skip_item[0] = [frame_skip_menu addItemWithTitle:@"Off" action:@selector(setFrameSkip:) keyEquivalent:@""]; + [frame_skip_item[0] setTarget:NDS]; + [frame_skip_item[0] setEnabled:YES]; + + int i2; + for(i2 = 1; i2 < MAX_FRAME_SKIP; i2++) + { + frame_skip_item[i2] = [frame_skip_menu addItemWithTitle:@"%d" withInt:i2 action:@selector(setFrameSkip:) keyEquivalent:@""]; + [frame_skip_item[i2] setTarget:NDS]; + [frame_skip_item[i2] setEnabled:YES]; + } + + //Create the screens menu + view = [[NSMenu alloc] initWithTitle:localizedString(@"View", nil)]; + [menu setSubmenu:view forItem:view_item]; + + resize1x = [view addItemWithTitle:@"Size 1x" action:@selector(resizeScreen1x) keyEquivalent:@"1"]; + [resize1x setState:NSOnState]; + [resize1x setTarget:main_window]; + + resize2x = [view addItemWithTitle:@"Size 2x" action:@selector(resizeScreen2x) keyEquivalent:@"2"]; + [resize2x setTarget:main_window]; + + resize3x = [view addItemWithTitle:@"Size 3x" action:@selector(resizeScreen3x) keyEquivalent:@"3"]; + [resize3x setTarget:main_window]; + + resize4x = [view addItemWithTitle:@"Size 4x" action:@selector(resizeScreen4x) keyEquivalent:@"4"]; + [resize4x setTarget:main_window]; +/* + [view addItem:[NSMenuItem separatorItem]]; + + [view addItemWithTitle:@"Full Screen" action:nil keyEquivalent:@"f"]; +*/ + [view addItem:[NSMenuItem separatorItem]]; + + allows_resize_item = [view addItemWithTitle:@"Allow Resize" action:@selector(toggleAllowsResize) keyEquivalent:@""]; + [allows_resize_item setState:NSOnState]; + [allows_resize_item setTarget:main_window]; + + constrain_item = [view addItemWithTitle:@"Constrain Proportions" action:@selector(toggleConstrainProportions) keyEquivalent:@""]; + [constrain_item setState:NSOnState]; + [constrain_item setTarget:main_window]; + + min_size_item = [view addItemWithTitle: @"No smaller than DS" action:@selector(toggleMinSize) keyEquivalent:@""]; + [min_size_item setState:NSOnState]; + [min_size_item setTarget:main_window]; + + [view addItem:[NSMenuItem separatorItem]]; + + temp = [view addItemWithTitle: @"Rotation" action:nil keyEquivalent:@""]; + + NSMenu *rotation_menu = [[NSMenu alloc] initWithTitle:@"Rotation"]; + [temp setSubmenu: rotation_menu]; + + rotation0_item = [rotation_menu addItemWithTitle:@"0" action:@selector(setRotation0) keyEquivalent:@""]; + [rotation0_item setState:NSOnState]; + [rotation0_item setTarget:main_window]; + + rotation90_item = [rotation_menu addItemWithTitle:@"90" action:@selector(setRotation90) keyEquivalent:@""]; + [rotation90_item setState:NSOffState]; + [rotation90_item setTarget:main_window]; + + rotation180_item = [rotation_menu addItemWithTitle:@"180" action:@selector(setRotation180) keyEquivalent:@""]; + [rotation180_item setState:NSOffState]; + [rotation180_item setTarget:main_window]; + + rotation270_item = [rotation_menu addItemWithTitle:@"270" action:@selector(setRotation270) keyEquivalent:@""]; + [rotation270_item setState:NSOffState]; + [rotation270_item setTarget:main_window]; + + [view addItem:[NSMenuItem separatorItem]]; + + temp = [view addItemWithTitle:@"Layers" action:nil keyEquivalent:@""]; + NSMenu *layer_menu = [[NSMenu alloc] initWithTitle:@"Layers"]; + [temp setSubmenu: layer_menu]; + + topBG0_item = [layer_menu addItemWithTitle:@"Top BG0" action:@selector(toggleTopBackground0) keyEquivalent:@""]; + [topBG0_item setState:NSOnState]; + [topBG0_item setTarget:main_window]; + + topBG1_item = [layer_menu addItemWithTitle:@"Top BG1" action:@selector(toggleTopBackground1) keyEquivalent:@""]; + [topBG1_item setState:NSOnState]; + [topBG1_item setTarget:main_window]; + + topBG2_item = [layer_menu addItemWithTitle:@"Top BG2" action:@selector(toggleTopBackground2) keyEquivalent:@""]; + [topBG2_item setState:NSOnState]; + [topBG2_item setTarget:main_window]; + + topBG3_item = [layer_menu addItemWithTitle:@"Top BG3" action:@selector(toggleTopBackground3) keyEquivalent:@""]; + [topBG3_item setState:NSOnState]; + [topBG3_item setTarget:main_window]; + + [layer_menu addItem:[NSMenuItem separatorItem]]; + + subBG0_item = [layer_menu addItemWithTitle:@"Sub BG0" action:@selector(toggleSubBackground0) keyEquivalent:@""]; + [subBG0_item setState:NSOnState]; + [subBG0_item setTarget:main_window]; + + subBG1_item = [layer_menu addItemWithTitle:@"Sub BG1" action:@selector(toggleSubBackground1) keyEquivalent:@""]; + [subBG1_item setState:NSOnState]; + [subBG1_item setTarget:main_window]; + + subBG2_item = [layer_menu addItemWithTitle:@"Sub BG2" action:@selector(toggleSubBackground2) keyEquivalent:@""]; + [subBG2_item setState:NSOnState]; + [subBG2_item setTarget:main_window]; + + subBG3_item = [layer_menu addItemWithTitle:@"Sub BG3" action:@selector(toggleSubBackground3) keyEquivalent:@""]; + [subBG3_item setState:NSOnState]; + [subBG3_item setTarget:main_window]; + + //Create the window menu +/* + window = [[NSMenu alloc] initWithTitle:localizedString(@"Window", nil)]; + [menu setSubmenu:window forItem:window_item]; + + [window addItemWithTitle:@"Minimize" action:nil keyEquivalent:@""]; + [window addItemWithTitle:@"Zoom" action:nil keyEquivalent:@""]; + [window addItem:[NSMenuItem separatorItem]]; + [window addItemWithTitle:@"Bring All to Front" action:nil keyEquivalent:@""]; + [window addItem:[NSMenuItem separatorItem]]; + [window addItemWithTitle:@"DS Display" action:nil keyEquivalent:@""]; + //[window addItemWithTitle:@"Save State Viewer" action:nil keyEquivalent:@""]; + //[window addItemWithTitle:@"Debugger" action:nil keyEquivalent:@""]; + //[window addItem:[NSMenuItem separatorItem]]; + //[window addItemWithTitle:@"(screenshots)" action:nil keyEquivalent:@""]; +*/ + + //Create the help menu + help = [[NSMenu alloc] initWithTitle:localizedString(@"Help", nil)]; + [menu setSubmenu:help forItem:help_item]; + + temp = [help addItemWithTitle:@"Website" action:@selector(launchWebsite) keyEquivalent: @""]; + [temp setTarget:NSApp]; + + temp = [help addItemWithTitle:@"Forums" action:@selector(launchForums) keyEquivalent: @""]; + [temp setTarget:NSApp]; + + temp = [help addItemWithTitle:@"Submit A Bug Report" action:@selector(bugReport) keyEquivalent: @""]; + [temp setTarget:NSApp]; + + [NSApp setMainMenu: menu]; + + [menu update]; +} + +//Main Function-------------------------------------------------------------------------------------- + +int main(int argc, char *argv[]) +{ + + srand(time(NULL)); + + //Application Init Stuff---------------------------------------------------------------------- + + //Get the application instance (global variable called NSApp) + [NSApplication sharedApplication]; + + //Set the application delegate + [NSApp setDelegate:NSApp]; + + [NSApp run]; + + //Program Exit --------------------------------------------------------------------------------------- + + return 0; +} + +//gdb stuff-------------------------------------------------------------------------------- +//don't know and don't care + +void * +createThread_gdb( void (*thread_function)( void *data), + void *thread_data) { +return NULL; +} + +void +joinThread_gdb( void *thread_handle) { +} + +//Implementations------------------------------------------------------------------------- + +@implementation NSApplication(delegate) + +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename +{ + if([NDS loadROM:filename]) + return YES; + + return NO; +} + +- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames +{ + //messageDialog(@"Openfiles",@""); +} + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification +{ + + //More app Init ------------------------------------------------------------------------------ + + //Bring the application to the front + [NSApp activateIgnoringOtherApps:TRUE]; + + //create the global ds object + NDS = [[NintendoDS alloc] init]; + + //create the video output window (the only window that opens with the app) + main_window = [[VideoOutputWindow alloc] init]; + + //start with a blank screen + [main_window clearScreen]; + + //create the menus + CreateMenu(); + + //init opengl 3d ness + NDS_3D_SetDriver (GPU3D_OPENGL); + if(!gpu3D->NDS_3D_Init()) + messageDialog(@"Error", @"Unable to initialize OpenGL components"); + + //[NDS LoadROM:@"/Users/gecko/nds/0004 - Feel the Magic - XY-XX (U) (Trashman).nds"]; + //^ above line breaks everything!? + + //Main program loop ---------------------------------------------------------------------------- + +#ifdef MULTITHREADED + + //Breakoff a thread to run + [NSApplication detachDrawingThread:@selector(run) toTarget:NDS withObject:nil]; + +#else + + [NDS run]; + + //it seems we need an event before it will quit + //(probably has something to do with calling run from applicationDidFinishLaunching?) + [NSEvent startPeriodicEventsAfterDelay:0 withPeriod:1]; + +#endif + +} + +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender +{ + //Ask user if he wants to quit + AskForQuit(); + + //AskForQuit takes care of quitting, dont need cocoa to do it for us + return NSTerminateCancel; +} +@end diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/main_window.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/main_window.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/main_window.h 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/main_window.h 2007-08-11 14:23:45.000000000 -0500 @@ -0,0 +1,87 @@ +/* Copyright (C) 2007 Jeff Bland + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef MAIN_WINDOW_H +#define MAIN_WINDOW_H + +#import + +//This interface is to create and manaage the window +//that displays DS video output and takes keyboard/mouse input +//do not instanciate more than one of these +@interface VideoOutputWindow : NSWindow {} + +//initialization +- (id)init; + +//call this function to read the screen from the emulator and update the window +//this is the only method involving cocoa that should be called from the run() function +- (void)updateScreen; + +//makes the screen white +- (void)clearScreen; + +//resets the min size internalls (when rotation changes), shouldn't be used from outside +- (void)resetMinSize:(bool)resize; + +//toggles between allowing tiny sizes and only being as small as DS +- (void)toggleMinSize; + +//this method will contrain the size as well +//this is screen size not window size +- (void)resizeScreen:(NSSize)size; + + +//like resizeScreen but does a size in relation to DS pixels +- (void)resizeScreen1x; +- (void)resizeScreen2x; +- (void)resizeScreen3x; +- (void)resizeScreen4x; + +// +- (void)toggleAllowsResize; +- (void)toggleConstrainProportions; + +//rotation +- (void)setRotation0; +- (void)setRotation90; +- (void)setRotation180; +- (void)setRotation270; + +//layers +- (void)toggleTopBackground0; +- (void)toggleTopBackground1; +- (void)toggleTopBackground2; +- (void)toggleTopBackground3; +- (void)toggleSubBackground0; +- (void)toggleSubBackground1; +- (void)toggleSubBackground2; +- (void)toggleSubBackground3; + +//keyboard input +- (void)keyDown:(NSEvent*)event; +- (void)keyUp:(NSEvent*)event; + +//mouse input +- (void)mouseDown:(NSEvent*)event; +- (void)mouseDragged:(NSEvent*)event; +- (void)mouseUp:(NSEvent*)event; +@end + +#endif //MAIN_WINDOW_H diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/main_window.m /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/main_window.m --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/main_window.m 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/main_window.m 2007-08-11 16:56:59.000000000 -0500 @@ -0,0 +1,1356 @@ +/* Copyright (C) 2007 Jeff Bland + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#import +#import + +//DeSmuME Cocoa includes +#import "globals.h" +#import "main_window.h" +#import "nds_control.h" + +//DeSmuME general includes +#define OBJ_C +#include "../MMU.h" +#include "../GPU.h" +#undef BOOL + +// +BOOL keep_proportions = YES; + +//Title bar size (calculated by VideoOuputWindow init) +//useful for window rect calculations +unsigned short title_bar_height; + +//How much padding to put around the video output +#define WINDOW_BORDER_PADDING 5 + +//data is copied here from the DS screen to flip it +volatile u8 correction_buffer[DS_SCREEN_WIDTH * DS_SCREEN_HEIGHT_COMBINED * 2 /*bits per pixel*/]; +volatile u8 temp_buffer[DS_SCREEN_WIDTH * DS_SCREEN_HEIGHT_COMBINED * 2 /*bits per pixel*/]; + +//this is th opengl view where we will display the video output +@class VideoOutputView; +VideoOutputView *video_output_view; + +//fast access to size of openglview (not size of window) +volatile unsigned short x_size = DS_SCREEN_WIDTH; +volatile unsigned short y_size = DS_SCREEN_HEIGHT_COMBINED; + +//screen menu items +NSMenuItem *resize1x; +NSMenuItem *resize2x; +NSMenuItem *resize3x; +NSMenuItem *resize4x; +NSMenuItem *allows_resize_item; +NSMenuItem *constrain_item; +NSMenuItem *min_size_item; +NSMenuItem *rotation0_item; +NSMenuItem *rotation90_item; +NSMenuItem *rotation180_item; +NSMenuItem *rotation270_item; +NSMenuItem *topBG0_item; +NSMenuItem *topBG1_item; +NSMenuItem *topBG2_item; +NSMenuItem *topBG3_item; +NSMenuItem *subBG0_item; +NSMenuItem *subBG1_item; +NSMenuItem *subBG2_item; +NSMenuItem *subBG3_item; + +//Default key config (based on the windows version) +unsigned short ds_up = 126; //up arrow +unsigned short ds_down = 125; //down arrow +unsigned short ds_left = 123; //left arrow +unsigned short ds_right = 124; //right arrrow +unsigned short ds_a = 9 ; //v +unsigned short ds_b = 11 ; //b +unsigned short ds_x = 5 ; //g +unsigned short ds_y = 4 ; //h +unsigned short ds_l = 8 ; //c +unsigned short ds_r = 45 ; //n +unsigned short ds_select = 49 ; //space bar +unsigned short ds_start = 36 ; //enter +unsigned short ds_debug = 999; + +// +unsigned short save_slot_1 = 122; //F1 +unsigned short save_slot_2 = 120; //F2 +unsigned short save_slot_3 = 99; //F3 +unsigned short save_slot_4 = 118; //F4 +unsigned short save_slot_5 = 96; //F5 +unsigned short save_slot_6 = 97; //F6 +unsigned short save_slot_7 = 98; //F7 +unsigned short save_slot_8 = 100; //F8 +unsigned short save_slot_9 = 101; //F9 +unsigned short save_slot_10 = 109; //F10 +//unsigned short save_slot_11 = 103; //F11 +//unsigned short save_slot_12 = 111; //F12 + +NSOpenGLContext *gpu_context; + +//rotation +#define ROTATION_0 0 +#define ROTATION_90 1 +#define ROTATION_180 2 +#define ROTATION_270 3 +u8 rotation = ROTATION_0; + +//extern unsigned char GPU_screen3D[256*256*4]; + +u8 gpu_buff[256 * 256 * 4]; +//#define gpu_buff GPU_screen3D + +//min sizes (window size, not ds screen size) +NSSize min_size; + +//Window delegate class --------------------------------------------------------- + +@interface WindowDelegate : NSObject {} +- (void)windowDidResize:(NSNotification *)aNotification; +- (BOOL)windowShouldClose:(id)sender; +- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize; +@end + +@interface VideoOutputView : NSView +{ + @private + NSOpenGLContext* context; + NSOpenGLPixelFormat* format; +} +- (id)initWithFrame:(NSRect)frame; +- (void)draw; +- (void)drawRect:(NSRect)bounds; +- (void)setFrame:(NSRect)rect; +- (BOOL) isOpaque; +@end + +@implementation VideoOutputView + +- (id)initWithFrame:(NSRect)frame +{ + //Initialize the view------------------------------------------------------------------ + + self = [super initWithFrame:frame]; + + if(self==nil) + { + messageDialog(@"Error", @"Could not init frame for OpenGL display"); + return nil; + } + + //Initialize the OpenGL context for displaying the screen ----------------------------------- + + //Create the pixel format for our video output view + NSOpenGLPixelFormatAttribute attrs[] = + { + NSOpenGLPFAAccelerated, + NSOpenGLPFANoRecovery, + NSOpenGLPFAColorSize, 16, + NSOpenGLPFAAlphaSize, 0, + NSOpenGLPFADepthSize, 0, + NSOpenGLPFAWindow, + 0 + }; + + NSOpenGLPixelFormat* pixel_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs]; + if(pixel_format == nil) + { + messageDialog(@"Error", @"Couldn't create OpenGL pixel format for video output"); + return self; + } + + context = [[NSOpenGLContext alloc] initWithFormat:pixel_format shareContext:nil]; + if(context == nil) + { + messageDialog(@"Error", @"Couldn't create OpenGL context for video output"); + return self; + } + + //Initialize the OpenGL context for 3D rendering --------------------------------------- + + //Create the pixel format for our gpu + NSOpenGLPixelFormatAttribute attrs2[] = + { + //NSOpenGLPFAAccelerated, + //NSOpenGLPFANoRecovery, + //NSOpenGLPFADoubleBuffer, + NSOpenGLPFAColorSize, 24, + NSOpenGLPFAAlphaSize, 8, + NSOpenGLPFADepthSize, 24, + //NSOpenGLPFAStencilSize, 8, + NSOpenGLPFAOffScreen, + 0 + }; + + NSOpenGLPixelFormat* pixel_format2 = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs2]; + if(pixel_format2 == nil) + { + messageDialog(@"Error", @"Couldn't create OpenGL pixel format for GPU"); + return self; + } + + gpu_context = [[NSOpenGLContext alloc] initWithFormat:pixel_format2 shareContext:nil]; + if(gpu_context == nil) + { + messageDialog(@"Error", @"Couldn't create OpenGL context for GPU"); + return self; + } + + //offscreen rendering + [gpu_context setOffScreen:(void*)&gpu_buff width:DS_SCREEN_WIDTH height:DS_SCREEN_HEIGHT rowbytes:DS_SCREEN_WIDTH * 4]; + + //this will init opengl for drawing + [self setFrame:frame]; + + // + return self; +} + +- (void) draw +{ + NSRect blar; + [self drawRect:blar]; +} + +- (void)drawRect:(NSRect)bounds +{ + [context setView:self]; //for some reason this doesnt work when called from the init function + + [context makeCurrentContext]; + + if(rotation == ROTATION_0 || rotation == ROTATION_180) + { + + //here we send our corrected video buffer off to OpenGL where it gets pretty much + //directly copied to the frame buffer (and converted to the devices color format) + glDrawPixels(DS_SCREEN_WIDTH, DS_SCREEN_HEIGHT_COMBINED, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, (GLvoid*)&correction_buffer); + + } else + { + glDrawPixels(DS_SCREEN_HEIGHT_COMBINED, DS_SCREEN_WIDTH, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, (GLvoid*)&correction_buffer); + } + + glFlush(); + + [gpu_context makeCurrentContext]; +} + +- (void)setFrame:(NSRect)rect +{ + BOOL was_paused = paused; + [NDS pause]; + + [super setFrame:rect]; + + [context update]; + +#ifndef MULTITHREADED + [context makeCurrentContext]; +#endif + + //set the viewport (so the raster pos will be correct) + glViewport(0, 0, rect.size.width, rect.size.height); + + if(rotation == ROTATION_0) + { + + //the raster pos controls where the bitmap where will be placed + glRasterPos2f(-1, 1); + + //set the pixel zoom so our bitmap streches to fit our new opengl size + glPixelZoom(((float)rect.size.width) / ((float)DS_SCREEN_WIDTH), -((float)rect.size.height) / ((float)DS_SCREEN_HEIGHT_COMBINED)); + + } else if (rotation == ROTATION_90) + { + + //the raster pos controls where the bitmap where will be placed + glRasterPos2f(1, 1); + + //set the pixel zoom so our bitmap streches to fit our new opengl size + glPixelZoom(-((float)rect.size.width) / ((float)DS_SCREEN_HEIGHT_COMBINED), -((float)rect.size.height) / ((float)DS_SCREEN_WIDTH)); + + } else if (rotation == ROTATION_180) + { + + //set the viewport (so the raster pos will be correct) + glViewport(0, 0, rect.size.width, rect.size.height); + + //the raster pos controls where the bitmap where will be placed + glRasterPos2f(1, -1); + + //set the pixel zoom so our bitmap streches to fit our new opengl size + glPixelZoom(-((float)rect.size.width) / ((float)DS_SCREEN_WIDTH), ((float)rect.size.height) / ((float)DS_SCREEN_HEIGHT_COMBINED)); + + } else if (rotation == ROTATION_270) + { + //the raster pos controls where the bitmap where will be placed + glRasterPos2f(-1, -1); + + //set the pixel zoom so our bitmap streches to fit our new opengl size + glPixelZoom(((float)rect.size.width) / ((float)DS_SCREEN_HEIGHT_COMBINED), ((float)rect.size.height) / ((float)DS_SCREEN_WIDTH)); + + } + +#ifndef MULTITHREADED + [gpu_context makeCurrentContext]; +#endif + + if(!was_paused)[NDS execute]; +} + +- (BOOL)isOpaque +{ + return YES; +} +@end + +/////////////////////////////////////////////////////////////////////////////////////// +//Video output window class ---------------------------------------------------------- +/////////////////////////////////////////////////////////////////////////////////////// + +@implementation VideoOutputWindow + +- (id)init +{ + + // + NSRect rect; + + //Create the window rect (content rect - title bar not included in size) + rect.size.width = DS_SCREEN_WIDTH + WINDOW_BORDER_PADDING * 2; + rect.size.height = DS_SCREEN_HEIGHT_COMBINED + WINDOW_BORDER_PADDING; + rect.origin.x = 200; + rect.origin.y = 200; + + //allocate the window + self = [super initWithContentRect:rect styleMask: + + NSTitledWindowMask|NSResizableWindowMask|/*NSClosableWindowMask|*/NSMiniaturizableWindowMask|NSTexturedBackgroundWindowMask + + backing:NSBackingStoreBuffered defer:NO screen:nil]; + + [self setTitle:@"DeSmuME Emulator"]; + + //set minimum window size (to the starting size, pixel-for-pixel to DS) + //this re-gets the window rect to include the title bar size + NSSize tempsize; + tempsize.width = 1; + tempsize.height = 1; + [self setMinSize:tempsize]; + min_size = rect.size; + + NSSize temp; + temp.width = WINDOW_BORDER_PADDING * 2 + 2; + temp.height = WINDOW_BORDER_PADDING + 2; + [self setContentMinSize:temp]; + + //set title_bar_height + title_bar_height = [super frame].size.height - rect.size.height; + + //Set the window delegate + [self setDelegate:[[WindowDelegate alloc] init]]; + + //Create the image view where we will display video output + rect.origin.x = WINDOW_BORDER_PADDING; + rect.origin.y = WINDOW_BORDER_PADDING; + rect.size.width = DS_SCREEN_WIDTH; + rect.size.height = DS_SCREEN_HEIGHT_COMBINED; + if((video_output_view = [[VideoOutputView alloc] initWithFrame:rect]) == nil) + messageDialog(@"Error", @"Couldn't create OpenGL view to display screens"); + else + { + [[self contentView] addSubview:video_output_view]; + + } + + //Show the window + [[[NSWindowController alloc] initWithWindow:self] showWindow:nil]; + + return self; +} + +- (void)updateScreen +{ + //here we copy gpu_screen to our own buffer + + if(rotation == ROTATION_0 || rotation == ROTATION_180) + memcpy(&correction_buffer, &GPU_screen, DS_SCREEN_WIDTH * DS_SCREEN_HEIGHT_COMBINED * 2); + else + { + //here is where we turn the screen sideways + + int x, y; + for(x = 0; x< DS_SCREEN_WIDTH; x++) + for(y = 0; y < DS_SCREEN_HEIGHT_COMBINED; y++) + { + correction_buffer[(x * DS_SCREEN_HEIGHT_COMBINED + y) * 2] = GPU_screen[(y * DS_SCREEN_WIDTH + x) * 2]; + correction_buffer[(x * DS_SCREEN_HEIGHT_COMBINED + y) * 2 + 1] = GPU_screen[(y * DS_SCREEN_WIDTH + x) * 2 + 1]; + } + + } + + //then video output view draws from that buffer + [video_output_view draw]; +} + +- (void)clearScreen +{ + //fill our buffer with pure white + memset(&correction_buffer, 255, DS_SCREEN_WIDTH * DS_SCREEN_HEIGHT_COMBINED * 2); + + [video_output_view draw]; +} + +- (void)resetMinSize:(bool)resize +{ + if(rotation == ROTATION_0 || rotation == ROTATION_180) + { + min_size.width = DS_SCREEN_WIDTH + WINDOW_BORDER_PADDING * 2; + min_size.height = DS_SCREEN_HEIGHT_COMBINED + WINDOW_BORDER_PADDING + title_bar_height; + + //resize if too small + if(resize) + { + NSSize temp = [video_output_view frame].size; + if(temp.width < DS_SCREEN_WIDTH || temp.height < DS_SCREEN_HEIGHT_COMBINED) + [self resizeScreen:NSMakeSize(DS_SCREEN_WIDTH, DS_SCREEN_HEIGHT_COMBINED)]; //this could be per axis? + } + + } else + { + min_size.width = DS_SCREEN_HEIGHT_COMBINED + WINDOW_BORDER_PADDING * 2; + min_size.height = DS_SCREEN_WIDTH + WINDOW_BORDER_PADDING + title_bar_height; + + //resize if too small + if(resize) + { + NSSize temp = [video_output_view frame].size; + if(temp.width < DS_SCREEN_HEIGHT_COMBINED || temp.height < DS_SCREEN_WIDTH) + [self resizeScreen:NSMakeSize(DS_SCREEN_HEIGHT_COMBINED, DS_SCREEN_WIDTH)]; + } + } +} + +- (void)toggleMinSize +{ + static bool state = false; + + if([min_size_item state] == NSOnState) + { + [min_size_item setState:NSOffState]; + min_size.width = 0; + min_size.height = 0; + } else + { + [min_size_item setState:NSOnState]; + [self resetMinSize:true]; + } +} + +- (void)resizeScreen:(NSSize)size +{ + //if(x_size == size.width && y_size == size.height)return; + + BOOL was_paused = paused; + [NDS pause]; + + //add the window borders + size.width += WINDOW_BORDER_PADDING * 2; + size.height += WINDOW_BORDER_PADDING + title_bar_height; + + //constrain + size = [[self delegate] windowWillResize:self toSize:size]; + + //set the position (keeping the center of the window the same) + NSRect current_window_rect = [super frame]; + current_window_rect.origin.x -= ((size.width + WINDOW_BORDER_PADDING * 2) - current_window_rect.size.width) / 2; + current_window_rect.origin.y -= ((size.height + WINDOW_BORDER_PADDING + title_bar_height) - current_window_rect.size.height) / 2; + + //and change the size + current_window_rect.size.width = size.width; + current_window_rect.size.height = size.height; + + //send it off to cocoa + [self setFrame:current_window_rect display:YES]; + + if(!was_paused)[NDS execute]; +} + +- (void)resizeScreen1x +{ + + if(rotation == ROTATION_0 || rotation == ROTATION_180) + [self resizeScreen:NSMakeSize(DS_SCREEN_WIDTH, DS_SCREEN_HEIGHT_COMBINED)]; + else + [self resizeScreen:NSMakeSize(DS_SCREEN_HEIGHT_COMBINED, DS_SCREEN_WIDTH)]; +} + +- (void)resizeScreen2x +{ + + if(rotation == ROTATION_0 || rotation == ROTATION_180) + [self resizeScreen:NSMakeSize(DS_SCREEN_WIDTH * 2, DS_SCREEN_HEIGHT_COMBINED * 2)]; + else + [self resizeScreen:NSMakeSize(DS_SCREEN_HEIGHT_COMBINED * 2, DS_SCREEN_WIDTH * 2)]; +} + +- (void)resizeScreen3x +{ + if(rotation == ROTATION_0 || rotation == ROTATION_180) + [self resizeScreen:NSMakeSize(DS_SCREEN_WIDTH * 3, DS_SCREEN_HEIGHT_COMBINED * 3)]; + else + [self resizeScreen:NSMakeSize(DS_SCREEN_HEIGHT_COMBINED * 3, DS_SCREEN_WIDTH * 3)]; +} + +- (void)resizeScreen4x +{ + if(rotation == ROTATION_0 || rotation == ROTATION_180) + [self resizeScreen:NSMakeSize(DS_SCREEN_WIDTH * 4, DS_SCREEN_HEIGHT_COMBINED * 4)]; + else + [self resizeScreen:NSMakeSize(DS_SCREEN_HEIGHT_COMBINED * 4, DS_SCREEN_WIDTH * 4)]; +} + +- (void)toggleAllowsResize +{ + //get the resize control state + BOOL resizes = [self showsResizeIndicator]; + + if(resizes == YES) + { + // + resizes = NO; + + //don't allow resize + //hack!!! fixme + NSSize temp; + temp.width = 9000; + temp.height = 9000; + [self setResizeIncrements:temp]; + + //don't show resize control + [self setShowsResizeIndicator:NO]; + + //unset the check + [allows_resize_item setState:NSOffState]; + + } else{ + resizes = YES; + + //allow resize + NSSize temp; + temp.width = 1; + temp.height = 1; + [self setResizeIncrements:temp]; + + //show resize control + [self setShowsResizeIndicator:YES]; + + //set the check + [allows_resize_item setState:NSOnState]; + } +} + +- (void)toggleConstrainProportions; +{ + //change the state + keep_proportions = !keep_proportions; + + //constrain + NSSize size; + size.width = x_size; + size.height = y_size; + if(keep_proportions) + [self resizeScreen:size]; + + //set the menu checks + if(keep_proportions) + [constrain_item setState:NSOnState]; + else + [constrain_item setState:NSOffState]; +} + +- (void)setRotation0 +{ + if(rotation == ROTATION_0)return; + + if(rotation == ROTATION_180) + { + rotation = ROTATION_0; + + [video_output_view setFrame:[video_output_view frame]]; + [self updateScreen]; + + } else + { + //set the global rotation state + rotation = ROTATION_0; + + //fix the buffer + memcpy(&temp_buffer, &correction_buffer, DS_SCREEN_WIDTH * DS_SCREEN_HEIGHT_COMBINED * 2); + int x, y; + for(x = 0; x< DS_SCREEN_WIDTH; x++) + for(y = 0; y < DS_SCREEN_HEIGHT_COMBINED; y++) + { + correction_buffer[(y * DS_SCREEN_WIDTH + x) * 2] = temp_buffer[(x * DS_SCREEN_HEIGHT_COMBINED + y) * 2]; + correction_buffer[(y * DS_SCREEN_WIDTH + x) * 2 + 1] = temp_buffer[(x * DS_SCREEN_HEIGHT_COMBINED + y) * 2 + 1]; + } + + //fix the min size + if([min_size_item state] == NSOnState) + [self resetMinSize:false]; + + //resize the window/view + NSSize video_size = [video_output_view frame].size; + float temp = video_size.width; + video_size.width = video_size.height; + video_size.height = temp; + [self resizeScreen:video_size]; + } + + //set the checkmarks + [rotation0_item setState:NSOnState ]; + [rotation90_item setState:NSOffState]; + [rotation180_item setState:NSOffState]; + [rotation270_item setState:NSOffState]; +} + +- (void)setRotation90 +{ + if(rotation == ROTATION_90)return; + + if(rotation == ROTATION_270) + { + + rotation = ROTATION_90; + + [video_output_view setFrame:[video_output_view frame]]; + [self updateScreen]; + + } else + { + //set the global rotation state + rotation = ROTATION_90; + + //fix the buffer + memcpy(&temp_buffer, &correction_buffer, DS_SCREEN_WIDTH * DS_SCREEN_HEIGHT_COMBINED * 2); + int x, y; + for(x = 0; x< DS_SCREEN_WIDTH; x++) + for(y = 0; y < DS_SCREEN_HEIGHT_COMBINED; y++) + { + correction_buffer[(x * DS_SCREEN_HEIGHT_COMBINED + y) * 2] = temp_buffer[(y * DS_SCREEN_WIDTH + x) * 2]; + correction_buffer[(x * DS_SCREEN_HEIGHT_COMBINED + y) * 2 + 1] = temp_buffer[(y * DS_SCREEN_WIDTH + x) * 2 + 1]; + } + + //fix min size + if([min_size_item state] == NSOnState) + [self resetMinSize:false]; + + //resize the window/screen + NSSize video_size = [video_output_view frame].size; + float temp = video_size.width; + video_size.width = video_size.height; + video_size.height = temp; + [self resizeScreen:video_size]; + } + + //set the checkmarks + [rotation0_item setState:NSOffState]; + [rotation90_item setState:NSOnState ]; + [rotation180_item setState:NSOffState]; + [rotation270_item setState:NSOffState]; +} + +- (void)setRotation180 +{ + if(rotation == ROTATION_180)return; + + if(rotation == ROTATION_0) + { + rotation = ROTATION_180; + + [video_output_view setFrame:[video_output_view frame]]; + [self updateScreen]; + + } else + { + //set the global rotation state + rotation = ROTATION_180; + + //fix the buffer + memcpy(&temp_buffer, &correction_buffer, DS_SCREEN_WIDTH * DS_SCREEN_HEIGHT_COMBINED * 2); + int x, y; + for(x = 0; x< DS_SCREEN_WIDTH; x++) + for(y = 0; y < DS_SCREEN_HEIGHT_COMBINED; y++) + { + correction_buffer[(y * DS_SCREEN_WIDTH + x) * 2] = temp_buffer[(x * DS_SCREEN_HEIGHT_COMBINED + y) * 2]; + correction_buffer[(y * DS_SCREEN_WIDTH + x) * 2 + 1] = temp_buffer[(x * DS_SCREEN_HEIGHT_COMBINED + y) * 2 + 1]; + } + + //fix the min size + if([min_size_item state] == NSOnState) + [self resetMinSize:false]; + + //resize the window/view + NSSize video_size = [video_output_view frame].size; + float temp = video_size.width; + video_size.width = video_size.height; + video_size.height = temp; + [self resizeScreen:video_size]; + + } + + //set the checkmarks + [rotation0_item setState:NSOffState]; + [rotation90_item setState:NSOffState]; + [rotation180_item setState:NSOnState ]; + [rotation270_item setState:NSOffState]; +} + +- (void)setRotation270 +{ + if(rotation == ROTATION_270)return; + + if(rotation == ROTATION_90) + { + rotation = ROTATION_270; + + [video_output_view setFrame:[video_output_view frame]]; + [self updateScreen]; + + } else + { + + //set the global rotation state + rotation = ROTATION_270; + + //fix the buffer + memcpy(&temp_buffer, &correction_buffer, DS_SCREEN_WIDTH * DS_SCREEN_HEIGHT_COMBINED * 2); + int x, y; + for(x = 0; x< DS_SCREEN_WIDTH; x++) + for(y = 0; y < DS_SCREEN_HEIGHT_COMBINED; y++) + { + correction_buffer[(x * DS_SCREEN_HEIGHT_COMBINED + y) * 2] = temp_buffer[(y * DS_SCREEN_WIDTH + x) * 2]; + correction_buffer[(x * DS_SCREEN_HEIGHT_COMBINED + y) * 2 + 1] = temp_buffer[(y * DS_SCREEN_WIDTH + x) * 2 + 1]; + } + + //fix the min size + if([min_size_item state] == NSOnState) + [self resetMinSize:false]; + + //resize the window/screen + NSSize video_size = [video_output_view frame].size; + float temp = video_size.width; + video_size.width = video_size.height; + video_size.height = temp; + [self resizeScreen:video_size]; + } + + //set the checkmarks + [rotation0_item setState:NSOffState]; + [rotation90_item setState:NSOffState]; + [rotation180_item setState:NSOffState]; + [rotation270_item setState:NSOnState]; +} + +- (void)toggleTopBackground0 +{ + if(SubScreen.gpu->dispBG[0]) + { + GPU_remove(SubScreen.gpu, 0); + [topBG0_item setState:NSOffState]; + } + else + { + GPU_addBack(SubScreen.gpu, 0); + [topBG0_item setState:NSOnState]; + } +} + +- (void)toggleTopBackground1 +{ + if(SubScreen.gpu->dispBG[1]) + { + GPU_remove(SubScreen.gpu, 1); + [topBG1_item setState:NSOffState]; + } + else + { + GPU_addBack(SubScreen.gpu, 1); + [topBG1_item setState:NSOnState]; + } +} + +- (void)toggleTopBackground2 +{ + if(SubScreen.gpu->dispBG[2]) + { + GPU_remove(SubScreen.gpu, 2); + [topBG2_item setState:NSOffState]; + } + else + { + GPU_addBack(SubScreen.gpu, 2); + [topBG2_item setState:NSOnState]; + } +} + +- (void)toggleTopBackground3 +{ + if(SubScreen.gpu->dispBG[3]) + { + GPU_remove(SubScreen.gpu, 3); + [topBG3_item setState:NSOffState]; + } + else + { + GPU_addBack(SubScreen.gpu, 3); + [topBG3_item setState:NSOnState]; + } +} + +- (void)toggleSubBackground0 +{ + if(MainScreen.gpu->dispBG[0]) + { + GPU_remove(MainScreen.gpu, 0); + [subBG0_item setState:NSOffState]; + } + else + { + GPU_addBack(MainScreen.gpu, 0); + [subBG0_item setState:NSOnState]; + } +} + +- (void)toggleSubBackground1 +{ + if(MainScreen.gpu->dispBG[1]) + { + GPU_remove(MainScreen.gpu, 1); + [subBG1_item setState:NSOffState]; + } + else + { + GPU_addBack(MainScreen.gpu, 1); + [subBG1_item setState:NSOnState]; + } +} + +- (void)toggleSubBackground2 +{ + if(MainScreen.gpu->dispBG[2]) + { + GPU_remove(MainScreen.gpu, 2); + [subBG2_item setState:NSOffState]; + } + else + { + GPU_addBack(MainScreen.gpu, 2); + [subBG2_item setState:NSOnState]; + } +} + +- (void)toggleSubBackground3 +{ + if(MainScreen.gpu->dispBG[3]) + { + GPU_remove(MainScreen.gpu, 3); + [subBG3_item setState:NSOffState]; + } + else + { + GPU_addBack(MainScreen.gpu, 3); + [subBG3_item setState:NSOnState]; + } +} + +- (void)keyDown:(NSEvent*)event +{ + if([event isARepeat])return; + + unsigned short keycode = [event keyCode]; + + if(keycode == ds_a) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] &= 0xFFFE; + ((u16 *)MMU.ARM7_REG)[0x130>>1] &= 0xFFFE; + } + + else if(keycode == ds_b) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] &= 0xFFFD; + ((u16 *)MMU.ARM7_REG)[0x130>>1] &= 0xFFFD; + } + + else if(keycode == ds_select) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] &= 0xFFFB; + ((u16 *)MMU.ARM7_REG)[0x130>>1] &= 0xFFFB; + } + + else if(keycode == ds_start) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] &= 0xFFF7; + ((u16 *)MMU.ARM7_REG)[0x130>>1] &= 0xFFF7; + } + + else if(keycode == ds_right) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] &= 0xFFEF; + ((u16 *)MMU.ARM7_REG)[0x130>>1] &= 0xFFEF; + } + + else if(keycode == ds_left) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] &= 0xFFDF; + ((u16 *)MMU.ARM7_REG)[0x130>>1] &= 0xFFDF; + } + + else if(keycode == ds_up) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] &= 0xFFBF; + ((u16 *)MMU.ARM7_REG)[0x130>>1] &= 0xFFBF; + } + + else if(keycode == ds_down) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] &= 0xFF7F; + ((u16 *)MMU.ARM7_REG)[0x130>>1] &= 0xFF7F; + } + + else if(keycode == ds_r) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] &= 0xFEFF; + ((u16 *)MMU.ARM7_REG)[0x130>>1] &= 0xFEFF; + } + + else if(keycode == ds_l) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] &= 0xFDFF; + ((u16 *)MMU.ARM7_REG)[0x130>>1] &= 0xFDFF; + } + + else if(keycode == ds_x) + { + ((u16 *)MMU.ARM7_REG)[0x136>>1] &= 0xFFFE; + } + + else if(keycode == ds_y) + { + ((u16 *)MMU.ARM7_REG)[0x136>>1] &= 0xFFFD; + } + + else if(keycode == ds_debug) + { + ((u16 *)MMU.ARM7_REG)[0x136>>1] &= 0xFFFB; + } +} + +- (void)keyUp:(NSEvent*)event +{ + unsigned short keycode = [event keyCode]; + + if(keycode == ds_a) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] |= 0x1; + ((u16 *)MMU.ARM7_REG)[0x130>>1] |= 0x1; + } + + else if(keycode == ds_b) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] |= 0x2; + ((u16 *)MMU.ARM7_REG)[0x130>>1] |= 0x2; + } + + else if(keycode == ds_select) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] |= 0x4; + ((u16 *)MMU.ARM7_REG)[0x130>>1] |= 0x4; + } + + else if(keycode == ds_start) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] |= 0x8; + ((u16 *)MMU.ARM7_REG)[0x130>>1] |= 0x8; + } + + else if(keycode == ds_right) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] |= 0x10; + ((u16 *)MMU.ARM7_REG)[0x130>>1] |= 0x10; + } + + if(keycode == ds_left) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] |= 0x20; + ((u16 *)MMU.ARM7_REG)[0x130>>1] |= 0x20; + } + + else if(keycode == ds_up) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] |= 0x40; + ((u16 *)MMU.ARM7_REG)[0x130>>1] |= 0x40; + } + + else if(keycode == ds_down) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] |= 0x80; + ((u16 *)MMU.ARM7_REG)[0x130>>1] |= 0x80; + } + + else if(keycode == ds_r) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] |= 0x100; + ((u16 *)MMU.ARM7_REG)[0x130>>1] |= 0x100; + } + + else if(keycode == ds_l) + { + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] |= 0x200; + ((u16 *)MMU.ARM7_REG)[0x130>>1] |= 0x200; + } + + else if(keycode == ds_x) + { + ((u16 *)MMU.ARM7_REG)[0x136>>1] |= 0x1; + } + + else if(keycode == ds_y) + { + ((u16 *)MMU.ARM7_REG)[0x136>>1] |= 0x2; + } + + else if(keycode == ds_debug) + { + ((u16 *)MMU.ARM7_REG)[0x136>>1] |= 0x4; + } + + else if(keycode == save_slot_1) + { + bool was_paused = paused; + [NDS pause]; + + if([event modifierFlags] & NSShiftKeyMask) + savestate_slot(1); + else + loadstate_slot(1); + + if(!was_paused)[NDS execute]; + } + + else if(keycode == save_slot_2) + { + bool was_paused = paused; + [NDS pause]; + + if([event modifierFlags] & NSShiftKeyMask) + savestate_slot(2); + else + loadstate_slot(2); + + if(!was_paused)[NDS execute]; + } + + else if(keycode == save_slot_3) + { + bool was_paused = paused; + [NDS pause]; + + if([event modifierFlags] & NSShiftKeyMask) + savestate_slot(3); + else + loadstate_slot(3); + + if(!was_paused)[NDS execute]; + } + + else if(keycode == save_slot_4) + { + bool was_paused = paused; + [NDS pause]; + + if([event modifierFlags] & NSShiftKeyMask) + savestate_slot(4); + else + loadstate_slot(4); + + if(!was_paused)[NDS execute]; + } + + else if(keycode == save_slot_5) + { + bool was_paused = paused; + [NDS pause]; + + if([event modifierFlags] & NSShiftKeyMask) + savestate_slot(5); + else + loadstate_slot(5); + + if(!was_paused)[NDS execute]; + } + + else if(keycode == save_slot_6) + { + bool was_paused = paused; + [NDS pause]; + + if([event modifierFlags] & NSShiftKeyMask) + savestate_slot(6); + else + loadstate_slot(6); + + if(!was_paused)[NDS execute]; + } + + else if(keycode == save_slot_7) + { + bool was_paused = paused; + [NDS pause]; + + if([event modifierFlags] & NSShiftKeyMask) + savestate_slot(7); + else + loadstate_slot(7); + + if(!was_paused)[NDS execute]; + } + + else if(keycode == save_slot_8) + { + bool was_paused = paused; + [NDS pause]; + + if([event modifierFlags] & NSShiftKeyMask) + savestate_slot(8); + else + loadstate_slot(8); + + if(!was_paused)[NDS execute]; + } + + else if(keycode == save_slot_9) + { + bool was_paused = paused; + [NDS pause]; + + if([event modifierFlags] & NSShiftKeyMask) + savestate_slot(9); + else + loadstate_slot(9); + + if(!was_paused)[NDS execute]; + } + + else if(keycode == save_slot_10) + { + bool was_paused = paused; + [NDS pause]; + + if([event modifierFlags] & NSShiftKeyMask) + savestate_slot(10); + else + loadstate_slot(10); + + if(!was_paused)[NDS execute]; + } + +} + +- (void)mouseDown:(NSEvent*)event +{ + NSPoint location = [event locationInWindow]; + + //If the click was to the left or under the opengl view, exit + if((location.x < WINDOW_BORDER_PADDING) || (location.y < WINDOW_BORDER_PADDING)) + return; + location.x -= WINDOW_BORDER_PADDING; + location.y -= WINDOW_BORDER_PADDING; + + //If the click was top or right of the view... + if(location.x >= x_size)return; + if(location.y >= y_size)return; + + if(rotation == ROTATION_0 || rotation == ROTATION_180) + { + if(rotation == ROTATION_180) + { + if(location.y < y_size / 2)return; + location.x = x_size - location.x; + location.y = y_size - location.y; + } else + if(location.y >= y_size / 2)return; + + //scale the coordinates + location.x *= ((float)DS_SCREEN_WIDTH) / ((float)x_size); + location.y *= ((float)DS_SCREEN_HEIGHT_COMBINED) / ((float)y_size); + + //invert the y + location.y = DS_SCREEN_HEIGHT - location.y - 1; + + } else + { + + if(rotation == ROTATION_270) + { + if(location.x < x_size / 2)return; + location.x = x_size - location.x; + + } else + { + if(location.x >= x_size / 2)return; + location.y = y_size - location.y; + } + + location.x *= ((float)DS_SCREEN_HEIGHT_COMBINED) / ((float)x_size); + location.y *= ((float)DS_SCREEN_WIDTH) / ((float)y_size); + + //invert the y + location.x = DS_SCREEN_HEIGHT - location.x - 1; + + float temp = location.x; + location.x = location.y; + location.y = temp; + } +//[self setTitle:[NSString localizedStringWithFormat:@"%u %u", (unsigned int)location.x, (unsigned int)location.y]]; + + NDS_setTouchPos((unsigned short)location.x, (unsigned short)location.y); +} + +- (void)mouseDragged:(NSEvent*)event +{ + [self mouseDown:event]; +} + +- (void)mouseUp:(NSEvent*)event +{ +// [self setTitle:@""]; + + NDS_releasTouch(); +} +@end + +//Window Delegate ----------------------------------------------------------------------- + +@implementation WindowDelegate +- (BOOL)windowShouldClose:(id)sender +{ + [sender hide]; + return FALSE; +} + +- (void)windowDidResize:(NSNotification *)aNotification; +{ + BOOL was_paused = paused; //we need to pause here incase the other thread wants to draw to the view while its resizing + [NDS pause]; + + //this is called after the window frame resizes + //so we must recalculate the video output view + + NSRect rect; + rect.size.width = x_size; + rect.size.height = y_size; + rect.origin.x = WINDOW_BORDER_PADDING; + rect.origin.y = WINDOW_BORDER_PADDING; + [video_output_view setFrame:rect]; + + if(!was_paused)[NDS execute]; +} + +- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize +{ + //constrain size + if(proposedFrameSize.width < min_size.width)proposedFrameSize.width = min_size.width; + if(proposedFrameSize.height < min_size.height)proposedFrameSize.height = min_size.height; + + //constrain proportions + if(keep_proportions) + { + //this is a simple algorithm to constrain to the smallest axis + unsigned short x_constrained; + unsigned short y_constrained; + + if(rotation == ROTATION_0 || rotation == ROTATION_180) + { + //this is a simple algorithm to constrain to the smallest axis + + x_constrained = ((float)(proposedFrameSize.height - WINDOW_BORDER_PADDING - title_bar_height)) * DS_SCREEN_X_RATIO; + x_constrained += WINDOW_BORDER_PADDING * 2; + + y_constrained = ((float)(proposedFrameSize.width - WINDOW_BORDER_PADDING * 2)) * DS_SCREEN_Y_RATIO; + y_constrained += WINDOW_BORDER_PADDING + title_bar_height; + + } else + { + + x_constrained = ((float)(proposedFrameSize.height - WINDOW_BORDER_PADDING - title_bar_height)) * DS_SCREEN_Y_RATIO; + x_constrained += WINDOW_BORDER_PADDING * 2; + + y_constrained = ((float)(proposedFrameSize.width - WINDOW_BORDER_PADDING * 2)) * DS_SCREEN_X_RATIO; + y_constrained += WINDOW_BORDER_PADDING + title_bar_height; + + } + + if(x_constrained < proposedFrameSize.width)proposedFrameSize.width = x_constrained; + if(y_constrained < proposedFrameSize.height)proposedFrameSize.height = y_constrained; + } + + //set global size variables + x_size = proposedFrameSize.width - WINDOW_BORDER_PADDING * 2; + y_size = proposedFrameSize.height - WINDOW_BORDER_PADDING - title_bar_height; + + //set the menu items + if((x_size == DS_SCREEN_WIDTH) && (y_size == DS_SCREEN_HEIGHT_COMBINED)) + { + [resize1x setState:NSOnState ]; + [resize2x setState:NSOffState]; + [resize3x setState:NSOffState]; + [resize4x setState:NSOffState]; + } else if((x_size == DS_SCREEN_WIDTH * 2) && (y_size == DS_SCREEN_HEIGHT_COMBINED * 2)) + { + [resize1x setState:NSOffState]; + [resize2x setState:NSOnState ]; + [resize3x setState:NSOffState]; + [resize4x setState:NSOffState]; + } else if((x_size == DS_SCREEN_WIDTH * 3) && (y_size == DS_SCREEN_HEIGHT_COMBINED * 3)) + { + [resize1x setState:NSOffState]; + [resize2x setState:NSOffState]; + [resize3x setState:NSOnState ]; + [resize4x setState:NSOffState]; + } else if((x_size == DS_SCREEN_WIDTH * 4) && (y_size == DS_SCREEN_HEIGHT_COMBINED * 4)) + { + [resize1x setState:NSOffState]; + [resize2x setState:NSOffState]; + [resize3x setState:NSOffState]; + [resize4x setState:NSOnState ]; + } else + { + [resize1x setState:NSOffState]; + [resize2x setState:NSOffState]; + [resize3x setState:NSOffState]; + [resize4x setState:NSOffState]; + } + + //return the [potentially modified] frame size to cocoa to actually resize the window + return proposedFrameSize; +} + +@end diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/Makefile.am /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/Makefile.am --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/Makefile.am 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/Makefile.am 2007-08-11 18:46:01.000000000 -0500 @@ -0,0 +1 @@ +EXTRA_DIST = cocoa_util.m DeSmuME.cbp globals.h main.m main_window.h main_window.m nds_control.h nds_control.m preferences.m diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/Makefile.in /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/Makefile.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/Makefile.in 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/Makefile.in 2007-09-03 12:31:41.000000000 -0500 @@ -0,0 +1,367 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = src/cocoa +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLADEUI_UNINSTALLED_DIR = @GLADEUI_UNINSTALLED_DIR@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ +GTHREAD_LIBS = @GTHREAD_LIBS@ +GTKGLEXT_CFLAGS = @GTKGLEXT_CFLAGS@ +GTKGLEXT_LIBS = @GTKGLEXT_LIBS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_PKG = @HAVE_PKG@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ +INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ +INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ +INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ +INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ +INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ +INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ +INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ +INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ +INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ +INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ +INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ +INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ +INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ +INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ +LDFLAGS = @LDFLAGS@ +LIBGLADE_CFLAGS = @LIBGLADE_CFLAGS@ +LIBGLADE_LIBS = @LIBGLADE_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_DIR = @PO_DIR@ +PO_FILES = @PO_FILES@ +PO_FILES_IN = @PO_FILES_IN@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SDLCONFIG = @SDLCONFIG@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UI_DIR = @UI_DIR@ +USE_MAINTAINER_MODE = @USE_MAINTAINER_MODE@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +desmume_arch = @desmume_arch@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = cocoa_util.m DeSmuME.cbp globals.h main.m main_window.h main_window.m nds_control.h nds_control.m preferences.m +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/cocoa/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/cocoa/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/nds_control.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/nds_control.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/nds_control.h 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/nds_control.h 2007-08-11 14:23:45.000000000 -0500 @@ -0,0 +1,59 @@ +/* Copyright (C) 2007 Jeff Bland + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef NDS_CONTROL_H_INCLUDED +#define NDS_CONTROL_H_INCLUDED + +#include + +//This class manages emulation +//dont instanciate more than once! +@interface NintendoDS : NSObject {} + +//creation +- (id)init; + +//ROM control +- (void)pickROM; +- (BOOL)loadROM:(NSString*)filename; +- (void)closeROM; +- (void)askAndCloseROM; + +//execution control +- (void)execute; +- (void)pause; +- (void)reset; +- (void)setFrameSkip:(id)sender; + +//run function (should be called at the start of the program) +- (void)run; + +//save states +- (void)saveStateAs; +- (void)loadStateFrom; +- (void)saveToSlot:(id)sender; +- (void)loadFromSlot:(id)sender; +//- (void)askAndClearStates; + +// +- (void)showRomInfo; +@end + + +#endif // NDS_CONTROL_H_INCLUDED diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/nds_control.m /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/nds_control.m --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/nds_control.m 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/nds_control.m 2007-08-11 14:23:45.000000000 -0500 @@ -0,0 +1,711 @@ +/* Copyright (C) 2007 Jeff Bland + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +//DeSmuME Cocoa includes +#import "globals.h" +#import "nds_control.h" +#import "main_window.h" + +//DeSmuME general includes +#define OBJ_C +#include "../NDSSystem.h" +#include "../saves.h" +#undef BOOL + +//ds screens are 59.8 frames per sec, so 1/59.8 seconds per frame +//times one million for microseconds per frame +#define DS_MICROSECONDS_PER_FRAME (1.0 / 59.8) * 1000000.0 + +//fixme bug when hitting apple+Q during the open dialog + +@interface TableHelper : NSObject +{ + NSTableView *table; + NSTableColumn *type_column; + NSTableColumn *value_column; + NDS_header *header; +} +//init +- (id)initWithWindow:(NSWindow*)window; + +//table data protocol +- (int)numberOfRowsInTableView:(NSTableView *)aTableView; +- (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id )info row:(int)row dropOperation:(NSTableViewDropOperation)operation; +- (NSArray *)tableView:(NSTableView *)aTableView namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination forDraggedRowsWithIndexes:(NSIndexSet *)indexSet; +- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex; +- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex; +- (void)tableView:(NSTableView *)aTableView sortDescriptorsDidChange:(NSArray *)oldDescriptors; +- (NSDragOperation)tableView:(NSTableView *)aTableView validateDrop:(id )info proposedRow:(int)row proposedDropOperation:(NSTableViewDropOperation)operation; +- (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard*)pboard; + +//window delegate stuff +- (void)windowWillClose:(NSNotification *)aNotification; +- (void)windowDidResize:(NSNotification *)aNotification; +@end + +///////////////////////// + +NSMenuItem *close_rom_item; +NSMenuItem *execute_item; +NSMenuItem *pause_item; +NSMenuItem *reset_item; +NSMenuItem *save_state_as_item; +NSMenuItem *load_state_from_item; +NSMenuItem *saveSlot_item[SAVE_SLOTS]; +NSMenuItem *loadSlot_item[SAVE_SLOTS]; +//NSMenuItem *clear_all_saves_item; +NSMenuItem *rom_info_item; +NSMenuItem *frame_skip_auto_item; +NSMenuItem *frame_skip_item[MAX_FRAME_SKIP]; + +volatile u8 frame_skip = 0; //this is one more than the acutal frame skip, a value of 0 signifies auto frame skip + +static int backupmemorytype=MC_TYPE_AUTODETECT; +static u32 backupmemorysize=1; + +NSString *current_file; + +@implementation NintendoDS +- (id)init +{ + struct armcpu_memory_iface *arm9_memio = &arm9_base_memory_iface; + struct armcpu_memory_iface *arm7_memio = &arm7_base_memory_iface; + struct armcpu_ctrl_iface *arm9_ctrl_iface; + struct armcpu_ctrl_iface *arm7_ctrl_iface; + //struct configured_features my_config; + + NDS_Init( arm9_memio, &arm9_ctrl_iface, + arm7_memio, &arm7_ctrl_iface); + +typedef struct { + enum nds_fw_ds_type ds_type; + + u8 fav_colour; + u8 birth_month; + u8 birth_day; + + u16 nickname[MAX_FW_NICKNAME_LENGTH]; + u8 nickname_len; + + u16 message[MAX_FW_MESSAGE_LENGTH]; + u8 message_len; + + u8 language; + + /* touchscreen calibration */ + struct NDS_fw_touchscreen_cal touch_cal[2]; +} NDS_fw_config_data; + + NDS_fw_config_data firmware; + NDS_FillDefaultFirmwareConfigData(&firmware); + NDS_CreateDummyFirmware(&firmware); + + return self; +} + +- (void)pickROM +{ + BOOL was_paused = paused; + [self pause]; + + NSString *temp = openDialog([NSArray arrayWithObjects:@"NDS", @"ds.GBA", nil]); + + if(temp) + { + [self loadROM:temp]; + return; + } + + if(!was_paused)[self execute]; +} + +- (BOOL)loadROM:(NSString*)filename +{ + //pause if not already paused + bool was_paused = paused; + [self pause]; + + //load the rom + if(!NDS_LoadROM([filename cStringUsingEncoding:NSASCIIStringEncoding], backupmemorytype, backupmemorysize, "/Users/gecko/AAAA.sav") > 0) + { + //if it didn't work give an error and dont unpause + messageDialog(@"Error", @"Could not open file"); + + //continue playing if load didn't work + if(!was_paused)[self execute]; + + return FALSE; + } + + //set current file var + current_file = filename; + + //enable execution control menu + [execute_item setEnabled:YES]; + [pause_item setEnabled:YES]; + [reset_item setEnabled:YES]; + [close_rom_item setEnabled:YES]; + [rom_info_item setEnabled:YES]; + [save_state_as_item setEnabled:YES]; + [load_state_from_item setEnabled:YES]; + + // + bool atleast_one_save_exists = false; + scan_savestates(); + int i; + for(i = 0; i < SAVE_SLOTS; i++) + { + [saveSlot_item[i] setEnabled:YES]; + + if(savestates[i].exists == desmume_TRUE) + { + atleast_one_save_exists = true; + [saveSlot_item[i] setState:NSOnState]; + [loadSlot_item[i] setEnabled:YES]; + } else + { + [saveSlot_item[i] setState:NSOffState]; + [loadSlot_item[i] setEnabled:NO]; + } + } + + //if(atleast_one_save_exists) + //[clear_all_saves_item setEnabled:YES]; + + //layers apparently get reset on rom load? + //[set topBG2_item fixme + + //if it worked, unpause (start) + [self execute]; + + return true; +} + +- (void)closeROM +{ + [self pause]; + + NDS_FreeROM(); + + //set menu item states + [execute_item setEnabled:NO]; + [pause_item setEnabled:NO]; + [reset_item setEnabled:NO]; + [close_rom_item setEnabled:NO]; + [rom_info_item setEnabled:NO]; + [save_state_as_item setEnabled:NO]; + [load_state_from_item setEnabled:NO]; + + //disable all save slots + int i; + for(i = 0; i < SAVE_SLOTS; i++) + { + [saveSlot_item[i] setEnabled:NO]; + [saveSlot_item[i] setState:NSOffState]; + [loadSlot_item[i] setEnabled:NO]; + } + + //[clear_all_saves_item setEnabled:NO]; +} + +- (void)askAndCloseROM +{ + bool was_paused = paused; + [NDS pause]; + + if(messageDialogYN(localizedString(@"DeSmuME Emulator", nil), localizedString(@"Are you sure you want to close the ROM?", nil))) + { + [self closeROM]; + + [main_window clearScreen]; + } + else if(!was_paused)[NDS execute]; +} + +- (void)execute +{ + paused = FALSE; + execute = TRUE; + //SPU_Pause(0); + + [pause_item setState:NSOffState]; + [execute_item setState:NSOnState]; +} + +- (void)pause +{ + if(paused)return; + + execute = FALSE; + //SPU_Pause(1); + +#ifndef MULTITHREADED + paused = TRUE; +#else + //wait for the other thread to stop execution + while (!paused) {} +#endif + + [pause_item setState:NSOnState]; + [execute_item setState:NSOffState]; +} + +- (void)reset +{ + NDS_Reset(); + [self execute]; +} + +- (void)setFrameSkip:(id)sender +{ + int i; + + //see if this was sent from the autoskip menu item + if(sender == frame_skip_auto_item) + { + //set the frame skip to auto + frame_skip = 0; + + //check auto + [frame_skip_auto_item setState:NSOnState]; + + //uncheck the others + for(i = 0; i < MAX_FRAME_SKIP; i++)[frame_skip_item[i] setState:NSOffState]; + return; + } + + //search through the frame skip menu items to find out which one called this function + for(i = 0; i < MAX_FRAME_SKIP; i++) + if(sender == frame_skip_item[i])break; + + if(i == MAX_FRAME_SKIP)return; //not a known sender + + //set the frame skip value + frame_skip = i + 1; + + //check the selected frame skip value + [frame_skip_item[i] setState:NSOnState]; + + //uncheck the others + int i2; + for(i2 = 0; i2 < MAX_FRAME_SKIP; i2++) + if(i2 != i) + [frame_skip_item[i2] setState:NSOffState]; + [frame_skip_auto_item setState:NSOffState]; +} + +- (void)run +{ + u32 cycles = 0; + + //this flag is so we can set the pause state to true + //ONCE after the inner run loop breaks (ie when you pause) + //to avoid some slight chance that the other thread sets pause to false + //and this thread re + bool was_running = false; //initialized here to avoid a warning + + unsigned long long frame_start_time, frame_end_time; + unsigned long long microseconds_per_frame; + + int frames_to_skip = 0; + + //program main loop + while(!finished) + { + +#ifndef MULTITHREADED + //keep the GUI responsive even while not running a gme + if(!execute)clearEvents(true); +#endif + //run the emulator + while(execute && !finished) + { + was_running = true; + +//clear the event queue so the GUI elements are responsive when the game is running +//needs to happen before frame_start_time is recieved incase the user does a live resize +//or something that will pause everything +#ifndef MULTITHREADED + if(frames_to_skip == 0) + clearEvents(false); +#endif + + Microseconds((struct UnsignedWide*)&frame_start_time); + + cycles = NDS_exec((560190<<1)-cycles, FALSE); + + if(frames_to_skip != 0) + frames_to_skip--; + + else + { + + Microseconds((struct UnsignedWide*)&frame_end_time); + + if(frame_skip == 0) + { //automatic + + //i don't know if theres a standard strategy, but here we calculate + //how much longer the frame took than it should have, then set it to skip + //that many frames. + frames_to_skip = ((double)(frame_end_time - frame_start_time)) / ((double)DS_MICROSECONDS_PER_FRAME); + + } else + { + + frames_to_skip = frame_skip; + + } + +#ifndef MULTITHREADED + if(!paused) //so the screen doesnt update after being cleared to white (when closing rom) +#endif + [main_window updateScreen]; + + } + + } + + // + if(was_running) + { + paused = TRUE; //for the multithreaded version (avoid forever loop in the pause method) + was_running = false; // + + //set some kind of checkmarks or something? + } + + } +} + +- (void)saveStateAs +{ + messageDialog(@"LOAD",@"DDSA"); +} + +- (void)loadStateFrom +{ + NSString *file = openDialog([NSArray arrayWithObject:@"DST"]); + + if(file) + { + [NDS pause]; + + savestate_load([file cStringUsingEncoding:NSASCIIStringEncoding]); + + [NDS execute]; + } +} + +- (void)saveToSlot:(id)sender +{ + //get the save slot by detecting which menu item sent the message + int i; + for(i = 0; i < SAVE_SLOTS; i++) + if(sender == saveSlot_item[i])break; + + //quit if the message wasn't sent by a save state menu item + if(i == SAVE_SLOTS)return; + + bool was_paused = paused; + [NDS pause]; + + savestate_slot(i + 1); + + [saveSlot_item[i] setState:NSOnState]; + [loadSlot_item[i] setEnabled:YES]; + //[clear_all_saves_item setEnabled:YES]; + + if(!was_paused)[NDS execute]; + +} + +- (void)loadFromSlot:(id)sender +{ + //get the load slot + int i; + for(i = 0; i < SAVE_SLOTS; i++) + if(sender == loadSlot_item[i])break; + + //quit if the message wasn't sent by a save state menu item + if(i == SAVE_SLOTS)return; + + bool was_paused = paused; + [NDS pause]; + + loadstate_slot(i + 1); + + if(!was_paused)[NDS execute]; +} +/* +- (void)askAndClearStates +{ + BOOL was_paused = paused; + [NDS pause]; + + if(messageDialogYN(localizedString(@"DeSmuME Emulator", nil), + localizedString(@"Are you sure you want to clear all save slots?", nil))) + { + + + to be implemented after saves.h provides a way to delete saves... + + int i; + for(i = 0; i < SAVE_SLOTS; i++) + { + [saveSlot_item[i] setState:NSOffState]; + [loadSlot_item[i] setEnabled:NO]; + } + + [clear_all_saves_item setEnabled:NO]; + + } + + if(!was_paused)[NDS execute]; +} +*/ + +- (void)showRomInfo +{ + BOOL was_paused = paused; + [self pause]; + + //create a window + NSRect rect; + rect.size.width = 400; + rect.size.height = 200; //fixme; + rect.origin.x = 200; + rect.origin.y = 200; + NSWindow *rom_info_window = [[NSWindow alloc] initWithContentRect:rect styleMask: + NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask backing:NSBackingStoreBuffered defer:NO screen:nil]; + + //set the window title + [rom_info_window setTitle:localizedString(@"ROM Info", nil)]; + + //create an NSTableView to display the stuff + TableHelper *helper = [[TableHelper alloc] initWithWindow:rom_info_window]; + + //set the window delegate + [rom_info_window setDelegate:helper]; + + //min size is starting size + [rom_info_window setMinSize:[rom_info_window frame].size]; + + //show the window + [[[NSWindowController alloc] initWithWindow:rom_info_window] showWindow:nil]; + + //run the window + [NSApp runModalForWindow:rom_info_window]; + + if(!was_paused)[self execute]; +} + +@end +#define ROM_INFO_ROWS 9 +#define ROM_INFO_WIDTH 400 +@implementation TableHelper +- (id)initWithWindow:(NSWindow*)window +{ + self = [super init]; + + type_column = [[NSTableColumn alloc] initWithIdentifier:@""]; + [type_column setEditable:NO]; + [value_column setResizable:YES]; + [[type_column headerCell] setStringValue:@"Attribute"]; + [type_column setMinWidth: 1]; + + value_column = [[NSTableColumn alloc] initWithIdentifier:@""]; + [value_column setEditable:NO]; + [value_column setResizable:YES]; + [[value_column headerCell] setStringValue:@"Value"]; + [value_column setMinWidth: 1]; + + NSRect rect; + rect.size.width = rect.size.height = rect.origin.x = rect.origin.y = 0; + table = [[NSTableView alloc] initWithFrame:rect]; + [table setDrawsGrid:NO]; + [table setAllowsColumnSelection:YES]; + [table setAllowsColumnReordering:YES]; + [table setAllowsEmptySelection:YES]; + [table setAllowsMultipleSelection:NO]; + [table addTableColumn:type_column]; + [table addTableColumn:value_column]; + [table setDataSource:self]; + //[table setDelegate:self]; + //[table setTarget: _parent]; + //[table setDoubleAction: @selector(editClicked:)]; + [table setUsesAlternatingRowBackgroundColors:YES]; + + // + //[table setHeaderView:[[NSTableHeaderView alloc] initWithFrame:NSMakeRect(0,0,0,0)]]; +if([table headerView] == nil)messageDialogBlank(); + + //resize the window to fit enough rows + rect.size.width = ROM_INFO_WIDTH; + rect.size.height = [table rowHeight] * ROM_INFO_ROWS + [table intercellSpacing].height * (ROM_INFO_ROWS - 1) + 2 /*dunno what the 2 is for*/; + [window setContentSize:rect.size]; + + //resize the left column to take up only as much space as needed + //[type_column sizeToFit]; + + //resize the right column to take up the rest of the window + [value_column setWidth:ROM_INFO_WIDTH - [type_column width]]; + + // + [window setContentView:table]; + + //grab the header to read data from + header = NDS_getROMHeader(); + + return self; +} +- (int)numberOfRowsInTableView:(NSTableView *)aTableView; +{ + return ROM_INFO_ROWS; +} + +- (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id )info row:(int)row dropOperation:(NSTableViewDropOperation)operation +{ + return NO; +} + +- (NSArray *)tableView:(NSTableView *)aTableView namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination forDraggedRowsWithIndexes:(NSIndexSet *)indexSet +{ + return [NSArray array]; +} + +- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex +{ + if(aTableColumn == type_column) + { + if(rowIndex == 0) + return localizedString(@"File on Disc", @" ROM Info "); + + if(rowIndex == 1) + return localizedString(@"ROM Title", @" ROM Info "); + + if(rowIndex == 2) + return localizedString(@"Maker Code", @" ROM Info "); + + if(rowIndex == 3) + return localizedString(@"Unit Code", @" ROM Info "); + + if(rowIndex == 4) + return localizedString(@"Card Size", @" ROM Info "); + + if(rowIndex == 5) + return localizedString(@"Flags", @" ROM Info "); + + if(rowIndex == 6) + return localizedString(@"Size of ARM9 Binary", @" ROM Info "); + + if(rowIndex == 7) + return localizedString(@"Size of ARM7 Size", @" ROM Info "); + + if(rowIndex == 8) + return localizedString(@"Size of Data", @" ROM Info "); + } else + { + if(rowIndex == 0)return current_file; + + if(rowIndex == 1) + return NSSTRc(header->gameTile); + + if(rowIndex == 2) + { + return [NSString localizedStringWithFormat:@"%u", header->makerCode]; + } + + if(rowIndex == 3) + { + return [NSString localizedStringWithFormat:@"%u", header->unitCode]; + } + + if(rowIndex == 4) + {//fixe: should show units? + return [NSString localizedStringWithFormat:@"%u", header->cardSize]; + } + + if(rowIndex == 5) + {//always seems to be empty? + return [NSString localizedStringWithFormat:@"%u%u%u%u%u%u%u%u", + ((header->flags) & 0x01) >> 0, + ((header->flags) & 0x02) >> 1, + ((header->flags) & 0x04) >> 2, + ((header->flags) & 0x08) >> 3, + ((header->flags) & 0x10) >> 4, + ((header->flags) & 0x20) >> 5, + ((header->flags) & 0x40) >> 6, + ((header->flags) & 0x80) >> 7]; + } + + if(rowIndex == 6) + {//fixe: should show units? + return [NSString localizedStringWithFormat:@"%u", header->ARM9binSize]; + } + + if(rowIndex == 7) + {//fixe: should show units? + return [NSString localizedStringWithFormat:@"%u", header->ARM7binSize]; + } + + if(rowIndex == 8) + {//fixe: should show units? + return [NSString localizedStringWithFormat:@"%u", header->ARM7binSize + header->ARM7src]; + } + + } + + return @"If you see this, there is a bug"; +} + +- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex; +{ +} + +- (void)tableView:(NSTableView *)aTableView sortDescriptorsDidChange:(NSArray *)oldDescriptors; +{ +} + +- (NSDragOperation)tableView:(NSTableView *)aTableView validateDrop:(id )info proposedRow:(int)row proposedDropOperation:(NSTableViewDropOperation)operation +{ + return NSDragOperationNone; +} + +- (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard*)pboard; +{ + return NO; +} + +- (void)windowWillClose:(NSNotification *)aNotification +{ + [NSApp stopModal]; +} + +- (void)windowDidResize:(NSNotification *)aNotification +{ + //we have this because the tableview doesn't change clipped text size + + int i; + for(i = 0; i < ROM_INFO_ROWS; i++) + { + [table drawRow:i clipRect:[table frame]]; + } +} +@end diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/preferences.m /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/preferences.m --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/cocoa/preferences.m 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/cocoa/preferences.m 2007-08-11 14:51:07.000000000 -0500 @@ -0,0 +1,189 @@ +#import "globals.h" +#import "nds_control.h" + +/////////////////////////////// + +NSWindow *preferences_window; + +NSFont *preferences_font; +NSDictionary *preferences_font_attribs; + +NSTabViewItem *interface_pane_tab; +NSTabViewItem *firmware_pane_tab; +NSTabViewItem *plugins_pane_tab; + +NSText *language_selection_text; +NSPopUpButton *language_selection; + +/////////////////////////////// + +@interface PreferencesDelegate : NSObject {} +- (void)windowWillClose:(NSNotification *)aNotification; +@end + +@implementation PreferencesDelegate +- (void)windowWillClose:(NSNotification *)aNotification +{ + [NSApp stopModal]; +} + +- (void)languageChange:(id)sender +{ + +} +@end + +//////////////////////////////////////////////////// + +@implementation NSApplication(custom_extensions) + +- (void)launchWebsite +{ + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://desmume.sourceforge.net"]]; +} + +- (void)launchForums +{ + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://forums.desmume.org/index.php"]]; +} + +- (void)bugReport +{ + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://sourceforge.net/tracker/?func=add&group_id=164579&atid=832291"]]; +} + +- (void)about +{ + bool was_paused = paused; + [NDS pause]; + + NSRunAlertPanel(localizedString(@"About DeSmuME", nil), + @"DeSmuME is an open source Nintendo DS emulator.\n\nBased off of YopYop's original work, and continued by the DeSmuME team.\n\ +\nhttp://www.desmume.org\n\n\n\ +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. \ +\n\n\ +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. \ +\n\n\ +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\ +\n\n\ +See the GNU General Public License details in COPYING.", nil/*OK*/, nil, nil); + + if(!was_paused)[NDS execute]; +} + +/////////////////////////////////////////////////// + +- (void)preferences +{ + bool was_paused = paused; + [NDS pause]; + + //---------------------------------------------------------------------------------------------- + + //get the applications main bundle + NSBundle* app_bundle = [NSBundle mainBundle]; + + //grab the list of languages + NSArray *languages = [app_bundle localizations]; + + //get a font for displaying text + preferences_font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]]; + + preferences_font_attribs = [NSDictionary dictionaryWithObjectsAndKeys:preferences_font, NSFontAttributeName, nil]; + + //create our delegate + PreferencesDelegate *delegate = [[PreferencesDelegate alloc] init]; + // + int i; //general iterator + + //Create the window ------------------------------------------------------------------------------ + + //create a preferences window + NSRect rect; + rect.size.width = 400; + rect.size.height = 300; + rect.origin.x = 200; + rect.origin.y = 200; + preferences_window = [[NSWindow alloc] initWithContentRect:rect styleMask: + NSTitledWindowMask|NSClosableWindowMask backing:NSBackingStoreBuffered defer:NO screen:nil]; + + //set the window title + [preferences_window setTitle:localizedString(@"DeSmuME Preferences", nil)]; + + //set the window delegate + [preferences_window setDelegate:delegate]; + + //create a tab view + rect.size.width = 400 - 10; + rect.size.height = 300 - 10; + rect.origin.x = 5; + rect.origin.y = 5; + NSTabView *tab_view = [[NSTabView alloc] initWithFrame:rect]; + [[preferences_window contentView] addSubview:tab_view]; + + //Create the "Interface" pane + interface_pane_tab = [[NSTabViewItem alloc] initWithIdentifier:nil]; + [interface_pane_tab setLabel:localizedString(@"Interface", nil)]; + [tab_view addTabViewItem:interface_pane_tab]; + + //Create interface view + rect.size.width = 400 - 10; + rect.size.height = 300 - 10; + rect.origin.x = 0; + rect.origin.y = 0; + NSView *interface_view = [[NSView alloc] initWithFrame:rect]; + [interface_pane_tab setView:interface_view]; + + //Create language selection text + rect.size.width = 225; + rect.size.height = 29 - [localizedString(@"Language",nil) sizeWithAttributes:preferences_font_attribs].height / 2; + rect.origin.x = 0; + rect.origin.y = 200;// + [localizedString(@"Language",nil) sizeWithAttributes:preferences_font_attribs].height / 2; + language_selection_text = [[NSText alloc] initWithFrame:rect]; + [language_selection_text setFont: preferences_font]; + [language_selection_text setString:localizedString(@"Language",nil)]; + [language_selection_text setEditable:NO]; + [language_selection_text setDrawsBackground:NO]; + [interface_view addSubview:language_selection_text]; + + //Create language selection button + rect.size.width = 130; + rect.size.height = 26; + rect.origin.x = 230; + rect.origin.y = 200; + language_selection = [[NSPopUpButton alloc] initWithFrame:rect pullsDown:NO]; + [language_selection addItemWithTitle:@"Default"]; + for(i = 0; i < [languages count]; i++) + [language_selection addItemWithTitle:[languages objectAtIndex:i]]; + [language_selection setAction:@selector(languageChange:)]; + [language_selection setTarget:delegate]; + [interface_view addSubview:language_selection]; + + //Create the "DS Firmware" pane + firmware_pane_tab = [[NSTabViewItem alloc] initWithIdentifier:nil]; + [firmware_pane_tab setLabel:localizedString(@"DS Firmware", nil)]; + [tab_view addTabViewItem:firmware_pane_tab]; + + //Create the "Plugins" pane + plugins_pane_tab = [[NSTabViewItem alloc] initWithIdentifier:nil]; + [plugins_pane_tab setLabel:localizedString(@"Plugins", nil)]; + [tab_view addTabViewItem:plugins_pane_tab]; + + //show the window + [[[NSWindowController alloc] initWithWindow:preferences_window] showWindow:nil]; + + + [NSApp runModalForWindow:preferences_window]; + + if(!was_paused)[NDS execute]; +} +@end diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/config.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/config.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/config.h 2006-04-13 19:32:35.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/config.h 2007-06-07 12:26:29.000000000 -0500 @@ -1,3 +1,22 @@ +/* Copyright (C) 2006 thoduv + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #ifndef __CONFIG_H__ #define __CONFIG_H__ diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/ctrlssdl.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/ctrlssdl.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/ctrlssdl.c 2007-01-22 01:46:40.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/ctrlssdl.c 2007-06-13 06:30:16.000000000 -0500 @@ -22,6 +22,8 @@ #include "ctrlssdl.h" +static SDL_Joystick **open_joysticks = NULL; + /* Keypad key names */ const char *key_names[NB_KEYS] = { @@ -68,15 +70,16 @@ }; /* Load default joystick and keyboard configurations */ -void load_default_config() +void load_default_config( void) { memcpy(keyboard_cfg, default_keyboard_cfg, sizeof(keyboard_cfg)); memcpy(joypad_cfg, default_joypad_cfg, sizeof(joypad_cfg)); } /* Initialize joysticks */ -BOOL init_joy(u16 joyCfg[]) { +BOOL init_joy( void) { int i; + BOOL joy_init_good = TRUE; set_joy_keys(default_joypad_cfg); @@ -90,21 +93,31 @@ nbr_joy = SDL_NumJoysticks(); printf("Nbr of joysticks: %d\n\n", nbr_joy); - for (i = 0; i < nbr_joy; i++) - { - SDL_Joystick * joy = SDL_JoystickOpen(i); - printf("Joystick %s\n", i, SDL_JoystickName(i)); - printf("Axes: %d\n", SDL_JoystickNumAxes(joy)); - printf("Buttons: %d\n", SDL_JoystickNumButtons(joy)); - printf("Trackballs: %d\n", SDL_JoystickNumBalls(joy)); - printf("Hats: %d\n\n", SDL_JoystickNumHats(joy)); + if ( nbr_joy > 0) { + open_joysticks = + calloc( sizeof ( SDL_Joystick *), nbr_joy); + + if ( open_joysticks != NULL) { + for (i = 0; i < nbr_joy; i++) + { + SDL_Joystick * joy = SDL_JoystickOpen(i); + printf("Joystick %d %s\n", i, SDL_JoystickName(i)); + printf("Axes: %d\n", SDL_JoystickNumAxes(joy)); + printf("Buttons: %d\n", SDL_JoystickNumButtons(joy)); + printf("Trackballs: %d\n", SDL_JoystickNumBalls(joy)); + printf("Hats: %d\n\n", SDL_JoystickNumHats(joy)); + } + } + else { + joy_init_good = FALSE; } + } - return TRUE; + return joy_init_good; } /* Set all buttons at once */ -void set_joy_keys(u16 joyCfg[]) +void set_joy_keys(const u16 joyCfg[]) { memcpy(joypad_cfg, joyCfg, sizeof(joypad_cfg)); } @@ -116,16 +129,25 @@ } /* Unload joysticks */ -void uninit_joy() +void uninit_joy( void) { - /* FIXME: Should we Close all joysticks? - SDL_JoystickClose( ... ); - */ + int i; + printf("Disabling joystick support.\n"); + + if ( open_joysticks != NULL) { + for (i = 0; i < SDL_NumJoysticks(); i++) { + SDL_JoystickClose( open_joysticks[i]); + } + + free( open_joysticks); + } + + open_joysticks = NULL; SDL_QuitSubSystem(SDL_INIT_JOYSTICK); } /* Return keypad vector with given key set to 1 */ -u16 inline lookup_joy_key (u16 keyval) { +u16 lookup_joy_key (u16 keyval) { int i; u16 Key = 0; for(i = 0; i < NB_KEYS; i++) @@ -135,7 +157,7 @@ } /* Return keypad vector with given key set to 1 */ -u16 inline lookup_key (u16 keyval) { +u16 lookup_key (u16 keyval) { int i; u16 Key = 0; for(i = 0; i < NB_KEYS; i++) @@ -145,28 +167,16 @@ } /* Empty SDL Events' queue */ -void clear_events() +static void clear_events( void) { SDL_Event event; /* IMPORTANT: Reenable joystick events iif needed. */ if(SDL_JoystickEventState(SDL_QUERY) == SDL_IGNORE) SDL_JoystickEventState(SDL_ENABLE); -#ifndef GTK_UI - sdl_quit = FALSE; -#endif - /* There's an event waiting to be processed? */ while (SDL_PollEvent(&event)) { -#ifndef GTK_UI - switch (event.type) - { - case SDL_QUIT: - sdl_quit = TRUE; - break; - } -#endif // !GTK_UI } return; @@ -248,7 +258,20 @@ joypad_cfg[index_o] = joypad_cfg[index]; } -#ifndef GTK_UI +static signed long +screen_to_touch_range_x( signed long scr_x, float size_ratio) { + signed long touch_x = (signed long)((float)scr_x * size_ratio); + + return touch_x; +} + +static signed long +screen_to_touch_range_y( signed long scr_y, float size_ratio) { + signed long touch_y = (signed long)((float)scr_y * size_ratio); + + return touch_y; +} + /* Set mouse coordinates */ void set_mouse_coord(signed long x,signed long y) { @@ -257,121 +280,170 @@ mouse.x = x; mouse.y = y; } -#endif // !GTK_UI /* Update NDS keypad */ void update_keypad(u16 keys) { ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] = ~keys & 0x3FF; - ((u16 *)MMU.ARM7_REG)[0x130>>1] = ~(keys >> 10) & 0x3; + ((u16 *)MMU.ARM7_REG)[0x130>>1] = ~keys & 0x3FF; /* Update X and Y buttons */ MMU.ARM7_REG[0x136] = ( ~( keys >> 10) & 0x3 ) | (MMU.ARM7_REG[0x136] & ~0x3); } /* Retrieve current NDS keypad */ -u16 get_keypad() +u16 get_keypad( void) { u16 keypad; - keypad = ~((u16 *)MMU.ARM7_REG)[0x130>>1]; + keypad = ~MMU.ARM7_REG[0x136]; keypad = (keypad & 0x3) << 10; keypad |= ~((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] & 0x3FF; return keypad; } -/* Manage input events */ -u16 process_ctrls_events(u16 keypad) -{ +/* + * The internal joystick events processing function + */ +static int +do_process_joystick_events( u16 *keypad, SDL_Event *event) { + int processed = 1; u16 key; + + switch ( event->type) + { + /* Joystick axis motion + Note: button constants have a 1bit offset. */ + case SDL_JOYAXISMOTION: + key = lookup_joy_key( JOY_AXIS_(event->jaxis.axis) ); + if( key == 0 ) break; /* Not an axis of interest? */ + + /* Axis is back to initial position */ + if( event->jaxis.value == 0 ) + RM_KEY( *keypad, key | get_joy_axis_twin(key) ); + /* Key should have been down but its currently set to up? */ + else if( (event->jaxis.value > 0) && + (key == KEYMASK_( KEY_UP-1 )) ) + key = KEYMASK_( KEY_DOWN-1 ); + /* Key should have been left but its currently set to right? */ + else if( (event->jaxis.value < 0) && + (key == KEYMASK_( KEY_RIGHT-1 )) ) + key = KEYMASK_( KEY_LEFT-1 ); + + /* Remove some sensitivity before checking if different than zero... + Fixes some badly behaving joypads [like one of mine]. */ + if( (event->jaxis.value >> 5) != 0 ) + ADD_KEY( *keypad, key ); + break; + + /* Joystick button pressed */ + /* FIXME: Add support for BOOST */ + case SDL_JOYBUTTONDOWN: + key = lookup_joy_key( event->jbutton.button ); + ADD_KEY( *keypad, key ); + break; + + /* Joystick button released */ + case SDL_JOYBUTTONUP: + key = lookup_joy_key(event->jbutton.button); + RM_KEY( *keypad, key ); + break; + + default: + processed = 0; + break; + } + + return processed; +} + +/* + * Process only the joystick events + */ +void +process_joystick_events( u16 *keypad) { SDL_Event event; /* IMPORTANT: Reenable joystick events iif needed. */ if(SDL_JoystickEventState(SDL_QUERY) == SDL_IGNORE) SDL_JoystickEventState(SDL_ENABLE); -#ifndef GTK_UI - sdl_quit = FALSE; -#endif - /* There's an event waiting to be processed? */ while (SDL_PollEvent(&event)) { - switch (event.type) - { - /* Joystick axis motion - Note: button constants have a 1bit offset. */ - case SDL_JOYAXISMOTION: - key = lookup_joy_key( JOY_AXIS_(event.jaxis.axis) ); - if( key == 0 ) break; /* Not an axis of interest? */ - - /* Axis is back to initial position */ - if( event.jaxis.value == 0 ) - RM_KEY( keypad, key | get_joy_axis_twin(key) ); - /* Key should have been down but its currently set to up? */ - else if( (event.jaxis.value > 0) && - (key == KEYMASK_( KEY_UP-1 )) ) - key = KEYMASK_( KEY_DOWN-1 ); - /* Key should have been left but its currently set to right? */ - else if( (event.jaxis.value < 0) && - (key == KEYMASK_( KEY_RIGHT-1 )) ) - key = KEYMASK_( KEY_LEFT-1 ); - - /* Remove some sensitivity before checking if different than zero... - Fixes some badly behaving joypads [like one of mine]. */ - if( (event.jaxis.value >> 5) != 0 ) - ADD_KEY( keypad, key ); - break; - - /* Joystick button pressed */ - /* FIXME: Add support for BOOST */ - case SDL_JOYBUTTONDOWN: - key = lookup_joy_key( event.jbutton.button ); - ADD_KEY( keypad, key ); - break; + do_process_joystick_events( keypad, &event); + } +} - /* Joystick button released */ - case SDL_JOYBUTTONUP: - key = lookup_joy_key(event.jbutton.button); - RM_KEY( keypad, key ); - break; +/* Manage input events */ +int +process_ctrls_events( u16 *keypad, + void (*external_videoResizeFn)( u16 width, u16 height), + float nds_screen_size_ratio) +{ + u16 key; + int cause_quit = 0; + SDL_Event event; - /* GTK only needs joystick support. For others, we here provide the - mouse, keyboard and quit events. */ -#ifndef GTK_UI - case SDL_KEYDOWN: - key = lookup_key(event.key.keysym.sym); - ADD_KEY( keypad, key ); - break; + /* IMPORTANT: Reenable joystick events iif needed. */ + if(SDL_JoystickEventState(SDL_QUERY) == SDL_IGNORE) + SDL_JoystickEventState(SDL_ENABLE); - case SDL_KEYUP: - key = lookup_key(event.key.keysym.sym); - RM_KEY( keypad, key ); - break; + /* There's an event waiting to be processed? */ + while (SDL_PollEvent(&event)) + { + if ( !do_process_joystick_events( keypad, &event)) { + switch (event.type) + { + case SDL_VIDEORESIZE: + if ( external_videoResizeFn != NULL) { + external_videoResizeFn( event.resize.w, event.resize.h); + } + break; - case SDL_MOUSEBUTTONDOWN: - if(event.button.button==1) - mouse.down = TRUE; + case SDL_KEYDOWN: + key = lookup_key(event.key.keysym.sym); + ADD_KEY( *keypad, key ); + break; + + case SDL_KEYUP: + key = lookup_key(event.key.keysym.sym); + RM_KEY( *keypad, key ); + break; + + case SDL_MOUSEBUTTONDOWN: + if(event.button.button==1) + mouse.down = TRUE; - case SDL_MOUSEMOTION: - if(!mouse.down) break; - if(event.button.y>=192) - set_mouse_coord(event.button.x, event.button.y - 192); - break; - - case SDL_MOUSEBUTTONUP: - if(mouse.down) mouse.click = TRUE; - mouse.down = FALSE; - break; + case SDL_MOUSEMOTION: + if(!mouse.down) + break; + else { + signed long scaled_x = + screen_to_touch_range_x( event.button.x, + nds_screen_size_ratio); + signed long scaled_y = + screen_to_touch_range_y( event.button.y, + nds_screen_size_ratio); - case SDL_QUIT: - sdl_quit = TRUE; - break; -#endif // !GTK_UI + if( scaled_y >= 192) + set_mouse_coord( scaled_x, scaled_y - 192); + } + break; - default: - break; + case SDL_MOUSEBUTTONUP: + if(mouse.down) mouse.click = TRUE; + mouse.down = FALSE; + break; + + case SDL_QUIT: + cause_quit = 1; + break; + + default: + break; + } } } - return keypad; + return cause_quit; } diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/ctrlssdl.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/ctrlssdl.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/ctrlssdl.h 2007-01-30 06:40:32.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/ctrlssdl.h 2007-05-23 11:35:54.000000000 -0500 @@ -34,8 +34,8 @@ #define ADD_KEY(keypad,key) ( (keypad) |= (key) ) #define RM_KEY(keypad,key) ( (keypad) &= ~(key) ) -#define KEYMASK_(k) (1 << k) -#define JOY_AXIS_(k) ((k+1) << 8) +#define KEYMASK_(k) (1 << (k)) +#define JOY_AXIS_(k) (((k)+1) << 8) #define NB_KEYS 14 #define KEY_NONE 0 @@ -74,22 +74,26 @@ struct mouse_status mouse; -BOOL sdl_quit; - void set_mouse_coord(signed long x,signed long y); #endif // !GTK_UI -void load_default_config(); -BOOL init_joy(); -void uninit_joy(); -void set_joy_keys(u16 joyCfg[]); +void load_default_config( void); +BOOL init_joy( void); +void uninit_joy( void); +void set_joy_keys(const u16 joyCfg[]); void set_kb_keys(u16 kbCfg[]); u16 get_set_joy_key(int index); void get_set_joy_axis(int index, int index_opp); void update_keypad(u16 keys); -u16 get_keypad(); -u16 inline lookup_key (u16 keyval); -u16 inline lookup_joy_key (u16 keyval); -u16 process_ctrls_events(u16 oldkeypad); +u16 get_keypad( void); +u16 lookup_key (u16 keyval); +u16 lookup_joy_key (u16 keyval); +int +process_ctrls_events( u16 *keypad, + void (*external_videoResizeFn)( u16 width, u16 height), + float nds_screen_size_ratio); + +void +process_joystick_events( u16 *keypad); #endif /* CTRLSSDL_H */ diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/debug.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/debug.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/debug.h 2006-05-14 01:14:48.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/debug.h 2007-06-07 12:26:29.000000000 -0500 @@ -1,3 +1,22 @@ +/* Copyright 2005-2006 Guillaume Duhamel + + This file is part of DeSmuME. + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #ifndef DEBUG_H #define DEBUG_H diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/desmume.mk /tmp/4ejbOOI7Zw/desmume-0.7.3/src/desmume.mk --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/desmume.mk 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/desmume.mk 2007-06-29 04:01:46.000000000 -0500 @@ -0,0 +1,3 @@ +AM_CFLAGS = +AM_CPPFLAGS = -I$(top_srcdir)/src +AM_LDFLAGS = \ No newline at end of file diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/Disassembler.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/Disassembler.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/Disassembler.c 2006-10-14 06:58:27.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/Disassembler.c 2007-05-01 08:53:07.000000000 -0500 @@ -3192,6 +3192,79 @@ return txt; } + +/* + * + * The Enhanced DSP Extension LDRD and STRD instructions. + * + */ +static char * +OP_LDRD_STRD_POST_INDEX(u32 adr, u32 i, char * txt) { + const char *direction = + BIT5(i) ? "STR" : "LDR"; + /* U bit - set = add, clear = sub */ + char sign = BIT23(i) ? '+' : '-'; + int txt_index = 0; + + txt_index += sprintf( &txt[txt_index], "%s%sD R%d, [R%d], ", + direction, Condition[CONDITION(i)], + (int)REG_POS(i, 12), + (int)REG_POS(i, 16)); + + /* I bit - set = immediate, clear = reg */ + if ( BIT22(i)) { + sprintf( &txt[txt_index], "#%c%d", + sign, (int)(((i>>4) & 0xF0) | (i&0xF)) ); + } + else { + sprintf( &txt[txt_index], "%cR%d", + sign, (int)REG_POS(i, 0)); + } + return txt; +} +static char * +OP_LDRD_STRD_OFFSET_PRE_INDEX(u32 adr, u32 i, char * txt) { + const char *direction = + BIT5(i) ? "STR" : "LDR"; + /* U bit - set = add, clear = sub */ + char sign = BIT23(i) ? '+' : '-'; + int txt_index = 0; + + txt_index += sprintf( &txt[txt_index], "%s%sD R%d, [R%d, ", + direction, Condition[CONDITION(i)], + (int)REG_POS(i, 12), + (int)REG_POS(i, 16)); + + /* I bit - set = immediate, clear = reg */ + if ( BIT22(i)) { + if ( BIT21(i)) { + /* pre-index */ + sprintf( &txt[txt_index], "#%c%d]!", + sign, (int)(((i>>4)&0xF0)|(i&0xF))); + } + else { + /* offset */ + sprintf( &txt[txt_index], "#%c%d]", + sign, (int)(((i>>4)&0xF0)|(i&0xF))); + } + } + else { + if ( BIT21(i)) { + /* pre-index */ + sprintf( &txt[txt_index], "%c%d]!", + sign, (int)REG_POS(i, 0)); + } + else { + /* offset */ + sprintf( &txt[txt_index], "%c%d]", + sign, (int)REG_POS(i, 0)); + } + } + + return txt; +} + + //----------------MCR----------------------- static char * OP_MCR(u32 adr, u32 i, char * txt) diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/dscard.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/dscard.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/dscard.h 2006-07-02 18:48:39.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/dscard.h 2007-06-07 12:26:29.000000000 -0500 @@ -1,4 +1,23 @@ -#ifndef __DSCARD_H__ +/* Copyright (C) 2006 thoduv + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef __DSCARD_H__ #define __DSCARD_H__ typedef struct diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/fat.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/fat.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/fat.h 2006-11-30 03:36:14.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/fat.h 2007-02-16 00:16:22.000000000 -0600 @@ -13,10 +13,14 @@ #define ATTRIB_LFN 0x0F #define FILE_FREE 0xE5 +/* Name and extension maximum length */ +#define NAME_LEN 8 +#define EXT_LEN 3 // Boot Sector - must be packed #ifdef _MSC_VER #pragma pack(push, 1) +#define DIR_SEP "\\" typedef struct { u8 jmpBoot[3]; @@ -54,8 +58,8 @@ #pragma pack(push, 1) typedef struct { - u8 name[8]; - u8 ext[3]; + u8 name[NAME_LEN]; + u8 ext[EXT_LEN]; u8 attrib; u8 reserved; u8 cTime_ms; @@ -70,6 +74,7 @@ } DIR_ENT; #pragma pack(pop) #else +#define DIR_SEP "/" typedef struct { u8 jmpBoot[3] __PACKED; @@ -105,8 +110,8 @@ // Directory entry - must be packed typedef struct { - u8 name[8] __PACKED; - u8 ext[3] __PACKED; + u8 name[NAME_LEN] __PACKED; + u8 ext[EXT_LEN] __PACKED; u8 attrib __PACKED; u8 reserved __PACKED; u8 cTime_ms __PACKED; diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/fs.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/fs.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/fs.h 2006-11-28 15:58:02.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/fs.h 2007-03-26 21:57:36.000000000 -0500 @@ -28,6 +28,7 @@ #define FS_IS_DIR 1 +#define FS_ERR_UNKNOWN -1 #define FS_ERR_NO_MORE_FILES 1 extern const char FS_SEPARATOR; @@ -36,6 +37,7 @@ char cFileName[256]; char cAlternateFileName[14]; u32 flags; + u32 fileSize; } FsEntry; void * FsReadFirst(const char * path, FsEntry * entry); diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/fs-linux.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/fs-linux.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/fs-linux.c 2006-11-28 15:58:02.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/fs-linux.c 2007-02-12 21:50:37.000000000 -0600 @@ -62,7 +62,10 @@ stat(buffer, &s); if (S_ISDIR(s.st_mode)) { entry->flags = FS_IS_DIR; - } + entry->fileSize = 0; + } else { + entry->fileSize = s.st_size; + } return dir; } @@ -87,6 +90,9 @@ stat(buffer, &s); if (S_ISDIR(s.st_mode)) { entry->flags = FS_IS_DIR; + entry->fileSize = 0; + } else { + entry->fileSize = s.st_size; } return 1; diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/fs-windows.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/fs-windows.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/fs-windows.c 2007-01-20 09:07:51.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/fs-windows.c 2007-03-26 21:57:36.000000000 -0500 @@ -46,7 +46,10 @@ entry->flags = 0; if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { entry->flags = FS_IS_DIR; - } + entry->fileSize = 0; + } else { + entry->fileSize = FindFileData.nFileSizeLow; + } ret = (void**)malloc(sizeof(HANDLE)); *ret = hFind; @@ -67,7 +70,10 @@ entry->flags = 0; if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { entry->flags = FS_IS_DIR; - } + entry->fileSize = 0; + } else { + entry->fileSize = FindFileData.nFileSizeLow; + } return ret; } @@ -79,4 +85,6 @@ int FsError(void) { if (GetLastError() == ERROR_NO_MORE_FILES) return FS_ERR_NO_MORE_FILES; + + return FS_ERR_UNKNOWN; } diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gdbstub/gdbstub.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gdbstub/gdbstub.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gdbstub/gdbstub.c 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gdbstub/gdbstub.c 2007-06-07 04:43:25.000000000 -0500 @@ -0,0 +1,1660 @@ +/* $Id: gdbstub.c,v 1.1 2007/06/07 09:43:25 masscat Exp $ + */ +/* + * THE SOFTWARE WITHIN THIS FILE IS NOT COPYRIGHTED + * + * Originally written by Ben Jaques. + * + * The software is offered for use in the public domain 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. + */ +#include +//#include +#include +#include + +#include + +#ifdef WIN32 +#include +#else +#include +#include +#include +#include +#include +#endif + +#include "armcpu.h" + +#define uint32_t u32 +#define uint16_t u16 +#define uint8_t u8 + +#include "gdbstub.h" +#include "gdbstub_internal.h" + +#ifdef __GNUC__ +#define UNUSED_PARM( parm) parm __attribute__((unused)) +#else +#define UNUSED_PARM( parm) parm +#endif + +#if 0 +#define DEBUG_LOG( fmt, ...) fprintf(stdout, fmt, ##__VA_ARGS__) +#else +#define DEBUG_LOG( fmt, ...) +#endif + +#if 0 +#define LOG_ERROR( fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__) +#else +#define LOG_ERROR( fmt, ...) +#endif + +#define LITTLE_ENDIAN_TO_UINT32_T( v) (\ + ((v)[3] << 24) | \ + ((v)[2] << 16) | \ + ((v)[1] << 8) | \ + ((v)[0] << 0)) + +/* + * The state of the packet reader + */ +#define IDLE_READ_STATE 0 +#define MID_PACKET_READ_STATE 1 +#define FIRST_CHECKSUM_READ_STATE 2 +#define SECOND_CHECKSUM_READ_STATE 3 + +/* + * The gdb stub thread control message types. + */ +enum stub_message_type { + /** The quit message type */ + QUIT_STUB_MESSAGE = 0, + /** The emulated CPU has stopped */ + CPU_STOPPED_STUB_MESSAGE = 1 +}; + + +/* + * The GDB signal values + */ +enum target_signal + { + /* Used some places (e.g. stop_signal) to record the concept that + there is no signal. */ + TARGET_SIGNAL_0 = 0, + TARGET_SIGNAL_FIRST = 0, + TARGET_SIGNAL_HUP = 1, + TARGET_SIGNAL_INT = 2, + TARGET_SIGNAL_QUIT = 3, + TARGET_SIGNAL_ILL = 4, + TARGET_SIGNAL_TRAP = 5, + TARGET_SIGNAL_ABRT = 6, + TARGET_SIGNAL_EMT = 7, + TARGET_SIGNAL_FPE = 8, + TARGET_SIGNAL_KILL = 9, + TARGET_SIGNAL_BUS = 10, + TARGET_SIGNAL_SEGV = 11, + TARGET_SIGNAL_SYS = 12, + TARGET_SIGNAL_PIPE = 13, + TARGET_SIGNAL_ALRM = 14, + TARGET_SIGNAL_TERM = 15, + TARGET_SIGNAL_URG = 16, + TARGET_SIGNAL_STOP = 17, + TARGET_SIGNAL_TSTP = 18, + TARGET_SIGNAL_CONT = 19, + TARGET_SIGNAL_CHLD = 20, + TARGET_SIGNAL_TTIN = 21, + TARGET_SIGNAL_TTOU = 22, + TARGET_SIGNAL_IO = 23, + TARGET_SIGNAL_XCPU = 24, + TARGET_SIGNAL_XFSZ = 25, + TARGET_SIGNAL_VTALRM = 26, + TARGET_SIGNAL_PROF = 27, + TARGET_SIGNAL_WINCH = 28, + TARGET_SIGNAL_LOST = 29, + TARGET_SIGNAL_USR1 = 30, + TARGET_SIGNAL_USR2 = 31, + TARGET_SIGNAL_PWR = 32, + /* Similar to SIGIO. Perhaps they should have the same number. */ + TARGET_SIGNAL_POLL = 33, + TARGET_SIGNAL_WIND = 34, + TARGET_SIGNAL_PHONE = 35, + TARGET_SIGNAL_WAITING = 36, + TARGET_SIGNAL_LWP = 37, + TARGET_SIGNAL_DANGER = 38, + TARGET_SIGNAL_GRANT = 39, + TARGET_SIGNAL_RETRACT = 40, + TARGET_SIGNAL_MSG = 41, + TARGET_SIGNAL_SOUND = 42, + TARGET_SIGNAL_SAK = 43, + TARGET_SIGNAL_PRIO = 44, + }; + + + + + +static void +causeQuit_gdb( struct gdb_stub_state *stub) { + uint8_t command = QUIT_STUB_MESSAGE; + +#ifdef WIN32 + send( stub->ctl_pipe[1], &command, 1, 0); +#else + write( stub->ctl_pipe[1], &command, 1); +#endif +} + +static void +indicateCPUStop_gdb( struct gdb_stub_state *stub) { + uint8_t command = CPU_STOPPED_STUB_MESSAGE; + +#ifdef WIN32 + send( stub->ctl_pipe[1], &command, 1, 0); +#else + write( stub->ctl_pipe[1], &command, 1); +#endif +} + + + + +/* + * + * + * + */ +static void +break_execution( void *data, UNUSED_PARM(uint32_t addr), UNUSED_PARM(int thunmb)) { + struct gdb_stub_state *stub = (struct gdb_stub_state *)data; + + /* stall the processor */ + stub->cpu_ctrl->stall( stub->cpu_ctrl->data); + + /* remove the post execution function */ + stub->cpu_ctrl->remove_post_ex_fn( stub->cpu_ctrl->data); + + /* indicate the halt */ + stub->stop_type = STOP_HOST_BREAK; + indicateCPUStop_gdb( stub); +} + + +static void +step_instruction_watch( void *data, uint32_t addr, UNUSED_PARM(int thunmb)) { + struct gdb_stub_state *stub = (struct gdb_stub_state *)data; + + DEBUG_LOG("Step watch: waiting for %08x at %08x\n", stub->step_instr_address, + addr); + + if ( addr == stub->step_instr_address) { + DEBUG_LOG("Step hit -> %08x\n", stub->cpu_ctrl->read_reg( stub->cpu_ctrl->data, 15)); + /* stall the processor */ + stub->cpu_ctrl->stall( stub->cpu_ctrl->data); + + /* remove the post execution function */ + stub->cpu_ctrl->remove_post_ex_fn( stub->cpu_ctrl->data); + + /* indicate the halt */ + stub->stop_type = STOP_STEP_BREAK; + indicateCPUStop_gdb( stub); + } +} + + + + + +/************************************************************************/ +/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ +/* at least NUMREGBYTES*2 are needed for register packets */ +#define BUFMAX 2048 + + + +static const char hexchars[]="0123456789abcdef"; + +/* + * Convert ch from a hex digit to an int + */ +static int +hex (unsigned char ch) { + if (ch >= 'a' && ch <= 'f') + return ch-'a'+10; + if (ch >= '0' && ch <= '9') + return ch-'0'; + if (ch >= 'A' && ch <= 'F') + return ch-'A'+10; + return -1; +} + +static const unsigned char * +hex2mem ( const unsigned char *buf, uint8_t *mem, int count) { + int i; + unsigned char ch; + + for (i=0; i 0) + { + ch = memio->read8( memio->data, mem_addr++); + *buf++ = hexchars[ch >> 4]; + *buf++ = hexchars[ch & 0xf]; + } + + *buf = 0; + + return buf; +} + + + +static enum read_res_gdb +readPacket_gdb( SOCKET_TYPE sock, struct packet_reader_gdb *packet) { + uint8_t cur_byte; + enum read_res_gdb read_res = READ_NOT_FINISHED; + int sock_res; + + /* update the state */ + + while ( (sock_res = recv( sock, &cur_byte, 1, 0)) == 1) { + switch ( packet->state) { + case IDLE_READ_STATE: + /* wait for the '$' start of packet character + */ + if ( cur_byte == '$') { + //DEBUG_LOG( "Found packet\n"); + packet->state = MID_PACKET_READ_STATE; + packet->pos_index = 0; + packet->checksum = 0; + } + /* Is this the break command */ + else if ( cur_byte == 3) { + //DEBUG_LOG( "GDB has sent a break\n"); + packet->buffer[0] = cur_byte; + packet->buffer[1] = 0; + packet->pos_index = 1; + return READ_BREAK; + } + break; + + case MID_PACKET_READ_STATE: + if ( cur_byte == '#') { + //DEBUG_LOG( "\nAbout to get checksum\n"); + packet->buffer[packet->pos_index] = '\0'; + packet->state = FIRST_CHECKSUM_READ_STATE; + } + else if ( packet->pos_index >= BUFMAX - 1) { + //DEBUG_LOG( "read buffer exceeded\n"); + packet->state = IDLE_READ_STATE; + } + else { + //DEBUG_LOG( "%c", cur_byte); + packet->checksum = packet->checksum + cur_byte; + packet->buffer[packet->pos_index] = cur_byte; + packet->pos_index = packet->pos_index + 1; + } + break; + + case FIRST_CHECKSUM_READ_STATE: + packet->read_checksum = hex( cur_byte) << 4; + packet->state = SECOND_CHECKSUM_READ_STATE; + break; + + case SECOND_CHECKSUM_READ_STATE: { + packet->read_checksum += hex( cur_byte); + packet->state = IDLE_READ_STATE; + return READ_COMPLETE; + break; + } + } + } + + if ( sock_res == 0) { + read_res = READ_SOCKET_ERROR; + } + else if ( sock_res == -1) { + if ( errno != EAGAIN) { + read_res = READ_SOCKET_ERROR; + } + } + + return read_res; +} + + +struct hidden_debug_out_packet { + unsigned char *start_ptr; +}; +struct debug_out_packet { + unsigned char *const start_ptr; +}; + +static struct hidden_debug_out_packet the_out_packet; +static unsigned char hidden_buffer[BUFMAX]; + + +static struct debug_out_packet * +getOutPacket( void) { + the_out_packet.start_ptr = &hidden_buffer[1]; + return (struct debug_out_packet *)&the_out_packet; +} + +#define CHECKSUM_PART_SIZE 3 +/** + * send the packet in buffer. + */ +static int +putpacket ( SOCKET_TYPE sock, struct debug_out_packet *out_packet, uint32_t size) { + unsigned char checksum = 0; + uint32_t count; + unsigned char *ch_ptr = (unsigned char *)&out_packet->start_ptr[-1]; + uint8_t reply_ch; + + //DEBUG_LOG_START( "Putting packet size %d ", size); + /* add the '$' to the start of the packet */ + *ch_ptr++ = '$'; + + /* calculate and add the checksum to the packet */ + for ( count = 0; count < size; count += 1) { + checksum += ch_ptr[count]; + //DEBUG_LOG_PART("%c", ch_ptr[count]); + } + //DEBUG_LOG_PART("\n"); + + ch_ptr[count++] = '#'; + ch_ptr[count++] = hexchars[checksum >> 4]; + ch_ptr[count++] = hexchars[checksum & 0xf]; + ch_ptr[count] = '\0'; + //DEBUG_LOG("packet %s\n", &out_packet->start_ptr[-1]); + + /* add one for the '$' character */ + count += 1; + + do { + int reply_found = 0; + + send( sock, &out_packet->start_ptr[-1], count, 0); + + do { + int read_res = recv( sock, &reply_ch, 1, 0); + + if ( read_res == 0) { + return -1; + } + else if ( read_res == -1) { + if ( errno != EAGAIN) { + return -1; + } + } + else { + reply_found = 1; + } + } while ( !reply_found); + } while ( reply_ch != '+'); + + /* $#. */ + return count - 4; +} + + + +static uint32_t +make_stop_packet( uint8_t *ptr, enum stop_type type, uint32_t stop_address) { + uint32_t stop_size = 0; + int watch_index = 0; + const char watch_chars[] = { 'a', 'r' }; + + switch (type) { + case STOP_UNKNOWN: + case STOP_HOST_BREAK: + ptr[0] = 'S'; + ptr[1] = hexchars[TARGET_SIGNAL_INT >> 4]; + ptr[2] = hexchars[TARGET_SIGNAL_INT & 0xf]; + stop_size = 3; + break; + + case STOP_STEP_BREAK: + case STOP_BREAKPOINT: + ptr[0] = 'S'; + ptr[1] = hexchars[TARGET_SIGNAL_TRAP >> 4]; + ptr[2] = hexchars[TARGET_SIGNAL_TRAP & 0xf]; + stop_size = 3; + break; + + case STOP_WATCHPOINT: + watch_index = 1; + case STOP_RWATCHPOINT: + watch_index += 1; + case STOP_AWATCHPOINT: + { + int i; + int out_index = 0; + ptr[out_index++] = 'T'; + ptr[out_index++] = hexchars[TARGET_SIGNAL_ABRT >> 4]; + ptr[out_index++] = hexchars[TARGET_SIGNAL_ABRT & 0xf]; + + if ( watch_index < 2) { + ptr[out_index++] = watch_chars[watch_index]; + } + ptr[out_index++] = 'w'; + ptr[out_index++] = 'a'; + ptr[out_index++] = 't'; + ptr[out_index++] = 'c'; + ptr[out_index++] = 'h'; + ptr[out_index++] = ':'; + + for ( i = 0; i < 8; i++) { + ptr[out_index++] = hexchars[(stop_address >> (i * 4)) & 0xf]; + } + ptr[out_index++] = ';'; + + stop_size = out_index; + } + break; + } + + return stop_size; +} + +/** + * Returns -1 if there is a socket error. + */ +static int +processPacket_gdb( SOCKET_TYPE sock, const uint8_t *packet, + struct gdb_stub_state *stub) { + // uint8_t remcomOutBuffer[BUFMAX_GDB]; + struct debug_out_packet *out_packet = getOutPacket(); + uint8_t *out_ptr = out_packet->start_ptr; + int send_reply = 1; + uint32_t send_size = 0; + + DEBUG_LOG("Processing packet %c\n", packet[0]); + + switch( packet[0]) { + case 3: + /* The break command */ + //stub->running_state = gdb_stub_state::STOPPED_GDB_STATE; + //*ptr++ = 'S'; + //*ptr++ = hexchars[0x2 >> 4]; + //*ptr++ = hexchars[0x2 & 0xf]; + //*ptr++ = 0; + send_reply = 0; + break; + + case '?': + send_size = make_stop_packet( out_ptr, stub->stop_type, stub->stop_address); + /**ptr++ = 'S'; + *ptr++ = hexchars[stub->stop_reason >> 4]; + *ptr++ = hexchars[stub->stop_reason & 0xf]; + send_size = 3;*/ + break; + + case 'c': + stub->emu_stub_state = RUNNING_EMU_GDB_STATE; + stub->ctl_stub_state = START_RUN_GDB_STATE; + stub->main_stop_flag = 0; + send_reply = 0; + /* remove the cpu stall */ + stub->cpu_ctrl->unstall( stub->cpu_ctrl->data); + break; + + case 's': { + uint32_t instr_addr = stub->cpu_ctrl->read_reg( stub->cpu_ctrl->data, 15); + /* Determine where the next instruction will take the CPU. + * Execute the instruction using a copy of the CPU with a zero memory interface. + */ + DEBUG_LOG( "Stepping instruction at %08x\n", instr_addr); + + /* install the post execution function */ + stub->step_instr_address = instr_addr; + stub->cpu_ctrl->install_post_ex_fn( stub->cpu_ctrl->data, + step_instruction_watch, + stub); + + + stub->emu_stub_state = RUNNING_EMU_GDB_STATE; + stub->ctl_stub_state = START_RUN_GDB_STATE; + stub->main_stop_flag = 0; + send_reply = 0; + + /* remove the cpu stall */ + stub->cpu_ctrl->unstall( stub->cpu_ctrl->data); + break; + } + + /* + * Register set + */ + case 'P': { + uint32_t reg; + uint32_t value; + const uint8_t *rx_ptr = &packet[1]; + + DEBUG_LOG("Processing packet %s\n", packet); + if ( hexToInt( &rx_ptr, ®)) { + if ( *rx_ptr++ == '=') { + uint8_t tmp_mem[4]; + + rx_ptr = hex2mem( rx_ptr, tmp_mem, 4); + value = LITTLE_ENDIAN_TO_UINT32_T( tmp_mem); + DEBUG_LOG("Setting reg %d to %08x\n", reg, value); + if ( reg < 16) + stub->cpu_ctrl->set_reg( stub->cpu_ctrl->data, reg, value); + if ( reg == 25) { + stub->cpu_ctrl->set_reg( stub->cpu_ctrl->data, 16, value); + } + + strcpy( (char *)out_ptr, "OK"); + send_size = 2; + } + } + break; + } + + case 'm': { + uint32_t addr = 0; + uint32_t length = 0; + int error01 = 1; + const uint8_t *rx_ptr = &packet[1]; + + if ( hexToInt( &rx_ptr, &addr)) { + if ( *rx_ptr++ == ',') { + if ( hexToInt( &rx_ptr, &length)) { + //DEBUG_LOG("mem read from %08x (%d)\n", addr, length); + if ( !mem2hex( stub->direct_memio, addr, out_ptr, length)) { + strcpy ( (char *)out_ptr, "E03"); + send_size = 3; + } + else { + send_size = length * 2; + } + error01 = 0; + } + } + } + if ( error01) + strcpy( (char *)out_ptr,"E01"); + break; + } + + /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ + case 'M': { + /* Try to read '%x,%x:'. */ + const uint8_t *rx_ptr = &packet[1]; + uint32_t addr = 0; + uint32_t length = 0; + int error01 = 1; + DEBUG_LOG("Memory write %s\n", rx_ptr); + if ( hexToInt(&rx_ptr, &addr)) { + if ( *rx_ptr++ == ',') { + if ( hexToInt(&rx_ptr, &length)) { + if ( *rx_ptr++ == ':') { + uint8_t write_byte; + int i; + DEBUG_LOG("Memory write of %d bytes to %08x\n", + length, addr); + + for ( i = 0; i < length; i++) { + rx_ptr = hex2mem( rx_ptr, &write_byte, 1); + + stub->direct_memio->write8( stub->direct_memio->data, + addr++, write_byte); + } + + strcpy( (char *)out_ptr, "OK"); + error01 = 0; + } + } + else { + DEBUG_LOG("Failed to find length (addr %08x)\n", addr); + } + } + else { + DEBUG_LOG("expected ',' got '%c' (addr = %08x)\n", *rx_ptr, addr); + } + } + else { + DEBUG_LOG("Failed to find addr\n"); + } + + if ( error01) { + strcpy( (char *)out_ptr, "E02"); + } + break; + } + + case 'Z': + case 'z': { + const uint8_t *rx_ptr = &packet[2]; + int remove_flag = 0; + + if ( packet[0] == 'z') + remove_flag = 1; + + DEBUG_LOG( "%c%c packet %s (remove? %d)\n", packet[0], packet[1], + rx_ptr, remove_flag); + + switch ( packet[1]) { + + /* all instruction breakpoints are treated the same */ + case '0': + case '1': + case '2': + case '3': + case '4': + { + uint32_t addr = 0; + uint32_t length = 0; + int error01 = 1; + struct breakpoint_gdb **bpoint_list; + + switch ( packet[1]) { + case '0': + case '1': + bpoint_list = &stub->instr_breakpoints; + break; + + case '2': + bpoint_list = &stub->write_breakpoints; + break; + + case '3': + bpoint_list = &stub->read_breakpoints; + break; + + case '4': + bpoint_list = &stub->access_breakpoints; + break; + } + + if ( *rx_ptr++ == ',') { + DEBUG_LOG("%s\n", rx_ptr); + + if ( hexToInt( &rx_ptr, &addr)) { + if ( *rx_ptr++ == ',') { + DEBUG_LOG("addr %08x %s\n", addr, rx_ptr); + + if ( hexToInt( &rx_ptr, &length)) { + if ( remove_flag) { + int removed = 0; + struct breakpoint_gdb *last_bpoint = NULL; + struct breakpoint_gdb *bpoint = *bpoint_list; + + while ( bpoint != NULL && !removed) { + if ( bpoint->addr == addr) { + DEBUG_LOG("Breakpoint(%c) at %08x removed\n", packet[1], addr); + removed = 1; + + if ( last_bpoint == NULL) { + *bpoint_list = bpoint->next; + } + else { + last_bpoint->next = bpoint->next; + } + bpoint->next = stub->free_breakpoints; + stub->free_breakpoints = bpoint; + } + last_bpoint = bpoint; + bpoint = bpoint->next; + } + + strcpy( (char *)out_ptr, "OK"); + send_size = 2; + error01 = 0; + } + else { + /* get a breakpoint descriptor from the free pool and add it to + * the current stub instruction breakpoint list */ + struct breakpoint_gdb *bpoint = stub->free_breakpoints; + + if ( bpoint != NULL) { + DEBUG_LOG( "Breakpoint(%c) added at %08x length %d\n", + packet[1], addr, length); + stub->free_breakpoints = bpoint->next; + + bpoint->addr = addr; + bpoint->size = length; + + bpoint->next = *bpoint_list; + *bpoint_list = bpoint; + + strcpy( (char *)out_ptr, "OK"); + send_size = 2; + error01 = 0; + } + } + } + } + } + } + + if ( error01) { + strcpy( (char *)out_ptr, "E01"); + send_size = 3; + } + } + break; + + default: + break; + } + break; + } + + /* + * Set the register values + */ + case 'G': + { + int i; + const uint8_t *rx_ptr = &packet[1]; + uint32_t reg_values[16]; + uint32_t cpsr; + uint8_t tmp_mem[4]; + DEBUG_LOG("'G' command %s\n", rx_ptr); + + /* general purpose regs 0 to 15 */ + for ( i = 0; i < 16; i++) { + rx_ptr = hex2mem( rx_ptr, tmp_mem, 4); + + reg_values[i] = LITTLE_ENDIAN_TO_UINT32_T( tmp_mem); + DEBUG_LOG("Setting reg %d to %08x\n", i, reg_values[i]); + } + + /* skip the floaing point registers and floating point status register */ + rx_ptr += 8 * (96 / 8 * 2); + rx_ptr += 8; + + /* the CPSR register is last */ + rx_ptr = hex2mem( rx_ptr, tmp_mem, 4); + cpsr = LITTLE_ENDIAN_TO_UINT32_T( tmp_mem); + DEBUG_LOG("Setting cpsr to %08x\n", cpsr); + + strcpy( (char *)out_ptr, "OK"); + send_size = 2; + break; + } + + case 'g': /* return the value of the CPU registers */ + { + int i; + int out_index = 0; + uint32_t pc_value = stub->cpu_ctrl->read_reg( stub->cpu_ctrl->data, 15); + uint32_t cpsr_value = stub->cpu_ctrl->read_reg( stub->cpu_ctrl->data, 16); + + DEBUG_LOG("'g' command PC = %08x\n", pc_value); + + /* general purpose regs 0 to 14 */ + for ( i = 0; i < 15; i++) { + uint32_t reg = stub->cpu_ctrl->read_reg( stub->cpu_ctrl->data, i); + out_ptr[out_index++] = hexchars[(reg >> 4) & 0xf]; + out_ptr[out_index++] = hexchars[(reg >> 0) & 0xf]; + out_ptr[out_index++] = hexchars[(reg >> 12) & 0xf]; + out_ptr[out_index++] = hexchars[(reg >> 8) & 0xf]; + out_ptr[out_index++] = hexchars[(reg >> 20) & 0xf]; + out_ptr[out_index++] = hexchars[(reg >> 16) & 0xf]; + out_ptr[out_index++] = hexchars[(reg >> 28) & 0xf]; + out_ptr[out_index++] = hexchars[(reg >> 24) & 0xf]; + } + + out_ptr[out_index++] = hexchars[(pc_value >> 4) & 0xf]; + out_ptr[out_index++] = hexchars[(pc_value >> 0) & 0xf]; + out_ptr[out_index++] = hexchars[(pc_value >> 12) & 0xf]; + out_ptr[out_index++] = hexchars[(pc_value >> 8) & 0xf]; + out_ptr[out_index++] = hexchars[(pc_value >> 20) & 0xf]; + out_ptr[out_index++] = hexchars[(pc_value >> 16) & 0xf]; + out_ptr[out_index++] = hexchars[(pc_value >> 28) & 0xf]; + out_ptr[out_index++] = hexchars[(pc_value >> 24) & 0xf]; + + /* floating point registers (8 96bit) */ + for ( i = 0; i < 8; i++) { + int j; + for ( j = 0; j < (96/4); j++) { + out_ptr[out_index++] = '0'; + } + } + + /* floating point status register? */ + for ( i = 0; i < 1; i++) { + int j; + for ( j = 0; j < 8; j++) { + out_ptr[out_index++] = '0'; + } + } + + /* The CPSR */ + for ( i = 0; i < 1; i++) { + out_ptr[out_index++] = hexchars[(cpsr_value >> 4) & 0xf]; + out_ptr[out_index++] = hexchars[(cpsr_value >> 0) & 0xf]; + out_ptr[out_index++] = hexchars[(cpsr_value >> 12) & 0xf]; + out_ptr[out_index++] = hexchars[(cpsr_value >> 8) & 0xf]; + out_ptr[out_index++] = hexchars[(cpsr_value >> 20) & 0xf]; + out_ptr[out_index++] = hexchars[(cpsr_value >> 16) & 0xf]; + out_ptr[out_index++] = hexchars[(cpsr_value >> 28) & 0xf]; + out_ptr[out_index++] = hexchars[(cpsr_value >> 24) & 0xf]; + } + send_size = out_index; + } + break; + } + + if ( send_reply) { + return putpacket( sock, out_packet, send_size); + } + + return 0; +} + + + +/** + * create the listening socket + */ +static SOCKET_TYPE +createSocket ( int port) { + SOCKET_TYPE sock; + struct sockaddr_in bind_addr; + + memset (&bind_addr, 0, sizeof (bind_addr)); + bind_addr.sin_family = AF_INET; + bind_addr.sin_port = htons( port); + bind_addr.sin_addr.s_addr = htonl (INADDR_ANY); + + /* create the socket, bind the address */ + + sock = socket (PF_INET, SOCK_STREAM, 0); + +#ifdef WIN32 + if ( sock != INVALID_SOCKET) +#else + if (sock != -1) +#endif + { + if (bind (sock, (struct sockaddr *) &bind_addr, + sizeof (bind_addr)) == -1) { + LOG_ERROR("Bind failed \"%s\" port %d\n", strerror( errno), port); +#ifdef WIN32 + closesocket( sock); +#else + close (sock); +#endif + sock = -1; + } + else if (listen (sock, 5) == -1) { + LOG_ERROR("Listen failed \"%s\"\n", strerror( errno)); +#ifdef WIN32 + closesocket( sock); +#else + close (sock); +#endif + sock = -1; + } + } + else { +#ifdef WIN32 + char message[30]; + int error = WSAGetLastError(); + sprintf( message, "Error creating socket %d\n", error); + LOG_ERROR("Error creating socket %d\n", error); +#endif + } + + return sock; +} + + + + +/* + * Handle GDB stub connections. + */ + + +/** + */ +INLINE static int +check_breaks_gdb( struct gdb_stub_state *gdb_state, + struct breakpoint_gdb *bpoint_list, + uint32_t addr, + UNUSED_PARM(uint32_t size), + enum stop_type stop_type) { + int found_break = 0; + + if ( gdb_state->active) { + struct breakpoint_gdb *bpoint = bpoint_list; + + while ( bpoint != NULL && !found_break) { + if ( addr == bpoint->addr) { + DEBUG_LOG("Breakpoint hit at %08x\n", addr); + + /* stall the processor */ + gdb_state->cpu_ctrl->stall( gdb_state->cpu_ctrl->data); + + /* indicate the break to the GDB stub thread */ + gdb_state->stop_type = stop_type; + gdb_state->stop_address = addr; + indicateCPUStop_gdb( gdb_state); + } + bpoint = bpoint->next; + } + } + + return found_break; +} + +static int +execute_gdb( void *data, uint32_t instr_addr, int thumb) { + struct gdb_stub_state *gdb_state = (struct gdb_stub_state *)data; + int execute = 1; + + if ( gdb_state->active) { + if ( gdb_state->main_stop_flag) { + execute = 0; + } + else { + if ( gdb_state->ctl_stub_state == STOPPED_GDB_STATE || + gdb_state->emu_stub_state != RUNNING_EMU_GDB_STATE) { + execute = 0; + } + else { + /* see if there is a breakpoint at this instruction */ + if ( gdb_state->instr_breakpoints != NULL) { + if ( gdb_state->ctl_stub_state != STEPPING_GDB_STATE && + gdb_state->ctl_stub_state != START_RUN_GDB_STATE) { + struct breakpoint_gdb *bpoint = gdb_state->instr_breakpoints; + + while ( bpoint != NULL && execute) { + if ( bpoint->addr == instr_addr) { + DEBUG_LOG("Breakpoint hit at %08x\n", instr_addr); + gdb_state->emu_stub_state = STOPPING_EMU_GDB_STATE; + gdb_state->stop_type = STOP_BREAKPOINT; + execute = 0; + } + bpoint = bpoint->next; + } + } + } + + if ( execute && gdb_state->ctl_stub_state == START_RUN_GDB_STATE) { + gdb_state->ctl_stub_state = RUNNING_GDB_STATE; + } + } + } + } + + return execute; +} + +static void +listenerThread_gdb( void *data) { + struct gdb_stub_state *state = (struct gdb_stub_state *)data; + fd_set read_sock_set; + fd_set main_set; + int quit = 0; + + FD_ZERO( &main_set); + + FD_SET( state->listen_fd, &main_set); + FD_SET( state->ctl_pipe[0], &main_set); + + while (!quit) { + int sel_res; + + read_sock_set = main_set; + + //DEBUG_LOG("Waiting on sockets\n"); + + sel_res = select( FD_SETSIZE, &read_sock_set, NULL, NULL, NULL); + //DEBUG_LOG("sockets ready %d\n", sel_res); + + if ( sel_res > 0) { + + /* Is this a control message */ + if ( FD_ISSET( state->ctl_pipe[0], &read_sock_set)) { + uint8_t ctl_command; + + //DEBUG_LOG("Control message\n"); +#ifdef WIN32 + recv( state->ctl_pipe[0], &ctl_command, 1, 0); +#else + read( state->ctl_pipe[0], &ctl_command, 1); +#endif + + switch ( ctl_command) { + + case CPU_STOPPED_STUB_MESSAGE: + if ( state->active && + state->ctl_stub_state != STOPPED_GDB_STATE) { + struct debug_out_packet *out_packet = getOutPacket(); + uint8_t *ptr = out_packet->start_ptr; + uint32_t send_size; + + /* mark the stub as stopped and send the stop packet */ + state->ctl_stub_state = STOPPED_GDB_STATE; + state->main_stop_flag = 1; + + send_size = make_stop_packet( ptr, state->stop_type, state->stop_address); + + /*ptr[0] = 'S'; + ptr[1] = hexchars[state->stop_reason >> 4]; + ptr[2] = hexchars[state->stop_reason & 0xf];*/ + + putpacket( state->sock_fd, out_packet, send_size); + DEBUG_LOG( "\nBreak from Emulation\n"); + } + else { + LOG_ERROR( "Asked to stop and already stopped\n"); + } + break; + + default: + /* quit out */ + quit = 1; + break; + } + } + + else { + //struct armcpu_t *cpu = twin_states->cpus[i]; + SOCKET_TYPE arm_listener = state->listen_fd; + + /* check for a connection request */ + if ( FD_ISSET( arm_listener, &read_sock_set)) { + SOCKET_TYPE new_conn; + struct sockaddr_in gdb_addr; +#ifdef WIN32 + int addr_size = sizeof( gdb_addr); +#else + socklen_t addr_size = sizeof( gdb_addr); +#endif + + //DEBUG_LOG("listener\n"); + + /* accept the connection if we do not already have one */ + new_conn = accept( arm_listener, (struct sockaddr *)&gdb_addr, + &addr_size); + + if ( new_conn != -1) { + int close_sock = 1; + + //DEBUG_LOG("got new socket\n"); + if ( state->sock_fd == -1 && state->active) { +#ifdef WIN32 + BOOL nodelay_opt = 1; +#else + int nodelay_opt = 1; +#endif + int set_res; + + //DEBUG_LOG("new connection\n"); + + close_sock = 0; + /* make the socket NODELAY */ +#ifdef WIN32 + set_res = setsockopt( new_conn, IPPROTO_TCP, TCP_NODELAY, + (char*)&nodelay_opt, sizeof( nodelay_opt)); +#else + set_res = setsockopt( new_conn, IPPROTO_TCP, TCP_NODELAY, + &nodelay_opt, sizeof( nodelay_opt)); +#endif + + if ( set_res != 0) { + LOG_ERROR( "Failed to set NODELAY socket option \"%s\"\n", strerror( errno)); + } + + FD_SET( new_conn, &main_set); + state->sock_fd = new_conn; + } + + if ( close_sock) { + //DEBUG_LOG("closing new socket\n"); +#ifdef WIN32 + closesocket( new_conn); +#else + close( new_conn); +#endif + } + } + } + + /* handle the gdb connection */ + if ( state->sock_fd != -1 && state->active) { + SOCKET_TYPE gdb_sock = state->sock_fd; + if ( FD_ISSET( gdb_sock, &read_sock_set)) { + enum read_res_gdb read_res = readPacket_gdb( gdb_sock, &state->rx_packet); + + //DEBUG_LOG("socket read %d\n", read_res); + + switch ( read_res) { + case READ_NOT_FINISHED: + /* do nothing here */ + break; + + case READ_SOCKET_ERROR: + /* close the socket */ +#ifdef WIN32 + closesocket( gdb_sock); +#else + close( gdb_sock); +#endif + state->sock_fd = -1; + FD_CLR( gdb_sock, &main_set); + break; + + case READ_BREAK: { + /* break the running of the cpu */ + if ( state->ctl_stub_state != STOPPED_GDB_STATE) { + /* this will cause the emulation to break the execution */ + DEBUG_LOG( "Breaking execution\n"); + + /* install the post execution function */ + state->cpu_ctrl->install_post_ex_fn( state->cpu_ctrl->data, + break_execution, + state); + } + break; + } + + case READ_COMPLETE: { + uint8_t reply; + int write_res; + int process_packet = 0; + int close_socket = 0; + struct packet_reader_gdb *packet = &state->rx_packet; + + if ( state->ctl_stub_state != STOPPED_GDB_STATE) { + /* not ready to process packet yet, send a bad reply */ + reply = '-'; + } + else { + /* send a reply based on the checksum and if okay process the packet */ + if ( packet->read_checksum == packet->checksum) { + reply = '+'; + process_packet = 1; + } + else { + reply = '-'; + } + } + + write_res = send( gdb_sock, &reply, 1, 0); + + if ( write_res != 1) { + close_socket = 1; + } + else { + if ( processPacket_gdb( gdb_sock, state->rx_packet.buffer, + state) == -1) { + close_socket = 1; + } + } + + if ( close_socket) { +#ifdef WIN32 + closesocket( gdb_sock); +#else + close( gdb_sock); +#endif + state->sock_fd = -1; + FD_CLR( gdb_sock, &main_set); + } + break; + } + } + } + } + } + } + } + + + /* tidy up and leave */ + if ( state->sock_fd != -1) { +#ifdef WIN32 + closesocket( state->sock_fd); +#else + close( state->sock_fd); +#endif + } + + /* close the listenering sockets */ +#ifdef WIN32 + closesocket( state->listen_fd); +#else + close( state->listen_fd); +#endif + + return; +} + + + + +/* + * + * The memory interface + * + */ +static uint32_t FASTCALL +gdb_prefetch32( void *data, uint32_t adr) { + struct gdb_stub_state *stub = (struct gdb_stub_state *)data; + uint32_t value = 0; + int breakpoint; + + breakpoint = check_breaks_gdb( stub, stub->instr_breakpoints, adr, 4, + STOP_BREAKPOINT); + + if ( !breakpoint) { + /* pass down to the real memory interace */ + value = stub->real_cpu_memio->prefetch32( stub->real_cpu_memio->data, + adr); + } + + return value; +} +static uint16_t FASTCALL +gdb_prefetch16( void *data, uint32_t adr) { + struct gdb_stub_state *stub = (struct gdb_stub_state *)data; + uint16_t value = 0; + int breakpoint; + + breakpoint = check_breaks_gdb( stub, stub->instr_breakpoints, adr, 2, + STOP_BREAKPOINT); + + if ( !breakpoint) { + /* pass down to the real memory interace */ + value = stub->real_cpu_memio->prefetch16( stub->real_cpu_memio->data, + adr); + } + + return value; +} + +/** read 8 bit data value */ +static uint8_t FASTCALL +gdb_read8( void *data, uint32_t adr) { + struct gdb_stub_state *stub = (struct gdb_stub_state *)data; + uint8_t value = 0; + int breakpoint; + + /* pass down to the real memory interace */ + value = stub->real_cpu_memio->read8( stub->real_cpu_memio->data, + adr); + + breakpoint = check_breaks_gdb( stub, stub->read_breakpoints, adr, 1, + STOP_RWATCHPOINT); + if ( !breakpoint) + check_breaks_gdb( stub, stub->access_breakpoints, adr, 1, + STOP_AWATCHPOINT); + + return value; +} + +/** read 16 bit data value */ +static uint16_t FASTCALL +gdb_read16( void *data, uint32_t adr) { + struct gdb_stub_state *stub = (struct gdb_stub_state *)data; + uint16_t value; + int breakpoint; + + /* pass down to the real memory interace */ + value = stub->real_cpu_memio->read16( stub->real_cpu_memio->data, + adr); + + breakpoint = check_breaks_gdb( stub, stub->read_breakpoints, adr, 2, + STOP_RWATCHPOINT); + if ( !breakpoint) + check_breaks_gdb( stub, stub->access_breakpoints, adr, 2, + STOP_AWATCHPOINT); + + return value; +} +/** read 32 bit data value */ +static uint32_t FASTCALL +gdb_read32( void *data, uint32_t adr) { + struct gdb_stub_state *stub = (struct gdb_stub_state *)data; + uint32_t value; + int breakpoint; + + /* pass down to the real memory interace */ + value = stub->real_cpu_memio->read32( stub->real_cpu_memio->data, + adr); + + breakpoint = check_breaks_gdb( stub, stub->read_breakpoints, adr, 4, + STOP_RWATCHPOINT); + if ( !breakpoint) + check_breaks_gdb( stub, stub->access_breakpoints, adr, 4, + STOP_AWATCHPOINT); + + return value; +} + +/** write 8 bit data value */ +static void FASTCALL +gdb_write8( void *data, uint32_t adr, uint8_t val) { + struct gdb_stub_state *stub = (struct gdb_stub_state *)data; + int breakpoint; + + /* pass down to the real memory interace */ + stub->real_cpu_memio->write8( stub->real_cpu_memio->data, + adr, val); + + breakpoint = check_breaks_gdb( stub, stub->write_breakpoints, adr, 1, + STOP_WATCHPOINT); + if ( !breakpoint) + check_breaks_gdb( stub, stub->access_breakpoints, adr, 1, + STOP_AWATCHPOINT); +} + +/** write 16 bit data value */ +static void FASTCALL +gdb_write16( void *data, uint32_t adr, uint16_t val) { + struct gdb_stub_state *stub = (struct gdb_stub_state *)data; + int breakpoint; + + /* pass down to the real memory interace */ + stub->real_cpu_memio->write16( stub->real_cpu_memio->data, + adr, val); + + breakpoint = check_breaks_gdb( stub, stub->write_breakpoints, adr, 2, + STOP_WATCHPOINT); + if ( !breakpoint) + check_breaks_gdb( stub, stub->access_breakpoints, adr, 2, + STOP_AWATCHPOINT); +} + +/** write 32 bit data value */ +static void FASTCALL +gdb_write32( void *data, uint32_t adr, uint32_t val) { + struct gdb_stub_state *stub = (struct gdb_stub_state *)data; + int breakpoint; + + /* pass down to the real memory interace */ + stub->real_cpu_memio->write32( stub->real_cpu_memio->data, + adr, val); + + breakpoint = check_breaks_gdb( stub, stub->write_breakpoints, adr, 4, + STOP_WATCHPOINT); + if ( !breakpoint) + check_breaks_gdb( stub, stub->access_breakpoints, adr, 4, + STOP_AWATCHPOINT); +} + + + + + + + +#ifdef WIN32 +struct socket_creator_data { + SOCKET_TYPE *sock; + int port_num; +}; +/** + */ +static DWORD WINAPI +control_creator( LPVOID lpParameter) +{ + struct socket_creator_data *my_data = (struct socket_creator_data *)lpParameter; + + *my_data->sock = socket( PF_INET, SOCK_STREAM, 0); + + if ( *my_data->sock != INVALID_SOCKET) { + int connect_res; + struct sockaddr_in clientService; + + clientService.sin_family = AF_INET; + clientService.sin_addr.s_addr = inet_addr( "127.0.0.1" ); + clientService.sin_port = htons( my_data->port_num); + + connect_res = connect( *my_data->sock, (SOCKADDR*) &clientService, sizeof(clientService)); + + if ( connect_res == SOCKET_ERROR) { + LOG_ERROR( "Failed to connect to socket\n"); + } + } + + return 0; +} + +#endif + + + +/** + */ +gdbstub_handle_t +createStub_gdb( uint16_t port, + struct armcpu_memory_iface **cpu_memio, + struct armcpu_memory_iface *direct_memio) { + struct gdb_stub_state *stub = malloc( sizeof (struct gdb_stub_state)); + gdbstub_handle_t handle = NULL; + int i; + int res = 0; + + if ( stub == NULL) { + return NULL; + } + + stub->active = 0; + + /* keep the memory interfaces */ + stub->real_cpu_memio = *cpu_memio; + stub->direct_memio = direct_memio; + + *cpu_memio = &stub->cpu_memio; + + /* fill in the memory interface */ + stub->cpu_memio.data = stub; + stub->cpu_memio.prefetch32 = gdb_prefetch32; + stub->cpu_memio.prefetch16 = gdb_prefetch16; + + stub->cpu_memio.read8 = gdb_read8; + stub->cpu_memio.read16 = gdb_read16; + stub->cpu_memio.read32 = gdb_read32; + + stub->cpu_memio.write8 = gdb_write8; + stub->cpu_memio.write16 = gdb_write16; + stub->cpu_memio.write32 = gdb_write32; + + + + /* put the breakpoint descriptors onto the free list */ + for ( i = 0; i < BREAKPOINT_POOL_SIZE - 1; i++) { + stub->breakpoint_pool[i].next = &stub->breakpoint_pool[i+1]; + } + stub->breakpoint_pool[i].next = NULL; + stub->free_breakpoints = &stub->breakpoint_pool[0]; + stub->instr_breakpoints = NULL; + + stub->read_breakpoints = NULL; + stub->write_breakpoints = NULL; + stub->access_breakpoints = NULL; + +#ifdef WIN32 + /* initialise the winsock library */ + { + WORD wVersionRequested; + WSADATA wsaData; + int err; + + wVersionRequested = MAKEWORD( 2, 2 ); + + err = WSAStartup( wVersionRequested, &wsaData ); + if ( err != 0 ) { + return NULL; + } + } + + { + struct socket_creator_data temp_data = { + &stub->ctl_pipe[0], + 24689 + }; + SOCKET_TYPE temp_sock = createSocket ( temp_data.port_num); + HANDLE temp_thread = INVALID_HANDLE_VALUE; + DWORD temp_threadID; + + res = -1; + + if ( temp_sock != -1) { + /* create a thread to connect to this socket */ + temp_thread = CreateThread( NULL, 0, control_creator, &temp_data, 0, &temp_threadID); + if ( temp_thread != INVALID_HANDLE_VALUE) { + struct sockaddr_in ignore_addr; + int addr_size = sizeof( ignore_addr); + + stub->ctl_pipe[1] = accept( temp_sock, (struct sockaddr *)&ignore_addr, &addr_size); + + if ( stub->ctl_pipe[1] != INVALID_SOCKET) { + BOOL nodelay_opt = 1; + int set_res; + + /* make the socket NODELAY */ + set_res = setsockopt( stub->ctl_pipe[1], IPPROTO_TCP, TCP_NODELAY, + (char*)&nodelay_opt, sizeof( nodelay_opt)); + if ( set_res == 0) { + closesocket( temp_sock); + res = 0; + } + } + } + } + } + + if ( res != 0) { + LOG_ERROR( "Failed to create control socket\n"); + } +#else + /* create the control pipe */ + res = pipe( stub->ctl_pipe); + + if ( res != 0) { + LOG_ERROR( "Failed to create control pipe \"%s\"\n", strerror( errno)); + } +#endif + else { + stub->active = 1; + stub->emu_stub_state = RUNNING_EMU_GDB_STATE; + stub->ctl_stub_state = STOPPED_GDB_STATE; + stub->rx_packet.state = IDLE_READ_STATE; + + stub->main_stop_flag = 1; + + stub->port_num = port; + stub->sock_fd = -1; + stub->listen_fd = createSocket( port); + + stub->stop_type = STOP_UNKNOWN; + + if ( stub->listen_fd == -1) { + LOG_ERROR( "Failed to create listening socket \"%s\"\n", strerror( errno)); + res = -1; + } + } + + if ( res != -1) { + /* create the listenering thread */ + stub->thread = createThread_gdb( listenerThread_gdb, stub); + + if ( stub->thread == NULL) { + LOG_ERROR("Failed to create listener thread\n"); + free( stub); + } + else { + handle = stub; + + DEBUG_LOG("Created stub on port %d\n", port); + } + } + else { + free( stub); + } + + return handle; +} + + +void +destroyStub_gdb( gdbstub_handle_t instance) { + struct gdb_stub_state *stub = (struct gdb_stub_state *)instance; + int status; + + causeQuit_gdb( stub); + + joinThread_gdb( stub->thread); + + //stub->cpu_ctl->unstall( stub->cpu_ctl->data); + //stub->cpu_ctl->remove_post_ex_fn( stub->cpu_ctl->data); + + free( stub); +} + +void +activateStub_gdb( gdbstub_handle_t instance, + struct armcpu_ctrl_iface *cpu_ctrl) { + struct gdb_stub_state *stub = (struct gdb_stub_state *)instance; + + stub->cpu_ctrl = cpu_ctrl; + + /* stall the cpu */ + stub->cpu_ctrl->stall( stub->cpu_ctrl->data); + + stub->active = 1; +} diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gdbstub/gdbstub_internal.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gdbstub/gdbstub_internal.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gdbstub/gdbstub_internal.h 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gdbstub/gdbstub_internal.h 2007-06-07 04:43:25.000000000 -0500 @@ -0,0 +1,160 @@ +#ifndef _GDBSTUB_INTERNAL_H_ +#define _GDBSTUB_INTERNAL_H_ 1 +/* $Id: gdbstub_internal.h,v 1.1 2007/06/07 09:43:25 masscat Exp $ + */ +/* + * THE SOFTWARE WITHIN THIS FILE IS NOT COPYRIGHTED + * + * Originally written by Ben Jaques. + * + * The software is offered for use in the public domain 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. + */ + +#ifdef WIN32 +#define SOCKET_TYPE SOCKET +#else +#define SOCKET_TYPE int +#endif + + +enum stop_type { + STOP_UNKNOWN, + STOP_HOST_BREAK, + STOP_STEP_BREAK, + STOP_BREAKPOINT, + STOP_WATCHPOINT, + STOP_RWATCHPOINT, + STOP_AWATCHPOINT +}; + + +/** + * The structure describing a breakpoint. + */ +struct breakpoint_gdb { + /** link them in a list */ + struct breakpoint_gdb *next; + + /** The address of the breakpoint */ + uint32_t addr; + + /** The size of the breakpoint */ + uint32_t size; +}; + + +/* + */ +#define BUFMAX_GDB 2048 + +struct packet_reader_gdb { + int state; + + int pos_index; + + uint8_t checksum; + + uint8_t read_checksum; + + uint8_t buffer[BUFMAX_GDB]; +}; + +/** The maximum number of breakpoints (of all types) available to the stub */ +#define BREAKPOINT_POOL_SIZE 100 + + +struct gdb_stub_state { + /** flag indicating if the stub is active */ + int active; + + int main_stop_flag; + + /** the listener thread */ + void *thread; + + /** the id of the cpu the is under control */ + //u32 cpu_id; + + /** the interface used to control the CPU */ + struct armcpu_ctrl_iface *cpu_ctrl; + + /** the memory interface passed to the CPU */ + struct armcpu_memory_iface cpu_memio; + + /** the direct interface to the memory system */ + struct armcpu_memory_iface *direct_memio; + + /** the CPU memory interface to the real memory system */ + struct armcpu_memory_iface *real_cpu_memio; + + /** the list of active instruction breakpoints */ + struct breakpoint_gdb *instr_breakpoints; + + /** the list of active read breakpoints */ + struct breakpoint_gdb *read_breakpoints; + + /** the list of active write breakpoints */ + struct breakpoint_gdb *write_breakpoints; + + /** the list of active access breakpoints */ + struct breakpoint_gdb *access_breakpoints; + + /** the pointer to the step break point (not NULL if set) */ + //struct breakpoint_gdb *step_breakpoint; + + uint32_t step_instr_address; + + /** the state of the stub as seen by the emulator, the emulator side can + * set this to STOPPING_EMU_GDB_STATE to indicate that the a breakpoint has been hit, + * and STOPPED_EMU_GDB_STATE when it has informed the gdb thread that a breakpoint has + * been hit. + * When handled the stub side will set it back to RUNNING_EMU_GDB_STATE. + * + * The emulator should only run the corresponding ARM if this is set to + * RUNNING_EMU_GDB_STATE. + */ + enum { STOPPED_EMU_GDB_STATE, STOPPING_EMU_GDB_STATE, RUNNING_EMU_GDB_STATE} emu_stub_state; + + /** the state of the stub as set by the stub control thread */ + enum { STOPPED_GDB_STATE, RUNNING_GDB_STATE, + STEPPING_GDB_STATE, START_RUN_GDB_STATE} ctl_stub_state; + + struct packet_reader_gdb rx_packet; + + /** the socket information */ + uint16_t port_num; + SOCKET_TYPE sock_fd; + + /** The listening socket */ + SOCKET_TYPE listen_fd; + + /** the type of event that caused the stop */ + enum stop_type stop_type; + + /** the address of the stop */ + uint32_t stop_address; + + /** The step break point decsriptor */ + struct breakpoint_gdb step_breakpoint_descr; + + /** the breakpoint descriptor pool */ + struct breakpoint_gdb breakpoint_pool[BREAKPOINT_POOL_SIZE]; + + /** the free breakpoint descriptor list */ + struct breakpoint_gdb *free_breakpoints; + + /** the control pipe (or socket) to the gdb stub */ + SOCKET_TYPE ctl_pipe[2]; +}; + + +enum read_res_gdb { + READ_NOT_FINISHED, + READ_SOCKET_ERROR, + READ_COMPLETE, + READ_BREAK +}; + +#endif /* End of _GDBSTUB_INTERNAL_H_ */ diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gdbstub/Makefile.am /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gdbstub/Makefile.am --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gdbstub/Makefile.am 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gdbstub/Makefile.am 2007-06-29 04:01:45.000000000 -0500 @@ -0,0 +1,4 @@ +include $(top_srcdir)/src/desmume.mk + +noinst_LIBRARIES = libgdbstub.a +libgdbstub_a_SOURCES = gdbstub.c gdbstub_internal.h diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gdbstub/Makefile.in /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gdbstub/Makefile.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gdbstub/Makefile.in 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gdbstub/Makefile.in 2007-09-03 12:31:41.000000000 -0500 @@ -0,0 +1,467 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/src/desmume.mk +subdir = src/gdbstub +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libgdbstub_a_AR = $(AR) $(ARFLAGS) +libgdbstub_a_LIBADD = +am_libgdbstub_a_OBJECTS = gdbstub.$(OBJEXT) +libgdbstub_a_OBJECTS = $(am_libgdbstub_a_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libgdbstub_a_SOURCES) +DIST_SOURCES = $(libgdbstub_a_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLADEUI_UNINSTALLED_DIR = @GLADEUI_UNINSTALLED_DIR@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ +GTHREAD_LIBS = @GTHREAD_LIBS@ +GTKGLEXT_CFLAGS = @GTKGLEXT_CFLAGS@ +GTKGLEXT_LIBS = @GTKGLEXT_LIBS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_PKG = @HAVE_PKG@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ +INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ +INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ +INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ +INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ +INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ +INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ +INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ +INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ +INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ +INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ +INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ +INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ +INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ +INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ +LDFLAGS = @LDFLAGS@ +LIBGLADE_CFLAGS = @LIBGLADE_CFLAGS@ +LIBGLADE_LIBS = @LIBGLADE_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_DIR = @PO_DIR@ +PO_FILES = @PO_FILES@ +PO_FILES_IN = @PO_FILES_IN@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SDLCONFIG = @SDLCONFIG@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +UI_DIR = @UI_DIR@ +USE_MAINTAINER_MODE = @USE_MAINTAINER_MODE@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +desmume_arch = @desmume_arch@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CFLAGS = +AM_CPPFLAGS = -I$(top_srcdir)/src +AM_LDFLAGS = +noinst_LIBRARIES = libgdbstub.a +libgdbstub_a_SOURCES = gdbstub.c gdbstub_internal.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/src/desmume.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/gdbstub/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/gdbstub/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libgdbstub.a: $(libgdbstub_a_OBJECTS) $(libgdbstub_a_DEPENDENCIES) + -rm -f libgdbstub.a + $(libgdbstub_a_AR) libgdbstub.a $(libgdbstub_a_OBJECTS) $(libgdbstub_a_LIBADD) + $(RANLIB) libgdbstub.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdbstub.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gdbstub.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gdbstub.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gdbstub.h 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gdbstub.h 2007-06-07 04:43:25.000000000 -0500 @@ -0,0 +1,63 @@ +#ifndef _GDBSTUB_H_ +#define _GDBSTUB_H_ 1 +/* $Id: gdbstub.h,v 1.1 2007/06/07 09:43:25 masscat Exp $ + */ +/* Copyright (C) 2006 Ben Jaques + * masscat@btinternet.com + * + * This file is part of DeSmuME + * + * DeSmuME 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. + * + * DeSmuME 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 DeSmuME; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +typedef void *gdbstub_handle_t; + +/* + * The function interface + */ +#ifdef __cplusplus +extern "C" { +#endif + +gdbstub_handle_t +createStub_gdb( u16 port, + struct armcpu_memory_iface **cpu_memio, + struct armcpu_memory_iface *direct_memio); + +void +destroyStub_gdb( gdbstub_handle_t stub); + +void +activateStub_gdb( gdbstub_handle_t stub, + struct armcpu_ctrl_iface *cpu_ctrl); + + + /* + * An implementation of the following functions is required + * for the GDB stub to function. + */ +void * +createThread_gdb( void (*thread_function)( void *data), + void *thread_data); + +void +joinThread_gdb( void *thread_handle); + + +#ifdef __cplusplus +} +#endif + +#endif /* End of _GDBSTUB_H_ */ diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gl_vertex.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gl_vertex.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gl_vertex.c 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gl_vertex.c 2007-02-27 21:02:26.000000000 -0600 @@ -0,0 +1,411 @@ +/* gl_vertex.c - this file is part of DeSmuME + * + * Copyright (C) 2007 Damien Nozay (damdoum) + * Author: damdoum at users.sourceforge.net + * + * based on http://nocash.emubase.de/gbatek.htm + * + * This file 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, or (at your option) + * any later version. + * + * This file 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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "gl_vertex.h" + + + +/* + credits goes to : + http://nocash.emubase.de/gbatek.htm#ds3dvideo + + missing functions + +Geometry Commands (can be invoked by Port Address, or by Command ID) +Table shows Port Address, Command ID, Number of Parameters, and Clock Cycles. + + Address Cmd Pa.Cy. + N/A 00h - - NOP - No Operation (for padding packed GXFIFO commands) + + 4000444h 11h - 17 MTX_PUSH - Push Current Matrix on Stack (W) + 4000448h 12h 1 36 MTX_POP - Pop Current Matrix from Stack (W) + 400044Ch 13h 1 17 MTX_STORE - Store Current Matrix on Stack (W) + 4000450h 14h 1 36 MTX_RESTORE - Restore Current Matrix from Stack (W) + + 400046Ch 1Bh 3 22 MTX_SCALE - Multiply Current Matrix by Scale Matrix (W) + 4000470h 1Ch 3 22* MTX_TRANS - Mult. Curr. Matrix by Translation Matrix (W) + 4000480h 20h 1 1 COLOR - Directly Set Vertex Color (W) + 4000484h 21h 1 NORMAL - Set Normal Vector (W) + + 40004A4h 29h 1 1 POLYGON_ATTR - Set Polygon Attributes (W) + 40004A8h 2Ah 1 1 TEXIMAGE_PARAM - Set Texture Parameters (W) + 40004ACh 2Bh 1 1 PLTT_BASE - Set Texture Palette Base Address (W) + 40004C0h 30h 1 4 DIF_AMB - MaterialColor0 - Diffuse/Ambient Reflect. (W) + 40004C4h 31h 1 4 SPE_EMI - MaterialColor1 - Specular Ref. & Emission (W) + 40004C8h 32h 1 6 LIGHT_VECTOR - Set Light's Directional Vector (W) + 40004CCh 33h 1 1 LIGHT_COLOR - Set Light Color (W) + 40004D0h 34h 32 32 SHININESS - Specular Reflection Shininess Table (W) + 4000540h 50h 1 392 SWAP_BUFFERS - Swap Rendering Engine Buffer (W) + 4000580h 60h 1 1 VIEWPORT - Set Viewport (W) + 40005C0h 70h 3 103 BOX_TEST - Test if Cuboid Sits inside View Volume (W) + 40005C4h 71h 2 9 POS_TEST - Set Position Coordinates for Test (W) + 40005C8h 72h 1 5 VEC_TEST - Set Directional Vector for Test (W) + +*/ + +//#define print(a) printf a +#define print(a) + +BOOL attempted_3D_op=FALSE; + +int mtx_mode=0; + +void gl_MTX_MODE (u32 val) { +CHECK_3D_ATTEMPT + mtx_mode = val; + switch(val) { + case MTX_MODE_PROJECTION: + print(("MTX MODE PROJECTION\n")); + break; + case MTX_MODE_POSITION: + print(("MTX MODE POSITION\n")); + break; + case MTX_MODE_POS_VECTOR: + print(("MTX MODE POSITION & VECTOR\n")); + break; + case MTX_MODE_TEXTURE: + print(("MTX MODE TEXTURE\n")); + break; + } +} + + +/******************************************************************/ +// MTX_LOAD* - cmd 15h-1Ah +/******************************************************************/ +#define MMM 0 +#define M_0 0 +#define M_1 (1<<12) +static u32 mCurrent[16]= + {M_1, M_0, M_0, M_0, + M_0, M_1, M_0, M_0, + M_0, M_0, M_1, M_0, + M_0, M_0, M_0, M_1}; +static u32 mUnit[16]= + {M_1, M_0, M_0, M_0, + M_0, M_1, M_0, M_0, + M_0, M_0, M_1, M_0, + M_0, M_0, M_0, M_1}; +static u32 m4x4[16]= + {MMM, MMM, MMM, MMM, + MMM, MMM, MMM, MMM, + MMM, MMM, MMM, MMM, + MMM, MMM, MMM, MMM}; +static u32 m4x3[16]= + {MMM, MMM, MMM, M_0, + MMM, MMM, MMM, M_0, + MMM, MMM, MMM, M_0, + MMM, MMM, MMM, M_1}; +static u32 m3x3[16]= + {MMM, MMM, MMM, M_0, + MMM, MMM, MMM, M_0, + MMM, MMM, MMM, M_0, + M_0, M_0, M_0, M_1}; + +void gl_MTX_show(u32 * m32) { + float m[16]; + int i; + for (i=0;i<16;i++) + m[i]=u32_to_float(m32[i]); + print(("\t[[%+.5f %+.5f %+.5f %+.5f]\n", m[0] ,m[1] ,m[2] ,m[3])); + print(("\t [%+.5f %+.5f %+.5f %+.5f]\n", m[4] ,m[5] ,m[6] ,m[7])); + print(("\t [%+.5f %+.5f %+.5f %+.5f]\n", m[8] ,m[9] ,m[10],m[11])); + print(("\t [%+.5f %+.5f %+.5f %+.5f]]\n",m[12],m[13],m[14],m[15])); +} + +void gl_MTX_load(u32* m) { + int i; +CHECK_3D_ATTEMPT + for (i=0;i<16;i++) + mCurrent[i]=m[i]; + gl_MTX_show(mCurrent); +} +void gl_MTX_mult(u32* m) { + int i; +CHECK_3D_ATTEMPT + for (i=0;i<16;i++) + mCurrent[i] = (mCurrent[i]>>6)*(m[i]>>6); + gl_MTX_show(mCurrent); +} + +void gl_MTX_IDENTITY () { + print(("MTX_IDENTITY\n")); + gl_MTX_load(mUnit); +} + +void gl_MTX_LOAD_4x4 (u32 val) { + static int mtx_nbparams = 0; + switch(mtx_nbparams) { + case 0: case 1: case 2: case 3: + case 4: case 5: case 6: case 7: + case 8: case 9: case 10: case 11: + case 12: case 13: case 14: + m4x4[mtx_nbparams]=val; + mtx_nbparams++; + break; + case 15: + m4x4[mtx_nbparams]=val; + mtx_nbparams=0; + print(("MTX_LOAD_4x4\n")); + gl_MTX_load(m4x4); + break; + default: + break; + } +} +void gl_MTX_MULT_4x4 (u32 val) { + static int mtx_nbparams = 0; + switch(mtx_nbparams) { + case 0: case 1: case 2: case 3: + case 4: case 5: case 6: case 7: + case 8: case 9: case 10: case 11: + case 12: case 13: case 14: + m4x4[mtx_nbparams]=val; + mtx_nbparams++; + break; + case 15: + m4x4[mtx_nbparams]=val; + mtx_nbparams=0; + print(("MTX_MULT_4x4\n")); + gl_MTX_mult(m4x4); + break; + default: + break; + } +} + + +void gl_MTX_LOAD_4x3 (u32 val) { + static int mtx_nbparams = 0; + switch(mtx_nbparams) { + case 3: case 7: case 11: + mtx_nbparams++; + case 0: case 1: case 2: + case 4: case 5: case 6: + case 8: case 9: case 10: + case 12: case 13: + m4x3[mtx_nbparams]=val; + mtx_nbparams++; + break; + case 14: + m4x3[mtx_nbparams]=val; + mtx_nbparams=0; + print(("MTX_LOAD_4x3\n")); + gl_MTX_load(m4x3); + break; + default: + break; + } +} +void gl_MTX_MULT_4x3 (u32 val) { + static int mtx_nbparams = 0; + switch(mtx_nbparams) { + case 3: case 7: case 11: + mtx_nbparams++; + case 0: case 1: case 2: + case 4: case 5: case 6: + case 8: case 9: case 10: + case 12: case 13: + m4x3[mtx_nbparams]=val; + mtx_nbparams++; + break; + case 14: + m4x3[mtx_nbparams]=val; + mtx_nbparams=0; + print(("MTX_MULT_4x3\n")); + gl_MTX_mult(m4x3); + break; + default: + break; + } +} + +void gl_MTX_LOAD_3x3 (u32 val) { + static int mtx_nbparams = 0; + switch(mtx_nbparams) { + case 3: case 7: case 11: + mtx_nbparams++; + case 0: case 1: case 2: + case 4: case 5: case 6: + case 8: case 9: + m3x3[mtx_nbparams]=val; + mtx_nbparams++; + break; + case 10: + m3x3[mtx_nbparams]=val; + mtx_nbparams=0; + print(("MTX_LOAD_3x3\n")); + gl_MTX_load(m3x3); + break; + default: + break; + } +} +void gl_MTX_MULT_3x3 (u32 val) { + static int mtx_nbparams = 0; + switch(mtx_nbparams) { + case 3: case 7: case 11: + mtx_nbparams++; + case 0: case 1: case 2: + case 4: case 5: case 6: + case 8: case 9: + m3x3[mtx_nbparams]=val; + mtx_nbparams++; + break; + case 10: + m3x3[mtx_nbparams]=val; + mtx_nbparams=0; + print(("MTX_MULT_3x3\n")); + gl_MTX_mult(m3x3); + break; + default: + break; + } +} +/******************************************************************/ +// TEXCOORD - cmd 22h +/******************************************************************/ + +void gl_TEXCOORD(u32 val) { + _TEXCOORD tx; + float s,t; +CHECK_3D_ATTEMPT + tx.val = val; + s = TEXCOORD_to_float(tx.bits.low); + t = TEXCOORD_to_float(tx.bits.high); + print(("\tTEX [%+.5f %+.5f]\n",s,t)); +} + + +/******************************************************************/ +// VTX - cmd 23h-28h, 40h-41h +/******************************************************************/ + +static s16 vx=0,vy=0,vz=0; + +INLINE void gl_VTX_one() { + float vfx,vfy,vfz; +CHECK_3D_ATTEMPT + vfx = s16_to_float(vx); + vfy = s16_to_float(vy); + vfz = s16_to_float(vz); + print(("\tVTX [%+.5f %+.5f %+.5f]\n",vfx,vfy,vfz)); +} + +void gl_VTX_begin(u32 val) { +//see 4000500h - Cmd 40h - BEGIN_VTXS - Start of Vertex List (W) +CHECK_3D_ATTEMPT + vx=vy=vz=0; + print(("VTX_begin : ")); + switch(val) { + case BEGIN_GL_TRIANGLES : // separate triangles (3 vertices for each triangle) + print(("GL_TRIANGLES\n")); + break; + case BEGIN_GL_QUADS : // separate quads (4 vertices for each triangle) + print(("GL_QUADS\n")); + break; + // strips : 1st triangle or quad defined by all vertices + // next ones share a segment (so 2 vertices less) + case BEGIN_GL_TRIANGLE_STRIP : // triangle strips (1st : 3, next : 1) + print(("GL_TRIANGLE_STRIP\n")); + break; + case BEGIN_GL_QUAD_STRIP : // quad strips (1st : 4, next : 2) + print(("GL_QUAD_STRIP\n")); + break; + default : + print(("unknown %d\n",val)); + } +} +void gl_VTX_end() { +//see 4000504h - Cmd 41h - END_VTXS - End of Vertex List (W) +CHECK_3D_ATTEMPT + print(("VTX_end.\n")); +} + +void gl_VTX_16 (u32 val) { +//see 400048Ch - Cmd 23h - VTX_16 - Set Vertex XYZ Coordinates (W) + _VTX_16 vval; + static int vtx_16_nbparams = 0; + vval.val = val; + switch(vtx_16_nbparams) { + case 0: + vx = vval.bits.low ; + vy = vval.bits.high; + vtx_16_nbparams++; + break; + case 1: + vz = vval.bits.low ; + gl_VTX_one(); + vtx_16_nbparams=0; + break; + default: + break; + } +} + +void gl_VTX_10 (u32 xyz) { +//see 4000490h - Cmd 24h - VTX_10 - Set Vertex XYZ Coordinates (W) + _VTX_10 vt; + vt.val = xyz; + vx = VTX10_to_s16(vt.bits.low); + vy = VTX10_to_s16(vt.bits.mid); + vz = VTX10_to_s16(vt.bits.high); + gl_VTX_one(); +} + + +void gl_VTX_XY (u32 xy) { +//see 4000494h - Cmd 25h - VTX_XY - Set Vertex XY Coordinates (W) + _VTX_16 vt; + vt.val = xy; + vx = VTX16_to_s16(vt.bits.low); + vy = VTX16_to_s16(vt.bits.high); + gl_VTX_one(); +} +void gl_VTX_XZ (u32 xz) { +//see 4000498h - Cmd 26h - VTX_XZ - Set Vertex XZ Coordinates (W) + _VTX_16 vt; + vt.val = xz; + vx = VTX16_to_s16(vt.bits.low); + vz = VTX16_to_s16(vt.bits.high); + gl_VTX_one(); +} +void gl_VTX_YZ (u32 yz) { +//see 400049Ch - Cmd 27h - VTX_YZ - Set Vertex YZ Coordinates (W) + _VTX_16 vt; + vt.val = yz; + vy = VTX16_to_s16(vt.bits.low); + vz = VTX16_to_s16(vt.bits.high); + gl_VTX_one(); +} + + +void gl_VTX_DIFF (u32 diff) { +//see 40004A0h - Cmd 28h - VTX_DIFF - Set Relative Vertex Coordinates (W) + _VTX_10 vt; + vt.val = diff; + vx += VTXDIFF_to_s16(vt.bits.low); + vy += VTXDIFF_to_s16(vt.bits.mid); + vz += VTXDIFF_to_s16(vt.bits.high); + gl_VTX_one(); +} diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gl_vertex.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gl_vertex.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gl_vertex.h 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gl_vertex.h 2007-02-27 11:53:03.000000000 -0600 @@ -0,0 +1,169 @@ +/* gl_vertex.h - this file is part of DeSmuME + * + * Copyright (C) 2007 Damien Nozay (damdoum) + * Author: damdoum at users.sourceforge.net + * + * based on http://nocash.emubase.de/gbatek.htm + * + * This file 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, or (at your option) + * any later version. + * + * This file 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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include "types.h" +#include "registers.h" + +#define CHECK_3D_ATTEMPT attempted_3D_op=TRUE; +BOOL attempted_3D_op; + +#define MTX_MODE_PROJECTION 0 +#define MTX_MODE_POSITION 1 +#define MTX_MODE_POS_VECTOR 2 +#define MTX_MODE_TEXTURE 3 +#define BEGIN_GL_TRIANGLES 0 +#define BEGIN_GL_QUADS 1 +#define BEGIN_GL_TRIANGLE_STRIP 2 +#define BEGIN_GL_QUAD_STRIP 3 + +#define TEXCOORD_to_float(t) (((float)(t)) / 2048.) +#define u32_to_float(t) (((float)(t)) / 4096.) +#define s16_to_float(t) (((float)(t)) / 4096.) +#define VTX16_to_s16(t) (t) +#define VTX10_to_s16(t) (t << 6) +#define VTXDIFF_to_s16(t) (t << 3) + +typedef union { + u32 val; + float fval; +} _MTX_val ; +typedef union { + u32 val; + struct { + // 12 bit fractionnal for _VTX_16 + // 11 bit fractionnal for _TEXCOORD + signed low:16; + signed high:16; + } bits; +} _VTX_16, _TEXCOORD ; +typedef union { + u32 val; + struct { // 6 bit fractionnal + signed low:10; + signed mid:10; + signed high:10; + signed :2; + } bits; +} _VTX_10 ; + +void gl_MTX_MODE (u32 val); +void gl_MTX_IDENTITY (); +void gl_MTX_LOAD_4x4 (u32 val); +void gl_MTX_LOAD_4x3 (u32 val); +void gl_MTX_LOAD_3x3 (u32 val); +void gl_MTX_MULT_4x4 (u32 val); +void gl_MTX_MULT_4x3 (u32 val); +void gl_MTX_MULT_3x3 (u32 val); + +void gl_TEXCOORD(u32 val); + +void gl_VTX_begin(u32 val); +//see 4000500h - Cmd 40h - BEGIN_VTXS - Start of Vertex List (W) +void gl_VTX_end(); +//see 4000504h - Cmd 41h - END_VTXS - End of Vertex List (W) + +void gl_VTX_16 (u32 val); +//see 400048Ch - Cmd 23h - VTX_16 - Set Vertex XYZ Coordinates (W) +void gl_VTX_10 (u32 xyz); +//see 4000490h - Cmd 24h - VTX_10 - Set Vertex XYZ Coordinates (W) + +void gl_VTX_XY (u32 xy); +//see 4000494h - Cmd 25h - VTX_XY - Set Vertex XY Coordinates (W) +void gl_VTX_XZ (u32 xz); +//see 4000498h - Cmd 26h - VTX_XZ - Set Vertex XZ Coordinates (W) +void gl_VTX_YZ (u32 yz); +//see 400049Ch - Cmd 27h - VTX_YZ - Set Vertex YZ Coordinates (W) + +void gl_VTX_DIFF (u32 diff); +//see 40004A0h - Cmd 28h - VTX_DIFF - Set Relative Vertex Coordinates (W) + + +#define GL_CMD_NAME(n) \ + case n : printf("cmd " #n "\n"); break; + +INLINE static void gl_print_cmd(u32 adr) { +CHECK_3D_ATTEMPT +#if 0 + switch (adr) { + GL_CMD_NAME(eng_3D_RDLINES_COUNT ) + GL_CMD_NAME(eng_3D_EDGE_COLOR ) + GL_CMD_NAME(eng_3D_ALPHA_TEST_REF ) + GL_CMD_NAME(eng_3D_CLEAR_COLOR ) + GL_CMD_NAME(eng_3D_CLEAR_DEPTH ) + GL_CMD_NAME(eng_3D_CLRIMAGE_OFFSET ) + GL_CMD_NAME(eng_3D_FOG_COLOR ) + GL_CMD_NAME(eng_3D_FOG_OFFSET ) + GL_CMD_NAME(eng_3D_FOG_TABLE ) + GL_CMD_NAME(eng_3D_TOON_TABLE ) + GL_CMD_NAME(eng_3D_GXFIFO ) + + GL_CMD_NAME(cmd_3D_MTX_MODE ) + GL_CMD_NAME(cmd_3D_MTX_PUSH ) + GL_CMD_NAME(cmd_3D_MTX_POP ) + GL_CMD_NAME(cmd_3D_MTX_STORE ) + GL_CMD_NAME(cmd_3D_MTX_RESTORE ) + GL_CMD_NAME(cmd_3D_MTX_IDENTITY ) + GL_CMD_NAME(cmd_3D_MTX_LOAD_4x4 ) + GL_CMD_NAME(cmd_3D_MTX_LOAD_4x3 ) + GL_CMD_NAME(cmd_3D_MTX_MULT_4x4 ) + GL_CMD_NAME(cmd_3D_MTX_MULT_4x3 ) + GL_CMD_NAME(cmd_3D_MTX_MULT_3x3 ) + GL_CMD_NAME(cmd_3D_MTX_SCALE ) + GL_CMD_NAME(cmd_3D_MTX_TRANS ) + GL_CMD_NAME(cmd_3D_COLOR ) + GL_CMD_NAME(cmd_3D_NORMA ) + GL_CMD_NAME(cmd_3D_TEXCOORD ) + GL_CMD_NAME(cmd_3D_VTX_16 ) + GL_CMD_NAME(cmd_3D_VTX_10 ) + GL_CMD_NAME(cmd_3D_VTX_XY ) + GL_CMD_NAME(cmd_3D_VTX_XZ ) + GL_CMD_NAME(cmd_3D_VTX_YZ ) + GL_CMD_NAME(cmd_3D_VTX_DIFF ) + GL_CMD_NAME(cmd_3D_POLYGON_ATTR ) + GL_CMD_NAME(cmd_3D_TEXIMAGE_PARAM ) + GL_CMD_NAME(cmd_3D_PLTT_BASE ) + GL_CMD_NAME(cmd_3D_DIF_AMB ) + GL_CMD_NAME(cmd_3D_SPE_EMI ) + GL_CMD_NAME(cmd_3D_LIGHT_VECTOR ) + GL_CMD_NAME(cmd_3D_LIGHT_COLOR ) + GL_CMD_NAME(cmd_3D_SHININESS ) + GL_CMD_NAME(cmd_3D_BEGIN_VTXS ) + GL_CMD_NAME(cmd_3D_END_VTXS ) + GL_CMD_NAME(cmd_3D_SWAP_BUFFERS ) + GL_CMD_NAME(cmd_3D_VIEWPORT ) + GL_CMD_NAME(cmd_3D_BOX_TEST ) + GL_CMD_NAME(cmd_3D_POS_TEST ) + GL_CMD_NAME(cmd_3D_VEC_TEST ) + + GL_CMD_NAME(eng_3D_GXSTAT ) + GL_CMD_NAME(eng_3D_RAM_COUNT ) + GL_CMD_NAME(eng_3D_DISP_1DOT_DEPTH ) + GL_CMD_NAME(eng_3D_POS_RESULT ) + GL_CMD_NAME(eng_3D_VEC_RESULT ) + GL_CMD_NAME(eng_3D_CLIPMTX_RESULT ) + GL_CMD_NAME(eng_3D_VECMTX_RESULT ) + default: break; + } +#endif +} diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/GPU.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/GPU.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/GPU.c 2007-02-01 06:43:01.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/GPU.c 2007-07-09 10:44:49.000000000 -0500 @@ -46,12 +46,13 @@ #include "MMU.h" #include "GPU.h" #include "debug.h" +#include "render3D.h" ARM9_struct ARM9Mem; extern BOOL click; -Screen MainScreen; -Screen SubScreen; +NDS_Screen MainScreen; +NDS_Screen SubScreen; //#define DEBUG_TRI @@ -110,6 +111,34 @@ NULL }; +//static BOOL setFinalColorDirect (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y); +static BOOL setFinalColorSpecialNone (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y); +static BOOL setFinalColorSpecialBlend (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y); +static BOOL setFinalColorSpecialIncrease (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y); +static BOOL setFinalColorSpecialDecrease (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y); + +//static BOOL setFinalColorDirectWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y); +static BOOL setFinalColorSpecialNoneWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y); +static BOOL setFinalColorSpecialBlendWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y); +static BOOL setFinalColorSpecialIncreaseWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y); +static BOOL setFinalColorSpecialDecreaseWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y); + + +typedef BOOL (*FinalColFunct)(const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y); + +FinalColFunct pixelBlitters[8] = { //setFinalColorDirect, + setFinalColorSpecialNone, + setFinalColorSpecialBlend, + setFinalColorSpecialIncrease, + setFinalColorSpecialDecrease, + + //setFinalColorDirectWnd, + setFinalColorSpecialNoneWnd, + setFinalColorSpecialBlendWnd, + setFinalColorSpecialIncreaseWnd, + setFinalColorSpecialDecreaseWnd}; + + /*****************************************************************************/ // INITIALIZATION @@ -124,6 +153,8 @@ GPU_Reset(g, l); + g->setFinalColor = setFinalColorSpecialNone; + return g; } @@ -131,6 +162,7 @@ { memset(g, 0, sizeof(GPU)); + g->setFinalColor = setFinalColorSpecialNone; g->lcd = l; g->core = l; g->BGSize[0][0] = g->BGSize[1][0] = g->BGSize[2][0] = g->BGSize[3][0] = 256; @@ -143,16 +175,20 @@ MMU.vram_mode[3] = 7 ; g->spriteRender = sprite1D; - + if(g->core == GPU_SUB) { g->oam = (OAM *)(ARM9Mem.ARM9_OAM + ADDRESS_STEP_1KB); g->sprMem = ARM9Mem.ARM9_BOBJ; + // GPU core B + g->dispx_st = (REG_DISPx*)(&ARM9Mem.ARM9_REG[REG_DISPB]); } else { g->oam = (OAM *)(ARM9Mem.ARM9_OAM); g->sprMem = ARM9Mem.ARM9_AOBJ; + // GPU core A + g->dispx_st = (REG_DISPx*)(&ARM9Mem.ARM9_REG[0]); } } @@ -164,18 +200,17 @@ void GPU_resortBGs(GPU *gpu) { int i, j, prio; - struct _DISPCNT * cnt = &gpu->dispCnt.bits; + struct _DISPCNT * cnt = &gpu->dispx_st->dispx_DISPCNT.bits; itemsForPriority_t * item; - for (i=0; i<256; i++) - memset(gpu->sprWin[i],0, 256); + memset(gpu->sprWin,0, 256*256); // we don't need to check for windows here... // if we tick boxes, invisible layers become invisible & vice versa #define OP ^ ! // if we untick boxes, layers become invisible //#define OP && - gpu->LayersEnable[0] = gpu->dispBG[0] OP(cnt->BG0_Enable && !(gpu->dispCnt.bits.BG0_3D && (gpu->core==0))); + gpu->LayersEnable[0] = gpu->dispBG[0] OP(cnt->BG0_Enable/* && !(cnt->BG0_3D && (gpu->core==0))*/); gpu->LayersEnable[1] = gpu->dispBG[1] OP(cnt->BG1_Enable); gpu->LayersEnable[2] = gpu->dispBG[2] OP(cnt->BG2_Enable); gpu->LayersEnable[3] = gpu->dispBG[3] OP(cnt->BG3_Enable); @@ -190,7 +225,7 @@ for (i=NB_BG,j=0; i>0; ) { i--; if (!gpu->LayersEnable[i]) continue; - prio = gpu->bgCnt[i].bits.Priority; + prio = (gpu->dispx_st)->dispx_BGxCNT[i].bits.Priority; item = &(gpu->itemsForPriority[prio]); item->BGs[item->nbBGs]=i; item->nbBGs++; @@ -213,19 +248,39 @@ #endif } +void GPU_setMasterBrightness (GPU *gpu, u16 val) +{ + u8 temp = (val&31); + gpu->MasterBrightFactor = (temp > 16 ? 16 : temp); + gpu->MasterBrightMode = (val>>14); +} +void SetupFinalPixelBlitter (GPU *gpu) +{ + u8 windowUsed = (gpu->WIN0_ENABLED | gpu->WIN1_ENABLED | gpu->WINOBJ_ENABLED); + u8 blendMode = (gpu->BLDCNT >> 6)&3; + + gpu->setFinalColor = pixelBlitters[windowUsed*4 + blendMode]; +} + /* Sets up LCD control variables for Display Engines A and B for quick reading */ void GPU_setVideoProp(GPU * gpu, u32 p) { - BOOL LayersEnable[5]; - u16 WinBG=0; - struct _DISPCNT * cnt = &gpu->dispCnt.bits; + BOOL LayersEnable[5]; + u16 WinBG=0; + struct _DISPCNT * cnt; + cnt = &(gpu->dispx_st)->dispx_DISPCNT.bits; + + T1WriteLong(&(gpu->dispx_st)->dispx_DISPCNT.val, 0, p); + + gpu->WIN0_ENABLED = cnt->Win0_Enable; + gpu->WIN1_ENABLED = cnt->Win1_Enable; + gpu->WINOBJ_ENABLED = cnt->WinOBJ_Enable; - gpu->dispCnt.val = p; + SetupFinalPixelBlitter (gpu); -// gpu->dispMode = DISPCNT_DISPLAY_MODE(p,gpu->lcd) ; gpu->dispMode = cnt->DisplayMode & ((gpu->core)?1:3); switch (gpu->dispMode) @@ -279,16 +334,18 @@ GPU_setBGProp(gpu, 1, T1ReadWord(ARM9Mem.ARM9_REG, gpu->core * ADDRESS_STEP_4KB + 10)); GPU_setBGProp(gpu, 0, T1ReadWord(ARM9Mem.ARM9_REG, gpu->core * ADDRESS_STEP_4KB + 8)); - GPU_resortBGs(gpu); + //GPU_resortBGs(gpu); } /* this is writing in BGxCNT */ /* FIXME: all DEBUG_TRI are broken */ void GPU_setBGProp(GPU * gpu, u16 num, u16 p) { - struct _BGxCNT * cnt = &(gpu->bgCnt[num].bits), *cnt2; + struct _BGxCNT * cnt = &((gpu->dispx_st)->dispx_BGxCNT[num].bits), *cnt2; + struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits; int mode; - gpu->bgCnt[num].val = p; + + T1WriteWord(&(gpu->dispx_st)->dispx_BGxCNT[num].val, 0, p); GPU_resortBGs(gpu); @@ -297,9 +354,9 @@ gpu->BG_bmp_ram[num] = ((u8 *)ARM9Mem.ARM9_BBG); gpu->BG_map_ram[num] = ARM9Mem.ARM9_BBG; } else { - gpu->BG_tile_ram[num] = ((u8 *)ARM9Mem.ARM9_ABG) + gpu->dispCnt.bits.CharacBase_Block * ADDRESS_STEP_64kB ; + gpu->BG_tile_ram[num] = ((u8 *)ARM9Mem.ARM9_ABG) + dispCnt->CharacBase_Block * ADDRESS_STEP_64kB ; gpu->BG_bmp_ram[num] = ((u8 *)ARM9Mem.ARM9_ABG); - gpu->BG_map_ram[num] = ARM9Mem.ARM9_ABG + gpu->dispCnt.bits.ScreenBase_Block * ADDRESS_STEP_64kB; + gpu->BG_map_ram[num] = ARM9Mem.ARM9_ABG + dispCnt->ScreenBase_Block * ADDRESS_STEP_64kB; } gpu->BG_tile_ram[num] += (cnt->CharacBase_Block * ADDRESS_STEP_16KB); @@ -318,189 +375,159 @@ break; } - mode = mode2type[gpu->dispCnt.bits.BG_Mode][num]; + mode = mode2type[dispCnt->BG_Mode][num]; gpu->BGSize[num][0] = sizeTab[mode][cnt->ScreenSize][0]; gpu->BGSize[num][1] = sizeTab[mode][cnt->ScreenSize][1]; } -/*****************************************************************************/ -// ENABLING / DISABLING LAYERS -/*****************************************************************************/ - -void GPU_remove(GPU * gpu, u8 num) +void GPU_setWIN0_H0 (GPU *gpu, u8 val) { - if (num == 4) gpu->dispOBJ = 0; - else gpu->dispBG[num] = 0; - GPU_resortBGs(gpu); + gpu->WIN0H0 = val; } -void GPU_addBack(GPU * gpu, u8 num) +void GPU_setWIN0_H1 (GPU *gpu, u8 val) { - if (num == 4) gpu->dispOBJ = 1; - else gpu->dispBG[num] = 1; - GPU_resortBGs(gpu); + gpu->WIN0H1 = val; } - -/*****************************************************************************/ -// PARAMETERS OF BACKGROUNDS -/*****************************************************************************/ - -void GPU_scrollX(GPU * gpu, u8 num, u16 v) +void GPU_setWIN0_V0 (GPU *gpu, u8 val) { - gpu->BGSX[num] = v; + gpu->WIN0V0 = val; } -void GPU_scrollY(GPU * gpu, u8 num, u16 v) +void GPU_setWIN0_V1 (GPU *gpu, u8 val) { - gpu->BGSY[num] = v; + gpu->WIN0V1 = val; } -void GPU_scrollXY(GPU * gpu, u8 num, u32 v) + +void GPU_setWIN1_H0 (GPU *gpu, u8 val) { - gpu->BGSX[num] = (v & 0xFFFF); - gpu->BGSY[num] = (v >> 16); + gpu->WIN1H0 = val; } - -void GPU_setX(GPU * gpu, u8 num, u32 v) +void GPU_setWIN1_H1 (GPU *gpu, u8 val) { - gpu->BGX[num] = (((s32)(v<<4))>>4); + gpu->WIN1H1 = val; } -void GPU_setXH(GPU * gpu, u8 num, u16 v) +void GPU_setWIN1_V0 (GPU *gpu, u8 val) { - gpu->BGX[num] = (((s32)((s16)(v<<4)))<<12) | (gpu->BGX[num]&0xFFFF); + gpu->WIN1V0; } -void GPU_setXL(GPU * gpu, u8 num, u16 v) +void GPU_setWIN1_V1 (GPU *gpu, u8 val) { - gpu->BGX[num] = (gpu->BGX[num]&0xFFFF0000) | v; + gpu->WIN1V1 = val; } -void GPU_setY(GPU * gpu, u8 num, u32 v) +void GPU_setWININ0 (GPU *gpu, u8 val) { - gpu->BGY[num] = (((s32)(v<<4))>>4); + gpu->WININ0 = val&0x1F; + gpu->WININ0_SPECIAL = (val>>5)&1; } -void GPU_setYH(GPU * gpu, u8 num, u16 v) +void GPU_setWININ1 (GPU *gpu, u8 val) { - gpu->BGY[num] = (((s32)((s16)(v<<4)))<<12) | (gpu->BGY[num]&0xFFFF); + gpu->WININ1 = val&0x1F; + gpu->WININ1_SPECIAL = (val>>5)&1; } -void GPU_setYL(GPU * gpu, u8 num, u16 v) + +void GPU_setWINOUT (GPU *gpu, u8 val) { - gpu->BGY[num] = (gpu->BGY[num]&0xFFFF0000) | v; + gpu->WINOUT = val&0x1F; + gpu->WINOUT_SPECIAL = (val>>5)&1; } -/*****************************************************************************/ -// PARAMETERS OF ROTOSCALE -/*****************************************************************************/ - -void GPU_setPA(GPU * gpu, u8 num, u16 v) +void GPU_setWINOBJ (GPU *gpu, u8 val) { - gpu->BGPA[num] = (s32)v; + gpu->WINOBJ = val&0x1F; + gpu->WINOBJ_SPECIAL = (val>>5)&1; } -void GPU_setPB(GPU * gpu, u8 num, u16 v) + +void GPU_setWIN0_H (GPU *gpu, u16 val) { - gpu->BGPB[num] = (s32)v; + gpu->WIN0H0 = val >> 8; + gpu->WIN0H1 = val&0xFF; } -void GPU_setPC(GPU * gpu, u8 num, u16 v) +void GPU_setWIN0_V (GPU *gpu, u16 val) { - gpu->BGPC[num] = (s32)v; + gpu->WIN0V0 = val >> 8; + gpu->WIN0V1 = val&0xFF; } -void GPU_setPD(GPU * gpu, u8 num, u16 v) +void GPU_setWIN1_H (GPU *gpu, u16 val) { - gpu->BGPD[num] = (s32)v; + gpu->WIN1H0 = val >> 8; + gpu->WIN1H1 = val&0xFF; } -void GPU_setPAPB(GPU * gpu, u8 num, u32 v) +void GPU_setWIN1_V (GPU *gpu, u16 val) { - gpu->BGPA[num] = (s16)v; - gpu->BGPB[num] = (s16)(v>>16); + gpu->WIN1V0 = val >> 8; + gpu->WIN1V1 = val&0xFF; } -void GPU_setPCPD(GPU * gpu, u8 num, u32 v) +void GPU_setWININ (GPU *gpu, u16 val) { - gpu->BGPC[num] = (s16)v; - gpu->BGPD[num] = (s16)(v>>16); -} - -/*****************************************************************************/ -// PARAMETERS OF EFFECTS -/*****************************************************************************/ + gpu->WININ0 = val&0x1F; + gpu->WININ0_SPECIAL = (val>>5)&1; -void GPU_setBLDCNT(GPU *gpu, u16 v) -{ - gpu->BLDCNT = v ; + val >>= 8; + gpu->WININ1 = val&0x1F; + gpu->WININ1_SPECIAL = (val>>5)&1; } -void GPU_setBLDALPHA(GPU *gpu, u16 v) +void GPU_setWINOUT16(GPU *gpu, u16 val) { - gpu->BLDALPHA = v ; + gpu->WINOUT = val&0x1F; + gpu->WINOUT_SPECIAL = (val>>5)&1; + + val >>= 8; + gpu->WINOBJ = val&0x1F; + gpu->WINOBJ_SPECIAL = (val>>5)&1; } -void GPU_setBLDY(GPU *gpu, u16 v) + +// Blending +void GPU_setBLDCNT_LOW (GPU *gpu, u8 val) { - gpu->BLDY = v ; + gpu->BLDCNT = (gpu->BLDCNT&0xFF00) | val; + SetupFinalPixelBlitter (gpu); } -void GPU_setMOSAIC(GPU *gpu, u16 v) +void GPU_setBLDCNT_HIGH (GPU *gpu, u8 val) { - gpu->MOSAIC = v ; + gpu->BLDCNT = (gpu->BLDCNT&0xFF) | (val<<8); + SetupFinalPixelBlitter (gpu); } -void GPU_setMASTER_BRIGHT (GPU *gpu, u16 v) +void GPU_setBLDCNT (GPU *gpu, u16 val) { - gpu->masterBright.val = v; + gpu->BLDCNT = val; + SetupFinalPixelBlitter (gpu); } - -/*****************************************************************************/ -// PARAMETERS OF WINDOWS -/*****************************************************************************/ - -void GPU_setWINDOW_XDIM(GPU *gpu, u16 v, u8 num) +void GPU_setBLDALPHA (GPU *gpu, u16 val) { - gpu->WINDOW_XDIM[num].val = v ; -} -void GPU_setWINDOW_XDIM_Component(GPU *gpu, u8 v, u8 num) /* write start/end seperately */ -{ - if (num & 1) { - gpu->WINDOW_XDIM[num >> 1].bits.start = v ; - } else { - gpu->WINDOW_XDIM[num >> 1].bits.end = v ; - } -} + gpu->BLDALPHA_EVA = (val&0x1f) > 16 ? 16 : (val&0x1f); -void GPU_setWINDOW_YDIM(GPU *gpu, u16 v, u8 num) -{ - gpu->WINDOW_YDIM[num].val = v ; + val >>= 8; + gpu->BLDALPHA_EVB = (val&0x1f) > 16 ? 16 : (val&0x1f); } -void GPU_setWINDOW_YDIM_Component(GPU *gpu, u8 v, u8 num) /* write start/end seperately */ +void GPU_setBLDALPHA_EVA (GPU *gpu, u8 val) { - if (num & 1) { - gpu->WINDOW_YDIM[num >> 1].bits.start = v ; - } else { - gpu->WINDOW_YDIM[num >> 1].bits.end = v ; - } + gpu->BLDALPHA_EVA = (val&0x1f) > 16 ? 16 : (val&0x1f); } - -void GPU_setWINDOW_INCNT(GPU *gpu, u16 v) +void GPU_setBLDALPHA_EVB (GPU *gpu, u8 val) { - gpu->WINDOW_INCNT.val = v ; + gpu->BLDALPHA_EVB = (val&0x1f) > 16 ? 16 : (val&0x1f); } -void GPU_setWINDOW_INCNT_Component(GPU *gpu, u8 v,u8 num) +void GPU_setBLDY_EVY (GPU *gpu, u8 val) { - switch (num) - { - case 0: - gpu->WINDOW_INCNT.bytes.low = v ; - break ; - case 1: - gpu->WINDOW_INCNT.bytes.high = v ; - break ; - } + gpu->BLDY_EVY = (val&0x1f) > 16 ? 16 : (val&0x1f); } -void GPU_setWINDOW_OUTCNT(GPU *gpu, u16 v) + +/*****************************************************************************/ +// ENABLING / DISABLING LAYERS +/*****************************************************************************/ + +void GPU_remove(GPU * gpu, u8 num) { - gpu->WINDOW_OUTCNT.val = v ; + if (num == 4) gpu->dispOBJ = 0; + else gpu->dispBG[num] = 0; + GPU_resortBGs(gpu); } -void GPU_setWINDOW_OUTCNT_Component(GPU *gpu, u8 v,u8 num) +void GPU_addBack(GPU * gpu, u8 num) { - switch (num) - { - case 0: - gpu->WINDOW_OUTCNT.bytes.low = v ; - break ; - case 1: - gpu->WINDOW_OUTCNT.bytes.high = v ; - break ; - } + //REG_DISPx_pack_test(gpu); + if (num == 4) gpu->dispOBJ = 1; + else gpu->dispBG[num] = 1; + GPU_resortBGs(gpu); } @@ -510,186 +537,307 @@ /* check whether (x,y) is within the rectangle (including wraparounds) */ -INLINE BOOL withinRect (u8 x,u8 y, u16 startX, u16 startY, u16 endX, u16 endY) +static INLINE BOOL withinRect (u8 x,u8 y, u16 startX, u16 startY, u16 endX, u16 endY) { - BOOL wrapx, wrapy, goodx, goody; + BOOL wrapx, wrapy; wrapx = startX > endX; wrapy = startY > endY; // when the start > end, // all points between start & end are outside the window, // otherwise - // they are inside - goodx = (wrapx)? ((startX <= x)||(x <= endX)):((startX <= x)&&(x <= endX)); - goody = (wrapy)? ((startY <= y)||(y <= endY)):((startY <= y)&&(y <= endY)); - return (goodx && goody); + // they are inside + return ((wrapx? ((startX <= x)||(x <= endX)):((startX <= x)&&(x <= endX))) && + (wrapy? ((startY <= y)||(y <= endY)):((startY <= y)&&(y <= endY)))); } // Now assumes that *draw and *effect are different from 0 when called, so we can avoid // setting some values twice -void renderline_checkWindows(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL *draw, BOOL *effect) +static INLINE void renderline_checkWindows(const GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL *draw, BOOL *effect) { - BOOL wwin0=0, wwin1=0, wwobj=0, windows=0; - // Check if win0 if enabled, and only check if it is - if (gpu->dispCnt.bits.Win0_Enable) + if (gpu->WIN0_ENABLED) { - wwin0 = withinRect( x,y, - gpu->WINDOW_XDIM[0].bits.start,gpu->WINDOW_YDIM[0].bits.start, - gpu->WINDOW_XDIM[0].bits.end, gpu->WINDOW_YDIM[0].bits.end); - windows = 1; + // it is in win0, do we display ? + // high priority + if (withinRect( x, y, gpu->WIN0H0, gpu->WIN0V0, gpu->WIN0H1, gpu->WIN0V1)) + { + *draw = (gpu->WININ0 >> bgnum)&1; + *effect = (gpu->WININ0_SPECIAL); + return; + } } // Check if win1 if enabled, and only check if it is - if (gpu->dispCnt.bits.Win1_Enable) + if (gpu->WIN1_ENABLED) { - wwin1 = withinRect( x,y, - gpu->WINDOW_XDIM[1].bits.start,gpu->WINDOW_YDIM[1].bits.start, - gpu->WINDOW_XDIM[1].bits.end, gpu->WINDOW_YDIM[1].bits.end); - windows = 1; + // it is in win1, do we display ? + // mid priority + if (withinRect( x, y, gpu->WIN1H0, gpu->WIN1V0, gpu->WIN1H1, gpu->WIN1V1)) + { + *draw = (gpu->WININ1 >> bgnum)&1; + *effect = (gpu->WININ1_SPECIAL); + return; + } } - if (gpu->dispCnt.bits.WinOBJ_Enable) + if (gpu->WINOBJ_ENABLED) { - wwobj = gpu->sprWin[y][x]; - windows = 1; + // it is in winOBJ, do we display ? + // low priority + if (gpu->sprWin[y][x]) + { + *draw = (gpu->WINOBJ >> bgnum)&1; + *effect = (gpu->WINOBJ_SPECIAL); + return; + } } - if (windows) { -/* - // HOW THE HELL THIS DOES NOT WORK !!! + if (gpu->WINOBJ_ENABLED | gpu->WIN1_ENABLED | gpu->WIN0_ENABLED) + { + *draw = (gpu->WINOUT >> bgnum) & 1; + *effect = (gpu->WINOUT_SPECIAL); + } +} - win0 = (gpu->WINDOW_INCNT.bytes.low & (1<WINDOW_INCNT.bytes.high & (1<WINDOW_OUTCNT.bytes.low & (1<WINDOW_OUTCNT.bytes.high & (1<WINDOW_INCNT.bytes.low >> bgnum)&1; - *effect = gpu->WINDOW_INCNT.bits.WIN0_Effect_Enable; +static BOOL setFinalColorSpecialNone (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y) +{ + T2WriteWord(dst, passing, color); + + return 1; +} + +static BOOL setFinalColorSpecialBlend (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y) +{ + if ((gpu->BLDCNT >> bgnum)&1) + { + u16 sourceFraction = gpu->BLDALPHA_EVA, + sourceR, sourceG, sourceB,targetFraction; + if (!sourceFraction) + return 0; + // no fraction of this BG to be showed, so don't do anything + sourceR = ((color & 0x1F) * sourceFraction) >> 4 ; + // weighted component from color to draw + sourceG = (((color>>5) & 0x1F) * sourceFraction) >> 4 ; + sourceB = (((color>>10) & 0x1F) * sourceFraction) >> 4 ; + targetFraction = gpu->BLDALPHA_EVB; + if (targetFraction) { + // when we dont take any fraction from existing pixel, we can just draw + u16 targetR, targetG, targetB; + color = T2ReadWord(dst, passing) ; + //if (color & 0x8000) { + // the existing pixel is not invisible + targetR = ((color & 0x1F) * targetFraction) >> 4 ; // weighted component from color we draw on + targetG = (((color>>5) & 0x1F) * targetFraction) >> 4 ; + targetB = (((color>>10) & 0x1F) * targetFraction) >> 4 ; + // limit combined components to 31 max + sourceR = min(0x1F,targetR+sourceR) ; + sourceG = min(0x1F,targetG+sourceG) ; + sourceB = min(0x1F,targetB+sourceB) ; + //} } - // it is in win1, do we display ? - // mid priority - else if (wwin1) { - *draw = (gpu->WINDOW_INCNT.bytes.high >> bgnum)&1; - *effect = gpu->WINDOW_INCNT.bits.WIN1_Effect_Enable; + color = (sourceR & 0x1F) | ((sourceG & 0x1F) << 5) | ((sourceB & 0x1F) << 10) | 0x8000 ; + + T2WriteWord(dst, passing, color); + } + else + { + T2WriteWord(dst, passing, color); + } + + return 1; +} + +static BOOL setFinalColorSpecialIncrease (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y) +{ + if ((gpu->BLDCNT >> bgnum)&1) // the bg to draw has a special color effect + { + if (gpu->BLDY_EVY != 0x0) + { // dont slow down if there is nothing to do + u16 modFraction = gpu->BLDY_EVY; + u16 sourceR = (color & 0x1F) ; + u16 sourceG = ((color>>5) & 0x1F) ; + u16 sourceB = ((color>>10) & 0x1F) ; + sourceR += ((31-sourceR) * modFraction) >> 4 ; + sourceG += ((31-sourceG) * modFraction) >> 4 ; + sourceB += ((31-sourceB) * modFraction) >> 4 ; + color = (sourceR & 0x1F) | ((sourceG & 0x1F) << 5) | ((sourceB & 0x1F) << 10) | 0x8000 ; } - // it is in winOBJ, do we display ? - // low priority - else if (wwobj) { - *draw = (gpu->WINDOW_OUTCNT.bytes.high>> bgnum)&1; - *effect = gpu->WINDOW_OUTCNT.bits.WIN1_Effect_Enable; - } - // it is outside of windows, do we display ? - // fallback - else if (!(wwin0||wwin1||wwobj)) { - *draw = (gpu->WINDOW_OUTCNT.bytes.low >> bgnum)&1; - *effect = gpu->WINDOW_OUTCNT.bits.WIN0_Effect_Enable; + + T2WriteWord(dst, passing, color) ; + } + else + { + T2WriteWord(dst, passing, color); + } + + return 1; +} + +static BOOL setFinalColorSpecialDecrease (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y) +{ + if ((gpu->BLDCNT >> bgnum)&1) // the bg to draw has a special color effect + { + if (gpu->BLDY_EVY != 0x0) + { // dont slow down if there is nothing to do + u16 modFraction = gpu->BLDY_EVY; + u16 sourceR = (color & 0x1F) ; + u16 sourceG = ((color>>5) & 0x1F) ; + u16 sourceB = ((color>>10) & 0x1F) ; + sourceR -= ((sourceR) * modFraction) >> 4 ; + sourceG -= ((sourceG) * modFraction) >> 4 ; + sourceB -= ((sourceB) * modFraction) >> 4 ; + color = (sourceR & 0x1F) | ((sourceG & 0x1F) << 5) | ((sourceB & 0x1F) << 10) | 0x8000 ; } + T2WriteWord(dst, passing, color) ; + } + else + { + T2WriteWord(dst, passing, color); } + + return 1; } -/*****************************************************************************/ -// PIXEL RENDERING -/*****************************************************************************/ +static BOOL setFinalColorSpecialNoneWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y) +{ + BOOL windowDraw = TRUE, windowEffect = TRUE; + + renderline_checkWindows(gpu,bgnum,x,y, &windowDraw, &windowEffect); -INLINE BOOL renderline_setFinalColor(GPU *gpu,u32 passing,u8 bgnum,u8 *dst,u16 color,u16 x, u16 y) { - BOOL windowDraw = TRUE, windowEffect = TRUE ; - /* window priority: insides, if no rule, check outside */ - renderline_checkWindows(gpu,bgnum,x,y,&windowDraw,&windowEffect); + if (((gpu->BLDCNT >> bgnum)&1) && windowEffect) // the bg to draw has a special color effect + { + T2WriteWord(dst, passing, color); + } + else + { + if ((windowEffect && (gpu->BLDCNT & (0x100 << bgnum))) || windowDraw) + T2WriteWord(dst, passing, color); + } + + return windowDraw; +} + +static BOOL setFinalColorSpecialBlendWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y) +{ + BOOL windowDraw = TRUE, windowEffect = TRUE; - if (((gpu->BLDCNT>>bgnum)&1) && (windowEffect)) /* the bg to draw has a special color effect */ + renderline_checkWindows(gpu,bgnum,x,y, &windowDraw, &windowEffect); + + if (((gpu->BLDCNT >> bgnum)&1) && windowEffect) // the bg to draw has a special color effect { - switch (gpu->BLDCNT & 0xC0) /* type of special color effect */ - { - case 0x00: /* none (plain color passing) */ - T2WriteWord(dst, passing, color) ; - break ; - case 0x40: /* alpha blending */ - { - //if (!(color & 0x8000)) return ; - /* we cant do alpha on an invisible pixel */ + u16 sourceFraction = gpu->BLDALPHA_EVA, + sourceR, sourceG, sourceB,targetFraction; + if (!sourceFraction) + return 0; + // no fraction of this BG to be showed, so don't do anything + sourceR = ((color & 0x1F) * sourceFraction) >> 4 ; + // weighted component from color to draw + sourceG = (((color>>5) & 0x1F) * sourceFraction) >> 4 ; + sourceB = (((color>>10) & 0x1F) * sourceFraction) >> 4 ; + targetFraction = gpu->BLDALPHA_EVB; + if (targetFraction) { + // when we dont take any fraction from existing pixel, we can just draw + u16 targetR, targetG, targetB; + color = T2ReadWord(dst, passing) ; + //if (color & 0x8000) { + // the existing pixel is not invisible + targetR = ((color & 0x1F) * targetFraction) >> 4 ; // weighted component from color we draw on + targetG = (((color>>5) & 0x1F) * targetFraction) >> 4 ; + targetB = (((color>>10) & 0x1F) * targetFraction) >> 4 ; + // limit combined components to 31 max + sourceR = min(0x1F,targetR+sourceR) ; + sourceG = min(0x1F,targetG+sourceG) ; + sourceB = min(0x1F,targetB+sourceB) ; + //} + } + color = (sourceR & 0x1F) | ((sourceG & 0x1F) << 5) | ((sourceB & 0x1F) << 10) | 0x8000 ; - u16 sourceFraction = (gpu->BLDALPHA & 0x1F), - sourceR, sourceG, sourceB,targetFraction; - if (!sourceFraction) return ; - /* no fraction of this BG to be showed, so don't do anything */ - sourceR = ((color & 0x1F) * sourceFraction) >> 4 ; - /* weighted component from color to draw */ - sourceG = (((color>>5) & 0x1F) * sourceFraction) >> 4 ; - sourceB = (((color>>10) & 0x1F) * sourceFraction) >> 4 ; - targetFraction = (gpu->BLDALPHA & 0x1F00) >> 8 ; - if (targetFraction) { - /* when we dont take any fraction from existing pixel, we can just draw */ - u16 targetR, targetG, targetB; - color = T2ReadWord(dst, passing) ; - //if (color & 0x8000) { - /* the existing pixel is not invisible */ - targetR = ((color & 0x1F) * targetFraction) >> 4 ; /* weighted component from color we draw on */ - targetG = (((color>>5) & 0x1F) * targetFraction) >> 4 ; - targetB = (((color>>10) & 0x1F) * targetFraction) >> 4 ; - /* limit combined components to 31 max */ - sourceR = min(0x1F,targetR+sourceR) ; - sourceG = min(0x1F,targetG+sourceG) ; - sourceB = min(0x1F,targetB+sourceB) ; - //} - } - color = (sourceR & 0x1F) | ((sourceG & 0x1F) << 5) | ((sourceB & 0x1F) << 10) | 0x8000 ; - } - T2WriteWord(dst, passing, color) ; - break ; - case 0x80: /* brightness increase */ - { - if (gpu->BLDY != 0x0) { /* dont slow down if there is nothing to do */ - u16 modFraction = (gpu->BLDY & 0x1F) ; - u16 sourceR = (color & 0x1F) ; - u16 sourceG = ((color>>5) & 0x1F) ; - u16 sourceB = ((color>>10) & 0x1F) ; - sourceR += ((31-sourceR) * modFraction) >> 4 ; - sourceG += ((31-sourceG) * modFraction) >> 4 ; - sourceB += ((31-sourceB) * modFraction) >> 4 ; - color = (sourceR & 0x1F) | ((sourceG & 0x1F) << 5) | ((sourceB & 0x1F) << 10) | 0x8000 ; - } ; - } - T2WriteWord(dst, passing, color) ; - break ; - case 0xC0: /* brightness decrease */ - { - if (gpu->BLDY!=0) { /* dont slow down if there is nothing to do */ - u16 modFraction = (gpu->BLDY & 0x1F) ; - u16 sourceR = (color & 0x1F) ; - u16 sourceG = ((color>>5) & 0x1F) ; - u16 sourceB = ((color>>10) & 0x1F) ; - sourceR -= ((sourceR) * modFraction) >> 4 ; - sourceG -= ((sourceG) * modFraction) >> 4 ; - sourceB -= ((sourceB) * modFraction) >> 4 ; - color = (sourceR & 0x1F) | ((sourceG & 0x1F) << 5) | ((sourceB & 0x1F) << 10) | 0x8000 ; - } - } - T2WriteWord(dst, passing, color) ; - break ; + T2WriteWord(dst, passing, color); + } + else + { + if ((windowEffect && (gpu->BLDCNT & (0x100 << bgnum))) || windowDraw) + T2WriteWord(dst, passing, color); + } + + return windowDraw; +} + +static BOOL setFinalColorSpecialIncreaseWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y) +{ + BOOL windowDraw = TRUE, windowEffect = TRUE; + + renderline_checkWindows(gpu,bgnum,x,y, &windowDraw, &windowEffect); + + if (((gpu->BLDCNT >> bgnum)&1) && windowEffect) // the bg to draw has a special color effect + { + if (gpu->BLDY_EVY != 0x0) + { // dont slow down if there is nothing to do + u16 modFraction = gpu->BLDY_EVY; + u16 sourceR = (color & 0x1F) ; + u16 sourceG = ((color>>5) & 0x1F) ; + u16 sourceB = ((color>>10) & 0x1F) ; + sourceR += ((31-sourceR) * modFraction) >> 4 ; + sourceG += ((31-sourceG) * modFraction) >> 4 ; + sourceB += ((31-sourceB) * modFraction) >> 4 ; + color = (sourceR & 0x1F) | ((sourceG & 0x1F) << 5) | ((sourceB & 0x1F) << 10) | 0x8000 ; } - } else { - /* only draw when effect is enabled on this pixel as source, or drawing itself is enabled */ - if (((windowEffect) && (gpu->BLDCNT & (0x100 << bgnum))) || (windowDraw)) - T2WriteWord(dst, passing, color) ; + + T2WriteWord(dst, passing, color) ; } + else + { + if ((windowEffect && (gpu->BLDCNT & (0x100 << bgnum))) || windowDraw) + T2WriteWord(dst, passing, color); + } + return windowDraw; } +static BOOL setFinalColorSpecialDecreaseWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y) +{ + BOOL windowDraw = TRUE, windowEffect = TRUE; + + renderline_checkWindows(gpu,bgnum,x,y, &windowDraw, &windowEffect); + + if (((gpu->BLDCNT >> bgnum)&1) && windowEffect) // the bg to draw has a special color effect + { + if (gpu->BLDY_EVY != 0x0) + { // dont slow down if there is nothing to do + u16 modFraction = gpu->BLDY_EVY; + u16 sourceR = (color & 0x1F) ; + u16 sourceG = ((color>>5) & 0x1F) ; + u16 sourceB = ((color>>10) & 0x1F) ; + sourceR -= ((sourceR) * modFraction) >> 4 ; + sourceG -= ((sourceG) * modFraction) >> 4 ; + sourceB -= ((sourceB) * modFraction) >> 4 ; + color = (sourceR & 0x1F) | ((sourceG & 0x1F) << 5) | ((sourceB & 0x1F) << 10) | 0x8000 ; + } + T2WriteWord(dst, passing, color) ; + } + else + { + if ((windowEffect && (gpu->BLDCNT & (0x100 << bgnum))) || windowDraw) + T2WriteWord(dst, passing, color); + } + + return windowDraw; +} /*****************************************************************************/ // BACKGROUND RENDERING -TEXT- /*****************************************************************************/ /* render a text background to the combined pixelbuffer */ -INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 YBG, u16 LG) +INLINE void renderline_textBG(const GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 YBG, u16 LG) { - struct _BGxCNT bgCnt = gpu->bgCnt[num].bits; + struct _BGxCNT * bgCnt = &(gpu->dispx_st)->dispx_BGxCNT[num].bits; + struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits; u16 lg = gpu->BGSize[num][0]; u16 ht = gpu->BGSize[num][1]; u16 tmp = ((YBG&(ht-1))>>3); @@ -702,6 +850,7 @@ u16 x = 0; u16 xfin; u16 palette_size; + u16 mosaic = T1ReadWord(&gpu->dispx_st->dispx_MISC.MOSAIC, 0); s8 line_dir = 1; u8 pt_xor = 0; @@ -710,7 +859,7 @@ if(tmp>31) { - map+= ADDRESS_STEP_512B << bgCnt.ScreenSize ; + map+= ADDRESS_STEP_512B << bgCnt->ScreenSize ; } tile = (u8*) gpu->BG_tile_ram[num]; @@ -718,14 +867,14 @@ xoff = XBG; pal = ARM9Mem.ARM9_VMEM + gpu->core * ADDRESS_STEP_1KB ; - if(!bgCnt.Palette_256) /* color: 16 palette entries */ + if(!bgCnt->Palette_256) /* color: 16 palette entries */ { - if (bgCnt.Mosaic_Enable){ + if (bgCnt->Mosaic_Enable){ /* test NDS: #2 of http://desmume.sourceforge.net/forums/index.php?action=vthread&forum=2&topic=50&page=0#msg192 */ - u8 mw = (gpu->MOSAIC & 0xF) +1 ; /* horizontal granularity of the mosaic */ - u8 mh = ((gpu->MOSAIC>>4) & 0xF) +1 ; /* vertical granularity of the mosaic */ + u8 mw = (mosaic & 0xF) +1 ; /* horizontal granularity of the mosaic */ + u8 mh = ((mosaic>>4) & 0xF) +1 ; /* vertical granularity of the mosaic */ YBG = (YBG / mh) * mh ; /* align y by vertical granularity */ yoff = ((YBG&7)<<2); @@ -740,12 +889,6 @@ line = (u8*)tile + (tileentry.bits.TileNum * 0x20) + ((tileentry.bits.VFlip)? (7*4)-yoff:yoff); - - #define RENDERL(c,m) \ - color = T1ReadWord(pal, ((c) + (tileentry.bits.Palette* m)) << 1); \ - if (c) renderline_setFinalColor(gpu,0,num,dst,color,x,Y) ; \ - dst += 2; x++; xoff++; - if(tileentry.bits.HFlip) { line += 3 - ((xoff&7)>>1); @@ -765,7 +908,14 @@ save = (*line) >> 4 ; } } - RENDERL(save,0x10) + + color = T1ReadWord(pal, ((save) + (tileentry.bits.Palette*16)) << 1); + if (save) + gpu->setFinalColor(gpu,0,num,dst,color,x,Y); + dst += 2; + x++; + xoff++; + pt++ ; if (!(pt % mw)) { /* next pixel next possible color update */ if ((pt & 1)^pt_xor) { @@ -774,7 +924,14 @@ save = (*line) >> 4 ; } } - RENDERL(save,0x10) + + color = T1ReadWord(pal, ((save) + (tileentry.bits.Palette*16)) << 1); + if (save) + gpu->setFinalColor(gpu,0,num,dst,color,x,Y); + dst += 2; + x++; + xoff++; + line+=line_dir; pt++ ; } } @@ -783,30 +940,85 @@ xfin = 8 - (xoff&7); for(x = 0; x < LG; xfin = min(x+8, LG)) { + u16 tilePalette = 0; tmp = ((xoff&(lg-1))>>3); mapinfo = map + (tmp&0x1F) * 2; if(tmp>31) mapinfo += 32*32*2; tileentry.val = T1ReadWord(mapinfo, 0); - line = (u8 * )tile + (tileentry.bits.TileNum * 0x20) + ((tileentry.bits.VFlip) ? (7*4)-yoff : yoff); + tilePalette = (tileentry.bits.Palette*16); + + line = (u8 * )tile + (tileentry.bits.TileNum * 0x20) + ((tileentry.bits.VFlip) ? (7*4)-yoff : yoff); if(tileentry.bits.HFlip) { - //x=xfin; continue; + u8 currLine; + line += (3 - ((xoff&7)>>1)); - line_dir = -1; - for(; x < xfin; ) { - RENDERL(((*line)>>4),0x10) - RENDERL(((*line)&0xF),0x10) - line += line_dir; + + if((!(7 - (xoff & 7)) & 1)) + { + currLine = *line; + if (currLine&0xF) + { + color = T1ReadWord(pal, ((currLine&0xF) + tilePalette) << 1); + gpu->setFinalColor(gpu,0,num,dst,color,x,Y); + } + dst += 2; x++; xoff++; + line--; + } + for(; x < xfin; line --) + { + currLine = *line; + + if (currLine>>4) + { + color = T1ReadWord(pal, ((currLine>>4) + tilePalette) << 1); + gpu->setFinalColor(gpu,0,num,dst,color,x,Y); + } + dst += 2; x++; xoff++; + + if (currLine&0xF) + { + color = T1ReadWord(pal, ((currLine&0xF) + tilePalette) << 1); + gpu->setFinalColor(gpu,0,num,dst,color,x,Y); + } + dst += 2; x++; xoff++; } } else { + u8 currLine; + line += ((xoff&7)>>1); - line_dir = 1; - for(; x < xfin; ) { - RENDERL(((*line)&0xF),0x10) - RENDERL(((*line)>>4),0x10) - line += line_dir; + + if(xoff & 1) + { + currLine = *line; + if (currLine>>4) + { + color = T1ReadWord(pal, ((currLine>>4) + tilePalette) << 1); + gpu->setFinalColor(gpu,0,num,dst,color,x,Y); + } + dst += 2; x++; xoff++; + line++; + } + for(; x < xfin; line ++) + { + currLine = *line; + + if (currLine&0xF) + { + color = T1ReadWord(pal, ((currLine&0xF) + tilePalette) << 1); + gpu->setFinalColor(gpu,0,num,dst,color,x,Y); + } + + dst += 2; x++; xoff++; + + if (currLine>>4) + { + color = T1ReadWord(pal, ((currLine>>4) + tilePalette) << 1); + gpu->setFinalColor(gpu,0,num,dst,color,x,Y); + } + dst += 2; x++; xoff++; } } } @@ -815,7 +1027,7 @@ } palette_size=0; /* color: no extended palette */ - if(gpu->dispCnt.bits.ExBGxPalette_Enable) /* color: extended palette */ + if(dispCnt->ExBGxPalette_Enable) /* color: extended palette */ { palette_size=0x100; pal = ARM9Mem.ExtPal[gpu->core][gpu->BGExtPalSlot[num]]; @@ -843,11 +1055,14 @@ } for(; x < xfin; ) { - RENDERL((*line),palette_size) + color = T1ReadWord(pal, ((*line) + (tileentry.bits.Palette*palette_size)) << 1); + if (*line) + gpu->setFinalColor(gpu,0,num,dst,color,x,Y); + dst += 2; x++; xoff++; + line += line_dir; } } -#undef RENDERL } /*****************************************************************************/ @@ -858,13 +1073,13 @@ u8 palette_entry; u16 tileindex, x, y, color; - tileindex = map[(auxX + auxY * lg)>>3]; + tileindex = map[(auxX>>3) + (auxY>>3) * (lg>>3)]; x = (auxX&7); y = (auxY&7); palette_entry = tile[(tileindex<<6)+(y<<3)+x]; color = T1ReadWord(pal, palette_entry << 1); if (palette_entry) - renderline_setFinalColor(gpu,0,num,dst, color,auxX,auxY); + gpu->setFinalColor(gpu,0,num,dst, color,auxX,auxY); } void rot_tiled_16bit_entry(GPU * gpu, int num, s32 auxX, s32 auxY, int lg, u8 * dst, u8 * map, u8 * tile, u8 * pal, int i, u16 H) { @@ -880,7 +1095,7 @@ palette_entry = tile[(tileentry.bits.TileNum<<6)+(y<<3)+x]; color = T1ReadWord(pal, (palette_entry + (tileentry.bits.Palette<<8)) << 1); if (palette_entry>0) - renderline_setFinalColor(gpu,0,num,dst, color, i, H); + gpu->setFinalColor(gpu,0,num,dst, color, i, H); } void rot_256_map(GPU * gpu, int num, s32 auxX, s32 auxY, int lg, u8 * dst, u8 * map, u8 * tile, u8 * pal, int i, u16 H) { @@ -892,7 +1107,7 @@ palette_entry = map[auxX + auxY * lg]; color = T1ReadWord(pal, palette_entry << 1); if(palette_entry) - renderline_setFinalColor(gpu,0,num,dst, color, i, H); + gpu->setFinalColor(gpu,0,num,dst, color, i, H); } @@ -903,7 +1118,7 @@ color = T1ReadWord(map, (auxX + auxY * lg) << 1); if (color&0x8000) - renderline_setFinalColor(gpu,0,num,dst, color, i, H); + gpu->setFinalColor(gpu,0,num,dst, color, i, H); } @@ -945,10 +1160,10 @@ INLINE void apply_rot_fun(GPU * gpu, u8 num, u8 * dst, u16 H, s32 X, s32 Y, s16 PA, s16 PB, s16 PC, s16 PD, u16 LG, rot_fun fun, u8 * map, u8 * tile, u8 * pal) { - struct _BGxCNT bgCnt = gpu->bgCnt[num].bits; + struct _BGxCNT * bgCnt = &(gpu->dispx_st)->dispx_BGxCNT[num].bits; s32 wh = gpu->BGSize[num][0]; s32 ht = gpu->BGSize[num][1]; - rot_scale_op(gpu, num, dst, H, X, Y, PA, PB, PC, PD, LG, wh, ht, bgCnt.PaletteSet_Wrap, fun, map, tile, pal); + rot_scale_op(gpu, num, dst, H, X, Y, PA, PB, PC, PD, LG, wh, ht, bgCnt->PaletteSet_Wrap, fun, map, tile, pal); } @@ -962,13 +1177,13 @@ INLINE void extRotBG2(GPU * gpu, u8 num, u8 * dst, u16 H, s32 X, s32 Y, s16 PA, s16 PB, s16 PC, s16 PD, s16 LG) { - struct _BGxCNT bgCnt = gpu->bgCnt[num].bits; + struct _BGxCNT * bgCnt = &(gpu->dispx_st)->dispx_BGxCNT[num].bits; u8 *map, *tile, *pal; u8 affineModeSelection ; /* see: http://nocash.emubase.de/gbatek.htm#dsvideobgmodescontrol */ - affineModeSelection = (bgCnt.Palette_256 << 1) | (bgCnt.CharacBase_Block & 1) ; + affineModeSelection = (bgCnt->Palette_256 << 1) | (bgCnt->CharacBase_Block & 1) ; // printf("extrot mode %d\n", affineModeSelection); switch(affineModeSelection) { @@ -1002,39 +1217,52 @@ void lineText(GPU * gpu, u8 num, u16 l, u8 * DST) { - renderline_textBG(gpu, num, DST, l, gpu->BGSX[num], l + gpu->BGSY[num], 256); + BGxOFS * ofs = &gpu->dispx_st->dispx_BGxOFS[num]; + renderline_textBG(gpu, num, DST, l, T1ReadWord(&ofs->BGxHOFS, 0), l + T1ReadWord(&ofs->BGxVOFS, 0), 256); } void lineRot(GPU * gpu, u8 num, u16 l, u8 * DST) -{ +{ + BGxPARMS * parms; + if (num==2) { + parms = &(gpu->dispx_st)->dispx_BG2PARMS; + } else { + parms = &(gpu->dispx_st)->dispx_BG3PARMS; + } rotBG2(gpu, num, DST, l, - gpu->BGX[num], - gpu->BGY[num], - gpu->BGPA[num], - gpu->BGPB[num], - gpu->BGPC[num], - gpu->BGPD[num], + parms->BGxX, + parms->BGxY, + parms->BGxPA, + parms->BGxPB, + parms->BGxPC, + parms->BGxPD, 256); } void lineExtRot(GPU * gpu, u8 num, u16 l, u8 * DST) { + BGxPARMS * parms; + if (num==2) { + parms = &(gpu->dispx_st)->dispx_BG2PARMS; + } else { + parms = &(gpu->dispx_st)->dispx_BG3PARMS; + } extRotBG2(gpu, num, DST, l, - gpu->BGX[num], - gpu->BGY[num], - gpu->BGPA[num], - gpu->BGPB[num], - gpu->BGPC[num], - gpu->BGPD[num], + parms->BGxX, + parms->BGxY, + parms->BGxPA, + parms->BGxPB, + parms->BGxPC, + parms->BGxPD, 256); } -void textBG(GPU * gpu, u8 num, u8 * DST) +void textBG(const GPU * gpu, u8 num, u8 * DST) { u32 i; for(i = 0; i < gpu->BGSize[num][1]; ++i) { - renderline_textBG(gpu, num, DST + i*gpu->BGSize[num][0], i, 0, i, gpu->BGSize[num][0]); + renderline_textBG(gpu, num, DST + i*gpu->BGSize[num][0]*2, i, 0, i, gpu->BGSize[num][0]); } } @@ -1042,14 +1270,14 @@ { u32 i; for(i = 0; i < gpu->BGSize[num][1]; ++i) - rotBG2(gpu, num, DST + i*gpu->BGSize[num][0], i, 0, 0, 256, 0, 0, 256, gpu->BGSize[num][0]); + rotBG2(gpu, num, DST + i*gpu->BGSize[num][0]*2, i, 0, 0, 256, 0, 0, 256, gpu->BGSize[num][0]); } void extRotBG(GPU * gpu, u8 num, u8 * DST) { u32 i; for(i = 0; i < gpu->BGSize[num][1]; ++i) - extRotBG2(gpu, num, DST + i*gpu->BGSize[num][0], i, 0, 0, 256, 0, 0, 256, gpu->BGSize[num][0]); + extRotBG2(gpu, num, DST + i*gpu->BGSize[num][0]*2, i, 0, 0, 256, 0, 0, 256, gpu->BGSize[num][0]); } @@ -1065,7 +1293,7 @@ if ((cond)&&(prio<=prioTab[sprX])) \ { \ /* if we don't draw, do not set prio, or else */ \ - if (renderline_setFinalColor(gpu, sprX << 1,4,dst, color, sprX ,l)) \ + if (gpu->setFinalColor(gpu, sprX << 1,4,dst, color, sprX ,l)) \ prioTab[sprX] = prio; \ } @@ -1151,8 +1379,7 @@ // that tells us where the first pixel of a screenline starts in the sprite, // and how a step to the right in a screenline translates within the sprite - if ((spriteInfo->RotScale == 2) || /* rotscale == 2 => sprite disabled */ - (l<*sprY)||(l>=*sprY+sprSize->y) || /* sprite lines outside of screen */ + if ((l<*sprY)||(l>=*sprY+sprSize->y) || /* sprite lines outside of screen */ (*sprX==256)||(*sprX+sprSize->x<=0)) /* sprite pixels outside of line */ return FALSE; /* not to be drawn */ @@ -1183,18 +1410,6 @@ return TRUE; } -INLINE void compute_sprite_rotoscale(GPU * gpu, _OAM_ * spriteInfo, - u16 * rotScaleA, u16 * rotScaleB, u16 * rotScaleC, u16 * rotScaleD) { - u16 rotScaleIndex; - // index from 0 to 31 - rotScaleIndex = spriteInfo->RotScalIndex + (spriteInfo->HFlip<<1) + (spriteInfo->VFlip << 2); - /* if we need to do rotscale, gather its parameters */ - /* http://nocash.emubase.de/gbatek.htm#lcdobjoamrotationscalingparameters */ - *rotScaleA = T1ReadWord((u8*)(gpu->oam + rotScaleIndex*0x20 + 0x06),0) ; - *rotScaleB = T1ReadWord((u8*)(gpu->oam + rotScaleIndex*0x20 + 0x0E),0) ; - *rotScaleC = T1ReadWord((u8*)(gpu->oam + rotScaleIndex*0x20 + 0x16),0) ; - *rotScaleD = T1ReadWord((u8*)(gpu->oam + rotScaleIndex*0x20 + 0x1E),0) ; -} /*****************************************************************************/ // SPRITE RENDERING @@ -1202,6 +1417,7 @@ void sprite1D(GPU * gpu, u16 l, u8 * dst, u8 * prioTab) { + struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits; _OAM_ * spriteInfo = (_OAM_ *)(gpu->oam + (nbShow-1));// + 127; u8 block = gpu->sprBoundary; u16 i; @@ -1212,68 +1428,242 @@ s32 sprX, sprY, x, y, lg; int xdir; u8 prio, * src; - u16 * pal; u16 i,j; - u16 rotScaleA,rotScaleB,rotScaleC,rotScaleD; - prio = spriteInfo->Priority; - if (!compute_sprite_vars(spriteInfo, l, &sprSize, &sprX, &sprY, &x, &y, &lg, &xdir)) + // Check if sprite is disabled before everything + if (spriteInfo->RotScale == 2) continue; - if (spriteInfo->RotScale & 1) { - compute_sprite_rotoscale(gpu, spriteInfo, - &rotScaleA, &rotScaleB, &rotScaleC, &rotScaleD); - //continue; - } + prio = spriteInfo->Priority; - if (spriteInfo->Mode == 2) { - if (spriteInfo->Depth) - src = gpu->sprMem + (spriteInfo->TileIndex<>3)*sprSize.x*8) + ((y&0x7)*8); + if (spriteInfo->RotScale & 1) + { + s32 fieldX, fieldY, auxX, auxY, realX, realY, offset; + u8 blockparameter, *pal; + s16 dx, dmx, dy, dmy; + u16 colour; + + // Get sprite positions and size + sprX = (spriteInfo->X<<23)>>23; + sprY = spriteInfo->Y; + sprSize = sprSizeTab[spriteInfo->Size][spriteInfo->Shape]; + + lg = sprSize.x; + + if (sprY>=192) + sprY = (s32)((s8)(spriteInfo->Y)); + + // Copy sprite size, to check change it if needed + fieldX = sprSize.x; + fieldY = sprSize.y; + + // If we are using double size mode, double our control vars + if (spriteInfo->RotScale & 2) + { + fieldX <<= 1; + fieldY <<= 1; + lg <<= 1; + } + + // Check if sprite enabled + if ((l = sprY+fieldY) || + (sprX==256) || (sprX+fieldX<=0)) + continue; + + y = l - sprY; + + // Get which four parameter block is assigned to this sprite + blockparameter = (spriteInfo->RotScalIndex + (spriteInfo->HFlip<< 3) + (spriteInfo->VFlip << 4))*4; + + // Get rotation/scale parameters + dx = (s16)(gpu->oam + blockparameter+0)->attr3; + dmx = (s16)(gpu->oam + blockparameter+1)->attr3; + dy = (s16)(gpu->oam + blockparameter+2)->attr3; + dmy = (s16)(gpu->oam + blockparameter+3)->attr3; + + // Calculate fixed poitn 8.8 start offsets + realX = ((sprSize.x) << 7) - (fieldX >> 1)*dx - (fieldY>>1)*dmx + y * dmx; + realY = ((sprSize.y) << 7) - (fieldX >> 1)*dy - (fieldY>>1)*dmy + y * dmy; + + if(sprX<0) + { + // If sprite is not in the window + if(sprX + fieldX <= 0) + continue; + + // Otherwise, is partially visible + lg += sprX; + realX -= sprX*dx; + realY -= sprX*dy; + sprX = 0; + } else - src = gpu->sprMem + (spriteInfo->TileIndex<>3)*sprSize.x*4) + ((y&0x7)*4); - render_sprite_Win (gpu, l, src, - spriteInfo->Depth, lg, sprX, x, xdir); - continue; - } + { + if(sprX+fieldX>256) + lg = 255 - sprX; + } - if (spriteInfo->Mode == 3) /* sprite is in BMP format */ - { - /* sprMemory + sprBoundary + 16Bytes per line (8pixels a 2 bytes) */ - src = (gpu->sprMem) + (spriteInfo->TileIndex<<4) + (y<sprBMPBoundary); + // If we are using 1 palette of 256 colours + if(spriteInfo->Depth) + { + src = gpu->sprMem + (spriteInfo->TileIndex << block); - render_sprite_BMP (gpu, l, dst, (u16*)src, - prioTab, prio, lg, sprX, x, xdir); + // If extended palettes are set, use them + if (dispCnt->ExOBJPalette_Enable) + pal = (ARM9Mem.ObjExtPal[gpu->core][0]+(spriteInfo->PaletteIndex*0x200)); + else + pal = (ARM9Mem.ARM9_VMEM + 0x200 + gpu->core *0x400); - continue; - } - - if(spriteInfo->Depth) /* 256 colors */ - { - src = gpu->sprMem + (spriteInfo->TileIndex<>3)*sprSize.x*8) + ((y&0x7)*8); - - if (gpu->dispCnt.bits.ExOBJPalette_Enable) - pal = (u16*)(ARM9Mem.ObjExtPal[gpu->core][0]+(spriteInfo->PaletteIndex*0x200)); + for(i = 0; i < lg; ++i, ++sprX) + { + // Get the integer part of the fixed point 8.8, and check if it lies inside the sprite data + auxX = (realX>>8); + auxY = (realY>>8); + + if (auxX >= 0 && auxY >= 0 && auxX < sprSize.x && auxY < sprSize.y) + { + offset = (auxX&0x7) + ((auxX&0xFFF8)<<3) + ((auxY>>3)*sprSize.x*8) + ((auxY&0x7)*8); + colour = src[offset]; + + if (colour && (prioTab[sprX]>=prio)) + { + if (gpu->setFinalColor(gpu, sprX << 1, 4, dst, T1ReadWord(pal, colour<<1), sprX ,l)) + prioTab[sprX] = prio; + } + } + + // Add the rotation/scale coeficients, here the rotation/scaling + // is performed + realX += dx; + realY += dy; + } + + continue; + } + // Rotozoomed direct color + else if(spriteInfo->Mode == 3) + { + src = gpu->sprMem + (spriteInfo->TileIndex)*32; + + for(i = 0; i < lg; ++i, ++sprX) + { + // Get the integer part of the fixed point 8.8, and check if it lies inside the sprite data + auxX = (realX>>8); + auxY = (realY>>8); + + if (auxX >= 0 && auxY >= 0 && auxX < sprSize.x && auxY < sprSize.y) + { + offset = (auxX) + (auxY<<5); + colour = T1ReadWord (src, offset<<1); + + if((colour&0x8000) && (prioTab[sprX]>=prio)) + { + if (gpu->setFinalColor(gpu, sprX << 1, 4, dst, colour, sprX ,l)) + prioTab[sprX] = prio; + } + } + + // Add the rotation/scale coeficients, here the rotation/scaling + // is performed + realX += dx; + realY += dy; + } + + continue; + } + // Rotozoomed 16/16 palette else - pal = (u16*)(ARM9Mem.ARM9_VMEM + 0x200 + gpu->core *0x400); - - render_sprite_256 (gpu, l, dst, src, pal, - prioTab, prio, lg, sprX, x, xdir); + { + pal = ARM9Mem.ARM9_VMEM + 0x200 + gpu->core*0x400 + (spriteInfo->PaletteIndex*32); + src = gpu->sprMem + (spriteInfo->TileIndex<sprBoundary); - continue; + for(i = 0; i < lg; ++i, ++sprX) + { + // Get the integer part of the fixed point 8.8, and check if it lies inside the sprite data + auxX = (realX>>8); + auxY = (realY>>8); + + if (auxX >= 0 && auxY >= 0 && auxX < sprSize.x && auxY < sprSize.y) + { + offset = ((auxX>>1)&0x3) + (((auxX>>1)&0xFFFC)<<3) + ((auxY>>3)*sprSize.x)*4 + ((auxY&0x7)*4); + colour = src[offset]; + + // Get 4bits value from the readed 8bits + if (auxX&1) colour >>= 4; + else colour &= 0xF; + + if(colour && (prioTab[sprX]>=prio)) + { + if (gpu->setFinalColor(gpu, sprX << 1, 4, dst, T1ReadWord(pal, colour<<1), sprX ,l)) + prioTab[sprX] = prio; + } + } + + // Add the rotation/scale coeficients, here the rotation/scaling + // is performed + realX += dx; + realY += dy; + } + + continue; + } } - /* 16 colors */ - src = gpu->sprMem + (spriteInfo->TileIndex<>3)*sprSize.x*4) + ((y&0x7)*4); - pal = (u16*)(ARM9Mem.ARM9_VMEM + 0x200 + gpu->core * 0x400); + else + { + u16 * pal; + + if (!compute_sprite_vars(spriteInfo, l, &sprSize, &sprX, &sprY, &x, &y, &lg, &xdir)) + continue; + + if (spriteInfo->Mode == 2) { + if (spriteInfo->Depth) + src = gpu->sprMem + (spriteInfo->TileIndex<>3)*sprSize.x*8) + ((y&0x7)*8); + else + src = gpu->sprMem + (spriteInfo->TileIndex<>3)*sprSize.x*4) + ((y&0x7)*4); + render_sprite_Win (gpu, l, src, + spriteInfo->Depth, lg, sprX, x, xdir); + continue; + } + + if (spriteInfo->Mode == 3) /* sprite is in BMP format */ + { + /* sprMemory + sprBoundary + 16Bytes per line (8pixels a 2 bytes) */ + src = (gpu->sprMem) + (spriteInfo->TileIndex<<4) + (y<sprBMPBoundary); + + render_sprite_BMP (gpu, l, dst, (u16*)src, + prioTab, prio, lg, sprX, x, xdir); + + continue; + } + + if(spriteInfo->Depth) /* 256 colors */ + { + src = gpu->sprMem + (spriteInfo->TileIndex<>3)*sprSize.x*8) + ((y&0x7)*8); - pal += (spriteInfo->PaletteIndex<<4); - render_sprite_16 (gpu, l, dst, src, pal, - prioTab, prio, lg, sprX, x, xdir); + if (dispCnt->ExOBJPalette_Enable) + pal = (u16*)(ARM9Mem.ObjExtPal[gpu->core][0]+(spriteInfo->PaletteIndex*0x200)); + else + pal = (u16*)(ARM9Mem.ARM9_VMEM + 0x200 + gpu->core *0x400); + + render_sprite_256 (gpu, l, dst, src, pal, + prioTab, prio, lg, sprX, x, xdir); + continue; + } + /* 16 colors */ + src = gpu->sprMem + (spriteInfo->TileIndex<>3)*sprSize.x*4) + ((y&0x7)*4); + pal = (u16*)(ARM9Mem.ARM9_VMEM + 0x200 + gpu->core * 0x400); + + pal += (spriteInfo->PaletteIndex<<4); + render_sprite_16 (gpu, l, dst, src, pal, + prioTab, prio, lg, sprX, x, xdir); + } } } void sprite2D(GPU * gpu, u16 l, u8 * dst, u8 * prioTab) { + struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits; _OAM_ * spriteInfo = (_OAM_*)(gpu->oam + (nbShow-1));// + 127; u16 i; @@ -1283,63 +1673,235 @@ s32 sprX, sprY, x, y, lg; int xdir; u8 prio, * src; - u16 * pal; + //u16 * pal; u16 i,j; - u16 rotScaleA,rotScaleB,rotScaleC,rotScaleD; - int block; - prio = spriteInfo->Priority; - - if (!compute_sprite_vars(spriteInfo, l, &sprSize, &sprX, &sprY, &x, &y, &lg, &xdir)) + // Check if sprite is disabled before everything + if (spriteInfo->RotScale == 2) continue; + + prio = spriteInfo->Priority; - if (spriteInfo->RotScale & 1) { - compute_sprite_rotoscale(gpu, spriteInfo, - &rotScaleA, &rotScaleB, &rotScaleC, &rotScaleD); - //continue; - } + if (spriteInfo->RotScale & 1) + { + s32 fieldX, fieldY, auxX, auxY, realX, realY, offset; + u8 blockparameter, *pal; + s16 dx, dmx, dy, dmy; + u16 colour; + + // Get sprite positions and size + sprX = (spriteInfo->X<<23)>>23; + sprY = spriteInfo->Y; + sprSize = sprSizeTab[spriteInfo->Size][spriteInfo->Shape]; - if (spriteInfo->Mode == 2) { - if (spriteInfo->Depth) - src = gpu->sprMem + ((spriteInfo->TileIndex)<<5) + ((y>>3)<<10) + ((y&0x7)*8); + lg = sprSize.x; + + if (sprY>=192) + sprY = (s32)((s8)(spriteInfo->Y)); + + // Copy sprite size, to check change it if needed + fieldX = sprSize.x; + fieldY = sprSize.y; + + // If we are using double size mode, double our control vars + if (spriteInfo->RotScale & 2) + { + fieldX <<= 1; + fieldY <<= 1; + lg <<= 1; + } + + // Check if sprite enabled + if ((l = sprY+fieldY) || + (sprX==256) || (sprX+fieldX<=0)) + continue; + + y = l - sprY; + + // Get which four parameter block is assigned to this sprite + blockparameter = (spriteInfo->RotScalIndex + (spriteInfo->HFlip<< 3) + (spriteInfo->VFlip << 4))*4; + + // Get rotation/scale parameters + dx = (s16)(gpu->oam + blockparameter+0)->attr3; + dmx = (s16)(gpu->oam + blockparameter+1)->attr3; + dy = (s16)(gpu->oam + blockparameter+2)->attr3; + dmy = (s16)(gpu->oam + blockparameter+3)->attr3; + + // Calculate fixed poitn 8.8 start offsets + realX = ((sprSize.x) << 7) - (fieldX >> 1)*dx - (fieldY>>1)*dmx + y * dmx; + realY = ((sprSize.y) << 7) - (fieldX >> 1)*dy - (fieldY>>1)*dmy + y * dmy; + + if(sprX<0) + { + // If sprite is not in the window + if(sprX + fieldX <= 0) + continue; + + // Otherwise, is partially visible + lg += sprX; + realX -= sprX*dx; + realY -= sprX*dy; + sprX = 0; + } else - src = gpu->sprMem + ((spriteInfo->TileIndex)<<5) + ((y>>3)<<10) + ((y&0x7)*4); - render_sprite_Win (gpu, l, src, - spriteInfo->Depth, lg, sprX, x, xdir); - continue; - } + { + if(sprX+fieldX>256) + lg = 255 - sprX; + } - if (spriteInfo->Mode == 3) /* sprite is in BMP format */ - { - if (gpu->dispCnt.bits.OBJ_BMP_2D_dim) // 256*256 - src = (gpu->sprMem) + (((spriteInfo->TileIndex&0x3F0) * 64 + (spriteInfo->TileIndex&0x0F) *8 + ( y << 8)) << 1); - else // 128 * 512 - src = (gpu->sprMem) + (((spriteInfo->TileIndex&0x3E0) * 64 + (spriteInfo->TileIndex&0x1F) *8 + ( y << 8)) << 1); - - render_sprite_BMP (gpu, l, dst, (u16*)src, - prioTab, prio, lg, sprX, x, xdir); + // If we are using 1 palette of 256 colours + if(spriteInfo->Depth) + { + src = gpu->sprMem + ((spriteInfo->TileIndex) << 5); - continue; - } + // If extended palettes are set, use them + if (dispCnt->ExOBJPalette_Enable) + pal = (ARM9Mem.ObjExtPal[gpu->core][0]+(spriteInfo->PaletteIndex*0x200)); + else + pal = (ARM9Mem.ARM9_VMEM + 0x200 + gpu->core *0x400); - if(spriteInfo->Depth) /* 256 colors */ + for(i = 0; i < lg; ++i, ++sprX) + { + // Get the integer part of the fixed point 8.8, and check if it lies inside the sprite data + auxX = (realX>>8); + auxY = (realY>>8); + + if (auxX >= 0 && auxY >= 0 && auxX < sprSize.x && auxY < sprSize.y) + { + offset = (auxX&0x7) + ((auxX&0xFFF8)<<3) + ((auxY>>3)<<10) + ((auxY&0x7)*8); + colour = src[offset]; + + if (colour && (prioTab[sprX]>=prio)) + { + if (gpu->setFinalColor(gpu, sprX << 1, 4, dst, T1ReadWord(pal, colour<<1), sprX ,l)) + prioTab[sprX] = prio; + } + } + + // Add the rotation/scale coeficients, here the rotation/scaling + // is performed + realX += dx; + realY += dy; + } + + continue; + } + // Rotozoomed direct color + else if(spriteInfo->Mode == 3) + { + src = gpu->sprMem + (((spriteInfo->TileIndex&0x03E0) * 8) + (spriteInfo->TileIndex&0x001F))*16; + + for(i = 0; i < lg; ++i, ++sprX) + { + // Get the integer part of the fixed point 8.8, and check if it lies inside the sprite data + auxX = (realX>>8); + auxY = (realY>>8); + + if (auxX >= 0 && auxY >= 0 && auxX < sprSize.x && auxY < sprSize.y) + { + offset = auxX + (auxY<<8); + colour = T1ReadWord(src, offset<<1); + + if((colour&0x8000) && (prioTab[sprX]>=prio)) + { + if (gpu->setFinalColor(gpu, sprX << 1, 4, dst, colour, sprX ,l)) + prioTab[sprX] = prio; + } + } + + // Add the rotation/scale coeficients, here the rotation/scaling + // is performed + realX += dx; + realY += dy; + } + + continue; + } + // Rotozoomed 16/16 palette + else + { + src = gpu->sprMem + (spriteInfo->TileIndex<<5); + pal = ARM9Mem.ARM9_VMEM + 0x200 + (gpu->core*0x400 + (spriteInfo->PaletteIndex*32)); + + for(i = 0; i < lg; ++i, ++sprX) + { + // Get the integer part of the fixed point 8.8, and check if it lies inside the sprite data + auxX = (realX>>8); + auxY = (realY>>8); + + if (auxX >= 0 && auxY >= 0 && auxX < sprSize.x && auxY < sprSize.y) + { + offset = ((auxX>>1)&0x3) + (((auxX>>1)&0xFFFC)<<3) + ((auxY>>3)<<10) + ((auxY&0x7)*4); + colour = src[offset]; + + if (auxX&1) colour >>= 4; + else colour &= 0xF; + + if(colour && (prioTab[sprX]>=prio)) + { + if (gpu->setFinalColor(gpu, sprX << 1,4,dst, T1ReadWord (pal, colour<<1), sprX ,l)) + prioTab[sprX] = prio; + } + } + + // Add the rotation/scale coeficients, here the rotation/scaling + // is performed + realX += dx; + realY += dy; + } + + continue; + } + } + else { - src = gpu->sprMem + ((spriteInfo->TileIndex)<<5) + ((y>>3)<<10) + ((y&0x7)*8); - pal = (u16*)(ARM9Mem.ARM9_VMEM + 0x200 + gpu->core *0x400); - - render_sprite_256 (gpu, l, dst, src, pal, - prioTab, prio, lg, sprX, x, xdir); + u16 *pal; - continue; + if (!compute_sprite_vars(spriteInfo, l, &sprSize, &sprX, &sprY, &x, &y, &lg, &xdir)) + continue; + + if (spriteInfo->Mode == 2) { + if (spriteInfo->Depth) + src = gpu->sprMem + ((spriteInfo->TileIndex)<<5) + ((y>>3)<<10) + ((y&0x7)*8); + else + src = gpu->sprMem + ((spriteInfo->TileIndex)<<5) + ((y>>3)<<10) + ((y&0x7)*4); + render_sprite_Win (gpu, l, src, + spriteInfo->Depth, lg, sprX, x, xdir); + continue; + } + + if (spriteInfo->Mode == 3) /* sprite is in BMP format */ + { + if (dispCnt->OBJ_BMP_2D_dim) // 256*256 + src = (gpu->sprMem) + (((spriteInfo->TileIndex&0x3F0) * 64 + (spriteInfo->TileIndex&0x0F) *8 + ( y << 8)) << 1); + else // 128 * 512 + src = (gpu->sprMem) + (((spriteInfo->TileIndex&0x3E0) * 64 + (spriteInfo->TileIndex&0x1F) *8 + ( y << 8)) << 1); + + render_sprite_BMP (gpu, l, dst, (u16*)src, + prioTab, prio, lg, sprX, x, xdir); + + continue; + } + + if(spriteInfo->Depth) /* 256 colors */ + { + src = gpu->sprMem + ((spriteInfo->TileIndex)<<5) + ((y>>3)<<10) + ((y&0x7)*8); + pal = (u16*)(ARM9Mem.ARM9_VMEM + 0x200 + gpu->core *0x400); + + render_sprite_256 (gpu, l, dst, src, pal, + prioTab, prio, lg, sprX, x, xdir); + + continue; + } + + /* 16 colors */ + src = gpu->sprMem + ((spriteInfo->TileIndex)<<5) + ((y>>3)<<10) + ((y&0x7)*4); + pal = (u16*)(ARM9Mem.ARM9_VMEM + 0x200 + gpu->core * 0x400); + + pal += (spriteInfo->PaletteIndex<<4); + render_sprite_16 (gpu, l, dst, src, pal, + prioTab, prio, lg, sprX, x, xdir); } - - /* 16 colors */ - src = gpu->sprMem + ((spriteInfo->TileIndex)<<5) + ((y>>3)<<10) + ((y&0x7)*4); - pal = (u16*)(ARM9Mem.ARM9_VMEM + 0x200 + gpu->core * 0x400); - - pal += (spriteInfo->PaletteIndex<<4); - render_sprite_16 (gpu, l, dst, src, pal, - prioTab, prio, lg, sprX, x, xdir); } } @@ -1462,7 +2024,7 @@ // #define BRIGHT_TABLES void calc_bright_colors() { - int base = /*gpu->masterBright.bits.FactorEx? 63:*/ 31 ; + int base = 31 ; int factor; u16 red, green, blue; COLOR color_more, color_less, color_ref; @@ -1495,25 +2057,24 @@ #undef FORMULA_LESS } -void GPU_ligne(Screen * screen, u16 l) +void GPU_ligne(NDS_Screen * screen, u16 l) { - struct _DISPCAPCNT * capcnt; GPU * gpu = screen->gpu; + struct _DISPCAPCNT * capcnt; + struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits; + struct _MASTER_BRIGHT * mBright; u8 * dst = GPU_screen + (screen->offset + l) * 512; u8 * mdst = GPU_screen + (MainScreen.offset + l) * 512; u8 * sdst = GPU_screen + (SubScreen.offset + l) * 512; itemsForPriority_t * item; u8 spr[512]; u8 sprPrio[256]; - u8 bgprio,prio; + u8 prio; int i; + int ix; int vram_bank; - u8 i8; u16 i16; u32 c; - u8 n,p; - - u8 *dest; /* initialize the scanline black */ /* not doing this causes invalid colors when all active BGs are prevented to draw at some place */ @@ -1534,7 +2095,7 @@ u8 * vram; /* we only draw one of the VRAM blocks */ - vram_bank = gpu->dispCnt.bits.VRAM_Block ; + vram_bank = dispCnt->VRAM_Block ; // This probably only needs to be calculated once per frame, but at least it's better than before >_< if (MMU.vram_mode[vram_bank] & 4) @@ -1599,10 +2160,20 @@ prio--; item = &(gpu->itemsForPriority[prio]); // render BGs - for (i=0; i < item->nbBGs; i++) { + for (i=0; i < item->nbBGs; i++) + { i16 = item->BGs[i]; - if (gpu->LayersEnable[i16]) - modeRender[gpu->dispCnt.bits.BG_Mode][i16](gpu, i16, l, dst); + + // If BG0, core A, and 3D is enabled, ask the gpu3D plugin for data + if (i16 == 0 && dispCnt->BG0_3D && gpu->core == 0) + { + gpu3D->NDS_3D_GetLine (l, (u16*)dst); + } + else + { + if (gpu->LayersEnable[i16]) + modeRender[dispCnt->BG_Mode][i16](gpu, i16, l, dst); + } } // render sprite Pixels for (i=0; i < item->nbPixelsX; i++) { @@ -1610,9 +2181,99 @@ T2WriteWord(dst, i16 << 1, T2ReadWord(spr, i16 << 1)); } } + + /* DISPCAP */ + /* TODO: Capture source B and A+B */ + if(gpu->core == GPU_MAIN) /* capture only for main gpu */ + { + capcnt = &gpu->dispCapCnt.bits; + if (capcnt->Capture_Enable) + { + int capx, capy; + u8 *capDst; + + /* find the dimensions of the capture */ + switch(capcnt->Capture_Size) /* TODO: it could be done only once, when writting to dispcap register */ + { + case 0: + capx = 128; + capy = 128; + break; + case 1: + capx = 256; + capy = 64; + break; + case 2: + capx = 256; + capy = 128; + case 3: + capx = 256; + capy = 192; + break; + } + + if(l < capy) /* check if our line is in cature area */ + { + /* calculate VRAM destination address */ + capDst = (ARM9Mem.ARM9_LCD + + (capcnt->VRAM_Write_Block * 0x20000) + + ((dispCnt->BG_Mode != 2) ? (capcnt->VRAM_Write_Offset * 0x8000) : 0) + + l * capx * 2); /* read offset ignored in VRAM display mode*/ + +// LOG("Capture line %d (%X) [dst: %X]...\n", l, gpu->dispCapCnt.val, capDst - ARM9Mem.ARM9_LCD); + + switch(capcnt->Capture_Source) + { + case 0: /* source A only */ + if(capcnt->Source_A == 1) /* capture 3D only */ + { + u16 cap3DLine[256]; /* temp buffer for 3D line reading */ + gpu3D->NDS_3D_GetLine (l, cap3DLine); /*FIXME: not sure it's good, since I hadn't seen how 3D works in desmume */ + for(i = 0; i < capx; i++) T1WriteWord(capDst, i, cap3DLine[i]); /* copy this line to buffer */ + } + else /* capture all screen (BG + OBJ + 3D) */ + { + for(i = 0; i < capx; i++) T1WriteWord(capDst, i, T2ReadWord(dst, i)); /* plain copy from screen to buffer */ + } + + break; + case 1: /* source B only */ + if(capcnt->Source_B == 1) /* capture from display FIFO */ + { + /* TODO ... */ + } + else /* capture from VRAM */ + { + /* calculate vram source address */ + u8 *capSrc = (ARM9Mem.ARM9_LCD + + (dispCnt->VRAM_Block * 0x20000) + + ((dispCnt->BG_Mode != 2) ? (capcnt->VRAM_Write_Offset * 0x8000) : 0) + + l * capx * 2); /* write offset ignored in VRAM display mode*/ + + for(i = 0; i < capx; i++) T1WriteWord(capDst, i, T2ReadWord(capSrc, i)); /* plain copy from source to dest */ + } + + break; + case 2: /* source A + B (using blending) */ + case 3: + + /* TODO... (the above code will need modifications in order to avoid redudance) */ + GPULOG("Unhandled capture source: %d\n", capcnt->Capture_Source); /* TODO */ + } + + if(l + 1 == capy) /* if it was the last line, we're done !*/ + { + capcnt->Capture_Enable = 0; /* done, now capture is disabled */ + T1WriteLong(ARM9Mem.ARM9_REG, 0x64, gpu->dispCapCnt.val); + } + } + } + } // FIXME !!! /* capture */ +#if 0 +// to be done with opengl capcnt = &gpu->dispCapCnt.bits; if (capcnt->Capture_Enable) { @@ -1631,7 +2292,7 @@ srcA = (u16*)dst; if (!capcnt->Source_B) { - vram_bank = gpu->dispCnt.bits.VRAM_Block ; + vram_bank = dispCnt->VRAM_Block ; if (MMU.vram_mode[vram_bank] & 4) { srcB = (u16*)(ARM9Mem.ARM9_LCD + (MMU.vram_mode[vram_bank] & 3) * 0x20000 @@ -1702,17 +2363,26 @@ break; } } +#endif /* end of capture */ -// Apply final brightness adjust (MASTER_BRIGHT) -// Reference: http://nocash.emubase.de/gbatek.htm#dsvideo (Under MASTER_BRIGHTNESS) -/* Mightymax> it should be more effective if the windowmanager applies brightness when drawing */ -/* it will most likly take acceleration, while we are stuck here with CPU power */ +#ifndef HAVE_LIBGDKGLEXT_X11_1_0 +// damdoum : +// brightness done with opengl +// test are ok (gfx_test_brightness) +// now, if we are going to support 3D, this becomes dead code +// because it is obvious we'll use openGL / mesa3D #ifdef BRIGHT_TABLES calc_bright_colors(); #endif - switch (gpu->masterBright.bits.Mode) + +// Apply final brightness adjust (MASTER_BRIGHT) +// Reference: http://nocash.emubase.de/gbatek.htm#dsvideo (Under MASTER_BRIGHTNESS) +/* Mightymax> it should be more effective if the windowmanager applies brightness when drawing */ +/* it will most likly take acceleration, while we are stuck here with CPU power */ + + switch (gpu->MasterBrightMode) { // Disabled case 0: @@ -1722,38 +2392,31 @@ case 1: { COLOR dstColor; - unsigned int masterBrightFactor = gpu->masterBright.bits.Factor; + unsigned int masterBrightFactor = gpu->MasterBrightFactor; u16 * colors = bright_more_colors[masterBrightFactor]; - if (gpu->masterBright.bits.FactorEx) - { - /* the formular would create only white, as (r + (31-r)) = 31 */ - /* white = enable all bits */ - memset(dst,0xFF, 256*2 /* sizeof(COLOR) */) ; - } else { - /* when we wont do anything, we dont need to loop */ - if (!masterBrightFactor) break ; + /* when we wont do anything, we dont need to loop */ + if (!masterBrightFactor) break ; - for(i16 = 0; i16 < 256; ++i16) - { + for(i16 = 0; i16 < 256; ++i16) + { #ifndef BRIGHT_TABLES - u8 base ; - u8 r,g,b; // get components, 5bit each - dstColor.val = T1ReadWord(dst, i16 << 1); - r = dstColor.bits.red; - g = dstColor.bits.green; - b = dstColor.bits.blue; - // Bright up and clamp to 5bit <-- automatic - base = /*gpu->masterBright.bits.FactorEx? 63:*/ 31 ; - dstColor.bits.red = r + ((base-r)*masterBrightFactor)/16; - dstColor.bits.green = g + ((base-g)*masterBrightFactor)/16; - dstColor.bits.blue = b + ((base-b)*masterBrightFactor)/16; + u8 base ; + u8 r,g,b; // get components, 5bit each + dstColor.val = T1ReadWord(dst, i16 << 1); + r = dstColor.bits.red; + g = dstColor.bits.green; + b = dstColor.bits.blue; + // Bright up and clamp to 5bit <-- automatic + base = 31 ; + dstColor.bits.red = r + ((base-r)*masterBrightFactor)/16; + dstColor.bits.green = g + ((base-g)*masterBrightFactor)/16; + dstColor.bits.blue = b + ((base-b)*masterBrightFactor)/16; #else - dstColor.val = T1ReadWord(dst, i16 << 1); - dstColor.bitx.bgr = colors[dstColor.bitx.bgr]; + dstColor.val = T1ReadWord(dst, i16 << 1); + dstColor.bitx.bgr = colors[dstColor.bitx.bgr]; #endif - T2WriteWord (dst, i16 << 1, dstColor.val); - } + T2WriteWord (dst, i16 << 1, dstColor.val); } break; } @@ -1779,36 +2442,29 @@ */ COLOR dstColor; - unsigned int masterBrightFactor = gpu->masterBright.bits.Factor ; + unsigned int masterBrightFactor = gpu->MasterBrightFactor; u16 * colors = bright_less_colors[masterBrightFactor]; - if (gpu->masterBright.bits.FactorEx) - { - /* the formular would create only black, as (r - r) = 0 */ - /* black = disable all bits */ - memset(dst,0, 256*2 /* sizeof(COLOR) */) ; - } else - { - /* when we wont do anything, we dont need to loop */ - if (!masterBrightFactor) break ; + /* when we wont do anything, we dont need to loop */ + if (!masterBrightFactor) break; - for(i16 = 0; i16 < 256; ++i16) - { + for(i16 = 0; i16 < 256; ++i16) + { #ifndef BRIGHT_TABLES - u8 r,g,b; - r = dstColor.bits.red; - g = dstColor.bits.green; - b = dstColor.bits.blue; - // Bright up and clamp to 5bit <- automatic - dstColor.bits.red = r - (r*masterBrightFactor)/16; - dstColor.bits.green = g - (g*masterBrightFactor)/16; - dstColor.bits.blue = b - (b*masterBrightFactor)/16; + u8 r,g,b; + dstColor.val = T1ReadWord(dst, i16 << 1); + r = dstColor.bits.red; + g = dstColor.bits.green; + b = dstColor.bits.blue; + // Bright up and clamp to 5bit <- automatic + dstColor.bits.red = r - (r*masterBrightFactor)/16; + dstColor.bits.green = g - (g*masterBrightFactor)/16; + dstColor.bits.blue = b - (b*masterBrightFactor)/16; #else - dstColor.val = T1ReadWord(dst, i16 << 1); - dstColor.bitx.bgr = colors[dstColor.bitx.bgr]; + dstColor.val = T1ReadWord(dst, i16 << 1); + dstColor.bitx.bgr = colors[dstColor.bitx.bgr]; #endif - T2WriteWord (dst, i16 << 1, dstColor.val); - } + T2WriteWord (dst, i16 << 1, dstColor.val); } break; } @@ -1817,4 +2473,5 @@ case 3: break; } +#endif } diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/GPU.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/GPU.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/GPU.h 2007-01-28 05:02:13.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/GPU.h 2007-08-11 14:23:44.000000000 -0500 @@ -1,25 +1,25 @@ /* Copyright (C) 2006 yopyop - yopyop156@ifrance.com - yopyop156.ifrance.com + yopyop156@ifrance.com + yopyop156.ifrance.com - Copyright (C) 2006-2007 Theo Berkau - Copyright (C) 2007 shash + Copyright (C) 2006-2007 Theo Berkau + Copyright (C) 2007 shash - This file is part of DeSmuME + This file is part of DeSmuME - DeSmuME 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. - - DeSmuME 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 DeSmuME; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef GPU_H @@ -30,12 +30,371 @@ #include "mem.h" #include "registers.h" #include "FIFO.h" +#include "MMU.h" #ifdef __cplusplus extern "C" { #endif +/******************************************************************************* + this structure is for display control, + it holds flags for general display +*******************************************************************************/ + +#ifdef WORDS_BIGENDIAN +struct _DISPCNT +{ +/* 7*/ u8 ForceBlank:1; // A+B: +/* 6*/ u8 OBJ_BMP_mapping:1; // A+B: 0=2D (128KB), 1=1D (128..256KB) +/* 5*/ u8 OBJ_BMP_2D_dim:1; // A+B: 0=128x512, 1=256x256 pixels +/* 4*/ u8 OBJ_Tile_1D:1; // A+B: 0=2D (32KB), 1=1D (32..256KB) +/* 3*/ u8 BG0_3D:1; // A : 0=2D, 1=3D +/* 0*/ u8 BG_Mode:3; // A+B: +/*15*/ u8 WinOBJ_Enable:1; // A+B: 0=disable, 1=Enable +/*14*/ u8 Win1_Enable:1; // A+B: 0=disable, 1=Enable +/*13*/ u8 Win0_Enable:1; // A+B: 0=disable, 1=Enable +/*12*/ u8 OBJ_Enable:1; // A+B: 0=disable, 1=Enable +/*11*/ u8 BG3_Enable:1; // A+B: 0=disable, 1=Enable +/*10*/ u8 BG2_Enable:1; // A+B: 0=disable, 1=Enable +/* 9*/ u8 BG1_Enable:1; // A+B: 0=disable, 1=Enable +/* 8*/ u8 BG0_Enable:1; // A+B: 0=disable, 1=Enable +/*23*/ u8 OBJ_HBlank_process:1; // A+B: OBJ processed during HBlank (GBA bit5) +/*22*/ u8 OBJ_BMP_1D_Bound:1; // A : +/*20*/ u8 OBJ_Tile_1D_Bound:2; // A+B: +/*18*/ u8 VRAM_Block:2; // A : VRAM block (0..3=A..D) + +/*16*/ u8 DisplayMode:2; // A+B: coreA(0..3) coreB(0..1) GBA(Green Swap) + // 0=off (white screen) + // 1=on (normal BG & OBJ layers) + // 2=VRAM display (coreA only) + // 3=RAM display (coreA only, DMA transfers) + +/*31*/ u8 ExOBJPalette_Enable:1; // A+B: 0=disable, 1=Enable OBJ extended Palette +/*30*/ u8 ExBGxPalette_Enable:1; // A+B: 0=disable, 1=Enable BG extended Palette +/*27*/ u8 ScreenBase_Block:3; // A : Screen Base (64K step) +/*24*/ u8 CharacBase_Block:3; // A : Character Base (64K step) +}; +#else +struct _DISPCNT +{ +/* 0*/ u8 BG_Mode:3; // A+B: +/* 3*/ u8 BG0_3D:1; // A : 0=2D, 1=3D +/* 4*/ u8 OBJ_Tile_1D:1; // A+B: 0=2D (32KB), 1=1D (32..256KB) +/* 5*/ u8 OBJ_BMP_2D_dim:1; // A+B: 0=128x512, 1=256x256 pixels +/* 6*/ u8 OBJ_BMP_mapping:1; // A+B: 0=2D (128KB), 1=1D (128..256KB) + + // 7-15 same as GBA +/* 7*/ u8 ForceBlank:1; // A+B: +/* 8*/ u8 BG0_Enable:1; // A+B: 0=disable, 1=Enable +/* 9*/ u8 BG1_Enable:1; // A+B: 0=disable, 1=Enable +/*10*/ u8 BG2_Enable:1; // A+B: 0=disable, 1=Enable +/*11*/ u8 BG3_Enable:1; // A+B: 0=disable, 1=Enable +/*12*/ u8 OBJ_Enable:1; // A+B: 0=disable, 1=Enable +/*13*/ u8 Win0_Enable:1; // A+B: 0=disable, 1=Enable +/*14*/ u8 Win1_Enable:1; // A+B: 0=disable, 1=Enable +/*15*/ u8 WinOBJ_Enable:1; // A+B: 0=disable, 1=Enable + +/*16*/ u8 DisplayMode:2; // A+B: coreA(0..3) coreB(0..1) GBA(Green Swap) + // 0=off (white screen) + // 1=on (normal BG & OBJ layers) + // 2=VRAM display (coreA only) + // 3=RAM display (coreA only, DMA transfers) + +/*18*/ u8 VRAM_Block:2; // A : VRAM block (0..3=A..D) +/*20*/ u8 OBJ_Tile_1D_Bound:2; // A+B: +/*22*/ u8 OBJ_BMP_1D_Bound:1; // A : +/*23*/ u8 OBJ_HBlank_process:1; // A+B: OBJ processed during HBlank (GBA bit5) +/*24*/ u8 CharacBase_Block:3; // A : Character Base (64K step) +/*27*/ u8 ScreenBase_Block:3; // A : Screen Base (64K step) +/*30*/ u8 ExBGxPalette_Enable:1; // A+B: 0=disable, 1=Enable BG extended Palette +/*31*/ u8 ExOBJPalette_Enable:1; // A+B: 0=disable, 1=Enable OBJ extended Palette +}; +#endif + +typedef union +{ + struct _DISPCNT bits; + u32 val; +} DISPCNT; +#define BGxENABLED(cnt,num) ((num<8)? ((cnt.val>>8) & num):0) + + + + +/******************************************************************************* + this structure is for display control of a specific layer, + there are 4 background layers + their priority indicate which one to draw on top of the other + some flags indicate special drawing mode, size, FX +*******************************************************************************/ + +#ifdef WORDS_BIGENDIAN +struct _BGxCNT +{ +/* 7*/ u8 Palette_256:1; // 0=16x16, 1=1*256 palette +/* 6*/ u8 Mosaic_Enable:1; // 0=disable, 1=Enable mosaic +/* 2*/ u8 CharacBase_Block:4; // individual character base offset (n*16KB) +/* 0*/ u8 Priority:2; // 0..3=high..low +/*14*/ u8 ScreenSize:2; // text : 256x256 512x256 256x512 512x512 + // x/rot/s : 128x128 256x256 512x512 1024x1024 + // bmp : 128x128 256x256 512x256 512x512 + // large : 512x1024 1024x512 - - +/*13*/ u8 PaletteSet_Wrap:1; // BG0 extended palette set 0=set0, 1=set2 + // BG1 extended palette set 0=set1, 1=set3 + // BG2 overflow area wraparound 0=off, 1=wrap + // BG3 overflow area wraparound 0=off, 1=wrap +/* 8*/ u8 ScreenBase_Block:5; // individual screen base offset (text n*2KB, BMP n*16KB) +}; +#else +struct _BGxCNT +{ +/* 0*/ u8 Priority:2; // 0..3=high..low +/* 2*/ u8 CharacBase_Block:4; // individual character base offset (n*16KB) +/* 6*/ u8 Mosaic_Enable:1; // 0=disable, 1=Enable mosaic +/* 7*/ u8 Palette_256:1; // 0=16x16, 1=1*256 palette +/* 8*/ u8 ScreenBase_Block:5; // individual screen base offset (text n*2KB, BMP n*16KB) +/*13*/ u8 PaletteSet_Wrap:1; // BG0 extended palette set 0=set0, 1=set2 + // BG1 extended palette set 0=set1, 1=set3 + // BG2 overflow area wraparound 0=off, 1=wrap + // BG3 overflow area wraparound 0=off, 1=wrap +/*14*/ u8 ScreenSize:2; // text : 256x256 512x256 256x512 512x512 + // x/rot/s : 128x128 256x256 512x512 1024x1024 + // bmp : 128x128 256x256 512x256 512x512 + // large : 512x1024 1024x512 - - +}; +#endif + + +typedef union +{ + struct _BGxCNT bits; + u16 val; +} BGxCNT; + +/******************************************************************************* + this structure is for background offset +*******************************************************************************/ + +typedef struct { + u16 BGxHOFS; + u16 BGxVOFS; +} BGxOFS; + +/******************************************************************************* + this structure is for rotoscale parameters +*******************************************************************************/ + +typedef struct { + s16 BGxPA; + s16 BGxPB; + s16 BGxPC; + s16 BGxPD; + s32 BGxX; + s32 BGxY; +} BGxPARMS; + + +/******************************************************************************* + these structures are for window description, + windows are square regions and can "subclass" + background layers or object layers (i.e window controls the layers) + + screen + | + +-- Window0/Window1/OBJwindow/OutOfWindows + | + +-- BG0/BG1/BG2/BG3/OBJ +*******************************************************************************/ + +typedef union { + struct { + u8 end:8; + u8 start:8; + } bits ; + u16 val; +} WINxDIM; + +#ifdef WORDS_BIGENDIAN +typedef struct { +/* 6*/ u8 :2; +/* 5*/ u8 WINx_Effect_Enable:1; +/* 4*/ u8 WINx_OBJ_Enable:1; +/* 3*/ u8 WINx_BG3_Enable:1; +/* 2*/ u8 WINx_BG2_Enable:1; +/* 1*/ u8 WINx_BG1_Enable:1; +/* 0*/ u8 WINx_BG0_Enable:1; +} WINxBIT; +#else +typedef struct { +/* 0*/ u8 WINx_BG0_Enable:1; +/* 1*/ u8 WINx_BG1_Enable:1; +/* 2*/ u8 WINx_BG2_Enable:1; +/* 3*/ u8 WINx_BG3_Enable:1; +/* 4*/ u8 WINx_OBJ_Enable:1; +/* 5*/ u8 WINx_Effect_Enable:1; +/* 6*/ u8 :2; +} WINxBIT; +#endif + +#ifdef WORDS_BIGENDIAN +typedef union { + struct { + WINxBIT win0; + WINxBIT win1; + } bits; + struct { + u8 :3; + u8 win0_en:5; + u8 :3; + u8 win1_en:5; + } packed_bits; + struct { + u8 low; + u8 high; + } bytes; + u16 val ; +} WINxCNT ; +#else +typedef union { + struct { + WINxBIT win0; + WINxBIT win1; + } bits; + struct { + u8 win0_en:5; + u8 :3; + u8 win1_en:5; + u8 :3; + } packed_bits; + struct { + u8 low; + u8 high; + } bytes; + u16 val ; +} WINxCNT ; +#endif + +/* +typedef struct { + WINxDIM WIN0H; + WINxDIM WIN1H; + WINxDIM WIN0V; + WINxDIM WIN1V; + WINxCNT WININ; + WINxCNT WINOUT; +} WINCNT; +*/ + +/******************************************************************************* + this structure is for miscellanous settings + //TODO: needs further description +*******************************************************************************/ + +typedef struct { + u16 MOSAIC; + u16 unused1; + u16 unused2;//BLDCNT; + u16 unused3;//BLDALPHA; + u16 unused4;//BLDY; + u16 unused5; + /* + u16 unused6; + u16 unused7; + u16 unused8; + u16 unused9; + */ +} MISCCNT; + + +/******************************************************************************* + this structure is for 3D settings +*******************************************************************************/ + +struct _DISP3DCNT +{ +/* 0*/ u8 EnableTexMapping:1; // +/* 1*/ u8 PolygonShading:1; // 0=Toon Shading, 1=Highlight Shading +/* 2*/ u8 EnableAlphaTest:1; // see ALPHA_TEST_REF +/* 3*/ u8 EnableAlphaBlending:1; // see various Alpha values +/* 4*/ u8 EnableAntiAliasing:1; // +/* 5*/ u8 EnableEdgeMarking:1; // see EDGE_COLOR +/* 6*/ u8 FogOnlyAlpha:1; // 0=Alpha and Color, 1=Only Alpha (see FOG_COLOR) +/* 7*/ u8 EnableFog:1; // Fog Master Enable +/* 8*/ u8 FogShiftSHR:4; // 0..10 SHR-Divider (see FOG_OFFSET) +/*12*/ u8 AckColorBufferUnderflow:1; // Color Buffer RDLINES Underflow (0=None, 1=Underflow/Acknowledge) +/*13*/ u8 AckVertexRAMOverflow:1; // Polygon/Vertex RAM Overflow (0=None, 1=Overflow/Acknowledge) +/*14*/ u8 RearPlaneMode:1; // 0=Blank, 1=Bitmap +/*15*/ u8 :1; +/*16*/ u16 :16; +}; + +typedef union +{ + struct _DISP3DCNT bits; + u32 val; +} DISP3DCNT; + +/******************************************************************************* + this structure is for capture control (core A only) + + source: + http://nocash.emubase.de/gbatek.htm#dsvideocaptureandmainmemorydisplaymode +*******************************************************************************/ + +struct _DISPCAPCNT +{ +/* 0*/ u8 BlendFactor_A:5; // 0..16 = Blending Factor for Source A +/* 5*/ u8 :3; // +/* 8*/ u8 BlendFactor_B:5; // 0..16 = Blending Factor for Source B +/*13*/ u8 :3; // +/*16*/ u8 VRAM_Write_Block:2; // 0..3 = VRAM A..D +/*18*/ u8 VRAM_Write_Offset:2; // n x 0x08000 +/*20*/ u8 Capture_Size:2; // 0=128x128, 1=256x64, 2=256x128, 3=256x192 dots +/*22*/ u8 :2; // +/*24*/ u8 Source_A:1; // 0=Graphics Screen BG+3D+OBJ, 1=3D Screen +/*25*/ u8 Source_B:1; // 0=VRAM, 1=Main Memory Display FIFO +/*26*/ u8 VRAM_Read_Offset:2; // n x 0x08000 +/*28*/ u8 :1; // +/*29*/ u8 Capture_Source:2; // 0=Source A, 1=Source B, 2/3=Sources A+B blended +/*31*/ u8 Capture_Enable:1; // 0=Disable/Ready, 1=Enable/Busy +}; + +typedef union +{ + struct _DISPCAPCNT bits; + u32 val; +} DISPCAPCNT; + + +/******************************************************************************* + this structure holds everything and should be mapped to + * core A : 0x04000000 + * core B : 0x04001000 +*******************************************************************************/ + +typedef struct _reg_dispx { + DISPCNT dispx_DISPCNT; // 0x0400x000 + u16 dispA_DISPSTAT; // 0x04000004 + u16 dispx_VCOUNT; // 0x0400x006 + BGxCNT dispx_BGxCNT[4]; // 0x0400x008 + BGxOFS dispx_BGxOFS[4]; // 0x0400x010 + BGxPARMS dispx_BG2PARMS; // 0x0400x020 + BGxPARMS dispx_BG3PARMS; // 0x0400x030 + u8 filler[12]; // 0x0400x040 + MISCCNT dispx_MISC; // 0x0400x04C + DISP3DCNT dispA_DISP3DCNT; // 0x04000060 + DISPCAPCNT dispA_DISPCAPCNT; // 0x04000064 + u32 dispA_DISPMMEMFIFO; // 0x04000068 +} REG_DISPx ; + + + + + + + + #ifndef min #define min(a,b) (((a)<(b))?(a):(b)) #endif @@ -44,20 +403,34 @@ #define max(a,b) (((a)>(b))?(a):(b)) #endif +typedef BOOL (*fun_gl_Begin) (int screen); +typedef void (*fun_gl_End) (int screen); +// the GUI should use this function prior to all gl calls +// if call to beg succeeds opengl draw +void register_gl_fun(fun_gl_Begin beg,fun_gl_End end); #define GPU_MAIN 0 #define GPU_SUB 1 /* human readable bitmask names */ -#define ADDRESS_STEP_512B 0x00200 -#define ADDRESS_STEP_1KB 0x00400 -#define ADDRESS_STEP_2KB 0x00800 -#define ADDRESS_STEP_4KB 0x01000 -#define ADDRESS_STEP_8KB 0x02000 -#define ADDRESS_STEP_16KB 0x04000 -#define ADDRESS_STEP_32KB 0x08000 -#define ADDRESS_STEP_64kB 0x10000 +#define ADDRESS_STEP_512B 0x00200 +#define ADDRESS_STEP_1KB 0x00400 +#define ADDRESS_STEP_2KB 0x00800 +#define ADDRESS_STEP_4KB 0x01000 +#define ADDRESS_STEP_8KB 0x02000 +#define ADDRESS_STEP_16KB 0x04000 +#define ADDRESS_STEP_32KB 0x08000 +#define ADDRESS_STEP_64kB 0x10000 +#ifdef WORDS_BIGENDIAN +struct _TILEENTRY +{ +/*14*/ unsigned Palette:4; +/*13*/ unsigned VFlip:1; // VERTICAL FLIP (top<-->bottom) +/*12*/ unsigned HFlip:1; // HORIZONTAL FLIP (left<-->right) +/* 0*/ unsigned TileNum:10; +}; +#else struct _TILEENTRY { /* 0*/ unsigned TileNum:10; @@ -65,7 +438,8 @@ /*13*/ unsigned VFlip:1; // VERTICAL FLIP (top<-->bottom) /*14*/ unsigned Palette:4; }; -typedef union +#endif +typedef union { struct _TILEENTRY bits; u16 val; @@ -77,89 +451,17 @@ /* 8*/ signed Integer:24; // /*28*/ unsigned :4; }; -typedef union +typedef union { struct _ROTOCOORD bits; s32 val; } ROTOCOORD; -/* - this structure is for display control, - it holds flags for general display -*/ - -struct _DISPCNT -{ -/*0*/ unsigned BG_Mode:3; // A+B: -/*3*/ unsigned BG0_3D:1; // A : 0=2D, 1=3D -/*4*/ unsigned OBJ_Tile_1D:1; // A+B: 0=2D (32KB), 1=1D (32..256KB) -/*5*/ unsigned OBJ_BMP_2D_dim:1; // A+B: 0=128x512, 1=256x256 pixels -/*6*/ unsigned OBJ_BMP_mapping:1; // A+B: 0=2D (128KB), 1=1D (128..256KB) - -// 7-15 same as GBA -/*7*/ unsigned ForceBlank:1; // A+B: -/*8*/ unsigned BG0_Enable:1; // A+B: 0=disable, 1=Enable -/*9*/ unsigned BG1_Enable:1; // A+B: 0=disable, 1=Enable -/*10*/ unsigned BG2_Enable:1; // A+B: 0=disable, 1=Enable -/*11*/ unsigned BG3_Enable:1; // A+B: 0=disable, 1=Enable -/*12*/ unsigned OBJ_Enable:1; // A+B: 0=disable, 1=Enable -/*13*/ unsigned Win0_Enable:1; // A+B: 0=disable, 1=Enable -/*14*/ unsigned Win1_Enable:1; // A+B: 0=disable, 1=Enable -/*15*/ unsigned WinOBJ_Enable:1; // A+B: 0=disable, 1=Enable - -/*16*/ unsigned DisplayMode:2; // A+B: coreA(0..3) coreB(0..1) GBA(Green Swap) - // 0=off (white screen) - // 1=on (normal BG & OBJ layers) - // 2=VRAM display (coreA only) - // 3=RAM display (coreA only, DMA transfers) - -/*18*/ unsigned VRAM_Block:2; // A : VRAM block (0..3=A..D) -/*20*/ unsigned OBJ_Tile_1D_Bound:2; // A+B: -/*22*/ unsigned OBJ_BMP_1D_Bound:1; // A : -/*23*/ unsigned OBJ_HBlank_process:1; // A+B: OBJ processed during HBlank (GBA bit5) -/*24*/ unsigned CharacBase_Block:3; // A : Character Base (64K step) -/*27*/ unsigned ScreenBase_Block:3; // A : Screen Base (64K step) -/*30*/ unsigned ExBGxPalette_Enable:1; // A+B: 0=disable, 1=Enable BG extended Palette -/*31*/ unsigned ExOBJPalette_Enable:1; // A+B: 0=disable, 1=Enable OBJ extended Palette -}; - -typedef union -{ - struct _DISPCNT bits; - u32 val; -} DISPCNT; -#define BGxENABLED(cnt,num) ((num<8)? ((cnt.val>>8) & num):0) - -// source: -// http://nocash.emubase.de/gbatek.htm#dsvideocaptureandmainmemorydisplaymode -struct _DISPCAPCNT -{ -/* 0*/ unsigned BlendFactor_A:5; // 0..16 = Blending Factor for Source A -/* 5*/ unsigned :3; // -/* 8*/ unsigned BlendFactor_B:5; // 0..16 = Blending Factor for Source B -/*13*/ unsigned :3; // -/*16*/ unsigned VRAM_Write_Block:2; // 0..3 = VRAM A..D -/*18*/ unsigned VRAM_Write_Offset:2; // n x 0x08000 -/*20*/ unsigned Capture_Size:2; // 0=128x128, 1=256x64, 2=256x128, 3=256x192 dots -/*22*/ unsigned :2; // -/*24*/ unsigned Source_A:1; // 0=Graphics Screen BG+3D+OBJ, 1=3D Screen -/*25*/ unsigned Source_B:1; // 0=VRAM, 1=Main Memory Display FIFO -/*26*/ unsigned VRAM_Read_Offset:2; // n x 0x08000 -/*28*/ unsigned :1; // -/*29*/ unsigned Capture_Source:2; // 0=Source A, 1=Source B, 2/3=Sources A+B blended -/*31*/ unsigned Capture_Enable:1; // 0=Disable/Ready, 1=Enable/Busy -}; -typedef union -{ - struct _DISPCAPCNT bits; - u32 val; -} DISPCAPCNT; - /* this structure is for color representation, it holds 5 meaningful bits per color channel (red,green,blue) - and 1 meaningful bit for alpha representation + and 1 meaningful bit for alpha representation this bit can be unused or used for special FX */ @@ -174,7 +476,7 @@ unsigned alpha:1; // sometimes it is unused (pad) }; -typedef union +typedef union { struct _COLOR bits; struct _COLORx bitx; @@ -192,7 +494,7 @@ unsigned alpha:1; // sometimes it is unused (pad) }; -typedef union +typedef union { struct _COLOR32 bits; u32 val; @@ -208,63 +510,6 @@ -/* - this structure is for display control of a specific layer, - there are 4 background layers - their priority indicate which one to draw on top of the other - some flags indicate special drawing mode, size, FX -*/ - - -struct _BGxCNT -{ -/*0*/ unsigned Priority:2; // 0..3=high..low -/*2*/ unsigned CharacBase_Block:4; // individual character base offset (n*16KB) -/*6*/ unsigned Mosaic_Enable:1; // 0=disable, 1=Enable mosaic -/*7*/ unsigned Palette_256:1; // 0=16x16, 1=1*256 palette -/*8*/ unsigned ScreenBase_Block:5; // individual screen base offset (text n*2KB, BMP n*16KB) -/*13*/ unsigned PaletteSet_Wrap:1; // BG0 extended palette set 0=set0, 1=set2 - // BG1 extended palette set 0=set1, 1=set3 - // BG2 overflow area wraparound 0=off, 1=wrap - // BG3 overflow area wraparound 0=off, 1=wrap -/*14*/ unsigned ScreenSize:2; // text : 256x256 512x256 256x512 512x512 - // x/rot/s : 128x128 256x256 512x512 1024x1024 - // bmp : 128x128 256x256 512x256 512x512 - // large : 512x1024 1024x512 - - -}; - - -typedef union -{ - struct _BGxCNT bits; - u16 val; -} BGxCNT; - -/* - this structure is to represent global FX - applied to a pixel - - Factor (5bits values 0-16, values >16 same as 16) -// damdoum : then the 4th bit use is questionnable ? - - Lighten : New = Old + (63-Old) * Factor/16 - Darken : New = Old - Old * Factor/16 -*/ - -struct _MASTER_BRIGHT -{ -/*0*/ unsigned Factor:4; // brightnessFactor = Factor | FactorEx << 4 -/*4*/ unsigned FactorEx:1; // -/*5*/ unsigned :9; -/*14*/ unsigned Mode:2; // 0=off, 1=Lighten, 2=Darken, 3=? -}; - -typedef union -{ - struct _MASTER_BRIGHT bits; - u16 val; -} MASTER_BRIGHT; - /* @@ -277,20 +522,20 @@ typedef struct { // attr0 -/*0*/ unsigned Y:8; -/*8*/ unsigned RotScale:2; // (00: Normal, 01: Rot/scale, 10: Disabled, 11: Double-size rot/scale) -/*10*/ unsigned Mode:2; // (00: Normal, 01: Transparent, 10: Object window, 11: Bitmap) +/* 0*/ unsigned Y:8; +/* 8*/ unsigned RotScale:2; // (00: Normal, 01: Rot/scale, 10: Disabled, 11: Double-size rot/scale) +/*10*/ unsigned Mode:2; // (00: Normal, 01: Transparent, 10: Object window, 11: Bitmap) /*12*/ unsigned Mosaic:1; // (1: Enabled) -/*13*/ unsigned Depth:1; // (0: 16, 1: 256) -/*14*/ unsigned Shape:2; // (00: Square, 01: Wide, 10: Tall, 11: Illegal) +/*13*/ unsigned Depth:1; // (0: 16, 1: 256) +/*14*/ unsigned Shape:2; // (00: Square, 01: Wide, 10: Tall, 11: Illegal) // attr1 -/*0*/ signed X:9; -/*9*/ unsigned RotScalIndex:3; // Rot/scale matrix index +/* 0*/ signed X:9; +/* 9*/ unsigned RotScalIndex:3; // Rot/scale matrix index /*12*/ unsigned HFlip:1; /*13*/ unsigned VFlip:1; /*14*/ unsigned Size:2; // attr2 -/*0*/ unsigned TileIndex:10; +/* 0*/ unsigned TileIndex:10; /*10*/ unsigned Priority:2; /*12*/ unsigned PaletteIndex:4; // attr3 @@ -299,77 +544,21 @@ typedef struct { - u16 attr0; - u16 attr1; - u16 attr2; - u16 attr3; + u16 attr0; + u16 attr1; + u16 attr2; + u16 attr3; } OAM; typedef struct { - s16 x; - s16 y; + s16 x; + s16 y; } size; -/* - these structures are for window description, - windows are square regions and can "subclass" - background layers or object layers (i.e window controls the layers) - - screen - | - +-- Window0/Window1/OBJwindow/OutOfWindows - | - +-- BG0/BG1/BG2/BG3/OBJ -*/ - -typedef union windowdim_t -{ - struct - { -/* 0*/ unsigned end:8; -/* 8*/ unsigned start:8; - } bits ; - unsigned short val ; -} windowdim_t ; - -typedef union windowcnt_t -{ - struct - { -/* 0*/ unsigned WIN0_BG0_Enable:1; -/* 1*/ unsigned WIN0_BG1_Enable:1; -/* 2*/ unsigned WIN0_BG2_Enable:1; -/* 3*/ unsigned WIN0_BG3_Enable:1; -/* 4*/ unsigned WIN0_OBJ_Enable:1; -/* 5*/ unsigned WIN0_Effect_Enable:1; -/* 6*/ unsigned :2; -/* 8*/ unsigned WIN1_BG0_Enable:1; -/* 9*/ unsigned WIN1_BG1_Enable:1; -/*10*/ unsigned WIN1_BG2_Enable:1; -/*11*/ unsigned WIN1_BG3_Enable:1; -/*12*/ unsigned WIN1_OBJ_Enable:1; -/*13*/ unsigned WIN1_Effect_Enable:1; -/*14*/ unsigned :2; - } bits ; - struct - { - unsigned char low ; - unsigned char high ; - } bytes ; - struct - { - unsigned win0_en:5; - unsigned :3; - unsigned win1_en:5; - unsigned :3; - } windows ; - unsigned short val ; -} windowcnt_t ; - /* @@ -379,7 +568,7 @@ #define NB_PRIORITIES 4 #define NB_BG 4 -typedef struct +typedef struct { u8 BGs[NB_BG], nbBGs; u8 PixelsX[256]; @@ -392,66 +581,95 @@ struct _GPU { - DISPCNT dispCnt; + // some structs are becoming redundant + // some functions too (no need to recopy some vars as it is done by MMU) + REG_DISPx * dispx_st; + DISPCAPCNT dispCapCnt; - BGxCNT bgCnt[4]; - MASTER_BRIGHT masterBright; BOOL LayersEnable[5]; itemsForPriority_t itemsForPriority[NB_PRIORITIES]; - u8 sprWin[256*2][256]; + u8 sprWin[256][256]; #define BGBmpBB BG_bmp_ram #define BGChBB BG_tile_ram - + u8 *(BG_bmp_ram[4]); u8 *(BG_tile_ram[4]); u8 *(BG_map_ram[4]); - + u8 BGExtPalSlot[4]; u32 BGSize[4][2]; - u16 BGSX[4]; - u16 BGSY[4]; - - s32 BGX[4]; - s32 BGY[4]; - s16 BGPA[4]; - s16 BGPB[4]; - s16 BGPC[4]; - s16 BGPD[4]; - + u8 lcd; u8 core; - + u8 dispMode; u8 vramBlock; - // these two are going to be deleted (use itemsForPriority instead...) - u8 BGIndex[4]; - u8 ordre[4]; - - BOOL dispBG[4]; BOOL dispOBJ; - + OAM * oam; u8 * sprMem; u8 sprBoundary; u8 sprBMPBoundary; u8 sprBMPMode; - u32 sprEnable ; - - u16 BLDCNT ; - u16 BLDALPHA ; - u16 BLDY ; - u16 MOSAIC ; - - windowdim_t WINDOW_XDIM[2] ; - windowdim_t WINDOW_YDIM[2] ; - windowcnt_t WINDOW_INCNT ; - windowcnt_t WINDOW_OUTCNT ; + u32 sprEnable; + + u8 WIN0H0; + u8 WIN0H1; + u8 WIN0V0; + u8 WIN0V1; + + u8 WIN1H0; + u8 WIN1H1; + u8 WIN1V0; + u8 WIN1V1; + + u8 WININ0; + u8 WININ0_SPECIAL; + u8 WININ1; + u8 WININ1_SPECIAL; + + u8 WINOUT; + u8 WINOUT_SPECIAL; + u8 WINOBJ; + u8 WINOBJ_SPECIAL; + + u8 WIN0_ENABLED; + u8 WIN1_ENABLED; + u8 WINOBJ_ENABLED; + + u16 BLDCNT; + u8 BLDALPHA_EVA; + u8 BLDALPHA_EVB; + u8 BLDY_EVY; - void (*spriteRender)(GPU * gpu, u16 l, u8 * dst, u8 * prioTab); + u8 MasterBrightMode; + u32 MasterBrightFactor; + + BOOL (*setFinalColor)(const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y); + void (*spriteRender) (GPU * gpu, u16 l, u8 * dst, u8 * prioTab); }; +/* +// normally should have same addresses +static void REG_DISPx_pack_test(GPU * gpu) +{ + REG_DISPx * r = gpu->dispx_st; + printf ("%08x %02x\n", r, (long)(&r->dispx_DISPCNT) - (long)r); + printf ("\t%02x\n", (long)(&r->dispA_DISPSTAT) - (long)r); + printf ("\t%02x\n", (long)(&r->dispx_VCOUNT) - (long)r); + printf ("\t%02x\n", (long)(&r->dispx_BGxCNT[0]) - (long)r); + printf ("\t%02x\n", (long)(&r->dispx_BGxOFS[0]) - (long)r); + printf ("\t%02x\n", (long)(&r->dispx_BG2PARMS) - (long)r); + printf ("\t%02x\n", (long)(&r->dispx_BG3PARMS) - (long)r); + printf ("\t%02x\n", (long)(&r->dispx_WINCNT) - (long)r); + printf ("\t%02x\n", (long)(&r->dispx_MISC) - (long)r); + printf ("\t%02x\n", (long)(&r->dispA_DISP3DCNT) - (long)r); + printf ("\t%02x\n", (long)(&r->dispA_DISPCAPCNT) - (long)r); + printf ("\t%02x\n", (long)(&r->dispA_DISPMMEMFIFO) - (long)r); +} +*/ extern u8 GPU_screen[4*256*192]; @@ -460,7 +678,7 @@ void GPU_Reset(GPU *g, u8 l); void GPU_DeInit(GPU *); -void textBG(GPU * gpu, u8 num, u8 * DST); +void textBG(const GPU * gpu, u8 num, u8 * DST); //Draw text based background void rotBG(GPU * gpu, u8 num, u8 * DST); void extRotBG(GPU * gpu, u8 num, u8 * DST); void sprite1D(GPU * gpu, u16 l, u8 * dst, u8 * prioTab); @@ -474,10 +692,10 @@ typedef struct { GPU * gpu; u16 offset; -} Screen; +} NDS_Screen; -extern Screen MainScreen; -extern Screen SubScreen; +extern NDS_Screen MainScreen; +extern NDS_Screen SubScreen; int Screen_Init(int coreid); void Screen_Reset(void); @@ -487,10 +705,10 @@ -#define GFXCORE_DEFAULT -1 -#define GFXCORE_DUMMY 0 +#define GFXCORE_DEFAULT -1 +#define GFXCORE_DUMMY 0 -#define GFXCORE_FULLSCREEN (1 << 0) +#define GFXCORE_FULLSCREEN (1 << 0) typedef struct { @@ -500,46 +718,19 @@ int (*Init)(); // Initializes stuff related to core void (*DeInit)(); // Deinitializes stuff related to core void (*Resize)(int width, int height, BOOL fullscreen); // Resizes window or fullscreen - void (*OnScreenText)(char *string, ...); // For handling save state messages, etc. + void (*OnScreenText)(char *string, ...); // For handling save state messages, etc. } GraphicsInterface_struct; extern GraphicsInterface_struct GFXDummy; void GPU_setVideoProp(GPU *, u32 p); void GPU_setBGProp(GPU *, u16 num, u16 p); -void GPU_scrollX(GPU *, u8 num, u16 v); -void GPU_scrollY(GPU *, u8 num, u16 v); -void GPU_scrollXY(GPU *, u8 num, u32 v); - -void GPU_setX(GPU *, u8 num, u32 v); -void GPU_setXH(GPU *, u8 num, u16 v); -void GPU_setXL(GPU *, u8 num, u16 v); -void GPU_setY(GPU *, u8 num, u32 v); -void GPU_setYH(GPU *, u8 num, u16 v); -void GPU_setYL(GPU *, u8 num, u16 v); -void GPU_setPA(GPU *, u8 num, u16 v); -void GPU_setPB(GPU *, u8 num, u16 v); -void GPU_setPC(GPU *, u8 num, u16 v); -void GPU_setPD(GPU *, u8 num, u16 v); -void GPU_setPAPB(GPU *, u8 num, u32 v); -void GPU_setPCPD(GPU *, u8 num, u32 v); - + void GPU_setBLDCNT(GPU *gpu, u16 v) ; void GPU_setBLDALPHA(GPU *gpu, u16 v) ; void GPU_setBLDY(GPU *gpu, u16 v) ; void GPU_setMOSAIC(GPU *gpu, u16 v) ; -void GPU_setWINDOW_XDIM(GPU *gpu, u16 v, u8 num) ; -void GPU_setWINDOW_YDIM(GPU *gpu, u16 v, u8 num) ; -void GPU_setWINDOW_XDIM_Component(GPU *gpu, u8 v, u8 num) ; -void GPU_setWINDOW_YDIM_Component(GPU *gpu, u8 v, u8 num) ; - -void GPU_setWINDOW_INCNT(GPU *gpu, u16 v) ; -void GPU_setWINDOW_OUTCNT(GPU *gpu, u16 v) ; -void GPU_setWINDOW_INCNT_Component(GPU *gpu, u8 v,u8 num) ; -void GPU_setWINDOW_OUTCNT_Component(GPU *gpu, u8 v,u8 num) ; - -void GPU_setMASTER_BRIGHT (GPU *gpu, u16 v); void GPU_remove(GPU *, u8 num); void GPU_addBack(GPU *, u8 num); @@ -547,7 +738,42 @@ int GPU_ChangeGraphicsCore(int coreid); void GPU_set_DISPCAPCNT(GPU * gpu, u32 val) ; -void GPU_ligne(Screen * screen, u16 l) ; +void GPU_ligne(NDS_Screen * screen, u16 l) ; +void GPU_setMasterBrightness (GPU *gpu, u16 val); + +void GPU_setWIN0_H (GPU *gpu, u16 val); +void GPU_setWIN0_H0 (GPU *gpu, u8 val); +void GPU_setWIN0_H1 (GPU *gpu, u8 val); + +void GPU_setWIN0_V (GPU *gpu, u16 val); +void GPU_setWIN0_V0 (GPU *gpu, u8 val); +void GPU_setWIN0_V1 (GPU *gpu, u8 val); + +void GPU_setWIN1_H (GPU *gpu, u16 val); +void GPU_setWIN1_H0 (GPU *gpu, u8 val); +void GPU_setWIN1_H1 (GPU *gpu, u8 val); + +void GPU_setWIN1_V (GPU *gpu, u16 val); +void GPU_setWIN1_V0 (GPU *gpu, u8 val); +void GPU_setWIN1_V1 (GPU *gpu, u8 val); + +void GPU_setWININ (GPU *gpu, u16 val); +void GPU_setWININ0 (GPU *gpu, u8 val); +void GPU_setWININ1 (GPU *gpu, u8 val); + +void GPU_setWINOUT16(GPU *gpu, u16 val); +void GPU_setWINOUT (GPU *gpu, u8 val); +void GPU_setWINOBJ (GPU *gpu, u8 val); + +void GPU_setBLDCNT_LOW (GPU *gpu, u8 val); +void GPU_setBLDCNT_HIGH (GPU *gpu, u8 val); +void GPU_setBLDCNT (GPU *gpu, u16 val); + +void GPU_setBLDALPHA (GPU *gpu, u16 val); +void GPU_setBLDALPHA_EVA(GPU *gpu, u8 val); +void GPU_setBLDALPHA_EVB(GPU *gpu, u8 val); + +void GPU_setBLDY_EVY (GPU *gpu, u8 val); #ifdef __cplusplus } diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/desmume.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/desmume.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/desmume.c 2007-01-26 01:13:57.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/desmume.c 2007-06-07 05:00:52.000000000 -0500 @@ -26,49 +26,54 @@ BOOL fini = FALSE; unsigned long glock = 0; -void desmume_mem_init(); - u8 *desmume_rom_data = NULL; u32 desmume_last_cycle; -void desmume_init() -{ - NDS_Init(); - SPU_ChangeSoundCore(SNDCORE_SDL, 735 * 4); +void desmume_init( struct armcpu_memory_iface *arm9_mem_if, + struct armcpu_ctrl_iface **arm9_ctrl_iface, + struct armcpu_memory_iface *arm7_mem_if, + struct armcpu_ctrl_iface **arm7_ctrl_iface, + int disable_sound) +{ + NDS_Init( arm9_mem_if, arm9_ctrl_iface, + arm7_mem_if, arm7_ctrl_iface); + if ( !disable_sound) { + SPU_ChangeSoundCore(SNDCORE_SDL, 735 * 4); + } execute = FALSE; } -void desmume_free() +void desmume_free( void) { execute = FALSE; NDS_DeInit(); } -void desmume_pause() +void desmume_pause( void) { execute = FALSE; } -void desmume_resume() +void desmume_resume( void) { execute = TRUE; } -void desmume_toggle() +void desmume_toggle( void) { execute = (execute) ? FALSE : TRUE; } -BOOL desmume_running() +BOOL desmume_running( void) { return execute; } -void desmume_cycle() +void desmume_cycle( void) { u16 keypad; /* Joystick events */ /* Retrieve old value: can use joysticks w/ another device (from our side) */ keypad = get_keypad(); /* Look for queued events */ - keypad = process_ctrls_events(keypad); + process_joystick_events( &keypad); /* Update keypad value */ update_keypad(keypad); diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/desmume.desktop.in /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/desmume.desktop.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/desmume.desktop.in 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/desmume.desktop.in 2007-05-11 00:30:13.000000000 -0500 @@ -0,0 +1,10 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=@VERSION@ +Type=Application +Name=DeSmuME (Gtk) +Comment=Nintento DS emulator +TryExec=desmume +Exec=desmume +Icon=DeSmuME.xpm +Categories=GNOME;GTK;Application;Game; diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/desmume.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/desmume.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/desmume.h 2007-01-26 01:12:36.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/desmume.h 2007-06-07 05:00:52.000000000 -0500 @@ -24,15 +24,19 @@ #include "globals.h" -extern void desmume_init(); -extern void desmume_free(); +extern void desmume_init( struct armcpu_memory_iface *arm9_mem_if, + struct armcpu_ctrl_iface **arm9_ctrl_iface, + struct armcpu_memory_iface *arm7_mem_if, + struct armcpu_ctrl_iface **arm7_ctrl_iface, + int disable_sound); +extern void desmume_free( void); + +extern void desmume_pause( void); +extern void desmume_resume( void); +extern void desmume_toggle( void); +extern BOOL desmume_running( void); -extern void desmume_pause(); -extern void desmume_resume(); -extern void desmume_toggle(); -extern BOOL desmume_running(); - -extern void desmume_cycle(); +extern void desmume_cycle( void); #endif /*__DESMUME_H__*/ diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/gdk_3Demu.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/gdk_3Demu.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/gdk_3Demu.c 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/gdk_3Demu.c 2007-06-27 09:44:40.000000000 -0500 @@ -0,0 +1,199 @@ +/* $Id: gdk_3Demu.c,v 1.3 2007/06/27 14:44:40 masscat Exp $ + */ +/* + Copyright (C) 2006-2007 Ben Jaques + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifdef GTKGLEXT_AVAILABLE + +#include + +#include "../types.h" +#include "../render3D.h" +#include "../opengl_collector_3Demu.h" +#include "gdk_3Demu.h" + +/* + * The GDK 3D emulation. + * This uses the OpenGL Collector plugin, using gdkGLext for the platform + * specific helper functions. + */ + + +static GdkPixmap *target_pixmap; +static GdkGLContext *glcontext = NULL; +static GdkGLDrawable *gldrawable; + + +static void +print_gl_config_attrib (GdkGLConfig *glconfig, + const gchar *attrib_str, + int attrib, + gboolean is_boolean) +{ + int value; + + g_print ("%s = ", attrib_str); + if (gdk_gl_config_get_attrib (glconfig, attrib, &value)) + { + if (is_boolean) + g_print ("%s\n", value == TRUE ? "TRUE" : "FALSE"); + else + g_print ("%d\n", value); + } + else + g_print ("*** Cannot get %s attribute value\n", attrib_str); +} + + +static void +examine_gl_config_attrib (GdkGLConfig *glconfig) +{ + g_print ("\nOpenGL visual configurations :\n\n"); + + g_print ("gdk_gl_config_is_rgba (glconfig) = %s\n", + gdk_gl_config_is_rgba (glconfig) ? "TRUE" : "FALSE"); + g_print ("gdk_gl_config_is_double_buffered (glconfig) = %s\n", + gdk_gl_config_is_double_buffered (glconfig) ? "TRUE" : "FALSE"); + g_print ("gdk_gl_config_is_stereo (glconfig) = %s\n", + gdk_gl_config_is_stereo (glconfig) ? "TRUE" : "FALSE"); + g_print ("gdk_gl_config_has_alpha (glconfig) = %s\n", + gdk_gl_config_has_alpha (glconfig) ? "TRUE" : "FALSE"); + g_print ("gdk_gl_config_has_depth_buffer (glconfig) = %s\n", + gdk_gl_config_has_depth_buffer (glconfig) ? "TRUE" : "FALSE"); + g_print ("gdk_gl_config_has_stencil_buffer (glconfig) = %s\n", + gdk_gl_config_has_stencil_buffer (glconfig) ? "TRUE" : "FALSE"); + g_print ("gdk_gl_config_has_accum_buffer (glconfig) = %s\n", + gdk_gl_config_has_accum_buffer (glconfig) ? "TRUE" : "FALSE"); + + g_print ("\n"); + + print_gl_config_attrib (glconfig, "GDK_GL_USE_GL", + GDK_GL_USE_GL, TRUE); + print_gl_config_attrib (glconfig, "GDK_GL_BUFFER_SIZE", + GDK_GL_BUFFER_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_LEVEL", + GDK_GL_LEVEL, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_RGBA", + GDK_GL_RGBA, TRUE); + print_gl_config_attrib (glconfig, "GDK_GL_DOUBLEBUFFER", + GDK_GL_DOUBLEBUFFER, TRUE); + print_gl_config_attrib (glconfig, "GDK_GL_STEREO", + GDK_GL_STEREO, TRUE); + print_gl_config_attrib (glconfig, "GDK_GL_AUX_BUFFERS", + GDK_GL_AUX_BUFFERS, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_RED_SIZE", + GDK_GL_RED_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_GREEN_SIZE", + GDK_GL_GREEN_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_BLUE_SIZE", + GDK_GL_BLUE_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_ALPHA_SIZE", + GDK_GL_ALPHA_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_DEPTH_SIZE", + GDK_GL_DEPTH_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_STENCIL_SIZE", + GDK_GL_STENCIL_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_RED_SIZE", + GDK_GL_ACCUM_RED_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_GREEN_SIZE", + GDK_GL_ACCUM_GREEN_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_BLUE_SIZE", + GDK_GL_ACCUM_BLUE_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_ALPHA_SIZE", + GDK_GL_ACCUM_ALPHA_SIZE, FALSE); + + g_print ("\n"); +} + + +static int +begin_opengl_region_gdk_3d( void) { + + if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)) { + return 0; + } + + return 1; +} + +static void +end_opengl_region_gdk_3d( void) { + gdk_gl_drawable_gl_end (gldrawable); +} + +static int +initialise_gdk_3d( void) { + /* this does nothing */ + return 1; +} + +int +init_opengl_gdk_3Demu( void) { + GdkGLConfig *glconfig; + + /* create the off screen pixmap */ + target_pixmap = gdk_pixmap_new ( NULL, 256, 192, 24); + + if ( target_pixmap == NULL) { + g_print ("*** Failed to create pixmap.\n"); + return 0; + } + + glconfig = gdk_gl_config_new_by_mode (GDK_GL_MODE_RGBA | + GDK_GL_MODE_DEPTH | + GDK_GL_MODE_STENCIL | + GDK_GL_MODE_SINGLE); + if (glconfig == NULL) + { + g_print ("*** No appropriate OpenGL-capable visual found.\n"); + return 0; + } + + /* + * Set OpenGL-capability to the pixmap + */ + + gldrawable = GDK_GL_DRAWABLE (gdk_pixmap_set_gl_capability (target_pixmap, + glconfig, + NULL)); + + if ( gldrawable == NULL) { + g_print ("Failed to create the GdkGLPixmap\n"); + return 0; + } + + glcontext = gdk_gl_context_new (gldrawable, + NULL, + FALSE, + GDK_GL_RGBA_TYPE); + if (glcontext == NULL) + { + g_print ("Connot create the OpenGL rendering context\n"); + return 0; + } + + begin_opengl_ogl_collector_platform = begin_opengl_region_gdk_3d; + end_opengl_ogl_collector_platform = end_opengl_region_gdk_3d; + initialise_ogl_collector_platform = initialise_gdk_3d; + + + return 1; +} + +#endif diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/gdk_3Demu.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/gdk_3Demu.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/gdk_3Demu.h 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/gdk_3Demu.h 2007-04-17 11:49:33.000000000 -0500 @@ -0,0 +1,32 @@ +/* $Id: gdk_3Demu.h,v 1.1 2007/04/17 16:49:33 masscat Exp $ + */ +/* + Copyright (C) 2006-2007 Ben Jaques + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifdef GTKGLEXT_AVAILABLE +/* + * The GDK 3D emulation. + * This uses the OpenGL Collector plugin, using gdkGLext for the platform + * specific helper functions. + */ + +int +init_opengl_gdk_3Demu( void); + +#endif diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/globals.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/globals.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/globals.h 2007-02-02 00:35:30.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/globals.h 2007-03-17 07:37:59.000000000 -0500 @@ -45,6 +45,7 @@ #include "../sndsdl.h" #include "../ctrlssdl.h" #include "../types.h" +#include "../render3D.h" #include "desmume.h" #endif /* GLOBALS_H */ diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/main.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/main.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/main.c 2007-01-26 01:12:36.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/main.c 2007-06-20 09:29:11.000000000 -0500 @@ -18,14 +18,44 @@ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ +#ifdef GTKGLEXT_AVAILABLE +#include +#include +#include +#endif #include "globals.h" #include "../debug.h" +#include "../gdbstub.h" + +#ifdef GTKGLEXT_AVAILABLE +#include "../opengl_collector_3Demu.h" +#include "gdk_3Demu.h" +#endif + #include "DeSmuME.xpm" #define EMULOOP_PRIO (G_PRIORITY_HIGH_IDLE + 20) + +#define ENABLE_MEMORY_PROFILING 1 + +#ifdef ENABLE_MEMORY_PROFILING +#include + +void +print_memory_profiling( void); +#endif + +static const char *bad_glob_cflash_disk_image_file; + + +#define FPS_LIMITER_FRAME_PERIOD 8 +static SDL_sem *fps_limiter_semaphore; +static int gtk_fps_limiter_disabled = 0; + + /************************ CONFIG FILE *****************************/ // extern char FirmwareFile[256]; @@ -57,6 +87,211 @@ NULL }; +GPU3DInterface *core3DList[] = { + &gpu3DNull +#ifdef GTKGLEXT_AVAILABLE + , + &gpu3D_opengl_collector +#endif +}; + + +struct screen_render_config { + int opengl; + int soft_colour; +}; + + +struct configured_features { + struct screen_render_config screen; + + int disable_sound; + int disable_3d; + int disable_limiter; + + u16 arm9_gdb_port; + u16 arm7_gdb_port; + + int firmware_language; + + const char *nds_file; + const char *cflash_disk_image_file; +}; + +static void +init_configured_features( struct configured_features *config) { + config->arm9_gdb_port = 0; + config->arm7_gdb_port = 0; + + config->disable_sound = 0; + + config->screen.opengl = 0; + config->screen.soft_colour = 0; + + config->disable_3d = 0; + + config->disable_limiter = 0; + + config->nds_file = NULL; + + config->cflash_disk_image_file = NULL; + + /* use the default language */ + config->firmware_language = -1; +} + +static int +fill_configured_features( struct configured_features *config, + int argc, char ** argv) { + int good_args = 1; + int print_usage = 0; + int i; + + for ( i = 1; i < argc && good_args; i++) { + if ( strcmp( argv[i], "--help") == 0) { + printf( "USAGE: %s [OPTIONS] [nds-file]\n", argv[0]); + printf( "OPTIONS:\n"); +#ifdef GTKGLEXT_AVAILABLE + printf( " --opengl-2d Enables using OpenGL for screen rendering\n"); + printf( " --soft-convert Use software colour conversion during OpenGL\n"); + printf( " screen rendering. May produce better or worse\n"); + printf( " frame rates depending on hardware.\n"); + printf( "\n"); + printf( " --disable-3d Disables the 3D emulation\n"); + printf( "\n"); +#endif + printf( " --disable-sound Disables the sound emulation\n"); + printf( " --disable-limiter Disables the 60 fps limiter\n"); + printf( "\n"); + printf( " --fwlang=LANG Set the language in the firmware, LANG as follows:\n"); + printf( " 0 = Japanese\n"); + printf( " 1 = English\n"); + printf( " 2 = French\n"); + printf( " 3 = German\n"); + printf( " 4 = Italian\n"); + printf( " 5 = Spanish\n"); + printf( "\n"); + printf( " --arm9gdb=PORT_NUM Enable the ARM9 GDB stub on the given port\n"); + printf( " --arm7gdb=PORT_NUM Enable the ARM7 GDB stub on the given port\n"); + //printf( " --sticky Enable sticky keys and stylus\n"); + printf( "\n"); + printf( " --cflash=PATH_TO_DISK_IMAGE\n"); + printf( " Enable disk image GBAMP compact flash emulation\n"); + printf( "\n"); + printf( " --help Display this message\n"); + good_args = 0; + } + else if ( strcmp( argv[i], "--disable-sound") == 0) { + config->disable_sound = 1; + } +#ifdef GTKGLEXT_AVAILABLE + else if ( strcmp( argv[i], "--opengl-2d") == 0) { + config->screen.opengl = 1; + } + else if ( strcmp( argv[i], "--soft-convert") == 0) { + config->screen.soft_colour = 1; + } + else if ( strcmp( argv[i], "--disable-3d") == 0) { + config->disable_3d = 1; + } +#endif + else if ( strcmp( argv[i], "--disable-limiter") == 0) { + config->disable_limiter = 1; + } + else if ( strncmp( argv[i], "--fwlang=", 9) == 0) { + char *end_char; + int lang = strtoul( &argv[i][9], &end_char, 10); + + if ( lang >= 0 && lang <= 5) { + config->firmware_language = lang; + } + else { + fprintf( stderr, "Firmware language must be set to a value from 0 to 5.\n"); + good_args = 0; + } + } + else if ( strncmp( argv[i], "--arm9gdb=", 10) == 0) { + char *end_char; + unsigned long port_num = strtoul( &argv[i][10], &end_char, 10); + + if ( port_num > 0 && port_num < 65536) { + config->arm9_gdb_port = port_num; + } + else { + fprintf( stderr, "ARM9 GDB stub port must be in the range 1 to 65535\n"); + good_args = 0; + } + } + else if ( strncmp( argv[i], "--arm7gdb=", 10) == 0) { + char *end_char; + unsigned long port_num = strtoul( &argv[i][10], &end_char, 10); + + if ( port_num > 0 && port_num < 65536) { + config->arm7_gdb_port = port_num; + } + else { + fprintf( stderr, "ARM7 GDB stub port must be in the range 1 to 65535\n"); + good_args = 0; + } + } + else if ( strncmp( argv[i], "--cflash=", 9) == 0) { + if ( config->cflash_disk_image_file == NULL) { + config->cflash_disk_image_file = &argv[i][9]; + } + else { + fprintf( stderr, "CFlash disk image file (\"%s\") already set\n", + config->cflash_disk_image_file); + good_args = 0; + } + } + else { + if ( config->nds_file == NULL) { + config->nds_file = argv[i]; + } + else { + fprintf( stderr, "NDS file (\"%s\") already set\n", config->nds_file); + good_args = 0; + } + } + } + + if ( good_args) { + /* + * check if the configured features are consistant + */ + } + + if ( print_usage) { + fprintf( stderr, "USAGE: %s [options] [nds-file]\n", argv[0]); + fprintf( stderr, "USAGE: %s --help - for help\n", argv[0]); + } + + return good_args; +} + + +/* + * The thread handling functions needed by the GDB stub code. + */ +void * +createThread_gdb( void (*thread_function)( void *data), + void *thread_data) { + GThread *new_thread = g_thread_create( (GThreadFunc)thread_function, + thread_data, + TRUE, + NULL); + + return new_thread; +} + +void +joinThread_gdb( void *thread_handle) { + g_thread_join( thread_handle); +} + + + + u16 Keypad_Temp[NB_KEYS]; int Write_ConfigFile() @@ -140,6 +375,19 @@ static GtkWidget *pToolbar; static GtkWidget *pDrawingArea; +/** The target for the expose event */ +static GtkWidget *nds_screen_widget; + +#ifdef GTKGLEXT_AVAILABLE +static GtkWidget *top_screen_widget; +static GtkWidget *bottom_screen_widget; + +GLuint screen_texture[1]; +#endif + +float nds_screen_size_ratio = 1.0f; + + static BOOL regMainLoop = FALSE; static gint pStatusBar_Ctx; @@ -162,9 +410,10 @@ g_object_unref(pixbuf); } -static int Open(const char *filename) +static int Open(const char *filename, const char *cflash_disk_image) { - int i = NDS_LoadROM(filename, MC_TYPE_AUTODETECT, 1); + int i = NDS_LoadROM( filename, MC_TYPE_AUTODETECT, 1, + cflash_disk_image); return i; } @@ -242,7 +491,7 @@ case GTK_RESPONSE_OK: /* Recuperation du chemin */ sChemin = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(pFileSelection)); - if(Open((const char*)sChemin) < 0) + if(Open((const char*)sChemin, bad_glob_cflash_disk_image_file) < 0) { GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection), GTK_DIALOG_MODAL, @@ -281,8 +530,340 @@ int ScreenCoeff_Size; + +#ifdef GTKGLEXT_AVAILABLE +static void +gtk_init_main_gl_area(GtkWidget *widget, + gpointer data) +{ + GLenum errCode; + int i; + GdkGLContext *glcontext; + GdkGLDrawable *gldrawable; + GtkWidget *other_drawing_area = (GtkWidget *)data; + glcontext = gtk_widget_get_gl_context (widget); + gldrawable = gtk_widget_get_gl_drawable (widget); + uint16_t blank_texture[256 * 512]; + + /*** OpenGL BEGIN ***/ + if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)) + return; + + //printf("Doing GL init\n"); + + for ( i = 0; i < 256 * 512; i++) { + blank_texture[i] = 0x001f; + } + + /* Enable Texture Mapping */ + glEnable( GL_TEXTURE_2D ); + + /* Set the background black */ + glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); + + /* Create The Texture */ + glGenTextures( 1, &screen_texture[0]); + + glBindTexture( GL_TEXTURE_2D, screen_texture[0]); + + /* Generate The Texture */ + glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, 256, 512, + 0, GL_RGBA, + GL_UNSIGNED_SHORT_1_5_5_5_REV, + blank_texture); + + /* Linear Filtering */ + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + + if ((errCode = glGetError()) != GL_NO_ERROR) { + const GLubyte *errString; + + errString = gluErrorString(errCode); + fprintf( stderr, "Failed to init GL: %s\n", errString); + } + + gdk_gl_drawable_gl_end (gldrawable); + /*** OpenGL END ***/ +} + +static void +gtk_init_sub_gl_area(GtkWidget *widget, + gpointer data) +{ + GLenum errCode; + GdkGLContext *glcontext; + GdkGLDrawable *gldrawable; + glcontext = gtk_widget_get_gl_context (widget); + gldrawable = gtk_widget_get_gl_drawable (widget); + + + /*** OpenGL BEGIN ***/ + if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)) + return; + + /* Enable Texture Mapping */ + glEnable( GL_TEXTURE_2D ); + + /* Set the background black */ + glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); + + glBindTexture( GL_TEXTURE_2D, screen_texture[0]); + + if ((errCode = glGetError()) != GL_NO_ERROR) { + const GLubyte *errString; + + errString = gluErrorString(errCode); + fprintf( stderr, "Failed to init GL: %s\n", errString); + } + + gdk_gl_drawable_gl_end (gldrawable); + /*** OpenGL END ***/ +} +#endif + + /////////////////////////////// DRAWING SCREEN ////////////////////////////////// +#ifdef GTKGLEXT_AVAILABLE +static int +top_screen_expose_fn( GtkWidget *widget, GdkEventExpose *event, gpointer data) { + GdkGLContext *glcontext = gtk_widget_get_gl_context (widget); + GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget); + int software_convert = *((int *)data); + + /*** OpenGL BEGIN ***/ + if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)) + return FALSE; + + GLenum errCode; + + /* Clear The Screen And The Depth Buffer */ + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + /* Move Into The Screen 5 Units */ + //glLoadIdentity( ); + + /* Select screen Texture */ + glBindTexture( GL_TEXTURE_2D, screen_texture[0]); + + if ( software_convert) { + int i; + u8 converted[256 * 384 * 3]; + + for ( i = 0; i < (256 * 384); i++) { + converted[(i * 3) + 0] = ((*((u16 *)&GPU_screen[(i<<1)]) >> 0) & 0x1f) << 3; + converted[(i * 3) + 1] = ((*((u16 *)&GPU_screen[(i<<1)]) >> 5) & 0x1f) << 3; + converted[(i * 3) + 2] = ((*((u16 *)&GPU_screen[(i<<1)]) >> 10) & 0x1f) << 3; + } + + glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 256, 384, + GL_RGB, + GL_UNSIGNED_BYTE, + converted); + } + else { + glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 256, 384, + GL_RGBA, + GL_UNSIGNED_SHORT_1_5_5_5_REV, + &GPU_screen); + } + + + if ((errCode = glGetError()) != GL_NO_ERROR) { + const GLubyte *errString; + + errString = gluErrorString(errCode); + fprintf( stderr, "GL subimage failed: %s\n", errString); + } + + + glBegin( GL_QUADS); + + /* Top screen */ + glTexCoord2f( 0.0f, 0.0f ); glVertex3f( 0.0f, 0.0f, 0.0f ); + glTexCoord2f( 1.0f, 0.0f ); glVertex3f( 256.0f, 0.0f, 0.0f ); + glTexCoord2f( 1.0f, 0.375f ); glVertex3f( 256.0f, 192.0f, 0.0f ); + glTexCoord2f( 0.0f, 0.375f ); glVertex3f( 0.0f, 192.0f, 0.0f ); + glEnd( ); + + if ((errCode = glGetError()) != GL_NO_ERROR) { + const GLubyte *errString; + + errString = gluErrorString(errCode); + fprintf( stderr, "GL draw failed: %s\n", errString); + } + + if (gdk_gl_drawable_is_double_buffered (gldrawable)) + gdk_gl_drawable_swap_buffers (gldrawable); + else + glFlush (); + + + gdk_gl_drawable_gl_end (gldrawable); + /*** OpenGL END ***/ + + gtk_widget_queue_draw( bottom_screen_widget); +} + +static int +bottom_screen_expose_fn(GtkWidget *widget, GdkEventExpose *event, gpointer data) +{ + GdkGLContext *glcontext = gtk_widget_get_gl_context (widget); + GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget); + + //g_print("Sub Expose\n"); + + /*** OpenGL BEGIN ***/ + if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)) { + g_print("begin failed\n"); + return FALSE; + } + //g_print("begin\n"); + + GLenum errCode; + + /* Clear The Screen */ + glClear( GL_COLOR_BUFFER_BIT); + + //glBindTexture( GL_TEXTURE_2D, screen_texture[0]); + + glBegin( GL_QUADS); + + /* Bottom screen */ + glTexCoord2f( 0.0f, 0.375f ); glVertex2f( 0.0f, 0.0f); + glTexCoord2f( 1.0f, 0.375f ); glVertex2f( 256.0f, 0.0f); + glTexCoord2f( 1.0f, 0.75f ); glVertex2f( 256.0f, 192.0f); + glTexCoord2f( 0.0f, 0.75f ); glVertex2f( 0.0f, 192.0f); + glEnd( ); + + if (gdk_gl_drawable_is_double_buffered (gldrawable)) + gdk_gl_drawable_swap_buffers (gldrawable); + else + glFlush (); + + + if ((errCode = glGetError()) != GL_NO_ERROR) { + const GLubyte *errString; + + errString = gluErrorString(errCode); + fprintf( stderr, "sub GL draw failed: %s\n", errString); + } + + gdk_gl_drawable_gl_end (gldrawable); + /*** OpenGL END ***/ + + return 1; +} + +static gboolean +common_configure_fn( GtkWidget *widget, + GdkEventConfigure *event ) { + if ( gtk_widget_is_gl_capable( widget) == FALSE) + return TRUE; + + GdkGLContext *glcontext = gtk_widget_get_gl_context (widget); + GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget); + + int comp_width = 3 * event->width; + int comp_height = 4 * event->height; + int use_width = 1; + GLenum errCode; + + /* Height / width ration */ + GLfloat ratio; + + //g_print("wdith %d, height %d\n", event->width, event->height); + + /*** OpenGL BEGIN ***/ + if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)) + return FALSE; + + if ( comp_width > comp_height) { + use_width = 0; + } + + /* Protect against a divide by zero */ + if ( event->height == 0 ) + event->height = 1; + if ( event->width == 0) + event->width = 1; + + ratio = ( GLfloat )event->width / ( GLfloat )event->height; + + /* Setup our viewport. */ + glViewport( 0, 0, ( GLint )event->width, ( GLint )event->height ); + + /* + * change to the projection matrix and set + * our viewing volume. + */ + glMatrixMode( GL_PROJECTION ); + glLoadIdentity( ); + + { + double left; + double right; + double bottom; + double top; + double other_dimen; + + if ( use_width) { + left = 0.0; + right = 256.0; + + nds_screen_size_ratio = 256.0 / (double)event->width; + + other_dimen = (double)event->width * 3.0 / 4.0; + + top = 0.0; + bottom = 192.0 * ((double)event->height / other_dimen); + } + else { + top = 0.0; + bottom = 192.0; + + nds_screen_size_ratio = 192.0 / (double)event->height; + + other_dimen = (double)event->height * 4.0 / 3.0; + + left = 0.0; + right = 256.0 * ((double)event->width / other_dimen); + } + + /* + printf("%d,%d\n", width, height); + printf("l %lf, r %lf, t %lf, b %lf, other dimen %lf\n", + left, right, top, bottom, other_dimen); + */ + + /* get the area (0,0) to (256,384) into the middle of the viewport */ + gluOrtho2D( left, right, bottom, top); + } + + /* Make sure we're chaning the model view and not the projection */ + glMatrixMode( GL_MODELVIEW ); + + /* Reset The View */ + glLoadIdentity( ); + + if ((errCode = glGetError()) != GL_NO_ERROR) { + const GLubyte *errString; + + errString = gluErrorString(errCode); + fprintf( stderr, "GL resie failed: %s\n", errString); + } + + gdk_gl_drawable_gl_end (gldrawable); + /*** OpenGL END ***/ + + return TRUE; +} + +#endif + + + /* Drawing callback */ int gtkFloatExposeEvent (GtkWidget *widget, GdkEventExpose *event, gpointer data) { @@ -325,10 +906,12 @@ GdkModifierType state; gint x,y; s32 EmuX, EmuY; + const int *opengl = (const int *)data; if(click) { + int scaled_x, scaled_y; if(e->is_hint) gdk_window_get_pointer(w->window, &x, &y, &state); else @@ -337,16 +920,22 @@ y= (gint)e->y; state=(GdkModifierType)e->state; } + + scaled_x = x * nds_screen_size_ratio; + scaled_y = y * nds_screen_size_ratio; // fprintf(stderr,"X=%d, Y=%d, S&1=%d\n", x,y,state&GDK_BUTTON1_MASK); - if(y >= 192 && (state & GDK_BUTTON1_MASK)) + if ( !(*opengl)) { + scaled_y -= 192; + } + if(scaled_y >= 0 && (state & GDK_BUTTON1_MASK)) { - EmuX = x; - EmuY = y - 192; - if(EmuX<0) EmuX = 0; else if(EmuX>255) EmuX = 255; - if(EmuY<0) EmuY = 0; else if(EmuY>192) EmuY = 192; - NDS_setTouchPos(EmuX, EmuY); + EmuX = scaled_x; + EmuY = scaled_y; + if(EmuX<0) EmuX = 0; else if(EmuX>255) EmuX = 255; + if(EmuY<0) EmuY = 0; else if(EmuY>192) EmuY = 192; + NDS_setTouchPos(EmuX, EmuY); } } @@ -357,21 +946,30 @@ GdkModifierType state; gint x,y; s32 EmuX, EmuY; - + const int *opengl = (const int *)data; + if(desmume_running()) { if(e->button == 1) { + int scaled_x, scaled_y; click = TRUE; gdk_window_get_pointer(w->window, &x, &y, &state); - if(y >= 192 && (state & GDK_BUTTON1_MASK)) - { - EmuX = x; - EmuY = y - 192; - if(EmuX<0) EmuX = 0; else if(EmuX>255) EmuX = 255; - if(EmuY<0) EmuY = 0; else if(EmuY>192) EmuY = 192; - NDS_setTouchPos(EmuX, EmuY); + + scaled_x = x * nds_screen_size_ratio; + scaled_y = y * nds_screen_size_ratio; + + if ( !(*opengl)) { + scaled_y -= 192; + } + if(scaled_y >= 0 && (state & GDK_BUTTON1_MASK)) + { + EmuX = scaled_x; + EmuY = scaled_y; + if(EmuX<0) EmuX = 0; else if(EmuX>255) EmuX = 255; + if(EmuY<0) EmuY = 0; else if(EmuY>192) EmuY = 192; + NDS_setTouchPos(EmuX, EmuY); } } } @@ -392,6 +990,12 @@ u16 Key = lookup_key(e->keyval); ADD_KEY( Cur_Keypad, Key ); if(desmume_running()) update_keypad(Cur_Keypad); + +#ifdef ENABLE_MEMORY_PROFILING + if ( e->keyval == GDK_Tab) { + print_memory_profiling(); + } +#endif return 1; } @@ -886,7 +1490,7 @@ if(desmume_running()) /* Si on est en train d'executer le programme ... */ { - + static int limiter_frame_counter = 0; fps_FrameCount += Frameskip + 1; if(!fps_SecStart) fps_SecStart = SDL_GetTicks(); if(SDL_GetTicks() - fps_SecStart >= 1000) @@ -906,7 +1510,18 @@ Draw(); _updateDTools(); - gtk_widget_queue_draw(pDrawingArea); + gtk_widget_queue_draw( nds_screen_widget); + + if ( !gtk_fps_limiter_disabled) { + limiter_frame_counter += 1; + if ( limiter_frame_counter >= FPS_LIMITER_FRAME_PERIOD) { + limiter_frame_counter = 0; + + /* wait for the timer to expire */ + SDL_SemWait( fps_limiter_semaphore); + } + } + return TRUE; } @@ -916,44 +1531,141 @@ } -/////////////////////////////// MAIN /////////////////////////////// +/** + * A SDL timer callback function. Signals the supplied SDL semaphore + * if its value is small. + * + * @param interval The interval since the last call (in ms) + * @param param The pointer to the semaphore. + * + * @return The interval to the next call (required by SDL) + */ +static u32 fps_limiter_fn(u32 interval, void *param) { + SDL_sem *sdl_semaphore = (SDL_sem *)param; -#ifdef WIN32 -int WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) -{ - main(0,NULL); + /* signal the semaphore if it is getting low */ + if ( SDL_SemValue( sdl_semaphore) < 4) { + SDL_SemPost( sdl_semaphore); + } + + return interval; } -#endif static void dui_set_accel_group(gpointer action, gpointer group) { gtk_action_set_accel_group(action, group); } -int main (int argc, char *argv[]) -{ +/////////////////////////////// MAIN /////////////////////////////// + +static int +common_gtk_main( struct configured_features *my_config) { int i; + SDL_TimerID limiter_timer; - const char *commandLine_File = NULL; GtkWidget *pVBox; GtkWidget *pMenuBar; GtkWidget *pMenu, *pSubMenu; GtkWidget *pMenuItem, *pSubMenuItem; GtkAccelGroup * accel_group; - - if(argc == 2) commandLine_File = argv[1]; - +#ifdef GTKGLEXT_AVAILABLE + GdkGLConfig *glconfig; + GdkGLContext *glcontext; +#endif + gdbstub_handle_t arm9_gdb_stub; + gdbstub_handle_t arm7_gdb_stub; + struct armcpu_memory_iface *arm9_memio = &arm9_base_memory_iface; + struct armcpu_memory_iface *arm7_memio = &arm7_base_memory_iface; + struct armcpu_ctrl_iface *arm9_ctrl_iface; + struct armcpu_ctrl_iface *arm7_ctrl_iface; + + /* the firmware settings */ + struct NDS_fw_config_data fw_config; + + /* default the firmware settings, they may get changed later */ + NDS_FillDefaultFirmwareConfigData( &fw_config); + + /* use any language set on the command line */ + if ( my_config->firmware_language != -1) { + fw_config.language = my_config->firmware_language; + } + + bad_glob_cflash_disk_image_file = my_config->cflash_disk_image_file; + #ifdef DEBUG LogStart(); #endif - gtk_init(&argc, &argv); - if(SDL_Init(SDL_INIT_VIDEO) == -1) + if ( my_config->arm9_gdb_port != 0) { + arm9_gdb_stub = createStub_gdb( my_config->arm9_gdb_port, + &arm9_memio, + &arm9_base_memory_iface); + + if ( arm9_gdb_stub == NULL) { + fprintf( stderr, "Failed to create ARM9 gdbstub on port %d\n", + my_config->arm9_gdb_port); + exit( -1); + } + } + if ( my_config->arm7_gdb_port != 0) { + arm7_gdb_stub = createStub_gdb( my_config->arm7_gdb_port, + &arm7_memio, + &arm7_base_memory_iface); + + if ( arm7_gdb_stub == NULL) { + fprintf( stderr, "Failed to create ARM7 gdbstub on port %d\n", + my_config->arm7_gdb_port); + exit( -1); + } + } + + +#ifdef GTKGLEXT_AVAILABLE + /* Try double-buffered visual */ + glconfig = gdk_gl_config_new_by_mode (GDK_GL_MODE_RGB | + GDK_GL_MODE_DEPTH | + GDK_GL_MODE_DOUBLE); + if (glconfig == NULL) + { + g_print ("*** Cannot find the double-buffered visual.\n"); + g_print ("*** Trying single-buffered visual.\n"); + + /* Try single-buffered visual */ + glconfig = gdk_gl_config_new_by_mode (GDK_GL_MODE_RGB | + GDK_GL_MODE_DEPTH); + if (glconfig == NULL) { + g_print ("*** No appropriate OpenGL-capable visual found.\n"); + exit (1); + } + } +#endif + /* FIXME: SDL_INIT_VIDEO is needed for joystick support to work!? + Perhaps it needs a "window" to catch events...? */ + if(SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO) == -1) { fprintf(stderr, "Error trying to initialize SDL: %s\n", SDL_GetError()); return 1; } - desmume_init(); + desmume_init( arm9_memio, &arm9_ctrl_iface, + arm7_memio, &arm7_ctrl_iface, + my_config->disable_sound); + + + /* + * Activate the GDB stubs + * This has to come after the NDS_Init (called in desmume_init) + * where the cpus are set up. + */ + if ( my_config->arm9_gdb_port != 0) { + activateStub_gdb( arm9_gdb_stub, arm9_ctrl_iface); + } + if ( my_config->arm7_gdb_port != 0) { + activateStub_gdb( arm7_gdb_stub, arm7_ctrl_iface); + } + + /* Create the dummy firmware */ + NDS_CreateDummyFirmware( &fw_config); + /* Initialize joysticks */ if(!init_joy()) return 1; @@ -966,7 +1678,14 @@ /* Creation de la fenetre */ pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(pWindow), "Desmume"); - gtk_window_set_policy (GTK_WINDOW (pWindow), FALSE, FALSE, FALSE); + + if ( my_config->screen.opengl) { + gtk_window_set_resizable(GTK_WINDOW (pWindow), TRUE); + } + else { + gtk_window_set_resizable(GTK_WINDOW (pWindow), FALSE); + } + gtk_window_set_icon(GTK_WINDOW (pWindow), gdk_pixbuf_new_from_xpm_data(DeSmuME_xpm)); g_signal_connect(G_OBJECT(pWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL); @@ -1049,20 +1768,22 @@ gtk_menu_shell_append(GTK_MENU_SHELL(mEmulation), pMenuItem); // TODO: Un jour, peut être... >< - mSize = gtk_menu_new(); - pMenuItem = gtk_menu_item_new_with_label("Size"); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mSize); - gtk_menu_shell_append(GTK_MENU_SHELL(mGraphics), pMenuItem); + if ( !my_config->screen.opengl) { + mSize = gtk_menu_new(); + pMenuItem = gtk_menu_item_new_with_label("Size"); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mSize); + gtk_menu_shell_append(GTK_MENU_SHELL(mGraphics), pMenuItem); - for(i = 1; i < MAX_SCREENCOEFF; i++) { - char sizeRadio_buf[16]; - sprintf(sizeRadio_buf, "x%d", i); - if(i>1) mSize_Radio[i] = gtk_radio_menu_item_new_with_label_from_widget(GTK_RADIO_MENU_ITEM(mSize_Radio[i-1]), sizeRadio_buf); - else mSize_Radio[i] = gtk_radio_menu_item_new_with_label(NULL, sizeRadio_buf); - g_signal_connect(G_OBJECT(mSize_Radio[i]), "activate", G_CALLBACK(Modify_ScreenCoeff), GINT_TO_POINTER(i)); - gtk_menu_shell_append(GTK_MENU_SHELL(mSize), mSize_Radio[i]); - } - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mFrameskip_Radio[0]), TRUE); + for(i = 1; i < MAX_SCREENCOEFF; i++) { + char sizeRadio_buf[16]; + sprintf(sizeRadio_buf, "x%d", i); + if(i>1) mSize_Radio[i] = gtk_radio_menu_item_new_with_label_from_widget(GTK_RADIO_MENU_ITEM(mSize_Radio[i-1]), sizeRadio_buf); + else mSize_Radio[i] = gtk_radio_menu_item_new_with_label(NULL, sizeRadio_buf); + g_signal_connect(G_OBJECT(mSize_Radio[i]), "activate", G_CALLBACK(Modify_ScreenCoeff), GINT_TO_POINTER(i)); + gtk_menu_shell_append(GTK_MENU_SHELL(mSize), mSize_Radio[i]); + } + } + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mFrameskip_Radio[0]), TRUE); mLayers = gtk_menu_new(); pMenuItem = gtk_menu_item_new_with_label("Layers"); @@ -1151,23 +1872,102 @@ gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), GTK_TOOL_ITEM(gtk_action_create_tool_item(gtk_action_group_get_action(action_group, "quit"))), -1); /* Création de l'endroit pour l'affichage des écrans */ +#ifdef GTKGLEXT_AVAILABLE + if ( my_config->screen.opengl) { + /* + * Create the top screen render area + */ + top_screen_widget = gtk_drawing_area_new(); + gtk_drawing_area_size(GTK_DRAWING_AREA(top_screen_widget), 256, 192); + gtk_widget_set_gl_capability ( top_screen_widget, + glconfig, + NULL, + TRUE, + GDK_GL_RGBA_TYPE); + + g_signal_connect_after (G_OBJECT (top_screen_widget), "realize", + G_CALLBACK (gtk_init_main_gl_area), + NULL); + gtk_widget_set_events( top_screen_widget, GDK_EXPOSURE_MASK); + g_signal_connect( G_OBJECT(top_screen_widget), "expose_event", + G_CALLBACK(top_screen_expose_fn), + &my_config->screen.soft_colour) ; + g_signal_connect( G_OBJECT(top_screen_widget), "configure_event", + G_CALLBACK(common_configure_fn), NULL ) ; + + gtk_box_pack_start(GTK_BOX(pVBox), top_screen_widget, TRUE, TRUE, 0); + + /* realise the topscreen so we can get the openGL context */ + gtk_widget_realize ( top_screen_widget); + glcontext = gtk_widget_get_gl_context( top_screen_widget); + + /*g_print("Window is direct? %d\n", + gdk_gl_context_is_direct( glcontext));*/ + + /* + *create the bottom screen drawing area. + */ + bottom_screen_widget = gtk_drawing_area_new(); + gtk_drawing_area_size(GTK_DRAWING_AREA(bottom_screen_widget), 256, 192); + gtk_widget_set_gl_capability ( bottom_screen_widget, + glconfig, + glcontext, + TRUE, + GDK_GL_RGBA_TYPE); + + g_signal_connect_after (G_OBJECT (bottom_screen_widget), "realize", + G_CALLBACK (gtk_init_sub_gl_area), + NULL); + gtk_widget_set_events( bottom_screen_widget, + GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK | + GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | + GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK ); + g_signal_connect( G_OBJECT(bottom_screen_widget), "expose_event", + G_CALLBACK(bottom_screen_expose_fn), NULL ) ; + g_signal_connect( G_OBJECT(bottom_screen_widget), "configure_event", + G_CALLBACK(common_configure_fn), NULL ) ; + g_signal_connect(G_OBJECT(bottom_screen_widget), "button_press_event", + G_CALLBACK(Stylus_Press), &my_config->screen.opengl); + g_signal_connect(G_OBJECT(bottom_screen_widget), "button_release_event", + G_CALLBACK(Stylus_Release), NULL); + g_signal_connect(G_OBJECT(bottom_screen_widget), "motion_notify_event", + G_CALLBACK(Stylus_Move), &my_config->screen.opengl); + + gtk_box_pack_start(GTK_BOX(pVBox), bottom_screen_widget, TRUE, TRUE, 0); + + /* each frame expose the top screen */ + nds_screen_widget = top_screen_widget; + } + else +#endif + { + pDrawingArea= gtk_drawing_area_new(); - pDrawingArea= gtk_drawing_area_new(); - - gtk_drawing_area_size(GTK_DRAWING_AREA(pDrawingArea), 256, 384); - gtk_widget_set_usize (pDrawingArea, 256, 384); + gtk_drawing_area_size(GTK_DRAWING_AREA(pDrawingArea), 256, 384); + gtk_widget_set_usize (pDrawingArea, 256, 384); - gtk_widget_set_events(pDrawingArea, GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK ); - - g_signal_connect(G_OBJECT(pDrawingArea), "button_press_event", G_CALLBACK(Stylus_Press), NULL); - g_signal_connect(G_OBJECT(pDrawingArea), "button_release_event", G_CALLBACK(Stylus_Release), NULL); - g_signal_connect(G_OBJECT(pDrawingArea), "motion_notify_event", G_CALLBACK(Stylus_Move), NULL); - - - g_signal_connect( G_OBJECT(pDrawingArea), "realize", G_CALLBACK(Draw), NULL ) ; - g_signal_connect( G_OBJECT(pDrawingArea), "expose_event", G_CALLBACK(gtkFloatExposeEvent), NULL ) ; + gtk_widget_set_events(pDrawingArea, + GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK | + GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | + GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK ); + + g_signal_connect(G_OBJECT(pDrawingArea), "button_press_event", + G_CALLBACK(Stylus_Press), &my_config->screen.opengl); + g_signal_connect(G_OBJECT(pDrawingArea), "button_release_event", + G_CALLBACK(Stylus_Release), NULL); + g_signal_connect(G_OBJECT(pDrawingArea), "motion_notify_event", + G_CALLBACK(Stylus_Move), &my_config->screen.opengl); + + + g_signal_connect( G_OBJECT(pDrawingArea), "realize", + G_CALLBACK(Draw), NULL ) ; + g_signal_connect( G_OBJECT(pDrawingArea), "expose_event", + G_CALLBACK(gtkFloatExposeEvent), NULL ) ; - gtk_box_pack_start(GTK_BOX(pVBox), pDrawingArea, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(pVBox), pDrawingArea, FALSE, FALSE, 0); + + nds_screen_widget = pDrawingArea; + } /* Création de la barre d'état */ @@ -1182,11 +1982,58 @@ gtk_widget_show_all(pWindow); //LoadFirmware("fw.bin"); + + gtk_fps_limiter_disabled = my_config->disable_limiter; + if ( !gtk_fps_limiter_disabled) { + /* create the semaphore used for fps limiting */ + fps_limiter_semaphore = SDL_CreateSemaphore( 1); + + /* start a SDL timer for every FPS_LIMITER_FRAME_PERIOD frames to keep us at 60 fps */ + limiter_timer = SDL_AddTimer( 16 * FPS_LIMITER_FRAME_PERIOD, fps_limiter_fn, fps_limiter_semaphore); + if ( limiter_timer == NULL) { + fprintf( stderr, "Error trying to start FPS limiter timer: %s\n", + SDL_GetError()); + return 1; + } + } + + /* + * Set the 3D emulation to use + */ + { + int use_null_3d = my_config->disable_3d; + +#ifdef GTKGLEXT_AVAILABLE + if ( !use_null_3d) { + /* setup the gdk 3D emulation */ + if ( init_opengl_gdk_3Demu()) { + NDS_3D_SetDriver ( 1); + + if (!gpu3D->NDS_3D_Init ()) { + fprintf( stderr, "Failed to initialise openGL 3D emulation; " + "removing 3D support\n"); + use_null_3d = 1; + } + } + else { + fprintf( stderr, "Failed to setup openGL 3D emulation; " + "removing 3D support\n"); + use_null_3d = 1; + } + } +#endif + + if ( use_null_3d) { + NDS_3D_SetDriver ( 0); + gpu3D->NDS_3D_Init(); + } + } + /* Vérifie la ligne de commandes */ - if(commandLine_File) + if( my_config->nds_file != NULL) { - if(Open(commandLine_File) >= 0) + if(Open( my_config->nds_file, bad_glob_cflash_disk_image_file) >= 0) { Launch(); } @@ -1196,7 +2043,7 @@ GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, - "Unable to load :\n%s", commandLine_File); + "Unable to load :\n%s", my_config->nds_file); gtk_dialog_run(GTK_DIALOG(pDialog)); gtk_widget_destroy(pDialog); } @@ -1211,6 +2058,12 @@ desmume_free(); + if ( !gtk_fps_limiter_disabled) { + /* tidy up the FPS limiter timer and semaphore */ + SDL_RemoveTimer( limiter_timer); + SDL_DestroySemaphore( fps_limiter_semaphore); + } + #ifdef DEBUG LogStop(); #endif @@ -1218,8 +2071,57 @@ uninit_joy(); SDL_Quit(); - + Write_ConfigFile(); + + if ( my_config->arm9_gdb_port != 0) { + destroyStub_gdb( arm9_gdb_stub); + } + if ( my_config->arm7_gdb_port != 0) { + destroyStub_gdb( arm7_gdb_stub); + } return EXIT_SUCCESS; } + + +int +main (int argc, char *argv[]) { + struct configured_features my_config; + + init_configured_features( &my_config); + + if (!g_thread_supported()) + g_thread_init( NULL); + + gtk_init(&argc, &argv); + +#ifdef GTKGLEXT_AVAILABLE + gtk_gl_init( &argc, &argv); +#endif + + if ( !fill_configured_features( &my_config, argc, argv)) { + exit(0); + } + + return common_gtk_main( &my_config); +} + +#ifdef WIN32 +int WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) +{ + int argc = 0; + char *argv[] = NULL; + + /* + * FIXME: + * Emulate the argc and argv main parameters. Could do this using + * CommandLineToArgvW and then convert the wide chars to thin chars. + * Or parse the wide chars directly and call common_gtk_main with a + * filled configuration structure. + */ + main( argc, argv); +} +#endif + + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/Makefile.am /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/Makefile.am --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/Makefile.am 2007-02-04 15:49:02.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/Makefile.am 2007-06-29 04:01:45.000000000 -0500 @@ -1,3 +1,11 @@ +include $(top_srcdir)/src/desmume.mk + +AM_CPPFLAGS += $(SDL_CFLAGS) $(GTK_CFLAGS) $(GTKGLEXT_CFLAGS) $(GTHREAD_CFLAGS) + +Applicationsdir = $(datadir)/applications +Applications_DATA = desmume.desktop +pixmapdir = $(datadir)/pixmaps +pixmap_DATA = DeSmuME.xpm EXTRA_DIST = DeSmuME.xpm dev-cpp/desmume.dev dev-cpp/desmume.layout \ dev-cpp/Makefile.win dev-cpp/pthread.h dev-cpp/sched.h \ dev-cpp/semaphore.h @@ -10,7 +18,7 @@ globals.h \ ../sndsdl.c \ ../ctrlssdl.h ../ctrlssdl.c \ + gdk_3Demu.c gdk_3Demu.h \ main.c -desmume_LDADD = ../libdesmume.a $(SDL_LIBS) $(GTK_LIBS) -desmume_CFLAGS = $(SDL_CFLAGS) $(GTK_CFLAGS) -#desmume_LDFLAGS = -rdynamic +desmume_LDADD = ../libdesmume.a ../gdbstub/libgdbstub.a \ + $(SDL_LIBS) $(GTK_LIBS) $(GTKGLEXT_LIBS) $(GTHREAD_LIBS) diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/Makefile.in /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/Makefile.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk/Makefile.in 2007-02-04 15:49:02.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk/Makefile.in 2007-09-03 12:31:41.000000000 -0500 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,15 +14,12 @@ @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -37,27 +34,29 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/desmume.desktop.in $(top_srcdir)/src/desmume.mk bin_PROGRAMS = desmume$(EXEEXT) subdir = src/gtk -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = desmume.desktop +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(Applicationsdir)" \ + "$(DESTDIR)$(pixmapdir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) -am_desmume_OBJECTS = desmume-gtk-compat.$(OBJEXT) \ - desmume-desmume.$(OBJEXT) desmume-dToolsList.$(OBJEXT) \ - desmume-ioregsView.$(OBJEXT) desmume-sndsdl.$(OBJEXT) \ - desmume-ctrlssdl.$(OBJEXT) desmume-main.$(OBJEXT) +am_desmume_OBJECTS = gtk-compat.$(OBJEXT) desmume.$(OBJEXT) \ + dToolsList.$(OBJEXT) ioregsView.$(OBJEXT) sndsdl.$(OBJEXT) \ + ctrlssdl.$(OBJEXT) gdk_3Demu.$(OBJEXT) main.$(OBJEXT) desmume_OBJECTS = $(am_desmume_OBJECTS) am__DEPENDENCIES_1 = -desmume_DEPENDENCIES = ../libdesmume.a $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I. -I$(srcdir) +desmume_DEPENDENCIES = ../libdesmume.a ../gdbstub/libgdbstub.a \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -66,26 +65,34 @@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(desmume_SOURCES) DIST_SOURCES = $(desmume_SOURCES) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +ApplicationsDATA_INSTALL = $(INSTALL_DATA) +pixmapDATA_INSTALL = $(INSTALL_DATA) +DATA = $(Applications_DATA) $(pixmap_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ +ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ @@ -93,14 +100,48 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLADEUI_UNINSTALLED_DIR = @GLADEUI_UNINSTALLED_DIR@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ GREP = @GREP@ +GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ +GTHREAD_LIBS = @GTHREAD_LIBS@ +GTKGLEXT_CFLAGS = @GTKGLEXT_CFLAGS@ +GTKGLEXT_LIBS = @GTKGLEXT_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ HAVE_PKG = @HAVE_PKG@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ +INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ +INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ +INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ +INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ +INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ +INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ +INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ +INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ +INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ +INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ +INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ +INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ +INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ +INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ LDFLAGS = @LDFLAGS@ LIBGLADE_CFLAGS = @LIBGLADE_CFLAGS@ LIBGLADE_LIBS = @LIBGLADE_LIBS@ @@ -108,9 +149,11 @@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -120,6 +163,13 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_DIR = @PO_DIR@ +PO_FILES = @PO_FILES@ +PO_FILES_IN = @PO_FILES_IN@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RANLIB = @RANLIB@ SDLCONFIG = @SDLCONFIG@ SDL_CFLAGS = @SDL_CFLAGS@ @@ -129,13 +179,14 @@ STRIP = @STRIP@ UI_DIR = @UI_DIR@ USE_MAINTAINER_MODE = @USE_MAINTAINER_MODE@ +USE_NLS = @USE_NLS@ VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -147,6 +198,7 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ desmume_arch = @desmume_arch@ @@ -175,12 +227,23 @@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CFLAGS = +AM_CPPFLAGS = -I$(top_srcdir)/src $(SDL_CFLAGS) $(GTK_CFLAGS) \ + $(GTKGLEXT_CFLAGS) $(GTHREAD_CFLAGS) +AM_LDFLAGS = +Applicationsdir = $(datadir)/applications +Applications_DATA = desmume.desktop +pixmapdir = $(datadir)/pixmaps +pixmap_DATA = DeSmuME.xpm EXTRA_DIST = DeSmuME.xpm dev-cpp/desmume.dev dev-cpp/desmume.layout \ dev-cpp/Makefile.win dev-cpp/pthread.h dev-cpp/sched.h \ dev-cpp/semaphore.h @@ -193,15 +256,17 @@ globals.h \ ../sndsdl.c \ ../ctrlssdl.h ../ctrlssdl.c \ + gdk_3Demu.c gdk_3Demu.h \ main.c -desmume_LDADD = ../libdesmume.a $(SDL_LIBS) $(GTK_LIBS) -desmume_CFLAGS = $(SDL_CFLAGS) $(GTK_CFLAGS) +desmume_LDADD = ../libdesmume.a ../gdbstub/libgdbstub.a \ + $(SDL_LIBS) $(GTK_LIBS) $(GTKGLEXT_LIBS) $(GTHREAD_LIBS) + all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/src/desmume.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -230,9 +295,11 @@ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +desmume.desktop: $(top_builddir)/config.status $(srcdir)/desmume.desktop.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ @@ -255,7 +322,7 @@ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) desmume$(EXEEXT): $(desmume_OBJECTS) $(desmume_DEPENDENCIES) @rm -f desmume$(EXEEXT) - $(LINK) $(desmume_LDFLAGS) $(desmume_OBJECTS) $(desmume_LDADD) $(LIBS) + $(LINK) $(desmume_OBJECTS) $(desmume_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -263,126 +330,104 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume-ctrlssdl.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume-dToolsList.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume-desmume.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume-gtk-compat.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume-ioregsView.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume-main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume-sndsdl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctrlssdl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dToolsList.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdk_3Demu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk-compat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioregsView.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndsdl.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -desmume-gtk-compat.o: gtk-compat.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -MT desmume-gtk-compat.o -MD -MP -MF "$(DEPDIR)/desmume-gtk-compat.Tpo" -c -o desmume-gtk-compat.o `test -f 'gtk-compat.c' || echo '$(srcdir)/'`gtk-compat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume-gtk-compat.Tpo" "$(DEPDIR)/desmume-gtk-compat.Po"; else rm -f "$(DEPDIR)/desmume-gtk-compat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtk-compat.c' object='desmume-gtk-compat.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -c -o desmume-gtk-compat.o `test -f 'gtk-compat.c' || echo '$(srcdir)/'`gtk-compat.c - -desmume-gtk-compat.obj: gtk-compat.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -MT desmume-gtk-compat.obj -MD -MP -MF "$(DEPDIR)/desmume-gtk-compat.Tpo" -c -o desmume-gtk-compat.obj `if test -f 'gtk-compat.c'; then $(CYGPATH_W) 'gtk-compat.c'; else $(CYGPATH_W) '$(srcdir)/gtk-compat.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume-gtk-compat.Tpo" "$(DEPDIR)/desmume-gtk-compat.Po"; else rm -f "$(DEPDIR)/desmume-gtk-compat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtk-compat.c' object='desmume-gtk-compat.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -c -o desmume-gtk-compat.obj `if test -f 'gtk-compat.c'; then $(CYGPATH_W) 'gtk-compat.c'; else $(CYGPATH_W) '$(srcdir)/gtk-compat.c'; fi` - -desmume-desmume.o: desmume.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -MT desmume-desmume.o -MD -MP -MF "$(DEPDIR)/desmume-desmume.Tpo" -c -o desmume-desmume.o `test -f 'desmume.c' || echo '$(srcdir)/'`desmume.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume-desmume.Tpo" "$(DEPDIR)/desmume-desmume.Po"; else rm -f "$(DEPDIR)/desmume-desmume.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='desmume.c' object='desmume-desmume.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -c -o desmume-desmume.o `test -f 'desmume.c' || echo '$(srcdir)/'`desmume.c - -desmume-desmume.obj: desmume.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -MT desmume-desmume.obj -MD -MP -MF "$(DEPDIR)/desmume-desmume.Tpo" -c -o desmume-desmume.obj `if test -f 'desmume.c'; then $(CYGPATH_W) 'desmume.c'; else $(CYGPATH_W) '$(srcdir)/desmume.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume-desmume.Tpo" "$(DEPDIR)/desmume-desmume.Po"; else rm -f "$(DEPDIR)/desmume-desmume.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='desmume.c' object='desmume-desmume.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -c -o desmume-desmume.obj `if test -f 'desmume.c'; then $(CYGPATH_W) 'desmume.c'; else $(CYGPATH_W) '$(srcdir)/desmume.c'; fi` - -desmume-dToolsList.o: dToolsList.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -MT desmume-dToolsList.o -MD -MP -MF "$(DEPDIR)/desmume-dToolsList.Tpo" -c -o desmume-dToolsList.o `test -f 'dToolsList.c' || echo '$(srcdir)/'`dToolsList.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume-dToolsList.Tpo" "$(DEPDIR)/desmume-dToolsList.Po"; else rm -f "$(DEPDIR)/desmume-dToolsList.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dToolsList.c' object='desmume-dToolsList.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -c -o desmume-dToolsList.o `test -f 'dToolsList.c' || echo '$(srcdir)/'`dToolsList.c - -desmume-dToolsList.obj: dToolsList.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -MT desmume-dToolsList.obj -MD -MP -MF "$(DEPDIR)/desmume-dToolsList.Tpo" -c -o desmume-dToolsList.obj `if test -f 'dToolsList.c'; then $(CYGPATH_W) 'dToolsList.c'; else $(CYGPATH_W) '$(srcdir)/dToolsList.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume-dToolsList.Tpo" "$(DEPDIR)/desmume-dToolsList.Po"; else rm -f "$(DEPDIR)/desmume-dToolsList.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dToolsList.c' object='desmume-dToolsList.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -c -o desmume-dToolsList.obj `if test -f 'dToolsList.c'; then $(CYGPATH_W) 'dToolsList.c'; else $(CYGPATH_W) '$(srcdir)/dToolsList.c'; fi` - -desmume-ioregsView.o: tools/ioregsView.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -MT desmume-ioregsView.o -MD -MP -MF "$(DEPDIR)/desmume-ioregsView.Tpo" -c -o desmume-ioregsView.o `test -f 'tools/ioregsView.c' || echo '$(srcdir)/'`tools/ioregsView.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume-ioregsView.Tpo" "$(DEPDIR)/desmume-ioregsView.Po"; else rm -f "$(DEPDIR)/desmume-ioregsView.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tools/ioregsView.c' object='desmume-ioregsView.o' libtool=no @AMDEPBACKSLASH@ +ioregsView.o: tools/ioregsView.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ioregsView.o -MD -MP -MF $(DEPDIR)/ioregsView.Tpo -c -o ioregsView.o `test -f 'tools/ioregsView.c' || echo '$(srcdir)/'`tools/ioregsView.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ioregsView.Tpo $(DEPDIR)/ioregsView.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tools/ioregsView.c' object='ioregsView.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -c -o desmume-ioregsView.o `test -f 'tools/ioregsView.c' || echo '$(srcdir)/'`tools/ioregsView.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ioregsView.o `test -f 'tools/ioregsView.c' || echo '$(srcdir)/'`tools/ioregsView.c -desmume-ioregsView.obj: tools/ioregsView.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -MT desmume-ioregsView.obj -MD -MP -MF "$(DEPDIR)/desmume-ioregsView.Tpo" -c -o desmume-ioregsView.obj `if test -f 'tools/ioregsView.c'; then $(CYGPATH_W) 'tools/ioregsView.c'; else $(CYGPATH_W) '$(srcdir)/tools/ioregsView.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume-ioregsView.Tpo" "$(DEPDIR)/desmume-ioregsView.Po"; else rm -f "$(DEPDIR)/desmume-ioregsView.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tools/ioregsView.c' object='desmume-ioregsView.obj' libtool=no @AMDEPBACKSLASH@ +ioregsView.obj: tools/ioregsView.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ioregsView.obj -MD -MP -MF $(DEPDIR)/ioregsView.Tpo -c -o ioregsView.obj `if test -f 'tools/ioregsView.c'; then $(CYGPATH_W) 'tools/ioregsView.c'; else $(CYGPATH_W) '$(srcdir)/tools/ioregsView.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ioregsView.Tpo $(DEPDIR)/ioregsView.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tools/ioregsView.c' object='ioregsView.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -c -o desmume-ioregsView.obj `if test -f 'tools/ioregsView.c'; then $(CYGPATH_W) 'tools/ioregsView.c'; else $(CYGPATH_W) '$(srcdir)/tools/ioregsView.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ioregsView.obj `if test -f 'tools/ioregsView.c'; then $(CYGPATH_W) 'tools/ioregsView.c'; else $(CYGPATH_W) '$(srcdir)/tools/ioregsView.c'; fi` -desmume-sndsdl.o: ../sndsdl.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -MT desmume-sndsdl.o -MD -MP -MF "$(DEPDIR)/desmume-sndsdl.Tpo" -c -o desmume-sndsdl.o `test -f '../sndsdl.c' || echo '$(srcdir)/'`../sndsdl.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume-sndsdl.Tpo" "$(DEPDIR)/desmume-sndsdl.Po"; else rm -f "$(DEPDIR)/desmume-sndsdl.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../sndsdl.c' object='desmume-sndsdl.o' libtool=no @AMDEPBACKSLASH@ +sndsdl.o: ../sndsdl.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sndsdl.o -MD -MP -MF $(DEPDIR)/sndsdl.Tpo -c -o sndsdl.o `test -f '../sndsdl.c' || echo '$(srcdir)/'`../sndsdl.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/sndsdl.Tpo $(DEPDIR)/sndsdl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../sndsdl.c' object='sndsdl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -c -o desmume-sndsdl.o `test -f '../sndsdl.c' || echo '$(srcdir)/'`../sndsdl.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sndsdl.o `test -f '../sndsdl.c' || echo '$(srcdir)/'`../sndsdl.c -desmume-sndsdl.obj: ../sndsdl.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -MT desmume-sndsdl.obj -MD -MP -MF "$(DEPDIR)/desmume-sndsdl.Tpo" -c -o desmume-sndsdl.obj `if test -f '../sndsdl.c'; then $(CYGPATH_W) '../sndsdl.c'; else $(CYGPATH_W) '$(srcdir)/../sndsdl.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume-sndsdl.Tpo" "$(DEPDIR)/desmume-sndsdl.Po"; else rm -f "$(DEPDIR)/desmume-sndsdl.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../sndsdl.c' object='desmume-sndsdl.obj' libtool=no @AMDEPBACKSLASH@ +sndsdl.obj: ../sndsdl.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sndsdl.obj -MD -MP -MF $(DEPDIR)/sndsdl.Tpo -c -o sndsdl.obj `if test -f '../sndsdl.c'; then $(CYGPATH_W) '../sndsdl.c'; else $(CYGPATH_W) '$(srcdir)/../sndsdl.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/sndsdl.Tpo $(DEPDIR)/sndsdl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../sndsdl.c' object='sndsdl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -c -o desmume-sndsdl.obj `if test -f '../sndsdl.c'; then $(CYGPATH_W) '../sndsdl.c'; else $(CYGPATH_W) '$(srcdir)/../sndsdl.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sndsdl.obj `if test -f '../sndsdl.c'; then $(CYGPATH_W) '../sndsdl.c'; else $(CYGPATH_W) '$(srcdir)/../sndsdl.c'; fi` -desmume-ctrlssdl.o: ../ctrlssdl.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -MT desmume-ctrlssdl.o -MD -MP -MF "$(DEPDIR)/desmume-ctrlssdl.Tpo" -c -o desmume-ctrlssdl.o `test -f '../ctrlssdl.c' || echo '$(srcdir)/'`../ctrlssdl.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume-ctrlssdl.Tpo" "$(DEPDIR)/desmume-ctrlssdl.Po"; else rm -f "$(DEPDIR)/desmume-ctrlssdl.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ctrlssdl.c' object='desmume-ctrlssdl.o' libtool=no @AMDEPBACKSLASH@ +ctrlssdl.o: ../ctrlssdl.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ctrlssdl.o -MD -MP -MF $(DEPDIR)/ctrlssdl.Tpo -c -o ctrlssdl.o `test -f '../ctrlssdl.c' || echo '$(srcdir)/'`../ctrlssdl.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ctrlssdl.Tpo $(DEPDIR)/ctrlssdl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ctrlssdl.c' object='ctrlssdl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -c -o desmume-ctrlssdl.o `test -f '../ctrlssdl.c' || echo '$(srcdir)/'`../ctrlssdl.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ctrlssdl.o `test -f '../ctrlssdl.c' || echo '$(srcdir)/'`../ctrlssdl.c -desmume-ctrlssdl.obj: ../ctrlssdl.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -MT desmume-ctrlssdl.obj -MD -MP -MF "$(DEPDIR)/desmume-ctrlssdl.Tpo" -c -o desmume-ctrlssdl.obj `if test -f '../ctrlssdl.c'; then $(CYGPATH_W) '../ctrlssdl.c'; else $(CYGPATH_W) '$(srcdir)/../ctrlssdl.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume-ctrlssdl.Tpo" "$(DEPDIR)/desmume-ctrlssdl.Po"; else rm -f "$(DEPDIR)/desmume-ctrlssdl.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ctrlssdl.c' object='desmume-ctrlssdl.obj' libtool=no @AMDEPBACKSLASH@ +ctrlssdl.obj: ../ctrlssdl.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ctrlssdl.obj -MD -MP -MF $(DEPDIR)/ctrlssdl.Tpo -c -o ctrlssdl.obj `if test -f '../ctrlssdl.c'; then $(CYGPATH_W) '../ctrlssdl.c'; else $(CYGPATH_W) '$(srcdir)/../ctrlssdl.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ctrlssdl.Tpo $(DEPDIR)/ctrlssdl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ctrlssdl.c' object='ctrlssdl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -c -o desmume-ctrlssdl.obj `if test -f '../ctrlssdl.c'; then $(CYGPATH_W) '../ctrlssdl.c'; else $(CYGPATH_W) '$(srcdir)/../ctrlssdl.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ctrlssdl.obj `if test -f '../ctrlssdl.c'; then $(CYGPATH_W) '../ctrlssdl.c'; else $(CYGPATH_W) '$(srcdir)/../ctrlssdl.c'; fi` +install-ApplicationsDATA: $(Applications_DATA) + @$(NORMAL_INSTALL) + test -z "$(Applicationsdir)" || $(MKDIR_P) "$(DESTDIR)$(Applicationsdir)" + @list='$(Applications_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(ApplicationsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(Applicationsdir)/$$f'"; \ + $(ApplicationsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(Applicationsdir)/$$f"; \ + done -desmume-main.o: main.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -MT desmume-main.o -MD -MP -MF "$(DEPDIR)/desmume-main.Tpo" -c -o desmume-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume-main.Tpo" "$(DEPDIR)/desmume-main.Po"; else rm -f "$(DEPDIR)/desmume-main.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='desmume-main.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -c -o desmume-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c +uninstall-ApplicationsDATA: + @$(NORMAL_UNINSTALL) + @list='$(Applications_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(Applicationsdir)/$$f'"; \ + rm -f "$(DESTDIR)$(Applicationsdir)/$$f"; \ + done +install-pixmapDATA: $(pixmap_DATA) + @$(NORMAL_INSTALL) + test -z "$(pixmapdir)" || $(MKDIR_P) "$(DESTDIR)$(pixmapdir)" + @list='$(pixmap_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pixmapDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pixmapdir)/$$f'"; \ + $(pixmapDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pixmapdir)/$$f"; \ + done -desmume-main.obj: main.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -MT desmume-main.obj -MD -MP -MF "$(DEPDIR)/desmume-main.Tpo" -c -o desmume-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume-main.Tpo" "$(DEPDIR)/desmume-main.Po"; else rm -f "$(DEPDIR)/desmume-main.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='desmume-main.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_CFLAGS) $(CFLAGS) -c -o desmume-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` -uninstall-info-am: +uninstall-pixmapDATA: + @$(NORMAL_UNINSTALL) + @list='$(pixmap_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pixmapdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pixmapdir)/$$f"; \ + done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -433,23 +478,21 @@ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/dev-cpp - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -462,10 +505,10 @@ done check-am: all-am check: check-am -all-am: Makefile $(PROGRAMS) +all-am: Makefile $(PROGRAMS) $(DATA) installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(Applicationsdir)" "$(DESTDIR)$(pixmapdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -511,14 +554,22 @@ info-am: -install-data-am: +install-data-am: install-ApplicationsDATA install-pixmapDATA + +install-dvi: install-dvi-am install-exec-am: install-binPROGRAMS +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -538,20 +589,26 @@ ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-info-am +uninstall-am: uninstall-ApplicationsDATA uninstall-binPROGRAMS \ + uninstall-pixmapDATA + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ + html-am info info-am install install-ApplicationsDATA \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-pixmapDATA \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-info-am + uninstall-ApplicationsDATA uninstall-am uninstall-binPROGRAMS \ + uninstall-pixmapDATA -#desmume_LDFLAGS = -rdynamic # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/callbacks.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/callbacks.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/callbacks.c 2007-02-01 06:43:02.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/callbacks.c 2007-07-15 16:50:30.000000000 -0500 @@ -24,8 +24,10 @@ /* globals */ int Frameskip = 0; +gboolean ScreenRightForce=FALSE; gboolean ScreenRight=FALSE; gboolean ScreenGap=FALSE; +gboolean ScreenInvert=FALSE; /* inline & protos */ @@ -47,19 +49,23 @@ void MAINWINDOW_RESIZE() { GtkWidget * spacer1 = glade_xml_get_widget(xml, "misc_sep3"); GtkWidget * spacer2 = glade_xml_get_widget(xml, "misc_sep4"); - int dim = 66 * ScreenCoeff_Size; - + int dim1,dim2; + BOOL rotate = (ScreenRotate==90.0 || ScreenRotate==270.0 ); + + dim1 = dim2 = 66 * ScreenCoeff_Size[0]; + /* sees whether we want a gap */ - if (!ScreenGap) dim = -1; - if (ScreenRight && ScreenRotate) { - gtk_widget_set_usize(spacer1, dim, -1); - } else if (!ScreenRight && !ScreenRotate) { - gtk_widget_set_usize(spacer2, -1, dim); + if (!ScreenGap) dim1 = dim2 = -1; + if (ScreenRight == rotate) { + if (ScreenRight) + dim2 = -1; + else + dim1 = -1; } else { - gtk_widget_set_usize(spacer1, -1, -1); - gtk_widget_set_usize(spacer2, -1, -1); + dim1 = dim2 = -1; } - + gtk_widget_set_usize(spacer1, dim1, -1); + gtk_widget_set_usize(spacer2, -1, dim2); gtk_window_resize ((GtkWindow*)pWindow,1,1); } @@ -82,7 +88,7 @@ pParent = GTK_WIDGET(pWindow); /* Creating the selection window */ - pFileSelection = gtk_file_chooser_dialog_new("Open...", + pFileSelection = gtk_file_chooser_dialog_new(_("Open..."), GTK_WINDOW(pParent), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, @@ -91,9 +97,9 @@ /* On limite les actions a cette fenetre */ gtk_window_set_modal(GTK_WINDOW(pFileSelection), TRUE); - ADD_FILTER(pFileSelection, "*.nds", "Nds binary (.nds)"); - ADD_FILTER(pFileSelection, "*.ds.gba", "Nds binary with loader (.ds.gba)"); - ADD_FILTER(pFileSelection, "*", "All files"); + ADD_FILTER(pFileSelection, "*.nds", _("Nds binary (.nds)")); + ADD_FILTER(pFileSelection, "*.ds.gba", _("Nds binary with loader (.ds.gba)")); + ADD_FILTER(pFileSelection, "*", _("All files")); //ADD_FILTER(pFileSelection, "*.zip", "Nds zipped binary"); /* Affichage fenetre*/ @@ -108,7 +114,7 @@ GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Unable to load :\n%s", sChemin); + _("Unable to load :\n%s"), sChemin); gtk_dialog_run(GTK_DIALOG(pDialog)); gtk_widget_destroy(pDialog); } else { @@ -120,44 +126,28 @@ break; default: break; - } + } gtk_widget_destroy(pFileSelection); } void on_menu_ouvrir_activate (GtkMenuItem *menuitem, gpointer user_data) { file_open();} -void on_menu_pscreen_activate (GtkMenuItem *menuitem, gpointer user_data) { WriteBMP("./test.bmp",GPU_screen); } +void on_menu_pscreen_activate (GtkMenuItem *menuitem, gpointer user_data) { WriteBMP("./test.bmp",(u16*)GPU_screen); } void on_menu_quit_activate (GtkMenuItem *menuitem, gpointer user_data) { gtk_main_quit(); } /* MENU SAVES ***** ***** ***** ***** */ -void on_loadstate1_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(1); } -void on_loadstate2_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(2); } -void on_loadstate3_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(3); } -void on_loadstate4_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(4); } -void on_loadstate5_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(5); } -void on_loadstate6_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(6); } -void on_loadstate7_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(7); } -void on_loadstate8_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(8); } -void on_loadstate9_activate (GtkMenuItem *m, gpointer d) { loadstate_slot(9); } -void on_loadstate10_activate(GtkMenuItem *m, gpointer d) { loadstate_slot(10); } - -void on_savestate1_activate (GtkMenuItem *m, gpointer d) { update_savestate(1); } -void on_savestate2_activate (GtkMenuItem *m, gpointer d) { update_savestate(2); } -void on_savestate3_activate (GtkMenuItem *m, gpointer d) { update_savestate(3); } -void on_savestate4_activate (GtkMenuItem *m, gpointer d) { update_savestate(4); } -void on_savestate5_activate (GtkMenuItem *m, gpointer d) { update_savestate(5); } -void on_savestate6_activate (GtkMenuItem *m, gpointer d) { update_savestate(6); } -void on_savestate7_activate (GtkMenuItem *m, gpointer d) { update_savestate(7); } -void on_savestate8_activate (GtkMenuItem *m, gpointer d) { update_savestate(8); } -void on_savestate9_activate (GtkMenuItem *m, gpointer d) { update_savestate(9); } -void on_savestate10_activate(GtkMenuItem *m, gpointer d) { update_savestate(10); } - -void on_savetype1_activate (GtkMenuItem *m, gpointer d) { desmume_savetype(1); } -void on_savetype2_activate (GtkMenuItem *m, gpointer d) { desmume_savetype(2); } -void on_savetype3_activate (GtkMenuItem *m, gpointer d) { desmume_savetype(3); } -void on_savetype4_activate (GtkMenuItem *m, gpointer d) { desmume_savetype(4); } -void on_savetype5_activate (GtkMenuItem *m, gpointer d) { desmume_savetype(5); } -void on_savetype6_activate (GtkMenuItem *m, gpointer d) { desmume_savetype(6); } +void on_loadstateXX_activate (GtkMenuItem *m, gpointer d) { + int slot = dyn_CAST(int,d); + loadstate_slot(slot); +} +void on_savestateXX_activate (GtkMenuItem *m, gpointer d) { + int slot = dyn_CAST(int,d); + update_savestate(slot); +} +void on_savetypeXX_activate (GtkMenuItem *m, gpointer d) { + int type = dyn_CAST(int,d); + desmume_savetype(type); +} /* MENU EMULATION ***** ***** ***** ***** */ @@ -179,38 +169,102 @@ MAINWINDOW_RESIZE(); } - /* SUBMENU FRAMESKIP ***** ***** ***** ***** */ -void on_fs0_activate (GtkMenuItem *menuitem,gpointer user_data) { Frameskip = 0; } -void on_fs1_activate (GtkMenuItem *menuitem,gpointer user_data) { Frameskip = 1; } -void on_fs2_activate (GtkMenuItem *menuitem,gpointer user_data) { Frameskip = 2; } -void on_fs3_activate (GtkMenuItem *menuitem,gpointer user_data) { Frameskip = 3; } -void on_fs4_activate (GtkMenuItem *menuitem,gpointer user_data) { Frameskip = 4; } -void on_fs5_activate (GtkMenuItem *menuitem,gpointer user_data) { Frameskip = 5; } -void on_fs6_activate (GtkMenuItem *menuitem,gpointer user_data) { Frameskip = 6; } -void on_fs7_activate (GtkMenuItem *menuitem,gpointer user_data) { Frameskip = 7; } -void on_fs8_activate (GtkMenuItem *menuitem,gpointer user_data) { Frameskip = 8; } -void on_fs9_activate (GtkMenuItem *menuitem,gpointer user_data) { Frameskip = 9; } +void on_fsXX_activate (GtkMenuItem *menuitem,gpointer user_data) { + Frameskip = dyn_CAST(int,user_data); +// printf ("setting FS %d %d\n", Frameskip, user_data); +} /* SUBMENU SIZE ***** ***** ***** ***** */ + +void gtk_table_reattach(GtkTable * table, GtkWidget * w, + guint left_attach, guint right_attach, guint top_attach, guint bottom_attach, + GtkAttachOptions xoptions, GtkAttachOptions yoptions, + guint xpadding, guint ypadding) { + GList *list; + for (list = table->children; list; list = list->next) + { + GtkTableChild *table_child; + table_child = list->data; + if (table_child->widget == w) { + table_child->left_attach = left_attach; + table_child->right_attach = right_attach; + table_child->top_attach = top_attach; + table_child->bottom_attach = bottom_attach; + table_child->xexpand = (xoptions & GTK_EXPAND) != 0; + table_child->xshrink = (xoptions & GTK_SHRINK) != 0; + table_child->xfill = (xoptions & GTK_FILL) != 0; + table_child->xpadding = xpadding; + table_child->yexpand = (yoptions & GTK_EXPAND) != 0; + table_child->yshrink = (yoptions & GTK_SHRINK) != 0; + table_child->yfill = (yoptions & GTK_FILL) != 0; + table_child->ypadding = ypadding; + break; + } + } +} + +void rightscreen(BOOL apply) { + GtkWidget *chk = glade_xml_get_widget(xml, "wvb_2_Sub"); + GtkTable *table = (GtkTable *)glade_xml_get_widget(xml, "table_layout"); + + ScreenRight = apply || ScreenRightForce; + if (ScreenRight) { + /* we want to change the layout, lower screen goes right */ + gtk_table_reattach(table, pDrawingArea2, + 3,4, 0,1, 0,0, 0,0); + gtk_table_reattach(table, chk, + 4,5, 0,1, 0,0, 0,0); + } else { + /* we want to change the layout, lower screen goes down */ + gtk_table_reattach(table, pDrawingArea2, + 1,2, 2,3, 0,0, 0,0); + gtk_table_reattach(table, chk, + 0,1, 2,3, 0,0, 0,0); + ScreenRight = FALSE; + } + + gtk_widget_queue_resize (GTK_WIDGET (table)); + + /* pack the window */ + MAINWINDOW_RESIZE(); +} int H=192, W=256; -void resize (int Size) { +void resize (float Size1, float Size2) { + // not ready yet to handle different zoom factors + Size2 = Size1; /* we want to scale drawing areas by a factor (1x,2x or 3x) */ - gtk_drawing_area_size(GTK_DRAWING_AREA(pDrawingArea), W * Size, H * Size); - gtk_widget_set_usize (pDrawingArea, W * Size, H * Size); - gtk_drawing_area_size(GTK_DRAWING_AREA(pDrawingArea2), W * Size, H * Size); - gtk_widget_set_usize (pDrawingArea2, W * Size, H * Size); - ScreenCoeff_Size = Size; + gtk_widget_set_size_request (pDrawingArea, W * Size1, H * Size1); + gtk_widget_set_size_request (pDrawingArea2, W * Size2, H * Size2); + ScreenCoeff_Size[0] = Size1; + ScreenCoeff_Size[1] = Size2; /* remove artifacts */ black_screen(); /* pack the window */ MAINWINDOW_RESIZE(); } +void rotate(float angle) { + BOOL rotated; + if (angle >= 360.0) angle -= 360.0; + ScreenRotate = angle; + rotated = (ScreenRotate==90.0 || ScreenRotate==270.0); + ScreenInvert = (ScreenRotate >= 180.0); + if (rotated) { + H=256; W=192; + } else { + W=256; H=192; + } + rightscreen(rotated); + resize(ScreenCoeff_Size[0],ScreenCoeff_Size[1]); +} + +void on_sizeXX_activate (GtkMenuItem *menuitem, gpointer user_data) { + float f = dyn_CAST(float,user_data); +// printf("setting ZOOM %f\n",f); + resize(f,f); +} -void on_size1x_activate (GtkMenuItem *menuitem, gpointer user_data) { resize(1); } -void on_size2x_activate (GtkMenuItem *menuitem, gpointer user_data) { resize(2); } -void on_size3x_activate (GtkMenuItem *menuitem, gpointer user_data) { resize(3); } /* MENU CONFIG ***** ***** ***** ***** */ @@ -234,13 +288,13 @@ if( (nbr_joy < 1) || desmume_running() ) { if( nbr_joy < 1 ) - text = "You don't have any joystick!"; + text = _("You don't have any joystick!"); else - text = "Can't configure joystick while the game is running!"; + text = _("Can't configure joystick while the game is running!"); dlg = (GtkDialog*)glade_xml_get_widget(xml, "wMainW"); - msgbox = - gtk_message_dialog_new(dlg, + msgbox = (GtkDialog*) + gtk_message_dialog_new((GtkWindow*)dlg, GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, @@ -276,34 +330,14 @@ } void on_menu_rightscreen_activate (GtkMenuItem *menuitem, gpointer user_data) { - GtkBox * sbox = (GtkBox*)glade_xml_get_widget(xml, "whb_Sub"); - GtkWidget * mbox = glade_xml_get_widget(xml, "whb_Main"); - GtkWidget * vbox = glade_xml_get_widget(xml, "wvb_Layout"); - GtkWidget * w = glade_xml_get_widget(xml, "wvb_2_Sub"); - - ScreenRight=gtk_check_menu_item_get_active((GtkCheckMenuItem*)menuitem); - /* we want to change the layout, lower screen goes left */ - if (ScreenRight) { - gtk_box_reorder_child(sbox,w,-1); - gtk_widget_reparent((GtkWidget*)sbox,mbox); - } else { - /* we want to change the layout, lower screen goes down */ - gtk_box_reorder_child(sbox,w,0); - gtk_widget_reparent((GtkWidget*)sbox,vbox); - } - /* pack the window */ - MAINWINDOW_RESIZE(); + ScreenRightForce=gtk_check_menu_item_get_active((GtkCheckMenuItem*)menuitem); + rightscreen(ScreenRightForce); } void on_menu_rotatescreen_activate (GtkMenuItem *menuitem, gpointer user_data) { /* we want to rotate the screen */ - ScreenRotate = gtk_check_menu_item_get_active((GtkCheckMenuItem*)menuitem); - if (ScreenRotate) { - H=256; W=192; - } else { - W=256; H=192; - } - resize(ScreenCoeff_Size); + float angle = dyn_CAST(float,user_data); + rotate(angle); } /* MENU TOOLS ***** ***** ***** ***** */ @@ -311,33 +345,33 @@ GtkWidget * dlg = glade_xml_get_widget(xml_tools, "wtools_1_IOregs"); gtk_widget_show(dlg); } - void on_menu_memview_activate (GtkMenuItem *menuitem, gpointer user_data) { GtkWidget * dlg = glade_xml_get_widget(xml_tools, "wtools_2_MemView"); gtk_widget_show(dlg); } - void on_menu_palview_activate (GtkMenuItem *menuitem, gpointer user_data) { GtkWidget * dlg = glade_xml_get_widget(xml_tools, "wtools_3_PalView"); gtk_widget_show(dlg); } - - - +void on_menu_tileview_activate (GtkMenuItem *menuitem, gpointer user_data) { + GtkWidget * dlg = glade_xml_get_widget(xml_tools, "wtools_4_TileView"); + gtk_widget_show(dlg); +} +void on_menu_wtoolsXX_activate (GtkMenuItem *menuitem, gpointer user_data) { + GtkWidget * w = user_data; + gtk_widget_show(w); +} /* MENU ? ***** ***** ***** ***** */ -void on_menu_apropos_activate (GtkMenuItem *menuitem, gpointer user_data) { - GtkAboutDialog * wAbout = (GtkAboutDialog*)glade_xml_get_widget(xml, "wAboutDlg"); - gtk_about_dialog_set_version(wAbout, VERSION); - gtk_widget_show((GtkWidget*)wAbout); +/* About dialog + FIXME: Add proper copyright */ +void on_menu_apropos_activate (GtkMenuItem *menuitem, gpointer user_data) { + GtkWidget * wAbout = glade_xml_get_widget(xml, "wAboutDlg"); + gtk_widget_show(wAbout); } - - - - /* TOOLBAR ***** ***** ***** ***** */ void on_wgt_Open_clicked (GtkToolButton *toolbutton, gpointer user_data) { file_open(); } void on_wgt_Reset_clicked (GtkToolButton *toolbutton, gpointer user_data) { desmume_reset(); } @@ -352,37 +386,20 @@ /* LAYERS ***** ***** ***** ***** */ -void change_bgx_layer(int layer, gboolean state, Screen scr) { +void change_bgx_layer(int layer, gboolean state, NDS_Screen scr) { //if(!desmume_running()) return; if(state==TRUE) { - if (!scr.gpu->dispBG[layer]) GPU_addBack(scr.gpu, layer); + GPU_addBack(scr.gpu, layer); } else { - if (scr.gpu->dispBG[layer]) GPU_remove(scr.gpu, layer); + GPU_remove(scr.gpu, layer); } //fprintf(stderr,"Changed Layer %s to %d\n",layer,state); } - - -/* LAYERS MAIN SCREEN ***** ***** ***** ***** */ -void on_wc_1_BG0_toggled (GtkToggleButton *togglebutton, gpointer user_data) { - change_bgx_layer(0, gtk_toggle_button_get_active(togglebutton), MainScreen); } -void on_wc_1_BG1_toggled (GtkToggleButton *togglebutton, gpointer user_data) { - change_bgx_layer(1, gtk_toggle_button_get_active(togglebutton), MainScreen); } -void on_wc_1_BG2_toggled (GtkToggleButton *togglebutton, gpointer user_data) { - change_bgx_layer(2, gtk_toggle_button_get_active(togglebutton), MainScreen); } -void on_wc_1_BG3_toggled (GtkToggleButton *togglebutton, gpointer user_data) { - change_bgx_layer(3, gtk_toggle_button_get_active(togglebutton), MainScreen); } -void on_wc_1_OBJ_toggled (GtkToggleButton *togglebutton, gpointer user_data) { - change_bgx_layer(4, gtk_toggle_button_get_active(togglebutton), MainScreen); } - -/* LAYERS SECOND SCREEN ***** ***** ***** ***** */ -void on_wc_2b_BG0_toggled (GtkToggleButton *togglebutton, gpointer user_data) { - change_bgx_layer(0, gtk_toggle_button_get_active(togglebutton), SubScreen); } -void on_wc_2b_BG1_toggled (GtkToggleButton *togglebutton, gpointer user_data) { - change_bgx_layer(1, gtk_toggle_button_get_active(togglebutton), SubScreen); } -void on_wc_2b_BG2_toggled (GtkToggleButton *togglebutton, gpointer user_data) { - change_bgx_layer(2, gtk_toggle_button_get_active(togglebutton), SubScreen); } -void on_wc_2b_BG3_toggled (GtkToggleButton *togglebutton, gpointer user_data) { - change_bgx_layer(3, gtk_toggle_button_get_active(togglebutton), SubScreen); } -void on_wc_2b_OBJ_toggled (GtkToggleButton *togglebutton, gpointer user_data) { - change_bgx_layer(4, gtk_toggle_button_get_active(togglebutton), SubScreen); } +void on_wc_1_BGXX_toggled (GtkToggleButton *togglebutton, gpointer user_data) { + int layer = dyn_CAST(int,user_data); + change_bgx_layer(layer, gtk_toggle_button_get_active(togglebutton), MainScreen); +} +void on_wc_2_BGXX_toggled (GtkToggleButton *togglebutton, gpointer user_data) { + int layer = dyn_CAST(int,user_data); + change_bgx_layer(layer, gtk_toggle_button_get_active(togglebutton), SubScreen); +} diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/callbacks.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/callbacks.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/callbacks.h 2007-02-02 00:23:31.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/callbacks.h 2007-02-12 14:12:32.000000000 -0600 @@ -27,59 +27,17 @@ G_MODULE_EXPORT void on_menu_quit_activate (GtkMenuItem *menuitem, gpointer user_data); /* MENU SAVES */ -G_MODULE_EXPORT void on_loadstate1_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_loadstate2_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_loadstate3_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_loadstate4_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_loadstate5_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_loadstate6_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_loadstate7_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_loadstate8_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_loadstate9_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_loadstate10_activate(GtkMenuItem *, gpointer ); - -G_MODULE_EXPORT void on_savestate1_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_savestate2_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_savestate3_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_savestate4_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_savestate5_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_savestate6_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_savestate7_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_savestate8_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_savestate9_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_savestate10_activate(GtkMenuItem *, gpointer ); - -G_MODULE_EXPORT void on_savetype1_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_savetype2_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_savetype3_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_savetype4_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_savetype5_activate (GtkMenuItem *, gpointer ); -G_MODULE_EXPORT void on_savetype6_activate (GtkMenuItem *, gpointer ); - - +G_MODULE_EXPORT void on_loadstateXX_activate (GtkMenuItem *, gpointer ); +G_MODULE_EXPORT void on_savestateXX_activate (GtkMenuItem *, gpointer ); +G_MODULE_EXPORT void on_savetypeXX_activate (GtkMenuItem *, gpointer ); /* MENU EMULATION */ G_MODULE_EXPORT void on_menu_exec_activate (GtkMenuItem *menuitem, gpointer user_data); G_MODULE_EXPORT void on_menu_pause_activate (GtkMenuItem *menuitem, gpointer user_data); G_MODULE_EXPORT void on_menu_reset_activate (GtkMenuItem *menuitem, gpointer user_data); G_MODULE_EXPORT void on_menu_layers_activate (GtkMenuItem *menuitem, gpointer user_data); -/* SUBMENU FRAMESKIP */ -G_MODULE_EXPORT void on_fsXX_activate (GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_fs0_activate (GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_fs1_activate (GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_fs2_activate (GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_fs3_activate (GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_fs4_activate (GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_fs5_activate (GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_fs6_activate (GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_fs7_activate (GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_fs8_activate (GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_fs9_activate (GtkMenuItem *menuitem, gpointer user_data); -/* SUBMENU SIZE */ -G_MODULE_EXPORT void on_size1x_activate (GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_size2x_activate (GtkMenuItem *menuitem, gpointer user_data); -G_MODULE_EXPORT void on_size3x_activate (GtkMenuItem *menuitem, gpointer user_data); - +G_MODULE_EXPORT void on_fsXX_activate (GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_sizeXX_activate (GtkMenuItem *menuitem, gpointer user_data); /* MENU CONFIG */ G_MODULE_EXPORT void on_menu_controls_activate (GtkMenuItem *menuitem, gpointer user_data); @@ -88,10 +46,13 @@ G_MODULE_EXPORT void on_menu_gapscreen_activate (GtkMenuItem *menuitem, gpointer user_data); G_MODULE_EXPORT void on_menu_rightscreen_activate (GtkMenuItem *menuitem, gpointer user_data); G_MODULE_EXPORT void on_menu_rotatescreen_activate (GtkMenuItem *menuitem, gpointer user_data); + /* MENU TOOLS */ +G_MODULE_EXPORT void on_menu_wtoolsXX_activate (GtkMenuItem *menuitem, gpointer user_data); G_MODULE_EXPORT void on_menu_IO_regs_activate (GtkMenuItem *menuitem, gpointer user_data); G_MODULE_EXPORT void on_menu_memview_activate (GtkMenuItem *menuitem, gpointer user_data); G_MODULE_EXPORT void on_menu_palview_activate (GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_menu_tileview_activate (GtkMenuItem *menuitem, gpointer user_data); /* MENU ? */ G_MODULE_EXPORT void on_menu_apropos_activate (GtkMenuItem *menuitem, gpointer user_data); @@ -104,17 +65,6 @@ G_MODULE_EXPORT void on_wgt_Reset_clicked (GtkToolButton *toolbutton, gpointer user_data); G_MODULE_EXPORT void on_wgt_Quit_clicked (GtkToolButton *toolbutton, gpointer user_data); - -/* LAYERS MAIN SCREEN */ -G_MODULE_EXPORT void on_wc_1_BG0_toggled (GtkToggleButton *togglebutton, gpointer user_data); -G_MODULE_EXPORT void on_wc_1_BG1_toggled (GtkToggleButton *togglebutton, gpointer user_data); -G_MODULE_EXPORT void on_wc_1_BG2_toggled (GtkToggleButton *togglebutton, gpointer user_data); -G_MODULE_EXPORT void on_wc_1_BG3_toggled (GtkToggleButton *togglebutton, gpointer user_data); -G_MODULE_EXPORT void on_wc_1_OBJ_toggled (GtkToggleButton *togglebutton, gpointer user_data); - -/* LAYERS SECOND SCREEN */ -G_MODULE_EXPORT void on_wc_2b_BG0_toggled (GtkToggleButton *togglebutton, gpointer user_data); -G_MODULE_EXPORT void on_wc_2b_BG1_toggled (GtkToggleButton *togglebutton, gpointer user_data); -G_MODULE_EXPORT void on_wc_2b_BG2_toggled (GtkToggleButton *togglebutton, gpointer user_data); -G_MODULE_EXPORT void on_wc_2b_BG3_toggled (GtkToggleButton *togglebutton, gpointer user_data); -G_MODULE_EXPORT void on_wc_2b_OBJ_toggled (GtkToggleButton *togglebutton, gpointer user_data); +/* LAYERS TOGGLE */ +G_MODULE_EXPORT void on_wc_1_BGXX_toggled (GtkToggleButton *togglebutton, gpointer user_data); +G_MODULE_EXPORT void on_wc_2_BGXX_toggled (GtkToggleButton *togglebutton, gpointer user_data); diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/callbacks_IO.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/callbacks_IO.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/callbacks_IO.c 2007-02-01 06:43:02.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/callbacks_IO.c 2007-02-23 08:23:02.000000000 -0600 @@ -23,8 +23,8 @@ #include "callbacks_IO.h" static u16 Cur_Keypad = 0; -int ScreenCoeff_Size=1; -gboolean ScreenRotate=FALSE; +float ScreenCoeff_Size[2]={1.0,1.0}; +float ScreenRotate=0.0; gboolean Boost=FALSE; int BoostFS=20; int saveFS; @@ -56,11 +56,39 @@ /* ***** ***** SCREEN DRAWING ***** ***** */ +#define RAW_W 256 +#define RAW_H 192 +#define RAW_OFFSET 256*192*sizeof(u16) +#define MAX_SIZE 3 +u32 on_screen_image32[RAW_W*RAW_H*2*MAX_SIZE*MAX_SIZE]; + +int inline screen_size() { + int sz = ScreenCoeff_Size[0]; + return RAW_W*RAW_H*2*sz*sz*sizeof(u32); +} +int inline offset_pixels_lower_screen() { + return screen_size()/2; +} + +void black_screen () { + /* removes artifacts when resizing with scanlines */ + memset(on_screen_image32,0,screen_size()); +} + +#ifndef HAVE_LIBGDKGLEXT_X11_1_0 +// they are empty if no opengl +// else see gdk_gl.c / gdk_gl.h +BOOL my_gl_Begin (int screen) { return FALSE; } +void my_gl_End (int screen) {} +void init_GL_capabilities() {} +void init_GL(GtkWidget * widget, ...) {} +void reshape (GtkWidget * widget, ...) {} + int has_pix_col_map=0; u32 pix_col_map[0x8000]; void init_pix_col_map() { - /* precalc colors so we get some fps */ + // precalc factors int a,b,c,A,B,C,rA,rB,rC; if (has_pix_col_map) return; for (a=0; a<0x20; a++) { @@ -76,142 +104,164 @@ has_pix_col_map=1; } -#define RAW_W 256 -#define RAW_H 192*2 -#define MAX_SIZE 3 -u32 on_screen_image32[RAW_W*RAW_H*MAX_SIZE*MAX_SIZE]; - -int inline screen_size() { - return RAW_W*RAW_H*ScreenCoeff_Size*ScreenCoeff_Size*sizeof(u32); -} -int inline offset_pixels_lower_screen() { - return screen_size()/2; -} - -void black_screen () { - /* removes artifacts when resizing with scanlines */ - memset(on_screen_image32,0,screen_size()); -} - void decode_screen () { int x,y, m, W,H,L,BL; - u32 image[RAW_H][RAW_W], pix; + u32 image[RAW_H*2][RAW_W], pix; u16 * pixel = (u16*)&GPU_screen; u32 * rgb32 = &on_screen_image32[0]; /* decode colors */ init_pix_col_map(); - for (y=0; y= 0, x--, y=0, y < W, y++) - LOOP(x=RAW_W-1, x >= 0, x--, y=W, y < RAW_H, y++) + W=RAW_H; H=RAW_W; + LOOP(x=RAW_W-1, x >= 0, x--, y=0, y < RAW_H, y++) + LOOP(x=RAW_W-1, x >= 0, x--, y=RAW_H, y < RAW_H*2, y++) } else { - H=RAW_H; W=RAW_W; - LOOP(y=0, y < RAW_H, y++, x=0, x < RAW_W, x++) - + H=RAW_H*2; W=RAW_W; + LOOP(y=0, y < RAW_H*2, y++, x=0, x < RAW_W, x++) } } -int screen (GtkWidget * widget, int offset_pix) { +gboolean screen (GtkWidget * widget, int off) { int H,W,L; + if (off==0) + decode_screen(); + if (ScreenRotate) { - W=RAW_H/2; H=RAW_W; + W=RAW_H; H=RAW_W; } else { - H=RAW_H/2; W=RAW_W; + H=RAW_H; W=RAW_W; } - L=W*ScreenCoeff_Size*sizeof(u32); + L=W*ScreenCoeff_Size[0]*sizeof(u32); + off*= offset_pixels_lower_screen(); gdk_draw_rgb_32_image (widget->window, widget->style->fg_gc[widget->state],0,0, - W*ScreenCoeff_Size, H*ScreenCoeff_Size, - GDK_RGB_DITHER_NONE,((guchar*)on_screen_image32)+offset_pix,L); - - return 1; + W*ScreenCoeff_Size[0], H*ScreenCoeff_Size[0], + GDK_RGB_DITHER_NONE,((guchar*)on_screen_image32)+off,L); + return TRUE; } +#endif /* if HAVE_LIBGDKGLEXT_X11_1_0 */ -/* OUTPUT UPPER SCREEN */ -void on_wDraw_Main_realize (GtkWidget *widget, gpointer user_data) { } -gboolean on_wDraw_Main_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { - decode_screen(); - return screen(widget, 0); -} -/* OUTPUT LOWER SCREEN */ -void on_wDraw_Sub_realize (GtkWidget *widget, gpointer user_data) { } -gboolean on_wDraw_Sub_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { - return screen(widget, offset_pixels_lower_screen()); +/* OUTPUT SCREENS */ +gboolean on_wDrawScreen_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { + int scr = dyn_CAST(int,user_data); + return screen(widget, scr); +} +gboolean on_wDrawScreen_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer user_data) { + int scr = dyn_CAST(int,user_data); + reshape(widget, scr); return TRUE; } +/* ***** ***** INPUT STYLUS / MOUSE ***** ***** */ +static void resize_incremental(int i, GdkEventScroll *event) { +#ifdef HAVE_LIBGDKGLEXT_X11_1_0 + float zoom_inc=.125, zoom_min=0.25, zoom_max=5.0; +#else + float zoom_inc=1.0, zoom_min=1.0, zoom_max=3.0; +#endif + switch (event->direction) { + case GDK_SCROLL_UP: + ScreenCoeff_Size[i]=MIN(ScreenCoeff_Size[i]+zoom_inc,zoom_max); break; + case GDK_SCROLL_DOWN: + ScreenCoeff_Size[i]=MAX(ScreenCoeff_Size[i]-zoom_inc,zoom_min); break; + case GDK_SCROLL_LEFT: + case GDK_SCROLL_RIGHT: + return; + } + resize(ScreenCoeff_Size[0],ScreenCoeff_Size[1]); +} -/* ***** ***** INPUT STYLUS / MOUSE ***** ***** */ +gboolean on_wDrawScreen_scroll_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) { + int scr = dyn_CAST(int,user_data); + // separate zoom factors not supported yet + scr = 0; + resize_incremental(scr,(GdkEventScroll*)event); +} void set_touch_pos (int x, int y) { s32 EmuX, EmuY; - x /= ScreenCoeff_Size; - y /= ScreenCoeff_Size; + x /= ScreenCoeff_Size[1]; + y /= ScreenCoeff_Size[1]; EmuX = x; EmuY = y; - if (ScreenRotate) { EmuX = 256-y; EmuY = x; } + if (ScreenRotate==90.0 || ScreenRotate==270.0) { EmuX = 256-y; EmuY = x; } if(EmuX<0) EmuX = 0; else if(EmuX>255) EmuX = 255; if(EmuY<0) EmuY = 0; else if(EmuY>192) EmuY = 192; + if (ScreenInvert) { + EmuX = 255-EmuX; + EmuY = 192-EmuY; + } NDS_setTouchPos(EmuX, EmuY); } -gboolean on_wDraw_Sub_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data) { +gboolean on_wDrawScreen_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data) { + int scr = dyn_CAST(int,user_data); GdkModifierType state; gint x,y; - if(desmume_running()) - if(event->button == 1) - { - click = TRUE; - gdk_window_get_pointer(widget->window, &x, &y, &state); - if (state & GDK_BUTTON1_MASK) - set_touch_pos(x,y); - } + switch (event->button) { + case 1: + if (((scr==1) ^ ScreenInvert) && desmume_running()) { + click = TRUE; + gdk_window_get_pointer(widget->window, &x, &y, &state); + if (state & GDK_BUTTON1_MASK) + set_touch_pos(x,y); + } + break; + case 3: break; + case 2: + // filter out 2x / 3x clicks + if (event->type==GDK_BUTTON_PRESS) + rotate(ScreenRotate + 90.0); break; + } return TRUE; } -gboolean on_wDraw_Sub_button_release_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data) { - if(click) NDS_releasTouch(); - click = FALSE; +gboolean on_wDrawScreen_button_release_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data) { + int scr = dyn_CAST(int,user_data); + if ((scr==1) ^ ScreenInvert) { + if (click) NDS_releasTouch(); + click = FALSE; + } return TRUE; } -gboolean on_wDraw_Sub_motion_notify_event (GtkWidget *widget, GdkEventMotion *event, gpointer user_data) { +gboolean on_wDrawScreen_motion_notify_event (GtkWidget *widget, GdkEventMotion *event, gpointer user_data) { + int scr = dyn_CAST(int,user_data); GdkModifierType state; gint x,y; - if(click) + if (((scr==1) ^ ScreenInvert) && click) { if(event->is_hint) gdk_window_get_pointer(widget->window, &x, &y, &state); @@ -220,20 +270,18 @@ x= (gint)event->x; y= (gint)event->y; state=(GdkModifierType)event->state; - } - + } // fprintf(stderr,"X=%d, Y=%d, S&1=%d\n", x,y,state&GDK_BUTTON1_MASK); - if(state & GDK_BUTTON1_MASK) set_touch_pos(x,y); } - return TRUE; } + /* ***** ***** KEYBOARD CONFIG / KEY DEFINITION ***** ***** */ u16 Keypad_Temp[NB_KEYS]; guint temp_Key=0; @@ -310,24 +358,6 @@ gtk_widget_hide((GtkWidget*)dlg); } -void on_button_Left_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_LEFT); } -void on_button_Up_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_UP); } -void on_button_Right_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_RIGHT); } -void on_button_Down_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_DOWN); } - -void on_button_L_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_L); } -void on_button_R_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_R); } - -void on_button_Y_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_Y); } -void on_button_X_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_X); } -void on_button_A_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_A); } -void on_button_B_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_B); } - -void on_button_Start_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_START); } -void on_button_Select_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_SELECT); } -void on_button_Debug_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_DEBUG); } -void on_button_Boost_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_BOOST); } - /* Joystick configuration / Key definition */ void ask_joy_key(GtkButton*b, int key) { @@ -347,20 +377,20 @@ } /* Joystick configuration / Key definition */ -void ask_joy_axis(GtkButton*b, u8 key, u8 opposite_key) +void ask_joy_axis(u8 key, u8 opposite_key) { char text[50]; - char opposite_button[50]; + char current_button[50], opposite_button[50]; u16 joykey; GtkWidget * dlg; - GtkWidget * bo; + GtkButton * btn; key--; /* remove 1 to get index */ opposite_key--; + sprintf(current_button,"button_joy_%s\0\0",key_names[key]); sprintf(opposite_button,"button_joy_%s\0\0",key_names[opposite_key]); dlg = (GtkWidget*)glade_xml_get_widget(xml, "wJoyDlg"); - bo = (GtkWidget*)glade_xml_get_widget(xml, opposite_button); gtk_widget_show(dlg); /* Need to force event processing. Otherwise, popup won't show up. */ @@ -368,39 +398,33 @@ get_set_joy_axis(key, opposite_key); sprintf(text,"%s : %d\0\0",key_names[key],joypad_cfg[key]); - gtk_button_set_label(b,text); + btn = (GtkButton*)glade_xml_get_widget(xml, current_button); + gtk_button_set_label(btn,text); sprintf(text,"%s : %d\0\0",key_names[opposite_key],joypad_cfg[opposite_key]); - gtk_button_set_label(bo,text); + btn = (GtkButton*)glade_xml_get_widget(xml, opposite_button); + gtk_button_set_label(btn,text); gtk_widget_hide((GtkWidget*)dlg); } -void on_button_joy_Left_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_axis(b,KEY_LEFT,KEY_RIGHT); } -void on_button_joy_Up_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_axis(b,KEY_UP,KEY_DOWN); } -void on_button_joy_Right_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_axis(b,KEY_RIGHT,KEY_LEFT); } -void on_button_joy_Down_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_axis(b,KEY_DOWN,KEY_UP); } -void on_button_joy_A_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_A); } -void on_button_joy_B_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_B); } -void on_button_joy_X_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_X); } -void on_button_joy_Y_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_Y); } -void on_button_joy_L_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_L); } -void on_button_joy_R_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_R); } -void on_button_joy_Select_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_SELECT); } -void on_button_joy_Start_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_START); } -void on_button_joy_Boost_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_BOOST); } -void on_button_joy_Debug_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_DEBUG); } +/* Bind a keyboard key to a keypad key */ +void on_button_kb_key_clicked (GtkButton *b, gpointer user_data) +{ + int key = dyn_CAST( int, user_data ); + ask( b, key ); +} + +/* Bind a joystick axis to a keypad directionnal pad */ +void on_button_joy_axis_clicked (GtkButton *b, gpointer user_data) +{ + int key = dyn_CAST( int, user_data ); + ask_joy_axis( key, key+1 ); +} + +/* Bind a joystick button to a keypad key */ +void on_button_joy_key_clicked (GtkButton *b, gpointer user_data) +{ + int key = dyn_CAST( int, user_data ); + ask_joy_key( b, key ); +} diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/callbacks_IO.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/callbacks_IO.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/callbacks_IO.h 2007-01-30 06:40:32.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/callbacks_IO.h 2007-02-13 01:27:29.000000000 -0600 @@ -26,57 +26,22 @@ G_MODULE_EXPORT gboolean on_wMainW_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data); G_MODULE_EXPORT gboolean on_wMainW_key_release_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data); -/* OUTPUT UPPER SCREEN */ -G_MODULE_EXPORT void on_wDraw_Main_realize (GtkWidget *widget, gpointer user_data); -G_MODULE_EXPORT gboolean on_wDraw_Main_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data); +/* OUTPUT SCREENS */ +G_MODULE_EXPORT gboolean on_wDrawScreen_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data); +G_MODULE_EXPORT gboolean on_wDrawScreen_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data); -/* OUTPUT LOWER SCREEN */ -G_MODULE_EXPORT void on_wDraw_Sub_realize (GtkWidget *widget, gpointer user_data); -G_MODULE_EXPORT gboolean on_wDraw_Sub_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data); /* INPUT STYLUS / MOUSE */ -G_MODULE_EXPORT gboolean on_wDraw_Sub_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data); -G_MODULE_EXPORT gboolean on_wDraw_Sub_button_release_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data); -G_MODULE_EXPORT gboolean on_wDraw_Sub_motion_notify_event (GtkWidget *widget, GdkEventMotion *event, gpointer user_data); - - - +G_MODULE_EXPORT gboolean on_wDrawScreen_motion_notify_event (GtkWidget *widget, GdkEventMotion *event, gpointer user_data); +G_MODULE_EXPORT gboolean on_wDrawScreen_button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data); +G_MODULE_EXPORT gboolean on_wDrawScreen_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data); +G_MODULE_EXPORT gboolean on_wDrawScreen_scroll_event (GtkWidget *widget, GdkEvent *event, gpointer user_data); /* KEYBOARD CONFIG / KEY DEFINITION */ - G_MODULE_EXPORT gboolean on_wKeyDlg_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data); G_MODULE_EXPORT void on_wKeybConfDlg_response (GtkDialog *dialog, gint arg1, gpointer user_data); - -G_MODULE_EXPORT void on_button_Left_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_Up_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_Right_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_Down_clicked (GtkButton *button, gpointer user_data); - -G_MODULE_EXPORT void on_button_L_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_R_clicked (GtkButton *button, gpointer user_data); - -G_MODULE_EXPORT void on_button_Y_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_X_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_A_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_B_clicked (GtkButton *button, gpointer user_data); - -G_MODULE_EXPORT void on_button_Start_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_Select_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_Debug_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_Boost_clicked (GtkButton *button, gpointer user_data); +G_MODULE_EXPORT void on_button_kb_key_clicked (GtkButton *button, gpointer user_data); /* Joystick configuration / Key definition */ -G_MODULE_EXPORT void on_button_joy_Left_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Up_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Right_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Down_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Y_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_X_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_A_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_B_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Select_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_L_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_R_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Debug_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Start_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Boost_clicked (GtkButton *button, gpointer user_data); +G_MODULE_EXPORT void on_button_joy_axis_clicked (GtkButton *button, gpointer user_data); +G_MODULE_EXPORT void on_button_joy_key_clicked (GtkButton *button, gpointer user_data); diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/desmume.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/desmume.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/desmume.c 2007-02-01 06:43:02.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/desmume.c 2007-06-07 05:00:52.000000000 -0500 @@ -26,6 +26,7 @@ static BOOL regMainLoop = FALSE; +static BOOL noticed_3D=FALSE; volatile BOOL execute = FALSE; BOOL click = FALSE; BOOL fini = FALSE; @@ -38,9 +39,13 @@ u8 *desmume_rom_data = NULL; u32 desmume_last_cycle; -void desmume_init() +void desmume_init( struct armcpu_memory_iface *arm9_mem_if, + struct armcpu_ctrl_iface **arm9_ctrl_iface, + struct armcpu_memory_iface *arm7_mem_if, + struct armcpu_ctrl_iface **arm7_ctrl_iface) { - NDS_Init(); + NDS_Init( arm9_mem_if, arm9_ctrl_iface, + arm7_mem_if, arm7_ctrl_iface); SPU_ChangeSoundCore(SNDCORE_SDL, 735 * 4); execute = FALSE; } @@ -54,8 +59,9 @@ int desmume_open(const char *filename) { int i; + noticed_3D=attempted_3D_op=FALSE; clear_savestates(); - i = NDS_LoadROM(filename, savetype, savesize); + i = NDS_LoadROM(filename, savetype, savesize, NULL); return i; } @@ -81,6 +87,7 @@ void desmume_reset() { + noticed_3D=attempted_3D_op=FALSE; NDS_Reset(); desmume_resume(); } @@ -101,7 +108,7 @@ /* Retrieve old value: can use joysticks w/ another device (from our side) */ keypad = get_keypad(); /* Process joystick events if any */ - keypad = process_ctrls_events(keypad); + process_joystick_events( &keypad); /* Update keypad value */ update_keypad(keypad); @@ -118,10 +125,15 @@ gboolean EmuLoop(gpointer data) { int i; - + if (!noticed_3D && attempted_3D_op) { + GtkWidget * dlg = glade_xml_get_widget(xml, "w3Dop"); + gtk_widget_show(dlg); + noticed_3D=TRUE; + } + if(desmume_running()) /* Si on est en train d'executer le programme ... */ { - + static int limiter_frame_counter = 0; fps_FrameCount += Frameskip + 1; if(!fps_SecStart) fps_SecStart = SDL_GetTicks(); if(SDL_GetTicks() - fps_SecStart >= 1000) @@ -143,10 +155,21 @@ notify_Tools(); gtk_widget_queue_draw(pDrawingArea); gtk_widget_queue_draw(pDrawingArea2); - + + if ( !glade_fps_limiter_disabled) { + limiter_frame_counter += 1; + if ( limiter_frame_counter >= FPS_LIMITER_FRAME_PERIOD) { + limiter_frame_counter = 0; + + /* wait for the timer to expire */ + SDL_SemWait( glade_fps_limiter_semaphore); + } + } + return TRUE; } - + gtk_widget_queue_draw(pDrawingArea); + gtk_widget_queue_draw(pDrawingArea2); regMainLoop = FALSE; return FALSE; } diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/DeSmuME.dev /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/DeSmuME.dev --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/DeSmuME.dev 2007-01-30 06:40:32.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/DeSmuME.dev 2007-02-23 08:23:01.000000000 -0600 @@ -1,18 +1,18 @@ [Project] FileName=DeSmuME.dev Name=DeSmuME -UnitCount=64 +UnitCount=107 Type=1 Ver=1 ObjFiles= -Includes=Z:\Dev-Cpp\include\SDL;z:\GTK\INCLUDE;z:\GTK\INCLUDE\GTK-2.0;z:\GTK\INCLUDE\GLIB-2.0;z:\GTK\INCLUDE\PANGO-1.0;z:\GTK\INCLUDE\CAIRO;z:\GTK\INCLUDE\ATK-1.0;z:\GTK\INCLUDE\LIBGLADE-2.0;Z:\GTK\include\libglade-2.0\glade;z:\GTK\INCLUDE\LIBXML2;z:\GTK\LIB\GTK-2.0\INCLUDE;z:\GTK\LIB\GLIB-2.0\INCLUDE;Z:\GTK\include\gtkglext-1.0 -Libs=Z:\Dev-Cpp\lib;z:\GTK\LIB;Z:\GTK\lib\glib-2.0;Z:\GTK\lib\gtk-2.0;Z:\GTK\lib\libglade;Z:\GTK\lib\libglade\2.0;Z:\GTK\lib\gtkglext-1.0 +Includes=D:\Dev-Cpp\include;d:\Dev-Cpp\include\SDL;D:\Dev-Cpp\include\GL;d:\GTK\INCLUDE;d:\GTK\INCLUDE\GTK-2.0;d:\GTK\INCLUDE\GLIB-2.0;d:\GTK\INCLUDE\PANGO-1.0;d:\GTK\INCLUDE\CAIRO;d:\GTK\INCLUDE\ATK-1.0;d:\GTK\INCLUDE\LIBGLADE-2.0;d:\GTK\include\libglade-2.0\glade;d:\GTK\INCLUDE\LIBXML2;d:\GTK\LIB\GTK-2.0\INCLUDE;d:\GTK\LIB\GLIB-2.0\INCLUDE;d:\GTK\include\gtkglext-1.0;D:\GTK\lib\gtkglext-1.0\include +Libs=d:\Dev-Cpp\lib;d:\GTK\LIB;d:\GTK\lib\glib-2.0;d:\GTK\lib\gtk-2.0;d:\GTK\lib\libglade;d:\GTK\lib\libglade\2.0;d:\GTK\lib\gtkglext-1.0 PrivateResource= ResourceIncludes= MakeIncludes= -Compiler=-DVERSION=\"0.5.0\"_@@_-DHAVE_LIBZ_@@_-mms-bitfields_@@_-rdynamic_@@_-shared_@@__@@_ +Compiler=-DHAVE_LIBZ=1_@@_-DHAVE_LIBGDKGLEXT_X11_1_0=1_@@_-mms-bitfields_@@_-rdynamic_@@_-shared_@@__@@_ CppCompiler= -Linker=Z:/Dev-Cpp/dll/SDL.dll_@@_Z:/GTK/lib/z.lib_@@_Z:/GTK/lib/atk-1.0.lib_@@_Z:/GTK/lib/cairo.lib_@@_Z:/GTK/lib/gdk_pixbuf-2.0.lib_@@_Z:/GTK/lib/gdk-win32-2.0.lib_@@_Z:/GTK/lib/glade-2.0.lib_@@_Z:/GTK/lib/glib-2.0.lib_@@_Z:/GTK/lib/gmodule-2.0.lib_@@_Z:/GTK/lib/gobject-2.0.lib_@@_Z:/GTK/lib/gtk-win32-2.0.lib_@@_Z:/GTK/lib/pango-1.0.lib_@@_Z:/GTK/lib/pangocairo-1.0.lib_@@_Z:/GTK/lib/pangowin32-1.0.lib_@@_Z:/GTK/lib/xml2.lib_@@_ +Linker=d:/GTK/lib/z.lib_@@_d:/GTK/lib/atk-1.0.lib_@@_d:/GTK/lib/cairo.lib_@@_d:/GTK/lib/gdk_pixbuf-2.0.lib_@@_d:/GTK/lib/gdk-win32-2.0.lib_@@_d:/GTK/lib/glade-2.0.lib_@@_d:/GTK/lib/glib-2.0.lib_@@_d:/GTK/lib/gmodule-2.0.lib_@@_d:/GTK/lib/gobject-2.0.lib_@@_d:/GTK/lib/gtk-win32-2.0.lib_@@_d:/GTK/lib/pango-1.0.lib_@@_d:/GTK/lib/pangocairo-1.0.lib_@@_d:/GTK/lib/pangowin32-1.0.lib_@@_d:/GTK/lib/xml2.lib_@@_D:/Dev-Cpp/dll/SDL.dll_@@_D:/Dev-Cpp/lib/libSDL.dll.a_@@_D:/Dev-Cpp/lib/libopengl32.a_@@_D:/GTK/lib/libgdkglext-win32-1.0.dll.a_@@_D:/GTK/lib/gtkglext-win32-1.0.lib_@@_ IsCpp=0 Icon= ExeOutput= @@ -20,7 +20,7 @@ OverrideOutput=0 OverrideOutputName=DeSmuME.exe HostApplication= -Folders=gtk-glade,gtk-glade/dTools +Folders=gtk-glade,gtk-glade/dTools,nocompile,nocompile/cli,nocompile/gtk,nocompile/windows CommandLine= UseCustomMakefile=0 CustomMakefile= @@ -130,9 +130,9 @@ BuildCmd= [Unit11] -FileName=..\ARM9.c +FileName=..\ARM9.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -140,9 +140,9 @@ BuildCmd= [Unit12] -FileName=..\ARM9.h +FileName=..\arm_instructions.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -150,9 +150,9 @@ BuildCmd= [Unit13] -FileName=..\arm_instructions.c +FileName=..\arm_instructions.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -160,9 +160,9 @@ BuildCmd= [Unit14] -FileName=..\arm_instructions.h +FileName=..\armcpu.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -170,9 +170,9 @@ BuildCmd= [Unit15] -FileName=..\armcpu.c +FileName=..\armcpu.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -180,9 +180,9 @@ BuildCmd= [Unit16] -FileName=..\armcpu.h +FileName=..\bios.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -190,9 +190,9 @@ BuildCmd= [Unit17] -FileName=..\bios.c +FileName=..\bios.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -200,9 +200,9 @@ BuildCmd= [Unit18] -FileName=..\bios.h +FileName=..\bits.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -210,9 +210,9 @@ BuildCmd= [Unit19] -FileName=..\bits.h +FileName=..\cflash.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -220,9 +220,9 @@ BuildCmd= [Unit20] -FileName=..\cflash.c +FileName=..\cflash.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -230,9 +230,9 @@ BuildCmd= [Unit21] -FileName=..\cflash.h +FileName=..\config.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -240,9 +240,9 @@ BuildCmd= [Unit22] -FileName=..\config.h +FileName=..\cp15.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -250,9 +250,9 @@ BuildCmd= [Unit23] -FileName=..\cp15.c +FileName=..\cp15.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -260,9 +260,9 @@ BuildCmd= [Unit24] -FileName=..\cp15.h +FileName=..\ctrlssdl.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -270,9 +270,9 @@ BuildCmd= [Unit25] -FileName=..\ctrlssdl.c +FileName=..\ctrlssdl.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -280,9 +280,9 @@ BuildCmd= [Unit26] -FileName=..\ctrlssdl.h +FileName=..\debug.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -290,9 +290,9 @@ BuildCmd= [Unit27] -FileName=..\debug.c +FileName=..\debug.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -300,9 +300,9 @@ BuildCmd= [Unit28] -FileName=..\debug.h +FileName=..\Disassembler.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -310,9 +310,9 @@ BuildCmd= [Unit29] -FileName=..\Disassembler.c +FileName=..\Disassembler.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -320,9 +320,9 @@ BuildCmd= [Unit30] -FileName=..\Disassembler.h +FileName=..\dscard.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -330,9 +330,9 @@ BuildCmd= [Unit31] -FileName=..\dscard.h +FileName=..\fat.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -340,9 +340,9 @@ BuildCmd= [Unit32] -FileName=..\fat.h +FileName=..\FIFO.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -350,9 +350,9 @@ BuildCmd= [Unit33] -FileName=..\FIFO.c +FileName=..\FIFO.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -360,9 +360,9 @@ BuildCmd= [Unit34] -FileName=..\FIFO.h +FileName=..\fs.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -370,9 +370,9 @@ BuildCmd= [Unit35] -FileName=..\fs.h +FileName=..\fs-windows.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -380,9 +380,9 @@ BuildCmd= [Unit36] -FileName=..\fs-windows.c +FileName=..\GPU.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -390,9 +390,9 @@ BuildCmd= [Unit37] -FileName=..\GPU.c +FileName=..\GPU.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -400,9 +400,9 @@ BuildCmd= [Unit38] -FileName=..\GPU.h +FileName=..\mc.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -410,9 +410,9 @@ BuildCmd= [Unit39] -FileName=..\mc.c +FileName=..\mc.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -420,9 +420,9 @@ BuildCmd= [Unit40] -FileName=..\mc.h +FileName=..\mem.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -430,9 +430,9 @@ BuildCmd= [Unit41] -FileName=..\mem.h +FileName=..\MMU.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -440,9 +440,9 @@ BuildCmd= [Unit42] -FileName=..\MMU.c +FileName=..\MMU.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -450,9 +450,9 @@ BuildCmd= [Unit43] -FileName=..\MMU.h +FileName=..\NDSSystem.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -460,9 +460,9 @@ BuildCmd= [Unit44] -FileName=..\NDSSystem.c +FileName=..\NDSSystem.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -470,9 +470,9 @@ BuildCmd= [Unit45] -FileName=..\NDSSystem.h +FileName=..\registers.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -480,9 +480,9 @@ BuildCmd= [Unit46] -FileName=..\registers.h +FileName=..\ROMReader.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -490,9 +490,9 @@ BuildCmd= [Unit47] -FileName=..\ROMReader.c +FileName=..\ROMReader.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -500,9 +500,9 @@ BuildCmd= [Unit48] -FileName=..\ROMReader.h +FileName=..\saves.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -510,9 +510,9 @@ BuildCmd= [Unit49] -FileName=..\saves.c +FileName=..\saves.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -520,9 +520,9 @@ BuildCmd= [Unit50] -FileName=..\saves.h +FileName=..\sndsdl.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -530,9 +530,9 @@ BuildCmd= [Unit51] -FileName=..\sndsdl.c +FileName=..\sndsdl.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -540,9 +540,9 @@ BuildCmd= [Unit52] -FileName=..\sndsdl.h +FileName=..\SPU.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -550,9 +550,9 @@ BuildCmd= [Unit53] -FileName=..\SPU.c +FileName=..\SPU.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -560,9 +560,9 @@ BuildCmd= [Unit54] -FileName=..\SPU.h +FileName=..\thumb_instructions.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -570,9 +570,9 @@ BuildCmd= [Unit55] -FileName=..\thumb_instructions.c +FileName=..\thumb_instructions.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -580,9 +580,9 @@ BuildCmd= [Unit56] -FileName=..\thumb_instructions.h +FileName=..\types.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -590,9 +590,9 @@ BuildCmd= [Unit57] -FileName=..\types.h +FileName=..\wifi.c CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -600,9 +600,9 @@ BuildCmd= [Unit58] -FileName=..\wifi.c +FileName=..\wifi.h CompileCpp=0 -Folder=DeSmuME +Folder= Compile=1 Link=1 Priority=1000 @@ -610,9 +610,9 @@ BuildCmd= [Unit59] -FileName=..\wifi.h +FileName=dTools\callbacks_1_ioregs.c CompileCpp=0 -Folder=DeSmuME +Folder=gtk-glade/dTools Compile=1 Link=1 Priority=1000 @@ -620,7 +620,7 @@ BuildCmd= [Unit60] -FileName=dTools\callbacks_1_ioregs.c +FileName=dTools\callbacks_2_memview.c CompileCpp=0 Folder=gtk-glade/dTools Compile=1 @@ -630,7 +630,7 @@ BuildCmd= [Unit61] -FileName=dTools\callbacks_2_memview.c +FileName=dTools\callbacks_3_palview.c CompileCpp=0 Folder=gtk-glade/dTools Compile=1 @@ -640,7 +640,7 @@ BuildCmd= [Unit62] -FileName=dTools\callbacks_3_palview.c +FileName=dTools\callbacks_dtools.h CompileCpp=0 Folder=gtk-glade/dTools Compile=1 @@ -650,7 +650,7 @@ BuildCmd= [Unit63] -FileName=dTools\callbacks_dtools.h +FileName=dTools\dTools_display.h CompileCpp=0 Folder=gtk-glade/dTools Compile=1 @@ -660,9 +660,9 @@ BuildCmd= [Unit64] -FileName=dTools\dTools_display.h +FileName=gdk_gl.c CompileCpp=0 -Folder=gtk-glade/dTools +Folder=gtk-glade Compile=1 Link=1 Priority=1000 @@ -687,3 +687,431 @@ ProductVersion= AutoIncBuildNr=0 +[Unit65] +FileName=gdk_gl.h +CompileCpp=0 +Folder=gtk-glade +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit66] +FileName=glade-xml.c +CompileCpp=0 +Folder=gtk-glade +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit67] +FileName=..\gl_vertex.c +CompileCpp=0 +Folder= +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit68] +FileName=..\gl_vertex.h +CompileCpp=0 +Folder= +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit69] +FileName=dTools\callbacks_4_tileview.c +CompileCpp=0 +Folder=gtk-glade/dTools +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit70] +FileName=..\cli\main.c +CompileCpp=0 +Folder=nocompile/cli +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c main.c -o main.o $(CFLAGS) + +[Unit71] +FileName=..\gtk\desmume.c +CompileCpp=0 +Folder=nocompile/gtk +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c desmume.c -o desmume.o $(CFLAGS) + +[Unit72] +FileName=..\gtk\desmume.h +CompileCpp=0 +Folder=nocompile/gtk +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit73] +FileName=..\gtk\dTool.h +CompileCpp=0 +Folder=nocompile/gtk +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit74] +FileName=..\gtk\dToolsList.c +CompileCpp=0 +Folder=nocompile/gtk +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c dToolsList.c -o dToolsList.o $(CFLAGS) + +[Unit75] +FileName=..\gtk\globals.h +CompileCpp=0 +Folder=nocompile/gtk +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit76] +FileName=..\gtk\gtk-compat.c +CompileCpp=0 +Folder=nocompile/gtk +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c gtk-compat.c -o gtk-compat.o $(CFLAGS) + +[Unit77] +FileName=..\gtk\gtk-compat.h +CompileCpp=0 +Folder=nocompile/gtk +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit78] +FileName=..\gtk\main.c +CompileCpp=0 +Folder=nocompile/gtk +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c main.c -o main.o $(CFLAGS) + +[Unit79] +FileName=..\gtk\tools\ioregsView.c +CompileCpp=0 +Folder=nocompile/gtk +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c ioregsView.c -o ioregsView.o $(CFLAGS) + +[Unit80] +FileName=..\gtk\tools\ioregsView.h +CompileCpp=0 +Folder=nocompile/gtk +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit81] +FileName=..\windows\memView.h +CompileCpp=0 +Folder=nocompile/windows +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit82] +FileName=..\windows\oamView.c +CompileCpp=0 +Folder=nocompile/windows +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c oamView.c -o oamView.o $(CFLAGS) + +[Unit83] +FileName=..\windows\oamView.h +CompileCpp=0 +Folder=nocompile/windows +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit84] +FileName=..\windows\palView.c +CompileCpp=0 +Folder=nocompile/windows +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c palView.c -o palView.o $(CFLAGS) + +[Unit85] +FileName=..\windows\palView.h +CompileCpp=0 +Folder=nocompile/windows +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit86] +FileName=..\windows\resource.h +CompileCpp=0 +Folder=nocompile/windows +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit87] +FileName=..\windows\resources.rc +Folder=nocompile/windows +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit88] +FileName=..\windows\snddx.c +CompileCpp=0 +Folder=nocompile/windows +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c snddx.c -o snddx.o $(CFLAGS) + +[Unit89] +FileName=..\windows\snddx.h +CompileCpp=0 +Folder=nocompile/windows +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit90] +FileName=..\windows\tileView.c +CompileCpp=0 +Folder=nocompile/windows +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c tileView.c -o tileView.o $(CFLAGS) + +[Unit91] +FileName=..\windows\tileView.h +CompileCpp=0 +Folder=nocompile/windows +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit92] +FileName=..\windows\yopyop_private.h +CompileCpp=0 +Folder=nocompile/windows +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit93] +FileName=..\windows\yopyop_private.rc +Folder=nocompile/windows +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit94] +FileName=..\windows\ConfigKeys.c +CompileCpp=0 +Folder=nocompile/windows +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c ConfigKeys.c -o ConfigKeys.o $(CFLAGS) + +[Unit95] +FileName=..\windows\ConfigKeys.h +CompileCpp=0 +Folder=nocompile/windows +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit96] +FileName=..\windows\CWindow.c +CompileCpp=0 +Folder=nocompile/windows +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c CWindow.c -o CWindow.o $(CFLAGS) + +[Unit97] +FileName=..\windows\CWindow.h +CompileCpp=0 +Folder=nocompile/windows +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit98] +FileName=..\windows\disView.c +CompileCpp=0 +Folder=nocompile/windows +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c disView.c -o disView.o $(CFLAGS) + +[Unit99] +FileName=..\windows\disView.h +CompileCpp=0 +Folder=nocompile/windows +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit100] +FileName=..\windows\ginfo.c +CompileCpp=0 +Folder=nocompile/windows +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c ginfo.c -o ginfo.o $(CFLAGS) + +[Unit101] +FileName=..\windows\ginfo.h +CompileCpp=0 +Folder=nocompile/windows +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit102] +FileName=..\windows\IORegView.c +CompileCpp=0 +Folder=nocompile/windows +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c IORegView.c -o IORegView.o $(CFLAGS) + +[Unit103] +FileName=..\windows\IORegView.h +CompileCpp=0 +Folder=nocompile/windows +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit104] +FileName=..\windows\main.c +CompileCpp=0 +Folder=nocompile/windows +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c main.c -o main.o $(CFLAGS) + +[Unit105] +FileName=..\windows\mapView.c +CompileCpp=0 +Folder=nocompile/windows +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c mapView.c -o mapView.o $(CFLAGS) + +[Unit106] +FileName=..\windows\mapView.h +CompileCpp=0 +Folder=nocompile/windows +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit107] +FileName=..\windows\memView.c +CompileCpp=0 +Folder=nocompile/windows +Compile=0 +Link=0 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c memView.c -o memView.o $(CFLAGS) + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/desmume-glade.desktop.in /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/desmume-glade.desktop.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/desmume-glade.desktop.in 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/desmume-glade.desktop.in 2007-05-11 00:30:14.000000000 -0500 @@ -0,0 +1,10 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=@VERSION@ +Type=Application +Name=DeSmuME (Gtk-Glade) +Comment=Nintento DS emulator +TryExec=desmume-glade +Exec=desmume-glade +Icon=DeSmuME.xpm +Categories=GNOME;GTK;Application;Game; diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/desmume.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/desmume.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/desmume.h 2007-02-01 06:43:02.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/desmume.h 2007-06-07 05:00:52.000000000 -0500 @@ -22,17 +22,24 @@ #include "globals.h" -extern void desmume_init(); -extern void desmume_free(); +#define FPS_LIMITER_FRAME_PERIOD 5 +extern SDL_sem *glade_fps_limiter_semaphore; +extern int glade_fps_limiter_disabled; + +extern void desmume_init( struct armcpu_memory_iface *arm9_mem_if, + struct armcpu_ctrl_iface **arm9_ctrl_iface, + struct armcpu_memory_iface *arm7_mem_if, + struct armcpu_ctrl_iface **arm7_ctrl_iface); +extern void desmume_free( void); extern int desmume_open(const char *filename); extern void desmume_savetype(int type); -extern void desmume_pause(); -extern void desmume_resume(); -extern void desmume_reset(); -extern void desmume_toggle(); -extern BOOL desmume_running(); +extern void desmume_pause( void); +extern void desmume_resume( void); +extern void desmume_reset( void); +extern void desmume_toggle( void); +extern BOOL desmume_running( void); -extern void desmume_cycle(); +extern void desmume_cycle( void); #endif /*__DESMUME_H__*/ diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/dTools/callbacks_1_ioregs.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/dTools/callbacks_1_ioregs.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/dTools/callbacks_1_ioregs.c 2007-01-26 01:01:30.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/dTools/callbacks_1_ioregs.c 2007-05-20 15:56:36.000000000 -0500 @@ -33,7 +33,7 @@ static void update_regs(); /* Register name list */ -#define NBR_IO_REGS 6 +#define NBR_IO_REGS 7 typedef struct { @@ -49,7 +49,8 @@ { "REG_IME", REG_IME, TRUE }, { "REG_IE", REG_IE, FALSE }, { "REG_IF", REG_IF, FALSE }, - { "REG_POWCNT1", REG_POWCNT1, TRUE } + { "REG_POWCNT1", REG_POWCNT1, TRUE }, + { "REG_DISPCAPCNT", REG_DISPA_DISPCAPCNT, FALSE } }; /* update */ diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/dTools/callbacks_2_memview.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/dTools/callbacks_2_memview.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/dTools/callbacks_2_memview.c 2007-01-16 00:29:03.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/dTools/callbacks_2_memview.c 2007-02-23 13:34:08.000000000 -0600 @@ -124,21 +124,23 @@ /* which address */ #define RANGE_MIN 0 -#define RANGE_MAX 0x100000000 -#define ADDR_MASK 0xFFFFFFF0 -#define STEP_ONE_LINE 0x10 -#define STEP_ONE_PAGE 0x100 -#define STEP_x10_PAGE 0x1000 +#define RANGE_MAX 0x10000000 +#define ADDR_MASK 0xFFFFFFF +#define STEP_ONE_LINE 0x1 +#define STEP_ONE_PAGE 0x10 +#define STEP_x10_PAGE 0x100 static void scroll_address(u32 addr) { - address = addr & ADDR_MASK; + address = (addr & ADDR_MASK); refresh(); } static void change_address(u32 addr) { + addr /= 0x10; gtk_range_set_value(wRange, addr); } -static void add_to_address(u32 inc) { - change_address(address+inc); +static void add_to_address(s32 inc) { + u32 addr = (address+inc) & ADDR_MASK; + gtk_range_set_value(wRange, addr); } void on_wtools_2_GotoAddress_activate (GtkEntry *entry, gpointer user_data) { @@ -240,8 +242,9 @@ if (!init) return; + addr=address * 0x10; for (i=0; i<0x100; i++) - mem[i] = MMU_readByte(cpu, address+i); + mem[i] = MMU_readByte(cpu, addr+i); dTools_display_clear(&dsp); switch(packmode) { @@ -252,7 +255,6 @@ // draw memory content here - addr=address; for (i=0; i<0x10; i++) { ptxt = txt; sprintf(ptxt, "%04X:%04X | ", (addr>>16)&0xFFFF, addr&0xFFFF); ptxt+=12; diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/dTools/callbacks_3_palview.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/dTools/callbacks_3_palview.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/dTools/callbacks_3_palview.c 2007-01-14 10:10:22.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/dTools/callbacks_3_palview.c 2007-02-23 08:23:02.000000000 -0600 @@ -21,6 +21,42 @@ #include "callbacks_dtools.h" +void init_combo_palette(GtkComboBox *combo, u16 ** addresses) { + GtkTreeIter iter; + GtkListStore* model = gtk_list_store_new(1, G_TYPE_STRING); + gtk_combo_box_set_model(combo, (GtkTreeModel*)model); + + int i=0; + +#define DO(str,addr,r) \ + gtk_list_store_append (model, &iter); \ + gtk_list_store_set (model, &iter, 0, str,-1); \ + addresses[i]=((u16*)(addr) r); i++; + + DO("Main screen BG PAL", ARM9Mem.ARM9_VMEM,) + DO("Main screen SPR PAL", ARM9Mem.ARM9_VMEM,+0x100) + DO("Sub screen BG PAL", ARM9Mem.ARM9_VMEM,+0x200) + DO("Sub screen SPR PAL", ARM9Mem.ARM9_VMEM,+0x300) + DO("Main screen ExtPAL 0", ARM9Mem.ExtPal[0][0],) + DO("Main screen ExtPAL 1", ARM9Mem.ExtPal[0][1],) + DO("Main screen ExtPAL 2", ARM9Mem.ExtPal[0][2],) + DO("Main screen ExtPAL 3", ARM9Mem.ExtPal[0][3],) + DO("Sub screen ExtPAL 0", ARM9Mem.ExtPal[1][0],) + DO("Sub screen ExtPAL 1", ARM9Mem.ExtPal[1][1],) + DO("Sub screen ExtPAL 2", ARM9Mem.ExtPal[1][2],) + DO("Sub screen ExtPAL 3", ARM9Mem.ExtPal[1][3],) + DO("Main screen SPR ExtPAL 0", ARM9Mem.ObjExtPal[0][0],) + DO("Main screen SPR ExtPAL 1", ARM9Mem.ObjExtPal[0][1],) + DO("Sub screen SPR ExtPAL 0", ARM9Mem.ObjExtPal[1][0],) + DO("Sub screen SPR ExtPAL 1", ARM9Mem.ObjExtPal[1][1],) + DO("Texture PAL 0", ARM9Mem.texPalSlot[0],) + DO("Texture PAL 1", ARM9Mem.texPalSlot[1],) + DO("Texture PAL 2", ARM9Mem.texPalSlot[2],) + DO("Texture PAL 3", ARM9Mem.texPalSlot[3],) +#undef DO + gtk_combo_box_set_active(combo,0); +} + static u16* base_addr[20]; static BOOL init=FALSE; static int palnum=0; @@ -33,20 +69,20 @@ static COLOR c; static COLOR32 c32; -static GdkGC * GC; +static GdkGC * gdkGC; static inline void paint_col(int x, int y, u16 col) { c.val = col; COLOR_16_32(c,c32) - gdk_rgb_gc_set_foreground(GC, c32.val); - gdk_draw_rectangle(wPaint->window, GC, TRUE, x, y, 15, 15); + gdk_rgb_gc_set_foreground(gdkGC, c32.val); + gdk_draw_rectangle(wPaint->window, gdkGC, TRUE, x, y, 15, 15); } static inline void paint_cross(int x, int y) { - gdk_rgb_gc_set_foreground(GC, 0x808080); - gdk_draw_rectangle(wPaint->window, GC, TRUE, x, y, 15, 15); - gdk_rgb_gc_set_foreground(GC, 0xFF0000); - gdk_draw_line(wPaint->window, GC, x+14, y+1, x+1, y+14); - gdk_draw_line(wPaint->window, GC, x+1, y+1, x+14, y+14); + gdk_rgb_gc_set_foreground(gdkGC, 0x808080); + gdk_draw_rectangle(wPaint->window, gdkGC, TRUE, x, y, 15, 15); + gdk_rgb_gc_set_foreground(gdkGC, 0xFF0000); + gdk_draw_line(wPaint->window, gdkGC, x+14, y+1, x+1, y+14); + gdk_draw_line(wPaint->window, gdkGC, x+1, y+1, x+14, y+14); } @@ -54,7 +90,7 @@ int i,x,y,X,Y; u16 * addr = base_addr[palindex], tmp; - GC = gdk_gc_new(wPaint->window); + gdkGC = gdk_gc_new(wPaint->window); if (addr) { memcpy(mem, addr, 0x100*sizeof(u16)); i=0; @@ -69,7 +105,7 @@ for(x=X= 0; x < 16; x++,X+=16) paint_cross(X,Y); } - g_object_unref(GC); + g_object_unref(gdkGC); } @@ -77,7 +113,7 @@ int x,y,X,Y; u16 * addr = base_addr[palindex]; COLOR c; COLOR32 c32; - GC = gdk_gc_new(wPaint->window); + gdkGC = gdk_gc_new(wPaint->window); if (addr) { memcpy(mem, addr, 0x100*sizeof(u16)); for(y=Y= 0; y < 16; y++,Y+=16) @@ -88,50 +124,20 @@ for(x=X= 0; x < 16; x++,X+=16) paint_cross(X,Y); } - g_object_unref(GC); + g_object_unref(gdkGC); } - static void initialize() { GtkComboBox * combo; - GtkTreeIter iter, *parent=NULL; - GtkListStore* model; - int i=0; if (init) return; - combo = (GtkComboBox*)glade_xml_get_widget(xml_tools, "wtools_3_palette"); - model = (GtkListStore*)gtk_combo_box_get_model(combo); wPaint= glade_xml_get_widget(xml_tools, "wtools_3_draw"); wSpin = (GtkSpinButton*)glade_xml_get_widget(xml_tools, "wtools_3_palnum"); + combo = (GtkComboBox*)glade_xml_get_widget(xml_tools, "wtools_3_palette"); + + init_combo_palette(combo, base_addr); -#define DO(str,addr,r) \ - gtk_list_store_append (model, &iter); \ - gtk_list_store_set (model, &iter, 0, str,-1); \ - base_addr[i]=((u16*)(addr) r); i++; - - DO("Main screen BG PAL", ARM9Mem.ARM9_VMEM,) - DO("Main screen SPR PAL", ARM9Mem.ARM9_VMEM,+0x100) - DO("Sub screen BG PAL", ARM9Mem.ARM9_VMEM,+0x200) - DO("Sub screen SPR PAL", ARM9Mem.ARM9_VMEM,+0x300) - DO("Main screen ExtPAL 0", ARM9Mem.ExtPal[0][0],) - DO("Main screen ExtPAL 1", ARM9Mem.ExtPal[0][1],) - DO("Main screen ExtPAL 2", ARM9Mem.ExtPal[0][2],) - DO("Main screen ExtPAL 3", ARM9Mem.ExtPal[0][3],) - DO("Sub screen ExtPAL 0", ARM9Mem.ExtPal[1][0],) - DO("Sub screen ExtPAL 1", ARM9Mem.ExtPal[1][1],) - DO("Sub screen ExtPAL 2", ARM9Mem.ExtPal[1][2],) - DO("Sub screen ExtPAL 3", ARM9Mem.ExtPal[1][3],) - DO("Main screen SPR ExtPAL 0", ARM9Mem.ObjExtPal[0][0],) - DO("Main screen SPR ExtPAL 1", ARM9Mem.ObjExtPal[0][1],) - DO("Sub screen SPR ExtPAL 0", ARM9Mem.ObjExtPal[1][0],) - DO("Sub screen SPR ExtPAL 1", ARM9Mem.ObjExtPal[1][1],) - DO("Texture PAL 0", ARM9Mem.texPalSlot[0],) - DO("Texture PAL 1", ARM9Mem.texPalSlot[1],) - DO("Texture PAL 2", ARM9Mem.texPalSlot[2],) - DO("Texture PAL 3", ARM9Mem.texPalSlot[3],) -#undef DO init=TRUE; - gtk_combo_box_set_active(combo,0); } diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/dTools/callbacks_4_tileview.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/dTools/callbacks_4_tileview.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/dTools/callbacks_4_tileview.c 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/dTools/callbacks_4_tileview.c 2007-02-27 11:47:51.000000000 -0600 @@ -0,0 +1,466 @@ +/* callbacks_3_palview.c - this file is part of DeSmuME + * + * Copyright (C) 2007 Damien Nozay (damdoum) + * Author: damdoum at users.sourceforge.net + * + * This file 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, or (at your option) + * any later version. + * + * This file 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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "callbacks_dtools.h" + +void init_combo_memory(GtkComboBox *combo, u8 ** addresses) { + GtkTreeIter iter; + GtkListStore* model = gtk_list_store_new(1, G_TYPE_STRING); + gtk_combo_box_set_model(combo, (GtkTreeModel*)model); + int i=0; + +#define DO(str,addr,r) \ + gtk_list_store_append (model, &iter); \ + gtk_list_store_set (model, &iter, 0, str,-1); \ + addresses[i]=(addr r); i++; + + DO("A-BG - 0x6000000",ARM9Mem.ARM9_ABG,) + DO("A-BG - 0x6010000",ARM9Mem.ARM9_ABG,+0x10000) + DO("A-BG - 0x6020000",ARM9Mem.ARM9_ABG,+0x20000) + DO("A-BG - 0x6030000",ARM9Mem.ARM9_ABG,+0x30000) + DO("A-BG - 0x6040000",ARM9Mem.ARM9_ABG,+0x40000) + DO("A-BG - 0x6050000",ARM9Mem.ARM9_ABG,+0x50000) + DO("A-BG - 0x6060000",ARM9Mem.ARM9_ABG,+0x60000) + DO("A-BG - 0x6070000",ARM9Mem.ARM9_ABG,+0x70000) + + DO("B-BG - 0x6200000",ARM9Mem.ARM9_BBG,) + DO("B-BG - 0x6210000",ARM9Mem.ARM9_BBG,+0x10000) + + DO("A-OBJ- 0x6400000",ARM9Mem.ARM9_AOBJ,) + DO("A-OBJ- 0x6410000",ARM9Mem.ARM9_AOBJ,+0x10000) + DO("A-OBJ- 0x6420000",ARM9Mem.ARM9_AOBJ,+0x20000) + DO("A-OBJ- 0x6430000",ARM9Mem.ARM9_AOBJ,+0x30000) + + DO("B-OBJ- 0x6600000",ARM9Mem.ARM9_BOBJ,) + DO("B-OBJ- 0x6610000",ARM9Mem.ARM9_BOBJ,+0x10000) + + DO("LCD - 0x6800000",ARM9Mem.ARM9_LCD,) + DO("LCD - 0x6810000",ARM9Mem.ARM9_LCD,+0x10000) + DO("LCD - 0x6820000",ARM9Mem.ARM9_LCD,+0x20000) + DO("LCD - 0x6830000",ARM9Mem.ARM9_LCD,+0x30000) + DO("LCD - 0x6840000",ARM9Mem.ARM9_LCD,+0x40000) + DO("LCD - 0x6850000",ARM9Mem.ARM9_LCD,+0x50000) + DO("LCD - 0x6860000",ARM9Mem.ARM9_LCD,+0x60000) + DO("LCD - 0x6870000",ARM9Mem.ARM9_LCD,+0x70000) + DO("LCD - 0x6880000",ARM9Mem.ARM9_LCD,+0x80000) + DO("LCD - 0x6890000",ARM9Mem.ARM9_LCD,+0x90000) +#undef DO + gtk_combo_box_set_active(combo,0); +} + +static u16* pal_addr[20]; +static u8* mem_addr[26]; +static BOOL init=FALSE; +static int palnum=0; +static int palindex=0; +static int memnum=0; +static int colnum=0; +static void refresh(); +static GtkWidget * wPaint; +static GtkSpinButton * wSpin; +static int gl_context_num=0; + +#define TILE_NUM_MAX 1024 +#define TILE_W_SZ 8 +#define TILE_H_SZ 8 +static u16 tiles[TILE_NUM_MAX][TILE_H_SZ*TILE_W_SZ]; + +static COLOR c; +static COLOR32 c32; +static GdkGC * gdkGC; + + + +static void wtools_4_update() { + +} + +typedef u16 tileBMP[8*8]; + +static void refresh() { + u16 palette_16[64]; + u16 palette_256[64]; + u8 * index16, * index256, * indexBMP; + u16 * pal; + int tile_n, index; + int i,j; + guint Textures; + if (!init) return; + + index16 = index256 = indexBMP = mem_addr[memnum]; + + // this little thing doesnt display properly + // nothing drawn... + // seems that is the context is not shared there is a pb switching context +/* + if (!my_gl_Begin(gl_context_num)) return; + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + my_gl_DrawBeautifulQuad(); + my_gl_End(gl_context_num); + return; + +*/ + if (!my_gl_Begin(gl_context_num)) return; + + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); +#if 1 + glEnable(GL_TEXTURE_2D); + glGenTextures(1, &Textures); + + //proxy + glBindTexture(GL_TEXTURE_2D, Textures); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, + 256, 256, 0, + GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, indexBMP); + + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); glVertex2d(-1.0, 1.0); + glTexCoord2f(1.0, 0.0); glVertex2d( 1.0, 1.0); + glTexCoord2f(1.0, 1.0); glVertex2d( 1.0,-1.0); + glTexCoord2f(0.0, 1.0); glVertex2d(-1.0,-1.0); + glEnd(); + + glDeleteTextures(1, &Textures); + + my_gl_End(gl_context_num); + return; + + glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, + 256, 256, 0, + GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL); + + + switch(colnum) { + case 0: //BMP + for (tile_n=0; tile_n> 5)<<3, + 8, 8, GL_RGBA, + GL_UNSIGNED_SHORT_1_5_5_5_REV, indexBMP); + indexBMP +=64; + } + break; + case 1: //256c + if (pal = pal_addr[palindex]) { + pal += palnum*256; + for (tile_n=0; tile_n<1024; tile_n++) { + for (index=0; index<64; index++) { + palette_256[index]=pal[*index256]; + index256++; + } + glTexSubImage2D(GL_TEXTURE_2D, 0, + (tile_n & 0x1F)<<3, (tile_n >> 5)<<3, + 8, 8, GL_RGBA, + GL_UNSIGNED_SHORT_1_5_5_5_REV, palette_256); + } + } + break; + case 2: //16c + if (pal = pal_addr[palindex]) { + pal += palnum*16; + for (tile_n=0; tile_n<1024; tile_n++) { + for (index=0; index<64; index++) { + if (index & 1) continue; + palette_16[index] =pal[*index16 & 15]; + palette_16[index+1]=pal[*index16 >> 4]; + index16++; + } + glTexSubImage2D(GL_TEXTURE_2D, 0, + (tile_n & 0x1F)<<3, (tile_n >> 5)<<3, + 8, 8, GL_RGBA, + GL_UNSIGNED_SHORT_1_5_5_5_REV, palette_16); + } + } + break; + } + + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); glVertex2d(-0.5, 0.5); + glTexCoord2f(0.0, 1.0); glVertex2d(-0.5,-0.5); + glTexCoord2f(1.0, 1.0); glVertex2d( 0.5,-0.5); + glTexCoord2f(1.0, 0.0); glVertex2d( 0.5, 0.5); + glEnd(); + + glDeleteTextures(1, &Textures); +#else + glDisable(GL_LIGHTING); + glDisable(GL_BLEND); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glColor4ub(255,255,255,255); + switch(colnum) { + case 0: //BMP + { + tileBMP tiles * = indexBMP; + + for (tile_n=0; tile_n<1024; tile_n++) { + i = (tile_n & 0x1F) << 4; + j = (tile_n >> 5) << 12; + memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; j+=512; + memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; j+=512; + memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; j+=512; + memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; j+=512; + memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; j+=512; + memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; j+=512; + memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; j+=512; + memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; + } + glRasterPos2i(0,0); + glDrawPixels(256,256,GL_RGBA,GL_UNSIGNED_SHORT_1_5_5_5_REV, bmp); + } + break; + case 1: //256c + if (pal = pal_addr[palindex]) { + pal += palnum*256; + for (tile_n=0; tile_n<1024; tile_n++) { + for (index=0; index<64; index++) { + palette_256[index]=pal[*index256]; + index256++; + } + glRasterPos2i((tile_n & 0x1F)<<3, (tile_n >> 5)<<3); + glDrawPixels(8,8,GL_RGBA,GL_UNSIGNED_SHORT_1_5_5_5_REV, palette_256); + } + } + break; + case 2: //16c + if (pal = pal_addr[palindex]) { + pal += palnum*16; + for (tile_n=0; tile_n<1024; tile_n++) { + for (index=0; index<64; index++) { + if (index & 1) continue; + palette_16[index] =pal[*index16 & 15]; + palette_16[index+1]=pal[*index16 >> 4]; + index16++; + } + glRasterPos2i((tile_n & 0x1F)<<3, (tile_n >> 5)<<3); + glDrawPixels(8,8,GL_RGBA,GL_UNSIGNED_SHORT_1_5_5_5_REV, palette_16); + } + } + break; + } +#endif + my_gl_End(gl_context_num); +} + +static void initialize() { + GtkComboBox * combo; + if (init) return; + + wPaint= glade_xml_get_widget(xml_tools, "wDraw_Tile"); + wSpin = (GtkSpinButton*)glade_xml_get_widget(xml_tools, "wtools_4_palnum"); + combo = (GtkComboBox*)glade_xml_get_widget(xml_tools, "wtools_4_palette"); + init_combo_palette(combo, pal_addr); + combo = (GtkComboBox*)glade_xml_get_widget(xml_tools, "wtools_4_memory"); + init_combo_memory(combo, mem_addr); + + gl_context_num = init_GL_free_s(wPaint,0); + reshape(wPaint, gl_context_num); + gtk_widget_show(wPaint); + init=TRUE; +} + + +void on_wtools_4_TileView_show (GtkWidget *widget, gpointer data) { + initialize(); + register_Tool(wtools_4_update); +} +gboolean on_wtools_4_TileView_close (GtkWidget *widget, ...) { + unregister_Tool(wtools_4_update); + gtk_widget_hide(widget); + return TRUE; +} + +void on_wtools_4_palette_changed (GtkComboBox *combo, gpointer user_data) { + palindex = gtk_combo_box_get_active(combo); + gtk_widget_set_sensitive((GtkWidget*)wSpin,(palindex >=4)); + gtk_spin_button_set_value(wSpin,0); + gtk_widget_queue_draw(wPaint); +} +void on_wtools_4_palnum_value_changed (GtkSpinButton *spin, gpointer user_data) { + palnum = gtk_spin_button_get_value_as_int(spin); + gtk_widget_queue_draw(wPaint); +} +void on_wtools_4_memory_changed (GtkComboBox *combo, gpointer user_data) { + memnum = gtk_combo_box_get_active(combo); + gtk_widget_queue_draw(wPaint); +} +void on_wtools_4_rXX_toggled (GtkToggleButton *togglebutton, gpointer user_data) { + colnum = dyn_CAST(int,user_data); + gtk_widget_queue_draw(wPaint); +} +gboolean on_wDraw_Tile_expose_event (GtkWidget * w, GdkEventExpose * e, gpointer user_data) { + refresh(); + return TRUE; +} + + + +#if 0 + +void other_screen (GtkWidget * widget, int screen) { + if (!my_gl_Begin(screen)) return; + + my_gl_Identity(); + glClear( GL_COLOR_BUFFER_BIT ); + + GPU * gpu = &SubScreen; + struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits; + _OAM_ * spriteInfo = (_OAM_*)(gpu->oam + 127);// + 127; + u16 i; int mode; + u8 prioTab[256]; + +#define MODE_IDX_16 1 +#define MODE_IDX_256 2 +#define MODE_BMP 3 + + for(i = 0; i<127; ++i, --spriteInfo) + { + size sprSize; + s32 sprX, sprY, x, y, lg; + int xdir; + u8 prio, * src; + u16 * pal; + u16 i,j; + u16 rotScaleA,rotScaleB,rotScaleC,rotScaleD; + int block; + + prio = spriteInfo->Priority; + + // get sprite location and size + sprX = (spriteInfo->X<<23)>>23; + sprY = spriteInfo->Y; + sprSize = sprSizeTab[spriteInfo->Size][spriteInfo->Shape]; + + lg = sprSize.x; + + if (spriteInfo->RotScale == 2) continue; +#if 0 + // switch TOP<-->BOTTOM + if (spriteInfo->VFlip); + // switch LEFT<-->RIGHT + if (spriteInfo->HFlip); + + { + u16 rotScaleIndex; + // index from 0 to 31 + rotScaleIndex = spriteInfo->RotScalIndex + (spriteInfo->HFlip<<1) + (spriteInfo->VFlip << 2); + rotScaleA = T1ReadWord((u8*)(gpu->oam + rotScaleIndex*0x20 + 0x06),0) ; + rotScaleB = T1ReadWord((u8*)(gpu->oam + rotScaleIndex*0x20 + 0x0E),0) ; + rotScaleC = T1ReadWord((u8*)(gpu->oam + rotScaleIndex*0x20 + 0x16),0) ; + rotScaleD = T1ReadWord((u8*)(gpu->oam + rotScaleIndex*0x20 + 0x1E),0) ; + } + + if (spriteInfo->Mode == 2) { + src = gpu->sprMem + ((spriteInfo->TileIndex)<<5) + ((y>>3)<<10); + continue; + } + + if (spriteInfo->Mode == 3) /* sprite is in BMP format */ + { + src = (gpu->sprMem) + (spriteInfo->TileIndex<<4) + (y<sprBMPBoundary); + + if (dispCnt->OBJ_BMP_2D_dim) // 256*256 + src = (gpu->sprMem) + (((spriteInfo->TileIndex&0x3F0) * 64 + (spriteInfo->TileIndex&0x0F) *8) << 1); + else // 128 * 512 + src = (gpu->sprMem) + (((spriteInfo->TileIndex&0x3E0) * 64 + (spriteInfo->TileIndex&0x1F) *8) << 1); + continue; + } + + + if(dispCnt->OBJ_Tile_1D) + + if (spriteInfo->Depth) { + //256 colors + glColorTable(GL_TEXTURE_COLOR_TABLE_EXT, + GL_RGBA, 256, GL_RGBA, + GL_UNSIGNED_SHORT_1_5_5_5_REV, pal); + } else { + pal += (spriteInfo->PaletteIndex<<4); + glColorTable(GL_TEXTURE_COLOR_TABLE_EXT, + GL_RGBA, 16, GL_RGBA, + GL_UNSIGNED_SHORT_1_5_5_5_REV, pal); + } + glTexImage2D(GL_TEXTURE_2D, 0, COLOR_INDEX4_EXT, + 16, 16, 0, + GL_COLOR_INDEX, GL_UNSIGNED_BYTE, src); + src = gpu->sprMem + ((spriteInfo->TileIndex)<<5) + ((y>>3)<<10); + pal = (u16*)(ARM9Mem.ARM9_VMEM + 0x200 + gpu->core *0x400); +#endif + } + + int boundary = 32; + if (dispCnt->OBJ_Tile_1D) + boundary <<= dispCnt->OBJ_Tile_1D_Bound; + + int bmpboundary = 128; + bmpboundary <<= (dispCnt->OBJ_BMP_mapping & dispCnt->OBJ_BMP_1D_Bound); + + guint Textures[3]; + glGenTextures(3, Textures); + glBindTexture(GL_TEXTURE_2D, Textures[0]); + //proxy + glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, + 256, 256, 0, + GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL); + + u16 * pal = (u16*)(ARM9Mem.ARM9_VMEM + 0x200 + gpu->core *0x400); + + u8 palette_16[1024][64]; + u8 palette_256[1024][64]; +// u16 tile_BMP[1024][64]; + u8 * index16 = gpu->sprMem; + u8 * index256 = gpu->sprMem; + u16 * indexBMP = gpu->sprMem; + int tile_n, index; + if (gpu->sprMem != NULL) + for (tile_n=0; tile_n<1024; tile_n++) { + for (index=0; index<64; index++) { +// tile_BMP[tile_n][index]=*indexBMP; +// indexBMP++; + palette_256[tile_n][index]=pal[*index256]; + index256++; + + if (index & 1) continue; + palette_16[tile_n][index] =pal[*index16 & 15]; + palette_16[tile_n][index+1]=pal[*index16 >> 4]; + index16++; + } + glBindTexture(GL_TEXTURE_2D, Textures[0]); + glTexSubImage2D(GL_TEXTURE_2D, 0, + (tile_n & 0x1F)<<3, (tile_n >> 5)<<3, + 8, 8, GL_RGBA, + GL_UNSIGNED_SHORT_1_5_5_5_REV, indexBMP); + } + + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); glVertex2d(-1.0, 1.0); + glTexCoord2f(0.0, 1.0); glVertex2d(-1.0,-1.0); + glTexCoord2f(1.0, 1.0); glVertex2d( 1.0,-1.0); + glTexCoord2f(1.0, 0.0); glVertex2d( 1.0, 1.0); + glEnd(); + + my_gl_End(screen); + glDeleteTextures(3, &Textures); +} + +#endif diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/dTools/callbacks_dtools.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/dTools/callbacks_dtools.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/dTools/callbacks_dtools.h 2007-01-30 06:40:32.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/dTools/callbacks_dtools.h 2007-02-13 11:50:15.000000000 -0600 @@ -45,10 +45,27 @@ G_MODULE_EXPORT gboolean on_wtools_2_draw_scroll_event (GtkWidget *, GdkEventScroll *, gpointer ); /* ***** ***** PALETTE VIEWER ***** ***** */ +// initialise combo box for all palettes +void init_combo_palette(GtkComboBox *combo, u16 ** addresses); + G_MODULE_EXPORT void on_wtools_3_PalView_show (GtkWidget *, gpointer ); G_MODULE_EXPORT gboolean on_wtools_3_PalView_close (GtkWidget *, ...); - G_MODULE_EXPORT gboolean on_wtools_3_PalView_delete_event (GtkWidget *, GdkEvent *, gpointer ); G_MODULE_EXPORT gboolean on_wtools_3_draw_expose_event (GtkWidget *, GdkEventExpose *, gpointer ); G_MODULE_EXPORT void on_wtools_3_palette_changed (GtkComboBox *, gpointer ); G_MODULE_EXPORT void on_wtools_3_palnum_value_changed (GtkSpinButton *, gpointer ); + + +/* ***** ***** TILE VIEWER ***** ***** */ +// initialise combo box for all palettes +void init_combo_memory(GtkComboBox *combo, u8 ** addresses); + +G_MODULE_EXPORT void on_wtools_4_TileView_show (GtkWidget *, gpointer ); +G_MODULE_EXPORT gboolean on_wtools_4_TileView_close (GtkWidget *, ...); +G_MODULE_EXPORT gboolean on_wtools_4_TileView_delete_event (GtkWidget *, GdkEvent *, gpointer ); +G_MODULE_EXPORT void on_wtools_4_memory_changed (GtkComboBox *, gpointer ); +G_MODULE_EXPORT void on_wtools_4_palette_changed (GtkComboBox *, gpointer ); +G_MODULE_EXPORT void on_wtools_4_palnum_value_changed (GtkSpinButton *, gpointer ); +G_MODULE_EXPORT void on_wtools_4_rXX_toggled (GtkToggleButton *togglebutton, gpointer user_data); +G_MODULE_EXPORT gboolean on_wDraw_Tile_expose_event (GtkWidget *, GdkEventExpose *, gpointer ); + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/dTools/dTools_display.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/dTools/dTools_display.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/dTools/dTools_display.h 2007-01-15 09:22:36.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/dTools/dTools_display.h 2007-02-22 09:04:11.000000000 -0600 @@ -99,7 +99,7 @@ pango_layout_set_attributes(dsp->playout, dsp->curr_attr); } -static void inline dTools_display_draw_text(dTools_dsp * dsp, int x, int y, char * txt) { +static void inline dTools_display_draw_text(dTools_dsp * dsp, int x, int y, const char * txt) { pango_layout_set_text(dsp->playout, txt, -1); gdk_draw_layout(dsp->draw, dsp->gc_fg, x * dsp->char_w + dsp->padding, diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/gdk_3Demu.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/gdk_3Demu.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/gdk_3Demu.c 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/gdk_3Demu.c 2007-07-15 16:50:30.000000000 -0500 @@ -0,0 +1,203 @@ +/* $Id: gdk_3Demu.c,v 1.4 2007/07/15 21:50:30 evilynux Exp $ + */ +/* + Copyright (C) 2006-2007 Ben Jaques + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifdef GTKGLEXT_AVAILABLE + +#include + +// Localization +#include +#define _(String) gettext (String) + +#include "../types.h" +#include "../render3D.h" +#include "../opengl_collector_3Demu.h" +#include "gdk_3Demu.h" + +/* + * The GDK 3D emulation. + * This uses the OpenGL Collector plugin, using gdkGLext for the platform + * specific helper functions. + */ + + +static GdkPixmap *target_pixmap; +static GdkGLContext *glcontext = NULL; +static GdkGLDrawable *gldrawable; + + +static void +print_gl_config_attrib (GdkGLConfig *glconfig, + const gchar *attrib_str, + int attrib, + gboolean is_boolean) +{ + int value; + + g_print ("%s = ", attrib_str); + if (gdk_gl_config_get_attrib (glconfig, attrib, &value)) + { + if (is_boolean) + g_print ("%s\n", value == TRUE ? "TRUE" : "FALSE"); + else + g_print ("%d\n", value); + } + else + g_print (_("*** Cannot get %s attribute value\n"), attrib_str); +} + + +static void +examine_gl_config_attrib (GdkGLConfig *glconfig) +{ + g_print ("\nOpenGL visual configurations :\n\n"); + + g_print ("gdk_gl_config_is_rgba (glconfig) = %s\n", + gdk_gl_config_is_rgba (glconfig) ? "TRUE" : "FALSE"); + g_print ("gdk_gl_config_is_double_buffered (glconfig) = %s\n", + gdk_gl_config_is_double_buffered (glconfig) ? "TRUE" : "FALSE"); + g_print ("gdk_gl_config_is_stereo (glconfig) = %s\n", + gdk_gl_config_is_stereo (glconfig) ? "TRUE" : "FALSE"); + g_print ("gdk_gl_config_has_alpha (glconfig) = %s\n", + gdk_gl_config_has_alpha (glconfig) ? "TRUE" : "FALSE"); + g_print ("gdk_gl_config_has_depth_buffer (glconfig) = %s\n", + gdk_gl_config_has_depth_buffer (glconfig) ? "TRUE" : "FALSE"); + g_print ("gdk_gl_config_has_stencil_buffer (glconfig) = %s\n", + gdk_gl_config_has_stencil_buffer (glconfig) ? "TRUE" : "FALSE"); + g_print ("gdk_gl_config_has_accum_buffer (glconfig) = %s\n", + gdk_gl_config_has_accum_buffer (glconfig) ? "TRUE" : "FALSE"); + + g_print ("\n"); + + print_gl_config_attrib (glconfig, "GDK_GL_USE_GL", + GDK_GL_USE_GL, TRUE); + print_gl_config_attrib (glconfig, "GDK_GL_BUFFER_SIZE", + GDK_GL_BUFFER_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_LEVEL", + GDK_GL_LEVEL, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_RGBA", + GDK_GL_RGBA, TRUE); + print_gl_config_attrib (glconfig, "GDK_GL_DOUBLEBUFFER", + GDK_GL_DOUBLEBUFFER, TRUE); + print_gl_config_attrib (glconfig, "GDK_GL_STEREO", + GDK_GL_STEREO, TRUE); + print_gl_config_attrib (glconfig, "GDK_GL_AUX_BUFFERS", + GDK_GL_AUX_BUFFERS, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_RED_SIZE", + GDK_GL_RED_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_GREEN_SIZE", + GDK_GL_GREEN_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_BLUE_SIZE", + GDK_GL_BLUE_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_ALPHA_SIZE", + GDK_GL_ALPHA_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_DEPTH_SIZE", + GDK_GL_DEPTH_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_STENCIL_SIZE", + GDK_GL_STENCIL_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_RED_SIZE", + GDK_GL_ACCUM_RED_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_GREEN_SIZE", + GDK_GL_ACCUM_GREEN_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_BLUE_SIZE", + GDK_GL_ACCUM_BLUE_SIZE, FALSE); + print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_ALPHA_SIZE", + GDK_GL_ACCUM_ALPHA_SIZE, FALSE); + + g_print ("\n"); +} + + +static int +begin_opengl_region_gdk_3d( void) { + + if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)) { + return 0; + } + + return 1; +} + +static void +end_opengl_region_gdk_3d( void) { + gdk_gl_drawable_gl_end (gldrawable); +} + +static int +initialise_gdk_3d( void) { + /* this does nothing */ + return 1; +} + +int +init_opengl_gdk_3Demu( void) { + GdkGLConfig *glconfig; + + /* create the off screen pixmap */ + target_pixmap = gdk_pixmap_new ( NULL, 256, 192, 24); + + if ( target_pixmap == NULL) { + g_print (_("*** Failed to create pixmap.\n")); + return 0; + } + + glconfig = gdk_gl_config_new_by_mode (GDK_GL_MODE_RGBA | + GDK_GL_MODE_DEPTH | + GDK_GL_MODE_STENCIL | + GDK_GL_MODE_SINGLE); + if (glconfig == NULL) + { + g_print (_("*** No appropriate OpenGL-capable visual found.\n")); + return 0; + } + + /* + * Set OpenGL-capability to the pixmap + */ + + gldrawable = GDK_GL_DRAWABLE (gdk_pixmap_set_gl_capability (target_pixmap, + glconfig, + NULL)); + + if ( gldrawable == NULL) { + g_print (_("Failed to create the GdkGLPixmap\n")); + return 0; + } + + glcontext = gdk_gl_context_new (gldrawable, + NULL, + FALSE, + GDK_GL_RGBA_TYPE); + if (glcontext == NULL) + { + g_print (_("Connot create the OpenGL rendering context\n")); + return 0; + } + + begin_opengl_ogl_collector_platform = begin_opengl_region_gdk_3d; + end_opengl_ogl_collector_platform = end_opengl_region_gdk_3d; + initialise_ogl_collector_platform = initialise_gdk_3d; + + + return 1; +} + +#endif diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/gdk_3Demu.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/gdk_3Demu.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/gdk_3Demu.h 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/gdk_3Demu.h 2007-04-21 14:45:07.000000000 -0500 @@ -0,0 +1,32 @@ +/* $Id: gdk_3Demu.h,v 1.1 2007/04/21 19:45:07 evilynux Exp $ + */ +/* + Copyright (C) 2006-2007 Ben Jaques + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifdef GTKGLEXT_AVAILABLE +/* + * The GDK 3D emulation. + * This uses the OpenGL Collector plugin, using gdkGLext for the platform + * specific helper functions. + */ + +int +init_opengl_gdk_3Demu( void); + +#endif diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/gdk_gl.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/gdk_gl.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/gdk_gl.c 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/gdk_gl.c 2007-05-24 09:39:17.000000000 -0500 @@ -0,0 +1,347 @@ +/* gdk_gl.c - this file is part of DeSmuME + * + * Copyright (C) 2007 Damien Nozay (damdoum) + * Author: damdoum at users.sourceforge.net + * + * This file 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, or (at your option) + * any later version. + * + * This file 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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "gdk_gl.h" + +#ifdef GTKGLEXT_AVAILABLE + +#include +#include + +#define _DUP8(a) a,a,a,a, a,a,a,a +#define _DUP4(a) a,a,a,a +#define _DUP2(a) a,a + +GLuint Textures[2]; +// free number we can use in tools 0-1 reserved for screens +static int free_gl_drawable=2; +GdkGLConfig *my_glConfig=NULL; +GdkGLContext *my_glContext[8]={_DUP8(NULL)}; +GdkGLDrawable *my_glDrawable[8]={_DUP8(NULL)}; +GtkWidget *pDrawingTexArea; + +GLuint screen_texture[1]; + +/* enable software colour format conversion */ +static int gtk_glade_use_software_colour_convert; + +#undef _DUP8 +#undef _DUP4 +#undef _DUP2 + +/* FIXME: Purpose of this code? */ +BOOL _fun_gl_Begin (int screen) { return FALSE; } +void _fun_gl_End (int screen) { } + +fun_gl_Begin Open_GL_beg = _fun_gl_Begin; +fun_gl_End Open_GL_end = _fun_gl_End; + +void register_gl_fun(fun_gl_Begin beg,fun_gl_End end) { + Open_GL_beg = beg; + Open_GL_end = end; +} + +/************************************************/ +/* BEGIN & END */ +/************************************************/ + +BOOL my_gl_Begin (int screen) { + return gdk_gl_drawable_gl_begin(my_glDrawable[screen], my_glContext[screen]); +} + +void my_gl_End (int screen) { + if (gdk_gl_drawable_is_double_buffered (my_glDrawable[screen])) + gdk_gl_drawable_swap_buffers (my_glDrawable[screen]); + else + glFlush(); + gdk_gl_drawable_gl_end(my_glDrawable[screen]); +} + +/************************************************/ +/* OTHER GL COMMANDS */ +/************************************************/ + +void my_gl_Identity() { + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +void my_gl_DrawBeautifulQuad( void) { + // beautiful quad + glBegin(GL_QUADS); + glColor3ub(255,0,0); glVertex2d(-0.75,-0.75); + glColor3ub(128,255,0); glVertex2d(-0.75, 0.75); + glColor3ub(0,255,128); glVertex2d( 0.75, 0.75); + glColor3ub(0,0,255); glVertex2d( 0.75,-0.75); + glEnd(); + glColor3ub(255,255,255); +} + + +void my_gl_DrawLogo() { + + +} + + +void my_gl_Clear(int screen) { + if (!my_gl_Begin(screen)) return; + + /* Set the background black */ + glClearColor(1.0f, 1.0f, 1.0f, 1.0f); + glClearDepth(1.0); + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + my_gl_DrawBeautifulQuad(); + + my_gl_End(screen); +} + +/************************************************/ +/* INITIALIZATION */ +/************************************************/ + +void init_GL(GtkWidget * widget, int screen, int share_num) { +// for (n=gtk_events_pending(); n>0; n--) +// gtk_main_iteration(); + // init GL capability + my_glContext[screen]=NULL; + my_glDrawable[screen]=NULL; + if (!gtk_widget_set_gl_capability( + widget, my_glConfig, + my_glContext[share_num], + //NULL, + TRUE, + GDK_GL_RGBA_TYPE)) { + printf ("gtk_widget_set_gl_capability\n"); + exit(1); + } + // realize so that we get a GdkWindow + gtk_widget_realize(widget); + // make sure we realize + gdk_flush(); + + my_glDrawable[screen] = gtk_widget_get_gl_drawable(widget); + + if (screen == share_num) { + my_glContext[screen] = gtk_widget_get_gl_context(widget); + } else { + my_glContext[screen] = my_glContext[share_num]; + return; + } + + reshape(widget, screen); +} + +int init_GL_free_s(GtkWidget * widget, int share_num) { + int r = free_gl_drawable; + my_glContext[r]=NULL; + my_glDrawable[r]=NULL; + init_GL(widget, r, share_num); + free_gl_drawable++; + return r; +} + +int init_GL_free(GtkWidget * widget) { + int r = free_gl_drawable; + my_glContext[r]=NULL; + my_glDrawable[r]=NULL; + init_GL(widget, r, r); + free_gl_drawable++; + return r; +} + +void init_GL_capabilities( int use_software_convert) { + + uint16_t blank_texture[256 * 512]; + my_glConfig = gdk_gl_config_new_by_mode ( + GDK_GL_MODE_RGBA + | GDK_GL_MODE_DEPTH + | GDK_GL_MODE_DOUBLE + ); + + gtk_glade_use_software_colour_convert = use_software_convert; + // initialize 1st drawing area + init_GL(pDrawingArea,0,0); + my_gl_Clear(0); + + if (!my_gl_Begin(0)) return; + // generate ONE texture (display) + glEnable(GL_TEXTURE_2D); + glGenTextures(2, Textures); + + /* Generate The Texture */ + glBindTexture( GL_TEXTURE_2D, Textures[0]); + glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, 256, 512, + 0, GL_RGBA, + GL_UNSIGNED_SHORT_1_5_5_5_REV, + blank_texture); + my_gl_End(0); + + // initialize 2nd drawing area (sharing context) + init_GL(pDrawingArea2,1,0); + my_gl_Clear(1); +} + +/************************************************/ +/* RESHAPE */ +/************************************************/ + +void reshape (GtkWidget * widget, int screen) { + if (my_glDrawable[screen] == NULL || + !my_gl_Begin(screen)) return; + + glViewport (0, 0, widget->allocation.width, widget->allocation.height); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + my_gl_End(screen); +} + +/************************************************/ +/* TEXTURING */ +/************************************************/ + +void my_gl_Texture2D() { + glBindTexture(GL_TEXTURE_2D, Textures[0]); +#define MyFILTER GL_LINEAR +//#define MyFILTER GL_NEAREST + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, MyFILTER); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, MyFILTER); +#undef MyFILTER +} + +static void +my_gl_ScreenTex( int software_convert) { + if ( software_convert) { + u8 converted[256 * 384 * 3]; + int i; + + for ( i = 0; i < (256 * 384); i++) { + converted[(i * 3) + 0] = ((*((u16 *)&GPU_screen[(i<<1)]) >> 0) & 0x1f) << 3; + converted[(i * 3) + 1] = ((*((u16 *)&GPU_screen[(i<<1)]) >> 5) & 0x1f) << 3; + converted[(i * 3) + 2] = ((*((u16 *)&GPU_screen[(i<<1)]) >> 10) & 0x1f) << 3; + } + + glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 256, 384, + GL_RGB, + GL_UNSIGNED_BYTE, + converted); + } + else { + glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 256, 384, + GL_RGBA, + GL_UNSIGNED_SHORT_1_5_5_5_REV, + &GPU_screen); + } +} + +void my_gl_ScreenTexApply(int screen) { + float off = (screen)?0.375:0; + glBegin(GL_QUADS); + // texcoords 0.375 means 192, 1 means 256 + glTexCoord2f(0.0, off+0.000); glVertex2d(-1.0, 1.0); + glTexCoord2f(1.0, off+0.000); glVertex2d( 1.0, 1.0); + glTexCoord2f(1.0, off+0.375); glVertex2d( 1.0,-1.0); + glTexCoord2f(0.0, off+0.375); glVertex2d(-1.0,-1.0); + glEnd(); +} + +/************************************************/ +/* RENDERING */ +/************************************************/ + +gboolean screen (GtkWidget * widget, int viewportscreen) { + int screen; + GPU * gpu; + float bright_color = 0.0f; // blend with black + float bright_alpha = 0.0f; // don't blend + + // we take care to draw the right thing the right place + // we need to rearrange widgets not to use this trick + screen = (ScreenInvert)?1-viewportscreen:viewportscreen; +// screen = viewportscreen; + + if (!my_gl_Begin(viewportscreen)) return TRUE; + + glLoadIdentity(); + + // clear screen + glClearColor(0.0f,0.0f,0.0f,0.0f); + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glEnable(GL_TEXTURE_2D); + + if (desmume_running()) { + + // master bright + gpu = ((screen)?SubScreen:MainScreen).gpu; + + switch (gpu->MasterBrightMode) + { + case 1: // Bright up : blend with white + bright_color = 1.0f; + // no break; + case 2: // Bright down : blend with black + bright_alpha = 1.0f; // blending max + + bright_alpha = gpu->MasterBrightFactor / 16.0; + break; + // Disabled 0, Reserved 3 + default: break; + } + // rotate + glRotatef(ScreenRotate, 0.0, 0.0, 1.0); + // create the texture for both display + my_gl_Texture2D(); + if (viewportscreen==0) { + my_gl_ScreenTex( gtk_glade_use_software_colour_convert); + } + } else { + // pause + // fake master bright up 50% + bright_color = 0.0f; + bright_alpha = 0.5f; + } + // make sure current color is ok + glColor4ub(255,255,255,255); + // apply part of the texture + my_gl_ScreenTexApply(screen); + glDisable(GL_TEXTURE_2D); + + // master bright (bis) + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + glColor4f(bright_color,bright_color,bright_color,bright_alpha); + glBegin(GL_QUADS); + glVertex2d(-1.0, 1.0); + glVertex2d( 1.0, 1.0); + glVertex2d( 1.0,-1.0); + glVertex2d(-1.0,-1.0); + glEnd(); + glDisable(GL_BLEND); + + my_gl_End(viewportscreen); + return TRUE; +} + +#endif /* if GTKGLEXT_AVAILABLE */ diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/gdk_gl.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/gdk_gl.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/gdk_gl.h 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/gdk_gl.h 2007-05-24 09:43:58.000000000 -0500 @@ -0,0 +1,44 @@ +/* gdk_gl.h - this file is part of DeSmuME + * + * Copyright (C) 2007 Damien Nozay (damdoum) + * Author: damdoum at users.sourceforge.net + * + * This file 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, or (at your option) + * any later version. + * + * This file 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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "globals.h" +// comment for GL :D +//#undef HAVE_LIBGDKGLEXT_X11_1_0 +#ifdef GTKGLEXT_AVAILABLE + #include + #include + #include + #include +#endif + + +BOOL my_gl_Begin (int screen); +void my_gl_End (int screen); +void my_gl_Clear(int screen); +void my_gl_DrawBeautifulQuad( void); + +void init_GL_capabilities( int use_software_convert); +void init_GL(GtkWidget * widget, int screen, int share_num); +int init_GL_free_s(GtkWidget * widget, int share_num); +int init_GL_free(GtkWidget * widget); +void register_gl_fun(fun_gl_Begin beg,fun_gl_End end); +void reshape (GtkWidget * widget, int screen); +gboolean screen (GtkWidget * widget, int off); diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/glade/DeSmuMe_Dtools.glade /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/glade/DeSmuMe_Dtools.glade --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/glade/DeSmuMe_Dtools.glade 2007-01-15 09:22:37.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/glade/DeSmuMe_Dtools.glade 2007-05-20 15:56:36.000000000 -0500 @@ -1,529 +1,537 @@ - - - + + + - - - IO registers - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - True - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - True - - - - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - 2 - 2 - False - 0 - 5 - - - - True - cpu : ARM7 -cpu : ARM9 - False - True - - - - 0 - 1 - 0 - 1 - fill - fill - - - - - - True - GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - - - 0 - 2 - 1 - 2 - fill - - - - - 0 - True - True - - - - - - - - memory viewer - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - DeSmuME.xpm - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - True - - - - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - -7 - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - 2 - 2 - False - 0 - 0 - - - - True - GTK_UPDATE_CONTINUOUS - False - 0 0 0 0 0 0 - - - - 1 - 2 - 1 - 2 - fill - fill - - - - - - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - - - - 0 - 1 - 1 - 2 - - - - - - True - False - 0 - - - - True - True - 8 bit - True - GTK_RELIEF_NORMAL - True - True - False - True - - - - 0 - False - False - - - - - - True - True - 16 bit - True - GTK_RELIEF_NORMAL - True - False - False - True - wtools_2_r8 - - - - 0 - False - False - - - - - - True - True - 32 bit - True - GTK_RELIEF_NORMAL - True - False - False - True - wtools_2_r8 - - - - 0 - False - False - - - - - - True - ARM9 cpu + + IO registers + True + GDK_WINDOW_TYPE_HINT_DIALOG + + + + + + True + + + True + 2 + 2 + 5 + + + + + + True + GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + + 2 + 1 + 2 + GTK_FILL + + + + + True + cpu : ARM9 +cpu : ARM7 + + + + GTK_FILL + GTK_FILL + + + + + 2 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-ok + True + -5 + + + + + False + GTK_PACK_END + + + + + + + memory viewer + DeSmuME.xpm + GDK_WINDOW_TYPE_HINT_DIALOG + + + + + + True + + + True + 2 + 2 + + + + + + True + + + True + True + 8 bit + True + True + True + + + + False + False + + + + + True + True + 16 bit + True + True + wtools_2_r8 + + + + False + False + 1 + + + + + True + True + 32 bit + True + True + wtools_2_r8 + + + + False + False + 2 + + + + + True + ARM9 cpu ARM7 cpu - False - True - - - - 0 - False - False - - - - - - True - GoTo: - False - False - GTK_JUSTIFY_RIGHT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - True - False - - - - - - True - True - True - True - 10 - 0x00000000 - True - ● - False - - - - - 0 - False - True - - - - - - True - True - Go! - True - GTK_RELIEF_NORMAL - True - - - - 0 - False - False - - - - - 0 - 1 - 0 - 1 - fill - fill - - - - - 0 - True - True - - - - - - - - Palette Viewer - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - DeSmuME.xpm - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - True - - - - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - -7 - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - 2 - 3 - False - 0 - 0 - - - - True - - False - True - - - - 0 - 1 - 0 - 1 - fill - - - - - - True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 0 0 15 1 2 1 - - - - 2 - 3 - 0 - 1 - fill - - - - - - - True - Palette : - False - False - GTK_JUSTIFY_RIGHT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 0 - 1 - fill - - - - - - - 256 - 256 - True - - - - 0 - 3 - 1 - 2 - - - - - - - 0 - True - True - - - - - - + + + + False + False + 3 + + + + + True + 0.000000 + GoTo: + GTK_JUSTIFY_RIGHT + + + False + 4 + + + + + True + True + 10 + ● + 0x00000000 + + + + + False + 5 + + + + + True + True + Go! + True + + + + False + False + 6 + + + + + GTK_FILL + GTK_FILL + + + + + True + GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + + + 1 + 2 + + + + + True + 0 0 0 0 0 0 + + + + 1 + 2 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + 2 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-close + True + -7 + + + + + False + GTK_PACK_END + + + + + + + Palette Viewer + DeSmuME.xpm + GDK_WINDOW_TYPE_HINT_DIALOG + + + + + + True + + + True + 2 + 3 + + + 256 + 256 + True + + + + 3 + 1 + 2 + + + + + + + True + 0.000000 + Palette : + GTK_JUSTIFY_RIGHT + + + 1 + 2 + GTK_FILL + + + + + + True + True + 0 0 15 1 2 1 + 1 + + + + 2 + 3 + GTK_FILL + + + + + + True + + + + + GTK_FILL + + + + + 2 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-close + True + -7 + + + + + False + GTK_PACK_END + + + + + + + Tile viewer + False + GDK_WINDOW_TYPE_HINT_DIALOG + + + + + + True + + + True + 3 + 4 + + + + + + + + + True + + + + + 1 + 2 + GTK_FILL + + + + + True + True + BMP + True + True + True + wtools_4_r16 + + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + + True + True + 256c + True + True + True + wtools_4_r16 + + + + 2 + 3 + 1 + 2 + GTK_FILL + + + + + + True + True + 16c + True + True + True + + + + 3 + 4 + 1 + 2 + GTK_FILL + + + + + + True + 0.000000 + Palette : + GTK_JUSTIFY_RIGHT + + + 2 + 3 + GTK_FILL + + + + + + True + True + 0 0 15 1 2 1 + 1 + + + + 3 + 4 + + + + + + 256 + 256 + GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK + + + + 3 + 2 + 3 + + + + + + + True + + + + + GTK_FILL + + + + + 2 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-close + True + -7 + + + + + False + GTK_PACK_END + + + + + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/glade/DeSmuMe.glade /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/glade/DeSmuMe.glade --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/glade/DeSmuMe.glade 2007-02-01 06:43:02.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/glade/DeSmuMe.glade 2007-07-18 08:09:47.000000000 -0500 @@ -6,9 +6,9 @@ True GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK - DeSmuMe + DeSmuME GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER_ON_PARENT + GTK_WIN_POS_CENTER False False False @@ -102,7 +102,7 @@ True State 1 True - + @@ -112,7 +112,7 @@ True State 2 True - + @@ -122,7 +122,7 @@ True State 3 True - + @@ -132,7 +132,7 @@ True State 4 True - + @@ -142,7 +142,7 @@ True State 5 True - + @@ -152,7 +152,7 @@ True State 6 True - + @@ -162,7 +162,7 @@ True State 7 True - + @@ -172,7 +172,7 @@ True State 8 True - + @@ -182,7 +182,7 @@ True State 9 True - + @@ -192,7 +192,7 @@ True State 10 True - + @@ -215,7 +215,7 @@ True State 1 True - + @@ -225,7 +225,7 @@ True State 2 True - + @@ -235,7 +235,7 @@ True State 3 True - + @@ -245,7 +245,7 @@ True State 4 True - + @@ -255,7 +255,7 @@ True State 5 True - + @@ -265,7 +265,7 @@ True State 6 True - + @@ -275,7 +275,7 @@ True State 7 True - + @@ -285,7 +285,7 @@ True State 8 True - + @@ -295,7 +295,7 @@ True State 9 True - + @@ -305,7 +305,7 @@ True State 10 True - + @@ -326,61 +326,64 @@ TYPE: Auto (1B) True True - + + True - TYPE: EEPROM1 (4KB) + TYPE: EEPROM1 (4kB) True False savetype1 - + + True - TYPE: EEPROM2 (64KB) + TYPE: EEPROM2 (64kB) True False savetype1 - + + True - TYPE: EEPROM2 (512KB) + TYPE: EEPROM2 (512kB) True False savetype1 - + + True - TYPE: FLASH (256KB) + TYPE: FLASH (256kB) True - savetype1 False - + savetype1 + + True TYPE: FRAM (2MB) True - savetype1 False - + savetype1 + - - @@ -462,7 +465,7 @@ 0 True True - + @@ -473,7 +476,7 @@ True False fs0 - + @@ -484,7 +487,7 @@ True False fs0 - + @@ -495,7 +498,7 @@ True False fs0 - + @@ -506,7 +509,7 @@ True False fs0 - + @@ -517,7 +520,7 @@ True False fs0 - + @@ -528,7 +531,7 @@ True False fs0 - + @@ -539,7 +542,7 @@ True False fs0 - + @@ -550,7 +553,7 @@ True False fs0 - + @@ -561,7 +564,7 @@ True False fs0 - + @@ -584,7 +587,7 @@ 1x True True - + @@ -595,7 +598,7 @@ True False size1x - + @@ -606,7 +609,7 @@ True False size1x - + @@ -700,12 +703,45 @@ - + + True + Rotate Screen 0 + True + True + + + + + + True - Rotate Screen + Rotate Screen 90 True False - + menu_rotatescreen0 + + + + + + + True + Rotate Screen 180 + True + False + menu_rotatescreen0 + + + + + + + True + Rotate Screen 270 + True + False + menu_rotatescreen0 + @@ -784,6 +820,27 @@ + + + + True + View Tiles + True + + + + + True + gtk-properties + 1 + 0.5 + 0.5 + 0 + 0 + + + + @@ -820,7 +877,6 @@ - True GTK_ORIENTATION_HORIZONTAL GTK_TOOLBAR_BOTH True @@ -925,122 +981,96 @@ - + True + 3 + 5 False - 0 + 0 + 0 - + + 256 + 192 + GDK_EXPOSURE_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK + + + + + + + + + 1 + 2 + 0 + 1 + + + + + + + + 256 + 192 + GDK_EXPOSURE_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK + + + + + + + + + 1 + 2 + 2 + 3 + + + + + + + True False 0 - + True - False - 0 - - - - True - True - BG0 - True - GTK_RELIEF_NORMAL - True - True - False - True - - - - 0 - False - False - - - - - - True - True - BG1 - True - GTK_RELIEF_NORMAL - True - True - False - True - - - - 0 - False - False - - - - - - True - True - BG2 - True - GTK_RELIEF_NORMAL - True - True - False - True - - - - 0 - False - False - - - - - - True - True - BG3 - True - GTK_RELIEF_NORMAL - True - True - False - True - - - - 0 - False - False - - + True + BG0 + True + GTK_RELIEF_NORMAL + True + True + False + True + + + + 0 + False + False + + - - - True - True - OBJ - True - GTK_RELIEF_NORMAL - True - True - False - True - - - - 0 - False - False - - + + + True + True + BG1 + True + GTK_RELIEF_NORMAL + True + True + False + True + 0 @@ -1050,13 +1080,17 @@ - - 256 - 192 + True - GDK_EXPOSURE_MASK - - + True + BG2 + True + GTK_RELIEF_NORMAL + True + True + False + True + 0 @@ -1066,8 +1100,17 @@ - + True + True + BG3 + True + GTK_RELIEF_NORMAL + True + True + False + True + 0 @@ -1075,136 +1118,115 @@ False - - - 0 - True - True - - - - - True + + + True + True + OBJ + True + GTK_RELIEF_NORMAL + True + True + False + True + + + + 0 + False + False + + - 0 - False - False + 0 + 1 + 2 + 3 + + - + True False 0 - + True - False - 0 - - - - True - True - BG0 - True - GTK_RELIEF_NORMAL - True - True - False - True - - - - 0 - False - False - - - - - - True - True - BG1 - True - GTK_RELIEF_NORMAL - True - True - False - True - - - - 0 - False - False - - + True + BG0 + True + GTK_RELIEF_NORMAL + True + True + False + True + + + + 0 + False + False + + - - - True - True - BG2 - True - GTK_RELIEF_NORMAL - True - True - False - True - - - - 0 - False - False - - + + + True + True + BG1 + True + GTK_RELIEF_NORMAL + True + True + False + True + + + + 0 + False + False + + - - - True - True - BG3 - True - GTK_RELIEF_NORMAL - True - True - False - True - - - - 0 - False - False - - + + + True + True + BG2 + True + GTK_RELIEF_NORMAL + True + True + False + True + + + + 0 + False + False + + - - - True - True - OBJ - True - GTK_RELIEF_NORMAL - True - True - False - True - - - - 0 - False - False - - + + + True + True + BG3 + True + GTK_RELIEF_NORMAL + True + True + False + True + 0 @@ -1214,16 +1236,17 @@ - - 256 - 192 + True - GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - - - + True + OBJ + True + GTK_RELIEF_NORMAL + True + True + False + True + 0 @@ -1233,9 +1256,40 @@ - 0 - False - False + 0 + 1 + 0 + 1 + + + + + + + + True + + + 2 + 3 + 0 + 1 + + fill + + + + + + True + + + 1 + 2 + 1 + 2 + fill + @@ -1268,13 +1322,35 @@ False http://desmume.sf.net http://desmume.sf.net - + Original author: + yopyop (now inactive) + +Current team: + Allustar + amponzi + ape + delfare + Guillaume Duhamel + Normmatt + Romain Vallet + shash + Theo Berkau + thoduv + Tim Seidel (Mighty Max) + Damien Nozay (damdoum) + Pascal Giard (evilynux) + +Contributors: + Anthony Molinaro translator-credits DeSmuME.xpm + + + - Keyboad Config + Keyboard Config GTK_WINDOW_TOPLEVEL GTK_WIN_POS_CENTER_ON_PARENT False @@ -1354,7 +1430,7 @@ True GTK_RELIEF_NORMAL True - + 0 @@ -1374,7 +1450,7 @@ True GTK_RELIEF_NORMAL True - + 1 @@ -1394,7 +1470,7 @@ True GTK_RELIEF_NORMAL True - + 2 @@ -1414,7 +1490,7 @@ True GTK_RELIEF_NORMAL True - + 4 @@ -1434,7 +1510,7 @@ True GTK_RELIEF_NORMAL True - + 5 @@ -1454,7 +1530,7 @@ True GTK_RELIEF_NORMAL True - + 6 @@ -1474,7 +1550,7 @@ True GTK_RELIEF_NORMAL True - + 1 @@ -1494,7 +1570,7 @@ True GTK_RELIEF_NORMAL True - + 5 @@ -1514,7 +1590,7 @@ True GTK_RELIEF_NORMAL True - + 3 @@ -1534,7 +1610,7 @@ True GTK_RELIEF_NORMAL True - + 0 @@ -1554,7 +1630,7 @@ True GTK_RELIEF_NORMAL True - + 5 @@ -1574,7 +1650,7 @@ True GTK_RELIEF_NORMAL True - + 2 @@ -1594,7 +1670,7 @@ True GTK_RELIEF_NORMAL True - + 3 @@ -1614,7 +1690,7 @@ True GTK_RELIEF_NORMAL True - + 4 @@ -1830,7 +1906,7 @@ True GTK_RELIEF_NORMAL True - + 4 @@ -1850,7 +1926,7 @@ True GTK_RELIEF_NORMAL True - + 5 @@ -1870,7 +1946,7 @@ True GTK_RELIEF_NORMAL True - + 6 @@ -1890,7 +1966,7 @@ True GTK_RELIEF_NORMAL True - + 5 @@ -1910,7 +1986,7 @@ True GTK_RELIEF_NORMAL True - + 3 @@ -1930,7 +2006,7 @@ True GTK_RELIEF_NORMAL True - + 0 @@ -1950,7 +2026,7 @@ True GTK_RELIEF_NORMAL True - + 5 @@ -1970,7 +2046,7 @@ True GTK_RELIEF_NORMAL True - + 2 @@ -1990,7 +2066,7 @@ True GTK_RELIEF_NORMAL True - + 3 @@ -2010,7 +2086,7 @@ True GTK_RELIEF_NORMAL True - + 4 @@ -2030,7 +2106,7 @@ True GTK_RELIEF_NORMAL True - + 1 @@ -2050,7 +2126,7 @@ True GTK_RELIEF_NORMAL True - + 1 @@ -2070,7 +2146,7 @@ True GTK_RELIEF_NORMAL True - + 0 @@ -2090,7 +2166,7 @@ True GTK_RELIEF_NORMAL True - + 2 @@ -2177,4 +2253,84 @@ + + 3D rom + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER + True + False + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + True + + + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 250 + 20 + True + 3D operation detected + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 10 + True + True + + + + + + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/glade-xml.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/glade-xml.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/glade-xml.c 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/glade-xml.c 2007-07-15 16:50:30.000000000 -0500 @@ -0,0 +1,254 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + + * libglade - a library for building interfaces from XML files at runtime + + * Copyright (C) 1998-2002 James Henstridge + + * + + * glade-xml.c: implementation of core public interface functions + + * + + * This library is free software; you can redistribute it and/or + + * modify it under the terms of the GNU Library General Public + + * License as published by the Free Software Foundation; either + + * version 2 of the License, or (at your option) any later version. + + * + + * This library 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 + + * Library General Public License for more details. + + * + + * You should have received a copy of the GNU Library General Public + + * License along with this library; if not, write to the + + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + + * Boston, MA 02111-1307, USA. + + */ + + + +#include "globals.h" + +#include + +#include + +#include + +#include + + + +typedef struct _GladeXMLPrivate nopriv_GladeXMLPrivate; + +struct _GladeXMLPrivate { + + GladeInterface *tree; /* the tree for this GladeXML */ + + GtkTooltips *tooltips; /* if not NULL, holds all tooltip info */ + + GHashTable *name_hash; + + GHashTable *signals; + + GtkWindow *toplevel; + + GtkAccelGroup *accel_group; + + GtkWidget *focus_widget; + + GtkWidget *default_widget; + + GList *deferred_props; + +}; + + + +typedef struct _GladeSignalData GladeSignalData; + +struct _GladeSignalData { + + GObject *signal_object; + + char *signal_name; + + char *connect_object; /* or NULL if there is none */ + + gboolean signal_after; + +}; + + + +static void + +autoconnect_foreach_StringObject(const char *signal_handler, GList *signals, + + GModule *allsymbols) + +{ + + GCallback func; + + + + if (!g_module_symbol(allsymbols, signal_handler, (gpointer)&func)) + + g_warning(_("could not find signal handler '%s'."), signal_handler); + + else + + for (; signals != NULL; signals = signals->next) { + + GladeSignalData *data = signals->data; + + if (data->connect_object) { + + GladeXML *self = glade_get_widget_tree( + + GTK_WIDGET(data->signal_object)); + + char format[]="%_\0\0"; + + if (sscanf(data->connect_object,"%%%c:", &format[1])) { + + // this should solve 64bit problems but now memory gets + + // (it should get) deallocated when program is destroyed + + gpointer argument = g_malloc(sizeof(callback_arg)); + + sscanf(data->connect_object+3,format, argument); + + + +// printf ("%f \n",obj); + + if (data->signal_after) + + g_signal_connect_after(data->signal_object, data->signal_name, + + func, argument); + + else + + g_signal_connect(data->signal_object, data->signal_name, + + func, argument); + + + + } else { + + GObject *other = g_hash_table_lookup(self->priv->name_hash, + + data->connect_object); + + g_signal_connect_object(data->signal_object, data->signal_name, + + func, other, (data->signal_after ? G_CONNECT_AFTER : 0) + + | G_CONNECT_SWAPPED); + + } + + } else { + + /* the signal_data argument is just a string, but may + + * be helpful for someone */ + + if (data->signal_after) + + g_signal_connect_after(data->signal_object, + + data->signal_name, func, NULL); + + else + + g_signal_connect(data->signal_object, data->signal_name, + + func, NULL); + + } + + } + +} + + + +/** + + * glade_xml_signal_autoconnect_StringObject: + + * @self: the GladeXML object. + + * + + * This function is a variation of glade_xml_signal_connect. It uses + + * gmodule's introspective features (by openning the module %NULL) to + + * look at the application's symbol table. From here it tries to match + + * the signal handler names given in the interface description with + + * symbols in the application and connects the signals. + + * + + * Note that this function will not work correctly if gmodule is not + + * supported on the platform. + + */ + +void + +glade_xml_signal_autoconnect_StringObject (GladeXML *self) + +{ + + GModule *allsymbols; + + nopriv_GladeXMLPrivate * priv; + + + + g_return_if_fail(self != NULL); + + if (!g_module_supported()) + + g_error("glade_xml_signal_autoconnect requires working gmodule"); + + + + /* get a handle on the main executable -- use this to find symbols */ + + allsymbols = g_module_open(NULL, 0); + + priv = (nopriv_GladeXMLPrivate *)self->priv; + + g_hash_table_foreach(priv->signals, (GHFunc)autoconnect_foreach_StringObject, + + allsymbols); + +} + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/globals.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/globals.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/globals.h 2007-02-02 00:35:30.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/globals.h 2007-07-15 16:50:30.000000000 -0500 @@ -32,10 +32,58 @@ //#include #include -#include +// Localization +#include +#define _(String) gettext (String) + +//#include +// more portable +#include "SDL.h" + +// fix gtk-glade on windows with no configure +#ifndef DATADIR +#define DATADIR " " +#endif +#ifndef GLADEUI_UNINSTALLED_DIR +#define GLADEUI_UNINSTALLED_DIR "glade/" +#endif + #include #include #include +#include + + +typedef union _callback_arg{ + gpointer my_pointer; + gconstpointer my_constpointer; + + gfloat my_float; + gdouble my_double; + gsize my_size; + gssize my_ssize; + + gboolean my_boolean; + + guchar my_uchar; + guint my_uint; + guint8 my_uint8; + guint16 my_uint16; + guint32 my_uint32; + guint64 my_uint64; + gushort my_ushort; + gulong my_ulong; + + gchar my_char; + gint my_int; + gint8 my_int8; + gint16 my_int16; + gint32 my_int32; + gint64 my_int64; + gshort my_short; + glong my_long; +} callback_arg; +#define dyn_CAST(gtype,var) (((callback_arg*)var)->my_##gtype) #include "../MMU.h" #include "../registers.h" @@ -46,30 +94,43 @@ #include "../ctrlssdl.h" #include "../types.h" #include "../saves.h" +#include "../gl_vertex.h" +#include "../render3D.h" #include "desmume.h" +#include "gdk_gl.h" + +// autoconnect with strings as user_data + +void +glade_xml_signal_autoconnect_StringObject (GladeXML *self); + +//--- int Frameskip; u16 Keypad_Temp[NB_KEYS]; /* main.c */ GtkWidget * pWindow; -GtkWidget * pDrawingArea; -GtkWidget * pDrawingArea2; +GtkWidget * pDrawingArea, * pDrawingArea2; GladeXML * xml, * xml_tools; typedef void (*VoidFunPtr)(); void notify_Tools(); void register_Tool(VoidFunPtr fun); void unregister_Tool(VoidFunPtr fun); +gchar * get_ui_file (const char *filename); /* callbacks.c */ void enable_rom_features(); +void resize (float Size1, float Size2); +void rotate(float angle); +gboolean ScreenInvert; +gboolean ScreenGap; +gboolean ScreenRight; /* callbacks_IO.c */ -int ScreenCoeff_Size; -gboolean ScreenRotate; -gboolean ScreenRight; -gboolean ScreenGap; +float ScreenCoeff_Size[2]; +float ScreenRotate; void black_screen (); void edit_controls(); diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/main.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/main.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/main.c 2007-02-01 06:43:02.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/main.c 2007-07-17 19:12:38.000000000 -0500 @@ -24,10 +24,23 @@ #include "callbacks_IO.h" #include "dTools/callbacks_dtools.h" #include "globals.h" +#include "../gdbstub.h" + +#ifdef GTKGLEXT_AVAILABLE +#include +#include "../opengl_collector_3Demu.h" +#include "gdk_3Demu.h" +#endif + +/* + * The frame limiter semaphore + */ +SDL_sem *glade_fps_limiter_semaphore; +int glade_fps_limiter_disabled = 0; + GtkWidget * pWindow; -GtkWidget * pDrawingArea; -GtkWidget * pDrawingArea2; +GtkWidget * pDrawingArea, * pDrawingArea2; GladeXML * xml, * xml_tools; SoundInterface_struct *SNDCoreList[] = { @@ -37,6 +50,160 @@ NULL }; +GPU3DInterface *core3DList[] = { +&gpu3DNull +#ifdef GTKGLEXT_AVAILABLE + , + &gpu3D_opengl_collector +#endif +}; + + +/* + * + * Command line handling + * + */ +struct configured_features { + int software_colour_convert; + int disable_3d; + int disable_limiter; + + u16 arm9_gdb_port; + u16 arm7_gdb_port; + + int firmware_language; + + const char *nds_file; +}; + +static void +init_configured_features( struct configured_features *config) { + config->arm9_gdb_port = 0; + config->arm7_gdb_port = 0; + + config->software_colour_convert = 0; + + config->disable_3d = 0; + + config->disable_limiter = 0; + + config->nds_file = NULL; + + /* use the default language */ + config->firmware_language = -1; +} + +static int +fill_configured_features( struct configured_features *config, + int argc, char ** argv) { + int good_args = 1; + int print_usage = 0; + int i; + + for ( i = 1; i < argc && good_args; i++) { + if ( strcmp( argv[i], "--help") == 0) { + g_print( _("USAGE: %s [OPTIONS] [nds-file]\n"), argv[0]); + g_print( _("OPTIONS:\n")); +#ifdef GTKGLEXT_AVAILABLE + g_print( _("\ + --soft-convert Use software colour conversion during OpenGL\n\ + screen rendering. May produce better or worse\n\ + frame rates depending on hardware.\n\ + \n\ + --disable-3d Disables the 3D emulation\n\n")); +#endif + g_print( _("\ + --disable-limiter Disables the 60 fps limiter\n\ + \n\ + --fwlang=LANG Set the language in the firmware, LANG as follows:\n\ + 0 = Japanese\n\ + 1 = English\n\ + 2 = French\n\ + 3 = German\n\ + 4 = Italian\n\ + 5 = Spanish\n\n\ + --arm9gdb=PORT_NUM Enable the ARM9 GDB stub on the given port\n\ + --arm7gdb=PORT_NUM Enable the ARM7 GDB stub on the given port\n\ + \n\ + --help Display this message\n")); + //g_print(" --sticky Enable sticky keys and stylus\n"); + good_args = 0; + } +#ifdef GTKGLEXT_AVAILABLE + else if ( strcmp( argv[i], "--soft-convert") == 0) { + config->software_colour_convert = 1; + } + else if ( strcmp( argv[i], "--disable-3d") == 0) { + config->disable_3d = 1; + } +#endif + else if ( strncmp( argv[i], "--fwlang=", 9) == 0) { + char *end_char; + int lang = strtoul( &argv[i][9], &end_char, 10); + + if ( lang >= 0 && lang <= 5) { + config->firmware_language = lang; + } + else { + g_print( stderr, _("Firmware language must be set to a value from 0 to 5.\n")); + good_args = 0; + } + } + else if ( strncmp( argv[i], "--arm9gdb=", 10) == 0) { + char *end_char; + unsigned long port_num = strtoul( &argv[i][10], &end_char, 10); + + if ( port_num > 0 && port_num < 65536) { + config->arm9_gdb_port = port_num; + } + else { + g_print( _("ARM9 GDB stub port must be in the range 1 to 65535\n")); + good_args = 0; + } + } + else if ( strncmp( argv[i], "--arm7gdb=", 10) == 0) { + char *end_char; + unsigned long port_num = strtoul( &argv[i][10], &end_char, 10); + + if ( port_num > 0 && port_num < 65536) { + config->arm7_gdb_port = port_num; + } + else { + g_print( _("ARM7 GDB stub port must be in the range 1 to 65535\n")); + good_args = 0; + } + } + else if ( strcmp( argv[i], "--disable-limiter") == 0) { + config->disable_limiter = 1; + } + else { + if ( config->nds_file == NULL) { + config->nds_file = argv[i]; + } + else { + g_print( _("NDS file (\"%s\") already set\n"), config->nds_file); + good_args = 0; + } + } + } + + if ( good_args) { + /* + * check if the configured features are consistant + */ + } + + if ( print_usage) { + g_print( _("USAGE: %s [options] [nds-file]\n"), argv[0]); + g_print( _("USAGE: %s --help - for help\n"), argv[0]); + } + + return good_args; +} + + + /* ***** ***** TOOLS ***** ***** */ GList * tools_to_update = NULL; @@ -55,9 +222,28 @@ } void notify_Tools() { - g_list_foreach(tools_to_update, ¬ify_Tool, NULL); + g_list_foreach(tools_to_update, (GFunc)notify_Tool, NULL); } +/* Return the glade directory. + Note: See configure.ac for the value of GLADEUI_UNINSTALLED_DIR. */ +gchar * get_ui_file (const char *filename) +{ + char *path; + + /* looking in uninstalled (aka building) dir first */ + path = g_build_filename (GLADEUI_UNINSTALLED_DIR, filename, NULL); + if (g_file_test (path, G_FILE_TEST_IS_REGULAR)) return path; + g_free (path); + + /* looking in installed dir */ + path = g_build_filename (DATADIR, filename, NULL); + if (g_file_test (path, G_FILE_TEST_IS_REGULAR)) return path; + g_free (path); + + /* not found */ + return NULL; +} /* ***** ***** CONFIG FILE ***** ***** */ @@ -131,7 +317,7 @@ if ( GTK_BIN(w)->child ) { - child = GTK_BIN(w)->child; + child = (GtkLabel*)GTK_BIN(w)->child; gtk_label_set_text(child, text); } } @@ -143,7 +329,7 @@ char text[40]; sprintf( cb, "%s%d", cb_name, num); - sprintf( text, "State %d (empty)", num); + sprintf( text, _("State %d (empty)"), num); w = glade_xml_get_widget(xml, cb); set_menuitem_label( w, text ); } @@ -188,35 +374,132 @@ desmume_resume(); } -/* ***** ***** MAIN ***** ***** */ +/* + * The thread handling functions needed by the GDB stub code. + */ +void * +createThread_gdb( void (*thread_function)( void *data), + void *thread_data) { + GThread *new_thread = g_thread_create( (GThreadFunc)thread_function, + thread_data, + TRUE, + NULL); + + return new_thread; +} + +void +joinThread_gdb( void *thread_handle) { + g_thread_join( thread_handle); +} -#ifdef WIN32 -int WinMain () -{ - main(0,NULL); + + +/** + * A SDL timer callback function. Signals the supplied SDL semaphore + * if its value is small. + * + * @param interval The interval since the last call (in ms) + * @param param The pointer to the semaphore. + * + * @return The interval to the next call (required by SDL) + */ +static Uint32 +glade_fps_limiter_fn( Uint32 interval, void *param) { + SDL_sem *sdl_semaphore = (SDL_sem *)param; + + /* signal the semaphore if it is getting low */ + if ( SDL_SemValue( sdl_semaphore) < 4) { + SDL_SemPost( sdl_semaphore); + } + + return interval; } -#endif -int main(int argc, char *argv[]) { - - const char *commandLine_File = NULL; +/* ***** ***** MAIN ***** ***** */ + +static int +common_gtk_glade_main( struct configured_features *my_config) { + SDL_TimerID limiter_timer; + gdbstub_handle_t arm9_gdb_stub; + gdbstub_handle_t arm7_gdb_stub; + struct armcpu_memory_iface *arm9_memio = &arm9_base_memory_iface; + struct armcpu_memory_iface *arm7_memio = &arm7_base_memory_iface; + struct armcpu_ctrl_iface *arm9_ctrl_iface; + struct armcpu_ctrl_iface *arm7_ctrl_iface; + /* the firmware settings */ + struct NDS_fw_config_data fw_config; + + /* default the firmware settings, they may get changed later */ + NDS_FillDefaultFirmwareConfigData( &fw_config); + + /* use any language set on the command line */ + if ( my_config->firmware_language != -1) { + fw_config.language = my_config->firmware_language; + } - if(argc == 2) commandLine_File = argv[1]; +#ifdef GTKGLEXT_AVAILABLE +// check if you have GTHREAD when running configure script + //g_thread_init(NULL); + register_gl_fun(my_gl_Begin,my_gl_End); +#endif #ifdef DEBUG LogStart(); #endif init_keyvals(); - - gtk_init(&argc, &argv); - if(SDL_Init(SDL_INIT_VIDEO) == -1) + + if ( my_config->arm9_gdb_port != 0) { + arm9_gdb_stub = createStub_gdb( my_config->arm9_gdb_port, + &arm9_memio, + &arm9_base_memory_iface); + + if ( arm9_gdb_stub == NULL) { + g_print( _("Failed to create ARM9 gdbstub on port %d\n"), + my_config->arm9_gdb_port); + return -1; + } + } + if ( my_config->arm7_gdb_port != 0) { + arm7_gdb_stub = createStub_gdb( my_config->arm7_gdb_port, + &arm7_memio, + &arm7_base_memory_iface); + + if ( arm7_gdb_stub == NULL) { + g_print( _("Failed to create ARM7 gdbstub on port %d\n"), + my_config->arm7_gdb_port); + return -1; + } + } + + + if(SDL_Init( SDL_INIT_TIMER | SDL_INIT_VIDEO) == -1) { - fprintf(stderr, "Error trying to initialize SDL: %s\n", + fprintf(stderr, _("Error trying to initialize SDL: %s\n"), SDL_GetError()); return 1; } - desmume_init(); + + desmume_init( arm9_memio, &arm9_ctrl_iface, + arm7_memio, &arm7_ctrl_iface); + + + /* Create the dummy firmware */ + NDS_CreateDummyFirmware( &fw_config); + + /* + * Activate the GDB stubs + * This has to come after the NDS_Init (called in desmume_init) + * where the cpus are set up. + */ + if ( my_config->arm9_gdb_port != 0) { + activateStub_gdb( arm9_gdb_stub, arm9_ctrl_iface); + } + if ( my_config->arm7_gdb_port != 0) { + activateStub_gdb( arm7_gdb_stub, arm7_ctrl_iface); + } + /* Initialize joysticks */ if(!init_joy()) return 1; @@ -224,19 +507,21 @@ Read_ConfigFile(); /* load the interface */ - xml = glade_xml_new("glade/DeSmuMe.glade", NULL, NULL); - xml_tools = glade_xml_new("glade/DeSmuMe_Dtools.glade", NULL, NULL); + xml = glade_xml_new(get_ui_file("DeSmuMe.glade"), NULL, NULL); + xml_tools = glade_xml_new(get_ui_file("DeSmuMe_Dtools.glade"), NULL, NULL); pWindow = glade_xml_get_widget(xml, "wMainW"); pDrawingArea = glade_xml_get_widget(xml, "wDraw_Main"); pDrawingArea2 = glade_xml_get_widget(xml, "wDraw_Sub"); - + /* connect the signals in the interface */ - glade_xml_signal_autoconnect(xml); - glade_xml_signal_autoconnect(xml_tools); + glade_xml_signal_autoconnect_StringObject(xml); + glade_xml_signal_autoconnect_StringObject(xml_tools); + + init_GL_capabilities( my_config->software_colour_convert); - /* Vérifie la ligne de commandes */ - if(commandLine_File) { - if(desmume_open(commandLine_File) >= 0) { + /* check command line file */ + if( my_config->nds_file) { + if(desmume_open( my_config->nds_file) >= 0) { desmume_resume(); enable_rom_features(); } else { @@ -244,16 +529,75 @@ GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, - "Unable to load :\n%s", commandLine_File); + _("Unable to load :\n%s"), my_config->nds_file); gtk_dialog_run(GTK_DIALOG(pDialog)); gtk_widget_destroy(pDialog); } } + gtk_widget_show(pDrawingArea); + gtk_widget_show(pDrawingArea2); + + { + int use_null_3d = my_config->disable_3d; + +#ifdef GTKGLEXT_AVAILABLE + if ( !use_null_3d) { + /* setup the gdk 3D emulation */ + if ( init_opengl_gdk_3Demu()) { + NDS_3D_SetDriver(1); + + if (!gpu3D->NDS_3D_Init()) { + fprintf( stderr, _("Failed to initialise openGL 3D emulation; " + "removing 3D support\n")); + use_null_3d = 1; + } + } + else { + fprintf( stderr, _("Failed to setup openGL 3D emulation; " + "removing 3D support\n")); + use_null_3d = 1; + } + } +#endif + if ( use_null_3d) { + NDS_3D_SetDriver ( 0); + gpu3D->NDS_3D_Init(); + } + } + +// on_menu_tileview_activate(NULL,NULL); + + /* setup the frame limiter and indicate if it is disabled */ + glade_fps_limiter_disabled = my_config->disable_limiter; + + if ( !glade_fps_limiter_disabled) { + /* create the semaphore used for fps limiting */ + glade_fps_limiter_semaphore = SDL_CreateSemaphore( 1); + + /* start a SDL timer for every FPS_LIMITER_FRAME_PERIOD + * frames to keep us at 60 fps */ + limiter_timer = SDL_AddTimer( 16 * FPS_LIMITER_FRAME_PERIOD, + glade_fps_limiter_fn, + glade_fps_limiter_semaphore); + if ( limiter_timer == NULL) { + fprintf( stderr, _("Error trying to start FPS limiter timer: %s\n"), + SDL_GetError()); + SDL_DestroySemaphore( glade_fps_limiter_semaphore); + glade_fps_limiter_disabled = 1; + } + } + /* start event loop */ gtk_main(); desmume_free(); + if ( !glade_fps_limiter_disabled) { + /* tidy up the FPS limiter timer and semaphore */ + SDL_RemoveTimer( limiter_timer); + SDL_DestroySemaphore( glade_fps_limiter_semaphore); + } + #ifdef DEBUG LogStop(); #endif @@ -265,3 +609,48 @@ return EXIT_SUCCESS; } +int main(int argc, char *argv[]) { + struct configured_features my_config; + + // Localization + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + + init_configured_features( &my_config); + + if (!g_thread_supported()) + g_thread_init( NULL); + + gtk_init(&argc, &argv); + +#ifdef GTKGLEXT_AVAILABLE + gtk_gl_init( &argc, &argv); +#endif + + if ( !fill_configured_features( &my_config, argc, argv)) { + exit(0); + } + + return common_gtk_glade_main( &my_config); +} + + +#ifdef WIN32 +int WinMain ( HINSTANCE hThisInstance, HINSTANCE hPrevInstance, + LPSTR lpszArgument, int nFunsterStil) +{ + int argc = 0; + char *argv[] = NULL; + + /* + * FIXME: + * Emulate the argc and argv main parameters. Could do this using + * CommandLineToArgvW and then convert the wide chars to thin chars. + * Or parse the wide chars directly and call common_gtk_glade_main with a + * filled configuration structure. + */ + main( argc, argv); +} +#endif + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/Makefile.am /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/Makefile.am --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/Makefile.am 2007-02-04 15:35:50.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/Makefile.am 2007-07-16 21:54:52.000000000 -0500 @@ -1,12 +1,32 @@ -EXTRA_DIST = DeSmuME.dev glade/DeSmuMe_Dtools.glade glade/DeSmuMe.glade glade/DeSmuME.xpm +include $(top_srcdir)/src/desmume.mk + +AM_CPPFLAGS += $(SDL_CFLAGS) $(GTKGLEXT_CFLAGS) $(LIBGLADE_CFLAGS) \ + $(GTHREAD_CFLAGS) -DDATADIR=\"$(gladedir)/\" \ + -DLOCALEDIR=\"$(localedir)\" +AM_LDFLAGS += -rdynamic $(INTLLIBS) + +EXTRA_DIST = DeSmuME.dev $(glade_DATA) + +Applicationsdir = $(datadir)/applications +Applications_DATA = desmume-glade.desktop +pixmapdir = $(datadir)/pixmaps +pixmap_DATA = glade/DeSmuME.xpm +gladedir = $(datadir)/desmume/glade +glade_DATA = glade/DeSmuMe_Dtools.glade glade/DeSmuMe.glade glade/DeSmuME.xpm + bin_PROGRAMS = desmume-glade desmume_glade_SOURCES = \ - callbacks.c callbacks.h callbacks_IO.c callbacks_IO.h desmume.c desmume.h \ - globals.h keyval_names.c main.c printscreen.c \ + globals.h glade-xml.c \ + callbacks.c callbacks.h callbacks_IO.c callbacks_IO.h \ + desmume.c desmume.h \ + keyval_names.c main.c printscreen.c gdk_gl.c gdk_gl.h \ dTools/callbacks_1_ioregs.c dTools/callbacks_2_memview.c \ - dTools/callbacks_3_palview.c dTools/callbacks_dtools.h \ + dTools/callbacks_3_palview.c dTools/callbacks_4_tileview.c \ + dTools/callbacks_dtools.h \ dTools/dTools_display.h \ + gdk_3Demu.c gdk_3Demu.h \ ../sndsdl.h ../sndsdl.c ../ctrlssdl.h ../ctrlssdl.c -desmume_glade_LDADD = ../libdesmume.a $(SDL_LIBS) $(LIBGLADE_LIBS) -desmume_glade_CFLAGS = $(SDL_CFLAGS) $(LIBGLADE_CFLAGS) -desmume_glade_LDFLAGS = -rdynamic + +desmume_glade_LDADD = ../libdesmume.a ../gdbstub/libgdbstub.a \ + $(SDL_LIBS) $(GTKGLEXT_LIBS) $(LIBGLADE_LIBS) \ + $(GTHREAD_LIBS) diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/Makefile.in /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/Makefile.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/gtk-glade/Makefile.in 2007-02-04 15:35:50.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/gtk-glade/Makefile.in 2007-09-03 12:31:41.000000000 -0500 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,15 +14,12 @@ @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -37,34 +34,34 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/desmume-glade.desktop.in \ + $(top_srcdir)/src/desmume.mk bin_PROGRAMS = desmume-glade$(EXEEXT) subdir = src/gtk-glade -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = desmume-glade.desktop +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(Applicationsdir)" \ + "$(DESTDIR)$(gladedir)" "$(DESTDIR)$(pixmapdir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) -am_desmume_glade_OBJECTS = desmume_glade-callbacks.$(OBJEXT) \ - desmume_glade-callbacks_IO.$(OBJEXT) \ - desmume_glade-desmume.$(OBJEXT) \ - desmume_glade-keyval_names.$(OBJEXT) \ - desmume_glade-main.$(OBJEXT) \ - desmume_glade-printscreen.$(OBJEXT) \ - desmume_glade-callbacks_1_ioregs.$(OBJEXT) \ - desmume_glade-callbacks_2_memview.$(OBJEXT) \ - desmume_glade-callbacks_3_palview.$(OBJEXT) \ - desmume_glade-sndsdl.$(OBJEXT) \ - desmume_glade-ctrlssdl.$(OBJEXT) +am_desmume_glade_OBJECTS = glade-xml.$(OBJEXT) callbacks.$(OBJEXT) \ + callbacks_IO.$(OBJEXT) desmume.$(OBJEXT) \ + keyval_names.$(OBJEXT) main.$(OBJEXT) printscreen.$(OBJEXT) \ + gdk_gl.$(OBJEXT) callbacks_1_ioregs.$(OBJEXT) \ + callbacks_2_memview.$(OBJEXT) callbacks_3_palview.$(OBJEXT) \ + callbacks_4_tileview.$(OBJEXT) gdk_3Demu.$(OBJEXT) \ + sndsdl.$(OBJEXT) ctrlssdl.$(OBJEXT) desmume_glade_OBJECTS = $(am_desmume_glade_OBJECTS) am__DEPENDENCIES_1 = -desmume_glade_DEPENDENCIES = ../libdesmume.a $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I. -I$(srcdir) +desmume_glade_DEPENDENCIES = ../libdesmume.a ../gdbstub/libgdbstub.a \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -73,26 +70,35 @@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(desmume_glade_SOURCES) DIST_SOURCES = $(desmume_glade_SOURCES) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +ApplicationsDATA_INSTALL = $(INSTALL_DATA) +gladeDATA_INSTALL = $(INSTALL_DATA) +pixmapDATA_INSTALL = $(INSTALL_DATA) +DATA = $(Applications_DATA) $(glade_DATA) $(pixmap_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ +ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ @@ -100,14 +106,48 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLADEUI_UNINSTALLED_DIR = @GLADEUI_UNINSTALLED_DIR@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ GREP = @GREP@ +GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ +GTHREAD_LIBS = @GTHREAD_LIBS@ +GTKGLEXT_CFLAGS = @GTKGLEXT_CFLAGS@ +GTKGLEXT_LIBS = @GTKGLEXT_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ HAVE_PKG = @HAVE_PKG@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ +INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ +INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ +INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ +INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ +INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ +INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ +INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ +INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ +INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ +INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ +INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ +INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ +INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ +INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ LDFLAGS = @LDFLAGS@ LIBGLADE_CFLAGS = @LIBGLADE_CFLAGS@ LIBGLADE_LIBS = @LIBGLADE_LIBS@ @@ -115,9 +155,11 @@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -127,6 +169,13 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_DIR = @PO_DIR@ +PO_FILES = @PO_FILES@ +PO_FILES_IN = @PO_FILES_IN@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RANLIB = @RANLIB@ SDLCONFIG = @SDLCONFIG@ SDL_CFLAGS = @SDL_CFLAGS@ @@ -136,13 +185,14 @@ STRIP = @STRIP@ UI_DIR = @UI_DIR@ USE_MAINTAINER_MODE = @USE_MAINTAINER_MODE@ +USE_NLS = @USE_NLS@ VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -154,6 +204,7 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ desmume_arch = @desmume_arch@ @@ -182,29 +233,48 @@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -EXTRA_DIST = DeSmuME.dev glade/DeSmuMe_Dtools.glade glade/DeSmuMe.glade glade/DeSmuME.xpm +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CFLAGS = +AM_CPPFLAGS = -I$(top_srcdir)/src $(SDL_CFLAGS) $(GTKGLEXT_CFLAGS) \ + $(LIBGLADE_CFLAGS) $(GTHREAD_CFLAGS) \ + -DDATADIR=\"$(gladedir)/\" -DLOCALEDIR=\"$(localedir)\" +AM_LDFLAGS = -rdynamic $(INTLLIBS) +EXTRA_DIST = DeSmuME.dev $(glade_DATA) +Applicationsdir = $(datadir)/applications +Applications_DATA = desmume-glade.desktop +pixmapdir = $(datadir)/pixmaps +pixmap_DATA = glade/DeSmuME.xpm +gladedir = $(datadir)/desmume/glade +glade_DATA = glade/DeSmuMe_Dtools.glade glade/DeSmuMe.glade glade/DeSmuME.xpm desmume_glade_SOURCES = \ - callbacks.c callbacks.h callbacks_IO.c callbacks_IO.h desmume.c desmume.h \ - globals.h keyval_names.c main.c printscreen.c \ + globals.h glade-xml.c \ + callbacks.c callbacks.h callbacks_IO.c callbacks_IO.h \ + desmume.c desmume.h \ + keyval_names.c main.c printscreen.c gdk_gl.c gdk_gl.h \ dTools/callbacks_1_ioregs.c dTools/callbacks_2_memview.c \ - dTools/callbacks_3_palview.c dTools/callbacks_dtools.h \ + dTools/callbacks_3_palview.c dTools/callbacks_4_tileview.c \ + dTools/callbacks_dtools.h \ dTools/dTools_display.h \ + gdk_3Demu.c gdk_3Demu.h \ ../sndsdl.h ../sndsdl.c ../ctrlssdl.h ../ctrlssdl.c -desmume_glade_LDADD = ../libdesmume.a $(SDL_LIBS) $(LIBGLADE_LIBS) -desmume_glade_CFLAGS = $(SDL_CFLAGS) $(LIBGLADE_CFLAGS) -desmume_glade_LDFLAGS = -rdynamic +desmume_glade_LDADD = ../libdesmume.a ../gdbstub/libgdbstub.a \ + $(SDL_LIBS) $(GTKGLEXT_LIBS) $(LIBGLADE_LIBS) \ + $(GTHREAD_LIBS) + all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/src/desmume.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -233,9 +303,11 @@ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +desmume-glade.desktop: $(top_builddir)/config.status $(srcdir)/desmume-glade.desktop.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ @@ -258,7 +330,7 @@ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) desmume-glade$(EXEEXT): $(desmume_glade_OBJECTS) $(desmume_glade_DEPENDENCIES) @rm -f desmume-glade$(EXEEXT) - $(LINK) $(desmume_glade_LDFLAGS) $(desmume_glade_OBJECTS) $(desmume_glade_LDADD) $(LIBS) + $(LINK) $(desmume_glade_OBJECTS) $(desmume_glade_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -266,186 +338,170 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume_glade-callbacks.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume_glade-callbacks_1_ioregs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume_glade-callbacks_2_memview.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume_glade-callbacks_3_palview.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume_glade-callbacks_IO.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume_glade-ctrlssdl.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume_glade-desmume.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume_glade-keyval_names.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume_glade-main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume_glade-printscreen.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume_glade-sndsdl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks_1_ioregs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks_2_memview.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks_3_palview.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks_4_tileview.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks_IO.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctrlssdl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desmume.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdk_3Demu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdk_gl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glade-xml.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keyval_names.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printscreen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndsdl.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -desmume_glade-callbacks.o: callbacks.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-callbacks.o -MD -MP -MF "$(DEPDIR)/desmume_glade-callbacks.Tpo" -c -o desmume_glade-callbacks.o `test -f 'callbacks.c' || echo '$(srcdir)/'`callbacks.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-callbacks.Tpo" "$(DEPDIR)/desmume_glade-callbacks.Po"; else rm -f "$(DEPDIR)/desmume_glade-callbacks.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='callbacks.c' object='desmume_glade-callbacks.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-callbacks.o `test -f 'callbacks.c' || echo '$(srcdir)/'`callbacks.c - -desmume_glade-callbacks.obj: callbacks.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-callbacks.obj -MD -MP -MF "$(DEPDIR)/desmume_glade-callbacks.Tpo" -c -o desmume_glade-callbacks.obj `if test -f 'callbacks.c'; then $(CYGPATH_W) 'callbacks.c'; else $(CYGPATH_W) '$(srcdir)/callbacks.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-callbacks.Tpo" "$(DEPDIR)/desmume_glade-callbacks.Po"; else rm -f "$(DEPDIR)/desmume_glade-callbacks.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='callbacks.c' object='desmume_glade-callbacks.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-callbacks.obj `if test -f 'callbacks.c'; then $(CYGPATH_W) 'callbacks.c'; else $(CYGPATH_W) '$(srcdir)/callbacks.c'; fi` - -desmume_glade-callbacks_IO.o: callbacks_IO.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-callbacks_IO.o -MD -MP -MF "$(DEPDIR)/desmume_glade-callbacks_IO.Tpo" -c -o desmume_glade-callbacks_IO.o `test -f 'callbacks_IO.c' || echo '$(srcdir)/'`callbacks_IO.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-callbacks_IO.Tpo" "$(DEPDIR)/desmume_glade-callbacks_IO.Po"; else rm -f "$(DEPDIR)/desmume_glade-callbacks_IO.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='callbacks_IO.c' object='desmume_glade-callbacks_IO.o' libtool=no @AMDEPBACKSLASH@ +callbacks_1_ioregs.o: dTools/callbacks_1_ioregs.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT callbacks_1_ioregs.o -MD -MP -MF $(DEPDIR)/callbacks_1_ioregs.Tpo -c -o callbacks_1_ioregs.o `test -f 'dTools/callbacks_1_ioregs.c' || echo '$(srcdir)/'`dTools/callbacks_1_ioregs.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/callbacks_1_ioregs.Tpo $(DEPDIR)/callbacks_1_ioregs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dTools/callbacks_1_ioregs.c' object='callbacks_1_ioregs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-callbacks_IO.o `test -f 'callbacks_IO.c' || echo '$(srcdir)/'`callbacks_IO.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o callbacks_1_ioregs.o `test -f 'dTools/callbacks_1_ioregs.c' || echo '$(srcdir)/'`dTools/callbacks_1_ioregs.c -desmume_glade-callbacks_IO.obj: callbacks_IO.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-callbacks_IO.obj -MD -MP -MF "$(DEPDIR)/desmume_glade-callbacks_IO.Tpo" -c -o desmume_glade-callbacks_IO.obj `if test -f 'callbacks_IO.c'; then $(CYGPATH_W) 'callbacks_IO.c'; else $(CYGPATH_W) '$(srcdir)/callbacks_IO.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-callbacks_IO.Tpo" "$(DEPDIR)/desmume_glade-callbacks_IO.Po"; else rm -f "$(DEPDIR)/desmume_glade-callbacks_IO.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='callbacks_IO.c' object='desmume_glade-callbacks_IO.obj' libtool=no @AMDEPBACKSLASH@ +callbacks_1_ioregs.obj: dTools/callbacks_1_ioregs.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT callbacks_1_ioregs.obj -MD -MP -MF $(DEPDIR)/callbacks_1_ioregs.Tpo -c -o callbacks_1_ioregs.obj `if test -f 'dTools/callbacks_1_ioregs.c'; then $(CYGPATH_W) 'dTools/callbacks_1_ioregs.c'; else $(CYGPATH_W) '$(srcdir)/dTools/callbacks_1_ioregs.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/callbacks_1_ioregs.Tpo $(DEPDIR)/callbacks_1_ioregs.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dTools/callbacks_1_ioregs.c' object='callbacks_1_ioregs.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-callbacks_IO.obj `if test -f 'callbacks_IO.c'; then $(CYGPATH_W) 'callbacks_IO.c'; else $(CYGPATH_W) '$(srcdir)/callbacks_IO.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o callbacks_1_ioregs.obj `if test -f 'dTools/callbacks_1_ioregs.c'; then $(CYGPATH_W) 'dTools/callbacks_1_ioregs.c'; else $(CYGPATH_W) '$(srcdir)/dTools/callbacks_1_ioregs.c'; fi` -desmume_glade-desmume.o: desmume.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-desmume.o -MD -MP -MF "$(DEPDIR)/desmume_glade-desmume.Tpo" -c -o desmume_glade-desmume.o `test -f 'desmume.c' || echo '$(srcdir)/'`desmume.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-desmume.Tpo" "$(DEPDIR)/desmume_glade-desmume.Po"; else rm -f "$(DEPDIR)/desmume_glade-desmume.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='desmume.c' object='desmume_glade-desmume.o' libtool=no @AMDEPBACKSLASH@ +callbacks_2_memview.o: dTools/callbacks_2_memview.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT callbacks_2_memview.o -MD -MP -MF $(DEPDIR)/callbacks_2_memview.Tpo -c -o callbacks_2_memview.o `test -f 'dTools/callbacks_2_memview.c' || echo '$(srcdir)/'`dTools/callbacks_2_memview.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/callbacks_2_memview.Tpo $(DEPDIR)/callbacks_2_memview.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dTools/callbacks_2_memview.c' object='callbacks_2_memview.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-desmume.o `test -f 'desmume.c' || echo '$(srcdir)/'`desmume.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o callbacks_2_memview.o `test -f 'dTools/callbacks_2_memview.c' || echo '$(srcdir)/'`dTools/callbacks_2_memview.c -desmume_glade-desmume.obj: desmume.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-desmume.obj -MD -MP -MF "$(DEPDIR)/desmume_glade-desmume.Tpo" -c -o desmume_glade-desmume.obj `if test -f 'desmume.c'; then $(CYGPATH_W) 'desmume.c'; else $(CYGPATH_W) '$(srcdir)/desmume.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-desmume.Tpo" "$(DEPDIR)/desmume_glade-desmume.Po"; else rm -f "$(DEPDIR)/desmume_glade-desmume.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='desmume.c' object='desmume_glade-desmume.obj' libtool=no @AMDEPBACKSLASH@ +callbacks_2_memview.obj: dTools/callbacks_2_memview.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT callbacks_2_memview.obj -MD -MP -MF $(DEPDIR)/callbacks_2_memview.Tpo -c -o callbacks_2_memview.obj `if test -f 'dTools/callbacks_2_memview.c'; then $(CYGPATH_W) 'dTools/callbacks_2_memview.c'; else $(CYGPATH_W) '$(srcdir)/dTools/callbacks_2_memview.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/callbacks_2_memview.Tpo $(DEPDIR)/callbacks_2_memview.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dTools/callbacks_2_memview.c' object='callbacks_2_memview.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-desmume.obj `if test -f 'desmume.c'; then $(CYGPATH_W) 'desmume.c'; else $(CYGPATH_W) '$(srcdir)/desmume.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o callbacks_2_memview.obj `if test -f 'dTools/callbacks_2_memview.c'; then $(CYGPATH_W) 'dTools/callbacks_2_memview.c'; else $(CYGPATH_W) '$(srcdir)/dTools/callbacks_2_memview.c'; fi` -desmume_glade-keyval_names.o: keyval_names.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-keyval_names.o -MD -MP -MF "$(DEPDIR)/desmume_glade-keyval_names.Tpo" -c -o desmume_glade-keyval_names.o `test -f 'keyval_names.c' || echo '$(srcdir)/'`keyval_names.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-keyval_names.Tpo" "$(DEPDIR)/desmume_glade-keyval_names.Po"; else rm -f "$(DEPDIR)/desmume_glade-keyval_names.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyval_names.c' object='desmume_glade-keyval_names.o' libtool=no @AMDEPBACKSLASH@ +callbacks_3_palview.o: dTools/callbacks_3_palview.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT callbacks_3_palview.o -MD -MP -MF $(DEPDIR)/callbacks_3_palview.Tpo -c -o callbacks_3_palview.o `test -f 'dTools/callbacks_3_palview.c' || echo '$(srcdir)/'`dTools/callbacks_3_palview.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/callbacks_3_palview.Tpo $(DEPDIR)/callbacks_3_palview.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dTools/callbacks_3_palview.c' object='callbacks_3_palview.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-keyval_names.o `test -f 'keyval_names.c' || echo '$(srcdir)/'`keyval_names.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o callbacks_3_palview.o `test -f 'dTools/callbacks_3_palview.c' || echo '$(srcdir)/'`dTools/callbacks_3_palview.c -desmume_glade-keyval_names.obj: keyval_names.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-keyval_names.obj -MD -MP -MF "$(DEPDIR)/desmume_glade-keyval_names.Tpo" -c -o desmume_glade-keyval_names.obj `if test -f 'keyval_names.c'; then $(CYGPATH_W) 'keyval_names.c'; else $(CYGPATH_W) '$(srcdir)/keyval_names.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-keyval_names.Tpo" "$(DEPDIR)/desmume_glade-keyval_names.Po"; else rm -f "$(DEPDIR)/desmume_glade-keyval_names.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyval_names.c' object='desmume_glade-keyval_names.obj' libtool=no @AMDEPBACKSLASH@ +callbacks_3_palview.obj: dTools/callbacks_3_palview.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT callbacks_3_palview.obj -MD -MP -MF $(DEPDIR)/callbacks_3_palview.Tpo -c -o callbacks_3_palview.obj `if test -f 'dTools/callbacks_3_palview.c'; then $(CYGPATH_W) 'dTools/callbacks_3_palview.c'; else $(CYGPATH_W) '$(srcdir)/dTools/callbacks_3_palview.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/callbacks_3_palview.Tpo $(DEPDIR)/callbacks_3_palview.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dTools/callbacks_3_palview.c' object='callbacks_3_palview.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-keyval_names.obj `if test -f 'keyval_names.c'; then $(CYGPATH_W) 'keyval_names.c'; else $(CYGPATH_W) '$(srcdir)/keyval_names.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o callbacks_3_palview.obj `if test -f 'dTools/callbacks_3_palview.c'; then $(CYGPATH_W) 'dTools/callbacks_3_palview.c'; else $(CYGPATH_W) '$(srcdir)/dTools/callbacks_3_palview.c'; fi` -desmume_glade-main.o: main.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-main.o -MD -MP -MF "$(DEPDIR)/desmume_glade-main.Tpo" -c -o desmume_glade-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-main.Tpo" "$(DEPDIR)/desmume_glade-main.Po"; else rm -f "$(DEPDIR)/desmume_glade-main.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='desmume_glade-main.o' libtool=no @AMDEPBACKSLASH@ +callbacks_4_tileview.o: dTools/callbacks_4_tileview.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT callbacks_4_tileview.o -MD -MP -MF $(DEPDIR)/callbacks_4_tileview.Tpo -c -o callbacks_4_tileview.o `test -f 'dTools/callbacks_4_tileview.c' || echo '$(srcdir)/'`dTools/callbacks_4_tileview.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/callbacks_4_tileview.Tpo $(DEPDIR)/callbacks_4_tileview.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dTools/callbacks_4_tileview.c' object='callbacks_4_tileview.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o callbacks_4_tileview.o `test -f 'dTools/callbacks_4_tileview.c' || echo '$(srcdir)/'`dTools/callbacks_4_tileview.c -desmume_glade-main.obj: main.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-main.obj -MD -MP -MF "$(DEPDIR)/desmume_glade-main.Tpo" -c -o desmume_glade-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-main.Tpo" "$(DEPDIR)/desmume_glade-main.Po"; else rm -f "$(DEPDIR)/desmume_glade-main.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='desmume_glade-main.obj' libtool=no @AMDEPBACKSLASH@ +callbacks_4_tileview.obj: dTools/callbacks_4_tileview.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT callbacks_4_tileview.obj -MD -MP -MF $(DEPDIR)/callbacks_4_tileview.Tpo -c -o callbacks_4_tileview.obj `if test -f 'dTools/callbacks_4_tileview.c'; then $(CYGPATH_W) 'dTools/callbacks_4_tileview.c'; else $(CYGPATH_W) '$(srcdir)/dTools/callbacks_4_tileview.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/callbacks_4_tileview.Tpo $(DEPDIR)/callbacks_4_tileview.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dTools/callbacks_4_tileview.c' object='callbacks_4_tileview.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o callbacks_4_tileview.obj `if test -f 'dTools/callbacks_4_tileview.c'; then $(CYGPATH_W) 'dTools/callbacks_4_tileview.c'; else $(CYGPATH_W) '$(srcdir)/dTools/callbacks_4_tileview.c'; fi` -desmume_glade-printscreen.o: printscreen.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-printscreen.o -MD -MP -MF "$(DEPDIR)/desmume_glade-printscreen.Tpo" -c -o desmume_glade-printscreen.o `test -f 'printscreen.c' || echo '$(srcdir)/'`printscreen.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-printscreen.Tpo" "$(DEPDIR)/desmume_glade-printscreen.Po"; else rm -f "$(DEPDIR)/desmume_glade-printscreen.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='printscreen.c' object='desmume_glade-printscreen.o' libtool=no @AMDEPBACKSLASH@ +sndsdl.o: ../sndsdl.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sndsdl.o -MD -MP -MF $(DEPDIR)/sndsdl.Tpo -c -o sndsdl.o `test -f '../sndsdl.c' || echo '$(srcdir)/'`../sndsdl.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/sndsdl.Tpo $(DEPDIR)/sndsdl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../sndsdl.c' object='sndsdl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-printscreen.o `test -f 'printscreen.c' || echo '$(srcdir)/'`printscreen.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sndsdl.o `test -f '../sndsdl.c' || echo '$(srcdir)/'`../sndsdl.c -desmume_glade-printscreen.obj: printscreen.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-printscreen.obj -MD -MP -MF "$(DEPDIR)/desmume_glade-printscreen.Tpo" -c -o desmume_glade-printscreen.obj `if test -f 'printscreen.c'; then $(CYGPATH_W) 'printscreen.c'; else $(CYGPATH_W) '$(srcdir)/printscreen.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-printscreen.Tpo" "$(DEPDIR)/desmume_glade-printscreen.Po"; else rm -f "$(DEPDIR)/desmume_glade-printscreen.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='printscreen.c' object='desmume_glade-printscreen.obj' libtool=no @AMDEPBACKSLASH@ +sndsdl.obj: ../sndsdl.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sndsdl.obj -MD -MP -MF $(DEPDIR)/sndsdl.Tpo -c -o sndsdl.obj `if test -f '../sndsdl.c'; then $(CYGPATH_W) '../sndsdl.c'; else $(CYGPATH_W) '$(srcdir)/../sndsdl.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/sndsdl.Tpo $(DEPDIR)/sndsdl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../sndsdl.c' object='sndsdl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-printscreen.obj `if test -f 'printscreen.c'; then $(CYGPATH_W) 'printscreen.c'; else $(CYGPATH_W) '$(srcdir)/printscreen.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sndsdl.obj `if test -f '../sndsdl.c'; then $(CYGPATH_W) '../sndsdl.c'; else $(CYGPATH_W) '$(srcdir)/../sndsdl.c'; fi` -desmume_glade-callbacks_1_ioregs.o: dTools/callbacks_1_ioregs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-callbacks_1_ioregs.o -MD -MP -MF "$(DEPDIR)/desmume_glade-callbacks_1_ioregs.Tpo" -c -o desmume_glade-callbacks_1_ioregs.o `test -f 'dTools/callbacks_1_ioregs.c' || echo '$(srcdir)/'`dTools/callbacks_1_ioregs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-callbacks_1_ioregs.Tpo" "$(DEPDIR)/desmume_glade-callbacks_1_ioregs.Po"; else rm -f "$(DEPDIR)/desmume_glade-callbacks_1_ioregs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dTools/callbacks_1_ioregs.c' object='desmume_glade-callbacks_1_ioregs.o' libtool=no @AMDEPBACKSLASH@ +ctrlssdl.o: ../ctrlssdl.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ctrlssdl.o -MD -MP -MF $(DEPDIR)/ctrlssdl.Tpo -c -o ctrlssdl.o `test -f '../ctrlssdl.c' || echo '$(srcdir)/'`../ctrlssdl.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ctrlssdl.Tpo $(DEPDIR)/ctrlssdl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ctrlssdl.c' object='ctrlssdl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-callbacks_1_ioregs.o `test -f 'dTools/callbacks_1_ioregs.c' || echo '$(srcdir)/'`dTools/callbacks_1_ioregs.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ctrlssdl.o `test -f '../ctrlssdl.c' || echo '$(srcdir)/'`../ctrlssdl.c -desmume_glade-callbacks_1_ioregs.obj: dTools/callbacks_1_ioregs.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-callbacks_1_ioregs.obj -MD -MP -MF "$(DEPDIR)/desmume_glade-callbacks_1_ioregs.Tpo" -c -o desmume_glade-callbacks_1_ioregs.obj `if test -f 'dTools/callbacks_1_ioregs.c'; then $(CYGPATH_W) 'dTools/callbacks_1_ioregs.c'; else $(CYGPATH_W) '$(srcdir)/dTools/callbacks_1_ioregs.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-callbacks_1_ioregs.Tpo" "$(DEPDIR)/desmume_glade-callbacks_1_ioregs.Po"; else rm -f "$(DEPDIR)/desmume_glade-callbacks_1_ioregs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dTools/callbacks_1_ioregs.c' object='desmume_glade-callbacks_1_ioregs.obj' libtool=no @AMDEPBACKSLASH@ +ctrlssdl.obj: ../ctrlssdl.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ctrlssdl.obj -MD -MP -MF $(DEPDIR)/ctrlssdl.Tpo -c -o ctrlssdl.obj `if test -f '../ctrlssdl.c'; then $(CYGPATH_W) '../ctrlssdl.c'; else $(CYGPATH_W) '$(srcdir)/../ctrlssdl.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ctrlssdl.Tpo $(DEPDIR)/ctrlssdl.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ctrlssdl.c' object='ctrlssdl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-callbacks_1_ioregs.obj `if test -f 'dTools/callbacks_1_ioregs.c'; then $(CYGPATH_W) 'dTools/callbacks_1_ioregs.c'; else $(CYGPATH_W) '$(srcdir)/dTools/callbacks_1_ioregs.c'; fi` - -desmume_glade-callbacks_2_memview.o: dTools/callbacks_2_memview.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-callbacks_2_memview.o -MD -MP -MF "$(DEPDIR)/desmume_glade-callbacks_2_memview.Tpo" -c -o desmume_glade-callbacks_2_memview.o `test -f 'dTools/callbacks_2_memview.c' || echo '$(srcdir)/'`dTools/callbacks_2_memview.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-callbacks_2_memview.Tpo" "$(DEPDIR)/desmume_glade-callbacks_2_memview.Po"; else rm -f "$(DEPDIR)/desmume_glade-callbacks_2_memview.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dTools/callbacks_2_memview.c' object='desmume_glade-callbacks_2_memview.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-callbacks_2_memview.o `test -f 'dTools/callbacks_2_memview.c' || echo '$(srcdir)/'`dTools/callbacks_2_memview.c - -desmume_glade-callbacks_2_memview.obj: dTools/callbacks_2_memview.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-callbacks_2_memview.obj -MD -MP -MF "$(DEPDIR)/desmume_glade-callbacks_2_memview.Tpo" -c -o desmume_glade-callbacks_2_memview.obj `if test -f 'dTools/callbacks_2_memview.c'; then $(CYGPATH_W) 'dTools/callbacks_2_memview.c'; else $(CYGPATH_W) '$(srcdir)/dTools/callbacks_2_memview.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-callbacks_2_memview.Tpo" "$(DEPDIR)/desmume_glade-callbacks_2_memview.Po"; else rm -f "$(DEPDIR)/desmume_glade-callbacks_2_memview.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dTools/callbacks_2_memview.c' object='desmume_glade-callbacks_2_memview.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-callbacks_2_memview.obj `if test -f 'dTools/callbacks_2_memview.c'; then $(CYGPATH_W) 'dTools/callbacks_2_memview.c'; else $(CYGPATH_W) '$(srcdir)/dTools/callbacks_2_memview.c'; fi` - -desmume_glade-callbacks_3_palview.o: dTools/callbacks_3_palview.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-callbacks_3_palview.o -MD -MP -MF "$(DEPDIR)/desmume_glade-callbacks_3_palview.Tpo" -c -o desmume_glade-callbacks_3_palview.o `test -f 'dTools/callbacks_3_palview.c' || echo '$(srcdir)/'`dTools/callbacks_3_palview.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-callbacks_3_palview.Tpo" "$(DEPDIR)/desmume_glade-callbacks_3_palview.Po"; else rm -f "$(DEPDIR)/desmume_glade-callbacks_3_palview.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dTools/callbacks_3_palview.c' object='desmume_glade-callbacks_3_palview.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-callbacks_3_palview.o `test -f 'dTools/callbacks_3_palview.c' || echo '$(srcdir)/'`dTools/callbacks_3_palview.c - -desmume_glade-callbacks_3_palview.obj: dTools/callbacks_3_palview.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-callbacks_3_palview.obj -MD -MP -MF "$(DEPDIR)/desmume_glade-callbacks_3_palview.Tpo" -c -o desmume_glade-callbacks_3_palview.obj `if test -f 'dTools/callbacks_3_palview.c'; then $(CYGPATH_W) 'dTools/callbacks_3_palview.c'; else $(CYGPATH_W) '$(srcdir)/dTools/callbacks_3_palview.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-callbacks_3_palview.Tpo" "$(DEPDIR)/desmume_glade-callbacks_3_palview.Po"; else rm -f "$(DEPDIR)/desmume_glade-callbacks_3_palview.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dTools/callbacks_3_palview.c' object='desmume_glade-callbacks_3_palview.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-callbacks_3_palview.obj `if test -f 'dTools/callbacks_3_palview.c'; then $(CYGPATH_W) 'dTools/callbacks_3_palview.c'; else $(CYGPATH_W) '$(srcdir)/dTools/callbacks_3_palview.c'; fi` - -desmume_glade-sndsdl.o: ../sndsdl.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-sndsdl.o -MD -MP -MF "$(DEPDIR)/desmume_glade-sndsdl.Tpo" -c -o desmume_glade-sndsdl.o `test -f '../sndsdl.c' || echo '$(srcdir)/'`../sndsdl.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-sndsdl.Tpo" "$(DEPDIR)/desmume_glade-sndsdl.Po"; else rm -f "$(DEPDIR)/desmume_glade-sndsdl.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../sndsdl.c' object='desmume_glade-sndsdl.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-sndsdl.o `test -f '../sndsdl.c' || echo '$(srcdir)/'`../sndsdl.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ctrlssdl.obj `if test -f '../ctrlssdl.c'; then $(CYGPATH_W) '../ctrlssdl.c'; else $(CYGPATH_W) '$(srcdir)/../ctrlssdl.c'; fi` +install-ApplicationsDATA: $(Applications_DATA) + @$(NORMAL_INSTALL) + test -z "$(Applicationsdir)" || $(MKDIR_P) "$(DESTDIR)$(Applicationsdir)" + @list='$(Applications_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(ApplicationsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(Applicationsdir)/$$f'"; \ + $(ApplicationsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(Applicationsdir)/$$f"; \ + done -desmume_glade-sndsdl.obj: ../sndsdl.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-sndsdl.obj -MD -MP -MF "$(DEPDIR)/desmume_glade-sndsdl.Tpo" -c -o desmume_glade-sndsdl.obj `if test -f '../sndsdl.c'; then $(CYGPATH_W) '../sndsdl.c'; else $(CYGPATH_W) '$(srcdir)/../sndsdl.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-sndsdl.Tpo" "$(DEPDIR)/desmume_glade-sndsdl.Po"; else rm -f "$(DEPDIR)/desmume_glade-sndsdl.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../sndsdl.c' object='desmume_glade-sndsdl.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-sndsdl.obj `if test -f '../sndsdl.c'; then $(CYGPATH_W) '../sndsdl.c'; else $(CYGPATH_W) '$(srcdir)/../sndsdl.c'; fi` +uninstall-ApplicationsDATA: + @$(NORMAL_UNINSTALL) + @list='$(Applications_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(Applicationsdir)/$$f'"; \ + rm -f "$(DESTDIR)$(Applicationsdir)/$$f"; \ + done +install-gladeDATA: $(glade_DATA) + @$(NORMAL_INSTALL) + test -z "$(gladedir)" || $(MKDIR_P) "$(DESTDIR)$(gladedir)" + @list='$(glade_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(gladeDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(gladedir)/$$f'"; \ + $(gladeDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(gladedir)/$$f"; \ + done -desmume_glade-ctrlssdl.o: ../ctrlssdl.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-ctrlssdl.o -MD -MP -MF "$(DEPDIR)/desmume_glade-ctrlssdl.Tpo" -c -o desmume_glade-ctrlssdl.o `test -f '../ctrlssdl.c' || echo '$(srcdir)/'`../ctrlssdl.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-ctrlssdl.Tpo" "$(DEPDIR)/desmume_glade-ctrlssdl.Po"; else rm -f "$(DEPDIR)/desmume_glade-ctrlssdl.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ctrlssdl.c' object='desmume_glade-ctrlssdl.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-ctrlssdl.o `test -f '../ctrlssdl.c' || echo '$(srcdir)/'`../ctrlssdl.c +uninstall-gladeDATA: + @$(NORMAL_UNINSTALL) + @list='$(glade_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(gladedir)/$$f'"; \ + rm -f "$(DESTDIR)$(gladedir)/$$f"; \ + done +install-pixmapDATA: $(pixmap_DATA) + @$(NORMAL_INSTALL) + test -z "$(pixmapdir)" || $(MKDIR_P) "$(DESTDIR)$(pixmapdir)" + @list='$(pixmap_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pixmapDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pixmapdir)/$$f'"; \ + $(pixmapDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pixmapdir)/$$f"; \ + done -desmume_glade-ctrlssdl.obj: ../ctrlssdl.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -MT desmume_glade-ctrlssdl.obj -MD -MP -MF "$(DEPDIR)/desmume_glade-ctrlssdl.Tpo" -c -o desmume_glade-ctrlssdl.obj `if test -f '../ctrlssdl.c'; then $(CYGPATH_W) '../ctrlssdl.c'; else $(CYGPATH_W) '$(srcdir)/../ctrlssdl.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/desmume_glade-ctrlssdl.Tpo" "$(DEPDIR)/desmume_glade-ctrlssdl.Po"; else rm -f "$(DEPDIR)/desmume_glade-ctrlssdl.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../ctrlssdl.c' object='desmume_glade-ctrlssdl.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(desmume_glade_CFLAGS) $(CFLAGS) -c -o desmume_glade-ctrlssdl.obj `if test -f '../ctrlssdl.c'; then $(CYGPATH_W) '../ctrlssdl.c'; else $(CYGPATH_W) '$(srcdir)/../ctrlssdl.c'; fi` -uninstall-info-am: +uninstall-pixmapDATA: + @$(NORMAL_UNINSTALL) + @list='$(pixmap_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pixmapdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pixmapdir)/$$f"; \ + done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -496,23 +552,21 @@ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/glade - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -525,10 +579,10 @@ done check-am: all-am check: check-am -all-am: Makefile $(PROGRAMS) +all-am: Makefile $(PROGRAMS) $(DATA) installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(Applicationsdir)" "$(DESTDIR)$(gladedir)" "$(DESTDIR)$(pixmapdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -574,14 +628,23 @@ info-am: -install-data-am: +install-data-am: install-ApplicationsDATA install-gladeDATA \ + install-pixmapDATA + +install-dvi: install-dvi-am install-exec-am: install-binPROGRAMS +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -601,18 +664,25 @@ ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-info-am +uninstall-am: uninstall-ApplicationsDATA uninstall-binPROGRAMS \ + uninstall-gladeDATA uninstall-pixmapDATA + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ + html-am info info-am install install-ApplicationsDATA \ + install-am install-binPROGRAMS install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-gladeDATA install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-pixmapDATA install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-info-am + uninstall-ApplicationsDATA uninstall-am uninstall-binPROGRAMS \ + uninstall-gladeDATA uninstall-pixmapDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/instruction_tabdef.inc /tmp/4ejbOOI7Zw/desmume-0.7.3/src/instruction_tabdef.inc --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/instruction_tabdef.inc 2006-04-05 16:01:57.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/instruction_tabdef.inc 2007-05-01 08:54:20.000000000 -0500 @@ -34,9 +34,11 @@ OP_AND_LSR_IMM, // OOO OOOO O 1010 OP_STRH_POS_INDE_M_REG_OFF, // 000 0000 0 1011 OP_AND_ASR_IMM, // 000 0000 0 1100 - OP_UND, // 000 0000 0 1101 + OP_LDRD_STRD_POST_INDEX, + // 000 0000 0 1101 OP_AND_ROR_IMM, // 000 0000 0 1110 - OP_UND, // 000 0000 0 1111 + OP_LDRD_STRD_POST_INDEX, + // 000 0000 0 1111 OP_AND_S_LSL_IMM, // 000 0000 1 0000 OP_AND_S_LSL_REG, // 000 0000 1 0001 @@ -106,9 +108,11 @@ OP_SUB_LSR_IMM, // OOO OO1O O 1010 OP_STRH_POS_INDE_M_IMM_OFF, // 000 0010 0 1011 OP_SUB_ASR_IMM, // 000 0010 0 1100 - OP_UND, // 000 0010 0 1101 + OP_LDRD_STRD_POST_INDEX, + // 000 0010 0 1101 OP_SUB_ROR_IMM, // 000 0010 0 1110 - OP_UND, // 000 0010 0 1111 + OP_LDRD_STRD_POST_INDEX, + // 000 0010 0 1111 OP_SUB_S_LSL_IMM, // 000 0010 1 0000 OP_SUB_S_LSL_REG, // 000 0010 1 0001 @@ -178,9 +182,11 @@ OP_ADD_LSR_IMM, // OOO O10O O 1010 OP_STRH_POS_INDE_P_REG_OFF, // 000 0100 0 1011 OP_ADD_ASR_IMM, // 000 0100 0 1100 - OP_UND, // 000 0100 0 1101 + OP_LDRD_STRD_POST_INDEX, + // 000 0100 0 1101 OP_ADD_ROR_IMM, // 000 0100 0 1110 - OP_UND, // 000 0100 0 1111 + OP_LDRD_STRD_POST_INDEX, + // 000 0100 0 1111 OP_ADD_S_LSL_IMM, // 000 0100 1 0000 OP_ADD_S_LSL_REG, // 000 0100 1 0001 @@ -250,9 +256,11 @@ OP_SBC_LSR_IMM, // OOO O11O O 1010 OP_STRH_POS_INDE_P_IMM_OFF, // 000 0110 0 1011 OP_SBC_ASR_IMM, // 000 0110 0 1100 - OP_UND, // 000 0110 0 1101 + OP_LDRD_STRD_POST_INDEX, + // 000 0110 0 1101 OP_SBC_ROR_IMM, // 000 0110 0 1110 - OP_UND, // 000 0110 0 1111 + OP_LDRD_STRD_POST_INDEX, + // 000 0110 0 1111 OP_SBC_S_LSL_IMM, // 000 0110 1 0000 OP_SBC_S_LSL_REG, // 000 0110 1 0001 @@ -322,9 +330,11 @@ OP_SMLA_T_B, // 000 1000 0 1010 OP_STRH_M_REG_OFF, // 000 1000 0 1011 OP_SMLA_B_T, // 000 1000 0 1100 - OP_UND, // 000 1000 0 1101 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1000 0 1101 OP_SMLA_T_T, // 000 1000 0 1110 - OP_UND, // 000 1000 0 1111 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1000 0 1111 OP_TST_LSL_IMM, // 000 1000 1 0000 OP_TST_LSL_REG, // 000 1000 1 0001 @@ -358,9 +368,11 @@ OP_SMULW_B, // 000 1001 0 1010 OP_STRH_PRE_INDE_M_REG_OFF, // 000 1001 0 1011 OP_SMLAW_T, // 000 1001 0 1100 - OP_UND, // 000 1001 0 1101 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1001 0 1101 OP_SMULW_T, // 000 1001 0 1110 - OP_UND, // 000 1001 0 1111 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1001 0 1111 OP_TEQ_LSL_IMM, // 000 1001 1 0000 OP_TEQ_LSL_REG, // 000 1001 1 0001 @@ -394,9 +406,11 @@ OP_SMLAL_T_B, // 000 1010 0 1010 OP_STRH_M_IMM_OFF, // 000 1010 0 1011 OP_SMLAL_B_T, // 000 1010 0 1100 - OP_UND, // 000 1010 0 1101 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1010 0 1101 OP_SMLAL_T_T, // 000 1010 0 1110 - OP_UND, // 000 1010 0 1111 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1010 0 1111 OP_CMP_LSL_IMM, // 000 1010 1 0000 OP_CMP_LSL_REG, // 000 1010 1 0001 @@ -430,9 +444,11 @@ OP_SMUL_T_B, // 000 1011 0 1010 OP_STRH_PRE_INDE_M_IMM_OFF, // 000 1011 0 1011 OP_SMUL_B_T, // 000 1011 0 1100 - OP_UND, // 000 1011 0 1101 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1011 0 1101 OP_SMUL_T_T, // 000 1011 0 1110 - OP_UND, // 000 1011 0 1111 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1011 0 1111 OP_CMN_LSL_IMM, // 000 1011 1 0000 OP_CMN_LSL_REG, // 000 1011 1 0001 @@ -466,9 +482,11 @@ OP_ORR_LSR_IMM, // OOO 110O O 1010 OP_STRH_P_REG_OFF, // 000 1100 0 1011 OP_ORR_ASR_IMM, // 000 1100 0 1100 - OP_UND, // 000 1100 0 1101 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1100 0 1101 OP_ORR_ROR_IMM, // 000 1100 0 1110 - OP_UND, // 000 1100 0 1111 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1100 0 1111 OP_ORR_S_LSL_IMM, // 000 1100 1 0000 OP_ORR_S_LSL_REG, // 000 1100 1 0001 @@ -502,9 +520,11 @@ OP_MOV_LSR_IMM, // OOO 1101 O 1010 OP_STRH_PRE_INDE_P_REG_OFF, // 000 1101 0 1011 OP_MOV_ASR_IMM, // 000 1101 0 1100 - OP_UND, // 000 1101 0 1101 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1101 0 1101 OP_MOV_ROR_IMM, // 000 1101 0 1110 - OP_UND, // 000 1101 0 1111 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1101 0 1111 OP_MOV_S_LSL_IMM, // 000 1101 1 0000 OP_MOV_S_LSL_REG, // 000 1101 1 0001 @@ -538,9 +558,11 @@ OP_BIC_LSR_IMM, // OOO 111O O 1010 OP_STRH_P_IMM_OFF, // 000 1110 0 1011 OP_BIC_ASR_IMM, // 000 1110 0 1100 - OP_UND, // 000 1110 0 1101 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1110 0 1101 OP_BIC_ROR_IMM, // 000 1110 0 1110 - OP_UND, // 000 1110 0 1111 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1110 0 1111 OP_BIC_S_LSL_IMM, // 000 1110 1 0000 OP_BIC_S_LSL_REG, // 000 1110 1 0001 @@ -574,9 +596,11 @@ OP_MVN_LSR_IMM, // OOO 1111 O 1010 OP_STRH_PRE_INDE_P_IMM_OFF, // 000 1111 0 1011 OP_MVN_ASR_IMM, // 000 1111 0 1100 - OP_UND, // 000 1111 0 1101 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1111 0 1101 OP_MVN_ROR_IMM, // 000 1111 0 1110 - OP_UND, // 000 1111 0 1111 + OP_LDRD_STRD_OFFSET_PRE_INDEX, + // 000 1111 0 1111 OP_MVN_S_LSL_IMM, // 000 1111 1 0000 OP_MVN_S_LSL_REG, // 000 1111 1 0001 diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/Makefile.am /tmp/4ejbOOI7Zw/desmume-0.7.3/src/Makefile.am --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/Makefile.am 2007-02-04 16:02:57.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/Makefile.am 2007-08-11 18:45:06.000000000 -0500 @@ -1,6 +1,8 @@ +include $(top_srcdir)/src/desmume.mk + EXTRA_DIST = build.bat instruction_tabdef.inc thumb_tabdef.inc fs-linux.c fs-windows.c -DIST_SUBDIRS = . cli gtk gtk-glade windows -SUBDIRS = . $(UI_DIR) +DIST_SUBDIRS = . gdbstub cli cocoa gtk gtk-glade windows +SUBDIRS = . gdbstub $(UI_DIR) noinst_LIBRARIES = libdesmume.a libdesmume_a_SOURCES = \ armcpu.c armcpu.h ARM9.h \ @@ -11,11 +13,16 @@ Disassembler.c Disassembler.h \ dscard.h fat.h FIFO.c FIFO.h \ GPU.c GPU.h \ + gl_vertex.c gl_vertex.h \ mem.h mc.c mc.h \ wifi.c wifi.h \ MMU.c MMU.h NDSSystem.c NDSSystem.h registers.h \ ROMReader.c ROMReader.h \ + render3D.c render3D.h \ saves.c saves.h \ SPU.c SPU.h \ + gdbstub.h \ + matrix.c matrix.h \ + opengl_collector_3Demu.c opengl_collector_3Demu.h \ thumb_instructions.c thumb_instructions.h types.h libdesmume_a_LIBADD = fs-$(desmume_arch).$(OBJEXT) diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/Makefile.in /tmp/4ejbOOI7Zw/desmume-0.7.3/src/Makefile.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/Makefile.in 2007-02-04 16:02:57.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/Makefile.in 2007-09-03 12:31:40.000000000 -0500 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,15 +14,11 @@ @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -37,13 +33,14 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/src/desmume.mk subdir = src -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar @@ -53,11 +50,12 @@ am_libdesmume_a_OBJECTS = armcpu.$(OBJEXT) arm_instructions.$(OBJEXT) \ bios.$(OBJEXT) cp15.$(OBJEXT) cflash.$(OBJEXT) debug.$(OBJEXT) \ Disassembler.$(OBJEXT) FIFO.$(OBJEXT) GPU.$(OBJEXT) \ - mc.$(OBJEXT) wifi.$(OBJEXT) MMU.$(OBJEXT) NDSSystem.$(OBJEXT) \ - ROMReader.$(OBJEXT) saves.$(OBJEXT) SPU.$(OBJEXT) \ - thumb_instructions.$(OBJEXT) + gl_vertex.$(OBJEXT) mc.$(OBJEXT) wifi.$(OBJEXT) MMU.$(OBJEXT) \ + NDSSystem.$(OBJEXT) ROMReader.$(OBJEXT) render3D.$(OBJEXT) \ + saves.$(OBJEXT) SPU.$(OBJEXT) matrix.$(OBJEXT) \ + opengl_collector_3Demu.$(OBJEXT) thumb_instructions.$(OBJEXT) libdesmume_a_OBJECTS = $(am_libdesmume_a_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) +DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -68,30 +66,32 @@ DIST_SOURCES = $(libdesmume_a_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ +ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ @@ -99,14 +99,48 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLADEUI_UNINSTALLED_DIR = @GLADEUI_UNINSTALLED_DIR@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ GREP = @GREP@ +GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ +GTHREAD_LIBS = @GTHREAD_LIBS@ +GTKGLEXT_CFLAGS = @GTKGLEXT_CFLAGS@ +GTKGLEXT_LIBS = @GTKGLEXT_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ HAVE_PKG = @HAVE_PKG@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ +INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ +INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ +INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ +INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ +INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ +INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ +INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ +INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ +INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ +INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ +INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ +INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ +INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ +INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ LDFLAGS = @LDFLAGS@ LIBGLADE_CFLAGS = @LIBGLADE_CFLAGS@ LIBGLADE_LIBS = @LIBGLADE_LIBS@ @@ -114,9 +148,11 @@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -126,6 +162,13 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_DIR = @PO_DIR@ +PO_FILES = @PO_FILES@ +PO_FILES_IN = @PO_FILES_IN@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RANLIB = @RANLIB@ SDLCONFIG = @SDLCONFIG@ SDL_CFLAGS = @SDL_CFLAGS@ @@ -135,13 +178,14 @@ STRIP = @STRIP@ UI_DIR = @UI_DIR@ USE_MAINTAINER_MODE = @USE_MAINTAINER_MODE@ +USE_NLS = @USE_NLS@ VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -153,6 +197,7 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ desmume_arch = @desmume_arch@ @@ -181,15 +226,21 @@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CFLAGS = +AM_CPPFLAGS = -I$(top_srcdir)/src +AM_LDFLAGS = EXTRA_DIST = build.bat instruction_tabdef.inc thumb_tabdef.inc fs-linux.c fs-windows.c -DIST_SUBDIRS = . cli gtk gtk-glade windows -SUBDIRS = . $(UI_DIR) +DIST_SUBDIRS = . gdbstub cli cocoa gtk gtk-glade windows +SUBDIRS = . gdbstub $(UI_DIR) noinst_LIBRARIES = libdesmume.a libdesmume_a_SOURCES = \ armcpu.c armcpu.h ARM9.h \ @@ -200,12 +251,17 @@ Disassembler.c Disassembler.h \ dscard.h fat.h FIFO.c FIFO.h \ GPU.c GPU.h \ + gl_vertex.c gl_vertex.h \ mem.h mc.c mc.h \ wifi.c wifi.h \ MMU.c MMU.h NDSSystem.c NDSSystem.h registers.h \ ROMReader.c ROMReader.h \ + render3D.c render3D.h \ saves.c saves.h \ SPU.c SPU.h \ + gdbstub.h \ + matrix.c matrix.h \ + opengl_collector_3Demu.c opengl_collector_3Demu.h \ thumb_instructions.c thumb_instructions.h types.h libdesmume_a_LIBADD = fs-$(desmume_arch).$(OBJEXT) @@ -213,7 +269,7 @@ .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/src/desmume.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -269,25 +325,28 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cflash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cp15.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_vertex.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matrix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opengl_collector_3Demu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/render3D.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/saves.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thumb_instructions.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wifi.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -320,8 +379,7 @@ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: +$(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ @@ -422,22 +480,21 @@ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -451,7 +508,7 @@ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ @@ -459,6 +516,8 @@ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ distdir) \ || exit 1; \ fi; \ @@ -514,12 +573,20 @@ install-data-am: +install-dvi: install-dvi-recursive + install-exec-am: +install-html: install-html-recursive + install-info: install-info-recursive install-man: +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + installcheck-am: maintainer-clean: maintainer-clean-recursive @@ -539,22 +606,24 @@ ps-am: -uninstall-am: uninstall-info-am +uninstall-am: -uninstall-info: uninstall-info-recursive +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ - clean clean-generic clean-noinstLIBRARIES clean-recursive \ - ctags ctags-recursive distclean distclean-compile \ - distclean-generic distclean-recursive distclean-tags distdir \ - dvi dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am uninstall-info-am + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/matrix.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/matrix.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/matrix.c 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/matrix.c 2007-04-24 16:07:10.000000000 -0500 @@ -0,0 +1,257 @@ +/* + Copyright (C) 2006-2007 shash + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include +#include +#include +#include "matrix.h" + +void MatrixInit (float *matrix) +{ + memset (matrix, 0, sizeof(float)*16); + + matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1.f; +} + +void MatrixMultVec4x4 (float *matrix, float *vecPtr) +{ + float x = vecPtr[0]; + float y = vecPtr[1]; + float z = vecPtr[2]; + + vecPtr[0] = x * matrix[0] + y * matrix[4] + z * matrix[ 8] + matrix[12]; + vecPtr[1] = x * matrix[1] + y * matrix[5] + z * matrix[ 9] + matrix[13]; + vecPtr[2] = x * matrix[2] + y * matrix[6] + z * matrix[10] + matrix[14]; +} + +void MatrixMultVec3x3 (float *matrix, float *vecPtr) +{ + float x = vecPtr[0]; + float y = vecPtr[1]; + float z = vecPtr[2]; + + vecPtr[0] = x * matrix[0] + y * matrix[4] + z * matrix[ 8]; + vecPtr[1] = x * matrix[1] + y * matrix[5] + z * matrix[ 9]; + vecPtr[2] = x * matrix[2] + y * matrix[6] + z * matrix[10]; +} + +void MatrixIdentity (float *matrix) +{ + memset (matrix, 0, sizeof(float)*16); + + matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1.f; +} + +void MatrixMultiply (float *matrix, float *rightMatrix) +{ + float tmpMatrix[16]; + + tmpMatrix[0] = (matrix[0]*rightMatrix[0])+(matrix[4]*rightMatrix[1])+(matrix[8]*rightMatrix[2])+(matrix[12]*rightMatrix[3]); + tmpMatrix[1] = (matrix[1]*rightMatrix[0])+(matrix[5]*rightMatrix[1])+(matrix[9]*rightMatrix[2])+(matrix[13]*rightMatrix[3]); + tmpMatrix[2] = (matrix[2]*rightMatrix[0])+(matrix[6]*rightMatrix[1])+(matrix[10]*rightMatrix[2])+(matrix[14]*rightMatrix[3]); + tmpMatrix[3] = (matrix[3]*rightMatrix[0])+(matrix[7]*rightMatrix[1])+(matrix[11]*rightMatrix[2])+(matrix[15]*rightMatrix[3]); + + tmpMatrix[4] = (matrix[0]*rightMatrix[4])+(matrix[4]*rightMatrix[5])+(matrix[8]*rightMatrix[6])+(matrix[12]*rightMatrix[7]); + tmpMatrix[5] = (matrix[1]*rightMatrix[4])+(matrix[5]*rightMatrix[5])+(matrix[9]*rightMatrix[6])+(matrix[13]*rightMatrix[7]); + tmpMatrix[6] = (matrix[2]*rightMatrix[4])+(matrix[6]*rightMatrix[5])+(matrix[10]*rightMatrix[6])+(matrix[14]*rightMatrix[7]); + tmpMatrix[7] = (matrix[3]*rightMatrix[4])+(matrix[7]*rightMatrix[5])+(matrix[11]*rightMatrix[6])+(matrix[15]*rightMatrix[7]); + + tmpMatrix[8] = (matrix[0]*rightMatrix[8])+(matrix[4]*rightMatrix[9])+(matrix[8]*rightMatrix[10])+(matrix[12]*rightMatrix[11]); + tmpMatrix[9] = (matrix[1]*rightMatrix[8])+(matrix[5]*rightMatrix[9])+(matrix[9]*rightMatrix[10])+(matrix[13]*rightMatrix[11]); + tmpMatrix[10] = (matrix[2]*rightMatrix[8])+(matrix[6]*rightMatrix[9])+(matrix[10]*rightMatrix[10])+(matrix[14]*rightMatrix[11]); + tmpMatrix[11] = (matrix[3]*rightMatrix[8])+(matrix[7]*rightMatrix[9])+(matrix[11]*rightMatrix[10])+(matrix[15]*rightMatrix[11]); + + tmpMatrix[12] = (matrix[0]*rightMatrix[12])+(matrix[4]*rightMatrix[13])+(matrix[8]*rightMatrix[14])+(matrix[12]*rightMatrix[15]); + tmpMatrix[13] = (matrix[1]*rightMatrix[12])+(matrix[5]*rightMatrix[13])+(matrix[9]*rightMatrix[14])+(matrix[13]*rightMatrix[15]); + tmpMatrix[14] = (matrix[2]*rightMatrix[12])+(matrix[6]*rightMatrix[13])+(matrix[10]*rightMatrix[14])+(matrix[14]*rightMatrix[15]); + tmpMatrix[15] = (matrix[3]*rightMatrix[12])+(matrix[7]*rightMatrix[13])+(matrix[11]*rightMatrix[14])+(matrix[15]*rightMatrix[15]); + + memcpy (matrix, tmpMatrix, sizeof(float)*16); +} +/* +void MatrixMulti (float* right) +{ + float tmpMatrix[16]; + + tmpMatrix[0] = (matrix[0]*right[0])+(matrix[4]*right[1])+(matrix[8]*right[2])+(matrix[12]*right[3]); + tmpMatrix[1] = (matrix[1]*right[0])+(matrix[5]*right[1])+(matrix[9]*right[2])+(matrix[13]*right[3]); + tmpMatrix[2] = (matrix[2]*right[0])+(matrix[6]*right[1])+(matrix[10]*right[2])+(matrix[14]*right[3]); + tmpMatrix[3] = (matrix[3]*right[0])+(matrix[7]*right[1])+(matrix[11]*right[2])+(matrix[15]*right[3]); + + tmpMatrix[4] = (matrix[0]*right[4])+(matrix[4]*right[5])+(matrix[8]*right[6])+(matrix[12]*right[7]); + tmpMatrix[5] = (matrix[1]*right[4])+(matrix[5]*right[5])+(matrix[9]*right[6])+(matrix[13]*right[7]); + tmpMatrix[6] = (matrix[2]*right[4])+(matrix[6]*right[5])+(matrix[10]*right[6])+(matrix[14]*right[7]); + tmpMatrix[7] = (matrix[3]*right[4])+(matrix[7]*right[5])+(matrix[11]*right[6])+(matrix[15]*right[7]); + + tmpMatrix[8] = (matrix[0]*right[8])+(matrix[4]*right[9])+(matrix[8]*right[10])+(matrix[12]*right[11]); + tmpMatrix[9] = (matrix[1]*right[8])+(matrix[5]*right[9])+(matrix[9]*right[10])+(matrix[13]*right[11]); + tmpMatrix[10] = (matrix[2]*right[8])+(matrix[6]*right[9])+(matrix[10]*right[10])+(matrix[14]*right[11]); + tmpMatrix[11] = (matrix[3]*right[8])+(matrix[7]*right[9])+(matrix[11]*right[10])+(matrix[15]*right[11]); + + tmpMatrix[12] = (matrix[0]*right[12])+(matrix[4]*right[13])+(matrix[8]*right[14])+(matrix[12]*right[15]); + tmpMatrix[13] = (matrix[1]*right[12])+(matrix[5]*right[13])+(matrix[9]*right[14])+(matrix[13]*right[15]); + tmpMatrix[14] = (matrix[2]*right[12])+(matrix[6]*right[13])+(matrix[10]*right[14])+(matrix[14]*right[15]); + tmpMatrix[15] = (matrix[3]*right[12])+(matrix[7]*right[13])+(matrix[11]*right[14])+(matrix[15]*right[15]); + + memcpy (matrix, tmpMatrix, sizeof(float)*16); +} + + +float* Matrix::Get (void) +{ + return matrix; +} + +float MatrixGet (float *matrix, int index) +{ + return matrix[index]; +} +*/ + +float MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix) +{ + int iMod = index%4, iDiv = (index>>2)<<2; + + return (matrix[iMod ]*rightMatrix[iDiv ])+(matrix[iMod+ 4]*rightMatrix[iDiv+1])+ + (matrix[iMod+8]*rightMatrix[iDiv+2])+(matrix[iMod+12]*rightMatrix[iDiv+3]); +} + +void MatrixSet (float *matrix, int x, int y, float value) +{ + matrix [x+(y<<2)] = value; +} +/* +void Matrix::Set (int pos, float value) +{ + matrix [pos] = value; +} +*/ +void MatrixCopy (float *matrixDST, float *matrixSRC) +{ + memcpy (matrixDST, matrixSRC, sizeof(float)*16); +} + +void MatrixTranslate (float *matrix, float *ptr) +{ + matrix[12] += (matrix[0]*ptr[0])+(matrix[4]*ptr[1])+(matrix[ 8]*ptr[2]); + matrix[13] += (matrix[1]*ptr[0])+(matrix[5]*ptr[1])+(matrix[ 9]*ptr[2]); + matrix[14] += (matrix[2]*ptr[0])+(matrix[6]*ptr[1])+(matrix[10]*ptr[2]); + matrix[15] += (matrix[3]*ptr[0])+(matrix[7]*ptr[1])+(matrix[11]*ptr[2]); +} + +void MatrixScale (float *matrix, float *ptr) +{ + matrix[0] *= ptr[0]; + matrix[1] *= ptr[0]; + matrix[2] *= ptr[0]; + matrix[3] *= ptr[0]; + + matrix[4] *= ptr[1]; + matrix[5] *= ptr[1]; + matrix[6] *= ptr[1]; + matrix[7] *= ptr[1]; + + matrix[8] *= ptr[2]; + matrix[9] *= ptr[2]; + matrix[10] *= ptr[2]; + matrix[11] *= ptr[2]; +} +/* +void Matrix::Set (float a11, float a21, float a31, float a41, + float a12, float a22, float a32, float a42, + float a13, float a23, float a33, float a43, + float a14, float a24, float a34, float a44) +{ +} +*/ + + +//----------------------------------------- + +void MatrixStackInit (MatrixStack *stack) +{ + stack->matrix = NULL; + stack->position = 0; + stack->size = 0; +} + +void MatrixStackSetMaxSize (MatrixStack *stack, int size) +{ + int i = 0; + + stack->size = size; + + if (stack->matrix == NULL) + { + stack->matrix = (float*) malloc (stack->size*16*sizeof(float)); + } + else + { + free (stack->matrix); + stack->matrix = (float*) malloc (stack->size*16*sizeof(float)); + } + + for (i = 0; i < stack->size; i++) + { + MatrixInit (&stack->matrix[i*16]); + } + + stack->size--; +} + + +void MatrixStackSetStackPosition (MatrixStack *stack, int pos) +{ + stack->position += pos; + + if (stack->position < 0) + stack->position = 0; + else if (stack->position > stack->size) + stack->position = stack->size; +} + +void MatrixStackPushMatrix (MatrixStack *stack, float *ptr) +{ + MatrixCopy (&stack->matrix[stack->position*16], ptr); + + MatrixStackSetStackPosition (stack, 1); +} + +float * MatrixStackPopMatrix (MatrixStack *stack, int size) +{ + MatrixStackSetStackPosition(stack, -size); + + return &stack->matrix[stack->position*16]; +} + +float * MatrixStackGetPos (MatrixStack *stack, int pos) +{ + return &stack->matrix[pos*16]; +} + +float * MatrixStackGet (MatrixStack *stack) +{ + return &stack->matrix[stack->position*16]; +} + +void MatrixStackLoadMatrix (MatrixStack *stack, int pos, float *ptr) +{ + MatrixCopy (&stack->matrix[pos*16], ptr); +} diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/matrix.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/matrix.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/matrix.h 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/matrix.h 2007-04-24 16:07:10.000000000 -0500 @@ -0,0 +1,51 @@ +/* + Copyright (C) 2006-2007 shash + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef MATRIX_H +#define MATRIX_H + +typedef struct MatrixStack +{ + float *matrix; + int position; + int size; +} MatrixStack; + +void MatrixInit (float *matrix); +void MatrixMultVec3x3 (float *matrix, float *vecPtr); +void MatrixMultVec4x4 (float *matrix, float *vecPtr); +void MatrixIdentity (float *matrix); +void MatrixMultiply (float *matrix, float *rightMatrix); +float MatrixGetMultipliedIndex(int index, float *matrix, float *rightMatrix); +void MatrixSet (float *matrix, int x, int y, float value); +void MatrixCopy (float *matrixDST, float *matrixSRC); +void MatrixTranslate (float *matrix, float *ptr); +void MatrixScale (float *matrix, float *ptr); + +void MatrixStackInit (MatrixStack *stack); +void MatrixStackSetMaxSize (MatrixStack *stack, int size); +void MatrixStackSetStackPosition (MatrixStack *stack, int pos); +void MatrixStackPushMatrix (MatrixStack *stack, float *ptr); +float* MatrixStackPopMatrix (MatrixStack *stack, int size); +float* MatrixStackGetPos (MatrixStack *stack, int pos); +float* MatrixStackGet (MatrixStack *stack); +void MatrixStackLoadMatrix (MatrixStack *stack, int pos, float *ptr); + +#endif diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/mc.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/mc.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/mc.c 2006-12-09 21:25:01.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/mc.c 2007-03-26 21:57:36.000000000 -0500 @@ -1,3 +1,23 @@ +/* Copyright (C) 2006 thoduv + Copyright (C) 2006-2007 Theo Berkau + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include #include "debug.h" #include "types.h" @@ -60,11 +80,13 @@ { u8 *buffer; buffer = malloc(size); - + + mc->data = buffer; if(!buffer) { return NULL; } - mc->data = buffer; - mc->size = size; - mc->writeable_buffer = TRUE; + mc->size = size; + mc->writeable_buffer = TRUE; + + return buffer; } void mc_free(memory_chip_t *mc) @@ -194,6 +216,54 @@ mc->fp = file; } +int mc_load_duc(memory_chip_t *mc, const char* filename) +{ + long size; + int type; + char id[16]; + FILE* file = fopen(filename, "rb"); + if(file == NULL) + return 0; + + fseek(file, 0, SEEK_END); + size = ftell(file) - 500; + fseek(file, 0, SEEK_SET); + + // Make sure we really have the right file + fread((void *)id, sizeof(char), 16, file); + + if (memcmp(id, "ARDS000000000001", 16) != 0) + { + fclose(file); + return 0; + } + + // Alright, it's time to load the file + if (mc->type == MC_TYPE_AUTODETECT) + { + if (size == MC_SIZE_4KBITS) + type = MC_TYPE_EEPROM1; + else if (size == MC_SIZE_64KBITS) + type = MC_TYPE_EEPROM2; + else if (size == MC_SIZE_256KBITS) + type = MC_TYPE_FRAM; + else if (size == MC_SIZE_512KBITS) + type = MC_TYPE_EEPROM2; + else if (size >= MC_SIZE_2MBITS) + type = MC_TYPE_FLASH; + mc_realloc(mc, type, size); + } + + if (size > mc->size) + size = mc->size; + // Skip the rest of the header since we don't need it + fseek(file, 500, SEEK_SET); + fread (mc->data, 1, size, file); + fclose(file); + + return 1; +} + u8 fw_transfer(memory_chip_t *mc, u8 data) { if(mc->com == FW_CMD_READ || mc->com == FW_CMD_PAGEWRITE) /* check if we are in a command that needs 3 bytes address */ diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/mc.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/mc.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/mc.h 2007-02-01 06:43:01.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/mc.h 2007-02-09 20:09:48.000000000 -0600 @@ -1,3 +1,23 @@ +/* Copyright (C) 2006 thoduv + Copyright (C) 2006 Theo Berkau + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #ifndef __FW_H__ #define __FW_H__ @@ -60,6 +80,7 @@ u8 *mc_alloc(memory_chip_t *mc, u32 size); /* alloc mc memory */ void mc_realloc(memory_chip_t *mc, int type, u32 size); /* realloc mc memory */ void mc_load_file(memory_chip_t *mc, const char* filename); /* load save file and setup fp */ +int mc_load_duc(memory_chip_t *mc, const char* filename); /* load Action Replay DS save file */ void mc_free(memory_chip_t *mc); /* delete mc memory */ void mc_reset_com(memory_chip_t *mc); /* reset communication with mc */ u8 fw_transfer(memory_chip_t *mc, u8 data); /* transfer to, then receive data from firmware */ diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/MMU.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/MMU.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/MMU.c 2007-01-27 18:11:04.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/MMU.c 2007-06-07 04:56:12.000000000 -0500 @@ -27,16 +27,27 @@ #include #include +//#include "gl_vertex.h" + #include "debug.h" #include "NDSSystem.h" #include "cflash.h" #include "cp15.h" #include "wifi.h" - #include "registers.h" +#include "render3D.h" #define ROM_MASK 3 +/* + * + */ +//#define PROFILE_MEMORY_ACCESS 1 +#define EARLY_MEMORY_ACCESS 1 + +#define INTERNAL_DTCM_READ 1 +#define INTERNAL_DTCM_WRITE 1 + //#define LOG_CARD //#define LOG_GPU //#define LOG_DMA @@ -197,6 +208,7 @@ mc_init(&MMU.bupmem, MC_TYPE_AUTODETECT); mc_alloc(&MMU.bupmem, 1); MMU.bupmem.fp = NULL; + } void MMU_DeInit(void) { @@ -223,49 +235,64 @@ void MMU_clearMem() { - int i; + int i; + + memset(ARM9Mem.ARM9_ABG, 0, 0x080000); + memset(ARM9Mem.ARM9_AOBJ, 0, 0x040000); + memset(ARM9Mem.ARM9_BBG, 0, 0x020000); + memset(ARM9Mem.ARM9_BOBJ, 0, 0x020000); + memset(ARM9Mem.ARM9_DTCM, 0, 0x4000); + memset(ARM9Mem.ARM9_ITCM, 0, 0x8000); + memset(ARM9Mem.ARM9_LCD, 0, 0x0A4000); + memset(ARM9Mem.ARM9_OAM, 0, 0x0800); + memset(ARM9Mem.ARM9_REG, 0, 0x01000000); + memset(ARM9Mem.ARM9_VMEM, 0, 0x0800); + memset(ARM9Mem.ARM9_WRAM, 0, 0x01000000); + memset(ARM9Mem.MAIN_MEM, 0, 0x400000); - memset(ARM9Mem.ARM9_ABG, 0, 0x80000); - memset(ARM9Mem.ARM9_AOBJ, 0, 0x40000); - memset(ARM9Mem.ARM9_BBG, 0, 0x20000); - memset(ARM9Mem.ARM9_BOBJ, 0, 0x20000); - memset(ARM9Mem.ARM9_DTCM, 0, 0x4000); - memset(ARM9Mem.ARM9_ITCM, 0, 0x8000); - memset(ARM9Mem.ARM9_LCD, 0, 0xA4000); - memset(ARM9Mem.ARM9_OAM, 0, 0x800); - memset(ARM9Mem.ARM9_REG, 0, 0x1000000); - memset(ARM9Mem.ARM9_VMEM, 0, 0x800); - memset(ARM9Mem.ARM9_WRAM, 0, 0x1000000); - memset(ARM9Mem.MAIN_MEM, 0, 0x400000); - - memset(MMU.ARM7_ERAM, 0, 0x10000); - memset(MMU.ARM7_REG, 0, 0x10000); - - for(i = 0;i < 16;i++) - FIFOInit(MMU.fifos + i); - - MMU.DTCMRegion = 0; - MMU.ITCMRegion = 0x00800000; - - memset(MMU.timer, 0, sizeof(u16) * 2 * 4); - memset(MMU.timerMODE, 0, sizeof(s32) * 2 * 4); - memset(MMU.timerON, 0, sizeof(u32) * 2 * 4); - memset(MMU.timerRUN, 0, sizeof(u32) * 2 * 4); - memset(MMU.timerReload, 0, sizeof(u16) * 2 * 4); - - memset(MMU.reg_IME, 0, sizeof(u32) * 2); - memset(MMU.reg_IE, 0, sizeof(u32) * 2); - memset(MMU.reg_IF, 0, sizeof(u32) * 2); - - memset(MMU.DMAStartTime, 0, sizeof(u32) * 2 * 4); - memset(MMU.DMACycle, 0, sizeof(s32) * 2 * 4); - memset(MMU.DMACrt, 0, sizeof(u32) * 2 * 4); - memset(MMU.DMAing, 0, sizeof(BOOL) * 2 * 4); - - memset(MMU.dscard, 0, sizeof(nds_dscard) * 2); + memset(ARM9Mem.blank_memory, 0, 0x020000); + + memset(MMU.ARM7_ERAM, 0, 0x010000); + memset(MMU.ARM7_REG, 0, 0x010000); + + for(i = 0;i < 16;i++) + FIFOInit(MMU.fifos + i); + + MMU.DTCMRegion = 0; + MMU.ITCMRegion = 0x00800000; + + memset(MMU.timer, 0, sizeof(u16) * 2 * 4); + memset(MMU.timerMODE, 0, sizeof(s32) * 2 * 4); + memset(MMU.timerON, 0, sizeof(u32) * 2 * 4); + memset(MMU.timerRUN, 0, sizeof(u32) * 2 * 4); + memset(MMU.timerReload, 0, sizeof(u16) * 2 * 4); + + memset(MMU.reg_IME, 0, sizeof(u32) * 2); + memset(MMU.reg_IE, 0, sizeof(u32) * 2); + memset(MMU.reg_IF, 0, sizeof(u32) * 2); + + memset(MMU.DMAStartTime, 0, sizeof(u32) * 2 * 4); + memset(MMU.DMACycle, 0, sizeof(s32) * 2 * 4); + memset(MMU.DMACrt, 0, sizeof(u32) * 2 * 4); + memset(MMU.DMAing, 0, sizeof(BOOL) * 2 * 4); + + memset(MMU.dscard, 0, sizeof(nds_dscard) * 2); + + MainScreen.offset = 192; + SubScreen.offset = 0; - MainScreen.offset = 192; - SubScreen.offset = 0; + /* setup the texture slot pointers */ +#if 0 + ARM9Mem.textureSlotAddr[0] = ARM9Mem.blank_memory; + ARM9Mem.textureSlotAddr[1] = ARM9Mem.blank_memory; + ARM9Mem.textureSlotAddr[2] = ARM9Mem.blank_memory; + ARM9Mem.textureSlotAddr[3] = ARM9Mem.blank_memory; +#else + ARM9Mem.textureSlotAddr[0] = &ARM9Mem.ARM9_LCD[0x20000 * 0]; + ARM9Mem.textureSlotAddr[1] = &ARM9Mem.ARM9_LCD[0x20000 * 1]; + ARM9Mem.textureSlotAddr[2] = &ARM9Mem.ARM9_LCD[0x20000 * 2]; + ARM9Mem.textureSlotAddr[3] = &ARM9Mem.ARM9_LCD[0x20000 * 3]; +#endif } /* the VRAM blocks keep their content even when not blended in */ @@ -273,16 +300,16 @@ /* FIXME: VRAM Bank E,F,G,H,I missing */ void MMU_VRAMWriteBackToLCD(u8 block) { - u8 *destination; - u8 *source; + u8 *destination; + u8 *source; u32 size ; - u8 VRAMBankCnt; + u8 VRAMBankCnt; #if 1 return ; #endif - destination = 0 ; - source = 0; - VRAMBankCnt = MMU_read8(ARMCPU_ARM9,REG_VRAMCNTA+block) ; + destination = 0 ; + source = 0; + VRAMBankCnt = MMU_read8(ARMCPU_ARM9,REG_VRAMCNTA+block) ; switch (block) { case 0: // Bank A @@ -330,33 +357,33 @@ MMU.vScreen = 1; break ; case 1: - switch(block){ - case 0: - case 1: - case 2: - case 3: - /* banks are in use for BG at ABG + ofs * 0x20000 */ - source = ARM9Mem.ARM9_ABG + ((VRAMBankCnt >> 3) & 3) * 0x20000 ; - break ; - case 4: - /* bank E is in use at ABG */ - source = ARM9Mem.ARM9_ABG ; - break; - case 5: - case 6: - /* banks are in use for BG at ABG + (0x4000*OFS.0)+(0x10000*OFS.1)*/ - source = ARM9Mem.ARM9_ABG + (((VRAMBankCnt >> 3) & 1) * 0x4000) + (((VRAMBankCnt >> 2) & 1) * 0x10000) ; - break; - case 8: - /* bank H is in use at BBG */ - source = ARM9Mem.ARM9_BBG ; - break ; - case 9: - /* bank I is in use at BBG */ - source = ARM9Mem.ARM9_BBG + 0x8000 ; - break; - default: return ; - } + switch(block){ + case 0: + case 1: + case 2: + case 3: + /* banks are in use for BG at ABG + ofs * 0x20000 */ + source = ARM9Mem.ARM9_ABG + ((VRAMBankCnt >> 3) & 3) * 0x20000 ; + break ; + case 4: + /* bank E is in use at ABG */ + source = ARM9Mem.ARM9_ABG ; + break; + case 5: + case 6: + /* banks are in use for BG at ABG + (0x4000*OFS.0)+(0x10000*OFS.1)*/ + source = ARM9Mem.ARM9_ABG + (((VRAMBankCnt >> 3) & 1) * 0x4000) + (((VRAMBankCnt >> 2) & 1) * 0x10000) ; + break; + case 8: + /* bank H is in use at BBG */ + source = ARM9Mem.ARM9_BBG ; + break ; + case 9: + /* bank I is in use at BBG */ + source = ARM9Mem.ARM9_BBG + 0x8000 ; + break; + default: return ; + } break ; case 2: if (block < 2) @@ -366,17 +393,17 @@ } else return ; break ; case 4: - switch(block){ - case 2: - /* bank C is in use at BBG */ - source = ARM9Mem.ARM9_BBG ; - break ; - case 3: - /* bank D is in use at BOBJ */ - source = ARM9Mem.ARM9_BOBJ ; - break ; - default: return ; - } + switch(block){ + case 2: + /* bank C is in use at BBG */ + source = ARM9Mem.ARM9_BBG ; + break ; + case 3: + /* bank D is in use at BOBJ */ + source = ARM9Mem.ARM9_BOBJ ; + break ; + default: return ; + } break ; default: return ; @@ -388,15 +415,15 @@ void MMU_VRAMReloadFromLCD(u8 block,u8 VRAMBankCnt) { - u8 *destination; - u8 *source; - u32 size; + u8 *destination; + u8 *source; + u32 size; #if 1 return ; #endif - destination = 0; - source = 0; - size = 0; + destination = 0; + source = 0; + size = 0; switch (block) { case 0: // Bank A @@ -451,46 +478,46 @@ } else return ; break ; case 2: - switch(block){ - case 0: - case 1: - case 2: - case 3: - /* banks are in use for BG at ABG + ofs * 0x20000 */ - destination = ARM9Mem.ARM9_ABG + ((VRAMBankCnt >> 3) & 3) * 0x20000 ; - break ; - case 4: - /* bank E is in use at ABG */ - destination = ARM9Mem.ARM9_ABG ; - break; - case 5: - case 6: - /* banks are in use for BG at ABG + (0x4000*OFS.0)+(0x10000*OFS.1)*/ - destination = ARM9Mem.ARM9_ABG + (((VRAMBankCnt >> 3) & 1) * 0x4000) + (((VRAMBankCnt >> 2) & 1) * 0x10000) ; - break; - case 8: - /* bank H is in use at BBG */ - destination = ARM9Mem.ARM9_BBG ; - break ; - case 9: - /* bank I is in use at BBG */ - destination = ARM9Mem.ARM9_BBG + 0x8000 ; - break; - default: return ; - } + switch(block){ + case 0: + case 1: + case 2: + case 3: + /* banks are in use for BG at ABG + ofs * 0x20000 */ + destination = ARM9Mem.ARM9_ABG + ((VRAMBankCnt >> 3) & 3) * 0x20000 ; + break ; + case 4: + /* bank E is in use at ABG */ + destination = ARM9Mem.ARM9_ABG ; + break; + case 5: + case 6: + /* banks are in use for BG at ABG + (0x4000*OFS.0)+(0x10000*OFS.1)*/ + destination = ARM9Mem.ARM9_ABG + (((VRAMBankCnt >> 3) & 1) * 0x4000) + (((VRAMBankCnt >> 2) & 1) * 0x10000) ; + break; + case 8: + /* bank H is in use at BBG */ + destination = ARM9Mem.ARM9_BBG ; + break ; + case 9: + /* bank I is in use at BBG */ + destination = ARM9Mem.ARM9_BBG + 0x8000 ; + break; + default: return ; + } break ; case 4: - switch(block){ - case 2: - /* bank C is in use at BBG */ - destination = ARM9Mem.ARM9_BBG ; - break ; - case 3: - /* bank D is in use at BOBJ */ - destination = ARM9Mem.ARM9_BOBJ ; - break ; - default: return ; - } + switch(block){ + case 2: + /* bank C is in use at BBG */ + destination = ARM9Mem.ARM9_BBG ; + break ; + case 3: + /* bank D is in use at BOBJ */ + destination = ARM9Mem.ARM9_BOBJ ; + break ; + default: return ; + } break ; default: return ; @@ -502,45 +529,47 @@ void MMU_setRom(u8 * rom, u32 mask) { - unsigned int i; - MMU.CART_ROM = rom; - - for(i = 0x80; i<0xA0; ++i) - { - MMU_ARM9_MEM_MAP[i] = rom; - MMU_ARM7_MEM_MAP[i] = rom; - MMU_ARM9_MEM_MASK[i] = mask; - MMU_ARM7_MEM_MASK[i] = mask; - } - rom_mask = mask; + unsigned int i; + MMU.CART_ROM = rom; + + for(i = 0x80; i<0xA0; ++i) + { + MMU_ARM9_MEM_MAP[i] = rom; + MMU_ARM7_MEM_MAP[i] = rom; + MMU_ARM9_MEM_MASK[i] = mask; + MMU_ARM7_MEM_MASK[i] = mask; + } + rom_mask = mask; } void MMU_unsetRom() { - unsigned int i; - MMU.CART_ROM=MMU.UNUSED_RAM; - - for(i = 0x80; i<0xA0; ++i) - { - MMU_ARM9_MEM_MAP[i] = MMU.UNUSED_RAM; - MMU_ARM7_MEM_MAP[i] = MMU.UNUSED_RAM; - MMU_ARM9_MEM_MASK[i] = ROM_MASK; - MMU_ARM7_MEM_MASK[i] = ROM_MASK; - } - rom_mask = ROM_MASK; + unsigned int i; + MMU.CART_ROM=MMU.UNUSED_RAM; + + for(i = 0x80; i<0xA0; ++i) + { + MMU_ARM9_MEM_MAP[i] = MMU.UNUSED_RAM; + MMU_ARM7_MEM_MAP[i] = MMU.UNUSED_RAM; + MMU_ARM9_MEM_MASK[i] = ROM_MASK; + MMU_ARM7_MEM_MASK[i] = ROM_MASK; + } + rom_mask = ROM_MASK; } char txt[80]; u8 FASTCALL MMU_read8(u32 proc, u32 adr) { +#ifdef INTERNAL_DTCM_READ if((proc==ARMCPU_ARM9)&((adr&(~0x3FFF))==MMU.DTCMRegion)) { return ARM9Mem.ARM9_DTCM[adr&0x3FFF]; } +#endif // CFlash reading, Mic if ((adr>=0x9000000)&&(adr<0x9900000)) - return (unsigned char)cflash_read(adr); + return (unsigned char)cflash_read(adr); #ifdef EXPERIMENTAL_WIFI /* wifi mac access */ @@ -553,37 +582,20 @@ } #endif - adr &= 0x0FFFFFFF; - - switch(adr) - { - case 0x027FFCDC : - return 0x20; - case 0x027FFCDD : - return 0x20; - case 0x027FFCE2 : - //execute = FALSE; - return 0xE0; - case 0x027FFCE3 : - return 0x80; - /*case REG_POSTFLG : - return 1; - case REG_IME : - execute = FALSE;*/ - default : - return MMU.MMU_MEM[proc][(adr>>20)&0xFF][adr&MMU.MMU_MASK[proc][(adr>>20)&0xFF]]; - } + return MMU.MMU_MEM[proc][(adr>>20)&0xFF][adr&MMU.MMU_MASK[proc][(adr>>20)&0xFF]]; } u16 FASTCALL MMU_read16(u32 proc, u32 adr) { +#ifdef INTERNAL_DTCM_READ if((proc == ARMCPU_ARM9) && ((adr & ~0x3FFF) == MMU.DTCMRegion)) { /* Returns data from DTCM (ARM9 only) */ return T1ReadWord(ARM9Mem.ARM9_DTCM, adr & 0x3FFF); } +#endif // CFlash reading, Mic if ((adr>=0x08800000)&&(adr<0x09900000)) @@ -597,12 +609,17 @@ adr &= 0x0FFFFFFF; - if((adr>>24)==4) + if(adr&0x04000000) { /* Adress is an IO register */ switch(adr) { - case REG_IPCFIFORECV : /* TODO (clear): ??? */ + case 0x04000604: + return (gpu3D->NDS_3D_GetNumPolys()&2047); + case 0x04000606: + return (gpu3D->NDS_3D_GetNumVertex()&8191); + + case REG_IPCFIFORECV : /* TODO (clear): ??? */ execute = FALSE; return 1; @@ -619,45 +636,22 @@ case REG_IF + 2 : return (u16)(MMU.reg_IF[proc]>>16); - case REG_TM0CNTL : - case REG_TM1CNTL : - case REG_TM2CNTL : - case REG_TM3CNTL : + case REG_TM0CNTL : + case REG_TM1CNTL : + case REG_TM2CNTL : + case REG_TM3CNTL : return MMU.timer[proc][(adr&0xF)>>2]; case 0x04000630 : LOG("vect res\r\n"); /* TODO (clear): ??? */ //execute = FALSE; return 0; - //case 0x27FFFAA : - //case 0x27FFFAC : - /*case 0x2330F84 : - if(click) execute = FALSE;*/ - //case 0x27FF018 : execute = FALSE; case REG_POSTFLG : return 1; default : break; } } - else - { - /* TODO (clear): i don't known what are these 'registers', perhaps reset vectors ... */ - switch(adr) - { - case 0x027FFCD8 : - return (0x20<<4); - case 0x027FFCDA : - return (0x20<<4); - case 0x027FFCDE : - return (0xE0<<4); - case 0x027FFCE0 : - //execute = FALSE; - return (0x80<<4); - default : - break; - } - } /* Returns data from memory */ return T1ReadWord(MMU.MMU_MEM[proc][(adr >> 20) & 0xFF], adr & MMU.MMU_MASK[proc][(adr >> 20) & 0xFF]); @@ -665,11 +659,13 @@ u32 FASTCALL MMU_read32(u32 proc, u32 adr) { +#ifdef INTERNAL_DTCM_READ if((proc == ARMCPU_ARM9) && ((adr & ~0x3FFF) == MMU.DTCMRegion)) { /* Returns data from DTCM (ARM9 only) */ return T1ReadLong(ARM9Mem.ARM9_DTCM, adr & 0x3FFF); } +#endif // CFlash reading, Mic if ((adr>=0x9000000)&&(adr<0x9900000)) @@ -682,10 +678,61 @@ /* Adress is an IO register */ switch(adr) { - #ifdef RENDER3D - case 0x04000600 : - return ((OGLRender::nbpush[0]&1)<<13) | ((OGLRender::nbpush[2]&0x1F)<<8); - #endif + // This is hacked due to the only current 3D core + case 0x04000600: + { + u32 fifonum = IPCFIFO+proc; + + u32 gxstat = (MMU.fifos[fifonum].empty<<26) | + (1<<25) | + (MMU.fifos[fifonum].full<<24) | + /*((NDS_nbpush[0]&1)<<13) | ((NDS_nbpush[2]&0x1F)<<8) |*/ + 2; + + LOG ("GXSTAT: 0x%X", gxstat); + + return gxstat; + } + + case 0x04000640: + case 0x04000644: + case 0x04000648: + case 0x0400064C: + case 0x04000650: + case 0x04000654: + case 0x04000658: + case 0x0400065C: + case 0x04000660: + case 0x04000664: + case 0x04000668: + case 0x0400066C: + case 0x04000670: + case 0x04000674: + case 0x04000678: + case 0x0400067C: + { + //LOG("4000640h..67Fh - CLIPMTX_RESULT - Read Current Clip Coordinates Matrix (R)"); + return gpu3D->NDS_3D_GetClipMatrix ((adr-0x04000640)/4); + } + case 0x04000680: + case 0x04000684: + case 0x04000688: + case 0x0400068C: + case 0x04000690: + case 0x04000694: + case 0x04000698: + case 0x0400069C: + case 0x040006A0: + { + //LOG("4000680h..6A3h - VECMTX_RESULT - Read Current Directional Vector Matrix (R)"); + return gpu3D->NDS_3D_GetDirectionalMatrix ((adr-0x04000680)/4); + } + + case 0x4000604: + { + return (gpu3D->NDS_3D_GetNumPolys()&2047) & ((gpu3D->NDS_3D_GetNumVertex()&8191) << 16); + //LOG ("read32 - RAM_COUNT -> 0x%X", ((u32 *)(MMU.MMU_MEM[proc][(adr>>20)&0xFF]))[(adr&MMU.MMU_MASK[proc][(adr>>20)&0xFF])>>2]); + } case REG_IME : return MMU.reg_IME[proc]; @@ -693,7 +740,7 @@ return MMU.reg_IE[proc]; case REG_IF : return MMU.reg_IF[proc]; - case REG_IPCFIFORECV : + case REG_IPCFIFORECV : { u16 IPCFIFO_CNT = T1ReadWord(MMU.MMU_MEM[proc][0x40], 0x184); if(IPCFIFO_CNT&0x8000) @@ -721,7 +768,8 @@ u32 val = T1ReadWord(MMU.MMU_MEM[proc][0x40], (adr + 2) & 0xFFF); return MMU.timer[proc][(adr&0xF)>>2] | (val<<16); } - case 0x04000640 : /* TODO (clear): again, ??? */ + /* + case 0x04000640 : // TODO (clear): again, ??? LOG("read proj\r\n"); return 0; case 0x04000680 : @@ -730,7 +778,7 @@ case 0x04000620 : LOG("point res\r\n"); return 0; - + */ case REG_GCDATAIN: { u32 val; @@ -773,12 +821,14 @@ void FASTCALL MMU_write8(u32 proc, u32 adr, u8 val) { +#ifdef INTERNAL_DTCM_WRITE if((proc == ARMCPU_ARM9) && ((adr & ~0x3FFF) == MMU.DTCMRegion)) { /* Writes data in DTCM (ARM9 only) */ ARM9Mem.ARM9_DTCM[adr&0x3FFF] = val; return ; } +#endif // CFlash writing, Mic if ((adr>=0x9000000)&&(adr<0x9900000)) { @@ -807,6 +857,119 @@ switch(adr) { + case REG_DISPA_WIN0H: + if(proc == ARMCPU_ARM9) GPU_setWIN0_H1 (MainScreen.gpu, val); + break ; + case REG_DISPA_WIN0H+1: + if(proc == ARMCPU_ARM9) GPU_setWIN0_H0 (MainScreen.gpu, val); + break ; + case REG_DISPA_WIN1H: + if(proc == ARMCPU_ARM9) GPU_setWIN1_H1 (MainScreen.gpu,val); + break ; + case REG_DISPA_WIN1H+1: + if(proc == ARMCPU_ARM9) GPU_setWIN1_H0 (MainScreen.gpu,val); + break ; + + case REG_DISPB_WIN0H: + if(proc == ARMCPU_ARM9) GPU_setWIN0_H1(SubScreen.gpu,val); + break ; + case REG_DISPB_WIN0H+1: + if(proc == ARMCPU_ARM9) GPU_setWIN0_H0(SubScreen.gpu,val); + break ; + case REG_DISPB_WIN1H: + if(proc == ARMCPU_ARM9) GPU_setWIN1_H1(SubScreen.gpu,val); + break ; + case REG_DISPB_WIN1H+1: + if(proc == ARMCPU_ARM9) GPU_setWIN1_H0(SubScreen.gpu,val); + break ; + + case REG_DISPA_WIN0V: + if(proc == ARMCPU_ARM9) GPU_setWIN0_V1(MainScreen.gpu,val) ; + break ; + case REG_DISPA_WIN0V+1: + if(proc == ARMCPU_ARM9) GPU_setWIN0_V0(MainScreen.gpu,val) ; + break ; + case REG_DISPA_WIN1V: + if(proc == ARMCPU_ARM9) GPU_setWIN1_V1(MainScreen.gpu,val) ; + break ; + case REG_DISPA_WIN1V+1: + if(proc == ARMCPU_ARM9) GPU_setWIN1_V0(MainScreen.gpu,val) ; + break ; + + case REG_DISPB_WIN0V: + if(proc == ARMCPU_ARM9) GPU_setWIN0_V1(SubScreen.gpu,val) ; + break ; + case REG_DISPB_WIN0V+1: + if(proc == ARMCPU_ARM9) GPU_setWIN0_V0(SubScreen.gpu,val) ; + break ; + case REG_DISPB_WIN1V: + if(proc == ARMCPU_ARM9) GPU_setWIN1_V1(SubScreen.gpu,val) ; + break ; + case REG_DISPB_WIN1V+1: + if(proc == ARMCPU_ARM9) GPU_setWIN1_V0(SubScreen.gpu,val) ; + break ; + + case REG_DISPA_WININ: + if(proc == ARMCPU_ARM9) GPU_setWININ0(MainScreen.gpu,val) ; + break ; + case REG_DISPA_WININ+1: + if(proc == ARMCPU_ARM9) GPU_setWININ1(MainScreen.gpu,val) ; + break ; + case REG_DISPA_WINOUT: + if(proc == ARMCPU_ARM9) GPU_setWINOUT(MainScreen.gpu,val) ; + break ; + case REG_DISPA_WINOUT+1: + if(proc == ARMCPU_ARM9) GPU_setWINOBJ(MainScreen.gpu,val); + break ; + + case REG_DISPB_WININ: + if(proc == ARMCPU_ARM9) GPU_setWININ0(SubScreen.gpu,val) ; + break ; + case REG_DISPB_WININ+1: + if(proc == ARMCPU_ARM9) GPU_setWININ1(SubScreen.gpu,val) ; + break ; + case REG_DISPB_WINOUT: + if(proc == ARMCPU_ARM9) GPU_setWINOUT(SubScreen.gpu,val) ; + break ; + case REG_DISPB_WINOUT+1: + if(proc == ARMCPU_ARM9) GPU_setWINOBJ(SubScreen.gpu,val) ; + break ; + + + case REG_DISPA_BLDCNT: + if(proc == ARMCPU_ARM9) GPU_setBLDCNT_HIGH(MainScreen.gpu,val); + break; + case REG_DISPA_BLDCNT+1: + if(proc == ARMCPU_ARM9) GPU_setBLDCNT_LOW (MainScreen.gpu,val); + break; + + case REG_DISPB_BLDCNT: + if(proc == ARMCPU_ARM9) GPU_setBLDCNT_HIGH (SubScreen.gpu,val); + break; + case REG_DISPB_BLDCNT+1: + if(proc == ARMCPU_ARM9) GPU_setBLDCNT_LOW (SubScreen.gpu,val); + break; + + case REG_DISPA_BLDALPHA: + if(proc == ARMCPU_ARM9) GPU_setBLDALPHA_EVB(MainScreen.gpu,val) ; + break; + case REG_DISPA_BLDALPHA+1: + if(proc == ARMCPU_ARM9) GPU_setBLDALPHA_EVA(MainScreen.gpu,val) ; + break; + + case REG_DISPB_BLDALPHA: + if(proc == ARMCPU_ARM9) GPU_setBLDALPHA_EVB(SubScreen.gpu,val) ; + break; + case REG_DISPB_BLDALPHA+1: + if(proc == ARMCPU_ARM9) GPU_setBLDALPHA_EVA(SubScreen.gpu,val); + break; + + case REG_DISPA_BLDY: + if(proc == ARMCPU_ARM9) GPU_setBLDY_EVY(MainScreen.gpu,val) ; + break ; + case REG_DISPB_BLDY: + if(proc == ARMCPU_ARM9) GPU_setBLDY_EVY(SubScreen.gpu,val) ; + break; /* TODO: EEEK ! Controls for VRAMs A, B, C, D are missing ! */ /* TODO: Not all mappings of VRAMs are handled... (especially BG and OBJ modes) */ @@ -842,13 +1005,29 @@ MMU.vram_mode[adr-REG_VRAMCNTA] = 4 | (adr-REG_VRAMCNTA) ; break ; } + /* + * FIXME: simply texture slot handling + * This is a first stab and is not correct. It does + * not handle a VRAM texture slot becoming + * unconfigured. + * Revisit all of VRAM control handling for future + * release? + */ + if ( val & 0x80) { + if ( (val & 0x7) == 3) { + int slot_index = (val >> 3) & 0x3; + + ARM9Mem.textureSlotAddr[slot_index] = + &ARM9Mem.ARM9_LCD[0x20000 * (adr - REG_VRAMCNTA)]; + } + } MMU_VRAMReloadFromLCD(adr-REG_VRAMCNTA,val) ; } break; case REG_VRAMCNTE : if(proc == ARMCPU_ARM9) { - MMU_VRAMWriteBackToLCD(REG_VRAMCNTE) ; + MMU_VRAMWriteBackToLCD((u8)REG_VRAMCNTE) ; if((val & 7) == 5) { ARM9Mem.ExtPal[0][0] = ARM9Mem.ARM9_LCD + 0x80000; @@ -961,7 +1140,7 @@ case REG_VRAMCNTH : if(proc == ARMCPU_ARM9) { - MMU_VRAMWriteBackToLCD(REG_VRAMCNTH) ; + MMU_VRAMWriteBackToLCD((u8)REG_VRAMCNTH) ; if((val & 7) == 2) { @@ -978,7 +1157,7 @@ case REG_VRAMCNTI : if(proc == ARMCPU_ARM9) { - MMU_VRAMWriteBackToLCD(REG_VRAMCNTI) ; + MMU_VRAMWriteBackToLCD((u8)REG_VRAMCNTI) ; if((val & 7) == 3) { @@ -989,90 +1168,6 @@ MMU_VRAMReloadFromLCD(adr-REG_VRAMCNTI,val) ; } break; - case REG_DISPA_WIN0H: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(MainScreen.gpu,val,0) ; - break ; - case REG_DISPA_WIN0H+1: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(MainScreen.gpu,val,1) ; - break ; - case REG_DISPA_WIN1H: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(MainScreen.gpu,val,2) ; - break ; - case REG_DISPA_WIN1H+1: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(MainScreen.gpu,val,3) ; - break ; - case REG_DISPB_WIN0H: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(SubScreen.gpu,val,0) ; - break ; - case REG_DISPB_WIN0H+1: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(SubScreen.gpu,val,1) ; - break ; - case REG_DISPB_WIN1H: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(SubScreen.gpu,val,2) ; - break ; - case REG_DISPB_WIN1H+1: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM_Component(SubScreen.gpu,val,3) ; - break ; - case REG_DISPA_WIN0V: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(MainScreen.gpu,val,0) ; - break ; - case REG_DISPA_WIN0V+1: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(MainScreen.gpu,val,1) ; - break ; - case REG_DISPA_WIN1V: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(MainScreen.gpu,val,2) ; - break ; - case REG_DISPA_WIN1V+1: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(MainScreen.gpu,val,3) ; - break ; - case REG_DISPB_WIN0V: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(SubScreen.gpu,val,0) ; - break ; - case REG_DISPB_WIN0V+1: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(SubScreen.gpu,val,1) ; - break ; - case REG_DISPB_WIN1V: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(SubScreen.gpu,val,2) ; - break ; - case REG_DISPB_WIN1V+1: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM_Component(SubScreen.gpu,val,3) ; - break ; - case REG_DISPA_WININ: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_INCNT_Component(MainScreen.gpu,val,0) ; - break ; - case REG_DISPA_WININ+1: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_INCNT_Component(MainScreen.gpu,val,1) ; - break ; - case REG_DISPA_WINOUT: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_OUTCNT_Component(MainScreen.gpu,val,0) ; - break ; - case REG_DISPA_WINOUT+1: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_OUTCNT_Component(MainScreen.gpu,val,1) ; - break ; - case REG_DISPB_WININ: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_INCNT_Component(SubScreen.gpu,val,0) ; - break ; - case REG_DISPB_WININ+1: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_INCNT_Component(SubScreen.gpu,val,1) ; - break ; - case REG_DISPB_WINOUT: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_OUTCNT_Component(SubScreen.gpu,val,0) ; - break ; - case REG_DISPB_WINOUT+1: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_OUTCNT_Component(SubScreen.gpu,val,1) ; - break ; - case REG_DISPA_MASTERBRIGHT: - if(proc == ARMCPU_ARM9) GPU_setMASTER_BRIGHT (MainScreen.gpu, (val & 0xFF) | (T1ReadWord((u16 *)REG_DISPA_MASTERBRIGHT,0) & 0xFF00)); - break; - case REG_DISPA_MASTERBRIGHT+1: - if(proc == ARMCPU_ARM9) GPU_setMASTER_BRIGHT (MainScreen.gpu, (val & 0xFF00) | (T1ReadWord((u16 *)REG_DISPA_MASTERBRIGHT,0) & 0xFF)); - break; - case REG_DISPB_MASTERBRIGHT: - if(proc == ARMCPU_ARM9) GPU_setMASTER_BRIGHT (SubScreen.gpu, (val & 0xFF) | (T1ReadWord((u16 *)REG_DISPB_MASTERBRIGHT,0) & 0xFF00)); - break; - case REG_DISPB_MASTERBRIGHT+1: - if(proc == ARMCPU_ARM9) GPU_setMASTER_BRIGHT (SubScreen.gpu, (val & 0xFF00) | (T1ReadWord((u16 *)REG_DISPB_MASTERBRIGHT,0) & 0xFF)); - break; #ifdef LOG_CARD case 0x040001A0 : /* TODO (clear): ??? */ @@ -1100,12 +1195,14 @@ void FASTCALL MMU_write16(u32 proc, u32 adr, u16 val) { +#ifdef INTERNAL_DTCM_WRITE if((proc == ARMCPU_ARM9) && ((adr & ~0x3FFF) == MMU.DTCMRegion)) { /* Writes in DTCM (ARM9 only) */ T1WriteWord(ARM9Mem.ARM9_DTCM, adr & 0x3FFF, val); return; } +#endif // CFlash writing, Mic if ((adr>=0x08800000)&&(adr<0x09900000)) @@ -1144,32 +1241,115 @@ /* Adress is an IO register */ switch(adr) { - #ifdef RENDER3D - case 0x04000610 : + case 0x0400035C: + { + ((u16 *)(MMU.MMU_MEM[proc][0x40]))[0x35C>>1] = val; if(proc == ARMCPU_ARM9) { - LOG("CUT DEPTH %08X\r\n", val); + gpu3D->NDS_3D_FogOffset (val); } return; - case 0x04000340 : + } + case 0x04000340: + { + ((u16 *)(MMU.MMU_MEM[proc][0x40]))[0x340>>1] = val; if(proc == ARMCPU_ARM9) { - OGLRender::glAlphaFunc(val); + gpu3D->NDS_3D_AlphaFunc(val); } return; - case REG_DISPA_DISP3DCNT : + } + case 0x04000060: + { + ((u16 *)(MMU.MMU_MEM[proc][0x40]))[0x060>>1] = val; if(proc == ARMCPU_ARM9) { - OGLRender::glControl(val); + gpu3D->NDS_3D_Control(val); } return; - case 0x04000354 : + } + case 0x04000354: + { + ((u16 *)(MMU.MMU_MEM[proc][0x40]))[0x354>>1] = val; if(proc == ARMCPU_ARM9) - OGLRender::glClearDepth(val); + { + gpu3D->NDS_3D_ClearDepth(val); + } return; - #endif + } + + case REG_DISPA_BLDCNT: + if(proc == ARMCPU_ARM9) GPU_setBLDCNT(MainScreen.gpu,val) ; + break ; + case REG_DISPB_BLDCNT: + if(proc == ARMCPU_ARM9) GPU_setBLDCNT(SubScreen.gpu,val) ; + break ; + case REG_DISPA_BLDALPHA: + if(proc == ARMCPU_ARM9) GPU_setBLDALPHA(MainScreen.gpu,val) ; + break ; + case REG_DISPB_BLDALPHA: + if(proc == ARMCPU_ARM9) GPU_setBLDALPHA(SubScreen.gpu,val) ; + break ; + case REG_DISPA_BLDY: + if(proc == ARMCPU_ARM9) GPU_setBLDY_EVY(MainScreen.gpu,val) ; + break ; + case REG_DISPB_BLDY: + if(proc == ARMCPU_ARM9) GPU_setBLDY_EVY(SubScreen.gpu,val) ; + break; + case REG_DISPA_MASTERBRIGHT: + GPU_setMasterBrightness (MainScreen.gpu, val); + break; + /* + case REG_DISPA_MOSAIC: + if(proc == ARMCPU_ARM9) GPU_setMOSAIC(MainScreen.gpu,val) ; + break ; + case REG_DISPB_MOSAIC: + if(proc == ARMCPU_ARM9) GPU_setMOSAIC(SubScreen.gpu,val) ; + break ; + */ + + case REG_DISPA_WIN0H: + if(proc == ARMCPU_ARM9) GPU_setWIN0_H (MainScreen.gpu,val) ; + break ; + case REG_DISPA_WIN1H: + if(proc == ARMCPU_ARM9) GPU_setWIN1_H(MainScreen.gpu,val) ; + break ; + case REG_DISPB_WIN0H: + if(proc == ARMCPU_ARM9) GPU_setWIN0_H(SubScreen.gpu,val) ; + break ; + case REG_DISPB_WIN1H: + if(proc == ARMCPU_ARM9) GPU_setWIN1_H(SubScreen.gpu,val) ; + break ; + case REG_DISPA_WIN0V: + if(proc == ARMCPU_ARM9) GPU_setWIN0_V(MainScreen.gpu,val) ; + break ; + case REG_DISPA_WIN1V: + if(proc == ARMCPU_ARM9) GPU_setWIN1_V(MainScreen.gpu,val) ; + break ; + case REG_DISPB_WIN0V: + if(proc == ARMCPU_ARM9) GPU_setWIN0_V(SubScreen.gpu,val) ; + break ; + case REG_DISPB_WIN1V: + if(proc == ARMCPU_ARM9) GPU_setWIN1_V(SubScreen.gpu,val) ; + break ; + case REG_DISPA_WININ: + if(proc == ARMCPU_ARM9) GPU_setWININ(MainScreen.gpu, val) ; + break ; + case REG_DISPA_WINOUT: + if(proc == ARMCPU_ARM9) GPU_setWINOUT16(MainScreen.gpu, val) ; + break ; + case REG_DISPB_WININ: + if(proc == ARMCPU_ARM9) GPU_setWININ(SubScreen.gpu, val) ; + break ; + case REG_DISPB_WINOUT: + if(proc == ARMCPU_ARM9) GPU_setWINOUT16(SubScreen.gpu, val) ; + break ; + + case REG_DISPB_MASTERBRIGHT: + GPU_setMasterBrightness (SubScreen.gpu, val); + break; - case REG_POWCNT1 : + case REG_POWCNT1 : if(proc == ARMCPU_ARM9) { if(val & (1<<15)) @@ -1209,11 +1389,23 @@ case REG_SPICNT : if(proc == ARMCPU_ARM7) { - SPI_CNT = val; + int reset_firmware = 1; + + if ( ((SPI_CNT >> 8) & 0x3) == 1) { + if ( ((val >> 8) & 0x3) == 1) { + if ( BIT11(SPI_CNT)) { + /* select held */ + reset_firmware = 0; + } + } + } //MMU.fw.com == 0; /* reset fw device communication */ - - mc_reset_com(&MMU.fw); /* reset fw device communication */ + if ( reset_firmware) { + /* reset fw device communication */ + mc_reset_com(&MMU.fw); + } + SPI_CNT = val; } T1WriteWord(MMU.MMU_MEM[proc][(REG_SPICNT >> 20) & 0xff], REG_SPICNT & 0xfff, val); @@ -1243,6 +1435,7 @@ break; } T1WriteWord(MMU.MMU_MEM[proc][(REG_SPIDATA >> 20) & 0xff], REG_SPIDATA & 0xfff, fw_transfer(&MMU.fw, val)); + return; case 2 : @@ -1314,150 +1507,6 @@ /* NOTICE: Perhaps we have to use gbatek-like reg names instead of libnds-like ones ...*/ - case REG_DISPA_BG0HOFS : - if(proc == ARMCPU_ARM9) GPU_scrollX(MainScreen.gpu, 0, val); - return; - case REG_DISPA_BG1HOFS : - if(proc == ARMCPU_ARM9) GPU_scrollX(MainScreen.gpu, 1, val); - return; - case REG_DISPA_BG2HOFS : - if(proc == ARMCPU_ARM9) GPU_scrollX(MainScreen.gpu, 2, val); - return; - case REG_DISPA_BG3HOFS : - if(proc == ARMCPU_ARM9) GPU_scrollX(MainScreen.gpu, 3, val); - return; - case REG_DISPB_BG0HOFS : - if(proc == ARMCPU_ARM9) GPU_scrollX(SubScreen.gpu, 0, val); - return; - case REG_DISPB_BG1HOFS : - if(proc == ARMCPU_ARM9) GPU_scrollX(SubScreen.gpu, 1, val); - return; - case REG_DISPB_BG2HOFS : - if(proc == ARMCPU_ARM9) GPU_scrollX(SubScreen.gpu, 2, val); - return; - case REG_DISPB_BG3HOFS : - if(proc == ARMCPU_ARM9) GPU_scrollX(SubScreen.gpu, 3, val); - return; - case REG_DISPA_BG0VOFS : - if(proc == ARMCPU_ARM9) GPU_scrollY(MainScreen.gpu, 0, val); - return; - case REG_DISPA_BG1VOFS : - if(proc == ARMCPU_ARM9) GPU_scrollY(MainScreen.gpu, 1, val); - return; - case REG_DISPA_BG2VOFS : - if(proc == ARMCPU_ARM9) GPU_scrollY(MainScreen.gpu, 2, val); - return; - case REG_DISPA_BG3VOFS : - if(proc == ARMCPU_ARM9) GPU_scrollY(MainScreen.gpu, 3, val); - return; - case REG_DISPB_BG0VOFS : - if(proc == ARMCPU_ARM9) GPU_scrollY(SubScreen.gpu, 0, val); - return; - case REG_DISPB_BG1VOFS : - if(proc == ARMCPU_ARM9) GPU_scrollY(SubScreen.gpu, 1, val); - return; - case REG_DISPB_BG2VOFS : - if(proc == ARMCPU_ARM9) GPU_scrollY(SubScreen.gpu, 2, val); - return; - case REG_DISPB_BG3VOFS : - if(proc == ARMCPU_ARM9) GPU_scrollY(SubScreen.gpu, 3, val); - return; - case REG_DISPA_BG2PA : - if(proc == ARMCPU_ARM9) GPU_setPA(MainScreen.gpu, 2, val); - return; - case REG_DISPA_BG2PB : - if(proc == ARMCPU_ARM9) GPU_setPB(MainScreen.gpu, 2, val); - return; - case REG_DISPA_BG2PC : - if(proc == ARMCPU_ARM9) GPU_setPC(MainScreen.gpu, 2, val); - return; - case REG_DISPA_BG2PD : - if(proc == ARMCPU_ARM9) GPU_setPD(MainScreen.gpu, 2, val); - return; - case REG_DISPB_BG2PA : - if(proc == ARMCPU_ARM9) GPU_setPA(SubScreen.gpu, 2, val); - return; - case REG_DISPB_BG2PB : - if(proc == ARMCPU_ARM9) GPU_setPB(SubScreen.gpu, 2, val); - return; - case REG_DISPB_BG2PC : - if(proc == ARMCPU_ARM9) GPU_setPC(SubScreen.gpu, 2, val); - return; - case REG_DISPB_BG2PD : - if(proc == ARMCPU_ARM9) GPU_setPD(SubScreen.gpu, 2, val); - return; - case REG_DISPA_BG3PA : - if(proc == ARMCPU_ARM9) GPU_setPA(MainScreen.gpu, 3, val); - return; - case REG_DISPA_BG3PB : - if(proc == ARMCPU_ARM9) GPU_setPB(MainScreen.gpu, 3, val); - return; - case REG_DISPA_BG3PC : - if(proc == ARMCPU_ARM9) GPU_setPC(MainScreen.gpu, 3, val); - return; - case REG_DISPA_BG3PD : - if(proc == ARMCPU_ARM9) GPU_setPD(MainScreen.gpu, 3, val); - return; - case REG_DISPB_BG3PA : - if(proc == ARMCPU_ARM9) GPU_setPA(SubScreen.gpu, 3, val); - return; - case REG_DISPB_BG3PB : - if(proc == ARMCPU_ARM9) GPU_setPB(SubScreen.gpu, 3, val); - return; - case REG_DISPB_BG3PC : - if(proc == ARMCPU_ARM9) GPU_setPC(SubScreen.gpu, 3, val); - return; - case REG_DISPB_BG3PD : - if(proc == ARMCPU_ARM9) GPU_setPD(SubScreen.gpu, 3, val); - return; - case REG_DISPA_BG2XL : - if(proc == ARMCPU_ARM9) GPU_setXL(MainScreen.gpu, 2, val); - return; - case REG_DISPA_BG2XH : - if(proc == ARMCPU_ARM9) GPU_setXH(MainScreen.gpu, 2, val); - return; - case REG_DISPB_BG2XL : - if(proc == ARMCPU_ARM9) GPU_setXL(SubScreen.gpu, 2, val); - return; - case REG_DISPB_BG2XH : - if(proc == ARMCPU_ARM9) GPU_setXH(SubScreen.gpu, 2, val); - return; - case REG_DISPA_BG3XL : - if(proc == ARMCPU_ARM9) GPU_setXL(MainScreen.gpu, 3, val); - return; - case REG_DISPA_BG3XH : - if(proc == ARMCPU_ARM9) GPU_setXH(MainScreen.gpu, 3, val); - return; - case REG_DISPB_BG3XL : - if(proc == ARMCPU_ARM9) GPU_setXL(SubScreen.gpu, 3, val); - return; - case REG_DISPB_BG3XH : - if(proc == ARMCPU_ARM9) GPU_setXH(SubScreen.gpu, 3, val); - return; - case REG_DISPA_BG2YL : - if(proc == ARMCPU_ARM9) GPU_setYL(MainScreen.gpu, 2, val); - return; - case REG_DISPA_BG2YH : - if(proc == ARMCPU_ARM9) GPU_setYH(MainScreen.gpu, 2, val); - return; - case REG_DISPB_BG2YL : - if(proc == ARMCPU_ARM9) GPU_setYL(SubScreen.gpu, 2, val); - return; - case REG_DISPB_BG2YH : - if(proc == ARMCPU_ARM9) GPU_setYH(SubScreen.gpu, 2, val); - return; - case REG_DISPA_BG3YL : - if(proc == ARMCPU_ARM9) GPU_setYL(MainScreen.gpu, 3, val); - return; - case REG_DISPA_BG3YH : - if(proc == ARMCPU_ARM9) GPU_setYH(MainScreen.gpu, 3, val); - return; - case REG_DISPB_BG3YL : - if(proc == ARMCPU_ARM9) GPU_setYL(SubScreen.gpu, 3, val); - return; - case REG_DISPB_BG3YH : - if(proc == ARMCPU_ARM9) GPU_setYH(SubScreen.gpu, 3, val); - return; case REG_DISPA_BG0CNT : //GPULOG("MAIN BG0 SETPROP 16B %08X\r\n", val); if(proc == ARMCPU_ARM9) GPU_setBGProp(MainScreen.gpu, 0, val); @@ -1498,76 +1547,20 @@ if(proc == ARMCPU_ARM9) GPU_setBGProp(SubScreen.gpu, 3, val); T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x100E, val); return; - case REG_DISPA_BLDCNT: - if(proc == ARMCPU_ARM9) GPU_setBLDCNT(MainScreen.gpu,val) ; - break ; - case REG_DISPB_BLDCNT: - if(proc == ARMCPU_ARM9) GPU_setBLDCNT(SubScreen.gpu,val) ; - break ; - case REG_DISPA_BLDALPHA: - if(proc == ARMCPU_ARM9) GPU_setBLDALPHA(MainScreen.gpu,val) ; - break ; - case REG_DISPB_BLDALPHA: - if(proc == ARMCPU_ARM9) GPU_setBLDALPHA(SubScreen.gpu,val) ; - break ; - case REG_DISPA_BLDY: - if(proc == ARMCPU_ARM9) GPU_setBLDY(MainScreen.gpu,val) ; - break ; - case REG_DISPB_BLDY: - if(proc == ARMCPU_ARM9) GPU_setBLDY(SubScreen.gpu,val) ; - break ; - case REG_DISPA_MOSAIC: - if(proc == ARMCPU_ARM9) GPU_setMOSAIC(MainScreen.gpu,val) ; - break ; - case REG_DISPB_MOSAIC: - if(proc == ARMCPU_ARM9) GPU_setMOSAIC(SubScreen.gpu,val) ; - break ; - case REG_DISPA_MASTERBRIGHT: - if(proc == ARMCPU_ARM9) GPU_setMASTER_BRIGHT (MainScreen.gpu, val); - break; - case REG_DISPB_MASTERBRIGHT: - if(proc == ARMCPU_ARM9) GPU_setMASTER_BRIGHT (SubScreen.gpu, val); - break; - case REG_DISPA_WIN0H: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM(MainScreen.gpu,val,0) ; - break ; - case REG_DISPA_WIN1H: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM(MainScreen.gpu,val,1) ; - break ; - case REG_DISPB_WIN0H: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM(SubScreen.gpu,val,0) ; - break ; - case REG_DISPB_WIN1H: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_XDIM(SubScreen.gpu,val,1) ; - break ; - case REG_DISPA_WIN0V: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM(MainScreen.gpu,val,0) ; - break ; - case REG_DISPA_WIN1V: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM(MainScreen.gpu,val,1) ; - break ; - case REG_DISPB_WIN0V: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM(SubScreen.gpu,val,0) ; - break ; - case REG_DISPB_WIN1V: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_YDIM(SubScreen.gpu,val,1) ; - break ; - case REG_DISPA_WININ: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_INCNT(MainScreen.gpu, val) ; - break ; - case REG_DISPA_WINOUT: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_OUTCNT(MainScreen.gpu, val) ; - break ; - case REG_DISPB_WININ: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_INCNT(SubScreen.gpu, val) ; - break ; - case REG_DISPB_WINOUT: - if(proc == ARMCPU_ARM9) GPU_setWINDOW_OUTCNT(SubScreen.gpu, val) ; - break ; - case REG_IME : - MMU.reg_IME[proc] = val&1; - T1WriteWord(MMU.MMU_MEM[proc][0x40], 0x208, val); + case REG_IME : { + u32 old_val = MMU.reg_IME[proc]; + u32 new_val = val & 1; + MMU.reg_IME[proc] = new_val; + T1WriteLong(MMU.MMU_MEM[proc][0x40], 0x208, val); + if ( new_val && old_val != new_val) { + /* raise an interrupt request to the CPU if needed */ + if ( MMU.reg_IE[proc] & MMU.reg_IF[proc]) { + NDS_ARM7.wIRQ = TRUE; + NDS_ARM7.waitIRQ = FALSE; + } + } return; + } case REG_VRAMCNTA: MMU_write8(proc,adr,val & 0xFF) ; MMU_write8(proc,adr+1,val >> 8) ; @@ -1590,6 +1583,13 @@ case REG_IE : MMU.reg_IE[proc] = (MMU.reg_IE[proc]&0xFFFF0000) | val; + if ( MMU.reg_IME[proc]) { + /* raise an interrupt request to the CPU if needed */ + if ( MMU.reg_IE[proc] & MMU.reg_IF[proc]) { + NDS_ARM7.wIRQ = TRUE; + NDS_ARM7.waitIRQ = FALSE; + } + } return; case REG_IE + 2 : execute = FALSE; @@ -1651,8 +1651,7 @@ case REG_TM3CNTH : if(val&0x80) { - if(!(val&4)) MMU.timer[proc][((adr-2)>>2)&0x3] = MMU.timerReload[proc][((adr-2)>>2)&0x3]; - else MMU.timer[proc][((adr-2)>>2)&0x3] = 0; + MMU.timer[proc][((adr-2)>>2)&0x3] = MMU.timerReload[proc][((adr-2)>>2)&0x3]; } MMU.timerON[proc][((adr-2)>>2)&0x3] = val & 0x80; switch(val&7) @@ -1814,15 +1813,16 @@ T1WriteWord(MMU.MMU_MEM[proc][(adr>>20)&0xFF], adr&MMU.MMU_MASK[proc][(adr>>20)&0xFF], val); } -u32 testval = 0; void FASTCALL MMU_write32(u32 proc, u32 adr, u32 val) { +#ifdef INTERNAL_DTCM_WRITE if((proc==ARMCPU_ARM9)&((adr&(~0x3FFF))==MMU.DTCMRegion)) { T1WriteLong(ARM9Mem.ARM9_DTCM, adr & 0x3FFF, val); return ; } +#endif // CFlash writing, Mic if ((adr>=0x9000000)&&(adr<0x9900000)) { @@ -1851,254 +1851,526 @@ if((adr>>24)==4) { - switch(adr) + if (adr >= 0x04000400 && adr < 0x04000440) { -#ifdef RENDER3D - case 0x040004AC : - T1WriteLong(MMU.MMU_MEM[proc][0x40], 0x4AC, val); + // Geometry commands (aka Dislay Lists) - Parameters:X + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x400>>2] = val; if(proc==ARMCPU_ARM9) - OGLRender::glTexImage2D(testval, TRUE); - //execute = FALSE; - return; - case 0x040004A8 : - if(proc==ARMCPU_ARM9) { - OGLRender::glTexImage2D(val, FALSE); - //execute = FALSE; - testval = val; + gpu3D->NDS_3D_CallList(val); } - return; - case 0x04000488 : - if(proc==ARMCPU_ARM9) + } + else + switch(adr) + { + // Alpha test reference value - Parameters:1 + case 0x04000340: { - OGLRender::glTexCoord(val); - //execute = FALSE; - } - return; - case 0x0400046C : - if(proc==ARMCPU_ARM9) - { - OGLRender::glScale(val); - } - return; - case 0x04000490 : - if(proc==ARMCPU_ARM9) + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x340>>2] = val; + if(proc == ARMCPU_ARM9) { - //GPULOG("VERTEX 10 %d\r\n",val); + gpu3D->NDS_3D_AlphaFunc(val); } return; - case 0x04000494 : - if(proc==ARMCPU_ARM9) + } + // Clear background color setup - Parameters:2 + case 0x04000350: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x350>>2] = val; + if(proc == ARMCPU_ARM9) { - //GPULOG(printf(txt, "VERTEXY %d\r\n",val); + gpu3D->NDS_3D_ClearColor(val); } return; - case 0x04000498 : - if(proc==ARMCPU_ARM9) + } + // Clear background depth setup - Parameters:2 + case 0x04000354: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x354>>2] = val; + if(proc == ARMCPU_ARM9) { - //GPULOG("VERTEXZ %d\r\n",val); + gpu3D->NDS_3D_ClearDepth(val); } return; - case 0x0400049C : - if(proc==ARMCPU_ARM9) + } + // Fog Color - Parameters:4b + case 0x04000358: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x358>>2] = val; + if(proc == ARMCPU_ARM9) { - //GPULOG("VERTEYZ %d\r\n",val); + gpu3D->NDS_3D_FogColor(val); } return; - case 0x04000400 : - if(proc==ARMCPU_ARM9) + } + case 0x0400035C: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x35C>>2] = val; + if(proc == ARMCPU_ARM9) { - OGLRender::glCallList(val); + gpu3D->NDS_3D_FogOffset(val); } return; - case 0x04000450 : + } + // Matrix mode - Parameters:1 + case 0x04000440: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x440>>2] = val; + if(proc == ARMCPU_ARM9) { - OGLRender::glRestore(); + gpu3D->NDS_3D_MatrixMode(val); } return; - case 0x04000580 : + } + // Push matrix - Parameters:0 + case 0x04000444: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x444>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::glViewPort(val); + gpu3D->NDS_3D_PushMatrix(); } return; - case 0x04000350 : + } + // Pop matrix/es - Parameters:1 + case 0x04000448: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x448>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::glClearColor(val); + gpu3D->NDS_3D_PopMatrix(val); } return; - case 0x04000440 : + } + // Store matrix in the stack - Parameters:1 + case 0x0400044C: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x44C>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::glMatrixMode(val); + gpu3D->NDS_3D_StoreMatrix(val); } return; - case 0x04000458 : + } + // Restore matrix from the stack - Parameters:1 + case 0x04000450: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x450>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::ML4x4ajouter(val); + gpu3D->NDS_3D_RestoreMatrix(val); } return; - case 0x0400044C : + } + // Load Identity matrix - Parameters:0 + case 0x04000454: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x454>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::glStoreMatrix(val); + gpu3D->NDS_3D_LoadIdentity(); } return; - case 0x0400045C : + } + // Load 4x4 matrix - Parameters:16 + case 0x04000458: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x458>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::ML4x3ajouter(val); + gpu3D->NDS_3D_LoadMatrix4x4(val); } return; - case 0x04000444 : + } + // Load 4x3 matrix - Parameters:12 + case 0x0400045C: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x45C>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::glPushMatrix(); + gpu3D->NDS_3D_LoadMatrix4x3(val); } return; - case 0x04000448 : + } + // Multiply 4x4 matrix - Parameters:16 + case 0x04000460: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x460>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::glPopMatrix(val); + gpu3D->NDS_3D_MultMatrix4x4(val); } return; - case 0x04000470 : + } + // Multiply 4x4 matrix - Parameters:12 + case 0x04000464: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x464>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::addTrans(val); + gpu3D->NDS_3D_MultMatrix4x3(val); } return; - case 0x04000460 : + } + // Multiply 3x3 matrix - Parameters:9 + case 0x04000468 : + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x468>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::glMultMatrix4x4(val); + gpu3D->NDS_3D_MultMatrix3x3(val); } return; - case 0x04000464 : - if(proc == ARMCPU_ARM9) + } + // Multiply current matrix by scaling matrix - Parameters:3 + case 0x0400046C: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x46C>>2] = val; + if(proc==ARMCPU_ARM9) { - OGLRender::glMultMatrix4x3(val); + gpu3D->NDS_3D_Scale(val); } return; - case 0x04000468 : + } + // Multiply current matrix by translation matrix - Parameters:3 + case 0x04000470: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x470>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::glMultMatrix3x3(val); + gpu3D->NDS_3D_Translate(val); } return; - case 0x04000500 : + } + // Set vertex color - Parameters:1 + case 0x04000480: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x480>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::glBegin(val); + gpu3D->NDS_3D_Color3b(val); } return; - case 0x04000504 : + } + // Set vertex normal - Parameters:1 + case 0x04000484: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x484>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::glEnd(); + gpu3D->NDS_3D_Normal(val); } return; - case 0x04000480 : - if(proc == ARMCPU_ARM9) + } + // Set vertex texture coordinate - Parameters:1 + case 0x04000488: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x488>>2] = val; + if(proc==ARMCPU_ARM9) { - OGLRender::glColor3b(val); + gpu3D->NDS_3D_TexCoord(val); } - return; - case 0x0400048C : + return; + } + // Set vertex position 16b/coordinate - Parameters:2 + case 0x0400048C: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x48C>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::glVertex3(val); + gpu3D->NDS_3D_Vertex16b(val); } return; - case 0x04000540 : + } + // Set vertex position 10b/coordinate - Parameters:1 + case 0x04000490: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x490>>2] = val; if(proc == ARMCPU_ARM9) { - OGLRender::glFlush(); + gpu3D->NDS_3D_Vertex10b(val); } return; - case 0x04000454 : - if(proc == ARMCPU_ARM9) + } + // Set vertex XY position - Parameters:1 + case 0x04000494: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x494>>2] = val; + if(proc==ARMCPU_ARM9) { - OGLRender::glLoadIdentity(); + gpu3D->NDS_3D_Vertex3_cord(0,1,val); } return; -#endif - case REG_DISPA_BG2PA : - if (proc == ARMCPU_ARM9) GPU_setPAPB(MainScreen.gpu, 2, val); - return; - case REG_DISPA_BG2PC : - if (proc == ARMCPU_ARM9) GPU_setPCPD(MainScreen.gpu, 2, val); - return; - - case REG_DISPB_BG2PA : - if (proc == ARMCPU_ARM9) GPU_setPAPB(SubScreen.gpu, 2, val); - return; - case REG_DISPB_BG2PC : - if (proc == ARMCPU_ARM9) GPU_setPCPD(SubScreen.gpu, 2, val); - return; - case REG_DISPA_BG3PA : - if (proc == ARMCPU_ARM9) GPU_setPAPB(MainScreen.gpu, 3, val); - return; - case REG_DISPA_BG3PC : - if (proc == ARMCPU_ARM9) GPU_setPCPD(MainScreen.gpu, 3, val); - return; - case REG_DISPB_BG3PA : - if (proc == ARMCPU_ARM9) GPU_setPAPB(SubScreen.gpu, 3, val); - return; - case REG_DISPB_BG3PC : - if (proc == ARMCPU_ARM9) GPU_setPCPD(SubScreen.gpu, 3, val); - return; - case REG_DISPA_BG2XL : - if (proc == ARMCPU_ARM9) GPU_setX(MainScreen.gpu, 2, val); + } + // Set vertex XZ position - Parameters:1 + case 0x04000498: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x498>>2] = val; + if(proc==ARMCPU_ARM9) + { + gpu3D->NDS_3D_Vertex3_cord(0,2,val); + } return; - case REG_DISPA_BG2YL : - if (proc == ARMCPU_ARM9) GPU_setY(MainScreen.gpu, 2, val); + } + // Set vertex YZ position - Parameters:1 + case 0x0400049C: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x49C>>2] = val; + if(proc==ARMCPU_ARM9) + { + gpu3D->NDS_3D_Vertex3_cord(1,2,val); + } return; - case REG_DISPB_BG2XL : - if (proc == ARMCPU_ARM9) GPU_setX(SubScreen.gpu, 2, val); + } + // Set vertex difference position (offset from the last vertex) - Parameters:1 + case 0x040004A0: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x4A0>>2] = val; + if(proc==ARMCPU_ARM9) + { + gpu3D->NDS_3D_Vertex_rel (val); + } return; - case REG_DISPB_BG2YL : - if (proc == ARMCPU_ARM9) GPU_setY(SubScreen.gpu, 2, val); + } + // Set polygon attributes - Parameters:1 + case 0x040004A4: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x4A4>>2] = val; + if(proc == ARMCPU_ARM9) + { + gpu3D->NDS_3D_PolygonAttrib(val); + } return; - case REG_DISPA_BG3XL : - if (proc == ARMCPU_ARM9) GPU_setX(MainScreen.gpu, 3, val); + } + // Set texture parameteres - Parameters:1 + case 0x040004A8: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x4A8>>2] = val; + if(proc==ARMCPU_ARM9) + { + gpu3D->NDS_3D_TexImage(val); + } return; - case REG_DISPA_BG3YL : - if (proc == ARMCPU_ARM9) GPU_setY(MainScreen.gpu, 3, val); + } + // Set palette base address - Parameters:1 + case 0x040004AC: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x4AC>>2] = val&0x1FFF; + if(proc==ARMCPU_ARM9) + { + gpu3D->NDS_3D_TexPalette(val&0x1FFFF); + } return; - case REG_DISPB_BG3XL : - if (proc == ARMCPU_ARM9) GPU_setX(SubScreen.gpu, 3, val); + } + // Set material diffuse/ambient parameters - Parameters:1 + case 0x040004C0: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x4C0>>2] = val; + if(proc == ARMCPU_ARM9) + { + gpu3D->NDS_3D_Material0 (val); + } return; - case REG_DISPB_BG3YL : - if (proc == ARMCPU_ARM9) GPU_setY(SubScreen.gpu, 3, val); + } + // Set material reflection/emission parameters - Parameters:1 + case 0x040004C4: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x4C4>>2] = val; + if(proc == ARMCPU_ARM9) + { + gpu3D->NDS_3D_Material1 (val); + } return; - case REG_DISPA_BG0HOFS : - if (proc == ARMCPU_ARM9) GPU_scrollXY(MainScreen.gpu, 0, val); + } + // Light direction vector - Parameters:1 + case 0x040004C8: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x4C8>>2] = val; + if(proc == ARMCPU_ARM9) + { + gpu3D->NDS_3D_LightDirection (val); + } return; - case REG_DISPA_BG1HOFS : - if (proc == ARMCPU_ARM9) GPU_scrollXY(MainScreen.gpu, 1, val); + } + // Light color - Parameters:1 + case 0x040004CC: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x4CC>>2] = val; + if(proc == ARMCPU_ARM9) + { + gpu3D->NDS_3D_LightColor(val); + } return; - case REG_DISPA_BG2HOFS : - if (proc == ARMCPU_ARM9) GPU_scrollXY(MainScreen.gpu, 2, val); + } + // Material Shininess - Parameters:32 + case 0x040004D0: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x4D0>>2] = val; + if(proc == ARMCPU_ARM9) + { + gpu3D->NDS_3D_Shininess(val); + } return; - case REG_DISPA_BG3HOFS : - if (proc == ARMCPU_ARM9) GPU_scrollXY(MainScreen.gpu, 3, val); + } + // Begin vertex list - Parameters:1 + case 0x04000500: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x500>>2] = val; + if(proc == ARMCPU_ARM9) + { + gpu3D->NDS_3D_Begin(val); + } return; - case REG_DISPB_BG0HOFS : - if (proc == ARMCPU_ARM9) GPU_scrollXY(SubScreen.gpu, 0, val); + } + // End vertex list - Parameters:0 + case 0x04000504: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x504>>2] = val; + if(proc == ARMCPU_ARM9) + { + gpu3D->NDS_3D_End(); + } return; - case REG_DISPB_BG1HOFS : - if (proc == ARMCPU_ARM9) GPU_scrollXY(SubScreen.gpu, 1, val); + } + // Swap rendering engine buffers - Parameters:1 + case 0x04000540: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x540>>2] = val; + if(proc == ARMCPU_ARM9) + { + gpu3D->NDS_3D_Flush(val); + } return; - case REG_DISPB_BG2HOFS : - if (proc == ARMCPU_ARM9) GPU_scrollXY(SubScreen.gpu, 2, val); + } + // Set viewport coordinates - Parameters:1 + case 0x04000580: + { + ((u32 *)(MMU.MMU_MEM[proc][0x40]))[0x580>>2] = val; + if(proc == ARMCPU_ARM9) + { + gpu3D->NDS_3D_ViewPort(val); + } return; - case REG_DISPB_BG3HOFS : - if (proc == ARMCPU_ARM9) GPU_scrollXY(SubScreen.gpu, 3, val); + } + + case REG_DISPA_WININ: + { + if(proc == ARMCPU_ARM9) + { + GPU_setWININ (MainScreen.gpu, val & 0xFFFF) ; + GPU_setWINOUT16 (MainScreen.gpu, (val >> 16) & 0xFFFF) ; + } + break; + } + case REG_DISPB_WININ: + { + if(proc == ARMCPU_ARM9) + { + GPU_setWININ (SubScreen.gpu, val & 0xFFFF) ; + GPU_setWINOUT16 (SubScreen.gpu, (val >> 16) & 0xFFFF) ; + } + break; + } + + case REG_DISPA_BLDCNT: + { + if (proc == ARMCPU_ARM9) + { + GPU_setBLDCNT (MainScreen.gpu,val&0xffff); + GPU_setBLDALPHA (MainScreen.gpu,val>>16); + } + break; + } + case REG_DISPB_BLDCNT: + { + if (proc == ARMCPU_ARM9) + { + GPU_setBLDCNT (SubScreen.gpu,val&0xffff); + GPU_setBLDALPHA (SubScreen.gpu,val>>16); + } + break; + } +/* + // Commented out, as this doesn't use the plug-in system, neither works + case cmd_3D_MTX_MODE // 0x04000440 : + if (proc == ARMCPU_ARM9) gl_MTX_MODE(val); + return; + case cmd_3D_MTX_PUSH // 0x04000444 : + case cmd_3D_MTX_POP // 0x04000448 : + case cmd_3D_MTX_STORE // 0x0400044C : + case cmd_3D_MTX_RESTORE // 0x04000450 : + if (proc == ARMCPU_ARM9) gl_print_cmd(adr); + return; + case cmd_3D_MTX_IDENTITY // 0x04000454 : + if (proc == ARMCPU_ARM9) gl_MTX_IDENTITY(); + return; + case cmd_3D_MTX_LOAD_4x4 // 0x04000458 : + if (proc == ARMCPU_ARM9) gl_MTX_LOAD_4x4(val); + return; + case cmd_3D_MTX_LOAD_4x3 // 0x0400045C : + if (proc == ARMCPU_ARM9) gl_MTX_LOAD_4x3(val); + return; + case cmd_3D_MTX_MULT_4x4 // 0x04000460 : + if (proc == ARMCPU_ARM9) gl_MTX_MULT_4x4(val); + return; + case cmd_3D_MTX_MULT_4x3 // 0x04000464 : + if (proc == ARMCPU_ARM9) gl_MTX_MULT_4x3(val); + return; + case cmd_3D_MTX_MULT_3x3 // 0x04000468 : + if (proc == ARMCPU_ARM9) gl_MTX_MULT_3x3(val); + return; + case cmd_3D_MTX_SCALE // 0x0400046C : + case cmd_3D_MTX_TRANS // 0x04000470 : + case cmd_3D_COLOR // 0x04000480 : + case cmd_3D_NORMA // 0x04000484 : + if (proc == ARMCPU_ARM9) gl_print_cmd(adr); + return; + case cmd_3D_TEXCOORD // 0x04000488 : + if (proc == ARMCPU_ARM9) gl_TEXCOORD(val); + return; + case cmd_3D_VTX_16 // 0x0400048C : + if (proc == ARMCPU_ARM9) gl_VTX_16(val); + return; + case cmd_3D_VTX_10 // 0x04000490 : + if (proc == ARMCPU_ARM9) gl_VTX_10(val); + return; + case cmd_3D_VTX_XY // 0x04000494 : + if (proc == ARMCPU_ARM9) gl_VTX_XY(val); + return; + case cmd_3D_VTX_XZ // 0x04000498 : + if (proc == ARMCPU_ARM9) gl_VTX_XZ(val); + return; + case cmd_3D_VTX_YZ // 0x0400049C : + if (proc == ARMCPU_ARM9) gl_VTX_YZ(val); + return; + case cmd_3D_VTX_DIFF // 0x040004A0 : + if (proc == ARMCPU_ARM9) gl_VTX_DIFF(val); + return; + case cmd_3D_POLYGON_ATTR // 0x040004A4 : + case cmd_3D_TEXIMAGE_PARAM // 0x040004A8 : + case cmd_3D_PLTT_BASE // 0x040004AC : + case cmd_3D_DIF_AMB // 0x040004C0 : + case cmd_3D_SPE_EMI // 0x040004C4 : + case cmd_3D_LIGHT_VECTOR // 0x040004C8 : + case cmd_3D_LIGHT_COLOR // 0x040004CC : + case cmd_3D_SHININESS // 0x040004D0 : + if (proc == ARMCPU_ARM9) gl_print_cmd(adr); + return; + case cmd_3D_BEGIN_VTXS // 0x04000500 : + if (proc == ARMCPU_ARM9) gl_VTX_begin(val); + return; + case cmd_3D_END_VTXS // 0x04000504 : + if (proc == ARMCPU_ARM9) gl_VTX_end(); + return; + case cmd_3D_SWAP_BUFFERS // 0x04000540 : + case cmd_3D_VIEWPORT // 0x04000580 : + case cmd_3D_BOX_TEST // 0x040005C0 : + case cmd_3D_POS_TEST // 0x040005C4 : + case cmd_3D_VEC_TEST // 0x040005C8 : + if (proc == ARMCPU_ARM9) gl_print_cmd(adr); return; +*/ case REG_DISPA_DISPCNT : if(proc == ARMCPU_ARM9) GPU_setVideoProp(MainScreen.gpu, val); @@ -2111,26 +2383,6 @@ //GPULOG("SUB INIT 32B %08X\r\n", val); T1WriteLong(MMU.MMU_MEM[proc][0x40], 0x1000, val); return; - case REG_DISPA_WININ: - if(proc == ARMCPU_ARM9) - { - GPU_setWINDOW_INCNT(MainScreen.gpu, val & 0xFFFF) ; - GPU_setWINDOW_OUTCNT(MainScreen.gpu, (val >> 16) & 0xFFFF) ; - } - break ; - case REG_DISPB_WININ: - if(proc == ARMCPU_ARM9) - { - GPU_setWINDOW_INCNT(SubScreen.gpu, val & 0xFFFF) ; - GPU_setWINDOW_OUTCNT(SubScreen.gpu, (val >> 16) & 0xFFFF) ; - } - break ; - case REG_DISPA_MASTERBRIGHT: - if(proc == ARMCPU_ARM9) GPU_setMASTER_BRIGHT (MainScreen.gpu, val & 0xFFFF); - break; - case REG_DISPB_MASTERBRIGHT: - if(proc == ARMCPU_ARM9) GPU_setMASTER_BRIGHT (SubScreen.gpu, val & 0xFFFF); - break; case REG_VRAMCNTA: case REG_VRAMCNTE: MMU_write8(proc,adr,val & 0xFF) ; @@ -2142,13 +2394,30 @@ MMU_write8(proc,adr,val & 0xFF) ; return ; - case REG_IME : - MMU.reg_IME[proc] = val & 1; + case REG_IME : { + u32 old_val = MMU.reg_IME[proc]; + u32 new_val = val & 1; + MMU.reg_IME[proc] = new_val; T1WriteLong(MMU.MMU_MEM[proc][0x40], 0x208, val); + if ( new_val && old_val != new_val) { + /* raise an interrupt request to the CPU if needed */ + if ( MMU.reg_IE[proc] & MMU.reg_IF[proc]) { + NDS_ARM7.wIRQ = TRUE; + NDS_ARM7.waitIRQ = FALSE; + } + } return; + } case REG_IE : MMU.reg_IE[proc] = val; + if ( MMU.reg_IME[proc]) { + /* raise an interrupt request to the CPU if needed */ + if ( MMU.reg_IE[proc] & MMU.reg_IF[proc]) { + NDS_ARM7.wIRQ = TRUE; + NDS_ARM7.waitIRQ = FALSE; + } + } return; case REG_IF : @@ -2161,8 +2430,7 @@ MMU.timerReload[proc][(adr>>2)&0x3] = (u16)val; if(val&0x800000) { - if(!(val&40000)) MMU.timer[proc][(adr>>2)&0x3] = MMU.timerReload[proc][(adr>>2)&0x3]; - else MMU.timer[proc][(adr>>2)&0x3] = 0; + MMU.timer[proc][(adr>>2)&0x3] = MMU.timerReload[proc][(adr>>2)&0x3]; } MMU.timerON[proc][(adr>>2)&0x3] = val & 0x800000; switch((val>>16)&7) @@ -2392,14 +2660,15 @@ } } return; - case REG_DMA0CNTL : + case REG_DMA0CNTL : //LOG("32 bit dma0 %04X\r\n", val); DMASrc[proc][0] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xB0); DMADst[proc][0] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xB4); MMU.DMAStartTime[proc][0] = (proc ? (val>>28) & 0x3 : (val>>27) & 0x7); MMU.DMACrt[proc][0] = val; T1WriteLong(MMU.MMU_MEM[proc][0x40], 0xB8, val); - if( MMU.DMAStartTime[proc][0] == 0) // Start Immediately + if( MMU.DMAStartTime[proc][0] == 0 || + MMU.DMAStartTime[proc][0] == 7) // Start Immediately MMU_doDMA(proc, 0); #ifdef LOG_DMA2 else @@ -2409,14 +2678,15 @@ #endif //execute = FALSE; return; - case REG_DMA1CNTL : + case REG_DMA1CNTL: //LOG("32 bit dma1 %04X\r\n", val); DMASrc[proc][1] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xBC); DMADst[proc][1] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xC0); MMU.DMAStartTime[proc][1] = (proc ? (val>>28) & 0x3 : (val>>27) & 0x7); MMU.DMACrt[proc][1] = val; T1WriteLong(MMU.MMU_MEM[proc][0x40], 0xC4, val); - if(MMU.DMAStartTime[proc][1] == 0) // Start Immediately + if(MMU.DMAStartTime[proc][1] == 0 || + MMU.DMAStartTime[proc][1] == 7) // Start Immediately MMU_doDMA(proc, 1); #ifdef LOG_DMA2 else @@ -2425,14 +2695,15 @@ } #endif return; - case REG_DMA2CNTL : + case REG_DMA2CNTL : //LOG("32 bit dma2 %04X\r\n", val); DMASrc[proc][2] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xC8); DMADst[proc][2] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xCC); MMU.DMAStartTime[proc][2] = (proc ? (val>>28) & 0x3 : (val>>27) & 0x7); MMU.DMACrt[proc][2] = val; T1WriteLong(MMU.MMU_MEM[proc][0x40], 0xD0, val); - if(MMU.DMAStartTime[proc][2] == 0) // Start Immediately + if(MMU.DMAStartTime[proc][2] == 0 || + MMU.DMAStartTime[proc][2] == 7) // Start Immediately MMU_doDMA(proc, 2); #ifdef LOG_DMA2 else @@ -2441,14 +2712,15 @@ } #endif return; - case 0x040000DC : + case 0x040000DC : //LOG("32 bit dma3 %04X\r\n", val); DMASrc[proc][3] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xD4); DMADst[proc][3] = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xD8); MMU.DMAStartTime[proc][3] = (proc ? (val>>28) & 0x3 : (val>>27) & 0x7); MMU.DMACrt[proc][3] = val; T1WriteLong(MMU.MMU_MEM[proc][0x40], 0xDC, val); - if( MMU.DMAStartTime[proc][3] == 0) // Start Immediately + if( MMU.DMAStartTime[proc][3] == 0 || + MMU.DMAStartTime[proc][3] == 7) // Start Immediately MMU_doDMA(proc, 3); #ifdef LOG_DMA2 else @@ -2517,6 +2789,14 @@ } return; + case REG_DISPA_DISPCAPCNT : + if(proc == ARMCPU_ARM9) + { + GPU_set_DISPCAPCNT(MainScreen.gpu,val); + T1WriteLong(ARM9Mem.ARM9_REG, 0x64, val); + } + return; + case REG_DISPA_BG0CNT : if (proc == ARMCPU_ARM9) { @@ -2550,21 +2830,6 @@ } T1WriteLong(ARM9Mem.ARM9_REG, 0x100C, val); return; - case REG_DISPA_BLDCNT: - if (proc == ARMCPU_ARM9) - { - GPU_setBLDCNT (MainScreen.gpu,val&0xffff); - GPU_setBLDALPHA (MainScreen.gpu,val>>16); - } - break; - case REG_DISPB_BLDCNT: - if (proc == ARMCPU_ARM9) - { - GPU_setBLDCNT (SubScreen.gpu,val&0xffff); - GPU_setBLDALPHA (SubScreen.gpu,val>>16); - } - break; - case REG_DISPA_DISPMMEMFIFO: { // NOTE: right now, the capture unit is not taken into account, @@ -2592,22 +2857,22 @@ if(src==dst) { - T1WriteLong(MMU.MMU_MEM[proc][0x40], 0xB8 + (0xC*num), T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xB8 + (0xC*num)) & 0x7FFFFFFF); - return; + T1WriteLong(MMU.MMU_MEM[proc][0x40], 0xB8 + (0xC*num), T1ReadLong(MMU.MMU_MEM[proc][0x40], 0xB8 + (0xC*num)) & 0x7FFFFFFF); + return; } if((!(MMU.DMACrt[proc][num]&(1<<31)))&&(!(MMU.DMACrt[proc][num]&(1<<25)))) { /* not enabled and not to be repeated */ - MMU.DMAStartTime[proc][num] = 0; - MMU.DMACycle[proc][num] = 0; - //MMU.DMAing[proc][num] = FALSE; - return; + MMU.DMAStartTime[proc][num] = 0; + MMU.DMACycle[proc][num] = 0; + //MMU.DMAing[proc][num] = FALSE; + return; } - + /* word count */ - taille = (MMU.DMACrt[proc][num]&0xFFFF); - + taille = (MMU.DMACrt[proc][num]&0xFFFF); + // If we are in "Main memory display" mode just copy an entire // screen (256x192 pixels). // Reference: http://nocash.emubase.de/gbatek.htm#dsvideocaptureandmainmemorydisplaymode @@ -2617,336 +2882,606 @@ (((MMU.DMACrt[proc][num]>>26)&1) == 1)) // Transfer mode must be 32bit wide taille = 256*192/2; - if(MMU.DMAStartTime[proc][num] == 5) taille *= 0x80; + if(MMU.DMAStartTime[proc][num] == 5) + taille *= 0x80; MMU.DMACycle[proc][num] = taille + nds.cycles; - MMU.DMAing[proc][num] = TRUE; - DMALOG("proc %d, dma %d src %08X dst %08X start %d taille %d repeat %s %08X\r\n", proc, num, src, dst, MMU.DMAStartTime[proc][num], taille, (MMU.DMACrt[proc][num]&(1<<25))?"on":"off",MMU.DMACrt[proc][num]); + DMALOG("proc %d, dma %d src %08X dst %08X start %d taille %d repeat %s %08X\r\n", + proc, num, src, dst, MMU.DMAStartTime[proc][num], taille, + (MMU.DMACrt[proc][num]&(1<<25))?"on":"off",MMU.DMACrt[proc][num]); - if(!(MMU.DMACrt[proc][num]&(1<<25))) MMU.DMAStartTime[proc][num] = 0; + if(!(MMU.DMACrt[proc][num]&(1<<25))) + MMU.DMAStartTime[proc][num] = 0; - switch((MMU.DMACrt[proc][num]>>26)&1) + // transfer { - case 1 : /* 32 bit DMA transfers */ - switch(((MMU.DMACrt[proc][num]>>21)&0xF)) - { - u32 i; - case 0 : /* dst and src increment */ - for(i = 0; i < taille; ++i) - { - MMU_writeWord(proc, dst, MMU_readWord(proc, src)); - dst += 4; - src += 4; - } - break; - case 1 : /* dst decrement, src increment */ - for(i = 0; i < taille; ++i) - { - MMU_writeWord(proc, dst, MMU_readWord(proc, src)); - dst -= 4; - src += 4; - } - break; - case 2 : /* dst fixed, src increment */ - for(i = 0; i < taille; ++i) - { - MMU_writeWord(proc, dst, MMU_readWord(proc, src)); - src += 4; - } - break; - case 3 : /*dst increment/reload, src increment */ - for(i = 0; i < taille; ++i) - { - MMU_writeWord(proc, dst, MMU_readWord(proc, src)); - dst += 4; - src += 4; - } - break; - case 4 : /* dst increment, src decrement */ - for(i = 0; i < taille; ++i) - { - MMU_writeWord(proc, dst, MMU_readWord(proc, src)); - dst += 4; - src -= 4; - } - break; - case 5 : /* dst decrement, src decrement */ - for(i = 0; i < taille; ++i) - { - MMU_writeWord(proc, dst, MMU_readWord(proc, src)); - dst -= 4; - src -= 4; - } - break; - case 6 : /* dst fixed, src decrement */ - for(i = 0; i < taille; ++i) - { - MMU_writeWord(proc, dst, MMU_readWord(proc, src)); - src -= 4; - } - break; - case 7 : /* dst increment/reload, src decrement */ - for(i = 0; i < taille; ++i) - { - MMU_writeWord(proc, dst, MMU_readWord(proc, src)); - dst += 4; - src -= 4; - } - break; - case 8 : /* dst increment, src fixed */ - for(i = 0; i < taille; ++i) - { - MMU_writeWord(proc, dst, MMU_readWord(proc, src)); - dst += 4; - } - break; - case 9 : /* dst decrement, src fixed */ - for(i = 0; i < taille; ++i) - { - MMU_writeWord(proc, dst, MMU_readWord(proc, src)); - dst -= 4; - } - break; - case 10 : /* dst fixed, src fixed */ - for(i = 0; i < taille; ++i) - { - MMU_writeWord(proc, dst, MMU_readWord(proc, src)); - } - break; - case 11 : /* dst increment/reload, src fixed */ - for(i = 0; i < taille; ++i) - { - MMU_writeWord(proc, dst, MMU_readWord(proc, src)); - dst += 4; - } - break; - default : /* reserved */ - break; - } - break; - case 0 : /* 16 bit transfers */ - switch(((MMU.DMACrt[proc][num]>>21)&0xF)) - { - u32 i; - case 0 : - for(i = 0; i < taille; ++i) - { - MMU_write16(proc, dst, MMU_readHWord(proc, src)); - dst += 2; - src += 2; - } - break; - case 1 : - for(i = 0; i < taille; ++i) - { - MMU_write16(proc, dst, MMU_readHWord(proc, src)); - dst -= 2; - src += 2; - } - break; - case 2 : - for(i = 0; i < taille; ++i) - { - MMU_write16(proc, dst, MMU_readHWord(proc, src)); - src += 2; - } - break; - case 3 : - for(i = 0; i < taille; ++i) - { - MMU_write16(proc, dst, MMU_readHWord(proc, src)); - dst += 2; - src += 2; - } - break; - case 4 : - for(i = 0; i < taille; ++i) - { - MMU_write16(proc, dst, MMU_readHWord(proc, src)); - dst += 2; - src -= 2; - } - break; - case 5 : - for(i = 0; i < taille; ++i) - { - MMU_write16(proc, dst, MMU_readHWord(proc, src)); - dst -= 2; - src -= 2; - } - break; - case 6 : - for(i = 0; i < taille; ++i) - { - MMU_write16(proc, dst, MMU_readHWord(proc, src)); - src -= 2; - } - break; - case 7 : - for(i = 0; i < taille; ++i) - { - MMU_write16(proc, dst, MMU_readHWord(proc, src)); - dst += 2; - src -= 2; - } - break; - case 8 : - for(i = 0; i < taille; ++i) - { - MMU_write16(proc, dst, MMU_readHWord(proc, src)); - dst += 2; - } - break; - case 9 : - for(i = 0; i < taille; ++i) - { - MMU_write16(proc, dst, MMU_readHWord(proc, src)); - dst -= 2; - } - break; - case 10 : - for(i = 0; i < taille; ++i) - { - MMU_write16(proc, dst, MMU_readHWord(proc, src)); - } - break; - case 11 : - for(i = 0; i < taille; ++i) - { - MMU_write16(proc, dst, MMU_readHWord(proc, src)); - dst += 2; - } - break; - default : - break; - } - break; + u32 i=0; + // 32 bit or 16 bit transfer ? + int sz = ((MMU.DMACrt[proc][num]>>26)&1)? 4 : 2; + int dstinc,srcinc; + int u=(MMU.DMACrt[proc][num]>>21); + switch(u & 0x3) { + case 0 : dstinc = sz; break; + case 1 : dstinc = -sz; break; + case 2 : dstinc = 0; break; + case 3 : dstinc = sz; break; //reload + } + switch((u >> 2)&0x3) { + case 0 : srcinc = sz; break; + case 1 : srcinc = -sz; break; + case 2 : srcinc = 0; break; + case 3 : // reserved + return; + } + if ((MMU.DMACrt[proc][num]>>26)&1) + for(; i < taille; ++i) + { + MMU_writeWord(proc, dst, MMU_readWord(proc, src)); + dst += dstinc; + src += srcinc; + } + else + for(; i < taille; ++i) + { + MMU_write16(proc, dst, MMU_readHWord(proc, src)); + dst += dstinc; + src += srcinc; + } } } #ifdef MMU_ENABLE_ACL + +INLINE void check_access(u32 adr, u32 access) { + /* every other mode: sys */ + access |= 1; + if ((NDS_ARM9.CPSR.val & 0x1F) == 0x10) { + /* is user mode access */ + access ^= 1 ; + } + if (armcp15_isAccessAllowed((armcp15_t *)NDS_ARM9.coproc[15],adr,access)==FALSE) { + execute = FALSE ; + } +} +INLINE void check_access_write(u32 adr) { + u32 access = CP15_ACCESS_WRITE; + check_access(adr, access) +} + u8 FASTCALL MMU_read8_acl(u32 proc, u32 adr, u32 access) { - if (proc == ARMCPU_ARM9) /* on arm9 we need to check the MPU regions */ + /* on arm9 we need to check the MPU regions */ + if (proc == ARMCPU_ARM9) + check_access(u32 adr, u32 access); + return MMU_read8(proc,adr); +} +u16 FASTCALL MMU_read16_acl(u32 proc, u32 adr, u32 access) +{ + /* on arm9 we need to check the MPU regions */ + if (proc == ARMCPU_ARM9) + check_access(u32 adr, u32 access); + return MMU_read16(proc,adr); +} +u32 FASTCALL MMU_read32_acl(u32 proc, u32 adr, u32 access) +{ + /* on arm9 we need to check the MPU regions */ + if (proc == ARMCPU_ARM9) + check_access(u32 adr, u32 access); + return MMU_read32(proc,adr); +} + +void FASTCALL MMU_write8_acl(u32 proc, u32 adr, u8 val) +{ + /* check MPU region on ARM9 */ + if (proc == ARMCPU_ARM9) + check_access_write(adr); + MMU_write8(proc,adr,val); +} +void FASTCALL MMU_write16_acl(u32 proc, u32 adr, u16 val) +{ + /* check MPU region on ARM9 */ + if (proc == ARMCPU_ARM9) + check_access_write(adr); + MMU_write16(proc,adr,val) ; +} +void FASTCALL MMU_write32_acl(u32 proc, u32 adr, u32 val) +{ + /* check MPU region on ARM9 */ + if (proc == ARMCPU_ARM9) + check_access_write(adr); + MMU_write32(proc,adr,val) ; +} +#endif + + + +#ifdef PROFILE_MEMORY_ACCESS + +#define PROFILE_PREFETCH 0 +#define PROFILE_READ 1 +#define PROFILE_WRITE 2 + +struct mem_access_profile { + u64 num_accesses; + u32 address_mask; + u32 masked_value; +}; + +#define PROFILE_NUM_MEM_ACCESS_PROFILES 4 + +static u64 profile_num_accesses[2][3]; +static u64 profile_unknown_addresses[2][3]; +static struct mem_access_profile +profile_memory_accesses[2][3][PROFILE_NUM_MEM_ACCESS_PROFILES]; + +static void +setup_profiling( void) { + int i; + + for ( i = 0; i < 2; i++) { + int access_type; + + for ( access_type = 0; access_type < 3; access_type++) { + profile_num_accesses[i][access_type] = 0; + profile_unknown_addresses[i][access_type] = 0; + + /* + * Setup the access testing structures + */ + profile_memory_accesses[i][access_type][0].address_mask = 0x0e000000; + profile_memory_accesses[i][access_type][0].masked_value = 0x00000000; + profile_memory_accesses[i][access_type][0].num_accesses = 0; + + /* main memory */ + profile_memory_accesses[i][access_type][1].address_mask = 0x0f000000; + profile_memory_accesses[i][access_type][1].masked_value = 0x02000000; + profile_memory_accesses[i][access_type][1].num_accesses = 0; + + /* shared memory */ + profile_memory_accesses[i][access_type][2].address_mask = 0x0f800000; + profile_memory_accesses[i][access_type][2].masked_value = 0x03000000; + profile_memory_accesses[i][access_type][2].num_accesses = 0; + + /* arm7 memory */ + profile_memory_accesses[i][access_type][3].address_mask = 0x0f800000; + profile_memory_accesses[i][access_type][3].masked_value = 0x03800000; + profile_memory_accesses[i][access_type][3].num_accesses = 0; + } + } +} + +static void +profile_memory_access( int arm9, u32 adr, int access_type) { + static int first = 1; + int mem_profile; + int address_found = 0; + + if ( first) { + setup_profiling(); + first = 0; + } + + profile_num_accesses[arm9][access_type] += 1; + + for ( mem_profile = 0; + mem_profile < PROFILE_NUM_MEM_ACCESS_PROFILES && + !address_found; + mem_profile++) { + if ( (adr & profile_memory_accesses[arm9][access_type][mem_profile].address_mask) == + profile_memory_accesses[arm9][access_type][mem_profile].masked_value) { + /*printf( "adr %08x mask %08x res %08x expected %08x\n", + adr, + profile_memory_accesses[arm9][access_type][mem_profile].address_mask, + adr & profile_memory_accesses[arm9][access_type][mem_profile].address_mask, + profile_memory_accesses[arm9][access_type][mem_profile].masked_value);*/ + address_found = 1; + profile_memory_accesses[arm9][access_type][mem_profile].num_accesses += 1; + } + } + + if ( !address_found) { + profile_unknown_addresses[arm9][access_type] += 1; + } +} + + +static const char *access_type_strings[] = { + "prefetch", + "read ", + "write " +}; + +void +print_memory_profiling( void) { + int arm; + + printf("------ Memory access profile ------\n"); + + for ( arm = 0; arm < 2; arm++) { + int access_type; + + for ( access_type = 0; access_type < 3; access_type++) { + int mem_profile; + printf("ARM%c: num of %s %lld\n", + arm ? '9' : '7', + access_type_strings[access_type], + profile_num_accesses[arm][access_type]); + + for ( mem_profile = 0; + mem_profile < PROFILE_NUM_MEM_ACCESS_PROFILES; + mem_profile++) { + printf( "address %08x: %lld\n", + profile_memory_accesses[arm][access_type][mem_profile].masked_value, + profile_memory_accesses[arm][access_type][mem_profile].num_accesses); + } + + printf( "unknown addresses %lld\n", + profile_unknown_addresses[arm][access_type]); + + printf( "\n"); + } + } + + printf("------ End of Memory access profile ------\n\n"); +} +#else +void +print_memory_profiling( void) { +} +#endif /* End of PROFILE_MEMORY_ACCESS area */ + +static u16 FASTCALL +arm9_prefetch16( void *data, u32 adr) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 1, adr, PROFILE_PREFETCH); +#endif + +#ifdef EARLY_MEMORY_ACCESS + if((adr & ~0x3FFF) == MMU.DTCMRegion) { - if ((NDS_ARM9.CPSR.val & 0x1F) == 0x10) - { - /* is user mode access */ - access &= ~1 ; - } else { - /* every other mode: sys */ - access |= 1 ; - } - if (armcp15_isAccessAllowed((armcp15_t *)NDS_ARM9.coproc[15],adr,access)==FALSE) - { - execute = FALSE ; - } + /* Returns data from DTCM (ARM9 only) */ + return T1ReadWord(ARM9Mem.ARM9_DTCM, adr & 0x3FFF); } - return MMU_read8(proc,adr) ; + /* access to main memory */ + if ( (adr & 0x0f000000) == 0x02000000) { + return T1ReadWord( MMU.MMU_MEM[ARMCPU_ARM9][(adr >> 20) & 0xFF], + adr & MMU.MMU_MASK[ARMCPU_ARM9][(adr >> 20) & 0xFF]); + } +#endif + + return MMU_read16( ARMCPU_ARM9, adr); } +static u32 FASTCALL +arm9_prefetch32( void *data, u32 adr) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 1, adr, PROFILE_PREFETCH); +#endif -u16 FASTCALL MMU_read16_acl(u32 proc, u32 adr, u32 access) -{ - if (proc == ARMCPU_ARM9) /* on arm9 we need to check the MPU regions */ +#ifdef EARLY_MEMORY_ACCESS + if((adr & ~0x3FFF) == MMU.DTCMRegion) { - if ((NDS_ARM9.CPSR.val & 0x1F) == 0x10) - { - /* is user mode access */ - access &= ~1 ; - } else { - /* every other mode: sys */ - access |= 1 ; - } - if (armcp15_isAccessAllowed((armcp15_t *)NDS_ARM9.coproc[15],adr,access)==FALSE) - { - execute = FALSE ; - } + /* Returns data from DTCM (ARM9 only) */ + return T1ReadLong(ARM9Mem.ARM9_DTCM, adr & 0x3FFF); } - return MMU_read16(proc,adr) ; + /* access to main memory */ + if ( (adr & 0x0f000000) == 0x02000000) { + return T1ReadLong( MMU.MMU_MEM[ARMCPU_ARM9][(adr >> 20) & 0xFF], + adr & MMU.MMU_MASK[ARMCPU_ARM9][(adr >> 20) & 0xFF]); + } +#endif + + return MMU_read32( ARMCPU_ARM9, adr); } -u32 FASTCALL MMU_read32_acl(u32 proc, u32 adr, u32 access) -{ - if (proc == ARMCPU_ARM9) /* on arm9 we need to check the MPU regions */ +static u8 FASTCALL +arm9_read8( void *data, u32 adr) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 1, adr, PROFILE_READ); +#endif + +#ifdef EARLY_MEMORY_ACCESS + if( (adr&(~0x3FFF)) == MMU.DTCMRegion) { - if ((NDS_ARM9.CPSR.val & 0x1F) == 0x10) - { - /* is user mode access */ - access &= ~1 ; - } else { - /* every other mode: sys */ - access |= 1 ; - } - if (armcp15_isAccessAllowed((armcp15_t *)NDS_ARM9.coproc[15],adr,access)==FALSE) - { - execute = FALSE ; - } + return ARM9Mem.ARM9_DTCM[adr&0x3FFF]; } - return MMU_read32(proc,adr) ; + /* access to main memory */ + if ( (adr & 0x0f000000) == 0x02000000) { + return MMU.MMU_MEM[ARMCPU_ARM9][(adr >> 20) & 0xFF] + [adr & MMU.MMU_MASK[ARMCPU_ARM9][(adr >> 20) & 0xFF]]; + } +#endif + + return MMU_read8( ARMCPU_ARM9, adr); } +static u16 FASTCALL +arm9_read16( void *data, u32 adr) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 1, adr, PROFILE_READ); +#endif -void FASTCALL MMU_write8_acl(u32 proc, u32 adr, u8 val) -{ - if (proc == ARMCPU_ARM9) /* on arm9 we need to check the MPU regions */ +#ifdef EARLY_MEMORY_ACCESS + if((adr & ~0x3FFF) == MMU.DTCMRegion) { - u32 access = CP15_ACCESS_WRITE ; - if ((NDS_ARM9.CPSR.val & 0x1F) == 0x10) - { - /* is user mode access */ - access &= ~1 ; - } else { - /* every other mode: sys */ - access |= 1 ; - } - if (armcp15_isAccessAllowed((armcp15_t *)NDS_ARM9.coproc[15],adr,access)==FALSE) - { - execute = FALSE ; - } + /* Returns data from DTCM (ARM9 only) */ + return T1ReadWord(ARM9Mem.ARM9_DTCM, adr & 0x3FFF); } - MMU_write8(proc,adr,val) ; + + /* access to main memory */ + if ( (adr & 0x0f000000) == 0x02000000) { + return T1ReadWord( MMU.MMU_MEM[ARMCPU_ARM9][(adr >> 20) & 0xFF], + adr & MMU.MMU_MASK[ARMCPU_ARM9][(adr >> 20) & 0xFF]); + } +#endif + + return MMU_read16( ARMCPU_ARM9, adr); } +static u32 FASTCALL +arm9_read32( void *data, u32 adr) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 1, adr, PROFILE_READ); +#endif -void FASTCALL MMU_write16_acl(u32 proc, u32 adr, u16 val) -{ - if (proc == ARMCPU_ARM9) /* on arm9 we need to check the MPU regions */ +#ifdef EARLY_MEMORY_ACCESS + if((adr & ~0x3FFF) == MMU.DTCMRegion) { - u32 access = CP15_ACCESS_WRITE ; - if ((NDS_ARM9.CPSR.val & 0x1F) == 0x10) - { - /* is user mode access */ - access &= ~1 ; - } else { - /* every other mode: sys */ - access |= 1 ; - } - if (armcp15_isAccessAllowed((armcp15_t *)NDS_ARM9.coproc[15],adr,access)==FALSE) - { - execute = FALSE ; - } + /* Returns data from DTCM (ARM9 only) */ + return T1ReadLong(ARM9Mem.ARM9_DTCM, adr & 0x3FFF); } - MMU_write16(proc,adr,val) ; + /* access to main memory */ + if ( (adr & 0x0f000000) == 0x02000000) { + return T1ReadLong( MMU.MMU_MEM[ARMCPU_ARM9][(adr >> 20) & 0xFF], + adr & MMU.MMU_MASK[ARMCPU_ARM9][(adr >> 20) & 0xFF]); + } +#endif + + return MMU_read32( ARMCPU_ARM9, adr); } -void FASTCALL MMU_write32_acl(u32 proc, u32 adr, u32 val) -{ - if (proc == ARMCPU_ARM9) /* on arm9 we need to check the MPU regions */ + +static void FASTCALL +arm9_write8(void *data, u32 adr, u8 val) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 1, adr, PROFILE_WRITE); +#endif + +#ifdef EARLY_MEMORY_ACCESS + if( (adr & ~0x3FFF) == MMU.DTCMRegion) { - u32 access = CP15_ACCESS_WRITE ; - if ((NDS_ARM9.CPSR.val & 0x1F) == 0x10) - { - /* is user mode access */ - access &= ~1 ; - } else { - /* every other mode: sys */ - access |= 1 ; - } - if (armcp15_isAccessAllowed((armcp15_t *)NDS_ARM9.coproc[15],adr,access)==FALSE) - { - execute = FALSE ; - } + /* Writes data in DTCM (ARM9 only) */ + ARM9Mem.ARM9_DTCM[adr&0x3FFF] = val; + return ; } - MMU_write32(proc,adr,val) ; + /* main memory */ + if ( (adr & 0x0f000000) == 0x02000000) { + MMU.MMU_MEM[ARMCPU_ARM9][(adr>>20)&0xFF] + [adr&MMU.MMU_MASK[ARMCPU_ARM9][(adr>>20)&0xFF]] = val; + return; + } +#endif + + MMU_write8( ARMCPU_ARM9, adr, val); +} +static void FASTCALL +arm9_write16(void *data, u32 adr, u16 val) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 1, adr, PROFILE_WRITE); +#endif + +#ifdef EARLY_MEMORY_ACCESS + if((adr & ~0x3FFF) == MMU.DTCMRegion) + { + /* Writes in DTCM (ARM9 only) */ + T1WriteWord(ARM9Mem.ARM9_DTCM, adr & 0x3FFF, val); + return; + } + /* main memory */ + if ( (adr & 0x0f000000) == 0x02000000) { + T1WriteWord( MMU.MMU_MEM[ARMCPU_ARM9][(adr>>20)&0xFF], + adr&MMU.MMU_MASK[ARMCPU_ARM9][(adr>>20)&0xFF], val); + return; + } +#endif + + MMU_write16( ARMCPU_ARM9, adr, val); +} +static void FASTCALL +arm9_write32(void *data, u32 adr, u32 val) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 1, adr, PROFILE_WRITE); +#endif + +#ifdef EARLY_MEMORY_ACCESS + if((adr & ~0x3FFF) == MMU.DTCMRegion) + { + /* Writes in DTCM (ARM9 only) */ + T1WriteLong(ARM9Mem.ARM9_DTCM, adr & 0x3FFF, val); + return; + } + /* main memory */ + if ( (adr & 0x0f000000) == 0x02000000) { + T1WriteLong( MMU.MMU_MEM[ARMCPU_ARM9][(adr>>20)&0xFF], + adr&MMU.MMU_MASK[ARMCPU_ARM9][(adr>>20)&0xFF], val); + return; + } +#endif + + MMU_write32( ARMCPU_ARM9, adr, val); +} + + + + +static u16 FASTCALL +arm7_prefetch16( void *data, u32 adr) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 0, adr, PROFILE_PREFETCH); +#endif + +#ifdef EARLY_MEMORY_ACCESS + /* ARM7 private memory */ + if ( (adr & 0x0f800000) == 0x03800000) { + T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM7][(adr >> 20) & 0xFF], + adr & MMU.MMU_MASK[ARMCPU_ARM7][(adr >> 20) & 0xFF]); + } +#endif + + return MMU_read16( ARMCPU_ARM7, adr); +} +static u32 FASTCALL +arm7_prefetch32( void *data, u32 adr) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 0, adr, PROFILE_PREFETCH); +#endif + +#ifdef EARLY_MEMORY_ACCESS + /* ARM7 private memory */ + if ( (adr & 0x0f800000) == 0x03800000) { + T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM7][(adr >> 20) & 0xFF], + adr & MMU.MMU_MASK[ARMCPU_ARM7][(adr >> 20) & 0xFF]); + } +#endif + + return MMU_read32( ARMCPU_ARM7, adr); +} + +static u8 FASTCALL +arm7_read8( void *data, u32 adr) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 0, adr, PROFILE_READ); +#endif + + return MMU_read8( ARMCPU_ARM7, adr); +} +static u16 FASTCALL +arm7_read16( void *data, u32 adr) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 0, adr, PROFILE_READ); +#endif + + return MMU_read16( ARMCPU_ARM7, adr); } +static u32 FASTCALL +arm7_read32( void *data, u32 adr) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 0, adr, PROFILE_READ); #endif + + return MMU_read32( ARMCPU_ARM7, adr); +} + + +static void FASTCALL +arm7_write8(void *data, u32 adr, u8 val) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 0, adr, PROFILE_WRITE); +#endif + + MMU_write8( ARMCPU_ARM7, adr, val); +} +static void FASTCALL +arm7_write16(void *data, u32 adr, u16 val) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 0, adr, PROFILE_WRITE); +#endif + + MMU_write16( ARMCPU_ARM7, adr, val); +} +static void FASTCALL +arm7_write32(void *data, u32 adr, u32 val) { +#ifdef PROFILE_MEMORY_ACCESS + profile_memory_access( 0, adr, PROFILE_WRITE); +#endif + + MMU_write32( ARMCPU_ARM7, adr, val); +} + + + +/* + * the base memory interfaces + */ +struct armcpu_memory_iface arm9_base_memory_iface = { +#ifdef __GNUC__ + .prefetch32 = arm9_prefetch32, + .prefetch16 = arm9_prefetch16, + + .read8 = arm9_read8, + .read16 = arm9_read16, + .read32 = arm9_read32, + + .write8 = arm9_write8, + .write16 = arm9_write16, + .write32 = arm9_write32 +#else + arm9_prefetch32, + arm9_prefetch16, + + arm9_read8, + arm9_read16, + arm9_read32, + + arm9_write8, + arm9_write16, + arm9_write32 +#endif +}; + +struct armcpu_memory_iface arm7_base_memory_iface = { +#ifdef __GNUC__ + .prefetch32 = arm7_prefetch32, + .prefetch16 = arm7_prefetch16, + + .read8 = arm7_read8, + .read16 = arm7_read16, + .read32 = arm7_read32, + + .write8 = arm7_write8, + .write16 = arm7_write16, + .write32 = arm7_write32 +#else + arm7_prefetch32, + arm7_prefetch16, + + arm7_read8, + arm7_read16, + arm7_read32, + + arm7_write8, + arm7_write16, + arm7_write32 +#endif +}; + +/* + * The direct memory interface for the ARM9. + * This avoids the ARM9 protection unit when accessing + * memory. + */ +struct armcpu_memory_iface arm9_direct_memory_iface = { +#ifdef __GNUC__ + /* the prefetch is not used */ + .prefetch32 = NULL, + .prefetch16 = NULL, + + .read8 = arm9_read8, + .read16 = arm9_read16, + .read32 = arm9_read32, + + .write8 = arm9_write8, + .write16 = arm9_write16, + .write32 = arm9_write32 +#else + NULL, + NULL, + + arm9_read8, + arm9_read16, + arm9_read32, + + arm9_write8, + arm9_write16, + arm9_write32 +#endif +}; diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/MMU.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/MMU.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/MMU.h 2007-02-01 06:43:01.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/MMU.h 2007-06-07 04:56:12.000000000 -0500 @@ -104,6 +104,32 @@ extern MMU_struct MMU; +struct armcpu_memory_iface { + /** the 32 bit instruction prefetch */ + u32 FASTCALL (*prefetch32)( void *data, u32 adr); + + /** the 16 bit instruction prefetch */ + u16 FASTCALL (*prefetch16)( void *data, u32 adr); + + /** read 8 bit data value */ + u8 FASTCALL (*read8)( void *data, u32 adr); + /** read 16 bit data value */ + u16 FASTCALL (*read16)( void *data, u32 adr); + /** read 32 bit data value */ + u32 FASTCALL (*read32)( void *data, u32 adr); + + /** write 8 bit data value */ + void FASTCALL (*write8)( void *data, u32 adr, u8 val); + /** write 16 bit data value */ + void FASTCALL (*write16)( void *data, u32 adr, u16 val); + /** write 32 bit data value */ + void FASTCALL (*write32)( void *data, u32 adr, u32 val); + + void *data; +}; + + + static void mmu_select_savetype(int type, int *bmemtype, u32 *bmemsize) { if (type<0 || type > 5) return; *bmemtype=save_types[type][0]; @@ -111,13 +137,13 @@ mc_realloc(&MMU.bupmem, *bmemtype, *bmemsize); } -void MMUInit(void); -void MMUDeInit(void); +void MMU_Init(void); +void MMU_DeInit(void); -void MMU_clearMem(); +void MMU_clearMem( void); void MMU_setRom(u8 * rom, u32 mask); -void MMU_unsetRom(); +void MMU_unsetRom( void); #define MMU_readByte MMU_read8 #define MMU_readHWord MMU_read16 @@ -129,7 +155,7 @@ u8 FASTCALL MMU_read8(u32 proc, u32 adr); u16 FASTCALL MMU_read16(u32 proc, u32 adr); u32 FASTCALL MMU_read32(u32 proc, u32 adr); - + #ifdef MMU_ENABLE_ACL u8 FASTCALL MMU_read8_acl(u32 proc, u32 adr, u32 access); u16 FASTCALL MMU_read16_acl(u32 proc, u32 adr, u32 access); @@ -150,6 +176,7 @@ void FASTCALL MMU_write8(u32 proc, u32 adr, u8 val); void FASTCALL MMU_write16(u32 proc, u32 adr, u16 val); void FASTCALL MMU_write32(u32 proc, u32 adr, u32 val); +void FASTCALL MMU_writeXX(u32 proc, u32 adr, u32 val, u8 nbbytes); #ifdef MMU_ENABLE_ACL void FASTCALL MMU_write8_acl(u32 proc, u32 adr, u8 val); @@ -163,6 +190,15 @@ void FASTCALL MMU_doDMA(u32 proc, u32 num); + +/* + * The base ARM memory interfaces + */ +extern struct armcpu_memory_iface arm9_base_memory_iface; +extern struct armcpu_memory_iface arm7_base_memory_iface; +extern struct armcpu_memory_iface arm9_direct_memory_iface; + + #ifdef __cplusplus } #endif diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/NDSSystem.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/NDSSystem.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/NDSSystem.c 2007-01-31 16:08:30.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/NDSSystem.c 2007-06-20 09:29:11.000000000 -0500 @@ -20,14 +20,126 @@ */ #include -#include "NDSSystem.h" #include +#include "NDSSystem.h" +#include "MMU.h" +#include "cflash.h" + +#include "MMU.h" +#include "cflash.h" #include "ROMReader.h" +/* the count of bytes copied from the firmware into memory */ +#define NDS_FW_USER_SETTINGS_MEM_BYTE_COUNT 0x70 + NDSSystem nds; -int NDS_Init(void) { +static u32 +calc_CRC16( u32 start, const u8 *data, int count) { + int i,j; + u32 crc = start & 0xffff; + static u16 val[] = { 0xC0C1,0xC181,0xC301,0xC601,0xCC01,0xD801,0xF001,0xA001 }; + for(i = 0; i < count; i++) + { + crc = crc ^ data[i]; + + for(j = 0; j < 8; j++) { + int do_bit = 0; + + if ( crc & 0x1) + do_bit = 1; + + crc = crc >> 1; + + if ( do_bit) { + crc = crc ^ (val[j] << (7-j)); + } + } + } + return crc; +} + +static int +copy_firmware_user_data( u8 *dest_buffer, const u8 *fw_data) { + /* + * Determine which of the two user settings in the firmware is the current + * and valid one and then copy this into the destination buffer. + * + * The current setting will have a greater count. + * Settings are only valid if its CRC16 is correct. + */ + int user1_valid = 0; + int user2_valid = 0; + u32 user_settings_offset; + u32 fw_crc; + u32 crc; + int copy_good = 0; + + user_settings_offset = fw_data[0x20]; + user_settings_offset |= fw_data[0x21] << 8; + user_settings_offset <<= 3; + + if ( user_settings_offset <= 0x3FE00) { + s32 copy_settings_offset = -1; + + crc = calc_CRC16( 0xffff, &fw_data[user_settings_offset], + NDS_FW_USER_SETTINGS_MEM_BYTE_COUNT); + fw_crc = fw_data[user_settings_offset + 0x72]; + fw_crc |= fw_data[user_settings_offset + 0x73] << 8; + if ( crc == fw_crc) { + user1_valid = 1; + } + + crc = calc_CRC16( 0xffff, &fw_data[user_settings_offset + 0x100], + NDS_FW_USER_SETTINGS_MEM_BYTE_COUNT); + fw_crc = fw_data[user_settings_offset + 0x100 + 0x72]; + fw_crc |= fw_data[user_settings_offset + 0x100 + 0x73] << 8; + if ( crc == fw_crc) { + user2_valid = 1; + } + + if ( user1_valid) { + if ( user2_valid) { + u16 count1, count2; + + count1 = fw_data[user_settings_offset + 0x70]; + count1 |= fw_data[user_settings_offset + 0x71] << 8; + + count2 = fw_data[user_settings_offset + 0x100 + 0x70]; + count2 |= fw_data[user_settings_offset + 0x100 + 0x71] << 8; + + if ( count2 > count1) { + copy_settings_offset = user_settings_offset + 0x100; + } + else { + copy_settings_offset = user_settings_offset; + } + } + else { + copy_settings_offset = user_settings_offset; + } + } + else if ( user2_valid) { + /* copy the second user settings */ + copy_settings_offset = user_settings_offset + 0x100; + } + + if ( copy_settings_offset > 0) { + memcpy( dest_buffer, &fw_data[copy_settings_offset], + NDS_FW_USER_SETTINGS_MEM_BYTE_COUNT); + copy_good = 1; + } + } + + return copy_good; +} + + +int NDS_Init( struct armcpu_memory_iface *arm9_mem_if, + struct armcpu_ctrl_iface **arm9_ctrl_iface, + struct armcpu_memory_iface *arm7_mem_if, + struct armcpu_ctrl_iface **arm7_ctrl_iface) { nds.ARM9Cycle = 0; nds.ARM7Cycle = 0; nds.cycles = 0; @@ -39,8 +151,8 @@ if (Screen_Init(GFXCORE_DUMMY) != 0) return -1; - armcpu_new(&NDS_ARM7,1); - armcpu_new(&NDS_ARM9,0); + armcpu_new(&NDS_ARM7,1, arm7_mem_if, arm7_ctrl_iface); + armcpu_new(&NDS_ARM9,0, arm9_mem_if, arm9_ctrl_iface); if (SPU_Init(SNDCORE_DUMMY, 735) != 0) return -1; @@ -174,7 +286,8 @@ ROM_DSGBA }; -int NDS_LoadROM(const char *filename, int bmtype, u32 bmsize) +int NDS_LoadROM( const char *filename, int bmtype, u32 bmsize, + const char *cflash_disk_image_file) { int i; int type; @@ -202,7 +315,12 @@ type = ROM_DSGBA; file = reader->Init(filename); - if (!file) return -1 ; + + if (!file) + { + free(noext); + return -1; + } size = reader->Size(file); if(type == ROM_DSGBA) @@ -226,6 +344,7 @@ if ((data = (u8*)malloc(mask + 1)) == NULL) { reader->DeInit(file); + free(noext); return -1; } @@ -239,7 +358,7 @@ * so the current one should be ok */ strncpy(szRomPath, ".", 512); /* "." is shorter then 512, yet strcpy should be avoided */ cflash_close(); - cflash_init(); + cflash_init( cflash_disk_image_file); strncpy(szRomBaseName, filename,512); @@ -250,23 +369,27 @@ // Setup Backup Memory if(type == ROM_DSGBA) + { /* be sure that we dont overwrite anything before stringstart */ if (strlen(noext)>= strlen(DSGBA_EXTENSTION)) - { - strncpy(noext + strlen(noext) - strlen(DSGBA_EXTENSTION), ".sav",strlen(DSGBA_EXTENSTION)+1); - } else - { - return -1 ; - } + strncpy(noext + strlen(noext) - strlen(DSGBA_EXTENSTION), ".sav",strlen(DSGBA_EXTENSTION)+1); + else + { + free(noext); + return -1; + } + } else + { /* be sure that we dont overwrite anything before stringstart */ if (strlen(noext)>=4) - { - strncpy(noext + strlen(noext) - 4, ".sav",5); - } else - { - return -1 ; - } + strncpy(noext + strlen(noext) - 4, ".sav",5); + else + { + free(noext); + return -1; + } + } mc_realloc(&MMU.bupmem, bmtype, bmsize); mc_load_file(&MMU.bupmem, noext); @@ -285,7 +408,9 @@ MMU.bupmem.fp = NULL; } -void NDS_Reset(void) + + +void NDS_Reset( void) { BOOL oldexecute=execute; int i; @@ -338,49 +463,20 @@ MMU_writeHWord(1, 0x04000130, 0x3FF); MMU_writeByte(1, 0x04000136, 0x43); - MMU_writeByte(0, 0x027FFCDC, 0x20); - MMU_writeByte(0, 0x027FFCDD, 0x20); - MMU_writeByte(0, 0x027FFCE2, 0xE0); - MMU_writeByte(0, 0x027FFCE3, 0x80); - - MMU_writeHWord(0, 0x027FFCD8, 0x20<<4); - MMU_writeHWord(0, 0x027FFCDA, 0x20<<4); - MMU_writeHWord(0, 0x027FFCDE, 0xE0<<4); - MMU_writeHWord(0, 0x027FFCE0, 0x80<<4); - - MMU_writeWord(0, 0x027FFE40, 0xE188); - MMU_writeWord(0, 0x027FFE44, 0x9); - MMU_writeWord(0, 0x027FFE48, 0xE194); - MMU_writeWord(0, 0x027FFE4C, 0x0); -// logcount = 0; - - MMU_writeByte(0, 0x023FFC80, 1); - MMU_writeByte(0, 0x023FFC82, 10); - MMU_writeByte(0, 0x023FFC83, 7); - MMU_writeByte(0, 0x023FFC84, 15); - - MMU_writeHWord(0, 0x023FFC86, 'y'); - MMU_writeHWord(0, 0x023FFC88, 'o'); - MMU_writeHWord(0, 0x023FFC8A, 'p'); - MMU_writeHWord(0, 0x023FFC8C, 'y'); - MMU_writeHWord(0, 0x023FFC8E, 'o'); - MMU_writeHWord(0, 0x023FFC90, 'p'); - MMU_writeHWord(0, 0x023FFC9A, 6); - - MMU_writeHWord(0, 0x023FFC9C, 'H'); - MMU_writeHWord(0, 0x023FFC9E, 'i'); - MMU_writeHWord(0, 0x023FFCA0, ','); - MMU_writeHWord(0, 0x023FFCA2, 'i'); - MMU_writeHWord(0, 0x023FFCA4, 't'); - MMU_writeHWord(0, 0x023FFCA6, '\''); - MMU_writeHWord(0, 0x023FFCA8, 's'); - MMU_writeHWord(0, 0x023FFCAA, ' '); - MMU_writeHWord(0, 0x023FFCAC, 'm'); - MMU_writeHWord(0, 0x023FFCAE, 'e'); - MMU_writeHWord(0, 0x023FFCB0, '!'); - MMU_writeHWord(0, 0x023FFCD0, 11); + /* + * Setup a copy of the firmware user settings in memory. + * (this is what the DS firmware would do). + */ + { + u8 temp_buffer[NDS_FW_USER_SETTINGS_MEM_BYTE_COUNT]; + int fw_index; - MMU_writeHWord(0, 0x023FFCE4, 2); + if ( copy_firmware_user_data( temp_buffer, MMU.fw.data)) { + for ( fw_index = 0; fw_index < NDS_FW_USER_SETTINGS_MEM_BYTE_COUNT; fw_index++) { + MMU_writeByte( 0, 0x027FFC80 + fw_index, temp_buffer[fw_index]); + } + } + } MMU_writeWord(0, 0x027FFE40, header->FNameTblOff); MMU_writeWord(0, 0x027FFE44, header->FNameTblSize); @@ -417,16 +513,16 @@ MMU_writeWord(1, 0x34, 0xE25EF004); //ARM9 BIOS IRQ HANDLER - MMU_writeWord(0, 0xFFF0018, 0xEA000000); - MMU_writeWord(0, 0xFFF0020, 0xE92D500F); - MMU_writeWord(0, 0xFFF0024, 0xEE190F11); - MMU_writeWord(0, 0xFFF0028, 0xE1A00620); - MMU_writeWord(0, 0xFFF002C, 0xE1A00600); - MMU_writeWord(0, 0xFFF0030, 0xE2800C40); - MMU_writeWord(0, 0xFFF0034, 0xE28FE000); - MMU_writeWord(0, 0xFFF0038, 0xE510F004); - MMU_writeWord(0, 0xFFF003C, 0xE8BD500F); - MMU_writeWord(0, 0xFFF0040, 0xE25EF004); + MMU_writeWord(0, 0xFFFF0018, 0xEA000000); + MMU_writeWord(0, 0xFFFF0020, 0xE92D500F); + MMU_writeWord(0, 0xFFFF0024, 0xEE190F11); + MMU_writeWord(0, 0xFFFF0028, 0xE1A00620); + MMU_writeWord(0, 0xFFFF002C, 0xE1A00600); + MMU_writeWord(0, 0xFFFF0030, 0xE2800C40); + MMU_writeWord(0, 0xFFFF0034, 0xE28FE000); + MMU_writeWord(0, 0xFFFF0038, 0xE510F004); + MMU_writeWord(0, 0xFFFF003C, 0xE8BD500F); + MMU_writeWord(0, 0xFFFF0040, 0xE25EF004); MMU_writeWord(0, 0x0000004, 0xE3A0010E); MMU_writeWord(0, 0x0000008, 0xE3A01020); @@ -441,11 +537,20 @@ GPU_Reset(SubScreen.gpu, 1); SPU_Reset(); - NDS_CreateDummyFirmware() ; - execute = oldexecute; } +int NDS_ImportSave(const char *filename) +{ + if (strlen(filename) < 4) + return 0; + + if (memcmp(filename+strlen(filename)-4, ".duc", 4) == 0) + return mc_load_duc(&MMU.bupmem, filename); + + return 0; +} + typedef struct { u32 size; @@ -535,11 +640,106 @@ return 1; } +static void +fill_user_data_area( struct NDS_fw_config_data *user_settings, + u8 *data, int count) { + u32 crc; + int i; + u8 *ts_cal_data_area; + + memset( data, 0, 0x100); + + /* version */ + data[0x00] = 5; + data[0x01] = 0; + + /* colour */ + data[0x02] = user_settings->fav_colour; + + /* birthday month and day */ + data[0x03] = user_settings->birth_month; + data[0x04] = user_settings->birth_day; + + /* nickname and length */ + for ( i = 0; i < MAX_FW_NICKNAME_LENGTH; i++) { + data[0x06 + (i * 2)] = user_settings->nickname[i] & 0xff; + data[0x06 + (i * 2) + 1] = (user_settings->nickname[i] >> 8) & 0xff; + } + + data[0x1a] = user_settings->nickname_len; + + /* Message */ + for ( i = 0; i < MAX_FW_MESSAGE_LENGTH; i++) { + data[0x1c + (i * 2)] = user_settings->message[i] & 0xff; + data[0x1c + (i * 2) + 1] = (user_settings->message[i] >> 8) & 0xff; + } + + data[0x50] = user_settings->message_len; + + /* + * touch screen calibration + */ + ts_cal_data_area = &data[0x58]; + for ( i = 0; i < 2; i++) { + /* ADC x y */ + *ts_cal_data_area++ = user_settings->touch_cal[i].adc_x & 0xff; + *ts_cal_data_area++ = (user_settings->touch_cal[i].adc_x >> 8) & 0xff; + *ts_cal_data_area++ = user_settings->touch_cal[i].adc_y & 0xff; + *ts_cal_data_area++ = (user_settings->touch_cal[i].adc_y >> 8) & 0xff; + + /* screen x y */ + *ts_cal_data_area++ = user_settings->touch_cal[i].screen_x; + *ts_cal_data_area++ = user_settings->touch_cal[i].screen_y; + } + + /* language and flags */ + data[0x64] = user_settings->language; + data[0x65] = 0xfc; + + /* update count and crc */ + data[0x70] = count & 0xff; + data[0x71] = (count >> 8) & 0xff; + + crc = calc_CRC16( 0xffff, data, 0x70); + data[0x72] = crc & 0xff; + data[0x73] = (crc >> 8) & 0xff; + + memset( &data[0x74], 0xff, 0x100 - 0x74); +} + /* creates an firmware flash image, which contains all needed info to initiate a wifi connection */ -int NDS_CreateDummyFirmware(void) +int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings) { + /* + * Create the firmware header + */ + memset( MMU.fw.data, 0, 0x200); + + /* firmware identifier */ + MMU.fw.data[0x8] = 'M'; + MMU.fw.data[0x8 + 1] = 'A'; + MMU.fw.data[0x8 + 2] = 'C'; + MMU.fw.data[0x8 + 3] = 'P'; + + /* DS type */ + if ( user_settings->ds_type == NDS_FW_DS_TYPE_LITE) + MMU.fw.data[0x1d] = 0x20; + else + MMU.fw.data[0x1d] = 0xff; + + /* User Settings offset 0x3fe00 / 8 */ + MMU.fw.data[0x20] = 0xc0; + MMU.fw.data[0x21] = 0x7f; + + + /* + * User settings (at 0x3FE00 and 0x3FE00) + */ + fill_user_data_area( user_settings, &MMU.fw.data[ 0x3FE00], 0); + fill_user_data_area( user_settings, &MMU.fw.data[ 0x3FF00], 1); + + #ifdef EXPERIMENTAL_WIFI - memcpy(MMU.fw.data+0x36,FW_Mac,sizeof(FW_Mac)) ; memcpy(MMU.fw.data+0x44,FW_WIFIInit,sizeof(FW_WIFIInit)) ; MMU.fw.data[0x41] = 18 ; /* bits per RF value */ @@ -554,6 +754,48 @@ return TRUE ; } +void +NDS_FillDefaultFirmwareConfigData( struct NDS_fw_config_data *fw_config) { + const char *default_nickname = "yopyop"; + const char *default_message = "DeSmuME makes you happy!"; + int i; + int str_length; + + memset( fw_config, 0, sizeof( struct NDS_fw_config_data)); + fw_config->ds_type = NDS_FW_DS_TYPE_FAT; + + fw_config->fav_colour = 7; + + fw_config->birth_day = 23; + fw_config->birth_month = 6; + + str_length = strlen( default_nickname); + for ( i = 0; i < str_length; i++) { + fw_config->nickname[i] = default_nickname[i]; + } + fw_config->nickname_len = str_length; + + str_length = strlen( default_message); + for ( i = 0; i < str_length; i++) { + fw_config->message[i] = default_message[i]; + } + fw_config->message_len = str_length; + + /* default to English */ + fw_config->language = 1; + + /* default touchscreen calibration */ + fw_config->touch_cal[0].adc_x = 0x200; + fw_config->touch_cal[0].adc_y = 0x200; + fw_config->touch_cal[0].screen_x = 0x20; + fw_config->touch_cal[0].screen_y = 0x20; + + fw_config->touch_cal[1].adc_x = 0xe00; + fw_config->touch_cal[1].adc_y = 0x800; + fw_config->touch_cal[1].screen_x = 0xe0; + fw_config->touch_cal[1].screen_y = 0x80; +} + int NDS_LoadFirmware(const char *filename) { int i; @@ -578,3 +820,656 @@ return i; } + +#define INDEX(i) ((((i)>>16)&0xFF0)|(((i)>>4)&0xF)) +u32 +NDS_exec(s32 nb, BOOL force) +{ + nb += nds.cycles;//(nds.cycles>>26)<<26; + + for(; (nb >= nds.cycles) && ((force)||(execute)); ) + { + if(nds.ARM9Cycle<=nds.cycles) + { +#ifdef LOG_ARM9 + if(logcount==3){ + if(NDS_ARM9.CPSR.bits.T) + des_thumb_instructions_set[(NDS_ARM9.instruction)>>6](NDS_ARM9.instruct_adr, NDS_ARM9.instruction, logbuf); + else + des_arm_instructions_set[INDEX(NDS_ARM9.instruction)](NDS_ARM9.instruct_adr, NDS_ARM9.instruction, logbuf); + sprintf(logbuf, "%s\t%08X\n\t R00: %08X, R01: %08X, R02: %08X, R03: %08X, R04: %08X, R05: %08X, R06: %08X, R07: %08X,\n\t R08: %08X, R09: %08X, R10: %08X, R11: %08X, R12: %08X, R13: %08X, R14: %08X, R15: %08X,\n\t CPSR: %08X , SPSR: %08X", + logbuf, NDS_ARM9.instruction, NDS_ARM9.R[0], NDS_ARM9.R[1], NDS_ARM9.R[2], NDS_ARM9.R[3], NDS_ARM9.R[4], NDS_ARM9.R[5], NDS_ARM9.R[6], NDS_ARM9.R[7], + NDS_ARM9.R[8], NDS_ARM9.R[9], NDS_ARM9.R[10], NDS_ARM9.R[11], NDS_ARM9.R[12], NDS_ARM9.R[13], NDS_ARM9.R[14], NDS_ARM9.R[15], + NDS_ARM9.CPSR, NDS_ARM9.SPSR); + LOG(logbuf); + } +#endif + if(NDS_ARM9.waitIRQ) + nds.ARM9Cycle += 100; + else + //nds.ARM9Cycle += NDS_ARM9.exec(); + nds.ARM9Cycle += armcpu_exec(&NDS_ARM9); + } + +#ifdef EXPERIMENTAL_WIFI + + if((nds.ARM7Cycle % 0x3F03) == 0) + { + /* 3F03 arm7 cyles = ~1usec */ + WIFI_usTrigger(&wifiMac) ; + } +#endif + if(nds.ARM7Cycle<=nds.cycles) + { +#ifdef LOG_ARM7 + if(logcount==1){ + if(NDS_ARM7.CPSR.bits.T) + des_thumb_instructions_set[(NDS_ARM7.instruction)>>6](NDS_ARM7.instruct_adr, NDS_ARM7.instruction, logbuf); + else + des_arm_instructions_set[INDEX(NDS_ARM7.instruction)](NDS_ARM7.instruct_adr, NDS_ARM7.instruction, logbuf); + sprintf(logbuf, "%s\n\t R00: %08X, R01: %08X, R02: %08X, R03: %08X, R04: %08X, R05: %08X, R06: %08X, R07: %08X,\n\t R08: %08X, R09: %08X, R10: %08X, R11: %08X, R12: %08X, R13: %08X, R14: %08X, R15: %08X,\n\t CPSR: %08X , SPSR: %08X", + logbuf, NDS_ARM7.R[0], NDS_ARM7.R[1], NDS_ARM7.R[2], NDS_ARM7.R[3], NDS_ARM7.R[4], NDS_ARM7.R[5], NDS_ARM7.R[6], NDS_ARM7.R[7], + NDS_ARM7.R[8], NDS_ARM7.R[9], NDS_ARM7.R[10], NDS_ARM7.R[11], NDS_ARM7.R[12], NDS_ARM7.R[13], NDS_ARM7.R[14], NDS_ARM7.R[15], + NDS_ARM7.CPSR, NDS_ARM7.SPSR); + LOG(logbuf); + } +#endif + if(NDS_ARM7.waitIRQ) + nds.ARM7Cycle += 100; + else + //nds.ARM7Cycle += (NDS_ARM7.exec()<<1); + nds.ARM7Cycle += (armcpu_exec(&NDS_ARM7)<<1); + } + nds.cycles = (nds.ARM9Cycle=nds.nextHBlank) + { + if(!nds.lignerendu) + { + T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) | 2); + T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 2); + NDS_ARM9HBlankInt(); + NDS_ARM7HBlankInt(); + + if(nds.VCount<192) + { + GPU_ligne(&MainScreen, nds.VCount); + GPU_ligne(&SubScreen, nds.VCount); + + if(MMU.DMAStartTime[0][0] == 2) + MMU_doDMA(0, 0); + if(MMU.DMAStartTime[0][1] == 2) + MMU_doDMA(0, 1); + if(MMU.DMAStartTime[0][2] == 2) + MMU_doDMA(0, 2); + if(MMU.DMAStartTime[0][3] == 2) + MMU_doDMA(0, 3); + } + nds.lignerendu = TRUE; + } + if(nds.cycles>=nds.nextHBlank+1092) + { + u32 vmatch; + + ++nds.VCount; + nds.nextHBlank += 4260; + T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0xFFFD); + T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) & 0xFFFD); + + if(MMU.DMAStartTime[0][0] == 3) + MMU_doDMA(0, 0); + if(MMU.DMAStartTime[0][1] == 3) + MMU_doDMA(0, 1); + if(MMU.DMAStartTime[0][2] == 3) + MMU_doDMA(0, 2); + if(MMU.DMAStartTime[0][3] == 3) + MMU_doDMA(0, 3); + + // Main memory display + if(MMU.DMAStartTime[0][0] == 4) + { + MMU_doDMA(0, 0); + MMU.DMAStartTime[0][0] = 0; + } + if(MMU.DMAStartTime[0][1] == 4) + { + MMU_doDMA(0, 1); + MMU.DMAStartTime[0][1] = 0; + } + if(MMU.DMAStartTime[0][2] == 4) + { + MMU_doDMA(0, 2); + MMU.DMAStartTime[0][2] = 0; + } + if(MMU.DMAStartTime[0][3] == 4) + { + MMU_doDMA(0, 3); + MMU.DMAStartTime[0][3] = 0; + } + + if(MMU.DMAStartTime[1][0] == 4) + { + MMU_doDMA(1, 0); + MMU.DMAStartTime[1][0] = 0; + } + if(MMU.DMAStartTime[1][1] == 4) + { + MMU_doDMA(1, 1); + MMU.DMAStartTime[0][1] = 0; + } + if(MMU.DMAStartTime[1][2] == 4) + { + MMU_doDMA(1, 2); + MMU.DMAStartTime[1][2] = 0; + } + if(MMU.DMAStartTime[1][3] == 4) + { + MMU_doDMA(1, 3); + MMU.DMAStartTime[1][3] = 0; + } + + nds.lignerendu = FALSE; + if(nds.VCount==192) + { + T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) | 1); + T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 1); + NDS_ARM9VBlankInt(); + NDS_ARM7VBlankInt(); + + if(MMU.DMAStartTime[0][0] == 1) + MMU_doDMA(0, 0); + if(MMU.DMAStartTime[0][1] == 1) + MMU_doDMA(0, 1); + if(MMU.DMAStartTime[0][2] == 1) + MMU_doDMA(0, 2); + if(MMU.DMAStartTime[0][3] == 1) + MMU_doDMA(0, 3); + + if(MMU.DMAStartTime[1][0] == 1) + MMU_doDMA(1, 0); + if(MMU.DMAStartTime[1][1] == 1) + MMU_doDMA(1, 1); + if(MMU.DMAStartTime[1][2] == 1) + MMU_doDMA(1, 2); + if(MMU.DMAStartTime[1][3] == 1) + MMU_doDMA(1, 3); + } + else + if(nds.VCount==263) + { + nds.nextHBlank = 3168; + nds.VCount = 0; + T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0xFFFE); + T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) & 0xFFFE); + + nds.cycles -= (560190<<1); + nds.ARM9Cycle -= (560190<<1); + nds.ARM7Cycle -= (560190<<1); + nb -= (560190<<1); + if(MMU.timerON[0][0]) + nds.timerCycle[0][0] -= (560190<<1); + if(MMU.timerON[0][1]) + nds.timerCycle[0][1] -= (560190<<1); + if(MMU.timerON[0][2]) + nds.timerCycle[0][2] -= (560190<<1); + if(MMU.timerON[0][3]) + nds.timerCycle[0][3] -= (560190<<1); + + if(MMU.timerON[1][0]) + nds.timerCycle[1][0] -= (560190<<1); + if(MMU.timerON[1][1]) + nds.timerCycle[1][1] -= (560190<<1); + if(MMU.timerON[1][2]) + nds.timerCycle[1][2] -= (560190<<1); + if(MMU.timerON[1][3]) + nds.timerCycle[1][3] -= (560190<<1); + if(MMU.DMAing[0][0]) + MMU.DMACycle[0][0] -= (560190<<1); + if(MMU.DMAing[0][1]) + MMU.DMACycle[0][1] -= (560190<<1); + if(MMU.DMAing[0][2]) + MMU.DMACycle[0][2] -= (560190<<1); + if(MMU.DMAing[0][3]) + MMU.DMACycle[0][3] -= (560190<<1); + if(MMU.DMAing[1][0]) + MMU.DMACycle[1][0] -= (560190<<1); + if(MMU.DMAing[1][1]) + MMU.DMACycle[1][1] -= (560190<<1); + if(MMU.DMAing[1][2]) + MMU.DMACycle[1][2] -= (560190<<1); + if(MMU.DMAing[1][3]) + MMU.DMACycle[1][3] -= (560190<<1); + } + + T1WriteWord(ARM9Mem.ARM9_REG, 6, nds.VCount); + T1WriteWord(MMU.ARM7_REG, 6, nds.VCount); + + vmatch = T1ReadWord(ARM9Mem.ARM9_REG, 4); + if((nds.VCount==(vmatch>>8)|((vmatch<<1)&(1<<8)))) + { + T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) | 4); + if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 32) + NDS_makeARM9Int(2); + } + else + T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0xFFFB); + + vmatch = T1ReadWord(MMU.ARM7_REG, 4); + if((nds.VCount==(vmatch>>8)|((vmatch<<1)&(1<<8)))) + { + T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 4); + if(T1ReadWord(MMU.ARM7_REG, 4) & 32) + NDS_makeARM7Int(2); + } + else + T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) & 0xFFFB); + } + } + /* assume the timers have not expired */ + nds.timerOver[0][0] = 0; + nds.timerOver[0][1] = 0; + nds.timerOver[0][2] = 0; + nds.timerOver[0][3] = 0; + nds.timerOver[1][0] = 0; + nds.timerOver[1][1] = 0; + nds.timerOver[1][2] = 0; + nds.timerOver[1][3] = 0; + if(MMU.timerON[0][0]) + { + if(MMU.timerRUN[0][0]) + { + switch(MMU.timerMODE[0][0]) + { + case 0xFFFF : + break; + default : + { + nds.diff = (nds.cycles - nds.timerCycle[0][0])>>MMU.timerMODE[0][0]; + nds.old = MMU.timer[0][0]; + MMU.timer[0][0] += nds.diff; + nds.timerCycle[0][0] += (nds.diff << MMU.timerMODE[0][0]); + nds.timerOver[0][0] = nds.old>MMU.timer[0][0]; + if(nds.timerOver[0][0]) + { + if(T1ReadWord(ARM9Mem.ARM9_REG, 0x102) & 0x40) + NDS_makeARM9Int(3); + MMU.timer[0][0] = MMU.timerReload[0][0]; + } + } + break; + } + } + else + { + MMU.timerRUN[0][0] = TRUE; + nds.timerCycle[0][0] = nds.cycles; + } + } + if(MMU.timerON[0][1]) + { + if(MMU.timerRUN[0][1]) + { + switch(MMU.timerMODE[0][1]) + { + case 0xFFFF : + if(nds.timerOver[0][0]) + { + ++(MMU.timer[0][1]); + nds.timerOver[0][1] = !MMU.timer[0][1]; + if (nds.timerOver[0][1]) + { + if(T1ReadWord(ARM9Mem.ARM9_REG, 0x106) & 0x40) + NDS_makeARM9Int(4); + MMU.timer[0][1] = MMU.timerReload[0][1]; + } + } + break; + default : + { + nds.diff = (nds.cycles - nds.timerCycle[0][1])>>MMU.timerMODE[0][1]; + nds.old = MMU.timer[0][1]; + MMU.timer[0][1] += nds.diff; + nds.timerCycle[0][1] += nds.diff << MMU.timerMODE[0][1]; + nds.timerOver[0][1] = nds.old>MMU.timer[0][1]; + if(nds.timerOver[0][1]) + { + if(T1ReadWord(ARM9Mem.ARM9_REG, 0x106) & 0x40) + NDS_makeARM9Int(4); + MMU.timer[0][1] = MMU.timerReload[0][1]; + } + } + break; + + } + } + else + { + MMU.timerRUN[0][1] = TRUE; + nds.timerCycle[0][1] = nds.cycles; + } + } + if(MMU.timerON[0][2]) + { + if(MMU.timerRUN[0][2]) + { + switch(MMU.timerMODE[0][2]) + { + case 0xFFFF : + if(nds.timerOver[0][1]) + { + ++(MMU.timer[0][2]); + nds.timerOver[0][2] = !MMU.timer[0][2]; + if (nds.timerOver[0][2]) + { + if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10A) & 0x40) + NDS_makeARM9Int(5); + MMU.timer[0][2] = MMU.timerReload[0][2]; + } + } + break; + default : + { + nds.diff = (nds.cycles - nds.timerCycle[0][2])>>MMU.timerMODE[0][2]; + nds.old = MMU.timer[0][2]; + MMU.timer[0][2] += nds.diff; + nds.timerCycle[0][2] += nds.diff << MMU.timerMODE[0][2]; + nds.timerOver[0][2] = nds.old>MMU.timer[0][2]; + if(nds.timerOver[0][2]) + { + if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10A) & 0x40) + NDS_makeARM9Int(5); + MMU.timer[0][2] = MMU.timerReload[0][2]; + } + } + break; + } + } + else + { + MMU.timerRUN[0][2] = TRUE; + nds.timerCycle[0][2] = nds.cycles; + } + } + if(MMU.timerON[0][3]) + { + if(MMU.timerRUN[0][3]) + { + switch(MMU.timerMODE[0][3]) + { + case 0xFFFF : + if(nds.timerOver[0][2]) + { + ++(MMU.timer[0][3]); + nds.timerOver[0][3] = !MMU.timer[0][3]; + if (nds.timerOver[0][3]) + { + if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10E) & 0x40) + NDS_makeARM9Int(6); + MMU.timer[0][3] = MMU.timerReload[0][3]; + } + } + break; + default : + { + nds.diff = (nds.cycles - nds.timerCycle[0][3])>>MMU.timerMODE[0][3]; + nds.old = MMU.timer[0][3]; + MMU.timer[0][3] += nds.diff; + nds.timerCycle[0][3] += nds.diff << MMU.timerMODE[0][3]; + nds.timerOver[0][3] = nds.old>MMU.timer[0][3]; + if(nds.timerOver[0][3]) + { + if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10E) & 0x40) + NDS_makeARM9Int(6); + MMU.timer[0][3] = MMU.timerReload[0][3]; + } + } + break; + } + } + else + { + MMU.timerRUN[0][3] = TRUE; + nds.timerCycle[0][3] = nds.cycles; + } + } + + if(MMU.timerON[1][0]) + { + if(MMU.timerRUN[1][0]) + { + switch(MMU.timerMODE[1][0]) + { + case 0xFFFF : + break; + default : + { + nds.diff = (nds.cycles - nds.timerCycle[1][0])>>MMU.timerMODE[1][0]; + nds.old = MMU.timer[1][0]; + MMU.timer[1][0] += nds.diff; + nds.timerCycle[1][0] += nds.diff << MMU.timerMODE[1][0]; + nds.timerOver[1][0] = nds.old>MMU.timer[1][0]; + if(nds.timerOver[1][0]) + { + if(T1ReadWord(MMU.ARM7_REG, 0x102) & 0x40) + NDS_makeARM7Int(3); + MMU.timer[1][0] = MMU.timerReload[1][0]; + } + } + break; + } + } + else + { + MMU.timerRUN[1][0] = TRUE; + nds.timerCycle[1][0] = nds.cycles; + } + } + if(MMU.timerON[1][1]) + { + if(MMU.timerRUN[1][1]) + { + switch(MMU.timerMODE[1][1]) + { + case 0xFFFF : + if(nds.timerOver[1][0]) + { + ++(MMU.timer[1][1]); + nds.timerOver[1][1] = !MMU.timer[1][1]; + if (nds.timerOver[1][1]) + { + if(T1ReadWord(MMU.ARM7_REG, 0x106) & 0x40) + NDS_makeARM7Int(4); + MMU.timer[1][1] = MMU.timerReload[1][1]; + } + } + break; + default : + { + nds.diff = (nds.cycles - nds.timerCycle[1][1])>>MMU.timerMODE[1][1]; + nds.old = MMU.timer[1][1]; + MMU.timer[1][1] += nds.diff; + nds.timerCycle[1][1] += nds.diff << MMU.timerMODE[1][1]; + nds.timerOver[1][1] = nds.old>MMU.timer[1][1]; + if(nds.timerOver[1][1]) + { + if(T1ReadWord(MMU.ARM7_REG, 0x106) & 0x40) + NDS_makeARM7Int(4); + MMU.timer[1][1] = MMU.timerReload[1][1]; + } + } + break; + } + } + else + { + MMU.timerRUN[1][1] = TRUE; + nds.timerCycle[1][1] = nds.cycles; + } + } + if(MMU.timerON[1][2]) + { + if(MMU.timerRUN[1][2]) + { + switch(MMU.timerMODE[1][2]) + { + case 0xFFFF : + if(nds.timerOver[1][1]) + { + ++(MMU.timer[1][2]); + nds.timerOver[1][2] = !MMU.timer[1][2]; + if (nds.timerOver[1][2]) + { + if(T1ReadWord(MMU.ARM7_REG, 0x10A) & 0x40) + NDS_makeARM7Int(5); + MMU.timer[1][2] = MMU.timerReload[1][2]; + } + } + break; + default : + { + nds.diff = (nds.cycles - nds.timerCycle[1][2])>>MMU.timerMODE[1][2]; + nds.old = MMU.timer[1][2]; + MMU.timer[1][2] += nds.diff; + nds.timerCycle[1][2] += nds.diff << MMU.timerMODE[1][2]; + nds.timerOver[1][2] = nds.old>MMU.timer[1][2]; + if(nds.timerOver[1][2]) + { + if(T1ReadWord(MMU.ARM7_REG, 0x10A) & 0x40) + NDS_makeARM7Int(5); + MMU.timer[1][2] = MMU.timerReload[1][2]; + } + } + break; + } + } + else + { + MMU.timerRUN[1][2] = TRUE; + nds.timerCycle[1][2] = nds.cycles; + } + } + if(MMU.timerON[1][3]) + { + if(MMU.timerRUN[1][3]) + { + switch(MMU.timerMODE[1][3]) + { + case 0xFFFF : + if(nds.timerOver[1][2]) + { + ++(MMU.timer[1][3]); + nds.timerOver[1][3] = !MMU.timer[1][3]; + if (nds.timerOver[1][3]) + { + if(T1ReadWord(MMU.ARM7_REG, 0x10E) & 0x40) + NDS_makeARM7Int(6); + MMU.timer[1][3] += MMU.timerReload[1][3]; + } + } + break; + default : + { + nds.diff = (nds.cycles - nds.timerCycle[1][3])>>MMU.timerMODE[1][3]; + nds.old = MMU.timer[1][3]; + MMU.timer[1][3] += nds.diff; + nds.timerCycle[1][3] += nds.diff << MMU.timerMODE[1][3]; + nds.timerOver[1][3] = nds.old>MMU.timer[1][3]; + if(nds.timerOver[1][3]) + { + if(T1ReadWord(MMU.ARM7_REG, 0x10E) & 0x40) + NDS_makeARM7Int(6); + MMU.timer[1][3] += MMU.timerReload[1][3]; + } + } + break; + } + } + else + { + MMU.timerRUN[1][3] = TRUE; + nds.timerCycle[1][3] = nds.cycles; + } + } + + if((MMU.DMAing[0][0])&&(MMU.DMACycle[0][0]<=nds.cycles)) + { + T1WriteLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*0), T1ReadLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*0)) & 0x7FFFFFFF); + if((MMU.DMACrt[0][0])&(1<<30)) NDS_makeARM9Int(8); + MMU.DMAing[0][0] = FALSE; + } + + if((MMU.DMAing[0][1])&&(MMU.DMACycle[0][1]<=nds.cycles)) + { + T1WriteLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*1), T1ReadLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*1)) & 0x7FFFFFFF); + if((MMU.DMACrt[0][1])&(1<<30)) NDS_makeARM9Int(9); + MMU.DMAing[0][1] = FALSE; + } + + if((MMU.DMAing[0][2])&&(MMU.DMACycle[0][2]<=nds.cycles)) + { + T1WriteLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*2), T1ReadLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*2)) & 0x7FFFFFFF); + if((MMU.DMACrt[0][2])&(1<<30)) NDS_makeARM9Int(10); + MMU.DMAing[0][2] = FALSE; + } + + if((MMU.DMAing[0][3])&&(MMU.DMACycle[0][3]<=nds.cycles)) + { + T1WriteLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*3), T1ReadLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*3)) & 0x7FFFFFFF); + if((MMU.DMACrt[0][3])&(1<<30)) NDS_makeARM9Int(11); + MMU.DMAing[0][3] = FALSE; + } + + if((MMU.DMAing[1][0])&&(MMU.DMACycle[1][0]<=nds.cycles)) + { + T1WriteLong(MMU.ARM7_REG, 0xB8 + (0xC*0), T1ReadLong(MMU.ARM7_REG, 0xB8 + (0xC*0)) & 0x7FFFFFFF); + if((MMU.DMACrt[1][0])&(1<<30)) NDS_makeARM7Int(8); + MMU.DMAing[1][0] = FALSE; + } + + if((MMU.DMAing[1][1])&&(MMU.DMACycle[1][1]<=nds.cycles)) + { + T1WriteLong(MMU.ARM7_REG, 0xB8 + (0xC*1), T1ReadLong(MMU.ARM7_REG, 0xB8 + (0xC*1)) & 0x7FFFFFFF); + if((MMU.DMACrt[1][1])&(1<<30)) NDS_makeARM7Int(9); + MMU.DMAing[1][1] = FALSE; + } + + if((MMU.DMAing[1][2])&&(MMU.DMACycle[1][2]<=nds.cycles)) + { + T1WriteLong(MMU.ARM7_REG, 0xB8 + (0xC*2), T1ReadLong(MMU.ARM7_REG, 0xB8 + (0xC*2)) & 0x7FFFFFFF); + if((MMU.DMACrt[1][2])&(1<<30)) NDS_makeARM7Int(10); + MMU.DMAing[1][2] = FALSE; + } + + if((MMU.DMAing[1][3])&&(MMU.DMACycle[1][3]<=nds.cycles)) + { + T1WriteLong(MMU.ARM7_REG, 0xB8 + (0xC*3), T1ReadLong(MMU.ARM7_REG, 0xB8 + (0xC*3)) & 0x7FFFFFFF); + if((MMU.DMACrt[1][3])&(1<<30)) NDS_makeARM7Int(11); + MMU.DMAing[1][3] = FALSE; + } + + if((MMU.reg_IF[0]&MMU.reg_IE[0]) && (MMU.reg_IME[0])) + //if(NDS_ARM9.irqExeption()) + if ( armcpu_flagIrq( &NDS_ARM9)) { + nds.ARM9Cycle = nds.cycles; + } + /* + if(armcpu_irqExeption(&NDS_ARM9)) + { + nds.ARM9Cycle = nds.cycles; + } + */ + + if((MMU.reg_IF[1]&MMU.reg_IE[1]) && (MMU.reg_IME[1])) + if ( armcpu_flagIrq( &NDS_ARM7)) { + nds.ARM7Cycle = nds.cycles; + } + /* + if (armcpu_irqExeption(&NDS_ARM7)) + nds.ARM7Cycle = nds.cycles; + */ + + } + return nds.cycles; +} diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/NDSSystem.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/NDSSystem.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/NDSSystem.h 2007-01-25 13:58:15.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/NDSSystem.h 2007-06-20 09:29:11.000000000 -0500 @@ -35,9 +35,23 @@ extern "C" { #endif + extern volatile BOOL execute; extern BOOL click; +/* + * The firmware language values + */ +#define NDS_FW_LANG_JAP 0 +#define NDS_FW_LANG_ENG 1 +#define NDS_FW_LANG_FRE 2 +#define NDS_FW_LANG_GER 3 +#define NDS_FW_LANG_ITA 4 +#define NDS_FW_LANG_SPA 5 +#define NDS_FW_LANG_CHI 6 +#define NDS_FW_LANG_RES 7 + + //#define LOG_ARM9 //#define LOG_ARM7 @@ -111,10 +125,54 @@ u16 touchY; } NDSSystem; +/** /brief A touchscreen calibration point. + */ +struct NDS_fw_touchscreen_cal { + u16 adc_x; + u16 adc_y; + + u8 screen_x; + u8 screen_y; +}; + +/** /brief The type of DS + */ +enum nds_fw_ds_type { + NDS_FW_DS_TYPE_FAT, + NDS_FW_DS_TYPE_LITE +}; + +#define MAX_FW_NICKNAME_LENGTH 10 +#define MAX_FW_MESSAGE_LENGTH 26 + +struct NDS_fw_config_data { + enum nds_fw_ds_type ds_type; + + u8 fav_colour; + u8 birth_month; + u8 birth_day; + + u16 nickname[MAX_FW_NICKNAME_LENGTH]; + u8 nickname_len; + + u16 message[MAX_FW_MESSAGE_LENGTH]; + u8 message_len; + + u8 language; + + /* touchscreen calibration */ + struct NDS_fw_touchscreen_cal touch_cal[2]; +}; + extern NDSSystem nds; -int NDSInit(void); -void NDSDeInit(void); +int NDS_Init( struct armcpu_memory_iface *arm9_mem_if, + struct armcpu_ctrl_iface **arm9_ctrl_iface, + struct armcpu_memory_iface *arm7_mem_if, + struct armcpu_ctrl_iface **arm7_ctrl_iface); +void NDS_DeInit(void); +void +NDS_FillDefaultFirmwareConfigData( struct NDS_fw_config_data *fw_config); BOOL NDS_SetROM(u8 * rom, u32 mask); NDS_header * NDS_getROMHeader(void); @@ -122,13 +180,17 @@ void NDS_setTouchPos(u16 x, u16 y); void NDS_releasTouch(void); -int NDS_LoadROM(const char *filename, int bmtype, u32 bmsize); +int NDS_LoadROM(const char *filename, int bmtype, u32 bmsize, + const char *cflash_disk_image_file); void NDS_FreeROM(void); void NDS_Reset(void); +int NDS_ImportSave(const char *filename); int NDS_WriteBMP(const char *filename); int NDS_LoadFirmware(const char *filename); -int NDS_CreateDummyFirmware(void); +int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings); +u32 +NDS_exec(s32 nb, BOOL force); static INLINE void NDS_ARM9HBlankInt(void) { @@ -174,632 +236,11 @@ SubScreen.offset = tmp; } - #define INDEX(i) ((((i)>>16)&0xFF0)|(((i)>>4)&0xF)) - static INLINE u32 NDS_exec(s32 nb, BOOL force) - { - nb += nds.cycles;//(nds.cycles>>26)<<26; - - for(; (nb >= nds.cycles) && ((force)||(execute)); ) - { - if(nds.ARM9Cycle<=nds.cycles) - { - #ifdef LOG_ARM9 - if(logcount==3){ - if(NDS_ARM9.CPSR.bits.T) - des_thumb_instructions_set[(NDS_ARM9.instruction)>>6](NDS_ARM9.instruct_adr, NDS_ARM9.instruction, logbuf); - else - des_arm_instructions_set[INDEX(NDS_ARM9.instruction)](NDS_ARM9.instruct_adr, NDS_ARM9.instruction, logbuf); - sprintf(logbuf, "%s\t%08X\n\t R00: %08X, R01: %08X, R02: %08X, R03: %08X, R04: %08X, R05: %08X, R06: %08X, R07: %08X,\n\t R08: %08X, R09: %08X, R10: %08X, R11: %08X, R12: %08X, R13: %08X, R14: %08X, R15: %08X,\n\t CPSR: %08X , SPSR: %08X", - logbuf, NDS_ARM9.instruction, NDS_ARM9.R[0], NDS_ARM9.R[1], NDS_ARM9.R[2], NDS_ARM9.R[3], NDS_ARM9.R[4], NDS_ARM9.R[5], NDS_ARM9.R[6], NDS_ARM9.R[7], - NDS_ARM9.R[8], NDS_ARM9.R[9], NDS_ARM9.R[10], NDS_ARM9.R[11], NDS_ARM9.R[12], NDS_ARM9.R[13], NDS_ARM9.R[14], NDS_ARM9.R[15], - NDS_ARM9.CPSR, NDS_ARM9.SPSR); - LOG(logbuf); - } - #endif - if(NDS_ARM9.waitIRQ) - nds.ARM9Cycle += 100; - else - //nds.ARM9Cycle += NDS_ARM9.exec(); - nds.ARM9Cycle += armcpu_exec(&NDS_ARM9); - } - -#ifdef EXPERIMENTAL_WIFI - - if((nds.ARM7Cycle % 0x3F03) == 0) - { - /* 3F03 arm7 cyles = ~1usec */ - WIFI_usTrigger(&wifiMac) ; - } -#endif - if(nds.ARM7Cycle<=nds.cycles) - { - #ifdef LOG_ARM7 - if(logcount==1){ - if(NDS_ARM7.CPSR.bits.T) - des_thumb_instructions_set[(NDS_ARM7.instruction)>>6](NDS_ARM7.instruct_adr, NDS_ARM7.instruction, logbuf); - else - des_arm_instructions_set[INDEX(NDS_ARM7.instruction)](NDS_ARM7.instruct_adr, NDS_ARM7.instruction, logbuf); - sprintf(logbuf, "%s\n\t R00: %08X, R01: %08X, R02: %08X, R03: %08X, R04: %08X, R05: %08X, R06: %08X, R07: %08X,\n\t R08: %08X, R09: %08X, R10: %08X, R11: %08X, R12: %08X, R13: %08X, R14: %08X, R15: %08X,\n\t CPSR: %08X , SPSR: %08X", - logbuf, NDS_ARM7.R[0], NDS_ARM7.R[1], NDS_ARM7.R[2], NDS_ARM7.R[3], NDS_ARM7.R[4], NDS_ARM7.R[5], NDS_ARM7.R[6], NDS_ARM7.R[7], - NDS_ARM7.R[8], NDS_ARM7.R[9], NDS_ARM7.R[10], NDS_ARM7.R[11], NDS_ARM7.R[12], NDS_ARM7.R[13], NDS_ARM7.R[14], NDS_ARM7.R[15], - NDS_ARM7.CPSR, NDS_ARM7.SPSR); - LOG(logbuf); - } - #endif - if(NDS_ARM7.waitIRQ) - nds.ARM7Cycle += 100; - else - //nds.ARM7Cycle += (NDS_ARM7.exec()<<1); - nds.ARM7Cycle += (armcpu_exec(&NDS_ARM7)<<1); - } - nds.cycles = (nds.ARM9Cycle=nds.nextHBlank) - { - if(!nds.lignerendu) - { - if(nds.VCount<192) - { - GPU_ligne(&MainScreen, nds.VCount); - GPU_ligne(&SubScreen, nds.VCount); - T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) | 2); - T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 2); - NDS_ARM9HBlankInt(); - NDS_ARM7HBlankInt(); - if(MMU.DMAStartTime[0][0] == 2) - MMU_doDMA(0, 0); - if(MMU.DMAStartTime[0][1] == 2) - MMU_doDMA(0, 1); - if(MMU.DMAStartTime[0][2] == 2) - MMU_doDMA(0, 2); - if(MMU.DMAStartTime[0][3] == 2) - MMU_doDMA(0, 3); - } - nds.lignerendu = TRUE; - } - if(nds.cycles>=nds.nextHBlank+1092) - { - u32 vmatch; - - ++nds.VCount; - nds.nextHBlank += 4260; - T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0xFFFD); - T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) & 0xFFFD); - - if(MMU.DMAStartTime[0][0] == 3) - MMU_doDMA(0, 0); - if(MMU.DMAStartTime[0][1] == 3) - MMU_doDMA(0, 1); - if(MMU.DMAStartTime[0][2] == 3) - MMU_doDMA(0, 2); - if(MMU.DMAStartTime[0][3] == 3) - MMU_doDMA(0, 3); - - // Main memory display - if(MMU.DMAStartTime[0][0] == 4) - { - MMU_doDMA(0, 0); - MMU.DMAStartTime[0][0] = 0; - } - if(MMU.DMAStartTime[0][1] == 4) - { - MMU_doDMA(0, 1); - MMU.DMAStartTime[0][1] = 0; - } - if(MMU.DMAStartTime[0][2] == 4) - { - MMU_doDMA(0, 2); - MMU.DMAStartTime[0][2] = 0; - } - if(MMU.DMAStartTime[0][3] == 4) - { - MMU_doDMA(0, 3); - MMU.DMAStartTime[0][3] = 0; - } - - if(MMU.DMAStartTime[1][0] == 4) - { - MMU_doDMA(1, 0); - MMU.DMAStartTime[1][0] = 0; - } - if(MMU.DMAStartTime[1][1] == 4) - { - MMU_doDMA(1, 1); - MMU.DMAStartTime[0][1] = 0; - } - if(MMU.DMAStartTime[1][2] == 4) - { - MMU_doDMA(1, 2); - MMU.DMAStartTime[1][2] = 0; - } - if(MMU.DMAStartTime[1][3] == 4) - { - MMU_doDMA(1, 3); - MMU.DMAStartTime[1][3] = 0; - } - - nds.lignerendu = FALSE; - if(nds.VCount==193) - { - T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) | 1); - T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 1); - NDS_ARM9VBlankInt(); - NDS_ARM7VBlankInt(); - - if(MMU.DMAStartTime[0][0] == 1) - MMU_doDMA(0, 0); - if(MMU.DMAStartTime[0][1] == 1) - MMU_doDMA(0, 1); - if(MMU.DMAStartTime[0][2] == 1) - MMU_doDMA(0, 2); - if(MMU.DMAStartTime[0][3] == 1) - MMU_doDMA(0, 3); - - if(MMU.DMAStartTime[1][0] == 1) - MMU_doDMA(1, 0); - if(MMU.DMAStartTime[1][1] == 1) - MMU_doDMA(1, 1); - if(MMU.DMAStartTime[1][2] == 1) - MMU_doDMA(1, 2); - if(MMU.DMAStartTime[1][3] == 1) - MMU_doDMA(1, 3); - } - else - if(nds.VCount==263) - { - nds.nextHBlank = 3168; - nds.VCount = 0; - T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0xFFFE); - T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) & 0xFFFE); - - nds.cycles -= (560190<<1); - nds.ARM9Cycle -= (560190<<1); - nds.ARM7Cycle -= (560190<<1); - nb -= (560190<<1); - if(MMU.timerON[0][0]) - nds.timerCycle[0][0] -= (560190<<1); - if(MMU.timerON[0][1]) - nds.timerCycle[0][1] -= (560190<<1); - if(MMU.timerON[0][2]) - nds.timerCycle[0][2] -= (560190<<1); - if(MMU.timerON[0][3]) - nds.timerCycle[0][3] -= (560190<<1); - - if(MMU.timerON[1][0]) - nds.timerCycle[1][0] -= (560190<<1); - if(MMU.timerON[1][1]) - nds.timerCycle[1][1] -= (560190<<1); - if(MMU.timerON[1][2]) - nds.timerCycle[1][2] -= (560190<<1); - if(MMU.timerON[1][3]) - nds.timerCycle[1][3] -= (560190<<1); - if(MMU.DMAing[0][0]) - MMU.DMACycle[0][0] -= (560190<<1); - if(MMU.DMAing[0][1]) - MMU.DMACycle[0][1] -= (560190<<1); - if(MMU.DMAing[0][2]) - MMU.DMACycle[0][2] -= (560190<<1); - if(MMU.DMAing[0][3]) - MMU.DMACycle[0][3] -= (560190<<1); - if(MMU.DMAing[1][0]) - MMU.DMACycle[1][0] -= (560190<<1); - if(MMU.DMAing[1][1]) - MMU.DMACycle[1][1] -= (560190<<1); - if(MMU.DMAing[1][2]) - MMU.DMACycle[1][2] -= (560190<<1); - if(MMU.DMAing[1][3]) - MMU.DMACycle[1][3] -= (560190<<1); - } - - T1WriteWord(ARM9Mem.ARM9_REG, 6, nds.VCount); - T1WriteWord(MMU.ARM7_REG, 6, nds.VCount); - - vmatch = T1ReadWord(ARM9Mem.ARM9_REG, 4); - if((nds.VCount==(vmatch>>8)|((vmatch<<1)&(1<<8)))) - { - T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) | 4); - if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 32) - NDS_makeARM9Int(2); - } - else - T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0xFFFB); - - vmatch = T1ReadWord(MMU.ARM7_REG, 4); - if((nds.VCount==(vmatch>>8)|((vmatch<<1)&(1<<8)))) - { - T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 4); - if(T1ReadWord(MMU.ARM7_REG, 4) & 32) - NDS_makeARM7Int(2); - } - else - T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) & 0xFFFB); - } - } - if(MMU.timerON[0][0]) - { - if(MMU.timerRUN[0][0]) - { - switch(MMU.timerMODE[0][0]) - { - case 0xFFFF : - break; - default : - { - nds.diff = (nds.cycles - nds.timerCycle[0][0])>>MMU.timerMODE[0][0]; - nds.old = MMU.timer[0][0]; - MMU.timer[0][0] += nds.diff; - nds.timerCycle[0][0] += (nds.diff << MMU.timerMODE[0][0]); - nds.timerOver[0][0] = nds.old>MMU.timer[0][0]; - if(nds.timerOver[0][0]) - { - if(T1ReadWord(ARM9Mem.ARM9_REG, 0x102) & 0x40) - NDS_makeARM9Int(3); - MMU.timer[0][0] += MMU.timerReload[0][0]; - } - } - break; - } - } - else - { - MMU.timerRUN[0][0] = TRUE; - nds.timerCycle[0][0] = nds.cycles; - } - } - if(MMU.timerON[0][1]) - { - if(MMU.timerRUN[0][1]) - { - switch(MMU.timerMODE[0][1]) - { - case 0xFFFF : - if(nds.timerOver[0][0]) - { - ++(MMU.timer[0][1]); - nds.timerOver[0][1] = !MMU.timer[0][1]; - if (nds.timerOver[0][1]) - { - if(T1ReadWord(ARM9Mem.ARM9_REG, 0x106) & 0x40) - NDS_makeARM9Int(4); - } - } - break; - default : - { - nds.diff = (nds.cycles - nds.timerCycle[0][1])>>MMU.timerMODE[0][1]; - nds.old = MMU.timer[0][1]; - MMU.timer[0][1] += nds.diff; - nds.timerCycle[0][1] += nds.diff << MMU.timerMODE[0][1]; - nds.timerOver[0][1] = nds.old>MMU.timer[0][1]; - if(nds.timerOver[0][1]) - { - if(T1ReadWord(ARM9Mem.ARM9_REG, 0x106) & 0x40) - NDS_makeARM9Int(4); - MMU.timer[0][1] += MMU.timerReload[0][1]; - } - } - break; - } - } - else - { - MMU.timerRUN[0][1] = TRUE; - nds.timerCycle[0][1] = nds.cycles; - } - } - if(MMU.timerON[0][2]) - { - if(MMU.timerRUN[0][2]) - { - switch(MMU.timerMODE[0][2]) - { - case 0xFFFF : - if(nds.timerOver[0][1]) - { - ++(MMU.timer[0][2]); - nds.timerOver[0][2] = !MMU.timer[0][2]; - if (nds.timerOver[0][2]) - { - if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10A) & 0x40) - NDS_makeARM9Int(5); - } - } - break; - default : - { - nds.diff = (nds.cycles - nds.timerCycle[0][2])>>MMU.timerMODE[0][2]; - nds.old = MMU.timer[0][2]; - MMU.timer[0][2] += nds.diff; - nds.timerCycle[0][2] += nds.diff << MMU.timerMODE[0][2]; - nds.timerOver[0][2] = nds.old>MMU.timer[0][2]; - if(nds.timerOver[0][2]) - { - if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10A) & 0x40) - NDS_makeARM9Int(5); - MMU.timer[0][2] += MMU.timerReload[0][2]; - } - } - break; - } - } - else - { - MMU.timerRUN[0][2] = TRUE; - nds.timerCycle[0][2] = nds.cycles; - } - } - if(MMU.timerON[0][3]) - { - if(MMU.timerRUN[0][3]) - { - switch(MMU.timerMODE[0][3]) - { - case 0xFFFF : - if(nds.timerOver[0][2]) - { - ++(MMU.timer[0][3]); - nds.timerOver[0][3] = !MMU.timer[0][3]; - if (nds.timerOver[0][3]) - { - if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10E) & 0x40) - NDS_makeARM9Int(6); - } - } - break; - default : - { - nds.diff = (nds.cycles - nds.timerCycle[0][3])>>MMU.timerMODE[0][3]; - nds.old = MMU.timer[0][3]; - MMU.timer[0][3] += nds.diff; - nds.timerCycle[0][3] += nds.diff << MMU.timerMODE[0][3]; - nds.timerOver[0][3] = nds.old>MMU.timer[0][3]; - if(nds.timerOver[0][3]) - { - if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10E) & 0x40) - NDS_makeARM9Int(6); - MMU.timer[0][3] += MMU.timerReload[0][3]; - } - } - break; - } - } - else - { - MMU.timerRUN[0][3] = TRUE; - nds.timerCycle[0][3] = nds.cycles; - } - } - - if(MMU.timerON[1][0]) - { - if(MMU.timerRUN[1][0]) - { - switch(MMU.timerMODE[1][0]) - { - case 0xFFFF : - break; - default : - { - nds.diff = (nds.cycles - nds.timerCycle[1][0])>>MMU.timerMODE[1][0]; - nds.old = MMU.timer[1][0]; - MMU.timer[1][0] += nds.diff; - nds.timerCycle[1][0] += nds.diff << MMU.timerMODE[1][0]; - nds.timerOver[1][0] = nds.old>MMU.timer[1][0]; - if(nds.timerOver[1][0]) - { - if(T1ReadWord(MMU.ARM7_REG, 0x102) & 0x40) - NDS_makeARM7Int(3); - MMU.timer[1][0] += MMU.timerReload[1][0]; - } - } - break; - } - } - else - { - MMU.timerRUN[1][0] = TRUE; - nds.timerCycle[1][0] = nds.cycles; - } - } - if(MMU.timerON[1][1]) - { - if(MMU.timerRUN[1][1]) - { - switch(MMU.timerMODE[1][1]) - { - case 0xFFFF : - if(nds.timerOver[1][0]) - { - ++(MMU.timer[1][1]); - nds.timerOver[1][1] = !MMU.timer[1][1]; - if (nds.timerOver[1][1]) - { - if(T1ReadWord(MMU.ARM7_REG, 0x106) & 0x40) - NDS_makeARM7Int(4); - } - } - break; - default : - { - nds.diff = (nds.cycles - nds.timerCycle[1][1])>>MMU.timerMODE[1][1]; - nds.old = MMU.timer[1][1]; - MMU.timer[1][1] += nds.diff; - nds.timerCycle[1][1] += nds.diff << MMU.timerMODE[1][1]; - nds.timerOver[1][1] = nds.old>MMU.timer[1][1]; - if(nds.timerOver[1][1]) - { - if(T1ReadWord(MMU.ARM7_REG, 0x106) & 0x40) - NDS_makeARM7Int(4); - MMU.timer[1][1] += MMU.timerReload[1][1]; - } - } - break; - } - } - else - { - MMU.timerRUN[1][1] = TRUE; - nds.timerCycle[1][1] = nds.cycles; - } - } - if(MMU.timerON[1][2]) - { - if(MMU.timerRUN[1][2]) - { - switch(MMU.timerMODE[1][2]) - { - case 0xFFFF : - if(nds.timerOver[1][1]) - { - ++(MMU.timer[1][2]); - nds.timerOver[1][2] = !MMU.timer[1][2]; - if (nds.timerOver[1][2]) - { - if(T1ReadWord(MMU.ARM7_REG, 0x10A) & 0x40) - NDS_makeARM7Int(5); - } - } - break; - default : - { - nds.diff = (nds.cycles - nds.timerCycle[1][2])>>MMU.timerMODE[1][2]; - nds.old = MMU.timer[1][2]; - MMU.timer[1][2] += nds.diff; - nds.timerCycle[1][2] += nds.diff << MMU.timerMODE[1][2]; - nds.timerOver[1][2] = nds.old>MMU.timer[1][2]; - if(nds.timerOver[1][2]) - { - if(T1ReadWord(MMU.ARM7_REG, 0x10A) & 0x40) - NDS_makeARM7Int(5); - MMU.timer[1][2] += MMU.timerReload[1][2]; - } - } - break; - } - } - else - { - MMU.timerRUN[1][2] = TRUE; - nds.timerCycle[1][2] = nds.cycles; - } - } - if(MMU.timerON[1][3]) - { - if(MMU.timerRUN[1][3]) - { - switch(MMU.timerMODE[1][3]) - { - case 0xFFFF : - if(nds.timerOver[1][2]) - { - ++(MMU.timer[1][3]); - nds.timerOver[1][3] = !MMU.timer[1][3]; - if (nds.timerOver[1][3]) - { - if(T1ReadWord(MMU.ARM7_REG, 0x10E) & 0x40) - NDS_makeARM7Int(6); - } - } - break; - default : - { - nds.diff = (nds.cycles - nds.timerCycle[1][3])>>MMU.timerMODE[1][3]; - nds.old = MMU.timer[1][3]; - MMU.timer[1][3] += nds.diff; - nds.timerCycle[1][3] += nds.diff << MMU.timerMODE[1][3]; - nds.timerOver[1][3] = nds.old>MMU.timer[1][3]; - if(nds.timerOver[1][3]) - { - if(T1ReadWord(MMU.ARM7_REG, 0x10E) & 0x40) - NDS_makeARM7Int(6); - MMU.timer[1][3] += MMU.timerReload[1][3]; - } - } - break; - } - } - else - { - MMU.timerRUN[1][3] = TRUE; - nds.timerCycle[1][3] = nds.cycles; - } - } - - if((MMU.DMAing[0][0])&&(MMU.DMACycle[0][0]<=nds.cycles)) - { - T1WriteLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*0), T1ReadLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*0)) & 0x7FFFFFFF); - if((MMU.DMACrt[0][0])&(1<<30)) NDS_makeARM9Int(8); - MMU.DMAing[0][0] = FALSE; - } - - if((MMU.DMAing[0][1])&&(MMU.DMACycle[0][1]<=nds.cycles)) - { - T1WriteLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*1), T1ReadLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*1)) & 0x7FFFFFFF); - if((MMU.DMACrt[0][1])&(1<<30)) NDS_makeARM9Int(9); - MMU.DMAing[0][1] = FALSE; - } - - if((MMU.DMAing[0][2])&&(MMU.DMACycle[0][2]<=nds.cycles)) - { - T1WriteLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*2), T1ReadLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*2)) & 0x7FFFFFFF); - if((MMU.DMACrt[0][2])&(1<<30)) NDS_makeARM9Int(10); - MMU.DMAing[0][2] = FALSE; - } - - if((MMU.DMAing[0][3])&&(MMU.DMACycle[0][3]<=nds.cycles)) - { - T1WriteLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*3), T1ReadLong(ARM9Mem.ARM9_REG, 0xB8 + (0xC*3)) & 0x7FFFFFFF); - if((MMU.DMACrt[0][3])&(1<<30)) NDS_makeARM9Int(11); - MMU.DMAing[0][3] = FALSE; - } - - if((MMU.DMAing[1][0])&&(MMU.DMACycle[1][0]<=nds.cycles)) - { - T1WriteLong(MMU.ARM7_REG, 0xB8 + (0xC*0), T1ReadLong(MMU.ARM7_REG, 0xB8 + (0xC*0)) & 0x7FFFFFFF); - if((MMU.DMACrt[1][0])&(1<<30)) NDS_makeARM7Int(8); - MMU.DMAing[1][0] = FALSE; - } - - if((MMU.DMAing[1][1])&&(MMU.DMACycle[1][1]<=nds.cycles)) - { - T1WriteLong(MMU.ARM7_REG, 0xB8 + (0xC*1), T1ReadLong(MMU.ARM7_REG, 0xB8 + (0xC*1)) & 0x7FFFFFFF); - if((MMU.DMACrt[1][1])&(1<<30)) NDS_makeARM7Int(9); - MMU.DMAing[1][1] = FALSE; - } - - if((MMU.DMAing[1][2])&&(MMU.DMACycle[1][2]<=nds.cycles)) - { - T1WriteLong(MMU.ARM7_REG, 0xB8 + (0xC*2), T1ReadLong(MMU.ARM7_REG, 0xB8 + (0xC*2)) & 0x7FFFFFFF); - if((MMU.DMACrt[1][2])&(1<<30)) NDS_makeARM7Int(10); - MMU.DMAing[1][2] = FALSE; - } - - if((MMU.DMAing[1][3])&&(MMU.DMACycle[1][3]<=nds.cycles)) - { - T1WriteLong(MMU.ARM7_REG, 0xB8 + (0xC*3), T1ReadLong(MMU.ARM7_REG, 0xB8 + (0xC*3)) & 0x7FFFFFFF); - if((MMU.DMACrt[1][3])&(1<<30)) NDS_makeARM7Int(11); - MMU.DMAing[1][3] = FALSE; - } - - if((MMU.reg_IF[0]&MMU.reg_IE[0]) && (MMU.reg_IME[0])) - //if(NDS_ARM9.irqExeption()) - if(armcpu_irqExeption(&NDS_ARM9)) - { - nds.ARM9Cycle = nds.cycles; - } - - if((MMU.reg_IF[1]&MMU.reg_IE[1]) && (MMU.reg_IME[1])) - if (armcpu_irqExeption(&NDS_ARM7)) - nds.ARM7Cycle = nds.cycles; - - } - return nds.cycles; - } - + #ifdef __cplusplus } #endif #endif + + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/opengl_collector_3Demu.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/opengl_collector_3Demu.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/opengl_collector_3Demu.c 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/opengl_collector_3Demu.c 2007-06-27 09:48:07.000000000 -0500 @@ -0,0 +1,3143 @@ +/* $Id: opengl_collector_3Demu.c,v 1.16 2007/06/27 14:48:07 masscat Exp $ + */ +/* + Copyright (C) 2006-2007 Ben Jaques, shash + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* + * This is a 3D emulation plugin. It uses OpenGL to perform the rendering. + * There is no platform specific code. Platform specific code is executed + * via a set of helper functions that must be defined should a particular + * platform use this plugin. + * + * The NDS 3D commands are collected until the flush command is issued. At this + * point the OpenGL function calls that correspnd to the set of commands are called. + * This approach is taken to allowing simple OpenGL context switching should + * OpenGL also be being used for other purposes (for example rendering the screen). + */ + +/* + * FIXME: This is a Work In Progress + * - The NDS command set should be checked to to ensure that it corresponds to a + * valid OpenGL command sequence. + * - Two sets of matrices should be maintained (maybe). One for rendering and one + * for NDS test commands. Any matrix commands should be executed immediately on + * the NDS test matix set (as well as stored). + * - Most of the OpenGL/emulation stuff has been copied from shash's Windows + * 3D code. There maybe optimisations and/or problems arising from the change + * of approach or the cut and paste. + * - More of the 3D needs to be emulated (correctly or at all) :). + */ + +#ifdef HAVE_GL_GL_H +#ifdef HAVE_GL_GLU_H +#ifndef __MINGW32__ + +#include + +#include +#include + +#include "types.h" + +#include "render3D.h" +#include "matrix.h" +#include "MMU.h" +#include "bits.h" + +#include "opengl_collector_3Demu.h" + +#define LOG_ALWAYS( fmt, ...) fprintf( stdout, "OpenGL Collector: "); \ +fprintf( stdout, fmt, ##__VA_ARGS__) + +#if 0 +#define LOG( fmt, ...) fprintf( stdout, "OpenGL Collector: "); \ +fprintf( stdout, fmt, ##__VA_ARGS__) +#else +#define LOG( fmt, ...) +#endif + +#if 0 +#define LOG_TEXTURE( fmt, ...) fprintf( stdout, "OpenGL Collector texture: "); \ +fprintf( stdout, fmt, ##__VA_ARGS__) +#else +#define LOG_TEXTURE( fmt, ...) +#endif + +#if 0 +#define LOG_CALL_LIST( fmt, ...) fprintf( stdout, "OpenGL Collector: Call list: "); \ +fprintf( stdout, fmt, ##__VA_ARGS__) +#else +#define LOG_CALL_LIST( fmt, ...) +#endif + +#if 0 +#define LOG_ERROR( fmt, ...) fprintf( stdout, "OpenGL Collector error: "); \ +fprintf( stdout, fmt, ##__VA_ARGS__) +#else +#define LOG_ERROR( fmt, ...) +#endif + +#if 0 +#define LOG_MATRIX( matrix) \ +LOG_ALWAYS( "%f, %f, %f, %f\n", matrix[0], matrix[1], matrix[2], matrix[3]); \ +LOG_ALWAYS( "%f, %f, %f, %f\n", matrix[4], matrix[5], matrix[6], matrix[7]); \ +LOG_ALWAYS( "%f, %f, %f, %f\n", matrix[8], matrix[9], matrix[10], matrix[11]); \ +LOG_ALWAYS( "%f, %f, %f, %f\n", matrix[12], matrix[13], matrix[14], matrix[15]) +#else +#define LOG_MATRIX( matrix) +#endif + +#define USE_BGR_ORDER 1 + +/** + * Define this to use software vertex transformation. + * The NDS can handle commands to change the modelview matrix during + * primitive definitions (between the begin and end). OpenGL does + * not like this. + * When this is defined the Modelview matrix will be left as the + * identity matrix and vertices are transformed before being passed + * to OpenGL. + */ +#define USE_SOFTWARE_VERTEX_TRANSFORM 1 + +/** + * Define this to enable Alpha Blending emulation. + * How the NDS renders transulcent polygons (order) is not fully understood + * so some polygon may not be rendered or rendered incorrectly. + */ +#define ENABLE_ALPHA_BLENDING 1 + +/** the largest number of parameters used by any command */ +#define MAX_NUMBER_OF_PARMS 32 + +/* Define this if you want to perform the glReadPixel call + * immediately after the render completion. + * If undefined the glReadPixel is performed in get_line_3Dgl_collect + * when called for line 0. + * + * Reading the pixels immediately may cause change of frame during display. + * Not reading the pixels immediately may mean that a frame is displayed early. + */ +//#define READ_PIXELS_IMMEDIATELY 1 + +static int +not_set( void) { + LOG_ERROR( "platform code not setup\n"); + return 0; +} + +static void +nothingness( void) { +} + +static void +flush_only( void) { + glFlush(); +} + +int (*begin_opengl_ogl_collector_platform)( void) = not_set; +void (*end_opengl_ogl_collector_platform)( void) = nothingness; +int (*initialise_ogl_collector_platform)( void) = not_set; +void (*complete_render_ogl_collector_platform)( void) = flush_only; + + +#define fix2float(v) (((float)((s32)(v))) / (float)(1<<12)) +#define fix10_2float(v) (((float)((s32)(v))) / (float)(1<<9)) + + + +static u8 GPU_screen3D[256*256*4]={0}; + +static u8 stencil_buffer[256*192]; + +#ifndef READ_PIXELS_IMMEDIATELY +/** flag indicating if the 3D emulation has produced a new render */ +static int new_render_available = 0; +#endif + +/* + * The matrices + */ +static int current_matrix_mode = 0; +static MatrixStack mtxStack[4]; +static float mtxCurrent [4][16]; +static float mtxTemporal[16]; + +static u32 disp_3D_control = 0; + +static u32 textureFormat=0, texturePalette=0; +static u32 lastTextureFormat=0, lastTexturePalette=0; +static unsigned int oglTextureID=0; +static u8 texMAP[1024*2048*4], texMAP2[2048*2048*4]; +static float invTexWidth = 1.f; +static float invTexHeight = 1.f; +static int texCoordinateTransform = 0; +static int t_texture_coord = 0, s_texture_coord = 0; +static GLint colorRGB[4] = { 0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}; +static float cur_vertex[3] = {0.0f, 0.0f, 0.0f}; + +static u32 alpha_function = 0; + +static float lightDirection[4][4]; +static int light_direction_valid = 0; +static GLint lightColor[4][4]; +static int light_colour_valid = 0; + +static u32 current_depth24b = 0; +static int depth24b_valid = 0; +static u32 current_clear_colour = 0; +static int clear_colour_valid = 0; + + +/** the current polygon attribute */ +static u32 current_polygon_attr = 0; + +/** flag set when a primitive is being defined */ +static int inside_primitive = 0; +/** the type of primitive being defined */ +static GLenum current_primitive_type; + + + +enum command_type { + NOP_CMD = 0x00, + MTX_MODE_CMD = 0x10, + MTX_PUSH_CMD = 0x11, + MTX_POP_CMD = 0x12, + MTX_STORE_CMD = 0x13, + MTX_RESTORE_CMD = 0x14, + MTX_IDENTITY_CMD = 0x15, + MTX_LOAD_4x4_CMD = 0x16, + MTX_LOAD_4x3_CMD = 0x17, + MTX_MULT_4x4_CMD = 0x18, + MTX_MULT_4x3_CMD = 0x19, + MTX_MULT_3x3_CMD = 0x1a, + MTX_SCALE_CMD = 0x1b, + MTX_TRANS_CMD = 0x1c, + COLOR_CMD = 0x20, + NORMAL_CMD = 0x21, + TEXCOORD_CMD = 0x22, + VTX_16_CMD = 0x23, + VTX_10_CMD = 0x24, + VTX_XY_CMD = 0x25, + VTX_XZ_CMD = 0x26, + VTX_YZ_CMD = 0x27, + VTX_DIFF_CMD = 0x28, + POLYGON_ATTR_CMD = 0x29, + TEXIMAGE_PARAM_CMD = 0x2a, + PLTT_BASE_CMD = 0x2b, + DIF_AMB_CMD = 0x30, + SPE_EMI_CMD = 0x31, + LIGHT_VECTOR_CMD = 0x32, + LIGHT_COLOR_CMD = 0x33, + SHININESS_CMD = 0x34, + BEGIN_VTXS_CMD = 0x40, + END_VTXS_CMD = 0x41, + SWAP_BUFFERS_CMD = 0x50, + VIEWPORT_CMD = 0x60, + BOX_TEST_CMD = 0x70, + POS_TEST_CMD = 0x71, + VEC_TEST_CMD = 0x72, + + /* The next ones are not NDS commands */ + CLEAR_COLOUR_CMD = 0x80, + CLEAR_DEPTH_CMD = 0x81, + FOG_COLOUR_CMD = 0x82, + FOG_OFFSET_CMD = 0x83, + CONTROL_CMD = 0x84, + ALPHA_FUNCTION_CMD = 0x85 +}; + +#define LAST_CMD_VALUE 0x84 + +#define ADD_RENDER_PARM_CMD( cmd) render_states[current_render_state].cmds[render_states[current_render_state].write_index++] = cmd + +static const char *primitive_type_names[] = { + "Triangles", + "Quads", + "Tri strip", + "Quad strip" +}; + +// Accelerationg tables +static float float16table[65536]; +static float float10Table[1024]; +static float float10RelTable[1024]; +static float normalTable[1024]; +static int numVertex = 0; + +#define NUM_RENDER_STATES 2 +int current_render_state; +static struct render_state { + int write_index; + + /* FIXME: how big to make this? */ + u32 cmds[100*1024]; + + //int cmds_drawn; +} render_states[NUM_RENDER_STATES]; + +#define GET_DRAW_STATE_INDEX( current_index) (((current_index) - 1) & (NUM_RENDER_STATES - 1)) +#define GET_NEXT_RENDER_STATE_INDEX( current_index) (((current_index) + 1) & (NUM_RENDER_STATES - 1)) + + +struct cmd_processor { + u32 num_parms; + void (*processor_fn)( struct render_state *state, + const u32 *parms); +}; +/*static int (*cmd_processors[LAST_CMD_VALUE+1])( struct render_state *state, + const u32 *parms); +*/ +static struct cmd_processor cmd_processors[LAST_CMD_VALUE+1]; + + + + + + + +static void +set_gl_matrix_mode( int mode) { + switch ( mode & 0x3) { + case 0: + glMatrixMode( GL_PROJECTION); + break; + + case 1: + glMatrixMode( GL_MODELVIEW); + break; + + case 2: + /* FIXME: more here? */ + glMatrixMode( GL_MODELVIEW); + break; + + case 3: + //glMatrixMode( GL_TEXTURE); + break; + } +} + +static void +loadMatrix( float *matrix) { +#ifdef USE_SOFTWARE_VERTEX_TRANSFORM + if ( current_matrix_mode == 0) +#endif + glLoadMatrixf( matrix); +} + + +static int +SetupTexture (unsigned int format, unsigned int palette) { + int alpha_texture = 0; + if(format == 0) // || disableTexturing) + { + LOG("Texture format is zero\n"); + glDisable (GL_TEXTURE_2D); + return 0; + } + else + { + unsigned short *pal = NULL; + unsigned int sizeX = (1<<(((format>>20)&0x7)+3)); + unsigned int sizeY = (1<<(((format>>23)&0x7)+3)); + unsigned int mode = (unsigned short)((format>>26)&0x7); + const unsigned char * adr; + //unsigned short param = (unsigned short)((format>>30)&0xF); + //unsigned short param2 = (unsigned short)((format>>16)&0xF); + unsigned int imageSize = sizeX*sizeY; + unsigned int paletteSize = 0; + unsigned int palZeroTransparent = BIT29(format) ? 0 : 255; + unsigned int x=0, y=0; + u32 bytes_in_slot; + u32 orig_bytes_in_slot; + int current_slot = (format >> 14) & 3; + + /* Get the address within the texture slot */ + adr = ARM9Mem.textureSlotAddr[current_slot]; + adr += (format&0x3FFF) << 3; + + bytes_in_slot = 0x20000 - ((format & 0x3fff) << 3); + orig_bytes_in_slot = bytes_in_slot; + + if ( BIT29(format) && mode != 0) { + alpha_texture = 1; + } + + LOG_TEXTURE("Texture %08x: size %d by %d\n", format, sizeX, sizeY); + + if (mode == 0) + glDisable (GL_TEXTURE_2D); + else + glEnable (GL_TEXTURE_2D); + + switch(mode) + { + case 1: + { + alpha_texture = 1; + paletteSize = 256; + pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4)); + break; + } + case 2: + { + paletteSize = 4; + pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<3)); + imageSize >>= 2; + break; + } + case 3: + { + paletteSize = 16; + pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4)); + imageSize >>= 1; + break; + } + case 4: + { + paletteSize = 256; + pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4)); + break; + } + case 5: + { + alpha_texture = 1; + paletteSize = 0; + pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4)); + break; + } + case 6: + { + alpha_texture = 1; + paletteSize = 256; + pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4)); + break; + } + case 7: + { + alpha_texture = 1; + paletteSize = 0; + break; + } + } + + //if (!textureCache.IsCached((u8*)pal, paletteSize, adr, imageSize, mode, palZeroTransparent)) + { + unsigned char * dst = texMAP;// + sizeX*sizeY*3; + + LOG_TEXTURE("Setting up texture mode %d\n", mode); + + switch(mode) + { + case 1: + { + for(x = 0; x < imageSize; x++, dst += 4) + { + unsigned short c = pal[adr[x]&31], alpha = (adr[x]>>5); + dst[0] = (unsigned char)((c & 0x1F)<<3); + dst[1] = (unsigned char)((c & 0x3E0)>>2); + dst[2] = (unsigned char)((c & 0x7C00)>>7); + dst[3] = ((alpha<<2)+(alpha>>1))<<3; + if ( dst[3] != 0) { + /* full range alpha */ + dst[3] |= 0x7; + } + + /* transverse to the next texture slot if needs be */ + bytes_in_slot -= 1; + if ( bytes_in_slot == 0) { + current_slot += 1; + adr = ARM9Mem.textureSlotAddr[current_slot]; + adr -= orig_bytes_in_slot; + bytes_in_slot = 0x20000; + orig_bytes_in_slot = bytes_in_slot; + } + } + + break; + } + case 2: + { + for(x = 0; x < imageSize; ++x) + { + unsigned short c = pal[(adr[x])&0x3]; + dst[0] = ((c & 0x1F)<<3); + dst[1] = ((c & 0x3E0)>>2); + dst[2] = ((c & 0x7C00)>>7); + dst[3] = ((adr[x]&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255; + dst += 4; + + c = pal[((adr[x])>>2)&0x3]; + dst[0] = ((c & 0x1F)<<3); + dst[1] = ((c & 0x3E0)>>2); + dst[2] = ((c & 0x7C00)>>7); + dst[3] = (((adr[x]>>2)&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255; + dst += 4; + + c = pal[((adr[x])>>4)&0x3]; + dst[0] = ((c & 0x1F)<<3); + dst[1] = ((c & 0x3E0)>>2); + dst[2] = ((c & 0x7C00)>>7); + dst[3] = (((adr[x]>>4)&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255; + dst += 4; + + c = pal[(adr[x])>>6]; + dst[0] = ((c & 0x1F)<<3); + dst[1] = ((c & 0x3E0)>>2); + dst[2] = ((c & 0x7C00)>>7); + dst[3] = (((adr[x]>>6)&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255; + dst += 4; + + /* transverse to the next texture slot if needs be */ + bytes_in_slot -= 1; + if ( bytes_in_slot == 0) { + current_slot += 1; + adr = ARM9Mem.textureSlotAddr[current_slot]; + adr -= orig_bytes_in_slot; + bytes_in_slot = 0x20000; + orig_bytes_in_slot = bytes_in_slot; + } + } + } + break; + case 3: + { + for(x = 0; x < imageSize; x++) + { + unsigned short c = pal[adr[x]&0xF]; + dst[0] = ((c & 0x1F)<<3); + dst[1] = ((c & 0x3E0)>>2); + dst[2] = ((c & 0x7C00)>>7); + dst[3] = (((adr[x])&0xF) == 0) ? palZeroTransparent : 255;//(c>>15)*255; + dst += 4; + + c = pal[((adr[x])>>4)]; + dst[0] = ((c & 0x1F)<<3); + dst[1] = ((c & 0x3E0)>>2); + dst[2] = ((c & 0x7C00)>>7); + dst[3] = (((adr[x]>>4)&0xF) == 0) ? palZeroTransparent : 255;//(c>>15)*255; + dst += 4; + + /* transverse to the next texture slot if needs be */ + bytes_in_slot -= 1; + if ( bytes_in_slot == 0) { + current_slot += 1; + adr = ARM9Mem.textureSlotAddr[current_slot]; + adr -= orig_bytes_in_slot; + bytes_in_slot = 0x20000; + orig_bytes_in_slot = bytes_in_slot; + } + } + } + break; + + case 4: + { + for(x = 0; x < imageSize; ++x) + { + unsigned short c = pal[adr[x]]; + //LOG_TEXTURE("mode 4: x %d colour %04x index %d\n", x, c, adr[x]); + dst[0] = (unsigned char)((c & 0x1F)<<3); + dst[1] = (unsigned char)((c & 0x3E0)>>2); + dst[2] = (unsigned char)((c & 0x7C00)>>7); + dst[3] = (adr[x] == 0) ? palZeroTransparent : 255;//(c>>15)*255; + dst += 4; + + /* transverse to the next texture slot if needs be */ + bytes_in_slot -= 1; + if ( bytes_in_slot == 0) { + current_slot += 1; + adr = ARM9Mem.textureSlotAddr[current_slot]; + adr -= orig_bytes_in_slot; + bytes_in_slot = 0x20000; + orig_bytes_in_slot = bytes_in_slot; + } + } + } + break; + + case 5: + { + unsigned short * pal = + (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4)); + const unsigned short * slot1; + const unsigned int * map = (const unsigned int *)adr; + unsigned int i = 0; + unsigned int * dst = (unsigned int *)texMAP; + + if ( (format & 0xc000) == 0x8000) { + /* texel are in slot 2 */ + slot1 = + (const unsigned short*) + &ARM9Mem.textureSlotAddr[1][((format&0x3FFF)<<2) + 0x10000]; + //LOG_TEXTURE("slot 2 compressed \n"); + } + else { + slot1 = + (const unsigned short*) + &ARM9Mem.textureSlotAddr[1][((format&0x3FFF)<<2) + 0x00000]; + //LOG_TEXTURE("slot 0 compressed\n"); + } + + //LOG_TEXTURE("Compressed texture\n"); + for (y = 0; y < (sizeY/4); y ++) + { + for (x = 0; x < (sizeX/4); x ++, i++) + { + u32 currBlock = map[i], sy; + u16 pal1 = slot1[i]; + u16 pal1offset = (pal1 & 0x3FFF)<<1; + u8 mode = pal1>>14; + u32 colours[4]; + + /* + * Setup the colours: + * In all modes the first two colours are read from + * the palette. + */ +#define RGB16TO32(col,alpha) (((alpha)<<24) | ((((col) & 0x7C00)>>7)<<16) | \ + ((((col) & 0x3E0)>>2)<<8) | (((col) & 0x1F)<<3)) + colours[0] = RGB16TO32( pal[pal1offset + 0], 255); + colours[1] = RGB16TO32( pal[pal1offset + 1], 255); + + switch ( mode) { + case 0: + /* colour 2 is read from the palette + * colour 3 is transparent + */ + colours[2] = RGB16TO32( pal[pal1offset+2], 255); + colours[3] = RGB16TO32( 0x7fff, 0); + break; + + case 1: + /* colour 2 is half colour 0 + half colour 1 + * colour 3 is transparent + */ + colours[2] = + /* RED */ + (((colours[0] & 0xff) + + (colours[1] & 0xff)) >> 1) | + /* GREEN */ + (((colours[0] & (0xff << 8)) + + (colours[1] & (0xff << 8))) >> 1) | + /* BLUE */ + (((colours[0] & (0xff << 16)) + + (colours[1] & (0xff << 16))) >> 1) | (0xff << 24); + colours[3] = RGB16TO32( 0x7fff, 0); + break; + + case 2: + /* colour 2 is read from the palette + * colour 3 is read from the palette + */ + colours[2] = RGB16TO32( pal[pal1offset+2], 255); + colours[3] = RGB16TO32( pal[pal1offset+3], 255); + break; + + case 3: { + /* colour 2 is (colour0 * 5 + colour1 * 3) / 8 + * colour 3 is (colour1 * 5 + colour0 * 3) / 8 + */ + u32 red0, red1; + u32 green0, green1; + u32 blue0, blue1; + u16 colour2, colour3; + + red0 = colours[0] & 0xff; + green0 = (colours[0] >> 8) & 0xff; + blue0 = (colours[0] >> 16) & 0xff; + + red1 = colours[1] & 0xff; + green1 = (colours[1] >> 8) & 0xff; + blue1 = (colours[1] >> 16) & 0xff; + + colour2 = + /* red */ + ((red0 * 5 + red1 * 3) >> 6) | + /* green */ + (((green0 * 5 + green1 * 3) >> 6) << 5) | + /* blue */ + (((blue0 * 5 + blue1 * 3) >> 6) << 10); + colour3 = + /* red */ + ((red1 * 5 + red0 * 3) >> 6) | + /* green */ + (((green1 * 5 + green0 * 3) >> 6) << 5) | + /* blue */ + (((blue1 * 5 + blue0 * 3) >> 6) << 10); + + colours[2] = RGB16TO32( colour2, 255); + colours[3] = RGB16TO32( colour3, 255); + break; + } + } + + for (sy = 0; sy < 4; sy++) + { + // Texture offset + u32 xAbs = (x<<2); + u32 yAbs = ((y<<2) + sy); + u32 currentPos = xAbs + yAbs*sizeX; + + // Palette + u8 currRow = (u8)((currBlock >> (sy*8)) & 0xFF); + + dst[currentPos+0] = colours[(currRow >> (2 * 0)) & 3]; + dst[currentPos+1] = colours[(currRow >> (2 * 1)) & 3]; + dst[currentPos+2] = colours[(currRow >> (2 * 2)) & 3]; + dst[currentPos+3] = colours[(currRow >> (2 * 3)) & 3]; + } + + /* transverse to the next texture slot if needs be */ + bytes_in_slot -= 4; + if ( bytes_in_slot == 0) { + current_slot += 1; + map = + (const unsigned int *)ARM9Mem.textureSlotAddr[current_slot]; + map -= orig_bytes_in_slot >> 2; + bytes_in_slot = 0x20000; + orig_bytes_in_slot = bytes_in_slot; + } + } + } + break; + } + case 6: + { + for(x = 0; x < imageSize; x++) + { + unsigned short c = pal[adr[x]&7]; + dst[0] = (unsigned char)((c & 0x1F)<<3); + dst[1] = (unsigned char)((c & 0x3E0)>>2); + dst[2] = (unsigned char)((c & 0x7C00)>>7); + dst[3] = (adr[x]&0xF8); + if ( dst[3] != 0) { + /* full range alpha */ + dst[3] |= 0x7; + } + dst += 4; + + /* transverse to the next texture slot if needs be */ + bytes_in_slot -= 1; + if ( bytes_in_slot == 0) { + current_slot += 1; + adr = ARM9Mem.textureSlotAddr[current_slot]; + adr -= orig_bytes_in_slot; + bytes_in_slot = 0x20000; + orig_bytes_in_slot = bytes_in_slot; + } + } + break; + } + case 7: + { + const unsigned short * map = ((const unsigned short *)adr); + for(x = 0; x < imageSize; ++x) + { + unsigned short c = map[x]; + dst[0] = ((c & 0x1F)<<3); + dst[1] = ((c & 0x3E0)>>2); + dst[2] = ((c & 0x7C00)>>7); + dst[3] = (c>>15)*255; + dst += 4; + + /* transverse to the next texture slot if needs be */ + bytes_in_slot -= 2; + if ( bytes_in_slot == 0) { + current_slot += 1; + map = (const unsigned short *)ARM9Mem.textureSlotAddr[current_slot]; + map -= orig_bytes_in_slot >> 1; + bytes_in_slot = 0x20000; + orig_bytes_in_slot = bytes_in_slot; + } + } + } + break; + } + + glBindTexture(GL_TEXTURE_2D, oglTextureID); + glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, sizeX, sizeY, 0, GL_RGBA, GL_UNSIGNED_BYTE, texMAP); + //textureCache.SetTexture ( texMAP, sizeX, sizeY, (u8*)pal, paletteSize, adr, imageSize, mode, palZeroTransparent); + + /* + switch ((format>>18)&3) + { + case 0: + { + textureCache.SetTexture ( texMAP, sizeX, sizeY, (u8*)pal, paletteSize, adr, imageSize, mode); + break; + } + + case 1: + { + u32 *src = (u32*)texMAP, *dst = (u32*)texMAP2; + + for (int y = 0; y < sizeY; y++) + { + for (int x = 0; x < sizeX; x++) + { + dst[y*sizeX*2 + x] = dst[y*sizeX*2 + (sizeX*2-x-1)] = src[y*sizeX + x]; + } + } + + sizeX <<= 1; + textureCache.SetTexture ( texMAP2, sizeX, sizeY, (u8*)pal, paletteSize, adr, imageSize, mode); + break; + } + + case 2: + { + u32 *src = (u32*)texMAP; + + for (int y = 0; y < sizeY; y++) + { + memcpy (&src[(sizeY*2-y-1)*sizeX], &src[y*sizeX], sizeX*4); + } + + sizeY <<= 1; + textureCache.SetTexture ( texMAP, sizeX, sizeY, (u8*)pal, paletteSize, adr, imageSize, mode); + break; + } + + case 3: + { + u32 *src = (u32*)texMAP, *dst = (u32*)texMAP2; + + for (int y = 0; y < sizeY; y++) + { + for (int x = 0; x < sizeX; x++) + { + dst[y*sizeX*2 + x] = dst[y*sizeX*2 + (sizeX*2-x-1)] = src[y*sizeX + x]; + } + } + + sizeX <<= 1; + + for (int y = 0; y < sizeY; y++) + { + memcpy (&dst[(sizeY*2-y-1)*sizeX], &dst[y*sizeX], sizeX*4); + } + + sizeY <<= 1; + textureCache.SetTexture ( texMAP2, sizeX, sizeY, (u8*)pal, paletteSize, adr, imageSize, mode); + break; + } + } + */ + } + + invTexWidth = 1.f/((float)sizeX*(1<<4));//+ 1; + invTexHeight = 1.f/((float)sizeY*(1<<4));//+ 1; + + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glMatrixMode (GL_TEXTURE); + glLoadIdentity (); + glScaled (invTexWidth, invTexHeight, 1.f); + + set_gl_matrix_mode( current_matrix_mode); + + // S Coordinate options + if (!BIT16(format)) + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP); + else { + if ( BIT18(format)) { + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_MIRRORED_REPEAT); + } + else { + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); + } + } + + // T Coordinate options + if (!BIT17(format)) + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP); + else { + if ( BIT19(format)) { + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_MIRRORED_REPEAT); + } + else { + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); + } + } + + texCoordinateTransform = (format>>30); + } + + return alpha_texture; +} + + +static void +setup_mode23_tex_coord( float *vertex) { + float *textureMatrix = mtxCurrent[3]; + int s2 = (int)(( vertex[0] * textureMatrix[0] + + vertex[1] * textureMatrix[4] + + vertex[2] * textureMatrix[8]) + s_texture_coord); + int t2 = (int)(( vertex[0] * textureMatrix[1] + + vertex[1] * textureMatrix[5] + + vertex[2] * textureMatrix[9]) + t_texture_coord); + + /*LOG_TEXTURE("mode23 texcoord %d,%d -> %d,%d\n", + s_texture_coord, t_texture_coord, + s2, t2);*/ + + glTexCoord2i( s2, t2); +} + + +static INLINE void +setup_vertex( float *vertex) { +#ifdef USE_SOFTWARE_VERTEX_TRANSFORM + float transformed_vertex[4]; +#endif + + LOG("vertex %f,%f,%f\n", vertex[0], vertex[1], vertex[2]); + + if (texCoordinateTransform == 3) + { + setup_mode23_tex_coord( vertex); + } + +#ifdef USE_SOFTWARE_VERTEX_TRANSFORM + /* + * Transform the vertex + */ + transformed_vertex[0] = vertex[0]; + transformed_vertex[1] = vertex[1]; + transformed_vertex[2] = vertex[2]; + transformed_vertex[3] = 1.0f; + MatrixMultVec4x4( mtxCurrent[1], transformed_vertex); + + glVertex4fv( transformed_vertex); +#else + glVertex3fv( vertex); +#endif + + numVertex += 1; +} + + +static INLINE void +handle_polygon_attribute( u32 attr, u32 control) { + static const int texEnv[4] = { GL_MODULATE, GL_DECAL, GL_MODULATE, GL_MODULATE }; + static const int depthFunc[2] = { GL_LESS, GL_EQUAL }; + static const unsigned short map3d_cull[4] = {GL_FRONT_AND_BACK, GL_FRONT, GL_BACK, 0}; + u32 light_mask = attr & 0xf; + u32 cullingMask; + GLint colorAlpha; + + //LOG_ALWAYS("poly attr %08x control %08x\n", attr, control); + /*LOG_ALWAYS("id %d alpha %d mode %d\n", + (attr >> 24) & 0x3f, + (attr >> 16) & 0x1f, + (attr >> 4) & 0x3);*/ + + /* + * lighting + * (should be done at the normal?) + */ + if ( light_mask) { + if ( light_mask & 1) { + LOG("enabling light 0\n"); + glEnable (GL_LIGHT0); + } + else { + LOG("disabling light 0\n"); + glDisable(GL_LIGHT0); + } + if ( light_mask & 2) { + LOG("enabling light 1\n"); + glEnable (GL_LIGHT1); + } + else { + LOG("disabling light 1\n"); + glDisable(GL_LIGHT1); + } + if ( light_mask & 4) { + LOG("enabling light 2\n"); + glEnable (GL_LIGHT2); + } + else { + LOG("disabling light 2\n"); + glDisable(GL_LIGHT2); + } + if ( light_mask & 8) { + LOG("enabling light 3\n"); + glEnable (GL_LIGHT3); + } + else { + LOG("disabling light 3\n"); + glDisable(GL_LIGHT3); + } + + glEnable (GL_LIGHTING); + //glEnable (GL_COLOR_MATERIAL); + } + else { + LOG( "Disabling lighting\n"); + glDisable (GL_LIGHTING); + } + + /* + * texture environment + */ + glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, texEnv[(attr & 0x30)>>4]); + + /* + * depth function + */ + glDepthFunc( depthFunc[BIT14(attr)]); + + /* + * Cull face + */ + cullingMask = (attr & 0xC0); + if (cullingMask != 0xC0) { + glEnable(GL_CULL_FACE); + glCullFace(map3d_cull[cullingMask>>6]); + } + else { + glDisable(GL_CULL_FACE); + } + + /* + * Alpha value, actually not well handled, 0 should be wireframe + * + * FIXME: How are translucent polygons rendered? + * some use of polygon ID? + */ + glDepthMask( GL_TRUE); + colorAlpha = (attr>>16) & 0x1F; + if ( colorAlpha != 0) { + colorAlpha = (colorAlpha << 26) | 0x3ffffff; +#if 0 + if ( colorAlpha != 0x7fffffff) { + if ( !BIT11( attr)) { + glDepthMask( GL_FALSE); + } + } +#endif + colorRGB[3] = colorAlpha; + glColor4iv (colorRGB); + } + + + /* + * Alpha blending + */ +#ifdef ENABLE_ALPHA_BLENDING + if ( BIT3(control)) { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable( GL_BLEND); + } + else { + glDisable( GL_BLEND); + } +#endif +} + + + +static void +process_begin_vtxs( struct render_state *state, + const u32 *parms) { + u32 prim_type = parms[0] & 0x3; + static int alpha_texture = 0; + + LOG("Begin: %s\n", primitive_type_names[prim_type]); + + if ( inside_primitive) { + LOG( "implicit primitive end\n"); + glEnd(); + } + + if ( depth24b_valid) { + glClearDepth( current_depth24b / ((float)(1<<24))); + depth24b_valid = 0; + } + + if ( clear_colour_valid) { + glClearColor( ((float)( current_clear_colour & 0x1F))/31.0f, + ((float)(( current_clear_colour >> 5)&0x1F))/31.0f, + ((float)(( current_clear_colour >> 10)&0x1F))/31.0f, + ((float)(( current_clear_colour >> 16)&0x1F))/31.0f); + clear_colour_valid = 0; + } + + if ( light_colour_valid) { + int light; + + for ( light = 0; light < 4; light++) { + if ( light_colour_valid & (1 << light)) { + glLightiv (GL_LIGHT0 + light, GL_AMBIENT, lightColor[light]); + glLightiv (GL_LIGHT0 + light, GL_DIFFUSE, lightColor[light]); + glLightiv (GL_LIGHT0 + light, GL_SPECULAR, lightColor[light]); + } + } + light_colour_valid = 0; + } + + if ( light_direction_valid) { + int light; + + for ( light = 0; light < 4; light++) { + if ( light_direction_valid & (1 << light)) { + glLightfv(GL_LIGHT0 + light, GL_POSITION, lightDirection[light]); + } + } + light_direction_valid = 0; + } + +#if 1 + /* FIXME: ignoring shadow polygons for now */ + if ( ((current_polygon_attr >> 4) & 0x3) == 3) { + return; + } +#endif + + if( disp_3D_control & (1<<2)) + { + LOG("Alpha test enabled\n"); + glEnable(GL_ALPHA_TEST); + glAlphaFunc (GL_GREATER, (alpha_function&31)/31.f); + } + else + { + glDisable(GL_ALPHA_TEST); + } + + + /* + * Setup for the current polygon attribute + */ + handle_polygon_attribute( current_polygon_attr, disp_3D_control); + + + /* setup the texture */ +#if 0 + glDisable (GL_TEXTURE_2D); +#else + if ( disp_3D_control & 0x1) { + if (textureFormat != lastTextureFormat || + texturePalette != lastTexturePalette) + { + LOG("Setting up texture %08x\n", textureFormat); + alpha_texture = SetupTexture (textureFormat, texturePalette); + + lastTextureFormat = textureFormat; + lastTexturePalette = texturePalette; + } + +#if 1 + /* FIXME: this is a hack to get some transparent textures to work */ + if ( alpha_texture) { + glEnable(GL_ALPHA_TEST); + glAlphaFunc(GL_GREATER, 0.0f); + } +#endif + + } + else { + glDisable (GL_TEXTURE_2D); + } +#endif + + inside_primitive = 1; + switch (prim_type) { + case 0: + current_primitive_type = GL_TRIANGLES; + glBegin( GL_TRIANGLES); + break; + case 1: + current_primitive_type = GL_QUADS; + glBegin( GL_QUADS); + break; + case 2: + current_primitive_type = GL_TRIANGLE_STRIP; + glBegin( GL_TRIANGLE_STRIP); + break; + case 3: + current_primitive_type = GL_QUAD_STRIP; + glBegin( GL_QUAD_STRIP); + break; + } +} + +static void +process_end_vtxs( struct render_state *state, + const u32 *parms) { + LOG("End\n"); + if ( inside_primitive) { + glEnd(); + } + else { + LOG("End whilst not inside primitive\n"); + } + inside_primitive = 0; +} + +static void +process_viewport( struct render_state *state, + const u32 *parms) { + LOG("Viewport %d,%d,%d,%d\n", parms[0] & 0xff, (parms[0] >> 8) & 0xff, + (parms[0] >> 16) & 0xff, (parms[0] >> 24) & 0xff); + glViewport( (parms[0]&0xFF), ((parms[0]>>8)&0xFF), + ((parms[0]>>16)&0xFF) + 1, (parms[0]>>24) + 1); + +} + +static void +process_polygon_attr( struct render_state *state, + const u32 *parms) { + LOG("polygon attr %08x\n", parms[0]); + + /* + * Save this until the next begin + */ + current_polygon_attr = parms[0]; +} + +static void +process_normal( struct render_state *state, + const u32 *parms) { + LOG("Normal %08x\n", parms[0]); + + float normal[3] = { + normalTable[parms[0] &1023], + normalTable[(parms[0]>>10)&1023], + normalTable[(parms[0]>>20)&1023] + }; + + if (texCoordinateTransform == 2) + { + setup_mode23_tex_coord( normal); + } + + /* transform the vector */ + MatrixMultVec3x3( mtxCurrent[2], normal); + + glNormal3fv(normal); +} + +static void +process_teximage_param( struct render_state *state, + const u32 *parms) { + LOG("texture param %08x\n", parms[0]); + + textureFormat = parms[0]; +} + +static void +process_pltt_base( struct render_state *state, + const u32 *parms) { + LOG("texture palette base %08x\n", parms[0]); + + texturePalette = parms[0]; +} + + +static void +process_dif_amb( struct render_state *state, + const u32 *parms) { + GLint diffuse[4] = { + (parms[0] & 0x1F) << 26, + ((parms[0] >> 5) & 0x1F) << 26, + ((parms[0] >> 10) & 0x1F) << 26, + 0x7fffffff }; + GLint ambient[4] = { + ((parms[0] >> 16) & 0x1F) << 26, + ((parms[0] >> 21) & 0x1F) << 26, + ((parms[0] >> 26) & 0x1F) << 26, + 0x7fffffff }; + + LOG("dif amb %08x\n", parms[0]); + + if ( diffuse[0] != 0) + diffuse[0] |= 0x3ffffff; + if ( diffuse[1] != 0) + diffuse[1] |= 0x3ffffff; + if ( diffuse[2] != 0) + diffuse[2] |= 0x3ffffff; + + if ( ambient[0] != 0) + ambient[0] |= 0x3ffffff; + if ( ambient[1] != 0) + ambient[1] |= 0x3ffffff; + if ( ambient[2] != 0) + ambient[2] |= 0x3ffffff; + + + if (BIT15(parms[0])) { + colorRGB[0] = diffuse[0]; + colorRGB[1] = diffuse[1]; + colorRGB[2] = diffuse[2]; + } + + glMaterialiv (GL_FRONT_AND_BACK, GL_AMBIENT, ambient); + glMaterialiv (GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse); +} + + +static void +process_spe_emi( struct render_state *state, + const u32 *parms) { + GLint specular[4] = { + (parms[0]&0x1F) << 26, + ((parms[0]>>5)&0x1F) << 26, + ((parms[0]>>10)&0x1F) << 26, + 0x7fffffff }; + GLint emission[4] = { + ((parms[0]>>16)&0x1F) << 26, + ((parms[0]>>21)&0x1F) << 26, + ((parms[0]>>26)&0x1F) << 26, + 0x7fffffff }; + + if ( specular[0] != 0) + specular[0] |= 0x3ffffff; + if ( specular[1] != 0) + specular[1] |= 0x3ffffff; + if ( specular[2] != 0) + specular[2] |= 0x3ffffff; + + if ( emission[0] != 0) + emission[0] |= 0x3ffffff; + if ( emission[1] != 0) + emission[1] |= 0x3ffffff; + if ( emission[2] != 0) + emission[2] |= 0x3ffffff; + + + LOG("spe emi %08x\n", parms[0]); + + glMaterialiv (GL_FRONT_AND_BACK, GL_SPECULAR, specular); + glMaterialiv (GL_FRONT_AND_BACK, GL_EMISSION, emission); +} + +static void +process_light_vector( struct render_state *state, + const u32 *parms) { + int light = parms[0] >> 30; + lightDirection[light][0] = -normalTable[parms[0]&1023]; + lightDirection[light][1] = -normalTable[(parms[0]>>10)&1023]; + lightDirection[light][2] = -normalTable[(parms[0]>>20)&1023]; + lightDirection[light][3] = 0.0f; + + LOG("Light vector %f,%f,%f,%f (%08x)\n", + lightDirection[light][0], lightDirection[light][1], + lightDirection[light][2], lightDirection[light][3], + parms[0]); + + MatrixMultVec3x3( mtxCurrent[2], lightDirection[light]); + + /* + * FIXME: + * Delay until the next normal command. + * Can this change inside a primative? + */ + if ( inside_primitive) { + //LOG_ALWAYS( "Light vector change whilst inside primative\n"); + /* + * Save until the 'begin' command + */ + light_direction_valid |= 1 << light; + } + else { + glLightfv(GL_LIGHT0 + light, GL_POSITION, lightDirection[light]); + light_direction_valid &= ~(1 << light); + } +} + +static void +process_light_color( struct render_state *state, + const u32 *parms) { + int light = parms[0] >> 30; + lightColor[light][0] = ((parms[0]) & 0x1F)<<26; + lightColor[light][1] = ((parms[0]>> 5)&0x1F)<<26; + lightColor[light][2] = ((parms[0]>> 10)&0x1F)<<26; + lightColor[light][3] = 0x7fffffff; + + LOG("Light color %08x\n", parms[0]); + + /* + * FIXME: + * Delay until the next normal command. + * Can this change inside a primative? + */ + if ( inside_primitive) { + //LOG_ALWAYS( "Light colour change whilst inside primative\n"); + /* + * Save until the 'begin' command + */ + light_colour_valid |= 1 << light; + } + else { + glLightiv (GL_LIGHT0 + light, GL_AMBIENT, lightColor[light]); + glLightiv (GL_LIGHT0 + light, GL_DIFFUSE, lightColor[light]); + glLightiv (GL_LIGHT0 + light, GL_SPECULAR, lightColor[light]); + light_colour_valid &= ~(1 << light); + } +} + + +static void +process_texcoord( struct render_state *state, + const u32 *parms) { + LOG("texture coord %08x\n", parms[0]); + + t_texture_coord = (s16)(parms[0] >> 16); + s_texture_coord = (s16)(parms[0] & 0xFFFF); + + if ( texCoordinateTransform == 1) + { + float *textureMatrix = mtxCurrent[3]; + int s2 =(int)( s_texture_coord * textureMatrix[0] + + t_texture_coord * textureMatrix[4] + + (1.f/16.f) * textureMatrix[8] + + (1.f/16.f) * textureMatrix[12]); + int t2 =(int)( s_texture_coord * textureMatrix[1] + + t_texture_coord * textureMatrix[5] + + (1.f/16.f) * textureMatrix[9] + + (1.f/16.f) * textureMatrix[13]); + + /*LOG_TEXTURE("texture coord (pre-trans) s=%d t=%d\n", + s_texture_coord, t_texture_coord); + LOG_MATRIX( textureMatrix); + LOG_TEXTURE("texture coord (trans) s=%d t=%d\n", s2, t2);*/ + glTexCoord2i (s2, t2); + } + else + { + /*LOG_TEXTURE("texture coord s=%d t=%d\n", s_texture_coord, t_texture_coord);*/ + glTexCoord2i (s_texture_coord,t_texture_coord); + } +} + +static void +process_mtx_mode( struct render_state *state, + const u32 *parms) { + LOG("Set current matrix %08x\n", parms[0]); + + current_matrix_mode = parms[0] & 0x3; + + set_gl_matrix_mode( current_matrix_mode); +} + + +static void +process_mtx_identity( struct render_state *state, + const u32 *parms) { + LOG("Load identity (%d)\n", current_matrix_mode); + + MatrixIdentity (mtxCurrent[current_matrix_mode]); + + if (current_matrix_mode == 2) + MatrixIdentity (mtxCurrent[1]); + + if ( current_matrix_mode < 3) + glLoadIdentity(); +} + +static void +process_mtx_push( struct render_state *state, + const u32 *parms) { + LOG("Matrix push\n"); + + if ( current_matrix_mode == 2) { + /* copy the stack position and size from the Model matrix stack + * as they are shared and may have been updated whilst Model + * Matrix mode was selected. */ + mtxStack[2].position = mtxStack[1].position; + mtxStack[2].size = mtxStack[1].size; + } + + MatrixStackPushMatrix (&mtxStack[current_matrix_mode], + mtxCurrent[current_matrix_mode]); + + if ( current_matrix_mode == 2) { + /* push the model matrix as well */ + MatrixStackPushMatrix ( &mtxStack[1], + mtxCurrent[1]); + } +} + +static void +process_mtx_pop( struct render_state *state, + const u32 *parms) { + s32 index = parms[0]; + LOG("Matrix pop\n"); + + if ( current_matrix_mode == 2) { + /* copy the stack position and size from the Model matrix stack + * as they are shared and may have been updated whilst Model + * Matrix mode was selected. */ + mtxStack[2].position = mtxStack[1].position; + mtxStack[2].size = mtxStack[1].size; + } + + MatrixCopy ( mtxCurrent[current_matrix_mode], + MatrixStackPopMatrix (&mtxStack[current_matrix_mode], index)); + + if (current_matrix_mode == 2) { + MatrixCopy ( mtxCurrent[1], + MatrixStackPopMatrix( &mtxStack[1], index)); + } + + if ( current_matrix_mode < 3) { + if ( current_matrix_mode == 2) + loadMatrix( mtxCurrent[1]); + else + loadMatrix( mtxCurrent[current_matrix_mode]); + } +} + +static void +process_mtx_store( struct render_state *state, + const u32 *parms) { + LOG("Matrix store (%d)\n", parms[0]); + + if ( current_matrix_mode == 2) { + /* copy the stack position and size from the Model matrix stack + * as they are shared and may have been updated whilst Model + * Matrix mode was selected. */ + mtxStack[2].position = mtxStack[1].position; + mtxStack[2].size = mtxStack[1].size; + } + + MatrixStackLoadMatrix (&mtxStack[current_matrix_mode], + parms[0] & 31, + mtxCurrent[current_matrix_mode]); + + if ( current_matrix_mode == 2) { + /* store the model matrix as well */ + MatrixStackLoadMatrix (&mtxStack[1], + parms[0] & 31, + mtxCurrent[1]); + } +} + +static void +process_mtx_restore( struct render_state *state, + const u32 *parms) { + LOG("Matrix restore\n"); + + if ( current_matrix_mode == 2) { + /* copy the stack position and size from the Model matrix stack + * as they are shared and may have been updated whilst Model + * Matrix mode was selected. */ + mtxStack[2].position = mtxStack[1].position; + mtxStack[2].size = mtxStack[1].size; + } + + MatrixCopy (mtxCurrent[current_matrix_mode], + MatrixStackGetPos(&mtxStack[current_matrix_mode], parms[0]&31)); + + if (current_matrix_mode == 2) { + MatrixCopy (mtxCurrent[1], + MatrixStackGetPos(&mtxStack[1], parms[0]&31)); + } + + if ( current_matrix_mode < 3) { + if ( current_matrix_mode == 2) { + loadMatrix( mtxCurrent[1]); + } + else { + loadMatrix( mtxCurrent[current_matrix_mode]); + } + } +} + +static void +process_mtx_load_4x4( struct render_state *state, + const u32 *parms) { + int i; + LOG("Load 4x4 (%d):\n", current_matrix_mode); + LOG("%08x, %08x, %08x, %08x\n", parms[0], parms[1], parms[2], parms[3]); + LOG("%08x, %08x, %08x, %08x\n", parms[4], parms[5], parms[6], parms[7]); + LOG("%08x, %08x, %08x, %08x\n", parms[8], parms[9], parms[10], parms[11]); + LOG("%08x, %08x, %08x, %08x\n", parms[12], parms[13], parms[14], parms[15]); + + for ( i = 0; i < 16; i++) { + mtxCurrent[current_matrix_mode][i] = fix2float(parms[i]); + } + + if (current_matrix_mode == 2) + MatrixCopy (mtxCurrent[1], mtxCurrent[2]); + + LOG("%f, %f, %f, %f\n", + mtxCurrent[current_matrix_mode][0], mtxCurrent[current_matrix_mode][1], + mtxCurrent[current_matrix_mode][2], mtxCurrent[current_matrix_mode][3]); + LOG("%f, %f, %f, %f\n", + mtxCurrent[current_matrix_mode][4], mtxCurrent[current_matrix_mode][5], + mtxCurrent[current_matrix_mode][6], mtxCurrent[current_matrix_mode][7]); + LOG("%f, %f, %f, %f\n", + mtxCurrent[current_matrix_mode][8], mtxCurrent[current_matrix_mode][9], + mtxCurrent[current_matrix_mode][10], mtxCurrent[current_matrix_mode][11]); + LOG("%f, %f, %f, %f\n", + mtxCurrent[current_matrix_mode][12], mtxCurrent[current_matrix_mode][13], + mtxCurrent[current_matrix_mode][14], mtxCurrent[current_matrix_mode][15]); + + if ( current_matrix_mode < 3) + loadMatrix( mtxCurrent[current_matrix_mode]); +} + +static void +process_mtx_load_4x3( struct render_state *state, + const u32 *parms) { + int i; + + LOG("Load 4x3 (%d):\n", current_matrix_mode); + LOG("%08x, %08x, %08x, 0.0\n", parms[0], parms[1], parms[2]); + LOG("%08x, %08x, %08x, 0.0\n", parms[3], parms[4], parms[5]); + LOG("%08x, %08x, %08x, 0.0\n", parms[6], parms[7], parms[8]); + LOG("%08x, %08x, %08x, 1.0\n", parms[9], parms[10], parms[11]); + + mtxCurrent[current_matrix_mode][3] = mtxCurrent[current_matrix_mode][7] = + mtxCurrent[current_matrix_mode][11] = 0.0f; + mtxCurrent[current_matrix_mode][15] = 1.0f; + mtxCurrent[current_matrix_mode][0] = fix2float(parms[0]); + mtxCurrent[current_matrix_mode][1] = fix2float(parms[1]); + mtxCurrent[current_matrix_mode][2] = fix2float(parms[2]); + mtxCurrent[current_matrix_mode][4] = fix2float(parms[3]); + mtxCurrent[current_matrix_mode][5] = fix2float(parms[4]); + mtxCurrent[current_matrix_mode][6] = fix2float(parms[5]); + mtxCurrent[current_matrix_mode][8] = fix2float(parms[6]); + mtxCurrent[current_matrix_mode][9] = fix2float(parms[7]); + mtxCurrent[current_matrix_mode][10] = fix2float(parms[8]); + mtxCurrent[current_matrix_mode][12] = fix2float(parms[9]); + mtxCurrent[current_matrix_mode][13] = fix2float(parms[10]); + mtxCurrent[current_matrix_mode][14] = fix2float(parms[11]); + + if (current_matrix_mode == 2) + MatrixCopy (mtxCurrent[1], mtxCurrent[2]); + + LOG("%f, %f, %f, %f\n", + mtxCurrent[current_matrix_mode][0], mtxCurrent[current_matrix_mode][1], + mtxCurrent[current_matrix_mode][2], mtxCurrent[current_matrix_mode][3]); + LOG("%f, %f, %f, %f\n", + mtxCurrent[current_matrix_mode][4], mtxCurrent[current_matrix_mode][5], + mtxCurrent[current_matrix_mode][6], mtxCurrent[current_matrix_mode][7]); + LOG("%f, %f, %f, %f\n", + mtxCurrent[current_matrix_mode][8], mtxCurrent[current_matrix_mode][9], + mtxCurrent[current_matrix_mode][10], mtxCurrent[current_matrix_mode][11]); + LOG("%f, %f, %f, %f\n", + mtxCurrent[current_matrix_mode][12], mtxCurrent[current_matrix_mode][13], + mtxCurrent[current_matrix_mode][14], mtxCurrent[current_matrix_mode][15]); + + if ( current_matrix_mode < 3) + loadMatrix( mtxCurrent[current_matrix_mode]); +} + + +static void +process_mtx_trans( struct render_state *state, + const u32 *parms) { + float trans[3]; + + trans[0] = fix2float(parms[0]); + trans[1] = fix2float(parms[1]); + trans[2] = fix2float(parms[2]); + + LOG("translate %lf,%lf,%lf (%d)\n", trans[0], trans[1], trans[2], + current_matrix_mode); + + MatrixTranslate (mtxCurrent[current_matrix_mode], trans); + + if (current_matrix_mode == 2) + MatrixTranslate (mtxCurrent[1], trans); + + if ( current_matrix_mode == 2) { + LOG_MATRIX( mtxCurrent[1]); + loadMatrix( mtxCurrent[1]); + } + else if ( current_matrix_mode < 3) + loadMatrix( mtxCurrent[current_matrix_mode]); +} + +static void +process_mtx_scale( struct render_state *state, + const u32 *parms) { + float scale[3]; + + LOG("scale %08x, %08x, %08x (%d)\n", parms[0], parms[1], parms[2], + current_matrix_mode); + + scale[0] = fix2float(parms[0]); + scale[1] = fix2float(parms[1]); + scale[2] = fix2float(parms[2]); + + if (current_matrix_mode == 2) { + /* scaling does not happen against the drirection matrix */ + MatrixScale (mtxCurrent[1], scale); + } + else + MatrixScale (mtxCurrent[current_matrix_mode], scale); + + LOG("scale %f,%f,%f\n", scale[0], scale[1], scale[2]); + + if ( current_matrix_mode == 2) + loadMatrix( mtxCurrent[1]); + else if ( current_matrix_mode < 3) + loadMatrix( mtxCurrent[current_matrix_mode]); +} + +static void +process_mtx_mult_4x4( struct render_state *state, + const u32 *parms) { + static float mult_matrix[16]; + int i; + LOG("Mult 4x4 (%d):\n", current_matrix_mode); + + for ( i = 0; i < 16; i++) { + mult_matrix[i] = fix2float(parms[i]); + } + + LOG_MATRIX( mult_matrix); + + MatrixMultiply (mtxCurrent[current_matrix_mode], mult_matrix); + + if (current_matrix_mode == 2) + MatrixMultiply (mtxCurrent[1], mult_matrix); + + if ( current_matrix_mode == 2) + loadMatrix( mtxCurrent[1]); + else if ( current_matrix_mode < 3) + loadMatrix( mtxCurrent[current_matrix_mode]); +} + +static void +process_mtx_mult_4x3( struct render_state *state, + const u32 *parms) { + static float mult_matrix[16]; + + LOG("Mult 4x3 (%d):\n", current_matrix_mode); + + mult_matrix[3] = mult_matrix[7] = + mult_matrix[11] = 0.0f; + mult_matrix[15] = 1.0f; + mult_matrix[0] = fix2float(parms[0]); + mult_matrix[1] = fix2float(parms[1]); + mult_matrix[2] = fix2float(parms[2]); + mult_matrix[4] = fix2float(parms[3]); + mult_matrix[5] = fix2float(parms[4]); + mult_matrix[6] = fix2float(parms[5]); + mult_matrix[8] = fix2float(parms[6]); + mult_matrix[9] = fix2float(parms[7]); + mult_matrix[10] = fix2float(parms[8]); + mult_matrix[12] = fix2float(parms[9]); + mult_matrix[13] = fix2float(parms[10]); + mult_matrix[14] = fix2float(parms[11]); + + LOG_MATRIX( mult_matrix); + + MatrixMultiply (mtxCurrent[current_matrix_mode], mult_matrix); + + if (current_matrix_mode == 2) + MatrixMultiply (mtxCurrent[1], mult_matrix); + + if ( current_matrix_mode == 2) + loadMatrix( mtxCurrent[1]); + else if ( current_matrix_mode < 3) + loadMatrix( mtxCurrent[current_matrix_mode]); +} + +static void +process_mtx_mult_3x3( struct render_state *state, + const u32 *parms) { + static float mult_matrix[16]; + + LOG("Mult 3x3 (%d):\n", current_matrix_mode); + + mult_matrix[3] = mult_matrix[7] = + mult_matrix[11] = 0.0f; + mult_matrix[12] = mult_matrix[13] = + mult_matrix[14] = 0.0f; + mult_matrix[15] = 1.0f; + mult_matrix[0] = fix2float(parms[0]); + mult_matrix[1] = fix2float(parms[1]); + mult_matrix[2] = fix2float(parms[2]); + mult_matrix[4] = fix2float(parms[3]); + mult_matrix[5] = fix2float(parms[4]); + mult_matrix[6] = fix2float(parms[5]); + mult_matrix[8] = fix2float(parms[6]); + mult_matrix[9] = fix2float(parms[7]); + mult_matrix[10] = fix2float(parms[8]); + + LOG_MATRIX( mult_matrix); + + MatrixMultiply (mtxCurrent[current_matrix_mode], mult_matrix); + + if (current_matrix_mode == 2) + MatrixMultiply (mtxCurrent[1], mult_matrix); + + if ( current_matrix_mode == 2) + loadMatrix( mtxCurrent[1]); + else if ( current_matrix_mode < 3) + loadMatrix( mtxCurrent[current_matrix_mode]); +} + +static void +process_colour( struct render_state *state, + const u32 *parms) { + colorRGB[0] = (parms[0] & 0x1f) << 26; + colorRGB[1] = ((parms[0] >> 5) & 0x1f) << 26; + colorRGB[2] = ((parms[0] >> 10) & 0x1f) << 26; + + if ( colorRGB[0] != 0) + colorRGB[0] |= 0x3ffffff; + if ( colorRGB[1] != 0) + colorRGB[1] |= 0x3ffffff; + if ( colorRGB[2] != 0) + colorRGB[2] |= 0x3ffffff; + + LOG("colour %08x,%08x,%08x (%08x)\n", + colorRGB[0], colorRGB[1], colorRGB[2], + parms[0]); + glColor4iv( colorRGB); +} + +static void +process_vtx_16( struct render_state *state, + const u32 *parms) { + cur_vertex[0] = float16table[parms[0] & 0xFFFF]; + cur_vertex[1] = float16table[parms[0] >> 16]; + cur_vertex[2] = float16table[parms[1] & 0xFFFF]; + LOG("vtx16 %08x %08x\n", parms[0], parms[1]); + + setup_vertex( cur_vertex); +} + +static void +process_vtx_10( struct render_state *state, + const u32 *parms) { + cur_vertex[0] = float10Table[(parms[0]) & 0x3ff]; + cur_vertex[1] = float10Table[(parms[0] >> 10) & 0x3ff]; + cur_vertex[2] = float10Table[(parms[0] >> 20) & 0x3ff]; + LOG("vtx10 %08x\n", parms[0]); + + setup_vertex( cur_vertex); +} + +static void +process_vtx_xy( struct render_state *state, + const u32 *parms) { + cur_vertex[0] = float16table[(parms[0]) & 0xffff]; + cur_vertex[1] = float16table[(parms[0] >> 16) & 0xffff]; + LOG("vtx xy %08x\n", parms[0]); + + setup_vertex( cur_vertex); +} + +static void +process_vtx_xz( struct render_state *state, + const u32 *parms) { + cur_vertex[0] = float16table[(parms[0]) & 0xffff]; + cur_vertex[2] = float16table[(parms[0] >> 16) & 0xffff]; + LOG("vtx xz %08x\n", parms[0]); + + setup_vertex( cur_vertex); +} + +static void +process_vtx_yz( struct render_state *state, + const u32 *parms) { + cur_vertex[1] = float16table[(parms[0]) & 0xffff]; + cur_vertex[2] = float16table[(parms[0] >> 16) & 0xffff]; + LOG("vtx yz %08x\n", parms[0]); + + setup_vertex( cur_vertex); +} + +static void +process_vtx_diff( struct render_state *state, + const u32 *parms) { + cur_vertex[0] += float10RelTable[(parms[0]) & 0x3ff]; + cur_vertex[1] += float10RelTable[(parms[0] >> 10) & 0x3ff]; + cur_vertex[2] += float10RelTable[(parms[0] >> 20) & 0x3ff]; + LOG("vtx10 %08x\n", parms[0]); + + setup_vertex( cur_vertex); +} + + +static void +process_control( struct render_state *state, + const u32 *parms) { + LOG("Control set to %08x\n", parms[0]); + + /* + * Save for later. + * all control is handled at a 'begin' command + */ + disp_3D_control = parms[0]; +} + +static void +process_alpha_function( struct render_state *state, + const u32 *parms) { + LOG("Alpha function %08x\n", parms[0]); + /* + * Save for later + */ + alpha_function = parms[0]; +} + +static void +process_clear_depth( struct render_state *state, + const u32 *parms) { + //u32 depth24b; + u32 v = parms[0] & 0x7FFF; + LOG("Clear depth %08x\n", parms[0]); + + /* + * Save for later. + * handled at a 'begin' command + */ + current_depth24b = (v * 0x200) + ( (v+1) & 0x8000 ? 0x1ff : 0); + + if ( inside_primitive) { + depth24b_valid = 1; + } + else { + depth24b_valid = 0; + glClearDepth( current_depth24b / ((float)(1<<24))); + } +} + +static void +process_clear_colour( struct render_state *state, + const u32 *parms) { + u32 v = parms[0]; + LOG("Clear colour %08x\n", v); + + /* + * Save for later. + * handled at a 'begin' command + */ + current_clear_colour = v; + + if ( inside_primitive) { + clear_colour_valid = 1; + } + else { + glClearColor( ((float)( current_clear_colour & 0x1F))/31.0f, + ((float)(( current_clear_colour >> 5)&0x1F))/31.0f, + ((float)(( current_clear_colour >> 10)&0x1F))/31.0f, + ((float)(( current_clear_colour >> 16)&0x1F))/31.0f); + clear_colour_valid = 0; + } +} + + +/* + * The rendering function. + */ +static void +draw_3D_area( void) { + struct render_state *state = &render_states[GET_DRAW_STATE_INDEX(current_render_state)]; + int i; + GLenum errCode; + + + /*** OpenGL BEGIN ***/ + if ( !begin_opengl_ogl_collector_platform()) { + LOG_ERROR( "platform failed for begin opengl for draw\n"); + return; + } + +#ifndef READ_PIXELS_IMMEDIATELY + /* + * If there is a render which has not had its pixels read yet + * then read them now. + */ + if ( new_render_available) { + new_render_available = 0; + +#ifdef USE_BGR_ORDER + glReadPixels(0,0,256,192,GL_BGRA,GL_UNSIGNED_BYTE,GPU_screen3D); +#else + glReadPixels(0,0,256,192,GL_RGBA,GL_UNSIGNED_BYTE,GPU_screen3D); +#endif + } +#endif + + + LOG("\n------------------------------------\n"); + LOG("Start of render\n"); + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + + /*if ( state->write_index > 10000) { + LOG_ALWAYS( "3d write index %d\n", state->write_index); + }*/ + + for ( i = 0; i < state->write_index; i++) { + u32 cmd = state->cmds[i]; + //LOG("Render cmd: %08x\n", state->cmds[i]); + + if ( cmd < LAST_CMD_VALUE + 1) { + if ( cmd_processors[cmd].processor_fn != NULL) { + cmd_processors[cmd].processor_fn( state, &state->cmds[i+1]); + } + else { + LOG_ERROR("Unhandled %02x\n", cmd); + } + i += cmd_processors[cmd].num_parms; + } + } + + /* + * Complete any primitive that may be left unended + */ + if ( inside_primitive) { + LOG( "implicit primitive end at end\n"); + glEnd(); + + inside_primitive = 0; + } + + complete_render_ogl_collector_platform(); + + if ((errCode = glGetError()) != GL_NO_ERROR) { + const GLubyte *errString; + + errString = gluErrorString(errCode); + LOG_ERROR( "openGL error during 3D emulation: %s\n", errString); + } + +#ifdef READ_PIXELS_IMMEDIATELY +#ifdef USE_BGR_ORDER + glReadPixels(0,0,256,192,GL_BGRA,GL_UNSIGNED_BYTE,GPU_screen3D); +#else + glReadPixels(0,0,256,192,GL_RGBA,GL_UNSIGNED_BYTE,GPU_screen3D); +#endif + + if ((errCode = glGetError()) != GL_NO_ERROR) { + const GLubyte *errString; + + errString = gluErrorString(errCode); + LOG_ERROR( "openGL error during glReadPixels: %s\n", errString); + } +#else + new_render_available = 1; +#endif + + + LOG("End of render\n------------------------------------\n"); + + end_opengl_ogl_collector_platform(); + return; +} + + +static void +init_openGL( void) { + /* OpenGL BEGIN */ + if ( !begin_opengl_ogl_collector_platform()) { + LOG_ERROR( "platform failed to begin opengl for initialisation\n"); + return; + } + + /* Set the background black */ + glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); + + /* Enables Depth Testing */ + glEnable( GL_DEPTH_TEST ); + glEnable(GL_TEXTURE_2D); + + glEnable( GL_STENCIL_TEST); + + // Always Passes, 1 Bit Plane, 1 As Mask + glStencilFunc( GL_ALWAYS, 1, 1); + glStencilOp( GL_KEEP, GL_REPLACE, GL_REPLACE); + + glGenTextures (1, &oglTextureID); + + glViewport (0, 0, 256, 192); + + end_opengl_ogl_collector_platform(); + /*** OpenGL END ***/ +} + + +static char +nullFunc1_3Dgl_collect(void) { + return 1; +} + +static void +nullFunc2_3Dgl_collect(void) { +} +static void +nullFunc3_3Dgl_collect(unsigned long v) { +} +static void nullFunc4_3Dgl_collect(signed long v){} +static void nullFunc5_3Dgl_collect(unsigned int v){} +static void nullFunc6_3Dgl_collect(unsigned int one, + unsigned int two, unsigned int v){} +static int nullFunc7_3Dgl_collect(void) {return 0;} +static long nullFunc8_3Dgl_collect(unsigned int index){ return 0; } +static void nullFunc9_3Dgl_collect(int line, unsigned short * DST) { }; + + +static int num_primitives[4]; + +static char +init_3Dgl_collect( void) { + int i; + + LOG("Initialising 3D renderer for OpenGL Collector\n"); + + if ( !initialise_ogl_collector_platform()) { + LOG_ERROR( "Platform initialisation failed\n"); + return 0; + } + + MatrixStackSetMaxSize(&mtxStack[0], 1); // Projection stack + MatrixStackSetMaxSize(&mtxStack[1], 31); // Coordinate stack + MatrixStackSetMaxSize(&mtxStack[2], 31); // Directional stack + MatrixStackSetMaxSize(&mtxStack[3], 1); // Texture stack + + MatrixInit (mtxCurrent[0]); + MatrixInit (mtxCurrent[1]); + MatrixInit (mtxCurrent[2]); + MatrixInit (mtxCurrent[3]); + MatrixInit (mtxTemporal); + + current_render_state = 0; + for ( i = 0; i < NUM_RENDER_STATES; i++) { + render_states[i].write_index = 0; + + } + + for ( i = 0; i < 4; i++) { + num_primitives[i] = 0; + } + + for ( i = 0; i < LAST_CMD_VALUE+1; i++) { + cmd_processors[i].processor_fn = NULL; + cmd_processors[i].num_parms = 0; + + switch ( i) { + case NOP_CMD: + cmd_processors[i].num_parms = 0; + break; + case MTX_MODE_CMD: + cmd_processors[i].processor_fn = process_mtx_mode; + cmd_processors[i].num_parms = 1; + break; + case MTX_PUSH_CMD: + cmd_processors[i].processor_fn = process_mtx_push; + cmd_processors[i].num_parms = 0; + break; + case MTX_POP_CMD: + cmd_processors[i].processor_fn = process_mtx_pop; + cmd_processors[i].num_parms = 1; + break; + case MTX_STORE_CMD: + cmd_processors[i].processor_fn = process_mtx_store; + cmd_processors[i].num_parms = 1; + break; + case MTX_RESTORE_CMD: + cmd_processors[i].processor_fn = process_mtx_restore; + cmd_processors[i].num_parms = 1; + break; + case MTX_IDENTITY_CMD: + cmd_processors[i].processor_fn = process_mtx_identity; + cmd_processors[i].num_parms = 0; + break; + case MTX_LOAD_4x4_CMD: + cmd_processors[i].processor_fn = process_mtx_load_4x4; + cmd_processors[i].num_parms = 16; + break; + case MTX_LOAD_4x3_CMD: + cmd_processors[i].processor_fn = process_mtx_load_4x3; + cmd_processors[i].num_parms = 12; + break; + case MTX_MULT_4x4_CMD: + cmd_processors[i].processor_fn = process_mtx_mult_4x4; + cmd_processors[i].num_parms = 16; + break; + case MTX_MULT_4x3_CMD: + cmd_processors[i].processor_fn = process_mtx_mult_4x3; + cmd_processors[i].num_parms = 12; + break; + case MTX_MULT_3x3_CMD: + cmd_processors[i].processor_fn = process_mtx_mult_3x3; + cmd_processors[i].num_parms = 9; + break; + case MTX_SCALE_CMD: + cmd_processors[i].processor_fn = process_mtx_scale; + cmd_processors[i].num_parms = 3; + break; + case MTX_TRANS_CMD: + cmd_processors[i].processor_fn = process_mtx_trans; + cmd_processors[i].num_parms = 3; + break; + case COLOR_CMD: + cmd_processors[i].processor_fn = process_colour; + cmd_processors[i].num_parms = 1; + break; + case NORMAL_CMD: + cmd_processors[i].processor_fn = process_normal; + cmd_processors[i].num_parms = 1; + break; + case TEXCOORD_CMD: + cmd_processors[i].processor_fn = process_texcoord; + cmd_processors[i].num_parms = 1; + break; + case VTX_16_CMD: + cmd_processors[i].processor_fn = process_vtx_16; + cmd_processors[i].num_parms = 2; + break; + case VTX_10_CMD: + cmd_processors[i].processor_fn = process_vtx_10; + cmd_processors[i].num_parms = 1; + break; + case VTX_XY_CMD: + cmd_processors[i].processor_fn = process_vtx_xy; + cmd_processors[i].num_parms = 1; + break; + case VTX_XZ_CMD: + cmd_processors[i].processor_fn = process_vtx_xz; + cmd_processors[i].num_parms = 1; + break; + case VTX_YZ_CMD: + cmd_processors[i].processor_fn = process_vtx_yz; + cmd_processors[i].num_parms = 1; + break; + case VTX_DIFF_CMD: + cmd_processors[i].processor_fn = process_vtx_diff; + cmd_processors[i].num_parms = 1; + break; + case POLYGON_ATTR_CMD: + cmd_processors[i].processor_fn = process_polygon_attr; + cmd_processors[i].num_parms = 1; + break; + case TEXIMAGE_PARAM_CMD: + cmd_processors[i].processor_fn = process_teximage_param; + cmd_processors[i].num_parms = 1; + break; + case PLTT_BASE_CMD: + cmd_processors[i].processor_fn = process_pltt_base; + cmd_processors[i].num_parms = 1; + break; + case DIF_AMB_CMD: + cmd_processors[i].processor_fn = process_dif_amb; + cmd_processors[i].num_parms = 1; + break; + case SPE_EMI_CMD: + cmd_processors[i].processor_fn = process_spe_emi; + cmd_processors[i].num_parms = 1; + break; + case LIGHT_VECTOR_CMD: + cmd_processors[i].processor_fn = process_light_vector; + cmd_processors[i].num_parms = 1; + break; + case LIGHT_COLOR_CMD: + cmd_processors[i].processor_fn = process_light_color; + cmd_processors[i].num_parms = 1; + break; + case SHININESS_CMD: + cmd_processors[i].num_parms = 32; + break; + case BEGIN_VTXS_CMD: + cmd_processors[i].processor_fn = process_begin_vtxs; + cmd_processors[i].num_parms = 1; + break; + case END_VTXS_CMD: + cmd_processors[i].processor_fn = process_end_vtxs; + cmd_processors[i].num_parms = 0; + break; + case SWAP_BUFFERS_CMD: + cmd_processors[i].num_parms = 1; + break; + case VIEWPORT_CMD: + cmd_processors[i].processor_fn = process_viewport; + cmd_processors[i].num_parms = 1; + break; + case BOX_TEST_CMD: + cmd_processors[i].num_parms = 3; + break; + case POS_TEST_CMD: + cmd_processors[i].num_parms = 2; + break; + case VEC_TEST_CMD: + cmd_processors[i].num_parms = 1; + break; + + /* The next ones are not NDS commands */ + case CLEAR_COLOUR_CMD: + cmd_processors[i].processor_fn = process_clear_colour; + cmd_processors[i].num_parms = 1; + break; + case CLEAR_DEPTH_CMD: + cmd_processors[i].processor_fn = process_clear_depth; + cmd_processors[i].num_parms = 1; + break; + + case FOG_COLOUR_CMD: + cmd_processors[i].num_parms = 1; + break; + case FOG_OFFSET_CMD: + cmd_processors[i].num_parms = 1; + break; + + case CONTROL_CMD: + cmd_processors[i].processor_fn = process_control; + cmd_processors[i].num_parms = 1; + break; + + case ALPHA_FUNCTION_CMD: + cmd_processors[i].processor_fn = process_alpha_function; + cmd_processors[i].num_parms = 1; + break; + + } + } + + for (i = 0; i < 65536; i++) + { + float16table[i] = fix2float((signed short)i); + } + + for (i = 0; i < 1024; i++) + { + float10RelTable[i] = ((signed short)(i<<6)) / (float)(1<<18); + float10Table[i] = ((signed short)(i<<6)) / (float)(1<<12); + normalTable[i] = ((signed short)(i<<6)) / (float)(1<<16); + } + + init_openGL(); + + return 1; +} + + + + +static void +Flush_3Dgl_collect( unsigned long val) { + int new_render_state = GET_NEXT_RENDER_STATE_INDEX(current_render_state); + //struct render_state *state = &render_states[current_render_state]; + struct render_state *new_state = &render_states[new_render_state]; + + LOG("Flush %lu %d %d\n", val, + state->write_index, render_states[new_render_state].write_index); + + current_render_state = new_render_state; + + draw_3D_area(); + new_state->write_index = 0; + + numVertex = 0; + //LOG("End of render\n"); +} + +static void +SwapScreen_3Dgl_collect( unsigned int screen) { + LOG("NEVER USED? SwapScreen %d\n", screen); +} + + +static void +call_list_3Dgl_collect(unsigned long v) { + static u32 call_list_command = 0; + static u32 total_num_parms = 0; + static u32 current_parm = 0; + static u32 parms[MAX_NUMBER_OF_PARMS]; + + LOG_CALL_LIST("call list - %08x (%08x cur %d tot %d)\n", v, + call_list_command, current_parm, total_num_parms); + + if ( call_list_command == 0) { + /* new call list command coming in */ + call_list_command = v; + + total_num_parms = cmd_processors[v & 0xff].num_parms; + current_parm = 0; + + LOG_CALL_LIST("new command %02x total parms %d\n", v & 0xff, + total_num_parms); + } + else { + LOG_CALL_LIST("Adding parm %d - %08x\n", current_parm, v); + parms[current_parm] = v; + current_parm += 1; + } + + if ( current_parm == total_num_parms) { + do { + u32 cmd = call_list_command & 0xff; + LOG_CALL_LIST("Current command is %02x\n", cmd); + if ( cmd != 0) { + unsigned int i; + + LOG_CALL_LIST("Cmd %02x complete:\n", cmd); + + if ( cmd == SWAP_BUFFERS_CMD) { + Flush_3Dgl_collect( parms[0]); + } + else { + /* put the command and parms on the list */ + ADD_RENDER_PARM_CMD( cmd); + + for ( i = 0; i < total_num_parms; i++) { + ADD_RENDER_PARM_CMD( parms[i]); + LOG_CALL_LIST("parm %08x\n", parms[i]); + } + } + } + call_list_command >>=8; + + total_num_parms = cmd_processors[call_list_command & 0xff].num_parms; + current_parm = 0; + + LOG_CALL_LIST("Next cmd %02x parms %d\n", call_list_command & 0xff, + total_num_parms); + } while ( call_list_command && total_num_parms == 0); + } +} + +static void +viewport_3Dgl_collect(unsigned long v) { + //LOG("Viewport\n"); + ADD_RENDER_PARM_CMD( VIEWPORT_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +Begin_3Dgl_collect(unsigned long v) { + //LOG("Begin\n"); + ADD_RENDER_PARM_CMD( BEGIN_VTXS_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +End_3Dgl_collect( void) { + //LOG("END\n"); + ADD_RENDER_PARM_CMD( END_VTXS_CMD); +} + + +static void +fog_colour_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( FOG_COLOUR_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +fog_offset_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( FOG_OFFSET_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +clear_depth_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( CLEAR_DEPTH_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +clear_colour_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( CLEAR_COLOUR_CMD); + ADD_RENDER_PARM_CMD( v); +} + + + +static void +Vertex16b_3Dgl_collect( unsigned int v) { + static int vertex16_count = 0; + static u32 parm1; + + if ( vertex16_count == 0) { + vertex16_count += 1; + parm1 = v; + } + else { + ADD_RENDER_PARM_CMD( VTX_16_CMD); + ADD_RENDER_PARM_CMD( parm1); + ADD_RENDER_PARM_CMD( v); + vertex16_count = 0; + } +} + +static void +Vertex10b_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( VTX_10_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +Vertex3_cord_3Dgl_collect(unsigned int one, unsigned int two, unsigned int v) { + if ( one == 0) { + if ( two == 1) { + ADD_RENDER_PARM_CMD( VTX_XY_CMD); + } + else { + ADD_RENDER_PARM_CMD( VTX_XZ_CMD); + } + } + else { + ADD_RENDER_PARM_CMD( VTX_YZ_CMD); + } + ADD_RENDER_PARM_CMD( v); +} + +static void +Vertex_rel_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( VTX_DIFF_CMD); + ADD_RENDER_PARM_CMD( v); +} + + +static void +matrix_mode_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( MTX_MODE_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +load_identity_matrix_3Dgl_collect(void) { + ADD_RENDER_PARM_CMD( MTX_IDENTITY_CMD); +} + + +static void +load_4x4_matrix_3Dgl_collect(signed long v) { + static int count_4x4 = 0; + static u32 parms[15]; + + if ( count_4x4 < 15) { + parms[count_4x4] = v; + count_4x4 += 1; + } + else { + int i; + + ADD_RENDER_PARM_CMD( MTX_LOAD_4x4_CMD); + + for ( i = 0; i < 15; i++) { + ADD_RENDER_PARM_CMD( parms[i]); + } + ADD_RENDER_PARM_CMD( v); + count_4x4 = 0; + } +} + +static void +load_4x3_matrix_3Dgl_collect(signed long v) { + static int count_4x3 = 0; + static u32 parms[11]; + + if ( count_4x3 < 11) { + parms[count_4x3] = v; + count_4x3 += 1; + } + else { + int i; + + ADD_RENDER_PARM_CMD( MTX_LOAD_4x3_CMD); + + for ( i = 0; i < 11; i++) { + ADD_RENDER_PARM_CMD( parms[i]); + } + ADD_RENDER_PARM_CMD( v); + count_4x3 = 0; + } +} + + +static void +multi_matrix_4x4_3Dgl_collect(signed long v) { + static int count_4x4 = 0; + static u32 parms[15]; + + if ( count_4x4 < 15) { + parms[count_4x4] = v; + count_4x4 += 1; + } + else { + int i; + + ADD_RENDER_PARM_CMD( MTX_MULT_4x4_CMD); + + for ( i = 0; i < 15; i++) { + ADD_RENDER_PARM_CMD( parms[i]); + } + ADD_RENDER_PARM_CMD( v); + count_4x4 = 0; + } +} + +static void +multi_matrix_4x3_3Dgl_collect(signed long v) { + static int count_4x3 = 0; + static u32 parms[11]; + + if ( count_4x3 < 11) { + parms[count_4x3] = v; + count_4x3 += 1; + } + else { + int i; + + ADD_RENDER_PARM_CMD( MTX_MULT_4x3_CMD); + + for ( i = 0; i < 11; i++) { + ADD_RENDER_PARM_CMD( parms[i]); + } + ADD_RENDER_PARM_CMD( v); + count_4x3 = 0; + } +} + +static void +multi_matrix_3x3_3Dgl_collect(signed long v) { + static int count_3x3 = 0; + static u32 parms[8]; + + if ( count_3x3 < 8) { + parms[count_3x3] = v; + count_3x3 += 1; + } + else { + int i; + + ADD_RENDER_PARM_CMD( MTX_MULT_3x3_CMD); + + for ( i = 0; i < 8; i++) { + ADD_RENDER_PARM_CMD( parms[i]); + } + ADD_RENDER_PARM_CMD( v); + count_3x3 = 0; + } +} + + + + +static void +store_matrix_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( MTX_STORE_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +restore_matrix_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( MTX_RESTORE_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +push_matrix_3Dgl_collect( void) { + ADD_RENDER_PARM_CMD( MTX_PUSH_CMD); +} + +static void +pop_matrix_3Dgl_collect(signed long v) { + ADD_RENDER_PARM_CMD( MTX_POP_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +translate_3Dgl_collect(signed long v) { + static int count_trans = 0; + static u32 parms[2]; + + if ( count_trans < 2) { + parms[count_trans] = v; + count_trans += 1; + } + else { + int i; + + ADD_RENDER_PARM_CMD( MTX_TRANS_CMD); + + for ( i = 0; i < 2; i++) { + ADD_RENDER_PARM_CMD( parms[i]); + } + ADD_RENDER_PARM_CMD( v); + count_trans = 0; + } +} + +static void +scale_3Dgl_collect(signed long v) { + static int count_scale = 0; + static u32 parms[2]; + + if ( count_scale < 2) { + parms[count_scale] = v; + count_scale += 1; + } + else { + int i; + + ADD_RENDER_PARM_CMD( MTX_SCALE_CMD); + + for ( i = 0; i < 2; i++) { + ADD_RENDER_PARM_CMD( parms[i]); + } + ADD_RENDER_PARM_CMD( v); + count_scale = 0; + } +} + +static void +PolyAttr_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( POLYGON_ATTR_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +TextImage_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( TEXIMAGE_PARAM_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +Colour_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( COLOR_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +material0_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( DIF_AMB_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +material1_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( SPE_EMI_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +shininess_3Dgl_collect(unsigned long v) { + static int count_shine = 0; + static u32 parms[31]; + + if ( count_shine < 31) { + parms[count_shine] = v; + count_shine += 1; + } + else { + int i; + + ADD_RENDER_PARM_CMD( SHININESS_CMD); + + for ( i = 0; i < 31; i++) { + ADD_RENDER_PARM_CMD( parms[i]); + } + ADD_RENDER_PARM_CMD( v); + count_shine = 0; + } +} + +static void +texture_palette_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( PLTT_BASE_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +texture_coord_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( TEXCOORD_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +light_direction_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( LIGHT_VECTOR_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +light_colour_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( LIGHT_COLOR_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +normal_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( NORMAL_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +control_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( CONTROL_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static void +alpha_function_3Dgl_collect(unsigned long v) { + ADD_RENDER_PARM_CMD( ALPHA_FUNCTION_CMD); + ADD_RENDER_PARM_CMD( v); +} + +static int +get_num_polygons_3Dgl_collect( void) { + /* FIXME: this is a hack */ + LOG("Hacky get_num_polygons %d\n", numVertex/3); + + return numVertex/3; +} +static int +get_num_vertices_3Dgl_collect( void) { + LOG("get_num_vertices %d\n", numVertex); + + return numVertex; +} + +static long +get_clip_matrix_3Dgl_collect(unsigned int index) { + float val = MatrixGetMultipliedIndex (index, mtxCurrent[0], mtxCurrent[1]); + LOG("get_clip_matrix %d\n", index); + + val *= (1<<12); + + return (signed long)val; +} + +static long +get_direction_matrix_3Dgl_collect(unsigned int index) { + LOG("get_direction_matrix %d\n", index); + index += (index/3); + + return (signed long)(mtxCurrent[2][(index)*(1<<12)]); +} + + +//#define BITMAP_STENCIL 1 +static void +get_line_3Dgl_collect(int line, unsigned short *dst) { + int i; + u8 *screen3D = (u8 *)&GPU_screen3D[(192-(line%192))*256*4]; +#ifdef BITMAP_STENCIL + u8 *line_stencil = (u8 *)&stencil_buffer[(192-(line%192))*(256>>3)]; +#else + u8 *line_stencil = (u8 *)&stencil_buffer[(192-(line%192))*256]; +#endif + +#ifndef READ_PIXELS_IMMEDIATELY + if ( line == 0) { + if ( new_render_available) { + new_render_available = 0; + if ( !begin_opengl_ogl_collector_platform()) { + LOG_ERROR( "platform failed for begin opengl for get_line\n"); + return; + } + +#ifdef USE_BGR_ORDER + glReadPixels(0,0,256,192,GL_BGRA,GL_UNSIGNED_BYTE,GPU_screen3D); +#else + glReadPixels(0,0,256,192,GL_RGBA,GL_UNSIGNED_BYTE,GPU_screen3D); +#endif + +#ifdef BITMAP_STENCIL + glReadPixels(0,0, 256,192, GL_STENCIL_INDEX, GL_BITMAP, stencil_buffer); +#else + glReadPixels(0,0, 256,192, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, stencil_buffer); +#endif + + end_opengl_ogl_collector_platform(); + } + } +#endif + + +#ifdef BITMAP_STENCIL + for(i = 0; i < 256; i += 8) + { + u8 bitmap = *line_stencil++; + + if ( bitmap) { + if ( bitmap & 0x80) { +#ifdef USE_BGR_ORDER + u32 r = screen3D[0], g = screen3D[1], b = screen3D[2], a = screen3D[3]; +#else + u32 r = screen3D[2], g = screen3D[1], b = screen3D[0], a = screen3D[3]; +#endif + r = (r*(a+1)) >> 8; g = (g*(a+1)) >> 8; b = (b*(a+1)) >> 8; + *dst = (((r>>3)<<10) | ((g>>3)<<5) | (b>>3)); + } + dst += 1; + screen3D += 4; + if ( bitmap & 0x40) { +#ifdef USE_BGR_ORDER + u32 r = screen3D[0], g = screen3D[1], b = screen3D[2], a = screen3D[3]; +#else + u32 r = screen3D[2], g = screen3D[1], b = screen3D[0], a = screen3D[3]; +#endif + r = (r*(a+1)) >> 8; g = (g*(a+1)) >> 8; b = (b*(a+1)) >> 8; + *dst = (((r>>3)<<10) | ((g>>3)<<5) | (b>>3)); + } + dst += 1; + screen3D += 4; + if ( bitmap & 0x20) { +#ifdef USE_BGR_ORDER + u32 r = screen3D[0], g = screen3D[1], b = screen3D[2], a = screen3D[3]; +#else + u32 r = screen3D[2], g = screen3D[1], b = screen3D[0], a = screen3D[3]; +#endif + r = (r*(a+1)) >> 8; g = (g*(a+1)) >> 8; b = (b*(a+1)) >> 8; + *dst = (((r>>3)<<10) | ((g>>3)<<5) | (b>>3)); + } + dst += 1; + screen3D += 4; + if ( bitmap & 0x10) { +#ifdef USE_BGR_ORDER + u32 r = screen3D[0], g = screen3D[1], b = screen3D[2], a = screen3D[3]; +#else + u32 r = screen3D[2], g = screen3D[1], b = screen3D[0], a = screen3D[3]; +#endif + r = (r*(a+1)) >> 8; g = (g*(a+1)) >> 8; b = (b*(a+1)) >> 8; + *dst = (((r>>3)<<10) | ((g>>3)<<5) | (b>>3)); + } + dst += 1; + screen3D += 4; + if ( bitmap & 0x08) { +#ifdef USE_BGR_ORDER + u32 r = screen3D[0], g = screen3D[1], b = screen3D[2], a = screen3D[3]; +#else + u32 r = screen3D[2], g = screen3D[1], b = screen3D[0], a = screen3D[3]; +#endif + r = (r*(a+1)) >> 8; g = (g*(a+1)) >> 8; b = (b*(a+1)) >> 8; + *dst = (((r>>3)<<10) | ((g>>3)<<5) | (b>>3)); + } + dst += 1; + screen3D += 4; + if ( bitmap & 0x04) { +#ifdef USE_BGR_ORDER + u32 r = screen3D[0], g = screen3D[1], b = screen3D[2], a = screen3D[3]; +#else + u32 r = screen3D[2], g = screen3D[1], b = screen3D[0], a = screen3D[3]; +#endif + r = (r*(a+1)) >> 8; g = (g*(a+1)) >> 8; b = (b*(a+1)) >> 8; + *dst = (((r>>3)<<10) | ((g>>3)<<5) | (b>>3)); + } + dst += 1; + screen3D += 4; + if ( bitmap & 0x02) { +#ifdef USE_BGR_ORDER + u32 r = screen3D[0], g = screen3D[1], b = screen3D[2], a = screen3D[3]; +#else + u32 r = screen3D[2], g = screen3D[1], b = screen3D[0], a = screen3D[3]; +#endif + r = (r*(a+1)) >> 8; g = (g*(a+1)) >> 8; b = (b*(a+1)) >> 8; + *dst = (((r>>3)<<10) | ((g>>3)<<5) | (b>>3)); + } + dst += 1; + screen3D += 4; + if ( bitmap & 0x01) { +#ifdef USE_BGR_ORDER + u32 r = screen3D[0], g = screen3D[1], b = screen3D[2], a = screen3D[3]; +#else + u32 r = screen3D[2], g = screen3D[1], b = screen3D[0], a = screen3D[3]; +#endif + r = (r*(a+1)) >> 8; g = (g*(a+1)) >> 8; b = (b*(a+1)) >> 8; + *dst = (((r>>3)<<10) | ((g>>3)<<5) | (b>>3)); + } + dst += 1; + screen3D += 4; + } + else { + screen3D += 4 * 8; + dst += 8; + } + } +#else + for(i = 0; i < 256; i++) + { + if ( line_stencil[i]) { +#ifdef USE_BGR_ORDER + u32 r = screen3D[0], + g = screen3D[1], + b = screen3D[2], + a = screen3D[3]; +#else + u32 r = screen3D[2], + g = screen3D[1], + b = screen3D[0], + a = screen3D[3]; +#endif +#if 0 + r = (r*a)/255; + g = (g*a)/255; + b = (b*a)/255; +#else + r = (r*(a+1)) >> 8; + g = (g*(a+1)) >> 8; + b = (b*(a+1)) >> 8; +#endif + + *dst = (((r>>3)<<10) | ((g>>3)<<5) | (b>>3)); + } + dst += 1; + screen3D += 4; + } +#endif +} + + +GPU3DInterface gpu3D_opengl_collector = { + /* the Init function */ + init_3Dgl_collect, + + /* Viewport */ + viewport_3Dgl_collect, + + /* Clear colour */ + clear_colour_3Dgl_collect, + + /* Fog colour */ + fog_colour_3Dgl_collect, + + /* Fog offset */ + fog_offset_3Dgl_collect, + + /* Clear Depth */ + clear_depth_3Dgl_collect, + + /* Matrix Mode */ + matrix_mode_3Dgl_collect, + + /* Load Identity */ + load_identity_matrix_3Dgl_collect, + + /* Load 4x4 Matrix */ + load_4x4_matrix_3Dgl_collect, + + /* Load 4x3 Matrix */ + load_4x3_matrix_3Dgl_collect, + + /* Store Matrix */ + store_matrix_3Dgl_collect, + + /* Restore Matrix */ + restore_matrix_3Dgl_collect, + + /* Push Matrix */ + push_matrix_3Dgl_collect, + + /* Pop Matrix */ + pop_matrix_3Dgl_collect, + + /* Translate */ + translate_3Dgl_collect, + + /* Scale */ + scale_3Dgl_collect, + + /* Multiply Matrix 3x3 */ + multi_matrix_3x3_3Dgl_collect, + + /* Multiply Matrix 4x3 */ + multi_matrix_4x3_3Dgl_collect, + + /* Multiply Matrix 4x4 */ + multi_matrix_4x4_3Dgl_collect, + + /* Begin primitive */ + Begin_3Dgl_collect, + /* End primitive */ + End_3Dgl_collect, + + /* Colour */ + Colour_3Dgl_collect, + + /* Vertex */ + Vertex16b_3Dgl_collect, + Vertex10b_3Dgl_collect, + Vertex3_cord_3Dgl_collect, + Vertex_rel_3Dgl_collect, + + /* Swap Screen */ + SwapScreen_3Dgl_collect, + + /* Get Number of polygons */ + get_num_polygons_3Dgl_collect, + + /* Get number of vertices */ + get_num_vertices_3Dgl_collect, + + /* Flush */ + Flush_3Dgl_collect, + + /* poly attribute */ + PolyAttr_3Dgl_collect, + + /* Material 0 */ + material0_3Dgl_collect, + + /* Material 1 */ + material1_3Dgl_collect, + + /* Shininess */ + shininess_3Dgl_collect, + + /* Texture attributes */ + TextImage_3Dgl_collect, + + /* Texture palette */ + texture_palette_3Dgl_collect, + + /* Texture coordinate */ + texture_coord_3Dgl_collect, + + /* Light direction */ + light_direction_3Dgl_collect, + + /* Light colour */ + light_colour_3Dgl_collect, + + /* Alpha function */ + alpha_function_3Dgl_collect, + + /* Control */ + control_3Dgl_collect, + + /* normal */ + normal_3Dgl_collect, + + /* Call list */ + call_list_3Dgl_collect, + + /* Get clip matrix */ + get_clip_matrix_3Dgl_collect, + + /* Get direction matrix */ + get_direction_matrix_3Dgl_collect, + + /* get line */ + get_line_3Dgl_collect +}; + + + +#endif /* End of __MINGW32__ */ +#endif /* End of HAVE_GL_GLU_H */ +#endif /* End of HAVE_GL_GL_H */ diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/opengl_collector_3Demu.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/opengl_collector_3Demu.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/opengl_collector_3Demu.h 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/opengl_collector_3Demu.h 2007-04-20 07:42:58.000000000 -0500 @@ -0,0 +1,65 @@ +/* $Id: opengl_collector_3Demu.h,v 1.2 2007/04/20 12:42:58 masscat Exp $ + */ +#ifndef _OPENGL_COLLECTOR_3DEMU_H_ +#define _OPENGL_COLLECTOR_3DEMU_H_ 1 +/* + Copyright (C) 2006-2007 Ben Jaques + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +extern GPU3DInterface gpu3D_opengl_collector; + + +/** + * This is called before a set of OpenGL functions are called. + * It is up to the platform code to switch to the correct context and similar. + * + * If the platform code is unsucessful then return 0 and the OpenGL functions + * will not be called. Return 1 otherwise. + * + * If this is not overridden then the call will always fail. + */ +extern int (*begin_opengl_ogl_collector_platform)( void); + +/** + * This is called after a set of OpenGL functions have been called, marking + * the end the OpenGL calls. + * + * If not overridden this function will do nothing. + */ +extern void (*end_opengl_ogl_collector_platform)( void); + +/** + * This is called during the OpenGL Collector's initialisation. + * + * If the platform code is unsucessful then return 0 and the initialisation + * will fail. Return 1 otherwise. + * + * If this is not overridden then the call will always fail. + */ +extern int (*initialise_ogl_collector_platform)( void); + +/** + * This is called when all the OpenGL functions comprising a single set + * have been called. + * + * If this is not overridden then a call to glFlush() is made. + */ +extern void (*complete_render_ogl_collector_platform)( void); + +#endif /* End of _OPENGL_COLLECTOR_3DEMU_H_ */ diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/registers.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/registers.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/registers.h 2006-12-08 23:04:04.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/registers.h 2007-06-07 12:26:29.000000000 -0500 @@ -1,9 +1,41 @@ +/* Copyright (C) 2006 Theo Berkau + + Ideas borrowed from Stephane Dallongeville's SCSP core + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #ifndef REGISTERS_H #define REGISTERS_H +#define REG_REGION_MASK 0x0FFFEF80 +#define REG_BASE_DISPx 0x04000000 +#define REG_BASE_DISPA 0x04000000 +#define REG_BASE_DISPB 0x04001000 +#define REG_BASE_DMA 0x04000080 +#define REG_BASE_SIORTCTIMERS 0x04000100 +#define REG_BASE_ROMIPC 0x04000180 +#define REG_BASE_MEMIRQ 0x04000200 +#define REG_BASE_MATH 0x04000280 +#define REG_BASE_OTHER 0x04000300 +#define REG_BASE_RCVPORTS 0x04100000 + // Display Engine A #define REG_DISPA_DISPCNT 0x04000000 -#define REG_DISPA_DISPSTAT 0x04000004 #define REG_DISPA_VCOUNT 0x04000006 #define REG_DISPA_BG0CNT 0x04000008 #define REG_DISPA_BG1CNT 0x0400000A @@ -43,9 +75,6 @@ #define REG_DISPA_BLDCNT 0x04000050 #define REG_DISPA_BLDALPHA 0x04000052 #define REG_DISPA_BLDY 0x04000054 -#define REG_DISPA_DISP3DCNT 0x04000060 -#define REG_DISPA_DISPCAPCNT 0x04000064 -#define REG_DISPA_DISPMMEMFIFO 0x04000068 #define REG_DISPA_MASTERBRIGHT 0x0400006C // DMA @@ -187,4 +216,118 @@ #define REG_IPCFIFORECV 0x04100000 #define REG_GCDATAIN 0x04100010 + + + + +#define REG_DISPB 0x00001000 +// core A and B specific +#define REG_DISPx_DISPCNT 0x04000000 +#define REG_DISPx_VCOUNT 0x04000006 +#define REG_DISPx_BG0CNT 0x04000008 +#define REG_DISPx_BG1CNT 0x0400000A +#define REG_DISPx_BG2CNT 0x0400000C +#define REG_DISPx_BG3CNT 0x0400000E +#define REG_DISPx_BG0HOFS 0x04000010 +#define REG_DISPx_BG0VOFS 0x04000012 +#define REG_DISPx_BG1HOFS 0x04000014 +#define REG_DISPx_BG1VOFS 0x04000016 +#define REG_DISPx_BG2HOFS 0x04000018 +#define REG_DISPx_BG2VOFS 0x0400001A +#define REG_DISPx_BG3HOFS 0x0400001C +#define REG_DISPx_BG3VOFS 0x0400001E +#define REG_DISPx_BG2PA 0x04000020 +#define REG_DISPx_BG2PB 0x04000022 +#define REG_DISPx_BG2PC 0x04000024 +#define REG_DISPx_BG2PD 0x04000026 +#define REG_DISPx_BG2XL 0x04000028 +#define REG_DISPx_BG2XH 0x0400002A +#define REG_DISPx_BG2YL 0x0400002C +#define REG_DISPx_BG2YH 0x0400002E +#define REG_DISPx_BG3PA 0x04000030 +#define REG_DISPx_BG3PB 0x04000032 +#define REG_DISPx_BG3PC 0x04000034 +#define REG_DISPx_BG3PD 0x04000036 +#define REG_DISPx_BG3XL 0x04000038 +#define REG_DISPx_BG3XH 0x0400003A +#define REG_DISPx_BG3YL 0x0400003C +#define REG_DISPx_BG3YH 0x0400003E +#define REG_DISPx_WIN0H 0x04000040 +#define REG_DISPx_WIN1H 0x04000042 +#define REG_DISPx_WIN0V 0x04000044 +#define REG_DISPx_WIN1V 0x04000046 +#define REG_DISPx_WININ 0x04000048 +#define REG_DISPx_WINOUT 0x0400004A +#define REG_DISPx_MOSAIC 0x0400004C +#define REG_DISPx_BLDCNT 0x04000050 +#define REG_DISPx_BLDALPHA 0x04000052 +#define REG_DISPx_BLDY 0x04000054 +#define REG_DISPx_MASTERBRIGHT 0x0400006C +// core A specific +#define REG_DISPA_DISPSTAT 0x04000004 +#define REG_DISPA_DISP3DCNT 0x04000060 +#define REG_DISPA_DISPCAPCNT 0x04000064 +#define REG_DISPA_DISPMMEMFIFO 0x04000068 + + +#define eng_3D_RDLINES_COUNT 0x04000320 +#define eng_3D_EDGE_COLOR 0x04000330 +#define eng_3D_ALPHA_TEST_REF 0x04000340 +#define eng_3D_CLEAR_COLOR 0x04000350 +#define eng_3D_CLEAR_DEPTH 0x04000354 +#define eng_3D_CLRIMAGE_OFFSET 0x04000356 +#define eng_3D_FOG_COLOR 0x04000358 +#define eng_3D_FOG_OFFSET 0x0400035C +#define eng_3D_FOG_TABLE 0x04000360 +#define eng_3D_TOON_TABLE 0x04000380 +#define eng_3D_GXFIFO 0x04000400 + +// 3d commands +#define cmd_3D_MTX_MODE 0x04000440 +#define cmd_3D_MTX_PUSH 0x04000444 +#define cmd_3D_MTX_POP 0x04000448 +#define cmd_3D_MTX_STORE 0x0400044C +#define cmd_3D_MTX_RESTORE 0x04000450 +#define cmd_3D_MTX_IDENTITY 0x04000454 +#define cmd_3D_MTX_LOAD_4x4 0x04000458 +#define cmd_3D_MTX_LOAD_4x3 0x0400045C +#define cmd_3D_MTX_MULT_4x4 0x04000460 +#define cmd_3D_MTX_MULT_4x3 0x04000464 +#define cmd_3D_MTX_MULT_3x3 0x04000468 +#define cmd_3D_MTX_SCALE 0x0400046C +#define cmd_3D_MTX_TRANS 0x04000470 +#define cmd_3D_COLOR 0x04000480 +#define cmd_3D_NORMA 0x04000484 +#define cmd_3D_TEXCOORD 0x04000488 +#define cmd_3D_VTX_16 0x0400048C +#define cmd_3D_VTX_10 0x04000490 +#define cmd_3D_VTX_XY 0x04000494 +#define cmd_3D_VTX_XZ 0x04000498 +#define cmd_3D_VTX_YZ 0x0400049C +#define cmd_3D_VTX_DIFF 0x040004A0 +#define cmd_3D_POLYGON_ATTR 0x040004A4 +#define cmd_3D_TEXIMAGE_PARAM 0x040004A8 +#define cmd_3D_PLTT_BASE 0x040004AC +#define cmd_3D_DIF_AMB 0x040004C0 +#define cmd_3D_SPE_EMI 0x040004C4 +#define cmd_3D_LIGHT_VECTOR 0x040004C8 +#define cmd_3D_LIGHT_COLOR 0x040004CC +#define cmd_3D_SHININESS 0x040004D0 +#define cmd_3D_BEGIN_VTXS 0x04000500 +#define cmd_3D_END_VTXS 0x04000504 +#define cmd_3D_SWAP_BUFFERS 0x04000540 +#define cmd_3D_VIEWPORT 0x04000580 +#define cmd_3D_BOX_TEST 0x040005C0 +#define cmd_3D_POS_TEST 0x040005C4 +#define cmd_3D_VEC_TEST 0x040005C8 + +#define eng_3D_GXSTAT 0x04000600 +#define eng_3D_RAM_COUNT 0x04000604 +#define eng_3D_DISP_1DOT_DEPTH 0x04000610 +#define eng_3D_POS_RESULT 0x04000620 +#define eng_3D_VEC_RESULT 0x04000630 +#define eng_3D_CLIPMTX_RESULT 0x04000640 +#define eng_3D_VECMTX_RESULT 0x04000680 + + #endif diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/render3D.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/render3D.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/render3D.c 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/render3D.c 2007-03-16 22:50:16.000000000 -0500 @@ -0,0 +1,86 @@ +/* + Copyright (C) 2006-2007 shash + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "render3D.h" + +char NDS_nullFunc1 (void){ return 1; } +void NDS_nullFunc2 (void){} +void NDS_nullFunc3 (unsigned long v){} +void NDS_nullFunc4 (signed long v) {} +void NDS_nullFunc5 (unsigned int v){} +void NDS_nullFunc6 (unsigned int one, unsigned int two, unsigned int v){} +int NDS_nullFunc7 (void) {return 0;} +long NDS_nullFunc8 (unsigned int index){ return 0; } +void NDS_nullFunc9 (int line, unsigned short * DST) { }; + +GPU3DInterface gpu3DNull = { NDS_nullFunc1, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc2, + NDS_nullFunc4, + NDS_nullFunc4, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc2, + NDS_nullFunc4, + NDS_nullFunc4, + NDS_nullFunc4, + NDS_nullFunc4, + NDS_nullFunc4, + NDS_nullFunc4, + NDS_nullFunc3, + NDS_nullFunc2, + NDS_nullFunc3, + NDS_nullFunc5, + NDS_nullFunc3, + NDS_nullFunc6, + NDS_nullFunc3, + NDS_nullFunc5, + NDS_nullFunc7, + NDS_nullFunc7, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + NDS_nullFunc3, + + NDS_nullFunc8, + NDS_nullFunc8, + NDS_nullFunc9 }; + +GPU3DInterface *gpu3D = &gpu3DNull; + +void NDS_3D_SetDriver (int core3DIndex) +{ + gpu3D = core3DList[core3DIndex]; +} diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/render3D.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/render3D.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/render3D.h 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/render3D.h 2007-03-17 07:35:13.000000000 -0500 @@ -0,0 +1,101 @@ +/* + Copyright (C) 2006-2007 shash + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef GPU_3D +#define GPU_3D + +#ifdef _MSC_VER +#define CALL_CONVENTION __cdecl +#else +#define CALL_CONVENTION +#endif + +/* +enum DRIVER_3D +{ + DRIVER_NULL = 0, + DRIVER_OPENGL +}; +*/ + +typedef struct GPU3DInterface +{ + char (CALL_CONVENTION* NDS_3D_Init) (void); + void (CALL_CONVENTION* NDS_3D_ViewPort) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_ClearColor) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_FogColor) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_FogOffset) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_ClearDepth) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_MatrixMode) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_LoadIdentity) (void); + void (CALL_CONVENTION* NDS_3D_LoadMatrix4x4) (signed long v); + void (CALL_CONVENTION* NDS_3D_LoadMatrix4x3) (signed long v); + void (CALL_CONVENTION* NDS_3D_StoreMatrix) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_RestoreMatrix) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_PushMatrix) (void); + void (CALL_CONVENTION* NDS_3D_PopMatrix) (signed long i); + void (CALL_CONVENTION* NDS_3D_Translate) (signed long v); + void (CALL_CONVENTION* NDS_3D_Scale) (signed long v); + void (CALL_CONVENTION* NDS_3D_MultMatrix3x3) (signed long v); + void (CALL_CONVENTION* NDS_3D_MultMatrix4x3) (signed long v); + void (CALL_CONVENTION* NDS_3D_MultMatrix4x4) (signed long v); + void (CALL_CONVENTION* NDS_3D_Begin) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_End) (void); + void (CALL_CONVENTION* NDS_3D_Color3b) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_Vertex16b) (unsigned int v); + void (CALL_CONVENTION* NDS_3D_Vertex10b) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_Vertex3_cord) (unsigned int one, unsigned int two, unsigned int v); + void (CALL_CONVENTION* NDS_3D_Vertex_rel) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_SwapScreen) (unsigned int screen); + int (CALL_CONVENTION* NDS_3D_GetNumPolys) (void); // THIS IS A HACK :D + int (CALL_CONVENTION* NDS_3D_GetNumVertex) (void); + void (CALL_CONVENTION* NDS_3D_Flush) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_PolygonAttrib) (unsigned long val); + void (CALL_CONVENTION* NDS_3D_Material0) (unsigned long val); + void (CALL_CONVENTION* NDS_3D_Material1) (unsigned long val); + void (CALL_CONVENTION* NDS_3D_Shininess) (unsigned long val); + void (CALL_CONVENTION* NDS_3D_TexImage) (unsigned long val); + void (CALL_CONVENTION* NDS_3D_TexPalette) (unsigned long val); + void (CALL_CONVENTION* NDS_3D_TexCoord) (unsigned long val); + void (CALL_CONVENTION* NDS_3D_LightDirection) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_LightColor) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_AlphaFunc) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_Control) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_Normal) (unsigned long v); + void (CALL_CONVENTION* NDS_3D_CallList) (unsigned long v); + + long (CALL_CONVENTION* NDS_3D_GetClipMatrix) (unsigned int index); + long (CALL_CONVENTION* NDS_3D_GetDirectionalMatrix) (unsigned int index); + void (CALL_CONVENTION* NDS_3D_GetLine) (int line, unsigned short * DST); +} GPU3DInterface; + +// gpu 3D core list, per port +extern GPU3DInterface *core3DList[]; + +// Default null plugin +#define GPU3D_NULL 0 +extern GPU3DInterface gpu3DNull; + +// Extern pointer +extern GPU3DInterface *gpu3D; + +void NDS_3D_SetDriver (int core3DIndex); + +#endif diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/ROMReader.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/ROMReader.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/ROMReader.c 2007-01-27 13:38:04.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/ROMReader.c 2007-06-07 12:26:29.000000000 -0500 @@ -1,3 +1,22 @@ +/* Copyright 2007 Guillaume Duhamel + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include "ROMReader.h" #include @@ -100,7 +119,7 @@ void * GZIPROMReaderInit(const char * filename) { - return gzopen(filename, "rb"); + return (void*)gzopen(filename, "rb"); } void GZIPROMReaderDeInit(void * file) diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/ROMReader.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/ROMReader.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/ROMReader.h 2007-01-07 15:38:23.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/ROMReader.h 2007-06-07 12:26:29.000000000 -0500 @@ -1,3 +1,22 @@ +/* Copyright 2007 Guillaume Duhamel + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include "types.h" #define ROMREADER_DEFAULT -1 diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/saves.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/saves.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/saves.c 2007-01-31 17:22:17.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/saves.c 2007-02-16 07:46:34.000000000 -0600 @@ -282,9 +282,9 @@ MMU_write16(ARMCPU_ARM9, 0x04000304, MMU_read16(ARMCPU_ARM9, 0x04000304)); // This should regenerate the graphics configuration - for (i = REG_DISPA_DISPCNT; i<=REG_DISPA_MASTERBRIGHT; i+=2) + for (i = REG_BASE_DISPA; i<=REG_BASE_DISPA + 0x7F; i+=2) MMU_write16(ARMCPU_ARM9, i, MMU_read16(ARMCPU_ARM9, i)); - for (i = REG_DISPB_DISPCNT; i<=REG_DISPB_MASTERBRIGHT; i+=2) + for (i = REG_BASE_DISPB; i<=REG_BASE_DISPB + 0x7F; i+=2) MMU_write16(ARMCPU_ARM9, i, MMU_read16(ARMCPU_ARM9, i)); gzclose (file); diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/SPU.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/SPU.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/SPU.c 2006-12-08 23:19:56.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/SPU.c 2007-06-18 17:34:42.000000000 -0500 @@ -26,6 +26,7 @@ #include "ARM9.h" #include "MMU.h" #include "SPU.h" +#include "mem.h" #include "armcpu.h" @@ -37,11 +38,6 @@ #define CHANSTAT_STOPPED 0 #define CHANSTAT_PLAY 1 -#define ARM7_REG_8(a) (MMU.ARM7_REG[a]) - -#define ARM7_REG_16(a) (((u16 *)(MMU.ARM7_REG+addr))[0]) -#define ARM7_REG_32(a) (((u32 *)(MMU.ARM7_REG+addr))[0]) - int indextbl[8] = { -1, -1, -1, -1, 2, 4, 6, 8 @@ -175,7 +171,8 @@ // Reset Registers for (i = 0x400; i < 0x51D; i++) - ARM7_REG_8(i) = 0; + T1WriteByte(MMU.ARM7_REG, i, 0); + } ////////////////////////////////////////////////////////////////////////////// @@ -202,8 +199,8 @@ channel_struct *chan = &SPU->chan[channel]; chan->sampinc = (16777216 / (0x10000 - (double)chan->timer)) / 44100; - -// LOG("Channel %d key on: vol = %d, datashift = %d, hold = %d, pan = %d, waveduty = %d, repeat = %d, format = %d, source address = %07X, timer = %04X, loop start = %04X, length = %06X, MMU.ARM7_REG[0x501] = %02X\n", channel, chan->vol, chan->datashift, chan->hold, chan->pan, chan->waveduty, chan->repeat, chan->format, chan->addr, chan->timer, chan->loopstart, chan->length, ARM7_REG_8(0x501)); + +// LOG("Channel %d key on: vol = %d, datashift = %d, hold = %d, pan = %d, waveduty = %d, repeat = %d, format = %d, source address = %07X, timer = %04X, loop start = %04X, length = %06X, MMU.ARM7_REG[0x501] = %02X\n", channel, chan->vol, chan->datashift, chan->hold, chan->pan, chan->waveduty, chan->repeat, chan->format, chan->addr, chan->timer, chan->loopstart, chan->length, T1ReadByte(MMU.ARM7_REG, 0x501)); switch(chan->format) { case 0: // 8-bit @@ -251,42 +248,42 @@ { case 0x0: // LOG("Sound Channel %d Volume read\n", (addr >> 4) & 0xF); - return ARM7_REG_8(addr); + return T1ReadByte(MMU.ARM7_REG, addr); case 0x1: { // LOG("Sound Channel %d Data Shift/Hold read\n",(addr >> 4) & 0xF); - return ARM7_REG_8(addr); + return T1ReadByte(MMU.ARM7_REG, addr); } case 0x2: // LOG("Sound Channel %d Panning read\n",(addr >> 4) & 0xF); - return ARM7_REG_8(addr); + return T1ReadByte(MMU.ARM7_REG, addr); case 0x3: -// LOG("Sound Channel %d Wave Duty/Repeat/Format/Start read: %02X\n", (addr >> 4) & 0xF, ARM7_REG_8(addr)); - return ARM7_REG_8(addr); +// LOG("Sound Channel %d Wave Duty/Repeat/Format/Start read: %02X\n", (addr >> 4) & 0xF, T1ReadByte(MMU.ARM7_REG, addr)); + return T1ReadByte(MMU.ARM7_REG, addr); case 0x4: case 0x5: case 0x6: case 0x7: // LOG("Sound Channel %d Data Source Register read: %08X\n",(addr >> 4) & 0xF, addr); - return ARM7_REG_8(addr); + return T1ReadByte(MMU.ARM7_REG, addr); case 0x8: // LOG("Sound Channel Timer(Low byte) read: %08X\n", addr); - return ARM7_REG_8(addr); + return T1ReadByte(MMU.ARM7_REG, addr); case 0x9: // LOG("Sound Channel Timer(High byte) read: %08X\n", addr); - return ARM7_REG_8(addr); + return T1ReadByte(MMU.ARM7_REG, addr); case 0xA: // LOG("Sound Channel Loop Start(Low byte) read: %08X\n", addr); - return ARM7_REG_8(addr); + return T1ReadByte(MMU.ARM7_REG, addr); case 0xB: // LOG("Sound Channel Loop Start(High byte) read: %08X\n", addr); - return ARM7_REG_8(addr); + return T1ReadByte(MMU.ARM7_REG, addr); case 0xC: case 0xD: case 0xE: case 0xF: // LOG("Sound Channel %d Length Register read: %08X\n",(addr >> 4) & 0xF, addr); - return ARM7_REG_8(addr); + return T1ReadByte(MMU.ARM7_REG, addr); default: break; } } @@ -297,22 +294,22 @@ case 0x000: case 0x001: // LOG("Sound Control Register read: %08X\n", addr); - return ARM7_REG_8(addr); + return T1ReadByte(MMU.ARM7_REG, addr); case 0x004: case 0x005: // LOG("Sound Bias Register read: %08X\n", addr); - return ARM7_REG_8(addr); + return T1ReadByte(MMU.ARM7_REG, addr); case 0x008: // LOG("Sound Capture 0 Control Register read\n"); - return ARM7_REG_8(addr); + return T1ReadByte(MMU.ARM7_REG, addr); case 0x009: // LOG("Sound Capture 1 Control Register read\n"); - return ARM7_REG_8(addr); + return T1ReadByte(MMU.ARM7_REG, addr); default: break; } } - return ARM7_REG_8(addr); + return T1ReadByte(MMU.ARM7_REG, addr); } ////////////////////////////////////////////////////////////////////////////// @@ -327,27 +324,27 @@ { case 0x0: // LOG("Sound Channel %d Volume/data shift/hold word read\n", (addr >> 4) & 0xF); - return ARM7_REG_16(addr); + return T1ReadWord(MMU.ARM7_REG, addr); case 0x2: { channel_struct *chan=&SPU->chan[(addr >> 4) & 0xF]; // LOG("Sound Channel %d Panning/Wave Duty/Repeat Mode/Format/Start word read\n", (addr >> 4) & 0xF); - return ARM7_REG_16(addr); + return T1ReadWord(MMU.ARM7_REG, addr); } case 0x4: case 0x6: // LOG("Sound Channel %d Data Source Register word read: %08X\n",(addr >> 4) & 0xF, addr); - return ARM7_REG_16(addr); + return T1ReadWord(MMU.ARM7_REG, addr); case 0x8: // LOG("Sound Channel %d Timer Register word read\n", (addr >> 4) & 0xF); - return ARM7_REG_16(addr); + return T1ReadWord(MMU.ARM7_REG, addr); case 0xA: // LOG("Sound Channel %d Loop start Register word read\n", (addr >> 4) & 0xF); - return ARM7_REG_16(addr); + return T1ReadWord(MMU.ARM7_REG, addr); case 0xC: case 0xE: // LOG("Sound Channel %d Length Register word read: %08X\n",(addr >> 4) & 0xF, addr); - return ARM7_REG_16(addr); + return T1ReadWord(MMU.ARM7_REG, addr); default: break; } } @@ -357,18 +354,18 @@ { case 0x000: // LOG("Sound Control Register word read\n"); - return ARM7_REG_16(addr); + return T1ReadWord(MMU.ARM7_REG, addr); case 0x004: // LOG("Sound Bias Register word read\n"); - return ARM7_REG_16(addr); + return T1ReadWord(MMU.ARM7_REG, addr); case 0x008: // LOG("Sound Capture 0/1 Control Register word read\n"); - return ARM7_REG_16(addr); + return T1ReadWord(MMU.ARM7_REG, addr); default: break; } } - return ARM7_REG_16(addr); + return T1ReadWord(MMU.ARM7_REG, addr); } ////////////////////////////////////////////////////////////////////////////// @@ -383,18 +380,18 @@ { case 0x0: // LOG("Sound Channel %d Control Register long read\n", (addr >> 4) & 0xF); - return ARM7_REG_32(addr); + return T1ReadLong(MMU.ARM7_REG, addr); case 0x4: // LOG("Sound Channel %d Data Source Register long read\n"); - return ARM7_REG_32(addr); + return T1ReadLong(MMU.ARM7_REG, addr); case 0x8: // LOG("Sound Channel %d Timer/Loop Start Register long read\n", (addr >> 4) & 0xF); - return ARM7_REG_32(addr); + return T1ReadLong(MMU.ARM7_REG, addr); case 0xC: // LOG("Sound Channel %d Length Register long read\n", (addr >> 4) & 0xF); - return ARM7_REG_32(addr); + return T1ReadLong(MMU.ARM7_REG, addr); default: - return ARM7_REG_32(addr); + return T1ReadLong(MMU.ARM7_REG, addr); } } else @@ -403,19 +400,19 @@ { case 0x000: // LOG("Sound Control Register long read\n"); - return ARM7_REG_32(addr); + return T1ReadLong(MMU.ARM7_REG, addr); case 0x004: // LOG("Sound Bias Register long read\n"); - return ARM7_REG_32(addr); + return T1ReadLong(MMU.ARM7_REG, addr); case 0x008: // LOG("Sound Capture 0/1 Control Register long read: %08X\n"); - return ARM7_REG_32(addr); + return T1ReadLong(MMU.ARM7_REG, addr); default: - return ARM7_REG_32(addr); + return T1ReadLong(MMU.ARM7_REG, addr); } } - return ARM7_REG_32(addr); + return T1ReadLong(MMU.ARM7_REG, addr); } ////////////////////////////////////////////////////////////////////////////// @@ -431,7 +428,7 @@ case 0x0: SPU->chan[(addr >> 4) & 0xF].vol = val & 0x7F; // LOG("Sound Channel %d Volume write: %02X\n", (addr >> 4) & 0xF, val); - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); return; case 0x1: { @@ -442,13 +439,13 @@ if (chan->datashift == 3) chan->datashift = 4; chan->hold = (val >> 7) & 0x1; - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); return; } case 0x2: // LOG("Sound Channel %d Panning write: %02X\n",(addr >> 4) & 0xF, val); SPU->chan[(addr >> 4) & 0xF].pan = val & 0x7F; - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); return; case 0x3: { @@ -462,7 +459,7 @@ if (SPU->chan[(addr >> 4) & 0xF].status) SPU_KeyOn((addr >> 4) & 0xF); - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); return; } case 0x4: @@ -470,34 +467,34 @@ case 0x6: case 0x7: // LOG("Sound Channel %d Data Source Register write: %08X %02X\n",(addr >> 4) & 0xF, addr, val); - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); return; case 0x8: // LOG("Sound Channel Timer(Low byte) write: %08X - %02X\n", addr, val); - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); return; case 0x9: // LOG("Sound Channel Timer(High byte) write: %08X - %02X\n", addr, val); - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); return; case 0xA: // LOG("Sound Channel Loop Start(Low byte) write: %08X - %02X\n", addr, val); - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); return; case 0xB: // LOG("Sound Channel Loop Start(High byte) write: %08X - %02X\n", addr, val); - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); return; case 0xC: case 0xD: case 0xE: case 0xF: // LOG("Sound Channel %d Length Register write: %08X %02X\n",(addr >> 4) & 0xF, addr, val); - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); return; default: LOG("Unsupported Sound Register byte write: %08X %02X\n", addr, val); - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); break; } } @@ -508,26 +505,26 @@ case 0x000: case 0x001: // LOG("Sound Control Register write: %08X %02X\n", addr, val); - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); return; case 0x004: case 0x005: // LOG("Sound Bias Register write: %08X %02X\n", addr, val); - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); return; case 0x008: // LOG("Sound Capture 0 Control Register write: %02X\n", val); - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); return; case 0x009: // LOG("Sound Capture 1 Control Register write: %02X\n", val); - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); return; default: break; } } - ARM7_REG_8(addr) = val; + T1WriteByte(MMU.ARM7_REG, addr, val); } ////////////////////////////////////////////////////////////////////////////// @@ -549,7 +546,7 @@ if (chan->datashift == 3) chan->datashift = 4; chan->hold = (val >> 15) & 0x1; - ARM7_REG_16(addr) = val; + T1WriteWord(MMU.ARM7_REG, addr, val); return; } case 0x2: @@ -565,13 +562,13 @@ if (chan->status) SPU_KeyOn((addr >> 4) & 0xF); - ARM7_REG_16(addr) = val; + T1WriteWord(MMU.ARM7_REG, addr, val); return; } case 0x4: case 0x6: // LOG("Sound Channel %d Data Source Register write: %08X %04X\n",(addr >> 4) & 0xF, addr, val); - ARM7_REG_16(addr) = val; + T1WriteWord(MMU.ARM7_REG, addr, val); return; case 0x8: { @@ -579,22 +576,22 @@ // LOG("Sound Channel %d Timer Register write: %04X\n", (addr >> 4) & 0xF, val); chan->timer = val & 0xFFFF; chan->sampinc = (16777216 / (0x10000 - (double)chan->timer)) / 44100; - ARM7_REG_16(addr) = val; + T1WriteWord(MMU.ARM7_REG, addr, val); return; } case 0xA: // LOG("Sound Channel %d Loop start Register write: %04X\n", (addr >> 4) & 0xF, val); SPU->chan[(addr >> 4) & 0xF].loopstart = val; - ARM7_REG_16(addr) = val; + T1WriteWord(MMU.ARM7_REG, addr, val); return; case 0xC: case 0xE: // LOG("Sound Channel %d Length Register write: %08X %04X\n",(addr >> 4) & 0xF, addr, val); - ARM7_REG_16(addr) = val; + T1WriteWord(MMU.ARM7_REG, addr, val); return; default: // LOG("Unsupported Sound Register word write: %08X %02X\n", addr, val); - ARM7_REG_16(addr) = val; + T1WriteWord(MMU.ARM7_REG, addr, val); break; } } @@ -604,21 +601,21 @@ { case 0x000: // LOG("Sound Control Register write: %04X\n", val); - ARM7_REG_16(addr) = val; + T1WriteWord(MMU.ARM7_REG, addr, val); return; case 0x004: // LOG("Sound Bias Register write: %04X\n", val); - ARM7_REG_16(addr) = val; + T1WriteWord(MMU.ARM7_REG, addr, val); return; case 0x008: // LOG("Sound Capture 0/1 Control Register write: %04X\n", val); - ARM7_REG_16(addr) = val; + T1WriteWord(MMU.ARM7_REG, addr, val); return; default: break; } } - ARM7_REG_16(addr) = val; + T1WriteWord(MMU.ARM7_REG, addr, val); } ////////////////////////////////////////////////////////////////////////////// @@ -647,13 +644,13 @@ chan->status = (val >> 31) & 0x1; if (SPU->chan[(addr >> 4) & 0xF].status) SPU_KeyOn((addr >> 4) & 0xF); - ARM7_REG_32(addr) = val; + T1WriteLong(MMU.ARM7_REG, addr, val); return; } case 0x4: // LOG("Sound Channel %d Data Source Register long write: %08X\n", (addr >> 4) & 0xF, val); SPU->chan[(addr >> 4) & 0xF].addr = val & 0x7FFFFFF; - ARM7_REG_32(addr) = val; + T1WriteLong(MMU.ARM7_REG, addr, val); return; case 0x8: { @@ -663,13 +660,13 @@ chan->timer = val & 0xFFFF; chan->loopstart = val >> 16; chan->sampinc = (16777216 / (0x10000 - (double)chan->timer)) / 44100; - ARM7_REG_32(addr) = val; + T1WriteLong(MMU.ARM7_REG, addr, val); return; } case 0xC: // LOG("Sound Channel %d Length Register long write: %08X\n", (addr >> 4) & 0xF, val); SPU->chan[(addr >> 4) & 0xF].length = val & 0x3FFFFF; - ARM7_REG_32(addr) = val; + T1WriteLong(MMU.ARM7_REG, addr, val); return; default: break; } @@ -680,21 +677,21 @@ { case 0x000: // LOG("Sound Control Register write: %08X\n", val); - ARM7_REG_32(addr) = val; + T1WriteLong(MMU.ARM7_REG, addr, val); return; case 0x004: // LOG("Sound Bias Register write: %08X\n", val); - ARM7_REG_32(addr) = val; + T1WriteLong(MMU.ARM7_REG, addr, val); return; case 0x008: // LOG("Sound Capture 0/1 Control Register write: %08X\n", val); - ARM7_REG_32(addr) = val; + T1WriteLong(MMU.ARM7_REG, addr, val); return; default: break; } } - ARM7_REG_32(addr) = val; + T1WriteLong(MMU.ARM7_REG, addr, val); } ////////////////////////////////////////////////////////////////////////////// @@ -812,6 +809,7 @@ else { chan->status = CHANSTAT_STOPPED; + MMU.ARM7_REG[0x403 + ((((u32)chan-(u32)SPU->chan) / sizeof(channel_struct)) * 0x10)] &= 0x7F; SPU->bufpos = SPU->buflength; } @@ -1097,11 +1095,12 @@ memset(SPU->sndbuf, 0, length*4*2); + // If Master Enable isn't set, don't output audio - if (!(MMU.ARM7_REG[0x501] & 0x80)) + if (!(T1ReadByte(MMU.ARM7_REG, 0x501) & 0x80)) return; - vol = MMU.ARM7_REG[0x500] & 0x7F; + vol = T1ReadByte(MMU.ARM7_REG, 0x500) & 0x7F; for(chan = &(SPU->chan[0]); chan < &(SPU->chan[16]); chan++) { diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/thumb_instructions.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/thumb_instructions.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/thumb_instructions.c 2006-12-22 18:52:11.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/thumb_instructions.c 2007-06-07 04:56:12.000000000 -0500 @@ -538,7 +538,7 @@ { u32 adr = (cpu->R[15]&0xFFFFFFFC) + ((cpu->instruction&0xFF)<<2); - cpu->R[REG_NUM(cpu->instruction, 8)] = MMU_readWord(cpu->proc_ID, adr); + cpu->R[REG_NUM(cpu->instruction, 8)] = cpu->mem_if->read32(cpu->mem_if->data, adr); return 3 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; } @@ -547,7 +547,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_NUM(i, 6)] + cpu->R[REG_NUM(i, 3)]; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_NUM(i, 0)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_NUM(i, 0)]); return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; } @@ -556,7 +556,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)]; - MMU_writeHWord(cpu->proc_ID, adr, ((u16)cpu->R[REG_NUM(i, 0)])); + cpu->mem_if->write16(cpu->mem_if->data, adr, ((u16)cpu->R[REG_NUM(i, 0)])); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -565,7 +565,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)]; - MMU_writeByte(cpu->proc_ID, adr, ((u8)cpu->R[REG_NUM(i, 0)])); + cpu->mem_if->write8(cpu->mem_if->data, adr, ((u8)cpu->R[REG_NUM(i, 0)])); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -574,7 +574,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)]; - cpu->R[REG_NUM(i, 0)] = (s32)((s8)MMU_readByte(cpu->proc_ID, adr)); + cpu->R[REG_NUM(i, 0)] = (s32)((s8)cpu->mem_if->read8(cpu->mem_if->data, adr)); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -583,7 +583,7 @@ { u32 i = cpu->instruction; u32 adr = (cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)]); - u32 tempValue = MMU_readWord(cpu->proc_ID, adr&0xFFFFFFFC); + u32 tempValue = cpu->mem_if->read32(cpu->mem_if->data, adr&0xFFFFFFFC); adr = (adr&3)*8; tempValue = (tempValue>>adr) | (tempValue<<(32-adr)); @@ -596,7 +596,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)]; - cpu->R[REG_NUM(i, 0)] = (u32)MMU_readHWord(cpu->proc_ID, adr); + cpu->R[REG_NUM(i, 0)] = (u32)cpu->mem_if->read16(cpu->mem_if->data, adr); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -605,7 +605,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)]; - cpu->R[REG_NUM(i, 0)] = (u32)MMU_readByte(cpu->proc_ID, adr); + cpu->R[REG_NUM(i, 0)] = (u32)cpu->mem_if->read8(cpu->mem_if->data, adr); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -614,7 +614,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)]; - cpu->R[REG_NUM(i, 0)] = (s32)((s16)MMU_readHWord(cpu->proc_ID, adr)); + cpu->R[REG_NUM(i, 0)] = (s32)((s16)cpu->mem_if->read16(cpu->mem_if->data, adr)); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -623,7 +623,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>4)&0x7C); - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_NUM(i, 0)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_NUM(i, 0)]); return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; } @@ -632,7 +632,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>4)&0x7C); - u32 tempValue = MMU_readWord(cpu->proc_ID, adr&0xFFFFFFFC); + u32 tempValue = cpu->mem_if->read32(cpu->mem_if->data, adr&0xFFFFFFFC); adr = (adr&3)*8; tempValue = (tempValue>>adr) | (tempValue<<(32-adr)); cpu->R[REG_NUM(i, 0)] = tempValue; @@ -644,7 +644,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>6)&0x1F); - MMU_writeByte(cpu->proc_ID, adr, (u8)cpu->R[REG_NUM(i, 0)]); + cpu->mem_if->write8(cpu->mem_if->data, adr, (u8)cpu->R[REG_NUM(i, 0)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -653,7 +653,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>6)&0x1F); - cpu->R[REG_NUM(i, 0)] = MMU_readByte(cpu->proc_ID, adr); + cpu->R[REG_NUM(i, 0)] = cpu->mem_if->read8(cpu->mem_if->data, adr); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -662,7 +662,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>5)&0x3E); - MMU_writeHWord(cpu->proc_ID, adr, (u16)cpu->R[REG_NUM(i, 0)]); + cpu->mem_if->write16(cpu->mem_if->data, adr, (u16)cpu->R[REG_NUM(i, 0)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -671,7 +671,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>5)&0x3E); - cpu->R[REG_NUM(i, 0)] = MMU_readHWord(cpu->proc_ID, adr); + cpu->R[REG_NUM(i, 0)] = cpu->mem_if->read16(cpu->mem_if->data, adr); return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -680,7 +680,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[13] + ((i&0xFF)<<2); - MMU_writeWord(cpu->proc_ID, adr, cpu->R[REG_NUM(i, 8)]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[REG_NUM(i, 8)]); return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF]; } @@ -689,7 +689,7 @@ { u32 i = cpu->instruction; u32 adr = cpu->R[13] + ((i&0xFF)<<2); - cpu->R[REG_NUM(i, 8)] = MMU_readWord(cpu->proc_ID, adr); + cpu->R[REG_NUM(i, 8)] = cpu->mem_if->read32(cpu->mem_if->data, adr); return 3 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; } @@ -733,7 +733,7 @@ for(j = 0; j<8; ++j) if(BIT_N(i, 7-j)) { - MMU_writeWord(cpu->proc_ID, adr, cpu->R[7-j]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[7-j]); c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; adr -= 4; } @@ -748,14 +748,14 @@ u32 adr = cpu->R[13] - 4; u32 c = 0, j; - MMU_writeWord(cpu->proc_ID, adr, cpu->R[14]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[14]); c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; adr -= 4; for(j = 0; j<8; ++j) if(BIT_N(i, 7-j)) { - MMU_writeWord(cpu->proc_ID, adr, cpu->R[7-j]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[7-j]); c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; adr -= 4; } @@ -773,7 +773,7 @@ for(j = 0; j<8; ++j) if(BIT_N(i, j)) { - cpu->R[j] = MMU_readWord(cpu->proc_ID, adr); + cpu->R[j] = cpu->mem_if->read32(cpu->mem_if->data, adr); c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; adr += 4; } @@ -792,12 +792,12 @@ for(j = 0; j<8; ++j) if(BIT_N(i, j)) { - cpu->R[j] = MMU_readWord(cpu->proc_ID, adr); + cpu->R[j] = cpu->mem_if->read32(cpu->mem_if->data, adr); c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; adr += 4; } - v = MMU_readWord(cpu->proc_ID, adr); + v = cpu->mem_if->read32(cpu->mem_if->data, adr); c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; cpu->R[15] = v & 0xFFFFFFFE; cpu->next_instruction = v & 0xFFFFFFFE; @@ -823,7 +823,7 @@ for(j = 0; j<8; ++j) if(BIT_N(i, j)) { - MMU_writeWord(cpu->proc_ID, adr, cpu->R[j]); + cpu->mem_if->write32(cpu->mem_if->data, adr, cpu->R[j]); c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; adr += 4; } @@ -840,7 +840,7 @@ for(j = 0; j<8; ++j) if(BIT_N(i, j)) { - cpu->R[j] = MMU_readWord(cpu->proc_ID, adr); + cpu->R[j] = cpu->mem_if->read32(cpu->mem_if->data, adr); c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF]; adr += 4; } diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/types.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/types.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/types.h 2007-01-24 15:04:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/types.h 2007-08-11 14:23:44.000000000 -0500 @@ -105,7 +105,13 @@ /*----------------------*/ +#ifndef OBJ_C typedef int BOOL; +#else +//apple defines BOOL so this is to avoid conflicts +typedef int desmume_BOOL; +#define BOOL desmume_BOOL +#endif #ifndef TRUE #define TRUE 1 diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/wifi.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/wifi.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/wifi.c 2007-01-25 13:59:21.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/wifi.c 2007-02-23 08:23:01.000000000 -0600 @@ -728,4 +728,4 @@ #endif } -#endif \ No newline at end of file +#endif diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/ConfigKeys.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/ConfigKeys.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/ConfigKeys.c 2007-01-31 17:25:26.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/ConfigKeys.c 2007-03-27 00:00:00.000000000 -0500 @@ -1,3 +1,23 @@ +/* + Copyright (C) 2006-2007 Normmatt + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include #include #include @@ -95,46 +115,46 @@ GetINIPath(IniName,MAX_PATH); - i=GetPrivateProfileInt("KEYS","KEY_A",31, IniName); + i=GetPrivateProfileInt("Keys","Key_A",31, IniName); KEY_A = i; - i=GetPrivateProfileInt("KEYS","KEY_B",11, IniName); + i=GetPrivateProfileInt("Keys","Key_B",11, IniName); KEY_B = i; - i=GetPrivateProfileInt("KEYS","KEY_SELECT",36, IniName); + i=GetPrivateProfileInt("Keys","Key_SELECT",36, IniName); KEY_SELECT = i; - i=GetPrivateProfileInt("KEYS","KEY_START",13, IniName); + i=GetPrivateProfileInt("Keys","Key_START",13, IniName); if(i==13) KEY_START = 47; else KEY_START = i; - i=GetPrivateProfileInt("KEYS","KEY_RIGHT",40, IniName); + i=GetPrivateProfileInt("Keys","Key_RIGHT",40, IniName); KEY_RIGHT = i; - i=GetPrivateProfileInt("KEYS","KEY_LEFT",39, IniName); + i=GetPrivateProfileInt("Keys","Key_LEFT",39, IniName); KEY_LEFT = i; - i=GetPrivateProfileInt("KEYS","KEY_UP",37, IniName); + i=GetPrivateProfileInt("Keys","Key_UP",37, IniName); KEY_UP = i; - i=GetPrivateProfileInt("KEYS","KEY_DOWN",38, IniName); + i=GetPrivateProfileInt("Keys","Key_DOWN",38, IniName); KEY_DOWN = i; - i=GetPrivateProfileInt("KEYS","KEY_R",23, IniName); + i=GetPrivateProfileInt("Keys","Key_R",23, IniName); KEY_R = i; - i=GetPrivateProfileInt("KEYS","KEY_L",12, IniName); + i=GetPrivateProfileInt("Keys","Key_L",12, IniName); KEY_L = i; - i=GetPrivateProfileInt("KEYS","KEY_X",16, IniName); + i=GetPrivateProfileInt("Keys","Key_X",16, IniName); KEY_X = i; - i=GetPrivateProfileInt("KEYS","KEY_Y",17, IniName); + i=GetPrivateProfileInt("Keys","Key_Y",17, IniName); KEY_Y = i; - /*i=GetPrivateProfileInt("KEYS","KEY_DEBUG",13, IniName); + /*i=GetPrivateProfileInt("Keys","Key_DEBUG",13, IniName); KEY_DEBUG = i;*/ } @@ -152,24 +172,24 @@ GetINIPath(IniName,MAX_PATH); - WritePrivateProfileInt("KEYS","KEY_A",KEY_A,IniName); - WritePrivateProfileInt("KEYS","KEY_B",KEY_B,IniName); - WritePrivateProfileInt("KEYS","KEY_SELECT",KEY_SELECT,IniName); + WritePrivateProfileInt("Keys","Key_A",KEY_A,IniName); + WritePrivateProfileInt("Keys","Key_B",KEY_B,IniName); + WritePrivateProfileInt("Keys","Key_SELECT",KEY_SELECT,IniName); if(KEY_START==47) - WritePrivateProfileInt("KEYS","KEY_START",13,IniName); + WritePrivateProfileInt("Keys","Key_START",13,IniName); else - WritePrivateProfileInt("KEYS","KEY_START",KEY_START,IniName); + WritePrivateProfileInt("Keys","Key_START",KEY_START,IniName); - WritePrivateProfileInt("KEYS","KEY_RIGHT",KEY_RIGHT,IniName); - WritePrivateProfileInt("KEYS","KEY_LEFT",KEY_LEFT,IniName); - WritePrivateProfileInt("KEYS","KEY_UP",KEY_UP,IniName); - WritePrivateProfileInt("KEYS","KEY_DOWN",KEY_DOWN,IniName); - WritePrivateProfileInt("KEYS","KEY_R",KEY_R,IniName); - WritePrivateProfileInt("KEYS","KEY_L",KEY_L,IniName); - WritePrivateProfileInt("KEYS","KEY_X",KEY_X,IniName); - WritePrivateProfileInt("KEYS","KEY_Y",KEY_Y,IniName); - /*WritePrivateProfileInt("KEYS","KEY_DEBUG",KEY_DEBUG,IniName);*/ + WritePrivateProfileInt("Keys","Key_RIGHT",KEY_RIGHT,IniName); + WritePrivateProfileInt("Keys","Key_LEFT",KEY_LEFT,IniName); + WritePrivateProfileInt("Keys","Key_UP",KEY_UP,IniName); + WritePrivateProfileInt("Keys","Key_DOWN",KEY_DOWN,IniName); + WritePrivateProfileInt("Keys","Key_R",KEY_R,IniName); + WritePrivateProfileInt("Keys","Key_L",KEY_L,IniName); + WritePrivateProfileInt("Keys","Key_X",KEY_X,IniName); + WritePrivateProfileInt("Keys","Key_Y",KEY_Y,IniName); + /*WritePrivateProfileInt("Keys","Key_DEBUG",KEY_DEBUG,IniName);*/ } void dsDefaultKeys(void) diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/ConfigKeys.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/ConfigKeys.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/ConfigKeys.h 2006-11-30 00:09:17.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/ConfigKeys.h 2007-03-27 00:00:00.000000000 -0500 @@ -1,3 +1,22 @@ +/* + Copyright (C) 2006-2007 Normmatt + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ #ifndef CONFIGKEYS_H #define CONFIGKEYS_H @@ -18,7 +37,7 @@ extern DWORD ds_start; extern DWORD ds_debug; -void GetINIPath(char *initpath); +void GetINIPath(char *initpath,u16 bufferSize); void ReadConfig(void); BOOL CALLBACK ConfigView_Proc(HWND dialog,UINT komunikat,WPARAM wparam,LPARAM lparam); diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/DeSmuME.dev /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/DeSmuME.dev --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/DeSmuME.dev 2007-01-23 20:33:59.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/DeSmuME.dev 2007-07-07 19:06:12.000000000 -0500 @@ -1,19 +1,19 @@ [Project] FileName=DeSmuME.dev Name=DeSmuME -UnitCount=70 +UnitCount=82 Type=0 Ver=1 ObjFiles= -Includes= +Includes=.. Libs= PrivateResource=yopyop_private.rc ResourceIncludes= MakeIncludes= -Compiler=-DVERSION=\"0.5\" _@@_ +Compiler=-DVERSION=\"0.7.2\" _@@_ CppCompiler=_@@_ -Linker=-ldxguid -ldxerr8 -ldsound -lws2_32_@@_ -IsCpp=1 +Linker=-ldxguid_@@_-ldxerr8_@@_-ldsound_@@_-lws2_32_@@_-lglu32_@@_-lopengl32_@@_ +IsCpp=0 Icon=DeSmuME.ico ExeOutput= ObjectOutput=obj @@ -27,7 +27,7 @@ IncludeVersionInfo=1 SupportXPThemes=1 CompilerSet=0 -CompilerSettings=00000000010010010000ib +CompilerSettings=0000000001001000000100 [Unit1] FileName=..\ROMReader.c @@ -42,8 +42,8 @@ [VersionInfo] Major=0 Minor=0 -Release=3 -Build=4 +Release=7 +Build=0 LanguageID=5129 CharsetID=1252 CompanyName=yopyop @@ -59,7 +59,7 @@ [Unit3] FileName=yopyop_private.rc -CompileCpp=1 +CompileCpp=0 Folder=Resources Compile=1 Link=0 @@ -69,7 +69,7 @@ [Unit4] FileName=..\types.h -CompileCpp=1 +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -79,7 +79,7 @@ [Unit8] FileName=..\cp15.h -CompileCpp=1 +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -109,7 +109,7 @@ [Unit15] FileName=..\Disassembler.h -CompileCpp=1 +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -125,7 +125,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -CompileCpp=1 +CompileCpp=0 [Unit17] FileName=..\fs-windows.c @@ -139,7 +139,7 @@ [Unit18] FileName=..\fs.h -CompileCpp=1 +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -159,7 +159,7 @@ [Unit20] FileName=..\GPU.h -CompileCpp=1 +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -168,18 +168,8 @@ BuildCmd= [Unit21] -FileName=..\ARM9.c -CompileCpp=0 -Folder=DeSmuME -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd=$(CC) -c ARM9.c -o obj/ARM9.o $(CFLAGS) - -[Unit22] FileName=..\ARM9.h -CompileCpp=1 +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -187,7 +177,7 @@ OverrideBuildCmd=0 BuildCmd= -[Unit23] +[Unit22] FileName=ConfigKeys.c CompileCpp=0 Folder=DeSmuME @@ -197,7 +187,7 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c ConfigKeys.c -o obj/ConfigKeys.o $(CFLAGS) -[Unit24] +[Unit23] FileName=CWindow.c CompileCpp=0 Folder=DeSmuME @@ -207,7 +197,7 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c CWindow.c -o obj/CWindow.o $(CFLAGS) -[Unit25] +[Unit24] FileName=disView.c CompileCpp=0 Folder=DeSmuME @@ -217,7 +207,7 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c disView.c -o obj/disView.o $(CFLAGS) -[Unit26] +[Unit25] FileName=ginfo.c CompileCpp=0 Folder=DeSmuME @@ -227,7 +217,7 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c ginfo.c -o obj/ginfo.o $(CFLAGS) -[Unit27] +[Unit26] FileName=IORegView.c CompileCpp=0 Folder=DeSmuME @@ -237,7 +227,7 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c IORegView.c -o obj/IORegView.o $(CFLAGS) -[Unit28] +[Unit27] FileName=main.c CompileCpp=0 Folder=DeSmuME @@ -247,7 +237,7 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c main.c -o obj/main.o $(CFLAGS) -[Unit29] +[Unit28] FileName=mapView.c CompileCpp=0 Folder=DeSmuME @@ -257,17 +247,17 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c mapView.c -o obj/mapView.o $(CFLAGS) -[Unit32] -FileName=palView.c +[Unit29] +FileName=memView.c CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 -BuildCmd=$(CC) -c palView.c -o obj/palView.o $(CFLAGS) +BuildCmd=$(CC) -c memView.c -o obj/memView.o $(CFLAGS) -[Unit33] +[Unit32] FileName=tileView.c CompileCpp=0 Folder=DeSmuME @@ -277,9 +267,19 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c tileView.c -o obj/tileView.o $(CFLAGS) -[Unit34] +[Unit33] FileName=ConfigKeys.h -CompileCpp=1 +CompileCpp=0 +Folder=DeSmuME +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit34] +FileName=CWindow.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -288,8 +288,8 @@ BuildCmd= [Unit37] -FileName=ginfo.h -CompileCpp=1 +FileName=IORegView.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -298,8 +298,8 @@ BuildCmd= [Unit41] -FileName=oamView.h -CompileCpp=1 +FileName=palView.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -308,8 +308,8 @@ BuildCmd= [Unit42] -FileName=palView.h -CompileCpp=1 +FileName=..\bios.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -318,8 +318,8 @@ BuildCmd= [Unit43] -FileName=..\bios.h -CompileCpp=1 +FileName=..\bits.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -328,8 +328,8 @@ BuildCmd= [Unit46] -FileName=..\dscard.h -CompileCpp=1 +FileName=..\fat.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -338,8 +338,8 @@ BuildCmd= [Unit35] -FileName=CWindow.h -CompileCpp=1 +FileName=disView.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -348,8 +348,8 @@ BuildCmd= [Unit40] -FileName=memView.h -CompileCpp=1 +FileName=oamView.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -358,8 +358,8 @@ BuildCmd= [Unit44] -FileName=..\bits.h -CompileCpp=1 +FileName=..\cflash.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -368,8 +368,8 @@ BuildCmd= [Unit45] -FileName=..\cflash.h -CompileCpp=1 +FileName=..\dscard.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -378,8 +378,8 @@ BuildCmd= [Unit47] -FileName=..\fat.h -CompileCpp=1 +FileName=..\mc.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -388,8 +388,8 @@ BuildCmd= [Unit48] -FileName=..\mc.h -CompileCpp=1 +FileName=..\mem.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -398,8 +398,8 @@ BuildCmd= [Unit49] -FileName=..\mem.h -CompileCpp=1 +FileName=..\MMU.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -408,8 +408,8 @@ BuildCmd= [Unit50] -FileName=..\MMU.h -CompileCpp=1 +FileName=..\NDSSystem.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -418,18 +418,18 @@ BuildCmd= [Unit31] -FileName=oamView.c +FileName=palView.c CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 -BuildCmd=$(CC) -c oamView.c -o obj/oamView.o $(CFLAGS) +BuildCmd=$(CC) -c palView.c -o obj/palView.o $(CFLAGS) [Unit36] -FileName=disView.h -CompileCpp=1 +FileName=ginfo.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -438,8 +438,8 @@ BuildCmd= [Unit38] -FileName=IORegView.h -CompileCpp=1 +FileName=mapView.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -448,8 +448,8 @@ BuildCmd= [Unit39] -FileName=mapView.h -CompileCpp=1 +FileName=memView.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -458,16 +458,6 @@ BuildCmd= [Unit53] -FileName=..\SPU.h -CompileCpp=1 -Folder=DeSmuME -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit54] FileName=..\arm_instructions.c CompileCpp=0 Folder=DeSmuME @@ -477,7 +467,7 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c arm_instructions.c -o obj/arm_instructions.o $(CFLAGS) -[Unit55] +[Unit54] FileName=..\armcpu.c CompileCpp=0 Folder=DeSmuME @@ -487,7 +477,7 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c armcpu.c -o obj/armcpu.o $(CFLAGS) -[Unit56] +[Unit55] FileName=..\bios.c CompileCpp=0 Folder=DeSmuME @@ -497,7 +487,7 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c bios.c -o obj/bios.o $(CFLAGS) -[Unit57] +[Unit56] FileName=..\cflash.c CompileCpp=0 Folder=DeSmuME @@ -507,7 +497,7 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c cflash.c -o obj/cflash.o $(CFLAGS) -[Unit58] +[Unit57] FileName=..\cp15.c CompileCpp=0 Folder=DeSmuME @@ -517,17 +507,17 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c cp15.c -o obj/cp15.o $(CFLAGS) -[Unit60] -FileName=..\MMU.c +[Unit58] +FileName=..\mc.c CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 -BuildCmd=$(CC) -c MMU.c -o obj/MMU.o $(CFLAGS) +BuildCmd=$(CC) -c mc.c -o obj/mc.o $(CFLAGS) -[Unit61] +[Unit60] FileName=..\NDSSystem.c CompileCpp=0 Folder=DeSmuME @@ -537,7 +527,7 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c NDSSystem.c -o obj/NDSSystem.o $(CFLAGS) -[Unit62] +[Unit61] FileName=..\saves.c CompileCpp=0 Folder=DeSmuME @@ -547,9 +537,19 @@ OverrideBuildCmd=0 BuildCmd=$(CC) -c saves.c -o obj/saves.o $(CFLAGS) +[Unit62] +FileName=..\SPU.c +CompileCpp=0 +Folder=DeSmuME +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c SPU.c -o obj/SPU.o $(CFLAGS) + [Unit5] FileName=..\arm_instructions.h -CompileCpp=1 +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -559,7 +559,7 @@ [Unit6] FileName=..\armcpu.h -CompileCpp=1 +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -569,7 +569,7 @@ [Unit7] FileName=..\config.h -CompileCpp=1 +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -579,7 +579,7 @@ [Unit11] FileName=..\thumb_instructions.h -CompileCpp=1 +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -589,7 +589,7 @@ [Unit12] FileName=resource.h -CompileCpp=1 +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -608,14 +608,14 @@ BuildCmd=$(CC) -c Disassembler.c -o obj/Disassembler.o $(CFLAGS) [Unit30] -FileName=memView.c +FileName=oamView.c CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 -BuildCmd=$(CC) -c memView.c -o obj/memView.o $(CFLAGS) +BuildCmd=$(CC) -c oamView.c -o obj/oamView.o $(CFLAGS) [Unit9] FileName=..\debug.c @@ -637,8 +637,8 @@ BuildCmd= [Unit51] -FileName=..\NDSSystem.h -CompileCpp=1 +FileName=..\saves.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -647,28 +647,28 @@ BuildCmd= [Unit64] -FileName=..\thumb_instructions.c +FileName=snddx.c CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 -BuildCmd=$(CC) -c thumb_instructions.c -o obj/thumb_instructions.o $(CFLAGS) +BuildCmd=$(CC) -c snddx.c -o obj/snddx.o $(CFLAGS) [Unit65] -FileName=snddx.c +FileName=snddx.h CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 -BuildCmd=$(CC) -c snddx.c -o obj/snddx.o $(CFLAGS) +BuildCmd= [Unit66] -FileName=snddx.h -CompileCpp=1 +FileName=..\registers.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -677,18 +677,18 @@ BuildCmd= [Unit59] -FileName=..\mc.c +FileName=..\MMU.c CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 -BuildCmd=$(CC) -c mc.c -o obj/mc.o $(CFLAGS) +BuildCmd=$(CC) -c MMU.c -o obj/MMU.o $(CFLAGS) [Unit52] -FileName=..\saves.h -CompileCpp=1 +FileName=..\SPU.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -697,18 +697,18 @@ BuildCmd= [Unit63] -FileName=..\SPU.c +FileName=..\thumb_instructions.c CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 -BuildCmd=$(CC) -c SPU.c -o obj/SPU.o $(CFLAGS) +BuildCmd=$(CC) -c thumb_instructions.c -o obj/thumb_instructions.o $(CFLAGS) [Unit67] -FileName=..\registers.h -CompileCpp=1 +FileName=..\ROMReader.h +CompileCpp=0 Folder=DeSmuME Compile=1 Link=1 @@ -717,9 +717,9 @@ BuildCmd= [Unit68] -FileName=..\ROMReader.h -CompileCpp=1 -Folder=DeSmuME +FileName=..\wifi.h +CompileCpp=0 +Folder= Compile=1 Link=1 Priority=1000 @@ -727,18 +727,28 @@ BuildCmd= [Unit69] -FileName=..\wifi.h -CompileCpp=1 +FileName=..\wifi.c +CompileCpp=0 Folder= Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 -BuildCmd= +BuildCmd=$(CC) -c wifi.c -o obj/wifi.o $(CFLAGS) [Unit70] -FileName=..\wifi.c -CompileCpp=1 +FileName=..\gl_vertex.c +CompileCpp=0 +Folder= +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit71] +FileName=..\gl_vertex.h +CompileCpp=0 Folder= Compile=1 Link=1 @@ -746,3 +756,112 @@ OverrideBuildCmd=0 BuildCmd= +[Unit72] +FileName=OGLRender.h +CompileCpp=0 +Folder=DeSmuME +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit73] +FileName=OGLRender.c +CompileCpp=0 +Folder=DeSmuME +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c OGLRender.c -o obj/OGLRender.o $(CFLAGS) + +[Unit74] +FileName=..\matrix.c +CompileCpp=0 +Folder=DeSmuME +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c matrix.c -o obj/matrix.o $(CFLAGS) + +[Unit75] +FileName=..\render3D.c +CompileCpp=0 +Folder=DeSmuME +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c render3D.c -o obj/render3D.o $(CFLAGS) + +[Unit76] +FileName=..\matrix.h +CompileCpp=0 +Folder=DeSmuME +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit77] +FileName=..\render3D.h +CompileCpp=0 +Folder=DeSmuME +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit78] +FileName=FirmConfig.c +CompileCpp=0 +Folder=DeSmuME +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit79] +FileName=FirmConfig.h +CompileCpp=0 +Folder=DeSmuME +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit80] +FileName=..\gdbstub\gdbstub_internal.h +CompileCpp=0 +Folder=DeSmuME +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit81] +FileName=..\gdbstub\gdbstub.c +CompileCpp=0 +Folder=DeSmuME +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit82] +FileName=..\gdbstub.h +CompileCpp=0 +Folder=DeSmuME +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/DeSmuME.vcproj /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/DeSmuME.vcproj --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/DeSmuME.vcproj 2007-01-28 15:30:54.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/DeSmuME.vcproj 2007-07-07 19:06:12.000000000 -0500 @@ -1,169 +1,110 @@ - + + RootNamespace="DeSmuME"> + Name="Win32"/> - - - - - - - + ConfigurationType="1"> + CompileAs="1"/> + Name="VCCustomBuildTool"/> + Name="VCLinkerTool" + AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib dxguid.lib shell32.lib comdlg32.lib dxerr8.lib dsound.lib" + GenerateDebugInformation="TRUE" + GenerateMapFile="TRUE"/> + Name="VCMIDLTool"/> + Name="VCPostBuildEventTool"/> + Name="VCPreBuildEventTool"/> + Name="VCPreLinkEventTool"/> + Name="VCResourceCompilerTool"/> + Name="VCWebServiceProxyGeneratorTool"/> + Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool"/> + Name="VCManagedWrapperGeneratorTool"/> + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - - - - - + ConfigurationType="1"> + CompileAs="1"/> + Name="VCCustomBuildTool"/> + Name="VCLinkerTool" + AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib dxguid.lib shell32.lib comdlg32.lib dxerr8.lib dsound.lib zdll.lib zziplib.lib" + AdditionalLibraryDirectories="..\..\..\..\zlib123\lib"/> + Name="VCMIDLTool"/> + Name="VCPostBuildEventTool"/> + Name="VCPreBuildEventTool"/> + Name="VCPreLinkEventTool"/> + Name="VCResourceCompilerTool"/> + Name="VCWebServiceProxyGeneratorTool"/> + Name="VCXMLDataGeneratorTool"/> + Name="VCWebDeploymentTool"/> + Name="VCManagedWrapperGeneratorTool"/> + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> @@ -172,303 +113,253 @@ + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + + + + + + + + + RelativePath=".\ConfigKeys.c"> + RelativePath="..\cp15.c"> + RelativePath=".\CWindow.c"> + RelativePath="..\debug.c"> + RelativePath="..\Disassembler.c"> + RelativePath=".\disView.c"> + RelativePath="..\FIFO.c"> + RelativePath=".\FirmConfig.c"> + RelativePath="..\fs-windows.c"> + RelativePath="..\gdbstub\gdbstub.c"> + RelativePath=".\ginfo.c"> + RelativePath="..\GPU.c"> + RelativePath=".\IORegView.c"> + RelativePath=".\main.c"> + RelativePath=".\mapView.c"> + RelativePath="..\matrix.c"> + RelativePath="..\mc.c"> + RelativePath=".\memView.c"> + RelativePath="..\MMU.c"> + RelativePath="..\NDSSystem.c"> + RelativePath=".\oamView.c"> + RelativePath=".\OGLRender.c"> + RelativePath=".\palView.c"> + RelativePath="..\render3D.c"> + RelativePath="..\ROMReader.c"> + RelativePath="..\saves.c"> + RelativePath=".\snddx.c"> + RelativePath="..\SPU.c"> + RelativePath="..\thumb_instructions.c"> + RelativePath=".\tileView.c"> + RelativePath="..\wifi.c"> + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + + + + + + + + + RelativePath="..\bits.h"> + RelativePath="..\cflash.h"> + RelativePath="..\config.h"> + RelativePath=".\ConfigKeys.h"> + RelativePath="..\cp15.h"> + RelativePath=".\CWindow.h"> + RelativePath="..\debug.h"> + RelativePath="..\Disassembler.h"> + RelativePath=".\disView.h"> + RelativePath="..\dscard.h"> + RelativePath="..\fat.h"> + RelativePath="..\FIFO.h"> + RelativePath=".\FirmConfig.h"> + RelativePath="..\fs.h"> + RelativePath="..\gdbstub.h"> + RelativePath="..\gdbstub\gdbstub_internal.h"> + RelativePath=".\ginfo.h"> + RelativePath="..\GPU.h"> + RelativePath=".\IORegView.h"> + RelativePath=".\mapView.h"> + RelativePath="..\matrix.h"> + RelativePath="..\mc.h"> + RelativePath="..\mem.h"> + RelativePath=".\memView.h"> + RelativePath="..\MMU.h"> + RelativePath="..\NDSSystem.h"> + RelativePath=".\oamView.h"> + RelativePath=".\palView.h"> + RelativePath="..\registers.h"> + RelativePath=".\resource.h"> + RelativePath="..\ROMReader.h"> + RelativePath="..\saves.h"> + RelativePath=".\snddx.h"> + RelativePath="..\SPU.h"> + RelativePath="..\thumb_instructions.h"> + RelativePath=".\tileView.h"> + RelativePath="..\types.h"> + RelativePath="..\wifi.h"> + RelativePath=".\yopyop_private.h"> + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + RelativePath=".\resources.rc"> diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/FirmConfig.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/FirmConfig.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/FirmConfig.c 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/FirmConfig.c 2007-06-20 09:29:11.000000000 -0500 @@ -0,0 +1,170 @@ +/* + Copyright (C) 2007 Normmatt + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include +#include +#include +#include +#include +#include + +#include "CWindow.h" + +#include "resource.h" +#include "FirmConfig.h" +#include "ConfigKeys.h" + +#include "../debug.h" +#include "../NDSSystem.h" + +char IniName[MAX_PATH]; +u32 keytab[12]; + +static char nickname_buffer[11]; +static char message_buffer[27]; + +const char firmLang[6][16] = {"Japanese","English","French","German","Italian","Spanish"}; +const char firmColor[16][16] = {"Gray","Brown","Red","Pink","Orange","Yellow","Lime Green", + "Green","Dark Green","Sea Green","Turquoise","Blue", + "Dark Blue","Dark Purple","Violet","Magenta"}; +const char firmDay[31][16] = {"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"}; +const char firmMonth[12][16] = {"January","Feburary","March","April","May","June","July", + "August","September","October","November","December"}; + +static void WriteFirmConfig( struct NDS_fw_config_data *fw_config) +{ + char temp_str[27]; + int i; + GetINIPath(IniName,MAX_PATH); + + WritePrivateProfileInt("Firmware","favColor", fw_config->fav_colour,IniName); + WritePrivateProfileInt("Firmware","bMonth", fw_config->birth_month,IniName); + WritePrivateProfileInt("Firmware","bDay",fw_config->birth_day,IniName); + WritePrivateProfileInt("Firmware","Language",fw_config->language,IniName); + + /* FIXME: harshly only use the lower byte of the UTF-16 character. + * This would cause strange behaviour if the user could set UTF-16 but + * they cannot yet. + */ + for ( i = 0; i < fw_config->nickname_len; i++) { + temp_str[i] = fw_config->nickname[i]; + } + temp_str[i] = '\0'; + WritePrivateProfileString("Firmware", "nickName", temp_str, IniName); + + for ( i = 0; i < fw_config->message_len; i++) { + temp_str[i] = fw_config->message[i]; + } + temp_str[i] = '\0'; + WritePrivateProfileString("Firmware","Message", temp_str, IniName); +} + +BOOL CALLBACK FirmConfig_Proc(HWND dialog,UINT komunikat,WPARAM wparam,LPARAM lparam) +{ + struct NDS_fw_config_data *fw_config = &win_fw_config; + int i; + char temp_str[27]; + + switch(komunikat) + { + case WM_INITDIALOG: + for(i=0;i<6;i++) SendDlgItemMessage(dialog,IDC_COMBO4,CB_ADDSTRING,0,(LPARAM)&firmLang[i]); + for(i=0;i<12;i++) SendDlgItemMessage(dialog,IDC_COMBO2,CB_ADDSTRING,0,(LPARAM)&firmMonth[i]); + for(i=0;i<16;i++) SendDlgItemMessage(dialog,IDC_COMBO1,CB_ADDSTRING,0,(LPARAM)&firmColor[i]); + for(i=0;i<31;i++) SendDlgItemMessage(dialog,IDC_COMBO3,CB_ADDSTRING,0,(LPARAM)&firmDay[i]); + SendDlgItemMessage(dialog,IDC_COMBO1,CB_SETCURSEL,fw_config->fav_colour,0); + SendDlgItemMessage(dialog,IDC_COMBO2,CB_SETCURSEL,fw_config->birth_month-1,0); + SendDlgItemMessage(dialog,IDC_COMBO3,CB_SETCURSEL,fw_config->birth_day-1,0); + SendDlgItemMessage(dialog,IDC_COMBO4,CB_SETCURSEL,fw_config->language,0); + SendDlgItemMessage(dialog,IDC_EDIT1,EM_SETLIMITTEXT,10,0); + SendDlgItemMessage(dialog,IDC_EDIT2,EM_SETLIMITTEXT,26,0); + SendDlgItemMessage(dialog,IDC_EDIT1,EM_SETSEL,0,10); + SendDlgItemMessage(dialog,IDC_EDIT2,EM_SETSEL,0,26); + + for ( i = 0; i < fw_config->nickname_len; i++) { + nickname_buffer[i] = fw_config->nickname[i]; + } + nickname_buffer[i] = '\0'; + SendDlgItemMessage(dialog,IDC_EDIT1,WM_SETTEXT,0,(LPARAM)nickname_buffer); + + for ( i = 0; i < fw_config->message_len; i++) { + message_buffer[i] = fw_config->message[i]; + } + message_buffer[i] = '\0'; + SendDlgItemMessage(dialog,IDC_EDIT2,WM_SETTEXT,0,(LPARAM)message_buffer); + break; + + case WM_COMMAND: + if((HIWORD(wparam)==BN_CLICKED)&&(((int)LOWORD(wparam))==IDOK)) + { + int char_index; + LRESULT res; + fw_config->fav_colour = SendDlgItemMessage(dialog,IDC_COMBO1,CB_GETCURSEL,0,0); + fw_config->birth_month = 1 + SendDlgItemMessage(dialog,IDC_COMBO2,CB_GETCURSEL,0,0); + fw_config->birth_day = 1 + SendDlgItemMessage(dialog,IDC_COMBO3,CB_GETCURSEL,0,0); + fw_config->language = SendDlgItemMessage(dialog,IDC_COMBO4,CB_GETCURSEL,0,0); + + *(WORD *)temp_str = 10; + res = SendDlgItemMessage(dialog,IDC_EDIT1,EM_GETLINE,0,(LPARAM)temp_str); + + if ( res > 0) { + temp_str[res] = '\0'; + fw_config->nickname_len = strlen( temp_str); + } + else { + strcpy( temp_str, "yopyop"); + fw_config->nickname_len = strlen( temp_str); + } + for ( char_index = 0; char_index < fw_config->nickname_len; char_index++) { + fw_config->nickname[char_index] = temp_str[char_index]; + } + + *(WORD *)temp_str = 26; + res = SendDlgItemMessage(dialog,IDC_EDIT2,EM_GETLINE,0,(LPARAM)temp_str); + if ( res > 0) { + temp_str[res] = '\0'; + fw_config->message_len = strlen( temp_str); + } + else { + fw_config->message_len = 0; + } + for ( char_index = 0; char_index < fw_config->message_len; char_index++) { + fw_config->message[char_index] = temp_str[char_index]; + } + + WriteFirmConfig( fw_config); + EndDialog(dialog,0); + NDS_CreateDummyFirmware( fw_config); + return 1; + } + else + if((HIWORD(wparam)==BN_CLICKED)&&(((int)LOWORD(wparam))==IDCANCEL)) + { + EndDialog(dialog, 0); + return 0; + } + break; + } + return 0; +} + + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/FirmConfig.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/FirmConfig.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/FirmConfig.h 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/FirmConfig.h 2007-06-20 09:29:11.000000000 -0500 @@ -0,0 +1,28 @@ +/* + Copyright (C) 2007 Normmatt + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef FIRMCONFIG_H +#define FIRMCONFIG_H + +extern struct NDS_fw_config_data win_fw_config; + +BOOL CALLBACK FirmConfig_Proc(HWND dialog,UINT komunikat,WPARAM wparam,LPARAM lparam); + +#endif diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/main.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/main.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/main.c 2007-02-02 18:25:58.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/main.c 2007-06-20 09:29:11.000000000 -0500 @@ -47,19 +47,23 @@ #include "oamView.h" #include "mapview.h" #include "ConfigKeys.h" +#include "FirmConfig.h" +#include "OGLRender.h" +#include "../render3D.h" +#include "../gdbstub.h" #include "snddx.h" -#ifdef RENDER3D - #include "OGLRender.h" -#endif +/* The compact flash disk image file */ +static const char *bad_glob_cflash_disk_image_file; +static char cflash_filename_buffer[512]; /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char SavName[MAX_PATH] = ""; -char SavName2[MAX_PATH] = ""; +char ImportSavName[MAX_PATH] = ""; char szClassName[ ] = "DeSmuME"; int romnum = 0; @@ -101,14 +105,95 @@ NULL }; +GPU3DInterface *core3DList[] = { +&gpu3DNull, +&gpu3Dgl, +}; + int autoframeskipenab=1; int frameskiprate=0; static int backupmemorytype=MC_TYPE_AUTODETECT; static u32 backupmemorysize=1; +/* the firmware settings */ +struct NDS_fw_config_data win_fw_config; + + LRESULT CALLBACK SoundSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - + +struct configured_features { + u16 arm9_gdb_port; + u16 arm7_gdb_port; + + const char *cflash_disk_image_file; +}; + +static void +init_configured_features( struct configured_features *config) { + config->arm9_gdb_port = 0; + config->arm7_gdb_port = 0; + + config->cflash_disk_image_file = NULL; +} + + +static int +fill_configured_features( struct configured_features *config, LPSTR lpszArgument) { + int good_args = 0; + LPTSTR cmd_line; + LPWSTR *argv; + int argc; + + argv = CommandLineToArgvW( GetCommandLineW(), &argc); + + if ( argv != NULL) { + int i; + good_args = 1; + for ( i = 1; i < argc && good_args; i++) { + if ( wcsncmp( argv[i], L"--arm9gdb=", 10) == 0) { + wchar_t *end_char; + unsigned long port_num = wcstoul( &argv[i][10], &end_char, 10); + + if ( port_num > 0 && port_num < 65536) { + config->arm9_gdb_port = port_num; + } + else { + MessageBox(NULL,"ARM9 GDB stub port must be in the range 1 to 65535","Error",MB_OK); + good_args = 0; + } + } + else if ( wcsncmp( argv[i], L"--arm7gdb=", 10) == 0) { + wchar_t *end_char; + unsigned long port_num = wcstoul( &argv[i][10], &end_char, 10); + + if ( port_num > 0 && port_num < 65536) { + config->arm7_gdb_port = port_num; + } + else { + MessageBox(NULL,"ARM9 GDB stub port must be in the range 1 to 65535","Error",MB_OK); + good_args = 0; + } + } + else if ( wcsncmp( argv[i], L"--cflash=", 9) == 0) { + if ( config->cflash_disk_image_file == NULL) { + size_t convert_count = wcstombs( &cflash_filename_buffer[0], &argv[i][9], 512); + if ( convert_count > 0) { + config->cflash_disk_image_file = cflash_filename_buffer; + } + } + else { + MessageBox(NULL,"CFlash disk image file already set","Error",MB_OK); + good_args = 0; + } + } + } + LocalFree( argv); + } + + return good_args; +} + // Rotation definitions u8 GPU_screenrotated[4*256*192]; short GPU_rotation = 0; @@ -278,9 +363,14 @@ rotationbmi.bV4Width = 256; rotationbmi.bV4Height = -192; - #ifdef RENDER3D - OGLRender::init(&hdc); - #endif + NDS_3D_SetDriver (GPU3D_OPENGL); + + if (!gpu3D->NDS_3D_Init ()) + { + MessageBox(hwnd,"Unable to initialize openGL","Error",MB_OK); + return -1; + } + QueryPerformanceFrequency((LARGE_INTEGER *)&freq); QueryPerformanceCounter((LARGE_INTEGER *)&lastticks); OneFrameTime = freq / 60; @@ -374,7 +464,7 @@ else { if (framestoskip < 1) - framestoskip = frameskiprate + 1; + framestoskip += frameskiprate; } CWindow_RefreshALL(); @@ -414,31 +504,124 @@ NDS_UnPause(); } -BOOL LoadROM(char * filename) +BOOL LoadROM(char * filename, const char *cflash_disk_image) { NDS_Pause(); - if (NDS_LoadROM(filename, backupmemorytype, backupmemorysize) > 0) + if (NDS_LoadROM(filename, backupmemorytype, backupmemorysize, cflash_disk_image) > 0) return TRUE; return FALSE; } +/* + * The thread handling functions needed by the GDB stub code. + */ +void * +createThread_gdb( void (*thread_function)( void *data), + void *thread_data) { + void *new_thread = CreateThread( NULL, 0, + (LPTHREAD_START_ROUTINE)thread_function, thread_data, + 0, NULL); + + return new_thread; +} + +void +joinThread_gdb( void *thread_handle) { +} + + +void SetLanguage(int langid) +{ + switch(langid) + { + case 1: + // French + SetThreadLocale(MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH), + SORT_DEFAULT)); + break; + case 2: + // Danish + SetThreadLocale(MAKELCID(MAKELANGID(LANG_DANISH, SUBLANG_DEFAULT), + SORT_DEFAULT)); + break; + case 0: + // English + SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), + SORT_DEFAULT)); + break; + default: break; + break; + } +} + +void SaveLanguage(int langid) +{ + char text[80]; + + sprintf(text, "%d", langid); + WritePrivateProfileString("General", "Language", text, IniName); +} + +void CheckLanguage(UINT id) +{ + int i; + for (i = IDC_LANGENGLISH; i < IDC_LANGFRENCH+1; i++) + CheckMenuItem(menu, i, MF_BYCOMMAND | MF_UNCHECKED); + + CheckMenuItem(menu, id, MF_BYCOMMAND | MF_CHECKED); +} + +void ChangeLanguage(int id) +{ + HMENU newmenu; + + SetLanguage(id); + newmenu = LoadMenu(hAppInst, "MENU_PRINCIPAL"); + SetMenu(hwnd, newmenu); + DestroyMenu(menu); + menu = newmenu; +} + int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { - MSG messages; /* Here messages to the application are saved */ + gdbstub_handle_t arm9_gdb_stub; + gdbstub_handle_t arm7_gdb_stub; + struct armcpu_memory_iface *arm9_memio = &arm9_base_memory_iface; + struct armcpu_memory_iface *arm7_memio = &arm7_base_memory_iface; + struct armcpu_ctrl_iface *arm9_ctrl_iface; + struct armcpu_ctrl_iface *arm7_ctrl_iface; + struct configured_features my_config; + + MSG messages; /* Here messages to the application are saved */ char text[80]; cwindow_struct MainWindow; HACCEL hAccel; hAppInst=hThisInstance; + /* default the firmware settings, they may get changed later */ + NDS_FillDefaultFirmwareConfigData( &win_fw_config); + InitializeCriticalSection(§ion); + + GetINIPath(IniName, MAX_PATH); + GetPrivateProfileString("General", "Language", "-1", text, 80, IniName); + SetLanguage(atoi(text)); + sprintf(text, "DeSmuME v%s", VERSION); + init_configured_features( &my_config); + if ( !fill_configured_features( &my_config, lpszArgument)) { + MessageBox(NULL,"Unable to parse command line arguments","Error",MB_OK); + return 0; + } + bad_glob_cflash_disk_image_file = my_config.cflash_disk_image_file; + hAccel = LoadAccelerators(hAppInst, MAKEINTRESOURCE(IDR_MAIN_ACCEL)); if (CWindow_Init(&MainWindow, hThisInstance, szClassName, text, @@ -467,9 +650,44 @@ LogStart(); #endif - GetINIPath(IniName); + if ( my_config.arm9_gdb_port != 0) { + arm9_gdb_stub = createStub_gdb( my_config.arm9_gdb_port, + &arm9_memio, &arm9_direct_memory_iface); + + if ( arm9_gdb_stub == NULL) { + MessageBox(hwnd,"Failed to create ARM9 gdbstub","Error",MB_OK); + return -1; + } + } + if ( my_config.arm7_gdb_port != 0) { + arm7_gdb_stub = createStub_gdb( my_config.arm7_gdb_port, + &arm7_memio, + &arm7_base_memory_iface); + + if ( arm7_gdb_stub == NULL) { + MessageBox(hwnd,"Failed to create ARM7 gdbstub","Error",MB_OK); + return -1; + } + } + + + NDS_Init( arm9_memio, &arm9_ctrl_iface, + arm7_memio, &arm7_ctrl_iface); + - NDS_Init(); + /* + * Activate the GDB stubs + * This has to come after the NDS_Init where the cpus are set up. + */ + if ( my_config.arm9_gdb_port != 0) { + activateStub_gdb( arm9_gdb_stub, arm9_ctrl_iface); + } + if ( my_config.arm7_gdb_port != 0) { + activateStub_gdb( arm7_gdb_stub, arm7_ctrl_iface); + } + + GetPrivateProfileString("General", "Language", "0", text, 80, IniName); + CheckLanguage(IDC_LANGENGLISH+atoi(text)); GetPrivateProfileString("Video", "FrameSkip", "AUTO", text, 80, IniName); @@ -492,20 +710,60 @@ if (SPU_ChangeSoundCore(sndcoretype, sndbuffersize) != 0) { MessageBox(hwnd,"Unable to initialize DirectSound","Error",MB_OK); - return messages.wParam; + return -1; } - sndvolume = GetPrivateProfileInt("Sound","Volume",100, IniName); + sndvolume = GetPrivateProfileInt("Sound","Volume",100, IniName); SPU_SetVolume(sndvolume); - + + /* Read the firmware settings from the init file */ + win_fw_config.fav_colour = GetPrivateProfileInt("Firmware","favColor", 10, IniName); + win_fw_config.birth_month = GetPrivateProfileInt("Firmware","bMonth", 7, IniName); + win_fw_config.birth_day = GetPrivateProfileInt("Firmware","bDay", 15, IniName); + win_fw_config.language = GetPrivateProfileInt("Firmware","Language", 1, IniName); + + { + /* + * Read in the nickname and message. + * Convert the strings into Unicode UTF-16 characters. + */ + char temp_str[27]; + int char_index; + GetPrivateProfileString("Firmware","nickName", "yopyop", temp_str, 11, IniName); + win_fw_config.nickname_len = strlen( temp_str); + + if ( win_fw_config.nickname_len == 0) { + strcpy( temp_str, "yopyop"); + win_fw_config.nickname_len = strlen( temp_str); + } + + for ( char_index = 0; char_index < win_fw_config.nickname_len; char_index++) { + win_fw_config.nickname[char_index] = temp_str[char_index]; + } + + GetPrivateProfileString("Firmware","Message", "DeSmuME makes you happy!", temp_str, 27, IniName); + win_fw_config.message_len = strlen( temp_str); + for ( char_index = 0; char_index < win_fw_config.message_len; char_index++) { + win_fw_config.message[char_index] = temp_str[char_index]; + } + } + + /* Create the dummy firmware */ + NDS_CreateDummyFirmware( &win_fw_config); + runthread = CreateThread(NULL, 0, run, NULL, 0, &threadID); - - if(LoadROM(lpszArgument)) + + // Make sure any quotes from lpszArgument are removed + if (lpszArgument[0] == '\"') + sscanf(lpszArgument, "\"%[^\"]\"", lpszArgument); + + if(LoadROM(lpszArgument, bad_glob_cflash_disk_image_file)) { EnableMenuItem(menu, IDM_EXEC, MF_GRAYED); EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED); EnableMenuItem(menu, IDM_RESET, MF_ENABLED); EnableMenuItem(menu, IDM_GAME_INFO, MF_ENABLED); + EnableMenuItem(menu, IDM_IMPORTBACKUPMEMORY, MF_ENABLED); romloaded = TRUE; NDS_UnPause(); } @@ -515,6 +773,7 @@ EnableMenuItem(menu, IDM_PAUSE, MF_GRAYED); EnableMenuItem(menu, IDM_RESET, MF_GRAYED); EnableMenuItem(menu, IDM_GAME_INFO, MF_GRAYED); + EnableMenuItem(menu, IDM_IMPORTBACKUPMEMORY, MF_GRAYED); } CheckMenuItem(menu, IDC_SAVETYPE1, MF_BYCOMMAND | MF_CHECKED); @@ -607,12 +866,13 @@ char filename[MAX_PATH] = ""; DragQueryFile((HDROP)wParam,0,filename,MAX_PATH); DragFinish((HDROP)wParam); - if(LoadROM(filename)) + if(LoadROM(filename, bad_glob_cflash_disk_image_file)) { EnableMenuItem(menu, IDM_EXEC, MF_GRAYED); EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED); EnableMenuItem(menu, IDM_RESET, MF_ENABLED); EnableMenuItem(menu, IDM_GAME_INFO, MF_ENABLED); + EnableMenuItem(menu, IDM_IMPORTBACKUPMEMORY, MF_ENABLED); romloaded = TRUE; NDS_UnPause(); } @@ -864,12 +1124,13 @@ LOG("%s\r\n", filename); - if(LoadROM(filename)) + if(LoadROM(filename, bad_glob_cflash_disk_image_file)) { EnableMenuItem(menu, IDM_EXEC, MF_GRAYED); EnableMenuItem(menu, IDM_PAUSE, MF_ENABLED); EnableMenuItem(menu, IDM_RESET, MF_ENABLED); EnableMenuItem(menu, IDM_GAME_INFO, MF_ENABLED); + EnableMenuItem(menu, IDM_IMPORTBACKUPMEMORY, MF_ENABLED); romloaded = TRUE; NDS_UnPause(); } @@ -1002,6 +1263,30 @@ case IDM_STATE_LOAD_F10: StateLoadSlot(10); return 0; + case IDM_IMPORTBACKUPMEMORY: + { + OPENFILENAME ofn; + NDS_Pause(); + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = hwnd; + ofn.lpstrFilter = "All supported types\0*.duc;*.sav\0Action Replay DS Save (*.duc)\0*.duc\0DS-Xtreme Save (*.sav)\0*.sav\0\0"; + ofn.nFilterIndex = 1; + ofn.lpstrFile = ImportSavName; + ofn.nMaxFile = MAX_PATH; + ofn.lpstrDefExt = "duc"; + + if(!GetOpenFileName(&ofn)) + { + NDS_UnPause(); + return 0; + } + + if (!NDS_ImportSave(ImportSavName)) + MessageBox(hwnd,"Save was not successfully imported","Error",MB_OK); + NDS_UnPause(); + return 0; + } case IDM_SOUNDSETTINGS: { DialogBox(GetModuleHandle(NULL), "SoundSettingsDlg", hwnd, (DLGPROC)SoundSettingsDlgProc); @@ -1241,6 +1526,16 @@ } return 0; + case IDM_FIRMSETTINGS: + { + cwindow_struct FirmConfig; + + if (CWindow_Init2(&FirmConfig, hAppInst, HWND_DESKTOP, + "Configure Controls", IDD_FIRMSETTINGS, FirmConfig_Proc) == 0) + CWindow_Show(&FirmConfig); + + } + return 0; case IDC_FRAMESKIPAUTO: case IDC_FRAMESKIP0: case IDC_FRAMESKIP1: @@ -1281,11 +1576,26 @@ CheckMenuItem(menu, LOWORD(wParam), MF_BYCOMMAND | MF_CHECKED); } return 0; + case IDC_LANGENGLISH: + SaveLanguage(0); + ChangeLanguage(0); + CheckLanguage(LOWORD(wParam)); + return 0; + case IDC_LANGFRENCH: + SaveLanguage(1); + ChangeLanguage(1); + CheckLanguage(LOWORD(wParam)); + return 0; + case IDC_LANGDANISH: + SaveLanguage(1); + ChangeLanguage(2); + CheckLanguage(LOWORD(wParam)); + return 0; case IDM_WEBSITE: ShellExecute(NULL, "open", "http://desmume.sourceforge.net", NULL, NULL, SW_SHOWNORMAL); return 0; case IDM_FORUM: - ShellExecute(NULL, "open", "http://sourceforge.net/forum/?group_id=164579", NULL, NULL, SW_SHOWNORMAL); + ShellExecute(NULL, "open", "http://forums.desmume.org/index.php", NULL, NULL, SW_SHOWNORMAL); return 0; case IDM_SUBMITBUGREPORT: ShellExecute(NULL, "open", "http://sourceforge.net/tracker/?func=add&group_id=164579&atid=832291", NULL, NULL, SW_SHOWNORMAL); diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/Makefile.am /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/Makefile.am --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/Makefile.am 2007-02-04 16:02:57.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/Makefile.am 2007-06-29 04:01:45.000000000 -0500 @@ -1,3 +1,5 @@ +include $(top_srcdir)/src/desmume.mk + EXTRA_DIST = DeSmuME.dev DeSmuME.exe.Manifest DeSmuME.ico \ DeSmuME.layout DeSmuME.vcproj Makefile.win \ resources.rc yopyop_private.rc @@ -11,7 +13,9 @@ resource.h \ snddx.c snddx.h \ tileView.c tileView.h yopyop_private.h \ - ConfigKeys.c ConfigKeys.h -desmume_LDADD = ../libdesmume.a yopyop_private.o + ConfigKeys.c ConfigKeys.h \ + FirmConfig.c FirmConfig.h \ + OGLRender.c OGLRender.h +desmume_LDADD = ../libdesmume.a yopyop_private.o ../gdbstub/libgdbstub.a yopyop_private.o: yopyop_private.rc resources.rc resource.h windres yopyop_private.rc -o yopyop_private.o diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/Makefile.in /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/Makefile.in --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/Makefile.in 2007-02-04 16:02:57.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/Makefile.in 2007-09-03 12:31:41.000000000 -0500 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,15 +14,11 @@ @SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -37,14 +33,15 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/src/desmume.mk bin_PROGRAMS = desmume$(EXEEXT) subdir = src/windows -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) @@ -53,10 +50,11 @@ ginfo.$(OBJEXT) IORegView.$(OBJEXT) main.$(OBJEXT) \ mapView.$(OBJEXT) memView.$(OBJEXT) oamView.$(OBJEXT) \ palView.$(OBJEXT) snddx.$(OBJEXT) tileView.$(OBJEXT) \ - ConfigKeys.$(OBJEXT) + ConfigKeys.$(OBJEXT) FirmConfig.$(OBJEXT) OGLRender.$(OBJEXT) desmume_OBJECTS = $(am_desmume_OBJECTS) -desmume_DEPENDENCIES = ../libdesmume.a yopyop_private.o -DEFAULT_INCLUDES = -I. -I$(srcdir) +desmume_DEPENDENCIES = ../libdesmume.a yopyop_private.o \ + ../gdbstub/libgdbstub.a +DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -69,22 +67,21 @@ CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ +ALL_LINGUAS = @ALL_LINGUAS@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ @@ -92,14 +89,48 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GLADEUI_UNINSTALLED_DIR = @GLADEUI_UNINSTALLED_DIR@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ GREP = @GREP@ +GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ +GTHREAD_LIBS = @GTHREAD_LIBS@ +GTKGLEXT_CFLAGS = @GTKGLEXT_CFLAGS@ +GTKGLEXT_LIBS = @GTKGLEXT_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ HAVE_PKG = @HAVE_PKG@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ +INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ +INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ +INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ +INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ +INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ +INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ +INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ +INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ +INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ +INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ +INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ +INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ +INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ +INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ LDFLAGS = @LDFLAGS@ LIBGLADE_CFLAGS = @LIBGLADE_CFLAGS@ LIBGLADE_LIBS = @LIBGLADE_LIBS@ @@ -107,9 +138,11 @@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -119,6 +152,13 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_DIR = @PO_DIR@ +PO_FILES = @PO_FILES@ +PO_FILES_IN = @PO_FILES_IN@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RANLIB = @RANLIB@ SDLCONFIG = @SDLCONFIG@ SDL_CFLAGS = @SDL_CFLAGS@ @@ -128,13 +168,14 @@ STRIP = @STRIP@ UI_DIR = @UI_DIR@ USE_MAINTAINER_MODE = @USE_MAINTAINER_MODE@ +USE_NLS = @USE_NLS@ VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -146,6 +187,7 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ desmume_arch = @desmume_arch@ @@ -174,12 +216,18 @@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CFLAGS = +AM_CPPFLAGS = -I$(top_srcdir)/src +AM_LDFLAGS = EXTRA_DIST = DeSmuME.dev DeSmuME.exe.Manifest DeSmuME.ico \ DeSmuME.layout DeSmuME.vcproj Makefile.win \ resources.rc yopyop_private.rc @@ -193,14 +241,16 @@ resource.h \ snddx.c snddx.h \ tileView.c tileView.h yopyop_private.h \ - ConfigKeys.c ConfigKeys.h + ConfigKeys.c ConfigKeys.h \ + FirmConfig.c FirmConfig.h \ + OGLRender.c OGLRender.h -desmume_LDADD = ../libdesmume.a yopyop_private.o +desmume_LDADD = ../libdesmume.a yopyop_private.o ../gdbstub/libgdbstub.a all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/src/desmume.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -231,7 +281,7 @@ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ @@ -254,7 +304,7 @@ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) desmume$(EXEEXT): $(desmume_OBJECTS) $(desmume_DEPENDENCIES) @rm -f desmume$(EXEEXT) - $(LINK) $(desmume_LDFLAGS) $(desmume_OBJECTS) $(desmume_LDADD) $(LIBS) + $(LINK) $(desmume_OBJECTS) $(desmume_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -264,7 +314,9 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CWindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConfigKeys.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FirmConfig.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IORegView.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OGLRender.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disView.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ginfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ @@ -276,19 +328,18 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tileView.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -339,22 +390,21 @@ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -370,7 +420,7 @@ all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am @@ -418,12 +468,20 @@ install-data-am: +install-dvi: install-dvi-am + install-exec-am: install-binPROGRAMS +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -443,18 +501,22 @@ ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-info-am +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-info-am + uninstall-am uninstall-binPROGRAMS yopyop_private.o: yopyop_private.rc resources.rc resource.h windres yopyop_private.rc -o yopyop_private.o diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/mapView.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/mapView.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/mapView.c 2006-11-30 15:43:48.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/mapView.c 2007-03-06 14:35:06.000000000 -0600 @@ -38,6 +38,7 @@ BITMAPV4HEADER bmi; u16 lg; u16 ht; + BGxPARMS * parms; //CreateBitmapIndirect(&bmi); memset(&bmi, 0, sizeof(bmi)); @@ -70,9 +71,11 @@ if(!(bgcnt&(1<<7))) sprintf(text, "normale 16"); else + { if(!(dispcnt&(1<<30))) sprintf(text, "normale 256"); else + { switch(win->map) { case 0 : @@ -85,6 +88,8 @@ sprintf(text, "extended slot %d", MainScreen.gpu->BGExtPalSlot[win->map]); break; } + } + } SetWindowText(GetDlgItem(hwnd, IDC_PAL), text); sprintf(text, "%d", (int)(bgcnt&3)); @@ -100,17 +105,97 @@ sprintf(text, "%d x %d", (int)MainScreen.gpu->BGSize[win->map][0], (int)MainScreen.gpu->BGSize[win->map][1]); SetWindowText(GetDlgItem(hwnd, IDC_MSIZE), text); - sprintf(text, "%d x %d", MainScreen.gpu->BGPC[win->map], MainScreen.gpu->BGPD[win->map]); + if (win->map==2) { + parms = &(MainScreen.gpu->dispx_st)->dispx_BG2PARMS; + } else { + parms = &(MainScreen.gpu->dispx_st)->dispx_BG3PARMS; + } + sprintf(text, "%d x %d", parms->BGxPC, parms->BGxPD); SetWindowText(GetDlgItem(hwnd, IDC_SCROLL), text); + memset(win->bitmap, 0, sizeof(win->bitmap)); if(win->lcd) - textBG(SubScreen.gpu, win->map, (u8 *)win->bitmap); - //rotBG(SubScreen.gpu, win->map, win->bitmap); - //extRotBG(SubScreen.gpu, win->map, win->bitmap); + { + switch(dispcnt & 7) + { + case 0: + textBG(SubScreen.gpu, win->map, (u8 *)win->bitmap); + break; + case 1: + if (win->map < 3) + textBG(SubScreen.gpu, win->map, (u8 *)win->bitmap); + else + rotBG(SubScreen.gpu, win->map, (u8 *)win->bitmap); + break; + case 2: + if (win->map < 2) + textBG(SubScreen.gpu, win->map, (u8 *)win->bitmap); + else + rotBG(SubScreen.gpu, win->map, (u8 *)win->bitmap); + break; + case 3: + if (win->map < 3) + textBG(SubScreen.gpu, win->map, (u8 *)win->bitmap); + else + extRotBG(SubScreen.gpu, win->map, (u8 *)win->bitmap); + break; + case 4: + if (win->map < 2) + textBG(SubScreen.gpu, win->map, (u8 *)win->bitmap); + else if (win->map < 3) + rotBG(SubScreen.gpu, win->map, (u8 *)win->bitmap); + else + extRotBG(SubScreen.gpu, win->map, (u8 *)win->bitmap); + break; + case 5: + if (win->map < 2) + textBG(SubScreen.gpu, win->map, (u8 *)win->bitmap); + else + extRotBG(SubScreen.gpu, win->map, (u8 *)win->bitmap); + break; + } + } else - textBG(MainScreen.gpu, win->map, (u8 *)win->bitmap); - //rotBG(MainScreen.gpu, win->map, win->bitmap); - //extRotBG(MainScreen.gpu, win->map, win->bitmap); + { + switch(dispcnt & 7) + { + case 0: + textBG(MainScreen.gpu, win->map, (u8 *)win->bitmap); + break; + case 1: + if (win->map < 3) + textBG(MainScreen.gpu, win->map, (u8 *)win->bitmap); + else + rotBG(MainScreen.gpu, win->map, (u8 *)win->bitmap); + break; + case 2: + if (win->map < 2) + textBG(MainScreen.gpu, win->map, (u8 *)win->bitmap); + else + rotBG(MainScreen.gpu, win->map, (u8 *)win->bitmap); + break; + case 3: + if (win->map < 3) + textBG(MainScreen.gpu, win->map, (u8 *)win->bitmap); + else + extRotBG(MainScreen.gpu, win->map, (u8 *)win->bitmap); + break; + case 4: + if (win->map < 2) + textBG(MainScreen.gpu, win->map, (u8 *)win->bitmap); + else if (win->map < 3) + rotBG(MainScreen.gpu, win->map, (u8 *)win->bitmap); + else + extRotBG(MainScreen.gpu, win->map, (u8 *)win->bitmap); + break; + case 5: + if (win->map < 2) + textBG(MainScreen.gpu, win->map, (u8 *)win->bitmap); + else + extRotBG(MainScreen.gpu, win->map, (u8 *)win->bitmap); + break; + } + } SetDIBitsToDevice(hdc, 200, 4, lg, ht, 0, 0, 0, ht, win->bitmap, (BITMAPINFO*)&bmi, DIB_RGB_COLORS); //SetDIBitsToDevice(hdc, 200, 4, 256, 192, 0, 0, 0, 192, win->bitmap, (BITMAPINFO*)&bmi, DIB_RGB_COLORS); @@ -160,6 +245,7 @@ case IDC_BG_SELECT : switch(HIWORD(wParam)) { + case CBN_SELCHANGE : case CBN_CLOSEUP : { u32 sel= SendMessage(GetDlgItem(hwnd, IDC_BG_SELECT), CB_GETCURSEL, 0, 0); diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/oamView.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/oamView.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/oamView.c 2007-01-09 18:19:16.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/oamView.c 2007-03-01 21:05:45.000000000 -0600 @@ -217,7 +217,7 @@ for(i = 0; i < 192; ++i) { - win->gpu->spriteRender(win->gpu, i, bitmap + i*256, prio + i*256); + win->gpu->spriteRender(win->gpu, i, (u8*)(bitmap + i*256), prio + i*256); } SetDIBitsToDevice(hdc, 180, 4, 256, 192, 0, 0, 0, 192, bitmap, (BITMAPINFO*)&bmi, DIB_RGB_COLORS); diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/OGLRender.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/OGLRender.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/OGLRender.c 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/OGLRender.c 2007-08-11 14:23:45.000000000 -0500 @@ -0,0 +1,1838 @@ +/* + Copyright (C) 2006 yopyop + Copyright (C) 2006-2007 shash + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef DESMUME_COCOA + +#define WIN32_LEAN_AND_MEAN +#include +#include +#include +#include +#include +#include "..\debug.h" +#include "..\MMU.h" +#include "..\bits.h" +#include "..\matrix.h" + +#else + + +#include +#include +#include "../debug.h" +#include "../MMU.h" +#include "../bits.h" +#include "../matrix.h" + +#endif + +#include "OGLRender.h" + + +#define fix2float(v) (((float)((s32)(v))) / (float)(1<<12)) +#define fix10_2float(v) (((float)((s32)(v))) / (float)(1<<9)) + +static unsigned char GPU_screen3D[256*256*4]={0}; + +// Acceleration tables +static float* float16table = NULL; +static float* float10Table = NULL; +static float* float10RelTable = NULL; +static float* normalTable = NULL; +static int numVertex = 0; + +// Matrix stack handling +static MatrixStack mtxStack[4]; +static float mtxCurrent [4][16]; +static float mtxTemporal[16]; + +// Indexes for matrix loading/multiplication +static char ML4x4ind = 0; +static char ML4x3_c = 0, ML4x3_l = 0; +static char MM4x4ind = 0; +static char MM4x3_c = 0, MM4x3_l = 0; +static char MM3x3_c = 0, MM3x3_l = 0; + +// Data for vertex submission +static float coord[3] = {0.0, 0.0, 0.0}; +static char coordind = 0; + +// Data for basic transforms +static float trans[3] = {0.0, 0.0, 0.0}; +static char transind = 0; + +static float scale[3] = {0.0, 0.0, 0.0}; +static char scaleind = 0; + +static const unsigned short polyType[4] = {GL_TRIANGLES, GL_QUADS, GL_TRIANGLE_STRIP, GL_QUAD_STRIP}; +static const unsigned short map3d_cull[4] = {GL_FRONT_AND_BACK, GL_FRONT, GL_BACK, 0}; +static const int texEnv[4] = { GL_MODULATE, GL_DECAL, GL_MODULATE, GL_MODULATE }; +static const int depthFunc[2] = { GL_LESS, GL_EQUAL }; + +static unsigned short matrixMode[2] = {GL_PROJECTION, GL_MODELVIEW}; +static short mode = 0; + +static int colorAlpha=0; +static unsigned int depthFuncMode=0; +static unsigned int lightMask=0; +static unsigned int envMode=0; +static unsigned int cullingMask=0; +static unsigned int oglTextureID=0; +static unsigned char texMAP[1024*2048*4], texMAP2[2048*2048*4]; +static float invTexWidth = 1.f; +static float invTexHeight = 1.f; +static float fogColor[4] = {0.f}; +static float fogOffset = 0.f; + +static unsigned long clCmd = 0; +static unsigned long clInd = 0; +static unsigned long clInd2 = 0; +static int alphaDepthWrite = 0; +static int colorRGB[4] = { 0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}; +static int texCoordinateTransform = 0; +static int t=0, s=0; +static char beginCalled = 0; +static unsigned int vtxFormat; +static unsigned int textureFormat=0, texturePalette=0; +static unsigned int lastTextureFormat=0, lastTexturePalette=0; + +#ifndef DESMUME_COCOA +extern HWND hwnd; +#endif + +char NDS_glInit(void) +{ + int i; +#ifndef DESMUME_COCOA + HDC oglDC = NULL; + HGLRC hRC = NULL; + int pixelFormat; + PIXELFORMATDESCRIPTOR pfd; + + oglDC = GetDC (hwnd); + + memset(&pfd,0, sizeof(PIXELFORMATDESCRIPTOR)); + pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); + pfd.nVersion = 1; + pfd.dwFlags = PFD_DRAW_TO_BITMAP | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.cColorBits = 32; + pfd.cDepthBits = 24; + pfd.cStencilBits = 8; + pfd.iLayerType = PFD_MAIN_PLANE ; + + pixelFormat = ChoosePixelFormat(oglDC, &pfd); + if (pixelFormat == 0) + return 0; + + if(!SetPixelFormat(oglDC, pixelFormat, &pfd)) + return 0; + + hRC = wglCreateContext(oglDC); + if (!hRC) + return 0; + + if(!wglMakeCurrent(oglDC, hRC)) + return 0; +#endif + + glEnable(GL_DEPTH_TEST); + glEnable(GL_TEXTURE_2D); + + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glColor3f (1.f, 1.f, 1.f); + + glGenTextures (1, &oglTextureID); + + glViewport(0, 0, 256, 192); + + if (glGetError() != GL_NO_ERROR) + return 0; + + // Precalculate some tables, to avoid pushing data to the FPU and back for conversion + float16table = (float*) malloc (sizeof(float)*65536); + for (i = 0; i < 65536; i++) + { + float16table[i] = fix2float((signed short)i); + } + + float10RelTable = (float*) malloc (sizeof(float)*1024); + for (i = 0; i < 1024; i++) + { + float10RelTable[i] = ((signed short)(i<<6)) / (float)(1<<18); + } + + float10Table = (float*) malloc (sizeof(float)*1024); + for (i = 0; i < 1024; i++) + { + float10Table[i] = ((signed short)(i<<6)) / (float)(1<<12); + } + + normalTable = (float*) malloc (sizeof(float)*1024); + for (i = 0; i < 1024; i++) + { + normalTable[i] = ((signed short)(i<<6)) / (float)(1<<16); + } + + MatrixStackSetMaxSize(&mtxStack[0], 1); // Projection stack + MatrixStackSetMaxSize(&mtxStack[1], 31); // Coordinate stack + MatrixStackSetMaxSize(&mtxStack[2], 31); // Directional stack + MatrixStackSetMaxSize(&mtxStack[3], 1); // Texture stack + + MatrixInit (mtxCurrent[0]); + MatrixInit (mtxCurrent[1]); + MatrixInit (mtxCurrent[2]); + MatrixInit (mtxCurrent[3]); + MatrixInit (mtxTemporal); + + return 1; +} + +void NDS_glViewPort(unsigned long v) +{ + glViewport( (v&0xFF), ((v>>8)&0xFF), ((v>>16)&0xFF), (v>>24)); +} + +void NDS_glClearColor(unsigned long v) +{ + glClearColor( ((float)(v&0x1F))/31.0f, + ((float)((v>>5)&0x1F))/31.0f, + ((float)((v>>10)&0x1F))/31.0f, + ((float)((v>>16)&0x1F))/31.0f); +} + +void NDS_glFogColor(unsigned long v) +{ + fogColor[0] = ((float)((v )&0x1F))/31.0f; + fogColor[1] = ((float)((v>> 5)&0x1F))/31.0f; + fogColor[2] = ((float)((v>>10)&0x1F))/31.0f; + fogColor[3] = ((float)((v>>16)&0x1F))/31.0f; +} + +void NDS_glFogOffset (unsigned long v) +{ + fogOffset = (float)(v&0xffff); +} + +void NDS_glClDepth() +{ + glClear(GL_DEPTH_BUFFER_BIT); +} + +void NDS_glClearDepth(unsigned long v) +{ + u32 depth24b; + + v &= 0x7FFFF; + depth24b = (v*0x200)+((v+1)/0x8000); + + glClearDepth(depth24b / ((float)(1<<24))); +} + +void NDS_glMatrixMode(unsigned long v) +{ + if (beginCalled) + { + glEnd(); + } + + mode = (short)(v&3); + + if (beginCalled) + { + glBegin (vtxFormat); + } +} + +void SetMatrix (void) +{ + if (mode < 2) + { + glEnd(); + glMatrixMode (matrixMode[mode]); + glLoadMatrixf(mtxCurrent[mode]); + glBegin (vtxFormat); + } + else if (mode == 2) + { + glEnd(); + glMatrixMode (matrixMode[1]); + glLoadMatrixf(mtxCurrent[1]); + glBegin (vtxFormat); + } +} + +void NDS_glLoadIdentity (void) +{ + MatrixIdentity (mtxCurrent[mode]); + + if (mode == 2) + MatrixIdentity (mtxCurrent[1]); +} + +void NDS_glLoadMatrix4x4(signed long v) +{ + mtxCurrent[mode][ML4x4ind] = fix2float(v); + + ++ML4x4ind; + if(ML4x4ind<16) return; + + if (mode == 2) + MatrixCopy (mtxCurrent[1], mtxCurrent[2]); + + ML4x4ind = 0; +} + +void NDS_glLoadMatrix4x3(signed long v) +{ + mtxCurrent[mode][(ML4x3_l<<2)+ML4x3_c] = fix2float(v); + + ++ML4x3_c; + if(ML4x3_c<3) return; + + ML4x3_c = 0; + ++ML4x3_l; + if(ML4x3_l<4) return; + ML4x3_l = 0; + + if (mode == 2) + MatrixCopy (mtxCurrent[1], mtxCurrent[2]); +} + +void NDS_glStoreMatrix(unsigned long v) +{ + MatrixStackLoadMatrix (&mtxStack[mode], v&31, mtxCurrent[mode]); +} + +void NDS_glRestoreMatrix(unsigned long v) +{ + MatrixCopy (mtxCurrent[mode], MatrixStackGetPos(&mtxStack[mode], v&31)); + + if (mode == 2) + MatrixCopy (mtxCurrent[1], mtxCurrent[2]); +} + +void NDS_glPushMatrix (void) +{ + MatrixStackPushMatrix (&mtxStack[mode], mtxCurrent[mode]); +} + +void NDS_glPopMatrix(signed long i) +{ + MatrixCopy (mtxCurrent[mode], MatrixStackPopMatrix (&mtxStack[mode], i)); + + if (mode == 2) + MatrixCopy (mtxCurrent[1], mtxCurrent[2]); +} + +void NDS_glTranslate(signed long v) +{ + trans[transind] = fix2float(v); + + ++transind; + + if(transind<3) + return; + + transind = 0; + + MatrixTranslate (mtxCurrent[mode], trans); + + if (mode == 2) + MatrixTranslate (mtxCurrent[1], trans); +} + +void NDS_glScale(signed long v) +{ + scale[scaleind] = fix2float(v); + + ++scaleind; + + if(scaleind<3) + return; + + scaleind = 0; + + MatrixScale (mtxCurrent[mode], scale); + + if (mode == 2) + MatrixScale (mtxCurrent[1], scale); +} + +void NDS_glMultMatrix3x3(signed long v) +{ + mtxTemporal[(MM3x3_l<<2)+MM3x3_c] = fix2float(v); + + ++MM3x3_c; + if(MM3x3_c<3) return; + + MM3x3_c = 0; + ++MM3x3_l; + if(MM3x3_l<3) return; + MM3x3_l = 0; + + MatrixMultiply (mtxCurrent[mode], mtxTemporal); + + if (mode == 2) + MatrixMultiply (mtxCurrent[1], mtxTemporal); + + MatrixIdentity (mtxTemporal); +} + +void NDS_glMultMatrix4x3(signed long v) +{ + mtxTemporal[(MM4x3_l<<2)+MM4x3_c] = fix2float(v); + + ++MM4x3_c; + if(MM4x3_c<3) return; + + MM4x3_c = 0; + ++MM4x3_l; + if(MM4x3_l<4) return; + MM4x3_l = 0; + + MatrixMultiply (mtxCurrent[mode], mtxTemporal); + if (mode == 2) + MatrixMultiply (mtxCurrent[1], mtxTemporal); + + MatrixIdentity (mtxTemporal); +} + +void NDS_glMultMatrix4x4(signed long v) +{ + mtxTemporal[MM4x4ind] = fix2float(v); + + ++MM4x4ind; + if(MM4x4ind<16) return; + + MM4x4ind = 0; + + MatrixMultiply (mtxCurrent[mode], mtxTemporal); + if (mode == 2) + MatrixMultiply (mtxCurrent[1], mtxTemporal); + + MatrixIdentity (mtxTemporal); +} + +static __inline void SetupTexture (unsigned int format, unsigned int palette) +{ + if(format == 0) + return; + else + { + unsigned short *pal = NULL; + unsigned int sizeX = (1<<(((format>>20)&0x7)+3)); + unsigned int sizeY = (1<<(((format>>23)&0x7)+3)); + unsigned int mode = (unsigned short)((format>>26)&0x7); + unsigned char * adr = (unsigned char *)(ARM9Mem.ARM9_LCD + ((format&0xFFFF)<<3)); + unsigned short param = (unsigned short)((format>>30)&0xF); + unsigned short param2 = (unsigned short)((format>>16)&0xF); + unsigned int imageSize = sizeX*sizeY; + unsigned int paletteSize = 0; + unsigned int palZeroTransparent = (1-((format>>29)&1))*255; // shash: CONVERT THIS TO A TABLE :) + unsigned int x=0, y=0; + unsigned char * dst = texMAP, *src = NULL; + + if (mode == 0) + glDisable (GL_TEXTURE_2D); + else + glEnable (GL_TEXTURE_2D); + + switch(mode) + { + case 1: + { + paletteSize = 256; + pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4)); + break; + } + case 2: + { + paletteSize = 4; + pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<3)); + imageSize >>= 2; + break; + } + case 3: + { + paletteSize = 16; + pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4)); + imageSize >>= 1; + break; + } + case 4: + { + paletteSize = 256; + pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4)); + break; + } + case 5: + { + paletteSize = 0; + pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4)); + break; + } + case 6: + { + paletteSize = 256; + pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4)); + break; + } + case 7: + { + paletteSize = 0; + break; + } + } + + switch(mode) + { + case 1: + { + for(x = 0; x < imageSize; x++, dst += 4) + { + unsigned short c = pal[adr[x]&31], alpha = (adr[x]>>5); + dst[0] = (unsigned char)((c & 0x1F)<<3); + dst[1] = (unsigned char)((c & 0x3E0)>>2); + dst[2] = (unsigned char)((c & 0x7C00)>>7); + dst[3] = ((alpha<<2)+(alpha>>1))<<3; + } + + break; + } + case 2: + { + for(x = 0; x < imageSize; ++x) + { + unsigned short c = pal[(adr[x])&0x3]; + dst[0] = ((c & 0x1F)<<3); + dst[1] = ((c & 0x3E0)>>2); + dst[2] = ((c & 0x7C00)>>7); + dst[3] = ((adr[x]&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255; + dst += 4; + + c = pal[((adr[x])>>2)&0x3]; + dst[0] = ((c & 0x1F)<<3); + dst[1] = ((c & 0x3E0)>>2); + dst[2] = ((c & 0x7C00)>>7); + dst[3] = (((adr[x]>>2)&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255; + dst += 4; + + c = pal[((adr[x])>>4)&0x3]; + dst[0] = ((c & 0x1F)<<3); + dst[1] = ((c & 0x3E0)>>2); + dst[2] = ((c & 0x7C00)>>7); + dst[3] = (((adr[x]>>4)&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255; + dst += 4; + + c = pal[(adr[x])>>6]; + dst[0] = ((c & 0x1F)<<3); + dst[1] = ((c & 0x3E0)>>2); + dst[2] = ((c & 0x7C00)>>7); + dst[3] = (((adr[x]>>6)&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255; + dst += 4; + } + } + break; + case 3: + { + for(x = 0; x < imageSize; x++) + { + unsigned short c = pal[adr[x]&0xF]; + dst[0] = ((c & 0x1F)<<3); + dst[1] = ((c & 0x3E0)>>2); + dst[2] = ((c & 0x7C00)>>7); + dst[3] = (((adr[x])&0xF) == 0) ? palZeroTransparent : 255;//(c>>15)*255; + dst += 4; + + c = pal[((adr[x])>>4)]; + dst[0] = ((c & 0x1F)<<3); + dst[1] = ((c & 0x3E0)>>2); + dst[2] = ((c & 0x7C00)>>7); + dst[3] = (((adr[x]>>4)&0xF) == 0) ? palZeroTransparent : 255;//(c>>15)*255; + dst += 4; + } + } + break; + + case 4: + { + for(x = 0; x < imageSize; ++x) + { + unsigned short c = pal[adr[x]]; + dst[0] = (unsigned char)((c & 0x1F)<<3); + dst[1] = (unsigned char)((c & 0x3E0)>>2); + dst[2] = (unsigned char)((c & 0x7C00)>>7); + dst[3] = (adr[x] == 0) ? palZeroTransparent : 255;//(c>>15)*255; + dst += 4; + } + } + break; + + case 5: + { + // UNOPTIMIZED + unsigned short * pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4)); + unsigned short * slot1 = (unsigned short*)((unsigned char *)(ARM9Mem.ARM9_LCD + ((format&0xFFFF)<<3)/2 + 0x20000)); + unsigned int * map = ((unsigned int *)adr), i = 0; + unsigned int * dst = (unsigned int *)texMAP; + + /* FIXME: the texture slots do not have to follow the VRAM bank layout */ + if ( (format & 0xc000) == 0x8000) { + /* texel are in slot 2 */ + slot1 = (unsigned short*)((unsigned char *)(ARM9Mem.ARM9_LCD + ((format&0x3FFF)<<2) + 0x30000)); + } + else { + slot1 = (unsigned short*)((unsigned char *)(ARM9Mem.ARM9_LCD +((format&0x3FFF)<<2) + 0x20000)); + } + + for (y = 0; y < (sizeY/4); y ++) + { + for (x = 0; x < (sizeX/4); x ++, i++) + { + u32 currBlock = map[i], sy; + u16 pal1 = slot1[i]; + u16 pal1offset = (pal1 & 0x3FFF)<<1; + u8 mode = pal1>>14; + + for (sy = 0; sy < 4; sy++) + { + // Texture offset + u32 xAbs = (x<<2); + u32 yAbs = ((y<<2) + sy); + u32 currentPos = xAbs + yAbs*sizeX; + + // Palette + u8 currRow = (u8)((currBlock >> (sy*8)) & 0xFF); +#define RGB16TO32(col,alpha) (((alpha)<<24) | ((((col) & 0x7C00)>>7)<<16) | ((((col) & 0x3E0)>>2)<<8) | (((col) & 0x1F)<<3)) +#define RGB32(r,g,b,a) (((a)<<24) | ((r)<<16) | ((g)<<8) | (b)) + + switch (mode) + { + case 0: + { + int i; + + for ( i = 0; i < 4; i++) { + int texel = (currRow >> (2 * i)) & 3; + + if ( texel == 3) { + dst[currentPos+i] = RGB16TO32(0x7fff, 0); + } + else { + u16 colour = pal[pal1offset+texel]; + dst[currentPos+i] = RGB16TO32( colour, 255); + } + } + break; + } + case 1: + { + u16 colours[3]; + int i; + + colours[0] = pal[pal1offset + 0]; + colours[1] = pal[pal1offset + 1]; + colours[2] = + /* RED */ + (((colours[0] & 0x1f) + + (colours[1] & 0x1f)) >> 1) | + /* GREEN */ + (((colours[0] & (0x1f << 5)) + + (colours[1] & (0x1f << 5))) >> 1) | + /* BLUE */ + (((colours[0] & (0x1f << 10)) + + (colours[1] & (0x1f << 10))) >> 1); + + for ( i = 0; i < 4; i++) { + int texel = (currRow >> (2 * i)) & 3; + + if ( texel == 3) { + dst[currentPos+i] = RGB16TO32(0, 0); + } + else { + dst[currentPos+i] = RGB16TO32( colours[texel], 255); + } + } + break; + } + case 2: + { + u16 col0 = pal[pal1offset+((currRow>>0)&3)]; + u16 col1 = pal[pal1offset+((currRow>>2)&3)]; + u16 col2 = pal[pal1offset+((currRow>>4)&3)]; + u16 col3 = pal[pal1offset+((currRow>>6)&3)]; + + dst[currentPos+0] = RGB16TO32(col0, 255); + dst[currentPos+1] = RGB16TO32(col1, 255); + dst[currentPos+2] = RGB16TO32(col2, 255); + dst[currentPos+3] = RGB16TO32(col3, 255); + + break; + } + case 3: + { + u16 colours[4]; + int i; + u32 red0, red1; + u32 green0, green1; + u32 blue0, blue1; + + colours[0] = pal[pal1offset + 0]; + colours[1] = pal[pal1offset + 1]; + + red0 = colours[0] & 0x1f; + green0 = (colours[0] & (0x1f << 5)) >> 5; + blue0 = (colours[0] & (0x1f << 10)) >> 10; + + red1 = colours[1] & 0x1f; + green1 = (colours[1] & (0x1f << 5)) >> 5; + blue1 = (colours[1] & (0x1f << 10)) >> 10; + + /* (colour0 * 5 + colour1 * 3) / 8 */ + colours[2] = + /* red */ + ((red0 * 5 + red1 * 3) >> 3) | + /* green */ + (((green0 * 5 + green1 * 3) >> 3) << 5) | + /* blue */ + (((blue0 * 5 + blue1 * 3) >> 3) << 10); + + /* (colour0 * 3 + colour1 * 5) / 8 */ + colours[3] = + /* red */ + ((red0 * 3 + red1 * 5) >> 3) | + /* green */ + (((green0 * 3 + green1 * 5) >> 3) << 5) | + /* blue */ + (((blue0 * 3 + blue1 * 5) >> 3) << 10); + + + for ( i = 0; i < 4; i++) { + int texel = (currRow >> (2 * i)) & 3; + + dst[currentPos+i] = RGB16TO32(colours[texel], 255); + } + break; + } + } + } + } + } + + break; + } + case 6: + { + for(x = 0; x < imageSize; x++) + { + unsigned short c = pal[adr[x]&7]; + dst[0] = (unsigned char)((c & 0x1F)<<3); + dst[1] = (unsigned char)((c & 0x3E0)>>2); + dst[2] = (unsigned char)((c & 0x7C00)>>7); + dst[3] = (adr[x]&0xF8); + dst += 4; + } + break; + } + case 7: + { + unsigned short * map = ((unsigned short *)adr); + for(x = 0; x < imageSize; ++x) + { + unsigned short c = map[x]; + dst[0] = ((c & 0x1F)<<3); + dst[1] = ((c & 0x3E0)>>2); + dst[2] = ((c & 0x7C00)>>7); + dst[3] = (c>>15)*255; + dst += 4; + } + } + break; + } + + glBindTexture(GL_TEXTURE_2D, oglTextureID); + + + switch ((format>>18)&3) + { + case 0: + { + glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, sizeX, sizeY, 0, GL_RGBA, GL_UNSIGNED_BYTE, texMAP); + break; + } + + case 1: + { + u32 *src = (u32*)texMAP, *dst = (u32*)texMAP2; + + for (y = 0; y < sizeY; y++) + { + for (x = 0; x < sizeX; x++) + { + dst[y*sizeX*2 + x] = dst[y*sizeX*2 + (sizeX*2-x-1)] = src[y*sizeX + x]; + } + } + + sizeX <<= 1; + glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, sizeX, sizeY, 0, GL_RGBA, GL_UNSIGNED_BYTE, texMAP2); + break; + } + + case 2: + { + u32 *src = (u32*)texMAP, *dst = (u32*)texMAP2; + + for (y = 0; y < sizeY; y++) + { + memcpy (&src[(sizeY*2-y-1)*sizeX], &src[y*sizeX], sizeX*4); + } + + sizeY <<= 1; + glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, sizeX, sizeY, 0, GL_RGBA, GL_UNSIGNED_BYTE, texMAP); + break; + } + + case 3: + { + u32 *src = (u32*)texMAP, *dst = (u32*)texMAP2; + + for (y = 0; y < sizeY; y++) + { + for (x = 0; x < sizeX; x++) + { + dst[y*sizeX*2 + x] = dst[y*sizeX*2 + (sizeX*2-x-1)] = src[y*sizeX + x]; + } + } + + sizeX <<= 1; + + for (y = 0; y < sizeY; y++) + { + memcpy (&dst[(sizeY*2-y-1)*sizeX], &dst[y*sizeX], sizeX*4); + } + + sizeY <<= 1; + glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, sizeX, sizeY, 0, GL_RGBA, GL_UNSIGNED_BYTE, texMAP2); + break; + } + } + + invTexWidth = 1.f/((float)sizeX*(1<<4)); + invTexHeight = 1.f/((float)sizeY*(1<<4)); + + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); + + // S Coordinate options + if (!BIT16(format)) + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP); + else + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); + + // T Coordinate options + if (!BIT17(format)) + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP); + else + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); + + texCoordinateTransform = (format>>30); + } +} + +void NDS_glBegin(unsigned long v) +{ + if (beginCalled) + { + glEnd(); + } + + // Light enable/disable + if (lightMask) + { + if (lightMask&1) glEnable (GL_LIGHT0); + else glDisable(GL_LIGHT0); + + if (lightMask&2) glEnable (GL_LIGHT1); + else glDisable(GL_LIGHT1); + + if (lightMask&4) glEnable (GL_LIGHT2); + else glDisable(GL_LIGHT2); + + if (lightMask&8) glEnable (GL_LIGHT3); + else glDisable(GL_LIGHT3); + + glEnable (GL_LIGHTING); + } + else + { + glDisable (GL_LIGHTING); + } + + // texture environment + glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, envMode); + + glDepthFunc (depthFuncMode); + + // Cull face + if (cullingMask != 0xC0) + { + glEnable(GL_CULL_FACE); + glCullFace(map3d_cull[cullingMask>>6]); + } + else + { + glDisable(GL_CULL_FACE); + } + + // Alpha value, actually not well handled, 0 should be wireframe + if (colorAlpha > 0.0f) + { + glPolygonMode (GL_FRONT, GL_FILL); + glPolygonMode (GL_BACK, GL_FILL); + /* + colorRGB[0] = 1.f; + colorRGB[1] = 1.f; + colorRGB[2] = 1.f; + */ + + colorRGB[3] = colorAlpha; + glColor4iv (colorRGB); + } + else + { + glPolygonMode (GL_FRONT, GL_LINE); + glPolygonMode (GL_BACK, GL_LINE); + } + + if (textureFormat != lastTextureFormat || + texturePalette != lastTexturePalette) + { + SetupTexture (textureFormat, texturePalette); + + lastTextureFormat = textureFormat; + lastTexturePalette = texturePalette; + } + + glMatrixMode (GL_TEXTURE); + glLoadIdentity (); + glScaled (invTexWidth, invTexHeight, 1.f); + + glMatrixMode (GL_PROJECTION); + glLoadMatrixf(mtxCurrent[0]); + + glMatrixMode (GL_MODELVIEW); + glLoadIdentity(); + + beginCalled = 1; + vtxFormat = polyType[v&3]; + glBegin(vtxFormat); +} + +void NDS_glEnd (void) +{ + if (beginCalled) + { + glEnd(); + beginCalled = 0; + } +} + +void NDS_glColor3b(unsigned long v) +{ + colorRGB[0] = (v&0x1F) << 26; + colorRGB[1] = ((v>>5)&0x1F) << 26; + colorRGB[2] = ((v>>10)&0x1F) << 26; + glColor4iv (colorRGB); +} + +static __inline void SetVertex() +{ + float coordTransformed[3] = { coord[0], coord[1], coord[2] }; + + if (texCoordinateTransform == 3) + { + int s2 = (int)(( coord[0]*mtxCurrent[3][0] + + coord[1]*mtxCurrent[3][4] + + coord[2]*mtxCurrent[3][8]) + s); + int t2 = (int)(( coord[0]*mtxCurrent[3][1] + + coord[1]*mtxCurrent[3][5] + + coord[2]*mtxCurrent[3][9]) + t); + + glTexCoord2i (s2, t2); + } + + MatrixMultVec4x4 (mtxCurrent[1], coordTransformed); + + glVertex3fv (coordTransformed); + + numVertex++; +} + +void NDS_glVertex16b(unsigned int v) +{ + if(coordind==0) + { + coord[0] = float16table[v&0xFFFF]; + coord[1] = float16table[v>>16]; + + ++coordind; + return; + } + + coord[2] = float16table[v&0xFFFF]; + + coordind = 0; + SetVertex (); +} + +void NDS_glVertex10b(unsigned long v) +{ + coord[0] = float10Table[v&1023]; + coord[1] = float10Table[(v>>10)&1023]; + coord[2] = float10Table[(v>>20)&1023]; + + SetVertex (); +} + +void NDS_glVertex3_cord(unsigned int one, unsigned int two, unsigned int v) +{ + coord[one] = float16table[v&0xffff]; + coord[two] = float16table[v>>16]; + + SetVertex (); +} + +void NDS_glVertex_rel(unsigned long v) +{ + coord[0] += float10RelTable[v&1023]; + coord[1] += float10RelTable[(v>>10)&1023]; + coord[2] += float10RelTable[(v>>20)&1023]; + + SetVertex (); +} + +// Ignored for now +void NDS_glSwapScreen(unsigned int screen) +{ +} + + +// THIS IS A HACK :D +int NDS_glGetNumPolys (void) +{ + return numVertex/3; +} + +int NDS_glGetNumVertex (void) +{ + return numVertex; +} + +void NDS_glGetLine (int line, unsigned short * dst) +{ + int i; + u8 *screen3D = (u8 *)&GPU_screen3D[(192-(line%192))*256*4]; + + for(i = 0; i < 256; i++) + { + u32 r = screen3D[i*4+0], + g = screen3D[i*4+1], + b = screen3D[i*4+2], + a = screen3D[i*4+3]; + + r = (r*a)/255; + g = (g*a)/255; + b = (b*a)/255; + + if (r != 0 || g != 0 || b != 0) + { + dst[i] = (((r>>3)<<10) | ((g>>3)<<5) | (b>>3)); + } + } +} + +void NDS_glFlush(unsigned long v) +{ + if (beginCalled) + { + glEnd(); + beginCalled = 0; + } + + clCmd = 0; + clInd = 0; + + glFlush(); + glReadPixels(0,0,256,192,GL_BGRA,GL_UNSIGNED_BYTE,GPU_screen3D); + + numVertex = 0; + + // Set back some secure render states + glPolygonMode (GL_BACK, GL_FILL); + glPolygonMode (GL_FRONT, GL_FILL); + + glDepthMask (GL_TRUE); + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +} + +void NDS_glPolygonAttrib (unsigned long val) +{ + u32 polygonID = (val>>24)&63; + + // Light enable/disable + lightMask = (val&0xF); + + // texture environment + envMode = texEnv[(val&0x30)>>4]; + + // overwrite depth on alpha pass + alphaDepthWrite = BIT11(val); + + // depth test function + depthFuncMode = depthFunc[BIT14(val)]; + + // back face culling + cullingMask = (val&0xC0); + + // Alpha value, actually not well handled, 0 should be wireframe + colorAlpha = ((val>>16)&0x1F)<<26; +} + +/* + 0-4 Diffuse Reflection Red + 5-9 Diffuse Reflection Green + 10-14 Diffuse Reflection Blue + 15 Set Vertex Color (0=No, 1=Set Diffuse Reflection Color as Vertex Color) + 16-20 Ambient Reflection Red + 21-25 Ambient Reflection Green + 26-30 Ambient Reflection Blue +*/ +void NDS_glMaterial0 (unsigned long val) +{ + int diffuse[4] = { (val&0x1F) << 26, + ((val>>5)&0x1F) << 26, + ((val>>10)&0x1F) << 26, + 0x7fffffff }, + ambient[4] = { ((val>>16)&0x1F) << 26, + ((val>>21)&0x1F) << 26, + ((val>>26)&0x1F) << 26, + 0x7fffffff }; + + if (BIT15(val)) + { + colorRGB[0] = diffuse[0]; + colorRGB[1] = diffuse[1]; + colorRGB[2] = diffuse[2]; + } + + if (beginCalled) + { + glEnd(); + } + + glMaterialiv (GL_FRONT_AND_BACK, GL_AMBIENT, ambient); + glMaterialiv (GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse); + + if (beginCalled) + { + glBegin (vtxFormat); + } +} + +void NDS_glMaterial1 (unsigned long val) +{ + int specular[4] = { (val&0x1F) << 26, + ((val>>5)&0x1F) << 26, + ((val>>10)&0x1F) << 26, + 0x7fffffff }, + emission[4] = { ((val>>16)&0x1F) << 26, + ((val>>21)&0x1F) << 26, + ((val>>26)&0x1F) << 26, + 0x7fffffff }; + + if (beginCalled) + { + glEnd(); + } + + glMaterialiv (GL_FRONT_AND_BACK, GL_SPECULAR, specular); + glMaterialiv (GL_FRONT_AND_BACK, GL_EMISSION, emission); + + if (beginCalled) + { + glBegin (vtxFormat); + } +} + +void NDS_glShininess (unsigned long val) +{ +} + +void NDS_glTexImage(unsigned long val) +{ + textureFormat = val; +} + +void NDS_glTexPalette(unsigned long val) +{ + texturePalette = val; +} + +void NDS_glTexCoord(unsigned long val) +{ + t = (s16)(val>>16); + s = (s16)(val&0xFFFF); + + if (texCoordinateTransform == 1) + { + int s2 =(int)( s* mtxCurrent[3][0] + t* mtxCurrent[3][4] + + (1.f/16.f)* mtxCurrent[3][8] + (1.f/16.f)* mtxCurrent[3][12]); + int t2 =(int)( s* mtxCurrent[3][1] + t* mtxCurrent[3][5] + + (1.f/16.f)* mtxCurrent[3][9] + (1.f/16.f)* mtxCurrent[3][13]); + + glTexCoord2i (s2, t2); + } + else + { + glTexCoord2i (s, t); + } +} + +signed long NDS_glGetClipMatrix (unsigned int index) +{ + float val = MatrixGetMultipliedIndex (index, mtxCurrent[0], mtxCurrent[1]); + + val *= (1<<12); + + return (signed long)val; +} + +signed long NDS_glGetDirectionalMatrix (unsigned int index) +{ + index += (index/3); + + return (signed long)(mtxCurrent[2][(index)*(1<<12)]); +} + + +/* + 0-9 Directional Vector's X component (1bit sign + 9bit fractional part) + 10-19 Directional Vector's Y component (1bit sign + 9bit fractional part) + 20-29 Directional Vector's Z component (1bit sign + 9bit fractional part) + 30-31 Light Number (0..3) +*/ + +void NDS_glLightDirection (unsigned long v) +{ + float lightDirection[4] = {0}; + lightDirection[0] = -normalTable[v&1023]; + lightDirection[1] = -normalTable[(v>>10)&1023]; + lightDirection[2] = -normalTable[(v>>20)&1023]; + + if (beginCalled) + { + glEnd(); + } + + glLightfv (GL_LIGHT0 + (v>>30), GL_POSITION, lightDirection); + + if (beginCalled) + { + glBegin (vtxFormat); + } +} + +void NDS_glLightColor (unsigned long v) +{ + int lightColor[4] = { ((v) &0x1F)<<26, + ((v>> 5)&0x1F)<<26, + ((v>>10)&0x1F)<<26, + 0x7fffffff}; + + if (beginCalled) + { + glEnd(); + } + + glLightiv (GL_LIGHT0 + (v>>30), GL_AMBIENT, lightColor); + glLightiv (GL_LIGHT0 + (v>>30), GL_DIFFUSE, lightColor); + glLightiv (GL_LIGHT0 + (v>>30), GL_SPECULAR, lightColor); + + if (beginCalled) + { + glBegin (vtxFormat); + } +} + +void NDS_glAlphaFunc(unsigned long v) +{ + glAlphaFunc (GL_GREATER, (v&31)/31.f); +} + +void NDS_glControl(unsigned long v) +{ + if(v&1) + { + glEnable (GL_TEXTURE_2D); + } + else + { + glDisable (GL_TEXTURE_2D); + } + + if(v&(1<<2)) + { + glEnable(GL_ALPHA_TEST); + } + else + { + glDisable(GL_ALPHA_TEST); + } + +/* + // Seems to broke hell a lot of stuff + if(v&(1<<3))// && !disableBlending) + { + /* + if (alphaDepthWrite) + { + glDepthMask (GL_TRUE); + } + else + { + glDepthMask (GL_FALSE); + //glDisable (GL_DEPTH_TEST); + } + *-/ + + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + //glBlendFunc (GL_ONE, GL_ONE); + //glBlendFunc (GL_SRC_ALPHA, GL_ONE); + glEnable (GL_BLEND); + } + else + { + glDepthMask (GL_TRUE); + glDisable(GL_BLEND); + } +*/ + if(v&(1<<7)) + { + int fog = 1; + } + + + if(v&(1<<4)) + { + glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE); + } +} + +void NDS_glNormal(unsigned long v) +{ + float normal[3] = { normalTable[v&1023], + normalTable[(v>>10)&1023], + normalTable[(v>>20)&1023]}; + + if (texCoordinateTransform == 2) + { + int s2 =(int)( (normal[0] *mtxCurrent[3][0] + normal[1] *mtxCurrent[3][4] + + normal[2] *mtxCurrent[3][8]) + s); + int t2 =(int)( (normal[0] *mtxCurrent[3][1] + normal[1] *mtxCurrent[3][5] + + normal[2] *mtxCurrent[3][9]) + t); + + glTexCoord2i (s2, t2); + } + + MatrixMultVec3x3 (mtxCurrent[2], normal); + + glNormal3fv(normal); +} + +void NDS_glCallList(unsigned long v) +{ + static unsigned long oldval = 0, shit = 0; + + if(!clInd) + { + clInd = 4; + clCmd = v; + return; + } + + + for (;;) + { + switch ((clCmd&0xFF)) + { + case 0x0: + { + --clInd; + + if (!clInd) + break; + + continue; + } + + case 0x11 : + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x444>>2] = v; + NDS_glPushMatrix(); + --clInd; + clCmd>>=8; + continue; + } + + case 0x15: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x454>>2] = v; + NDS_glLoadIdentity(); + --clInd; + clCmd>>=8; + break; + } + + case 0x41: + { + NDS_glEnd(); + --clInd; + clCmd>>=8; + continue; + } + } + + break; + } + + + if(!clInd) + { + clInd = 4; + clCmd = v; + return; + } + + switch(clCmd&0xFF) + { + case 0x10: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x440>>2] = v; + NDS_glMatrixMode (v); + --clInd; + clCmd>>=8; + break; + } + + case 0x12: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x448>>2] = v; + NDS_glPopMatrix(v); + --clInd; + clCmd>>=8; + break; + } + + case 0x13: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x44C>>2] = v; + NDS_glStoreMatrix(v); + --clInd; + clCmd>>=8; + break; + } + + case 0x14: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x450>>2] = v; + NDS_glRestoreMatrix (v); + --clInd; + clCmd>>=8; + break; + } + + case 0x16: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x458>>2] = v; + NDS_glLoadMatrix4x4(v); + clInd2++; + if(clInd2==16) + { + --clInd; + clCmd>>=8; + clInd2 = 0; + } + break; + } + + case 0x17: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x45C>>2] = v; + NDS_glLoadMatrix4x3(v); + clInd2++; + if(clInd2==12) + { + --clInd; + clCmd>>=8; + clInd2 = 0; + } + break; + } + + case 0x18: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x460>>2] = v; + NDS_glMultMatrix4x4(v); + clInd2++; + if(clInd2==16) + { + --clInd; + clCmd>>=8; + clInd2 = 0; + } + break; + } + + case 0x19: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x464>>2] = v; + NDS_glMultMatrix4x3(v); + clInd2++; + if(clInd2==12) + { + --clInd; + clCmd>>=8; + clInd2 = 0; + } + break; + } + + case 0x1A: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x468>>2] = v; + NDS_glMultMatrix3x3(v); + clInd2++; + if(clInd2==9) + { + --clInd; + clCmd>>=8; + clInd2 = 0; + } + break; + } + + case 0x1B: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x46C>>2] = v; + NDS_glScale (v); + clInd2++; + if(clInd2==3) + { + --clInd; + clCmd>>=8; + clInd2 = 0; + } + break; + } + + case 0x1C: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x470>>2] = v; + NDS_glTranslate (v); + clInd2++; + if(clInd2==3) + { + --clInd; + clCmd>>=8; + clInd2 = 0; + } + break; + } + + case 0x20 : + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x480>>2] = v; + NDS_glColor3b(v); + --clInd; + clCmd>>=8; + break; + } + + case 0x21 : + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x484>>2] = v; + NDS_glNormal(v); + --clInd; + clCmd>>=8; + break; + } + + case 0x22 : + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x488>>2] = v; + NDS_glTexCoord(v); + --clInd; + clCmd>>=8; + break; + } + + case 0x23 : + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x48C>>2] = v; + NDS_glVertex16b(v); + clInd2++; + if(clInd2==2) + { + --clInd; + clCmd>>=8; + clInd2 = 0; + } + break; + } + + case 0x24: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x490>>2] = v; + NDS_glVertex10b(v); + --clInd; + clCmd>>=8; + break; + } + + case 0x25:// GFX_VERTEX_XY + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x494>>2] = v; + NDS_glVertex3_cord(0,1,v); + --clInd; + clCmd>>=8; + break; + } + + case 0x26:// GFX_VERTEX_XZ + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x498>>2] = v; + NDS_glVertex3_cord(0,2,v); + --clInd; + clCmd>>=8; + break; + } + + case 0x27:// GFX_VERTEX_YZ + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x49C>>2] = v; + NDS_glVertex3_cord(1,2,v); + --clInd; + clCmd>>=8; + break; + } + + case 0x28: // GFX_VERTEX_DIFF + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x4A0>>2] = v; + NDS_glVertex_rel (v); + --clInd; + clCmd>>=8; + break; + } + + case 0x29: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x4A4>>2] = v; + NDS_glPolygonAttrib (v); + --clInd; + clCmd>>=8; + break; + } + + case 0x2A: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x4A8>>2] = v; + NDS_glTexImage (v); + --clInd; + clCmd>>=8; + break; + } + + case 0x2B: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x4AC>>2] = v; + NDS_glTexPalette (v&0x1FFF); + --clInd; + clCmd>>=8; + break; + } + + case 0x30: // GFX_DIFFUSE_AMBIENT + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x4C0>>2] = v; + NDS_glMaterial0(v); + --clInd; + clCmd>>=8; + break; + } + + case 0x31: // GFX_SPECULAR_EMISSION + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x4C4>>2] = v; + NDS_glMaterial1(v); + --clInd; + clCmd>>=8; + break; + } + + case 0x32: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x4C8>>2] = v; + NDS_glLightDirection(v); + --clInd; + clCmd>>=8; + break; + } + + case 0x33: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x4CC>>2] = v; + NDS_glLightColor(v); + --clInd; + clCmd>>=8; + break; + } + + case 0x34: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x4D0>>2] = v; + NDS_glShininess (v); + clInd2++; + if(clInd2==32) + { + --clInd; + clCmd>>=8; + clInd2 = 0; + } + break; + } + + case 0x40 : + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x500>>2] = v; + NDS_glBegin(v); + --clInd; + clCmd>>=8; + break; + } +/* + case 0x50: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x540>>2] = v; + NDS_glFlush(v); + --clInd; + clCmd>>=8; + break; + } +*/ + case 0x60: + { + ((unsigned long *)ARM9Mem.ARM9_REG)[0x580>>2] = v; + NDS_glViewPort(v); + --clInd; + clCmd>>=8; + break; + } +/* + case 0x80: + { + clInd2++; + if(clInd2==7) + { + --clInd; + clCmd>>=8; + clInd2 = 0; + } + + break; + } +*/ + default: + { + LOG ("Unknown 3D command %02X", clCmd&0xFF); + --clInd; + clCmd>>=8; + break; + } + } + if((clCmd&0xFF)==0x41) + { + glEnd(); + --clInd; + clCmd>>=8; + } +} + + +GPU3DInterface gpu3Dgl = { NDS_glInit, + NDS_glViewPort, + NDS_glClearColor, + NDS_glFogColor, + NDS_glFogOffset, + NDS_glClearDepth, + NDS_glMatrixMode, + NDS_glLoadIdentity, + NDS_glLoadMatrix4x4, + NDS_glLoadMatrix4x3, + NDS_glStoreMatrix, + NDS_glRestoreMatrix, + NDS_glPushMatrix, + NDS_glPopMatrix, + NDS_glTranslate, + NDS_glScale, + NDS_glMultMatrix3x3, + NDS_glMultMatrix4x3, + NDS_glMultMatrix4x4, + NDS_glBegin, + NDS_glEnd, + NDS_glColor3b, + NDS_glVertex16b, + NDS_glVertex10b, + NDS_glVertex3_cord, + NDS_glVertex_rel, + NDS_glSwapScreen, + NDS_glGetNumPolys, + NDS_glGetNumVertex, + NDS_glFlush, + NDS_glPolygonAttrib, + NDS_glMaterial0, + NDS_glMaterial1, + NDS_glShininess, + NDS_glTexImage, + NDS_glTexPalette, + NDS_glTexCoord, + NDS_glLightDirection, + NDS_glLightColor, + NDS_glAlphaFunc, + NDS_glControl, + NDS_glNormal, + NDS_glCallList, + + NDS_glGetClipMatrix, + NDS_glGetDirectionalMatrix, + NDS_glGetLine}; + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/OGLRender.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/OGLRender.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/OGLRender.h 1969-12-31 18:00:00.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/OGLRender.h 2007-03-16 23:07:34.000000000 -0500 @@ -0,0 +1,31 @@ +/* + Copyright (C) 2006 yopyop + Copyright (C) 2006-2007 shash + + This file is part of DeSmuME + + DeSmuME 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. + + DeSmuME 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 DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef OGLRENDER_H +#define OGLRENDER_H + +#include "../render3D.h" + +#define GPU3D_OPENGL 1 + +extern GPU3DInterface gpu3Dgl; + +#endif diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/palView.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/palView.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/palView.c 2006-10-04 19:16:43.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/palView.c 2007-02-18 14:01:10.000000000 -0600 @@ -27,7 +27,7 @@ ////////////////////////////////////////////////////////////////////////////// -LRESULT PalView_OnPaint(u16 * adr, u16 num, HWND hwnd, WPARAM wParam, LPARAM lParam) +LRESULT PalView_OnPaint(const u16 * adr, u16 num, HWND hwnd, WPARAM wParam, LPARAM lParam) { HDC hdc; PAINTSTRUCT ps; @@ -156,6 +156,7 @@ case IDC_PAL_SELECT : switch(HIWORD(wParam)) { + case CBN_SELCHANGE : case CBN_CLOSEUP : { u32 sel = SendMessage(GetDlgItem(hwnd, IDC_PAL_SELECT), CB_GETCURSEL, 0, 0); diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/resource.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/resource.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/resource.h 2007-01-26 02:07:48.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/resource.h 2007-05-18 13:59:21.000000000 -0500 @@ -23,7 +23,7 @@ #define RESOURCE_H #if 0 -#include "../NDSSystem.hpp" +#include "../NDSSystem.h" extern NDSSystem nds; extern BOOL execute; @@ -131,6 +131,12 @@ #define IDC_FRAMESKIP8 199 #define IDC_FRAMESKIP9 200 +#define IDM_IMPORTBACKUPMEMORY 201 + +#define IDC_LANGENGLISH 210 +#define IDC_LANGFRENCH 211 +#define IDC_LANGDANISH 212 + #define IDD_MEM_VIEWER 301 #define IDC_8_BIT 302 #define IDC_16_BIT 303 @@ -232,4 +238,9 @@ #define IDC_WINDOW3X 1012 #define IDC_WINDOW4X 1013 +#define IDM_FIRMSETTINGS 1100 +#define IDD_FIRMSETTINGS 1101 +#define IDC_EDIT1 1102 +#define IDC_EDIT2 1103 + #endif diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/resources.rc /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/resources.rc --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/resources.rc 2007-01-26 02:08:01.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/resources.rc 2007-05-18 13:59:21.000000000 -0500 @@ -29,7 +29,8 @@ // FRENCH //////////////////////////////////////////////////////////////////// LANGUAGE LANG_FRENCH,SUBLANG_FRENCH - +#pragma code_page(1252) + MENU_PRINCIPAL MENU { POPUP "&Fichier" @@ -37,8 +38,39 @@ MENUITEM "&Ouvrir", IDM_OPEN MENUITEM "&Info rom", IDM_GAME_INFO MENUITEM SEPARATOR - MENUITEM "&Printscreen", IDM_PRINTSCREEN - MENUITEM "&Quick Printscreen", IDM_QUICK_PRINTSCREEN + MENUITEM "Save State As", IDM_STATE_SAVE + MENUITEM "Load State As", IDM_STATE_LOAD + POPUP "Save State" + { + MENUITEM "1", IDM_STATE_SAVE_F1 + MENUITEM "2", IDM_STATE_SAVE_F2 + MENUITEM "3", IDM_STATE_SAVE_F3 + MENUITEM "4", IDM_STATE_SAVE_F4 + MENUITEM "5", IDM_STATE_SAVE_F5 + MENUITEM "6", IDM_STATE_SAVE_F6 + MENUITEM "7", IDM_STATE_SAVE_F7 + MENUITEM "8", IDM_STATE_SAVE_F8 + MENUITEM "9", IDM_STATE_SAVE_F9 + MENUITEM "10", IDM_STATE_SAVE_F10 + } + POPUP "Load State" + { + MENUITEM "1", IDM_STATE_LOAD_F1 + MENUITEM "2", IDM_STATE_LOAD_F2 + MENUITEM "3", IDM_STATE_LOAD_F3 + MENUITEM "4", IDM_STATE_LOAD_F4 + MENUITEM "5", IDM_STATE_LOAD_F5 + MENUITEM "6", IDM_STATE_LOAD_F6 + MENUITEM "7", IDM_STATE_LOAD_F7 + MENUITEM "8", IDM_STATE_LOAD_F8 + MENUITEM "9", IDM_STATE_LOAD_F9 + MENUITEM "10", IDM_STATE_LOAD_F10 + } + MENUITEM SEPARATOR + MENUITEM "Import Backup Memory", IDM_IMPORTBACKUPMEMORY + MENUITEM SEPARATOR + MENUITEM "Save Screenshot &As", IDM_PRINTSCREEN + MENUITEM "&Quick Screenshot", IDM_QUICK_PRINTSCREEN MENUITEM SEPARATOR MENUITEM "&Quitter", IDM_QUIT } @@ -68,6 +100,41 @@ //MENUITEM "&DeMagnify", IDC_DEMAGNIFY MENUITEM "&Force Maintain Ratio", IDC_FORCERATIO } + POPUP "&Config" + { + POPUP "&Save Type" + { + MENUITEM "Autodetect", IDC_SAVETYPE1 + MENUITEM "EEPROM 4kbit", IDC_SAVETYPE2 + MENUITEM "EEPROM 64kbit", IDC_SAVETYPE3 + MENUITEM "EEPROM 512kbit", IDC_SAVETYPE4 + MENUITEM "FRAM 256kbit", IDC_SAVETYPE5 + MENUITEM "FLASH 2mbit", IDC_SAVETYPE6 + } + MENUITEM "Control Config", IDM_CONFIG + MENUITEM "Sound Settings", IDM_SOUNDSETTINGS + MENUITEM "Firmware Settings", IDM_FIRMSETTINGS + POPUP "&Frame Skip" + { + MENUITEM "Auto", IDC_FRAMESKIPAUTO + MENUITEM "0", IDC_FRAMESKIP0 + MENUITEM "1", IDC_FRAMESKIP1 + MENUITEM "2", IDC_FRAMESKIP2 + MENUITEM "3", IDC_FRAMESKIP3 + MENUITEM "4", IDC_FRAMESKIP4 + MENUITEM "5", IDC_FRAMESKIP5 + MENUITEM "6", IDC_FRAMESKIP6 + MENUITEM "7", IDC_FRAMESKIP7 + MENUITEM "8", IDC_FRAMESKIP8 + MENUITEM "9", IDC_FRAMESKIP9 + } + POPUP "&Language" + { + MENUITEM "English", IDC_LANGENGLISH + MENUITEM "French", IDC_LANGFRENCH + MENUITEM "Danish", IDC_LANGDANISH + } + } POPUP "&Outils" { MENUITEM "&Desassembleur", IDM_DISASSEMBLER @@ -92,9 +159,14 @@ MENUITEM "Sub BG 3", IDM_SBG3, CHECKED } } + POPUP "&Help" + { + MENUITEM "&Website", IDM_WEBSITE + MENUITEM "&Forums", IDM_FORUM + MENUITEM "&Submit a bug report", IDM_SUBMITBUGREPORT + } } - IDD_MEM_VIEWER DIALOG DISCARDABLE 0, 0, 428, 178 STYLE WS_SYSMENU CAPTION "Visualisation de la memoire" @@ -307,7 +379,8 @@ // ENGLISH /////////////////////////////////////////////////////////////////// LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US - +#pragma code_page(1252) + MENU_PRINCIPAL MENU { POPUP "&File" @@ -344,6 +417,8 @@ MENUITEM "10", IDM_STATE_LOAD_F10 } MENUITEM SEPARATOR + MENUITEM "Import Backup Memory", IDM_IMPORTBACKUPMEMORY + MENUITEM SEPARATOR MENUITEM "Save Screenshot &As", IDM_PRINTSCREEN MENUITEM "&Quick Screenshot", IDM_QUICK_PRINTSCREEN MENUITEM SEPARATOR @@ -388,6 +463,7 @@ } MENUITEM "Control Config", IDM_CONFIG MENUITEM "Sound Settings", IDM_SOUNDSETTINGS + MENUITEM "Firmware Settings", IDM_FIRMSETTINGS POPUP "&Frame Skip" { MENUITEM "Auto", IDC_FRAMESKIPAUTO @@ -402,6 +478,12 @@ MENUITEM "8", IDC_FRAMESKIP8 MENUITEM "9", IDC_FRAMESKIP9 } + POPUP "&Language" + { + MENUITEM "English", IDC_LANGENGLISH + MENUITEM "French", IDC_LANGFRENCH + MENUITEM "Danish", IDC_LANGDANISH + } } POPUP "&Tools" { @@ -707,6 +789,463 @@ PUSHBUTTON "&Cancel",IDCANCEL,127,78,40,14 END + +IDD_FIRMSETTINGS DIALOG DISCARDABLE 0, 0, 161, 145 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Firmware Settings" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "&OK",IDOK,7,124,50,14 + PUSHBUTTON "&Cancel",IDCANCEL,104,124,50,14 + CONTROL "Favourite Color:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | + WS_GROUP,9,55,52,12 + COMBOBOX IDC_COMBO1,66,53,84,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + CONTROL "Birth Month:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | + WS_GROUP,9,72,52,12 + COMBOBOX IDC_COMBO2,66,71,84,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + CONTROL "Birthday:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | + WS_GROUP,9,90,52,12 + COMBOBOX IDC_COMBO3,66,88,84,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + CONTROL "Language:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | + WS_GROUP,9,106,52,12 + COMBOBOX IDC_COMBO4,66,105,84,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + CONTROL "Nickname:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | + WS_GROUP,9,17,52,12 + EDITTEXT IDC_EDIT1,66,14,82,14,ES_AUTOHSCROLL | ES_WANTRETURN | WS_GROUP + CONTROL "Message:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | + WS_GROUP,9,36,52,12 + EDITTEXT IDC_EDIT2,66,33,82,14,ES_AUTOHSCROLL | ES_WANTRETURN | WS_GROUP +END + +// DANISH //////////////////////////////////////////////////////////////////// + +LANGUAGE LANG_DANISH,SUBLANG_DEFAULT +#pragma code_page(1252) + +MENU_PRINCIPAL MENU +{ +POPUP "&Fil" +{ + MENUITEM "&Åbn", IDM_OPEN + MENUITEM "Rom &Info", IDM_GAME_INFO + MENUITEM SEPARATOR + MENUITEM "Gem Stadie Som", IDM_STATE_SAVE + MENUITEM "Indlæs Stadie Som", IDM_STATE_LOAD +POPUP "Gem Stadie" +{ + MENUITEM "1", IDM_STATE_SAVE_F1 + MENUITEM "2", IDM_STATE_SAVE_F2 + MENUITEM "3", IDM_STATE_SAVE_F3 + MENUITEM "4", IDM_STATE_SAVE_F4 + MENUITEM "5", IDM_STATE_SAVE_F5 + MENUITEM "6", IDM_STATE_SAVE_F6 + MENUITEM "7", IDM_STATE_SAVE_F7 + MENUITEM "8", IDM_STATE_SAVE_F8 + MENUITEM "9", IDM_STATE_SAVE_F9 + MENUITEM "10", IDM_STATE_SAVE_F10 +} +POPUP "Indlæs Stadie" +{ + MENUITEM "1", IDM_STATE_LOAD_F1 + MENUITEM "2", IDM_STATE_LOAD_F2 + MENUITEM "3", IDM_STATE_LOAD_F3 + MENUITEM "4", IDM_STATE_LOAD_F4 + MENUITEM "5", IDM_STATE_LOAD_F5 + MENUITEM "6", IDM_STATE_LOAD_F6 + MENUITEM "7", IDM_STATE_LOAD_F7 + MENUITEM "8", IDM_STATE_LOAD_F8 + MENUITEM "9", IDM_STATE_LOAD_F9 + MENUITEM "10", IDM_STATE_LOAD_F10 +} + MENUITEM SEPARATOR + MENUITEM "Importere Backup Hukommelse", IDM_IMPORTBACKUPMEMORY + MENUITEM SEPARATOR + MENUITEM "Gem Skærmbillede &Som", IDM_PRINTSCREEN + MENUITEM "&Hurtigt Skærmbillede", IDM_QUICK_PRINTSCREEN + MENUITEM SEPARATOR + MENUITEM "&Afslut", IDM_QUIT +} +POPUP "&Emulation" +{ + MENUITEM "&Start", IDM_EXEC + MENUITEM "&Pause", IDM_PAUSE + MENUITEM "&Genstart", IDM_RESET +} +POPUP "&Vis" +{ + POPUP "&Rotation" + { + MENUITEM " 0 Grader", IDC_ROTATE0 + MENUITEM " 90 Grader", IDC_ROTATE90 + MENUITEM "180 Grader", IDC_ROTATE180 + MENUITEM "270 Grader", IDC_ROTATE270 + } + POPUP "Vindue &Størrelse" + { + MENUITEM "1x", IDC_WINDOW1X + MENUITEM "2x", IDC_WINDOW2X + MENUITEM "3x", IDC_WINDOW3X + MENUITEM "4x", IDC_WINDOW4X +} + //MENUITEM "&Magnify", IDC_MAGNIFY + //MENUITEM "&DeMagnify", IDC_DEMAGNIFY + MENUITEM "&Bevar Højde og Bredde", IDC_FORCERATIO +} +POPUP "&Konfigure" +{ +POPUP "&Vælg Hukommelse Type" +{ + MENUITEM "Vælg Automatisk", IDC_SAVETYPE1 + MENUITEM "EEPROM 4kbit", IDC_SAVETYPE2 + MENUITEM "EEPROM 64kbit", IDC_SAVETYPE3 + MENUITEM "EEPROM 512kbit", IDC_SAVETYPE4 + MENUITEM "FRAM 256kbit", IDC_SAVETYPE5 + MENUITEM "FLASH 2mbit", IDC_SAVETYPE6 +} + MENUITEM "Indput Indstillinger", IDM_CONFIG + MENUITEM "Lyd Indstillinger", IDM_SOUNDSETTINGS + MENUITEM "Firmware Indstillinger", IDM_FIRMSETTINGS +POPUP "&Frame Skip" +{ + MENUITEM "Auto", IDC_FRAMESKIPAUTO + MENUITEM "0", IDC_FRAMESKIP0 + MENUITEM "1", IDC_FRAMESKIP1 + MENUITEM "2", IDC_FRAMESKIP2 + MENUITEM "3", IDC_FRAMESKIP3 + MENUITEM "4", IDC_FRAMESKIP4 + MENUITEM "5", IDC_FRAMESKIP5 + MENUITEM "6", IDC_FRAMESKIP6 + MENUITEM "7", IDC_FRAMESKIP7 + MENUITEM "8", IDC_FRAMESKIP8 + MENUITEM "9", IDC_FRAMESKIP9 +} + POPUP "&Language" + { + MENUITEM "English", IDC_LANGENGLISH + MENUITEM "French", IDC_LANGFRENCH + MENUITEM "Danish", IDC_LANGDANISH + } +} +POPUP "&Værktøjer" +{ + MENUITEM "&Disassembler", IDM_DISASSEMBLER + MENUITEM "Vis &Hukommelse", IDM_MEMORY + MENUITEM "Vis &Register", IDM_IOREG + // MENUITEM "Vis Logbog", IDM_LOG + MENUITEM "Vis &Palette", IDM_PAL + MENUITEM "Vis &Tiles", IDM_TILE + MENUITEM "Vis M&aps", IDM_MAP + MENUITEM "Vis &OAM", IDM_OAM + MENUITEM SEPARATOR +POPUP "&Vis &Lag" +{ + MENUITEM "Hoved Baggrund 0", IDM_MBG0, CHECKED + MENUITEM "Hoved Baggrund 1", IDM_MBG1, CHECKED + MENUITEM "Hoved Baggrund 2", IDM_MBG2, CHECKED + MENUITEM "Hoved Baggrund 3", IDM_MBG3, CHECKED + MENUITEM SEPARATOR + MENUITEM "Under Baggrund 0", IDM_SBG0, CHECKED + MENUITEM "Under Baggrund 1", IDM_SBG1, CHECKED + MENUITEM "Under Baggrund 2", IDM_SBG2, CHECKED + MENUITEM "Under Baggrund 3", IDM_SBG3, CHECKED +} +} +POPUP "&Hjælp" +{ + MENUITEM "&Hjemmeside", IDM_WEBSITE + MENUITEM "&Forums", IDM_FORUM + MENUITEM "&Indsend Fejl Rapport", IDM_SUBMITBUGREPORT +} +} + +IDD_CONFIG DIALOG DISCARDABLE 0, 0, 125, 227 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | WS_POPUP | WS_CAPTION +CAPTION "Konfigurer Input" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDC_FERMER,67,208,50,14 + PUSHBUTTON "Standard",IDC_BUTTON1,7,208,50,14 + COMBOBOX IDC_COMBO1,46,13,59,14,CBS_DROPDOWNLIST | WS_VSCROLL |WS_TABSTOP + LTEXT "Op:",IDC_STATIC,17,14,27,10 + COMBOBOX IDC_COMBO4,46,29,59,14,CBS_DROPDOWNLIST | WS_VSCROLL |WS_TABSTOP + LTEXT "Ned:",IDC_STATIC,17,31,28,9 + COMBOBOX IDC_COMBO2,46,45,59,14,CBS_DROPDOWNLIST | WS_VSCROLL |WS_TABSTOP + LTEXT "Venstre:",IDC_STATIC,17,47,28,9 + COMBOBOX IDC_COMBO3,46,61,59,14,CBS_DROPDOWNLIST | WS_VSCROLL |WS_TABSTOP + LTEXT "Højre:",IDC_STATIC,17,63,28,9 + COMBOBOX IDC_COMBO7,46,77,59,14,CBS_DROPDOWNLIST | WS_VSCROLL |WS_TABSTOP + LTEXT "A:",IDC_STATIC,18,78,28,9 + COMBOBOX IDC_COMBO8,46,92,59,14,CBS_DROPDOWNLIST | WS_VSCROLL |WS_TABSTOP + LTEXT "B:",IDC_STATIC,17,94,28,9 + COMBOBOX IDC_COMBO10,46,108,59,14,CBS_DROPDOWNLIST | WS_VSCROLL|WS_TABSTOP + LTEXT "L:",IDC_STATIC,17,110,28,9 + COMBOBOX IDC_COMBO11,46,124,59,14,CBS_DROPDOWNLIST | WS_VSCROLL|WS_TABSTOP + LTEXT "R:",IDC_STATIC,17,126,28,9 + COMBOBOX IDC_COMBO6,46,140,59,14,CBS_DROPDOWNLIST | WS_VSCROLL |WS_TABSTOP + LTEXT "X:",IDC_STATIC,17,142,28,9 + COMBOBOX IDC_COMBO5,46,156,59,14,CBS_DROPDOWNLIST | WS_VSCROLL |WS_TABSTOP + LTEXT "Y:",IDC_STATIC,17,158,28,9 + GROUPBOX "",IDC_STATIC,7,3,111,203 + COMBOBOX IDC_COMBO9,46,172,59,14,CBS_DROPDOWNLIST | WS_VSCROLL |WS_TABSTOP + LTEXT "Start:",IDC_STATIC,17,174,28,9 + COMBOBOX IDC_COMBO12,46,188,59,14,CBS_DROPDOWNLIST | WS_VSCROLL| WS_TABSTOP + LTEXT "Select:",IDC_STATIC,17,190,28,9 +END + +IDD_MEM_VIEWER DIALOG DISCARDABLE 0, 0, 428, 178 +STYLE WS_SYSMENU +CAPTION "Vis Hukommelse" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "8 bit",IDC_8_BIT,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,10,4,29,10 + CONTROL "16 bit",IDC_16_BIT,"Button",BS_AUTORADIOBUTTON,44,4,33,10 + CONTROL "32 bit",IDC_32_BIT,"Button",BS_AUTORADIOBUTTON,82,4,33,10 + LTEXT "Gå Til:",IDC_STATIC,130,4,33,10 + EDITTEXT IDC_GOTOMEM,155,1,82,14,ES_UPPERCASE | ES_AUTOHSCROLL | + ES_WANTRETURN | WS_GROUP + PUSHBUTTON "&Start",IDC_GO,240,1,20,14 + CONTROL "Auto-opdatere",IDC_AUTO_UPDATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,350,1,75,14 + CONTROL "Rediger", IDC_MEM_BOX,"MemViewBox",WS_TABSTOP | + WS_VSCROLL,4,16,424,142,WS_EX_CLIENTEDGE + PUSHBUTTON "&Luk",IDC_FERMER,185,162,50,14 +END + +IDD_DESASSEMBLEUR_VIEWER DIALOG DISCARDABLE 0, 0, 380, 186 +STYLE WS_SYSMENU +CAPTION "Disassembler" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Auto ",IDC_AUTO_DES,"Button",BS_AUTORADIOBUTTON | WS_GROUP,10,4,35,10 + CONTROL "ARM",IDC_ARM,"Button",BS_AUTORADIOBUTTON,44,4,35,10 + CONTROL "Thumb",IDC_THUMB,"Button",BS_AUTORADIOBUTTON,82,4,40,10 + LTEXT "Gå til:",IDC_STATIC,130,4,33,10 + EDITTEXT IDC_GOTODES,155,1,82,14,ES_UPPERCASE | ES_AUTOHSCROLL |ES_WANTRETURN | WS_GROUP + PUSHBUTTON "&Start",IDC_GO,240,1,20,14 + CONTROL "Auto-opdatere",IDC_AUTO_UPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,300,1,75,14 + CONTROL "Rediger", IDC_DES_BOX,"DesViewBox",WS_TABSTOP |WS_VSCROLL,4,16,296,150,WS_EX_CLIENTEDGE + PUSHBUTTON "&Luk",IDC_FERMER,185,170,50,14 + EDITTEXT IDC_SETPNUM,5,170,65,14,ES_UPPERCASE | ES_AUTOHSCROLL |WS_GROUP | ES_NUMBER + PUSHBUTTON "&Step",IDC_STEP,75,170,50,14 + LTEXT "R0 :",IDC_STATIC,304,16,17,8 + LTEXT "R1 :",IDC_STATIC,304,24,17,8 + LTEXT "R2 :",IDC_STATIC,304,32,17,8 + LTEXT "R3 :",IDC_STATIC,304,40,17,8 + LTEXT "R4 :",IDC_STATIC,304,48,17,8 + LTEXT "R5 :",IDC_STATIC,304,56,17,8 + LTEXT "R6 :",IDC_STATIC,304,64,17,8 + LTEXT "R7 :",IDC_STATIC,304,72,17,8 + LTEXT "R8 :",IDC_STATIC,304,80,17,8 + LTEXT "R9 :",IDC_STATIC,304,88,17,8 + LTEXT "R10 :",IDC_STATIC,304,96,17,8 + LTEXT "R11 :",IDC_STATIC,304,104,17,8 + LTEXT "R12 :",IDC_STATIC,304,112,17,8 + LTEXT "SP :",IDC_STATIC,304,120,17,8 + LTEXT "LR :",IDC_STATIC,304,128,17,8 + LTEXT "PC :",IDC_STATIC,304,136,17,8 + LTEXT "Mode :",IDC_STATIC,304,158,22,8 + LTEXT "SPSR :",IDC_STATIC,304,168,22,8 + LTEXT "00000000",IDC_R0,325,16,40,8 + LTEXT "00000000",IDC_R1,325,24,40,8 + LTEXT "00000000",IDC_R2,325,32,40,8 + LTEXT "00000000",IDC_R3,325,40,40,8 + LTEXT "00000000",IDC_R4,325,48,40,8 + LTEXT "00000000",IDC_R5,325,56,40,8 + LTEXT "00000000",IDC_R6,325,64,40,8 + LTEXT "00000000",IDC_R7,325,72,40,8 + LTEXT "00000000",IDC_R8,325,80,40,8 + LTEXT "00000000",IDC_R9,325,88,40,8 + LTEXT "00000000",IDC_R10,325,96,40,8 + LTEXT "00000000",IDC_R11,325,104,40,8 + LTEXT "00000000",IDC_R12,325,112,40,8 + LTEXT "00000000",IDC_R13,325,120,40,8 + LTEXT "00000000",IDC_R14,325,128,40,8 + LTEXT "00000000",IDC_R15,325,136,40,8 + LTEXT "",IDC_MODE,327,158,28,8 + LTEXT "",IDC_TMP,327,168,40,8 +END + +IDD_GAME_INFO DIALOG DISCARDABLE 0, 0, 150, 150 +STYLE WS_VISIBLE | WS_SYSMENU +CAPTION "ROM Information" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "&Luk",IDC_FERMER,50,134,50,14 + LTEXT "Spillets Navn:",IDC_STATIC,4,4,51,8 + LTEXT "Kode:",IDC_STATIC,4,12,51,8 + LTEXT "Fabrikant:",IDC_STATIC,4,20,51,8 + LTEXT "Størrelse:",IDC_STATIC,4,28,51,8 + LTEXT "ARM9 Størrelse:",IDC_STATIC,4,36,51,8 + LTEXT "ARM7 Størrelse:",IDC_STATIC,4,44,51,8 + LTEXT "Data:",IDC_STATIC,4,52,51,8 + LTEXT "",IDC_NOM_JEU,60,4,100,8 + LTEXT "",IDC_CDE,60,12,100,8 + LTEXT "",IDC_FAB,60,20,100,8 + LTEXT "",IDC_TAILLE,60,28,100,8 + LTEXT "",IDC_ARM9_T,60,36,100,8 + LTEXT "",IDC_ARM7_T,60,44,100,8 + LTEXT "",IDC_DATA,60,52,100,8 +END + +IDD_IO_REG DIALOG DISCARDABLE 0, 0, 150, 150 +STYLE WS_SYSMENU +CAPTION "IO Registre" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "&Luk",IDC_FERMER,50,134,50,14 + LTEXT "Int Handler :",IDC_STATIC,4,4,41,8 + LTEXT "IE :",IDC_STATIC,4,12,41,8 + LTEXT "IME :",IDC_STATIC,4,20,41,8 + LTEXT "DISPCNT :",IDC_STATIC,4,28,41,8 + LTEXT "DISPSTAT :",IDC_STATIC,4,36,41,8 + LTEXT "IPCSYNC :",IDC_STATIC,4,44,41,8 + LTEXT "IPCFIFO :",IDC_STATIC,4,52,41,8 + LTEXT "",IDC_INTHAND,45,4,100,8 + LTEXT "",IDC_IE,45,12,130,8 + LTEXT "",IDC_IME,45,20,130,8 + LTEXT "",IDC_DISPCNT,45,28,130,8 + LTEXT "",IDC_DISPSTAT,45,36,130,8 + LTEXT "",IDC_IPCSYNC,45,44,130,8 + LTEXT "",IDC_IPCFIFO,45,52,130,8 +END + +IDD_LOG DIALOG DISCARDABLE 0, 0, 300, 300 +STYLE WS_SYSMENU +CAPTION "Logbog" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Rediger", IDC_LOG,"LogView",WS_TABSTOP |WS_VSCROLL,4,4,292,280,WS_EX_CLIENTEDGE + PUSHBUTTON "&Luk",IDC_FERMER,125,285,50,14 +END + +IDD_PAL DIALOG DISCARDABLE 0, 0, 120, 165 +STYLE WS_SYSMENU +CAPTION "Palette Fremvisning" +FONT 8, "MS Sans Serif" +BEGIN + COMBOBOX IDC_PAL_SELECT, 15, 3, 90, 14, WS_TABSTOP | CBS_DROPDOWN + LTEXT "Pal : 0",IDC_PALNUM,3,21,25,8 + SCROLLBAR IDC_SCROLLER,30,18,20,14, SBS_HORZ + CONTROL "Auto-opdatere",IDC_AUTO_UPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,60,18,75,14 + PUSHBUTTON "&Luk",IDC_FERMER,35,149,50,14 +END + +IDD_TILE DIALOG DISCARDABLE 0, 0, 446, 180 +STYLE WS_SYSMENU +CAPTION "TILE Fremvisning" +FONT 8, "MS Sans Serif" +BEGIN + COMBOBOX IDC_PAL_SELECT, 4, 13, 90, 14, WS_TABSTOP |CBS_DROPDOWN + LTEXT "Pal : 0",IDC_PALNUM,4,31,25,8 + SCROLLBAR IDC_SCROLLER,30,28,20,14, SBS_HORZ + COMBOBOX IDC_MEM_SELECT, 4, 50, 90, 14, WS_TABSTOP | CBS_DROPDOWN + CONTROL "Bitmap",IDC_BITMAP,"Button",BS_AUTORADIOBUTTON |WS_GROUP,4,68,35,10 + CONTROL "256 Farver",IDC_256COUL,"Button",BS_AUTORADIOBUTTON,4,80,55,10 + CONTROL "16 Farver",IDC_16COUL,"Button",BS_AUTORADIOBUTTON,4,92,50,10 + CONTROL "Auto-opdatere",IDC_AUTO_UPDATE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,369,164,75,14 + CONTROL "Rediger", IDC_Tile_BOX,"TileViewBox",WS_TABSTOP,100,2,344,160,WS_EX_CLIENTEDGE + CONTROL "Rediger", IDC_MINI_TILE,"MiniTileViewBox",WS_TABSTOP,22,116,56,52,WS_EX_CLIENTEDGE + LTEXT "Tile Num : 0",IDC_TILENUM,23,170,100,8 + PUSHBUTTON "&Luk",IDC_FERMER,198,164,50,14 +END + +IDD_MAP DIALOG DISCARDABLE 0, 0, 485, 320 +STYLE WS_SYSMENU +CAPTION "MAP Fremviser" +FONT 8, "MS Sans Serif" +BEGIN + COMBOBOX IDC_BG_SELECT, 4, 4, 90, 14, WS_TABSTOP | CBS_DROPDOWN + LTEXT "Mode :",IDC_STATIC,4,20,45,8 + LTEXT "Palette :",IDC_STATIC,4,30,45,8 + LTEXT "Prio :",IDC_STATIC,4,40,45,8 + LTEXT "Char base :",IDC_STATIC,4,50,45,8 + LTEXT "Skærm base :",IDC_STATIC,4,60,45,8 + LTEXT "Størrelse :",IDC_STATIC,4,70,45,8 + LTEXT "Scroll :",IDC_STATIC,4,80,45,8 + LTEXT "",IDC_MODE,48,20,85,8 + LTEXT "",IDC_PAL,48,30,85,8 + LTEXT "",IDC_PRIO,48,40,85,8 + LTEXT "",IDC_CHAR,48,50,85,8 + LTEXT "",IDC_SCR,48,60,85,8 + LTEXT "",IDC_MSIZE,48,70,85,8 + LTEXT "",IDC_SCROLL,48,80,85,8 + // CONTROL "Rediger", IDC_MAP_BOX,"MapViewBox",WS_TABSTOP | WS_VSCROLL | WS_HSCROLL,4,16,296,150,WS_EX_CLIENTEDGE + PUSHBUTTON "&Luk",IDC_FERMER,4,300,50,14 +END + +IDD_OAM DIALOG DISCARDABLE 0, 0, 300, 200//150, 150 +STYLE WS_SYSMENU +CAPTION "OAM Fremviser" +FONT 8, "MS Sans Serif" +BEGIN + COMBOBOX IDC_SCR_SELECT, 4, 4, 90, 14, WS_TABSTOP | CBS_DROPDOWN + SCROLLBAR IDC_SCROLLER,48,20,20,14, SBS_HORZ + LTEXT "Mode :",IDC_STATIC,4,36,45,8 + LTEXT "Tile :",IDC_STATIC,4,46,45,8 + LTEXT "Palette :",IDC_STATIC,4,56,45,8 + LTEXT "Prio :",IDC_STATIC,4,66,45,8 + LTEXT "Koordinater :",IDC_STATIC,4,76,45,8 + LTEXT "Dimension :",IDC_STATIC,4,86,45,8 + LTEXT "Rotation :",IDC_STATIC,4,96,45,8 + LTEXT "Mosaic :",IDC_STATIC,4,106,45,8 + LTEXT "OAM : 0",IDC_OAMNUM,4,24,40,8 + LTEXT "",IDC_MODE,48,36,42,8 + LTEXT "",IDC_TILE,48,46,72,8 + LTEXT "",IDC_PAL,48,56,72,8 + LTEXT "",IDC_PRIO,48,66,72,8 + LTEXT "",IDC_COOR,48,76,42,8 + LTEXT "",IDC_DIM,48,86,42,8 + LTEXT "",IDC_ROT,48,96,42,8 + LTEXT "",IDC_MOS,48,106,42,8 + LTEXT "",IDC_PROP0,4,116,86,8 + LTEXT "",IDC_PROP1,4,126,86,8 + // CONTROL "Rediger", IDC_OAM_BOX,"OAMViewBox",WS_TABSTOP,100,50,45,42,WS_EX_CLIENTEDGE + PUSHBUTTON "&Luk",IDC_FERMER,50,134,50,14 +END + +SOUNDSETTINGSDLG DIALOG DISCARDABLE 0, 0, 174, 96 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Lyd Indstillinger" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Lyd Indstillinger", -1, 3, 2, 168, 28, WS_CHILD | WS_VISIBLE + LTEXT "Lyd Driver", -1, 10, 14, 40, 10 + COMBOBOX IDC_SOUNDCORECB, 54, 13, 110, 33, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Andre Indstillinger", -1, 3, 31, 168, 43, WS_CHILD | WS_VISIBLE + LTEXT "Buffer Størrelse", -1, 10, 42, 60, 10 + EDITTEXT IDC_SOUNDBUFFERET, 136, 41, 28, 13 + LTEXT "Volumen", -1, 10, 57, 30, 10 + CONTROL "", IDC_SLVOLUME, "msctls_trackbar32", WS_VISIBLE | WS_CHILD, 40, 57, 128, 10 + DEFPUSHBUTTON "&OK",IDOK,82,78,40,14 + PUSHBUTTON "&Fortryd",IDCANCEL,127,78,40,14 +END + +IDD_FIRMSETTINGS DIALOG DISCARDABLE 0, 0, 161, 145 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Firmware Indstillinger" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "&OK",IDOK,7,124,50,14 + PUSHBUTTON "&Fortryd",IDCANCEL,104,124,50,14 + CONTROL "Favorit Farve:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,9,55,52,12 + COMBOBOX IDC_COMBO1,66,53,84,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + CONTROL "Fødselsmåned:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,9,72,52,12 + COMBOBOX IDC_COMBO2,66,71,84,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + CONTROL "Fødselsdag:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,9,90,52,12 + COMBOBOX IDC_COMBO3,66,88,84,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + CONTROL "Sprog:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,9,106,52,12 + COMBOBOX IDC_COMBO4,66,105,84,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + CONTROL "Kælenavn:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,9,17,52,12 + EDITTEXT IDC_EDIT1,66,14,82,14,ES_AUTOHSCROLL | ES_WANTRETURN | WS_GROUP + CONTROL "Besked:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,9,36,52,12 + EDITTEXT IDC_EDIT2,66,33,82,14,ES_AUTOHSCROLL | ES_WANTRETURN | WS_GROUP +END + +////////////////////////////////////////////////////////////////////////////// + +LANGUAGE LANG_NEUTRAL,SUBLANG_NEUTRAL + IDR_MAIN_ACCEL ACCELERATORS DISCARDABLE BEGIN VK_F1, IDM_STATE_SAVE_F1, VIRTKEY, SHIFT, NOINVERT @@ -732,3 +1271,4 @@ END ////////////////////////////////////////////////////////////////////////////// + diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/snddx.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/snddx.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/snddx.c 2007-01-16 21:19:08.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/snddx.c 2007-02-05 17:05:00.000000000 -0600 @@ -125,7 +125,8 @@ { if (ret == DSERR_CONTROLUNAVAIL || ret == DSERR_INVALIDCALL || - ret == E_FAIL) + ret == E_FAIL || + ret == E_NOTIMPL) { // Try using a software buffer instead dsbdesc.dwFlags = DSBCAPS_GLOBALFOCUS | DSBCAPS_STICKYFOCUS | diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/tileView.c /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/tileView.c --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/tileView.c 2006-11-30 15:43:48.000000000 -0600 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/tileView.c 2007-02-18 14:01:10.000000000 -0600 @@ -475,6 +475,7 @@ case IDC_MEM_SELECT : switch(HIWORD(wParam)) { + case CBN_SELCHANGE : case CBN_CLOSEUP : { u32 sel = SendMessage(GetDlgItem(hwnd, IDC_MEM_SELECT), CB_GETCURSEL, 0, 0); @@ -527,6 +528,7 @@ case IDC_PAL_SELECT : switch(HIWORD(wParam)) { + case CBN_SELCHANGE : case CBN_CLOSEUP : { u32 sel = SendMessage(GetDlgItem(hwnd, IDC_PAL_SELECT), CB_GETCURSEL, 0, 0); diff -Nru /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/yopyop_private.h /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/yopyop_private.h --- /tmp/bSLAZZZKhC/desmume-0.6.0/src/windows/yopyop_private.h 2006-10-04 19:16:43.000000000 -0500 +++ /tmp/4ejbOOI7Zw/desmume-0.7.3/src/windows/yopyop_private.h 2007-03-24 23:42:46.000000000 -0500 @@ -5,11 +5,11 @@ #define YOPYOP_PRIVATE_H /* VERSION DEFINITIONS */ -#define VER_STRING "0.0.0.1" +#define VER_STRING "0.0.7.0" #define VER_MAJOR 0 #define VER_MINOR 0 -#define VER_RELEASE 0 -#define VER_BUILD 1 +#define VER_RELEASE 7 +#define VER_BUILD 0 #define COMPANY_NAME "yopyop" #define FILE_VERSION "" #define FILE_DESCRIPTION "NDS(tm) emulator"