[Scummvm-cvs-logs] SF.net SVN: scummvm:[51495] scummvm/branches/gsoc2010-opengl

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Fri Jul 30 07:28:11 CEST 2010


Revision: 51495
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51495&view=rev
Author:   vgvgf
Date:     2010-07-30 05:28:09 +0000 (Fri, 30 Jul 2010)

Log Message:
-----------
Merged from trunk, from Rev 50841 to HEAD

Revision Links:
--------------
    http://scummvm.svn.sourceforge.net/scummvm/?rev=50841&view=rev

Modified Paths:
--------------
    scummvm/branches/gsoc2010-opengl/AUTHORS
    scummvm/branches/gsoc2010-opengl/NEWS
    scummvm/branches/gsoc2010-opengl/README
    scummvm/branches/gsoc2010-opengl/backends/events/default/default-events.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp
    scummvm/branches/gsoc2010-opengl/backends/midi/alsa.cpp
    scummvm/branches/gsoc2010-opengl/backends/midi/seq.cpp
    scummvm/branches/gsoc2010-opengl/backends/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/android/README.build
    scummvm/branches/gsoc2010-opengl/backends/platform/android/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/dc/Makefile
    scummvm/branches/gsoc2010-opengl/backends/platform/dc/dc.h
    scummvm/branches/gsoc2010-opengl/backends/platform/dc/dcmain.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/dc/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/dc/selector.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/ds/arm9/makefile
    scummvm/branches/gsoc2010-opengl/backends/platform/ds/arm9/source/dsoptions.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/ds/ds.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/ds/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/gp2x/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/gp2xwiz/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/iphone/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/linuxmoto/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/n64/Makefile
    scummvm/branches/gsoc2010-opengl/backends/platform/n64/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/null/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/ps2/Makefile.gdb
    scummvm/branches/gsoc2010-opengl/backends/platform/ps2/Makefile.ps2
    scummvm/branches/gsoc2010-opengl/backends/platform/ps2/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/psp/Makefile
    scummvm/branches/gsoc2010-opengl/backends/platform/psp/display_client.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/psp/memory.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/psp/memory.h
    scummvm/branches/gsoc2010-opengl/backends/platform/psp/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/psp/psp_main.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/psp/trace.h
    scummvm/branches/gsoc2010-opengl/backends/platform/samsungtv/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/wii/module.mk
    scummvm/branches/gsoc2010-opengl/backends/platform/wince/module.mk
    scummvm/branches/gsoc2010-opengl/base/commandLine.cpp
    scummvm/branches/gsoc2010-opengl/base/main.cpp
    scummvm/branches/gsoc2010-opengl/base/plugins.cpp
    scummvm/branches/gsoc2010-opengl/base/version.cpp
    scummvm/branches/gsoc2010-opengl/common/hashmap.h
    scummvm/branches/gsoc2010-opengl/common/ptr.h
    scummvm/branches/gsoc2010-opengl/common/scummsys.h
    scummvm/branches/gsoc2010-opengl/common/singleton.h
    scummvm/branches/gsoc2010-opengl/common/textconsole.cpp
    scummvm/branches/gsoc2010-opengl/common/translation.cpp
    scummvm/branches/gsoc2010-opengl/common/unarj.cpp
    scummvm/branches/gsoc2010-opengl/common/util.cpp
    scummvm/branches/gsoc2010-opengl/configure
    scummvm/branches/gsoc2010-opengl/dists/iphone/icon-72.png
    scummvm/branches/gsoc2010-opengl/dists/iphone/scummvm.xcodeproj/project.pbxproj
    scummvm/branches/gsoc2010-opengl/engines/agi/agi.cpp
    scummvm/branches/gsoc2010-opengl/engines/agi/console.cpp
    scummvm/branches/gsoc2010-opengl/engines/agi/console.h
    scummvm/branches/gsoc2010-opengl/engines/agi/cycle.cpp
    scummvm/branches/gsoc2010-opengl/engines/agi/op_cmd.cpp
    scummvm/branches/gsoc2010-opengl/engines/agi/sprite.cpp
    scummvm/branches/gsoc2010-opengl/engines/agi/view.cpp
    scummvm/branches/gsoc2010-opengl/engines/agi/wagparser.cpp
    scummvm/branches/gsoc2010-opengl/engines/agi/words.cpp
    scummvm/branches/gsoc2010-opengl/engines/agos/agos.cpp
    scummvm/branches/gsoc2010-opengl/engines/agos/event.cpp
    scummvm/branches/gsoc2010-opengl/engines/agos/input.cpp
    scummvm/branches/gsoc2010-opengl/engines/agos/midi.cpp
    scummvm/branches/gsoc2010-opengl/engines/cine/cine.cpp
    scummvm/branches/gsoc2010-opengl/engines/cine/cine.h
    scummvm/branches/gsoc2010-opengl/engines/cine/detection.cpp
    scummvm/branches/gsoc2010-opengl/engines/cine/saveload.cpp
    scummvm/branches/gsoc2010-opengl/engines/cine/various.cpp
    scummvm/branches/gsoc2010-opengl/engines/cruise/cruise.cpp
    scummvm/branches/gsoc2010-opengl/engines/cruise/cruise_main.cpp
    scummvm/branches/gsoc2010-opengl/engines/cruise/vars.cpp
    scummvm/branches/gsoc2010-opengl/engines/cruise/vars.h
    scummvm/branches/gsoc2010-opengl/engines/draci/module.mk
    scummvm/branches/gsoc2010-opengl/engines/draci/walking.cpp
    scummvm/branches/gsoc2010-opengl/engines/drascula/actors.cpp
    scummvm/branches/gsoc2010-opengl/engines/engine.cpp
    scummvm/branches/gsoc2010-opengl/engines/gob/gob.cpp
    scummvm/branches/gsoc2010-opengl/engines/gob/inter_playtoons.cpp
    scummvm/branches/gsoc2010-opengl/engines/gob/mult_v2.cpp
    scummvm/branches/gsoc2010-opengl/engines/groovie/groovie.cpp
    scummvm/branches/gsoc2010-opengl/engines/groovie/vdx.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/debugger.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/detection_tables.h
    scummvm/branches/gsoc2010-opengl/engines/kyra/gui_lok.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/gui_lol.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/gui_v2.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/kyra_lok.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/kyra_lok.h
    scummvm/branches/gsoc2010-opengl/engines/kyra/kyra_mr.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/kyra_mr.h
    scummvm/branches/gsoc2010-opengl/engines/kyra/kyra_v1.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/module.mk
    scummvm/branches/gsoc2010-opengl/engines/kyra/scene_mr.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/screen.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/script_tim.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/sequences_lok.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/sound_midi.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/sound_towns.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/staticres.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/text_lok.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/timer_lok.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/vqa.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/vqa.h
    scummvm/branches/gsoc2010-opengl/engines/lure/debugger.cpp
    scummvm/branches/gsoc2010-opengl/engines/lure/fights.cpp
    scummvm/branches/gsoc2010-opengl/engines/lure/game.cpp
    scummvm/branches/gsoc2010-opengl/engines/lure/game.h
    scummvm/branches/gsoc2010-opengl/engines/lure/sound.cpp
    scummvm/branches/gsoc2010-opengl/engines/lure/sound.h
    scummvm/branches/gsoc2010-opengl/engines/m4/animation.cpp
    scummvm/branches/gsoc2010-opengl/engines/m4/animation.h
    scummvm/branches/gsoc2010-opengl/engines/m4/console.cpp
    scummvm/branches/gsoc2010-opengl/engines/m4/converse.cpp
    scummvm/branches/gsoc2010-opengl/engines/m4/graphics.cpp
    scummvm/branches/gsoc2010-opengl/engines/m4/hotspot.cpp
    scummvm/branches/gsoc2010-opengl/engines/m4/hotspot.h
    scummvm/branches/gsoc2010-opengl/engines/m4/m4_scene.cpp
    scummvm/branches/gsoc2010-opengl/engines/m4/m4_scene.h
    scummvm/branches/gsoc2010-opengl/engines/m4/mads_logic.cpp
    scummvm/branches/gsoc2010-opengl/engines/m4/mads_logic.h
    scummvm/branches/gsoc2010-opengl/engines/m4/mads_menus.cpp
    scummvm/branches/gsoc2010-opengl/engines/m4/mads_menus.h
    scummvm/branches/gsoc2010-opengl/engines/m4/mads_player.cpp
    scummvm/branches/gsoc2010-opengl/engines/m4/mads_player.h
    scummvm/branches/gsoc2010-opengl/engines/m4/mads_scene.cpp
    scummvm/branches/gsoc2010-opengl/engines/m4/mads_scene.h
    scummvm/branches/gsoc2010-opengl/engines/m4/mads_views.cpp
    scummvm/branches/gsoc2010-opengl/engines/m4/mads_views.h
    scummvm/branches/gsoc2010-opengl/engines/m4/rails.cpp
    scummvm/branches/gsoc2010-opengl/engines/m4/rails.h
    scummvm/branches/gsoc2010-opengl/engines/m4/scene.cpp
    scummvm/branches/gsoc2010-opengl/engines/m4/scene.h
    scummvm/branches/gsoc2010-opengl/engines/made/database.cpp
    scummvm/branches/gsoc2010-opengl/engines/made/detection.cpp
    scummvm/branches/gsoc2010-opengl/engines/made/resource.cpp
    scummvm/branches/gsoc2010-opengl/engines/made/scriptfuncs.cpp
    scummvm/branches/gsoc2010-opengl/engines/made/scriptfuncs.h
    scummvm/branches/gsoc2010-opengl/engines/parallaction/input.cpp
    scummvm/branches/gsoc2010-opengl/engines/queen/queen.cpp
    scummvm/branches/gsoc2010-opengl/engines/queen/resource.cpp
    scummvm/branches/gsoc2010-opengl/engines/saga/music.cpp
    scummvm/branches/gsoc2010-opengl/engines/saga/saga.cpp
    scummvm/branches/gsoc2010-opengl/engines/saga/script.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/console.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/console.h
    scummvm/branches/gsoc2010-opengl/engines/sci/detection.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/detection_tables.h
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/features.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/features.h
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kernel.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kernel.h
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kevent.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kfile.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kgraphics.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/klists.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kmath.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kmisc.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kmovement.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kparse.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kpathing.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kscripts.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/ksound.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kstring.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/message.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/savegame.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/savegame.h
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/script.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/scriptdebug.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/seg_manager.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/seg_manager.h
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/selector.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/selector.h
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/state.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/static_selectors.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/vm.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/vm.h
    scummvm/branches/gsoc2010-opengl/engines/sci/event.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/event.h
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/animate.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/cache.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/compare.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/compare.h
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/controls.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/coordadjuster.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/coordadjuster.h
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/cursor.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/cursor.h
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/font.h
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/frameout.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/frameout.h
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/helpers.h
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/menu.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/paint16.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/paint16.h
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/palette.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/palette.h
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/picture.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/picture.h
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/ports.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/ports.h
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/robot.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/robot.h
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/screen.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/text16.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/transitions.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/transitions.h
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/view.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/graphics/view.h
    scummvm/branches/gsoc2010-opengl/engines/sci/module.mk
    scummvm/branches/gsoc2010-opengl/engines/sci/parser/grammar.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/parser/said.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/parser/vocabulary.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/parser/vocabulary.h
    scummvm/branches/gsoc2010-opengl/engines/sci/resource.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/resource.h
    scummvm/branches/gsoc2010-opengl/engines/sci/resource_audio.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/resource_intern.h
    scummvm/branches/gsoc2010-opengl/engines/sci/sci.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/sci.h
    scummvm/branches/gsoc2010-opengl/engines/sci/sound/audio.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/sound/drivers/mididriver.h
    scummvm/branches/gsoc2010-opengl/engines/sci/sound/midiparser_sci.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/sound/music.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/sound/music.h
    scummvm/branches/gsoc2010-opengl/engines/sci/sound/soundcmd.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/sound/soundcmd.h
    scummvm/branches/gsoc2010-opengl/engines/scumm/debugger.cpp
    scummvm/branches/gsoc2010-opengl/engines/scumm/gfx.cpp
    scummvm/branches/gsoc2010-opengl/engines/scumm/gfx.h
    scummvm/branches/gsoc2010-opengl/engines/scumm/scumm.cpp
    scummvm/branches/gsoc2010-opengl/engines/scumm/string.cpp
    scummvm/branches/gsoc2010-opengl/engines/sky/sky.cpp
    scummvm/branches/gsoc2010-opengl/engines/sword1/memman.h
    scummvm/branches/gsoc2010-opengl/engines/sword2/anims.cpp
    scummvm/branches/gsoc2010-opengl/engines/sword2/music.cpp
    scummvm/branches/gsoc2010-opengl/engines/sword2/resman.h
    scummvm/branches/gsoc2010-opengl/engines/sword2/sword2.cpp
    scummvm/branches/gsoc2010-opengl/engines/teenagent/module.mk
    scummvm/branches/gsoc2010-opengl/engines/teenagent/teenagent.cpp
    scummvm/branches/gsoc2010-opengl/engines/tinsel/actors.cpp
    scummvm/branches/gsoc2010-opengl/engines/tinsel/bmv.cpp
    scummvm/branches/gsoc2010-opengl/engines/tinsel/handle.cpp
    scummvm/branches/gsoc2010-opengl/engines/tinsel/object.cpp
    scummvm/branches/gsoc2010-opengl/engines/tinsel/savescn.cpp
    scummvm/branches/gsoc2010-opengl/engines/tinsel/strres.cpp
    scummvm/branches/gsoc2010-opengl/engines/tinsel/tinsel.cpp
    scummvm/branches/gsoc2010-opengl/graphics/video/codecs/cinepak.cpp
    scummvm/branches/gsoc2010-opengl/graphics/video/dxa_decoder.h
    scummvm/branches/gsoc2010-opengl/graphics/video/flic_decoder.cpp
    scummvm/branches/gsoc2010-opengl/graphics/video/mpeg_player.h
    scummvm/branches/gsoc2010-opengl/graphics/video/qt_decoder.cpp
    scummvm/branches/gsoc2010-opengl/graphics/video/video_decoder.cpp
    scummvm/branches/gsoc2010-opengl/gui/GuiManager.cpp
    scummvm/branches/gsoc2010-opengl/gui/GuiManager.h
    scummvm/branches/gsoc2010-opengl/gui/ListWidget.cpp
    scummvm/branches/gsoc2010-opengl/gui/ThemeEngine.cpp
    scummvm/branches/gsoc2010-opengl/gui/ThemeEngine.h
    scummvm/branches/gsoc2010-opengl/gui/ThemeParser.cpp
    scummvm/branches/gsoc2010-opengl/gui/console.cpp
    scummvm/branches/gsoc2010-opengl/gui/credits.h
    scummvm/branches/gsoc2010-opengl/gui/debugger.cpp
    scummvm/branches/gsoc2010-opengl/gui/debugger.h
    scummvm/branches/gsoc2010-opengl/gui/launcher.cpp
    scummvm/branches/gsoc2010-opengl/gui/module.mk
    scummvm/branches/gsoc2010-opengl/gui/options.cpp
    scummvm/branches/gsoc2010-opengl/gui/options.h
    scummvm/branches/gsoc2010-opengl/gui/themes/default.inc
    scummvm/branches/gsoc2010-opengl/gui/themes/scummclassic/classic_gfx.stx
    scummvm/branches/gsoc2010-opengl/gui/themes/scummclassic/classic_layout.stx
    scummvm/branches/gsoc2010-opengl/gui/themes/scummclassic/classic_layout_lowres.stx
    scummvm/branches/gsoc2010-opengl/gui/themes/scummclassic.zip
    scummvm/branches/gsoc2010-opengl/gui/themes/scummmodern/scummmodern_gfx.stx
    scummvm/branches/gsoc2010-opengl/gui/themes/scummmodern/scummmodern_layout.stx
    scummvm/branches/gsoc2010-opengl/gui/themes/scummmodern/scummmodern_layout_lowres.stx
    scummvm/branches/gsoc2010-opengl/gui/themes/scummmodern.zip
    scummvm/branches/gsoc2010-opengl/gui/widget.cpp
    scummvm/branches/gsoc2010-opengl/gui/widget.h
    scummvm/branches/gsoc2010-opengl/sound/audiostream.cpp
    scummvm/branches/gsoc2010-opengl/sound/decoders/aiff.cpp
    scummvm/branches/gsoc2010-opengl/sound/decoders/mp3.cpp
    scummvm/branches/gsoc2010-opengl/sound/mididrv.cpp
    scummvm/branches/gsoc2010-opengl/sound/mididrv.h
    scummvm/branches/gsoc2010-opengl/sound/midiparser.cpp
    scummvm/branches/gsoc2010-opengl/sound/midiparser_smf.cpp
    scummvm/branches/gsoc2010-opengl/sound/module.mk
    scummvm/branches/gsoc2010-opengl/sound/musicplugin.h
    scummvm/branches/gsoc2010-opengl/sound/rate_arm_asm.s
    scummvm/branches/gsoc2010-opengl/sound/softsynth/mt32.cpp
    scummvm/branches/gsoc2010-opengl/sound/softsynth/opl/dbopl.cpp
    scummvm/branches/gsoc2010-opengl/sound/softsynth/opl/mame.cpp
    scummvm/branches/gsoc2010-opengl/test/common/tokenizer.h
    scummvm/branches/gsoc2010-opengl/tools/convbdf.c
    scummvm/branches/gsoc2010-opengl/tools/create_msvc/create_msvc.cpp
    scummvm/branches/gsoc2010-opengl/tools/credits.pl

