[Scummvm-cvs-logs] SF.net SVN: scummvm: [30444] scummvm/branches/branch-0-11-0/backends/ platform/ds/arm9/source

agent-q at users.sourceforge.net agent-q at users.sourceforge.net
Sat Jan 12 17:55:08 CET 2008


Revision: 30444
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30444&view=rev
Author:   agent-q
Date:     2008-01-12 08:55:07 -0800 (Sat, 12 Jan 2008)

Log Message:
-----------
 - Swapping the screens while the software scaler is enabled no longer causes odd effects
 - Fixed CPU scaler in FM Towns games
- Enabled use of CPU scaler in menus even when turned off in the game
- Fixed function keys F5 and F7 in AGI games.
- Rearranged DS Options Menu to make things clearer and not allow conflicting options to be selected together

Modified Paths:
--------------
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/blitters.h
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/blitters_arm.s
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsmain.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsmain.h
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsoptions.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsoptions.h
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/fat/gba_nds_fat.h
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/gbampsave.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/gbampsave.h
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/osystem_ds.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/portdefs.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/ramsave.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/ramsave.h
    scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/touchkeyboard.cpp

Modified: scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/blitters.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/blitters.h	2008-01-12 12:22:49 UTC (rev 30443)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/blitters.h	2008-01-12 16:55:07 UTC (rev 30444)
@@ -44,7 +44,7 @@
 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/branch-0-11-0/backends/platform/ds/arm9/source/blitters_arm.s
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/blitters_arm.s	2008-01-12 12:22:49 UTC (rev 30443)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/blitters_arm.s	2008-01-12 16:55:07 UTC (rev 30444)
@@ -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:

Modified: scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsmain.cpp	2008-01-12 12:22:49 UTC (rev 30443)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsmain.cpp	2008-01-12 16:55:07 UTC (rev 30444)
@@ -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;
 
@@ -217,7 +221,9 @@
 int hBlankCount = 0;
 #endif
 
+u8* scalerBackBuffer = NULL;
 
+
 gameListType gameList[NUM_SUPPORTED_GAMES] = {
 	// Unknown game - use normal SCUMM controls
 	{"unknown", 	CONT_SCUMM_ORIGINAL},
@@ -277,13 +283,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;
 }
 
 
@@ -322,8 +329,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) {
@@ -359,54 +372,18 @@
 
 
 void saveGameBackBuffer() {
-#ifdef DISABLE_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() {
-#ifdef DISABLE_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;
@@ -523,7 +500,19 @@
 			buffer[r] = ((u16 *) SCREEN_BASE_BLOCK_SUB(4))[r];
 		}
 	}
+
+	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); 
@@ -533,7 +522,7 @@
 		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);
 	
@@ -543,6 +532,7 @@
 	    BG3_XDY = 0;
 	    BG3_YDX = 0;
 	    BG3_YDY = (int) ((200.0f / 192.0f) * 256);
+
 	}
 	else
 	{
@@ -553,7 +543,7 @@
 		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);
 	
@@ -584,26 +574,20 @@
 
 
 	
-	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;
 	
@@ -674,6 +658,7 @@
 	
 	
 		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++) {
@@ -681,8 +666,10 @@
 	
 				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;
 				}
 			}
 		}
@@ -695,8 +682,9 @@
 	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);
 	
@@ -704,10 +692,16 @@
 	
 	// 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;
 	}
@@ -719,23 +713,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 +746,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];
@@ -770,10 +767,6 @@
 	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);
 	
@@ -803,6 +796,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
@@ -822,7 +821,7 @@
 		
 		if (isCpuScalerEnabled())
 		{
-            Rescale_320x256x1555_To_256x256x1555(BG_GFX, back, 512, 512);
+			Rescale_320x256x1555_To_256x256x1555(BG_GFX, back, 512, 512);
 		}
 		else
 		{
@@ -841,11 +840,13 @@
         #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
@@ -875,9 +876,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!
 }
@@ -1090,7 +1106,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 {
 
 
@@ -1106,10 +1126,17 @@
 			// 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 {
@@ -1117,7 +1144,12 @@
 			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;
+		}
 	}
 }
 
