diff --git a/engines/myst3/directorysubentry.cpp b/engines/myst3/directorysubentry.cpp index 2550af50151..b433123e8f5 100644 --- a/engines/myst3/directorysubentry.cpp +++ b/engines/myst3/directorysubentry.cpp @@ -32,9 +32,6 @@ namespace Myst3 { DirectorySubEntry::DirectorySubEntry(Archive *archive) : _archive(archive) { - for (uint i = 0; i < ARRAYSIZE(_miscData); i++) { - _miscData[i] = 0; - } } void DirectorySubEntry::readFromStream(Common::SeekableReadStream &inStream) { @@ -61,12 +58,7 @@ void DirectorySubEntry::readFromStream(Common::SeekableReadStream &inStream) { _videoData.width = inStream.readSint32LE(); _videoData.height = inStream.readSint32LE(); } else if (_type == kNumMetadata || _type == kTextMetadata) { - if (_metadataSize > 20) { - warning("Too much metadata, skipping"); - inStream.skip(_metadataSize * sizeof(uint32)); - return; - } - + _miscData.resize(_metadataSize + 2); _miscData[0] = _offset; _miscData[1] = _size; @@ -129,8 +121,6 @@ Common::MemoryReadStream *DirectorySubEntry::getData() const { } uint32 DirectorySubEntry::getMiscData(uint index) const { - assert(index < 22); - return _miscData[index]; } @@ -141,7 +131,7 @@ Common::String DirectorySubEntry::getTextData(uint index) const { memset(decrypted, 0, sizeof(decrypted)); uint8 *out = &decrypted[0]; - while (_miscData[cnt / 4] && cnt < 89) { + while (cnt / 4 < _miscData.size() && cnt < 89) { // XORed text stored in little endian 32 bit words *out++ = (_miscData[cnt / 4] >> (8 * (3 - (cnt % 4)))) ^ key++; cnt++; diff --git a/engines/myst3/directorysubentry.h b/engines/myst3/directorysubentry.h index be39b6f31d2..37857c43bdb 100644 --- a/engines/myst3/directorysubentry.h +++ b/engines/myst3/directorysubentry.h @@ -43,7 +43,7 @@ struct VideoData { int32 height; }; -typedef uint32 MiscData[22]; +typedef Common::Array MiscData; class Archive; @@ -69,7 +69,6 @@ class DirectorySubEntry { kDialogMovie = 74 }; - DirectorySubEntry() {} DirectorySubEntry(Archive *archive); void readFromStream(Common::SeekableReadStream &inStream);