[Scummvm-cvs-logs] SF.net SVN: scummvm:[48136] scummvm/trunk/backends/platform/ds

agent-q at users.sourceforge.net agent-q at users.sourceforge.net
Fri Feb 26 18:29:38 CET 2010


Revision: 48136
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48136&view=rev
Author:   agent-q
Date:     2010-02-26 17:29:18 +0000 (Fri, 26 Feb 2010)

Log Message:
-----------
DS: Merging accross changes from branch1-0-0 into trunk.

Modified Paths:
--------------
    scummvm/trunk/backends/platform/ds/Makefile
    scummvm/trunk/backends/platform/ds/arm9/Makefile
    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/osystem_ds.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.h
    scummvm/trunk/backends/platform/ds/logoa.bmp
    scummvm/trunk/backends/platform/ds/logob.bmp
    scummvm/trunk/backends/platform/ds/logoc.bmp
    scummvm/trunk/backends/platform/ds/logod.bmp
    scummvm/trunk/backends/platform/ds/logoe.bmp
    scummvm/trunk/backends/platform/ds/logof.bmp
    scummvm/trunk/backends/platform/ds/logog.bmp

Added Paths:
-----------
    scummvm/trunk/backends/platform/ds/logoh.bmp
    scummvm/trunk/backends/platform/ds/logoi.bmp
    scummvm/trunk/backends/platform/ds/logoj.bmp
    scummvm/trunk/backends/platform/ds/logok.bmp

Modified: scummvm/trunk/backends/platform/ds/Makefile
===================================================================
--- scummvm/trunk/backends/platform/ds/Makefile	2010-02-26 16:17:12 UTC (rev 48135)
+++ scummvm/trunk/backends/platform/ds/Makefile	2010-02-26 17:29:18 UTC (rev 48136)
@@ -38,6 +38,10 @@
 	$(MAKE) all       SCUMM_BUILD=g
 	$(MAKE) semiclean
 	$(MAKE) all       SCUMM_BUILD=h
+	$(MAKE) semiclean
+	$(MAKE) all       SCUMM_BUILD=i
+	$(MAKE) semiclean
+	$(MAKE) all       SCUMM_BUILD=k
 
 allbuildssafe:
 	$(MAKE) clean     SCUMM_BUILD=a
@@ -56,3 +60,7 @@
 	$(MAKE) all       SCUMM_BUILD=g
 	$(MAKE) clean     SCUMM_BUILD=h
 	$(MAKE) all       SCUMM_BUILD=h
+	$(MAKE) clean     SCUMM_BUILD=i
+	$(MAKE) all       SCUMM_BUILD=i
+	$(MAKE) clean     SCUMM_BUILD=k
+	$(MAKE) all       SCUMM_BUILD=k

Modified: scummvm/trunk/backends/platform/ds/arm9/Makefile
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/Makefile	2010-02-26 16:17:12 UTC (rev 48135)
+++ scummvm/trunk/backends/platform/ds/arm9/Makefile	2010-02-26 17:29:18 UTC (rev 48136)
@@ -8,31 +8,38 @@
 # Select the build by setting SCUMM_BUILD to a,b,c,d,e,f or g.
 # Anything else gets build a.
 
-ifeq ($(SCUMM_BUILD),i)
+ifeq ($(SCUMM_BUILD),k)
+	DS_BUILD_K = 1
+else
+ ifeq ($(SCUMM_BUILD),j)
+ 	DS_BUILD_J = 1
+ else
+  ifeq ($(SCUMM_BUILD),i)
         DS_BUILD_I = 1
-else
- ifeq ($(SCUMM_BUILD),h)
-         DS_BUILD_H = 1
   else
-   ifeq ($(SCUMM_BUILD),g)
+   ifeq ($(SCUMM_BUILD),h)
+          DS_BUILD_H = 1
+   else
+    ifeq ($(SCUMM_BUILD),g)
          DS_BUILD_G = 1
-   else
-    ifeq ($(SCUMM_BUILD),f)
+    else
+     ifeq ($(SCUMM_BUILD),f)
          DS_BUILD_F = 1
-    else
-     ifeq ($(SCUMM_BUILD),e)
+     else
+      ifeq ($(SCUMM_BUILD),e)
          DS_BUILD_E = 1
-     else
-      ifeq ($(SCUMM_BUILD),d)
+      else
+       ifeq ($(SCUMM_BUILD),d)
          DS_BUILD_D = 1
-      else
-       ifeq ($(SCUMM_BUILD),c)
+       else
+        ifeq ($(SCUMM_BUILD),c)
          DS_BUILD_C = 1
-       else
-        ifeq ($(SCUMM_BUILD),b)
+        else
+         ifeq ($(SCUMM_BUILD),b)
          DS_BUILD_B = 1
-        else
-         DS_BUILD_A = 1
+         else
+          DS_BUILD_A = 1
+         endif
         endif
        endif
       endif
@@ -41,6 +48,7 @@
    endif
   endif
  endif
+endif
 # To do:
 # - FAT cache?
 
@@ -58,9 +66,18 @@
 	# TODO: Inherit the earth uses so much RAM that I have removed libmad in order to
 	# claw some back.
 
+	
 
 	else
-		USE_MAD = 1
+		ifdef DS_BUILD_I
+
+		else
+			ifdef DS_BUILD_K
+
+			else
+				USE_MAD = 1
+			endif
+		endif
 	endif
 endif
 
@@ -150,28 +167,51 @@
 
 ifdef DS_BUILD_H
 	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_H
-	LOGO = logog.bmp
+	LOGO = logoh.bmp
 	ENABLE_PARALLACTION = STATIC_PLUGIN
 	BUILD=scummvm-H
 endif
 
 ifdef DS_BUILD_I
-	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_H
-	LOGO = logog.bmp
-	ENABLE_TUCKER = STATIC_PLUGIN
-	BUILD=scummvm-H
+	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_I
+	LOGO = logoi.bmp
+	ENABLE_MADE = STATIC_PLUGIN
+	BUILD=scummvm-I
 endif
 
+ifdef DS_BUILD_K
+	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_K
+	LOGO = logok.bmp
+	ENABLE_CRUISE = STATIC_PLUGIN
+	BUILD=scummvm-K
+endif
+
+
+#ifdef DS_BUILD_L
+#	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_L
+#	LOGO = logog.bmp
+#	ENABLE_DRASCULA = STATIC_PLUGIN
+#	BUILD=scummvm-K
+#endif
+
+#ifdef DS_BUILD_M
+#	DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_M
+#	LOGO = logog.bmp
+#	ENABLE_TUCKER = STATIC_PLUGIN
+#	BUILD=scummvm-K
+#endif
+
 ARM7BIN	:= -7 $(CURDIR)/../../arm7/arm7.bin
 ICON		:= -b ../../../logo.bmp "ScummVM;By Neil Millstone;"
 
 CC      = arm-eabi-gcc
 CXX     = arm-eabi-g++
+LD	= arm-eabi-g++
 
 CFLAGS	=	-Wno-multichar -Wall\
 		-Wno-multichar -mcpu=arm9tdmi -mtune=arm9tdmi \
 		-mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer\
-		-mthumb-interwork -DUSE_ARM_COSTUME_ASM=1
+		-mthumb-interwork -DUSE_ARM_COSTUME_ASM=1 -DDISABLE_SID
 
 
 # -ffast-math
@@ -187,7 +227,7 @@
 endif
 
 CXXFLAGS=	$(CFLAGS) -Wno-non-virtual-dtor -Wno-unknown-pragmas -Wno-reorder  \
-		-fno-exceptions -fno-rtti -mthumb-interwork -ffunction-sections -fdata-sections
+		-fno-exceptions -fno-rtti -mthumb-interwork -ffunction-sections -fdata-sections -fno-strict-aliasing
 
 #		-mthumb
 
@@ -293,13 +333,20 @@
 #$(portdir)/source/libcartreset/cartreset.o
 
 # Files in this list will be optimisied for speed, otherwise they will be optimised for space
-OPTLIST := actor.cpp ds_main.cpp osystem_ds.cpp blitters.cpp mame.cpp rate.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.cpp
+OPTLIST := actor.cpp ds_main.cpp osystem_ds.cpp blitters.cpp mame.cpp rate.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.cpp script.cpp
 #OPTLIST :=
 
 # Compiler options for files which should be optimised for speed
-OPT_SPEED := -O3
-#OPT_SPEED := -Os -mthumb
+ifdef DS_BUILD_E
+# Another attempt to save some RAM in ITE
+OPT_SPEED := -O3 -mthumb
+else
+#OPT_SPEED := -O3
 
+OPT_SPEED := -Os -mthumb
+
+endif
+
 # Compiler options for files which should be optimised for space
 OPT_SIZE := -Os -mthumb
 
@@ -315,7 +362,7 @@
 
 ndsall:
 	@[ -d $(BUILD) ] || mkdir -p $(BUILD)
-	$(MAKE) -C ./$(BUILD) -f ../Makefile scummvm.nds
+	make -C ./$(BUILD) -f ../makefile scummvm.nds
 
 include $(srcdir)/Makefile.common
 

