[Scummvm-cvs-logs] CVS: scummvm/backends/wince findgame.cpp,1.12,1.13
Nicolas Bacca
arisme at users.sourceforge.net
Sun Oct 12 06:36:08 CEST 2003
Update of /cvsroot/scummvm/scummvm/backends/wince
In directory sc8-pr-cvs1:/tmp/cvs-serv10162
Modified Files:
findgame.cpp
Log Message:
New config-manager, Add Broken Sword 2, Whole filesystem scan for smartphone thanks to MS non standard storage mappings
Index: findgame.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/findgame.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- findgame.cpp 21 Jul 2003 22:28:23 -0000 1.12
+++ findgame.cpp 12 Oct 2003 13:35:31 -0000 1.13
@@ -35,15 +35,13 @@
#include <Winuser.h>
#include <Winnls.h>
#include "resource.h"
-#include "scumm.h"
-#include "config-file.h"
+#include "scumm/scumm.h"
+#include "common/config-manager.h"
#include "screen.h"
-extern Config *g_config;
-
#define CURRENT_GAMES_VERSION 7
-#define MAX_GAMES 30
+#define MAX_GAMES 32
int MAX_DIRECTORY = 40;
#define MAX_DISPLAYED_DIRECTORIES 7
@@ -285,6 +283,20 @@
0
},
{
+ "Broken Sword 2",
+ "Experimental",
+ "", "PLAYERS.CLU", "",
+ "sword2",
+ 0
+ },
+ {
+ "Broken Sword 2",
+ "Experimental",
+ "", "R2CTLNS.OCX", "",
+ "sword2alt",
+ 0
+ },
+ {
NULL, NULL, NULL, NULL, NULL, NULL, 0
}
};
@@ -365,18 +377,18 @@
_scanning = false;
/* check version */
- version = g_config->getInt("GamesVersion", 0, "wince");
+ version = ConfMan.getInt("GamesVersion", "wince");
if (!version || version != CURRENT_GAMES_VERSION)
return FALSE;
- current = g_config->get("GamesInstalled", "wince");
+ current = ConfMan.get("GamesInstalled", "wince").c_str();
if (!current)
return FALSE;
index = atoi(current);
installedGamesNumber = index;
- current = g_config->get("GamesReferences", "wince");
+ current = ConfMan.get("GamesReferences", "wince").c_str();
if (!current)
return FALSE;
for (i=0; i<index; i++) {
@@ -390,7 +402,7 @@
gamesInstalled[i].reference = j;
}
- current = g_config->get("BasePath", "wince");
+ current = ConfMan.get("BasePath", "wince").c_str();
if (!current)
return FALSE;
MultiByteToWideChar(CP_ACP, 0, current, strlen(current) + 1, basePath, sizeof(basePath));
@@ -399,7 +411,7 @@
char keyName[100];
sprintf(keyName, "GamesDirectory%d", i);
- current = g_config->get(keyName, "wince");
+ current = ConfMan.get(keyName, "wince").c_str();
if (!current)
return FALSE;
MultiByteToWideChar(CP_ACP, 0, current, strlen(current) + 1, gamesInstalled[i].directory, sizeof(gamesInstalled[i].directory));
@@ -795,7 +807,7 @@
if (display)
drawCommentString("Saving the results");
- g_config->setInt("GamesInstalled", index, "wince");
+ ConfMan.set("GamesInstalled", index, "wince");
tempo[0] = '\0';
for (i=0; i<index; i++) {
@@ -804,23 +816,23 @@
strcat(tempo, x);
}
- g_config->set("GamesReferences", tempo, "wince");
+ ConfMan.set("GamesReferences", tempo, "wince");
WideCharToMultiByte(CP_ACP, 0, basePath, wcslen(basePath) + 1, workdir, sizeof(workdir), NULL, NULL);
- g_config->set("BasePath", workdir, "wince");
+ ConfMan.set("BasePath", workdir, "wince");
for (i=0; i<index; i++) {
char keyName[100];
sprintf(keyName, "GamesDirectory%d", i);
WideCharToMultiByte(CP_ACP, 0, gamesInstalled[i].directory, wcslen(gamesInstalled[i].directory) + 1, workdir, sizeof(workdir), NULL, NULL);
- g_config->set(keyName, workdir, "wince");
+ ConfMan.set(keyName, workdir, "wince");
}
- g_config->setInt("GamesVersion", CURRENT_GAMES_VERSION, "wince");
+ ConfMan.set("GamesVersion", CURRENT_GAMES_VERSION, "wince");
- g_config->flush();
+ ConfMan.flushToDisk();
//SetDlgItemText(hwndDlg, IDC_FILEPATH, TEXT("Scan finished"));
if (display)
@@ -884,15 +896,15 @@
work = wcsrchr(directory, '\\');
- WideCharToMultiByte(CP_ACP, 0, work + 1, wcslen(work + 1) + 1, curdir, sizeof(curdir), NULL, NULL);
- if (stricmp(curdir, current_game.directory) == 0) {
-
- //MessageBox(NULL, TEXT("Match directory !"), TEXT("..."), MB_OK);
-
- gamesFound[i] = 1;
- gamesInstalled[installedGamesNumber].reference = i;
- wcscpy(gamesInstalled[installedGamesNumber].directory, directory);
- installedGamesNumber++;
+ if (work) {
+ WideCharToMultiByte(CP_ACP, 0, work + 1, wcslen(work + 1) + 1, curdir, sizeof(curdir), NULL, NULL);
+ if (stricmp(curdir, current_game.directory) == 0) {
+ //MessageBox(NULL, TEXT("Match directory !"), TEXT("..."), MB_OK);
+ gamesFound[i] = 1;
+ gamesInstalled[installedGamesNumber].reference = i;
+ wcscpy(gamesInstalled[installedGamesNumber].directory, directory);
+ installedGamesNumber++;
+ }
}
}
else
@@ -933,13 +945,17 @@
if (x == INVALID_HANDLE_VALUE)
return;
if (desc.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- wsprintf(newDirectory, TEXT("%s\\%s"), directory, desc.cFileName);
- findGame(newDirectory);
+ if (wcscmp(desc.cFileName, TEXT("Windows")) != 0) {
+ wsprintf(newDirectory, TEXT("%s\\%s"), directory, desc.cFileName);
+ findGame(newDirectory);
+ }
}
while (FindNextFile(x, &desc))
if (desc.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- wsprintf(newDirectory, TEXT("%s\\%s"), directory, desc.cFileName);
- findGame(newDirectory);
+ if (wcscmp(desc.cFileName, TEXT("Windows")) != 0) {
+ wsprintf(newDirectory, TEXT("%s\\%s"), directory, desc.cFileName);
+ findGame(newDirectory);
+ }
}
FindClose(x);
}
More information about the Scummvm-git-logs
mailing list