[Scummvm-cvs-logs] SF.net SVN: scummvm:[46608] tools/branches/gsoc2009-gui/engines/sword2/ compress_sword2.cpp

sev at users.sourceforge.net sev at users.sourceforge.net
Sun Dec 27 00:49:41 CET 2009


Revision: 46608
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46608&view=rev
Author:   sev
Date:     2009-12-26 23:49:41 +0000 (Sat, 26 Dec 2009)

Log Message:
-----------
Fix bug #2905706: "GUI Tools: compress_sword2 does not work"

Modified Paths:
--------------
    tools/branches/gsoc2009-gui/engines/sword2/compress_sword2.cpp

Modified: tools/branches/gsoc2009-gui/engines/sword2/compress_sword2.cpp
===================================================================
--- tools/branches/gsoc2009-gui/engines/sword2/compress_sword2.cpp	2009-12-26 22:26:12 UTC (rev 46607)
+++ tools/branches/gsoc2009-gui/engines/sword2/compress_sword2.cpp	2009-12-26 23:49:41 UTC (rev 46608)
@@ -69,25 +69,28 @@
 	Common::Filename inpath(_inputPaths[0].path);
 	Common::Filename &outpath = _outputPath;
 
+	if (outpath.empty())
+		// Extensions change between the in/out files, so we can use the same directory
+		outpath = inpath;
+
 	switch (_format) {
 	case AUDIO_MP3:
 		_audioOutputFilename = TEMP_MP3;
+		outpath.setExtension(".cl3");
 		break;
 	case AUDIO_VORBIS:
 		_audioOutputFilename = TEMP_OGG;
+		outpath.setExtension(".clg");
 		break;
 	case AUDIO_FLAC:
 		_audioOutputFilename = TEMP_FLAC;
+		outpath.setExtension(".clf");
 		break;
 	default:
 		throw ToolException("Unknown audio format");
 		break;
 	}
 
-	if (outpath.empty())
-		// Extensions change between the in/out files, so we can use the same directory
-		outpath = inpath;
-
 	_input.open(inpath, "rb");
 
 	indexSize = _input.readUint32LE();
@@ -139,12 +142,12 @@
 			f.writeUint32BE(0x57415645);	/* "WAVE" */
 			f.writeUint32BE(0x666d7420);	/* "fmt " */
 			f.writeUint32LE(16);
-			f.writeUint16LE(1);		/* PCM */
-			f.writeUint16LE(1);		/* mono */
-			f.writeUint32LE(22050);	/* sample rate */
-			f.writeUint32LE(44100);	/* bytes per second */
-			f.writeUint16LE(2);		/* basic block size */
-			f.writeUint16LE(16);		/* sample width */
+			f.writeUint16LE(1);				/* PCM */
+			f.writeUint16LE(1);				/* mono */
+			f.writeUint32LE(22050);			/* sample rate */
+			f.writeUint32LE(44100);			/* bytes per second */
+			f.writeUint16LE(2);				/* basic block size */
+			f.writeUint16LE(16);			/* sample width */
 			f.writeUint32BE(0x64617461);	/* "data" */
 			f.writeUint32LE(2 * length);
 
@@ -173,6 +176,8 @@
 				prev = out;
 			}
 
+			f.close();
+
 			encodeAudio(TEMP_WAV, false, -1, tempEncoded, _format);
 			enc_length = append_to_file(_output_snd, tempEncoded);
 
@@ -187,14 +192,15 @@
 		}
 	}
 
+	_output_snd.close();
+	_output_idx.close();
+
 	Common::File output(outpath, "wb");
 
 	append_to_file(output, TEMP_IDX);
 	append_to_file(output, TEMP_DAT);
 
 	output.close();
-	_output_snd.close();
-	_output_idx.close();
 
 	unlink(TEMP_DAT);
 	unlink(TEMP_IDX);


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