aboutsummaryrefslogtreecommitdiff
path: root/common/advancedDetector.h
diff options
context:
space:
mode:
authorEugene Sandulenko2006-10-02 22:21:57 +0000
committerEugene Sandulenko2006-10-02 22:21:57 +0000
commit988ddf2b3664b37f20ddad46e65bc789145f1d80 (patch)
treebdd6e4b50eb3c8791081b90a1bb64f9110f58c6f /common/advancedDetector.h
parent574665be4b98675016bbb6aefcc1a00b70ee025c (diff)
downloadscummvm-rg350-988ddf2b3664b37f20ddad46e65bc789145f1d80.tar.gz
scummvm-rg350-988ddf2b3664b37f20ddad46e65bc789145f1d80.tar.bz2
scummvm-rg350-988ddf2b3664b37f20ddad46e65bc789145f1d80.zip
Unify SAGA/AGOS detection code so other engines could also reuse it
without further code duplication. svn-id: r24083
Diffstat (limited to 'common/advancedDetector.h')
-rw-r--r--common/advancedDetector.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/common/advancedDetector.h b/common/advancedDetector.h
new file mode 100644
index 0000000000..013a06a0d1
--- /dev/null
+++ b/common/advancedDetector.h
@@ -0,0 +1,90 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2005-2006 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+#ifndef COMMON_ADVANCED_DETECTOR_H
+#define COMMON_ADVANCED_DETECTOR_H
+
+#include "common/fs.h"
+
+namespace Common {
+
+struct ADGameFileDescription {
+ const char *fileName;
+ uint16 fileType;
+ const char *md5;
+};
+
+struct ADGameDescription {
+ const char *name;
+ int gameType;
+ int gameId;
+ const char *extra;
+ int filesCount;
+ ADGameFileDescription *filesDescriptions;
+ uint32 features;
+ Language language;
+ Platform platform;
+};
+
+typedef Array<int> ADList;
+typedef Array<ADGameDescription*> ADGameDescList;
+
+class AdvancedDetector {
+
+public:
+ AdvancedDetector();
+ ~AdvancedDetector() {};
+
+
+ void registerGameDescriptions(Array<ADGameDescription*> gameDescriptions) {
+ _gameDescriptions = gameDescriptions;
+ }
+
+ /**
+ * Specify number of bytes which are used to calculate MD5
+ * Default value is 0 which means whole file
+ */
+ void setFileMD5Bytes(int bytes) { _fileMD5Bytes = bytes; }
+
+ /**
+ * Detect games in specified directory.
+ * Parameters language and platform are used to pass on values
+ * specified by the user. I.e. this is used to restrict search scope
+ *
+ * @param fslist: FSList to scan or NULL for scanning all specified
+ * default directories.
+ * @param language: restrict results to specified language only
+ * @param platform: restrict results to specified platform only
+ * @return: list of indexes to GameDescriptions of matched games
+ */
+ ADList detectGame(const FSList *fslist, Language language, Platform platform);
+
+private:
+ ADGameDescList _gameDescriptions;
+
+ int _fileMD5Bytes;
+
+ String getDescription(int num);
+};
+
+} // End of namespace Common
+
+#endif