blob: f89df2e97163ded4c732216cd3bdeb90a401fbcb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/* 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;
const char *extra;
int filesCount;
const ADGameFileDescription *filesDescriptions;
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
|