diff options
author | Bastien Bouclet | 2019-10-20 09:25:30 +0200 |
---|---|---|
committer | Bastien Bouclet | 2019-10-26 19:18:47 +0200 |
commit | ecccefcbec2caf5aae5ae6d714cb0584204355b1 (patch) | |
tree | c98d9965af604404ebc19e7c07ab794f0daab0c0 | |
parent | ea52a996926fa91bd5b4c240af7582b4d95ba491 (diff) | |
download | scummvm-rg350-ecccefcbec2caf5aae5ae6d714cb0584204355b1.tar.gz scummvm-rg350-ecccefcbec2caf5aae5ae6d714cb0584204355b1.tar.bz2 scummvm-rg350-ecccefcbec2caf5aae5ae6d714cb0584204355b1.zip |
MOHAWK: Cut down on seeks when opening archives
Helps with loading times on systems with slow storage.
-rw-r--r-- | engines/mohawk/resource.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/engines/mohawk/resource.cpp b/engines/mohawk/resource.cpp index e8e382ad00..1e6ded8c8a 100644 --- a/engines/mohawk/resource.cpp +++ b/engines/mohawk/resource.cpp @@ -183,6 +183,7 @@ struct FileTableEntry { }; struct NameTableEntry { + uint16 offset; uint16 index; Common::String name; }; @@ -263,14 +264,15 @@ bool MohawkArchive::openStream(Common::SeekableReadStream *stream) { debug(3, "Names = %04x", nameTable.size()); for (uint16 j = 0; j < nameTable.size(); j++) { - uint16 offset = stream->readUint16BE(); - nameTable[j].index = stream->readUint16BE(); + nameTable[j].offset = stream->readUint16BE(); + nameTable[j].index = stream->readUint16BE(); - debug(4, "Entry[%02x]: Name List Offset = %04x Index = %04x", j, offset, nameTable[j].index); + debug(4, "Entry[%02x]: Name List Offset = %04x Index = %04x", j, nameTable[j].offset, nameTable[j].index); + } + for (uint16 j = 0; j < nameTable.size(); j++) { // Name List - uint32 pos = stream->pos(); - stream->seek(absOffset + stringTableOffset + offset); + stream->seek(absOffset + stringTableOffset + nameTable[j].offset); char c = (char)stream->readByte(); while (c != 0) { nameTable[j].name += c; @@ -278,9 +280,6 @@ bool MohawkArchive::openStream(Common::SeekableReadStream *stream) { } debug(3, "Name = \'%s\'", nameTable[j].name.c_str()); - - // Get back to next entry - stream->seek(pos); } // Resource Table |