ScummVM API documentation
compression.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 MADS_COMPRESSION_H
23
#define MADS_COMPRESSION_H
24
25
#include "common/memstream.h"
26
#include "common/stream.h"
27
28
#include "mads/mads.h"
29
30
namespace
MADS
{
31
32
enum
CompressionType { COMPRESS_NONE = 0, COMPRESS_FAB = 1 };
33
34
struct
MadsPackEntry
{
35
public
:
36
CompressionType _type;
37
byte _priority;
38
uint32 _size;
39
uint32 _compressedSize;
40
byte *_data;
41
};
42
43
class
MadsPack
{
44
private
:
45
MadsPackEntry
*_items;
46
int
_count;
47
int
_dataOffset;
48
49
void
initialize(
Common::SeekableReadStream
*stream);
50
public
:
51
static
bool
isCompressed(
Common::SeekableReadStream
*stream);
52
MadsPack
(
Common::SeekableReadStream
*stream);
53
MadsPack
(
const
Common::Path
&resourceName,
MADSEngine
*_vm);
54
~
MadsPack
();
55
56
int
getCount()
const
{
return
_count; }
57
MadsPackEntry
&getItem(
int
index)
const
{
58
assert(index < _count);
59
return
_items[index]; }
60
MadsPackEntry
&operator[](
int
index)
const
{
61
assert(index < _count);
62
return
_items[index];
63
}
64
Common::MemoryReadStream
*getItemStream(
int
index) {
65
assert(index < _count);
66
return
new
Common::MemoryReadStream
(_items[index]._data, _items[index]._size,
67
DisposeAfterUse::NO);
68
}
69
int
getDataOffset()
const
{
return
_dataOffset; }
70
};
71
72
class
FabDecompressor
{
73
private
:
74
int
_bitsLeft;
75
uint32 _bitBuffer;
76
const
byte *_srcData, *_srcP;
77
int
_srcSize;
78
79
int
getBit();
80
public
:
81
void
decompress(
const
byte *srcData,
int
srcSize, byte *destData,
int
destSize);
82
};
83
84
}
// End of namespace MADS
85
86
#endif
MADS::MadsPackEntry
Definition:
compression.h:34
MADS::FabDecompressor
Definition:
compression.h:72
Common::Path
Definition:
path.h:52
Common::SeekableReadStream
Definition:
stream.h:745
MADS::MadsPack
Definition:
compression.h:43
Common::MemoryReadStream
Definition:
memstream.h:43
MADS::MADSEngine
Definition:
mads.h:87
MADS
Definition:
action.h:28
engines
mads
compression.h
Generated on Thu Nov 14 2024 09:17:26 for ScummVM API documentation by
1.8.13