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

sev- noreply at scummvm.org
Sun Jan 15 18:22:40 UTC 2023


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

Summary:
30717496ce COMMON: Allow unarj to flatten tree structure
600f33bccf COMMON: Allow unzip to flatten tree structure
8e5d88cd55 SAGA: Flatten tree in ZIP and ARJ archives.
b88c384721 SAGA: Add ITE win demo 1 and 2 compressed variant.


Commit: 30717496cef8e2cd801891299f24cb8d2594d258
    https://github.com/scummvm/scummvm/commit/30717496cef8e2cd801891299f24cb8d2594d258
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-15T19:22:34+01:00

Commit Message:
COMMON: Allow unarj to flatten tree structure

It's easier to some games to ignore directories

Changed paths:
    common/compression/unarj.cpp
    common/compression/unarj.h


diff --git a/common/compression/unarj.cpp b/common/compression/unarj.cpp
index 01fd039d047..b0e3530b20a 100644
--- a/common/compression/unarj.cpp
+++ b/common/compression/unarj.cpp
@@ -702,9 +702,10 @@ typedef HashMap<String, Array<ArjFileChunk>, IgnoreCase_Hash, IgnoreCase_EqualTo
 class ArjArchive : public MemcachingCaseInsensitiveArchive {
 	ArjHeadersMap _headers;
 	Array<String> _arjFilenames;
+	bool _flattenTree;
 
 public:
-	ArjArchive(const Array<String> &names);
+	ArjArchive(const Array<String> &names, bool flattenTree);
 	virtual ~ArjArchive();
 
 	// Archive implementation
@@ -713,7 +714,7 @@ public:
 	const ArchiveMemberPtr getMember(const Path &path) const override;
 	Common::SharedArchiveContents readContentsForPath(const Common::String& translated) const override;
 	Common::String translatePath(const Common::Path &path) const override {
-		return path.toString();
+		return _flattenTree ? path.getLastComponent().toString() : path.toString();
 	}
 };
 
@@ -726,7 +727,7 @@ ArjArchive::~ArjArchive() {
        }
 }
 
