Skip to content

Commit

Permalink
DIRECTOR: Parse mac name
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Iskrich authored and sev- committed Aug 3, 2016
1 parent f954105 commit bd345ce
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
21 changes: 17 additions & 4 deletions engines/director/resource.cpp
Expand Up @@ -244,13 +244,26 @@ 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);

ResourceMap &resMap = _types[tag];
Resource &res = resMap[id];
res.offset = offset;
res.size = size;
res.name = name;
}

_stream = stream;
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions engines/director/score.cpp
Expand Up @@ -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) {
Expand Down

0 comments on commit bd345ce

Please sign in to comment.