ScummVM API documentation
cvcrfile.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 LASTEXPRESS_CVCRFILE_H
23#define LASTEXPRESS_CVCRFILE_H
24
25#include "lastexpress/lastexpress.h"
26#include "lastexpress/shared.h"
27
28namespace Common {
29class MemorySeekableReadWriteStream;
30class SeekableReadStream;
31}
32
33namespace LastExpress {
34
35#define CVCRMODE_WB 0
36#define CVCRMODE_RB 1
37#define CVCRMODE_RWB 2
38
40 int32 magicNumber;
41 int32 numVCRGames;
42 int32 nextWritePos;
43 int32 realWritePos;
44 int32 lastIsTemporary;
45 int32 brightness;
46 int32 volume;
47 int32 saveVersion;
48};
49
51 int32 magicNumber;
52 int32 type;
53 int32 time;
54 int32 size;
55 int32 partNumber;
56 int32 latestGameEvent;
57 int32 emptyField1;
58 int32 emptyField2;
59};
60
61class CVCRFile {
62public:
64 ~CVCRFile();
65
66 bool open(const char *filename, int mode);
67 uint32 read(void *dstBuf, uint32 elementSize, uint32 elementCount, bool forceSimpleReadOnRle, bool checkSize);
68 uint32 write(void *srcBuf, uint32 elementSize, uint32 elementCount, bool forceSimpleReadOnRle);
69 uint32 readRLE(void *dstBuf, uint32 elementSize, uint32 elementCount);
70 uint32 writeRLE(void *srcBuf, uint32 elementSize, uint32 elementCount);
71 void writeToRLEBuffer(uint8 operation, uint8 flag);
72 uint32 flush();
73 uint32 seek(int32 offset, int mode);
74 void close();
75 int32 tell();
76
77 bool fileIsOpen() { return _virtualFileIsOpen; }
78
79private:
80 LastExpressEngine *_engine = nullptr;
81 Common::MemorySeekableReadWriteStream *_rwStream = nullptr;
82 Common::String _filename = "";
83 bool _virtualFileIsOpen = false;
84 uint32 _virtualFileSize = 0;
85 uint32 _rwStreamSize = 0;
86 uint8 _rleDstBuf[256];
87 int32 _rleBufferPosition = -1;
88 uint8 _rleByte = 0;
89 uint8 _rleCount = 0;
90 int32 _rleMode = 0;
91 int32 _bytesProcessed = 0;
92 int32 _rleStatus = 0;
93 int32 _fileMode = 0;
94};
95
96} // End of namespace LastExpress
97
98#endif // LASTEXPRESS_CVCRFILE_H
Definition: memstream.h:397
Definition: str.h:59
Definition: cvcrfile.h:61
Definition: lastexpress.h:523
Definition: algorithm.h:29
Definition: archive.h:29
Definition: cvcrfile.h:39
Definition: cvcrfile.h:50