ScummVM API documentation
files.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 ACCESS_FILES_H
23 #define ACCESS_FILES_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/file.h"
28 #include "graphics/managed_surface.h"
29 #include "access/decompress.h"
30 #include "access/detection.h"
31 
32 namespace Access {
33 
34 class AccessEngine;
35 
36 struct FileIdent {
37  int _fileNum;
38  int _subFile;
39 
40  FileIdent();
41  FileIdent(int fileNum, int subfile) { _fileNum = fileNum; _subFile = subfile; }
42 
43  void load(Common::SeekableReadStream &s);
44 };
45 
46 struct CellIdent : FileIdent {
47  byte _cell;
48 
49  CellIdent();
50  CellIdent(int cell, int fileNum, int subfile);
51 };
52 
53 class FileManager;
54 
55 class Resource {
56  friend class FileManager;
57 private:
58  Common::File _file;
59  byte *_data;
60 public:
62  int _size;
63 
64  Resource();
65  Resource(byte *data, int size);
66  ~Resource();
67  byte *data();
68 
69  const char *getFileName() const;
70 };
71 
72 class FileManager {
73 private:
74  AccessEngine *_vm;
75 
79  void openFile(Resource *res, const Common::Path &filename);
80 
84  void handleFile(Resource *res);
85 
89  void handleScreen(Graphics::ManagedSurface *dest, Resource *res);
90 
94  void setAppended(Resource *file, const Common::Path &fileName);
95 
99  void gotoAppended(Resource *file, int subfile);
100 
104  void readIndex(Resource *res);
105 
106 public:
107  Common::Path _indexedFilename;
108  Common::Array<uint32> _fileIndex;
109  bool _setPaletteFlag;
110 public:
112  ~FileManager();
113 
117  bool existFile(const Common::Path &filename);
118 
122  Resource *loadFile(int fileNum, int subfile);
123 
127  Resource *loadFile(const FileIdent &fileIdent);
128 
132  Resource *loadRawFile(const Common::Path &filename);
133 
137  void loadScreen(int fileNum, int subfile);
138 
142  void loadScreen(const Common::Path &filename);
143 
147  void loadScreen(Graphics::ManagedSurface *dest, int fileNum, int subfile);
148 };
149 
150 } // End of namespace Access
151 
152 #endif /* ACCESS_FILES_H */
Definition: managed_surface.h:51
Definition: files.h:36
Definition: access.h:141
Definition: path.h:52
Definition: stream.h:745
Definition: files.h:55
Definition: file.h:47
Definition: files.h:72
Definition: files.h:46
Definition: access.h:62