[Scummvm-cvs-logs] SF.net SVN: scummvm: [32350] scummvm/branches/gsoc2008-rtl

cpage88 at users.sourceforge.net cpage88 at users.sourceforge.net
Wed May 28 22:30:21 CEST 2008


Revision: 32350
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32350&view=rev
Author:   cpage88
Date:     2008-05-28 13:30:20 -0700 (Wed, 28 May 2008)

Log Message:
-----------
Merged revisions 32124,32126-32128,32131,32133,32135-32144,32146-32153,32155-32163,32165-32168,32170-32173,32175-32179,32181-32191,32193-32202,32204-32205,32209-32214,32216,32218,32220-32235,32237-32266,32269-32271,32273-32290,32292-32295,32297-32317,32319-32323,32325-32328,32330-32331,32334-32338,32343-32347 via svnmerge from 
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk

Modified Paths:
--------------
    scummvm/branches/gsoc2008-rtl/NEWS
    scummvm/branches/gsoc2008-rtl/backends/midi/coreaudio.cpp
    scummvm/branches/gsoc2008-rtl/backends/midi/quicktime.cpp
    scummvm/branches/gsoc2008-rtl/backends/module.mk
    scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_base.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_base.h
    scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/extend.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_kyra.h
    scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_sword1.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/makefile
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/adpcm_arm.s
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters.s
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters_arm.s
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/cdaudio.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/cdaudio.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/console2.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsmain.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsmain.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsoptions.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsoptions.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/disc_io.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/disc_io.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/gba_nds_fat.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_dldi.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_dldi.s
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_efa2.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_fcsr.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_fcsr.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_m3_common.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_m3_common.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_m3cf.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_m3cf.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_m3sd.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_m3sd_asm.s
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_mmcf.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_mmcf.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_mpcf.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_mpcf.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_njsd.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_njsd.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_nmmc.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_nmmc.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_sccf.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_sccf.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_scsd.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_scsd.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_scsd_asm.s
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_sd_common.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/io_sd_common.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/gbampsave.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/gbampsave.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/keys.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/osystem_ds.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/osystem_ds.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/portdefs.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/portdefs.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/ramsave.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/ramsave.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/scummconsole.c
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/scummconsole.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/scummhelp.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/scummhelp.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/touchkeyboard.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/touchkeyboard.h
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/wordcompletion.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/zipreader.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/zipreader.h
    scummvm/branches/gsoc2008-rtl/backends/platform/sdl/sdl.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/wince/CELauncherDialog.cpp
    scummvm/branches/gsoc2008-rtl/base/commandLine.cpp
    scummvm/branches/gsoc2008-rtl/base/main.cpp
    scummvm/branches/gsoc2008-rtl/base/plugins.cpp
    scummvm/branches/gsoc2008-rtl/base/plugins.h
    scummvm/branches/gsoc2008-rtl/common/advancedDetector.h
    scummvm/branches/gsoc2008-rtl/common/file.h
    scummvm/branches/gsoc2008-rtl/common/hashmap.h
    scummvm/branches/gsoc2008-rtl/common/system.cpp
    scummvm/branches/gsoc2008-rtl/common/system.h
    scummvm/branches/gsoc2008-rtl/common/util.cpp
    scummvm/branches/gsoc2008-rtl/common/util.h
    scummvm/branches/gsoc2008-rtl/dists/engine-data/kyra.dat
    scummvm/branches/gsoc2008-rtl/dists/msvc7/saga.vcproj
    scummvm/branches/gsoc2008-rtl/dists/msvc7/scummvm.vcproj
    scummvm/branches/gsoc2008-rtl/dists/msvc71/saga.vcproj
    scummvm/branches/gsoc2008-rtl/dists/msvc71/scummvm.vcproj
    scummvm/branches/gsoc2008-rtl/dists/msvc8/saga.vcproj
    scummvm/branches/gsoc2008-rtl/dists/msvc8/scummvm.vcproj
    scummvm/branches/gsoc2008-rtl/dists/msvc9/saga.vcproj
    scummvm/branches/gsoc2008-rtl/dists/msvc9/scummvm.vcproj
    scummvm/branches/gsoc2008-rtl/engines/agos/agos.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/agos.h
    scummvm/branches/gsoc2008-rtl/engines/cine/anim.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/bg.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/bg.h
    scummvm/branches/gsoc2008-rtl/engines/cine/bg_list.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/bg_list.h
    scummvm/branches/gsoc2008-rtl/engines/cine/cine.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/gfx.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/gfx.h
    scummvm/branches/gsoc2008-rtl/engines/cine/main_loop.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/object.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/pal.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/pal.h
    scummvm/branches/gsoc2008-rtl/engines/cine/prc.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/rel.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/script.h
    scummvm/branches/gsoc2008-rtl/engines/cine/script_fw.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/script_os.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/texte.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/texte.h
    scummvm/branches/gsoc2008-rtl/engines/cine/various.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/various.h
    scummvm/branches/gsoc2008-rtl/engines/cine/xref.txt
    scummvm/branches/gsoc2008-rtl/engines/drascula/animation.cpp
    scummvm/branches/gsoc2008-rtl/engines/drascula/detection.cpp
    scummvm/branches/gsoc2008-rtl/engines/drascula/drascula.cpp
    scummvm/branches/gsoc2008-rtl/engines/drascula/drascula.h
    scummvm/branches/gsoc2008-rtl/engines/drascula/rooms.cpp
    scummvm/branches/gsoc2008-rtl/engines/drascula/talk.cpp
    scummvm/branches/gsoc2008-rtl/engines/drascula/texts.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/coktelvideo.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/coktelvideo.h
    scummvm/branches/gsoc2008-rtl/engines/gob/detection.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/draw_v2.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/driver_vga.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/game_v2.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/gob.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/gob.h
    scummvm/branches/gsoc2008-rtl/engines/gob/inter.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/inter.h
    scummvm/branches/gsoc2008-rtl/engines/gob/inter_v2.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/inter_v4.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/map_v4.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/mult_v2.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/scenery.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/scenery.h
    scummvm/branches/gsoc2008-rtl/engines/gob/sound/adlib.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/sound/cdrom.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/sound/sound.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/video.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/video.h
    scummvm/branches/gsoc2008-rtl/engines/gob/videoplayer.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/videoplayer.h
    scummvm/branches/gsoc2008-rtl/engines/kyra/animator_hof.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/animator_mr.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/debugger.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/detection.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/gui_hof.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/gui_lok.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/items_lok.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/kyra_hof.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/kyra_hof.h
    scummvm/branches/gsoc2008-rtl/engines/kyra/kyra_lok.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/kyra_lok.h
    scummvm/branches/gsoc2008-rtl/engines/kyra/kyra_mr.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/kyra_mr.h
    scummvm/branches/gsoc2008-rtl/engines/kyra/kyra_v1.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/kyra_v1.h
    scummvm/branches/gsoc2008-rtl/engines/kyra/kyra_v2.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/kyra_v2.h
    scummvm/branches/gsoc2008-rtl/engines/kyra/resource.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/resource.h
    scummvm/branches/gsoc2008-rtl/engines/kyra/scene_lok.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/scene_v2.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/script_hof.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/script_lok.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/script_v1.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/sequences_hof.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/sound.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/sound.h
    scummvm/branches/gsoc2008-rtl/engines/kyra/sound_lok.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/sound_towns.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/staticres.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/text.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/text_hof.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/text_lok.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/text_mr.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/vqa.cpp
    scummvm/branches/gsoc2008-rtl/engines/lure/game.cpp
    scummvm/branches/gsoc2008-rtl/engines/lure/lure.cpp
    scummvm/branches/gsoc2008-rtl/engines/lure/lure.h
    scummvm/branches/gsoc2008-rtl/engines/lure/res_struct.cpp
    scummvm/branches/gsoc2008-rtl/engines/m4/script.h
    scummvm/branches/gsoc2008-rtl/engines/made/database.h
    scummvm/branches/gsoc2008-rtl/engines/made/detection.cpp
    scummvm/branches/gsoc2008-rtl/engines/made/graphics.cpp
    scummvm/branches/gsoc2008-rtl/engines/made/graphics.h
    scummvm/branches/gsoc2008-rtl/engines/made/made.cpp
    scummvm/branches/gsoc2008-rtl/engines/made/made.h
    scummvm/branches/gsoc2008-rtl/engines/made/pmvplayer.cpp
    scummvm/branches/gsoc2008-rtl/engines/made/resource.cpp
    scummvm/branches/gsoc2008-rtl/engines/made/screen.cpp
    scummvm/branches/gsoc2008-rtl/engines/made/screen.h
    scummvm/branches/gsoc2008-rtl/engines/made/screenfx.cpp
    scummvm/branches/gsoc2008-rtl/engines/made/screenfx.h
    scummvm/branches/gsoc2008-rtl/engines/made/script.cpp
    scummvm/branches/gsoc2008-rtl/engines/made/script.h
    scummvm/branches/gsoc2008-rtl/engines/made/scriptfuncs.cpp
    scummvm/branches/gsoc2008-rtl/engines/made/scriptfuncs.h
    scummvm/branches/gsoc2008-rtl/engines/metaengine.h
    scummvm/branches/gsoc2008-rtl/engines/parallaction/callables_ns.cpp
    scummvm/branches/gsoc2008-rtl/engines/parallaction/gui_ns.cpp
    scummvm/branches/gsoc2008-rtl/engines/parallaction/input.cpp
    scummvm/branches/gsoc2008-rtl/engines/parallaction/input.h
    scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction.cpp
    scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction.h
    scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction_ns.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/actor.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/actor_walk.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/detection.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/detection_tables.h
    scummvm/branches/gsoc2008-rtl/engines/saga/gfx.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/interface.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/interface.h
    scummvm/branches/gsoc2008-rtl/engines/saga/isomap.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/isomap.h
    scummvm/branches/gsoc2008-rtl/engines/saga/itedata.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/module.mk
    scummvm/branches/gsoc2008-rtl/engines/saga/music.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/palanim.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/puzzle.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/rscfile.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/saga.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/saga.h
    scummvm/branches/gsoc2008-rtl/engines/saga/saveload.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/scene.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/scene.h
    scummvm/branches/gsoc2008-rtl/engines/saga/sfuncs.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/sndres.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/sprite.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/sthread.cpp
    scummvm/branches/gsoc2008-rtl/engines/scumm/charset.cpp
    scummvm/branches/gsoc2008-rtl/engines/scumm/debugger.cpp
    scummvm/branches/gsoc2008-rtl/engines/scumm/detection_tables.h
    scummvm/branches/gsoc2008-rtl/engines/scumm/saveload.cpp
    scummvm/branches/gsoc2008-rtl/engines/scumm/script_v6.cpp
    scummvm/branches/gsoc2008-rtl/engines/scumm/scumm-md5.h
    scummvm/branches/gsoc2008-rtl/engines/scumm/string.cpp
    scummvm/branches/gsoc2008-rtl/engines/sword2/mouse.cpp
    scummvm/branches/gsoc2008-rtl/engines/sword2/mouse.h
    scummvm/branches/gsoc2008-rtl/engines/sword2/sword2.cpp
    scummvm/branches/gsoc2008-rtl/engines/sword2/sword2.h
    scummvm/branches/gsoc2008-rtl/gui/about.cpp
    scummvm/branches/gsoc2008-rtl/gui/debugger.cpp
    scummvm/branches/gsoc2008-rtl/gui/launcher.h
    scummvm/branches/gsoc2008-rtl/sound/audiostream.cpp
    scummvm/branches/gsoc2008-rtl/sound/audiostream.h
    scummvm/branches/gsoc2008-rtl/sound/flac.cpp
    scummvm/branches/gsoc2008-rtl/sound/fmopl.h
    scummvm/branches/gsoc2008-rtl/sound/midiplugin.h
    scummvm/branches/gsoc2008-rtl/sound/mp3.cpp
    scummvm/branches/gsoc2008-rtl/sound/softsynth/mt32/mt32emu.h
    scummvm/branches/gsoc2008-rtl/sound/vorbis.cpp
    scummvm/branches/gsoc2008-rtl/test/common/hashmap.h
    scummvm/branches/gsoc2008-rtl/tools/create_kyradat/create_kyradat.cpp
    scummvm/branches/gsoc2008-rtl/tools/scumm-md5.txt

Added Paths:
-----------
    scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_m4.h
    scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_made.h
    scummvm/branches/gsoc2008-rtl/engines/saga/introproc_ihnm.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/introproc_ite.cpp
    scummvm/branches/gsoc2008-rtl/tools/create_kyradat/ita.h

Removed Paths:
-------------
    scummvm/branches/gsoc2008-rtl/backends/fs/gp32/
    scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_save.cpp
    scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_save.h
    scummvm/branches/gsoc2008-rtl/backends/platform/gp32/
    scummvm/branches/gsoc2008-rtl/engines/saga/ihnm_introproc.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/ite_introproc.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/sagaresnames.h

Property Changed:
----------------
    scummvm/branches/gsoc2008-rtl/


Property changes on: scummvm/branches/gsoc2008-rtl
___________________________________________________________________
Name: svnmerge-integrated
   - /scummvm/branches/gsoc2008-gui:1-31703 /scummvm/branches/gsoc2008-tfmx:1-31765 /scummvm/trunk:1-32123
   + /scummvm/branches/gsoc2008-gui:1-31703 /scummvm/branches/gsoc2008-tfmx:1-31765 /scummvm/trunk:1-32347

Modified: scummvm/branches/gsoc2008-rtl/NEWS
===================================================================
--- scummvm/branches/gsoc2008-rtl/NEWS	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/NEWS	2008-05-28 20:30:20 UTC (rev 32350)
@@ -6,6 +6,7 @@
    - Added support for The Legend of Kyrandia: Book Two: Hand of Fate
    - Added support for The Legend of Kyrandia: Book Three: Malcolm's Revenge
    - Added support for Lost in Time
+   - Added support for The Bizarre Adventures of Woodruff and the Schnibble
    - Added support for the PC version of Waxworks
    - Added support for the Macintosh version of I Have no Mouth, and I
      must Scream

Modified: scummvm/branches/gsoc2008-rtl/backends/midi/coreaudio.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/midi/coreaudio.cpp	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/midi/coreaudio.cpp	2008-05-28 20:30:20 UTC (rev 32350)
@@ -24,6 +24,17 @@
 
 #ifdef MACOSX
 
+// HACK to disable deprecated warnings under Mac OS X 10.5.
+// Apple depracted the AUGraphNewNode & AUGraphGetNodeInfo APIs
+// in favor of the new AUGraphAddNode & AUGraphNodeInfo APIs.
+// While it would be trivial to switch to those, this would break
+// binary compatibility with all pre-10.5 systems, so we don't want
+// to do that just now. Maybe when 10.6 comes... :)
+#include <AvailabilityMacros.h>
+#undef DEPRECATED_ATTRIBUTE
+#define DEPRECATED_ATTRIBUTE
+
+
 #include "common/config-manager.h"
 #include "common/util.h"
 #include "sound/midiplugin.h"

Modified: scummvm/branches/gsoc2008-rtl/backends/midi/quicktime.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/midi/quicktime.cpp	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/midi/quicktime.cpp	2008-05-28 20:30:20 UTC (rev 32350)
@@ -24,6 +24,18 @@
 
 #if defined(MACOSX) || defined(macintosh)
 
+// HACK to disable deprecated warnings under Mac OS X 10.5.
+// Apple depracted the complete QuickTime Music/MIDI API.
+// Apps are supposed to use CoreAudio & CoreMIDI. We do support
+// those, but while QT Midi support is still around, there is no
+// reason to disable this driver. If they really ditch the API in 10.6,
+// we can still release binaries with this driver disabled/removed.
+#include <AvailabilityMacros.h>
+#undef DEPRECATED_ATTRIBUTE
+#define DEPRECATED_ATTRIBUTE
+
+
+
 #include "common/endian.h"
 #include "common/util.h"
 #include "sound/midiplugin.h"
@@ -285,10 +297,10 @@
 	return mididriver;
 }
 
-//#if PLUGIN_ENABLED_DYNAMIC(QT)
-	//REGISTER_PLUGIN_DYNAMIC(QT, PLUGIN_TYPE_MIDI, QuickTimeMidiPlugin);
+//#if PLUGIN_ENABLED_DYNAMIC(QUICKTIME)
+	//REGISTER_PLUGIN_DYNAMIC(QUICKTIME, PLUGIN_TYPE_MIDI, QuickTimeMidiPlugin);
 //#else
-	REGISTER_PLUGIN_STATIC(QT, PLUGIN_TYPE_MIDI, QuickTimeMidiPlugin);
+	REGISTER_PLUGIN_STATIC(QUICKTIME, PLUGIN_TYPE_MIDI, QuickTimeMidiPlugin);
 //#endif
 
 #endif // MACOSX || macintosh

Modified: scummvm/branches/gsoc2008-rtl/backends/module.mk
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/module.mk	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/module.mk	2008-05-28 20:30:20 UTC (rev 32350)
@@ -3,7 +3,6 @@
 MODULE_OBJS := \
 	fs/amigaos4/amigaos4-fs-factory.o \
 	fs/ds/ds-fs-factory.o \
-	fs/gp32/gp32-fs-factory.o \
 	fs/palmos/palmos-fs-factory.o \
 	fs/posix/posix-fs-factory.o \
 	fs/ps2/ps2-fs-factory.o \

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_base.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_base.cpp	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_base.cpp	2008-05-28 20:30:20 UTC (rev 32350)
@@ -24,9 +24,9 @@
  */
 
 #include "be_base.h"
-#include "be_save.h"
 #include "common/config-file.h"
 #include "common/config-manager.h"
+#include "backends/saves/default/default-saves.h"
 #include "backends/timer/default/default-timer.h"
 #include "sound/mixer.h"
 
