ScummVM API documentation
disk.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 SKY_DISK_H
23 #define SKY_DISK_H
24 
25 
26 #include "common/scummsys.h"
27 #include "common/compression/rnc_deco.h"
28 
29 #define MAX_FILES_IN_LIST 60
30 
31 #define MAX_FRAMES 16 // Maximum number of frames per animation in ibass
32 
33 namespace Common {
34 class File;
35 }
36 
37 namespace Graphics {
38 struct Surface;
39 struct PixelFormat;
40 }
41 
42 struct FileEntry {
43  uint32 _fileNum;
44  uint32 _offset;
45  uint32 _size;
46  uint32 _compressedSize;
47  FileEntry() : _fileNum(0), _offset(0), _size(0), _compressedSize(0) {}
48 };
49 
50 namespace Sky {
51 
52 struct Animation {
53  Graphics::Surface **_frames;
54  int _numFrames;
55  int _width;
56  int _height;
57 };
58 
59 class Disk {
60 public:
61  Disk();
62  ~Disk();
63 
64  uint8 *loadFile(uint16 fileNr);
65  uint16 *loadScriptFile(uint16 fileNr);
66  bool fileExists(uint16 fileNr);
67 
68  uint32 determineGameVersion();
69 
70  uint32 _lastLoadedFileSize;
71 
72  void fnMiniLoad(uint16 fileNum);
73  void fnCacheFast(uint16 *fList);
74  void fnCacheChip(uint16 *fList);
75  void fnCacheFiles();
76  void fnFlushBuffers();
77  uint32 *giveLoadedFilesList() { return _loadedFilesList; }
78  void refreshFilesList(uint32 *list);
79  Animation *loadAnim(const char *filename, Graphics::PixelFormat &targetFormat);
80 
81 protected:
82  uint8 *getFileInfo(uint16 fileNr);
83  void dumpFile(uint16 fileNr);
84 
85  uint32 _numFiles;
86  FileEntry *_entry;
87 
88  uint32 _dinnerTableEntries;
89  uint8 *_dinnerTableArea;
90  Common::File *_dataDiskHandle;
91  Common::RncDecoder _rncDecoder;
92 
93  uint32 getFileSize(uint32 filenum);
94  FileEntry *getEntry(uint32 filenum);
95 
96  uint16 _buildList[MAX_FILES_IN_LIST];
97  uint32 _loadedFilesList[MAX_FILES_IN_LIST];
98 };
99 
100 } // End of namespace Sky
101 
102 #endif
Definition: surface.h:67
Definition: disk.h:42
Definition: pixelformat.h:138
Definition: rnc_deco.h:29
Definition: disk.h:59
Definition: disk.h:52
Definition: file.h:47
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: autoroute.h:28