Modified: scummvm/trunk/backends/platform/ds/arm9/source/cdaudio.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/cdaudio.cpp	2010-02-26 16:17:12 UTC (rev 48135)
+++ scummvm/trunk/backends/platform/ds/arm9/source/cdaudio.cpp	2010-02-26 17:29:18 UTC (rev 48136)
@@ -137,18 +137,21 @@
 
 	char str[100];
 
-	if (path[strlen(path.c_str()) - 1] == '/') {
-		sprintf(str, "track%d.wav", track);
-		path = path + str;
-	} else {
-		sprintf(str, "/track%d.wav", track);
-		path = path + str;
+	if (path[strlen(path.c_str()) - 1] != '/') {
+		path = path + "/";
 	}
 
+	Common::String fname;
 
-	//1820160
+	sprintf(str, "track%d.wav", track);
+	fname = path + str;
+	file = DS::std_fopen(fname.c_str(), "rb");
 
-	file = DS::std_fopen(path.c_str(), "rb");
+	if (!file) {
+		sprintf(str, "track%02d.wav", track);
+		fname = path + str;
+		file = DS::std_fopen(fname.c_str(), "rb");
+	}
 
 	if (!file) {
 		consolePrintf("Failed to open %s!\n", path.c_str());
@@ -158,6 +161,8 @@
 
 	DS::std_fread((const void *) &waveHeader, sizeof(waveHeader), 1, file);
 
+	consolePrintf("File: %s\n", fname.c_str());
+
 	consolePrintf("Playing track %d\n", track);
 	consolePrintf("Format: %d\n", waveHeader.fmtFormatTag);
 	consolePrintf("Rate  : %d\n", waveHeader.fmtSamPerSec);
@@ -496,7 +501,27 @@
 		setActive(true);
 		DS::std_fclose(file);
 		return true;
+	}
+
+	sprintf(fname, "track%02d.wav", num);
+
+	 path = ConfMan.get("path");
+
+	if (path[strlen(path.c_str()) - 1] == '/') {
+		path = path + fname;
 	} else {
+		path = path + "/" + fname;
+	}
+
+	consolePrintf("Looking for %s...", path.c_str());
+
+
+	if ((file = DS::std_fopen(path.c_str(), "r"))) {
+		consolePrintf("Success!\n");
+		setActive(true);
+		DS::std_fclose(file);
+		return true;
+	} else {
 		setActive(false);
 		consolePrintf("Failed!\n");
 		return false;

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp	2010-02-26 16:17:12 UTC (rev 48135)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp	2010-02-26 17:29:18 UTC (rev 48136)
@@ -117,17 +117,20 @@
 
 extern "C" void* __real_malloc(size_t size);
 
+int total = 0;
+
 void* operator new (size_t size)
 {
 	register unsigned int reg asm("lr");
 	volatile unsigned int poo = reg;
 
 	void* res = __real_malloc(size);
+	total += size;
 
 	if (!res)
 	{
 //		*((u8 *) NULL) = 0;
-		consolePrintf("Failed alloc (new) %d (%x)\n", size, poo);
+		consolePrintf("Failed alloc (new) %d (%d)\n", size, total);
 		return NULL;
 	}
 
@@ -155,18 +158,20 @@
 
 	void* res = __real_malloc(size);
 	if (res) {
-		if (size > 100 * 1024) {
-			consolePrintf("Allocated %d (%d)\n", size, poo);
+		if (size > 50 * 1024) {
+			consolePrintf("Allocated %d (%x)\n", size, poo);
 		}
+		total += size;
 		return res;
 	} else {
 
 //		*((u8 *) NULL) = 0;
-		consolePrintf("Failed alloc %d (%x)\n", size, poo);
+		consolePrintf("Failed alloc %d (%d)\n", size, total);
 		return NULL;
 	}
 }
 
+
 #endif
 
 namespace DS {
@@ -545,7 +550,23 @@
 	return soundFrequency;
 }
 
+void setControls(char* gameName) {
 
+	for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) {
+		if (!stricmp(gameName, gameList[r].gameId)) {
+			currentGame = &gameList[r];
+			consolePrintf("Current game set to: %s\n", gameName);
+			return;
+		}
+	}
+
+	consolePrintf("Failed to set current game to: %s\n", gameName);
+}
+
+void exitGame() {
+	currentGame = NULL;
+}
+
 void initGame() {
 	// This is a good time to check for left handed mode since the mode change is done as the game starts.
 	// There's probably a better way, but hey.
@@ -558,15 +579,18 @@
 	setOptions();
 
 	//strcpy(gameName, ConfMan.getActiveDomain().c_str());
-	strcpy(gameName, ConfMan.get("gameid").c_str());
-//	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 (currentGame == NULL) {
+	
+		strcpy(gameName, ConfMan.get("gameid").c_str());
+	//	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);
+			}
 		}
 	}
 
