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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Jul 5 22:36:12 CEST 2010


Revision: 50708
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50708&view=rev
Author:   fingolfin
Date:     2010-07-05 20:36:11 +0000 (Mon, 05 Jul 2010)

Log Message:
-----------
DS: More formating, made more vars static

Modified Paths:
--------------
    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/dsoptions.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/keys.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/keys.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/zipreader.cpp

Modified: scummvm/trunk/backends/platform/ds/arm9/source/blitters.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/blitters.cpp	2010-07-05 20:25:33 UTC (rev 50707)
+++ scummvm/trunk/backends/platform/ds/arm9/source/blitters.cpp	2010-07-05 20:36:11 UTC (rev 50708)
@@ -33,11 +33,11 @@
 void asmDrawStripToScreen(int height, int width, byte const *text, byte const *src, byte *dst,
 	int vsPitch, int vmScreenWidth, int textSurfacePitch) {
 
+	if (height <= 0)
+		height = 1;
+	if (width < 4)
+		return;
 
-	if (height <= 0) height = 1;
-	if (width < 4) return;
-
-
 	width &= ~4;
 //	src = (const byte *) (((int) (src)) & (~4));
 //	dst = (byte *) (((int) (dst)) & (~4));
@@ -144,22 +144,19 @@
 static bool isDivBy5Ready = false;
 static u32  DIV_BY_5[160];
 
-void ComputeDivBy5TableIFN()
-{
+void ComputeDivBy5TableIFN() {
     if (isDivBy5Ready)
         return;
     isDivBy5Ready = true;
 
-    for (int i=0; i<160; ++i)
-    {
+    for (int i = 0; i < 160; ++i) {
         DIV_BY_5[i] = (2*i+5)/10;
     }
 }
 
 #ifdef PERFECT_5_TO_4_RESCALING
 static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3, u16 s4,
-                                                    u16 *dest)
-{
+                                                    u16 *dest) {
     u32 bs0 = s0 & 0x1F;
     u32 bs1 = s1 & 0x1F;
     u32 bs2 = s2 & 0x1F;
@@ -233,8 +230,7 @@
 }
 #else
 static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3, u16 s4,
-                                                    u16 *dest)
-{
+                                                    u16 *dest) {
     static const u32 MASK = 0x03E07C1F;
 
     u32 argbargbs0 = u32(s0) | (u32(s0) << 16);
@@ -282,8 +278,7 @@
 #endif
 
 static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3, u32 s4,
-                                                    u16 *dest)
-{
+                                                    u16 *dest) {
     u32 d0 = 4*s0 +   s1;
     u32 d1 = 2*s1 +   s1 + 2*s2;
 
@@ -320,12 +315,10 @@
 
 // Can't work in place
 #ifdef PERFECT_5_TO_4_RESCALING
-static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16 *dest, const u8 *src, const u32 *palette)
-{
+static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16 *dest, const u8 *src, const u32 *palette) {
     ComputeDivBy5TableIFN();
 
-    for (size_t i=0; i<64; ++i)
-    {
+    for (size_t i = 0; i < 64; ++i) {
         u32 s0 = palette[src[5*i+0]];
         u32 s1 = palette[src[5*i+1]];
         u32 s2 = palette[src[5*i+2]];
@@ -336,10 +329,8 @@
     }
 }
 #else
-static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16 *dest, const u8 *src, const u16 *palette)
-{
-    for (size_t i=0; i<64; ++i)
-    {
+static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16 *dest, const u8 *src, const u16 *palette) {
+    for (size_t i = 0; i < 64; ++i) {
         u16 s0 = palette[src[5*i+0]];
         u16 s1 = palette[src[5*i+1]];
         u16 s2 = palette[src[5*i+2]];
@@ -353,12 +344,10 @@
 
 
 // Can work in place, because it's a contraction
-static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16 *dest, const u16 *src)
-{
+static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16 *dest, const u16 *src) {
     ComputeDivBy5TableIFN();
 
-    for (size_t i=0; i<64; ++i)
-    {
+    for (size_t i = 0; i < 64; ++i) {
         u16 s0 = src[5*i+0];
         u16 s1 = src[5*i+1];
         u16 s2 = src[5*i+2];
@@ -370,13 +359,11 @@
 }
 
 #ifdef PERFECT_5_TO_4_RESCALING
-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 fastRam[768];
 
     // Palette lookup -> 0_888
-    for (size_t i=0; i<256; ++i)
-    {
+    for (size_t i = 0; i < 256; ++i) {
         u32 col = palette[i];
         u32 result = col & 0x0000001F;
         result |= (col << 3) & 0x00001F00;
@@ -385,29 +372,24 @@
         fastRam[i] = result;
     }
 
-	for (size_t i=0; i<200; ++i)
-	{
+	for (size_t i = 0; i < 200; ++i) {
 		Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
 	}
 }
 #else
-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) {
 	u16 fastRam[256];
-    for (size_t i=0; i<128; ++i)
+    for (size_t i = 0; i < 128; ++i)
         ((u32*)fastRam)[i] = ((const u32*)palette)[i];
 
-	for (size_t i=0; i<200; ++i)
-	{
+	for (size_t i = 0; i < 200; ++i) {
 		Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
 	}
 }
 #endif
 
-void Rescale_320x256x1555_To_256x256x1555(u16 *dest, const u16 *src, int destStride, int srcStride)
-{
-	for (size_t i=0; i<200; ++i)
-	{
+void Rescale_320x256x1555_To_256x256x1555(u16 *dest, const u16 *src, int destStride, int srcStride) {
+	for (size_t i = 0; i < 200; ++i) {
 		Rescale_320x1555Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride);
 	}
 }

Modified: scummvm/trunk/backends/platform/ds/arm9/source/cdaudio.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/cdaudio.cpp	2010-07-05 20:25:33 UTC (rev 50707)
+++ scummvm/trunk/backends/platform/ds/arm9/source/cdaudio.cpp	2010-07-05 20:36:11 UTC (rev 50708)
@@ -328,45 +328,30 @@
 		int offset = 0;
 
 		switch (7 - (r & 0x0007)) {
-			case 0: {
-				offset = (word & 0xF0000000) >> 28;
-				break;
-			}
-
-			case 1: {
-				offset = (word & 0x0F000000) >> 24;
-				break;
-			}
-
-			case 2: {
-				offset = (word & 0x00F00000) >> 20;
-				break;
-			}
-
-			case 3: {
-				offset = (word & 0x000F0000) >> 16;
-				break;
-			}
-
-			case 4: {
-				offset = (word & 0x0000F000) >> 12;
-				break;
-			}
-
-			case 5: {
-				offset = (word & 0x00000F00) >> 8;
-				break;
-			}
-
-			case 6: {
-				offset = (word & 0x000000F0) >> 4;
-				break;
-			}
-
-			case 7: {
-				offset = (word & 0x0000000F);
-				break;
-			}
+		case 0:
+			offset = (word & 0xF0000000) >> 28;
+			break;
+		case 1:
+			offset = (word & 0x0F000000) >> 24;
+			break;
+		case 2:
+			offset = (word & 0x00F00000) >> 20;
+			break;
+		case 3:
+			offset = (word & 0x000F0000) >> 16;
+			break;
+		case 4:
+			offset = (word & 0x0000F000) >> 12;
+			break;
+		case 5:
+			offset = (word & 0x00000F00) >> 8;
+			break;
+		case 6:
+			offset = (word & 0x000000F0) >> 4;
+			break;
+		case 7:
+			offset = (word & 0x0000000F);
+			break;
 		}
 
 		int diff = 0;
@@ -409,7 +394,8 @@
 }
 
 void playNextBlock() {
-	if (!isPlayingFlag) return;
+	if (!isPlayingFlag)
+		return;
 	int lastBlockId = -1;
 
 	while (IPC->adpcm.semaphore);		// Wait for buffer to become free if needed
@@ -445,9 +431,6 @@
 //			DC_FlushAll();
 
 		}
-
-
-
 	}
 
 
@@ -463,7 +446,8 @@
 }
 
 void stopTrack() {
-	if (!isPlayingFlag) return;
+	if (!isPlayingFlag)
+		return;
 
 	DS::std_fclose(s_file);
 
@@ -473,7 +457,7 @@
 		audioBuffer[r] = 0;
 	}
 
-	for (int r= 0; r < waveHeader.fmtExtra; r++) {
+	for (int r = 0; r < waveHeader.fmtExtra; r++) {
 		decompressionBuffer[r] = 0;
 	}
 //	DS::stopSound(1);

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp	2010-07-05 20:25:33 UTC (rev 50707)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp	2010-07-05 20:36:11 UTC (rev 50708)
@@ -1026,8 +1026,9 @@
 }
 
 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
+	// 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;
@@ -1371,8 +1372,7 @@
 	system->addEvent(event);
 }
 
-void doButtonSelectMode(OSystem_DS *system)
-{
+void doButtonSelectMode(OSystem_DS *system) {
 	Common::Event event;
 
 
@@ -1670,12 +1670,9 @@
 
 		if (!keyboardEnable) {
 
-
 			if (((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) || (indyFightState)) && (displayModeIs8Bit)) {
 				// Controls specific to the control method
 
-
-
 				if (s_currentGame->control == CONT_SKY) {
 					// Extra controls for Beneath a Steel Sky
 					if ((getKeysDown() & KEY_DOWN)) {
@@ -1686,7 +1683,6 @@
 
 				if (s_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");
@@ -1699,11 +1695,8 @@
 						event.type = Common::EVENT_KEYUP;
 						system->addEvent(event);
 					}
-
 				}
 
-
-
 				if (s_currentGame->control == CONT_SIMON) {
 					// Extra controls for Simon the Sorcerer
 					if ((getKeysDown() & KEY_DOWN)) {
@@ -1719,8 +1712,6 @@
 					}
 				}
 
-
-
 				if (s_currentGame->control == CONT_SCUMM_ORIGINAL) {
 					// Extra controls for Scumm v1-5 games
 					if ((getKeysDown() & KEY_DOWN)) {
@@ -1803,9 +1794,7 @@
 		}
 
 		consumeKeys();
-
 		consumePenEvents();
-
 	}
 }
 
@@ -1835,23 +1824,19 @@
 	if (displayModeIs8Bit) {
 		if (!tapScreenClicks) {
 			switch (mouseMode) {
-				case MOUSE_LEFT: {
-					offs = 1;
-					break;
-				}
-				case MOUSE_RIGHT: {
-					offs = 2;
-					break;
-				}
- 				case MOUSE_HOVER: {
-					offs = 0;
-					break;
-				}
-				default: {
-					// Nothing!
-					offs = 0;
-					break;
-				}
+			case MOUSE_LEFT:
+				offs = 1;
+				break;
+			case MOUSE_RIGHT:
+				offs = 2;
+				break;
+			case MOUSE_HOVER:
+				offs = 0;
+				break;
+			default:
+				// Nothing!
+				offs = 0;
+				break;
 			}
 
 			setIcon(0, 208, 150, offs, 0, true);
@@ -1935,15 +1920,12 @@
 		SUB_BG3_YDX = 0;
 		SUB_BG3_YDY = y;
 	} else*/ {
-		if (isCpuScalerEnabled() && (x==320))
-		{
+		if (isCpuScalerEnabled() && (x==320)) {
 			BG3_XDX = 256;
 			BG3_XDY = 0;
 			BG3_YDX = 0;
 			BG3_YDY = y;
-		}
-		else
-		{
+		} else {
 			BG3_XDX = x;
 			BG3_XDY = 0;
 			BG3_YDX = 0;
@@ -2030,8 +2012,6 @@
 	soundUpdate();
 
 
-
-
 	if ((!gameScreenSwap) && (!(getKeysHeld() & KEY_L) && !(getKeysHeld() & KEY_R))) {
 		if (s_currentGame) {
 			if (s_currentGame->control != CONT_SCUMM_SAMNMAX) {
@@ -2607,9 +2587,6 @@
 
 					}
 				}
-				else
-				{
-				}
 
 			} else {
 				penDown = true;

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.cpp	2010-07-05 20:25:33 UTC (rev 50707)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.cpp	2010-07-05 20:36:11 UTC (rev 50708)
@@ -423,7 +423,7 @@
 
 		DS::setTrackPadStyleEnable(enable);
 
-		if ((enable) and (firstLoad)) {
+		if (enable && firstLoad) {
 			// If we've just booted up, want to swap screens when trackpad mode is in use
 			// but not every time we enter the options dialog.
 			DS::setGameScreenSwap(true);

Modified: scummvm/trunk/backends/platform/ds/arm9/source/keys.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/keys.cpp	2010-07-05 20:25:33 UTC (rev 50707)
+++ scummvm/trunk/backends/platform/ds/arm9/source/keys.cpp	2010-07-05 20:36:11 UTC (rev 50708)
@@ -74,7 +74,6 @@
 #include <nds/system.h>
 #include <nds/arm9/input.h>
 
-//------------------------------------------------------------------------------
 
 #define KEYS_CUR (( ((~REG_KEYINPUT)&0x3ff) | (((~IPC->buttons)&3)<<10) | (((~IPC->buttons)<<6) & (KEY_TOUCH|KEY_LID) ))^KEY_LID)
 
@@ -89,61 +88,47 @@
 static uint16 oldx = 0;
 static uint16 oldy = 0;
 
-//------------------------------------------------------------------------------
 void scanKeys(void) {
-//------------------------------------------------------------------------------
 	keysold = keys;
 	keys = KEYS_CUR;
 
 	oldx = IPC->touchXpx;
 	oldy = IPC->touchYpx;
-    if ( delay != 0 ) {
-        if ( keys != keysold ) {
-            count = delay ;
-            keysrepeat = keysDown() ;
+    if (delay != 0) {
+        if (keys != keysold) {
+            count = delay;
+            keysrepeat = keysDown();
         }
         count--;
-        if ( count == 0 ) {
+        if (count == 0) {
             count = repeat;
             keysrepeat = keys;
         }
     }
 }
 
-//------------------------------------------------------------------------------
 uint32 keysHeld(void) {
-//------------------------------------------------------------------------------
 	return keys;
 }
 
-//------------------------------------------------------------------------------
 uint32 keysDown(void) {
-//------------------------------------------------------------------------------
 	return (keys ^ keysold) & keys;
 }
 
-//------------------------------------------------------------------------------
 uint32 keysDownRepeat(void) {
-//------------------------------------------------------------------------------
 	uint32 tmp = keysrepeat;
-
     keysrepeat = 0;
-
     return tmp;
 }
 
-//------------------------------------------------------------------------------
 void keysSetRepeat( u8 setDelay, u8 setRepeat ) {
-//------------------------------------------------------------------------------
-    delay = setDelay ;
-    repeat = setRepeat ;
-    count = delay ;
-    keysrepeat = 0 ;
+    delay = setDelay;
+    repeat = setRepeat;
+    count = delay;
+    keysrepeat = 0;
 }
 
-//------------------------------------------------------------------------------
 uint32 keysUp(void) {
-//------------------------------------------------------------------------------
 	return (keys ^ keysold) & (~keys);
 }
 

Modified: scummvm/trunk/backends/platform/ds/arm9/source/keys.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/keys.h	2010-07-05 20:25:33 UTC (rev 50707)
+++ scummvm/trunk/backends/platform/ds/arm9/source/keys.h	2010-07-05 20:36:11 UTC (rev 50708)
@@ -30,7 +30,7 @@
 uint32 keysHeld(void);
 uint32 keysDown(void);
 uint32 keysDownRepeat(void);
-void keysSetRepeat( u8 setDelay, u8 setRepeat );
+void keysSetRepeat(u8 setDelay, u8 setRepeat);
 uint32 keysUp(void);
 
 }	// End of namespace DS

Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp	2010-07-05 20:25:33 UTC (rev 50707)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp	2010-07-05 20:36:11 UTC (rev 50708)
@@ -208,8 +208,7 @@
 	}
 }
 
-void OSystem_DS::restoreHardwarePalette()
-{
+void OSystem_DS::restoreHardwarePalette() {
 	// Set the hardware palette up based on the stored palette
 
 	for (int r = 0; r < 255; r++) {

Modified: scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp	2010-07-05 20:25:33 UTC (rev 50707)
+++ scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp	2010-07-05 20:36:11 UTC (rev 50708)
@@ -44,7 +44,7 @@
 #define DS_CAPSLOCK 1
 
 
-key_data keys[DS_NUM_KEYS] = {
+static key_data keys[DS_NUM_KEYS] = {
 	// Key number		x		y		character
 
 	// Numbers
@@ -137,27 +137,27 @@
 
 };
 
-int keyboardX;
-int keyboardY;
+static int keyboardX;
+static int keyboardY;
 
 static int s_mapBase;
 static int s_tileBase;
 
-u16 *baseAddress;
+static u16 *baseAddress;
 
-bool shiftState;
-bool capsLockState;
+static bool shiftState;
+static bool capsLockState;
 
-bool closed;
+static bool closed;
 
-char autoCompleteWord[NUM_WORDS][32];
-int autoCompleteCount;
+static char autoCompleteWord[NUM_WORDS][32];
+static int autoCompleteCount;
 
-char autoCompleteBuffer[128];
+static char autoCompleteBuffer[128];
 
-int selectedCompletion = -1;
-int charactersEntered = 0;
-int typingTimeout = 0;
+static int selectedCompletion = -1;
+static int charactersEntered = 0;
+static int typingTimeout = 0;
 
 // Render text onto the tiled screen
 
@@ -396,8 +396,7 @@
 		event.type = Common::EVENT_KEYUP;
 		system->addEvent(event);
 
-		for (int r = 0; r < (int)strlen(autoCompleteBuffer); r++)
-		{
+		for (int r = 0; r < (int)strlen(autoCompleteBuffer); r++) {
 			autoCompleteBuffer[r] = autoCompleteBuffer[r + 1];
 		}
 
@@ -405,8 +404,7 @@
 	}
 }
 
-void createKeyEvent(int keyNum, Common::Event& event)
-{
+void createKeyEvent(int keyNum, Common::Event& event) {
 	event.kbd.flags = 0;
 
 	if ((keys[keyNum].character >= '0') && (keys[keyNum].character <= '9')) {

Modified: scummvm/trunk/backends/platform/ds/arm9/source/zipreader.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/zipreader.cpp	2010-07-05 20:25:33 UTC (rev 50707)
+++ scummvm/trunk/backends/platform/ds/arm9/source/zipreader.cpp	2010-07-05 20:36:11 UTC (rev 50708)
@@ -79,7 +79,6 @@
 	bool more = true;
 
 	while (!currentFileInFolder() && more) {
-		char name[128];
 		getFileName(name);
 		more = skipFile();
 	}


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