aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/file-manager.cpp
diff options
context:
space:
mode:
authorNipun Garg2019-06-01 16:21:46 +0530
committerEugene Sandulenko2019-09-03 17:16:42 +0200
commit006bf635ae4327e4f12900bf7bcf6ad06b180b98 (patch)
treed8ce2f8aeccb92677b78bdad20668a1dee581571 /engines/hdb/file-manager.cpp
parente3eaf42515a9872b896883697b6bcd87731671b7 (diff)
downloadscummvm-rg350-006bf635ae4327e4f12900bf7bcf6ad06b180b98.tar.gz
scummvm-rg350-006bf635ae4327e4f12900bf7bcf6ad06b180b98.tar.bz2
scummvm-rg350-006bf635ae4327e4f12900bf7bcf6ad06b180b98.zip
HDB: Add readStream() to create input stream
The input stream is designed keeping in mind the structure of the MPC file in mind.
Diffstat (limited to 'engines/hdb/file-manager.cpp')
-rw-r--r--engines/hdb/file-manager.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/engines/hdb/file-manager.cpp b/engines/hdb/file-manager.cpp
index 1632da90bb..72250a2251 100644
--- a/engines/hdb/file-manager.cpp
+++ b/engines/hdb/file-manager.cpp
@@ -87,19 +87,21 @@ void FileMan::closeMPC() {
_mpcFile->close();
}
-MPCEntry *FileMan::findFirstData(const char *string, DataType type) {
- Common::String fileString;
-
- debug("Hello");
+void FileMan::seek(int32 offset, int flag) {
+ _mpcFile->seek(offset, flag);
+}
- /*for (MPCIterator it = _dir.begin(); it != _dir.end(); it++) {
+MPCEntry **FileMan::findFirstData(const char *string, DataType type) {
+ Common::String fileString;
+
+ for (MPCIterator it = _dir.begin(); it != _dir.end(); it++) {
fileString = (*it)->filename;
if (fileString.contains(string)) {
if ((*it)->type == type) {
return it;
}
}
- }*/
+ }
return NULL;
}
@@ -129,4 +131,16 @@ int FileMan::findAmount(char *string, DataType type) {
return count;
}*/
+Common::SeekableReadStream *FileMan::readStream(uint32 length) {
+ byte *buffer = new byte[length];
+ byte *origin = buffer;
+
+ for (uint32 i = 0; i < length; i++) {
+ *buffer = _mpcFile->readByte();
+ buffer++;
+ }
+
+ return new Common::MemoryReadStream(origin, length);
+}
+
} // End of Namespace HDB