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

Chris Apers chrilith at users.sourceforge.net
Fri Nov 28 01:22:03 CET 2003


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

Modified Files:
	games.cpp games.h 
Log Message:
Process new games database version

Index: games.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/games.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- games.cpp	3 Nov 2003 16:16:57 -0000	1.2
+++ games.cpp	28 Nov 2003 09:21:45 -0000	1.3
@@ -51,7 +51,6 @@
 			if (version != curItemVersion && size != sizeof(GameInfoType)) {
 				UInt16 index;
 				GameInfoType gitCur;
-				GameInfoTypeV0 git0;
 				void *tmpP;
 				FormPtr ofmP, frmP;
 				
@@ -62,40 +61,82 @@
 				FrmDrawForm(frmP);
 				SysTaskDelay(200);
 
-				// need conversion from V0 -> V2
-				for (index = 0; index < numRecs; index++) {
-					
-					// get old data
-					tmpH = DmQueryRecord(gameDB, index);
-					tmpP = MemHandleLock(tmpH);
-					MemMove(&git0, tmpP, sizeof(GameInfoTypeV0));
-					MemHandleUnlock(tmpH);
+				if (version == itemVersion_2) {
+					// need conversion from V2 -> V2.5
+					GameInfoTypeV2 git0;
 
-					// convert to new format
-					gitCur.version = curItemVersion;
-					gitCur.icnID = 0xFFFF;
-					gitCur.selected = git0.selected;
-					StrCopy(gitCur.nameP, git0.nameP);
-					StrCopy(gitCur.pathP, git0.pathP);
-					StrCopy(gitCur.gameP, git0.gameP);
-					gitCur.gfxMode = git0.gfxMode;
-					
-					gitCur.autoLoad = git0.autoLoad;
-					gitCur.bootParam = git0.bootParam;
-					gitCur.setPlatform = git0.amiga;	// amiga become platform amiga/atari-st/machintosh
-					gitCur.subtitles = git0.subtitles;
-					gitCur.talkSpeed = git0.talkSpeed;
+					for (index = 0; index < numRecs; index++) {
+						
+						// get old data
+						tmpH = DmQueryRecord(gameDB, index);
+						tmpP = MemHandleLock(tmpH);
+						MemMove(&git0, tmpP, sizeof(GameInfoTypeV2));
+						MemHandleUnlock(tmpH);
 
-					gitCur.loadSlot = git0.loadSlot;
-					gitCur.bootValue = git0.bootValue;
-					gitCur.talkValue = git0.talkValue;
-					gitCur.platform = 0;	// default to amiga
-					gitCur.language = git0.language;
-					
-					tmpH = DmResizeRecord(gameDB, index, sizeof(GameInfoType));	// TODO : check error on resize tmpH==NULL
-					tmpP = MemHandleLock(tmpH);
-					DmWrite(tmpP, 0, &gitCur, sizeof(GameInfoType));
-					MemPtrUnlock(tmpP);
+						// convert to new format
+						gitCur.version = curItemVersion;
+						gitCur.icnID = 0xFFFF;
+						gitCur.selected = git0.selected;
+						StrCopy(gitCur.nameP, git0.nameP);
+						StrCopy(gitCur.pathP, git0.pathP);
+						StrCopy(gitCur.gameP, git0.gameP);
+						gitCur.gfxMode = git0.gfxMode;
+						
+						gitCur.autoLoad = git0.autoLoad;
+						gitCur.bootParam = git0.bootParam;
+						gitCur.setPlatform = git0.setPlatform;
+						gitCur.subtitles = git0.subtitles;
+						gitCur.talkSpeed = git0.talkSpeed;
+
+						gitCur.loadSlot = git0.loadSlot;
+						gitCur.bootValue = git0.bootValue;
+						gitCur.talkValue = git0.talkValue;
+						gitCur.platform = git0.platform;
+						gitCur.language = git0.language;
+						
+						tmpH = DmResizeRecord(gameDB, index, sizeof(GameInfoType));	// TODO : check error on resize tmpH==NULL
+						tmpP = MemHandleLock(tmpH);
+						DmWrite(tmpP, 0, &gitCur, sizeof(GameInfoType));
+						MemPtrUnlock(tmpP);
+					}
+				} else {
+					// need conversion from V0 -> V2.5
+					GameInfoTypeV0 git0;
+
+					for (index = 0; index < numRecs; index++) {
+						
+						// get old data
+						tmpH = DmQueryRecord(gameDB, index);
+						tmpP = MemHandleLock(tmpH);
+						MemMove(&git0, tmpP, sizeof(GameInfoTypeV0));
+						MemHandleUnlock(tmpH);
+
+						// convert to new format
+						gitCur.version = curItemVersion;
+						gitCur.icnID = 0xFFFF;
+						gitCur.selected = git0.selected;
+						StrCopy(gitCur.nameP, git0.nameP);
+						StrCopy(gitCur.pathP, git0.pathP);
+						StrCopy(gitCur.gameP, git0.gameP);
+						gitCur.gfxMode = git0.gfxMode;
+						
+						gitCur.autoLoad = git0.autoLoad;
+						gitCur.bootParam = git0.bootParam;
+						gitCur.setPlatform = git0.amiga;	// amiga become platform amiga/atari-st/machintosh
+						gitCur.subtitles = git0.subtitles;
+						gitCur.talkSpeed = git0.talkSpeed;
+
+						gitCur.loadSlot = git0.loadSlot;
+						gitCur.bootValue = git0.bootValue;
+						gitCur.talkValue = git0.talkValue;
+						gitCur.platform = 0;	// default to amiga
+						gitCur.language = git0.language;
+						
+						tmpH = DmResizeRecord(gameDB, index, sizeof(GameInfoType));	// TODO : check error on resize tmpH==NULL
+						tmpP = MemHandleLock(tmpH);
+						DmWrite(tmpP, 0, &gitCur, sizeof(GameInfoType));
+						MemPtrUnlock(tmpP);
+					}
 				}
 
 				FrmEraseForm(frmP);

Index: games.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/games.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- games.h	3 Nov 2003 16:16:57 -0000	1.2
+++ games.h	28 Nov 2003 09:21:45 -0000	1.3
@@ -46,7 +46,6 @@
 
 } GameInfoTypeV0;
 
-// Current config
 typedef struct {
 	UInt32	version;
 	UInt16	icnID;			// icon to display on the list
@@ -55,6 +54,31 @@
 	Char 	nameP[50];		// game name to display in list
 	Char 	pathP[150];		// path to the game files
 	Char 	gameP[10];		// scumm name of the game
+	UInt16	gfxMode;
+
+	Boolean autoLoad;
+	Boolean bootParam;
+	Boolean setPlatform;
+	Boolean subtitles;
+	Boolean talkSpeed;
+
+	UInt16 loadSlot;
+	UInt16 bootValue;
+	UInt16 talkValue;
+	UInt8 platform;
+	UInt8 language;
+
+} GameInfoTypeV2;
+
+// Current config
+typedef struct {
+	UInt32	version;
+	UInt16	icnID;			// icon to display on the list
+	Boolean	selected;
+
+	Char 	nameP[50];		// game name to display in list
+	Char 	pathP[150];		// path to the game files
+	Char 	gameP[15];		// scumm name of the game
 	UInt16	gfxMode;
 
 	Boolean autoLoad;





More information about the Scummvm-git-logs mailing list