[Scummvm-cvs-logs] scummvm-tools master -> a8858aa9337556d72730636649de2a2daa8244ed

criezy criezy at scummvm.org
Sun Feb 2 19:07:59 CET 2014


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

Summary:
a8858aa933 SWORD1: Improve support for sub-directory structure


Commit: a8858aa9337556d72730636649de2a2daa8244ed
    https://github.com/scummvm/scummvm-tools/commit/a8858aa9337556d72730636649de2a2daa8244ed
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2014-02-02T10:07:43-08:00

Commit Message:
SWORD1: Improve support for sub-directory structure

When using a sub-directory structure with SPEECH and MUSIC
sub-directories, to compress both speech and music the user needed
to select either a cluster file or the swordres.rif file in the parent
directory. Now it should work if those files are in a Clusters
sub-directory and when selecting one of the speech file.

Changed paths:
    NEWS
    engines/sword1/compress_sword1.cpp



diff --git a/NEWS b/NEWS
index 05f5574..71e6433 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,10 @@
 For a more comprehensive changelog of the latest experimental code, see:
         https://github.com/scummvm/scummvm-tools/commits/
 
+1.7.0 (XXXX-XX-XX)
+ - Improve support for sub-directory structure in Broken Sword 1 (e.g. when the
+   files are in the Clusters, Music and Speech sub-directories).
+
 1.6.0 (2013-05-31)
  - Fix crash when compiling with wxWidgets 2.9.
  - Add two tools to extract and repackage the Soltys game data.
diff --git a/engines/sword1/compress_sword1.cpp b/engines/sword1/compress_sword1.cpp
index 75f9f26..71c787b 100644
--- a/engines/sword1/compress_sword1.cpp
+++ b/engines/sword1/compress_sword1.cpp
@@ -745,6 +745,21 @@ void CompressSword1::execute() {
 	Common::Filename inpath(_inputPaths[0].path);
 	Common::Filename &outpath = _outputPath;
 
+	// If the input path is in one of the usual sub-directory, take the parent directory.
+	std::string path = inpath.getPath();
+	if (!path.empty()) {
+		path.pop_back(); // remove slash at the end.
+		size_t slash = path.rfind('/');
+		if (slash == std::string::npos)
+			slash = path.rfind('\\');
+		if (slash != std::string::npos) {
+			std::string dirName = path.substr(slash + 1);
+			std::transform(dirName.begin(), dirName.end(), dirName.begin(), std::tolower);
+			if (dirName == "clusters" || dirName == "music" || dirName == "speech")
+				inpath.setFullPath(path.substr(0, slash + 1));
+		}
+	}
+
 	switch (_format) {
 	case AUDIO_MP3:
 		_audioOuputFilename = TEMP_MP3;






More information about the Scummvm-git-logs mailing list