22 #ifndef NEVERHOOD_RESOURCEMAN_H 23 #define NEVERHOOD_RESOURCEMAN_H 25 #include "common/array.h" 26 #include "common/file.h" 27 #include "common/hashmap.h" 28 #include "neverhood/neverhood.h" 29 #include "neverhood/blbarchive.h" 30 #include "neverhood/nhcarchive.h" 35 struct ResourceHandle;
50 ResourceFileEntry() : resourceHandle(-1), archive(
nullptr), archiveEntry(
nullptr), nhcArchive(
nullptr), nhcArchiveEntry(
nullptr) {}
69 bool isValid()
const {
return _resourceFileEntry != NULL
70 && (_resourceFileEntry->archiveEntry != NULL
71 || (_resourceFileEntry->nhcArchiveEntry != NULL && _resourceFileEntry->nhcArchiveEntry->isNormal())); }
73 if (_resourceFileEntry == NULL)
75 if (_resourceFileEntry->nhcArchiveEntry != NULL && _resourceFileEntry->nhcArchiveEntry->isNormal())
76 return _resourceFileEntry->nhcArchiveEntry->type;
77 if (_resourceFileEntry->archiveEntry != NULL)
78 return _resourceFileEntry->archiveEntry->type;
81 const byte *data()
const {
return _data; }
83 if (_resourceFileEntry == NULL)
85 if (_resourceFileEntry->nhcArchiveEntry != NULL && _resourceFileEntry->nhcArchiveEntry->isNormal())
86 return _resourceFileEntry->nhcArchiveEntry->size;
87 if (_resourceFileEntry->archiveEntry != NULL)
88 return _resourceFileEntry->archiveEntry->size;
91 const byte *extData()
const {
return _extData; }
92 uint32 fileHash()
const {
93 if (_resourceFileEntry == NULL)
95 if (_resourceFileEntry->nhcArchiveEntry != NULL && _resourceFileEntry->nhcArchiveEntry->isNormal())
96 return _resourceFileEntry->nhcArchiveEntry->fileHash;
97 if (_resourceFileEntry->archiveEntry != NULL)
98 return _resourceFileEntry->archiveEntry->fileHash;
103 const byte *_extData;
111 void addArchive(
const Common::Path &filename,
bool isOptional =
false);
117 bool nhcExists(uint32 fileHash, uint32 type);
118 bool exists(uint32 fileHash);
120 uint getEntryCount() {
return _entries.size(); }
121 void queryResource(uint32 fileHash,
ResourceHandle &resourceHandle);
122 void loadResource(
ResourceHandle &resourceHandle,
bool applyResourceFixes);
124 void purgeResources();
Definition: background.h:30
Definition: resourceman.h:64
Definition: blbarchive.h:42
Definition: nhcarchive.h:34
Definition: nhcarchive.h:48
Definition: resourceman.h:58
Definition: resourceman.h:37
Definition: resourceman.h:107
Definition: resourceman.h:53
Definition: blbarchive.h:53