@@ -100,7 +100,7 @@
 	// Create the savefile manager, if none exists yet (we check for this to
 	// allow subclasses to provide their own).
 	if (_saveMgr == 0) {
-		_saveMgr = new PalmSaveFileManager();
+		_saveMgr = new DefaultSaveFileManager();
 	}
 
 	// Create and hook up the mixer, if none exists yet (we check for this to
@@ -120,6 +120,11 @@
 	OSystem::initBackend();
 }
 
+void OSystem_PalmBase::getTimeAndDate(struct tm &t) const {
+	time_t curTime = time(0);
+	t = *localtime(&curTime);
+}
+
 uint32 OSystem_PalmBase::getMillis() {
 	return TimGetTicks() * 1000 / SysTicksPerSecond();
 }

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_base.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_base.h	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_base.h	2008-05-28 20:30:20 UTC (rev 32350)
@@ -26,6 +26,8 @@
 #ifndef BE_BASE_H
 #define BE_BASE_H
 
+#include <time.h>
+
 #include "PalmVersion.h"
 #include "globals.h"
 
@@ -236,6 +238,7 @@
 
 	bool pollEvent(Common::Event &event);
 
+	void getTimeAndDate(struct tm &t) const;
 	virtual uint32 getMillis();
 	virtual void delayMillis(uint msecs);
 

Deleted: scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_save.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_save.cpp	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_save.cpp	2008-05-28 20:30:20 UTC (rev 32350)
@@ -1,76 +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 "be_base.h"
-#include "common/savefile.h"
-#include "be_save.h"
-
-Common::StringList PalmSaveFileManager::listSavefiles(const char *pattern) {
-	TODO: Implement this. If you don't understand what it should do, just ask
-	(e.g. on scummvm-devel or Fingolfin). It should be pretty simple if you
-	use Common::matchString from common/util.h and read the Doxygen docs,
-	then combine this with the old code below...
-
-/*
-void PalmSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num) {
-	FileRef fileRef;
-	// try to open the dir
-	Err e = VFSFileOpen(gVars->VFS.volRefNum, SCUMMVM_SAVEPATH, vfsModeRead, &fileRef);
-	memset(marks, false, num*sizeof(bool));
-
-	if (e != errNone)
-		return;
-
-	// enumerate all files
-	UInt32 dirEntryIterator = vfsIteratorStart;
-	Char filename[32];
-	FileInfoType info = {0, filename, 32};
-	UInt16 length = StrLen(prefix);
-	int slot = 0;
-
-	while (dirEntryIterator != vfsIteratorStop) {
-		e = VFSDirEntryEnumerate (fileRef, &dirEntryIterator, &info);
-
-		if (e != expErrEnumerationEmpty) {									// there is something
-
-			if (StrLen(info.nameP) == (length + 2)) {						// consider max 99, filename length is ok
-				if (StrNCaselessCompare(prefix, info.nameP, length) == 0) { // this seems to be a save file
-					if (isdigit(info.nameP[length]) && isdigit(info.nameP[length+1])) {
-
-						slot = StrAToI(filename + length);
-						if (slot >= 0 && slot < num)
-							*(marks+slot) = true;
-
-					}
-				}
-			}
-
-		}
-	}
-
-	VFSFileClose(fileRef);
-}
-
-}

Deleted: scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_save.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_save.h	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/be_save.h	2008-05-28 20:30:20 UTC (rev 32350)
@@ -1,36 +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$
- *
- */
-
-#ifndef BACKEND_SAVES_PALM_H
-#define BACKEND_SAVES_PALM_H
-
-#include "saves/default/default-saves.h"
-
-class PalmSaveFileManager : public DefaultSaveFileManager {
-public:
-	Common::StringList listSavefiles(const char *pattern);
-};
-
-#endif

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/extend.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/extend.cpp	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/extend.cpp	2008-05-28 20:30:20 UTC (rev 32350)
@@ -29,8 +29,6 @@
 
 #include "modulesrsc.h"
 
-const char *SCUMMVM_SAVEPATH = "/PALM/Programs/ScummVM/Saved";
-
 void PalmFatalError(const char *err) {
 	WinSetDrawWindow(WinGetDisplayWindow());
 	WinPalette(winPaletteSetToDefault,0,0,0);

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_kyra.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_kyra.h	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_kyra.h	2008-05-28 20:30:20 UTC (rev 32350)
@@ -2,6 +2,6 @@
 #define PREFIX_H
 
 #include "native_common.h"
-#define ENABLE_KYRA
+#define ENABLE_KYRA STATIC_PLUGIN
 
 #endif

Copied: scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_m4.h (from rev 32347, scummvm/trunk/backends/platform/PalmOS/Src/prefixes/native_m4.h)
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_m4.h	                        (rev 0)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_m4.h	2008-05-28 20:30:20 UTC (rev 32350)
@@ -0,0 +1,7 @@
+#ifndef PREFIX_H
+#define PREFIX_H
+
+#include "native_common.h"
+#define ENABLE_M4 STATIC_PLUGIN
+
+#endif

Copied: scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_made.h (from rev 32347, scummvm/trunk/backends/platform/PalmOS/Src/prefixes/native_made.h)
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_made.h	                        (rev 0)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_made.h	2008-05-28 20:30:20 UTC (rev 32350)
@@ -0,0 +1,7 @@
+#ifndef PREFIX_H
+#define PREFIX_H
+
+#include "native_common.h"
+#define ENABLE_MADE STATIC_PLUGIN
+
+#endif

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_sword1.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_sword1.h	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/PalmOS/Src/prefixes/native_sword1.h	2008-05-28 20:30:20 UTC (rev 32350)
@@ -2,7 +2,7 @@
 #define PREFIX_H
 
 #include "native_common.h"
-#define ENABLE_SWORD1
+#define ENABLE_SWORD1 STATIC_PLUGIN
 #define USE_MPEG2
 #define USE_VORBIS
 

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/makefile
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/makefile	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/makefile	2008-05-28 20:30:20 UTC (rev 32350)
@@ -34,10 +34,10 @@
         DS_BUILD_G = 1
 endif
 
-#DS_BUILD_A = 1
+DS_BUILD_A = 1
 #DS_BUILD_B = 1
 #DS_BUILD_C = 1
-#DS_BUILD_D = 1		# started!
+#DS_BUILD_D = 1		
 #DS_BUILD_E = 1
 #DS_BUILD_F = 1
 #DS_BUILD_G = 1
@@ -82,11 +82,15 @@
 
 USE_ARM_SOUND_ASM = 1
 ARM = 1
+USE_ARM_COSTUME_ASM = 1
 
 ifdef DS_BUILD_A
-	DEFINES = -DDS_SCUMM_BUILD -DDS_BUILD_A -DUSE_ARM_GFX_ASM
+	DEFINES = -DDS_SCUMM_BUILD -DDS_BUILD_A -DUSE_ARM_GFX_ASM -DUSE_ARM_COSTUME_ASM
 	LOGO = logoa.bmp
 	ENABLE_SCUMM = STATIC_PLUGIN
+	DEFINES += -DENABLE_SCUMM=STATIC_PLUGIN
+	MODULES += engines/scumm
+
 	USE_ARM_GFX_ASM = 1
 	BUILD=scummvm-A
 endif
@@ -146,10 +150,12 @@
 CFLAGS	=	-Wno-multichar -Wall\
 		-Wno-multichar -mcpu=arm9tdmi -mtune=arm9tdmi \
 		-mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer\
-		-ffast-math -mthumb-interwork
+		-mthumb-interwork -DUSE_ARM_COSTUME_ASM=1
 
+# -ffast-math 
+
 ifdef USE_DEBUGGER
-	DEFINES += -DUSE_DEBUGGER
+	DEFINES += -DUSE_DEBUGGER 
 	CFLAGS += -g
 endif
 
@@ -258,17 +264,21 @@
 #OPTLIST :=
 
 # Compiler options for files which should be optimised for speed
-OPT_SPEED := -O3
+OPT_SPEED := -O2
 
 # Compiler options for files which should be optimised for space
-OPT_SIZE := -Os -mthumb -fno-gcse -fno-schedule-insns2
+OPT_SIZE := -Os
 
 
+#-mthumb -fno-gcse -fno-schedule-insns2
 
-OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS)
 
+			
+OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS) 
+		
 
 
+
 MODULE_DIRS += .
 
 ndsall:
@@ -330,8 +340,8 @@
 ifndef HAVE_GCC3
 # If you use GCC, disable the above and enable this for intelligent
 # dependency tracking.
-.cpp.o:
-
+#.cpp.o:
+%.o:%.cpp
 	$(MKDIR) $(*D)/$(DEPDIR)
 	$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d2" $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
 #	$(ECHO) "$(*D)/" > $(*D)/$(DEPDIR)/$(*F).d
@@ -342,7 +352,8 @@
 # rule can get you into a bad state if you Ctrl-C at the wrong moment.
 # Also, with this GCC inserts additional dummy rules for the involved headers,
 # which ensures a smooth compilation even if said headers become obsolete.
-.cpp.o:
+#.cpp.o:
+%.o:%.cpp
 #	echo !!!!!!!!!!!! $(notdir $<)
 #	ifeq ( $(notdir $<), $(findstring $(notdir $<), $(OPTLIST)) )
 #	 OPTFLAG=-O3

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/adpcm_arm.s
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/adpcm_arm.s	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/adpcm_arm.s	2008-05-28 20:30:20 UTC (rev 32350)
@@ -55,14 +55,14 @@
 loop:
 	LDRH	r10,[r11,r2]	@ r10 = stepTab[stepTableIndex]
 	TST	r12,#4		@ if ((offset & 4) == 0)
-	MOVEQ	r9, #0		@	r9 = diff = 0
+	MOVEQ	r9, #0		@ 	r9 = diff = 0
 	MOVNE	r9, r10		@ else	r9 = diff = stepTab[stepTableIndex]
 
 	TST	r12,#2		@ if (offset & 2)
-	ADDNE	r9, r9, r10,ASR #1	@	diff += r10>>1
+	ADDNE	r9, r9, r10,ASR #1	@ 	diff += r10>>1
 
 	TST	r12,#1		@ if (offset & 1)
-	ADDNE	r9, r9, r10,ASR #2	@	diff += r10>>2
+	ADDNE	r9, r9, r10,ASR #2	@ 	diff += r10>>2
 
 	ADD	r9, r9, r10,ASR #3	@ diff += r10>>3
 

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters.cpp	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters.cpp	2008-05-28 20:30:20 UTC (rev 32350)
@@ -27,25 +27,25 @@
 
 namespace DS {
 
-void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
+void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst, 
 	int vsPitch, int vmScreenWidth, int textSurfacePitch) {
 
 
 	if (height <= 0) height = 1;
 	if (width < 4) return;
-
-
+	
+	
 	width &= ~4;
 //	src = (const byte *) (((int) (src)) & (~4));
 //	dst = (byte *) (((int) (dst)) & (~4));
 //	text = (const byte *) (((int) (text)) & (~4));
-
+	
 	asm (	"mov r5, %0\n"				// Height
-			"yLoop:\n"
+			"yLoop:\n"			
 			"mov r3, #0\n"				// X pos
-
+			
 			"xLoop:\n"
-
+			
 			"ldr r4, [%2, r3]\n"		// Load text layer word
 			"cmp r4, %5\n"
 			"bne singleByteCompare\n"
@@ -54,7 +54,7 @@
 			"add r3, r3, #4\n"
 			"cmp r3, %1\n"				// x == width?
 			"blt xLoop\n"
-
+			
 			"add %2, %2, %8\n"			// src += vs->pitch
 			"add %3, %3, %6\n"			// dst += _vm->_screenWidth
 			"add %4, %4, %7\n"			// text += _textSurface.pitch
@@ -62,8 +62,8 @@
 			"cmp r5, #0\n"				// y == 0?
 			"bne yLoop\n"
 			"b end\n"
-
-
+			
+			
 			"singleByteCompare:\n"
 			"ldrb r4, [%2, r3]\n"		// Load text byte
 			"cmps r4, %5, lsr #24\n"	// Compare with mask
@@ -78,7 +78,7 @@
 			"ldreqb r4, [%3, r3]\n"		// Otherwise Load src byte
 			"streqb r4, [%4, r3]\n"		// Store it
 			"add r3, r3, #1\n"
-
+			
 			"ldrb r4, [%2, r3]\n"		// Load text byte
 			"cmps r4, %5, lsr #24\n"	// Compare with mask
 			"strneb r4, [%4, r3]\n"		// Store if not equal
@@ -91,7 +91,7 @@
 			"strneb r4, [%4, r3]\n"		// Store if not equal
 			"ldreqb r4, [%3, r3]\n"		// Otherwise Load src byte
 			"streqb r4, [%4, r3]\n"		// Store it
-			"add r3, r3, #1\n"
+			"add r3, r3, #1\n"			
 
 			"cmps r3, %1\n"				// x == width?
 			"blt xLoop\n"				// Repeat
@@ -101,10 +101,10 @@
 			"sub r5, r5, #1\n"			// y -= 1
 			"cmp r5, #0\n"				// y == 0?
 			"bne yLoop\n"
-
+			
 			"end:\n"
 		: /* no output registers */
-		: "r" (height), "r" (width), "r" (text), "r" (src), "r" (dst), "r" (CHARSET_MASK_TRANSPARENCY | (CHARSET_MASK_TRANSPARENCY << 8) | (CHARSET_MASK_TRANSPARENCY << 16) | (CHARSET_MASK_TRANSPARENCY << 24)),
+		: "r" (height), "r" (width), "r" (text), "r" (src), "r" (dst), "r" (CHARSET_MASK_TRANSPARENCY | (CHARSET_MASK_TRANSPARENCY << 8) | (CHARSET_MASK_TRANSPARENCY << 16) | (CHARSET_MASK_TRANSPARENCY << 24)), 
 			"r" (vsPitch), "r" (vmScreenWidth), "r" (textSurfacePitch)
 		: "r5", "r3", "r4", "%2", "%3", "%4", "memory");
 }
@@ -115,7 +115,7 @@
 	asm("ands r0, %3, #1\n"
 		 "addne %3, %3, #1\n"
 		 "bne roll2\n"
-
+			
 		 "yLoop2:\n"
 		 "ldr r0, [%2, #0]\n"
 		 "str r0, [%0, #0]\n"
@@ -131,7 +131,7 @@
 		 "add %0, %0, %1\n"
 		 "add %2, %2, %1\n"
 		 "subs %3, %3, #2\n"
-		 "bne yLoop2\n"
+		 "bne yLoop2\n"		 
 
 		: /* no output registers */
 		: "r" (dst), "r" (dstPitch), "r" (src), "r" (height)
@@ -150,7 +150,7 @@
     for (int i=0; i<160; ++i)
     {
         DIV_BY_5[i] = (2*i+5)/10;
-    }
+    }                
 }
 
 #ifdef PERFECT_5_TO_4_RESCALING
@@ -163,13 +163,13 @@
     u32 bs3 = s3 & 0x1F;
     u32 bs4 = s4 & 0x1F;
 
-#if 0
+#if 0    
     u32 gs0 = (s0 >> 5) & 0x1F;
     u32 gs1 = (s1 >> 5) & 0x1F;
     u32 gs2 = (s2 >> 5) & 0x1F;
     u32 gs3 = (s3 >> 5) & 0x1F;
     u32 gs4 = (s4 >> 5) & 0x1F;
-
+    
     u32 rs0 = (s0 >> 10) & 0x1F;
     u32 rs1 = (s1 >> 10) & 0x1F;
     u32 rs2 = (s2 >> 10) & 0x1F;
@@ -191,22 +191,22 @@
     asm("and %0, %2, %1, lsr #10" : "=r"(rs3) : "r"(s3), "r"(mask) : );
     asm("and %0, %2, %1, lsr #10" : "=r"(rs4) : "r"(s4), "r"(mask) : );
 #endif
-
+    
     u32 rd0 = 4*rs0 +   rs1;
     u32 rd1 = 2*rs1 + rs1 + 2*rs2;
     u32 rd2 = 2*rs2 + 2*rs3 + rs3;
     u32 rd3 =   rs3 + 4*rs4;
-
+    
     u32 gd0 = 4*gs0 +   gs1;
     u32 gd1 = 2*gs1 + gs1 + 2*gs2;
     u32 gd2 = 2*gs2 + 2*gs3 + gs3;
     u32 gd3 =   gs3 + 4*gs4;
-
+    
     u32 bd0 = 4*bs0 +   bs1;
     u32 bd1 = 2*bs1 + bs1 + 2*bs2;
     u32 bd2 = 2*bs2 + 2*bs3 + bs3;
     u32 bd3 =   bs3 + 4*bs4;
-
+    
 #if 0
     // Offsetting for correct rounding
     rd0 = rd0*2+5; rd1 = rd1*2+5; rd2 = rd2*2+5; rd3 = rd3*2+5;
@@ -217,14 +217,14 @@
 	gd0 = (gd0 * 51) >> 9; gd1 = (gd1 * 51) >> 9; gd2 = (gd2 * 51) >> 9; gd3 = (gd3 * 51) >> 9;
 	bd0 = (bd0 * 51) >> 9; bd1 = (bd1 * 51) >> 9; bd2 = (bd2 * 51) >> 9; bd3 = (bd3 * 51) >> 9;
 #else
-	rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1]; rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3];
-	gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1]; gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3];
-	bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1]; bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3];
+	rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1]; rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3]; 
+	gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1]; gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3]; 
+	bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1]; bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3]; 
 #endif
-
+    
     u32 d10 = 0x80008000 | (rd1 << 26) | (gd1 << 21) | (bd1 << 16) | (rd0 << 10) | (gd0 << 5) | bd0;
     u32 d32 = 0x80008000 | (rd3 << 26) | (gd3 << 21) | (bd3 << 16) | (rd2 << 10) | (gd2 << 5) | bd2;
-
+    
     ((u32*)dest)[0] = d10;
     ((u32*)dest)[1] = d32;
 }
