[Scummvm-git-logs] scummvm master -> ecccefcbec2caf5aae5ae6d714cb0584204355b1

bgK bastien.bouclet at gmail.com
Sat Oct 26 19:52:21 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ecccefcbec MOHAWK: Cut down on seeks when opening archives


Commit: ecccefcbec2caf5aae5ae6d714cb0584204355b1
    https://github.com/scummvm/scummvm/commit/ecccefcbec2caf5aae5ae6d714cb0584204355b1
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2019-10-26T19:18:47+02:00

Commit Message:
MOHAWK: Cut down on seeks when opening archives

Helps with loading times on systems with slow storage.

Changed paths:
    engines/mohawk/resource.cpp


diff --git a/engines/mohawk/resource.cpp b/engines/mohawk/resource.cpp
index e8e382a..1e6ded8 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





More information about the Scummvm-git-logs mailing list