mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 05:01:43 +00:00
NEVERHOOD: Add ResourceMan::exists helper function
This is essentially same ads attempting to open the file in question but without incurring I/O cost.
This commit is contained in:
parent
0d3f068db3
commit
31618a13f5
@ -131,6 +131,17 @@ bool ResourceMan::nhcExists(uint32 fileHash, uint32 type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ResourceMan::exists(uint32 fileHash) {
|
||||
ResourceFileEntry *entry = findEntry(fileHash);
|
||||
if (!entry)
|
||||
return false;
|
||||
if (entry->nhcArchiveEntry && entry->nhcArchive && entry->nhcArchiveEntry->isNormal())
|
||||
return true;
|
||||
if (entry->archiveEntry && entry->archive)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void ResourceMan::queryResource(uint32 fileHash, ResourceHandle &resourceHandle) {
|
||||
ResourceFileEntry *firstEntry;
|
||||
resourceHandle._resourceFileEntry = findEntry(fileHash, &firstEntry);
|
||||
|
@ -115,6 +115,7 @@ public:
|
||||
Common::SeekableReadStream *createStream(uint32 fileHash);
|
||||
Common::SeekableReadStream *createNhcStream(uint32 fileHash, uint32 type);
|
||||
bool nhcExists(uint32 fileHash, uint32 type);
|
||||
bool exists(uint32 fileHash);
|
||||
const ResourceFileEntry& getEntry(uint index) { return _entries[index]; }
|
||||
uint getEntryCount() { return _entries.size(); }
|
||||
void queryResource(uint32 fileHash, ResourceHandle &resourceHandle);
|
||||
|
Loading…
x
Reference in New Issue
Block a user