@@ -879,6 +903,8 @@
 
 	releaseAllKeys();
 
+	setKeyboardEnable(false);
+
 	if (!displayModeIs8Bit) {
 		for (int r = 0; r < 32 * 32; r++) {
 			buffer[r] = ((u16 *) SCREEN_BASE_BLOCK_SUB(4))[r];
@@ -1326,32 +1352,34 @@
 		right = true;
 	}
 
-
-	if (getKeysDown() & KEY_LEFT) {
-		event.type = Common::EVENT_LBUTTONDOWN;
-		event.mouse = Common::Point(getPenX(), getPenY());
-		system->addEvent(event);
+	if (!(getKeysHeld() & (KEY_L | KEY_R))) {
+	
+		if (getKeysDown() & KEY_LEFT) {
+			event.type = Common::EVENT_LBUTTONDOWN;
+			event.mouse = Common::Point(getPenX(), getPenY());
+			system->addEvent(event);
+		}
+	
+		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) {
+			event.type = Common::EVENT_RBUTTONUP;
+			event.mouse = Common::Point(getPenX(), getPenY());
+			system->addEvent(event);
+		}
 	}
-
-	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) {
-		event.type = Common::EVENT_RBUTTONUP;
-		event.mouse = Common::Point(getPenX(), getPenY());
-		system->addEvent(event);
-	}
-
+	
 	event.type = Common::EVENT_MOUSEMOVE;
 	event.mouse = Common::Point(getPenX(), getPenY());
 	system->addEvent(event);
@@ -1487,8 +1515,8 @@
 	OSystem_DS* system = OSystem_DS::instance();
 	Common::Event event;
 
-
 #ifdef USE_PROFILER
+/*
 	if (keysDown() & KEY_R) {
 		cygprofile_begin();
 		cygprofile_enable();
@@ -1497,9 +1525,11 @@
 		cygprofile_disable();
 		cygprofile_end();
 	}
+*/
 #endif
 
 
