[Scummvm-cvs-logs] SF.net SVN: scummvm: [26394] scummvm/trunk

agent-q at users.sourceforge.net agent-q at users.sourceforge.net
Fri Apr 6 20:34:54 CEST 2007


Revision: 26394
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26394&view=rev
Author:   agent-q
Date:     2007-04-06 11:34:53 -0700 (Fri, 06 Apr 2007)

Log Message:
-----------
Updating DS port for changes in main codebase.  Code changes for DevkitArm r20 and latest libnds.

Modified Paths:
--------------
    scummvm/trunk/backends/fs/ds/ds-fs.cpp
    scummvm/trunk/backends/fs/ds/ds-fs.h
    scummvm/trunk/backends/platform/ds/arm7/Makefile
    scummvm/trunk/backends/platform/ds/arm7/source/main.cpp
    scummvm/trunk/backends/platform/ds/arm9/makefile
    scummvm/trunk/backends/platform/ds/arm9/source/blitters.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/cdaudio.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h
    scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.c
    scummvm/trunk/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
    scummvm/trunk/backends/platform/ds/arm9/source/fat/io_dldi.h
    scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h
    scummvm/trunk/backends/platform/ds/arm9/source/portdefs.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/portdefs.h
    scummvm/trunk/backends/platform/ds/arm9/source/scummconsole.h
    scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp
    scummvm/trunk/common/file.cpp
    scummvm/trunk/engines/agi/text.cpp

Modified: scummvm/trunk/backends/fs/ds/ds-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/ds/ds-fs.cpp	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/fs/ds/ds-fs.cpp	2007-04-06 18:34:53 UTC (rev 26394)
@@ -22,7 +22,7 @@
 #include "str.h"
 #include "fs.h"
 #include "common/util.h"
-#include <NDS/ARM9/console.h> //basic print funcionality
+//#include <NDS/ARM9/console.h> //basic print funcionality
 #include "ds-fs.h"
 #include "dsmain.h"
 #include "gba_nds_fat.h"
@@ -30,31 +30,9 @@
 
 namespace DS {
 
-struct fileHandle {
-	int pos;
-	bool used;
-	char* data;
-	int size;
-	
-	DSSaveFile* sramFile;
-};
 
-#define FILE DS::fileHandle
 
-// FIXME: The following definition for stdin etc. are duplicated in common/util.cpp.
-// This should be fixed, e.g. by moving this (and the declarations of fileHandle,
-// the various functions etc.) into a separate header file which includes by util.cpp,
-// file.cpp and ds-fs.cpp
 
-#undef stderr
-#undef stdout
-#undef stdin
-
-#define stdout ((DS::fileHandle*) -1)
-#define stderr ((DS::fileHandle*) -2)
-#define stdin ((DS::fileHandle*) -3)
-
-
 //////////////////////////////////////////////////////////////
 // DSFileSystemNode - Flash ROM file system using Zip files
 //////////////////////////////////////////////////////////////
@@ -751,7 +729,7 @@
 			p++;
 			file->sramFile->read((char *) &str[p], 1);
 //			consolePrintf("%d,", str[p]);
-		} while ((str[p] >= 32) && (!feof(file)) && (p < size));
+		} while ((str[p] >= 32) && (!std_feof(file)) && (p < size));
 		str[p + 1] = 0;
 		file->pos++;
 //		consolePrintf("Read:%s\n", str);

Modified: scummvm/trunk/backends/fs/ds/ds-fs.h
===================================================================
--- scummvm/trunk/backends/fs/ds/ds-fs.h	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/fs/ds/ds-fs.h	2007-04-06 18:34:53 UTC (rev 26394)
@@ -21,9 +21,6 @@
 #define _DS_FS_H
 
 
-#include "stdafx.h"
-#include "common/array.h"
-#include "common/str.h"
 
 //#include <NDS/ARM9/console.h>
 #include "fs.h"
@@ -105,14 +102,41 @@
 };
 
 
-// FIXME: Why is assert redefined ? And why here (this is definitely the wrong place).
 
-#ifdef assert
-#undef assert
-#endif
 
-#define assert(s) if (!(s)) consolePrintf("Assertion failed: '##s##' at file %s, line %d\n", __FILE__, __LINE__)
+struct fileHandle {
+	int pos;
+	bool used;
+	char* data;
+	int size;
+	
+	DSSaveFile* sramFile;
+};
 
+
+#undef stderr
+#undef stdout
+#undef stdin
+
+#define stdout ((DS::fileHandle*) -1)
+#define stderr ((DS::fileHandle*) -2)
+#define stdin ((DS::fileHandle*) -3)
+
+#define FILE DS::fileHandle
+	
+// Please do not remove any of these prototypes that appear not to be required.
+FILE* 	std_fopen(const char* name, const char* mode);
+void 	std_fclose(FILE* handle);
+int 	std_getc(FILE* handle);
+size_t 	std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle);
+size_t 	std_fwrite(const void* ptr, size_t size, size_t numItems, FILE* handle);
+bool 	std_feof(FILE* handle);
+long int std_ftell(FILE* handle);
+int 	std_fseek(FILE* handle, long int offset, int whence);
+void 	std_clearerr(FILE* handle);
+void 	std_cwd(char* dir);
+void 	std_fflush(FILE* handle);
+
 }
 
 #endif

Modified: scummvm/trunk/backends/platform/ds/arm7/Makefile
===================================================================
--- scummvm/trunk/backends/platform/ds/arm7/Makefile	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm7/Makefile	2007-04-06 18:34:53 UTC (rev 26394)
@@ -68,7 +68,7 @@
 # list of directories containing libraries, this must be the top level containing
 # include and lib
 #---------------------------------------------------------------------------------
