[Scummvm-cvs-logs] SF.net SVN: scummvm:[42686] tools/branches/gsoc2009-gui
Remere at users.sourceforge.net
Remere at users.sourceforge.net
Fri Jul 24 09:51:38 CEST 2009
Revision: 42686
http://scummvm.svn.sourceforge.net/scummvm/?rev=42686&view=rev
Author: Remere
Date: 2009-07-24 07:51:38 +0000 (Fri, 24 Jul 2009)
Log Message:
-----------
*Added progress bars to alot of compression tools.
Modified Paths:
--------------
tools/branches/gsoc2009-gui/compress_agos.cpp
tools/branches/gsoc2009-gui/compress_saga.cpp
tools/branches/gsoc2009-gui/compress_scumm_bun.cpp
tools/branches/gsoc2009-gui/compress_scumm_san.cpp
tools/branches/gsoc2009-gui/compress_scumm_sou.cpp
tools/branches/gsoc2009-gui/compress_scumm_sou.h
tools/branches/gsoc2009-gui/compress_sword1.cpp
tools/branches/gsoc2009-gui/compress_sword2.cpp
tools/branches/gsoc2009-gui/compress_tinsel.cpp
tools/branches/gsoc2009-gui/compress_touche.cpp
tools/branches/gsoc2009-gui/compress_tucker.cpp
Modified: tools/branches/gsoc2009-gui/compress_agos.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_agos.cpp 2009-07-24 05:20:44 UTC (rev 42685)
+++ tools/branches/gsoc2009-gui/compress_agos.cpp 2009-07-24 07:51:38 UTC (rev 42686)
@@ -28,6 +28,7 @@
CompressAgos::CompressAgos(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
_convertMac = false;
_outputToDirectory = false;
+ _supportsProgressBar = true;
ToolInput input;
input.format = "*.*";
@@ -148,6 +149,8 @@
_output_idx.writeUint32LE(size);
for (i = 1; i < num; i++) {
+ updateProgress(i, num);
+
if (offsets[i] == offsets[i + 1]) {
_output_idx.writeUint32LE(size);
continue;
@@ -182,6 +185,8 @@
_output_idx.writeUint32LE(size);
for (i = 1; i < num; i++) {
+ updateProgress(i, num);
+
if (filenums[i] == filenums[i + 1] && offsets[i] == offsets[i + 1]) {
_output_idx.writeUint32LE(size);
continue;
Modified: tools/branches/gsoc2009-gui/compress_saga.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_saga.cpp 2009-07-24 05:20:44 UTC (rev 42685)
+++ tools/branches/gsoc2009-gui/compress_saga.cpp 2009-07-24 07:51:38 UTC (rev 42686)
@@ -112,8 +112,8 @@
CompressSaga::CompressSaga(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
_currentGameDescription = NULL;
_currentFileDescription = NULL;
+ _supportsProgressBar = true;
-
ToolInput input;
// We accept many extensions, and the fact that "inherit the earth voices" does not have an extension
// makes it pretty much unsupported by the standard dialogs to open
@@ -382,6 +382,9 @@
outputFile.open(*outpath, "wb");
for (i = 0; i < resTableCount; i++) {
+ // This is where compression takes place, and where all time is spent
+ updateProgress(i, resTableCount);
+
inputFile.seek(inputTable[i].offset, SEEK_SET);
outputTable[i].offset = outputFile.pos();
Modified: tools/branches/gsoc2009-gui/compress_scumm_bun.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_bun.cpp 2009-07-24 05:20:44 UTC (rev 42685)
+++ tools/branches/gsoc2009-gui/compress_scumm_bun.cpp 2009-07-24 07:51:38 UTC (rev 42686)
@@ -1067,6 +1067,8 @@
CompressScummBun::CompressScummBun(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
_cbundleCurIndex = 0;
+
+ _supportsProgressBar = true;
ToolInput input;
input.format = "*.bun";
@@ -1127,6 +1129,9 @@
for (int i = 0; i < numFiles; i++) {
if (strcmp(_bundleTable[i].filename, "PRELOAD.") == 0)
continue;
+
+ updateProgress(i, numFiles);
+
int offsetData = 0, bits = 0, freq = 0, channels = 0;
int32 size = 0;
byte *compFinal = decompressBundleSound(i, input, size);
Modified: tools/branches/gsoc2009-gui/compress_scumm_san.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_san.cpp 2009-07-24 05:20:44 UTC (rev 42685)
+++ tools/branches/gsoc2009-gui/compress_scumm_san.cpp 2009-07-24 07:51:38 UTC (rev 42686)
@@ -574,7 +574,10 @@
CompressScummSan::CompressScummSan(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
_IACTpos = 0;
-
+
+ _supportedFormats = AudioFormat(AUDIO_MP3 | AUDIO_VORBIS);
+ _supportsProgressBar = true;
+
ToolInput input;
input.format = "*.san";
_inputPaths.push_back(input);
@@ -585,7 +588,7 @@
void CompressScummSan::execute() {
if (_format == AUDIO_FLAC)
- error("Only ogg vorbis and MP3 is supported for this tool.");
+ error("Only ogg vorbis and MP3 are supported for this tool.");
Filename inpath(_inputPaths[0].path);
Filename &outpath = _outputPath;
@@ -645,6 +648,9 @@
int fps = 0;
for (l = 0; l < nbframes; l++) {
+ // Compression takes place in this loops, which takes the most time by far
+ updateProgress(l, nbframes);
+
print("frame: %d\n", l);
bool first_fobj = true;
uint32 tag = input.readUint32BE(); // chunk tag
Modified: tools/branches/gsoc2009-gui/compress_scumm_sou.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_sou.cpp 2009-07-24 05:20:44 UTC (rev 42685)
+++ tools/branches/gsoc2009-gui/compress_scumm_sou.cpp 2009-07-24 07:51:38 UTC (rev 42686)
@@ -43,7 +43,7 @@
_output_snd.close();
_output_idx.close();
- _output_idx.open(_audioOuputFilename, "wb");
+ _output_idx.open(_audioOutputFilename, "wb");
_output_idx.writeUint32BE((uint32)idx_size);
File in(TEMP_IDX, "rb");
@@ -130,7 +130,7 @@
}
CompressScummSou::CompressScummSou(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
- _audioOuputFilename = OUTPUT_MP3;
+ _audioOutputFilename = OUTPUT_MP3;
ToolInput input;
input.format = "*.sou";
@@ -147,13 +147,13 @@
switch (_format) {
case AUDIO_MP3:
- _audioOuputFilename = OUTPUT_MP3;
+ _audioOutputFilename = OUTPUT_MP3;
break;
case AUDIO_VORBIS:
- _audioOuputFilename = OUTPUT_OGG;
+ _audioOutputFilename = OUTPUT_OGG;
break;
case AUDIO_FLAC:
- _audioOuputFilename = OUTPUT_FLAC;
+ _audioOutputFilename = OUTPUT_FLAC;
break;
default:
throw ToolException("Unknown audio format");
Modified: tools/branches/gsoc2009-gui/compress_scumm_sou.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_sou.h 2009-07-24 05:20:44 UTC (rev 42685)
+++ tools/branches/gsoc2009-gui/compress_scumm_sou.h 2009-07-24 07:51:38 UTC (rev 42686)
@@ -34,7 +34,7 @@
virtual void execute();
protected:
- std::string _audioOuputFilename;
+ std::string _audioOutputFilename;
File _input, _output_idx, _output_snd;
void end_of_file(const char *inputPath);
Modified: tools/branches/gsoc2009-gui/compress_sword1.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword1.cpp 2009-07-24 05:20:44 UTC (rev 42685)
+++ tools/branches/gsoc2009-gui/compress_sword1.cpp 2009-07-24 07:51:38 UTC (rev 42686)
@@ -438,6 +438,9 @@
setRawAudioType(true, false, 16);
for (i = 1; i <= 2; i++) {
+ // Updates the progress bar, add music files if we compress those too
+ updateProgress(i, 2 +(_compMusic? TOTAL_TUNES : 0));
+
sprintf(cluName, "%s/SPEECH/SPEECH%d.CLU", inpath->getPath().c_str(), i);
try {
clu.open(cluName, "rb");
@@ -479,6 +482,9 @@
char fNameIn[256], fNameOut[256];
for (i = 0; i < TOTAL_TUNES; i++) {
+ // Update the progress bar, we add 2 if we compress speech to, for those files
+ updateProgress(i, TOTAL_TUNES +(_compSpeech? 2 : 0));
+
sprintf(fNameIn, "%s/MUSIC/%s.WAV", inpath->getPath().c_str(), musicNames[i].fileName);
try {
File inf(fNameIn, "rb");
@@ -560,6 +566,8 @@
CompressSword1::CompressSword1(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
_compSpeech = true;
_compMusic = true;
+
+ _supportsProgressBar = true;
ToolInput input;
input.format = "*.clu";
Modified: tools/branches/gsoc2009-gui/compress_sword2.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword2.cpp 2009-07-24 05:20:44 UTC (rev 42685)
+++ tools/branches/gsoc2009-gui/compress_sword2.cpp 2009-07-24 07:51:38 UTC (rev 42686)
@@ -50,7 +50,8 @@
#define GetCompressedAmplitude(n) ((n) & 7)
CompressSword2::CompressSword2(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
-
+ _supportsProgressBar = true;
+
ToolInput input;
input.format = "*.clu";
_inputPaths.push_back(input);
@@ -103,6 +104,9 @@
_output_idx.writeUint32BE(0xfff0fff0);
for (int i = 0; i < (int)indexSize; i++) {
+ // Update progress, this loop is where most of the time is spent
+ updateProgress(i, indexSize);
+
uint32 pos;
uint32 enc_length;
Modified: tools/branches/gsoc2009-gui/compress_tinsel.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_tinsel.cpp 2009-07-24 05:20:44 UTC (rev 42685)
+++ tools/branches/gsoc2009-gui/compress_tinsel.cpp 2009-07-24 07:51:38 UTC (rev 42686)
@@ -48,6 +48,8 @@
#define TEMP_ENC "tempfile.enc"
CompressTinsel::CompressTinsel(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
+ _supportsProgressBar = true;
+
ToolInput input1;
input1.format = "*.smp";
_inputPaths.push_back(input1);
@@ -274,6 +276,9 @@
loopCount = indexCount;
while (loopCount>0) {
+ // Update progress
+ updateProgress(indexCount - loopCount, indexCount);
+
indexOffset = _input_idx.readUint32LE();
if (indexOffset) {
if (indexNo==0) {
Modified: tools/branches/gsoc2009-gui/compress_touche.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_touche.cpp 2009-07-24 05:20:44 UTC (rev 42685)
+++ tools/branches/gsoc2009-gui/compress_touche.cpp 2009-07-24 07:51:38 UTC (rev 42686)
@@ -39,6 +39,7 @@
static uint32 input_Vxx_size[Vxx_HDR_LEN];
CompressTouche::CompressTouche(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
+ _supportsProgressBar = true;
ToolInput input;
input.format = "/";
@@ -131,6 +132,7 @@
/* process Vxx files */
for (i = 1; i < MAX_OFFSETS; ++i) {
+ updateProgress(i, MAX_OFFSETS);
char d[16];
sprintf(d, "V%d", i);
Modified: tools/branches/gsoc2009-gui/compress_tucker.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_tucker.cpp 2009-07-24 05:20:44 UTC (rev 42685)
+++ tools/branches/gsoc2009-gui/compress_tucker.cpp 2009-07-24 07:51:38 UTC (rev 42686)
@@ -40,7 +40,8 @@
static CompressedData temp_table[10000];
CompressTucker::CompressTucker(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
-
+ _supportsProgressBar = true;
+
ToolInput input;
input.format = "/";
_inputPaths.push_back(input);
@@ -371,11 +372,15 @@
/* compress the .wav files in each directory */
for (i = 0; i < SOUND_TYPES_COUNT; ++i) {
+ updateProgress(i, SOUND_TYPES_COUNT + 1);
+
print("Processing directory '%s'...\n", sound_directory_table[i].name);
sound_directory_size[i] = compress_sounds_directory(inpath, outpath, output, &sound_directory_table[i]);
print("Done (%d bytes)\n", sound_directory_size[i]);
}
if (flags & HEADER_FLAG_AUDIO_INTRO) {
+ updateProgress(1, 1);
+
print("Processing directory 'audio'...\n");
audio_directory_size = compress_audio_directory(inpath, outpath, output);
print("Done (%d bytes)\n", audio_directory_size);
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