[Scummvm-git-logs] scummvm master -> 8cea76d583c09921cbeac62532483d6ccf9cdd58

sev- sev at scummvm.org
Thu Jul 9 21:15:55 UTC 2020


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

Summary:
f534e11ccf COMMON: Added VersionInfo parser to WinResources
e57f332942 DIRECTOR: Switch to WinResources VersionInfo parser
8cea76d583 DIRECTOR: Fix warning


Commit: f534e11ccf96fc842fe2d0744ded02a63d63e7b2
    https://github.com/scummvm/scummvm/commit/f534e11ccf96fc842fe2d0744ded02a63d63e7b2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-07-09T23:13:47+02:00

Commit Message:
COMMON: Added VersionInfo parser to WinResources

Changed paths:
    common/winexe.cpp
    common/winexe.h


diff --git a/common/winexe.cpp b/common/winexe.cpp
index ad6ff96505..d853df01cf 100644
--- a/common/winexe.cpp
+++ b/common/winexe.cpp
@@ -23,6 +23,7 @@
 #include "common/file.h"
 #include "common/memstream.h"
 #include "common/str.h"
+#include "common/ustr.h"
 #include "common/winexe.h"
 #include "common/winexe_ne.h"
 #include "common/winexe_pe.h"
@@ -183,4 +184,59 @@ WinResources *WinResources::createFromEXE(const String &fileName) {
 	return nullptr;
 }
 
+WinResources::VersionHash *WinResources::parseVersionInfo(SeekableReadStream *res) {
+	VersionHash *versionMap = new VersionHash;
+
+	while (res->pos() < res->size() && !res->eos()) {
+		while (res->pos() % 4 && !res->eos()) // Pad to 4
+			res->readByte();
+
+		/* uint16 len = */ res->readUint16LE();
+		uint16 valLen = res->readUint16LE();
+		uint16 type = res->readUint16LE();
+		uint16 c;
+
+		Common::U32String info;
+		while ((c = res->readUint16LE()) != 0 && !res->eos())
+			info += c;
+
+		while (res->pos() % 4 && !res->eos()) // Pad to 4
+			res->readByte();
+
+		if (res->eos())
+			break;
+
+		if (type != 0) {	// text
+			Common::U32String value;
+			for (int j = 0; j < valLen; j++)
+				value += res->readUint16LE();
+
+			versionMap->setVal(info.encode(), value);
+		} else {
+			if (info == "VS_VERSION_INFO") {
+				uint16 pos2 = res->pos() + valLen;
+
+				res->readUint32LE();
+				res->readUint32LE();
+				uint16 fileB = res->readUint16LE();
+				uint16 fileA = res->readUint16LE();
+				uint16 fileD = res->readUint16LE();
+				uint16 fileC = res->readUint16LE();
+				uint16 prodB = res->readUint16LE();
+				uint16 prodA = res->readUint16LE();
+				uint16 prodD = res->readUint16LE();
+				uint16 prodC = res->readUint16LE();
+
+				versionMap->setVal("File:", Common::String::format("%d.%d.%d.%d", fileA, fileB, fileC, fileD));
+				versionMap->setVal("Prod:", Common::String::format("%d.%d.%d.%d", prodA, prodB, prodC, prodD));
+
+				while (res->pos() != pos2 && !res->eos())
+					res->readByte();
+			}
+		}
+	}
+
+	return versionMap;
+}
+
 } // End of namespace Common
diff --git a/common/winexe.h b/common/winexe.h
index 2b81a33261..cab0867587 100644
--- a/common/winexe.h
+++ b/common/winexe.h
@@ -130,6 +130,10 @@ public:
 	}
 
 	static WinResources *createFromEXE(const String &fileName);
+
+	typedef Common::HashMap<Common::String, Common::U32String, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> VersionHash;
+
+	static VersionHash *parseVersionInfo(SeekableReadStream *stream);
 };
 
 } // End of namespace Common


Commit: e57f33294245935af9af78cdd6296c224636d4bf
    https://github.com/scummvm/scummvm/commit/e57f33294245935af9af78cdd6296c224636d4bf
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-07-09T23:13:47+02:00

Commit Message:
DIRECTOR: Switch to WinResources VersionInfo parser

Changed paths:
    engines/director/resource.cpp


diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 80a1c72cb2..b07845dda5 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -178,53 +178,14 @@ void Stage::loadEXE(const Common::String movie) {
 		for (uint i = 0; i < versions.size(); i++) {
 			Common::SeekableReadStream *res = exe->getResource(Common::kWinVersion, versions[i]);
 
-			while (res->pos() < res->size() && !res->eos()) {
-				while (res->pos() % 4 && !res->eos()) // Pad to 4
-					res->readByte();
-
-				/* uint16 len = */ res->readUint16LE();
-				uint16 valLen = res->readUint16LE();
-				uint16 type = res->readUint16LE();
-				uint16 c;
-
-				Common::U32String info;
-				while ((c = res->readUint16LE()) != 0 && !res->eos())
-					info += c;
-
-				while (res->pos() % 4 && !res->eos()) // Pad to 4
-					res->readByte();
-
-				if (res->eos())
-					break;
-
-				if (type != 0) {	// text
-					Common::U32String value;
-					for (int j = 0; j < valLen; j++)
-						value += res->readUint16LE();
-
-					warning("info <%s>: <%s>", info.encode().c_str(), value.encode().c_str());
-				} else {
-					if (info == "VS_VERSION_INFO") {
-						uint16 pos2 = res->pos() + valLen;
-
-						res->readUint32LE();
-						res->readUint32LE();
-						uint16 fileB = res->readUint16LE();
-						uint16 fileA = res->readUint16LE();
-						uint16 fileD = res->readUint16LE();
-						uint16 fileC = res->readUint16LE();
-						uint16 prodB = res->readUint16LE();
-						uint16 prodA = res->readUint16LE();
-						uint16 prodD = res->readUint16LE();
-						uint16 prodC = res->readUint16LE();
-						warning("\tFile: %d.%d.%d.%d", fileA, fileB, fileC, fileD);
-						warning("\tProd: %d.%d.%d.%d", prodA, prodB, prodC, prodD);
-
-						while (res->pos() != pos2 && !res->eos())
-							res->readByte();
-					}
-				}
-			}
+			Common::WinResources::VersionHash *versionMap = Common::WinResources::parseVersionInfo(res);
+
+			for (Common::WinResources::VersionHash::const_iterator it = versionMap->begin(); it != versionMap->end(); ++it)
+				warning("info <%s>: <%s>", it->_key.c_str(), it->_value.encode().c_str());
+
+			delete versionMap;
+			delete res;
+
 		}
 		delete exe;
 


Commit: 8cea76d583c09921cbeac62532483d6ccf9cdd58
    https://github.com/scummvm/scummvm/commit/8cea76d583c09921cbeac62532483d6ccf9cdd58
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-07-09T23:15:35+02:00

Commit Message:
DIRECTOR: Fix warning

Changed paths:
    engines/director/stage.h


diff --git a/engines/director/stage.h b/engines/director/stage.h
index c2aa8d5361..ae849f6d83 100644
--- a/engines/director/stage.h
+++ b/engines/director/stage.h
@@ -38,7 +38,7 @@ class MacWindowManager;
 
 namespace Director {
 
-struct Channel;
+class Channel;
 struct MacShape;
 
 struct TransParams {




More information about the Scummvm-git-logs mailing list