-LIBDIRS	:=	$(DEVKITPRO)/libnds $(DEVKITPRO)/libnds/nds
+LIBDIRS	:=	/home/neil/devkitpro/libnds home/neil/devkitpro/libnds/nds
  
  
 #---------------------------------------------------------------------------------

Modified: scummvm/trunk/backends/platform/ds/arm7/source/main.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm7/source/main.cpp	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm7/source/main.cpp	2007-04-06 18:34:53 UTC (rev 26394)
@@ -25,7 +25,7 @@
 // -- modified by Darkain and others
 //////////////////////////////////////////////////////////////////////
 
-#define USE_LIBCARTRESET
+//#define USE_LIBCARTRESET
  
 #include <nds.h>
  
@@ -424,7 +424,6 @@
     uint32 temp=0;
     uint8 ct[sizeof(IPC->curtime)];
 	static int heartbeat = 0;
-    
     // Update the heartbeat
     heartbeat++;
  
@@ -512,8 +511,7 @@
  #ifdef USE_DEBUGGER
     Wifi_Update(); // update wireless in vblank
  #endif
- }
- 
+} 
 
 //////////////////////////////////////////////////////////////////////
 
@@ -571,6 +569,7 @@
 
 
 int main(int argc, char ** argv) {
+
 	
 #ifdef USE_DEBUGGER
   REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
@@ -639,6 +638,7 @@
 	if (IPC->reset) {
 		powerOff();
 	}
+
 	swiWaitForVBlank();
   }
   return 0;

Modified: scummvm/trunk/backends/platform/ds/arm9/makefile
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/makefile	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm9/makefile	2007-04-06 18:34:53 UTC (rev 26394)
@@ -1,13 +1,14 @@
 #BUILD_PLUGINS = 1
-libndsdir = $(DEVKITPRO)/libnds
+#libndsdir = $(DEVKITPRO)/libnds
+libndsdir = /home/neil/devkitpro/libnds
 
 # Select the build you want by uncommenting one of the following lines:
 
 DS_BUILD_A = 1
 #DS_BUILD_B = 1
 #DS_BUILD_C = 1
+#DS_BUILD_D = 1
 
-
 # Uncomment the following line to build in support for MP3 audio
 # using libmad:
 USE_MAD = 1
@@ -42,6 +43,7 @@
 	DISABLE_CINE = 1
 	DISABLE_AGI = 1
 	DISABLE_TOUCHE = 1
+	DISABLE_PARALLACTION = 1
 	BUILD=scummvm-A
 endif
 
@@ -63,6 +65,7 @@
 	DISABLE_CINE = 1
 	DISABLE_AGI = 1
 	DISABLE_TOUCHE = 1
+	DISABLE_PARALLACTION = 1
 	BUILD=scummvm-B
 endif
 
@@ -84,10 +87,33 @@
 	DISABLE_CINE = 1
 	DISABLE_AGI = 1
 	DISABLE_TOUCHE = 1
+	DISABLE_PARALLACTION = 1
 	BUILD=scummvm-C
 endif
 
+ifdef DS_BUILD_D
+	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_D
+	LOGO = logoc.bmp
+	DISABLE_HE = 1
+	DISABLE_SCUMM = 1
+	DISABLE_SCUMM_7_8 = 1
+	DISABLE_AGOS = 1
+	DISABLE_SKY = 1
+	DISABLE_SWORD1 = 1
+	DISABLE_SWORD2 = 1
+	DISABLE_QUEEN = 1
+	DISABLE_SAGA = 1
+	DISABLE_KYRA = 1
+	DISABLE_GOB = 1
+	DISABLE_LURE = 1
+	#DISABLE_CINE = 1
+	#DISABLE_AGI = 1
+	DISABLE_TOUCHE = 1
+	DISABLE_PARALLACTION = 1
+	BUILD=scummvm-A
+endif
 
+
 ARM7BIN	:= -7 $(CURDIR)/../../arm7/arm7.bin
 ICON 		:= -b ../../../logo.bmp "ScummVM;By Neil Millstone;"
 
@@ -108,7 +134,7 @@
 		-fno-exceptions -fno-rtti
 
 ASFLAGS = -mcpu=arm9tdmi -mthumb-interwork
-DEFINES += -D__DS__ -DNDS -DARM9 -DNONSTANDARD_PORT -DDISABLE_FANCY_THEMES
+DEFINES += -D__DS__ -DNDS -DARM9 -DNONSTANDARD_PORT -DDISABLE_FANCY_THEMES -DDISABLE_DEFAULT_SAVEFILEMANAGER
 ifdef USE_MAD
 	DEFINES += -DUSE_MAD
 endif
@@ -156,7 +182,7 @@
 		$(portdir)/../../../fs/ds/ds-fs.o $(portdir)/source/gbampsave.o $(portdir)/source/scummhelp.o\
 		$(portdir)/source/osystem_ds.o $(portdir)/source/portdefs.o $(portdir)/source/ramsave.o\
 		$(portdir)/source/scummconsole.o $(portdir)/source/touchkeyboard.o $(portdir)/source/zipreader.o\
-		$(portdir)/source/dsoptions.o
+		$(portdir)/source/dsoptions.o $(portdir)/source/keys.o
 		
 DATA_OBJS := $(portdir)/data/icons.o $(portdir)/data/keyboard.o $(portdir)/data/keyboard_pal.o $(portdir)/data/default_font.o
 			
