[Scummvm-cvs-logs] SF.net SVN: scummvm:[39916] scummvm/branches/branch-0-13-0/backends/ platform/ds/arm9/source/dsmain.cpp

agent-q at users.sourceforge.net agent-q at users.sourceforge.net
Sat Apr 11 02:25:52 CEST 2009


Revision: 39916
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39916&view=rev
Author:   agent-q
Date:     2009-04-11 00:25:52 +0000 (Sat, 11 Apr 2009)

Log Message:
-----------
DS: Fixing bugs: 
- Console corruption when switching it on and off
- Accessing OSystem_DS before it was initialised.

Modified Paths:
--------------
    scummvm/branches/branch-0-13-0/backends/platform/ds/arm9/source/dsmain.cpp

Modified: scummvm/branches/branch-0-13-0/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/branches/branch-0-13-0/backends/platform/ds/arm9/source/dsmain.cpp	2009-04-10 22:33:29 UTC (rev 39915)
+++ scummvm/branches/branch-0-13-0/backends/platform/ds/arm9/source/dsmain.cpp	2009-04-11 00:25:52 UTC (rev 39916)
@@ -579,9 +579,11 @@
 
 	displayModeIs8Bit = true;
 
+	videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+
 	if (isCpuScalerEnabled())
 	{
-		videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+
 		videoSetModeSub(MODE_3_2D /*| DISPLAY_BG0_ACTIVE*/ | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
 
 		vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
@@ -595,14 +597,13 @@
 		BG3_CR = BG_BMP16_256x256 | BG_BMP_BASE(8);
 
 		BG3_XDX = 256;
-	    BG3_XDY = 0;
-	    BG3_YDX = 0;
-	    BG3_YDY = (int) ((200.0f / 192.0f) * 256);
+		BG3_XDY = 0;
+		BG3_YDX = 0;
+		BG3_YDY = (int) ((200.0f / 192.0f) * 256);
 
 	}
 	else
 	{
-		videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
 		videoSetModeSub(MODE_3_2D /*| DISPLAY_BG0_ACTIVE*/ | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
 
 		vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
@@ -616,13 +617,21 @@
 		BG3_CR = BG_BMP8_512x256 | BG_BMP_BASE(8);
 
 		BG3_XDX = (int) (((float) (gameWidth) / 256.0f) * 256);
-	    BG3_XDY = 0;
-	    BG3_YDX = 0;
-	    BG3_YDY = (int) ((200.0f / 192.0f) * 256);
+		BG3_XDY = 0;
+		BG3_YDX = 0;
+		BG3_YDY = (int) ((200.0f / 192.0f) * 256);
 	}
 
+	consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 2, 0, true);
+
+	videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
++
+	// Move the cursor to the bottom of the screen using ANSI escape code
+	consolePrintf("\033[23;0f");
+
 	SUB_BG3_CR = BG_BMP8_512x256;
 
+
 	SUB_BG3_XDX = (int) (subScreenWidth / 256.0f * 256);
     	SUB_BG3_XDY = 0;
     	SUB_BG3_YDX = 0;
@@ -630,13 +639,6 @@
 
 
 
-	if (consoleEnable)
-	{
-		consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 2, 0, true);
-
-		// Move the cursor to the bottom of the screen using ANSI escape code
-		consolePrintf("\033[23;0f");
-	}
 //	consoleInitDefault((u16*)SCREEN_BASE_BLOCK(2), (u16*)CHAR_BASE_BLOCK(0), 16);
 //	consoleSetWindow(NULL, 0, 0, 32, 24);
 //	consolePrintSet(0, 23);
@@ -651,7 +653,9 @@
 	}
 
 	// ConsoleInit destroys the hardware palette :-(
-	OSystem_DS::instance()->restoreHardwarePalette();
+	if (OSystem_DS::instance()) {
+		OSystem_DS::instance()->restoreHardwarePalette();
+	}
 	
 //	BG_PALETTE_SUB[255] = RGB15(31,31,31);//by default font will be rendered with color 255
 
@@ -3060,7 +3064,7 @@
 	consolePrintf("-------------------------------\n");
 	consolePrintf("ScummVM DS\n");
 	consolePrintf("Ported by Neil Millstone\n");
-	consolePrintf("Version 0.13.1 beta1 ");
+	consolePrintf("Version 0.13.1 beta2 ");
 #if defined(DS_BUILD_A)
 	consolePrintf("build A\n");
 	consolePrintf("Lucasarts SCUMM games (SCUMM)\n");


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