[Scummvm-cvs-logs] CVS: scummvm/backends/wince findgame.cpp,1.8,1.9
Nicolas Bacca
arisme at users.sourceforge.net
Sun Jan 26 13:42:02 CET 2003
Update of /cvsroot/scummvm/scummvm/backends/wince
In directory sc8-pr-cvs1:/tmp/cvs-serv26629
Modified Files:
findgame.cpp
Log Message:
Changes for Smartphone calls
Index: findgame.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/findgame.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- findgame.cpp 1 Dec 2002 23:24:02 -0000 1.8
+++ findgame.cpp 26 Jan 2003 21:41:07 -0000 1.9
@@ -41,6 +41,8 @@
extern Config *g_config;
+#define CURRENT_GAMES_VERSION 3
+
#define MAX_GAMES 23
int MAX_DIRECTORY = 40;
@@ -236,8 +238,9 @@
void displayDirectoryList(void);
void displayGamesList(void);
void doScan(void);
-void startFindGame(void);
-bool loadGameSettings(void);
+void startFindGame(BOOL, TCHAR*);
+bool loadGameSettings(BOOL);
+void sortFoundGames(void);
char gamesFound[MAX_GAMES];
GameReference listIndex[MAX_GAMES];
@@ -260,7 +263,7 @@
extern int _game_selection_X_offset;
extern int _game_selection_Y_offset;
-int chooseGame(bool need_rescan) {
+int chooseGame() {
if (directories)
free(directories);
@@ -270,8 +273,7 @@
setGameSelectionPalette();
drawBlankGameSelection();
- if (!need_rescan)
- loadGameSettings();
+ loadGameSettings(TRUE);
_game_selected = false;
while (!_game_selected) {
MSG msg;
@@ -297,14 +299,20 @@
hwndDlg = x;
}
-bool loadGameSettings() {
+bool loadGameSettings(BOOL display) {
int index;
int i;
const char *current;
+ int version;
/*prescanning = FALSE;*/
_scanning = false;
+ /* check version */
+ version = g_config->getInt("GamesVersion", 0, "wince");
+ if (!version || version != CURRENT_GAMES_VERSION)
+ return FALSE;
+
current = g_config->get("GamesInstalled", "wince");
if (!current)
return FALSE;
@@ -341,7 +349,10 @@
MultiByteToWideChar(CP_ACP, 0, current, strlen(current) + 1, gamesInstalled[i].directory, sizeof(gamesInstalled[i].directory));
}
- displayFoundGames();
+ if (display)
+ displayFoundGames();
+ else
+ sortFoundGames();
return TRUE;
}
@@ -357,8 +368,7 @@
return number;
}
-int displayFoundGames() {
-
+void sortFoundGames() {
int i;
_total_games = 0;
@@ -392,6 +402,10 @@
_total_games++;
}
}
+}
+
+int displayFoundGames() {
+ sortFoundGames();
displayGamesList();
@@ -598,6 +612,18 @@
}
}
+int getTotalGames() {
+ return _total_games;
+}
+
+TCHAR* getGameName(int x) {
+ static TCHAR gameName[100];
+
+ MultiByteToWideChar(CP_ACP, 0, listIndex[x].name, strlen(listIndex[x].name) + 1, gameName, sizeof(gameName));
+
+ return gameName;
+}
+
void displayDirectoryList() {
int current = _first_index;
int index_link = 0;
@@ -650,7 +676,7 @@
SetDlgItemText(hwndDlg, IDC_SCAN, TEXT("Scan"));
ShowWindow(GetDlgItem(hwndDlg, IDC_PLAY), SW_SHOW);
*/
- startFindGame();
+ startFindGame(TRUE, NULL);
}
void abortScanPath() {
@@ -667,7 +693,7 @@
displayFoundGames();
}
-void startFindGame() {
+void startFindGame(BOOL display, TCHAR *path) {
//TCHAR fileName[MAX_PATH];
//TCHAR *tempo;
int i = 0;
@@ -679,8 +705,10 @@
_scanning = false;
//SetDlgItemText(hwndDlg, IDC_FILEPATH, TEXT("Scanning, please wait"));
- drawBlankGameSelection();
- drawCommentString("Scanning, please wait");
+ if (display) {
+ drawBlankGameSelection();
+ drawCommentString("Scanning, please wait");
+ }
//SendMessage(GetDlgItem(hwndDlg, IDC_LISTAVAILABLE), LB_RESETCONTENT, 0, 0);
@@ -694,14 +722,22 @@
installedGamesNumber = 0;
//findGame(fileName);
+ if (path)
+ wcscpy(basePath, path);
findGame(basePath);
// Display the results
- index = displayFoundGames();
+ if (display)
+ index = displayFoundGames();
+ else {
+ sortFoundGames();
+ index = _total_games;
+ }
// Save the results in the registry
//SetDlgItemText(hwndDlg, IDC_FILEPATH, TEXT("Saving the results"));
- drawCommentString("Saving the results");
+ if (display)
+ drawCommentString("Saving the results");
g_config->setInt("GamesInstalled", index, "wince");
@@ -726,10 +762,13 @@
g_config->set(keyName, workdir, "wince");
}
+ g_config->setInt("GamesVersion", CURRENT_GAMES_VERSION, "wince");
+
g_config->flush();
//SetDlgItemText(hwndDlg, IDC_FILEPATH, TEXT("Scan finished"));
- drawCommentString("Scan finished");
+ if (display)
+ drawCommentString("Scan finished");
}
@@ -912,7 +951,7 @@
if (!_scanning)
startScan();
else
- startFindGame();
+ startFindGame(TRUE, NULL);
}
if ((x>=93 && x<=129)) {
if (!_scanning) {
@@ -922,7 +961,7 @@
_game_selected = true;
}
else
- startFindGame();
+ startFindGame(TRUE, NULL);
}
if (x>=175 && x<=208) {
if (!_scanning) {
More information about the Scummvm-git-logs
mailing list