@@ -252,7 +278,7 @@
 .cpp.o:
 	$(MKDIR) $(*D)/$(DEPDIR)
 	$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d2" $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
-	$(ECHO) "$(*D)/" > $(*D)/$(DEPDIR)/$(*F).d
+#	$(ECHO) "$(*D)/" > $(*D)/$(DEPDIR)/$(*F).d
 	$(CAT) "$(*D)/$(DEPDIR)/$(*F).d2" >> "$(*D)/$(DEPDIR)/$(*F).d"
 	$(RM) "$(*D)/$(DEPDIR)/$(*F).d2"
 else

Modified: scummvm/trunk/backends/platform/ds/arm9/source/blitters.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/blitters.cpp	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm9/source/blitters.cpp	2007-04-06 18:34:53 UTC (rev 26394)
@@ -17,7 +17,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  */
- 
+
 #include "stdafx.h"
 #define CHARSET_MASK_TRANSPARENCY 253
 
@@ -298,8 +298,8 @@
 
 void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, const u16* palette, int destStride, int srcStride)
 {
-	u32* fastRam = (u32 *) (0x37F8000 + 16384);
-    
+	u32 fastRam[768];
+
     // Palette lookup -> 0_888
     for(size_t i=0; i<256; ++i)
     {

Modified: scummvm/trunk/backends/platform/ds/arm9/source/cdaudio.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/cdaudio.cpp	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm9/source/cdaudio.cpp	2007-04-06 18:34:53 UTC (rev 26394)
@@ -85,6 +85,7 @@
 int blockCount;
 int dataChunkStart;
 int blocksLeft;
+bool trackStartsAt2 = false;
 
 
 // These are from Microsoft's document on DVI ADPCM
@@ -128,10 +129,12 @@
 		stopTrack();
 	}
 	
+	if (trackStartsAt2) {
+		track++;
+	}
 	
 	
 	
-	
 	char str[100];
 
 	if (path[strlen(path.c_str()) - 1] == '/') {
@@ -460,16 +463,17 @@
 	DC_FlushAll();
 }
 
-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");
+bool trackExists(int num) {
+	Common::String path = ConfMan.get("path");
 
-	Common::String path = ConfMan.get("path");
-	// 6577 153 154
+	char fname[128];
+
+	sprintf(fname, "track%d.wav", num);
+
 	if (path[strlen(path.c_str()) - 1] == '/') {
-		path = path + "track2.wav";
+		path = path + fname;
 	} else {
-		path = path + "/track2.wav";
+		path = path + "/" + fname;
 	}
 	consolePrintf("Looking for %s...", path.c_str());
 
@@ -486,6 +490,21 @@
 	}
 }
 
+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;
+	} else if (trackExists(2)) {
+		trackStartsAt2 = true;
+		return true;
+	} else {
+		return false;
+	}
+}
+
 bool isPlaying() {
 	return isPlayingFlag;
 }

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp	2007-04-06 18:34:53 UTC (rev 26394)
@@ -42,13 +42,14 @@
 // - Delete saves?
 // - Software scaler?
 // - 100% scale
+// - Find out what's going wrong when you turn the console off
 
 #define USE_LIBCARTRESET
 //#define USE_BUILT_IN_DRIVER_SELECTION
 
 #include <nds.h>
 
-#include <ARM9/console.h> //basic print funcionality
+//#include <ARM9/console.h> //basic print funcionality
 
 #include <stdlib.h>
 #include "dsmain.h"
@@ -74,6 +75,7 @@
 #include "disc_io.h"
 #include "blitters.h"
 #include "cartreset_nolibfat.h"
+#include "keys.h"
 
 namespace DS {
 
@@ -231,9 +233,10 @@
 bool penHeld;
 bool penReleased;
 bool penDownLastFrame;
-f32 penX, penY;
+s32 penX, penY;
 int keysDownSaved;
 int keysReleasedSaved;
+int keysChangedSaved;
 
 bool penDownSaved;
 bool penReleasedSaved;
@@ -241,11 +244,19 @@
 int touchXOffset = 0;
 int touchYOffset = 0;
 
+int triggeredIcon = 0;
+int triggeredIconTimeout = 0;
+
 u16 savedPalEntry255 = RGB15(31, 31, 31);
 
 
 extern "C" int scummvm_main(int argc, char *argv[]);
+Common::EventType getKeyEvent(int key);
+int getKeysChanged();
+
 void updateStatus();
+void triggerIcon(int imageNum);
+void setIcon(int num, int x, int y, int imageNum, int flags, bool enable);
 
 TransferSound soundControl;
 
@@ -469,11 +480,11 @@
 		videoSetMode(MODE_5_2D | 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_0x6000000);
-		vramSetBankB(VRAM_B_MAIN_BG_0x6020000);
+		vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
+		vramSetBankB(VRAM_B_MAIN_BG_0x06020000);
 	
-		vramSetBankC(VRAM_C_SUB_BG_0x6200000);
-		vramSetBankD(VRAM_D_MAIN_BG_0x6040000);
+		vramSetBankC(VRAM_C_SUB_BG_0x06200000);
+		vramSetBankD(VRAM_D_MAIN_BG_0x06040000);
 		
 		vramSetBankH(VRAM_H_LCD);
 	
@@ -489,11 +500,11 @@
 		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_0x6000000);
-		vramSetBankB(VRAM_B_MAIN_BG_0x6020000);
+		vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
+		vramSetBankB(VRAM_B_MAIN_BG_0x06020000);
 	