@@ -1249,6 +1281,13 @@
 
 				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)) {
@@ -1477,7 +1516,6 @@
 //				consolePrintf("!!!!!F5!!!!!");
 			}
 			event.kbd.flags = 0;
-			consolePrintf("!!!!!F5!!!!!");
 			system->addEvent(event);
 		}
 
@@ -1589,25 +1627,27 @@
 }
 
 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;
@@ -1622,35 +1662,48 @@
 			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;
@@ -2000,6 +2053,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;
@@ -2011,7 +2077,7 @@
 /*	vramSetBankA(VRAM_A_MAIN_BG); 
 	vramSetBankB(VRAM_B_MAIN_BG); 
 	vramSetBankC(VRAM_C_SUB_BG); */
-	vramSetBankI(VRAM_I_SUB_SPRITE); 
+	vramSetBankD(VRAM_D_SUB_SPRITE); 
 	vramSetBankE(VRAM_E_MAIN_SPRITE); 
 	
 	currentTimeMillis = 0;
@@ -2104,21 +2170,16 @@
 	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 +2187,8 @@
 }
 
 
+
+
 void setKeyboardIcon(bool enable) {
 	keyboardIcon = enable;
 }
@@ -2599,7 +2662,7 @@
 	consolePrintf("-------------------------------\n");
 	consolePrintf("ScummVM DS\n");
 	consolePrintf("Ported by Neil Millstone\n");
-	consolePrintf("Version 0.11.0 beta1 ");
+	consolePrintf("Version 0.11.0 ");
 #if defined(DS_BUILD_A)
 	consolePrintf("build A\n");
 	consolePrintf("Lucasarts SCUMM games (SCUMM)\n");

Modified: scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsmain.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsmain.h	2008-01-12 12:22:49 UTC (rev 30443)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsmain.h	2008-01-12 16:55:07 UTC (rev 30444)
@@ -75,6 +75,8 @@
 // Get address of current back buffer
 u16* 	get16BitBackBuffer();
 u16* 	get8BitBackBuffer();
+s32 	get8BitBackBufferStride();
+u16*	getScalerBuffer();
 
 void 	setTalkPos(int x, int y);
 void 	setTopScreenTarget(int x, int y);

Modified: scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsoptions.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsoptions.cpp	2008-01-12 12:22:49 UTC (rev 30443)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsoptions.cpp	2008-01-12 16:55:07 UTC (rev 30444)
@@ -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,8 +41,10 @@
 
 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()) {
@@ -49,20 +52,29 @@
 	}
 #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);
@@ -152,7 +164,12 @@
 	} else {
 		_touchY->setValue(0);
 	}
-	
+
+	if (!_cpuScaler->getState() && !_unscaledCheckbox->getState()) {
+		_hardScaler->setState(true);
+	}
+		
+	_radioButtonMode = true;
 }
 
 DSOptionsDialog::~DSOptionsDialog() {
@@ -177,11 +194,44 @@
 }
 
 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));
@@ -239,10 +289,8 @@
 
 	DSOptionsDialog* d = new DSOptionsDialog();
 	d->runModal();
-	consolePrintf("deleting dialog\n");
 	delete d;
 	
-	consolePrintf("going to 8 bit\n");
 	DS::displayMode8Bit();
 
 	togglePause();
@@ -304,6 +352,7 @@
 		DS::setCpuScalerEnable(false);
 	}
 #endif	
+
 }
 
 }

Modified: scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsoptions.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsoptions.h	2008-01-12 12:22:49 UTC (rev 30443)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/dsoptions.h	2008-01-12 16:55:07 UTC (rev 30444)
@@ -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/branch-0-11-0/backends/platform/ds/arm9/source/fat/gba_nds_fat.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/fat/gba_nds_fat.h	2008-01-12 12:22:49 UTC (rev 30443)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/fat/gba_nds_fat.h	2008-01-12 16:55:07 UTC (rev 30444)
@@ -25,7 +25,7 @@
 
 // Maximum number of files open at once
 // Increase this to open more files, decrease to save memory
