ScummVM API documentation
fstream.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 M4_FILEIO_FSTREAM_H
23 #define M4_FILEIO_FSTREAM_H
24 
25 #include "common/file.h"
26 #include "m4/fileio/sys_file.h"
27 #include "m4/mem/reloc.h"
28 #include "m4/m4_types.h"
29 
30 namespace M4 {
31 
32 class StreamFile {
33 private:
34  Common::File _file;
35 public:
36  StreamFile(const Common::Path &filename);
37  ~StreamFile() {}
38 
39  int32 read(Handle bufferHandle, int32 n);
40  bool seek(uint32 n);
41  bool seek_ahead(int32 n);
42  uint32 get_pos();
43 };
44 
45 struct strmRequest {
46  strmRequest *next;
47  strmRequest *prev;
48  SysFile *srcFile;
49  int32 strmSize;
50  MemHandle strmHandle;
51  uint8 *strmBuff;
52  uint8 *endStrmBuff;
53  uint8 *strmHead;
54  uint8 *strmTail;
55  uint8 *strmWrap;
56  uint8 *strmLastRead;
57  int32 nextReadSize;
58  int32 numBlocksToRead;
59  int32 *blockSizeArray;
60  bool wrapStream;
61 };
62 
63 bool f_stream_Init();
64 void f_stream_Shutdown();
65 
66 strmRequest *f_stream_Open(SysFile *srcFile, int32 fileOffset, int32 strmMinBuffSize, int32 strmBuffSize,
67  int32 numBlocksToRead, int32 *blockSizeArray, int32 initialRead, bool wrapStream);
68 int32 f_stream_Read(strmRequest *myStream, uint8 **dest, int32 numBytes);
69 void f_stream_Close(strmRequest *myStream);
70 void f_stream_Process(int32 numToProcess);
71 
72 } // namespace M4
73 
74 #endif
Definition: fstream.h:32
Definition: path.h:52
Definition: fstream.h:45
Definition: file.h:47
Definition: database.h:28
Definition: sys_file.h:47