@@ -233,7 +233,7 @@
                                                     u16* dest)
 {
     static const u32 MASK = 0x03E07C1F;
-
+    
     u32 argbargbs0 = u32(s0) | (u32(s0) << 16);
     u32 argbargbs1 = u32(s1) | (u32(s1) << 16);
     u32 argbargbs2 = u32(s2) | (u32(s2) << 16);
@@ -245,32 +245,32 @@
     u32 grbs2 = argbargbs2 & MASK;
     u32 grbs3 = argbargbs3 & MASK;
     u32 grbs4 = argbargbs4 & MASK;
-
+    
     u32 grbd0 = (3*grbs0 +   grbs1) >> 2;
     u32 grbd1 = (  grbs1 +   grbs2) >> 1;
     u32 grbd2 = (  grbs2 +   grbs3) >> 1;
     u32 grbd3 = (  grbs3 + 3*grbs4) >> 2;
-
+    
     grbd0 &= MASK;
     grbd1 &= MASK;
     grbd2 &= MASK;
     grbd3 &= MASK;
-
+    
     u32 d0 = grbd0 | (grbd0 >> 16);
     u32 d1 = grbd1 | (grbd1 >> 16);
     u32 d2 = grbd2 | (grbd2 >> 16);
     u32 d3 = grbd3 | (grbd3 >> 16);
-
-    d0 &= 0xFFFF;
-    d1 &= 0xFFFF;
-    d2 &= 0xFFFF;
-    d3 &= 0xFFFF;
-
-    d0 |= 0x8000;
-    d1 |= 0x8000;
-    d2 |= 0x8000;
-    d3 |= 0x8000;
-
+    
+    d0 &= 0xFFFF; 
+    d1 &= 0xFFFF; 
+    d2 &= 0xFFFF; 
+    d3 &= 0xFFFF; 
+    
+    d0 |= 0x8000; 
+    d1 |= 0x8000; 
+    d2 |= 0x8000; 
+    d3 |= 0x8000; 
+    
     dest[0] = d0;
     dest[1] = d1;
     dest[2] = d2;
@@ -287,13 +287,13 @@
     u32 bd0 = (d0 << 24) >> 24;
     u32 bd1 = (d1 << 24) >> 24;
     u32 gd0 = (d0 << 16) >> 24;
-    u32 gd1 = (d1 << 16) >> 24;
+    u32 gd1 = (d1 << 16) >> 24;    
     u32 rd0 = (d0 >> 16);
     u32 rd1 = (d1 >> 16);
-
+    
 	rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1];
 	gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1];
-	bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1];
+	bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1];    
     u32 d10 = 0x80008000 | (rd1 << 26) | (gd1 << 21) | (bd1 << 16) | (rd0 << 10) | (gd0 << 5) | bd0;
     ((u32*)dest)[0] = d10;
 
@@ -307,11 +307,11 @@
     u32 rd2 = (d2 >> 16);
     u32 rd3 = (d3 >> 16);
 
-    rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3];
-    gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3];
-    bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3];
+    rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3]; 
+    gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3]; 
+    bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3]; 
     u32 d32 = 0x80008000 | (rd3 << 26) | (gd3 << 21) | (bd3 << 16) | (rd2 << 10) | (gd2 << 5) | bd2;
-
+    
     ((u32*)dest)[1] = d32;
 }
 
@@ -320,7 +320,7 @@
 static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const u8* src, const u32* palette)
 {
     ComputeDivBy5TableIFN();
-
+    
     for (size_t i=0; i<64; ++i)
     {
         u32 s0 = palette[src[5*i+0]];
@@ -353,7 +353,7 @@
 static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16* dest, const u16* src)
 {
     ComputeDivBy5TableIFN();
-
+    
     for (size_t i=0; i<64; ++i)
     {
         u16 s0 = src[5*i+0];
@@ -384,7 +384,7 @@
 
 	for (size_t i=0; i<200; ++i)
 	{
-		Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
+		Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);			
 	}
 }
 #else
@@ -396,7 +396,7 @@
 
 	for (size_t i=0; i<200; ++i)
 	{
-		Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
+		Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);			
 	}
 }
 #endif

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters.h	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters.h	2008-05-28 20:30:20 UTC (rev 32350)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  */
-
+ 
  #ifndef _BLITTERS_H_
  #define _BLITTERS_H_
 
@@ -29,22 +29,22 @@
 
 namespace DS {
 
-void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
+void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst, 
 	int vsPitch, int vmScreenWidth, int textSurfacePitch);
 void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height);
 void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStride, int srcStride, const u16* palette);
 void Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride);
 
 }
-
+	
 #else
 
 extern "C" {
 
-void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
+void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst, 
 	int vsPitch, int vmScreenWidth, int textSurfacePitch);
 void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height);
-void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStride, int srcStride, const u16* palette);
+void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStride, int srcStride, const u16* palette, u32 numLines);
 void Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride);
 
 }

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters.s
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters.s	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters.s	2008-05-28 20:30:20 UTC (rev 32350)
@@ -21,7 +21,7 @@
 @ @author Robin Watts (robin at wss.co.uk)
 
 	.text
-
+	
 	.global	asmDrawStripToScreen
 	.global	asmCopy8Col
 	.global	Rescale_320x256xPAL8_To_256x256x1555
@@ -142,7 +142,7 @@
 	@ r3 = height
 	STMFD	r13!,{r14}
 	SUB	r1,r1,#4
-
+	
 	TST	r3,#1
 	ADDNE   r3,r3,#1
 	BNE	roll2
@@ -177,7 +177,7 @@
 	@ r2 = dstStride
 	@ r3 = srcStride
 	STMFD	r13!,{r4-r5,r8-r11,r14}
-
+	
 	SUB	r2,r2,#64*5		@ srcStride -= line length
 	SUB	r3,r3,#64*4		@ dstStride -= line length
 
@@ -187,7 +187,7 @@
 	MOV	r5, #200		@ r5 = y
 yLoop3:
 	MOV	r4, #64			@ r4 = x
-xLoop3:
+xLoop3:	
 	LDRH	r9, [r0],#2		@ r9 = src0
 	LDRH	r10,[r0],#2		@ r10= src1
 	LDRH	r11,[r0],#2		@ r11= src2
@@ -212,7 +212,7 @@
 	ADD	r11,r11,r12		@ r11= dst2
 	ADD	r12,r12,r14		@ r12= src3 + src4
 	ADD	r12,r12,r14,LSL #1	@ r12= src3 + src4*3 = dst3<<2
-
+	
 	AND	r9, r8, r9, LSR #2	@ r9 = dst0 (split)
 	AND	r10,r8, r10,LSR #1	@ r10= dst1 (split)
 	AND	r11,r8, r11,LSR #1	@ r11= dst2 (split)
@@ -227,7 +227,7 @@
 	ORR	r10,r10,#0x8000
 	ORR	r11,r11,#0x8000
 	ORR	r12,r12,#0x8000
-
+	
 	STRH	r9, [r1],#2
 	STRH	r10,[r1],#2
 	STRH	r11,[r1],#2
@@ -235,7 +235,7 @@
 
 	SUBS	r4,r4,#1
 	BGT	xLoop3
-
+	
 	ADD	r0,r0,r2,LSL #1
 	ADD	r1,r2,r3,LSL #1
 	SUBS	r5,r5,#1
@@ -266,7 +266,7 @@
 	ORR	r8, r8,#0x00007C00
 	ORR	r8, r8,#0x03E00000	@ r8 = mask
 	LDR	r9, [r13,#7*4]		@ r9 = palette
-
+	
 	SUB	r13,r13,#256*4		@ r13 = 1K of space on the stack.
 	MOV	r5, r13			@ r5 points to this space
 	MOV	r14,#256
@@ -277,14 +277,14 @@
 	AND	r10,r10,r8		@ r10 = separated palette entry
 	STR	r10,[r5], #4
 	BGT	palLoop
-
+	
 	SUB	r2,r2,#64*5		@ srcStride -= line length
 	SUB	r3,r3,#64*4		@ dstStride -= line length
 
 	MOV	r5,#200			@ r5 = y
 yLoop4:
 	MOV	r4,#64			@ r4 = x
-xLoop4:
+xLoop4:	
 	LDRB	r9, [r0],#1		@ r9 = src0
 	LDRB	r10,[r0],#1		@ r10= src1
 	LDRB	r11,[r0],#1		@ r11= src2
@@ -303,7 +303,7 @@
 	ADD	r11,r11,r12		@ r11= dst2
 	ADD	r12,r12,r14		@ r12= src3 + src4
 	ADD	r12,r12,r14,LSL #1	@ r12= src3 + src4*3 = dst3<<2
-
+	
 	AND	r9, r8, r9, LSR #2	@ r9 = dst0 (split)
 	AND	r10,r8, r10,LSR #1	@ r10= dst1 (split)
 	AND	r11,r8, r11,LSR #1	@ r11= dst2 (split)
@@ -318,7 +318,7 @@
 	ORR	r10,r10,#0x8000
 	ORR	r11,r11,#0x8000
 	ORR	r12,r12,#0x8000
-
+	
 	STRH	r9, [r1],#2
 	STRH	r10,[r1],#2
 	STRH	r11,[r1],#2
@@ -326,7 +326,7 @@
 
 	SUBS	r4,r4,#1
 	BGT	xLoop4
-
+	
 	ADD	r0,r0,r2
 	ADD	r1,r2,r3,LSL #1
 	SUBS	r5,r5,#1
@@ -336,4 +336,4 @@
 
 	LDMFD	r13!,{r4-r5,r8-r11,PC}
 
-
+ 	  	 

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters_arm.s
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters_arm.s	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/blitters_arm.s	2008-05-28 20:30:20 UTC (rev 32350)
@@ -251,8 +251,8 @@
 	@                                      const u8   *src,
 	@                                      int         dstStride,
 	@                                      int         srcStride,
-	@                                      const u16  *pal);
-	@
+	@                                      const u16  *pal,
+	@                                      u32         numLines);
 Rescale_320x256xPAL8_To_256x256x1555:
 	@ r0 = dst
 	@ r1 = src
