[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src games.cpp,1.4,1.5 games.h,1.4,1.5

Chris Apers chrilith at users.sourceforge.net
Tue Jan 20 06:04:05 CET 2004


Update of /cvsroot/scummvm/scummvm/backends/PalmOS/Src
In directory sc8-pr-cvs1:/tmp/cvs-serv6018

Modified Files:
	games.cpp games.h 
Log Message:
Fixed GamUnselect function, added GamJumpTo

Index: games.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/games.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- games.cpp	6 Jan 2004 12:45:25 -0000	1.4
+++ games.cpp	20 Jan 2004 14:03:50 -0000	1.5
@@ -22,9 +22,11 @@
 
 #include <PalmOS.h>
 #include <VFSMgr.h>
+#include <ctype.h>
 
 #include "start.h"
 #include "games.h"
+#include "skin.h"
 
 #include "extend.h"
 #include "StarterRsc.h"
@@ -247,7 +249,6 @@
 }
 
 void GamUnselect() {
-	GameInfoType modGame;
 	GameInfoType *game;
 
 	MemHandle recordH;
@@ -256,12 +257,13 @@
 	index = GamGetSelected();
 	
 	if (index != dmMaxRecordIndex) {
+		Boolean newValue;
+		
 		recordH = DmGetRecord(gameDB, index);
 		game = (GameInfoType *)MemHandleLock(recordH);
-
-		MemMove(&modGame, game, sizeof(GameInfoType));	
-		modGame.selected = !modGame.selected;
-		DmWrite(game, 0, &modGame, sizeof(GameInfoType));
+		
+		newValue = false;
+		DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean));
 
 		MemHandleUnlock(recordH);
 		DmReleaseRecord (gameDB, index, 0);
@@ -288,3 +290,47 @@
 
 	return dmMaxRecordIndex;
 }
+
+Boolean GamJumpTo(Char letter) {
+	MemHandle record;
+	GameInfoType *game;
+	Boolean found = false;
+	UInt16 index = 0;
+	UInt16 maxIndex = DmNumRecords(gameDB);
+	UInt16 active = GamGetSelected();
+
+	while (index < maxIndex) {
+		record = DmGetRecord(gameDB, index);
+		game = (GameInfoType *)MemHandleLock(record);
+		
+		if (tolower(game->nameP[0]) == tolower(letter)) {
+			found = true;
+
+			if (index != active) {
+				RectangleType rArea;
+				UInt16 maxView;
+				Boolean newValue = true;
+
+				SknGetListBounds(&rArea, NULL);
+				maxView = rArea.extent.y / sknInfoListItemSize;
+
+				GamUnselect();
+				DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean));
+				
+				if (index < gPrefs->listPosition || index >= (gPrefs->listPosition + maxView))
+					gPrefs->listPosition = index;
+			}
+		}
+
+		MemHandleUnlock(record);
+		DmReleaseRecord (gameDB, index, 0);
+
+		index++;
+		
+		if (found)
+			return found;
+	}
+
+	return found;
+}
+

Index: games.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/games.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- games.h	6 Jan 2004 12:45:25 -0000	1.4
+++ games.h	20 Jan 2004 14:03:50 -0000	1.5
@@ -102,6 +102,7 @@
 Err		GamSortList			();
 UInt16	GamGetSelected		();
 void	GamUnselect			();
+Boolean GamJumpTo			(Char letter);
 
 extern DmOpenRef gameDB;
 





More information about the Scummvm-git-logs mailing list