aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb
diff options
context:
space:
mode:
authorEugene Sandulenko2019-08-21 19:24:29 +0200
committerEugene Sandulenko2019-09-03 17:17:34 +0200
commitcf3c1f099759df4e6c6787949bffbd707bad328b (patch)
tree4f8a183900d8e2a79e02020c1eed0f646b55d578 /engines/hdb
parentaf8df1bd56324ef5d90d33b9574c494c30b3c1cc (diff)
downloadscummvm-rg350-cf3c1f099759df4e6c6787949bffbd707bad328b.tar.gz
scummvm-rg350-cf3c1f099759df4e6c6787949bffbd707bad328b.tar.bz2
scummvm-rg350-cf3c1f099759df4e6c6787949bffbd707bad328b.zip
HDB: Added optional length parameter for querying from FindFirstData
Diffstat (limited to 'engines/hdb')
-rw-r--r--engines/hdb/file-manager.cpp5
-rw-r--r--engines/hdb/file-manager.h2
2 files changed, 5 insertions, 2 deletions
diff --git a/engines/hdb/file-manager.cpp b/engines/hdb/file-manager.cpp
index e38d44f40e..bc751749f5 100644
--- a/engines/hdb/file-manager.cpp
+++ b/engines/hdb/file-manager.cpp
@@ -96,7 +96,7 @@ void FileMan::seek(int32 offset, int flag) {
_mpcFile->seek(offset, flag);
}
-Common::SeekableReadStream *FileMan::findFirstData(const char *string, DataType type) {
+Common::SeekableReadStream *FileMan::findFirstData(const char *string, DataType type, int *length) {
Common::String fileString;
MPCEntry *file = NULL;
@@ -135,6 +135,9 @@ Common::SeekableReadStream *FileMan::findFirstData(const char *string, DataType
_mpcFile->read(buffer, file->length);
+ if (length)
+ *length = file->ulength;
+
// Return buffer wrapped in a MemoryReadStream, automatically
// uncompressed if it is zlib-compressed
return Common::wrapCompressedReadStream(new Common::MemoryReadStream(buffer, file->length, DisposeAfterUse::NO), file->length);
diff --git a/engines/hdb/file-manager.h b/engines/hdb/file-manager.h
index 62caaadf84..f3a65bb1b4 100644
--- a/engines/hdb/file-manager.h
+++ b/engines/hdb/file-manager.h
@@ -72,7 +72,7 @@ public:
void closeMPC();
void seek(int32 offset, int flag);
- Common::SeekableReadStream *findFirstData(const char *string, DataType type);
+ Common::SeekableReadStream *findFirstData(const char *string, DataType type, int *length = NULL);
int32 getLength(const char *string, DataType type);
int getCount(const char *subString, DataType type);
Common::Array<const char *> *findFiles(const char *string, DataType type);