@@ -263,6 +263,7 @@
 	ORR	r8, r8,#0x0000FC00
 	ORR	r8, r8,#0x03E00000	@ r8 = mask
 	LDR	r9, [r13,#9*4]		@ r9 = palette
+	LDR	r7, [r13,#10*4]		@ r7 = numLines
 
 	SUB	r13,r13,#256*4		@ r13 = 1K of space on the stack.
 	MOV	r5, r13			@ r5 points to this space
@@ -280,7 +281,7 @@
 	SUB	r3,r3,#64*5		@ dstStride -= line length
 
 	MOV	r14,#0xFF		@ r14= 255
-	MOV	r5,#200			@ r5 = y
+	MOV	r5,r7			@ r5 = numLines
 yLoop4:
 	MOV	r4,#16			@ r4 = x
 xLoop4:
@@ -292,7 +293,7 @@
 	ADD	r6, r6, r6, LSL #1	@ r6 = 3*pal[src0]
 	AND	r9, r14,r10,LSR #16	@ r9 = src2
 	LDR	r9, [r13,r9, LSL #2]	@ r9 = pal[src2]
-	MOV	r10,r10,LSR #24		@ r10= src3
+ 	MOV	r10,r10,LSR #24		@ r10= src3
 	LDR	r10,[r13,r10,LSL #2]	@ r10= pal[src3]
 	ADD	r6, r6, r7		@ r6 = dst0<<2
 	AND	r6, r8, r6, LSR #2	@ r6 = dst0 (split)
@@ -322,7 +323,7 @@
 	ADD	r6, r6, r6, LSL #1	@ r6 = 3*pal[src5]
 	MOV	r9, r11,LSR #24		@ r9 = src7
 	LDR	r9, [r13,r9, LSL #2]	@ r9 = pal[src7]
-	AND	r10,r14,r12		@ r10= src8
+ 	AND	r10,r14,r12		@ r10= src8
 	LDR	r10,[r13,r10,LSL #2]	@ r10= pal[src8]
 	ADD	r6, r6, r7		@ r6 = dst4<<2
 	AND	r6, r8, r6, LSR #2	@ r6 = dst4 (split)
@@ -354,7 +355,7 @@
 	ADD	r6, r6, r6, LSL #1	@ r6 = 3*pal[src10]
 	AND	r9, r14,r10		@ r9 = src12
 	LDR	r9, [r13,r9, LSL #2]	@ r9 = pal[src12]
-	AND	r12,r14,r10,LSR #8	@ r11= src13
+ 	AND	r12,r14,r10,LSR #8	@ r11= src13
 	LDR	r12,[r13,r12,LSL #2]	@ r11= pal[src13]
 	ADD	r6, r6, r7		@ r6 = dst8<<2
 	AND	r6, r8, r6, LSR #2	@ r6 = dst8 (split)
@@ -384,7 +385,7 @@
 	ADD	r6, r6, r6, LSL #1	@ r6 = 3*pal[src15]
 	AND	r9, r14,r11,LSR #8	@ r9 = src17
 	LDR	r9, [r13,r9, LSL #2]	@ r9 = pal[src17]
-	AND	r12,r14,r11,LSR #16	@ r11= src18
+ 	AND	r12,r14,r11,LSR #16	@ r11= src18
 	LDR	r12,[r13,r12,LSL #2]	@ r11= pal[src18]
 	ADD	r6, r6, r7		@ r6 = dst12<<2
 	AND	r6, r8, r6, LSR #2	@ r6 = dst12 (split)

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/cdaudio.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/cdaudio.cpp	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/cdaudio.cpp	2008-05-28 20:30:20 UTC (rev 32350)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  */
-
+ 
 #include "cdaudio.h"
 #include "ds-fs.h"
 #include "config-manager.h"
@@ -53,14 +53,14 @@
 	u16			fmtExtraData;	// Number of extra fmt bytes
 	u16			fmtExtra;		// Samples per block (only for IMA-ADPCM files)
 } __attribute__ ((packed));
-
+	
 struct chunkHeader {
-	char		name[4];
+	char 		name[4];	
 	u32			size;
 } __attribute__ ((packed));
 
 struct Header {
-	s16			firstSample;
+	s16 		firstSample;
 	char		stepTableIndex;
 	char		reserved;
 } __attribute__ ((packed));
@@ -112,7 +112,7 @@
 
 
 void allocBuffers() {
-
+	
 }
 
 void setActive(bool active) {
@@ -125,17 +125,17 @@
 
 void playTrack(int track, int numLoops, int startFrame, int duration) {
 	Common::String path = ConfMan.get("path");
-
+	
 	if (isPlayingFlag) {
 		stopTrack();
 	}
-
+	
 	if (trackStartsAt2) {
 		track++;
 	}
-
-
-
+	
+	
+	
 	char str[100];
 
 	if (path[strlen(path.c_str()) - 1] == '/') {
@@ -145,50 +145,50 @@
 		sprintf(str, "/track%d.wav", track);
 		path = path + str;
 	}
-
-
+	
+	
 	//1820160
-
+	
 	file = DS::std_fopen(path.c_str(), "rb");
-
+	
 	if (!file) {
 		consolePrintf("Failed to open %s!\n", path.c_str());
 		return;
 	}
-
-
+	
+	
 	DS::std_fread((const void *) &waveHeader, sizeof(waveHeader), 1, file);
-
+	
 	consolePrintf("Playing track %d\n", track);
 	consolePrintf("Format: %d\n", waveHeader.fmtFormatTag);
 	consolePrintf("Rate  : %d\n", waveHeader.fmtSamPerSec);
 	consolePrintf("Bits  : %d\n", waveHeader.fmtBitsPerSam);
 	consolePrintf("BlkSz : %d\n", waveHeader.fmtExtra);
-
+	
 	if ((waveHeader.fmtFormatTag != 17) && (waveHeader.fmtFormatTag != 20)) {
 		consolePrintf("Wave file is in the wrong format!  You must use IMA-ADPCM 4-bit mono.\n");
 		DS::std_fclose(file);
 		return;
 	}
-
+	
 	for (int r = 0; r < 8; r++) {
 		IPC->adpcm.buffer[r] = (u8 * volatile) (decoderFormat *) malloc(waveHeader.fmtBlockAlign);
 		IPC->adpcm.filled[r] = false;
 		IPC->adpcm.arm7Dirty[r] = false;
 	}
-
+	
 	// Skip chunks until we reach the data chunk
 	chunkHeader chunk;
 	DS::std_fread((const void *) &chunk, sizeof(chunkHeader), 1, file);
-
+	
 	while (!((chunk.name[0] == 'd') && (chunk.name[1] == 'a') && (chunk.name[2] == 't') && (chunk.name[3] == 'a'))) {
 		DS::std_fseek(file, chunk.size, SEEK_CUR);
 		DS::std_fread((const void *) &chunk, sizeof(chunkHeader), 1, file);
 	}
-
+	
 	dataChunkStart = DS::std_ftell(file);
-
-
+	
+	
 	static bool started = false;
 	sampleNum = 0;
 	blockCount = 0;
@@ -206,35 +206,35 @@
 		memset(audioBuffer, 0, BUFFER_SIZE * 2);
 		memset(decompressionBuffer, 0, waveHeader.fmtExtra * 2);
 		DS::playSound(audioBuffer, BUFFER_SIZE * 2, false, false, waveHeader.fmtSamPerSec);
-
-	}
+		
+	}	
 	fillPos = (IPC->streamPlayingSection + 1) & 3;
 	isPlayingFlag = true;
-
-
+	
+	
 	// Startframe is a 75Hz timer.  Dunno why, since nothing else
 	// seems to run at that rate.
 	int tenths = (startFrame * 10) / 75;
-
+	
 	// Seek to the nearest block start to the start time
 	int samples = (tenths * waveHeader.fmtSamPerSec) / 10;
 	int block = samples / waveHeader.fmtExtra;
-
-
+	
+	
 	if (duration == 0) {
 		blocksLeft = 0;
 	} else {
 		blocksLeft = ((((duration * 100) / 75) * (waveHeader.fmtSamPerSec)) / (waveHeader.fmtExtra) / 100) + 10;
 	}
 //	consolePrintf("Playing %d blocks (%d)\n\n", blocksLeft, duration);
-
+	
 	// No need to seek if we're starting from the beginning
 	if (block != 0) {
 		DS::std_fseek(file, dataChunkStart + block * waveHeader.fmtBlockAlign, SEEK_SET);
 //		consolePrintf("Startframe: %d  msec: %d (%d,%d)\n", startFrame, tenthssec, samples, block);
 	}
-
-
+	
+	
 	//decompressBlock();
 	playNextBlock();
 	DS::CD::numLoops = numLoops;
@@ -252,21 +252,21 @@
 void decompressBlock() {
 	int block[2048];
 	bool loop = false;
-
+	
 	blockCount++;
-
+	
 	if (blockCount < 10) return;
-
-
+	
+	
 	do {
 		DS::std_fread((const void *) &blockHeader, sizeof(blockHeader), 1, file);
-
+	
 		DS::std_fread(&block[0], waveHeader.fmtBlockAlign - sizeof(blockHeader), 1, file);
 
 		if (DS::std_feof(file) ) {
 			// Reached end of file, so loop
-
-
+			
+			
 			if ((numLoops == -1) || (numLoops > 1)) {
 				// Seek file to first packet
 				if (numLoops != -1) {
@@ -283,14 +283,14 @@
 				stopTrack();
 				return;
 			}
-
+			
 		} else {
 			loop = false;
 		}
-
+		
 	} while (loop);
-
-
+		
+		
 	if (blocksLeft > 0) {
 		blocksLeft--;
 	//	consolePrintf("%d ", blocksLeft);
@@ -305,37 +305,37 @@
 	          blockHeader.stepTableIndex,
 	          blockHeader.firstSample,
 	          decompressionBuffer);
-#else
+#else		
 	// First sample is in header
 	decompressionBuffer[0] = blockHeader.firstSample;
-
+	
 	// Set up initial table indeces
 	int stepTableIndex = blockHeader.stepTableIndex;
 	int prevSample = blockHeader.firstSample;
-
+	
 //	consolePrintf("Decompressing block step=%d fs=%d\n", stepTableIndex, prevSample);
 
 	for (int r = 0; r < waveHeader.fmtExtra - 1; r++) {
-
+		
 		int word = block[r >> 3];
 		int offset = 0;
-
+		
 		switch (7 - (r & 0x0007)) {
 			case 0: {
 				offset = (word & 0xF0000000) >> 28;
 				break;
 			}
-
+			
 			case 1: {
 				offset = (word & 0x0F000000) >> 24;
 				break;
 			}
-
+			
 			case 2: {
 				offset = (word & 0x00F00000) >> 20;
 				break;
 			}
-
+			
 			case 3: {
 				offset = (word & 0x000F0000) >> 16;
 				break;
@@ -361,42 +361,42 @@
 				break;
 			}
 		}
-
+		
 		int diff = 0;
-
+		
 		if (offset & 4) {
 			diff = diff + stepTab[stepTableIndex];
 		}
-
+		
 		if (offset & 2) {
 			diff = diff + (stepTab[stepTableIndex] >> 1);
 		}
-
+		
 		if (offset & 1) {
 			diff = diff + (stepTab[stepTableIndex] >> 2);
 		}
-
+		
 		diff = diff + (stepTab[stepTableIndex] >> 3);
-
+		
 		if (offset & 8) {
-			diff = -diff;
+			diff = -diff;		
 		}
-
+		
 		int newSample = prevSample + diff;
-
+		
 		if (newSample > 32767) newSample = 32767;
 		if (newSample < -32768) newSample = -32768;
-
+		
 		decompressionBuffer[r + 1] = newSample;
-
+		
 		prevSample = newSample;
-
+		
 		stepTableIndex += indexTab[offset];
-
+		
 		if (stepTableIndex > 88) stepTableIndex = 88;
 		if (stepTableIndex < 0) stepTableIndex = 0;
+		
 
-
 	}
 #endif
 }
@@ -404,21 +404,21 @@
 void playNextBlock() {
 	if (!isPlayingFlag) return;
 	int lastBlockId = -1;
-
+	
 	while (IPC->adpcm.semaphore);		// Wait for buffer to become free if needed
 	IPC->adpcm.semaphore = true;		// Lock the buffer structure to prevent clashing with the ARM7
 //	DC_FlushAll();
-
+	
 	//-8644, 25088
 	for (int block = fillPos + 1; block < fillPos + 4; block++) {
 
 		int blockId = block & 3;
-
+		
 		if (IPC->streamFillNeeded[blockId]) {
-
+			
 			IPC->streamFillNeeded[blockId] = false;
 //			DC_FlushAll();
-
+			
 /*			if (!(REG_KEYINPUT & KEY_R)) {
 				//consolePrintf("Align: %d First: %d  Step:%d  Res:%d\n", waveHeader.fmtBlockAlign, blockHeader.firstSample, blockHeader.stepTableIndex, blockHeader.reserved);
 				consolePrintf("Filling buffer %d\n", blockId);
@@ -432,19 +432,19 @@
 					}
 				}
 			}
-
+			
 			lastBlockId = blockId;
 			IPC->streamFillNeeded[blockId] = false;
 //			DC_FlushAll();
 
 		}
-
-
-
+	
+		
+		
 	}
-
-
-
+	
+	
+	
 	if (lastBlockId != -1) {
 		fillPos = lastBlockId;
 /*		if (!(REG_KEYINPUT & KEY_R)) {
@@ -459,18 +459,18 @@
 	if (!isPlayingFlag) return;
 
 	DS::std_fclose(file);
-
+	
 	isPlayingFlag = false;
-
+	
 	for (int r = 0; r < BUFFER_SIZE; r++) {
 		audioBuffer[r] = 0;
 	}
-
+	
 	for (int r= 0; r < waveHeader.fmtExtra; r++) {
 		decompressionBuffer[r] = 0;
 	}
 //	DS::stopSound(1);
-
+	
 //	free(audioBuffer);
 //	free(decompressionBuffer);
 
@@ -507,7 +507,7 @@
 bool checkCD() {
 	// Need to check whethe CD audio files are present - do this by trying to open Track1.wav.
 	consolePrintf("Attempted to open cd drive\n");
-
+	
 	if (trackExists(1)) {
 		trackStartsAt2 = false;
 		return true;

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/cdaudio.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/cdaudio.h	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/cdaudio.h	2008-05-28 20:30:20 UTC (rev 32350)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  */
-
+ 
  #ifndef _CDAUDIO_H_
 #define _CDAUDIO_H_
 

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/console2.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/console2.h	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/console2.h	2008-05-28 20:30:20 UTC (rev 32350)
@@ -25,7 +25,7 @@
 //
 // Changelog:
 //   0.1: First version
-//	 0.2: Fixed sprite mapping bug.  1D mapping should work now.
+//	 0.2: Fixed sprite mapping bug.  1D mapping should work now.  
 //			Changed some register defines for consistency.
 //
 //////////////////////////////////////////////////////////////////////
@@ -87,7 +87,7 @@
 //
 // Changelog:
 //   0.1: First version
-//	 0.2: Fixed sprite mapping bug.  1D mapping should work now.
+//	 0.2: Fixed sprite mapping bug.  1D mapping should work now.  
 //			Changed some register defines for consistency.
 //
 //////////////////////////////////////////////////////////////////////

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsmain.cpp	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsmain.cpp	2008-05-28 20:30:20 UTC (rev 32350)
@@ -19,8 +19,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  */
+ 
 
-
 // - Remove scummconsole.c
 // - Delete files
 // - Fatlib conversion?
@@ -55,8 +55,13 @@
 // - Alternative controls?
 
 
+// - Fix 512x256 backbuffer to 320x240 - Done
+// - Fix keyboard appearing on wrong screen - Done
+// - Volume amplify option
+// - Make save/restore game screen use scaler buffer
 
 
+
 //#define USE_LIBCARTRESET
 
 #include <nds.h>
@@ -158,7 +163,6 @@
 bool bufferSecondHalf;
 
 // Saved buffers
-u8* savedBuffer = NULL;
 bool highBuffer;
 bool displayModeIs8Bit = false;
 
@@ -211,36 +215,41 @@
 // Scale
 bool twoHundredPercentFixedScale = false;
 bool cpuScalerEnable = false;
-#define NUM_SUPPORTED_GAMES 17
+#define NUM_SUPPORTED_GAMES 20
 
 #ifdef USE_PROFILER
 int hBlankCount = 0;
 #endif
 
+u8* scalerBackBuffer = NULL;
 
+
 gameListType gameList[NUM_SUPPORTED_GAMES] = {
 	// Unknown game - use normal SCUMM controls
-	{"unknown",	CONT_SCUMM_ORIGINAL},
-
+	{"unknown", 	CONT_SCUMM_ORIGINAL},
+	
 	// SCUMM games
 	{"maniac",		CONT_SCUMM_ORIGINAL},
 	{"zak",			CONT_SCUMM_ORIGINAL},
 	{"loom",		CONT_SCUMM_ORIGINAL},
 	{"indy3",		CONT_SCUMM_ORIGINAL},
-	{"atlantis",	CONT_SCUMM_ORIGINAL},
+	{"atlantis",		CONT_SCUMM_ORIGINAL},
 	{"monkey",		CONT_SCUMM_ORIGINAL},
 	{"monkey2",		CONT_SCUMM_ORIGINAL},
-	{"tentacle",	CONT_SCUMM_ORIGINAL},
+	{"tentacle",		CONT_SCUMM_ORIGINAL},
 	{"samnmax",		CONT_SCUMM_SAMNMAX},
-
+	
 	// Non-SCUMM games
 	{"sky",			CONT_SKY},
 	{"simon1",		CONT_SIMON},
 	{"simon2",		CONT_SIMON},
-	{"gob",		CONT_GOBLINS},
+	{"gob",			CONT_GOBLINS},
 	{"queen",		CONT_SCUMM_ORIGINAL},
 	{"cine",		CONT_FUTURE_WARS},
-	{"agi",			CONT_AGI}
+	{"agi",			CONT_AGI},
+	{"elvira2",		CONT_SIMON},
+	{"elvira1",		CONT_SIMON},
+	{"waxworks",		CONT_SIMON},
 };
 
 gameListType* currentGame = NULL;
@@ -277,13 +286,14 @@
 void triggerIcon(int imageNum);
 void setIcon(int num, int x, int y, int imageNum, int flags, bool enable);
 void setIconMain(int num, int x, int y, int imageNum, int flags, bool enable);
+void uploadSpriteGfx();
 
 TransferSound soundControl;
 
 
 bool isCpuScalerEnabled()
 {
-	return cpuScalerEnable;
+	return cpuScalerEnable || !displayModeIs8Bit;
 }
 
 
@@ -298,11 +308,11 @@
 //plays an 8 bit mono sample at 11025Hz
 void playSound(const void* data, u32 length, bool loop, bool adpcm, int rate)
 {
-
+	
 	if (!IPC->soundData) {
 		soundControl.count = 0;
 	}
-
+	
 	soundControl.data[soundControl.count].data = data;
 	soundControl.data[soundControl.count].len = length | (loop? 0x80000000: 0x00000000);
 	soundControl.data[soundControl.count].rate = rate;		// 367 samples per frame
@@ -322,8 +332,14 @@
 
 void updateOAM() {
 	DC_FlushAll();
-    dmaCopy(sprites, OAM_SUB, 128 * sizeof(SpriteEntry));
-    dmaCopy(spritesMain, OAM, 128 * sizeof(SpriteEntry));
+
+	if (gameScreenSwap) {
+		dmaCopy(sprites, OAM, 128 * sizeof(SpriteEntry));
+		dmaCopy(spritesMain, OAM_SUB, 128 * sizeof(SpriteEntry));
+	} else {
+		dmaCopy(sprites, OAM_SUB, 128 * sizeof(SpriteEntry));
+		dmaCopy(spritesMain, OAM, 128 * sizeof(SpriteEntry));
+	}
 }
 
 void setGameSize(int width, int height) {
@@ -346,67 +362,31 @@
 	   sprites[i].attribute[2] = 0;
 	   sprites[i].attribute[3] = 0;
     }
-
+	
 	for (int i = 0; i < 128; i++) {
 	   spritesMain[i].attribute[0] = ATTR0_DISABLED;
 	   spritesMain[i].attribute[1] = 0;
 	   spritesMain[i].attribute[2] = 0;
 	   spritesMain[i].attribute[3] = 0;
     }
-
+	
 	updateOAM();
 }
 
 
 void saveGameBackBuffer() {
-#ifndef ENABLE_SCUMM
-    if (savedBuffer == NULL) savedBuffer = new u8[gameWidth * gameHeight];
-    for (int r = 0; r < gameHeight; r++) {
 
-		u16* dst = (u16 *) (savedBuffer + (r * gameWidth));
-		u16* src = BG_GFX_SUB + (r * 256);
-
-		for (int x = 0; x < gameWidth >> 1; x++)
-		{
-			*dst++ = *src++;
-		}
-	}
-#endif
+	// Sometimes the only copy of the game screen is in video memory.
+	// So, I lock the video memory here, as if I'm going to modify it.  This
+	// forces OSystem_DS to create a system memory copy if one doesn't exist.
+	// This will be automatially resotred by OSystem_DS::updateScreen().
+	
+	OSystem_DS::instance()->lockScreen();
+	OSystem_DS::instance()->unlockScreen();
 }
 
-void restoreGameBackBuffer() {
-#ifndef ENABLE_SCUMM
-	if (savedBuffer) {
-		for (int r = 0; r < gameHeight; r++) {
 
-			u16* dst = get8BitBackBuffer() + (r * 256);
-			u16* dst2 = BG_GFX_SUB + (r * 256);
-			u16* src = ((u16 *) (savedBuffer)) + (r * (gameWidth >> 1));
 
-			for (int x = 0; x < gameWidth >> 1; x++)
-			{
-				*dst++ = *src;
-				*dst2++ = *src++;
-			}
-
-		}
-
-		delete savedBuffer;
-		savedBuffer = NULL;
-	}
-#else
-    memset(get8BitBackBuffer(), 0, 512 * 256);
-    memset(BG_GFX_SUB, 0, 512 * 256);
-	if (Scumm::g_scumm) {
-		Scumm::g_scumm->markRectAsDirty(Scumm::kMainVirtScreen, 0, gameWidth - 1, 0, gameHeight - 1, 1);
-		Scumm::g_scumm->markRectAsDirty(Scumm::kTextVirtScreen, 0, gameWidth - 1, 0, gameHeight - 1, 1);
-		Scumm::g_scumm->markRectAsDirty(Scumm::kVerbVirtScreen, 0, gameWidth - 1, 0, gameHeight - 1, 1);
-	}
-#endif
-
-}
-
-
 void startSound(int freq, int buffer) {
 	bufferRate = freq * 2;
 	bufferFrame = 0;
@@ -414,23 +394,23 @@
 
 	bufferFirstHalf = false;
 	bufferSecondHalf = true;
-
+	
 	int bytes = (2 * (bufferSamples)) + 100;
-
+	
 	soundBuffer = (s16 *) malloc(bytes * 2);
 	if (!soundBuffer)
 		consolePrintf("Sound buffer alloc failed\n");
 
 
 	soundHiPart = true;
-
+	
 	for (int r = 0; r < bytes; r++) {
 		soundBuffer[r] = 0;
 	}
 
 	soundFrequency = freq;
+	
 
-
 	swiWaitForVBlank();
 	swiWaitForVBlank();
 	playSound(soundBuffer, (bufferSamples * 2), true, false, freq * 2);
@@ -461,14 +441,14 @@
 	consolePrintf("\n\n\n\nCurrent game: '%s' %d\n", gameName, gameName[0]);
 
 	currentGame = &gameList[0];		// Default game
-
+	
 	for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) {
 		if (!stricmp(gameName, gameList[r].gameId)) {
 			currentGame = &gameList[r];
 //			consolePrintf("Game list num: %d\n", currentGame);
 		}
 	}
-
+		
 	if (firstTime) {
 		firstTime = false;
 
@@ -515,7 +495,7 @@
 	consolePrintf("displayMode8Bit...");
 #endif
 	u16 buffer[32 * 32];
-
+	
 	setKeyboardEnable(false);
 
 	if (!displayModeIs8Bit) {
@@ -524,49 +504,62 @@
 		}
 	}
 
+	consoleInitDefault((u16*)SCREEN_BASE_BLOCK(2), (u16*)CHAR_BASE_BLOCK(0), 16);
+	consolePrintSet(0, 23);
+	
+	if (!displayModeIs8Bit) {
+		for (int r = 0; r < 32 * 32; r++) {
+			((u16 *) SCREEN_BASE_BLOCK(2))[r] = buffer[r];
+		}
+//		dmaCopyHalfWords(3, (u16 *) SCREEN_BASE_BLOCK(0), buffer, 32 * 32 * 2);
+	}
+
+	displayModeIs8Bit = true;
+	
 	if (isCpuScalerEnabled())
 	{
-		videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+		videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); 
 		videoSetModeSub(MODE_3_2D /*| DISPLAY_BG0_ACTIVE*/ | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
-
+	
 		vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
 		vramSetBankB(VRAM_B_MAIN_BG_0x06020000);
-
+	
 		vramSetBankC(VRAM_C_SUB_BG_0x06200000);
-		vramSetBankD(VRAM_D_MAIN_BG_0x06040000);
-
+		vramSetBankD(VRAM_D_SUB_SPRITE);
+		
 		vramSetBankH(VRAM_H_LCD);
-
+	
 		BG3_CR = BG_BMP16_256x256 | BG_BMP_BASE(8);
 
 		BG3_XDX = 256;
 	    BG3_XDY = 0;
 	    BG3_YDX = 0;
 	    BG3_YDY = (int) ((200.0f / 192.0f) * 256);
+
 	}
 	else
 	{
-		videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+		videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); 
 		videoSetModeSub(MODE_3_2D /*| DISPLAY_BG0_ACTIVE*/ | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
-
+	
 		vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
 		vramSetBankB(VRAM_B_MAIN_BG_0x06020000);
-
+	
 		vramSetBankC(VRAM_C_SUB_BG_0x06200000);
-		vramSetBankD(VRAM_D_MAIN_BG_0x06040000);
-
+		vramSetBankD(VRAM_D_SUB_SPRITE);
+		
 		vramSetBankH(VRAM_H_LCD);
-
+	
 		BG3_CR = BG_BMP8_512x256 | BG_BMP_BASE(8);
-
+		
 		BG3_XDX = (int) (((float) (gameWidth) / 256.0f) * 256);
 	    BG3_XDY = 0;
 	    BG3_YDX = 0;
 	    BG3_YDY = (int) ((200.0f / 192.0f) * 256);
-	}
-
+	}	
+	
 	SUB_BG3_CR = BG_BMP8_512x256;
-
+	
 	SUB_BG3_XDX = (int) (subScreenWidth / 256.0f * 256);
     SUB_BG3_XDY = 0;
     SUB_BG3_YDX = 0;
@@ -578,35 +571,29 @@
 
 	BG0_CR = BG_MAP_BASE(2) | BG_TILE_BASE(0);
 	BG0_Y0 = 0;
-
-	// Restore palette entry used by text in the front-end
+	
+	// Restore palette entry used by text in the front-end	
 //	PALETTE_SUB[255] = savedPalEntry255;
 
 
-
-	consoleInitDefault((u16*)SCREEN_BASE_BLOCK(2), (u16*)CHAR_BASE_BLOCK(0), 16);
-	consolePrintSet(0, 23);
-
-	if (!displayModeIs8Bit) {
-		for (int r = 0; r < 32 * 32; r++) {
-			((u16 *) SCREEN_BASE_BLOCK(2))[r] = buffer[r];
-		}
-//		dmaCopyHalfWords(3, (u16 *) SCREEN_BASE_BLOCK(0), buffer, 32 * 32 * 2);
-	}
-
+	
+	
 	initGame();
-
-	if (!displayModeIs8Bit) restoreGameBackBuffer();
-	displayModeIs8Bit = true;
+	
 	#ifdef HEAVY_LOGGING
 	consolePrintf("done\n");
 	#endif
 
+	if (gameScreenSwap) {
+		POWER_CR |= POWER_SWAP_LCDS;
+	} else {
+		POWER_CR &= ~POWER_SWAP_LCDS;
+	}
 
-	POWER_CR &= ~POWER_SWAP_LCDS;
-
+	uploadSpriteGfx();
+	
 	keyboardEnable = false;
-
+	
 }
 
 void setGameID(int id) {
@@ -619,22 +606,22 @@
 
 void checkSleepMode() {
 	if (IPC->performArm9SleepMode) {
-
+	
 		consolePrintf("ARM9 Entering sleep mode\n");
-
+		
 		int intSave = REG_IE;
 		irqSet(IRQ_VBLANK, dummyHandler);
 //		int irqHandlerSave = (int) IRQ_HANDLER;
 		REG_IE = IRQ_VBLANK;
 		//IRQ_HANDLER = dummyHandler;
-
+		
 		int powerSave = POWER_CR;
 		POWER_CR &= ~POWER_ALL;
-
+		
 		while (IPC->performArm9SleepMode) {
 			swiWaitForVBlank();
 		}
-
+		
 		POWER_CR = powerSave;
 //		IRQ_HANDLER = (void (*)()) irqHandlerSave;
 		irqSet(IRQ_VBLANK, VBlankHandler);
@@ -671,47 +658,57 @@
 
 	{
 		int off = 128*64;
-
-
+	
+	
 		memset(SPRITE_GFX + off, 0, 32 * 32 * 2);
-
+		memset(SPRITE_GFX_SUB + off, 0, 32 * 32 * 2);
+	
 		for (uint y=0; y<h; y++) {
 			for (uint x=0; x<w; x++) {
 				int color = icon[y*w+x];
-
+	
 				if (color == keycolor) {
 					SPRITE_GFX[off+(y)*32+x] = 0x0000; // black background
+					SPRITE_GFX_SUB[off+(y)*32+x] = 0x0000; // black background
 				} else {
 					SPRITE_GFX[off+(y)*32+x] = BG_PALETTE[color] | 0x8000;
+					SPRITE_GFX_SUB[off+(y)*32+x] = BG_PALETTE[color] | 0x8000;
 				}
 			}
 		}
-
+	
 	}
 
 	if (currentGame->control != CONT_SCUMM_SAMNMAX)
 		return;
 
 	uint16 border = RGB15(24,24,24) | 0x8000;
-
-
-	int off = 48*64;
+	
+	
+	int off = 176*64;
 	memset(SPRITE_GFX_SUB+off, 0, 64*64*2);
-
+	memset(SPRITE_GFX+off, 0, 64*64*2);
+	
 	int pos = 190 - (w+2);
+	
 
-
-
+	
 	// make border
 	for (uint i=0; i<w+2; i++) {
+		SPRITE_GFX[off+i] = border;
+		SPRITE_GFX[off+(31)*64+i] = border;
+
 		SPRITE_GFX_SUB[off+i] = border;
 		SPRITE_GFX_SUB[off+(31)*64+i] = border;
 	}
 	for (uint i=1; i<31; i++) {
+		SPRITE_GFX[off+(i*64)] = border;
+		SPRITE_GFX[off+(i*64)+(w+1)] = border;
+
 		SPRITE_GFX_SUB[off+(i*64)] = border;
 		SPRITE_GFX_SUB[off+(i*64)+(w+1)] = border;
 	}
-
+	
 	int offset = (32 - h) >> 1;
 
 	for (uint y=0; y<h; y++) {
@@ -719,23 +716,24 @@
 			int color = icon[y*w+x];
 
 			if (color == keycolor) {
+				SPRITE_GFX[off+(y+1+offset)*64+(x+1)] = 0x8000; // black background
 				SPRITE_GFX_SUB[off+(y+1+offset)*64+(x+1)] = 0x8000; // black background
 			} else {
+				SPRITE_GFX[off+(y+1+offset)*64+(x+1)] = BG_PALETTE[color] | 0x8000;
 				SPRITE_GFX_SUB[off+(y+1+offset)*64+(x+1)] = BG_PALETTE[color] | 0x8000;
 			}
 		}
 	}
-
-
-	if ((cursorEnable))
-	{
+	
+	
+	if ((cursorEnable)) {
 		sprites[1].attribute[0] = ATTR0_BMP | 150;
 		sprites[1].attribute[1] = ATTR1_SIZE_64 | pos;
-		sprites[1].attribute[2] = ATTR2_ALPHA(1) | 48;
+		sprites[1].attribute[2] = ATTR2_ALPHA(1) | 176;
 	} else {
 		sprites[1].attribute[0] = ATTR0_DISABLED | 150;
 		sprites[1].attribute[1] = ATTR1_SIZE_64 | pos;
-		sprites[1].attribute[2] = ATTR2_ALPHA(1) | 48;
+		sprites[1].attribute[2] = ATTR2_ALPHA(1) | 176;
 	}
 }
 
@@ -751,6 +749,8 @@
 
 
 	if (displayModeIs8Bit) {
+		static int test = 0;
+//		consolePrintf("saving buffer... %d\n", test++);
 		saveGameBackBuffer();
 		for (int r = 0; r < 32 * 32; r++) {
 			buffer[r] = ((u16 *) SCREEN_BASE_BLOCK(2))[r];
@@ -758,7 +758,7 @@
 	}
 
 
-	videoSetMode(MODE_5_2D | /*DISPLAY_BG0_ACTIVE |*/ DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+	videoSetMode(MODE_5_2D | /*DISPLAY_BG0_ACTIVE |*/ DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); 
 	videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE |/* DISPLAY_BG1_ACTIVE |*/ DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
 
 	vramSetBankA(VRAM_A_MAIN_BG);
@@ -769,14 +769,10 @@
 
 	BG3_CR = BG_BMP16_512x256;
 	highBuffer = false;
+	
 
-	BG3_XDX = isCpuScalerEnabled() ? 256 : (int) (1.25f * 256);
-    BG3_XDY = 0;
-    BG3_YDX = 0;
-    BG3_YDY = (int) ((200.0f / 192.0f) * 256);
-
 	memset(BG_GFX, 0, 512 * 256 * 2);
-
+	
 	savedPalEntry255 = PALETTE_SUB[255];
 	PALETTE_SUB[255] = RGB15(31,31,31);//by default font will be rendered with color 255
 
@@ -795,14 +791,20 @@
 
 	consolePrintSet(0, 23);
 	consolePrintf("\n");
-
+	
 	// Show keyboard
 	SUB_BG1_CR = BG_TILE_BASE(1) | BG_MAP_BASE(12);
 	//drawKeyboard(1, 12);
-
+	
 	POWER_CR &= ~POWER_SWAP_LCDS;
 
 	displayModeIs8Bit = false;
+
+	BG3_XDX = isCpuScalerEnabled() ? 256 : (int) (1.25f * 256);
+    BG3_XDY = 0;
+    BG3_YDX = 0;
+    BG3_YDY = (int) ((200.0f / 192.0f) * 256);
+
 	#ifdef HEAVY_LOGGING
 	consolePrintf("done\n");
 	#endif
@@ -816,13 +818,13 @@
 	#endif
 	if (!displayModeIs8Bit) {
 		u16* back = get16BitBackBuffer();
-
+	
 //		highBuffer = !highBuffer;
 //		BG3_CR = BG_BMP16_512x256 |	BG_BMP_RAM(highBuffer? 1: 0);
-
+		
 		if (isCpuScalerEnabled())
 		{
-            Rescale_320x256x1555_To_256x256x1555(BG_GFX, back, 512, 512);
+			Rescale_320x256x1555_To_256x256x1555(BG_GFX, back, 512, 512);
 		}
 		else
 		{
@@ -841,12 +843,14 @@
         #endif
 		const u8* back = (const u8*)get8BitBackBuffer();
 		u16* base = BG_GFX + 0x10000;
-		Rescale_320x256xPAL8_To_256x256x1555( base,
-											  back,
-                                              256,
-											  512,
-                                              BG_PALETTE );
-
+		Rescale_320x256xPAL8_To_256x256x1555( 
+			base,
+			back,
+			256,
+			get8BitBackBufferStride(),
+			BG_PALETTE, 
+			getGameHeight() );
+        
         #ifdef SCALER_PROFILE
         // 10 pixels : 1ms
         u16 t1 = TIMER1_DATA;
@@ -875,9 +879,24 @@
 	return BG_GFX + 0x20000;
 }
 
+s32 get8BitBackBufferStride() {
+	// When the CPU scaler is enabled, the back buffer is in system RAM and is 320 pixels wide
+	// When the CPU scaler is disabled, the back buffer is in video memory and therefore must have a 512 pixel stride
+
+	if (isCpuScalerEnabled()){
+		return 320;
+	} else {
+		return 512;
+	}
+}
+
+u16* getScalerBuffer() {
+	return (u16 *) scalerBackBuffer;
+}
+
 u16* get8BitBackBuffer() {
 	if (isCpuScalerEnabled())
-		return BG_GFX + 0x60000;
+		return (u16 *) scalerBackBuffer;
 	else
 		return BG_GFX + 0x10000;		// 16bit qty!
 }
@@ -899,10 +918,10 @@
 
 	if (soundCallback) {
 		lastCallbackFrame = frameCount;
-
+		
 		for (int r = IPC->playingSection; r < IPC->playingSection + 4; r++) {
 			int chunk = r & 3;
-
+			
 			if (IPC->fillNeeded[chunk]) {
 				IPC->fillNeeded[chunk] = false;
 				DC_FlushAll();
@@ -910,9 +929,9 @@
 				IPC->fillNeeded[chunk] = false;
 				DC_FlushAll();
 			}
-
+		
 		}
-
+		
 	}
 	#ifdef HEAVY_LOGGING
 	consolePrintf("done\n");
@@ -924,7 +943,7 @@
 		if (callbackTimer <= 0) {
 			callbackTimer += callbackInterval;
 			callback(callbackInterval);
-		}
+		}	
 	}
 }
 
@@ -933,15 +952,15 @@
 //		playSound(soundBuffer, (bufferSamples * 2), true);
 	}
 //	consolePrintf("%x\n", IPC->test);
-
-
+	
+	
 	if (bufferFrame == 0) {
 //		bufferFirstHalf = true;
-	}
+	}	
 	if (bufferFrame == bufferSize >> 1) {
 	//bufferSecondHalf = true;
-	}
-
+	}	
+	
 	bufferFrame++;
 	if (bufferFrame == bufferSize) {
 		bufferFrame = 0;
@@ -954,20 +973,20 @@
 	do {
 		p = (int *) malloc(r * 8192);
 		free(p);
-		r++;
+		r++;		
 	} while ((p) && (r < 512));
-
+	
 	int t = -1;
 	void* block[1024];
 	do {
 		t++;
 		block[t] = (int *) malloc(4096);
-	} while ((t < 1024) && (block[t]));
-
+	} while ((t < 1024) && (block[t]));		
+	
 	for (int q = 0; q < t; q++) {
 		free(block[q]);
 	}
-
+	
 	consolePrintf("Free: %dK, Largest: %dK\n", t * 4, r * 8);
 }
 
@@ -978,7 +997,7 @@
 
 	event.type = Common::EVENT_KEYDOWN;
 	event.kbd.flags = 0;
-
+	
 //	consolePrintf("Fight keys\n");
 
 	if ((getKeysDown() & KEY_L)) {
@@ -1008,16 +1027,16 @@
 		event.kbd.keycode = Common::KEYCODE_6;
 		event.kbd.ascii = '6';
 		system->addEvent(event);
-	}
+	}	
 	if ((getKeysChanged() & KEY_DOWN)) {
 		event.type = getKeyEvent(KEY_DOWN);
 		event.kbd.keycode = Common::KEYCODE_2;
 		event.kbd.ascii = '2';
 		system->addEvent(event);
 	}
-
+	
 	if (indyFightRight) {
-
+	
 		if ((getKeysChanged() & KEY_X)) {
 			event.type = getKeyEvent(KEY_X);
 			event.kbd.keycode = Common::KEYCODE_9;
@@ -1035,7 +1054,7 @@
 			event.kbd.keycode = Common::KEYCODE_3;
 			event.kbd.ascii = '3';
 			system->addEvent(event);
-		}
+		}	
 
 	} else {
 
@@ -1056,18 +1075,18 @@
 			event.kbd.keycode = Common::KEYCODE_1;
 			event.kbd.ascii = '1';
 			system->addEvent(event);
-		}
-
+		}	
+	
 	}
-
-
+	
+	
 	if ((getKeysChanged() & KEY_Y)) {
 		event.type = getKeyEvent(KEY_Y);
 		event.kbd.keycode = Common::KEYCODE_5;
 		event.kbd.ascii = '5';
 		system->addEvent(event);
 	}
-}
+} 			
 
 
 void setKeyboardEnable(bool en) {
@@ -1079,8 +1098,8 @@
 
 
 		DS::drawKeyboard(1, 15, backupBank);
-
-
+		
+		
 		SUB_BG1_CR = BG_TILE_BASE(1) | BG_MAP_BASE(15);
 
 		if (displayModeIs8Bit) {
@@ -1090,7 +1109,11 @@
 			SUB_DISPLAY_CR |= DISPLAY_BG1_ACTIVE;	// Turn on keyboard layer
 			SUB_DISPLAY_CR &= ~DISPLAY_BG0_ACTIVE;	// Turn off console layer
 		}
-		lcdSwap();
+
+		// Ensure the keyboard is on the lower screen
+		POWER_CR |= POWER_SWAP_LCDS;
+
+
 	} else {
 
 
@@ -1098,26 +1121,38 @@
 		for (int r = 0; r < 256; r++) {
 			BG_PALETTE_SUB[r] = BG_PALETTE[r];
 		}
-
-
+		
+		
 		//restoreVRAM(1, 12, backupBank);
-
+		
 		if (displayModeIs8Bit) {
 			// Copy the sub screen VRAM from the top screen - they should always be
 			// the same.
 			u16* buffer = get8BitBackBuffer();
+			s32 stride = get8BitBackBufferStride();
 
+			for (int y = 0; y < gameHeight; y++) {
+				for (int x = 0; x < gameWidth; x++) {
+					BG_GFX_SUB[y * 256 + x] = buffer[(y * (stride / 2)) + x];
+				}
+			}
+/*            
             for (int r = 0; r < (512 * 256) >> 1; r++)
                 BG_GFX_SUB[r] = buffer[r];
-
+  */              
 			SUB_DISPLAY_CR &= ~DISPLAY_BG1_ACTIVE;	// Turn off keyboard layer
 			SUB_DISPLAY_CR |= DISPLAY_BG3_ACTIVE;	// Turn on game layer
 		} else {
 			SUB_DISPLAY_CR &= ~DISPLAY_BG1_ACTIVE;	// Turn off keyboard layer
 			SUB_DISPLAY_CR |= DISPLAY_BG0_ACTIVE;	// Turn on console layer
 		}
-
-		lcdSwap();
+		
+		// Restore the screens so they're the right way round
+		if (gameScreenSwap) {
+			POWER_CR |= POWER_SWAP_LCDS;
+		} else {
+			POWER_CR &= ~POWER_SWAP_LCDS;
+		}
 	}
 }
 
@@ -1136,7 +1171,7 @@
 	OSystem_DS* system = OSystem_DS::instance();
 	Common::Event event;
 
-
+	
 #ifdef USE_PROFILER
 	if (keysDown() & KEY_R) {
 		cygprofile_begin();
@@ -1148,7 +1183,7 @@
 	}
 #endif
 
-
+	
 	if (system->isEventQueueEmpty()) {
 
 /*
@@ -1157,8 +1192,8 @@
 			consolePrintf("Tweak: %d\n", tweak);
 			IPC->tweakChanged = true;
 		}
+		
 
-
 		if (getKeysDown() & KEY_R) {
 			tweak++;
 			consolePrintf("Tweak: %d\n", tweak);
@@ -1173,14 +1208,14 @@
 
 			if (!indyFightState) {
 
-				if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_B)) {
+				if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_B)) {	
 					if (currentGame->control == CONT_AGI) {
 						event.kbd.keycode = Common::KEYCODE_RETURN;
 						event.kbd.ascii = 13;
 						event.kbd.flags = 0;
 					} else {
-						event.kbd.keycode = Common::KEYCODE_ESCAPE;
-						event.kbd.ascii = 27;
+						event.kbd.keycode = Common::KEYCODE_ESCAPE;		
+						event.kbd.ascii = 27;		
 						event.kbd.flags = 0;
 					}
 
@@ -1190,11 +1225,11 @@
 					event.type = Common::EVENT_KEYUP;
 					system->addEvent(event);
 				}
-
+		
 			}
-
-
-
+			
+		
+			
 			if ((!getIndyFightState()) && (getKeysDown() & KEY_Y)) {
 				consoleEnable = !consoleEnable;
 				if (displayModeIs8Bit) {
@@ -1203,7 +1238,7 @@
 					displayMode16Bit();
 				}
 			}
-
+	
 			if ((getKeyboardEnable())) {
 				event.kbd.flags = 0;
 
@@ -1211,30 +1246,30 @@
 				bool release = getKeysReleased() & (KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN);
 				bool shoulders = getKeysHeld() & (KEY_L | KEY_R);
 
-				if ( (down && (!shoulders)) || release)
+				if ( (down && (!shoulders)) || release) 
 				{
-
+	
 					if (getKeysChanged() & KEY_LEFT) {
 						event.kbd.keycode = Common::KEYCODE_LEFT;
 						event.kbd.ascii = 0;
 						event.type = getKeyEvent(KEY_LEFT);
 						system->addEvent(event);
 					}
-
+	
 					if (getKeysChanged() & KEY_RIGHT) {
 						event.kbd.keycode = Common::KEYCODE_RIGHT;
 						event.kbd.ascii = 0;
 						event.type = getKeyEvent(KEY_RIGHT);
 						system->addEvent(event);
 					}
-
+	
 					if (getKeysChanged() & KEY_UP) {
 						event.kbd.keycode = Common::KEYCODE_UP;
 						event.kbd.ascii = 0;
 						event.type = getKeyEvent(KEY_UP);
 						system->addEvent(event);
 					}
-
+	
 					if (getKeysChanged() & KEY_DOWN) {
 						event.kbd.keycode = Common::KEYCODE_DOWN;
 						event.kbd.ascii = 0;
@@ -1242,15 +1277,22 @@
 						system->addEvent(event);
 					}
 				}
-
+					
 			}
-
+	
 			if (!((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (!getIndyFightState()) && (!getKeyboardEnable())) {
 
 				if ((getKeysDown() & KEY_A) && (!indyFightState)) {
 					gameScreenSwap = !gameScreenSwap;
+
+					if (gameScreenSwap) {
+						POWER_CR |= POWER_SWAP_LCDS;
+					} else {
+						POWER_CR &= ~POWER_SWAP_LCDS;
+					}
+
 				}
-
+	
 				if (!getPenHeld() || (mouseMode != MOUSE_HOVER)) {
 					if (getKeysDown() & KEY_LEFT) {
 						mouseMode = MOUSE_LEFT;
@@ -1264,8 +1306,8 @@
 						system->addEvent(event);
 						rightButtonDown = false;
 					}
+						
 
-
 					if (getKeysDown() & KEY_RIGHT) {
 						if ((currentGame->control != CONT_SCUMM_SAMNMAX) && (currentGame->control != CONT_FUTURE_WARS) && (currentGame->control != CONT_GOBLINS)) {
 							mouseMode = MOUSE_RIGHT;
@@ -1281,13 +1323,13 @@
 							} else {
 								event.mouse = Common::Point(getPenX(), getPenY());
 							}
-
+							
 							rightButtonDown = true;
 
-
+		
 							event.type = Common::EVENT_RBUTTONDOWN;
 							system->addEvent(event);
-
+		
 							//event.type = Common::EVENT_RBUTTONUP;
 							//system->addEvent(event);
 						}
@@ -1299,9 +1341,9 @@
 						mouseMode = MOUSE_HOVER;
 					}
 				}
-
-
-
+	
+					
+				
 			}
 
 			if ((getKeysDown() & KEY_SELECT)) {
@@ -1310,18 +1352,18 @@
 				showOptionsDialog();
 			}
 
-
+			
 		}
-
+	
 		if (!getIndyFightState() && !((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_X)) {
 			setKeyboardEnable(!keyboardEnable);
 		}
-
-		updateStatus();
-
+		
+		updateStatus();			
+		
 		Common::Event event;
 
-
+	
 		if (!keyboardEnable) {
 
 			if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) {
@@ -1332,12 +1374,12 @@
 			}
 
 			if ((mouseMode != MOUSE_HOVER) || (!displayModeIs8Bit)) {
-					if (getPenDown() && (!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) {
+					if (getPenDown() && (!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) {	
 						event.type = ((mouseMode == MOUSE_LEFT) || (!displayModeIs8Bit))? Common::EVENT_LBUTTONDOWN: Common::EVENT_RBUTTONDOWN;
 						event.mouse = Common::Point(getPenX(), getPenY());
 						system->addEvent(event);
 					}
-
+					
 					if (getPenReleased()) {
 						event.type = mouseMode == MOUSE_LEFT? Common::EVENT_LBUTTONUP: Common::EVENT_RBUTTONUP;
 						event.mouse = Common::Point(getPenX(), getPenY());
@@ -1345,36 +1387,37 @@
 					}
 			} else {
 				// In hover mode, D-pad left and right click the mouse when the pen is on the screen
-
+	
 				if (getPenHeld()) {
 					if (getKeysDown() & KEY_LEFT) {
 						event.type = Common::EVENT_LBUTTONDOWN;
 						event.mouse = Common::Point(getPenX(), getPenY());
 						system->addEvent(event);
 					}
-				/*	if (getKeysReleased() & KEY_LEFT) {
+					if (getKeysReleased() & KEY_LEFT) {
 						event.type = Common::EVENT_LBUTTONUP;
 						event.mouse = Common::Point(getPenX(), getPenY());
 						system->addEvent(event);
-					}*/
+					}
 
+
 					if (getKeysDown() & KEY_RIGHT) {
 						event.type = Common::EVENT_RBUTTONDOWN;
 						event.mouse = Common::Point(getPenX(), getPenY());
 						system->addEvent(event);
 					}
-					/*if (getKeysReleased() & KEY_RIGHT) {
+					if (getKeysReleased() & KEY_RIGHT) {
 						event.type = Common::EVENT_RBUTTONUP;
 						event.mouse = Common::Point(getPenX(), getPenY());
 						system->addEvent(event);
-					}*/
+					}
 				}
 			}
