aboutsummaryrefslogtreecommitdiff
path: root/backends/PalmOS
diff options
context:
space:
mode:
authorChris Apers2003-11-28 09:21:45 +0000
committerChris Apers2003-11-28 09:21:45 +0000
commitfa2abbf4556d079695d127400d8dbe74b57d7d0e (patch)
tree0936fb2e98728f37aea0576500e8fd7342c90b12 /backends/PalmOS
parent3cfeebdb1fd69939cdc97f05cf97d90674e12fe8 (diff)
downloadscummvm-rg350-fa2abbf4556d079695d127400d8dbe74b57d7d0e.tar.gz
scummvm-rg350-fa2abbf4556d079695d127400d8dbe74b57d7d0e.tar.bz2
scummvm-rg350-fa2abbf4556d079695d127400d8dbe74b57d7d0e.zip
Process new games database version
svn-id: r11390
Diffstat (limited to 'backends/PalmOS')
-rw-r--r--backends/PalmOS/Src/games.cpp111
-rw-r--r--backends/PalmOS/Src/games.h26
2 files changed, 101 insertions, 36 deletions
diff --git a/backends/PalmOS/Src/games.cpp b/backends/PalmOS/Src/games.cpp
index 364bfd6c3e..6b08326913 100644
--- a/backends/PalmOS/Src/games.cpp
+++ b/backends/PalmOS/Src/games.cpp
@@ -51,7 +51,6 @@ static Err GamUpdateList() {
if (version != curItemVersion && size != sizeof(GameInfoType)) {
UInt16 index;
GameInfoType gitCur;
- GameInfoTypeV0 git0;
void *tmpP;
FormPtr ofmP, frmP;
@@ -62,40 +61,82 @@ static Err GamUpdateList() {
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);
-
- // 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);
+ if (version == itemVersion_2) {
+ // need conversion from V2 -> V2.5
+ GameInfoTypeV2 git0;
+
+ for (index = 0; index < numRecs; index++) {
+
+ // get old data
+ tmpH = DmQueryRecord(gameDB, index);
+ tmpP = MemHandleLock(tmpH);
+ MemMove(&git0, tmpP, sizeof(GameInfoTypeV2));
+ 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.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);
diff --git a/backends/PalmOS/Src/games.h b/backends/PalmOS/Src/games.h
index 1dcbcb33a1..a43a0e1577 100644
--- a/backends/PalmOS/Src/games.h
+++ b/backends/PalmOS/Src/games.h
@@ -46,7 +46,6 @@ typedef struct {
} GameInfoTypeV0;
-// Current config
typedef struct {
UInt32 version;
UInt16 icnID; // icon to display on the list
@@ -69,6 +68,31 @@ typedef struct {
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;
+ Boolean bootParam;
+ Boolean setPlatform;
+ Boolean subtitles;
+ Boolean talkSpeed;
+
+ UInt16 loadSlot;
+ UInt16 bootValue;
+ UInt16 talkValue;
+ UInt8 platform;
+ UInt8 language;
+
} GameInfoType;
// protos