[Scummvm-cvs-logs] SF.net SVN: scummvm:[46137] tools/branches/gsoc2009-gui/compress_tucker.cpp

joostp at users.sourceforge.net joostp at users.sourceforge.net
Wed Nov 25 19:05:39 CET 2009


Revision: 46137
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46137&view=rev
Author:   joostp
Date:     2009-11-25 18:05:39 +0000 (Wed, 25 Nov 2009)

Log Message:
-----------
fix compress_tucker tool

Modified Paths:
--------------
    tools/branches/gsoc2009-gui/compress_tucker.cpp

Modified: tools/branches/gsoc2009-gui/compress_tucker.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_tucker.cpp	2009-11-25 10:55:25 UTC (rev 46136)
+++ tools/branches/gsoc2009-gui/compress_tucker.cpp	2009-11-25 18:05:39 UTC (rev 46137)
@@ -318,11 +318,10 @@
 	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]);
-		File input(filepath, "rb");
-		if (!input.isOpen()) {
-			warning("Can't open file '%s'", filepath);
-			temp_table[i].size = 0;
-		} else {
+		
+		try {
+			File input(filepath, "rb");
+			
 			switch (audio_formats_table[i]) {
 			case 1:
 			case 2:
@@ -335,7 +334,11 @@
 				temp_table[i].size = compress_file_raw(filepath, 1, output);
 				break;
 			}
+		} catch (...) {
+			warning("Can't open file '%s'", filepath);
+			temp_table[i].size = 0;
 		}
+
 		current_offset += temp_table[i].size;
 	}
 
@@ -355,7 +358,7 @@
 	uint32 current_offset;
 	uint32 sound_directory_size[SOUND_TYPES_COUNT];
 	uint32 audio_directory_size;
-	const uint16 flags = 0; // HEADER_FLAG_AUDIO_INTRO;
+	const uint16 flags = HEADER_FLAG_AUDIO_INTRO;
 
 	File output(*outpath, "wb");
 
@@ -369,6 +372,7 @@
 	}
 	if (flags & HEADER_FLAG_AUDIO_INTRO) {
 		output.writeUint32LE(0);
+		output.writeUint32LE(0);
 	}
 
 	/* compress the .wav files in each directory */
@@ -401,6 +405,8 @@
 		current_offset += audio_directory_size;
 	}
 
+	output.close();
+
 	/* cleanup */
 	unlink(TEMP_WAV);
 	unlink(TEMP_RAW);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list