-
+			
 			if (((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) || (indyFightState))  && (displayModeIs8Bit)) {
 				// Controls specific to the control method
-
-
+			
+			
 				if (currentGame->control == CONT_SKY) {
 					// Extra controls for Beneath a Steel Sky
 					if ((getKeysDown() & KEY_DOWN)) {
@@ -1387,7 +1430,7 @@
 					// Extra controls for Simon the Sorcerer
 					if ((getKeysDown() & KEY_DOWN)) {
 						Common::Event event;
-
+					
 						event.type = Common::EVENT_KEYDOWN;
 						event.kbd.keycode = Common::KEYCODE_F10;		// F10 or # - show hotspots
 						event.kbd.ascii = Common::ASCII_F10;
@@ -1400,13 +1443,13 @@
 					}
 				}
 
-
-
+	
+	
 				if (currentGame->control == CONT_SCUMM_ORIGINAL) {
 					// Extra controls for Scumm v1-5 games
 					if ((getKeysDown() & KEY_DOWN)) {
 						Common::Event event;
-
+					
 						event.type = Common::EVENT_KEYDOWN;
 						event.kbd.keycode = Common::KEYCODE_PERIOD;		// Full stop - skips current dialogue line
 						event.kbd.ascii = '.';
@@ -1416,19 +1459,19 @@
 						event.type = Common::EVENT_KEYUP;
 						system->addEvent(event);
 					}
-
+					
 					if (indyFightState) {
 						addIndyFightingKeys();
 					}
-
+					
 				}
-
+				
 			}
 		}