Added Paths:
-----------
    scummvm/branches/gsoc2010-opengl/backends/platform/psp/tests.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/psp/tests.h
    scummvm/branches/gsoc2010-opengl/engines/kyra/staticres_lol.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kernel_tables.h
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kvideo.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/workarounds.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/workarounds.h
    scummvm/branches/gsoc2010-opengl/engines/sci/sound/drivers/amigamac.cpp
    scummvm/branches/gsoc2010-opengl/gui/Tooltip.cpp
    scummvm/branches/gsoc2010-opengl/gui/Tooltip.h
    scummvm/branches/gsoc2010-opengl/gui/themes/scummmodern/helvb12-iso-8859-1.fcc
    scummvm/branches/gsoc2010-opengl/sound/decoders/mac_snd.cpp
    scummvm/branches/gsoc2010-opengl/sound/decoders/mac_snd.h

Removed Paths:
-------------
    scummvm/branches/gsoc2010-opengl/backends/fs/palmos/
    scummvm/branches/gsoc2010-opengl/backends/midi/ypa1.cpp
    scummvm/branches/gsoc2010-opengl/backends/midi/zodiac.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/PalmOS/
    scummvm/branches/gsoc2010-opengl/backends/platform/android/scummvm-android-themeengine.patch
    scummvm/branches/gsoc2010-opengl/engines/sci/engine/kernel32.cpp
    scummvm/branches/gsoc2010-opengl/engines/sci/parser/said.y
    scummvm/branches/gsoc2010-opengl/engines/sci/sound/drivers/amiga.cpp
    scummvm/branches/gsoc2010-opengl/gui/themes/scummmodern/helvr12-l1.fcc

Property Changed:
----------------
    scummvm/branches/gsoc2010-opengl/
    scummvm/branches/gsoc2010-opengl/engines/draci/script.cpp
    scummvm/branches/gsoc2010-opengl/engines/draci/script.h


Property changes on: scummvm/branches/gsoc2010-opengl
___________________________________________________________________
Modified: svn:mergeinfo
   - /scummvm/branches/gsoc2009-draci:41389-44325
/scummvm/trunk:49204-50837
   + /scummvm/branches/gsoc2009-draci:41389-44325
/scummvm/trunk:49204-50837,50841-51493

Modified: scummvm/branches/gsoc2010-opengl/AUTHORS
===================================================================
--- scummvm/branches/gsoc2010-opengl/AUTHORS	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/AUTHORS	2010-07-30 05:28:09 UTC (rev 51495)
@@ -190,9 +190,6 @@
     Nintendo DS:
        Neil Millstone
 
-    PalmOS:
-       Chris Apers
-
     PocketPC / WinCE:
        Nicolas Bacca         - (retired)
        Kostas Nakos
@@ -256,6 +253,7 @@
 
   Retired Team Members
   --------------------
+     Chris Apers           - Former PalmOS porter
      Ralph Brorsen         - Help with GUI implementation
      Jamieson Christian    - iMUSE, MIDI, all things musical
      Felix Jakschitsch     - Zak256 reverse engineering

Modified: scummvm/branches/gsoc2010-opengl/NEWS
===================================================================
--- scummvm/branches/gsoc2010-opengl/NEWS	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/NEWS	2010-07-30 05:28:09 UTC (rev 51495)
@@ -6,6 +6,7 @@
    - Added Android port.
 
  General:
+   - Removed the outdated PalmOS port.
    - Switched to the "fast" DOSBox OPL emulator.
    - Fixed a crash in the rjp1 player code affecting the FOTAQ Amiga version.
    - Added support for more original media layouts.
@@ -29,6 +30,10 @@
    - Added support for the Macintosh version of The 7th Guest.
    - Added support for custom MT-32 instruments.
 
+ KYRA:
+   - Fixed some minor graphical glitches.
+   - Implemented formerly missing recreation of some in game items.
+
  Parallaction:
    - Made part one of The Big Red Adventure completable.
 

Modified: scummvm/branches/gsoc2010-opengl/README
===================================================================
--- scummvm/branches/gsoc2010-opengl/README	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/README	2010-07-30 05:28:09 UTC (rev 51495)
@@ -859,17 +859,13 @@
         Nintendo DS
         Nintendo Wii
         OS/2
-        PalmOS
         PlayStation 2
         PlayStation Portable
         Symbian
 
 The Dreamcast port does not support The Curse of Monkey Island, nor The
-Dig. The PalmOS port does not support The Curse of Monkey Island,
-Beneath a Steel Sky, nor either Simon the Sorcerer 1 or 2. The Dig will
-only work on some Palm devices (those with a large dynamic heap). The
-Nintendo DS port does not support Full Throttle, The Dig, or The Curse
-of Monkey Island.
+Dig. The Nintendo DS port does not support Full Throttle, The Dig, or
+The Curse of Monkey Island.
 For more platform specific limitations, please refer to our Wiki:
   http://wiki.scummvm.org/index.php/Platforms
 

Modified: scummvm/branches/gsoc2010-opengl/backends/events/default/default-events.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/events/default/default-events.cpp	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/events/default/default-events.cpp	2010-07-30 05:28:09 UTC (rev 51495)
@@ -95,13 +95,11 @@
 		case Common::EVENT_KEYDOWN:
 			_modifierState = event.kbd.flags;
 			// init continuous event stream
-			// not done on PalmOS because keyboard is emulated and keyup is not generated
-#if !defined(PALMOS_MODE)
 			_currentKeyDown.ascii = event.kbd.ascii;
 			_currentKeyDown.keycode = event.kbd.keycode;
 			_currentKeyDown.flags = event.kbd.flags;
 			_keyRepeatTime = time + kKeyRepeatInitialDelay;
