diff options
author | Max Horn | 2006-10-02 22:26:57 +0000 |
---|---|---|
committer | Max Horn | 2006-10-02 22:26:57 +0000 |
commit | 125d599acc0b7463cb008d99dac9d7e9c28a1ceb (patch) | |
tree | bd61de530768d019896e973303afe6ad33d3d956 /engines | |
parent | 988ddf2b3664b37f20ddad46e65bc789145f1d80 (diff) | |
download | scummvm-rg350-125d599acc0b7463cb008d99dac9d7e9c28a1ceb.tar.gz scummvm-rg350-125d599acc0b7463cb008d99dac9d7e9c28a1ceb.tar.bz2 scummvm-rg350-125d599acc0b7463cb008d99dac9d7e9c28a1ceb.zip |
Improved the BASS detector a bit
svn-id: r24084
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sky/sky.cpp | 62 |
1 files changed, 58 insertions, 4 deletions
diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp index f30a98a9bc..5aa752e3b0 100644 --- a/engines/sky/sky.cpp +++ b/engines/sky/sky.cpp @@ -89,22 +89,76 @@ GameDescriptor Engine_SKY_findGameID(const char *gameid) { return GameDescriptor(); } +struct SkyVersion { + int dinnerTableEntries; + int dataDiskSize; + const char *extraDesc; + int version; +}; + +// TODO: Would be nice if Disk::determineGameVersion() used this table, too. +static const SkyVersion skyVersions[] = { + { 243, -1, "pc gamer demo", 109 }, + { 247, -1, "floppy demo", 267 }, + { 1404, -1, "floppy", 288 }, + { 1413, -1, "floppy", 303 }, + { 1445, 8830435, "floppy", 348 }, + { 1445, -1, "floppy", 331 }, + { 1711, -1, "cd demo", 365 }, + { 5099, -1, "cd", 368 }, + { 5097, -1, "cd", 372 }, + { 0, 0, 0, 0 } +}; + DetectedGameList Engine_SKY_detectGames(const FSList &fslist) { DetectedGameList detectedGames; + bool hasSkyDsk = false; + bool hasSkyDnr = false; + int dinnerTableEntries = -1; + int dataDiskSize = -1; + // Iterate over all files in the given directory for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { if (!file->isDirectory()) { const char *fileName = file->name().c_str(); if (0 == scumm_stricmp("sky.dsk", fileName)) { - // Match found, add to list of candidates, then abort inner loop. - // The game detector uses US English by default. We want British - // English to match the recorded voices better. - detectedGames.push_back(DetectedGame(skySetting, Common::EN_GRB, Common::kPlatformUnknown)); + Common::File dataDisk; + if (dataDisk.open(file->path())) { + hasSkyDsk = true; + dataDiskSize = dataDisk.size(); + } + } + + if (0 == scumm_stricmp("sky.dnr", fileName)) { + Common::File dinner; + if (dinner.open(file->path())) { + hasSkyDnr = true; + dinnerTableEntries = dinner.readUint32LE(); + } + } + } + } + + if (hasSkyDsk && hasSkyDnr) { + // Match found, add to list of candidates, then abort inner loop. + // The game detector uses US English by default. We want British + // English to match the recorded voices better. + DetectedGame dg(skySetting, Common::UNK_LANG, Common::kPlatformUnknown); + const SkyVersion *sv = skyVersions; + while (sv->dinnerTableEntries) { + if (dinnerTableEntries == sv->dinnerTableEntries && + (sv->dataDiskSize == dataDiskSize || sv->dataDiskSize == -1)) { + char buf[32]; + snprintf(buf, sizeof(buf), "v0.0%d %s", sv->version, sv->extraDesc); + dg.updateDesc(buf); break; } + ++sv; } + detectedGames.push_back(dg); } + return detectedGames; } |