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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Jan 21 05:03:22 CET 2009


Revision: 35976
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35976&view=rev
Author:   fingolfin
Date:     2009-01-21 04:03:22 +0000 (Wed, 21 Jan 2009)

Log Message:
-----------
cleanup

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

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.cpp	2009-01-21 02:28:14 UTC (rev 35975)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsoptions.cpp	2009-01-21 04:03:22 UTC (rev 35976)
@@ -284,28 +284,23 @@
 
 	static bool guard = false;
 
-	if ((!guard) && (_radioButtonMode))
-	{
+	if ((!guard) && (_radioButtonMode)) {
 		guard = true;
 
-		if ((cmd & 0xFF000000) == 0x10000000)
-		{
+		if ((cmd & 0xFF000000) == 0x10000000) {
 			_cpuScaler->setState(false);
 			_hardScaler->setState(false);
 			_unscaledCheckbox->setState(false);
 
-			if ((sender == _cpuScaler) && (cmd == 0x10000002))
-			{
+			if ((sender == _cpuScaler) && (cmd == 0x10000002)) {
 				_cpuScaler->setState(true);
 			}
 
-			if ((sender == _hardScaler) && (cmd == 0x10000001))
-			{
+			if ((sender == _hardScaler) && (cmd == 0x10000001)) {
 				_hardScaler->setState(true);
 			}
 
-			if ((sender == _unscaledCheckbox) && (cmd == 0x10000003))
-			{
+			if ((sender == _unscaledCheckbox) && (cmd == 0x10000003)) {
 				_unscaledCheckbox->setState(true);
 			}
 		}

Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp	2009-01-21 02:28:14 UTC (rev 35975)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp	2009-01-21 04:03:22 UTC (rev 35976)
@@ -85,18 +85,17 @@
 }
 
 bool OSystem_DS::hasFeature(Feature f) {
-//	consolePrintf("hasfeature\n");
 	return (f == kFeatureVirtualKeyboard) || (f == kFeatureCursorHasPalette);
 }
 
 void OSystem_DS::setFeatureState(Feature f, bool enable) {
-//	consolePrintf("setfeature f=%d e=%d\n", f, enable);
-	if (f == kFeatureVirtualKeyboard) DS::setKeyboardIcon(enable);
+	if (f == kFeatureVirtualKeyboard)
+		DS::setKeyboardIcon(enable);
 }
 
 bool OSystem_DS::getFeatureState(Feature f) {
-//	consolePrintf("getfeat\n");
-	if (f == kFeatureVirtualKeyboard) return DS::getKeyboardIcon();
+	if (f == kFeatureVirtualKeyboard)
+		return DS::getKeyboardIcon();
 	return false;
 }
 
@@ -201,11 +200,9 @@
 
 
 	const u16* image = (const u16 *) DS::get8BitBackBuffer();
-	for (int y = 0; y <  DS::getGameHeight(); y++)
-	{
+	for (int y = 0; y <  DS::getGameHeight(); y++) {
 		DC_FlushRange(image + (y << 8), DS::getGameWidth());
-		for (int x = 0; x < DS::getGameWidth() >> 1; x++)
-		{
+		for (int x = 0; x < DS::getGameWidth() >> 1; x++) {
 			*(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[(y << 8) + x];
 		}
 	}
@@ -235,16 +232,16 @@
 
 	u16* bg;
 	s32 stride;
-	u16* bgSub = (u16 *) BG_GFX_SUB;
+	u16* bgSub = (u16 *)BG_GFX_SUB;
 
 	// The DS video RAM doesn't support 8-bit writes because Nintendo wanted
 	// to save a few pennies/euro cents on the hardware.
 
 	if (_frameBufferExists) {
-		bg = (u16 *) _framebuffer.pixels;
+		bg = (u16 *)_framebuffer.pixels;
 		stride = _framebuffer.pitch;
 	} else {
-		bg = (u16 *) DS::get8BitBackBuffer();
+		bg = (u16 *)DS::get8BitBackBuffer();
 		stride = DS::get8BitBackBufferStride();
 	}
 
@@ -370,6 +367,7 @@
 //	DS::doTimerCallback();
 	DS::addEventsToQueue();
 
+	// FIXME: Evil game specific hack.
 	// Force back buffer usage for Nippon Safes, as it doesn't double buffer it's output
 	if (DS::getControlType() == DS::CONT_NIPPON) {
 		OSystem_DS::instance()->lockScreen();
@@ -381,25 +379,25 @@
 	DS::setShakePos(shakeOffset);
 }
 
-void OSystem_DS::showOverlay () {
+void OSystem_DS::showOverlay() {
 //	consolePrintf("showovl\n");
 	DS::displayMode16Bit();
 }
 
-void OSystem_DS::hideOverlay () {
+void OSystem_DS::hideOverlay() {
 	DS::displayMode8Bit();
 }
 
-void OSystem_DS::clearOverlay () {
+void OSystem_DS::clearOverlay() {
 	memset((u16 *) DS::get16BitBackBuffer(), 0, 512 * 256 * 2);
 //	consolePrintf("clearovl\n");
 }
 
-void OSystem_DS::grabOverlay (OverlayColor *buf, int pitch) {
+void OSystem_DS::grabOverlay(OverlayColor *buf, int pitch) {
 //	consolePrintf("grabovl\n");
 }
 
-void OSystem_DS::copyRectToOverlay (const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void OSystem_DS::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
 	u16* bg = (u16 *) DS::get16BitBackBuffer();
 	const u16* src = (const u16 *) buf;
 
@@ -591,8 +589,7 @@
 	DS::CD::stopTrack();
 }
 
-void OSystem_DS::updateCD()
-{
+void OSystem_DS::updateCD() {
 }
 
 void OSystem_DS::quit() {
@@ -638,10 +635,12 @@
 
 	// 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 the scaler is enabled, we can just return the 8 bit back buffer,
+	// since it's in system memory anyway.  Otherwise, we need to copy the back
+	// buffer into the memory normally used by the scaler buffer and then
+	// return it.
+	// We also must ensure that once the frame buffer is created, future calls
+	// to copyRectToScreen() copy to this buffer.
 
 	if (DS::isCpuScalerEnabled()) {
 
@@ -651,7 +650,6 @@
 		_framebuffer.pitch = DS::getGameWidth();
 		_framebuffer.bytesPerPixel = 1;
 
-
 	} else {
 
 		s32 height = DS::getGameHeight();
@@ -720,7 +718,7 @@
 
 
 void OSystem_DS::addAutoComplete(const char *word) {
-	DS::addAutoComplete((char *) word);
+	DS::addAutoComplete(word);
 }
 
 void OSystem_DS::clearAutoComplete() {
@@ -730,10 +728,3 @@
 void OSystem_DS::setCharactersEntered(int count) {
 	DS::setCharactersEntered(count);
 }
-
-OSystem *OSystem_DS_create() {
-	return new OSystem_DS();
-}
-
-
-

Modified: scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp	2009-01-21 02:28:14 UTC (rev 35975)
+++ scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.cpp	2009-01-21 04:03:22 UTC (rev 35976)
@@ -299,7 +299,7 @@
 	}
 }
 
-void addAutoComplete(char* word) {
+void addAutoComplete(const char* word) {
 	if (autoCompleteCount == NUM_WORDS) return;
 	strcpy(&autoCompleteWord[autoCompleteCount++][0], word);
 	drawAutoComplete();

Modified: scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.h	2009-01-21 02:28:14 UTC (rev 35975)
+++ scummvm/trunk/backends/platform/ds/arm9/source/touchkeyboard.h	2009-01-21 04:03:22 UTC (rev 35976)
@@ -37,7 +37,7 @@
 void addKeyboardEvents();
 bool getKeyboardClosed();
 
-void addAutoComplete(char* word);
+void addAutoComplete(const char* word);
 void clearAutoComplete();
 void setCharactersEntered(int count);
 void releaseAllKeys();

Modified: scummvm/trunk/backends/platform/ds/arm9/source/wordcompletion.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/wordcompletion.cpp	2009-01-21 02:28:14 UTC (rev 35975)
+++ scummvm/trunk/backends/platform/ds/arm9/source/wordcompletion.cpp	2009-01-21 04:03:22 UTC (rev 35976)
@@ -17,16 +17,14 @@
 char* wordBufferPtr[MAX_WORD_COUNT];
 int wordBufferPtrPos = 0;
 
-void addAutoCompleteLine(char* line) {
+void addAutoCompleteLine(const char *line) {
 
-	while (*line != 0)
-	{
+	while (*line != 0) {
 		char word[32];
 		int length;
 
 		// Skip the T9-style numbers
-		while (*line != ' ')
-		{
+		while (*line != ' ') {
 			line++;
 		}
 		line++;
@@ -64,15 +62,14 @@
 
 void sortAutoCompleteWordList() {
 	// Sort the whole word list into alphabetical order
-	qsort((void *) wordBufferPtr, wordBufferPtrPos, 4, stringCompare);
+	qsort((void *)wordBufferPtr, wordBufferPtrPos, 4, stringCompare);
 }
 
 // Sends the current available words to the virtual keyboard code for display
-bool findWordCompletions(char* input)
-{
+bool findWordCompletions(const char* input) {
 	int min = 0;
 	int max = wordBufferPtrPos - 1;
-	char* word;
+	char *word;
 	int position;
 	char partialWord[32];
 
@@ -92,8 +89,7 @@
 	}
 	strcpy(partialWord, &input[start]);
 
-	if (strlen(partialWord) == 0)
-	{
+	if (*partialWord == 0) {
 		return false;
 	}
 
@@ -103,10 +99,8 @@
 		// Get the word from the dictonary line
 		word = wordBufferPtr[position];
 
-
-
 		// Now check to see if the word is before or after the stub we're after
-		int result = scumm_stricmp((const char *) partialWord, (const char *) word);
+		int result = scumm_stricmp(partialWord, word);
 
 		if (result == 0) {
 			// We've found the whole word.  Aren't we good.
@@ -144,7 +138,8 @@
 
 	if (!match) {
 		position++;
-		if (position == wordBufferPtrPos) return false;
+		if (position == wordBufferPtrPos)
+			return false;
 		word = wordBufferPtr[position];
 //		consolePrintf("Final word: %s\n", word);
 	}

Modified: scummvm/trunk/backends/platform/ds/arm9/source/wordcompletion.h
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/wordcompletion.h	2009-01-21 02:28:14 UTC (rev 35975)
+++ scummvm/trunk/backends/platform/ds/arm9/source/wordcompletion.h	2009-01-21 04:03:22 UTC (rev 35976)
@@ -1,7 +1,7 @@
 namespace DS {
 
-extern bool findWordCompletions(char* input);
-extern void addAutoCompleteLine(char* line);
+extern bool findWordCompletions(const char *input);
+extern void addAutoCompleteLine(const char *line);
 extern void sortAutoCompleteWordList();
 
 }


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