-
+		
 		if (!displayModeIs8Bit) {
 			// Front end controls
-
+			
 			if (leftHandedSwap(getKeysChanged()) & KEY_UP) {
 				event.type = getKeyEvent(leftHandedSwap(KEY_UP));
 				event.kbd.keycode = Common::KEYCODE_UP;
@@ -1455,10 +1498,10 @@
 				event.type = Common::EVENT_KEYUP;
 				system->addEvent(event);
 			}
-
+		
 		}
 
-
+		
 		if ((getKeysChanged() & KEY_START)) {
 			event.type = getKeyEvent(KEY_START);
 			if (currentGame->control == CONT_FUTURE_WARS) {
@@ -1477,38 +1520,37 @@
 //				consolePrintf("!!!!!F5!!!!!");
 			}
 			event.kbd.flags = 0;
-			consolePrintf("!!!!!F5!!!!!");
 			system->addEvent(event);
 		}
 
-
+		
 		if (keyboardEnable) {
 			DS::addKeyboardEvents();
 		}
-
+		
 		consumeKeys();
-
+		
 		consumePenEvents();
 
 	}
 }
 
 
-
+		
 void triggerIcon(int imageNum) {
 	triggeredIcon = imageNum;
-	triggeredIconTimeout = 120;
+	triggeredIconTimeout = 120;	
 }
+	
 
-
 void setIcon(int num, int x, int y, int imageNum, int flags, bool enable) {
-	sprites[num].attribute[0] = ATTR0_BMP | (enable? y: 192) | (!enable? ATTR0_DISABLED: 0);
+	sprites[num].attribute[0] = ATTR0_BMP | (enable? y: 192) | (!enable? ATTR0_DISABLED: 0); 
 	sprites[num].attribute[1] = ATTR1_SIZE_32 | x | flags;
 	sprites[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16);
 }
 
 void setIconMain(int num, int x, int y, int imageNum, int flags, bool enable) {
-	spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0xFF) | (!enable? ATTR0_DISABLED: 0);
+	spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0xFF) | (!enable? ATTR0_DISABLED: 0); 
 	spritesMain[num].attribute[1] = ATTR1_SIZE_32 | (x & 0x1FF) | flags;
 	spritesMain[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16);
 }
@@ -1536,16 +1578,16 @@
 				break;
 			}
 		}
-
+	
 		setIcon(0, 208, 150, offs, 0, true);
-
+	
 		if (indyFightState) {
 			setIcon(1, (190 - 32), 150, 3, (indyFightRight? 0: ATTR1_FLIP_X), true);
 //			consolePrintf("%d\n", indyFightRight);
 		} else {
 //			setIcon(1, 0, 0, 0, 0, false);
 		}
-
+		
 		if (triggeredIconTimeout > 0) {
 			triggeredIconTimeout--;
 			setIcon(4, 16, 150, triggeredIcon, 0, true);
@@ -1584,30 +1626,32 @@
 	} else {
 //		bufferFirstHalf = true;
 	}
