ScummVM API documentation
resourceManager.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 RESOURCE_MANAGER_H
23
#define RESOURCE_MANAGER_H
24
25
#include "common/archive.h"
26
#include "common/file.h"
27
#include "common/hash-str.h"
28
#include "common/hashmap.h"
29
#include "common/ptr.h"
30
#include "common/scummsys.h"
31
#include "common/str.h"
32
33
namespace
Graphics
{
34
struct
Surface;
35
struct
PixelFormat;
36
}
// namespace Graphics
37
38
namespace
AGDS
{
39
40
class
ResourceManager
{
41
private
:
42
class
GrpFile;
43
class
ArchiveMember :
public
Common::ArchiveMember
{
44
GrpFile *_parent;
45
Common::String
_name;
46
uint32 _offset;
47
uint32 _size;
48
49
public
:
50
ArchiveMember(GrpFile *parent,
const
Common::String
&name, uint32 offset, uint32 size) : _parent(parent), _name(name), _offset(offset), _size(size) {
51
}
52
Common::SeekableReadStream
*createReadStream()
const override
;
53
Common::String
getName()
const override
{
54
return
getFileName();
55
}
56
Common::Path
getPathInArchive()
const override
{
57
return
Common::Path
{_name};
58
}
59
Common::String
getFileName()
const override
{
60
return
_name;
61
}
62
Common::SeekableReadStream
*createReadStreamForAltStream(Common::AltStreamType altStreamType)
const override
{
63
return
nullptr
;
64
}
65
};
66
using
ArchiveMemberPtr
=
Common::SharedPtr<ArchiveMember>
;
67
68
class
GrpFile :
public
Common::Archive
{
69
Common::File
_file;
70
71
using
MembersType =
Common::HashMap<Common::String, ArchiveMemberPtr, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo>
;
72
MembersType _members;
73
74
public
:
75
bool
load(
const
Common::Path
&path);
76
77
Common::SeekableReadStream
&getArchiveStream() {
78
return
_file;
79
}
80
81
bool
hasFile(
const
Common::Path
&name)
const override
;
82
int
listMembers(
Common::ArchiveMemberList
&list)
const override
;
83
const
Common::ArchiveMemberPtr
getMember(
const
Common::Path
&name)
const override
;
84
Common::SeekableReadStream
*createReadStreamForMember(
const
Common::Path
&name)
const override
;
85
};
86
87
public
:
88
ResourceManager
();
89
~
ResourceManager
();
90
91
static
void
decrypt(uint8 *data,
unsigned
size);
92
static
bool
IsBMP(
Common::SeekableReadStream
&stream);
93
94
bool
addPath(
const
Common::Path
&grpFilename);
95
96
Common::SeekableReadStream
*getResource(
const
Common::String
&name)
const
;
97
Graphics::Surface
*loadPicture(
const
Common::String
&name,
const
Graphics::PixelFormat
&format);
98
99
static
Common::String
loadText(
Common::SeekableReadStream
&stream);
100
Common::String
loadText(
const
Common::String
&name)
const
;
101
};
102
103
Common::String
readString(
Common::ReadStream
&stream, uint size = 32);
104
void
writeString(
Common::WriteStream
&stream,
const
Common::String
&
string
, uint size = 32);
105
106
}
// End of namespace AGDS
107
108
#endif
/* AGDS_RESOURCE_MANAGER_H */
Common::String
Definition:
str.h:59
Graphics::Surface
Definition:
surface.h:67
Common::WriteStream
Definition:
stream.h:77
Graphics::PixelFormat
Definition:
pixelformat.h:138
Common::List
Definition:
list.h:44
Common::Path
Definition:
path.h:52
Common::SeekableReadStream
Definition:
stream.h:745
Common::Archive
Definition:
archive.h:141
AGDS::ResourceManager
Definition:
resourceManager.h:40
AGDS
Definition:
agds.h:58
Common::HashMap< Common::String, ArchiveMemberPtr, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo >
Common::File
Definition:
file.h:47
Common::ArchiveMember
Definition:
archive.h:68
Graphics
Definition:
formatinfo.h:28
Common::ReadStream
Definition:
stream.h:385
Common::SharedPtr< ArchiveMember >
engines
agds
resourceManager.h
Generated on Wed Dec 10 2025 09:10:19 for ScummVM API documentation by
1.8.13