ScummVM API documentation
resources.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef HARVESTER_RESOURCES_H
23#define HARVESTER_RESOURCES_H
24
25#include "common/archive.h"
26#include "common/array.h"
27
28namespace Harvester {
29
30Common::String normalizeHarvesterResourcePath(const Common::String &path);
31
33public:
34 enum {
35 kFirstDiscNumber = 1,
36 kLastDiscNumber = 3
37 };
38
41
42 void reset();
43 bool mountStartupArchives();
44 bool setCurrentDisc(int discNumber);
45 int getCurrentDisc() const { return _currentDisc; }
46
47 bool hasFile(const Common::String &path) const;
48 Common::SeekableReadStream *openFile(const Common::String &path) const;
49 bool loadFile(const Common::String &path, Common::Array<byte> &data) const;
50
51 Common::String normalizeResourcePath(const Common::String &path) const;
52 void mountArchive(const Common::String &name, Common::Archive *archive, int priority = 10, bool autoFree = true);
53
54private:
55 bool ensureDiscMounted(int discNumber);
56 void unmountOtherDiscArchives(int keepDiscNumber);
57 Common::Archive *getMountedDiscArchive(int discNumber, char archiveSetId) const;
58 Common::Archive *findArchiveForMember(char archiveSetId, const Common::Path &memberPath) const;
59 bool hasInMountedArchives(const Common::Path &memberPath) const;
60 Common::SeekableReadStream *openFromMountedArchives(const Common::Path &memberPath) const;
61 Common::SearchSet _search;
62 int _currentDisc = 1;
63};
64
65} // End of namespace Harvester
66
67#endif // HARVESTER_RESOURCES_H
Definition: archive.h:141
Definition: path.h:52
Definition: archive.h:330
Definition: stream.h:745
Definition: str.h:59
Definition: resources.h:32