ScummVM API documentation
file.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 GAMOS_FILE_H
23#define GAMOS_FILE_H
24
25#include "common/file.h"
26
27namespace Gamos {
28
29typedef Common::Array<byte> RawData;
30
32 uint32 offset;
33 byte id;
34};
35
36class GameFile : public Common::File {
37public:
38 GameFile();
39 ~GameFile() override;
40 bool open(const Common::Path &name) override;
41
42 uint16 getDirCount() const {
43 return _dirCount;
44 }
45
46 int16 findDirByID(uint id) const {
47 for (uint i = 0; i < _directories.size(); ++i) {
48 if (_directories[i].id == id)
49 return i;
50 }
51
52 return -1;
53 }
54
55 bool seekDir(uint id);
56
57 int32 readPackedInt();
58
59 RawData *readCompressedData();
60 bool readCompressedData(RawData *out);
61
62 static void decompress(RawData const *in, RawData *out);
63
64 void setVersion(int v) {
65 _version = v;
66 }
67
68public:
69
70 uint32 _lastReadSize = 0;
71 uint32 _lastReadDecompressedSize = 0;
72 uint32 _lastReadDataOffset = 0;
73
74
75private:
76 int32 _dirOffset = 0;
77
78 byte _dirCount = 0;
79 uint32 _dataOffset = 0;
80
81 Common::Array<GameFileDir> _directories;
82
83 int _version = 0x18;
84
85 //bool _error;
86};
87
88
89
90} // namespace Gamos
91
92#endif // GAMOS_FILE_H
Definition: file.h:47
Definition: path.h:52
Definition: file.h:36
bool open(const Common::Path &name) override
Definition: file.h:31