-#define MAX_FILES_OPEN	4
+#define MAX_FILES_OPEN	16
 
 // Allow file writing
 // Disable this to remove file writing support

Modified: scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/gbampsave.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/gbampsave.cpp	2008-01-12 12:22:49 UTC (rev 30443)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/gbampsave.cpp	2008-01-12 16:55:07 UTC (rev 30444)
@@ -23,6 +23,7 @@
 #include "gbampsave.h"
 #include "gba_nds_fat.h"
 #include "ds-fs.h"
+#include "config-manager.h"
 
 /////////////////////////
 // GBAMP Save File
@@ -30,7 +31,7 @@
 
 GBAMPSaveFile::GBAMPSaveFile(char* name, bool saveOrLoad) {
 	handle = DS::std_fopen(name, saveOrLoad? "w": "r");
-	consolePrintf("%s handle is %d\n", name, handle);
+//	consolePrintf("%s handle is %d\n", name, handle);
 //	consolePrintf("Created %s\n", name);
 	bufferPos = 0;
 	saveSize = 0;
@@ -164,62 +165,35 @@
 	}
 }
 
-void GBAMPSaveFileManager::listSavefiles(char const* prefix, bool* marks, int num) {
-//	memset(marks, true, num * sizeof(bool));
-//	return;
-	
-	// Seems like I misunderstood what this function was supposed to do.
-	// I thought I was meant to set the marks[] array according to which
-	// saves are present on disk.
-	enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 };
-	char name[128];
-	char path[128];
-	
-	DS::std_cwd((char *) getSavePath());
-	consolePrintf("Save path: %s\n", getSavePath());
-	
-	int fileType = FAT_FindFirstFileLFN(name);
-	
-	for (int r = 0; r < num; r++) {
-		marks[r] = false;
+// This method copied from an old version of the savefile.cpp, since it's been removed from there and
+// placed in default-saves.cpp, where I cannot call it.
+const char *GBAMPSaveFileManager::getSavePath() const {
+	const char *dir = NULL;
+
+	// Try to use game specific savepath from config
+	dir = ConfMan.get("savepath").c_str();
+
+	// Work around a bug (#999122) in the original 0.6.1 release of
+	// ScummVM, which would insert a bad savepath value into config files.
+	if (0 == strcmp(dir, "None")) {
+		ConfMan.removeKey("savepath", ConfMan.getActiveDomainName());
+		ConfMan.flushToDisk();
+		dir = ConfMan.get("savepath").c_str();
 	}
-	
-	do {
-	
-		if (fileType == TYPE_FILE) {
 
-			FAT_GetLongFilename(name);
-			
-			for (int r = 0; r < num; r++) {
-				char str[128];
-				
-				
-				sprintf(str, "%s%02d", prefix, r);
-				consolePrintf("%s != %s", str, name);
-				if (!stricmp(str, name)) {
-					marks[r] = true;
-					consolePrintf("Matched %d", r);
-				}
-				
-			}
-			
-		}
-	
-	} while ((fileType = FAT_FindNextFileLFN(name)));
-	
-	FAT_chdir("/");
-}
 
-Common::StringList GBAMPSaveFileManager::listSavefiles(const char *regex) { 
+	assert(dir);
 
-	
+	return dir;
+}
 
+Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) { 
+
 	enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 };
 	char name[256];
-
 	
 	DS::std_cwd((char *) getSavePath());
-//	consolePrintf("Save path: '%s', regex: '%s'\n", getSavePath(),regex);
+//	consolePrintf("Save path: '%s', pattern: '%s'\n", getSavePath(),pattern);
 
 	
 	int fileType = FAT_FindFirstFileLFN(name);
@@ -238,16 +212,15 @@
 			}
 			
 			
-			if (Common::matchString(name, regex)) {
+			if (Common::matchString(name, pattern)) {
 				list.push_back(name);
 			}
 		}
-	
+
 	} while ((fileType = FAT_FindNextFileLFN(name)));
 	
 	FAT_chdir("/");
 
-
 	return list;
 }	
 