-#endif
+
 			// Global Main Menu
 			if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_F5) {
 				if (g_engine && !g_engine->isPaused()) {

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp	2010-07-30 05:28:09 UTC (rev 51495)
@@ -940,7 +940,8 @@
 #endif
 
 	// If the shake position changed, fill the dirty area with blackness
-	if (_currentShakePos != _newShakePos) {
+	if (_currentShakePos != _newShakePos || 
+		(_mouseNeedsRedraw && _mouseBackup.y <= _currentShakePos)) {
 		SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor};
 
 		if (_videoMode.aspectRatioCorrection && !_overlayVisible)
@@ -1842,7 +1843,7 @@
 		return;
 
 	if (_mouseBackup.w != 0 && _mouseBackup.h != 0)
-		addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h);
+		addDirtyRect(x, y - _currentShakePos, _mouseBackup.w, _mouseBackup.h);
 }
 
 void SdlGraphicsManager::drawMouse() {

Modified: scummvm/branches/gsoc2010-opengl/backends/midi/alsa.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/midi/alsa.cpp	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/midi/alsa.cpp	2010-07-30 05:28:09 UTC (rev 51495)
@@ -24,7 +24,7 @@
 
 #include "common/scummsys.h"
 
-#if defined(UNIX) && defined(USE_ALSA)
+#if defined(USE_ALSA)
 
 #include "common/config-manager.h"
 #include "common/util.h"
@@ -48,6 +48,17 @@
 #define my_snd_seq_open(seqp) snd_seq_open(seqp, SND_SEQ_OPEN)
 #endif
 
+#define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits))
+
+static int check_permission(snd_seq_port_info_t *pinfo)
+{
+	if (perm_ok(pinfo, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE)) {
+		if (!(snd_seq_port_info_get_capability(pinfo) & SND_SEQ_PORT_CAP_NO_EXPORT))
+			return 1;
+	}
+	return 0;
+}
+
 /*
  * parse address string
  */
@@ -56,7 +67,7 @@
 
 class MidiDriver_ALSA:public MidiDriver_MPU401 {
 public:
-	MidiDriver_ALSA();
+	MidiDriver_ALSA(int client, int port);
 	int open();
 	void close();
 	void send(uint32 b);
@@ -69,34 +80,19 @@
 	snd_seq_t *seq_handle;
 	int seq_client, seq_port;
 	int my_client, my_port;
-	static int parse_addr(const char *arg, int *client, int *port);
 };
 
-MidiDriver_ALSA::MidiDriver_ALSA()
- : _isOpen(false), seq_handle(0), seq_client(0), seq_port(0), my_client(0), my_port(0)
+MidiDriver_ALSA::MidiDriver_ALSA(int client, int port)
+ : _isOpen(false), seq_handle(0), seq_client(client), seq_port(port), my_client(0), my_port(0)
 {
 	memset(&ev, 0, sizeof(ev));
 }
 
 int MidiDriver_ALSA::open() {
-	const char *var = NULL;
-
 	if (_isOpen)
 		return MERR_ALREADY_OPEN;
 	_isOpen = true;
 
-	var = getenv("SCUMMVM_PORT");
-	if (!var && ConfMan.hasKey("alsa_port")) {
-		var = ConfMan.get("alsa_port").c_str();
-	}
-
-	if (var) {
-		if (parse_addr(var, &seq_client, &seq_port) < 0) {
-			error("Invalid port %s", var);
-			return -1;
-		}
-	}
-
 	if (my_snd_seq_open(&seq_handle) < 0) {
 		error("Can't open sequencer");
 		return -1;
@@ -108,39 +104,60 @@
 	}
 	snd_seq_set_client_group(seq_handle, "input");
 
-	my_port = snd_seq_create_simple_port(seq_handle, "SCUMMVM port 0",
-		SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE |
-		SND_SEQ_PORT_CAP_READ, SND_SEQ_PORT_TYPE_MIDI_GENERIC);
+	// According to http://www.alsa-project.org/~tiwai/alsa-subs.html
+	// you can set read or write capabilities to allow other clients to
+	// read or write the port. I don't think we need that, unless maybe
+	// to be able to record the sound, but I can't get that to work even
+	// with those capabilities.
 
+	my_port = snd_seq_create_simple_port(seq_handle, "SCUMMVM port 0", 0,
+		SND_SEQ_PORT_TYPE_MIDI_GENERIC | SND_SEQ_PORT_TYPE_APPLICATION);
+
 	if (my_port < 0) {
 		snd_seq_close(seq_handle);
 		error("Can't create port");
 		return -1;
 	}
 
-	if (var) {
-		if (seq_client != SND_SEQ_ADDRESS_SUBSCRIBERS) {
-			// subscribe to MIDI port
-			if (snd_seq_connect_to(seq_handle, my_port, seq_client, seq_port) < 0) {
-				error("Can't subscribe to MIDI port (%d:%d) see README for help", seq_client, seq_port);
+	if (seq_client != SND_SEQ_ADDRESS_SUBSCRIBERS) {
+		// Subscribe to MIDI port. Prefer one that doesn't already have
+		// any connections, unless we've forced a port number already.
+		if (seq_port == -1) {
+			snd_seq_client_info_t *cinfo;
+			snd_seq_port_info_t *pinfo;
+
+			snd_seq_client_info_alloca(&cinfo);
+			snd_seq_port_info_alloca(&pinfo);
+
+			snd_seq_get_any_client_info(seq_handle, seq_client, cinfo);
+
+			int first_port = -1;
+			int found_port = -1;
+
+			snd_seq_port_info_set_client(pinfo, seq_client);
+			snd_seq_port_info_set_port(pinfo, -1);
+			while (found_port == -1 && snd_seq_query_next_port(seq_handle, pinfo) >= 0) {
+				if (check_permission(pinfo)) {
+					if (first_port == -1)
+						first_port = snd_seq_port_info_get_port(pinfo);
+					if (found_port == -1 && snd_seq_port_info_get_write_use(pinfo) == 0)
+						found_port = snd_seq_port_info_get_port(pinfo);
+				}
 			}
+
+			if (found_port == -1) {
+				// Should we abort here? For now, use the first
+				// available port.
+				seq_port = first_port;
+				warning("MidiDriver_ALSA: All ports on client %d (%s) are already in use", seq_client, snd_seq_client_info_get_name(cinfo));
+			} else {
+				seq_port = found_port;
+			}
 		}
-	} else {
-		int defaultPorts[] = {
-			65, 0,
-			17, 0
-		};
-		int i;
 
-		for (i = 0; i < ARRAYSIZE(defaultPorts); i += 2) {
-			seq_client = defaultPorts[i];
-			seq_port = defaultPorts[i + 1];
-			if (snd_seq_connect_to(seq_handle, my_port, seq_client, seq_port) >= 0)
-				break;
+		if (snd_seq_connect_to(seq_handle, my_port, seq_client, seq_port) < 0) {
+			error("Can't subscribe to MIDI port (%d:%d) see README for help", seq_client, seq_port);
 		}
-
-		if (i >= ARRAYSIZE(defaultPorts))
-			error("Can't subscribe to MIDI port (65:0) or (17:0)");
 	}
 
 	printf("Connected to Alsa sequencer client [%d:%d]\n", seq_client, seq_port);
@@ -150,10 +167,13 @@
 }
 
 void MidiDriver_ALSA::close() {
-	_isOpen = false;
-	MidiDriver_MPU401::close();
-	if (seq_handle)
-		snd_seq_close(seq_handle);
+	if (_isOpen) {
+		_isOpen = false;
+		MidiDriver_MPU401::close();
+		if (seq_handle)
+			snd_seq_close(seq_handle);
+	} else
+		warning("MidiDriver_ALSA: Closing the driver before opening it");
 }
 
 void MidiDriver_ALSA::send(uint32 b) {
@@ -227,24 +247,6 @@
 	send_event(1);
 }
 
-int MidiDriver_ALSA::parse_addr(const char *arg, int *client, int *port) {
-	const char *p;
-
-	if (isdigit(*arg)) {
-		if ((p = strpbrk(arg, ADDR_DELIM)) == NULL)
-			return -1;
-		*client = atoi(arg);
-		*port = atoi(p + 1);
-	} else {
-		if (*arg == 's' || *arg == 'S') {
-			*client = SND_SEQ_ADDRESS_SUBSCRIBERS;
-			*port = 0;
-		} else
-			return -1;
-	}
-	return 0;
-}
-
 void MidiDriver_ALSA::send_event(int do_flush) {
 	snd_seq_ev_set_direct(&ev);
 	snd_seq_ev_set_source(&ev, my_port);
@@ -258,6 +260,37 @@
 
 // Plugin interface
 
+class AlsaDevice {
+public:
+	AlsaDevice(Common::String name, MusicType mt, int client);
+	Common::String getName();
+	MusicType getType();
+	int getClient();
+
+private:
+	Common::String _name;
+	MusicType _type;
+	int _client;
+};
+
+typedef Common::List<AlsaDevice> AlsaDevices;
+
+AlsaDevice::AlsaDevice(Common::String name, MusicType mt, int client)
+	: _name(name), _type(mt), _client(client) {
+}
+
+Common::String AlsaDevice::getName() {
+	return _name;
+}
+
+MusicType AlsaDevice::getType() {
+	return _type;
+}
+
+int AlsaDevice::getClient() {
+	return _client;
+}
+
 class AlsaMusicPlugin : public MusicPluginObject {
 public:
 	const char *getName() const {
@@ -268,26 +301,18 @@
 		return "alsa";
 	}
 
+	AlsaDevices getAlsaDevices() const;
 	MusicDevices getDevices() const;
 	Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const;
+
+private:
+	static int parse_addr(const char *arg, int *client, int *port);
 };
 
-#define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits))
-
-static int check_permission(snd_seq_port_info_t *pinfo)
-{
-	if (perm_ok(pinfo, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE)) {
-		if (!(snd_seq_port_info_get_capability(pinfo) & SND_SEQ_PORT_CAP_NO_EXPORT))
-			return 1;
-	}
-	return 0;
-}
-
-MusicDevices AlsaMusicPlugin::getDevices() const {
-	MusicDevices devices;
-
-	snd_seq_t *seq;
-	if (snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0) < 0)
+AlsaDevices AlsaMusicPlugin::getAlsaDevices() const {
+	AlsaDevices devices;
+	snd_seq_t *seq_handle;
+	if (my_snd_seq_open(&seq_handle) < 0)
 		return devices; // can't open sequencer
 
 	snd_seq_client_info_t *cinfo;
@@ -295,32 +320,147 @@
 	snd_seq_port_info_t *pinfo;
 	snd_seq_port_info_alloca(&pinfo);
 	snd_seq_client_info_set_client(cinfo, -1);
-	while (snd_seq_query_next_client(seq, cinfo) >= 0) {
+	while (snd_seq_query_next_client(seq_handle, cinfo) >= 0) {
 		bool found_valid_port = false;
 
 		/* reset query info */
 		snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo));
 		snd_seq_port_info_set_port(pinfo, -1);
-		while (!found_valid_port && snd_seq_query_next_port(seq, pinfo) >= 0) {
+		while (!found_valid_port && snd_seq_query_next_port(seq_handle, pinfo) >= 0) {
 			if (check_permission(pinfo)) {
 				found_valid_port = true;
-				// TODO: Return a different music type depending on the configuration
-				devices.push_back(MusicDevice(this, snd_seq_client_info_get_name(cinfo), MT_GM));
-				//snd_seq_client_info_get_client(cinfo) : snd_seq_port_info_get_port(pinfo)
+
+				const char *name = snd_seq_client_info_get_name(cinfo);
+				// TODO: Can we figure out the appropriate music type?
+				MusicType type = MT_GM;
+				int client = snd_seq_client_info_get_client(cinfo);
+				devices.push_back(AlsaDevice(name, type, client));
 			}
 		}
 	}
-	snd_seq_close(seq);
+	snd_seq_close(seq_handle);
 
 	return devices;
 }
 
-Common::Error AlsaMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const {
-	*mididriver = new MidiDriver_ALSA();
+MusicDevices AlsaMusicPlugin::getDevices() const {
+	MusicDevices devices;
+	AlsaDevices::iterator d;
 
+	AlsaDevices alsaDevices = getAlsaDevices();
+
+	// Since the default behaviour is to use the first device in the list,
+	// try to put something sensible there. We used to have 17:0 and 65:0
+	// as defaults.
+
+	for (d = alsaDevices.begin(); d != alsaDevices.end();) {
+		const int client = d->getClient();
+
+		if (client == 17 || client == 65) {
+			devices.push_back(MusicDevice(this, d->getName(), d->getType()));
+			d = alsaDevices.erase(d);
+		} else {
+			++d;
+		}
+	}
+
+	// 128:0 is probably TiMidity, or something like that, so that's
+	// probably a good second choice.
+
+	for (d = alsaDevices.begin(); d != alsaDevices.end();) {
+		if (d->getClient() == 128) {
+			devices.push_back(MusicDevice(this, d->getName(), d->getType()));
+			d = alsaDevices.erase(d);
+		} else {
+			++d;
+		}
+	}
+
+	// Add the remaining devices in the order they were found.
+
+	for (d = alsaDevices.begin(); d != alsaDevices.end(); ++d)
+		devices.push_back(MusicDevice(this, d->getName(), d->getType()));
+
+	return devices;
+}
+
+Common::Error AlsaMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle dev) const {
+	bool found = false;
+	int seq_client, seq_port;
+
+	const char *var = NULL;
+
+	// TODO: Upgrade from old alsa_port setting. This probably isn't the
+	// right place to do that, though.
+
+	if (ConfMan.hasKey("alsa_port")) {
+		warning("AlsaMusicPlugin: Found old 'alsa_port' setting, which will be ignored");
+	}
+
+	// The SCUMMVM_PORT environment variable can still be used to override
+	// any config setting.
+
+	var = getenv("SCUMMVM_PORT");
+	if (var) {
+		warning("AlsaMusicPlugin: SCUMMVM_PORT environment variable overrides config settings");
+		if (parse_addr(var, &seq_client, &seq_port) >= 0) {
+			found = true;
+		} else {
+			warning("AlsaMusicPlugin: Invalid port %s, using config settings instead", var);
+		}
+	}
+
+	// Try to match the setting to an available ALSA device.
+
+	if (!found && dev) {
+		AlsaDevices alsaDevices = getAlsaDevices();
+
+		for (AlsaDevices::iterator d = alsaDevices.begin(); d != alsaDevices.end(); ++d) {
+			MusicDevice device(this, d->getName(), d->getType());
+
+			if (device.getCompleteId().equals(MidiDriver::getDeviceString(dev, MidiDriver::kDeviceId))) {
+				found = true;
+				seq_client = d->getClient();
+				seq_port = -1;
+				break;
+			}
+		}
+	}
+
+	// Still nothing? Try a sensible default.
+
+	if (!found) {
+		// TODO: What's a sensible default anyway? And exactly when do
+		// we get to this case?
+
+		warning("AlsaMusicPlugin: Using 17:0 as default ALSA port");
+		seq_client = 17;
+		seq_port = 0;
+	}
+
+	*mididriver = new MidiDriver_ALSA(seq_client, seq_port);
+
 	return Common::kNoError;
 }
 
+int AlsaMusicPlugin::parse_addr(const char *arg, int *client, int *port) {
+	const char *p;
+
+	if (isdigit(*arg)) {
+		if ((p = strpbrk(arg, ADDR_DELIM)) == NULL)
+			return -1;
+		*client = atoi(arg);
+		*port = atoi(p + 1);
+	} else {
+		if (*arg == 's' || *arg == 'S') {
+			*client = SND_SEQ_ADDRESS_SUBSCRIBERS;
+			*port = 0;
+		} else
+			return -1;
+	}
+	return 0;
+}
+
 //#if PLUGIN_ENABLED_DYNAMIC(ALSA)
 	//REGISTER_PLUGIN_DYNAMIC(ALSA, PLUGIN_TYPE_MUSIC, AlsaMusicPlugin);
 //#else

Modified: scummvm/branches/gsoc2010-opengl/backends/midi/seq.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/midi/seq.cpp	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/midi/seq.cpp	2010-07-30 05:28:09 UTC (rev 51495)
@@ -28,8 +28,10 @@
  *    both the QuickTime support and (vkeybd http://www.alsa-project.org/~iwai/alsa.html)
  */
 
-#if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__) && !defined(__MINT__) && !defined(__ANDROID__)
+#include "common/scummsys.h"
 
+#if defined(USE_SEQ_MIDI)
+
 #include "common/util.h"
 #include "sound/musicplugin.h"
 #include "sound/mpu401.h"

Deleted: scummvm/branches/gsoc2010-opengl/backends/midi/ypa1.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/midi/ypa1.cpp	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/midi/ypa1.cpp	2010-07-30 05:28:09 UTC (rev 51495)
@@ -1,141 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- */
-
-#include "common/util.h"
-#include "sound/musicplugin.h"
-#include "sound/mpu401.h"
-
-#include "Pa1Lib.h"
-
-class MidiDriver_YamahaPa1:public MidiDriver_MPU401 {
-public:
-	MidiDriver_YamahaPa1();
-	int open();
-	void close();
-	void send(uint32 b);
-
-private:
-	UInt8 _midiHandle;
-	Boolean _isOpen;
- };
-
-MidiDriver_YamahaPa1::MidiDriver_YamahaPa1() {
-	_isOpen = false;
-	_midiHandle = 0;
-}
-
-int MidiDriver_YamahaPa1::open() {
-	if (!(_isOpen = Pa1Lib_midiOpen(NULL, &_midiHandle)))
-		return MERR_DEVICE_NOT_AVAILABLE;
-
-	return 0;
-}
-
-void MidiDriver_YamahaPa1::close() {
-	if (_isOpen) {
-		_isOpen = false;
-		MidiDriver_MPU401::close();
-		for (UInt8 channel = 0; channel < 16; channel++) {
-			Pa1Lib_midiControlChange(_midiHandle, channel, 120,0); // all sound off
-			Pa1Lib_midiControlChange(_midiHandle, channel, 121,0); // reset all controller
-			Pa1Lib_midiControlChange(_midiHandle, channel, 123, 0); // all notes off
-		}
-		Pa1Lib_midiClose(_midiHandle);
-	}
-}
-
-void MidiDriver_YamahaPa1::send(uint32 b) {
-	if (!_isOpen)
-		return;
-
-	UInt8 midiCmd[4];
-	UInt8 chanID,mdCmd;
-
-	midiCmd[3] = (b & 0xFF000000) >> 24;
-	midiCmd[2] = (b & 0x00FF0000) >> 16;
-	midiCmd[1] = (b & 0x0000FF00) >> 8;
-	midiCmd[0] = (b & 0x000000FF);
-
-	chanID = (midiCmd[0] & 0x0F) ;
-	mdCmd = midiCmd[0] & 0xF0;
-
-	switch (mdCmd) {
-		case 0x80:	// note off
-			Pa1Lib_midiNoteOff(_midiHandle, chanID, midiCmd[1], 0);
-			break;
-
-		case 0x90:	// note on
-			Pa1Lib_midiNoteOn(_midiHandle, chanID, midiCmd[1], midiCmd[2]);
-			break;
-
-		case 0xB0:	// control change
-			Pa1Lib_midiControlChange(_midiHandle, chanID, midiCmd[1], midiCmd[2]);
-			break;
-
-		case 0xC0:	// progam change
-			Pa1Lib_midiProgramChange(_midiHandle, chanID, midiCmd[1]);
-			break;
-
-		case 0xE0:	// pitchBend
-			Pa1Lib_midiPitchBend(_midiHandle, chanID, (short)(midiCmd[1] | (midiCmd[2] << 8)));
-			break;
-	}
-}
-
-
-// Plugin interface
-
-class YamahaPa1MusicPlugin : public MusicPluginObject {
-public:
-	const char *getName() const {
-		return "Yamaha Pa1";
-	}
-
-	const char *getId() const {
-		return "ypa1";
-	}
-
-	MusicDevices getDevices() const;
-	Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const;
-};
-
-MusicDevices YamahaPa1MusicPlugin::getDevices() const {
-	MusicDevices devices;
-	// TODO: Return a different music type depending on the configuration
-	// TODO: List the available devices
-	devices.push_back(MusicDevice(this, "", MT_GM));
-	return devices;
-}
-
-Common::Error YamahaPa1MusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const {
-	*mididriver = new MidiDriver_YamahaPa1();
-
-	return Common::kNoError;
-}
-
-//#if PLUGIN_ENABLED_DYNAMIC(YPA1)
-	//REGISTER_PLUGIN_DYNAMIC(YPA1, PLUGIN_TYPE_MUSIC, YamahaPa1MusicPlugin);
-//#else
-	REGISTER_PLUGIN_STATIC(YPA1, PLUGIN_TYPE_MUSIC, YamahaPa1MusicPlugin);
-//#endif

Deleted: scummvm/branches/gsoc2010-opengl/backends/midi/zodiac.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/midi/zodiac.cpp	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/midi/zodiac.cpp	2010-07-30 05:28:09 UTC (rev 51495)
@@ -1,161 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- */
-
-#include "common/util.h"
-#include "sound/musicplugin.h"
-#include "sound/mpu401.h"
-
-#ifndef DISABLE_TAPWAVE
-
-#include <tapwave.h>
-
-
-class MidiDriver_Zodiac:public MidiDriver_MPU401 {
-public:
-	MidiDriver_Zodiac();
-	int open();
-	void close();
-	void send(uint32 b);
-	void sysEx(const byte *msg, uint16 length);
-
-private:
-	TwMidiHandle _midiHandle;
-	Boolean _isOpen;
-	Int32 _oldVol;
- };
-
-MidiDriver_Zodiac::MidiDriver_Zodiac() {
-	_isOpen = false;
-	_midiHandle = 0;
-}
-
-int MidiDriver_Zodiac::open() {
-	Err e;
-
-	if (e = TwMidiOpen(&_midiHandle))
-		return MERR_DEVICE_NOT_AVAILABLE;
-
-	TwMidiGetMasterVolume(&_oldVol);
-	TwMidiSetMasterVolume(twMidiMaxVolume); // TODO : set volume based on gVars
-
-	_isOpen = true;
-	return 0;
-}
-
-void MidiDriver_Zodiac::close() {
-	if (_isOpen) {
-		_isOpen = false;
-		MidiDriver_MPU401::close();
-
-		TwMidiSetMasterVolume(_oldVol);
-		TwMidiClose(_midiHandle);
-	}
-}
-
-void MidiDriver_Zodiac::send(uint32 b) {
-	if (!_isOpen)
-		return;
-
-	UInt8 midiCmd[4];
-	UInt8 chanID,mdCmd;
-
-	midiCmd[3] = (b & 0xFF000000) >> 24;
-	midiCmd[2] = (b & 0x00FF0000) >> 16;
-	midiCmd[1] = (b & 0x0000FF00) >> 8;
-	midiCmd[0] = (b & 0x000000FF);
-
-	chanID = (midiCmd[0] & 0x0F) ;
-	mdCmd = midiCmd[0] & 0xF0;
-
-	switch (mdCmd) {
-		case 0x80:	// note off
-			TwMidiNoteOff(_midiHandle, chanID, midiCmd[1], 0);
-			break;
-
-		case 0x90:	// note on
-			TwMidiNoteOn(_midiHandle, chanID, midiCmd[1], midiCmd[2]);
-			break;
-
-		case 0xB0:	// control change
-			TwMidiControlChange(_midiHandle, chanID, midiCmd[1], midiCmd[2]);
-			break;
-
-		case 0xC0:	// progam change
-			TwMidiProgramChange(_midiHandle, chanID, midiCmd[1]);
-			break;
-
-		case 0xE0:	// pitchBend
-			TwMidiPitchBend(_midiHandle, chanID, (short)(midiCmd[1] | (midiCmd[2] << 8)));
-			break;
-	}
-}
-
-void MidiDriver_Zodiac::sysEx(const byte *msg, uint16 length) {
-	unsigned char buf[266];
-
-	buf[0] = 0xF0;
-	memcpy(buf + 1, msg, length);
-	buf[length + 1] = 0xF7;
-
-	TwMidiSysEx(_midiHandle, 0, (byte *)buf, length + 2);
-}
-
-
-// Plugin interface
-
-class ZodiacMusicPlugin : public MusicPluginObject {
-public:
-	const char *getName() const {
-		return "Tapwave Zodiac";
-	}
-
-	const char *getId() const {
-		return "zodiac";
-	}
-
-	MusicDevices getDevices() const;
-	Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const;
-};
-
-MusicDevices ZodiacMusicPlugin::getDevices() const {
-	MusicDevices devices;
-	// TODO: Return a different music type depending on the configuration
-	// TODO: List the available devices
-	devices.push_back(MusicDevice(this, "", MT_GM));
-	return devices;
-}
-
-Common::Error ZodiacMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const {
-	*mididriver = new MidiDriver_Zodiac();
-
-	return Common::kNoError;
-}
-
-//#if PLUGIN_ENABLED_DYNAMIC(ZODIAC)
-	//REGISTER_PLUGIN_DYNAMIC(ZODIAC, PLUGIN_TYPE_MUSIC, ZodiacMusicPlugin);
-//#else
-	REGISTER_PLUGIN_STATIC(ZODIAC, PLUGIN_TYPE_MUSIC, ZodiacMusicPlugin);
-//#endif
-
-#endif

Modified: scummvm/branches/gsoc2010-opengl/backends/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -14,17 +14,9 @@
 	fs/abstract-fs.o \
 	fs/stdiostream.o \
 	fs/amigaos4/amigaos4-fs-factory.o \
-	fs/ds/ds-fs-factory.o \
-	fs/palmos/palmos-fs-factory.o \
 	fs/posix/posix-fs-factory.o \
-	fs/ps2/ps2-fs-factory.o \
-	fs/psp/psp-fs-factory.o \
-	fs/psp/psp-stream.o \
 	fs/symbian/symbian-fs-factory.o \
 	fs/windows/windows-fs-factory.o \
-	fs/wii/wii-fs-factory.o \
-	fs/n64/n64-fs-factory.o \
-	fs/n64/romfsstream.o \
 	graphics/gp2xsdl/gp2xsdl-graphics.o \
 	graphics/gp2xwizsdl/gp2xwizsdl-graphics.o \
 	graphics/linuxmotosdl/linuxmotosdl-graphics.o \
@@ -55,13 +47,10 @@
 	plugins/posix/posix-provider.o \
 	plugins/sdl/sdl-provider.o \
 	plugins/win32/win32-provider.o \
-	plugins/psp/psp-provider.o \
 	saves/savefile.o \
 	saves/default/default-saves.o \
 	saves/posix/posix-saves.o \
-	saves/psp/psp-saves.o \
 	timer/default/default-timer.o \
-	timer/psp/timer.o \
 	timer/sdl/sdl-timer.o \
 	vkeybd/image-map.o \
 	vkeybd/polygon.o \
@@ -69,5 +58,41 @@
 	vkeybd/virtual-keyboard-gui.o \
 	vkeybd/virtual-keyboard-parser.o
 
+ifeq ($(BACKEND),dc)
+MODULE_OBJS += \
+	plugins/dc/dc-provider.o
+endif
+
+ifeq ($(BACKEND),ds)
+MODULE_OBJS += \
+	fs/ds/ds-fs-factory.o \
+	fs/ds/ds-fs.o
+endif
+
+ifeq ($(BACKEND),n64)
+MODULE_OBJS += \
+	fs/n64/n64-fs-factory.o \
+	fs/n64/romfsstream.o
+endif
+
+ifeq ($(BACKEND),ps2)
+MODULE_OBJS += \
+	fs/ps2/ps2-fs-factory.o
+endif
+
+ifeq ($(BACKEND),psp)
+MODULE_OBJS += \
+	fs/psp/psp-fs-factory.o \
+	fs/psp/psp-stream.o \
+	plugins/psp/psp-provider.o \
+	saves/psp/psp-saves.o \
+	timer/psp/timer.o
+endif
+
+ifeq ($(BACKEND),wii)
+MODULE_OBJS += \
+	fs/wii/wii-fs-factory.o
+endif
+
 # Include common rules
 include $(srcdir)/rules.mk

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/android/README.build
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/android/README.build	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/android/README.build	2010-07-30 05:28:09 UTC (rev 51495)
@@ -67,10 +67,6 @@
 Building ScummVM
 ================
 
-Apply the theme engine patch:
-
- patch -p1 < backends/platform/android/scummvm-android-themeengine.patch
-
 (Optionally) compress scummmodern.zip:
 (ScummVM usually ships it uncompressed, but Android can read it more
 efficiently if it is compressed *before* adding it to the apk)

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/android/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/android/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/android/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -3,12 +3,11 @@
 MODULE_OBJS := \
 	android.o asset-archive.o video.o
 
-MODULE_DIRS += \
-	backends/platform/android/
+# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
 
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
-
 JAVA_SRC = \
 	$(MODULE)/org/inodes/gus/scummvm/ScummVM.java \
 	$(MODULE)/org/inodes/gus/scummvm/ScummVMApplication.java \

Deleted: scummvm/branches/gsoc2010-opengl/backends/platform/android/scummvm-android-themeengine.patch
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/android/scummvm-android-themeengine.patch	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/android/scummvm-android-themeengine.patch	2010-07-30 05:28:09 UTC (rev 51495)
@@ -1,135 +0,0 @@
-diff -r 884e66fd1b9c gui/ThemeEngine.cpp
---- a/gui/ThemeEngine.cpp	Tue Apr 13 09:30:52 2010 +1000
-+++ b/gui/ThemeEngine.cpp	Fri May 28 23:24:43 2010 +1000
-@@ -390,21 +390,19 @@
- 
- 	// Try to create a Common::Archive with the files of the theme.
- 	if (!_themeArchive && !_themeFile.empty()) {
--		Common::FSNode node(_themeFile);
--		if (node.getName().hasSuffix(".zip") && !node.isDirectory()) {
-+		Common::ArchiveMemberPtr member = SearchMan.getMember(_themeFile);
-+		if (member && member->getName().hasSuffix(".zip")) {
- #ifdef USE_ZLIB
--			Common::Archive *zipArchive = Common::makeZipArchive(node);
-+			Common::Archive *zipArchive = Common::makeZipArchive(member->createReadStream());
- 
- 			if (!zipArchive) {
--				warning("Failed to open Zip archive '%s'.", node.getPath().c_str());
-+				warning("Failed to open Zip archive '%s'.", member->getDisplayName().c_str());
- 			}
- 			_themeArchive = zipArchive;
- #else
- 			warning("Trying to load theme '%s' in a Zip archive without zLib support", _themeFile.c_str());
- 			return false;
- #endif
--		} else if (node.isDirectory()) {
--			_themeArchive = new Common::FSDirectory(node);
- 		}
- 	}
- 
-@@ -1436,6 +1434,30 @@
- 	return tok.empty();
- }
- 
-+bool ThemeEngine::themeConfigUsable(const Common::ArchiveMember &member, Common::String &themeName) {
-+	Common::File stream;
-+	bool foundHeader = false;
-+
-+	if (member.getName().hasSuffix(".zip")) {
-+#ifdef USE_ZLIB
-+		Common::Archive *zipArchive = Common::makeZipArchive(member.createReadStream());
-+
-+		if (zipArchive && zipArchive->hasFile("THEMERC")) {
-+			stream.open("THEMERC", *zipArchive);
-+		}
-+
-+		delete zipArchive;
-+#endif
-+	}
-+
-+	if (stream.isOpen()) {
-+		Common::String stxHeader = stream.readLine();
-+		foundHeader = themeConfigParseHeader(stxHeader, themeName);
-+	}
-+
-+	return foundHeader;
-+}
-+
- bool ThemeEngine::themeConfigUsable(const Common::FSNode &node, Common::String &themeName) {
- 	Common::File stream;
- 	bool foundHeader = false;
-@@ -1493,10 +1515,6 @@
- 	if (ConfMan.hasKey("themepath"))
- 		listUsableThemes(Common::FSNode(ConfMan.get("themepath")), list);
- 
--#ifdef DATA_PATH
--	listUsableThemes(Common::FSNode(DATA_PATH), list);
--#endif
--
- #if defined(MACOSX) || defined(IPHONE)
- 	CFURLRef resourceUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
- 	if (resourceUrl) {
-@@ -1509,10 +1527,7 @@
- 	}
- #endif
- 
--	if (ConfMan.hasKey("extrapath"))
--		listUsableThemes(Common::FSNode(ConfMan.get("extrapath")), list);
--
--	listUsableThemes(Common::FSNode("."), list, 1);
-+	listUsableThemes(SearchMan, list);
- 
- 	// Now we need to strip all duplicates
- 	// TODO: It might not be the best idea to strip duplicates. The user might
-@@ -1531,6 +1546,34 @@
- 	output.clear();
- }
- 
-+void ThemeEngine::listUsableThemes(Common::Archive &archive, Common::List<ThemeDescriptor> &list) {
-+	ThemeDescriptor td;
-+
-+#ifdef USE_ZLIB
-+	Common::ArchiveMemberList fileList;
-+	archive.listMatchingMembers(fileList, "*.zip");
-+	for (Common::ArchiveMemberList::iterator i = fileList.begin();
-+	     i != fileList.end(); ++i) {
-+		td.name.clear();
-+		if (themeConfigUsable(**i, td.name)) {
-+			td.filename = (*i)->getName();
-+			td.id = (*i)->getDisplayName();
-+
-+			// If the name of the node object also contains
-+			// the ".zip" suffix, we will strip it.
-+			if (td.id.hasSuffix(".zip")) {
-+				for (int j = 0; j < 4; ++j)
-+					td.id.deleteLastChar();
-+			}
-+
-+			list.push_back(td);
-+		}
-+	}
-+
-+	fileList.clear();
-+#endif
-+}
-+
- void ThemeEngine::listUsableThemes(const Common::FSNode &node, Common::List<ThemeDescriptor> &list, int depth) {
- 	if (!node.exists() || !node.isReadable() || !node.isDirectory())
- 		return;
-diff -r 884e66fd1b9c gui/ThemeEngine.h
---- a/gui/ThemeEngine.h	Tue Apr 13 09:30:52 2010 +1000
-+++ b/gui/ThemeEngine.h	Fri May 28 23:24:43 2010 +1000
-@@ -560,11 +560,13 @@
- 	static void listUsableThemes(Common::List<ThemeDescriptor> &list);
- private:
- 	static bool themeConfigUsable(const Common::FSNode &node, Common::String &themeName);
-+	static bool themeConfigUsable(const Common::ArchiveMember &member, Common::String &themeName);
- 	static bool themeConfigParseHeader(Common::String header, Common::String &themeName);
- 
- 	static Common::String getThemeFile(const Common::String &id);
- 	static Common::String getThemeId(const Common::String &filename);
- 	static void listUsableThemes(const Common::FSNode &node, Common::List<ThemeDescriptor> &list, int depth = -1);
-+	static void listUsableThemes(Common::Archive &archive, Common::List<ThemeDescriptor> &list);
- 
- protected:
- 	OSystem *_system; /** Global system object. */

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/dc/Makefile
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/dc/Makefile	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/dc/Makefile	2010-07-30 05:28:09 UTC (rev 51495)
@@ -69,6 +69,8 @@
 
 MODULE_DIRS += ./
 
+BACKEND := dc
+
 include $(srcdir)/Makefile.common
 
 scummvm.bin : scummvm.elf

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/dc/dc.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/dc/dc.h	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/dc/dc.h	2010-07-30 05:28:09 UTC (rev 51495)
@@ -233,6 +233,9 @@
 
 
   Common::SaveFileManager *createSavefileManager();
+
+  Common::SeekableReadStream *createConfigReadStream();
+  Common::WriteStream *createConfigWriteStream();
 };
 
 

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/dc/dcmain.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/dc/dcmain.cpp	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/dc/dcmain.cpp	2010-07-30 05:28:09 UTC (rev 51495)
@@ -31,6 +31,7 @@
 #include "icon.h"
 #include "DCLauncherDialog.h"
 #include <common/config-manager.h>
+#include <common/stream.h>
 
 #include "backends/plugins/dc/dc-provider.h"
 #include "sound/mixer_intern.h"
@@ -206,6 +207,16 @@
   td.tm_year = t.tm_year;
 }
 
+Common::SeekableReadStream *OSystem_Dreamcast::createConfigReadStream() {
+  Common::FSNode file("/scummvm.ini");
+  Common::SeekableReadStream *s = file.createReadStream();
+  return s? s : new Common::MemoryReadStream((const byte *)"", 0);
+}
+
+Common::WriteStream *OSystem_Dreamcast::createConfigWriteStream() {
+  return 0;
+}
+
 void DCHardware::dc_init_hardware()
 {
 #ifndef NOSERIAL

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/dc/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/dc/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/dc/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -3,8 +3,7 @@
 MODULE_OBJS :=	dcmain.o time.o display.o audio.o input.o selector.o icon.o \
 	label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o
 
-MODULE_DIRS += \
-        backends/platform/dc/
-
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
+# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/dc/selector.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/dc/selector.cpp	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/dc/selector.cpp	2010-07-30 05:28:09 UTC (rev 51495)
@@ -30,6 +30,7 @@
 #include <base/plugins.h>
 #include <common/fs.h>
 #include <common/events.h>
+#include <common/config-manager.h>
 #include "dc.h"
 #include "icon.h"
 #include "label.h"
@@ -200,12 +201,43 @@
   return true;
 }
 
-static int findGames(Game *games, int max)
+static int findGames(Game *games, int max, bool use_ini)
 {
   Dir *dirs = new Dir[MAX_DIR];
-  int curr_game = 0, curr_dir = 0, num_dirs = 1;
-  dirs[0].node = Common::FSNode("");
-  while (curr_game < max && curr_dir < num_dirs) {
+  int curr_game = 0, curr_dir = 0, num_dirs = 0;
+
+  if (use_ini) {
+    ConfMan.loadDefaultConfigFile();
+    Common::ConfigManager::DomainMap &game_domains = ConfMan.getGameDomains();
+    for(Common::ConfigManager::DomainMap::const_iterator i =
+	  game_domains.begin(); curr_game < max && i != game_domains.end(); i++) {
+      Common::String path = (*i)._value["path"];
+      if (path.size() && path.lastChar() != '/')
+	path += "/";
+      int j;
+      for (j=0; j<num_dirs; j++)
+	if (path.equals(dirs[j].node.getPath()))
+	  break;
+      if (j >= num_dirs) {
+	if (num_dirs >= MAX_DIR)
+	  continue;
+	dirs[j = num_dirs++].node = Common::FSNode(path);
+      }
+      if (curr_game < max) {
+	strcpy(games[curr_game].filename_base, (*i)._key.c_str());
+	strncpy(games[curr_game].dir, dirs[j].node.getPath().c_str(), 256);
+	games[curr_game].dir[255] = '\0';
+	games[curr_game].language = Common::UNK_LANG;
+	games[curr_game].platform = Common::kPlatformUnknown;
+	strcpy(games[curr_game].text, (*i)._value["description"].c_str());
+	curr_game++;
+      }
+    }
+  } else {
+    dirs[num_dirs++].node = Common::FSNode("");
+  }
+
+  while ((curr_game < max || use_ini) && curr_dir < num_dirs) {
     strncpy(dirs[curr_dir].name, dirs[curr_dir].node.getPath().c_str(), 252);
     dirs[curr_dir].name[251] = '\0';
     dirs[curr_dir].deficon[0] = '\0';
@@ -214,44 +246,46 @@
     for (Common::FSList::const_iterator entry = fslist.begin(); entry != fslist.end();
 	 ++entry) {
       if (entry->isDirectory()) {
-	if (num_dirs < MAX_DIR && strcasecmp(entry->getDisplayName().c_str(),
-					    "install")) {
+	if (!use_ini && num_dirs < MAX_DIR &&
+	    strcasecmp(entry->getDisplayName().c_str(), "install")) {
 	  dirs[num_dirs].node = *entry;
 	  num_dirs++;
 	}
       } else
 	if (isIcon(*entry))
 	  strcpy(dirs[curr_dir-1].deficon, entry->getDisplayName().c_str());
-	else
+	else if(!use_ini)
 	  files.push_back(*entry);
     }
 
-    GameList candidates = EngineMan.detectGames(files);
+    if (!use_ini) {
+      GameList candidates = EngineMan.detectGames(files);
 
-    for (GameList::const_iterator ge = candidates.begin();
-	ge != candidates.end(); ++ge)
-      if (curr_game < max) {
-	strcpy(games[curr_game].filename_base, ge->gameid().c_str());
-	strcpy(games[curr_game].dir, dirs[curr_dir-1].name);
-	games[curr_game].language = ge->language();
-	games[curr_game].platform = ge->platform();
-	if (uniqueGame(games[curr_game].filename_base,
-		       games[curr_game].dir,
-		       games[curr_game].language,
-		       games[curr_game].platform, games, curr_game)) {
-
-	  strcpy(games[curr_game].text, ge->description().c_str());
+      for (GameList::const_iterator ge = candidates.begin();
+	   ge != candidates.end(); ++ge)
+	if (curr_game < max) {
+	  strcpy(games[curr_game].filename_base, ge->gameid().c_str());
+	  strcpy(games[curr_game].dir, dirs[curr_dir-1].name);
+	  games[curr_game].language = ge->language();
+	  games[curr_game].platform = ge->platform();
+	  if (uniqueGame(games[curr_game].filename_base,
+			 games[curr_game].dir,
+			 games[curr_game].language,
+			 games[curr_game].platform, games, curr_game)) {
+	    
+	    strcpy(games[curr_game].text, ge->description().c_str());
 #if 0
-	  printf("Registered game <%s> (l:%d p:%d) in <%s> <%s> because of <%s> <*>\n",
-		 games[curr_game].text,
-		 (int)games[curr_game].language,
-		 (int)games[curr_game].platform,
-		 games[curr_game].dir, games[curr_game].filename_base,
-		 dirs[curr_dir-1].name);
+	    printf("Registered game <%s> (l:%d p:%d) in <%s> <%s> because of <%s> <*>\n",
+		   games[curr_game].text,
+		   (int)games[curr_game].language,
+		   (int)games[curr_game].platform,
+		   games[curr_game].dir, games[curr_game].filename_base,
+		   dirs[curr_dir-1].name);
 #endif
-	  curr_game++;
+	    curr_game++;
+	  }
 	}
-      }
+    }
   }
 
   for (int i=0; i<curr_game; i++)
@@ -426,7 +460,9 @@
   void *mark = ta_txmark();
 
   for (;;) {
-    num_games = findGames(games, MAX_GAMES);
+    num_games = findGames(games, MAX_GAMES, true);
+    if (!num_games)
+      num_games = findGames(games, MAX_GAMES, false);
 
     for (int i=0; i<num_games; i++) {
       games[i].icon.create_texture();

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/ds/arm9/makefile
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/ds/arm9/makefile	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/ds/arm9/makefile	2010-07-30 05:28:09 UTC (rev 51495)
@@ -110,7 +110,7 @@
 #WRAP_MALLOC = 1
 
 ifdef DS_BUILD_A
-	DEFINES = -DDS_SCUMM_BUILD -DDS_BUILD_A -DUSE_ARM_GFX_ASM -DUSE_ARM_COSTUME_ASM
+	DEFINES = -DDS_BUILD_A -DUSE_ARM_GFX_ASM -DUSE_ARM_COSTUME_ASM
 	LOGO = logoa.bmp
 	ENABLE_SCUMM = STATIC_PLUGIN
 	USE_ARM_GFX_ASM = 1
@@ -118,7 +118,7 @@
 endif
 
 ifdef DS_BUILD_B
-	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_B
+	DEFINES = -DDS_BUILD_B
 	LOGO = logob.bmp
 	ENABLE_SKY = STATIC_PLUGIN
 	ENABLE_QUEEN = STATIC_PLUGIN
@@ -126,14 +126,14 @@
 endif
 
 ifdef DS_BUILD_C
-	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_C
+	DEFINES = -DDS_BUILD_C
 	LOGO = logoc.bmp
 	ENABLE_AGOS = STATIC_PLUGIN
 	BUILD=scummvm-C
 endif
 
 ifdef DS_BUILD_D
-	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_D
+	DEFINES = -DDS_BUILD_D
 	LOGO = logod.bmp
 	ENABLE_GOB = STATIC_PLUGIN
 	ENABLE_CINE = STATIC_PLUGIN
@@ -142,42 +142,42 @@
 endif
 
 ifdef DS_BUILD_E
-	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_E
+	DEFINES = -DDS_BUILD_E
 	LOGO = logoe.bmp
 	ENABLE_SAGA = STATIC_PLUGIN
 	BUILD=scummvm-E
 endif
 
 ifdef DS_BUILD_F
-	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_F
+	DEFINES = -DDS_BUILD_F
 	LOGO = logof.bmp
 	ENABLE_KYRA = STATIC_PLUGIN
 	BUILD=scummvm-F
 endif
 
 ifdef DS_BUILD_G
-	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_G
+	DEFINES = -DDS_BUILD_G
 	LOGO = logog.bmp
 	ENABLE_LURE = STATIC_PLUGIN
 	BUILD=scummvm-G
 endif
 
 ifdef DS_BUILD_H
-	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_H
+	DEFINES = -DDS_BUILD_H
 	LOGO = logoh.bmp
 	ENABLE_PARALLACTION = STATIC_PLUGIN
 	BUILD=scummvm-H
 endif
 
 ifdef DS_BUILD_I
-	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_I
+	DEFINES = -DDS_BUILD_I
 	LOGO = logoi.bmp
 	ENABLE_MADE = STATIC_PLUGIN
 	BUILD=scummvm-I
 endif
 
 ifdef DS_BUILD_K
-	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_K
+	DEFINES = -DDS_BUILD_K
 	LOGO = logok.bmp
 	ENABLE_CRUISE = STATIC_PLUGIN
 	BUILD=scummvm-K
@@ -185,14 +185,14 @@
 
 
 #ifdef DS_BUILD_L
-#	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_L
+#	DEFINES = -DDS_BUILD_L
 #	LOGO = logog.bmp
 #	ENABLE_DRASCULA = STATIC_PLUGIN
 #	BUILD=scummvm-K
 #endif
 
 #ifdef DS_BUILD_M
-#	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_M
+#	DEFINES = -DDS_BUILD_M
 #	LOGO = logog.bmp
 #	ENABLE_TUCKER = STATIC_PLUGIN
 #	BUILD=scummvm-K
@@ -251,6 +251,8 @@
 	DEFINES += -DWRAP_MALLOC
 endif
 
+BACKEND := ds
+
 INCLUDES= -I$(portdir)/$(BUILD) -I$(srcdir) -I$(srcdir)/engines \
 			-I$(portdir)/data -I$(portdir)/../commoninclude \
 			-I$(portdir)/source -I$(portdir)/source/mad \

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/ds/arm9/source/dsoptions.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/ds/arm9/source/dsoptions.cpp	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/ds/arm9/source/dsoptions.cpp	2010-07-30 05:28:09 UTC (rev 51495)
@@ -128,12 +128,6 @@
 
 	_radioButtonMode = false;
 
-#ifdef DS_SCUMM_BUILD
-	if (!DS::isGBAMPAvailable()) {
-//		addButton(this, 100, 140, "Delete Save", 0, 'dels', 'D');
-	}
-#endif
-
 //	new GUI::StaticTextWidget(this, 90, 10, 130, 15, "ScummVM DS Options", Graphics::kTextAlignCenter);
 
 

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/ds/ds.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/ds/ds.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/ds/ds.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -12,6 +12,11 @@
 # build I:  --enable-made --disable-mad
 # build K:  --enable-cruise --disable-mad
 #
+# However, this could be automated using a simple script, which generates
+# subdirs for each build, and runs configure in those subdirs with the right
+# parameters (all builds would still share the same set of source code files,
+# thanks to our "out of tree" building support).
+#
 # This does not currently take care of some things:
 # * It does not #define DS_BUILD_A etc. -- most uses of that should be
 #   eliminated, though. Only usage should be for selecting the default config
@@ -21,6 +26,9 @@
 #   too; we need to investigate those.
 # * It does not currently adjust the logo. Ideally, if we ever get real plugin
 #   support, that should be necessary anymore anyway.
+# * No support for USE_DEBUGGER and USE_PROFILER yet. I envision that we would
+#  integrate them with the --enable-debug and --enable-profiling configure options,
+#  I simply haven't gotten around to do that yet.
 # * ...
 
 # Set location of ndsdir so that we can easily refer to files in it
@@ -59,7 +67,13 @@
 # folder.
 
 
+ifdef WRAP_MALLOC
+	LDFLAGS += -Wl,--wrap,malloc
+	DEFINES += -DWRAP_MALLOC
+endif
 
+
+
 # Compiler options for files which should be optimised for speed
 OPT_SPEED := -O3
 

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/ds/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/ds/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/ds/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -8,7 +8,6 @@
 	arm9/source/blitters_arm.o \
 	arm9/source/cdaudio.o \
 	arm9/source/dsmain.o \
-	../../fs/ds/ds-fs.o \
 	arm9/source/gbampsave.o \
 	arm9/source/scummhelp.o \
 	arm9/source/osystem_ds.o \
@@ -99,11 +98,10 @@
 
 
 MODULE_DIRS += \
-	backends/platform/ds/ \
 	backends/platform/ds/arm7/source/ \
 	backends/platform/ds/arm7/source/libcartreset/ \
-	backends/platform/ds/arm9/source/ \
-	backends/platform/ds/arm9/source/fat/
 
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
+# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/gp2x/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/gp2x/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/gp2x/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -6,8 +6,7 @@
 	gp2x-mem.o \
 	gp2x.o
 
-MODULE_DIRS += \
-	backends/platform/gp2x/
-
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
+# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/gp2xwiz/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/gp2xwiz/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/gp2xwiz/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -5,11 +5,10 @@
 	gp2xwiz-main.o \
 	gp2xwiz-sdl.o
 
-MODULE_DIRS += \
-	backends/platform/gp2xwiz/ 
+# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
 
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
-
 # Hack to ensure the SDL backend is built so we can use OSystem_SDL.
 -include $(srcdir)/backends/platform/sdl/module.mk
\ No newline at end of file

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/iphone/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/iphone/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/iphone/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -10,8 +10,7 @@
 	iphone_keyboard.o \
 	blit_arm.o
 
-MODULE_DIRS += \
-	backends/platform/iphone/
-
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
+# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/linuxmoto/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/linuxmoto/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/linuxmoto/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -5,11 +5,10 @@
 	linuxmoto-sdl.o \
 	hardwarekeys.o
 
-MODULE_DIRS += \
-	backends/platform/linuxmoto/
+# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
 
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
-
 # HACK: The linuxmoto backend is based on the SDL one, so we load that, too.
 include $(srcdir)/backends/platform/sdl/module.mk

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/n64/Makefile
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/n64/Makefile	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/n64/Makefile	2010-07-30 05:28:09 UTC (rev 51495)
@@ -64,6 +64,8 @@
 
 OBJS :=	nintendo64.o osys_n64_base.o osys_n64_events.o osys_n64_utilities.o pakfs_save_manager.o framfs_save_manager.o
 
+BACKEND := n64
+
 include $(srcdir)/Makefile.common
 
 MODULE_DIRS += ./

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/n64/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/n64/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/n64/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -3,8 +3,7 @@
 MODULE_OBJS := \
 	nintendo64.o
 
-MODULE_DIRS += \
-	backends/platform/n64/
-
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
+# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/null/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/null/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/null/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -3,8 +3,7 @@
 MODULE_OBJS := \
 	null.o
 
-MODULE_DIRS += \
-	backends/platform/null/
-
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
+# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/ps2/Makefile.gdb
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/ps2/Makefile.gdb	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/ps2/Makefile.gdb	2010-07-30 05:28:09 UTC (rev 51495)
@@ -75,6 +75,8 @@
     
 MODULE_DIRS += .
 
+BACKEND := ps2
+
 include $(srcdir)/Makefile.common
 
 LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile 

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/ps2/Makefile.ps2
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/ps2/Makefile.ps2	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/ps2/Makefile.ps2	2010-07-30 05:28:09 UTC (rev 51495)
@@ -75,6 +75,8 @@
     
 MODULE_DIRS += .
 
+BACKEND := ps2
+
 include $(srcdir)/Makefile.common
 
 LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile 

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/ps2/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/ps2/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/ps2/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -18,8 +18,7 @@
     ps2time.o \
 	ps2debug.o
 
-MODULE_DIRS += \
-	backends/platform/ps2/
-
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
+# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/psp/Makefile
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/psp/Makefile	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/psp/Makefile	2010-07-30 05:28:09 UTC (rev 51495)
@@ -64,7 +64,6 @@
 $(error $$(PSPSDK) cannot be obtained.)
 endif
 
-
 # Variables for common Scummvm makefile
 CXX      = psp-g++
 CXXFLAGS = -O3 -Wall -Wno-multichar -fno-exceptions -fno-rtti
@@ -148,8 +147,11 @@
 	audio.o \
 	thread.o \
 	rtc.o \
-	mp3.o
+	mp3.o \
+	tests.o
 
+BACKEND := psp
+
 # Include common Scummvm makefile
 include $(srcdir)/Makefile.common
 

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/psp/display_client.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/psp/display_client.cpp	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/psp/display_client.cpp	2010-07-30 05:28:09 UTC (rev 51495)
@@ -340,11 +340,17 @@
 
 	if (pitch == realWidthInBytes && pitch == recWidthInBytes) {
 		//memcpy(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth));
-		Copier::copy(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth), &_pixelFormat);
+		if (_pixelFormat.swapRB)
+			PspMemory::fastSwap(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth), _pixelFormat);
+		else
+			PspMemory::fastCopy(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth));
 	} else {
 		do {
 			//memcpy(dst, buf, recWidthInBytes);
-			Copier::copy(dst, buf, recWidthInBytes, &_pixelFormat);
+			if (_pixelFormat.swapRB)
+				PspMemory::fastSwap(dst, buf, recWidthInBytes, _pixelFormat);
+			else
+				PspMemory::fastCopy(dst, buf, recWidthInBytes);
 			buf += pitch;
 			dst += realWidthInBytes;
 		} while (--recHeight);
@@ -363,7 +369,10 @@
 
 	do {
 		//memcpy(dst, src, sourceWidthInBytes);
-		Copier::copy(dst, src, sourceWidthInBytes, &_pixelFormat);
+		if (_pixelFormat.swapRB)
+			PspMemory::fastSwap(dst, src, sourceWidthInBytes, _pixelFormat);
+		else
+			PspMemory::fastCopy(dst, src, sourceWidthInBytes);
 		src += realWidthInBytes;
 		dst += pitch;
 	} while (--h);

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/psp/memory.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/psp/memory.cpp	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/psp/memory.cpp	2010-07-30 05:28:09 UTC (rev 51495)
@@ -35,130 +35,406 @@
 
 #include "backends/platform/psp/trace.h"
 
-void Copier::copy(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat *format /* = NULL */) {
+//#define TEST_MEMORY_COPY
+
+extern "C" {
+
+void *__wrap_memcpy(void *dst, void *src, size_t bytes) {
+	PspMemory::fastCopy((byte *)dst, (byte *)src, bytes);
+	return dst;
+}
+
+}
+
+void PspMemory::copy(byte *dst, const byte *src, uint32 bytes) {
 	DEBUG_ENTER_FUNC();
 
-	uint32 prefixDst = (((uint32)dst) & 0x3);
-	prefixDst = prefixDst ? 4 - prefixDst : 0;	// prefix only if we have address % 4 != 0
-	uint32 prefixSrc = (((uint32)src) & 0x3);
-	prefixSrc = prefixSrc ? 4 - prefixSrc : 0;  // prefix only if we have address % 4 != 0
-	uint32 *dst32, *src32;
-	bool swapRB = format ? format->swapRB : false;	// take swap value from pixelformat if it's given
-#ifdef __PSP_DEBUG_PRINT__
+#ifdef TEST_MEMORY_COPY
 	uint32 debugBytes = bytes;
 	const byte *debugDst = dst, *debugSrc = src;
 #endif
-	uint32 words, remainingBytes;
 
-	//PSP_DEBUG_PRINT("dst[%p], src[%p], bytes[%d], swap[%s], prefixDst[%u], prefixSrc[%u]\n", dst, src, bytes, swapRB ? "true" : "false", prefixDst, prefixSrc);
+	PSP_DEBUG_PRINT("copy(): dst[%p], src[%p], bytes[%d]\n", dst, src, bytes);
 
-	if (prefixDst || prefixSrc) { 			// we're not aligned to word boundaries
-		if (prefixDst != prefixSrc) {		// worst case: we can never be aligned. this mode is highly inefficient. try to get engines not to use this mode too much
-			PSP_DEBUG_PRINT("misaligned copy of %u bytes from %p to %p\n", bytes, src, dst);
-			if ((prefixDst & 1) || (prefixSrc & 1))
-				copy8(dst, src, bytes);	// no swap is possible on 8 bit
-			else
-				copy16((uint16 *)dst, (uint16 *)src, bytes, format);
+	// align the destination pointer first
+	uint32 prefixDst = (((uint32)dst) & 0x3);
+	
+	if (prefixDst) {
+		prefixDst = 4 - prefixDst;				// prefix only if we have address % 4 != 0	
+		PSP_DEBUG_PRINT("prefixDst[%d]\n", prefixDst);
 
-			goto test;
-		}
-
-		// Do the prefix: the part to get us aligned
-		if (prefixDst & 1) { 			// byte
-			copy8(dst, src, prefixDst);	// no swap available
-		} else {						// short
-			copy16((uint16 *)dst, (uint16 *)src, prefixDst, format);
-		}
-		if (bytes > prefixDst)	// check that we can afford to subtract from bytes
-			bytes -= prefixDst;
-		else {
+		bytes -= prefixDst;						// remember we assume bytes >= 4
+		
+		if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) {	// check if it's worthwhile to continue
+			copy8(dst, src, bytes + prefixDst);
+#ifdef TEST_MEMORY_COPY
+			testCopy(debugDst, debugSrc, debugBytes);
+#endif		
 			return;
 		}
-		dst32 = (uint32 *)(dst + prefixDst);
-		src32 = (uint32 *)(src + prefixSrc);
-	} else { // We're aligned to word boundaries
-		dst32 = (uint32 *)dst;
-		src32 = (uint32 *)src;
+		
+		while (prefixDst--) {
+			*dst++ = *src++;
+		}		
 	}
+	
+	// check the source pointer alignment now
+	uint32 alignSrc = (((uint32)src) & 0x3);
+	
+	if (alignSrc) {						// we'll need to realign our reads
+		copy32Misaligned((uint32 *)dst, src, bytes, alignSrc);
+	} else {
+		copy32Aligned((uint32 *)dst, (uint32 *)src, bytes);
+	}
 
-	words = bytes >> 2;
-	remainingBytes = bytes & 0x3;
+#ifdef TEST_MEMORY_COPY
+	testCopy(debugDst, debugSrc, debugBytes);
+#endif		
+}
 
-	if (swapRB) {	// need to swap
-		for (; words > 0; words--) {
-			*dst32 = format->swapRedBlue32(*src32);
-			dst32++;
-			src32++;
+void PspMemory::testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes) {
+	
+	bool mismatch = false;
+	PSP_INFO_PRINT("testing fastCopy...");
+
+	for (uint32 i = 0; i < debugBytes; i++) {
+		if (debugDst[i] != debugSrc[i]) {
+			if (!mismatch) {
+				PSP_INFO_PRINT("**** mismatch in copy! ****\n");
+				PSP_INFO_PRINT("dst[%p], src[%p], bytes[%u]\n", debugDst, debugSrc, debugBytes);
+				mismatch = true;
+			}
+			PSP_INFO_PRINT("[%d]%x!=%x ", i, debugSrc[i], debugDst[i]);
 		}
-	} else { // no swapping
-		for (; words > 0; words--) {
-			*dst32 = *src32;
-			dst32++;
-			src32++;
-		}
 	}
+	if (mismatch) {
+		PSP_INFO_PRINT("\n");
+	} else {
+		PSP_INFO_PRINT("ok\n");
+	}	
+}
 
-	// Do any remaining bytes
-	if (remainingBytes) {
-		if (remainingBytes & 1)	// we have bytes left
-			copy8((byte *)dst32, (byte *)src32, remainingBytes);
-		else // 16bits left
-			copy16((uint16*)dst32, (uint16 *)src32, remainingBytes, format);
+// 
+// used to swap red and blue
+void PspMemory::swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) {
+	DEBUG_ENTER_FUNC();
+
+#ifdef TEST_MEMORY_COPY
+	uint32 debugBytes = bytes;
+	const uint16 *debugDst = dst16, *debugSrc = src16;
+#endif
+	
+	// align the destination pointer first
+	uint32 prefixDst = (((uint32)dst16) & 0x3);	// for swap, we can only have 2 or 0 as our prefix
+	
+	if (prefixDst) {
+		bytes -= prefixDst;						// remember we assume bytes > 4
+		*dst16++ = format.swapRedBlue16(*src16++);
+		
+		if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { // check if it's worthwhile to continue
+			swap16(dst16, src16, bytes, format);
+
+#ifdef TEST_MEMORY_COPY
+			testSwap(debugDst, debugSrc, debugBytes, format);
+#endif		
+			return;
+		}
 	}
+	
+	// check the source pointer alignment now
+	uint32 alignSrc = (((uint32)src16) & 0x3);
+	
+	if (alignSrc) {						// we'll need to realign our reads
+		PSP_DEBUG_PRINT("misaligned copy of %u bytes from %p to %p\n", bytes, src16, dst16);
+		swap32Misaligned((uint32 *)dst16, src16, bytes, format);
+	} else {
+		swap32Aligned((uint32 *)dst16, (const uint32 *)src16, bytes, format);
+	}
+	
+#ifdef TEST_MEMORY_COPY
+	testSwap(debugDst, debugSrc, debugBytes, format);
+#endif		
+	
+}
 
-test:
-	// debug
-#ifdef __PSP_DEBUG_PRINT__
+void PspMemory::testSwap(const uint16 *debugDst, const uint16 *debugSrc, uint32 debugBytes, PSPPixelFormat &format) {
+	
 	bool mismatch = false;
+	PSP_INFO_PRINT("testing fastSwap...");
+	
+	uint32 shorts = debugBytes >> 1;
 
-	for (uint32 i = 0; i < debugBytes; i++) {
-		if (debugDst[i] != debugSrc[i]) {
-			if (mismatch == false) {
-				PSP_DEBUG_PRINT_SAMELN("mismatch in copy:\n");
-				PSP_DEBUG_PRINT("dst[%p], src[%p], bytes[%u], swap[%s], prefixDst[%u], prefixSrc[%u]\n", debugDst, debugSrc, debugBytes, swapRB ? "true" : "false", prefixDst, prefixSrc);
+	for (uint32 i = 0; i < shorts; i++) {
+		if (debugDst[i] != format.swapRedBlue16(debugSrc[i])) {
+			if (!mismatch) {
+				PSP_INFO_PRINT("**** mismatch in swap! ****\n");
+				PSP_INFO_PRINT("dst[%p], src[%p], bytes[%u]\n", debugDst, debugSrc, debugBytes);
 				mismatch = true;
 			}
-			PSP_DEBUG_PRINT_SAMELN("%x!=%x ", debugSrc[i], debugDst[i]);
+			PSP_INFO_PRINT("[%d]%x!=%x ", i<<1, format.swapRedBlue16(debugSrc[i]), debugDst[i]);
 		}
 	}
-	if (mismatch)
-		PSP_DEBUG_PRINT("\n");
-#endif
+	if (mismatch) {
+		PSP_INFO_PRINT("\n");
+	} else {
+		PSP_INFO_PRINT("ok\n");
+	}	
+}
 
-	return;		// So we have something to jump to with the label
+
+void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes) {
+	PSP_DEBUG_PRINT("copy32Aligned(): dst32[%p], src32[%p], bytes[%d]\n", dst32, src32, bytes);
+
+	int words8 = bytes >> 5;
+	
+	// try blocks of 8 words at a time
+	if (words8) {
+		while (words8--) {
+			uint32 a, b, c, d;
+			a = src32[0];
+			b = src32[1];
+			c = src32[2];
+			d = src32[3];
+			dst32[0] = a;
+			dst32[1] = b;
+			dst32[2] = c;
+			dst32[3] = d;
+			a = src32[4];
+			b = src32[5];
+			c = src32[6];
+			d = src32[7];
+			dst32[4] = a;
+			dst32[5] = b;
+			dst32[6] = c;
+			dst32[7] = d;
+			dst32 += 8;
+			src32 += 8;
+		}				
+	}
+	
+	int words4 = (bytes & 0x1F) >> 4;
+	
+	// try blocks of 4 words at a time
+	if (words4) {
+		uint32 a, b, c, d;
+		a = src32[0];
+		b = src32[1];
+		c = src32[2];
+		d = src32[3];
+		dst32[0] = a;
+		dst32[1] = b;
+		dst32[2] = c;
+		dst32[3] = d;
+		dst32 += 4;
+		src32 += 4;
+	}
+	
+	int bytesLeft = (bytes & 0xF);	// only look at bytes left after we did the above
+	int wordsLeft = bytesLeft >> 2;
+	
+	// now just do single words
+	while (wordsLeft) {
+		*dst32++ = *src32++;
+		wordsLeft--;
+	}
+
+	bytesLeft = bytes & 0x3;	// get remaining bytes
+
+	PSP_DEBUG_PRINT("bytesLeft[%d]\n", bytesLeft);
+
+	byte *dst = (byte *)dst32;
+	byte *src = (byte *)src32;
+	
+	while (bytesLeft--) {
+		*dst++ = *src++;
+	}
 }
 
-inline void Copier::copy8(byte *dst, const byte *src, uint32 bytes) {
-	for (; bytes > 0; bytes--) {
-		*dst = *src;
-		dst++;
-		src++;
+void PspMemory::swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format) {
+	DEBUG_ENTER_FUNC();
+	int words4 = bytes >> 4;
+	
+	// try blocks of 4 words at a time
+	while (words4--) {
+		uint32 a, b, c, d;
+		a = format.swapRedBlue32(src32[0]);
+		b = format.swapRedBlue32(src32[1]);
+		c = format.swapRedBlue32(src32[2]);
+		d = format.swapRedBlue32(src32[3]);
+		dst32[0] = a;
+		dst32[1] = b;
+		dst32[2] = c;
+		dst32[3] = d;
+		dst32 += 4;
+		src32 += 4;
 	}
+
+	uint32 bytesLeft = bytes & 0xF;
+	uint32 words = bytesLeft >> 2;
+	
+	// now just do words
+	while (words--) {
+		*dst32++ = format.swapRedBlue32(*src32++);
+	}	
+
+	bytesLeft = bytes & 0x3;
+	
+	if (bytesLeft) {	// for swap, can only be 1 short left
+		*((uint16 *)dst32) = format.swapRedBlue16(*((uint16 *)src32));
+	}
 }
 
-inline void Copier::copy16(uint16 *dst, const uint16 *src, uint32 bytes, PSPPixelFormat *format /* = NULL */) {
-	uint32 shorts = bytes >> 1;
-	uint32 remainingBytes = bytes & 1;
-	bool swapRB = format ? format->swapRB : false;
 
-	if (swapRB) {
-		for (; shorts > 0 ; shorts--) {
-			*dst = format->swapRedBlue16(*src);
-			dst++;
-			src++;
+// More challenging -- need to shift
+// Assume dst is aligned
+void PspMemory::copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc) {
+	PSP_DEBUG_PRINT("copy32Misaligned: dst32[%p], src[%p], bytes[%d], alignSrc[%d]\n", dst32, src, bytes, alignSrc);
+	
+	uint32 *src32 = (uint32 *)(((uint32)src) & 0xFFFFFFFC);	// remove misalignment
+	uint32 offset;
+	
+	switch (alignSrc) {
+	case 1:
+		offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 8, 24);
+		break;
+	case 2:
+		offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 16, 16);
+		break;
+	default: /* 3 */
+		offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 24, 8);
+		break;
+	}
+	
+	uint32 remainingBytes = bytes & 3;
+	
+	if (remainingBytes) {
+		byte *dst = (byte *)dst32;
+		src += offset;
+		dst += offset;
+		copy8(dst, src, remainingBytes);
+	}	
+}
+
+// returns offset in dst
+uint32 PspMemory::misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue) {
+	uint32 *origDst32 = dst32;
+	register uint32 dstWord, srcWord;
+	
+	PSP_DEBUG_PRINT("misaligned32Detail(): alignSrc[%d], dst32[%p], src32[%p], bytes[%d]\n", alignSrc, dst32, src32, bytes);
+	
+	// Try to do groups of 4 words
+	uint32 words4 = bytes >> 4;
+	
+	srcWord = src32[0];
+
+	while (words4--) {
+		dstWord = srcWord >> shiftValue;
+		srcWord = src32[1];
+		dstWord |= srcWord << lastShiftValue;
+		dst32[0] = dstWord;
+		dstWord = srcWord >> shiftValue;
+		srcWord = src32[2];
+		dstWord |= srcWord << lastShiftValue;
+		dst32[1] = dstWord;
+		dstWord = srcWord >> shiftValue;
+		srcWord = src32[3];
+		dstWord |= srcWord << lastShiftValue;
+		dst32[2] = dstWord;
+		dstWord = srcWord >> shiftValue;
+		srcWord = src32[4];
+		dstWord |= srcWord << lastShiftValue;
+		dst32[3] = dstWord;
+		src32 += 4;
+		dst32 += 4;
+	}
+	
+	uint32 words = (bytes & 0xF) >> 2;
+	
+	// we read one word ahead of what we write
+	// setup the first read
+	if (words) {
+		src32++;	// we already loaded the value, so just increment
+		
+		while (words--) {
+			dstWord = srcWord >> shiftValue;
+			srcWord = *src32++;
+			dstWord |= srcWord << lastShiftValue;
+			*dst32++ = dstWord;
 		}
-	} else {
-		for (; shorts > 0 ; shorts--) {
-			*dst = *src;
-			dst++;
-			src++;
+	}
+	
+	return (byte *)dst32 - (byte *)origDst32;
+}
+
+// More challenging -- need to shift
+// We assume dst is aligned
+void PspMemory::swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) {
+	DEBUG_ENTER_FUNC();
+
+	const uint32 shiftValue = 16;
+	uint32 *src32 = (uint32 *)(((uint32)src16) & 0xFFFFFFFC);	// remove misalignment
+	
+	// Try to do groups of 4 words
+	uint32 words4 = bytes >> 4;
+	uint32 srcWord = src32[0];	// preload
+
+	while (words4--) {
+		uint32 dstWord = srcWord >> shiftValue;
+		srcWord = src32[1];
+		dstWord |= srcWord << shiftValue;
+		dst32[0] = format.swapRedBlue32(dstWord);
+		dstWord = srcWord >> shiftValue;
+		srcWord = src32[2];
+		dstWord |= srcWord << shiftValue;
+		dst32[1] = format.swapRedBlue32(dstWord);
+		dstWord = srcWord >> shiftValue;
+		srcWord = src32[3];
+		dstWord |= srcWord << shiftValue;
+		dst32[2] = format.swapRedBlue32(dstWord);
+		dstWord = srcWord >> shiftValue;
+		srcWord = src32[4];
+		dstWord |= srcWord << shiftValue;
+		dst32[3] = format.swapRedBlue32(dstWord);
+		src32 += 4;
+		dst32 += 4;
+	}
+	
+	uint32 words = (bytes & 0xF) >> 2;
+	
+	// we read one word ahead of what we write
+	// setup the first read
+	if (words) {
+		//srcWord = *src32++;	// don't need this. already loaded
+		src32++;	// we already have the value loaded in
+		
+		while (words--) {
+			uint32 dstWord = srcWord >> shiftValue;
+			srcWord = *src32++;
+			dstWord |= srcWord << shiftValue;
+			*dst32++ = format.swapRedBlue32(dstWord);
 		}
 	}
+	
+	uint32 bytesLeft = bytes & 3;
+	
+	if (bytesLeft) {	// for swap, can only be 1 short left
+		*((uint16 *)dst32) = format.swapRedBlue16((uint16)(srcWord >> shiftValue));
+	}
+}
+
+inline void PspMemory::copy16(uint16 *dst16, const uint16 *src16, uint32 bytes) {
+	PSP_DEBUG_PRINT("copy16(): dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes);
+	
+	uint32 shorts = bytes >> 1;
+	uint32 remainingBytes = bytes & 1;
+
+	for (; shorts > 0 ; shorts--) {
+		*dst16++ = *src16++;
+	}
 	if (remainingBytes)
-		*(byte *)dst = *(byte *)src;
+		*(byte *)dst16 = *(byte *)src16;
 }
 
-
 // Class VramAllocator -----------------------------------
 
 DECLARE_SINGLETON(VramAllocator)

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/psp/memory.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/psp/memory.h	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/psp/memory.h	2010-07-30 05:28:09 UTC (rev 51495)
@@ -27,17 +27,69 @@
 #ifndef PSP_MEMORY_H
 #define PSP_MEMORY_H
 
+#include "backends/platform/psp/psppixelformat.h"
+#include "common/list.h"
+
 #define UNCACHED(x)		((byte *)(((uint32)(x)) | 0x40000000))	/* make an uncached access */
 #define CACHED(x)		((byte *)(((uint32)(x)) & 0xBFFFFFFF))	/* make an uncached access into a cached one */
 
+#define MIN_AMOUNT_FOR_COMPLEX_COPY  8
+#define MIN_AMOUNT_FOR_MISALIGNED_COPY 8
+
+//#define __PSP_DEBUG_PRINT__
+
+#include "backends/platform/psp/trace.h"
+
 /**
  *	Class that does memory copying and swapping if needed
  */
-class Copier {
-public:
-	static void copy(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat *format = NULL);
-	static void copy8(byte *dst, const byte *src, uint32 bytes);
-	static void copy16(uint16 *dst, const uint16 *src, uint32 bytes, PSPPixelFormat *format = NULL);
+class PspMemory {
+private:
+	static void testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes);
+	static void testSwap(const uint16 *debugDst, const uint16 *debugSrc, uint32 debugBytes, PSPPixelFormat &format);
+	static void copy(byte *dst, const byte *src, uint32 bytes);
+	static void swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format);
+	static void copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes);
+	static void swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format);
+	static void copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc);
+	static uint32 misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue);
+	static void swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format);
+	static void copy16(uint16 *dst, const uint16 *src, uint32 bytes);
+
+	// For swapping, we know that we have multiples of 16 bits
+	static void swap16(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) {
+		PSP_DEBUG_PRINT("swap16 called with dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes);
+		uint32 shorts = bytes >> 1;
+
+		while (shorts--) {
+			*dst16++ = format.swapRedBlue16(*src16++);
+		}
+	}
+	
+	static void copy8(byte *dst, const byte *src, uint32 bytes) {
+		PSP_DEBUG_PRINT("copy8 called with dst[%p], src[%p], bytes[%d]\n", dst, src, bytes);
+		while (bytes--) {
+			*dst++ = *src++;
+		}
+	}
+
+public:	
+	// This is the interface to the outside world
+	static void fastCopy(byte *dst, const byte *src, uint32 bytes) {
+		if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) {
+			copy8(dst, src, bytes);
+		} else {	// go to more powerful copy
+			copy(dst, src, bytes);
+		}
+	}
+
+	static void fastSwap(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat &format) {
+		if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY * 2) {
+			swap16((uint16 *)dst, (uint16 *)src, bytes, format);
+		} else {	// go to more powerful copy
+			swap((uint16 *)dst, (uint16 *)src, bytes, format);
+		}
+	}
 };
 
 /**

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/psp/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/psp/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/psp/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -16,10 +16,10 @@
 	audio.o \
 	thread.o \
 	rtc.o \
-	mp3.o
+	mp3.o \
+	tests.o
 
-MODULE_DIRS += \
-	backends/platform/psp/
-
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
+# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/psp/psp_main.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/psp/psp_main.cpp	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/psp/psp_main.cpp	2010-07-30 05:28:09 UTC (rev 51495)
@@ -44,6 +44,7 @@
 #include "backends/plugins/psp/psp-provider.h"
 #include "backends/platform/psp/psppixelformat.h"
 #include "backends/platform/psp/osys_psp.h"
+#include "backends/platform/psp/tests.h"	/* for unit/speed tests */
 #include "backends/platform/psp/trace.h"
 
 #ifdef ENABLE_PROFILING
@@ -169,6 +170,13 @@
 	PluginManager::instance().addPluginProvider(new PSPPluginProvider());
 #endif
 
+/* unit/speed tests */
+#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS)	
+	PSP_INFO_PRINT("running tests\n");
+	psp_tests();
+	sceKernelSleepThread();	// that's it. That's all we're doing
+#endif
+	
 	int res = scummvm_main(argc, argv);
 
 	g_system->quit();	// TODO: Consider removing / replacing this!

Copied: scummvm/branches/gsoc2010-opengl/backends/platform/psp/tests.cpp (from rev 51493, scummvm/trunk/backends/platform/psp/tests.cpp)
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/psp/tests.cpp	                        (rev 0)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/psp/tests.cpp	2010-07-30 05:28:09 UTC (rev 51495)
@@ -0,0 +1,565 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $
+ * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $
+ *
+ */
+
+// PSP speed and unit tests. Activate in tests.h 
+// You may also want to build without any engines. 
+ 
+#include "backends/platform/psp/tests.h"
+
+#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS)	
+ 
+#include "common/scummsys.h"
+#include <pspiofilemgr_fcntl.h>
+#include <pspiofilemgr_stat.h>
+#include <pspiofilemgr.h>
+#include <pspthreadman.h>
+#include <pspsdk.h>
+#include <psprtc.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <psputils.h>
+#include "backends/platform/psp/rtc.h"
+#include "backends/platform/psp/thread.h"
+#include "backends/platform/psp/memory.h"
+
+
+#define UNCACHED(x)		((byte *)(((uint32)(x)) | 0x40000000))	/* make an uncached access */
+#define CACHED(x)		((byte *)(((uint32)(x)) & 0xBFFFFFFF))	/* make an uncached access into a cached one */
+ 
+//#define __PSP_DEBUG_FUNCS__
+//#define __PSP_DEBUG_PRINT__
+ 
+// Results: (333Mhz/222Mhz)
+// Getting a tick: 1-2 us
+// Getting a time structure: 9/14us
+// ie. using a tick and just dividing by 1000 saves us time.
+  
+#include "backends/platform/psp/trace.h" 
+
+class PspSpeedTests {
+public:
+	void tickSpeed();
+	void getMicrosSpeed();
+	void seekSpeed();
+	void msReadSpeed();
+	void threadFunctionsSpeed();
+	void semaphoreSpeed(); 
+	static int threadFunc(SceSize args, void *argp);
+	void semaphoreManyThreadSpeed();
+	void fastCopySpeed();
+	
+private:
+	enum {
+		MEMCPY_BUFFER_SIZE = 8192
+	};
+	static PspSemaphore _sem;	// semaphore
+
+	void readAndTime(uint32 bytes, char *buffer, FILE *file);
+	void seekAndTime(int bytes, int origin, FILE *file);
+	void fastCopySpecificSize(byte *dst, byte *src, uint32 bytes);
+	void fastCopyDifferentSizes(byte *dst, byte *src);
+	int getThreadIdSpeed();
+	void getPrioritySpeed();
+	void changePrioritySpeed(int id, int priority);
+};
+
+PspSemaphore PspSpeedTests::_sem(0);
+
+void PspSpeedTests::tickSpeed() {
+	uint32 ticksPerSecond = sceRtcGetTickResolution();
+	PSP_INFO_PRINT("ticksPerSecond[%d]\n", ticksPerSecond);
+
+	uint32 currentTicks1[2];
+	uint32 currentTicks2[2];
+	
+	sceRtcGetCurrentTick((u64 *)currentTicks1);
+	sceRtcGetCurrentTick((u64 *)currentTicks2);
+	PSP_INFO_PRINT("current tick[%x %x][%u %u]\n", currentTicks1[0], currentTicks1[1], currentTicks1[0], currentTicks1[1]);
+	PSP_INFO_PRINT("current tick[%x %x][%u %u]\n", currentTicks2[0], currentTicks2[1], currentTicks2[0], currentTicks2[1]);
+	
+	pspTime time;
+	sceRtcSetTick(&time, (u64 *)currentTicks2);
+	PSP_INFO_PRINT("current tick in time, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time.year, time.month, time.day, time.hour, time.minutes, time.seconds, time.microseconds);	
+	
+	pspTime time1;
+	pspTime time2;
+	sceRtcGetCurrentClockLocalTime(&time1);
+	sceRtcGetCurrentClockLocalTime(&time2);
+	PSP_INFO_PRINT("time1, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time1.year, time1.month, time1.day, time1.hour, time1.minutes, time1.seconds, time1.microseconds);
+	PSP_INFO_PRINT("time2, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time2.year, time2.month, time2.day, time2.hour, time2.minutes, time2.seconds, time2.microseconds);
+}
+
+void PspSpeedTests::getMicrosSpeed() {
+	uint32 time1, time2, time3, time4;
+	time1 = PspRtc::instance().getMicros();
+	time2 = PspRtc::instance().getMicros();
+	time3 = PspRtc::instance().getMicros();
+	time4 = PspRtc::instance().getMicros();
+	
+	PSP_INFO_PRINT("getMicros() times: %d, %d, %d\n", time4-time3, time3-time2, time2-time1);
+}
+
+void PspSpeedTests::readAndTime(uint32 bytes, char *buffer, FILE *file) {
+	uint32 time1 = PspRtc::instance().getMicros();
+	// test minimal read
+	fread(buffer, bytes, 1, file);
+	uint32 time2 = PspRtc::instance().getMicros();
+	
+	PSP_INFO_PRINT("Reading %d byte takes %dus\n", bytes, time2-time1);	
+}
+
+/*
+	333MHz/222MHz
+	Reading 1 byte takes 2590us / 3167
+	Reading 10 byte takes 8us / 9
+	Reading 50 byte takes 8us / 11
+	Reading 100 byte takes 8us / 11
+	Reading 1000 byte takes 915us / 1131
+	Reading 2000 byte takes 1806us / 2,284
+	Reading 3000 byte takes 2697us / 3,374
+	Reading 5000 byte takes 4551us / 5,544
+	Reading 6000 byte takes 5356us / 6,676
+	Reading 7000 byte takes 6800us / 8,358
+	Reading 8000 byte takes 6794us / 8,454
+	Reading 9000 byte takes 6782us / 8,563
+	Reading 10000 byte takes 8497us / 10,631
+	Reading 30000 byte takes 25995us / 32,473
+	Reading 80000 byte takes 68457us / 85,291
+	Reading 100000 byte takes 85103us / 106,163
+*/
+// Function to test the impact of MS reads
+// These tests can't be done from shell - the cache screws them up
+void PspSpeedTests::msReadSpeed() {
+	FILE *file;
+	file = fopen("ms0:/psp/music/track1.mp3", "r");
+
+	char *buffer = (char *)malloc(2 * 1024 * 1024);
+	
+	readAndTime(1, buffer, file);
+	readAndTime(10, buffer, file);
+	readAndTime(50, buffer, file);
+	readAndTime(100, buffer, file);
+	readAndTime(1000, buffer, file);
+	readAndTime(2000, buffer, file);
+	readAndTime(3000, buffer, file);
+	readAndTime(5000, buffer, file);
+	readAndTime(6000, buffer, file);
+	readAndTime(7000, buffer, file);
+	readAndTime(8000, buffer, file);
+	readAndTime(9000, buffer, file);	
+	readAndTime(10000, buffer, file);
+	readAndTime(30000, buffer, file);
+	readAndTime(50000, buffer, file);
+	readAndTime(80000, buffer, file);
+	readAndTime(100000, buffer, file);
+	
+	fclose(file);
+	free(buffer);	
+}
+ 
+void PspSpeedTests::seekAndTime(int bytes, int origin, FILE *file) {
+	char buffer[1000];
+	
+	uint32 time1 = PspRtc::instance().getMicros();
+	// test minimal read
+	fseek(file, bytes, origin);
+	uint32 time2 = PspRtc::instance().getMicros();
+	
+	PSP_INFO_PRINT("Seeking %d byte from %d took %dus\n", bytes, origin, time2-time1);
+
+	time1 = PspRtc::instance().getMicros();
+	// test minimal read
+	fread(buffer, 1000, 1, file);
+	time2 = PspRtc::instance().getMicros();
+	
+	PSP_INFO_PRINT("Reading 1000 bytes took %dus\n", time2-time1);
+}
+
+/*
+333MHz
+Seeking 0 byte from 0 took 946us
+Reading 1000 bytes took 1781us
+Seeking 5 byte from 0 took 6us
+Reading 1000 bytes took 19us
+Seeking 1000 byte from 0 took 5us
+Reading 1000 bytes took 913us
+Seeking 100 byte from 0 took 955us
+Reading 1000 bytes took 906us
+Seeking 10000 byte from 0 took 963us
+Reading 1000 bytes took 905us
+Seeking -5 byte from 1 took 1022us
+Reading 1000 bytes took 949us
+Seeking -100 byte from 1 took 1040us
+Reading 1000 bytes took 907us
+Seeking 100 byte from 1 took 1044us
+Reading 1000 bytes took 930us
+Seeking 0 byte from 2 took 7211us
+Reading 1000 bytes took 80us
+Seeking 10000 byte from 2 took 3636us
+Reading 1000 bytes took 110us
+*/
+
+void PspSpeedTests::seekSpeed() {
+	FILE *file;
+	file = fopen("ms0:/psp/music/track1.mp3", "r");
+
+	seekAndTime(0, SEEK_SET, file);
+	seekAndTime(5, SEEK_SET, file);
+	seekAndTime(1000, SEEK_SET, file);
+	seekAndTime(100, SEEK_SET, file);
+	seekAndTime(10000, SEEK_SET, file);
+	seekAndTime(-5, SEEK_CUR, file);
+	seekAndTime(-100, SEEK_CUR, file);
+	seekAndTime(100, SEEK_CUR, file);
+	seekAndTime(0, SEEK_END, file);
+	seekAndTime(-10000, SEEK_END, file);
+
+	fclose(file);
+}
+
+// 222: 5-7us
+int PspSpeedTests::getThreadIdSpeed() {
+	uint32 time1 = PspRtc::instance().getMicros();
+	int threadId = sceKernelGetThreadId();
+	uint32 time2 = PspRtc::instance().getMicros();
+	
+	PSP_INFO_PRINT("Getting thread ID %d took %dus\n", threadId, time2-time1);
+	
+	return threadId;
+}
+
+// 222: 4-5us
+void PspSpeedTests::getPrioritySpeed() {
+	uint32 time1 = PspRtc::instance().getMicros();
+	int priority = sceKernelGetThreadCurrentPriority();
+	uint32 time2 = PspRtc::instance().getMicros();
+	
+	PSP_INFO_PRINT("Getting thread priority %d took %dus\n", priority, time2-time1);
+}
+
+// 222: 9-10us
+void PspSpeedTests::changePrioritySpeed(int id, int priority) {
+	uint32 time1 = PspRtc::instance().getMicros();
+	sceKernelChangeThreadPriority(id, priority);
+	uint32 time2 = PspRtc::instance().getMicros();
+	
+	PSP_INFO_PRINT("Changing thread priority to %d for id %d took %dus\n", priority, id, time2-time1);
+}
+
+void PspSpeedTests::threadFunctionsSpeed() {
+	// very unscientific -- just ballpark
+	int id;
+	id = getThreadIdSpeed();
+	getThreadIdSpeed();
+	getPrioritySpeed();
+	getPrioritySpeed();
+	changePrioritySpeed(id, 30);
+	changePrioritySpeed(id, 35);
+	changePrioritySpeed(id, 25);
+	
+	// test context switch time
+	for (int i=0; i<10; i++) {
+		uint time1 = PspRtc::instance().getMicros();
+		PspThread::delayMicros(0);
+		uint time2 = PspRtc::instance().getMicros();
+		PSP_INFO_PRINT("poll %d. context switch Time = %dus\n", i, time2-time1);	// 10-15us	
+	}	
+}
+ 
+void PspSpeedTests::semaphoreSpeed() { 
+	PspSemaphore sem(1);
+	
+	uint32 time1 = PspRtc::instance().getMicros();
+	
+	sem.take();
+	
+	uint32 time2 = PspRtc::instance().getMicros();
+	
+	PSP_INFO_PRINT("taking semaphore took %d us\n", time2-time1);	// 10us
+	
+	uint32 time3 = PspRtc::instance().getMicros();
+	
+	sem.give();
+	
+	uint32 time4 = PspRtc::instance().getMicros();
+	PSP_INFO_PRINT("releasing semaphore took %d us\n", time4-time3);	//10us-55us
+}
+
+int PspSpeedTests::threadFunc(SceSize args, void *argp) {
+	PSP_INFO_PRINT("thread %x created.\n", sceKernelGetThreadId());
+	
+	_sem.take();
+	
+	PSP_INFO_PRINT("grabbed semaphore. Quitting thread\n");
+	
+	return 0;
+}
+
+void PspSpeedTests::semaphoreManyThreadSpeed() {	
+	
+	// create 4 threads
+	for (int i=0; i<4; i++) {
+		int thid = sceKernelCreateThread("my_thread", PspSpeedTests::threadFunc, 0x18, 0x10000, THREAD_ATTR_USER, NULL);
+		sceKernelStartThread(thid, 0, 0);
+	}
+		
+	PSP_INFO_PRINT("main thread. created threads\n");
+
+	uint32 threads = _sem.numOfWaitingThreads();
+	while (threads < 4) {
+		threads = _sem.numOfWaitingThreads();
+		PSP_INFO_PRINT("main thread: waiting threads[%d]\n", threads);
+	}
+	
+	PSP_INFO_PRINT("main: semaphore value[%d]\n", _sem.getValue());
+	PSP_INFO_PRINT("main thread: waiting threads[%d]\n", _sem.numOfWaitingThreads());
+	
+	_sem.give(4);
+}
+
+void PspSpeedTests::fastCopySpecificSize(byte *dst, byte *src, uint32 bytes) {
+	uint32 time1, time2;
+	uint32 fastcopyTime, memcpyTime;
+	const int iterations = 2000;
+	int intc;
+	
+	intc = pspSdkDisableInterrupts();
+	
+	time1 = PspRtc::instance().getMicros();
+	for (int i=0; i<iterations; i++) {
+		PspMemory::fastCopy(dst, src, bytes);
+	}	
+	time2 = PspRtc::instance().getMicros();
+	
+	pspSdkEnableInterrupts(intc);
+	
+	fastcopyTime = time2-time1;
+	
+	intc = pspSdkDisableInterrupts();
+	
+	time1 = PspRtc::instance().getMicros();
+	for (int i=0; i<iterations; i++) {
+		memcpy(dst, src, bytes);
+	}	
+	time2 = PspRtc::instance().getMicros();
+	
+	pspSdkEnableInterrupts(intc);
+	
+	memcpyTime = time2-time1;
+	
+	PSP_INFO_PRINT("%d bytes. memcpy[%d], fastcopy[%d]\n", bytes, memcpyTime, fastcopyTime);
+}
+
+void PspSpeedTests::fastCopyDifferentSizes(byte *dst, byte *src) {
+	PSP_INFO_PRINT("\nsrc[%p], dst[%p]\n", src, dst);
+	fastCopySpecificSize(dst, src, 1);
+	fastCopySpecificSize(dst, src, 2);
+	fastCopySpecificSize(dst, src, 3);
+	fastCopySpecificSize(dst, src, 4);
+	fastCopySpecificSize(dst, src, 5);
+	fastCopySpecificSize(dst, src, 8);
+	fastCopySpecificSize(dst, src, 10);
+	fastCopySpecificSize(dst, src, 16);
+	fastCopySpecificSize(dst, src, 32);
+	fastCopySpecificSize(dst, src, 50);
+	fastCopySpecificSize(dst, src, 100);
+	fastCopySpecificSize(dst, src, 500);
+	fastCopySpecificSize(dst, src, 1024);
+	fastCopySpecificSize(dst, src, 2048);
+}
+
+void PspSpeedTests::fastCopySpeed() {
+	PSP_INFO_PRINT("running fastCopy speed test\n");
+
+	uint32 *bufferSrc32 = (uint32 *)memalign(16, MEMCPY_BUFFER_SIZE);
+	uint32 *bufferDst32 = (uint32 *)memalign(16, MEMCPY_BUFFER_SIZE);
+	
+	// fill buffer 1
+	for (int i=0; i<MEMCPY_BUFFER_SIZE/4; i++)
+		bufferSrc32[i] = i | (((MEMCPY_BUFFER_SIZE/4)-i)<<16);
+		
+	// print buffer
+	for (int i=0; i<50; i++)
+		PSP_INFO_PRINT("%x ", bufferSrc32[i]);
+	PSP_INFO_PRINT("\n");
+	
+	byte *bufferSrc = ((byte *)bufferSrc32);
+	byte *bufferDst = ((byte *)bufferDst32);
+
+	PSP_INFO_PRINT("\n\ndst and src cached: -----------------\n");
+	fastCopyDifferentSizes(bufferDst, bufferSrc);
+	fastCopyDifferentSizes(bufferDst+1, bufferSrc+1);
+	fastCopyDifferentSizes(bufferDst, bufferSrc+1);
+	fastCopyDifferentSizes(bufferDst+1, bufferSrc);
+	
+	PSP_INFO_PRINT("\n\ndst cached, src uncached: -----------------\n");
+	bufferSrc = UNCACHED(bufferSrc);
+	fastCopyDifferentSizes(bufferDst, bufferSrc);
+	fastCopyDifferentSizes(bufferDst+1, bufferSrc+1);
+	fastCopyDifferentSizes(bufferDst, bufferSrc+1);
+	fastCopyDifferentSizes(bufferDst+1, bufferSrc);
+
+	PSP_INFO_PRINT("\n\ndst uncached, src uncached: --------------\n");
+	bufferDst = UNCACHED(bufferDst);
+	fastCopyDifferentSizes(bufferDst, bufferSrc);
+	fastCopyDifferentSizes(bufferDst+1, bufferSrc+1);
+	fastCopyDifferentSizes(bufferDst, bufferSrc+1);
+	fastCopyDifferentSizes(bufferDst+1, bufferSrc);
+	
+	PSP_INFO_PRINT("\n\ndst uncached, src cached: -------------------\n");
+	bufferSrc = CACHED(bufferSrc);
+	fastCopyDifferentSizes(bufferDst, bufferSrc);
+	fastCopyDifferentSizes(bufferDst+1, bufferSrc+1);
+	fastCopyDifferentSizes(bufferDst, bufferSrc+1);
+	fastCopyDifferentSizes(bufferDst+1, bufferSrc);
+
+	
+	free(bufferSrc32);
+	free(bufferDst32);
+}
+
+//-------Unit Tests -------------------------------
+
+class PspUnitTests {
+public:
+	void testFastCopy();
+
+private:
+	enum {
+		MEMCPY_BUFFER_SIZE = 8192
+	};
+	
+	void fastCopySpecificSize(byte *dst, byte *src, uint32 bytes, bool swap = false);
+	void fastCopyDifferentSizes(byte *dst, byte *src, bool swap = false);
+};	
+
+void PspUnitTests::testFastCopy() {
+	PSP_INFO_PRINT("running fastcopy unit test ***********\n");
+	PSP_INFO_PRINT("this test requires the test flag to be on in fastCopy\n\n");
+
+	uint32 *bufferSrc32 = (uint32 *)memalign(16, MEMCPY_BUFFER_SIZE);
+	uint32 *bufferDst32 = (uint32 *)memalign(16, MEMCPY_BUFFER_SIZE);
+	
+	// fill buffer 1
+	for (int i=0; i<MEMCPY_BUFFER_SIZE/4; i++)
+		bufferSrc32[i] = i | (((MEMCPY_BUFFER_SIZE/4)-i)<<16);
+		
+	// print buffer
+	for (int i=0; i<50; i++)
+		PSP_INFO_PRINT("%x ", bufferSrc32[i]);
+	PSP_INFO_PRINT("\n");
+	
+	byte *bufferSrc = ((byte *)bufferSrc32);
+	byte *bufferDst = ((byte *)bufferDst32);
+	
+	fastCopyDifferentSizes(bufferDst, bufferSrc, true);
+	fastCopyDifferentSizes(bufferDst+1, bufferSrc+1);
+	fastCopyDifferentSizes(bufferDst+2, bufferSrc+2, true);
+	fastCopyDifferentSizes(bufferDst+3, bufferSrc+3);
+	fastCopyDifferentSizes(bufferDst, bufferSrc+1);
+	fastCopyDifferentSizes(bufferDst, bufferSrc+2, true);
+	fastCopyDifferentSizes(bufferDst+2, bufferSrc, true);
+	fastCopyDifferentSizes(bufferDst, bufferSrc+3);
+	fastCopyDifferentSizes(bufferDst+1, bufferSrc+2);
+	fastCopyDifferentSizes(bufferDst+1, bufferSrc+3);
+	fastCopyDifferentSizes(bufferDst+2, bufferSrc+1);
+	fastCopyDifferentSizes(bufferDst+2, bufferSrc+3);
+	fastCopyDifferentSizes(bufferDst+3, bufferSrc+1);
+	fastCopyDifferentSizes(bufferDst+3, bufferSrc+2);	
+	
+	free(bufferSrc32);
+	free(bufferDst32);
+}
+	
+void PspUnitTests::fastCopyDifferentSizes(byte *dst, byte *src, bool swap) {
+	fastCopySpecificSize(dst, src, 1);
+	fastCopySpecificSize(dst, src, 2, swap);
+	fastCopySpecificSize(dst, src, 4, swap);
+	fastCopySpecificSize(dst, src, 6, swap);
+	fastCopySpecificSize(dst, src, 8, swap);
+	fastCopySpecificSize(dst, src, 9);
+	fastCopySpecificSize(dst, src, 10, swap);
+	fastCopySpecificSize(dst, src, 11);
+	fastCopySpecificSize(dst, src, 12, swap);
+	fastCopySpecificSize(dst, src, 13);
+	fastCopySpecificSize(dst, src, 14, swap);
+	fastCopySpecificSize(dst, src, 15);	
+	fastCopySpecificSize(dst, src, 16, swap);
+	fastCopySpecificSize(dst, src, 17);
+	fastCopySpecificSize(dst, src, 18, swap);
+	fastCopySpecificSize(dst, src, 19);
+	fastCopySpecificSize(dst, src, 20, swap);
+	fastCopySpecificSize(dst, src, 32, swap);
+	fastCopySpecificSize(dst, src, 33);
+	fastCopySpecificSize(dst, src, 34, swap);
+	fastCopySpecificSize(dst, src, 35);
+	fastCopySpecificSize(dst, src, 36, swap);
+	fastCopySpecificSize(dst, src, 50, swap);
+	fastCopySpecificSize(dst, src, 100, swap);
+	fastCopySpecificSize(dst, src, 500, swap);
+	fastCopySpecificSize(dst, src, 1000, swap);
+}
+
+void PspUnitTests::fastCopySpecificSize(byte *dst, byte *src, uint32 bytes, bool swap) {
+	memset(dst, 0, bytes);
+	PspMemory::fastCopy(dst, src, bytes);
+	
+	if (swap) {	// test swap also
+		memset(dst, 0, bytes);
+		
+		// pixelformat for swap
+		PSPPixelFormat format;
+		format.set(PSPPixelFormat::Type_4444, true);
+	
+		PspMemory::fastSwap(dst, src, bytes, format);
+	}	
+}
+
+void psp_tests() {
+	PSP_INFO_PRINT("in tests\n");
+	
+#ifdef PSP_ENABLE_SPEED_TESTS
+	// Speed tests
+	PspSpeedTests speedTests;
+	speedTests.tickSpeed();
+	speedTests.getMicrosSpeed();
+	speedTests.msReadSpeed();
+	speedTests.seekSpeed();
+	speedTests.msReadSpeed();
+	speedTests.threadFunctionsSpeed();
+	speedTests.semaphoreSpeed();	
+	speedTests.semaphoreManyThreadSpeed();
+	speedTests.fastCopySpeed();
+#endif	
+	
+#ifdef PSP_ENABLE_UNIT_TESTS
+	// Unit tests
+	PspUnitTests unitTests;
+	
+	unitTests.testFastCopy();
+#endif	
+}	
+
+#endif /* (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS) */
\ No newline at end of file

Copied: scummvm/branches/gsoc2010-opengl/backends/platform/psp/tests.h (from rev 51493, scummvm/trunk/backends/platform/psp/tests.h)
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/psp/tests.h	                        (rev 0)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/psp/tests.h	2010-07-30 05:28:09 UTC (rev 51495)
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/psp_main.cpp $
+ * $Id: psp_main.cpp 49155 2010-05-23 11:48:21Z Bluddy $
+ *
+ */
+
+#ifndef _PSP_TESTS_H_ 
+#define _PSP_TESTS_H_
+
+//#define PSP_ENABLE_UNIT_TESTS		// run unit tests
+//#define PSP_ENABLE_SPEED_TESTS		// run speed tests
+
+#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS)	
+void psp_tests();
+#endif
+
+#endif /* _PSP_TESTS_H_ */
\ No newline at end of file

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/psp/trace.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/psp/trace.h	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/psp/trace.h	2010-07-30 05:28:09 UTC (rev 51495)
@@ -30,11 +30,13 @@
 
 #include "common/str.h"
 
+#define __PSP_PRINT_TO_FILE_AND_SCREEN__
+
 /* Choose to print to file/screen/both */
 #ifdef __PSP_PRINT_TO_FILE__
-	#define __PSP_PRINT__(format,...)			PSPDebugTrace(false, format, ## __VA_ARGS__)
+	#define __PSP_PRINT__(format,...)			PspDebugTrace(false, format, ## __VA_ARGS__)
 #elif defined __PSP_PRINT_TO_FILE_AND_SCREEN__
-	#define __PSP_PRINT__(format,...)			PSPDebugTrace(true, format, ## __VA_ARGS__)
+	#define __PSP_PRINT__(format,...)			PspDebugTrace(true, format, ## __VA_ARGS__)
 #else /* default - print to screen */
 	#define __PSP_PRINT__(format,...)			fprintf(stderr, format, ## __VA_ARGS__)
 #endif /* PSP_PRINT_TO_FILE/SCREEN */

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/samsungtv/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/samsungtv/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/samsungtv/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -4,8 +4,7 @@
 	main.o \
 	samsungtv.o
 
-MODULE_DIRS += \
-	backends/platform/samsungtv/
-
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
+# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -19,11 +19,7 @@
 	win32/win32.o
 endif
 
-MODULE_DIRS += \
-	backends/platform/sdl/ \
-	backends/platform/sdl/macosx/ \
-	backends/platform/sdl/posix/ \
-	backends/platform/sdl/win32/
-
 # We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
+MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
+OBJS := $(MODULE_OBJS) $(OBJS)
+MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
\ No newline at end of file

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/wii/module.mk
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/wii/module.mk	2010-07-30 05:25:09 UTC (rev 51494)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/wii/module.mk	2010-07-30 05:28:09 UTC (rev 51495)
@@ -8,8 +8,7 @@
 	osystem_sfx.o \
 	osystem_events.o
 
-MODULE_DIRS += \
-	backends/platform/wii/
-
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)

@@ Diff output truncated at 100000 characters. @@

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list