-
+	
 	soundHiPart = !soundHiPart;
 }
 
 void setMainScreenScroll(int x, int y) {
-	if (gameScreenSwap) {
+/*	if (gameScreenSwap) {
 		SUB_BG3_CX = x + (((frameCount & 1) == 0)? 64: 0);
 		SUB_BG3_CY = y;
-	} else {
+	} else */{
 		BG3_CX = x + (((frameCount & 1) == 0)? 64: 0);
 		BG3_CY = y;
-
-		touchX = x >> 8;
-		touchY = y >> 8;
+		
+		if (!gameScreenSwap) {
+			touchX = x >> 8;
+			touchY = y >> 8;
+		}
 	}
 }
 
 void setMainScreenScale(int x, int y) {
-	if (gameScreenSwap) {
+/*	if (gameScreenSwap) {
 		SUB_BG3_XDX = x;
 		SUB_BG3_XDY = 0;
 		SUB_BG3_YDX = 0;
 		SUB_BG3_YDY = y;
-	} else {
+	} else*/ {
 		if (isCpuScalerEnabled() && (x==320))
 		{
 			BG3_XDX = 256;
@@ -1616,41 +1660,54 @@
 			BG3_YDY = y;
 		}
 		else
-		{
+		{	
 			BG3_XDX = x;
 			BG3_XDY = 0;
 			BG3_YDX = 0;
 			BG3_YDY = y;
 		}
-
-		touchScX = x;
-		touchScY = y;
+		
+		if (!gameScreenSwap) {		
+			touchScX = x;
+			touchScY = y;
+		}
 	}
 }
 
 void setZoomedScreenScroll(int x, int y, bool shake) {
-	if (gameScreenSwap) {
+/*	if (gameScreenSwap) {
 		BG3_CX = x + ((shake && ((frameCount & 1) == 0))? 64: 0);
 		BG3_CY = y;
-
+		
 		touchX = x >> 8;
 		touchY = y >> 8;
-	} else {
+	} else */{
+
+		if (gameScreenSwap) {
+			touchX = x >> 8;
+			touchY = y >> 8;
+		}
+
+
 		SUB_BG3_CX = x + ((shake && (frameCount & 1) == 0)? 64: 0);
 		SUB_BG3_CY = y;
 	}
 }
 
 void setZoomedScreenScale(int x, int y) {
-	if (gameScreenSwap) {
+/*	if (gameScreenSwap) {
 		BG3_XDX = x;
 		BG3_XDY = 0;
 		BG3_YDX = 0;
 		BG3_YDY = y;
 
-		touchScX = x;
-		touchScY = y;
-	} else {
+	} else */{
+
+		if (gameScreenSwap) {
+			touchScX = x;
+			touchScY = y;
+		}
+
 		SUB_BG3_XDX = x;
 		SUB_BG3_XDY = 0;
 		SUB_BG3_YDX = 0;
@@ -1684,8 +1741,8 @@
 	soundUpdate();
 
 
+	
 
-
 	if ((!gameScreenSwap) && (!(getKeysHeld() & KEY_L) && !(getKeysHeld() & KEY_R))) {
 		if (currentGame) {
 			if (currentGame->control != CONT_SCUMM_SAMNMAX) {
@@ -1699,14 +1756,14 @@
 			}
 		}
 	}
+	
 
-
 	penUpdate();
 	keysUpdate();
 
 
 	frameCount++;
-
+	
 	if ((cursorEnable) && (mouseCursorVisible))
 	{
 		if (!keyboardEnable) {
@@ -1725,31 +1782,31 @@
 	if (callback) {
 		callbackTimer -= FRAME_TIME;
 	}
-
+	
 	if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) {
-
+	
 		if ((!dragging) && (getPenHeld()) && (penDownFrames > 5)) {
 			dragging = true;
 			dragStartX = penX;
 			dragStartY = penY;
-
+			
 			if (gameScreenSwap) {
 				dragScX = subScTargetX;
 				dragScY = subScTargetY;
 			} else {
 				dragScX = scX;
-				dragScY = scY;
-			}
-
-
+				dragScY = scY;				
+			}	
+			
+			
 		}
-
+		
 		if ((dragging) && (!getPenHeld())) {
 			dragging = false;
 		}
-
+		
 		if (dragging) {
-
+		
 			if (gameScreenSwap) {
 				subScTargetX = dragScX + ((dragStartX - penX) << 8);
 				subScTargetY = dragScY + ((dragStartY - penY) << 8);
@@ -1757,18 +1814,18 @@
 				scX = dragScX + ((dragStartX - penX));
 				scY = dragScY + ((dragStartY - penY));
 			}
-
+			
 //			consolePrintf("X:%d Y:%d\n", dragStartX - penX, dragStartY - penY);
 		}
-	}
-
-
+	}	
+	
+	
 /*	if ((frameCount & 1) == 0) {
 		SUB_BG3_CX = subScX;
 	} else {
 		SUB_BG3_CX = subScX + 64;
 	}
-
+	
 	SUB_BG3_CY = subScY + (shakePos << 8);*/
 
 	/*SUB_BG3_XDX = (int) (subScreenWidth / 256.0f * 256);
@@ -1777,40 +1834,40 @@
     SUB_BG3_YDY = (int) (subScreenHeight / 192.0f * 256);*/
 
 	static int ratio = ( 320 << 8) / SCUMM_GAME_WIDTH;
-
+	
 	bool zooming = false;
-
+	
 	if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) {
 		if ((getKeysHeld() & KEY_A) && (subScreenScale < ratio)) {
 			subScreenScale += 1;
 			zooming = true;
 		}
-
+		
 		if ((getKeysHeld() & KEY_B) && (subScreenScale > 128)) {
 			subScreenScale -=1;
 			zooming = true;
 		}
 	}
 
-
+	
 	int xCenter = subScTargetX + ((subScreenWidth >> 1) << 8);
 	int yCenter = subScTargetY + ((subScreenHeight >> 1) << 8);
 
-
+	
 	if (twoHundredPercentFixedScale) {
 		subScreenWidth = 256 >> 1;
 		subScreenHeight = 192 >> 1;
 	} else {
 		subScreenWidth = (((SCUMM_GAME_HEIGHT * 256) / 192) * subScreenScale) >> 8;
 		subScreenHeight = SCUMM_GAME_HEIGHT * subScreenScale >> 8;
-
+		
 		if ( ((subScreenWidth) > 256 - 8) && ((subScreenWidth) < 256 + 8) ) {
 			subScreenWidth = 256;
 			subScreenHeight = 192;
 			if (zooming) {
 				subScX = subScTargetX;
 				subScY = subScTargetY;
-				triggerIcon(5);
+			 	triggerIcon(5);
 			}
 		} else if ( ((subScreenWidth) > 128 - 8) && ((subScreenWidth) < 128 + 8) ) {
 			subScreenWidth = 128;
@@ -1832,14 +1889,14 @@
 			//triggerIcon(-1);
 		}
 	}
+	
 
-
 	subScTargetX = xCenter - ((subScreenWidth >> 1) << 8);
 	subScTargetY = yCenter - ((subScreenHeight >> 1) << 8);
+	
 
+	
 
-
-
 	if (subScTargetX < 0) subScTargetX = 0;
 	if (subScTargetX > (gameWidth - subScreenWidth) << 8) subScTargetX = (gameWidth - subScreenWidth) << 8;
 
@@ -1850,30 +1907,30 @@
 
 	subScX += (subScTargetX - subScX) >> 2;
 	subScY += (subScTargetY - subScY) >> 2;
-
+	
 	if (displayModeIs8Bit) {
-
+	
 		if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) {
-
+			
 			int offsX = 0, offsY = 0;
 
 
 			if (getKeysHeld() & KEY_LEFT) {
 				offsX -= 1;
 			}
-
+			
 			if (getKeysHeld() & KEY_RIGHT) {
 				offsX += 1;
 			}
-
+	
 			if (getKeysHeld() & KEY_UP) {
 				offsY -= 1;
 			}
-
+	
 			if (getKeysHeld() & KEY_DOWN) {
 				offsY += 1;
 			}
-
+			
 			if (((gameScreenSwap) && (getKeysHeld() & KEY_L)) || ((!gameScreenSwap) && (getKeysHeld() & KEY_R))) {
 				subScTargetX += offsX << 8;
 				subScTargetY += offsY << 8;
@@ -1884,32 +1941,32 @@
 		}
 
 		if (!scaledMode) {
-
+			
 			if (scX + 256 > gameWidth - 1) {
 				scX = gameWidth - 1 - 256;
 			}
-
+	
 			if (scX < 0) {
 				scX = 0;
 			}
-
+	
 			if (scY + 192 > gameHeight - 1) {
 				scY = gameHeight - 1 - 192;
 			}
-
+	
 			if (scY < 0) {
 				scY = 0;
 			}
-
+			
 			setZoomedScreenScroll(subScX, subScY, (subScreenWidth != 256) && (subScreenWidth != 128));
 			setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8);
-
-
+	
+		
 			setMainScreenScroll(scX << 8, (scY << 8) + (shakePos << 8));
 			setMainScreenScale(256, 256);		// 1:1 scale
-
+	
 		} else {
-
+		
 			if (scY > gameHeight - 192 - 1) {
 				scY = gameHeight - 192 - 1;
 			}
@@ -1917,13 +1974,13 @@
 			if (scY < 0) {
 				scY = 0;
 			}
-
+		
 			setZoomedScreenScroll(subScX, subScY, (subScreenWidth != 256) && (subScreenWidth != 128));
 			setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8);
-
+	
 			setMainScreenScroll(64, (scY << 8) + (shakePos << 8));
 			setMainScreenScale(320, 256);		// 1:1 scale
-
+			
 		}
 	} else {
 		setZoomedScreenScroll(0, 0, true);
@@ -1932,12 +1989,12 @@
 		setMainScreenScroll(0, 0);
 		setMainScreenScale(320, 256);		// 1:1 scale
 	}
-
+	
 	// Enable on screen keyboard when pen taps icon
 	if ((keyboardIcon) && (penX < 32) && (penY > 160) && (penHeld)) {
 		setKeyboardEnable(true);
 	}
-
+	
 	if (keyboardEnable) {
 		if (DS::getKeyboardClosed()) {
 			setKeyboardEnable(false);
@@ -1987,7 +2044,7 @@
 
 	if (subScTargetY < 0) subScTargetY = 0;
 	if (subScTargetY > gameHeight - subScreenHeight) subScTargetY = gameHeight - subScreenHeight;
-
+	
 	subScTargetX <<=8;
 	subScTargetY <<=8;
 }
@@ -2000,6 +2057,19 @@
 }
 #endif
 
+void uploadSpriteGfx() {
+	vramSetBankD(VRAM_D_SUB_SPRITE); 
+	vramSetBankE(VRAM_E_MAIN_SPRITE); 
+
+	// Convert texture from 24bit 888 to 16bit 1555, remembering to set top bit!
+	u8* srcTex = (u8 *) icons_raw;
+	for (int r = 32 * 256 ; r >= 0; r--) {
+		SPRITE_GFX_SUB[r] = 0x8000 | (srcTex[r * 3] >> 3) | ((srcTex[r * 3 + 1] >> 3) << 5) | ((srcTex[r * 3 + 2] >> 3) << 10);
+		SPRITE_GFX[r] = 0x8000 | (srcTex[r * 3] >> 3) | ((srcTex[r * 3 + 1] >> 3) << 5) | ((srcTex[r * 3 + 2] >> 3) << 10);
+	}
+	
+}
+
 void initHardware() {
 	// Guard band
 //((int *) (0x023FFF00)) = 0xBEEFCAFE;
@@ -2008,12 +2078,12 @@
 	penInit();
 
 	powerON(POWER_ALL);
-/*	vramSetBankA(VRAM_A_MAIN_BG);
-	vramSetBankB(VRAM_B_MAIN_BG);
+/*	vramSetBankA(VRAM_A_MAIN_BG); 
+	vramSetBankB(VRAM_B_MAIN_BG); 
 	vramSetBankC(VRAM_C_SUB_BG); */
-	vramSetBankI(VRAM_I_SUB_SPRITE);
-	vramSetBankE(VRAM_E_MAIN_SPRITE);
-
+	vramSetBankD(VRAM_D_SUB_SPRITE); 
+	vramSetBankE(VRAM_E_MAIN_SPRITE); 
+	
 	currentTimeMillis = 0;
 
 
@@ -2041,8 +2111,8 @@
 	// Allocate save buffer for game screen
 //	savedBuffer = new u8[320 * 200];
 	displayMode16Bit();
-
-	memset(BG_GFX, 0, 512 * 256 * 2);
+	
+	memset(BG_GFX, 0, 512 * 256 * 2);	
 	scaledMode = true;
 	scX = 0;
 	scY = 0;
@@ -2050,33 +2120,33 @@
 	subScY = 0;
 	subScTargetX = 0;
 	subScTargetY = 0;
-
+	
 	//lcdSwap();
 	POWER_CR &= ~POWER_SWAP_LCDS;
-
+	
 	frameCount = 0;
 	callback = NULL;
+	
+//	vramSetBankH(VRAM_H_SUB_BG); 
+	
 
-//	vramSetBankH(VRAM_H_SUB_BG);
-
-
 //	// Do text stuff
 	//BG0_CR = BG_MAP_BASE(0) | BG_TILE_BASE(1);
 //	BG0_Y0 = 48;
-
+	
 	PALETTE[255] = RGB15(31,31,31);//by default font will be rendered with color 255
-
+	
 	//consoleInit() is a lot more flexible but this gets you up and running quick
 //	consoleInitDefault((u16*)SCREEN_BASE_BLOCK(0), (u16*)CHAR_BASE_BLOCK(1), 16);
 	//consolePrintSet(0, 6);
-
+	
 	//irqs are nice
 	irqInit();
 //	irqInitHandler();
 	irqSet(IRQ_VBLANK, VBlankHandler);
 	irqSet(IRQ_TIMER0, timerTickHandler);
 	irqSet(IRQ_TIMER2, soundBufferEmptyHandler);
-
+	
 	irqEnable(IRQ_VBLANK);
 	irqEnable(IRQ_TIMER0);
 	irqEnable(IRQ_TIMER2);
@@ -2085,15 +2155,15 @@
 	irqSet(IRQ_HBLANK, hBlankHandler);
 	irqEnable(IRQ_HBLANK);
 #endif
-
-
+	
+	
 	// Set up a millisecond timer
 	#ifdef HEAVY_LOGGING
 	consolePrintf("Setting up timer...");
 	#endif
 	TIMER0_CR = 0;
 	TIMER0_DATA = (u32) TIMER_FREQ(1000);
-	TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1 | TIMER_IRQ_REQ;
+	TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1 | TIMER_IRQ_REQ;	
 	REG_IME = 1;
 	#ifdef HEAVY_LOGGING
 	consolePrintf("done\n");
@@ -2102,23 +2172,18 @@
 	PALETTE[255] = RGB15(0,0,31);
 
 	initSprites();
-
+	
 //	videoSetModeSub(MODE_3_2D | DISPLAY_BG0_ACTIVE | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
 
-	// Convert texture from 24bit 888 to 16bit 1555, remembering to set top bit!
-	u8* srcTex = (u8 *) icons_raw;
-	for (int r = 32 * 256 ; r >= 0; r--) {
-		SPRITE_GFX_SUB[r] = 0x8000 | (srcTex[r * 3] >> 3) | ((srcTex[r * 3 + 1] >> 3) << 5) | ((srcTex[r * 3 + 2] >> 3) << 10);
-		SPRITE_GFX[r] = 0x8000 | (srcTex[r * 3] >> 3) | ((srcTex[r * 3 + 1] >> 3) << 5) | ((srcTex[r * 3 + 2] >> 3) << 10);
-	}
+	// If the software scaler's back buffer has not been allocated, do it now
+	scalerBackBuffer = (u8 *) malloc(320 * 256);
 
 
-
-
-
 	WAIT_CR &= ~(0x0080);
 //	REG_WRAM_CNT = 0;
 
+	uploadSpriteGfx();
+
 	// This is a bodge to get around the fact that the cursor is turned on before it's image is set
 	// during startup in Sam & Max.  This bodge moves the cursor offscreen so it is not seen.
 	sprites[1].attribute[1] = ATTR1_SIZE_64 | 192;
@@ -2126,6 +2191,8 @@
 }
 
 
+
+
 void setKeyboardIcon(bool enable) {
 	keyboardIcon = enable;
 }
@@ -2199,27 +2266,27 @@
 		penDownLastFrame = false;
 		penDownFrames = 0;
 	}
-
+	
 }
 
 int leftHandedSwap(int keys) {
 	// Start and select are unchanged
 	if (leftHandedMode) {
 		int result = keys & (~(KEY_R | KEY_L | KEY_Y | KEY_A | KEY_B | KEY_X | KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN));
-
+		
 		if (keys & KEY_L) result |= KEY_R;
 		if (keys & KEY_R) result |= KEY_L;
-
+	
 		if (keys & KEY_LEFT) result |= KEY_Y;
 		if (keys & KEY_RIGHT) result |= KEY_A;
 		if (keys & KEY_DOWN) result |= KEY_B;
 		if (keys & KEY_UP) result |= KEY_X;
-
+	
 		if (keys & KEY_Y) result |= KEY_LEFT;
 		if (keys & KEY_A) result |= KEY_RIGHT;
 		if (keys & KEY_B) result |= KEY_DOWN;
 		if (keys & KEY_X) result |= KEY_UP;
-
+	
 		return result;
 	} else {
 		return keys;
@@ -2310,28 +2377,28 @@
 
 GLvector getPenPos() {
 	GLvector v;
-
+	
 	v.x = (penX * inttof32(1)) / SCREEN_WIDTH;
 	v.y = (penY * inttof32(1)) / SCREEN_HEIGHT;
-
+	
 	return v;
 }
 
 void formatSramOption() {
 	consolePrintf("The following files are present in save RAM:\n");
 	DSSaveFileManager::instance()->listFiles();
-
+	
 	consolePrintf("\nAre you sure you want to\n");
 	consolePrintf("DELETE all files?\n");
 	consolePrintf("A = Yes, X = No\n");
-
+	
 	while (true) {
 		if (keysHeld() & KEY_A) {
 			DSSaveFileManager::instance()->formatSram();
 			consolePrintf("SRAM cleared!\n");
 			return;
 		}
-
+	
 		if (keysHeld() & KEY_X) {
 			consolePrintf("Whew, that was close!\n");
 			return;
@@ -2364,9 +2431,13 @@
 
 void* fastRamAlloc(int size) {
 //	return malloc(size);
-	void* result = (void *) fastRamPointer;
+	void* result = fastRamPointer;
 	fastRamPointer += size;
-	return (void *) (result);
+	if(fastRamPointer > fastRamData + FAST_RAM_SIZE) {
+		consolePrintf("FastRam (ITCM) allocation failed!\n");
+		return NULL;
+	}		
+	return result;
 }
 
 void fastRamReset() {
@@ -2380,7 +2451,7 @@
 
 bool GBAMPAvail = false;
 
-bool initGBAMP(int mode) {
+bool initGBAMP(int mode) {	
 	if (FAT_InitFiles()) {
 		if (mode == 2)	{
 			disc_IsInserted();
@@ -2405,14 +2476,14 @@
 	set_verbosity(VERBOSE_INFO | VERBOSE_ERROR);
 	wireless_init(0);
 	wireless_connect();
-
+	
 	// This is where the address of the computer running the Java
 	// stub goes.
 	debugger_connect_tcp(192, 168, 0, 1);
-	debugger_init();
-
+	debugger_init();	
+	
 	// Update function - should really call every frame
-	user_debugger_update();
+	user_debugger_update();	
 }
 
 
@@ -2447,7 +2518,7 @@
 void reboot() {
 	int deviceType = -1;
 
-
+	
 	if (disc_getDeviceId() == DEVICE_DLDI) {
 
 		char id[6];
@@ -2525,13 +2596,13 @@
 		initDebugger();
 	}
 #endif
-
+	
 	// Let arm9 read cartridge
 	*((u16 *) (0x04000204)) &= ~0x0080;
-
+	
 	lastCallbackFrame = 0;
 	tweak = 0;
-
+	
 	indyFightState = false;
 	indyFightRight = true;
 
@@ -2544,26 +2615,26 @@
 
 //	bufferSize = 10;
 
-
+	
 	/*bufferRate = 44100;
 	bufferFrame = 0;
 	bufferSamples = 8192;
 
 	bufferFirstHalf = false;
 	bufferSecondHalf = true;
-
+	
 	int bytes = (2 * (bufferSamples)) + 100;
-
+	
 	soundBuffer = (s16 *) malloc(bytes * 2);
 
 
 	soundHiPart = true;
-
+	
 	for (int r = 0; r < bytes; r++) {
 		soundBuffer[r] = 0;
 	}
+	
 
-
 	swiWaitForVBlank();
 	swiWaitForVBlank();
 	playSound(soundBuffer, (bufferSamples * 2), true);
@@ -2571,35 +2642,35 @@
 	swiWaitForVBlank();
 	swiWaitForVBlank();
 */
+	
 
-
 	lastEventFrame = 0;
 	mouseMode = MOUSE_LEFT;
+	
 
-
 /*
 	TIMER1_CR = 0;
 	TIMER1_DATA = TIMER_FREQ(bufferRate);
 	TIMER1_CR = TIMER_ENABLE | TIMER_DIV_1;
-
+	
 	TIMER2_CR = 0;
 	TIMER2_DATA = 0xFFFF - (bufferSamples / 2);
 	TIMER2_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
 	*/
 	// 2945 - 2947
+	
 
-
-
+	
 //	for (int r = 2946; r < 3000; r++) {
 //		soundBuffer[r] = 30000;
 //	}
+	
 
-
 	//2372
 	consolePrintf("-------------------------------\n");
 	consolePrintf("ScummVM DS\n");
 	consolePrintf("Ported by Neil Millstone\n");
-	consolePrintf("Version 0.11.0 beta1 ");
+	consolePrintf("Version 0.11.1 beta2");
 #if defined(DS_BUILD_A)
 	consolePrintf("build A\n");
 	consolePrintf("Lucasarts SCUMM games (SCUMM)\n");
@@ -2610,7 +2681,7 @@
 	consolePrintf("-------------------------------\n");
 #elif defined(DS_BUILD_C)
 	consolePrintf("build C\n");
-	consolePrintf("Simon/Elvira (AGOS)\n");
+	consolePrintf("Simon/Elvira/Waxworks (AGOS)\n");
 	consolePrintf("-------------------------------\n");
 #elif defined(DS_BUILD_D)
 	consolePrintf("build D\n");
@@ -2618,7 +2689,7 @@
 	consolePrintf("-------------------------------\n");
 #elif defined(DS_BUILD_E)
 	consolePrintf("build E\n");
-	consolePrintf("ITE/IHNM (SAGA)\n");
+	consolePrintf("Inherit the Earth (SAGA)\n");
 	consolePrintf("-------------------------------\n");
 #elif defined(DS_BUILD_F)
 	consolePrintf("build F\n");
@@ -2649,7 +2720,7 @@
 	consolePrintf("\n");
 #endif
 
-
+	
 #ifdef USE_BUILT_IN_DRIVER_SELECTION
 	// Do M3 detection selectioon
 	int extraData = DSSaveFileManager::getExtraData();
@@ -2688,7 +2759,7 @@
 	disc_setEnable(mode);
 	DSSaveFileManager::setExtraData(mode);
 #else
-
+	
 	int mode = 0;
 
 #endif
@@ -2734,11 +2805,11 @@
 	}
 	delete node;
 
+	
 
-
 	updateStatus();
-
-
+	
+	
 //	OSystem_DS::instance();
 
 	g_system = new OSystem_DS();
@@ -2769,7 +2840,7 @@
 	char* argv[3] = {"/scummvmds", "--config=scummvmg.ini"};
 #endif
 
-#ifdef DS_NON_SCUMM_BUILD
+#ifdef DS_NON_SCUMM_BUILD	
 
 	while (1) {
 		scummvm_main(2, (char **) &argv);

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsmain.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsmain.h	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsmain.h	2008-05-28 20:30:20 UTC (rev 32350)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  */
-
+ 
 #ifndef _DSMAIN_H
 #define _DSMAIN_H
 
@@ -42,98 +42,100 @@
 };
 
 struct gameListType {
-	char			gameId[16];
-	controlType		control;
+	char 			gameId[16];
+	controlType 	control;
 };
 
 // Pen reading functions
-void	penInit();
-void	penUpdate();
-bool	getPenDown();
-bool	getPenHeld();
-bool	getPenReleased();
-int		getPenX();
-int		getPenY();
+void 	penInit();
+void 	penUpdate();
+bool 	getPenDown();
+bool 	getPenHeld();
+bool 	getPenReleased();
+int 	getPenX();
+int 	getPenY();
 GLvector getPenPos();
-void	consumePenEvents();
+void 	consumePenEvents();
 
 // Pad reading
-int		getKeysHeld();
-void	keysUpdate();
-int		getKeysDown();
-int		getKeysReleased();
-void	consumeKeys();
-int		leftHandedSwap(int keys);
+int 	getKeysHeld();
+void 	keysUpdate();
+int 	getKeysDown();
+int 	getKeysReleased();
+void 	consumeKeys();
+int 	leftHandedSwap(int keys);
 
 // Video
-void	displayMode8Bit();											// Switch to 8-bit mode5
-void	displayMode16Bit();										// Switch to 16-bit mode5
+void 	displayMode8Bit();											// Switch to 8-bit mode5
+void 	displayMode16Bit();										// Switch to 16-bit mode5
 
 // Flip double buffer
-void	displayMode16BitFlipBuffer();
+void 	displayMode16BitFlipBuffer();
 
 // Get address of current back buffer
-u16*	get16BitBackBuffer();
-u16*	get8BitBackBuffer();
+u16* 	get16BitBackBuffer();
+u16* 	get8BitBackBuffer();
+s32 	get8BitBackBufferStride();
+u16*	getScalerBuffer();
 
-void	setTalkPos(int x, int y);
-void	setTopScreenTarget(int x, int y);
+void 	setTalkPos(int x, int y);
+void 	setTopScreenTarget(int x, int y);
 void	set200PercentFixedScale(bool on);
 
 // Timers
-void	setTimerCallback(OSystem_DS::TimerProc proc, int interval);		// Setup a callback function at a regular interval
-int		getMillis();													// Return the current runtime in milliseconds
-void	doTimerCallback();												// Call callback function if required
+void 	setTimerCallback(OSystem_DS::TimerProc proc, int interval);		// Setup a callback function at a regular interval
+int 	getMillis();													// Return the current runtime in milliseconds
+void 	doTimerCallback();												// Call callback function if required
 
 // Sound
-void	setSoundProc(OSystem_DS::SoundProc proc, void* param);			// Setup a callback function for sound
-void	doSoundCallback();												// Call function if sound buffers need more data
-void	playSound(const void* data, u32 length, bool loop, bool adpcm = false, int rate = 22050);		// Start a sound
-void	stopSound(int channel);
+void 	setSoundProc(OSystem_DS::SoundProc proc, void* param);			// Setup a callback function for sound
+void 	doSoundCallback();												// Call function if sound buffers need more data
+void 	playSound(const void* data, u32 length, bool loop, bool adpcm = false, int rate = 22050);		// Start a sound
+void 	stopSound(int channel);
 int		getSoundFrequency();
 
 // Event queue
-void	addEventsToQueue();
-void	VBlankHandler();
+void 	addEventsToQueue();
+void 	VBlankHandler();
 
 // Sam and Max Stuff
-void	setGameID(int id);
-void	setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX, int hotspotY);
+void 	setGameID(int id);
+void 	setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX, int hotspotY);
 void	setShowCursor(bool enable);
 void	setMouseCursorVisible(bool visible);
 
 // Shake
-void	setShakePos(int shakePos);
+void 	setShakePos(int shakePos);
 
 // Reports
-void	memoryReport();
+void 	memoryReport();
 
 // GBAMP
-bool	isGBAMPAvailable();
+bool 	isGBAMPAvailable();
 
 // Sleep (I'd like some of that right now)
-void	checkSleepMode();
+void 	checkSleepMode();
 
 // Virtual keyboard
-void	setKeyboardIcon(bool enable);
-bool	getKeyboardIcon();
-void	setKeyboardEnable(bool en);
-bool	getKeyboardEnable();
+void 	setKeyboardIcon(bool enable);
+bool 	getKeyboardIcon();
+void 	setKeyboardEnable(bool en);
+bool 	getKeyboardEnable();
 
 // Options
-void	setLeftHanded(bool enable);
-void	setTouchXOffset(int x);
-void	setTouchYOffset(int y);
-void	setUnscaledMode(bool enable);
+void 	setLeftHanded(bool enable);
+void 	setTouchXOffset(int x);
+void 	setTouchYOffset(int y);
+void 	setUnscaledMode(bool enable);
 void	setSnapToBorder(bool enable);
-void	setIndyFightState(bool st);
-bool	getIndyFightState();
+void 	setIndyFightState(bool st);
+bool 	getIndyFightState();
 bool    isCpuScalerEnabled();
 void	setCpuScalerEnable(bool enable);
 
 // Display
-bool	getIsDisplayMode8Bit();
-void	setGameSize(int width, int height);
+bool 	getIsDisplayMode8Bit();
+void 	setGameSize(int width, int height);
 int		getGameWidth();
 int		getGameHeight();
 

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsoptions.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsoptions.cpp	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsoptions.cpp	2008-05-28 20:30:20 UTC (rev 32350)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  */
-
+ 
 #include "dsoptions.h"
 #include "dsmain.h"
 #include "gui/dialog.h"
@@ -28,6 +28,7 @@
 #include "osystem_ds.h"
 #include "engines/scumm/scumm.h"
 #include "touchkeyboard.h"
+#include "gui/PopUpWidget.h"
 
 #define ALLOW_CPU_SCALER
 
@@ -40,29 +41,40 @@
 
 namespace DS {
 
-DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(20, 0, 320 - 40, 230 - 20) {
+DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(5, 0, 320 - 5, 230 - 20) {
 	addButton(this, 10, 175, "Close", GUI::kCloseCmd, 'C');
 
+	_radioButtonMode = false;
+	
 #ifdef DS_SCUMM_BUILD
 	if (!DS::isGBAMPAvailable()) {
 //		addButton(this, 100, 140, "Delete Save", 'dels', 'D');
 	}
 #endif
 
-	new GUI::StaticTextWidget(this, 80, 10, 130, 15, "ScummVM DS Options", GUI::kTextAlignCenter);
+	new GUI::StaticTextWidget(this, 90, 10, 130, 15, "ScummVM DS Options", GUI::kTextAlignCenter);
 
-	_leftHandedCheckbox = new GUI::CheckboxWidget(this, 20, 25, 200, 20, "Left handed mode", 0, 'L');
-	_indyFightCheckbox = new GUI::CheckboxWidget(this, 20, 40, 200, 20, "Indy fighting controls", 0, 'I');
-	_unscaledCheckbox = new GUI::CheckboxWidget(this, 20, 55, 200, 20, "Unscaled main screen", 0, 'S');
-	_twoHundredPercentCheckbox = new GUI::CheckboxWidget(this, 20, 70, 230, 20, "Zoomed screen at fixed 200% zoom", 0, 'T');
-	_highQualityAudioCheckbox = new GUI::CheckboxWidget(this, 20, 85, 250, 20, "High quality audio (slower) (reboot)", 0, 'T');
-	_disablePowerOff = new GUI::CheckboxWidget(this, 20, 100, 250, 20, "Disable power off on quit", 0, 'T');
-	_showCursorCheckbox = new GUI::CheckboxWidget(this, 20, 115, 130, 20, "Show mouse cursor", 0, 'T');
-#ifdef ALLOW_CPU_SCALER
-	_cpuScaler = new GUI::CheckboxWidget(this, 160, 115, 90, 20, "CPU scaler", 0, 'T');
-#endif
-	_snapToBorderCheckbox = new GUI::CheckboxWidget(this, 20, 130, 250, 20, "Snap to border", 0, 'T');
+	_leftHandedCheckbox = new GUI::CheckboxWidget(this, 5, 70, 130, 20, "Left handed mode", 0, 'L');
+	_indyFightCheckbox = new GUI::CheckboxWidget(this, 5, 40, 200, 20, "Indy fighting controls", 0, 'I');
+	_twoHundredPercentCheckbox = new GUI::CheckboxWidget(this, 5, 55, 230, 20, "Zoomed screen at fixed 200% zoom", 0, 'T');
+	_highQualityAudioCheckbox = new GUI::CheckboxWidget(this, 5, 25, 250, 20, "High quality audio (slower) (reboot)", 0, 'T');
+	_disablePowerOff = new GUI::CheckboxWidget(this, 5, 85, 130, 20, "Disable power off", 0, 'T');
+	_showCursorCheckbox = new GUI::CheckboxWidget(this, 5, 100, 130, 20, "Show mouse cursor", 0, 'T');
 
+//#ifdef ALLOW_CPU_SCALER
+//	_cpuScaler = new GUI::CheckboxWidget(this, 160, 115, 90, 20, "CPU scaler", 0, 'T');
+//#endif
+
+	new GUI::StaticTextWidget(this, 180, 70, 130, 15, "Main screen:", GUI::kTextAlignLeft);
+
+	_hardScaler = new GUI::CheckboxWidget(this, 140, 85, 170, 20, "Hardware scale (fast)", 0x10000001, 'T');
+	_cpuScaler = new GUI::CheckboxWidget(this, 140, 100, 170, 20, "Software scale (quality)", 0x10000002, 'S');
+	_unscaledCheckbox = new GUI::CheckboxWidget(this, 140, 115, 170, 20, "Unscaled", 0x10000003, 'S');
+	
+
+
+	_snapToBorderCheckbox = new GUI::CheckboxWidget(this, 5, 115, 120, 20, "Snap to border", 0, 'T');
+
 	new GUI::StaticTextWidget(this, 20, 145, 110, 15, "Touch X Offset", GUI::kTextAlignLeft);
 	_touchX = new GUI::SliderWidget(this, 130, 145, 130, 12, 1);
 	_touchX->setMinValue(-8);
@@ -153,6 +165,11 @@
 		_touchY->setValue(0);
 	}
 
+	if (!_cpuScaler->getState() && !_unscaledCheckbox->getState()) {
+		_hardScaler->setState(true);
+	}
+		
+	_radioButtonMode = true;
 }
 
 DSOptionsDialog::~DSOptionsDialog() {
@@ -177,16 +194,49 @@
 }
 
 void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
+
+	static bool guard = false;
+
+	if ((!guard) && (_radioButtonMode))
+	{
+		guard = true;
+
+		if ((cmd & 0xFF000000) == 0x10000000)
+		{
+			_cpuScaler->setState(false);
+			_hardScaler->setState(false);
+			_unscaledCheckbox->setState(false);
+		
+			if ((sender == _cpuScaler) && (cmd == 0x10000002))
+			{
+				_cpuScaler->setState(true);
+			}
+		
+			if ((sender == _hardScaler) && (cmd == 0x10000001))
+			{
+				_hardScaler->setState(true);
+			}
+	
+			if ((sender == _unscaledCheckbox) && (cmd == 0x10000003))
+			{
+				_unscaledCheckbox->setState(true);
+			}
+		}
+
+		guard = false;
+
+	}
+
 	if (cmd == GUI::kCloseCmd) {
 		updateConfigManager();
 		close();
 	}
-
+	
 #ifdef DS_SCUMM_BUILD
 /*	if (cmd == 'dels') {
 		_delDialog->setList(Scumm::generateSavegameList(Scumm::g_scumm, false));
 		_delDialog->handleCommand(NULL, GUI::kListSelectionChangedCmd, 0);
-
+		
 		Common::Event event;
 		event.type = Common::EVENT_KEYDOWN;
 		event.kbd.ascii = 0;
@@ -195,9 +245,9 @@
 
 		event.type = Common::EVENT_KEYUP;
 		OSystem_DS::instance()->addEvent(event);
-
+				
 		int idx = _delDialog->runModal();
-
+		
 		if (idx >= 0) {
 			char name[256];
 			Scumm::g_scumm->makeSavegameName(name, idx, false);
@@ -205,11 +255,11 @@
 				((DSSaveFileManager *) (OSystem_DS::instance()->getSavefileManager()))->deleteFile(name);
 			}
 		}
-
+		
 	}*/
 #endif
+	
 
-
 }
 
 void togglePause() {
@@ -220,11 +270,11 @@
 		OSystem_DS* system = OSystem_DS::instance();
 
 		event.type = Common::EVENT_KEYDOWN;
-		event.kbd.keycode = Common::KEYCODE_p;
+		event.kbd.keycode = Common::KEYCODE_p;		
 		event.kbd.ascii = 'p';
 		event.kbd.flags = 0;
 		system->addEvent(event);
-
+	
 		event.type = Common::EVENT_KEYUP;
 		system->addEvent(event);
 	}
@@ -235,14 +285,12 @@
 	togglePause();
 
 	DS::displayMode16Bit();
+	
 
-
 	DSOptionsDialog* d = new DSOptionsDialog();
 	d->runModal();
-	consolePrintf("deleting dialog\n");
 	delete d;
-
-	consolePrintf("going to 8 bit\n");
+	
 	DS::displayMode8Bit();
 
 	togglePause();
@@ -303,7 +351,8 @@
 	} else {
 		DS::setCpuScalerEnable(false);
 	}
-#endif
+#endif	
+
 }
 
 }

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsoptions.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsoptions.h	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/dsoptions.h	2008-05-28 20:30:20 UTC (rev 32350)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  */
-
+ 
 #ifndef _DSOPTIONS_H_
 #define _DSOPTIONS_H_
 
@@ -39,7 +39,7 @@
 public:
 	DSOptionsDialog();
 	~DSOptionsDialog();
-
+	
 protected:
 	virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
 	void togglePause();
@@ -53,14 +53,18 @@
 	GUI::CheckboxWidget* _indyFightCheckbox;
 	GUI::CheckboxWidget* _highQualityAudioCheckbox;
 	GUI::CheckboxWidget* _disablePowerOff;
-	GUI::CheckboxWidget* _cpuScaler;
 	GUI::CheckboxWidget* _showCursorCheckbox;
 	GUI::CheckboxWidget* _snapToBorderCheckbox;
 
+	GUI::CheckboxWidget* _hardScaler;
+	GUI::CheckboxWidget* _cpuScaler;
+	
 #ifdef DS_SCUMM_BUILD
 	Scumm::SaveLoadChooser* _delDialog;
 #endif
 
+	bool	_radioButtonMode;
+
 };
 
 extern void showOptionsDialog();

Modified: scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/disc_io.c
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/disc_io.c	2008-05-28 20:16:22 UTC (rev 32349)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/ds/arm9/source/fat/disc_io.c	2008-05-28 20:30:20 UTC (rev 32350)
@@ -5,7 +5,7 @@
 	uniformed io-interface to work with Chishm's FAT library
 
 	Written by MightyMax
-
+  
 	Modified by Chishm:
 	2005-11-06
 		* Added WAIT_CR modifications for NDS
@@ -87,7 +87,7 @@
 
 	Disc Cache functions
 	2006-02-03:
-		Added by www.neoflash.com
+		Added by www.neoflash.com 
 
 */
 int discDetect = 0;
@@ -99,7 +99,7 @@
 #include <string.h>
 
 #define CACHE_FREE 0xFFFFFFFF
-
+	
 static u8 cacheBuffer[ DISC_CACHE_COUNT * 512 ];
 
 static struct {
@@ -112,20 +112,20 @@
 
 static u32 disc_CacheFind(u32 sector) {
 	u32 i;
-
+	
 	for( i = 0; i < DISC_CACHE_COUNT; i++ )	{
 		if( cache[ i ].sector == sector )
 			return i;
 	}
-
+	
 	return CACHE_FREE;
 }
 
 static u32 disc_CacheFindFree(void) {
-
+	
 	u32 i = 0, j;
 	u32 count = -1;
-
+	
 	for( j = 0; j < DISC_CACHE_COUNT; j++ )	{
 
 		if( cache[ j ].sector == CACHE_FREE ) {
@@ -142,7 +142,7 @@
 	if( cache[ i ].sector != CACHE_FREE && cache[i].dirty != 0 ) {
 
 		active_interface->fn_WriteSectors( cache[ i ].sector, 1, &cacheBuffer[ i * 512 ] );
-		/* todo: handle write error here
+		/* todo: handle write error here 
 
 		cache[ i ].sector = CACHE_FREE;
 		cache[ i ].dirty = 0;
@@ -431,7 +431,7 @@
 #endif
 
 
-bool disc_Init(void)
+bool disc_Init(void) 
 {
 #ifdef DISC_CACHE
 	disc_CacheInit();
@@ -455,15 +455,15 @@
 	// could not find a working IO Interface
 	active_interface = 0 ;
 	return false ;
-}
+} 
 
-bool disc_IsInserted(void)
+bool disc_IsInserted(void) 
 {
 	if (active_interface) return active_interface->fn_IsInserted() ;
 	return false ;
-}
+} 
 
-bool disc_ReadSectors(u32 sector, u8 numSecs, void* buffer)
+bool disc_ReadSectors(u32 sector, u8 numSecs, void* buffer) 
 {
 #ifdef DISC_CACHE
 	u8 *p=(u8*)buffer;
@@ -480,9 +480,9 @@
 	if (active_interface) return active_interface->fn_ReadSectors(sector,numSecs,buffer) ;
 	return false ;
 #endif
-}
+} 
 
-bool disc_WriteSectors(u32 sector, u8 numSecs, void* buffer)
+bool disc_WriteSectors(u32 sector, u8 numSecs, void* buffer) 
 {
 /*#ifdef DISC_CACHE
 	u8 *p=(u8*)buffer;
@@ -499,18 +499,46 @@
 #ifdef DISC_CACHE
 	disc_CacheInit();
 #endif
+
+#define MISALIGNMENT_BODGE
+
+#ifdef MISALIGNMENT_BODGE
+	// This bodge works around problems with some card reader drivers which require data to be
+	// aligned to 2- or 4-byte boundaries it varies which one they require.  This bodge sorts
+	// it but also reduces write speed as it doesn't use the multi-sector write capability any

@@ 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