Modified: scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/gbampsave.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/gbampsave.h	2008-01-12 12:22:49 UTC (rev 30443)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/gbampsave.h	2008-01-12 16:55:07 UTC (rev 30444)
@@ -24,7 +24,7 @@
 #define _GBAMPSAVE_H_
 
 #include "system.h"
-#include "saves/default/default-saves.h"
+#include "backends/saves/default/default-saves.h"
 #include "ds-fs.h"
 
 #define SAVE_BUFFER_SIZE 100000
@@ -58,7 +58,7 @@
 };
 
 
-class GBAMPSaveFileManager : public DefaultSaveFileManager {
+class GBAMPSaveFileManager : public Common::SaveFileManager {
 public:
 	GBAMPSaveFileManager();
 	~GBAMPSaveFileManager();
@@ -71,12 +71,12 @@
 	virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
 	
 	virtual bool removeSavefile(const char *filename) { return false; } // TODO: Implement this
-	virtual Common::StringList listSavefiles(const char *regex);
+	virtual Common::StringList listSavefiles(const char *pattern);
 	
-	void listSavefiles(const char *prefix, bool *marks, int num);
-	
 	void deleteFile(char* name);
 	void listFiles();
+
+	const char *getSavePath() const;
 };
 
 #endif

Modified: scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/osystem_ds.cpp	2008-01-12 12:22:49 UTC (rev 30443)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/osystem_ds.cpp	2008-01-12 16:55:07 UTC (rev 30444)
@@ -191,14 +191,24 @@
 	if (h < 0) return;
 	if (!DS::getIsDisplayMode8Bit()) return;
 	
+	u16* bg;
+	s32 stride;
 	u16* bgSub = (u16 *) BG_GFX_SUB;
-	u16* bg = (u16 *) DS::get8BitBackBuffer();
+
+	if (_frameBufferExists) {
+		bg = (u16 *) _framebuffer.pixels;
+		stride = _framebuffer.pitch;
+	} else {
+		bg = (u16 *) DS::get8BitBackBuffer();
+		stride = DS::get8BitBackBufferStride();
+	}
+
 	u16* src = (u16 *) buf;
 	
 	if (DS::getKeyboardEnable()) {
 	
 		for (int dy = y; dy < y + h; dy++) {
-			u16* dest = bg + (dy << 8) + (x >> 1);
+			u16* dest = bg + (dy * (stride >> 1)) + (x >> 1);
 		
 			DC_FlushRange(src, w << 1);
 			DC_FlushRange(dest, w << 1);
@@ -209,7 +219,7 @@
 	
 	} else {
 		for (int dy = y; dy < y + h; dy++) {
-			u16* dest1 = bg + (dy << 8) + (x >> 1);
+			u16* dest1 = bg + (dy * (stride >> 1)) + (x >> 1);
 			u16* dest2 = bgSub + (dy << 8) + (x >> 1);
 			
 			DC_FlushRange(src, w << 1);
@@ -232,15 +242,12 @@
 void OSystem_DS::updateScreen()
 {
 
-	if (_frameBufferExists)
+	if ((_frameBufferExists) && (DS::getIsDisplayMode8Bit()))
 	{
+		_frameBufferExists = false;
+
 		// Copy temp framebuffer back to screen
 		copyRectToScreen((byte *)_framebuffer.pixels, _framebuffer.pitch, 0, 0, _framebuffer.w, _framebuffer.h);
-	
-		// Free memory
-		_framebuffer.free();
-
-		_frameBufferExists = false;
 	}
 
 	DS::displayMode16BitFlipBuffer();
@@ -438,7 +445,7 @@
 
 void OSystem_DS::clearSoundCallback()
 {
-	consolePrintf("Clearing sound callback");
+//	consolePrintf("Clearing sound callback");
 //	DS::setSoundProc(NULL, NULL);
 }
 
@@ -511,28 +518,64 @@
 
 
 Graphics::Surface* OSystem_DS::createTempFrameBuffer() {
-	// For now, we create a full temporary screen surface, to which we copy the
-	// the screen content. Later unlockScreen will copy everything back.
-	// Not very nice nor efficient, but at least works, and is not worse
-	// than in the bad old times where we used grabRawScreen + copyRectToScreen.
-//	consolePrintf("lockScreen()\n");
-	_framebuffer.create(DS::getGameWidth(), DS::getGameHeight(), 1);
 
 	// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
+
+	// If the scaler is enabled, we can just return the 8 bit back buffer, since it's in system memory
+	// memory anyway.  Otherwise, we need to copy the back buffer into the memory normally used by the scaler buffer and
+	// then return it.
+	// We must make sure that once the frame buffer is created, future calls to copyRectToScreen() copy to this buffer
+
+	if (DS::isCpuScalerEnabled()) {
+
+		_framebuffer.pixels = DS::getScalerBuffer();
+		_framebuffer.w = DS::getGameWidth();
+		_framebuffer.h = DS::getGameHeight();
+		_framebuffer.pitch = DS::getGameWidth();
+		_framebuffer.bytesPerPixel = 1;
+
+
+	} else {
 	
-	size_t imageStrideInBytes = DS::isCpuScalerEnabled()? DS::getGameWidth() : 512;
+		s32 height = DS::getGameHeight();
+		s32 width = DS::getGameWidth();
+		s32 stride = DS::get8BitBackBufferStride();
+		
+		u16* src = DS::get8BitBackBuffer();
+		u16* dest = DS::getScalerBuffer();
+
+		for (int y = 0; y < height; y++) {
+			
+			u16* destLine = dest + (y * (width / 2));
+			u16* srcLine = src + (y * (stride / 2));
+
+			DC_FlushRange(srcLine, width);
+					
+			dmaCopyHalfWords(3, srcLine, destLine, width);
+		}
+
+		_framebuffer.pixels = dest;
+		_framebuffer.w = width;
+		_framebuffer.h = height;
+		_framebuffer.pitch = width;
+		_framebuffer.bytesPerPixel = 1;
+
+	}
+
+	_frameBufferExists = true;
+
+/*	
+	size_t imageStrideInBytes = DS::get8BitBackBufferStride();
 	size_t imageStrideInWords = imageStrideInBytes / 2;
 
 	u16* image = (u16 *) DS::get8BitBackBuffer();
 	for (int y = 0; y <  DS::getGameHeight(); y++) {
 		DC_FlushRange(image + (y * imageStrideInWords), DS::getGameWidth());
 		for (int x = 0; x < DS::getGameWidth() >> 1; x++) {
-			*(((u16 *) (_framebuffer.pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[(y << 8) + x];
+			*(((u16 *) (_framebuffer.pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[(y * imageStrideInWords) + x];
 //			*(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y * imageStrideInWords + x];
 		}
-	}
-//	consolePrintf("lockScreen() done\n");
-	_frameBufferExists = true;
+	}*/
 
 	return &_framebuffer;
 }
@@ -547,15 +590,7 @@
 }
 
 void OSystem_DS::unlockScreen() {
-
-//	consolePrintf("unlockScreen()\n");
-
-	// Copy temp framebuffer back to screen
-//	copyRectToScreen((byte *)_framebuffer.pixels, _framebuffer.pitch, 0, 0, _framebuffer.w, _framebuffer.h);
-
-	// Free memory
-//	_framebuffer.free();
-//	consolePrintf("unlockScreen() done\n");
+	// No need to do anything here.  The screen will be updated in updateScreen().
 }
 
 void OSystem_DS::setFocusRectangle(const Common::Rect& rect) {

Modified: scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/portdefs.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/portdefs.cpp	2008-01-12 12:22:49 UTC (rev 30443)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/portdefs.cpp	2008-01-12 16:55:07 UTC (rev 30444)
@@ -37,7 +37,6 @@
 
 
 time_t DS_time(time_t) {
-	consolePrintf("Time!");
 	if (OSystem_DS::instance()) {
 		return 0xABCD1234 + (OSystem_DS::instance()->getMillis() / 1000);
 	} else {
@@ -46,7 +45,6 @@
 }
 
 time_t DS_time(long* t) {
-	consolePrintf("Time!");
 	if (OSystem_DS::instance()) {
 		if (t) *t = 0xABCD1234 + (OSystem_DS::instance()->getMillis() / 1000);
 		return 0xABCD1234 + (OSystem_DS::instance()->getMillis() / 1000);

Modified: scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/ramsave.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/ramsave.cpp	2008-01-12 12:22:49 UTC (rev 30443)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/ramsave.cpp	2008-01-12 16:55:07 UTC (rev 30444)
@@ -383,6 +383,17 @@
 	flushToSaveRAM();
 }
 
+bool DSSaveFileManager::removeSavefile(const char *filename) {
+	// TODO: Implement this. 
+}
+
+
+Common::StringList DSSaveFileManager::listSavefiles(const char *pattern) {
+	// TODO: Implement this.
+
+
+
+/*
 void DSSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num) {
 	memset(marks, true, num * sizeof(bool));
 	return;
@@ -398,7 +409,10 @@
 	}
 	
 }
+*/
 
+}
+
 DSSaveFile *DSSaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) {
 	
 	// Find a free save slot

Modified: scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/ramsave.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/ramsave.h	2008-01-12 12:22:49 UTC (rev 30443)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/ramsave.h	2008-01-12 16:55:07 UTC (rev 30444)
@@ -123,14 +123,11 @@
 	virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); }
 	virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
 
-	virtual bool removeSavefile(const char *filename) { return false; } // TODO: Implement this
-	virtual Common::StringList listSavefiles(const char *regex) { return Common::StringList(); }	// TODO: I don't know what this is for!
-		
+	virtual bool removeSavefile(const char *filename);
+	virtual Common::StringList listSavefiles(const char *pattern);
 	
-	void listSavefiles(const char *prefix, bool *marks, int num);
-	
 	void flushToSaveRAM();
-	
+
 	void addBytesFree(int size) { sramBytesFree += size; }
 	int getBytesFree() { return sramBytesFree; }
 

Modified: scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/touchkeyboard.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/touchkeyboard.cpp	2008-01-12 12:22:49 UTC (rev 30443)
+++ scummvm/branches/branch-0-11-0/backends/platform/ds/arm9/source/touchkeyboard.cpp	2008-01-12 16:55:07 UTC (rev 30444)
@@ -392,12 +392,19 @@
 		
 		event.kbd.keycode = (Common::KeyCode) event.kbd.ascii;
 	} else {
-		event.kbd.ascii = keys[keyNum].character;
-		event.kbd.keycode = (Common::KeyCode) keys[keyNum].character;
+		if ((keys[keyNum].character >= Common::KEYCODE_F1) && (keys[keyNum].character >= Common::KEYCODE_F12))	{
+			event.kbd.keycode = (Common::KeyCode) keys[keyNum].character;
+			event.kbd.ascii = keys[keyNum].character - Common::KEYCODE_F1 + Common::ASCII_F1;
+		} else {
+			event.kbd.ascii = keys[keyNum].character;
+			event.kbd.keycode = (Common::KeyCode) keys[keyNum].character;
+		}
 	}				
 }
 
 void addKeyboardEvents() {
+	bool resetShift = false;
+
 	updateTypeEvents();
 
 	if (DS::getPenDown()) {
@@ -468,15 +475,6 @@
 					default: {
 						DS::setKeyHighlight(r, true);
 						keys[r].pressed = true;
-						
-						if (DS::shiftState) {
-							DS::shiftState = false;
-							for (int t = 0; t < DS_NUM_KEYS; t++) {
-								if (keys[t].character == DS_SHIFT) {
-									DS::setKeyHighlight(t, false);
-								}
-							}
-						}
 						break;
 					}
 				}
@@ -499,9 +497,26 @@
 				system->addEvent(event);
 
 				keys[r].pressed = false;
+
+				if (keys[r].character != DS_SHIFT) {
+					resetShift = true;
+				}
 			}
 		}	
+
 	}
+
+
+	if ((resetShift) && (DS::shiftState)) {
+		DS::shiftState = false;
+		resetShift = false;
+		for (int t = 0; t < DS_NUM_KEYS; t++) {
+			if (keys[t].character == DS_SHIFT) {
+				DS::setKeyHighlight(t, false);
+			}
+		}
+	}
+
 }
 
 }


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