aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/blorb.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2018-12-12 19:38:29 -0800
committerPaul Gilbert2018-12-12 19:38:29 -0800
commit48d3b829d6a82cab5a62d84e07a51b2687a63572 (patch)
tree025eb0b3a7cfb500e055ce4ef7d7c19db76513d5 /engines/glk/blorb.cpp
parentd31e37683c8790ff41cdd7356344bd01861fb414 (diff)
downloadscummvm-rg350-48d3b829d6a82cab5a62d84e07a51b2687a63572.tar.gz
scummvm-rg350-48d3b829d6a82cab5a62d84e07a51b2687a63572.tar.bz2
scummvm-rg350-48d3b829d6a82cab5a62d84e07a51b2687a63572.zip
GLK: FROTZ: Adding detection entries, add ability to read serials from Blorb archives
Diffstat (limited to 'engines/glk/blorb.cpp')
-rw-r--r--engines/glk/blorb.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/engines/glk/blorb.cpp b/engines/glk/blorb.cpp
index 1438abb66b..1f95919401 100644
--- a/engines/glk/blorb.cpp
+++ b/engines/glk/blorb.cpp
@@ -58,6 +58,12 @@ Blorb::Blorb(const Common::String &filename, InterpreterType interpType) :
error("Could not parse blorb file");
}
+Blorb::Blorb(const Common::FSNode &fileNode, InterpreterType interpType) :
+ Common::Archive(), _fileNode(fileNode), _interpType(interpType) {
+ if (load() != Common::kNoError)
+ error("Could not parse blorb file");
+}
+
bool Blorb::hasFile(const Common::String &name) const {
for (uint idx = 0; idx < _chunks.size(); ++idx) {
if (_chunks[idx]._filename.equalsIgnoreCase(name))
@@ -86,7 +92,8 @@ Common::SeekableReadStream *Blorb::createReadStreamForMember(const Common::Strin
for (uint idx = 0; idx < _chunks.size(); ++idx) {
if (_chunks[idx]._filename.equalsIgnoreCase(name)) {
Common::File f;
- if (!f.open(_filename))
+ if ((!_filename.empty() && !f.open(_filename)) ||
+ (_filename.empty() && !f.open(_fileNode)))
error("Reading failed");
f.seek(_chunks[idx]._offset);
@@ -103,7 +110,9 @@ Common::SeekableReadStream *Blorb::createReadStreamForMember(const Common::Strin
Common::ErrorCode Blorb::load() {
// First, chew through the file and index the chunks
Common::File f;
- if (!f.open(_filename) || f.size() < 12)
+ if ((!_filename.empty() && !f.open(_filename)) ||
+ (_filename.empty() && !f.open(_fileNode)) ||
+ f.size() < 12)
return Common::kReadingFailed;
if (f.readUint32BE() != ID_FORM)