DIRECTOR: Fix scanned archive names

This commit is contained in:
Eugene Sandulenko 2016-08-30 18:21:34 +02:00
parent 6d3e772897
commit fe22b8bd0e
5 changed files with 22 additions and 6 deletions

View File

@ -152,6 +152,8 @@ Common::HashMap<Common::String, Score *> DirectorEngine::loadMMMNames(Common::St
arc->openFile(i->getName());
Score *sc = new Score(this, arc);
nameMap[sc->getMacName()] = sc;
debugC(2, kDebugLoading, "Movie name: \"%s\"", sc->getMacName().c_str());
}
}

View File

@ -174,7 +174,7 @@ void Frame::readMainChannels(Common::SeekableSubReadStreamEndian &stream, uint16
default:
offset++;
stream.readByte();
debug("Field Position %d, Finish Position %d", offset, finishPosition);
debugC(kDebugLoading, "Frame::readMainChannels: Field Position %d, Finish Position %d", offset, finishPosition);
break;
}
}

View File

@ -51,6 +51,8 @@ bool Archive::openFile(const Common::String &fileName) {
return false;
}
_fileName = fileName;
return true;
}
@ -190,6 +192,12 @@ bool MacArchive::openFile(const Common::String &fileName) {
return false;
}
_fileName = _resFork->getBaseFileName();
if (_fileName.hasSuffix(".bin")) {
for (int i = 0; i < 4; i++)
_fileName.deleteLastChar();
}
Common::MacResTagArray tagArray = _resFork->getResTagArray();
for (uint32 i = 0; i < tagArray.size(); i++) {

View File

@ -43,6 +43,8 @@ public:
virtual bool openStream(Common::SeekableReadStream *stream, uint32 offset = 0) = 0;
virtual void close();
Common::String getFileName() const { return _fileName; }
bool isOpen() const { return _stream != 0; }
bool hasResource(uint32 tag, uint16 id) const;
@ -67,6 +69,8 @@ protected:
typedef Common::HashMap<uint16, Resource> ResourceMap;
typedef Common::HashMap<uint32, ResourceMap> TypeMap;
TypeMap _types;
Common::String _fileName;
};
class MacArchive : public Archive {

View File

@ -108,12 +108,14 @@ Score::Score(DirectorEngine *vm, Archive *archive) {
_stopPlay = false;
_stageColor = 0;
if (_movieArchive->hasResource(MKTAG('M','C','N','M'), 0)) {
_macName = _movieArchive->getName(MKTAG('M','C','N','M'), 0).c_str();
if (archive->hasResource(MKTAG('M','C','N','M'), 0)) {
_macName = archive->getName(MKTAG('M','C','N','M'), 0).c_str();
} else {
_macName = archive->getFileName();
}
if (_movieArchive->hasResource(MKTAG('V','W','L','B'), 1024)) {
loadLabels(*_movieArchive->getResource(MKTAG('V','W','L','B'), 1024));
if (archive->hasResource(MKTAG('V','W','L','B'), 1024)) {
loadLabels(*archive->getResource(MKTAG('V','W','L','B'), 1024));
}
}
@ -344,7 +346,7 @@ void Score::loadLabels(Common::SeekableSubReadStreamEndian &stream) {
Common::SortedArray<Label *>::iterator j;
for (j = _labels->begin(); j != _labels->end(); ++j) {
debug("Frame %d, Label %s", (*j)->number, (*j)->name.c_str());
debugC(2, kDebugLoading, "Frame %d, Label %s", (*j)->number, (*j)->name.c_str());
}
}