ScummVM API documentation
nhcarchive.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_NHCARCHIVE_H
23
#define NEVERHOOD_NHCARCHIVE_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
NhcArchiveEntry
{
35
uint32 fileHash;
36
uint32 type;
37
uint32 offset;
38
uint32 size;
39
40
bool
isNormal()
const
{
41
// Resources 0-10 replace resources with the same ID
42
// Resources 11 and 12 are under custom ID for subtitle font and saveload dialog messages
43
// 13 adds subtitles to a video with the same ID and so should not replace it
44
return
type <= 10;
45
}
46
};
47
48
class
NhcArchive
{
49
public
:
50
NhcArchive
() {}
51
~
NhcArchive
() {}
52
bool
open(
const
Common::Path
&filename,
bool
isOptional);
53
void
load(uint index, byte *buffer, uint32 size);
54
void
load(
NhcArchiveEntry
*entry, byte *buffer, uint32 size);
55
uint32 getSize(uint index) {
return
_entries[index].size; }
56
NhcArchiveEntry
*getEntry(uint index) {
return
&_entries[index]; }
57
uint getCount() {
return
_entries.size(); }
58
Common::SeekableReadStream
*createStream(uint index);
59
Common::SeekableReadStream
*createStream(
NhcArchiveEntry
*entry);
60
private
:
61
Common::File
_fd;
62
Common::Mutex
_mutex;
63
Common::Array<NhcArchiveEntry>
_entries;
64
};
65
66
}
// End of namespace Neverhood
67
68
#endif
/* NEVERHOOD_BLBARCHIVE_H */
Neverhood
Definition:
background.h:30
Common::Array
Definition:
array.h:52
Neverhood::NhcArchiveEntry
Definition:
nhcarchive.h:34
Neverhood::NhcArchive
Definition:
nhcarchive.h:48
Common::Path
Definition:
path.h:52
Common::SeekableReadStream
Definition:
stream.h:745
Common::File
Definition:
file.h:47
Common::Mutex
Definition:
mutex.h:67
engines
neverhood
nhcarchive.h
Generated on Sun Dec 22 2024 09:16:02 for ScummVM API documentation by
1.8.13