aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorChris Apers2004-01-20 14:03:50 +0000
committerChris Apers2004-01-20 14:03:50 +0000
commit79db0a1853f368e8413f51f6e28a77f9d2b2fc94 (patch)
tree2dae38bf8ea717fb8525ee7b4dab835ff4004989 /backends
parent89ae755bdcecf09e04543c920e8b7b27e0d0715a (diff)
downloadscummvm-rg350-79db0a1853f368e8413f51f6e28a77f9d2b2fc94.tar.gz
scummvm-rg350-79db0a1853f368e8413f51f6e28a77f9d2b2fc94.tar.bz2
scummvm-rg350-79db0a1853f368e8413f51f6e28a77f9d2b2fc94.zip
Fixed GamUnselect function, added GamJumpTo
svn-id: r12545
Diffstat (limited to 'backends')
-rw-r--r--backends/PalmOS/Src/games.cpp56
-rw-r--r--backends/PalmOS/Src/games.h1
2 files changed, 52 insertions, 5 deletions
diff --git a/backends/PalmOS/Src/games.cpp b/backends/PalmOS/Src/games.cpp
index d75b47a353..33ba1a7fb2 100644
--- a/backends/PalmOS/Src/games.cpp
+++ b/backends/PalmOS/Src/games.cpp
@@ -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 @@ Err GamSortList() {
}
void GamUnselect() {
- GameInfoType modGame;
GameInfoType *game;
MemHandle recordH;
@@ -256,12 +257,13 @@ void GamUnselect() {
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 @@ UInt16 GamGetSelected() {
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;
+}
+
diff --git a/backends/PalmOS/Src/games.h b/backends/PalmOS/Src/games.h
index f43c83b9f7..a381388629 100644
--- a/backends/PalmOS/Src/games.h
+++ b/backends/PalmOS/Src/games.h
@@ -102,6 +102,7 @@ void GamCloseDatabase (Boolean ignoreCardParams);
Err GamSortList ();
UInt16 GamGetSelected ();
void GamUnselect ();
+Boolean GamJumpTo (Char letter);
extern DmOpenRef gameDB;