ScummVM API documentation
archive.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 LASTEXPRESS_HPFARCHIVE_H
23 #define LASTEXPRESS_HPFARCHIVE_H
24 
25 /*
26  Archive file format (.HPF)
27 
28  uint32 {4} - number of files
29 
30  // for each file
31  char {12} - name (zero-terminated)
32  uint32 {4} - offset (expressed in sectors of 2048 bytes)
33  uint32 {4} - size (expressed in sectors of 2048 bytes)
34  byte {2} - file status: 1 = on disk (ie. in HD.HPF), 0 = on CD
35 */
36 
37 #include "common/archive.h"
38 #include "common/hash-str.h"
39 #include "common/hashmap.h"
40 #include "common/str.h"
41 
42 namespace LastExpress {
43 
44 class HPFArchive : public Common::Archive {
45 public:
46  HPFArchive(const Common::Path &path);
47 
48  bool hasFile(const Common::Path &path) const override;
49  int listMembers(Common::ArchiveMemberList &list) const override;
50  const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
52 
53  int count() { return _files.size(); }
54 
55 private:
56  static const unsigned int _archiveNameSize = 12;
57  static const unsigned int _archiveSectorSize = 2048;
58 
59  // File entry
60  struct HPFEntry {
61  uint32 offset;
62  uint32 size;
63  uint16 isOnHD;
64  };
65 
67 
68  FileMap _files;
69  Common::Path _filename;
70 };
71 
72 } // End of namespace LastExpress
73 
74 #endif // LASTEXPRESS_HPFARCHIVE_H
Definition: archive.h:44
Definition: list.h:44
bool hasFile(const Common::Path &path) const override
Definition: path.h:52
Definition: stream.h:745
Definition: animation.h:45
int listMembers(Common::ArchiveMemberList &list) const override
Definition: archive.h:141
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override
Common::SeekableReadStream * createReadStreamForMember(const Common::Path &path) const override