From f754a017b9add0958ba8a0dc1212e416912543ba Mon Sep 17 00:00:00 2001 From: John Lee Date: Thu, 17 Jan 2008 08:49:53 +0000 Subject: (Merge OM mtn modification back into mainline) Add fbset by Dodji's request. --- packages/tasks/task-openmoko-debug.bb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/tasks/task-openmoko-debug.bb b/packages/tasks/task-openmoko-debug.bb index 8486aa01cf..0c2342183e 100644 --- a/packages/tasks/task-openmoko-debug.bb +++ b/packages/tasks/task-openmoko-debug.bb @@ -1,7 +1,7 @@ DESCRIPTION = "OpenMoko: Debugging and Benchmarking Tools" SECTION = "openmoko/base" LICENSE = "MIT" -PR = "r58" +PR = "r59" inherit task @@ -15,6 +15,7 @@ RDEPENDS_task-openmoko-debug = "\ cu \ dbench \ fbgrab \ + fbset \ fstests \ gdb \ gdbserver \ -- cgit v1.2.3 From 3ae494f2e5497197beebdcf02af92f892928aadc Mon Sep 17 00:00:00 2001 From: John Lee Date: Thu, 17 Jan 2008 08:50:55 +0000 Subject: (Merge OM mtn modification back into mainline) Remove ipkg-list-fields because already in ipkg-utils --- packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb b/packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb index 23d73ebae6..3101ecb3be 100644 --- a/packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb +++ b/packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb @@ -8,7 +8,7 @@ inherit native # Avoid circular dependencies from package_ipk.bbclass PACKAGES = "" FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/ipkg-utils" -INSTALL += "ipkg-list-fields arfile.py" +INSTALL += "arfile.py" do_stage() { for i in ${INSTALL}; do -- cgit v1.2.3 From 048ace2a52af79397c783867a0fe2a37d671baf4 Mon Sep 17 00:00:00 2001 From: John Lee Date: Thu, 17 Jan 2008 08:51:49 +0000 Subject: (Merge OM mtn modification back into mainline) Add ability to find the directory of parent package if the child package is of different arch. --- packages/meta/meta-toolchain.bb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/meta/meta-toolchain.bb b/packages/meta/meta-toolchain.bb index fc029505c3..923844ef8c 100644 --- a/packages/meta/meta-toolchain.bb +++ b/packages/meta/meta-toolchain.bb @@ -1,7 +1,7 @@ DESCRIPTION = "Meta package for building a installable toolchain" LICENSE = "MIT" DEPENDS = "ipkg-native ipkg-utils-native fakeroot-native sed-native" -PR = "r1" +PR = "r2" inherit sdk meta @@ -75,10 +75,17 @@ do_populate_sdk() { for arch in $revipkgarchs; do pkgnames=${DEPLOY_DIR_IPK}/$arch/${pkg}_*_$arch.ipk if [ -e $pkgnames ]; then - echo "Found $pkgnames" + oenote "Found $pkgnames" cp $pkgnames ${SDK_OUTPUT}/${prefix}/ipk/ orig_pkg=`ipkg-list-fields $pkgnames | grep OE: | cut -d ' ' -f2` - pkg_subdir=$arch${TARGET_VENDOR}${@['-' + bb.data.getVar('TARGET_OS', d, 1), ''][bb.data.getVar('TARGET_OS', d, 1) == ('' or 'custom')]} + pkg_subdir_postfix=${TARGET_VENDOR}${@['-' + bb.data.getVar('TARGET_OS', d, 1), ''][bb.data.getVar('TARGET_OS', d, 1) == ('' or 'custom')]} + for aarch in $revipkgarchs; do + if [ -e "${STAGING_DIR}/pkgdata/${aarch}${pkg_subdir_postfix}/${orig_pkg}" ]; then + pkg_subdir="${aarch}${pkg_subdir_postfix}" + break + fi + done + oenote "Original package in ${pkg_subdir}" mkdir -p ${SDK_OUTPUT}/${prefix}/pkgdata/$pkg_subdir/runtime cp ${STAGING_DIR}/pkgdata/$pkg_subdir/$orig_pkg ${SDK_OUTPUT}/${prefix}/pkgdata/$pkg_subdir/ subpkgs=`cat ${STAGING_DIR}/pkgdata/$pkg_subdir/$orig_pkg | grep PACKAGES: | cut -b 10-` -- cgit v1.2.3 From 357ee099c60ddf4fe162b8e24aeeba52edf4099a Mon Sep 17 00:00:00 2001 From: John Lee Date: Thu, 17 Jan 2008 09:03:38 +0000 Subject: (Merge OM mtn modification back into mainline) Integrate mainstream to build meta-toolchain-openmoko packages/meta/meta-toolchain-openmoko.bb: will install task-openmoko-toolchain-{target,host} task-openmoko-toolchain-target: specific to target arch. task-openmoko-toolchain-host: for host and all, such as openmoko-sample2-src moko-autorev.inc, sane-srcrevs.inc: add SRCREV_pn-openmoko-toolchain-scripts openmoko-toolchain-scripts_svn.bb: will not install sample code now. openmoko-sample2_svn.bb: update PACKAGE_ARCH_${PN}-src to be used by ipkg-sdk.conf --- conf/distro/include/moko-autorev.inc | 1 + conf/distro/include/sane-srcrevs.inc | 1 + packages/meta/meta-toolchain-openmoko.bb | 8 +++--- .../openmoko-toolchain-scripts_svn.bb | 13 +++++---- packages/openmoko2/openmoko-sample2_svn.bb | 2 +- packages/tasks/task-openmoko-toolchain-host.bb | 26 ++++++++++++++++++ packages/tasks/task-openmoko-toolchain-target.bb | 30 +++++++++++++++++++++ packages/tasks/task-toolchain-openmoko-sdk.bb | 31 ---------------------- 8 files changed, 70 insertions(+), 42 deletions(-) create mode 100644 packages/tasks/task-openmoko-toolchain-host.bb create mode 100644 packages/tasks/task-openmoko-toolchain-target.bb delete mode 100644 packages/tasks/task-toolchain-openmoko-sdk.bb diff --git a/conf/distro/include/moko-autorev.inc b/conf/distro/include/moko-autorev.inc index 87fea8d622..eb0a403fb3 100644 --- a/conf/distro/include/moko-autorev.inc +++ b/conf/distro/include/moko-autorev.inc @@ -39,6 +39,7 @@ SRCREV_pn-openmoko-theme-standard2 ?= "${AUTOREV}" SRCREV_pn-openmoko-theme-standard2-qvga ?= "${AUTOREV}" SRCREV_pn-openmoko-today2 ?= "${AUTOREV}" SRCREV_pn-openmoko-today2-folders ?= "${AUTOREV}" +SRCREV_pn-openmoko-toolchain-scripts ?= "${AUTOREV}" SRCREV_pn-openmoko-worldclock2 ?= "${AUTOREV}" SRCREV_pn-openocd ?= "${AUTOREV}" diff --git a/conf/distro/include/sane-srcrevs.inc b/conf/distro/include/sane-srcrevs.inc index 51fff86c0e..cdcf35d928 100644 --- a/conf/distro/include/sane-srcrevs.inc +++ b/conf/distro/include/sane-srcrevs.inc @@ -113,6 +113,7 @@ SRCREV_pn-openmoko-theme-standard2-qvga ?= "3425" SRCREV_pn-openmoko-today ?= "3056" SRCREV_pn-openmoko-today2 ?= "3609" SRCREV_pn-openmoko-today2-folders ?= "3414" +SRCREV_pn-openmoko-toolchain-scripts ?= "3767" SRCREV_pn-openmoko-worldclock2 ?= "3365" SRCREV_pn-openocd ?= "206" SRCREV_pn-openocd-native ?= "206" diff --git a/packages/meta/meta-toolchain-openmoko.bb b/packages/meta/meta-toolchain-openmoko.bb index b5e392ab1c..b7e5626f61 100644 --- a/packages/meta/meta-toolchain-openmoko.bb +++ b/packages/meta/meta-toolchain-openmoko.bb @@ -1,5 +1,7 @@ -TOOLCHAIN_TARGET_TASK = "task-toolchain-openmoko-sdk" +PR = "r1" -require meta-toolchain.bb +TOOLCHAIN_TARGET_TASK = "task-openmoko-toolchain-target" +TOOLCHAIN_HOST_TASK = "task-openmoko-toolchain-host" -SDK_SUFFIX = "toolchain-openmoko" \ No newline at end of file +require meta-toolchain.bb +SDK_SUFFIX = "toolchain-openmoko" diff --git a/packages/openmoko-spaces/openmoko-toolchain-scripts_svn.bb b/packages/openmoko-spaces/openmoko-toolchain-scripts_svn.bb index 1526cbab55..7533f81958 100644 --- a/packages/openmoko-spaces/openmoko-toolchain-scripts_svn.bb +++ b/packages/openmoko-spaces/openmoko-toolchain-scripts_svn.bb @@ -1,15 +1,14 @@ DESCRIPTION = "Convenient scripts to be used with openmoko toolchain." -PACKAGE_ARCH = "all" +PR = "r1" SRC_URI = "svn://svn.openmoko.org/developers/john_lee;module=toolkit;proto=http" -SRC_URI += "svn://svn.openmoko.org/trunk/src/target/OM-2007.2/applications;module=openmoko-sample2;proto=http" -SRCREV="3630" +S = "${WORKDIR}/toolkit" + FILES_${PN} = "/" do_install () { - (find ${WORKDIR} -type d -name ".svn" | xargs rm -rf) || true - install -m 755 -d ${D}/share - cp -dr ${WORKDIR}/toolkit/* ${D} - cp -dr ${WORKDIR}/openmoko-sample2 ${D}/share + cp -dr ${S}/* ${D} + find ${D} -name ".svn" | xargs rm -rf + rm -r ${D}/patches } diff --git a/packages/openmoko2/openmoko-sample2_svn.bb b/packages/openmoko2/openmoko-sample2_svn.bb index 4c2c5aad46..9118f89e8a 100644 --- a/packages/openmoko2/openmoko-sample2_svn.bb +++ b/packages/openmoko2/openmoko-sample2_svn.bb @@ -9,7 +9,7 @@ inherit openmoko2 PACKAGES += "${PN}-src" # path should match the toolchain path FILES_${PN}-src = "/usr/local/openmoko" -PACKAGE_ARCH_${PN}-src = "all" +PACKAGE_ARCH_${PN}-src = "${BUILD_ARCH}-all-sdk" do_configure_prepend() { install -d ${WORKDIR}/source diff --git a/packages/tasks/task-openmoko-toolchain-host.bb b/packages/tasks/task-openmoko-toolchain-host.bb new file mode 100644 index 0000000000..31ac3bb746 --- /dev/null +++ b/packages/tasks/task-openmoko-toolchain-host.bb @@ -0,0 +1,26 @@ +require task-sdk-host.bb + +DESCRIPTION = "Packages for a standalone OpenMoko SDK or external toolchain" +LICENSE = "MIT" +ALLOW_EMPTY = "1" + +PR = "r0" + +PACKAGES = "${PN}" + +RDEPENDS_${PN} += "\ + openmoko-sample2-src \ +" +require task-sdk-host.bb + +DESCRIPTION = "Packages for a standalone OpenMoko SDK or external toolchain" +LICENSE = "MIT" +ALLOW_EMPTY = "1" + +PR = "r0" + +PACKAGES = "${PN}" + +RDEPENDS_${PN} += "\ + openmoko-sample2-src \ +" diff --git a/packages/tasks/task-openmoko-toolchain-target.bb b/packages/tasks/task-openmoko-toolchain-target.bb new file mode 100644 index 0000000000..281884d051 --- /dev/null +++ b/packages/tasks/task-openmoko-toolchain-target.bb @@ -0,0 +1,30 @@ +DESCRIPTION = "Packages for a standalone OpenMoko SDK or external toolchain" +LICENSE = "MIT" +ALLOW_EMPTY = "1" + +PR = "r2" + +PACKAGES = "${PN}" + +RDEPENDS_${PN} = "\ + glibc \ + glibc-dbg \ + glibc-dev \ + glibc-utils \ + libsegfault \ + glibc-thread-db \ + glibc-localedata-i18n \ + glibc-gconv-ibm850 \ + glibc-gconv-cp1252 \ + glibc-gconv-iso8859-1 \ + glibc-gconv-iso8859-15 \ + locale-base-en-gb \ + libgcc \ + libstdc++ \ + \ + libmokogsmd2-dev \ + libmokoui2-dev \ + libmokopanelui2-dev \ + libmokojournal2-dev \ + openmoko-toolchain-scripts \ +" diff --git a/packages/tasks/task-toolchain-openmoko-sdk.bb b/packages/tasks/task-toolchain-openmoko-sdk.bb deleted file mode 100644 index bcb2d370a6..0000000000 --- a/packages/tasks/task-toolchain-openmoko-sdk.bb +++ /dev/null @@ -1,31 +0,0 @@ -DESCRIPTION = "Packages for a standalone OpenMoko SDK or external toolchain" -LICENSE = "MIT" -ALLOW_EMPTY = "1" - -PR = "r2" - -PACKAGES = "${PN}" - -RDEPENDS_${PN} = "\ - glibc \ - glibc-dbg \ - glibc-dev \ - glibc-utils \ - libsegfault \ - glibc-thread-db \ - glibc-localedata-i18n \ - glibc-gconv-ibm850 \ - glibc-gconv-cp1252 \ - glibc-gconv-iso8859-1 \ - glibc-gconv-iso8859-15 \ - locale-base-en-gb \ - libgcc \ - libstdc++ \ - \ - libmokogsmd2-dev \ - libmokoui2-dev \ - libmokopanelui2-dev \ - libmokojournal2-dev \ - openmoko-sample2-src \ - openmoko-toolchain-scripts \ -" -- cgit v1.2.3 From d6ab8cb7bb36e7876efeb274dd1aad1d3b1f6f3b Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 17 Jan 2008 13:00:44 +0000 Subject: supertux: Fix QA warnings for .desktop. --- packages/supertux/files/supertux.desktop | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/supertux/files/supertux.desktop b/packages/supertux/files/supertux.desktop index ace237bef0..8677a71301 100644 --- a/packages/supertux/files/supertux.desktop +++ b/packages/supertux/files/supertux.desktop @@ -1,7 +1,6 @@ [Desktop Entry] Type=Application Version=1.0 -Encoding=UTF-8 Name=SuperTux Name[en]=SuperTux Name[de]=SuperTux @@ -14,8 +13,8 @@ Comment=A Super Mario inspired penguin platform game Comment[en]=A Super Mario inspired penguin platform game Comment[de]=Ein von Super Mario inspiriertes Pinguin Jump&Run Spiel Comment[cs]=Plošinovka inspirovaná SuperMariem s tučňákem Tuxem v hlavní roli -Icon=supertux.png +Icon=supertux Exec=supertux Terminal=false StartupNotify=false -Categories=Application;Game;ArcadeGame +Categories=Application;Game;ArcadeGame; -- cgit v1.2.3 From a96a64e4975b8e3100904f902bd3b24f521210fb Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 17 Jan 2008 13:02:45 +0000 Subject: supertux-qvga 0.1.3: Add QVGA port of SperTux, based on GP2X port. * Original GP2X port by Ingo Arndt. * Data conversion preparation and script by myself. --- packages/supertux/files/gp2x.patch | 2614 ++++++++++++++++++++ packages/supertux/files/img-resize.sh | 28 + .../supertux/files/supertux-smallsize-data.tar.bz2 | Bin 0 -> 41782 bytes packages/supertux/supertux-qvga_0.1.3.bb | 57 + 4 files changed, 2699 insertions(+) create mode 100644 packages/supertux/files/gp2x.patch create mode 100644 packages/supertux/files/img-resize.sh create mode 100644 packages/supertux/files/supertux-smallsize-data.tar.bz2 create mode 100644 packages/supertux/supertux-qvga_0.1.3.bb diff --git a/packages/supertux/files/gp2x.patch b/packages/supertux/files/gp2x.patch new file mode 100644 index 0000000000..9d5d9a6d02 --- /dev/null +++ b/packages/supertux/files/gp2x.patch @@ -0,0 +1,2614 @@ +Only in supertux-0.1.3: aclocal.m4 +diff -ur supertux-0.1.3/AUTHORS supertux-0.1.3-gp2x/AUTHORS +--- supertux-0.1.3/AUTHORS 2005-07-02 14:37:30.000000000 +0300 ++++ supertux-0.1.3-gp2x/AUTHORS 2006-04-13 06:11:02.000000000 +0300 +@@ -91,6 +91,12 @@ + + Royalty free CDROMs and FTP sites sounds + ++Port to GP2X ++----------- ++ Ingo Arndt ++ scachi@gmx.de ++ http://www.bitmage.de ++ + More information and contacts + ============================= + +Only in supertux-0.1.3: autom4te.cache +Only in supertux-0.1.3-gp2x: autoscan.log +Only in supertux-0.1.3-gp2x: COMPILE4GP2X +Only in supertux-0.1.3: config.guess +Only in supertux-0.1.3: config.log +Only in supertux-0.1.3: config.status +Only in supertux-0.1.3: config.sub +Only in supertux-0.1.3: configure +diff -ur supertux-0.1.3/configure.ac supertux-0.1.3-gp2x/configure.ac +--- supertux-0.1.3/configure.ac 2005-07-06 12:26:15.000000000 +0300 ++++ supertux-0.1.3-gp2x/configure.ac 2006-04-19 22:29:05.000000000 +0300 +@@ -76,13 +76,33 @@ + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + ++AM_PATH_LIBMIKMOD(, ++ :, ++ AC_MSG_ERROR([*** mikmod not found!])) ++CXXFLAGS="$CXXFLAGS $LIBMIKMOD_CFLAGS" ++CFLAGS="$CFLAGS $LIBMIKMOD_CFLAGS" ++LIBS="$LIBS $LIBMIKMOD_LIBS" ++ + dnl Checks for additional libraries. ++AC_CHECK_LIB(smpeg, SMPEG_status) ++ ++AC_CHECK_LIB(mikmod, MikMod_Init) ++ + AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio,, + AC_MSG_ERROR([SDL_mixer library required])) + ++AC_CHECK_LIB(jpeg,jpeg_abort) ++ ++AC_CHECK_LIB(z,compress) ++ ++AC_CHECK_LIB(png,png_free) ++ + AC_CHECK_LIB(SDL_image, IMG_Load,, + AC_MSG_ERROR([SDL_image library required])) + ++AC_CHECK_LIB(SDL_gfx, rotozoomSurface,, ++ AC_MSG_ERROR([SDL_gfx library required])) ++ + if test "x${enable_opengl}" != "xno"; then + AX_CHECK_GL + fi +@@ -95,7 +115,30 @@ + LIBS="$LIBS $GL_LIBS" + fi + +-AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR([*** zlib is missing])) ++# compile for the testing the 320x240 resolution ++# compile for the gp2x ++AC_ARG_ENABLE(gp2x, ++[ --enable-gp2x Build the gp2x version [default=no]], ++ , enable_gp2x=no) ++if test x$enable_gp2x = xyes; then ++ CXXFLAGS="$CXXFLAGS -DGP2X" ++fi ++ ++AC_ARG_ENABLE(320x240, ++[ --enable-320x240 Test the 320x240 resolution [default=no]], ++ , enable_320x240=no) ++if test x$enable_320x240 = xyes; then ++ CXXFLAGS="$CXXFLAGS -DRES320X240" ++fi ++ ++# compile static ++AC_ARG_ENABLE(static, ++[ --enable-static Build the static version [default=no]], ++ , enable_static=no) ++if test x$enable_static = xyes; then ++ CXXFLAGS="$CXXFLAGS -static" ++fi ++ + + CXXFLAGS="$CXXFLAGS -DDATA_PREFIX='\"$datadir/supertux\"'" + +@@ -110,6 +153,9 @@ + echo " Profile Mode: $enable_gprof" + echo " Debug Mode: $enable_debug" + echo " OpenGL Support: $enable_opengl" ++echo " 320x240 Resolution: $enable_320x240" ++echo " GP2X Build (+320x240): $enable_gp2x" ++echo " Static Build: $enable_static" + echo "" + + # EOF # +Only in supertux-0.1.3/data: CREDITS +Only in supertux-0.1.3/data: extro-bonus2.txt +Only in supertux-0.1.3/data: extro-bonus.txt +Only in supertux-0.1.3/data: extro.txt +Only in supertux-0.1.3/data: images +Only in supertux-0.1.3/data: intro.txt +Only in supertux-0.1.3/data: levels +Only in supertux-0.1.3/data: Makefile +Only in supertux-0.1.3/data: Makefile.in +Only in supertux-0.1.3/data: music +Only in supertux-0.1.3/data: sounds +Only in supertux-0.1.3/data: supertux.strf +Only in supertux-0.1.3: depcomp +Only in supertux-0.1.3: install-sh +Only in supertux-0.1.3: m4 +Only in supertux-0.1.3: Makefile +Only in supertux-0.1.3: Makefile.in +Only in supertux-0.1.3: missing +Only in supertux-0.1.3: mkinstalldirs +Only in supertux-0.1.3: patches +diff -ur supertux-0.1.3/src/badguy.cpp supertux-0.1.3-gp2x/src/badguy.cpp +--- supertux-0.1.3/src/badguy.cpp 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/badguy.cpp 2006-04-20 21:32:23.000000000 +0300 +@@ -250,7 +250,11 @@ + tux.kick_timer.start(KICKING_TIME); + set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); + physic.set_velocity_x((dir == LEFT) ? -3.5 : 3.5); ++#ifndef GP2X + play_sound(sounds[SND_KICK],SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_KICK); ++#endif + } + } + +@@ -260,6 +264,7 @@ + check_horizontal_bump(); + if(mode == KICK && changed != dir) + { ++#ifndef GP2X + /* handle stereo sound (number 10 should be tweaked...)*/ + if (base.x < scroll_x + screen->w/2 - 10) + play_sound(sounds[SND_RICOCHET], SOUND_LEFT_SPEAKER); +@@ -267,6 +272,9 @@ + play_sound(sounds[SND_RICOCHET], SOUND_RIGHT_SPEAKER); + else + play_sound(sounds[SND_RICOCHET], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_RICOCHET); ++#endif + } + } + +@@ -455,11 +463,15 @@ + + /* play explosion sound */ // FIXME: is the stereo all right? maybe we should use player cordinates... + if (base.x < scroll_x + screen->w/2 - 10) ++#ifndef GP2X + play_sound(sounds[SND_EXPLODE], SOUND_LEFT_SPEAKER); + else if (base.x > scroll_x + screen->w/2 + 10) + play_sound(sounds[SND_EXPLODE], SOUND_RIGHT_SPEAKER); + else + play_sound(sounds[SND_EXPLODE], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_EXPLODE); ++#endif + + } else if(mode == BOMB_EXPLODE) { + remove_me(); +@@ -677,13 +689,21 @@ + } + + // BadGuy fall below the ground ++#ifndef RES320X240 + if (base.y > screen->h) { ++#else ++ if (base.y > 640) { ++#endif + remove_me(); + return; + } + + // Once it's on screen, it's activated! ++#ifndef RES320X240 + if (base.x <= scroll_x + screen->w + OFFSCREEN_DISTANCE) ++#else ++ if (base.x <= scroll_x + 640 + OFFSCREEN_DISTANCE) ++#endif + seen = true; + + if(!seen) +@@ -743,7 +763,11 @@ + BadGuy::draw() + { + // Don't try to draw stuff that is outside of the screen ++#ifndef RES320X240 + if(base.x <= scroll_x - base.width || base.x >= scroll_x + screen->w) ++#else ++ if(base.x <= scroll_x - base.width || base.x >= scroll_x + 640) ++#endif + return; + + if(sprite_left == 0 || sprite_right == 0) +@@ -811,7 +835,11 @@ + + World::current()->add_score(base.x - scroll_x, + base.y, 50 * player_status.score_multiplier); ++#ifndef GP2X + play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_SQUISH); ++#endif + player_status.score_multiplier++; + + dying = DYING_SQUISHED; +@@ -830,7 +858,11 @@ + + player->jump_of_badguy(this); + World::current()->add_score(base.x - scroll_x, base.y, 50 * player_status.score_multiplier); ++#ifndef GP2X + play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_SQUISH); ++#endif + player_status.score_multiplier++; + remove_me(); + return; +@@ -839,7 +871,11 @@ + if (mode == NORMAL || mode == KICK) + { + /* Flatten! */ ++#ifndef GP2X + play_sound(sounds[SND_STOMP], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_STOMP); ++#endif + mode = FLAT; + set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); + physic.set_velocity_x(0); +@@ -847,7 +883,11 @@ + timer.start(4000); + } else if (mode == FLAT) { + /* Kick! */ ++#ifndef GP2X + play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_KICK); ++#endif + + if (player->base.x < base.x + (base.width/2)) { + physic.set_velocity_x(5); +@@ -925,7 +965,11 @@ + score * player_status.score_multiplier); + + /* Play death sound: */ ++#ifndef GP2X + play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_FALL); ++#endif + } + + void BadGuy::explode(BadGuy *badguy) +@@ -1053,7 +1097,11 @@ + /* Get kicked if were flat */ + if (mode == FLAT && !dying) + { ++#ifndef GP2X + play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_KICK); ++#endif + + // Hit from left side + if (player->base.x < base.x) { +diff -ur supertux-0.1.3/src/configfile.cpp supertux-0.1.3-gp2x/src/configfile.cpp +--- supertux-0.1.3/src/configfile.cpp 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/configfile.cpp 2006-04-10 13:32:19.000000000 +0300 +@@ -92,12 +92,22 @@ + else + use_joystick = true; + ++#ifndef GP2X + reader.read_int ("joystick-x", &joystick_keymap.x_axis); + reader.read_int ("joystick-y", &joystick_keymap.y_axis); + reader.read_int ("joystick-a", &joystick_keymap.a_button); + reader.read_int ("joystick-b", &joystick_keymap.b_button); + reader.read_int ("joystick-start", &joystick_keymap.start_button); + reader.read_int ("joystick-deadzone", &joystick_keymap.dead_zone); ++#else ++ reader.read_int ("joystick-up", &joystick_keymap.up_button); ++ reader.read_int ("joystick-down", &joystick_keymap.down_button); ++ reader.read_int ("joystick-right", &joystick_keymap.right_button); ++ reader.read_int ("joystick-left", &joystick_keymap.left_button); ++ reader.read_int ("joystick-a", &joystick_keymap.a_button); ++ reader.read_int ("joystick-b", &joystick_keymap.b_button); ++ reader.read_int ("joystick-start", &joystick_keymap.start_button); ++#endif + + reader.read_int ("keyboard-jump", &keymap.jump); + reader.read_int ("keyboard-duck", &keymap.duck); +@@ -130,12 +140,22 @@ + fprintf(config, "\n\t;; joystick number (-1 means no joystick):\n"); + fprintf(config, "\t(joystick %d)\n", use_joystick ? joystick_num : -1); + ++#ifndef GP2X + fprintf(config, "\t(joystick-x %d)\n", joystick_keymap.x_axis); + fprintf(config, "\t(joystick-y %d)\n", joystick_keymap.y_axis); + fprintf(config, "\t(joystick-a %d)\n", joystick_keymap.a_button); + fprintf(config, "\t(joystick-b %d)\n", joystick_keymap.b_button); + fprintf(config, "\t(joystick-start %d)\n", joystick_keymap.start_button); + fprintf(config, "\t(joystick-deadzone %d)\n", joystick_keymap.dead_zone); ++#else ++ fprintf(config, "\t(joystick-up %d)\n", joystick_keymap.up_button); ++ fprintf(config, "\t(joystick-down %d)\n", joystick_keymap.down_button); ++ fprintf(config, "\t(joystick-right %d)\n", joystick_keymap.right_button); ++ fprintf(config, "\t(joystick-left %d)\n", joystick_keymap.left_button); ++ fprintf(config, "\t(joystick-a %d)\n", joystick_keymap.a_button); ++ fprintf(config, "\t(joystick-b %d)\n", joystick_keymap.b_button); ++ fprintf(config, "\t(joystick-start %d)\n", joystick_keymap.start_button); ++#endif + + fprintf(config, "\t(keyboard-jump %d)\n", keymap.jump); + fprintf(config, "\t(keyboard-duck %d)\n", keymap.duck); +diff -ur supertux-0.1.3/src/defines.h supertux-0.1.3-gp2x/src/defines.h +--- supertux-0.1.3/src/defines.h 2005-07-07 02:05:03.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/defines.h 2006-04-11 22:02:05.000000000 +0300 +@@ -91,7 +91,11 @@ + + /* Scrolling text speed */ + ++#ifndef RES320X240 + #define SCROLL_SPEED_CREDITS 1.2 ++#else ++#define SCROLL_SPEED_CREDITS 2.4 ++#endif + #define SCROLL_SPEED_MESSAGE 1.0 + + /* Debugging */ +Only in supertux-0.1.3/src: .deps +diff -ur supertux-0.1.3/src/gameloop.cpp supertux-0.1.3-gp2x/src/gameloop.cpp +--- supertux-0.1.3/src/gameloop.cpp 2005-07-02 15:16:08.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/gameloop.cpp 2006-05-05 23:22:58.000000000 +0300 +@@ -288,6 +288,7 @@ + + switch(event.type) + { ++#ifndef GP2X + case SDL_QUIT: /* Quit event - quit: */ + st_abort("Received window close", ""); + break; +@@ -434,22 +435,60 @@ + tux.input.down = UP; + } + break; +- ++#endif + case SDL_JOYBUTTONDOWN: ++#ifndef GP2X ++ if (event.jbutton.button == joystick_keymap.a_button) ++ tux.input.up = DOWN; ++ else if (event.jbutton.button == joystick_keymap.b_button) ++ tux.input.fire = DOWN; ++ else if (event.jbutton.button == joystick_keymap.start_button) ++ on_escape_press(); ++ break; ++#else + if (event.jbutton.button == joystick_keymap.a_button) + tux.input.up = DOWN; + else if (event.jbutton.button == joystick_keymap.b_button) + tux.input.fire = DOWN; + else if (event.jbutton.button == joystick_keymap.start_button) + on_escape_press(); ++ else if (event.jbutton.button == joystick_keymap.up_button) ++ tux.input.up = DOWN; ++ else if (event.jbutton.button == joystick_keymap.down_button) ++ tux.input.down = DOWN; ++ else if (event.jbutton.button == joystick_keymap.right_button) ++ tux.input.right = DOWN; ++ else if (event.jbutton.button == joystick_keymap.left_button) ++ tux.input.left = DOWN; ++ else if (event.jbutton.button == joystick_keymap.voldown_button) ++ decreaseSoundVolume(); ++ else if (event.jbutton.button == joystick_keymap.volup_button) ++ increaseSoundVolume(); + break; ++#endif ++ + case SDL_JOYBUTTONUP: ++#ifndef GP2X + if (event.jbutton.button == joystick_keymap.a_button) + tux.input.up = UP; + else if (event.jbutton.button == joystick_keymap.b_button) + tux.input.fire = UP; + break; +- ++#else ++ if (event.jbutton.button == joystick_keymap.a_button) ++ tux.input.up = UP; ++ else if (event.jbutton.button == joystick_keymap.b_button) ++ tux.input.fire = UP; ++ else if (event.jbutton.button == joystick_keymap.up_button) ++ tux.input.up = UP; ++ else if (event.jbutton.button == joystick_keymap.down_button) ++ tux.input.down = UP; ++ else if (event.jbutton.button == joystick_keymap.right_button) ++ tux.input.right = UP; ++ else if (event.jbutton.button == joystick_keymap.left_button) ++ tux.input.left = UP; ++ break; ++#endif + default: + break; + } /* switch */ +@@ -464,7 +503,7 @@ + Player* tux = world->get_tux(); + + /* End of level? */ +- int endpos = (World::current()->get_level()->width-5) * 32; ++ int endpos = (World::current()->get_level()->width-5) * (32); + Tile* endtile = collision_goal(tux->base); + + // fallback in case the other endpositions don't trigger +@@ -545,7 +584,7 @@ + Menu::current()->draw(); + mouse_cursor->draw(); + } +- ++ //updateSound(); + updatescreen(); + } + +@@ -599,6 +638,7 @@ + + while (exit_status == ES_NONE) + { ++ SDL_Delay(10); + /* Calculate the movement-factor */ + double frame_ratio = ((double)(update_time-last_update_time))/((double)FRAME_RATE); + +@@ -686,6 +726,7 @@ + fps_cnt = 0; + } + } ++ //updateSound(); + } + + return exit_status; +@@ -694,21 +735,32 @@ + /* Bounce a brick: */ + void bumpbrick(float x, float y) + { +- World::current()->add_bouncy_brick(((int)(x + 1) / 32) * 32, +- (int)(y / 32) * 32); ++ World::current()->add_bouncy_brick(((int)(x + 1) / (32)) * (32), ++ (int)(y / (32)) * (32)); + ++#ifndef GP2X + play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_BRICK); ++#endif + } + + /* (Status): */ + void + GameSession::drawstatus() + { ++ int xdiv; ++#ifdef RES320X240 ++ xdiv=2; ++#else ++ xdiv=1; ++#endif ++ + char str[60]; + + sprintf(str, "%d", player_status.score); + white_text->draw("SCORE", 0, 0, 1); +- gold_text->draw(str, 96, 0, 1); ++ gold_text->draw(str, 96/xdiv, 0, 1); + + if(st_gl_mode == ST_GL_TEST) + { +@@ -716,28 +768,33 @@ + } + + if(!time_left.check()) { +- white_text->draw("TIME'S UP", 224, 0, 1); ++ white_text->draw("TIME'S UP", 224/xdiv, 0, 1); + } else if (time_left.get_left() > TIME_WARNING || (global_frame_counter % 10) < 5) { + sprintf(str, "%d", time_left.get_left() / 1000 ); +- white_text->draw("TIME", 224, 0, 1); +- gold_text->draw(str, 304, 0, 1); ++ white_text->draw("TIME", 224/xdiv, 0, 1); ++ gold_text->draw(str, 304/xdiv, 0, 1); + } + + sprintf(str, "%d", player_status.distros); + white_text->draw("COINS", screen->h, 0, 1); +- gold_text->draw(str, 608, 0, 1); ++ gold_text->draw(str, 608/xdiv, 0, 1); + +- white_text->draw("LIVES", 480, 20); ++ white_text->draw("LIVES", 480/xdiv, 20); + if (player_status.lives >= 5) + { + sprintf(str, "%dx", player_status.lives); ++#ifdef RES320X240 ++ gold_text->draw_align(str, 617/xdiv-5, 20, A_RIGHT, A_TOP); ++ tux_life->draw(565+(18*3)/xdiv+10, 20); ++#else + gold_text->draw_align(str, 617, 20, A_RIGHT, A_TOP); + tux_life->draw(565+(18*3), 20); ++#endif + } + else + { + for(int i= 0; i < player_status.lives; ++i) +- tux_life->draw(565+(18*i),20); ++ tux_life->draw(565+(18*i)/xdiv,20); + } + + if(show_fps) +@@ -746,6 +803,7 @@ + white_text->draw("FPS", screen->h, 40, 1); + gold_text->draw(str, screen->h + 60, 40, 1); + } ++// updateSound(); + } + + void +@@ -824,4 +882,3 @@ + return tmp; + } + +- +diff -ur supertux-0.1.3/src/gameobjs.cpp supertux-0.1.3-gp2x/src/gameobjs.cpp +--- supertux-0.1.3/src/gameobjs.cpp 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/gameobjs.cpp 2006-04-11 21:52:52.000000000 +0300 +@@ -98,6 +98,9 @@ + src.h = 16; + + dest.x = (int)(base.x - scroll_x); ++#ifdef RES320X240 ++ dest.x=dest.x/2; ++#endif + dest.y = (int)base.y; + dest.w = 16; + dest.h = 16; +@@ -143,8 +146,13 @@ + { + SDL_Rect dest; + ++#ifndef RES320X240 + if (base.x >= scroll_x - 32 && + base.x <= scroll_x + screen->w) ++#else ++ if (base.x >= scroll_x - 32 && ++ base.x <= scroll_x + 640) ++#endif + { + dest.x = (int)(base.x - scroll_x); + dest.y = (int)base.y; +@@ -165,8 +173,14 @@ + else + { + int s = ((int)scroll_x / 2)%640; ++ ++#ifdef RES320X240 ++ plevel->img_bkgd->draw_part(dest.x/2 + s/2, dest.y/2, ++ dest.x/2, dest.y,dest.w/2,dest.h/2); ++#else + plevel->img_bkgd->draw_part(dest.x + s, dest.y, + dest.x, dest.y,dest.w,dest.h); ++#endif + } + + Tile::draw(base.x - scroll_x, +diff -ur supertux-0.1.3/src/globals.cpp supertux-0.1.3-gp2x/src/globals.cpp +--- supertux-0.1.3/src/globals.cpp 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/globals.cpp 2006-04-11 22:39:03.000000000 +0300 +@@ -25,6 +25,7 @@ + + JoystickKeymap::JoystickKeymap() + { ++#ifndef GP2X + a_button = 0; + b_button = 1; + start_button = 2; +@@ -33,6 +34,17 @@ + y_axis = 1; + + dead_zone = 4096; ++#else ++ a_button = GP2X_BUTTON_A; ++ b_button = GP2X_BUTTON_X; ++ start_button = GP2X_BUTTON_START; ++ up_button = GP2X_BUTTON_UP; ++ down_button = GP2X_BUTTON_DOWN; ++ left_button = GP2X_BUTTON_LEFT; ++ right_button = GP2X_BUTTON_RIGHT; ++ volup_button = GP2X_BUTTON_VOLUP; ++ voldown_button = GP2X_BUTTON_VOLDOWN; ++#endif + } + + JoystickKeymap joystick_keymap; +diff -ur supertux-0.1.3/src/globals.h supertux-0.1.3-gp2x/src/globals.h +--- supertux-0.1.3/src/globals.h 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/globals.h 2006-04-11 23:45:27.000000000 +0300 +@@ -28,10 +28,33 @@ + #include "menu.h" + #include "mousecursor.h" + ++#ifdef GP2X ++#define GP2X_BUTTON_UP (0) ++#define GP2X_BUTTON_DOWN (4) ++#define GP2X_BUTTON_LEFT (2) ++#define GP2X_BUTTON_RIGHT (6) ++#define GP2X_BUTTON_UPLEFT (1) ++#define GP2X_BUTTON_UPRIGHT (7) ++#define GP2X_BUTTON_DOWNLEFT (3) ++#define GP2X_BUTTON_DOWNRIGHT (5) ++#define GP2X_BUTTON_CLICK (18) ++#define GP2X_BUTTON_A (12) ++#define GP2X_BUTTON_B (13) ++#define GP2X_BUTTON_X (15) ++#define GP2X_BUTTON_Y (14) ++#define GP2X_BUTTON_L (10) ++#define GP2X_BUTTON_R (11) ++#define GP2X_BUTTON_START (8) ++#define GP2X_BUTTON_SELECT (9) ++#define GP2X_BUTTON_VOLUP (16) ++#define GP2X_BUTTON_VOLDOWN (17) ++#endif ++ + extern std::string datadir; + + struct JoystickKeymap + { ++#ifndef GP2X + int a_button; + int b_button; + int start_button; +@@ -42,6 +65,19 @@ + int dead_zone; + + JoystickKeymap(); ++#else ++ int a_button; ++ int b_button; ++ int start_button; ++ int up_button; ++ int down_button; ++ int left_button; ++ int right_button; ++ int volup_button; ++ int voldown_button; ++ ++ JoystickKeymap(); ++#endif + }; + + extern JoystickKeymap joystick_keymap; +diff -ur supertux-0.1.3/src/lispreader.h supertux-0.1.3-gp2x/src/lispreader.h +Only in supertux-0.1.3/src: Makefile +diff -ur supertux-0.1.3/src/Makefile.am supertux-0.1.3-gp2x/src/Makefile.am +--- supertux-0.1.3/src/Makefile.am 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/Makefile.am 2006-04-19 21:55:54.000000000 +0300 +@@ -77,3 +77,5 @@ + musicref.h + + # EOF # ++ ++#supertux_LDADD = libmikmod +Only in supertux-0.1.3/src: Makefile.in +diff -ur supertux-0.1.3/src/menu.cpp supertux-0.1.3-gp2x/src/menu.cpp +--- supertux-0.1.3/src/menu.cpp 2005-06-29 15:44:13.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/menu.cpp 2006-05-04 23:59:29.000000000 +0300 +@@ -53,6 +53,8 @@ + Menu* options_menu = 0; + Menu* options_keys_menu = 0; + Menu* options_joystick_menu = 0; ++Menu* options_joystick_axis_menu = 0; ++Menu* options_joystick_button_menu = 0; + Menu* highscore_menu = 0; + Menu* load_game_menu = 0; + Menu* save_game_menu = 0; +@@ -240,8 +242,10 @@ + } + + /* Set ControlField a key */ ++//TODO: get joystick in here somehow + void Menu::get_controlfield_key_into_input(MenuItem *item) + { ++#ifndef GP2X + switch(*item->int_p) + { + case SDLK_UP: +@@ -288,6 +292,11 @@ + } + break; + } ++#else ++ char tmp[64]; ++ snprintf(tmp, 64, "%d", *item->int_p); ++ item->change_input(tmp); ++#endif + } + + /* Free a menu and all its items */ +@@ -497,8 +506,13 @@ + int menu_height) + { + MenuItem& pitem = item[index]; +- ++ ++#ifndef RES320X240 + int font_width = 16; ++#else ++ int font_width = 16/2; ++#endif ++ + int effect_offset = 0; + { + int effect_time = 0; +@@ -510,7 +524,7 @@ + } + + int x_pos = pos_x; +- int y_pos = pos_y + 24*index - menu_height/2 + 12 + effect_offset; ++ int y_pos = pos_y + (int)(24)*index - menu_height/2 + 12 + effect_offset; + int shadow_size = 2; + int text_width = strlen(pitem.text) * font_width; + int input_width = (strlen(pitem.input)+ 1) * font_width; +@@ -518,7 +532,7 @@ + Text* text_font = white_text; + + if (arrange_left) +- x_pos += 24 - menu_width/2 + (text_width + input_width + list_width)/2; ++ x_pos += (int)(24) - menu_width/2 + (text_width + input_width + list_width)/2; + + if(index == active_item) + { +@@ -538,7 +552,11 @@ + + case MN_HL: + { ++#ifndef RES320X240 + int x = pos_x - menu_width/2; ++#else ++ int x = pos_x - menu_width/4; ++#endif + int y = y_pos - 12 - effect_offset; + /* Draw a horizontal line with a little 3d effect */ + fillrect(x, y + 6, +@@ -551,9 +569,15 @@ + } + case MN_LABEL: + { ++#ifndef RES320X240 + white_big_text->draw_align(pitem.text, + x_pos, y_pos, + A_HMIDDLE, A_VMIDDLE, 2); ++#else ++ white_text->draw_align(pitem.text, ++ x_pos, y_pos, ++ A_HMIDDLE, A_VMIDDLE, 2); ++#endif + break; + } + case MN_TEXTFIELD: +@@ -570,8 +594,9 @@ + input_width + font_width, 18, + 0,0,0,128); + +- if(pitem.kind == MN_CONTROLFIELD) ++ if(pitem.kind == MN_CONTROLFIELD) { + get_controlfield_key_into_input(&pitem); ++ } + + if(pitem.kind == MN_TEXTFIELD || pitem.kind == MN_NUMFIELD) + { +@@ -663,7 +688,7 @@ + menu_width += 2; + } + } +- ++ + return (menu_width * 16 + 24); + } + +@@ -680,10 +705,17 @@ + int menu_width = get_width(); + + /* Draw a transparent background */ ++#ifndef RES320X240 + fillrect(pos_x - menu_width/2, + pos_y - 24*item.size()/2 - 10, + menu_width,menu_height + 20, + 150,180,200,125); ++#else ++ fillrect(pos_x - menu_width/4, ++ pos_y - 24*item.size()/2 - 10, ++ menu_width,menu_height + 20, ++ 150,180,200,125); ++#endif + + for(unsigned int i = 0; i < item.size(); ++i) + { +@@ -723,6 +755,8 @@ + SDLKey key; + switch(event.type) + { ++ ++#ifndef GP2X + case SDL_KEYDOWN: + key = event.key.keysym.sym; + SDLMod keymod; +@@ -754,7 +788,6 @@ + return; + } + +- + switch(key) + { + case SDLK_UP: /* Menu Up */ +@@ -800,12 +833,14 @@ + break; + } + break; ++ + case SDL_JOYHATMOTION: + if(event.jhat.value == SDL_HAT_UP) + menuaction = MENU_ACTION_UP; + if(event.jhat.value == SDL_HAT_DOWN) + menuaction = MENU_ACTION_DOWN; + break; ++ + case SDL_JOYAXISMOTION: + if(event.jaxis.axis == joystick_keymap.y_axis) + { +@@ -815,9 +850,88 @@ + menuaction = MENU_ACTION_UP; + } + break; ++#endif ++ + case SDL_JOYBUTTONDOWN: ++#ifndef GP2X + menuaction = MENU_ACTION_HIT; + break; ++#else ++ ++ if(item[active_item].kind == MN_CONTROLFIELD) ++ { ++ if( event.jbutton.button == joystick_keymap.start_button ) ++ { ++ Menu::pop_current(); ++ return; ++ } ++ ++ static int save[8]={-1,-1,-1,-1,-1,-1,-1,-1}; ++ int itemid=get_active_item_id(); ++ int inputkey; ++ switch ( itemid ) { ++ case 11 : inputkey=joystick_keymap.up_button; ++ break; ++ case 12 : inputkey=joystick_keymap.down_button; ++ break; ++ case 13 : inputkey=joystick_keymap.left_button; ++ break; ++ case 14 : inputkey=joystick_keymap.right_button; ++ break; ++ case 15 : inputkey=joystick_keymap.a_button; ++ break; ++ case 16 : inputkey=joystick_keymap.b_button; ++ break; ++ default : break; ++ } ++ ++ *item[active_item].int_p = event.jbutton.button; ++ ++ bool okay=true; ++ ++ save[itemid-11]=event.jbutton.button; ++ ++ int i; ++ for ( i=0;irefcount++; + + if(music_enabled) ++#ifndef GP2X + Mix_PlayMusic(current_music->music, loops); ++#else ++ { ++ if ( loops == -1 ) current_music->music->wrap=1; ++ Player_Stop(); ++ Player_Start(current_music->music); ++ Player_SetPosition(0); ++ } ++#endif + } + + void +@@ -106,13 +124,17 @@ + if(!audio_device) + return; + ++#ifndef GP2X + Mix_HaltMusic(); ++#else ++ Player_Stop(); ++#endif + + if(current_music) { + current_music->refcount--; + if(current_music->refcount == 0) + free_music(current_music); +- current_music = 0; ++ current_music = 0; + } + } + +@@ -127,9 +149,17 @@ + + music_enabled = enable; + if(music_enabled == false) { ++#ifndef GP2X + Mix_HaltMusic(); ++#else ++ Player_Stop(); ++#endif + } else { ++#ifndef GP2X + Mix_PlayMusic(current_music->music, -1); ++#else ++ Player_Start(current_music->music); ++#endif + } + } + +diff -ur supertux-0.1.3/src/music_manager.h supertux-0.1.3-gp2x/src/music_manager.h +--- supertux-0.1.3/src/music_manager.h 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/music_manager.h 2006-04-22 04:51:32.000000000 +0300 +@@ -20,6 +20,10 @@ + #ifndef HEADER_MUSIC_MANAGER_H + #define HEADER_MUSIC_MANAGER_H + ++#ifdef GP2X ++#include "mikmod.h" ++#endif ++ + #include + #include + #include +@@ -51,7 +55,12 @@ + ~MusicResource(); + + MusicManager* manager; ++#ifndef GP2X + Mix_Music* music; ++#else ++ MODULE *music; ++#endif ++ + int refcount; + }; + +diff -ur supertux-0.1.3/src/particlesystem.cpp supertux-0.1.3-gp2x/src/particlesystem.cpp +--- supertux-0.1.3/src/particlesystem.cpp 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/particlesystem.cpp 2006-04-12 22:20:41.000000000 +0300 +@@ -28,8 +28,13 @@ + + ParticleSystem::ParticleSystem() + { ++#ifndef RES320X240 + virtual_width = screen->w; + virtual_height = screen->h; ++#else ++ virtual_width = 640; ++ virtual_height = 480; ++#endif + } + + ParticleSystem::~ParticleSystem() +@@ -57,13 +62,24 @@ + float ymax = fmodf(y + particle->texture->h, virtual_height); + + // particle on screen ++#ifndef RES320X240 + if(x >= screen->w && xmax >= screen->w) + continue; + if(y >= screen->h && ymax >= screen->h) + continue; +- ++ + if(x > screen->w) x -= virtual_width; + if(y > screen->h) y -= virtual_height; ++#else ++ if(x >= 640 && xmax >= 640) ++ continue; ++ if(y >= 480 && ymax >= 480) ++ continue; ++ ++ if(x > 640) x -= virtual_width; ++ if(y > 480) y -= virtual_height; ++#endif ++ + particle->texture->draw(x, y); + } + } +@@ -74,14 +90,21 @@ + snowimages[1] = new Surface(datadir+"/images/shared/snow1.png", USE_ALPHA); + snowimages[2] = new Surface(datadir+"/images/shared/snow2.png", USE_ALPHA); + ++#ifndef RES320X240 + virtual_width = screen->w * 2; +- ++#else ++ virtual_width = 640 * 2; ++#endif + // create some random snowflakes + size_t snowflakecount = size_t(virtual_width/10.0); + for(size_t i=0; ix = rand() % int(virtual_width); ++#ifndef RES320X240 + particle->y = rand() % screen->h; ++#else ++ particle->y = rand() % 480; ++#endif + particle->layer = i % 2; + int snowsize = rand() % 3; + particle->texture = snowimages[snowsize]; +@@ -106,7 +129,11 @@ + for(i = particles.begin(); i != particles.end(); ++i) { + SnowParticle* particle = (SnowParticle*) *i; + particle->y += particle->speed * elapsed_time; ++#ifndef RES320X240 + if(particle->y > screen->h) { ++#else ++ if(particle->y > 480) { ++#endif + particle->y = fmodf(particle->y , virtual_height); + particle->x = rand() % int(virtual_width); + } +diff -ur supertux-0.1.3/src/player.cpp supertux-0.1.3-gp2x/src/player.cpp +--- supertux-0.1.3/src/player.cpp 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/player.cpp 2006-05-05 22:59:52.000000000 +0300 +@@ -261,6 +261,7 @@ + } + } + } ++// updateSound(); + + /* ---- DONE HANDLING TUX! --- */ + +@@ -337,7 +338,11 @@ + if(on_ground() && ((vx < 0 && dirsign >0) || (vx>0 && dirsign<0))) { + if(fabs(vx)>SKID_XM && !skidding_timer.check()) { + skidding_timer.start(SKID_TIME); ++#ifndef GP2X + play_sound(sounds[SND_SKID], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_SKID); ++#endif + ax *= 2.5; + } else { + ax *= 2; +@@ -391,9 +396,17 @@ + jumping = true; + can_jump = false; + if (size == SMALL) ++#ifndef GP2X + play_sound(sounds[SND_JUMP], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_JUMP); ++#endif + else ++#ifndef GP2X + play_sound(sounds[SND_BIGJUMP], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_BIGJUMP); ++#endif + } + } + // Let go of jump key +@@ -533,7 +546,11 @@ + if(player_status.lives < MAX_LIVES) + ++player_status.lives; + /*We want to hear the sound even, if MAX_LIVES is reached*/ ++#ifndef GP2X + play_sound(sounds[SND_LIFEUP], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_LIFEUP); ++#endif + } + } + +@@ -665,7 +682,11 @@ + else + { + pbad_c->dying = DYING_FALLING; ++#ifndef GP2X + play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_FALL); ++#endif + World::current()->add_score(pbad_c->base.x - scroll_x, + pbad_c->base.y, + 25 * player_status.score_multiplier); +@@ -696,7 +717,12 @@ + void + Player::kill(HurtMode mode) + { ++#ifndef GP2X + play_sound(sounds[SND_HURT], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_HURT); ++ updateSound(); ++#endif + + physic.set_velocity_x(0); + +@@ -734,7 +760,11 @@ + + bool Player::is_dead() + { ++#ifndef RES320X240 + if(base.y > screen->h || base.x < scroll_x - AUTOSCROLL_DEAD_INTERVAL) // last condition can happen in auto-scrolling ++#else ++ if(base.y > 640 || base.x < scroll_x - AUTOSCROLL_DEAD_INTERVAL) // last condition can happen in auto-scrolling ++#endif + return true; + else + return false; +@@ -760,9 +790,20 @@ + } + + /* Keep in-bounds, vertically: */ ++#ifndef RES320X240 + if (base.y > screen->h) ++#else ++ if (base.y > 640) ++#endif + { + kill(KILL); ++#ifdef GP2X ++ float wait=SDL_GetTicks()+800; ++ while ( wait > SDL_GetTicks()) { ++ updateSound(); ++ } ++#endif ++ + } + + if(base.x < scroll_x && (!back_scrolling || hor_autoscroll)) // can happen if back scrolling is disabled +@@ -777,7 +818,6 @@ + if(base.x + base.width > scroll_x + screen->w) + base.x = scroll_x + screen->w - base.width; + } +- + } + + // EOF // +diff -ur supertux-0.1.3/src/resources.cpp supertux-0.1.3-gp2x/src/resources.cpp +--- supertux-0.1.3/src/resources.cpp 2005-07-02 15:20:14.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/resources.cpp 2006-04-22 13:14:01.000000000 +0300 +@@ -18,6 +18,7 @@ + // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + #include "globals.h" ++#include "sound.h" + #include "scene.h" + #include "player.h" + #include "badguy.h" +@@ -187,11 +188,13 @@ + // This is also true with if (use_music) + Send a mail to me: neoneurone@users.sf.net, if you have another opinion. :) + */ ++#ifndef GP2X + for (i = 0; i < NUM_SOUNDS; i++) + sounds[i] = load_sound(datadir + soundfilenames[i]); ++#endif + + /* Herring song */ +- herring_song = music_manager->load_music(datadir + "/music/SALCON.MOD"); ++ herring_song = music_manager->load_music(datadir + "/music/SALCON.MOD"); + level_end_song = music_manager->load_music(datadir + "/music/leveldone.mod"); + } + +@@ -223,8 +226,10 @@ + + delete tux_life; + ++#ifndef GP2X + for (i = 0; i < NUM_SOUNDS; i++) + free_chunk(sounds[i]); ++#endif + + delete sprite_manager; + sprite_manager = 0; +diff -ur supertux-0.1.3/src/screen.cpp supertux-0.1.3-gp2x/src/screen.cpp +--- supertux-0.1.3/src/screen.cpp 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/screen.cpp 2006-04-14 18:18:47.000000000 +0300 +@@ -81,7 +81,6 @@ + else + { + #endif +- + for(float y = 0; y < 480; y += 2) + fillrect(0, (int)y, 640, 2, + (int)(((float)(top_clr.red-bot_clr.red)/(0-480)) * y + top_clr.red), +@@ -199,11 +198,23 @@ + SDL_UnlockSurface(screen); + } + /* Update just the part of the display that we've changed */ ++#ifndef RES320X240 + SDL_UpdateRect(screen, x, y, 1, 1); ++#else ++ SDL_UpdateRect(screen, x/2, y/2, 1, 1); ++#endif + } + + void drawline(int x1, int y1, int x2, int y2, int r, int g, int b, int a) + { ++ ++#ifdef RES320X240 ++ x1=x1/2; ++ x2=x2/2; ++ y1=y1/2; ++ y2=y2/2; ++#endif ++ + #ifndef NOOPENGL + if(use_gl) + { +@@ -280,6 +291,13 @@ + y += h; + h = -h; + } ++ ++#ifdef RES320X240 ++ x=x; ++ y=y/2; ++ w=w/2; ++ h=h/2; ++#endif + + #ifndef NOOPENGL + if(use_gl) +@@ -367,6 +385,9 @@ + void update_rect(SDL_Surface *scr, Sint32 x, Sint32 y, Sint32 w, Sint32 h) + { + if(!use_gl) ++#ifndef RES320X240 ++ SDL_UpdateRect(scr, x, y, w, h); ++#else + SDL_UpdateRect(scr, x, y, w, h); ++#endif + } +- +diff -ur supertux-0.1.3/src/setup.cpp supertux-0.1.3-gp2x/src/setup.cpp +--- supertux-0.1.3/src/setup.cpp 2005-07-08 15:19:17.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/setup.cpp 2006-05-03 23:32:49.000000000 +0300 +@@ -62,10 +62,19 @@ + #define DATA_PREFIX "./data/" + #endif + +-/* Screen proprities: */ ++/* Screen properties: */ + /* Don't use this to test for the actual screen sizes. Use screen->w/h instead! */ ++#ifndef RES320X240 + #define SCREEN_W 640 + #define SCREEN_H 480 ++#else ++#define SCREEN_W 320 ++#define SCREEN_H 240 ++#endif ++ ++#ifdef GP2X ++#define DATA_PREFIX "data/" ++#endif + + /* Local function prototypes: */ + +@@ -308,10 +317,14 @@ + char str[1024]; + /* Get home directory (from $HOME variable)... if we can't determine it, + use the current directory ("."): */ ++#ifndef GP2X + if (getenv("HOME") != NULL) + home = getenv("HOME"); + else + home = "."; ++#else ++ home = "."; ++#endif + + st_dir = (char *) malloc(sizeof(char) * (strlen(home) + + strlen("/.supertux") + 1)); +@@ -340,9 +353,10 @@ + // User has not that a datadir, so we try some magic + if (datadir.empty()) + { +-#ifndef WIN32 + // Detect datadir + char exe_file[PATH_MAX]; ++ ++#ifndef WIN32 + if (readlink("/proc/self/exe", exe_file, PATH_MAX) < 0) + { + puts("Couldn't read /proc/self/exe, using default path: " DATA_PREFIX); +@@ -358,7 +372,12 @@ + datadir = exedir + "../share/supertux"; // SuperTux run from PATH + if (access(datadir.c_str(), F_OK) != 0) + { // If all fails, fall back to compiled path +- datadir = DATA_PREFIX; ++ datadir = exedir + "./data"; // SuperTux run with data in same path as executable ++ if (access(datadir.c_str(), F_OK) != 0) ++ { ++ // If all fails, fall back to compiled path ++ datadir = DATA_PREFIX; ++ } + } + } + } +@@ -375,7 +394,8 @@ + main_menu = new Menu(); + options_menu = new Menu(); + options_keys_menu = new Menu(); +- options_joystick_menu = new Menu(); ++ options_joystick_axis_menu = new Menu(); ++ options_joystick_button_menu = new Menu(); + load_game_menu = new Menu(); + save_game_menu = new Menu(); + game_menu = new Menu(); +@@ -384,22 +404,27 @@ + contrib_subset_menu = new Menu(); + worldmap_menu = new Menu(); + +- main_menu->set_pos(screen->w/2, 335); ++ main_menu->set_pos(screen->w/2, (int)(335)+20); + main_menu->additem(MN_GOTO, "Start Game",0,load_game_menu, MNID_STARTGAME); + main_menu->additem(MN_GOTO, "Bonus Levels",0,contrib_menu, MNID_CONTRIB); + main_menu->additem(MN_GOTO, "Options",0,options_menu, MNID_OPTIONMENU); ++ ++#ifndef GP2X + main_menu->additem(MN_ACTION,"Level Editor",0,0, MNID_LEVELEDITOR); ++#endif + main_menu->additem(MN_ACTION,"Credits",0,0, MNID_CREDITS); + main_menu->additem(MN_ACTION,"Quit",0,0, MNID_QUITMAINMENU); + + options_menu->additem(MN_LABEL,"Options",0,0); + options_menu->additem(MN_HL,"",0,0); ++#ifndef GP2X + #ifndef NOOPENGL + options_menu->additem(MN_TOGGLE,"OpenGL",use_gl,0, MNID_OPENGL); + #else + options_menu->additem(MN_DEACTIVE,"OpenGL (not supported)",use_gl, 0, MNID_OPENGL); + #endif + options_menu->additem(MN_TOGGLE,"Fullscreen",use_fullscreen,0, MNID_FULLSCREEN); ++#endif + if(audio_device) + { + options_menu->additem(MN_TOGGLE,"Sound ", use_sound,0, MNID_SOUND); +@@ -411,10 +436,15 @@ + options_menu->additem(MN_DEACTIVE,"Music ", false,0, MNID_MUSIC); + } + options_menu->additem(MN_TOGGLE,"Show FPS ",show_fps,0, MNID_SHOWFPS); ++#ifndef GP2X + options_menu->additem(MN_GOTO,"Keyboard Setup",0,options_keys_menu); ++#endif + + //if(use_joystick) +- // options_menu->additem(MN_GOTO,"Joystick Setup",0,options_joystick_menu); ++#ifdef GP2X ++ options_menu->additem(MN_GOTO,"Joystick Move Setup",0,options_joystick_axis_menu); ++ options_menu->additem(MN_GOTO,"Joystick Action Setup",0,options_joystick_button_menu); ++#endif + + options_menu->additem(MN_HL,"",0,0); + options_menu->additem(MN_BACK,"Back",0,0); +@@ -429,6 +459,7 @@ + options_keys_menu->additem(MN_HL,"",0,0); + options_keys_menu->additem(MN_BACK,"Back",0,0); + ++#ifndef GP2X + if(use_joystick) + { + options_joystick_menu->additem(MN_LABEL,"Joystick Setup",0,0); +@@ -442,6 +473,20 @@ + options_joystick_menu->additem(MN_HL,"",0,0); + options_joystick_menu->additem(MN_BACK,"Back",0,0); + } ++#else ++ options_joystick_axis_menu->additem(MN_LABEL,"Joystick Move Setup",0,0); ++ options_joystick_axis_menu->additem(MN_CONTROLFIELD,"Up", 0,0, 11,&joystick_keymap.up_button); ++ options_joystick_axis_menu->additem(MN_CONTROLFIELD,"Down", 0,0, 12,&joystick_keymap.down_button); ++ options_joystick_axis_menu->additem(MN_CONTROLFIELD,"Left", 0,0, 13,&joystick_keymap.left_button); ++ options_joystick_axis_menu->additem(MN_CONTROLFIELD,"Right", 0,0, 14,&joystick_keymap.right_button); ++ options_joystick_axis_menu->additem(MN_BACK,"Back",0,0); ++ ++ options_joystick_button_menu->additem(MN_LABEL,"Joystick Action Setup",0,0); ++ options_joystick_button_menu->additem(MN_CONTROLFIELD,"Jump", 0,0, 15,&joystick_keymap.a_button); ++ options_joystick_button_menu->additem(MN_CONTROLFIELD,"Shoot/Run", 0,0, 16,&joystick_keymap.b_button); ++ options_joystick_button_menu->additem(MN_BACK,"Back",0,0); ++#endif ++ + + load_game_menu->additem(MN_LABEL,"Start Game",0,0); + load_game_menu->additem(MN_HL,"",0,0); +@@ -576,9 +621,10 @@ + + srand(SDL_GetTicks()); + ++#ifndef GP2X + /* Set icon image: */ +- + seticon(); ++#endif + + /* Unicode needed for input handling: */ + +@@ -586,13 +632,32 @@ + + /* Load global images: */ + ++#ifndef RES320X240 ++ white_text = new Text(datadir + "/images/status/letters-white.png", TEXT_TEXT, 16,18); ++#else ++ white_text = new Text(datadir + "/images/status/letters-white-small.png", TEXT_TEXT, 8,9); ++ fadeout(); ++#endif ++ ++ ++#ifndef RES320X240 + black_text = new Text(datadir + "/images/status/letters-black.png", TEXT_TEXT, 16,18); ++#else ++ black_text = new Text(datadir + "/images/status/letters-black.png", TEXT_TEXT, 8,9); ++#endif ++#ifndef RES320X240 + gold_text = new Text(datadir + "/images/status/letters-gold.png", TEXT_TEXT, 16,18); ++#else ++ gold_text = new Text(datadir + "/images/status/letters-gold.png", TEXT_TEXT, 8,9); ++#endif + silver_text = new Text(datadir + "/images/status/letters-silver.png", TEXT_TEXT, 16,18); ++#ifndef RES320X240 + blue_text = new Text(datadir + "/images/status/letters-blue.png", TEXT_TEXT, 16,18); ++#else ++ blue_text = new Text(datadir + "/images/status/letters-blue.png", TEXT_TEXT, 8,9); ++#endif + red_text = new Text(datadir + "/images/status/letters-red.png", TEXT_TEXT, 16,18); + green_text = new Text(datadir + "/images/status/letters-green.png", TEXT_TEXT, 16,18); +- white_text = new Text(datadir + "/images/status/letters-white.png", TEXT_TEXT, 16,18); + white_small_text = new Text(datadir + "/images/status/letters-white-small.png", TEXT_TEXT, 8,9); + white_big_text = new Text(datadir + "/images/status/letters-white-big.png", TEXT_TEXT, 20,22); + yellow_nums = new Text(datadir + "/images/status/numbers.png", TEXT_NUM, 32,32); +@@ -665,14 +736,22 @@ + Surface::reload_all(); + + /* Set window manager stuff: */ ++#ifndef GP2X_VERSION + SDL_WM_SetCaption("SuperTux " VERSION, "SuperTux"); ++#endif + } + + void st_video_setup_sdl(void) + { + if (use_fullscreen) + { ++#ifndef GP2X + screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_FULLSCREEN ) ; /* | SDL_HWSURFACE); */ ++#else ++// screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 16, SDL_HWSURFACE | SDL_DOUBLEBUF ) ; /* GP2X */ ++ printf("screen width: %d, height: %d\n",SCREEN_W, SCREEN_H); ++ screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 16, SDL_SWSURFACE ) ; /* GP2X */ ++#endif + if (screen == NULL) + { + fprintf(stderr, +@@ -685,14 +764,22 @@ + } + else + { ++#ifndef GP2X + screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_HWSURFACE | SDL_DOUBLEBUF ); +- ++#else ++// screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 16, SDL_HWSURFACE | SDL_DOUBLEBUF ) ; /* GP2X */ ++ screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 16, SDL_SWSURFACE ) ; /* GP2X */ ++#endif + if (screen == NULL) + { + fprintf(stderr, + "\nError: I could not set up video for 640x480 mode.\n" + "The Simple DirectMedia error that occured was:\n" + "%s\n\n", SDL_GetError()); ++#ifdef GP2X_VERSION ++ chdir("/usr/gp2x"); ++ execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL); ++#endif + exit(1); + } + } +@@ -790,6 +877,7 @@ + + use_joystick = false; + } ++#ifndef GP2X + else + { + if (SDL_JoystickNumAxes(js) < 2) +@@ -811,6 +899,7 @@ + } + } + } ++#endif + } + } + } +@@ -844,12 +933,17 @@ + } + } + +- ++ audio_device = true; ++ + /* Open sound silently regarless the value of "use_sound": */ + + if (audio_device) + { ++#ifndef GP2X + if (open_audio(44100, AUDIO_S16, 2, 2048) < 0) ++#else ++ if (open_audio(44100, AUDIO_S16, 1, 1024) < 0) ++#endif + { + /* only print out message if sound or music + was not disabled at command-line +@@ -878,6 +972,12 @@ + close_audio(); + SDL_Quit(); + saveconfig(); ++ ++#ifdef GP2X ++ chdir("/usr/gp2x"); ++ execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL); ++#endif ++ + } + + /* --- ABORT! --- */ +@@ -893,6 +993,7 @@ + + void seticon(void) + { ++#ifndef GP2X + // int masklen; + // Uint8 * mask; + SDL_Surface * icon; +@@ -927,6 +1028,7 @@ + + // free(mask); + SDL_FreeSurface(icon); ++#endif + } + + +@@ -956,6 +1058,7 @@ + } + else if (strcmp(argv[i], "--joymap") == 0) + { ++#ifndef GP2X + assert(i+1 < argc); + if (sscanf(argv[++i], + "%d:%d:%d:%d:%d", +@@ -976,6 +1079,7 @@ + << " B-Button: " << joystick_keymap.b_button << "\n" + << " Start-Button: " << joystick_keymap.start_button << std::endl; + } ++#endif + } + else if (strcmp(argv[i], "--leveleditor") == 0) + { +diff -ur supertux-0.1.3/src/sound.cpp supertux-0.1.3-gp2x/src/sound.cpp +--- supertux-0.1.3/src/sound.cpp 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/sound.cpp 2006-04-22 02:07:57.000000000 +0300 +@@ -22,6 +22,9 @@ + #include "globals.h" + #include "sound.h" + #include "setup.h" ++#ifdef GP2X ++#include ++#endif + + /*global variable*/ + bool use_sound = true; /* handle sound on/off menu and command-line option */ +@@ -54,12 +57,21 @@ + + #include + ++#ifndef GP2X + Mix_Chunk * sounds[NUM_SOUNDS]; ++#else + +-/* --- OPEN THE AUDIO DEVICE --- */ ++#include ++static MODULE *music=NULL; ++static SAMPLE *chunk[NUM_SOUNDS]; ++static int chunkFlag[NUM_SOUNDS]; ++#endif + ++/* --- OPEN THE AUDIO DEVICE --- */ + int open_audio (int frequency, Uint16 format, int channels, int chunksize) + { ++// close_audio(); ++#ifndef GP2X + if (Mix_OpenAudio( frequency, format, channels, chunksize ) < 0) + return -1; + +@@ -74,20 +86,93 @@ + /* prepare the spanning effects */ + Mix_SetPanning( SOUND_LEFT_SPEAKER, 230, 24 ); + Mix_SetPanning( SOUND_RIGHT_SPEAKER, 24, 230 ); ++#else ++ if (drv_oss.Name) // Valid OSS driver ++ { ++ if (drv_oss.CommandLine) // Valid Commandline ++ { ++ drv_oss.CommandLine("buffer=14,coun