ScummVM API documentation
resource_intern.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 KYRA_RESOURCE_INTERN_H
23
#define KYRA_RESOURCE_INTERN_H
24
25
#include "common/archive.h"
26
#include "common/hash-str.h"
27
#include "common/hashmap.h"
28
#include "common/str.h"
29
#include "common/list.h"
30
#include "
common/macresman.h
"
31
#include "common/stream.h"
32
33
namespace
Kyra
{
34
35
class
Resource;
36
37
class
PlainArchive
:
public
Common::Archive
{
38
public
:
39
struct
Entry
{
40
Entry
() : offset(0), size(0) {}
41
Entry
(uint32 o, uint32 s) : offset(o), size(s) {}
42
43
uint32 offset;
44
uint32 size;
45
};
46
47
PlainArchive
(
Common::ArchiveMemberPtr
file);
48
49
void
addFileEntry(
const
Common::Path
&name,
const
Entry
entry);
50
Entry
getFileEntry(
const
Common::Path
&name)
const
;
51
52
// Common::Archive API implementation
53
bool
hasFile
(
const
Common::Path
&path)
const override
;
54
int
listMembers
(
Common::ArchiveMemberList
&list)
const override
;
55
const
Common::ArchiveMemberPtr
getMember
(
const
Common::Path
&path)
const override
;
56
Common::SeekableReadStream
*
createReadStreamForMember
(
const
Common::Path
&path)
const override
;
57
private
:
58
typedef
Common::HashMap<Common::Path, Entry, Common::Path::IgnoreCase_Hash, Common::Path::IgnoreCase_EqualTo>
FileMap
;
59
60
Common::ArchiveMemberPtr
_file;
61
FileMap _files;
62
};
63
64
class
TlkArchive
:
public
Common::Archive
{
65
public
:
66
TlkArchive
(
Common::ArchiveMemberPtr
file, uint16 entryCount,
const
uint32 *fileEntries);
67
~
TlkArchive
()
override
;
68
69
bool
hasFile
(
const
Common::Path
&path)
const override
;
70
int
listMembers
(
Common::ArchiveMemberList
&list)
const override
;
71
const
Common::ArchiveMemberPtr
getMember
(
const
Common::Path
&path)
const override
;
72
Common::SeekableReadStream
*
createReadStreamForMember
(
const
Common::Path
&path)
const override
;
73
private
:
74
Common::ArchiveMemberPtr
_file;
75
76
const
uint32 *findFile(
const
Common::Path
&path)
const
;
77
78
const
uint16 _entryCount;
79
const
uint32 *
const
_fileEntries;
80
};
81
82
class
CachedArchive
:
public
Common::Archive
{
83
public
:
84
struct
InputEntry
{
85
Common::Path
name;
86
87
byte *data;
88
uint32 size;
89
};
90
91
typedef
Common::List<InputEntry>
FileInputList
;
92
93
CachedArchive
(
const
FileInputList &files);
94
~
CachedArchive
()
override
;
95
96
bool
hasFile
(
const
Common::Path
&path)
const override
;
97
int
listMembers
(
Common::ArchiveMemberList
&list)
const override
;
98
const
Common::ArchiveMemberPtr
getMember
(
const
Common::Path
&path)
const override
;
99
Common::SeekableReadStream
*
createReadStreamForMember
(
const
Common::Path
&path)
const override
;
100
private
:
101
struct
Entry {
102
byte *data;
103
uint32 size;
104
};
105
106
typedef
Common::HashMap<Common::Path, Entry, Common::Path::IgnoreCase_Hash, Common::Path::IgnoreCase_EqualTo>
FileMap
;
107
FileMap _files;
108
};
109
110
111
class
ResArchiveLoader
{
112
public
:
113
virtual
~
ResArchiveLoader
() {}
114
virtual
bool
checkFilename(
const
Common::String
&filename)
const
= 0;
115
virtual
bool
isLoadable(
const
Common::String
&filename,
Common::SeekableReadStream
&stream)
const
= 0;
116
virtual
Common::Archive
*load(
Common::ArchiveMemberPtr
file,
Common::SeekableReadStream
&stream)
const
= 0;
117
};
118
119
class
ResLoaderPak
:
public
ResArchiveLoader
{
120
public
:
121
bool
checkFilename(
const
Common::String
&filename)
const override
;
122
bool
isLoadable(
const
Common::String
&filename,
Common::SeekableReadStream
&stream)
const override
;
123
Common::Archive
*load(
Common::ArchiveMemberPtr
file,
Common::SeekableReadStream
&stream)
const override
;
124
};
125
126
class
ResLoaderInsMalcolm
:
public
ResArchiveLoader
{
127
public
:
128
bool
checkFilename(
const
Common::String
&filename)
const override
;
129
bool
isLoadable(
const
Common::String
&filename,
Common::SeekableReadStream
&stream)
const override
;
130
Common::Archive
*load(
Common::ArchiveMemberPtr
file,
Common::SeekableReadStream
&stream)
const override
;
131
};
132
133
class
ResLoaderTlk
:
public
ResArchiveLoader
{
134
public
:
135
bool
checkFilename(
const
Common::String
&filename)
const override
;
136
bool
isLoadable(
const
Common::String
&filename,
Common::SeekableReadStream
&stream)
const override
;
137
Common::Archive
*load(
Common::ArchiveMemberPtr
file,
Common::SeekableReadStream
&stream)
const override
;
138
};
139
140
class
InstallerLoader
{
141
public
:
142
static
Common::Archive
*load(
Resource
*owner,
const
Common::Path
&filename,
const
Common::String
&extension,
const
uint8 offset);
143
};
144
145
class
StuffItLoader
{
146
public
:
147
static
Common::Archive
*load(
Resource
*owner,
const
Common::Path
&filename);
148
static
Common::Archive
*load(
Resource
*owner,
Common::SeekableReadStream
*stream,
const
Common::String
&debugName);
149
};
150
151
}
// End of namespace Kyra
152
153
#endif
Kyra::InstallerLoader
Definition:
resource_intern.h:140
Common::String
Definition:
str.h:59
Kyra::StuffItLoader
Definition:
resource_intern.h:145
Kyra::PlainArchive::Entry
Definition:
resource_intern.h:39
Kyra::ResArchiveLoader
Definition:
resource_intern.h:111
Kyra::Resource
Definition:
resource.h:48
Kyra::PlainArchive
Definition:
resource_intern.h:37
Kyra::PlainArchive::listMembers
int listMembers(Common::ArchiveMemberList &list) const override
Common::List
Definition:
list.h:44
Common::Path
Definition:
path.h:52
Kyra::CachedArchive
Definition:
resource_intern.h:82
Kyra::PlainArchive::hasFile
bool hasFile(const Common::Path &path) const override
Kyra::PlainArchive::getMember
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override
Common::SeekableReadStream
Definition:
stream.h:745
Common::Archive
Definition:
archive.h:141
Common::HashMap< Common::Path, Entry, Common::Path::IgnoreCase_Hash, Common::Path::IgnoreCase_EqualTo >
Kyra::TlkArchive
Definition:
resource_intern.h:64
Kyra::ResLoaderPak
Definition:
resource_intern.h:119
Kyra::ResLoaderInsMalcolm
Definition:
resource_intern.h:126
Kyra
Definition:
detection.h:27
Kyra::CachedArchive::InputEntry
Definition:
resource_intern.h:84
Common::SharedPtr< ArchiveMember >
Kyra::ResLoaderTlk
Definition:
resource_intern.h:133
Kyra::PlainArchive::createReadStreamForMember
Common::SeekableReadStream * createReadStreamForMember(const Common::Path &path) const override
macresman.h
engines
kyra
resource
resource_intern.h
Generated on Thu Nov 14 2024 09:16:31 for ScummVM API documentation by
1.8.13