From bd345ce81c0edd1267909b0bcac7bcf65dea834b Mon Sep 17 00:00:00 2001 From: Dmitry Iskrich Date: Fri, 3 Jun 2016 19:07:30 +0300 Subject: DIRECTOR: Parse mac name --- engines/director/resource.cpp | 21 +++++++++++++++++---- engines/director/score.cpp | 4 ++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp index 8eb4b92b14..2c90dfd203 100644 --- a/engines/director/resource.cpp +++ b/engines/director/resource.cpp @@ -244,6 +244,18 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff if (tag == 0) break; + uint16 startResPos = stream->pos(); + stream->seek(offset + 12); + + Common::String name = ""; + byte nameSize = stream->readByte(); + if (nameSize) { + for (uint8 i = 0; i < nameSize; i++) { + name += stream->readByte(); + } + } + + stream->seek(startResPos); debug(0, "Found RIFF resource '%s' %d: %d @ 0x%08x", tag2str(tag), id, size, offset); @@ -251,6 +263,7 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff Resource &res = resMap[id]; res.offset = offset; res.size = size; + res.name = name; } _stream = stream; @@ -273,9 +286,10 @@ Common::SeekableReadStream *RIFFArchive::getResource(uint32 tag, uint16 id) { uint32 size = res.size - 4; // Skip the Pascal string _stream->seek(offset); - byte stringSize = _stream->readByte() + 1; // 1 for this byte - offset += stringSize; - size -= stringSize; + byte stringSize = _stream->readByte(); // 1 for this byte + + offset += stringSize + 1; + size -= stringSize + 1; // Align to nearest word boundary if (offset & 1) { @@ -286,7 +300,6 @@ Common::SeekableReadStream *RIFFArchive::getResource(uint32 tag, uint16 id) { return new Common::SeekableSubReadStream(_stream, offset, offset + size); } - // RIFX Archive code bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOffset) { diff --git a/engines/director/score.cpp b/engines/director/score.cpp index bd07f7849d..889020cdff 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -54,6 +54,10 @@ Score::Score(Archive &movie) { if (_movieArchive->hasResource(MKTAG('V','W','A','C'), 1024)) { loadActions(*_movieArchive->getResource(MKTAG('V','W','A','C'), 1024)); } + + if (_movieArchive->hasResource(MKTAG('M','C','N','M'), 0)) { + debug("Mac name %s", _movieArchive->getName(MKTAG('M','C','N','M'), 0).c_str()); + } } void Score::loadFrames(Common::SeekableReadStream &stream) { -- cgit v1.2.3