aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/wintermute/detection.cpp60
1 files changed, 34 insertions, 26 deletions
diff --git a/engines/wintermute/detection.cpp b/engines/wintermute/detection.cpp
index 3411512064..3deae26632 100644
--- a/engines/wintermute/detection.cpp
+++ b/engines/wintermute/detection.cpp
@@ -76,7 +76,7 @@ static const ADExtraGuiOptionsMap gameGuiOptions[] = {
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
-static char s_fallbackGameIdBuf[256];
+static char s_fallbackExtraBuf[256];
static const char *directoryGlobs[] = {
"language", // To detect the various languages
@@ -114,33 +114,41 @@ public:
s_fallbackDesc.gameId = "wintermute";
s_fallbackDesc.guiOptions = GUIO0();
- if (allFiles.contains("data.dcp")) {
- Common::String name, caption;
- if (WintermuteEngine::getGameInfo(fslist, name, caption)) {
- for (uint32 i = 0; i < name.size(); i++) {
- // Replace spaces (and other non-alphanumerics) with underscores
- if (!Common::isAlnum(name[(int32)i])) {
- name.setChar('_', (uint32)i);
- }
- }
- // Prefix to avoid collisions with actually known games
- name = "wmeunk-" + name;
- Common::strlcpy(s_fallbackGameIdBuf, name.c_str(), sizeof(s_fallbackGameIdBuf) - 1);
- s_fallbackDesc.gameId = s_fallbackGameIdBuf;
- if (caption != name) {
- caption += " (unknown version) ";
- char *offset = s_fallbackGameIdBuf + name.size() + 1;
- uint32 remainingLength = (sizeof(s_fallbackGameIdBuf) - 1) - (name.size() + 1);
- Common::strlcpy(offset, caption.c_str(), remainingLength);
- s_fallbackDesc.extra = offset;
- s_fallbackDesc.flags |= ADGF_USEEXTRAASTITLE;
- }
-
- return ADDetectedGame(&s_fallbackDesc);
- } // Fall through to return 0;
+ if (!allFiles.contains("data.dcp")) {
+ return ADDetectedGame();
}
- return ADDetectedGame();
+ Common::String name, caption;
+ if (!WintermuteEngine::getGameInfo(fslist, name, caption)) {
+ return ADDetectedGame();
+ }
+
+ Common::String extra = caption;
+ if (extra.empty()) {
+ extra = name;
+ }
+
+ if (!extra.empty()) {
+ Common::strlcpy(s_fallbackExtraBuf, extra.c_str(), sizeof(s_fallbackExtraBuf) - 1);
+ s_fallbackDesc.extra = s_fallbackExtraBuf;
+ s_fallbackDesc.flags |= ADGF_USEEXTRAASTITLE;
+ s_fallbackDesc.flags |= ADGF_AUTOGENTARGET;
+ }
+
+ ADDetectedGame game(&s_fallbackDesc);
+
+ for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
+ if (file->isDirectory()) continue;
+ if (!file->getName().hasSuffixIgnoreCase(".dcp")) continue;
+
+ FileProperties tmp;
+ if (getFileProperties(file->getParent(), allFiles, s_fallbackDesc, file->getName(), tmp)) {
+ game.hasUnknownFiles = true;
+ game.matchedFiles[file->getName()] = tmp;
+ }
+ }
+
+ return game;
}
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {