ScummVM API documentation
psx_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 TINSEL_PSX_ARCHIVE_H
23 #define TINSEL_PSX_ARCHIVE_H
24 
25 #include "common/archive.h"
26 #include "common/scummsys.h"
27 #include "common/hashmap.h"
28 
29 namespace Tinsel {
30 
31 // PSX Index / Data archive format
32 //
33 // Several PSX versions store all resource files in a single uncompressed
34 // data file. A separate index file contains the names, offsets, and sizes.
35 // Used in DW1 German, DW1 Japanese, and all DW2 versions.
36 
37 class PsxArchive : public Common::Archive {
38 public:
39  PsxArchive();
40  ~PsxArchive() override;
41 
42  bool open(const Common::Path &indexFilePath, const Common::Path &dataFilePath, uint16 tinselVersion);
43  void close();
44 
45  // Common::Archive API implementation
46  bool hasFile(const Common::Path &path) const override;
47  int listMembers(Common::ArchiveMemberList &list) const override;
48  const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
50 
51 private:
52  struct FileEntry {
53  uint32 size;
54  uint32 offset;
55  };
56 
57  Common::Path _dataFilePath;
58 
60  FileMap _map;
61 };
62 
63 } // End of namespace Tinsel
64 
65 #endif
Definition: psx_archive.h:37
Definition: list.h:44
Definition: path.h:52
Common::SeekableReadStream * createReadStreamForMember(const Common::Path &path) const override
Definition: stream.h:745
Definition: archive.h:141
bool hasFile(const Common::Path &path) const override
Definition: actors.h:36
int listMembers(Common::ArchiveMemberList &list) const override
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override