-		vramSetBankC(VRAM_C_SUB_BG_0x6200000);
-		vramSetBankD(VRAM_D_MAIN_BG_0x6040000);
+		vramSetBankC(VRAM_C_SUB_BG_0x06200000);
+		vramSetBankD(VRAM_D_MAIN_BG_0x06040000);
 		
 		vramSetBankH(VRAM_H_LCD);
 	
@@ -855,6 +866,8 @@
 
 	event.type = Common::EVENT_KEYDOWN;
 	event.kbd.flags = 0;
+	
+	consolePrintf("Fight keys\n");
 
 	if ((getKeysDown() & KEY_L)) {
 		indyFightRight = false;
@@ -864,22 +877,28 @@
 		indyFightRight = true;
 	}
 
-	if ((getKeysDown() & KEY_UP)) {
+	consolePrintf("ifr:%d\n", indyFightRight);
+
+	if ((getKeysChanged() & KEY_UP)) {
+		event.type = getKeyEvent(KEY_UP);
 		event.kbd.keycode = '8';
 		event.kbd.ascii = '8';
 		system->addEvent(event);
 	}
-	if ((getKeysDown() & KEY_LEFT)) {
+	if ((getKeysChanged() & KEY_LEFT)) {
+		event.type = getKeyEvent(KEY_LEFT);
 		event.kbd.keycode = '4';
 		event.kbd.ascii = '4';
 		system->addEvent(event);
 	}
-	if ((getKeysDown() & KEY_RIGHT)) {
+	if ((getKeysChanged() & KEY_RIGHT)) {
+		event.type = getKeyEvent(KEY_RIGHT);
 		event.kbd.keycode = '6';
 		event.kbd.ascii = '6';
 		system->addEvent(event);
 	}	
-	if ((getKeysDown() & KEY_DOWN)) {
+	if ((getKeysChanged() & KEY_DOWN)) {
+		event.type = getKeyEvent(KEY_DOWN);
 		event.kbd.keycode = '2';
 		event.kbd.ascii = '2';
 		system->addEvent(event);
@@ -887,17 +906,20 @@
 	
 	if (indyFightRight) {
 	
-		if ((getKeysDown() & KEY_X)) {
+		if ((getKeysChanged() & KEY_X)) {
+			event.type = getKeyEvent(KEY_X);
 			event.kbd.keycode = '9';
 			event.kbd.ascii = '9';
 			system->addEvent(event);
 		}
-		if ((getKeysDown() & KEY_A)) {
+		if ((getKeysChanged() & KEY_A)) {
+			event.type = getKeyEvent(KEY_A);
 			event.kbd.keycode = '6';
 			event.kbd.ascii = '6';
 			system->addEvent(event);
 		}
-		if ((getKeysDown() & KEY_B)) {
+		if ((getKeysChanged() & KEY_B)) {
+			event.type = getKeyEvent(KEY_B);
 			event.kbd.keycode = '3';
 			event.kbd.ascii = '3';
 			system->addEvent(event);
@@ -905,17 +927,20 @@
 
 	} else {
 
-		if ((getKeysDown() & KEY_X)) {
+		if ((getKeysChanged() & KEY_X)) {
+			event.type = getKeyEvent(KEY_X);
 			event.kbd.keycode = '7';
 			event.kbd.ascii = '7';
 			system->addEvent(event);
 		}
-		if ((getKeysDown() & KEY_A)) {
+		if ((getKeysChanged() & KEY_A)) {
+			event.type = getKeyEvent(KEY_A);
 			event.kbd.keycode = '4';
 			event.kbd.ascii = '4';
 			system->addEvent(event);
 		}
-		if ((getKeysDown() & KEY_B)) {
+		if ((getKeysChanged() & KEY_B)) {
+			event.type = getKeyEvent(KEY_B);
 			event.kbd.keycode = '1';
 			event.kbd.ascii = '1';
 			system->addEvent(event);
@@ -924,7 +949,8 @@
 	}
 	
 	
-	if ((getKeysDown() & KEY_Y)) {
+	if ((getKeysChanged() & KEY_Y)) {
+		event.type = getKeyEvent(KEY_Y);
 		event.kbd.keycode = '5';
 		event.kbd.ascii = '5';
 		system->addEvent(event);
@@ -967,8 +993,10 @@
 		if (displayModeIs8Bit) {
 			// Copy the sub screen VRAM from the top screen - they should always be
 			// the same.
+			u16* buffer = get8BitBackBuffer();
+
 			for (int r = 0; r < (512 * 256) >> 1; r++) {
-				BG_GFX_SUB[r] = get8BitBackBuffer()[r];
+				BG_GFX_SUB[r] = buffer[r];
 			}
 			
 			SUB_DISPLAY_CR &= ~DISPLAY_BG1_ACTIVE;	// Turn off keyboard layer
@@ -1024,14 +1052,12 @@
 
 			if (!indyFightState) {
 
-				
-				if ((getKeysDown() & KEY_B) && (!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) {
-		//			consolePrintf("Pressing Esc");
-		
-					event.type = Common::EVENT_KEYDOWN;
+				if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) {	
 					event.kbd.keycode = 27;		
 					event.kbd.ascii = 27;		
 					event.kbd.flags = 0;
+
+					event.type = getKeyEvent(KEY_B);
 					system->addEvent(event);
 				}
 		
@@ -1149,7 +1175,7 @@
 				}
 			}
 			
-			if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))  && (displayModeIs8Bit)) {
+			if (((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) || (indyFightState))  && (displayModeIs8Bit)) {
 				// Controls specific to the control method
 			
 			
@@ -1163,10 +1189,10 @@
 
 				if (currentGame->control == CONT_SIMON) {
 					// Extra controls for Simon the Sorcerer
-					if ((getKeysDown() & KEY_DOWN)) {
+					if ((getKeysChanged() & KEY_DOWN)) {
 						Common::Event event;
 					
-						event.type = Common::EVENT_KEYDOWN;
+						event.type = getKeyEvent(KEY_DOWN);
 						event.kbd.keycode = '#';		// F10 or # - show hotspots
 						event.kbd.ascii = '#';
 						event.kbd.flags = 0;
@@ -1177,10 +1203,10 @@
 	
 				if (currentGame->control == CONT_SCUMM_ORIGINAL) {
 					// Extra controls for Scumm v1-5 games
-					if ((getKeysDown() & KEY_DOWN)) {
+					if ((getKeysChanged() & KEY_DOWN)) {
 						Common::Event event;
 					
-						event.type = Common::EVENT_KEYDOWN;
+						event.type = getKeyEvent(KEY_DOWN);
 						event.kbd.keycode = '.';		// Full stop - skips current dialogue line
 						event.kbd.ascii = '.';
 						event.kbd.flags = 0;
@@ -1199,55 +1225,39 @@
 		if (!displayModeIs8Bit) {
 			// Front end controls
 			
-			if (leftHandedSwap(getKeysDown()) & KEY_UP) {
-				event.type = Common::EVENT_KEYDOWN;
+			if (leftHandedSwap(getKeysChanged()) & KEY_UP) {
+				event.type = getKeyEvent(leftHandedSwap(KEY_UP));
 				event.kbd.keycode = SDLK_UP;
 				event.kbd.ascii = 0;
 				event.kbd.flags = 0;
 				system->addEvent(event);
-
-				event.type = Common::EVENT_KEYUP;
-				system->addEvent(event);
 			}
 
-			if (leftHandedSwap(getKeysDown()) & KEY_DOWN) {
-				event.type = Common::EVENT_KEYDOWN;
+			if (leftHandedSwap(getKeysChanged()) & KEY_DOWN) {
+				event.type = getKeyEvent(leftHandedSwap(KEY_DOWN));
 				event.kbd.keycode = SDLK_DOWN;
 				event.kbd.ascii = 0;
 				event.kbd.flags = 0;
 				system->addEvent(event);
-
-				event.type = Common::EVENT_KEYUP;
-				system->addEvent(event);
 			}
 
 			if (leftHandedSwap(getKeysDown()) & KEY_A) {
-				event.type = Common::EVENT_KEYDOWN;
+				event.type = getKeyEvent(leftHandedSwap(KEY_A));
 				event.kbd.keycode = SDLK_RETURN;
 				event.kbd.ascii = 0;
 				event.kbd.flags = 0;
 				system->addEvent(event);
-
-				event.type = Common::EVENT_KEYUP;
-				system->addEvent(event);
 			}
 		
 		}
 
 		
-		if ((getKeysDown() & KEY_START)) {
-			event.type = Common::EVENT_KEYDOWN;
+		if ((getKeysChanged() & KEY_START)) {
+			event.type = getKeyEvent(KEY_START);
 			event.kbd.keycode = 319;		// F5
 			event.kbd.ascii = 319;
 			event.kbd.flags = 0;
 			system->addEvent(event);
-/*
-			event.type = Common::EVENT_KEYUP;
-			event.kbd.keycode = 319;		// F5
-			event.kbd.ascii = 319;
-			system->addEvent(event);*/
-			
-//			consolePrintf("Pressing F5");
 		}
 
 		
@@ -1262,17 +1272,31 @@
 	}
 }
 
+
+		
+void triggerIcon(int imageNum) {
+	triggeredIcon = imageNum;
+	triggeredIconTimeout = 120;	
+}
+	
+
+void setIcon(int num, int x, int y, int imageNum, int flags, bool enable) {
+	sprites[num].attribute[0] = ATTR0_BMP | y | (!enable? ATTR0_DISABLED: 0); 
+	sprites[num].attribute[1] = ATTR1_SIZE_32 | x | flags;
+	sprites[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16);
+}
+
 void updateStatus() {
 	int offs;
 
 	if (displayModeIs8Bit) {
 		switch (mouseMode) {
 			case MOUSE_LEFT: {
-				offs = 16;
+				offs = 1;
 				break;
 			}
 			case MOUSE_RIGHT: {
-				offs = 32;
+				offs = 2;
 				break;
 			}
 			case MOUSE_HOVER: {
@@ -1286,25 +1310,28 @@
 			}
 		}
 	
-		
-		sprites[0].attribute[0] = ATTR0_BMP | 150; 
-		sprites[0].attribute[1] = ATTR1_SIZE_32 | 208;
-		sprites[0].attribute[2] = ATTR2_ALPHA(1)| offs;
+		setIcon(0, 208, 150, offs, 0, true);
 	
 		if (indyFightState) {
-			sprites[2].attribute[0] = ATTR0_BMP | 150; 
-			sprites[2].attribute[1] = ATTR1_SIZE_32 | (190 - 32) | (indyFightRight? 0: ATTR1_FLIP_X);
-			sprites[2].attribute[2] = ATTR2_ALPHA(1)| 48;
+			setIcon(1, (190 - 32), 150, 3, (indyFightRight? 0: ATTR1_FLIP_X), true);
+			consolePrintf("%d\n", indyFightRight);
 		} else {
-			sprites[2].attribute[0] = ATTR0_DISABLED; 
-			sprites[2].attribute[1] = 0;
-			sprites[2].attribute[2] = 0;
+//			setIcon(1, 0, 0, 0, 0, false);
 		}
+		
+		if (triggeredIconTimeout > 0) {
+			triggeredIconTimeout--;
+			setIcon(4, 16, 150, triggeredIcon, 0, true);
+		} else {
+			setIcon(4, 0, 0, 0, 0, false);
+		}
+		
 	} else {
-		sprites[0].attribute[0] = ATTR0_DISABLED; 
-		sprites[1].attribute[0] = ATTR0_DISABLED; 
-		sprites[2].attribute[0] = ATTR0_DISABLED; 
-		sprites[3].attribute[0] = ATTR0_DISABLED; 
+		setIcon(0, 0, 0, 0, 0, false);
+		setIcon(1, 0, 0, 0, 0, false);
+		setIcon(2, 0, 0, 0, 0, false);
+		setIcon(3, 0, 0, 0, 0, false);
+		setIcon(4, 0, 0, 0, 0, false);
 	}
 
 	if ((keyboardIcon) && (!keyboardEnable) && (!displayModeIs8Bit)) {
@@ -1372,15 +1399,15 @@
 	}
 }
 
-void setZoomedScreenScroll(int x, int y) {
+void setZoomedScreenScroll(int x, int y, bool shake) {
 	if (gameScreenSwap) {
-		BG3_CX = x + (((frameCount & 1) == 0)? 64: 0);
+		BG3_CX = x + ((shake && ((frameCount & 1) == 0))? 64: 0);
 		BG3_CY = y;
 		
 		touchX = x >> 8;
 		touchY = y >> 8;
 	} else {
-		SUB_BG3_CX = x + (((frameCount & 1) == 0)? 64: 0);
+		SUB_BG3_CX = x + ((shake && (frameCount & 1) == 0)? 64: 0);
 		SUB_BG3_CY = y;
 	}
 }
@@ -1505,29 +1532,62 @@
 
 	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 += 2;
+			subScreenScale += 1;
+			zooming = true;
 		}
 		
 		if ((getKeysHeld() & KEY_B) && (subScreenScale > 128)) {
-			subScreenScale -=2;
+			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_WIDTH * subScreenScale >> 8;
+		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(0);
+			}
+		} else if ( ((subScreenWidth) > 128 - 8) && ((subScreenWidth) < 128 + 8) ) {
+			subScreenWidth = 128;
+			subScreenHeight = 96;
+			if (zooming) {
+				subScX = subScTargetX;
+				subScY = subScTargetY;
+				triggerIcon(1);
+			}
+		} else if (subScreenWidth > 256) {
+			subScreenWidth = 320;
+			subScreenHeight = 200;
+			if (zooming) {
+				subScX = subScTargetX;
+				subScY = subScTargetY;
+				triggerIcon(2);
+			}
+		} else {
+			triggerIcon(-1);
+		}
 	}
 	
+
 	subScTargetX = xCenter - ((subScreenWidth >> 1) << 8);
 	subScTargetY = yCenter - ((subScreenHeight >> 1) << 8);
 	
@@ -1595,8 +1655,8 @@
 				scY = 0;
 			}
 			
-			setZoomedScreenScroll(subScX, subScY);
-			setZoomedScreenScale(subScreenWidth, (subScreenHeight * 256) / 192);
+			setZoomedScreenScroll(subScX, subScY, (subScreenWidth != 256) && (subScreenWidth != 128));
+			setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8);
 	
 		
 			setMainScreenScroll(scX << 8, (scY << 8) + (shakePos << 8));
@@ -1612,15 +1672,15 @@
 				scY = 0;
 			}
 		
-			setZoomedScreenScroll(subScX, subScY);
-			setZoomedScreenScale(subScreenWidth, (subScreenHeight * 256) / 192);
+			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);
+		setZoomedScreenScroll(0, 0, true);
 		setZoomedScreenScale(320, 256);
 
 		setMainScreenScroll(0, 0);
@@ -1794,7 +1854,7 @@
 	}
 
 	WAIT_CR &= ~(0x0080);
-	REG_WRAM_CNT = 0;
+//	REG_WRAM_CNT = 0;
 
 }
 
@@ -1903,6 +1963,7 @@
 	scanKeys();
 	keysDownSaved |= leftHandedSwap(keysDown());
 	keysReleasedSaved |= leftHandedSwap(keysUp());
+	keysChangedSaved = keysDownSaved | keysReleasedSaved;
 }
 
 int getKeysDown() {
@@ -1917,9 +1978,24 @@
 	return keysReleasedSaved;
 }
 
+int getKeysChanged() {
+	return keysChangedSaved;
+}
+
+Common::EventType getKeyEvent(int key) {
+	if (getKeysDown() & key) {
+		return Common::EVENT_KEYDOWN;
+	} else if (getKeysReleased() & key) {
+		return Common::EVENT_KEYUP;
+	} else {
+		return (Common::EventType) 0;
+	}
+}
+
 void consumeKeys() {
 	keysDownSaved = 0;
 	keysReleasedSaved = 0;
+	keysChangedSaved = 0;
 }
 
 bool getPenDown() {
@@ -1992,6 +2068,26 @@
 	return indyFightState;
 }
 
+///////////////////
+// Fast Ram
+///////////////////
+
+#define FAST_RAM_SIZE (30000)
+
+u8* fastRamPointer;
+u8 fastRamData[FAST_RAM_SIZE] ITCM_DATA;
+
+void* fastRamAlloc(int size) {
+	void* result = (void *) fastRamPointer;
+	fastRamPointer += size;
+	return (void *) (result);
+}
+
+void fastRamReset() {
+	fastRamPointer = fastRamData;
+}
+
+
 /////////////////
 // GBAMP
 /////////////////
@@ -2153,6 +2249,7 @@
 	indyFightState = false;
 	indyFightRight = true;
 
+
 	// CPU speed = 67108864
 	// 8 frames = 2946   368.5 bytes per fr
 
@@ -2358,6 +2455,8 @@
 	char* argv[2] = {"/scummvmds", "--config=scummvmb.ini"};
 #elif defined(DS_BUILD_C)
 	char* argv[2] = {"/scummvmds", "--config=scummvmc.ini"};
+#elif defined(DS_BUILD_D)
+	char* argv[2] = {"/scummvmds", "--config=scummvmd.ini"};
 #endif
 
 

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h	2007-04-06 18:34:53 UTC (rev 26394)
@@ -116,6 +116,11 @@
 int		getGameWidth();
 int		getGameHeight();
 
+// Fast RAM allocation (ITCM)
+void	fastRamReset();
+void*	fastRamAlloc(int size);
+
+
 }
 
 

Modified: scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.c
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.c	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm9/source/fat/disc_io.c	2007-04-06 18:34:53 UTC (rev 26394)
@@ -358,10 +358,10 @@
 bool disc_setDsSlotInterface (void)
 {
 #ifdef ARM9
-	WAIT_CR &= ~(1<<11);
+	REG_EXEMEMCNT &= ~(1<<11);
 #endif
 #ifdef ARM7
-	WAIT_CR |= (1<<11);
+	REG_EXEMEMCNT |= (1<<11);
 #endif
 
 	active_interface = DLDI_GetInterface();

Modified: scummvm/trunk/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/fat/gba_nds_fat.c	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm9/source/fat/gba_nds_fat.c	2007-04-06 18:34:53 UTC (rev 26394)
@@ -22,7 +22,8 @@
 #include "disc_io.h"
 #include <string.h>
 #ifdef NDS
- #include <nds/ipc.h>	// Time on the NDS
+// #include <nds/ipc.h>	// Time on the NDS
+ #include <NDS/scummvm_ipc.h>
 #endif
 //----------------------------------------------------------------
 // Data	types

Modified: scummvm/trunk/backends/platform/ds/arm9/source/fat/io_dldi.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/fat/io_dldi.h	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm9/source/fat/io_dldi.h	2007-04-06 18:34:53 UTC (rev 26394)
@@ -19,6 +19,7 @@
 #include "disc_io.h"
 #ifdef NDS
 #include <nds/memory.h>
+#include <nds.h>
 #endif
 
 extern IO_INTERFACE _io_dldi;
@@ -28,7 +29,8 @@
 // export interface
 static inline LPIO_INTERFACE DLDI_GetInterface(void) {
 #ifdef NDS
-	WAIT_CR &= ~(ARM9_OWNS_ROM | ARM9_OWNS_CARD);
+	// NDM: I'm really not sure about this change ARM9 - ARM7
+	REG_EXEMEMCNT &= ~(ARM7_OWNS_ROM | ARM7_OWNS_CARD);
 #endif // defined NDS
 	return &_io_dldi;
 }

Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp	2007-04-06 18:34:53 UTC (rev 26394)
@@ -320,9 +320,11 @@
 			event.kbd.ascii = 0;
 			event.kbd.keycode = 0;
 			event.kbd.flags = 0;
+			consolePrintf("type: %d\n", event.type);
 			return false;
 		} else {
 			event = eventQueue[eventNum++];
+			consolePrintf("type: %d\n", event.type);
 			return true;
 		}
 	}

Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.h	2007-04-06 18:34:53 UTC (rev 26394)
@@ -22,6 +22,7 @@
 #ifndef _OSYSTEM_DS_H_
 #define _OSYSTEM_DS_H_
 #include "common/system.h"
+#include "common/events.h"
 #include "nds.h"
 #include "ramsave.h"
 #include "gbampsave.h"

Modified: scummvm/trunk/backends/platform/ds/arm9/source/portdefs.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/portdefs.cpp	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm9/source/portdefs.cpp	2007-04-06 18:34:53 UTC (rev 26394)
@@ -18,7 +18,7 @@
  *
  */
 
-#include "portdefs.h"
+#include "stdafx.h"
 #include <string.h>
 #include "nds/dma.h"
 #include "osystem_ds.h"

Modified: scummvm/trunk/backends/platform/ds/arm9/source/portdefs.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/portdefs.h	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm9/source/portdefs.h	2007-04-06 18:34:53 UTC (rev 26394)
@@ -33,11 +33,32 @@
 
 //#define double float
 
+// Somebody removed these from scummsys.h, but they're still required, so I'm adding them here
+// in the hope that they'll stay.
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <math.h>
+#include <time.h>
+
+
 #define CT_NO_TRANSPARENCY
+#include "scummconsole.h"
 
+
+
+//#undef assert
+//#define assert(expr) consolePrintf("Asserted!")
+#define NO_DEBUG_MSGS
+
+#ifdef assert
 #undef assert
-#define assert(expr) consolePrintf("Asserted!")
-//#define NO_DEBUG_MSGS
+#endif
+
+#define assert(s) if (!(s)) consolePrintf("Assertion failed: '##s##' at file %s, line %d\n", __FILE__, __LINE__)
+
 #include "ds-fs.h"
 
 //#define debug(fmt, ...) consolePrintf(fmt, ##__VA_ARGS__)
@@ -45,6 +66,13 @@
 #define time(t) DS_time(t)
 //#define memcpy(dest, src, size) DS_memcpy(dest, src, size)
 
+#define ITCM_DATA	__attribute__((section(".itcm")))
+
+
+
+#include "common/array.h"
+#include "common/str.h"
+
 time_t DS_time(time_t* t);
 time_t DS_time(long* t);
 void* DS_memcpy(void* s1, void const* s2, size_t n);

Modified: scummvm/trunk/backends/platform/ds/arm9/source/scummconsole.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/scummconsole.h	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm9/source/scummconsole.h	2007-04-06 18:34:53 UTC (rev 26394)
@@ -38,68 +38,7 @@
 extern "C" {
 #endif
 
-void consoleInit(u16* font, u16* charBase, u16 numCharacters, u8 charStart, u16* map, u8 pal, u8 bitDepth);
-void consoleInitDefault(u16* map, u16* charBase, u8 bitDepth);
 
-void consolePrintf(const char* s, ...);
-
-void consolePrintSet(int x, int y);
-
-void consolePrintChar(char c);
-
-void consolePutString(int x, int y, char* s);
-void consolePutInt(int x, int y, int d);
-void consolePutX(int x, int y, int d);
-void consolePutChar(int x, int y, char c);
-void consolePutBin(int x, int y, int b);
-
-void consoleClear(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-//////////////////////////////////////////////////////////////////////
-//
-// consol.h --provides basic consol type print functionality
-//
-// version 0.1, February 14, 2005
-//
-//  Copyright (C) 2005 Michael Noland (joat) and Jason Rogers (dovoto)
-//
-//  This software is provided 'as-is', without any express or implied
-//  warranty.  In no event will the authors be held liable for any
-//  damages arising from the use of this software.
-//
-//  Permission is granted to anyone to use this software for any
-//  purpose, including commercial applications, and to alter it and
-//  redistribute it freely, subject to the following restrictions:
-//
-//  1. The origin of this software must not be misrepresented; you
-//     must not claim that you wrote the original software. If you use
-//     this software in a product, an acknowledgment in the product
-//     documentation would be appreciated but is not required.
-//  2. Altered source versions must be plainly marked as such, and
-//     must not be misrepresented as being the original software.
-//  3. This notice may not be removed or altered from any source
-//     distribution.
-//
-// Changelog:
-//   0.1: First version
-//	 0.2: Fixed sprite mapping bug.  1D mapping should work now.  
-//			Changed some register defines for consistency.
-//
-//////////////////////////////////////////////////////////////////////
-#ifndef CONSOLE_H2
-#define CONSOLE_H2
-
-#define CONSOLE_USE_COLOR255 16
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 void consoleInit(u16* font, u16* charBase, u16 numCharacters, u8 charStart, u16* map, u8 pal, u8 bitDepth);
 void consoleInitDefault(u16* map, u16* charBase, u8 bitDepth);
 
@@ -122,3 +61,4 @@
 #endif
 
 #endif
+

Modified: scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp	2007-04-06 18:34:53 UTC (rev 26394)
@@ -131,13 +131,13 @@
 bool closed;
 
 void restoreVRAM(int tileBase, int mapBase, u16* saveSpace) {
-	for (int r = 0; r < 32 * 32; r++) {
+/*	for (int r = 0; r < 32 * 32; r++) {
 		((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r] = *saveSpace++;
 	}
 	
 	for (int r = 0; r < 4096; r++) {
 		((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r]	= *saveSpace++;
-	}
+	}*/
 }
 
 void drawKeyboard(int tileBase, int mapBase, u16* saveSpace) {

Modified: scummvm/trunk/common/file.cpp
===================================================================
--- scummvm/trunk/common/file.cpp	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/common/file.cpp	2007-04-06 18:34:53 UTC (rev 26394)
@@ -70,16 +70,6 @@
 	//#undef getc
 	//#undef ferror
 	
-	#define FILE void
-	
-	FILE* 	std_fopen(const char* name, const char* mode);
-	void 	std_fclose(FILE* handle);
-	size_t 	std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle);
-	size_t 	std_fwrite(const void* ptr, size_t size, size_t numItems, FILE* handle);
-	bool 	std_feof(FILE* handle);
-	long int std_ftell(FILE* handle);
-	int 	std_fseek(FILE* handle, long int offset, int whence);
-	void 	std_clearerr(FILE* handle);
 
 	//void 	std_fprintf(FILE* handle, const char* fmt, ...);	// used in common/util.cpp
 	//void 	std_fflush(FILE* handle);	// used in common/util.cpp

Modified: scummvm/trunk/engines/agi/text.cpp
===================================================================
--- scummvm/trunk/engines/agi/text.cpp	2007-04-06 18:29:55 UTC (rev 26393)
+++ scummvm/trunk/engines/agi/text.cpp	2007-04-06 18:34:53 UTC (rev 26394)
@@ -35,7 +35,14 @@
 	int maxx, minx, ofoff;
 	int update;
 	/* Note: Must be unsigned to use AGDS cyrillic characters! */
+#ifdef __DS__
+	// On the DS, a compiler bug causes the text to render incorrectly, because
+	// GCC tries to optimisie out writes to this pointer (tested on DevkitARM v19b and v20)
+	// Making this pointer volatile fixes this.
+	volatile const unsigned char *m;
+#else
 	const unsigned char *m;
+#endif
 
 	/* kludge! */
 	update = 1;
@@ -81,6 +88,7 @@
 				}
 
 				x1++;
+				
 				/* DF: changed the len-1 to len... */
 				if (x1 == len && m[1] != '\n')
 					y1++, x1 = foff = 0;


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