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 namespace Nebular {
29 
30 enum ResourceType {
31  RESTYPE_ROOM, RESTYPE_SC, RESTYPE_TEXT, RESTYPE_QUO, RESTYPE_I,
32  RESTYPE_OB, RESTYPE_FONT, RESTYPE_SOUND, RESTYPE_SPEECH, RESTYPE_HAS_EXT, RESTYPE_NO_EXT
33 };
34 
38 class HagArchive : public Common::Archive {
39 private:
43  struct HagEntry {
44  Common::Path _resourceName;
45  uint32 _offset;
46  uint32 _size;
47 
48  HagEntry() : _offset(0), _size(0) {
49  }
50  HagEntry(const Common::Path &resourceName, uint32 offset, uint32 size)
51  : _resourceName(resourceName), _offset(offset), _size(size) {
52  }
53  };
54 
55  class HagIndex {
56  public:
57  Common::List<HagEntry> _entries;
58  Common::Path _filename;
59  };
60 
62 
66  void loadIndex(int gameID, bool isDemo);
67 
72  bool getHeaderEntry(const Common::Path &resourceName, HagIndex &hagIndex, HagEntry &hagEntry) const;
73 
77  Common::Path getResourceFilename(const Common::Path &resourceName) const;
78 
82  ResourceType getResourceType(const Common::String &resourceName) const;
83 public:
84  explicit HagArchive(int gameID, bool isDemo);
85  ~HagArchive() override;
86 
87  // Archive implementation
88  bool hasFile(const Common::Path &path) const override;
89  int listMembers(Common::ArchiveMemberList &list) const override;
90  const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
92 };
93 
94 } // namespace Nebular
95 } // namespace MADS
96 
97 #endif
Definition: str.h:59
Common::SeekableReadStream * createReadStreamForMember(const Common::Path &path) const override
bool hasFile(const Common::Path &path) const override
Definition: path.h:52
Definition: stream.h:745
Definition: archive.h:141
Definition: mps_installer.h:31
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override
int listMembers(Common::ArchiveMemberList &list) const override
Definition: hag.h:38