ScummVM API documentation
blbarchive.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 NEVERHOOD_BLBARCHIVE_H
23 #define NEVERHOOD_BLBARCHIVE_H
24 
25 #include "common/array.h"
26 #include "common/file.h"
27 #include "common/mutex.h"
28 #include "common/stream.h"
29 #include "common/substream.h"
30 #include "neverhood/neverhood.h"
31 
32 namespace Neverhood {
33 
34 struct BlbHeader {
35  uint32 id1;
36  uint16 id2;
37  uint16 extDataSize;
38  int32 fileSize;
39  uint32 fileCount;
40 };
41 
43  uint32 fileHash;
44  byte type;
45  byte comprType;
46  byte *extData;
47  uint32 timeStamp;
48  uint32 offset;
49  uint32 diskSize;
50  uint32 size;
51 };
52 
53 class BlbArchive {
54 public:
55  BlbArchive();
56  ~BlbArchive();
57  bool open(const Common::Path &filename, bool isOptional);
58  void load(uint index, byte *buffer, uint32 size);
59  void load(BlbArchiveEntry *entry, byte *buffer, uint32 size);
60  byte *getEntryExtData(uint index);
61  byte *getEntryExtData(BlbArchiveEntry *entry);
62  uint32 getSize(uint index) { return _entries[index].size; }
63  BlbArchiveEntry *getEntry(uint index) { return &_entries[index]; }
64  uint getCount() { return _entries.size(); }
65  Common::SeekableReadStream *createStream(uint index);
66  Common::SeekableReadStream *createStream(BlbArchiveEntry *entry);
67 private:
68  Common::File _fd;
69  Common::Mutex _mutex;
71  byte *_extData;
72 };
73 
74 } // End of namespace Neverhood
75 
76 #endif /* NEVERHOOD_BLBARCHIVE_H */
Definition: background.h:30
Definition: array.h:52
Definition: blbarchive.h:42
Definition: path.h:52
Definition: stream.h:745
Definition: file.h:47
Definition: mutex.h:67
Definition: blbarchive.h:34
Definition: blbarchive.h:53