mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-30 07:23:05 +00:00
Pass subdirectories to gamedetector functions
svn-id: r16002
This commit is contained in:
parent
58bf9028b1
commit
0d7ab01640
@ -506,7 +506,7 @@ void LauncherDialog::addGame() {
|
||||
if (_browser->runModal() > 0) {
|
||||
// User made his choice...
|
||||
FilesystemNode dir(_browser->getResult());
|
||||
FSList files = dir.listDir(FilesystemNode::kListFilesOnly);
|
||||
FSList files = dir.listDir(FilesystemNode::kListAll);
|
||||
|
||||
// ...so let's determine a list of candidates, games that
|
||||
// could be contained in the specified directory.
|
||||
|
@ -77,10 +77,12 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
|
||||
continue;
|
||||
|
||||
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
||||
const char *name = file->displayName().c_str();
|
||||
if ((!scumm_stricmp(game->detectName, name))) {
|
||||
detectedGames.push_back(game->toGameSettings());
|
||||
break;
|
||||
if (!file->isDirectory()) {
|
||||
const char *name = file->displayName().c_str();
|
||||
if ((!scumm_stricmp(game->detectName, name))) {
|
||||
detectedGames.push_back(game->toGameSettings());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,12 +64,14 @@ DetectedGameList Engine_QUEEN_detectGames(const FSList &fslist) {
|
||||
|
||||
// Iterate over all files in the given directory
|
||||
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
||||
const char *gameName = file->displayName().c_str();
|
||||
if (!file->isDirectory()) {
|
||||
const char *gameName = file->displayName().c_str();
|
||||
|
||||
if (0 == scumm_stricmp("queen.1", gameName) || 0 == scumm_stricmp("queen.1c", gameName)) {
|
||||
// Match found, add to list of candidates, then abort loop.
|
||||
detectedGames.push_back(queen_setting);
|
||||
break;
|
||||
if (0 == scumm_stricmp("queen.1", gameName) || 0 == scumm_stricmp("queen.1c", gameName)) {
|
||||
// Match found, add to list of candidates, then abort loop.
|
||||
detectedGames.push_back(queen_setting);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return detectedGames;
|
||||
|
@ -385,12 +385,14 @@ DetectedGameList GAME_ProbeGame(const FSList &fslist) {
|
||||
file_missing = 1;
|
||||
// Iterate over all files in the given directory
|
||||
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
||||
const char *gameName = file->displayName().c_str();
|
||||
if (!file->isDirectory()) {
|
||||
const char *gameName = file->displayName().c_str();
|
||||
|
||||
if (0 == scumm_stricmp(GameDescs[game_n].gd_filedescs[file_n].gf_fname,
|
||||
gameName)) {
|
||||
file_missing = 0;
|
||||
break;
|
||||
if (0 == scumm_stricmp(GameDescs[game_n].gd_filedescs[file_n].gf_fname,
|
||||
gameName)) {
|
||||
file_missing = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2678,13 +2678,15 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) {
|
||||
|
||||
// Iterate over all files in the given directory
|
||||
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
||||
const char *name = file->displayName().c_str();
|
||||
if (!file->isDirectory()) {
|
||||
const char *name = file->displayName().c_str();
|
||||
|
||||
if (0 == scumm_stricmp(detectName, name)) {
|
||||
// Match found, add to list of candidates, then abort inner loop.
|
||||
detectedGames.push_back(g->toGameSettings());
|
||||
fileSet.addKey(file->path());
|
||||
break;
|
||||
if (0 == scumm_stricmp(detectName, name)) {
|
||||
// Match found, add to list of candidates, then abort inner loop.
|
||||
detectedGames.push_back(g->toGameSettings());
|
||||
fileSet.addKey(file->path());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -113,13 +113,15 @@ DetectedGameList Engine_SIMON_detectGames(const FSList &fslist) {
|
||||
|
||||
// Iterate over all files in the given directory
|
||||
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
||||
const char *name = file->displayName().c_str();
|
||||
if (!file->isDirectory()) {
|
||||
const char *name = file->displayName().c_str();
|
||||
|
||||
if ((!scumm_stricmp(detectName, name)) || (!scumm_stricmp(detectName2, name))) {
|
||||
// Match found, add to list of candidates, then abort inner loop.
|
||||
detectedGames.push_back(g->toGameSettings());
|
||||
fileSet.addKey(file->path());
|
||||
break;
|
||||
if ((!scumm_stricmp(detectName, name)) || (!scumm_stricmp(detectName2, name))) {
|
||||
// Match found, add to list of candidates, then abort inner loop.
|
||||
detectedGames.push_back(g->toGameSettings());
|
||||
fileSet.addKey(file->path());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
sky/sky.cpp
12
sky/sky.cpp
@ -90,12 +90,14 @@ DetectedGameList Engine_SKY_detectGames(const FSList &fslist) {
|
||||
DetectedGameList detectedGames;
|
||||
// Iterate over all files in the given directory
|
||||
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
||||
const char *fileName = file->displayName().c_str();
|
||||
if (!file->isDirectory()) {
|
||||
const char *fileName = file->displayName().c_str();
|
||||
|
||||
if (0 == scumm_stricmp("sky.dsk", fileName)) {
|
||||
// Match found, add to list of candidates, then abort inner loop.
|
||||
detectedGames.push_back(skySetting);
|
||||
break;
|
||||
if (0 == scumm_stricmp("sky.dsk", fileName)) {
|
||||
// Match found, add to list of candidates, then abort inner loop.
|
||||
detectedGames.push_back(skySetting);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return detectedGames;
|
||||
|
@ -46,44 +46,62 @@
|
||||
using namespace Sword1;
|
||||
|
||||
/* Broken Sword 1 */
|
||||
static const GameSettings sword1_settings[] = {
|
||||
{"sword1", "Broken Sword I", GF_DEFAULT_TO_1X_SCALER},
|
||||
{"sword1demo", "Broken Sword I (Demo)", GF_DEFAULT_TO_1X_SCALER | Sword1::GF_DEMO },
|
||||
{ NULL, NULL, 0 }
|
||||
static const GameSettings sword1FullSettings =
|
||||
{"sword1", "Broken Sword I", GF_DEFAULT_TO_1X_SCALER};
|
||||
static const GameSettings sword1DemoSettings =
|
||||
{"sword1demo", "Broken Sword I (Demo)", GF_DEFAULT_TO_1X_SCALER | Sword1::GF_DEMO };
|
||||
|
||||
// check these subdirectories (if present)
|
||||
static const char *g_dirNames[] = { "clusters", "speech" };
|
||||
|
||||
#define NUM_FILES_TO_CHECK 5
|
||||
static const char *g_filesToCheck[NUM_FILES_TO_CHECK] = { // these files have to be found
|
||||
"swordres.rif",
|
||||
"general.clu",
|
||||
"compacts.clu",
|
||||
"scripts.clu",
|
||||
"cows.mad", // this one should only exist in the demo version
|
||||
// the engine needs several more files to work, but checking these should be sufficient
|
||||
};
|
||||
|
||||
GameList Engine_SWORD1_gameList() {
|
||||
const GameSettings *g = sword1_settings;
|
||||
GameList games;
|
||||
while (g->name) {
|
||||
games.push_back(*g);
|
||||
g++;
|
||||
}
|
||||
games.push_back(sword1FullSettings);
|
||||
games.push_back(sword1DemoSettings);
|
||||
return games;
|
||||
}
|
||||
|
||||
void Sword1CheckDirectory(const FSList &fslist, bool *filesFound) {
|
||||
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
||||
if (!file->isDirectory()) {
|
||||
const char *fileName = file->displayName().c_str();
|
||||
for (int cnt = 0; cnt < NUM_FILES_TO_CHECK; cnt++)
|
||||
if (scumm_stricmp(fileName, g_filesToCheck[cnt]) == 0)
|
||||
filesFound[cnt] = true;
|
||||
} else {
|
||||
for (int cnt = 0; cnt < ARRAYSIZE(g_dirNames); cnt++)
|
||||
if (scumm_stricmp(file->displayName().c_str(), g_dirNames[cnt]) == 0)
|
||||
Sword1CheckDirectory(file->listDir(AbstractFilesystemNode::kListFilesOnly), filesFound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DetectedGameList Engine_SWORD1_detectGames(const FSList &fslist) {
|
||||
DetectedGameList detectedGames;
|
||||
const GameSettings *g = sword1_settings;
|
||||
bool filesFound[NUM_FILES_TO_CHECK];
|
||||
for (int i = 0; i < NUM_FILES_TO_CHECK; i++)
|
||||
filesFound[i] = false;
|
||||
|
||||
// TODO: It would be nice if we had code here which distinguishes
|
||||
// between the 'sword1' and 'sword1demo' targets.
|
||||
Sword1CheckDirectory(fslist, filesFound);
|
||||
bool mainFilesFound = true;
|
||||
for (int i = 0; i < NUM_FILES_TO_CHECK -1; i++)
|
||||
if (!filesFound[i])
|
||||
mainFilesFound = false;
|
||||
|
||||
while (g->name) {
|
||||
// Iterate over all files in the given directory
|
||||
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
||||
const char *gameName = file->displayName().c_str();
|
||||
|
||||
if ((0 == scumm_stricmp("swordres.rif", gameName)) ||
|
||||
(0 == scumm_stricmp("cd1.id", gameName)) ||
|
||||
(0 == scumm_stricmp("cd2.id", gameName))) {
|
||||
// Match found, add to list of candidates, then abort inner loop.
|
||||
detectedGames.push_back(*g);
|
||||
break;
|
||||
}
|
||||
}
|
||||
g++;
|
||||
}
|
||||
if (mainFilesFound && filesFound[NUM_FILES_TO_CHECK - 1])
|
||||
detectedGames.push_back(sword1DemoSettings);
|
||||
else if (mainFilesFound)
|
||||
detectedGames.push_back(sword1FullSettings);
|
||||
|
||||
return detectedGames;
|
||||
}
|
||||
|
@ -80,12 +80,14 @@ DetectedGameList Engine_SWORD2_detectGames(const FSList &fslist) {
|
||||
for (g = sword2_settings; g->name; ++g) {
|
||||
// Iterate over all files in the given directory
|
||||
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
|
||||
const char *gameName = file->displayName().c_str();
|
||||
if (!file->isDirectory()) {
|
||||
const char *gameName = file->displayName().c_str();
|
||||
|
||||
if (0 == scumm_stricmp(g->detectname, gameName)) {
|
||||
// Match found, add to list of candidates, then abort inner loop.
|
||||
detectedGames.push_back(g->toGameSettings());
|
||||
break;
|
||||
if (0 == scumm_stricmp(g->detectname, gameName)) {
|
||||
// Match found, add to list of candidates, then abort inner loop.
|
||||
detectedGames.push_back(g->toGameSettings());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user