ScummVM API documentation
unpack.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 CINE_UNPACK_H
23#define CINE_UNPACK_H
24
25
26#include "common/scummsys.h"
27
28namespace Cine {
29
37public:
48 bool unpack(const byte *src, uint srcLen, byte *dst, uint dstLen);
49private:
56 uint32 readSource();
57
63 uint rcr(bool inputCarry);
64
70 uint nextBit();
71
79 uint getBits(uint numBits);
80
87 void unpackRawBytes(uint numBytes);
88
96 void copyRelocatedBytes(uint offset, uint numBytes);
97private:
98 uint32 _crc;
99 uint32 _chunk32b;
100 byte *_dst;
101 const byte *_src;
102
103 // These are used for detecting errors (e.g. out of bounds issues) during unpacking
104 bool _error;
105 const byte *_srcBegin;
106 const byte *_srcEnd;
107 byte *_dstBegin;
108 byte *_dstEnd;
109};
110
111} // End of namespace Cine
112
113#endif
Definition: unpack.h:36
bool unpack(const byte *src, uint srcLen, byte *dst, uint dstLen)
Definition: anim.h:29