ScummVM API documentation
hag.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 MADS_HAG_H
23 #define MADS_HAG_H
24 
25 #include "common/archive.h"
26 
27 namespace MADS {
28 
29 enum ResourceType {
30  RESTYPE_ROOM, RESTYPE_SC, RESTYPE_TEXT, RESTYPE_QUO, RESTYPE_I,
31  RESTYPE_OB, RESTYPE_FONT, RESTYPE_SOUND, RESTYPE_SPEECH, RESTYPE_HAS_EXT, RESTYPE_NO_EXT
32 };
33 
37 class HagArchive : public Common::Archive {
38 private:
42  struct HagEntry {
43  Common::Path _resourceName;
44  uint32 _offset;
45  uint32 _size;
46 
47  HagEntry() : _offset(0), _size(0) {
48  }
49  HagEntry(const Common::Path &resourceName, uint32 offset, uint32 size)
50  : _resourceName(resourceName), _offset(offset), _size(size) {
51  }
52  };
53 
54  class HagIndex {
55  public:
56  Common::List<HagEntry> _entries;
57  Common::Path _filename;
58  };
59 
61 
65  void loadIndex(int gameID, bool isDemo);
66 
71  bool getHeaderEntry(const Common::Path &resourceName, HagIndex &hagIndex, HagEntry &hagEntry) const;
72 
76  Common::Path getResourceFilename(const Common::Path &resourceName) const;
77 
81  ResourceType getResourceType(const Common::String &resourceName) const;
82 public:
83  explicit HagArchive(int gameID, bool isDemo);
84  ~HagArchive() override;
85 
86  // Archive implementation
87  bool hasFile(const Common::Path &path) const override;
88  int listMembers(Common::ArchiveMemberList &list) const override;
89  const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
91 };
92 
93 } // namespace MADS
94 
95 #endif
Definition: str.h:59
int listMembers(Common::ArchiveMemberList &list) const override
Definition: path.h:52
Definition: stream.h:745
Definition: archive.h:141
Common::SeekableReadStream * createReadStreamForMember(const Common::Path &path) const override
Definition: hag.h:37
bool hasFile(const Common::Path &path) const override
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override
Definition: action.h:28