+
 	if (system->isEventQueueEmpty()) {
 
 /*
@@ -1645,18 +1675,27 @@
 		Common::Event event;
 
 
-		if (!keyboardEnable) {
-
-			if ((tapScreenClicks) && (getIsDisplayMode8Bit())) {
+		if ((tapScreenClicks) && (getIsDisplayMode8Bit())) {
+			if ((!keyboardEnable) || (!isInsideKeyboard(penDownX, penDownY))) {
 				doScreenTapMode(system);
-			} else {
+			}
+		} else {
+			if (!keyboardEnable) {
 				doButtonSelectMode(system);
+			} else if ((!keyboardEnable) || (!isInsideKeyboard(penDownX, penDownY))) {
+				doScreenTapMode(system);
 			}
+		}
 
+
+		if (!keyboardEnable) {
+
+
 			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)) {
@@ -1665,6 +1704,26 @@
 					}
 				}
 
+				if (currentGame->control == CONT_AGI) {
+					// Extra controls for Leisure Suit Larry and KQ4
+
+					if ((getKeysHeld() & KEY_UP) && (getKeysHeld() & KEY_START)
+						/*&& (!strcmp(gameName, "LLLLL"))*/) {
+						consolePrintf("Cheat key!\n");
+						event.type = Common::EVENT_KEYDOWN;
+						event.kbd.keycode = (Common::KeyCode)'X';		// Skip age test in LSL
+						event.kbd.ascii = 'X';
+						event.kbd.flags = Common::KBD_ALT;
+						system->addEvent(event);
+
+						event.type = Common::EVENT_KEYUP;
+						system->addEvent(event);
+					}
+
+				}
+
+
+
 				if (currentGame->control == CONT_SIMON) {
 					// Extra controls for Simon the Sorcerer
 					if ((getKeysDown() & KEY_DOWN)) {
@@ -2019,10 +2078,8 @@
 	frameCount++;
 
 	if ((cursorEnable) && (mouseCursorVisible)) {
-		if (!keyboardEnable) {
-			storedMouseX = penX;
-			storedMouseY = penY;
-		}
+		storedMouseX = penX;
+		storedMouseY = penY;
 
 		if (gameScreenSwap) {
 			setIcon(3, storedMouseX - mouseHotspotX, storedMouseY - mouseHotspotY, 8, 0, true);
@@ -2177,20 +2234,20 @@
 			int offsX = 0, offsY = 0;
 
 
-			if (getKeysHeld() & KEY_LEFT) {
-				offsX -= 1;
+			if ((getKeysHeld() & KEY_LEFT)) {
+				offsX -= 2;
 			}
 
-			if (getKeysHeld() & KEY_RIGHT) {
-				offsX += 1;
+			if ((getKeysHeld() & KEY_RIGHT)) {
+				offsX += 2;
 			}
 
-			if (getKeysHeld() & KEY_UP) {
-				offsY -= 1;
+			if ((getKeysHeld() & KEY_UP)) {
+				offsY -= 2;
 			}
 
-			if (getKeysHeld() & KEY_DOWN) {
-				offsY += 1;
+			if ((getKeysHeld() & KEY_DOWN)) {
+				offsY += 2;
 			}
 
 			if (((gameScreenSwap) && (getKeysHeld() & KEY_L)) || ((!gameScreenSwap) && (getKeysHeld() & KEY_R))) {
@@ -2491,8 +2548,9 @@
 	bool penDownThisFrame = (IPC->touchZ1 > 0) && (IPC->touchXpx > 0) && (IPC->touchYpx > 0);
 	static bool moved = false;
 
-	if ((tapScreenClicks) && (!getKeyboardEnable()) && (getIsDisplayMode8Bit())) {
+	if (( (tapScreenClicks) || getKeyboardEnable() ) && (getIsDisplayMode8Bit())) {
 
+
 		if ((tapTimeout >= 0)) {
 			tapTimeout++;
 
@@ -2506,7 +2564,7 @@
 
 
 		if ((penHeld) && (!penDownThisFrame)) {
-			if ((touchPadStyle) || (moved) || (tapCount == 1)) {
+			if ((touchPadStyle) || (getKeyboardEnable() && (!isInsideKeyboard(penDownX, penDownY))) || (moved) || (tapCount == 1)) {
 				if ((penDownFrames > 0) && (penDownFrames < 6) && ((tapTimeout == -1) || (tapTimeout > 2))) {
 					tapCount++;
 					tapTimeout = 0;
@@ -2518,40 +2576,56 @@
 	}
 
 
+	if ( ((keyboardEnable) || (touchPadStyle)) && (getIsDisplayMode8Bit()) ) {
+		// Relative positioning mode
 
-	if ((touchPadStyle) && (getIsDisplayMode8Bit())) {
 
-		if ((penDownFrames > 0)) {
+		if ((penDownFrames > 0) ) {
 
-
 			if ((penHeld)) {
 
-				if (penDownThisFrame)
-				{
+				if (penDownThisFrame) {
 					if (penDownFrames >= 2) {
-						int diffX = IPC->touchXpx - penDownX;
-						int diffY = IPC->touchYpx - penDownY;
 
-						int speed = ABS(diffX) + ABS(diffY);
+						if ((!keyboardEnable) || (!isInsideKeyboard(IPC->touchXpx, IPC->touchYpx))) {
+							int diffX = IPC->touchXpx - penDownX;
+							int diffY = IPC->touchYpx - penDownY;
+	
+							int speed = ABS(diffX) + ABS(diffY);
+	
+							if ((ABS(diffX) < 35) && (ABS(diffY) < 35)) {
+	
+								if (speed >= 8)	{
+									diffX *= ((speed >> 3) * touchPadSensitivity) >> 3;
+									diffY *= ((speed >> 3) * touchPadSensitivity) >> 3;
+								}
+	
+								penX += diffX;
+								penY += diffY;
 
-						if ((ABS(diffX) < 35) && (ABS(diffY) < 35))
-						{
+								if (penX > 255) {
+									scX -= 255 - penX;
+									penX = 255;
+								}
 
-							if (speed >= 8)
-							{
-								diffX *= ((speed >> 3) * touchPadSensitivity) >> 3;
-								diffY *= ((speed >> 3) * touchPadSensitivity) >> 3;
+								if (penX < 0) {
+									scX -= -penX;
+									penX = 0;
+								}
+							
+								if (penY > 191) {
+									scY += penY - 191;
+									penY = 191;
+								}
+
+								if (penY < 0) {
+									scY -= -penY;
+									penY = 0;
+								}
 							}
-
-							penX += diffX;
-							penY += diffY;
-							if (penX > 255) penX = 255;
-							if (penX < 0) penX = 0;
-							if (penY > 191) penY = 191;
-							if (penY < 0) penY = 0;
+	
+	//						consolePrintf("x: %d y: %d\n", IPC->touchYpx - penDownY, IPC->touchYpx - penDownY);
 						}
-
-//						consolePrintf("x: %d y: %d\n", IPC->touchYpx - penDownY, IPC->touchYpx - penDownY);
 						penDownX = IPC->touchXpx;
 						penDownY = IPC->touchYpx;
 
@@ -2561,7 +2635,6 @@
 				{
 				}
 
-
 			} else {
 				penDown = true;
 				penHeld = true;
@@ -2573,7 +2646,6 @@
 					penDownY = IPC->touchYpx;
 				}
 			}
-
 		} else {
 			if (penHeld) {
 				penReleased = true;
@@ -2585,13 +2657,19 @@
 			penDown = false;
 			penHeld = false;
 		}
-	} else {
+
+
+	} else {	// Absolute positioning mode
 		if ((penDownFrames > 1)) {			// Is this right?  Dunno, but it works for me.
 
 			if ((penHeld)) {
 				penHeld = true;
 				penDown = false;
 			} else {
+				if (penDownFrames == 2) {
+					penDownX = IPC->touchXpx;
+					penDownY = IPC->touchYpx;
+				}
 				penDown = true;
 				penHeld = true;
 				penDownSaved = true;
@@ -2604,7 +2682,6 @@
 			}
 
 
-
 		} else {
 			if (penHeld) {
 				penReleased = true;
@@ -2616,8 +2693,6 @@
 			penDown = false;
 			penHeld = false;
 		}
-
-
 	}
 
 
@@ -2971,13 +3046,17 @@
 
 	consolePrintf("  pc: %08X addr: %08X\n\n",codeAddress,exceptionAddress);
 
+
 	int i;
 	for ( i=0; i < 8; i++ ) {
 		consolePrintf("  %s: %08X   %s: %08X\n",
 					registerNames[i], exceptionRegisters[i],
 					registerNames[i+8],exceptionRegisters[i+8]);
 	}
+	while(1);
 	u32 *stack = (u32 *)exceptionRegisters[13];
+
+
 	for ( i=0; i<10; i++ ) {
 		consolePrintf("%08X %08X %08X\n", stack[i*3], stack[i*3+1], stack[(i*3)+2] );
 	}
@@ -3007,6 +3086,7 @@
 	}
 #endif
 
+
 	// Let arm9 read cartridge
 	*((u16 *) (0x04000204)) &= ~0x0080;
 
@@ -3080,7 +3160,7 @@
 	consolePrintf("-------------------------------\n");
 	consolePrintf("ScummVM DS\n");
 	consolePrintf("Ported by Neil Millstone\n");
-	consolePrintf("Version 1.0.0 RC1 ");
+	consolePrintf("Version 1.0.0 ");
 #if defined(DS_BUILD_A)
 	consolePrintf("build A\n");
 	consolePrintf("Lucasarts SCUMM games (SCUMM)\n");
@@ -3105,6 +3185,12 @@
 #elif defined(DS_BUILD_H)
 	consolePrintf("build H\n");
 	consolePrintf("Nippon Safes (PARALLATION)\n");
+#elif defined(DS_BUILD_I)
+	consolePrintf("build I\n");
+	consolePrintf("Activision Games (MADE)\n");
+#elif defined(DS_BUILD_K)
+	consolePrintf("build K\n");
+	consolePrintf("Cruise for a Corpse (Cruise)\n");
 #endif
 	consolePrintf("-------------------------------\n");
 	consolePrintf("L/R + D-pad/pen:    Scroll view\n");
@@ -3249,13 +3335,21 @@
 	const char *argv[] = {"/scummvmds", "--config=scummvmg.ini"};
 #elif defined(DS_BUILD_H)
 	const char *argv[] = {"/scummvmds", "--config=scummvmh.ini"};
+#elif defined(DS_BUILD_I)
+	const char *argv[] = {"/scummvmds", "--config=scummvmi.ini"};
+#elif defined(DS_BUILD_J)
+	const char *argv[] = {"/scummvmds", "--config=scummvmj.ini"};
+#elif defined(DS_BUILD_K)
+	const char *argv[] = {"/scummvmds", "--config=scummvmk.ini"};
 #endif
 
+
 	while (1) {
 		scummvm_main(ARRAYSIZE(argv), (char **) &argv);
 		powerOff();
 	}
 
+
 	return 0;
 }
 
@@ -3273,6 +3367,9 @@
 int cygprofile_getHBlanks() {
 	return DS::hBlankCount;
 }
+
+
+extern "C" void consolePrintf(char * format, ...) __attribute__ ((no_instrument_function));
 #endif
 
 

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h	2010-02-26 16:17:12 UTC (rev 48135)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsmain.h	2010-02-26 17:29:18 UTC (rev 48136)
@@ -68,6 +68,9 @@
 void	setGameScreenSwap(bool enable);
 void	setSensitivity(int sensitivity);
 
+// Controls options
+void	setControls(char* gameName);
+
 // Video
 void 	displayMode8Bit();											// Switch to 8-bit mode5
 void 	displayMode16Bit();										// Switch to 16-bit mode5
@@ -151,7 +154,7 @@
 void	fastRamReset();
 void*	fastRamAlloc(int size);
 
-
+void 	exitGame();
 gameListType* getCurrentGame();
 
 

Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp	2010-02-26 16:17:12 UTC (rev 48135)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp	2010-02-26 17:29:18 UTC (rev 48136)
@@ -60,6 +60,12 @@
 #define DEFAULT_CONFIG_FILE "scummvmg.ini"
 #elif defined(DS_BUILD_H)
 #define DEFAULT_CONFIG_FILE "scummvmh.ini"
+#elif defined(DS_BUILD_I)
+#define DEFAULT_CONFIG_FILE "scummvmi.ini"
+#elif defined(DS_BUILD_J)
+#define DEFAULT_CONFIG_FILE "scummvmj.ini"
+#elif defined(DS_BUILD_K)
+#define DEFAULT_CONFIG_FILE "scummvmk.ini"
 #endif
 
 OSystem_DS* OSystem_DS::_instance = NULL;
@@ -177,7 +183,7 @@
 		green >>= 3;
 		blue >>= 3;
 
-		//if (r != 255)
+//		if (r != 255)
 		{
 			u16 paletteValue = red | (green << 5) | (blue << 10);
 
@@ -265,12 +271,13 @@
 #define MISALIGNED16(ptr) (((u32) (ptr) & 1) != 0)
 
 void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
-	//consolePrintf("Copy rect %d, %d   %d, %d ", x, y, w, h);
 	if (!_graphicsEnable) return;
 	if (w <= 1) return;
 	if (h < 0) return;
 	if (!DS::getIsDisplayMode8Bit()) return;
 
+//	consolePrintf("CopyRectToScreen %d\n", w * h);
+
 	u16* bg;
 	s32 stride;
 	u16* bgSub = (u16 *)BG_GFX_SUB;
@@ -452,6 +459,8 @@
 }
 
 void OSystem_DS::updateScreen() {
+	static int cnt = 0;
+//	consolePrintf("updatescr %d\n", cnt++);
 
 	if ((_frameBufferExists) && (DS::getIsDisplayMode8Bit())) {
 		_frameBufferExists = false;
@@ -883,6 +892,7 @@
 void OSystem_DS::engineDone() {
 	// Scumm games appear not to stop their CD audio, so I stop the CD here.
 	stopCD();
+	DS::exitGame();
 
 #ifdef ENABLE_AGI
 	DS::clearAutoCompleteWordList();

Modified: scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp	2010-02-26 16:17:12 UTC (rev 48135)
+++ scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp	2010-02-26 17:29:18 UTC (rev 48136)
@@ -156,8 +156,31 @@
 
 int selectedCompletion = -1;
 int charactersEntered = 0;
+int typingTimeout = 0;
 
+// Render text onto the tiled screen
 
+void drawText(int tx, int ty, char* string, bool highlight) {
+
+	u16 baseValue = 0;
+
+	if (highlight) {
+		baseValue |= 0x1000;
+	}
+
+	for (int p = 0; *string; string++, p++) {
+		char c = *string;
+
+		if (c != ' ') {
+			int tile = c - 33 + (KEYBOARD_DATA_SIZE / 32);
+			baseAddress[ty * 32 + tx + p] = baseValue | tile;
+		}
+	}
+	
+}
+
+
+
 void restoreVRAM(int tileBase, int mapBase, u16* saveSpace) {
 /*	for (int r = 0; r < 32 * 32; r++) {
 		((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r] = *saveSpace++;
@@ -246,12 +269,16 @@
 		keys[r].pressed = false;
 	}
 
+
 	closed = false;
 	clearAutoComplete();
+
 }
 
+
 void drawAutoComplete() {
 
+	// Clear the auto complete area at the bottom of the screen.
 	for (int y = 12; y < 24; y++) {
 		for (int x = 0; x < 32; x++) {
 			baseAddress[y * 32 + x] = 0;
@@ -259,23 +286,26 @@
 	}
 
 
-	for (int r = 0; r < autoCompleteCount; r++) {
-		int y = 12 + (r % 6) * 2;
-		int x = 0 + ((r / 6) * 16);
+	if ((autoCompleteCount == 0) || (typingTimeout > 0)) {
 
-		for (int p = 0; autoCompleteWord[r][p] != 0; p++) {
-			char c = autoCompleteWord[r][p];
+		// When there's no completions on the bottom of the screen, it acts like a mouse pad
+		// so this text indicates that
+		drawText(11, 18, "MOUSE AREA", true);
+		
 
-			int tile = c - 33 + (KEYBOARD_DATA_SIZE / 32);
+	} else {
 
-			if (selectedCompletion == r) {
-				tile |= 0x1000;
-			}
+		consolePrintf("time: %d\n", typingTimeout);
 
-			baseAddress[y * 32 + x + p] = tile;
-
-
+		// Otherwise, draw autocompletions if one isn't being entered and there are
+		// some available.
+		for (int r = 0; r < autoCompleteCount; r++) {
+			int y = 12 + (r % 6) * 2;
+			int x = 0 + ((r / 6) * 16);
+	
+			drawText(x, y, autoCompleteWord[r], selectedCompletion == r);
 		}
+	
 	}
 }
 
@@ -309,6 +339,12 @@
 	charactersEntered = count;
 }
 
+bool isInsideKeyboard(int x, int y) {
+	// When completions are available, keyboard covers the whole screen.
+	// otherwise, it only covers the area above KEYBOARD_BOTTOM_Y
+	return (autoCompleteCount > 0) || (y < KEYBOARD_BOTTOM_Y);
+}
+
 void clearAutoComplete() {
 	autoCompleteCount = 0;
 	selectedCompletion = -1;
@@ -345,10 +381,8 @@
 	system->addEvent(event);*/
 }
 
-void updateTypeEvents()
-{
-	if (autoCompleteBuffer[0] != '\0')
-	{
+void updateTypeEvents() {
+	if (autoCompleteBuffer[0] != '\0') {
 		Common::Event event;
    		OSystem_DS* system = OSystem_DS::instance();
 
@@ -365,6 +399,8 @@
 		{
 			autoCompleteBuffer[r] = autoCompleteBuffer[r + 1];
 		}
+
+		typingTimeout = 100;
 	}
 }
 
@@ -424,6 +460,13 @@
 
 	updateTypeEvents();
 
+	if (typingTimeout > 0) {
+		typingTimeout--;
+		if (typingTimeout == 0) {
+			drawAutoComplete();
+		}
+	}
+
 	if (DS::getPenDown()) {
 		int x = IPC->touchXpx;
 		int y = IPC->touchYpx;
@@ -443,7 +486,9 @@
 			if (selectedCompletion == current) {
 				typeCompletion(current);
 			} else {
-				selectedCompletion = current;
+				if (current < autoCompleteCount) {
+					selectedCompletion = current;
+				}
 			}
 
 			drawAutoComplete();

Modified: scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.h	2010-02-26 16:17:12 UTC (rev 48135)
+++ scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.h	2010-02-26 17:29:18 UTC (rev 48136)
@@ -29,6 +29,7 @@
 
 static const int NUM_WORDS = 12;
 static const int KEYBOARD_DATA_SIZE = 4736 * 2;
+static const int KEYBOARD_BOTTOM_Y = 105;
 
 void createKeyEvent(int keyNum, Common::Event& event);
 
@@ -36,6 +37,7 @@
 void restoreVRAM(int tileBase, int mapBase, u16* saveSpace);
 void addKeyboardEvents();
 bool getKeyboardClosed();
+bool isInsideKeyboard(int x, int y);
 
 void addAutoComplete(const char* word);
 void clearAutoComplete();

Modified: scummvm/trunk/backends/platform/ds/logoa.bmp
===================================================================
(Binary files differ)

Modified: scummvm/trunk/backends/platform/ds/logob.bmp
===================================================================
(Binary files differ)

Modified: scummvm/trunk/backends/platform/ds/logoc.bmp
===================================================================
(Binary files differ)

Modified: scummvm/trunk/backends/platform/ds/logod.bmp
===================================================================
(Binary files differ)

Modified: scummvm/trunk/backends/platform/ds/logoe.bmp
===================================================================
(Binary files differ)

Modified: scummvm/trunk/backends/platform/ds/logof.bmp
===================================================================
(Binary files differ)

Modified: scummvm/trunk/backends/platform/ds/logog.bmp
===================================================================
(Binary files differ)

Added: scummvm/trunk/backends/platform/ds/logoh.bmp
===================================================================
(Binary files differ)


Property changes on: scummvm/trunk/backends/platform/ds/logoh.bmp
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: scummvm/trunk/backends/platform/ds/logoi.bmp
===================================================================
(Binary files differ)


Property changes on: scummvm/trunk/backends/platform/ds/logoi.bmp
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: scummvm/trunk/backends/platform/ds/logoj.bmp
===================================================================
(Binary files differ)


Property changes on: scummvm/trunk/backends/platform/ds/logoj.bmp
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: scummvm/trunk/backends/platform/ds/logok.bmp
===================================================================
(Binary files differ)


Property changes on: scummvm/trunk/backends/platform/ds/logok.bmp
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream


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