[Scummvm-cvs-logs] scummvm-tools master -> 39d9bf8dc42c1577292b693b6a655a0700531e3c

cyxx cyx at scummvm.org
Wed Feb 23 19:05:45 CET 2011


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

Summary:
1bb5aaf03d TUCKER: change all filenames to uppercase (consistency)
0ccf1741ce COMMON: add isDirectory wrapper
39d9bf8dc4 TUCKER: update README section


Commit: 1bb5aaf03daf750f2a1ce7baca77c1c698142f33
    https://github.com/scummvm/scummvm-tools/commit/1bb5aaf03daf750f2a1ce7baca77c1c698142f33
Author: Gregory Montoir (cyx at scummvm.org)
Date: 2011-02-23T05:35:26-08:00

Commit Message:
TUCKER: change all filenames to uppercase (consistency)

Changed paths:
    engines/tucker/compress_tucker.cpp



diff --git a/engines/tucker/compress_tucker.cpp b/engines/tucker/compress_tucker.cpp
index 9541902..0e592a9 100644
--- a/engines/tucker/compress_tucker.cpp
+++ b/engines/tucker/compress_tucker.cpp
@@ -100,9 +100,9 @@ struct SoundDirectory {
 };
 
 static SoundDirectory sound_directory_table[SOUND_TYPES_COUNT] = {
-	{ "FX",     "fx%d.wav",    MAX_SOUND_FILES  },
-	{ "MUSIC",  "mus%d.wav",   MAX_MUSIC_FILES  },
-	{ "SPEECH", "sam%04d.wav", MAX_SPEECH_FILES }
+	{ "FX",     "FX%d.WAV",    MAX_SOUND_FILES  },
+	{ "MUSIC",  "MUS%d.WAV",   MAX_MUSIC_FILES  },
+	{ "SPEECH", "SAM%04d.WAV", MAX_SPEECH_FILES }
 };
 
 uint32 CompressTucker::compress_sounds_directory(const Common::Filename *inpath, const Common::Filename *outpath, Common::File &output, const struct SoundDirectory *dir) {
@@ -160,136 +160,136 @@ uint32 CompressTucker::compress_sounds_directory(const Common::Filename *inpath,
 }
 
 static const char *audio_files_list[] = {
-	"demomenu.raw",
-	"demorolc.raw",
-	"fx101.wav",
-	"fx102.wav",
-	"fx103.wav",
-	"fx104.wav",
-	"fx105.wav",
-	"fx107.wav",
-	"fx108.wav",
-	"fx109.wav",
-	"fx110.wav",
-	"fx111.wav",
-	"fx112.wav",
-	"fx113.wav",
-	"fx114.wav",
-	"fx116.wav",
-	"fx117.wav",
-	"fx32.wav",
-	"fx33.wav",
-	"fx34.wav",
-	"fx35.wav",
-	"fx36.wav",
-	"fx37.wav",
-	"fx38.wav",
-	"fx39.wav",
-	"fx40.wav",
-	"fx42.wav",
-	"fx43.wav",
-	"fx44.wav",
-	"fx45.wav",
-	"fx47.wav",
-	"fx48.wav",
-	"fx49.wav",
-	"fx50.wav",
-	"fx52.wav",
-	"fx53.wav",
-	"fx55.wav",
-	"fx56.wav",
-	"fx57.wav",
-	"fx58.wav",
-	"fx59.wav",
-	"fx60.wav",
-	"fx61.wav",
-	"fx62.wav",
-	"fx63.wav",
-	"fx64.wav",
-	"fx66.wav",
-	"fx67.wav",
-	"fx68.wav",
-	"fx69.wav",
-	"fx70.wav",
-	"fx71.wav",
-	"fx72.wav",
-	"fx73.wav",
-	"fx74.wav",
-	"fx75.wav",
-	"fx76.wav",
-	"fx77.wav",
-	"fx78.wav",
-	"fx79.wav",
-	"fx80.wav",
-	"fx81.wav",
-	"fx83.wav",
-	"fx86.wav",
-	"fx91.wav",
-	"fx92.wav",
-	"fx93.wav",
-	"fx97.wav",
-	"fx98.wav",
-	"int1.raw",
-	"int14.raw",
-	"int15.raw",
-	"int16.raw",
-	"int17.raw",
-	"int18.raw",
-	"int19.raw",
-	"int2.raw",
-	"int20.raw",
-	"int21.raw",
-	"int22.raw",
-	"int23.raw",
-	"int24.raw",
-	"int25.raw",
-	"int26.raw",
-	"int27.raw",
-	"int28.raw",
-	"int29.raw",
-	"int3.raw",
-	"int30.raw",
-	"int31.raw",
-	"int32.raw",
-	"int33.raw",
-	"int34.raw",
-	"int35.raw",
-	"int36.raw",
-	"int37.raw",
-	"int38.raw",
-	"int4.raw",
-	"int41.raw",
-	"int42.raw",
-	"int5.raw",
-	"int6.raw",
-	"int7.raw",
-	"introdua.wav",
-	"merilogo.raw",
-	"rdfx1.wav",
-	"rdfx12.wav",
-	"rdfx13.wav",
-	"rdfx14.wav",
-	"rdfx15.wav",
-	"rdfx16.wav",
-	"rdfx17.wav",
-	"rdfx18.wav",
-	"rdfx20.wav",
-	"rdfx21.wav",
-	"rdfx22.wav",
-	"rdfx24.wav",
-	"rdfx25.wav",
-	"rdfx26.wav",
-	"rdfx27.wav",
-	"rdfx28.wav",
-	"rdfx3.wav",
-	"rdfx30.wav",
-	"rdfx31.wav",
-	"rdfx33.wav",
-	"rdfx36.wav",
-	"rdfx37.wav",
-	"rdfx38.wav",
-	"rdfx8.wav",
-	"rdfx9.wav"
+	"DEMOMENU.RAW",
+	"DEMOROLC.RAW",
+	"FX101.WAV",
+	"FX102.WAV",
+	"FX103.WAV",
+	"FX104.WAV",
+	"FX105.WAV",
+	"FX107.WAV",
+	"FX108.WAV",
+	"FX109.WAV",
+	"FX110.WAV",
+	"FX111.WAV",
+	"FX112.WAV",
+	"FX113.WAV",
+	"FX114.WAV",
+	"FX116.WAV",
+	"FX117.WAV",
+	"FX32.WAV",
+	"FX33.WAV",
+	"FX34.WAV",
+	"FX35.WAV",
+	"FX36.WAV",
+	"FX37.WAV",
+	"FX38.WAV",
+	"FX39.WAV",
+	"FX40.WAV",
+	"FX42.WAV",
+	"FX43.WAV",
+	"FX44.WAV",
+	"FX45.WAV",
+	"FX47.WAV",
+	"FX48.WAV",
+	"FX49.WAV",
+	"FX50.WAV",
+	"FX52.WAV",
+	"FX53.WAV",
+	"FX55.WAV",
+	"FX56.WAV",
+	"FX57.WAV",
+	"FX58.WAV",
+	"FX59.WAV",
+	"FX60.WAV",
+	"FX61.WAV",
+	"FX62.WAV",
+	"FX63.WAV",
+	"FX64.WAV",
+	"FX66.WAV",
+	"FX67.WAV",
+	"FX68.WAV",
+	"FX69.WAV",
+	"FX70.WAV",
+	"FX71.WAV",
+	"FX72.WAV",
+	"FX73.WAV",
+	"FX74.WAV",
+	"FX75.WAV",
+	"FX76.WAV",
+	"FX77.WAV",
+	"FX78.WAV",
+	"FX79.WAV",
+	"FX80.WAV",
+	"FX81.WAV",
+	"FX83.WAV",
+	"FX86.WAV",
+	"FX91.WAV",
+	"FX92.WAV",
+	"FX93.WAV",
+	"FX97.WAV",
+	"FX98.WAV",
+	"INT1.RAW",
+	"INT14.RAW",
+	"INT15.RAW",
+	"INT16.RAW",
+	"INT17.RAW",
+	"INT18.RAW",
+	"INT19.RAW",
+	"INT2.RAW",
+	"INT20.RAW",
+	"INT21.RAW",
+	"INT22.RAW",
+	"INT23.RAW",
+	"INT24.RAW",
+	"INT25.RAW",
+	"INT26.RAW",
+	"INT27.RAW",
+	"INT28.RAW",
+	"INT29.RAW",
+	"INT3.RAW",
+	"INT30.RAW",
+	"INT31.RAW",
+	"INT32.RAW",
+	"INT33.RAW",
+	"INT34.RAW",
+	"INT35.RAW",
+	"INT36.RAW",
+	"INT37.RAW",
+	"INT38.RAW",
+	"INT4.RAW",
+	"INT41.RAW",
+	"INT42.RAW",
+	"INT5.RAW",
+	"INT6.RAW",
+	"INT7.RAW",
+	"INTRODUA.WAV",
+	"MERILOGO.RAW",
+	"RDFX1.WAV",
+	"RDFX12.WAV",
+	"RDFX13.WAV",
+	"RDFX14.WAV",
+	"RDFX15.WAV",
+	"RDFX16.WAV",
+	"RDFX17.WAV",
+	"RDFX18.WAV",
+	"RDFX20.WAV",
+	"RDFX21.WAV",
+	"RDFX22.WAV",
+	"RDFX24.WAV",
+	"RDFX25.WAV",
+	"RDFX26.WAV",
+	"RDFX27.WAV",
+	"RDFX28.WAV",
+	"RDFX3.WAV",
+	"RDFX30.WAV",
+	"RDFX31.WAV",
+	"RDFX33.WAV",
+	"RDFX36.WAV",
+	"RDFX37.WAV",
+	"RDFX38.WAV",
+	"RDFX8.WAV",
+	"RDFX9.WAV"
 };
 
 static const int audio_formats_table[] = {
@@ -321,7 +321,7 @@ uint32 CompressTucker::compress_audio_directory(const Common::Filename *inpath,
 	current_offset = 0;
 	for (i = 0; i < count; ++i) {
 		temp_table[i].offset = current_offset;
-		sprintf(filepath, "%s/audio/%s", inpath->getPath().c_str(), audio_files_list[i]);
+		sprintf(filepath, "%s/AUDIO/%s", inpath->getPath().c_str(), audio_files_list[i]);
 
 		try {
 			Common::File input(filepath, "rb");


Commit: 0ccf1741ced3c114bb8244773ef503cfdd93ab41
    https://github.com/scummvm/scummvm-tools/commit/0ccf1741ced3c114bb8244773ef503cfdd93ab41
Author: Gregory Montoir (cyx at scummvm.org)
Date: 2011-02-23T06:08:24-08:00

Commit Message:
COMMON: add isDirectory wrapper

Use it in compress_tucker to ensure input directories
are present. See bug report #3093138.

Changed paths:
    common/file.cpp
    common/file.h
    engines/tucker/compress_tucker.cpp



diff --git a/common/file.cpp b/common/file.cpp
index ac3d34a..e691c6f 100644
--- a/common/file.cpp
+++ b/common/file.cpp
@@ -25,6 +25,8 @@
 #include <stdio.h>
 #include <assert.h>
 #ifndef _MSC_VER
+#include <sys/types.h>
+#include <sys/stat.h>   // for stat()
 #include <unistd.h>	// for unlink()
 #endif
 
@@ -494,5 +496,10 @@ int removeFile(const char *path) {
 	return unlink(path);
 }
 
+bool isDirectory(const char *path) {
+	struct stat st;
+	return stat(path, &st) == 0 && S_ISDIR(st.st_mode);
+}
+
 } // End of namespace Common
 
diff --git a/common/file.h b/common/file.h
index eb1bf8b..2131cda 100644
--- a/common/file.h
+++ b/common/file.h
@@ -401,6 +401,12 @@ protected:
  */
 int removeFile(const char *path);
 
+/**
+ * Test if the specified path is a directory.
+ * This is just a wrapper around stat/S_ISDIR.
+ */
+bool isDirectory(const char *path);
+
 } // End of namespace Common
 
 
diff --git a/engines/tucker/compress_tucker.cpp b/engines/tucker/compress_tucker.cpp
index 0e592a9..88acbd3 100644
--- a/engines/tucker/compress_tucker.cpp
+++ b/engines/tucker/compress_tucker.cpp
@@ -107,24 +107,14 @@ static SoundDirectory sound_directory_table[SOUND_TYPES_COUNT] = {
 
 uint32 CompressTucker::compress_sounds_directory(const Common::Filename *inpath, const Common::Filename *outpath, Common::File &output, const struct SoundDirectory *dir) {
 	char filepath[1024];
-	char *filename;
-	//struct stat s;
-	int i, pos;
+	int i, pos, len;
 	uint32 current_offset;
 	Common::File input;
 
 	assert(dir->count <= ARRAYSIZE(temp_table));
 
 	// We can't use setFullName since dir->name can contain '/'
-	snprintf(filepath, sizeof(filepath), "%s/%s", inpath->getPath().c_str(), dir->name);
-	/* stat is NOT standard C, but rather a POSIX call and fails under MSVC
-	 * this could be factored out to Common::Filename::isDirectory ?
-	if (stat(filepath, &s) != 0 || !S_ISDIR(s.st_mode)) {
-		error("Cannot stat directory '%s'", filepath);
-	}
-	*/
-	strcat(filepath, "/");
-	filename = filepath + strlen(filepath);
+	len = snprintf(filepath, sizeof(filepath), "%s/%s/", inpath->getPath().c_str(), dir->name);
 
 	pos = output.pos();
 
@@ -138,7 +128,7 @@ uint32 CompressTucker::compress_sounds_directory(const Common::Filename *inpath,
 	current_offset = 0;
 	for (i = 0; i < dir->count; ++i) {
 		temp_table[i].offset = current_offset;
-		sprintf(filename, dir->fmt, i);
+		snprintf(&filepath[len], sizeof(filepath) - len, dir->fmt, i);
 		try {
 			input.open(filepath, "rb");
 			temp_table[i].size = compress_file_wav(input, output);
@@ -321,7 +311,7 @@ uint32 CompressTucker::compress_audio_directory(const Common::Filename *inpath,
 	current_offset = 0;
 	for (i = 0; i < count; ++i) {
 		temp_table[i].offset = current_offset;
-		sprintf(filepath, "%s/AUDIO/%s", inpath->getPath().c_str(), audio_files_list[i]);
+		snprintf(filepath, sizeof(filepath), "%s/AUDIO/%s", inpath->getPath().c_str(), audio_files_list[i]);
 
 		try {
 			Common::File input(filepath, "rb");
@@ -362,7 +352,7 @@ void CompressTucker::compress_sound_files(const Common::Filename *inpath, const
 	uint32 current_offset;
 	uint32 sound_directory_size[SOUND_TYPES_COUNT];
 	uint32 audio_directory_size;
-	const uint16 flags = HEADER_FLAG_AUDIO_INTRO;
+	static const uint16 flags = HEADER_FLAG_AUDIO_INTRO;
 
 	Common::File output(*outpath, "wb");
 
@@ -419,11 +409,21 @@ void CompressTucker::compress_sound_files(const Common::Filename *inpath, const
 	print("Done.\n");
 }
 
+static const char *inputDirs[] = { "AUDIO", "FX", "MUSIC", "SPEECH", 0 };
 
 void CompressTucker::execute() {
 	Common::Filename inpath(_inputPaths[0].path);
 	Common::Filename &outpath = _outputPath;
 
+	// Ensure necessary directories are present
+	for (int i = 0; inputDirs[i]; ++i) {
+		char path[1024];
+		snprintf(path, sizeof(path), "%s/%s", inpath.getPath().c_str(), inputDirs[i]);
+		if (!Common::isDirectory(path)) {
+			error("Missing input directory '%s'", path);
+		}
+	}
+
 	// Default out is same as in directory, file names differ by extension
 	if (outpath.empty()) {
 		outpath = inpath;


Commit: 39d9bf8dc42c1577292b693b6a655a0700531e3c
    https://github.com/scummvm/scummvm-tools/commit/39d9bf8dc42c1577292b693b6a655a0700531e3c
Author: Gregory Montoir (cyx at scummvm.org)
Date: 2011-02-23T10:04:12-08:00

Commit Message:
TUCKER: update README section

Changed paths:
    README



diff --git a/README b/README
index eca368f..336954a 100644
--- a/README
+++ b/README
@@ -281,12 +281,19 @@ Compression Tools:
                 Files in the input folder should be in uppercase.
 
         compress_tucker
-                Used to compress .wav files from FX/MUSIC/SPEECH directories
-                to a single file named TUCKER.SOx
+                Used to compress sound and speech files from AUDIO/FX/MUSIC/SPEECH
+                directories to a single file named TUCKER.SO3 (MP3), TUCKER.SOG
+                (Vorbis) or TUCKER.SOF (FLAC).
 
-                Once compressed, the 3 directories aren't required to play
+                Once compressed, the four directories are not required to play
                 the game under ScummVM.
 
+                Example of usage:
+                ./scummvm-tools-cli --tool compress_tucker [mode params] [-o outputfile] <inputdir>
+
+                Default outpufile is TUCKER.SOx (depends on compression method).
+                Files in the input folder should be in uppercase.
+
 Script Tools:
         decine
                 Decompiles Delphine's Cinematique engine's scripts.






More information about the Scummvm-git-logs mailing list