-ArjArchive::ArjArchive(const Array<String> &filenames) : _arjFilenames(filenames) {
+ArjArchive::ArjArchive(const Array<String> &filenames, bool flattenTree) : _arjFilenames(filenames), _flattenTree(flattenTree) {
 	for (uint i = 0; i < _arjFilenames.size(); i++) {
 		File arjFile;
 
@@ -750,7 +751,13 @@ ArjArchive::ArjArchive(const Array<String> &filenames) : _arjFilenames(filenames
 		delete header;
 
 		while ((header = readHeader(arjFile)) != nullptr) {
-			_headers[header->filename].push_back(ArjFileChunk(header, i));
+			const char *name = header->filename;
+
+			if (_flattenTree)
+				for (const char *p = header->filename; *p; p++)
+					if (*p == '\\' || *p == '/')
+						name = p + 1;
+			_headers[name].push_back(ArjFileChunk(header, i));
 			arjFile.seek(header->compSize, SEEK_CUR);
 		}
 	}
@@ -841,12 +848,12 @@ Common::SharedArchiveContents ArjArchive::readContentsForPath(const Common::Stri
 	return Common::SharedArchiveContents(uncompressedData, uncompressedSize);
 }
 
-Archive *makeArjArchive(const String &name) {
-	return new ArjArchive({name});
+Archive *makeArjArchive(const String &name, bool flattenTree) {
+	return new ArjArchive({name}, flattenTree);
 }
 
-Archive *makeArjArchive(const Array<String> &names) {
-	return new ArjArchive(names);
+Archive *makeArjArchive(const Array<String> &names, bool flattenTree) {
+	return new ArjArchive(names, flattenTree);
 }
 
 } // End of namespace Common
diff --git a/common/compression/unarj.h b/common/compression/unarj.h
index 6e08b5778aa..ba90f028de8 100644
--- a/common/compression/unarj.h
+++ b/common/compression/unarj.h
@@ -49,12 +49,12 @@ class Archive;
  *
  * May return 0 in case of a failure.
  */
-Archive *makeArjArchive(const String &name);
+Archive *makeArjArchive(const String &name, bool flattenTree = false);
 
 /**
  * Similar to previous but for multi-volume archives
  */
-Archive *makeArjArchive(const Array<String> &names);
+Archive *makeArjArchive(const Array<String> &names, bool flattenTree = false);
 
 /** @} */
 


Commit: 600f33bccfcfbaafb11e0007354c23f7b331482d
    https://github.com/scummvm/scummvm/commit/600f33bccfcfbaafb11e0007354c23f7b331482d
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-15T19:22:34+01:00

Commit Message:
COMMON: Allow unzip to flatten tree structure

It's easier to some games to ignore directories

Changed paths:
    common/compression/unzip.cpp
    common/compression/unzip.h


diff --git a/common/compression/unzip.cpp b/common/compression/unzip.cpp
index efce67ba448..93a02f178fb 100644
--- a/common/compression/unzip.cpp
+++ b/common/compression/unzip.cpp
@@ -429,7 +429,7 @@ static uLong unzlocal_SearchCentralDir(Common::SeekableReadStream &fin) {
 	 Else, the return value is a unzFile Handle, usable with other function
 	   of this unzip package.
 */
-unzFile unzOpen(Common::SeekableReadStream *stream) {
+unzFile unzOpen(Common::SeekableReadStream *stream, bool flattenTree) {
 	if (!stream)
 		return nullptr;
 
@@ -523,7 +523,14 @@ unzFile unzOpen(Common::SeekableReadStream *stream) {
 		fe.cur_file_info = us->cur_file_info;
 		fe.cur_file_info_internal = us->cur_file_info_internal;
 
-		us->_hash[Common::String(szCurrentFileName)] = fe;
+		const char *name = szCurrentFileName;
+
+		if (flattenTree)
+			for (const char *p = szCurrentFileName; *p; p++)
+				if (*p == '\\' || *p == '/')
+					name = p + 1;
+
+		us->_hash[Common::String(name)] = fe;
 
 		// Move to the next file
 		err = unzGoToNextFile((unzFile)us);
@@ -964,9 +971,10 @@ namespace Common {
 class ZipArchive : public MemcachingCaseInsensitiveArchive {
 	unzFile _zipFile;
 	Common::CRC32 _crc;
+	bool _flattenTree;
 
 public:
-	ZipArchive(unzFile zipFile);
+	ZipArchive(unzFile zipFile, bool flattenTree);
 
 
 	~ZipArchive();
@@ -976,7 +984,7 @@ public:
 	const ArchiveMemberPtr getMember(const Path &path) const override;
 	Common::SharedArchiveContents readContentsForPath(const Common::String& translated) const override;
 	Common::String translatePath(const Common::Path &path) const override {
-		return path.toString();
+		return _flattenTree ? path.getLastComponent().toString() : path.toString();
 	}
 };
 
@@ -998,7 +1006,7 @@ public:
 };
 */
 
-ZipArchive::ZipArchive(unzFile zipFile) : _zipFile(zipFile), _crc() {
+ZipArchive::ZipArchive(unzFile zipFile, bool flattenTree) : _zipFile(zipFile), _crc(), _flattenTree(flattenTree) {
 	assert(_zipFile);
 }
 
@@ -1039,24 +1047,24 @@ Common::SharedArchiveContents ZipArchive::readContentsForPath(const Common::Stri
 	return unzOpenCurrentFile(_zipFile, _crc);
 }
 
-Archive *makeZipArchive(const String &name) {
-	return makeZipArchive(SearchMan.createReadStreamForMember(name));
+Archive *makeZipArchive(const String &name, bool flattenTree) {
+	return makeZipArchive(SearchMan.createReadStreamForMember(name), flattenTree);
 }
 
-Archive *makeZipArchive(const FSNode &node) {
-	return makeZipArchive(node.createReadStream());
+Archive *makeZipArchive(const FSNode &node, bool flattenTree) {
+	return makeZipArchive(node.createReadStream(), flattenTree);
 }
 
-Archive *makeZipArchive(SeekableReadStream *stream) {
+Archive *makeZipArchive(SeekableReadStream *stream, bool flattenTree) {
 	if (!stream)
 		return nullptr;
-	unzFile zipFile = unzOpen(stream);
+	unzFile zipFile = unzOpen(stream, flattenTree);
 	if (!zipFile) {
 		// stream gets deleted by unzOpen() call if something
 		// goes wrong.
 		return nullptr;
 	}
-	return new ZipArchive(zipFile);
+	return new ZipArchive(zipFile, flattenTree);
 }
 
 } // End of namespace Common
diff --git a/common/compression/unzip.h b/common/compression/unzip.h
index 08870409d59..ee9b070faa3 100644
--- a/common/compression/unzip.h
+++ b/common/compression/unzip.h
@@ -45,7 +45,7 @@ class SeekableReadStream;
  *
  * May return 0 in case of a failure.
  */
-Archive *makeZipArchive(const String &name);
+Archive *makeZipArchive(const String &name, bool flattenTree = false);
 
 /**
  * This factory method creates an Archive instance corresponding to the content
@@ -53,7 +53,7 @@ Archive *makeZipArchive(const String &name);
  *
  * May return 0 in case of a failure.
  */
-Archive *makeZipArchive(const FSNode &node);
+Archive *makeZipArchive(const FSNode &node, bool flattenTree = false);
 
 /**
  * This factory method creates an Archive instance corresponding to the content
@@ -63,7 +63,7 @@ Archive *makeZipArchive(const FSNode &node);
  *
  * May return 0 in case of a failure. In this case stream will still be deleted.
  */
-Archive *makeZipArchive(SeekableReadStream *stream);
+Archive *makeZipArchive(SeekableReadStream *stream, bool flattenTree = false);
 
 /** @} */
 


Commit: 8e5d88cd555d432be5c6b8f52a6563a49e9e9603
    https://github.com/scummvm/scummvm/commit/8e5d88cd555d432be5c6b8f52a6563a49e9e9603
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-15T19:22:34+01:00

Commit Message:
SAGA: Flatten tree in ZIP and ARJ archives.

Music patches are in subdirectory. It's easier to remove structure altogether

Changed paths:
    engines/saga/saga.cpp


diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp
index f49d8c6dd96..76b2dd71e37 100644
--- a/engines/saga/saga.cpp
+++ b/engines/saga/saga.cpp
@@ -355,9 +355,9 @@ Common::Error SagaEngine::run() {
 			filenames.push_back(gameArchiveDescription->fileName);
 		Common::Archive *archive = nullptr;
 		if (filenames.size() == 1 && filenames[0].hasSuffix(".exe"))
-			archive = Common::makeZipArchive(filenames[0]);
+			archive = Common::makeZipArchive(filenames[0], true);
 		else
-			archive = Common::makeArjArchive(filenames);
+			archive = Common::makeArjArchive(filenames, true);
 		if (!archive)
 			error("Error opening archive");
 		SearchMan.add("archive", archive, DisposeAfterUse::YES);


Commit: b88c3847218be5b522b86b8d2f02836adc6c57ea
    https://github.com/scummvm/scummvm/commit/b88c3847218be5b522b86b8d2f02836adc6c57ea
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-15T19:22:34+01:00

Commit Message:
SAGA: Add ITE win demo 1 and 2 compressed variant.

Changed paths:
    engines/saga/detection_tables.h


diff --git a/engines/saga/detection_tables.h b/engines/saga/detection_tables.h
index dbe184e4ed0..c7fddc91771 100644
--- a/engines/saga/detection_tables.h
+++ b/engines/saga/detection_tables.h
@@ -145,6 +145,34 @@ static const SAGAGameDescription gameDescriptions[] = {
 		{},
 	},
 
+	// Inherit the earth - Win32 Demo version 2, compressed
+	{
+		{
+			"ite",
+			"Win Demo 2",
+			{
+				{"itedemo.exe",		0,	"d2ea5ccf8554fef4576718c06f34e5e5", 17472512},
+				AD_LISTEND
+			},
+			Common::EN_ANY,
+			Common::kPlatformWindows,
+			ADGF_DEMO,
+			GUIO0()
+		},
+		GID_ITE,
+		GF_INSTALLER,
+		ITE_DEFAULT_SCENE,
+		RESOURCELIST_ITE,
+		FONTLIST_ITE_WIN_DEMO,
+		PATCHLIST_ITE,
+		INTROLIST_ITE_DEFAULT,
+		{
+			{"ited.rsc",		GAME_RESOURCEFILE,	"3a450852cbf3c80773984d565647e6ac", 1951395},
+			{"scriptsd.rsc",	GAME_SCRIPTFILE,	"3f12b67fa93e56e1a6be39d2921d80bb", 70051},
+			AD_LISTEND
+		},
+	},
+
 	// Inherit the earth - Win32 Demo version 3, compressed
 	{
 		{
@@ -200,6 +228,35 @@ static const SAGAGameDescription gameDescriptions[] = {
 		{},
 	},
 
+	// Inherit the earth - Win32 Demo version 1
+	// Non-interactive demo, compressed
+	{
+		{
+			"ite",
+			"Demo 1",
+			{
+				{"itedemo.exe",		0,	"e49c52d06add732f3736f64d3e79a223", 7823872},
+				AD_LISTEND
+			},
+			Common::EN_ANY,
+			Common::kPlatformWindows,
+			ADGF_DEMO,
+			GUIO0()
+		},
+		GID_ITE,
+		GF_8BIT_UNSIGNED_PCM | GF_INSTALLER,
+		ITE_DEFAULT_SCENE,
+		RESOURCELIST_ITE,
+		FONTLIST_ITE_WIN_DEMO,
+		PATCHLIST_ITE,
+		INTROLIST_ITE_DEFAULT,
+		{
+			{"ited.rsc",		GAME_RESOURCEFILE,	"3a450852cbf3c80773984d565647e6ac", 1327323},
+			{"scriptsd.rsc",	GAME_SCRIPTFILE,	"3f12b67fa93e56e1a6be39d2921d80bb", 38613},
+			AD_LISTEND
+		},
+	},
+
 
 	{
 		{




More information about the Scummvm-git-logs mailing list