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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Dec 26 14:37:54 CET 2009


Revision: 46582
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46582&view=rev
Author:   fingolfin
Date:     2009-12-26 13:37:48 +0000 (Sat, 26 Dec 2009)

Log Message:
-----------
Restructured tools file hierarchy

Modified Paths:
--------------
    tools/branches/gsoc2009-gui/Makefile
    tools/branches/gsoc2009-gui/Makefile.common
    tools/branches/gsoc2009-gui/sound/adpcm.cpp
    tools/branches/gsoc2009-gui/sound/adpcm.h
    tools/branches/gsoc2009-gui/sound/audiostream.cpp
    tools/branches/gsoc2009-gui/sound/audiostream.h
    tools/branches/gsoc2009-gui/sound/voc.cpp
    tools/branches/gsoc2009-gui/sound/voc.h
    tools/branches/gsoc2009-gui/sound/wave.cpp
    tools/branches/gsoc2009-gui/sound/wave.h
    tools/branches/gsoc2009-gui/tools.cpp

Added Paths:
-----------
    tools/branches/gsoc2009-gui/engines/
    tools/branches/gsoc2009-gui/engines/agos/
    tools/branches/gsoc2009-gui/engines/agos/compress_agos.cpp
    tools/branches/gsoc2009-gui/engines/agos/compress_agos.h
    tools/branches/gsoc2009-gui/engines/agos/extract_agos.cpp
    tools/branches/gsoc2009-gui/engines/agos/extract_agos.h
    tools/branches/gsoc2009-gui/engines/cine/
    tools/branches/gsoc2009-gui/engines/cine/decine.cpp
    tools/branches/gsoc2009-gui/engines/cine/extract_cine.cpp
    tools/branches/gsoc2009-gui/engines/cine/extract_cine.h
    tools/branches/gsoc2009-gui/engines/gob/
    tools/branches/gsoc2009-gui/engines/gob/compress_gob.cpp
    tools/branches/gsoc2009-gui/engines/gob/compress_gob.h
    tools/branches/gsoc2009-gui/engines/gob/degob.cpp
    tools/branches/gsoc2009-gui/engines/gob/degob_script.cpp
    tools/branches/gsoc2009-gui/engines/gob/degob_script.h
    tools/branches/gsoc2009-gui/engines/gob/degob_script_bargon.cpp
    tools/branches/gsoc2009-gui/engines/gob/degob_script_v1.cpp
    tools/branches/gsoc2009-gui/engines/gob/degob_script_v2.cpp
    tools/branches/gsoc2009-gui/engines/gob/degob_script_v3.cpp
    tools/branches/gsoc2009-gui/engines/gob/degob_script_v4.cpp
    tools/branches/gsoc2009-gui/engines/gob/degob_script_v5.cpp
    tools/branches/gsoc2009-gui/engines/gob/degob_script_v6.cpp
    tools/branches/gsoc2009-gui/engines/gob/extract_gob_stk.cpp
    tools/branches/gsoc2009-gui/engines/gob/extract_gob_stk.h
    tools/branches/gsoc2009-gui/engines/groovie/
    tools/branches/gsoc2009-gui/engines/groovie/extract_t7g_mac.cpp
    tools/branches/gsoc2009-gui/engines/groovie/extract_t7g_mac.h
    tools/branches/gsoc2009-gui/engines/kyra/
    tools/branches/gsoc2009-gui/engines/kyra/compress_kyra.cpp
    tools/branches/gsoc2009-gui/engines/kyra/compress_kyra.h
    tools/branches/gsoc2009-gui/engines/kyra/dekyra.cpp
    tools/branches/gsoc2009-gui/engines/kyra/dekyra.h
    tools/branches/gsoc2009-gui/engines/kyra/dekyra_v1.cpp
    tools/branches/gsoc2009-gui/engines/kyra/extract_kyra.cpp
    tools/branches/gsoc2009-gui/engines/kyra/extract_kyra.h
    tools/branches/gsoc2009-gui/engines/kyra/kyra_ins.cpp
    tools/branches/gsoc2009-gui/engines/kyra/kyra_ins.h
    tools/branches/gsoc2009-gui/engines/kyra/kyra_pak.cpp
    tools/branches/gsoc2009-gui/engines/kyra/kyra_pak.h
    tools/branches/gsoc2009-gui/engines/parallaction/
    tools/branches/gsoc2009-gui/engines/parallaction/extract_parallaction.cpp
    tools/branches/gsoc2009-gui/engines/parallaction/extract_parallaction.h
    tools/branches/gsoc2009-gui/engines/queen/
    tools/branches/gsoc2009-gui/engines/queen/compress_queen.cpp
    tools/branches/gsoc2009-gui/engines/queen/compress_queen.h
    tools/branches/gsoc2009-gui/engines/saga/
    tools/branches/gsoc2009-gui/engines/saga/compress_saga.cpp
    tools/branches/gsoc2009-gui/engines/saga/compress_saga.h
    tools/branches/gsoc2009-gui/engines/scumm/
    tools/branches/gsoc2009-gui/engines/scumm/compress_scumm_bun.cpp
    tools/branches/gsoc2009-gui/engines/scumm/compress_scumm_bun.h
    tools/branches/gsoc2009-gui/engines/scumm/compress_scumm_san.cpp
    tools/branches/gsoc2009-gui/engines/scumm/compress_scumm_san.h
    tools/branches/gsoc2009-gui/engines/scumm/compress_scumm_sou.cpp
    tools/branches/gsoc2009-gui/engines/scumm/compress_scumm_sou.h
    tools/branches/gsoc2009-gui/engines/scumm/descumm-common.cpp
    tools/branches/gsoc2009-gui/engines/scumm/descumm-tool.cpp
    tools/branches/gsoc2009-gui/engines/scumm/descumm.cpp
    tools/branches/gsoc2009-gui/engines/scumm/descumm.h
    tools/branches/gsoc2009-gui/engines/scumm/descumm6.cpp
    tools/branches/gsoc2009-gui/engines/scumm/extract_loom_tg16.cpp
    tools/branches/gsoc2009-gui/engines/scumm/extract_loom_tg16.h
    tools/branches/gsoc2009-gui/engines/scumm/extract_mm_apple.cpp
    tools/branches/gsoc2009-gui/engines/scumm/extract_mm_apple.h
    tools/branches/gsoc2009-gui/engines/scumm/extract_mm_c64.cpp
    tools/branches/gsoc2009-gui/engines/scumm/extract_mm_c64.h
    tools/branches/gsoc2009-gui/engines/scumm/extract_mm_nes.cpp
    tools/branches/gsoc2009-gui/engines/scumm/extract_mm_nes.h
    tools/branches/gsoc2009-gui/engines/scumm/extract_scumm_mac.cpp
    tools/branches/gsoc2009-gui/engines/scumm/extract_scumm_mac.h
    tools/branches/gsoc2009-gui/engines/scumm/extract_zak_c64.cpp
    tools/branches/gsoc2009-gui/engines/scumm/extract_zak_c64.h
    tools/branches/gsoc2009-gui/engines/sword1/
    tools/branches/gsoc2009-gui/engines/sword1/compress_sword1.cpp
    tools/branches/gsoc2009-gui/engines/sword1/compress_sword1.h
    tools/branches/gsoc2009-gui/engines/sword2/
    tools/branches/gsoc2009-gui/engines/sword2/compress_sword2.cpp
    tools/branches/gsoc2009-gui/engines/sword2/compress_sword2.h
    tools/branches/gsoc2009-gui/engines/sword2/desword2.cpp
    tools/branches/gsoc2009-gui/engines/sword2/sword2_clue.cpp
    tools/branches/gsoc2009-gui/engines/tinsel/
    tools/branches/gsoc2009-gui/engines/tinsel/compress_tinsel.cpp
    tools/branches/gsoc2009-gui/engines/tinsel/compress_tinsel.h
    tools/branches/gsoc2009-gui/engines/touche/
    tools/branches/gsoc2009-gui/engines/touche/compress_touche.cpp
    tools/branches/gsoc2009-gui/engines/touche/compress_touche.h
    tools/branches/gsoc2009-gui/engines/tucker/
    tools/branches/gsoc2009-gui/engines/tucker/compress_tucker.cpp
    tools/branches/gsoc2009-gui/engines/tucker/compress_tucker.h
    tools/branches/gsoc2009-gui/sound/

Removed Paths:
-------------
    tools/branches/gsoc2009-gui/compress_agos.cpp
    tools/branches/gsoc2009-gui/compress_agos.h
    tools/branches/gsoc2009-gui/compress_gob.cpp
    tools/branches/gsoc2009-gui/compress_gob.h
    tools/branches/gsoc2009-gui/compress_kyra.cpp
    tools/branches/gsoc2009-gui/compress_kyra.h
    tools/branches/gsoc2009-gui/compress_queen.cpp
    tools/branches/gsoc2009-gui/compress_queen.h
    tools/branches/gsoc2009-gui/compress_saga.cpp
    tools/branches/gsoc2009-gui/compress_saga.h
    tools/branches/gsoc2009-gui/compress_scumm_bun.cpp
    tools/branches/gsoc2009-gui/compress_scumm_bun.h
    tools/branches/gsoc2009-gui/compress_scumm_san.cpp
    tools/branches/gsoc2009-gui/compress_scumm_san.h
    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_sword1.h
    tools/branches/gsoc2009-gui/compress_sword2.cpp
    tools/branches/gsoc2009-gui/compress_sword2.h
    tools/branches/gsoc2009-gui/compress_tinsel.cpp
    tools/branches/gsoc2009-gui/compress_tinsel.h
    tools/branches/gsoc2009-gui/compress_touche.cpp
    tools/branches/gsoc2009-gui/compress_touche.h
    tools/branches/gsoc2009-gui/compress_tucker.cpp
    tools/branches/gsoc2009-gui/compress_tucker.h
    tools/branches/gsoc2009-gui/decine.cpp
    tools/branches/gsoc2009-gui/degob.cpp
    tools/branches/gsoc2009-gui/degob_script.cpp
    tools/branches/gsoc2009-gui/degob_script.h
    tools/branches/gsoc2009-gui/degob_script_bargon.cpp
    tools/branches/gsoc2009-gui/degob_script_v1.cpp
    tools/branches/gsoc2009-gui/degob_script_v2.cpp
    tools/branches/gsoc2009-gui/degob_script_v3.cpp
    tools/branches/gsoc2009-gui/degob_script_v4.cpp
    tools/branches/gsoc2009-gui/degob_script_v5.cpp
    tools/branches/gsoc2009-gui/degob_script_v6.cpp
    tools/branches/gsoc2009-gui/dekyra.cpp
    tools/branches/gsoc2009-gui/dekyra.h
    tools/branches/gsoc2009-gui/dekyra_v1.cpp
    tools/branches/gsoc2009-gui/descumm-common.cpp
    tools/branches/gsoc2009-gui/descumm-tool.cpp
    tools/branches/gsoc2009-gui/descumm.cpp
    tools/branches/gsoc2009-gui/descumm.h
    tools/branches/gsoc2009-gui/descumm6.cpp
    tools/branches/gsoc2009-gui/desword2.cpp
    tools/branches/gsoc2009-gui/extract_agos.cpp
    tools/branches/gsoc2009-gui/extract_agos.h
    tools/branches/gsoc2009-gui/extract_cine.cpp
    tools/branches/gsoc2009-gui/extract_cine.h
    tools/branches/gsoc2009-gui/extract_gob_stk.cpp
    tools/branches/gsoc2009-gui/extract_gob_stk.h
    tools/branches/gsoc2009-gui/extract_kyra.cpp
    tools/branches/gsoc2009-gui/extract_kyra.h
    tools/branches/gsoc2009-gui/extract_loom_tg16.cpp
    tools/branches/gsoc2009-gui/extract_loom_tg16.h
    tools/branches/gsoc2009-gui/extract_mm_apple.cpp
    tools/branches/gsoc2009-gui/extract_mm_apple.h
    tools/branches/gsoc2009-gui/extract_mm_c64.cpp
    tools/branches/gsoc2009-gui/extract_mm_c64.h
    tools/branches/gsoc2009-gui/extract_mm_nes.cpp
    tools/branches/gsoc2009-gui/extract_mm_nes.h
    tools/branches/gsoc2009-gui/extract_parallaction.cpp
    tools/branches/gsoc2009-gui/extract_parallaction.h
    tools/branches/gsoc2009-gui/extract_scumm_mac.cpp
    tools/branches/gsoc2009-gui/extract_scumm_mac.h
    tools/branches/gsoc2009-gui/extract_t7g_mac.cpp
    tools/branches/gsoc2009-gui/extract_t7g_mac.h
    tools/branches/gsoc2009-gui/extract_zak_c64.cpp
    tools/branches/gsoc2009-gui/extract_zak_c64.h
    tools/branches/gsoc2009-gui/kyra_ins.cpp
    tools/branches/gsoc2009-gui/kyra_ins.h
    tools/branches/gsoc2009-gui/kyra_pak.cpp
    tools/branches/gsoc2009-gui/kyra_pak.h
    tools/branches/gsoc2009-gui/sword2_clue.cpp
    tools/branches/gsoc2009-gui/utils/

Modified: tools/branches/gsoc2009-gui/Makefile
===================================================================
--- tools/branches/gsoc2009-gui/Makefile	2009-12-26 13:35:57 UTC (rev 46581)
+++ tools/branches/gsoc2009-gui/Makefile	2009-12-26 13:37:48 UTC (rev 46582)
@@ -15,9 +15,7 @@
 DEPDIR      := .deps
 
 MODULES     :=
-# HACK: Until we get proper module support, add these "module dirs" to 
-# get the dependency tracking code working.
-MODULE_DIRS := ./ utils/ common/ gui/
+MODULE_DIRS :=
 
 STANDALONE  := 
 # This one will go away once all tools are converted

Modified: tools/branches/gsoc2009-gui/Makefile.common
===================================================================
--- tools/branches/gsoc2009-gui/Makefile.common	2009-12-26 13:35:57 UTC (rev 46581)
+++ tools/branches/gsoc2009-gui/Makefile.common	2009-12-26 13:37:48 UTC (rev 46582)
@@ -12,6 +12,33 @@
 all:
 
 
+######################################################################
+# Module settings
+######################################################################
+
+#MODULES := test tools base $(MODULES)
+
+# HACK: Until we get proper module support, add these "module dirs" to 
+# get the dependency tracking code working.
+MODULE_DIRS := ./ common/ gui/ sound/
+
+MODULE_DIRS += \
+	engines/agos/ \
+	engines/cine/ \
+	engines/gob/ \
+	engines/groovie/ \
+	engines/kyra/ \
+	engines/parallaction/ \
+	engines/queen/ \
+	engines/saga/ \
+	engines/scumm/ \
+	engines/sword1/ \
+	engines/sword2/ \
+	engines/tinsel/ \
+	engines/touche/ \
+	engines/tucker/
+
+
 # TODO: This file should be restructured and much of it moved
 # to module.mk style files.
 
@@ -31,10 +58,10 @@
 	common/file.o \
 	common/md5.o \
 	common/util.o \
-	utils/adpcm.o \
-	utils/audiostream.o \
-	utils/voc.o \
-	utils/wave.o
+	sound/adpcm.o \
+	sound/audiostream.o \
+	sound/voc.o \
+	sound/wave.o
 
 all: $(TARGETS)
 
@@ -66,24 +93,32 @@
 	sword2_clue
 
 
-decine_OBJS := decine.o
+decine_OBJS := engines/cine/decine.o
 
-dekyra_OBJS := dekyra.o dekyra_v1.o $(UTILS)
+dekyra_OBJS := \
+	engines/kyra/dekyra.o \
+	engines/kyra/dekyra_v1.o \
+	$(UTILS)
 
-descumm_OBJS := descumm-tool.o descumm.o descumm6.o descumm-common.o tool.o $(UTILS)
+descumm_OBJS := \
+	engines/scumm/descumm-tool.o \
+	engines/scumm/descumm.o \
+	engines/scumm/descumm6.o \
+	engines/scumm/descumm-common.o \
+	tool.o $(UTILS)
 
-desword2_OBJS := desword2.o tool.o $(UTILS)
+desword2_OBJS := engines/sword2/desword2.o tool.o $(UTILS)
 
 degob_OBJS := \
-	degob.o \
-	degob_script.o \
-	degob_script_v1.o \
-	degob_script_v2.o \
-	degob_script_v3.o \
-	degob_script_v4.o \
-	degob_script_v5.o \
-	degob_script_v6.o \
-	degob_script_bargon.o \
+	engines/gob/degob.o \
+	engines/gob/degob_script.o \
+	engines/gob/degob_script_v1.o \
+	engines/gob/degob_script_v2.o \
+	engines/gob/degob_script_v3.o \
+	engines/gob/degob_script_v4.o \
+	engines/gob/degob_script_v5.o \
+	engines/gob/degob_script_v6.o \
+	engines/gob/degob_script_bargon.o \
 	tool.o \
 	$(UTILS)
 
@@ -94,49 +129,53 @@
 create_sjisfnt.o: CPPFLAGS+=`pkg-config --cflags gtk+-2.0`
 
 
-sword2_clue_OBJS := sword2_clue.o
+sword2_clue_OBJS := engines/sword2/sword2_clue.o
 sword2_clue_LIBS := `pkg-config --libs gtk+-2.0`
 # Set custom build flags
 sword2_clue.o: CPPFLAGS+=`pkg-config --cflags gtk+-2.0`
 
 
+tools_OBJS := \
+	engines/agos/compress_agos.o \
+	engines/gob/compress_gob.o \
+	engines/kyra/compress_kyra.o \
+	engines/queen/compress_queen.o \
+	engines/saga/compress_saga.o \
+	engines/scumm/compress_scumm_bun.o \
+	engines/scumm/compress_scumm_san.o \
+	engines/scumm/compress_scumm_sou.o \
+	engines/sword1/compress_sword1.o \
+	engines/sword2/compress_sword2.o \
+	engines/touche/compress_touche.o \
+	engines/tucker/compress_tucker.o \
+	engines/tinsel/compress_tinsel.o \
+	engines/agos/extract_agos.o \
+	engines/cine/extract_cine.o \
+	engines/gob/extract_gob_stk.o \
+	engines/kyra/extract_kyra.o \
+	engines/scumm/extract_loom_tg16.o \
+	engines/scumm/extract_mm_apple.o \
+	engines/scumm/extract_mm_c64.o \
+	engines/scumm/extract_mm_nes.o \
+	engines/parallaction/extract_parallaction.o \
+	engines/scumm/extract_scumm_mac.o \
+	engines/groovie/extract_t7g_mac.o \
+	engines/scumm/extract_zak_c64.o \
+	engines/kyra/kyra_pak.o \
+	engines/kyra/kyra_ins.o \
+	encode_dxa.o \
+	compress.o \
+	tool.o \
+	tools.o \
+	$(UTILS)
+
+
 tools_gui_OBJS := \
 	gui/main.o \
 	gui/configuration.o \
 	gui/pages.o \
 	gui/gui_tools.o \
-	compress_agos.o \
-	compress_gob.o \
-	compress_kyra.o \
-	compress_queen.o \
-	compress_saga.o \
-	compress_scumm_bun.o \
-	compress_scumm_san.o \
-	compress_scumm_sou.o \
-	compress_sword1.o \
-	compress_sword2.o \
-	compress_touche.o \
-	compress_tucker.o \
-	compress_tinsel.o \
-	extract_agos.o \
-	extract_cine.o \
-	extract_gob_stk.o \
-	extract_kyra.o \
-	extract_loom_tg16.o \
-	extract_mm_apple.o \
-	extract_mm_c64.o \
-	extract_mm_nes.o \
-	extract_parallaction.o \
-	extract_scumm_mac.o \
-	extract_t7g_mac.o \
-	encode_dxa.o \
-	extract_zak_c64.o \
-	kyra_pak.o \
-	kyra_ins.o \
-	compress.o \
-	tool.o \
-	tools.o \
-	$(UTILS)
+	$(tools_OBJS)
 tools_gui_LIBS := $(WXLIBS) $(LIBS)
 
 # Set custom build flags for various files
@@ -150,38 +189,7 @@
 tools_cli_OBJS := \
 	main_cli.o \
 	tools_cli.o \
-	compress_agos.o \
-	compress_gob.o \
-	compress_kyra.o \
-	compress_queen.o \
-	compress_saga.o \
-	compress_scumm_bun.o \
-	compress_scumm_san.o \
-	compress_scumm_sou.o \
-	compress_sword1.o \
-	compress_sword2.o \
-	compress_touche.o \
-	compress_tucker.o \
-	compress_tinsel.o \
-	extract_agos.o \
-	extract_cine.o \
-	extract_gob_stk.o \
-	extract_kyra.o \
-	extract_loom_tg16.o \
-	extract_mm_apple.o \
-	extract_mm_c64.o \
-	extract_mm_nes.o \
-	extract_parallaction.o \
-	extract_scumm_mac.o \
-	extract_t7g_mac.o \
-	encode_dxa.o \
-	extract_zak_c64.o \
-	kyra_pak.o \
-	kyra_ins.o \
-	compress.o \
-	tool.o \
-	tools.o \
-	$(UTILS)
+	$(tools_OBJS)
 tools_cli_LIBS := $(LIBS)
 
 

Deleted: tools/branches/gsoc2009-gui/compress_agos.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_agos.cpp	2009-12-26 13:35:57 UTC (rev 46581)
+++ tools/branches/gsoc2009-gui/compress_agos.cpp	2009-12-26 13:37:48 UTC (rev 46582)
@@ -1,249 +0,0 @@
-/* compress_agos - Compress Simon the Sorcerer 1/2 digital sound files into MP3-format
- * Copyright (C) 2004-2006  The ScummVM Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include <cstring>
-
-#include "compress_agos.h"
-
-#define TEMP_DAT	"tempfile.dat"
-#define TEMP_IDX	"tempfile.idx"
-
-CompressAgos::CompressAgos(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
-	_convertMac = false;
-	_outputToDirectory = false;
-	_supportsProgressBar = true;
-	
-	ToolInput input;
-	input.format = "*.*";
-	_inputPaths.push_back(input);
-
-	_shorthelp = "Compresses Simon the Sorcer and Feeble Files data files.";
-	_helptext = "\nUsage: " + getName() + " [mode params] [-o outfile] [--mac] <infile>\n";
-}
-
-void CompressAgos::end() {
-	int size;
-	char fbuf[2048];
-
-	_output_idx.close();
-	_output_snd.close();
-
-	Common::File outputFile(_outputPath, "wb");
-
-	_input.open(TEMP_IDX, "rb");
-	while ((size = _input.read_noThrow(fbuf, 2048)) > 0) {
-		outputFile.write(fbuf, size);
-	}
-
-	_input.open(TEMP_DAT, "rb");
-	while ((size = _input.read_noThrow(fbuf, 2048)) > 0) {
-		outputFile.write(fbuf, size);
-	}
-
-	_input.close();
-	outputFile.close();
-
-	/* And some clean-up :-) */
-	unlink(TEMP_IDX);
-	unlink(TEMP_DAT);
-	unlink(TEMP_RAW);
-	unlink(tempEncoded);
-	unlink(TEMP_WAV);
-}
-
-
-int CompressAgos::get_offsets(size_t maxcount, uint32 filenums[], uint32 offsets[]) {
-	for (size_t i = 0; i < maxcount; i++) {
-		char buf[8];
-		_input.read_throwsOnError(buf, 8);
-		if (!memcmp(buf, "Creative", 8) || !memcmp(buf, "RIFF", 4)) {
-			return i;
-		}
-		_input.seek(-8, SEEK_CUR);
-
-		offsets[i] = _input.readUint32LE();
-	}
-
-	// We exceeded size of array
-	throw ToolException("Too many indexes read, file does not appear to be of the correct format.");
-}
-
-int CompressAgos::get_offsets_mac(size_t maxcount, uint32 filenums[], uint32 offsets[]) {
-	int size = _input.size();
-
-	for (int i = 1; i <= size / 6; i++) {
-		if ((size_t)i >= maxcount)
-			throw ToolException("Too many indexes read, file does not appear to be of the correct format.");
-		filenums[i] = _input.readUint16BE();
-		offsets[i] = _input.readUint32BE();
-	}
-
-	return (size/6);
-}
-
-
-uint32 CompressAgos::get_sound(uint32 offset) {
-	uint32 tot_size;
-	char outname[256];
-	int size;
-	char fbuf[2048];
-	char buf[8];
-
-	_input.seek(offset, SEEK_SET);
-
-	_input.read_throwsOnError(buf, 8);
-	if (!memcmp(buf, "Creative", 8)) {
-		print("VOC found (pos = %d) :\n", offset);
-		_input.seek(18, SEEK_CUR);
-		extractAndEncodeVOC(TEMP_RAW, _input, _format);
-	} else if (!memcmp(buf, "RIFF", 4)) {
-		print("WAV found (pos = %d) :\n", offset);
-		extractAndEncodeWAV(TEMP_WAV, _input, _format);
-	} else {
-		error("Unexpected data at offset: %d", offset);
-	}
-
-	/* Append the converted data to the master output file */
-	sprintf(outname, "%s", tempEncoded);
-	Common::File f(outname, "rb");
-	tot_size = 0;
-	while ((size = f.read_noThrow(fbuf, 2048)) > 0) {
-		tot_size += size;
-		_output_snd.write(fbuf, size);
-	}
-
-	return(tot_size);
-}
-
-
-void CompressAgos::convert_pc(Common::Filename* inputPath) {
-	int i, size, num;
-	uint32 filenums[32768];
-	uint32 offsets[32768];
-
-	_input.open(*inputPath, "rb");
-
-	_output_idx.open(TEMP_IDX, "wb");
-
-	_output_snd.open(TEMP_DAT, "wb");
-
-	num = get_offsets(32768, filenums, offsets);
-	if (!num) {
-		error("This does not seem to be a valid file");
-	}
-	size = num * 4;
-
-	_output_idx.writeUint32LE(0);
-	_output_idx.writeUint32LE(size);
-
-	for (i = 1; i < num; i++) {
-		updateProgress(i, num);
-
-		if (offsets[i] == offsets[i + 1]) {
-			_output_idx.writeUint32LE(size);
-			continue;
-		}
-
-		if (offsets[i] != 0)
-			size += get_sound(offsets[i]);
-		if (i < num - 1)
-			_output_idx.writeUint32LE(size);
-	}
-}
-
-void CompressAgos::convert_mac(Common::Filename *inputPath) {
-	int i, size, num;
-	uint32 filenums[32768];
-	uint32 offsets[32768];
-
-	inputPath->setFullName("voices.idx");
-	_input.open(*inputPath, "rb");
-
-	_output_idx.open(TEMP_IDX, "wb");
-
-	_output_snd.open(TEMP_DAT, "wb");
-
-	num = get_offsets_mac(32768, filenums, offsets);
-	if (!num) {
-		error("This does not seem to be a valid file");
-	}
-	size = num * 4;
-
-	_output_idx.writeUint32LE(0);
-	_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;
-		}
-
-		if (filenums[i] != filenums[i - 1]) {
-			char filename[256];
-			sprintf(filename, "voices%d.dat", filenums[i]);
-			inputPath->setFullName(filename);
-
-			_input.open(*inputPath, "rb");
-		}
-
-		size += get_sound(offsets[i]);
-
-		if (i < num - 1) {
-			_output_idx.writeUint32LE(size);
-		}
-	}
-}
-
-void CompressAgos::parseExtraArguments() {
-	if (!_arguments.empty() && _arguments.front() == "--mac") {
-		_convertMac = true;
-		_arguments.pop_front();
-	}
-}
-
-void CompressAgos::execute() {
-	Common::Filename inpath(_inputPaths[0].path);
-
-	if (_outputPath.empty()) {
-		_outputPath = inpath;
-		_outputPath.setExtension(audio_extensions(_format));
-	}
-
-	if (_convertMac) {
-		convert_mac(&inpath);
-		inpath.setFullName("simon2");
-	} else {
-		convert_pc(&inpath);
-	}
-
-	end();
-}
-
-#ifdef STANDALONE_MAIN
-int main(int argc, char *argv[]) {
-	CompressAgos agos(argv[0]);
-	return agos.run(argc, argv);
-}
-#endif
-

Deleted: tools/branches/gsoc2009-gui/compress_agos.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_agos.h	2009-12-26 13:35:57 UTC (rev 46581)
+++ tools/branches/gsoc2009-gui/compress_agos.h	2009-12-26 13:37:48 UTC (rev 46582)
@@ -1,49 +0,0 @@
-/* compress_agos.h - Compress Simon the Sorcerer 1/2 digital sound files into compressed audio format
- * Copyright (C) 2009 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef COMPRESS_AGOS_H
-#define COMPRESS_AGOS_H
-
-#include "compress.h"
-
-class CompressAgos : public CompressionTool {
-public:
-	CompressAgos(const std::string &name = "compress_agos");
-
-	virtual void execute();
-
-	bool _convertMac;
-
-protected:
-	void parseExtraArguments();
-
-	Common::File _input, _output_idx, _output_snd;
-
-	void end();
-	int get_offsets(size_t maxcount, uint32 filenums[], uint32 offsets[]);
-	int get_offsets_mac(size_t maxcount, uint32 filenums[], uint32 offsets[]);
-	uint32 get_sound(uint32 offset);
-	void convert_pc(Common::Filename* inputPath);
-	void convert_mac(Common::Filename *inputPath);
-};
-
-#endif

Deleted: tools/branches/gsoc2009-gui/compress_gob.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_gob.cpp	2009-12-26 13:35:57 UTC (rev 46581)
+++ tools/branches/gsoc2009-gui/compress_gob.cpp	2009-12-26 13:37:48 UTC (rev 46582)
@@ -1,519 +0,0 @@
-/* compress_gob - .stk/.itk archive creation tool, based on a conf file.
- * Copyright (C) 2007 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include <cstring>
-
-#include "compress_gob.h"
-
-struct CompressGob::Chunk {
-	char name[64];
-	uint32 size, realSize, offset;
-	uint8 packed;
-	Chunk *replChunk;
-	Chunk *next;
-
-	Chunk() : next(0) { }
-	~Chunk() { delete next; }
-};
-
-
-CompressGob::CompressGob(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
-	_execMode = MODE_NORMAL;
-	_chunks = NULL;
-	_supportedFormats = AUDIO_NONE;
-
-	ToolInput input;
-	input.format = "*.gob";
-	_inputPaths.push_back(input);
-
-	_shorthelp = "Compresses Gobliiins! data files.";
-	_helptext = 
-		"\nUsage: " + getName() + " [-o <output path>] [-f] <conf file>\n"
-		"<conf file> is a .gob file generated extract_gob_stk\n"
-		"<-f> forces compression for all files\n\n"
-		"The stick archive (STK/ITK/LTK) will be created in the directory specified by the '-o' parameter.\n";
-}
-
-CompressGob::~CompressGob() {
-	delete _chunks;
-}
-
-void CompressGob::parseExtraArguments() {
-	if (!_arguments.empty() && _arguments.front() == "-f") {
-		_execMode |= MODE_FORCE;
-		_arguments.pop_front();
-	}
-}
-
-void CompressGob::execute() {
-	Common::File stk;
-	Common::File gobConf;
-	uint16 chunkCount;
-
-
-	Common::Filename inpath(_inputPaths[0].path);
-
-	// We output with .stk extension, if there is no specific out file
-	if (_outputPath.empty()) {
-		_outputPath = inpath;
-	}
-	// Open input (config) file
-	gobConf.open(inpath, "r");
-	// Read the input into memory
-	_chunks = readChunkConf(gobConf, inpath, chunkCount);
-	gobConf.close();
-
-	_outputPath.setFullName(inpath.getFullName());
-	
-	stk.open(_outputPath, "wb");
-
-	// Output in compressed format
-	writeEmptyHeader (stk, chunkCount);
-	writeBody(&inpath, stk, _chunks);
-	rewriteHeader(stk, chunkCount, _chunks);
-}
-
-/*! \brief Config file parser
- * \param gobConf Config file to parse
- * \param stk STK/ITK archive file to be created
- * \param chunkCount Number of chunks to be written in the archive file
- * \return A list of chunks
- *
- * This function reads the '.gob' config file (generated by extract_gob_stk).
- * It creates the output archive file and a list of chunks containing the file
- * and compression information.
- * In order to have a slightly better compression ration in some cases (Playtoons), it
- * also detects duplicate files.
- */
-CompressGob::Chunk *CompressGob::readChunkConf(Common::File &gobConf, Common::Filename &stkName, uint16 &chunkCount) {
-	Chunk *chunks = new Chunk;
-	Chunk *curChunk = chunks;
-	Chunk *parseChunk;
-	Common::File src1;
-	Common::Filename srcName("");
-	char buffer[1024];
-
-	chunkCount = 1;
-
-// First read: Output filename
-	gobConf.scanString(buffer);
-	stkName.setFullName(buffer);
-
-	srcName.setFullPath(stkName.getPath());
-
-// Second read: signature
-	gobConf.scanString(buffer);
-	std::string signature(buffer);
-	if (signature == confSTK21)
-		error("STK21 not yet handled");
-	else if (signature != confSTK10)
-		error("Unknown format signature %s", signature.c_str());
-
-	print("Checking duplicate files\n");
-
-// All the other reads concern file + compression flag
-	gobConf.scanString(buffer);
-	while (!gobConf.eos()) {
-		strcpy(curChunk->name, buffer);
-		srcName.setFullName(buffer);
-
-		gobConf.scanString(buffer);
-		if ((strcmp(buffer, "1") == 0 )|| (_execMode & MODE_FORCE))
-			curChunk->packed = true;
-		else
-			curChunk->packed = false;
-		src1.open(srcName, "rb");
-		src1.seek(0, SEEK_END);
-// if file is too small, force 'Store' method
-		if ((curChunk->realSize = src1.pos()) < 8) 
-			curChunk->packed = 0;
-
-		parseChunk = chunks;
-		while (parseChunk != curChunk) {
-			if ((parseChunk->realSize == curChunk->realSize) & (parseChunk->packed != 2)) {
-				if (strcmp(parseChunk->name, curChunk->name) == 0)
-					error("Duplicate filename found in conf file: %s", parseChunk->name);
-				srcName.setFullName(parseChunk->name);
-				if (filcmp(src1, srcName)) {
-// If files are identical, use the same compressed chunk instead of re-compressing the same thing
-					curChunk->packed = 2;
-					curChunk->replChunk = parseChunk;
-					print("Identical files : %s %s (%d bytes)\n", curChunk->name, parseChunk->name, curChunk->realSize);
-					break;
-				}
-			}
-			parseChunk = parseChunk->next;
-		}
-		src1.close();
-		
-		gobConf.scanString(buffer);
-
-		if (!gobConf.eos()) {
-			curChunk->next = new Chunk;
-			curChunk = curChunk->next;
-			chunkCount++;
-		}
-	}
-	return chunks;
-}
-
-/*! \brief Write an empty header to the STK archive
- * \param stk STK/ITK archive file
- * \param chunkCount Number of chunks to be written in the archive file
- *
- * This function writes an empty header in the STK archive. This is required as
- * the header length is variable and depends on the number of chunks to be written
- * in the archive file. 
- *
- * This header will be overwritten just before the end of the program execution
- */
-void CompressGob::writeEmptyHeader(Common::File &stk, uint16 chunkCount) {
-	for (uint32 count = 0; count < 2 + (uint32) (chunkCount * 22); count++)
-		stk.writeByte(0);
-
-	return;
-}
-
-/*! \brief Write the body of the STK archive
- * \param stk STK/ITK archive file
- * \param chunks Chunk list
- *
- * This function writes the body of the STK archive by storing or compressing
- * (or skipping duplicate files) the files. It also updates the chunk information
- * with the size of the chunk in the archive, the compression method (if modified),
- * ...
- */
-void CompressGob::writeBody(Common::Filename *inpath, Common::File &stk, Chunk *chunks) {
-	Chunk *curChunk = chunks;
-	Common::File src;
-	uint32 tmpSize;
-	
-	while (curChunk) {
-		inpath->setFullName(curChunk->name);
-		src.open(*inpath, "rb");
-
-		if (curChunk->packed == 2)
-			print("Identical file %12s\t(compressed size %d bytes)\n", curChunk->name, curChunk->replChunk->size);
-
-		curChunk->offset = stk.pos();
-		if (curChunk->packed == 1) {
-			curChunk->size = writeBodyPackFile(stk, src);
-			if (curChunk->size >= curChunk->realSize) {
-// If compressed size >= realsize, compression is useless
-// => Store instead
-				curChunk->packed = 0;
-				stk.seek(curChunk->offset, SEEK_SET);
-				src.rewind();
-			} else
-				print("Compressing %12s\t%d -> %d bytes\n", curChunk->name, curChunk->realSize, curChunk->size);
-
-		} 
-
-		if (curChunk->packed == 0) {
-			tmpSize = 0;
-			curChunk->size = writeBodyStoreFile(stk, src);
-			print("Storing %12s\t%d bytes\n", curChunk->name, curChunk->size);
-		}
-		curChunk = curChunk->next;
-	}
-}
-
-/*! \brief Rewrites the header of the archive file
- * \param stk STK/ITK archive file
- * \param chunkCount Number of chunks
- * \param chunks List of chunks
- *
- * This function rewrites the header of the archive, replacing dummy values 
- * by the one computed during execution.
- * The structure of the header is the following :
- * + 2 bytes : numbers of files archived in the .stk/.itk
- * Then, for each files :
- * + 13 bytes : the filename, terminated by '\0'. In original, there's
- *   garbage after if the filename has not the maximum length
- * + 4  bytes : size of the chunk
- * + 4  bytes : start position of the chunk in the file
- * + 1  byte  : If 0 : not compressed, if 1 : compressed
- * 
- * The duplicate files are defined using the same information
- * as the one of the replacement file.
-*/
-void CompressGob::rewriteHeader(Common::File &stk, uint16 chunkCount, Chunk *chunks) {
-	uint16 i;
-	char buffer[1024];
-	Chunk *curChunk = chunks;
-
-	stk.rewind();
-
-	buffer[0] = chunkCount & 0xFF;
-	buffer[1] = chunkCount >> 8;
-	stk.write(buffer, 2);
-// TODO : Implement STK21
-	while (curChunk) {
-		for (i = 0; i < 13; i++)
-			if (i < strlen(curChunk->name))
-				buffer[i] = curChunk->name[i];
-			else
-				buffer[i] = '\0';
-		stk.write(buffer, 13);
-
-		if (curChunk->packed == 2)
-		{
-			buffer[0] = curChunk->replChunk->size;
-			buffer[1] = curChunk->replChunk->size >> 8;
-			buffer[2] = curChunk->replChunk->size >> 16;
-			buffer[3] = curChunk->replChunk->size >> 24;
-			buffer[4] = curChunk->replChunk->offset;
-			buffer[5] = curChunk->replChunk->offset >> 8;
-			buffer[6] = curChunk->replChunk->offset >> 16;
-			buffer[7] = curChunk->replChunk->offset >> 24;
-			buffer[8] = curChunk->replChunk->packed;
-		} else {
-			buffer[0] = curChunk->size;
-			buffer[1] = curChunk->size >> 8;
-			buffer[2] = curChunk->size >> 16;
-			buffer[3] = curChunk->size >> 24;
-			buffer[4] = curChunk->offset;
-			buffer[5] = curChunk->offset >> 8;
-			buffer[6] = curChunk->offset >> 16;
-			buffer[7] = curChunk->offset >> 24;
-			buffer[8] = curChunk->packed;
-		}
-		stk.write(buffer, 9);
-		curChunk = curChunk->next;
-	}
-}
-
-/*! \brief Stores a file in the archive file
- * \param stk STK/ITK archive file
- * \param src File to be stored
- * \return Size of the file stored
- *
- * This function stores a file in the STK archive
- */
-uint32 CompressGob::writeBodyStoreFile(Common::File &stk, Common::File &src) {
-	int count;
-	char buffer[4096];
-	uint32 tmpSize = 0;
-
-	do {
-		count = src.read_noThrow(buffer, 4096);
-		stk.write(buffer, count);
-		tmpSize += count;
-	} while (count == 4096);
-	return tmpSize;
-}
-
-/*! \brief Compress a file in the archive file
- * \param stk STK/ITK archive file
- * \param src File to be stored
- * \return Size of the resulting compressed chunk
- *
- * This function compress a file in the STK archive
- */
-uint32 CompressGob::writeBodyPackFile(Common::File &stk, Common::File &src) {
-	byte dico[4114];
-	byte writeBuffer[17];
-	uint32 counter;
-	uint16 dicoIndex;
-	uint32 unpackedIndex, size;
-	uint8 cmd;
-	uint8 buffIndex, cpt;
-	uint16 resultcheckpos;
-	byte resultchecklength;
-
-	size = src.size();
-
-	byte *unpacked = new byte [size + 1];
-
-	memset(dico, 0x20, 4114);
-	memset(unpacked, 0, size + 1);
-
-	src.read_throwsOnError(unpacked, size);
-
-	writeBuffer[0] = size & 0xFF;
-	writeBuffer[1] = size >> 8;
-	writeBuffer[2] = size >> 16;
-	writeBuffer[3] = size >> 24;
-	stk.write(writeBuffer, 4);
-
-// Size is already checked : small files (less than 8 characters) 
-// are not compressed, so copying the first three bytes is safe.
-	dicoIndex = 4078;
-	dico[dicoIndex] = unpacked[0];
-	dico[dicoIndex+1] = unpacked[1];
-	dico[dicoIndex+2] = unpacked[2];
-	dicoIndex += 3;
-
-// writeBuffer[0] is reserved for the command byte
-	writeBuffer[1] = unpacked[0];
-	writeBuffer[2] = unpacked[1];
-	writeBuffer[3] = unpacked[2];
-// Force the 3 first operation bits to 'copy character'
-	cmd = (1 << 3) - 1;
-
-	counter = size - 3;
-	unpackedIndex = 3;
-	cpt = 3;
-	buffIndex = 4;
-
-	size=4;
-	resultcheckpos = 0;
-	resultchecklength = 0;
-
-	while (counter>0) {
-		if (!checkDico(unpacked, unpackedIndex, counter, dico, dicoIndex, resultcheckpos, resultchecklength)) {
-			dico[dicoIndex] = unpacked[unpackedIndex];
-			writeBuffer[buffIndex] = unpacked[unpackedIndex];
-// set the operation bit : copy character
-			cmd |= (1 << cpt);
-			unpackedIndex++;
-			dicoIndex = (dicoIndex + 1) % 4096;
-			buffIndex++;
-			counter--;
-		} else {
-// Copy the string in the dictionary
-			for (int i = 0; i < resultchecklength; i++)
-				dico[((dicoIndex + i) % 4096)] = dico[((resultcheckpos + i) % 4096)];
-
-// Write the copy string command
-			writeBuffer[buffIndex] = resultcheckpos & 0xFF;
-			writeBuffer[buffIndex + 1] = ((resultcheckpos & 0x0F00) >> 4) + (resultchecklength - 3);
-
-// Do not set the operation bit : copy string from dictionary
-//			cmd |= (0 << cpt);
-
-			unpackedIndex += resultchecklength;
-			dicoIndex = (dicoIndex + resultchecklength) % 4096;
-			resultcheckpos = (resultcheckpos + resultchecklength) % 4096;
-
-			buffIndex += 2;
-			counter -= resultchecklength;
-		}
-
-// The command byte is complete when the file is entirely compressed, or 
-// when the 8 operation bits are set.
-		if ((cpt == 7) | (counter == 0)) {
-			writeBuffer[0] = cmd;
-			stk.write(writeBuffer, buffIndex);
-			size += buffIndex;
-			buffIndex = 1;
-			cmd = 0;
-			cpt = 0;
-		} else
-			cpt++;
-	}
-
-	delete[] unpacked;
-	return size;
-}
-
-/*! \brief Compare a file to a file defined in a chunk
- * \param src1 File to be compared
- * \param compChunk Chunk containing information on second file to be compared
- * \return whether they are identical or not.
- *
- * This function compares a file to another defined in a chunk. The file sizes 
- * are already tested outside the function.
- */
-bool CompressGob::filcmp(Common::File &src1, Common::Filename &stkName) {
-	uint16 readCount;
-	bool checkFl = true;
-	char buf1[4096]; 
-	char buf2[4096];
-	Common::File src2;
-
-	src1.rewind();
-	src2.open(stkName.getFullPath(), "rb");
-	
-	do {
-		readCount = src1.read_noThrow(buf1, 4096);
-		src2.read_noThrow(buf2, 4096);
-		for (int i = 0; checkFl & (i < readCount); i++)
-			if (buf1[i] != buf2[i])
-				checkFl = false;
-	} while (checkFl & (readCount == 4096));
-
-	src1.rewind();
-	src2.rewind();
-	return checkFl;
-}
-
-/*! \brief Compare a file to a file defined in a chunk
- * \param unpacked Buffer being compressed
- * \param unpackedIndex Current 'read' position in this buffer
- * \param counter Number of bytes still to be compressed in the file
- * \param dico Dictionary
- * \param currIndex Current 'write' position in the dictionary (used to avoid dictionary collision)
- * \param pos Position of the better match found, if any
- * \param length Length of the better match found, if any
- * \return whether a match has been found or not or not.
- *
- * This function search in the dictionary for matches with the characters still to be compressed. 
- * 'A match' is when at least three characters of the buffer (comparing from the current 'read' position)
- * are found in the dictionary. The match lengths are limited to 18 characters, as the 
- * length (minus 3) is stored on 4 bits.
- */
-bool CompressGob::checkDico(byte *unpacked, uint32 unpackedIndex, int32 counter, byte *dico, uint16 currIndex, uint16 &pos, uint8 &length) {
-	uint16 tmpPos, bestPos;
-	uint8 tmpLength, bestLength, i;
-
-	bestPos = 0;
-	bestLength = 2;
-
-	if (counter < 3)
-		return false;
-
-	for (tmpPos = 0; tmpPos < 0x1000; tmpPos++) {
-		tmpLength = 0;
-		for (i = 0; ((i < 18) & (i < counter)); i++)
-			if ((unpacked[unpackedIndex + i] == dico[(tmpPos + i) % 4096]) & 
-				// avoid dictionary collision
-				(((tmpPos + i) % 4096 != currIndex) | (i == 0)))
-				tmpLength++;
-			else
-				break;
-		if (tmpLength > bestLength)
-		{
-			bestPos = tmpPos;
-			if ((bestLength = tmpLength) == 18)
-				break;
-		}
-	}
-
-	pos = bestPos;
-	length = bestLength;
-
-	if (bestLength > 2)
-		return true;
-	else {
-		length = 0;
-		return false;
-	}
-}
-
-#ifdef STANDALONE_MAIN
-int main(int argc, char *argv[]) {
-	CompressGob gob(argv[0]);
-	return gob.run(argc, argv);
-}
-#endif
-

Deleted: tools/branches/gsoc2009-gui/compress_gob.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_gob.h	2009-12-26 13:35:57 UTC (rev 46581)
+++ tools/branches/gsoc2009-gui/compress_gob.h	2009-12-26 13:37:48 UTC (rev 46582)
@@ -1,64 +0,0 @@
-/* Scumm Tools
- * Copyright (C) 2007 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef COMPRESS_GOB_H
-#define COMPRESS_GOB_H
-
-#include "compress.h"
-
-#define confSTK21 "STK21"
-#define confSTK10 "STK10"
-
-enum {
-	MODE_NORMAL = 0,
-	MODE_HELP   = 1,
-	MODE_FORCE  = 2,
-	MODE_SET    = 4
-};
-
-class CompressGob : public CompressionTool {
-public:
-	CompressGob(const std::string &name = "compress_gob");
-	~CompressGob();
-
-	virtual void execute();
-
-protected:
-	struct Chunk;
-	
-	uint8 _execMode;
-	Chunk *_chunks;
-
-	void parseExtraArguments();
-
-	Chunk *readChunkConf(Common::File &gobconf, Common::Filename &stkName, uint16 &chunkCount);
-	void writeEmptyHeader(Common::File &stk, uint16 chunkCount);
-	void writeBody(Common::Filename *inpath, Common::File &stk, Chunk *chunks);
-	uint32 writeBodyStoreFile(Common::File &stk, Common::File &src);
-	uint32 writeBodyPackFile(Common::File &stk, Common::File &src);
-	void rewriteHeader(Common::File &stk, uint16 chunkCount, Chunk *chunks);
-	bool filcmp(Common::File &src1, Common::Filename &stkName);
-	bool checkDico(byte *unpacked, uint32 unpackedIndex, int32 counter, byte *dico, uint16 currIndex, uint16 &pos, uint8 &length);
-
-};
-
-#endif

Deleted: tools/branches/gsoc2009-gui/compress_kyra.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_kyra.cpp	2009-12-26 13:35:57 UTC (rev 46581)
+++ tools/branches/gsoc2009-gui/compress_kyra.cpp	2009-12-26 13:37:48 UTC (rev 46582)
@@ -1,405 +0,0 @@
-/* compress_kyra_bun - compressor for kyra sound file packages
- * Copyright (C) 2006  The ScummVM Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include <cassert>
-#include <cstdlib>
-
-#include "compress_kyra.h"
-
-#include "compress.h"
-#include "kyra_pak.h"
-
-#define TEMPFILE "TEMP.VOC"
-
-CompressKyra::CompressKyra(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
-	ToolInput input;
-	input.format = "*.*";
-	_inputPaths.push_back(input);
-
-	_shorthelp = "Used to compress Legend of Kyrandia games.";
-	_helptext = "\nUsage: " + getName() + " [mode params] [-o outfile] <infile>\n";
-}
-
-InspectionMatch CompressKyra::inspectInput(const Common::Filename &filename) {
-	if (filename.hasExtension("VRM") ||
-		filename.hasExtension("PAK") ||
-		filename.hasExtension("TLK") ||
-		filename.hasExtension("AUD"))
-		return IMATCH_PERFECT;
-	return IMATCH_AWFUL;
-}
-
-void CompressKyra::execute() {
-	Common::Filename inpath(_inputPaths[0].path);
-	Common::Filename &outpath = _outputPath;
-	outpath.setFullName(inpath.getFullName());
-
-	if (inpath == outpath)
-		error("Infile and outfile cannot be the same file");
-
-	bool isKyra3 = detectKyra3File(&inpath);
-	if (!isKyra3)
-		process(&inpath, &outpath);
-	else
-		processKyra3(&inpath, &outpath);
-}
-
-void CompressKyra::process(Common::Filename *infile, Common::Filename *outfile) {
-	PAKFile input, output;
-
-	if (!input.loadFile(infile->getFullPath().c_str(), false))
-		return;
-
-	if (!output.loadFile(NULL, false))
-		return;
-
-	PAKFile::cFileList *list = input.getFileList();
-
-	for (; list; list = list->next) {
-		// Detect VOC file from content instead of extension. This is needed for Lands of Lore TLK files.
-		if (memcmp(list->data, "Creative Voice File", 19) != 0)
-			continue;
-
-		if (list->data[26] != 1) {
-			warning("'%s' contains broken VOC file '%s' skipping it...", infile->getFullPath().c_str(), list->filename);
-			continue;
-		}
-
-		Common::Filename outputName;
-		input.outputFileAs(list->filename, TEMPFILE);
-		outputName._path = list->filename;
-
-		Common::File tempFile(TEMPFILE, "rb");
-		tempFile.seek(26, SEEK_CUR);
-		extractAndEncodeVOC(TEMP_RAW, tempFile, _format);
-		tempFile.close();
-
-		outputName.setExtension(audio_extensions(_format));
-
-		output.addFile(outputName.getFullPath().c_str(), tempEncoded);
-
-		unlink(TEMPFILE);
-		unlink(TEMP_RAW);
-		unlink(tempEncoded);
-	}
-
-	if (output.getFileList())
-		output.saveFile(outfile->getFullPath().c_str());
-	else
-		print("file '%s' doesn't contain any .voc files\n", infile->getFullPath().c_str());
-}
-
-// Kyra3 specifc code
-
-uint16 CompressKyra::clip8BitSample(int16 sample) {
-	if (sample > 255)
-		return 255;
-	if (sample < 0)
-		return 0;
-	return sample;
-}
-
-int CompressKyra::decodeChunk(Common::File &in, Common::File &out) {
-	uint16 size = in.readUint16LE();
-	uint16 outSize = in.readUint16LE();
-	uint32 id = in.readUint32LE();
-	byte *inputBuffer, *outputBuffer;
-	int bytesRead = 0;
-
-	int16 curSample;
-	uint8 code;
-	int8 count;
-	uint16 input;
-	int i, j;
-
-	uint16 remaining;
-
-	const int8 WSTable2Bit[] = { -2, -1, 0, 1 };
-	const int8 WSTable4Bit[] = {
-		-9, -8, -6, -5, -4, -3, -2, -1,
-		 0,  1,  2,  3,  4,  5,  6,  8
-	};
-
-	assert(id == 0x0000DEAF);
-
-	bytesRead += (8 + size);
-
-	outputBuffer = (byte *)malloc(outSize);
-	assert(outputBuffer);
-
-	if (size == outSize) {
-		int readSize = size;
-		while (readSize > 0) {
-			int read = in.read_noThrow(outputBuffer, readSize);
-			if (read <= 0)
-				error("[1] Couldn't read data");
-			readSize -= read;
-		}
-		while (size > 0)  {
-			int written = out.write(outputBuffer, size);
-			size -= written;
-		}
-		free(outputBuffer);
-		return bytesRead;
-	}
-
-	inputBuffer = (byte *)malloc(size);
-	assert(inputBuffer);
-
-	int readSize = size;
-	while (readSize > 0) {
-		int read = in.read_noThrow(inputBuffer, readSize);
-		if (read <= 0)
-			error("[2] Couldn't read data");
-		readSize -= read;
-	}
-
-	curSample = 0x80;
-	i = 0;
-	j = 0;
-
-	remaining = outSize;
-
-	while (remaining > 0) {
-		input = inputBuffer[i++] << 2;
-		code = (input >> 8) & 0xff;
-		count = (input & 0xff) >> 2;
-
-		switch (code) {
-		case 2:
-			if (count & 0x20) {
-				/* NOTE: count is signed! */
-				count <<= 3;
-				curSample += (count >> 3);
-				outputBuffer[j++] = (byte)curSample;
-				remaining--;
-			} else {
-				for (; count >= 0; count--) {
-					outputBuffer[j++] = inputBuffer[i++];
-					remaining--;
-				}
-				curSample = inputBuffer[i - 1];
-			}
-			break;
-		case 1:
-			for (; count >= 0; count--) {
-				code = inputBuffer[i++];
-
-				curSample += WSTable4Bit[code & 0x0f];
-				curSample = clip8BitSample(curSample);
-				outputBuffer[j++] = (byte)curSample;
-
-				curSample += WSTable4Bit[code >> 4];
-				curSample = clip8BitSample(curSample);
-				outputBuffer[j++] = (byte)curSample;
-
-				remaining -= 2;
-			}
-			break;
-		case 0:
-			for (; count >= 0; count--) {
-				code = inputBuffer[i++];
-
-				curSample += WSTable2Bit[code & 0x03];
-				curSample = clip8BitSample(curSample);
-				outputBuffer[j++] = (byte)curSample;
-
-				curSample += WSTable2Bit[(code >> 2) & 0x03];
-				curSample = clip8BitSample(curSample);
-				outputBuffer[j++] = (byte)curSample;
-
-				curSample += WSTable2Bit[(code >> 4) & 0x03];
-				curSample = clip8BitSample(curSample);
-				outputBuffer[j++] = (byte)curSample;
-
-				curSample += WSTable2Bit[(code >> 6) & 0x03];
-				curSample = clip8BitSample(curSample);
-				outputBuffer[j++] = (byte)curSample;
-
-				remaining -= 4;
-			}
-			break;
-		default:
-			for (; count >= 0; count--) {
-				outputBuffer[j++] = (byte)curSample;
-				remaining--;
-			}
-		}
-	}
-
-	while (outSize > 0)  {
-		int written = out.write(outputBuffer, outSize);
-		if (written <= 0)
-			error("[2] Couldn't write data");
-		outSize -= written;
-	}
-
-	free(inputBuffer);
-	free(outputBuffer);
-
-	return bytesRead;
-}
-
-typedef struct {
-	uint16 freq;
-	uint32 size;
-	byte flags;
-	byte type;
-} AUDHeader;
-
-void CompressKyra::compressAUDFile(Common::File &input, const char *outfile) {
-	AUDHeader header;
-
-	header.freq = input.readUint16LE();
-	header.size = input.readUint32LE();
-	header.flags = input.readByte();
-	header.type = input.readByte();
-	//print("%d Hz, %d bytes, type %d (%08X)\n", header.freq, header.size, header.type, header.flags);
-
-	Common::File output(TEMP_RAW, "wb");
-
-	uint32 remaining = header.size;
-	while (remaining > 0)
-		remaining -= decodeChunk(input, output);
-
-	encodeAudio(TEMP_RAW, true, header.freq, outfile, _format);
-
-	unlink(TEMP_RAW);
-}
-
-struct CompressKyra::DuplicatedFile {
-	uint32 resFilename;
-	uint32 resOffset;
-};
-
-const CompressKyra::DuplicatedFile *CompressKyra::findDuplicatedFile(uint32 resOffset, const DuplicatedFile *list, const uint32 maxEntries) {
-	for (uint32 i = 0; i < maxEntries; ++i) {
-		if (list[i].resOffset == resOffset && list[i].resOffset != 0)
-			return &list[i];
-	}
-
-	return 0;
-}
-
-void CompressKyra::processKyra3(Common::Filename *infile, Common::Filename *outfile) {
-	if (infile->hasExtension("AUD")) {
-		outfile->setExtension(audio_extensions(_format));
-
-		Common::File input(*infile, "rb");
-
-		compressAUDFile(input, outfile->getFullPath().c_str());
-	} else if (infile->hasExtension("TLK")) {
-		PAKFile output;
-
-		Common::File input(*infile, "rb");
-
-		if (!output.loadFile(NULL, false))
-			return;
-
-		uint16 files = input.readUint16LE();
-		DuplicatedFile *red = new DuplicatedFile[files];
-		memset(red, 0, sizeof(DuplicatedFile)*files);
-
-		for (uint16 i = 0; i < files; ++i) {
-			uint32 resFilename = input.readUint32LE();
-			uint32 resOffset = input.readUint32LE();
-
-			char outname[16];
-			snprintf(outname, 16, "%.08u%s", resFilename, audio_extensions(_format));
-
-			const DuplicatedFile *file = findDuplicatedFile(resOffset, red, files);
-			if (file) {
-				char linkname[16];
-				snprintf(linkname, 16, "%.08u%s", file->resFilename, audio_extensions(_format));
-
-				output.linkFiles(outname, linkname);
-			} else {
-				red[i].resFilename = resFilename;
-				red[i].resOffset = resOffset;
-
-				uint32 pos = (uint32)input.pos();
-				input.seek(resOffset + 4, SEEK_SET);
-
-				compressAUDFile(input, outname);
-
-				output.addFile(outname, outname);
-
-				unlink(outname);
-
-				input.seek(pos, SEEK_SET);
-			}
-		}
-
-		delete[] red;
-
-		if (output.getFileList())
-			output.saveFile(outfile->getFullPath().c_str());
-	} else {
-		error("Unsupported file '%s'", infile->getFullPath().c_str());
-	}
-}
-
-bool CompressKyra::detectKyra3File(Common::Filename *infile) {
-	if (infile->hasExtension("AUD")) {
-		return true;
-	} else if (infile->hasExtension("VRM") || infile->hasExtension("PAK")) {
-		if (!PAKFile::isPakFile(infile->getFullPath().c_str()))
-			error("Unknown filetype of file: '%s'", infile->getFullPath().c_str());
-		return false;
-	} else if (infile->hasExtension("TLK")) {
-		if (PAKFile::isPakFile(infile->getFullPath().c_str()))
-			return false;
-
-		Common::File f(*infile, "rb");
-
-		uint16 entries = f.readUint16LE();
-		uint32 entryTableSize = (entries * 8);
-		const uint32 filesize = f.size();
-
-		if (entryTableSize + 2 > filesize) {
-			error("Unknown filetype of file: '%s'", infile->getFullPath().c_str());
-		}
-
-		uint32 offset = 0;
-		for (uint16 i = 0; i < entries; ++i) {
-			f.readUint32LE();
-			offset = f.readUint32LE();
-
-			if (offset > filesize)
-				error("Unknown filetype of file: '%s'", infile->getFullPath().c_str());
-		}
-
-		return true;
-	}
-
-	error("Unknown filetype of file: '%s'", infile->getFullPath().c_str());
-
-	// Never reached
-	return false;
-}
-
-#ifdef STANDALONE_MAIN
-int main(int argc, char *argv[]) {
-	return export_main(compress_kyra)(argc, argv);
-}
-#endif
-

Deleted: tools/branches/gsoc2009-gui/compress_kyra.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_kyra.h	2009-12-26 13:35:57 UTC (rev 46581)
+++ tools/branches/gsoc2009-gui/compress_kyra.h	2009-12-26 13:37:48 UTC (rev 46582)
@@ -1,48 +0,0 @@
-/* compress_kyra_bun - compressor for kyra sound file packages
- * Copyright (C) 2006  The ScummVM Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef COMPRESS_KYRA_H
-#define COMPRESS_KYRA_H
-
-#include "compress.h"
-
-class CompressKyra : public CompressionTool {
-public:
-	CompressKyra(const std::string &name = "compress_kyra");
-
-	virtual void execute();
-
-	virtual InspectionMatch inspectInput(const Common::Filename &filename);
-
-protected:
-	struct DuplicatedFile;
-
-	uint16 clip8BitSample(int16 sample);
-	int decodeChunk(Common::File &in, Common::File &out);
-	void compressAUDFile(Common::File &input, const char *outfile);
-	const DuplicatedFile *findDuplicatedFile(uint32 resOffset, const DuplicatedFile *list, const uint32 maxEntries);
-	void process(Common::Filename *infile, Common::Filename *output);
-	void processKyra3(Common::Filename *infile, Common::Filename *output);
-	bool detectKyra3File(Common::Filename *infile);
-};
-
-#endif

Deleted: tools/branches/gsoc2009-gui/compress_queen.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_queen.cpp	2009-12-26 13:35:57 UTC (rev 46581)
+++ tools/branches/gsoc2009-gui/compress_queen.cpp	2009-12-26 13:37:48 UTC (rev 46582)
@@ -1,330 +0,0 @@
-/* compress_queen - Rebuild QUEEN.1 file to contain Resource Table (and optionally compress sound & speech)
- * Copyright (C) 2009  The ScummVM Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include <cstring>
-
-#include "compress.h"
-
-#include "compress_queen.h"
-
-const uint32 QTBL = 'QTBL';
-
-#define INPUT_TBL	"queen.tbl"
-#define FINAL_OUT	"queen.1c"
-
-#define TEMP_DAT	"tempfile.dat"
-#define TEMP_TBL	"tempfile.tbl"
-#define TEMP_SB		"tempfile.sb"
-
-#define CURRENT_TBL_VERSION	2
-#define EXTRA_TBL_HEADER 8
-#define SB_HEADER_SIZE_V104 110
-#define SB_HEADER_SIZE_V110 122
-
-enum {
-	VER_ENG_FLOPPY     = 0,
-	VER_ENG_TALKIE     = 1,
-	VER_FRE_FLOPPY     = 2,
-	VER_FRE_TALKIE     = 3,
-	VER_GER_FLOPPY     = 4,
-	VER_GER_TALKIE     = 5,
-	VER_ITA_FLOPPY     = 6,
-	VER_ITA_TALKIE     = 7,
-	VER_SPA_TALKIE     = 8,
-	VER_HEB_TALKIE     = 9,
-	VER_DEMO_PCGAMES   = 10,
-	VER_DEMO           = 11,
-	VER_INTERVIEW      = 12,
-	VER_AMI_ENG_FLOPPY = 13,
-	VER_AMI_DEMO       = 14,
-	VER_AMI_INTERVIEW  = 15,
-
-	VER_PC_COUNT       = 13 /* PC versions */
-};
-
-struct PatchFile {
-	const char *filename;
-	char lang;
-};
-
-const struct CompressQueen::GameVersion gameVersions[] = {
-	{ "PEM10", 1, 0, 0x00000008,  22677657 },
-	{ "CEM10", 0, 0, 0x0000584E, 190787021 },
-	{ "PFM10", 1, 0, 0x0002CD93,  22157304 },
-	{ "CFM10", 0, 0, 0x00032585, 186689095 },
-	{ "PGM10", 1, 0, 0x00059ACA,  22240013 },
-	{ "CGM10", 0, 0, 0x0005F2A7, 217648975 },
-	{ "PIM10", 1, 0, 0x000866B1,  22461366 },
-	{ "CIM10", 0, 0, 0x0008BEE2, 190795582 },
-	{ "CSM10", 0, 0, 0x000B343C, 190730602 },
-	{ "CHM10", 0, 0, 0x000DA981, 190705558 },
-	{ "PE100", 1, 1, 0x00101EC6,   3724538 },
-	{ "PE100", 1, 1, 0x00102B7F,   3732177 },
-	{ "PEint", 1, 1, 0x00103838,   1915913 },
-	{ "aEM10", 1, 0, 0x00103F1E,    351775 },
-	{ "CE101", 1, 1, 0x00107D8D,    563335 },
-	{ "PE100", 1, 1, 0x001086D4,    597032 }
-};
-
-const struct PatchFile patchFiles[] = {
-	{ "CHIEF1.DOG", 'F' },
-	{ "CHIEF2.DOG", 'F' },
-	{ "BUD1.DOG",   'I' }
-};
-
-CompressQueen::CompressQueen(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
-	_supportsProgressBar = true;
-	
-	ToolInput input;
-	input.format = "queen.1";
-	_inputPaths.push_back(input);
-
-	_shorthelp = "Used to compress Flight of the Amazon Queen data files. Output filename is " + std::string(FINAL_OUT) + " .";
-	_helptext = "\nUsage: " + getName() + " [mode] [mode params] [-o outputdir] <inputfile (queen.1)>\n\t" + _shorthelp + "\n";
-}
-
-const CompressQueen::GameVersion *CompressQueen::detectGameVersion(uint32 size) {
-	const struct GameVersion *pgv = gameVersions;
-	int i;
-
-	/* Compressing/rebuiling an Amiga version is not supported */
-	for (i = 0; i < VER_PC_COUNT; ++i, ++pgv) {
-		if (pgv->dataFileSize == size) {
-			return pgv;
-		}
- 	}
-
-	error("Unknown/unsupported FOTAQ version");
-
-	return NULL;
-}
-
-void CompressQueen::fromFileToFile(Common::File &in, Common::File &out, uint32 amount) {
-	char fBuf[2048];
-	uint32 numRead;
-
-	while (amount > 0) {
-		numRead = in.read_noThrow(fBuf, amount > 2048 ? 2048 : amount);
-		if (numRead <= 0) {
-			break;
-		}
-
-		amount -= numRead;
-		out.write(fBuf, numRead);
-	}
-}
-
-void CompressQueen::createFinalFile(Common::Filename outPath) {
-	int i;
-	uint32 dataStartOffset;
-	uint32 dataSize;
-
-	outPath.setFullName(FINAL_OUT);
-
-	Common::File inTbl(TEMP_TBL, "rb");
-	Common::File inData(TEMP_DAT, "rb");
-	Common::File outFinal(outPath, "wb");
-
-	dataStartOffset = inTbl.size() + EXTRA_TBL_HEADER;
-	dataSize = inData.size();
-
-	inTbl.seek(7, SEEK_SET);	/* Skip past header */
-
-	/* Write new header */
-	outFinal.writeUint32BE(QTBL);
-	outFinal.write(_version->versionString, 6);
-	outFinal.writeByte(_version->isFloppy);
-	outFinal.writeByte(_version->isDemo);
-	outFinal.writeByte(_versionExtra.compression);
-	outFinal.writeUint16BE(_versionExtra.entries);
-
-	for (i = 0; i < _versionExtra.entries; i++) {
-		fromFileToFile(inTbl, outFinal, 12);
-		outFinal.writeByte(inTbl.readByte());
-		outFinal.writeUint32BE(dataStartOffset + inTbl.readUint32BE());
-		outFinal.writeUint32BE(inTbl.readUint32BE());
-	}
-
-	/* Append contents of temporary datafile to final datafile */
-	fromFileToFile(inData, outFinal, dataSize);
-
-	/* Cleanup */
-	unlink(TEMP_TBL);
-	unlink(TEMP_DAT);
-}
-
-void CompressQueen::execute() {
-	Common::File inputData, inputTbl, outputTbl, outputData, compFile;
-	char tmp[5];
-	int size, i = 1;
-	uint32 prevOffset;
-
-	Common::Filename inpath(_inputPaths[0].path);
-	Common::Filename &outpath = _outputPath;
-
-	if (outpath.empty())
-		outpath = inpath;
-
-	/* Open input file (QUEEN.1) */
-	inputData.open(inpath, "rb");
-
-	/* Open TBL file (QUEEN.TBL) */
-	inpath.setFullName(INPUT_TBL);
-	inputTbl.open(inpath, "rb");
-
-	size = inputData.size();
-	inputTbl.read_throwsOnError(tmp, 4);
-	tmp[4] = '\0';
-
-	if (memcmp(tmp, "QTBL", 4)) {
-		error("Invalid TBL file");
-	}
-
-	if (inputTbl.readUint32BE() != CURRENT_TBL_VERSION) {
-		error("You are using an incorrect (outdated?) version of the queen.tbl file");
-	}
-
-	_version = detectGameVersion(size);
-	inputTbl.seek(_version->tableOffset, SEEK_SET);
-
-	_versionExtra.compression = compression_format(_format);
-	_versionExtra.entries = inputTbl.readUint16BE();
-
-	outputTbl.open(TEMP_TBL, "wb");
-
-	outputData.open(TEMP_DAT, "wb");
-
-	/* Write tablefile header */
-	outputTbl.writeUint32BE(QTBL);
-	outputTbl.writeByte(_versionExtra.compression);
-	outputTbl.writeUint16BE(_versionExtra.entries);
-
-	for (i = 0; i < _versionExtra.entries; i++) {
-		/* Update progress */
-		updateProgress(i, _versionExtra.entries);
-
-		prevOffset = outputData.pos();
-
-		/* Read entry */
-		inputTbl.read_throwsOnError(_entry.filename, 12);
-		_entry.filename[12] = '\0';
-		_entry.bundle = inputTbl.readByte();
-		_entry.offset = inputTbl.readUint32BE();
-		_entry.size = inputTbl.readUint32BE();
-
-		print("Processing entry: %s\n", _entry.filename);
-		inputData.seek(_entry.offset, SEEK_SET);
-
-		if (_versionExtra.compression && strstr(_entry.filename, ".SB")) { /* Do we want to compress? */
-			uint16 sbVersion;
-			int headerSize;
-
-			/* Read in .SB */
-			Common::File tmpFile(TEMP_SB, "wb");
-			inputData.seek(_entry.offset, SEEK_SET);
-
-			inputData.seek(2, SEEK_CUR);
-			sbVersion = inputData.readUint16LE();
-
-			switch (sbVersion) {
-			case 104:
-				headerSize = SB_HEADER_SIZE_V104;
-				break;
-			case 110:
-				headerSize = SB_HEADER_SIZE_V110;
-				break;
-			default:
-				warning("Unhandled SB file version %d, defaulting to 104\n", sbVersion);
-				headerSize = SB_HEADER_SIZE_V104;
-				break;
-			}
-
-			inputData.seek(headerSize - 4, SEEK_CUR);
-			_entry.size -= headerSize;
-
-			fromFileToFile(inputData, tmpFile, _entry.size);
-			tmpFile.close();
-
-			/* Invoke encoder */
-			setRawAudioType(false, false, 8);
-			encodeAudio(TEMP_SB, true, 11840, tempEncoded, _format);
-
-			/* Append MP3/OGG to data file */
-			compFile.open(tempEncoded, "rb");
-			_entry.size = compFile.size();
-			fromFileToFile(compFile, outputData, _entry.size);
-			compFile.close();
-
-			/* Delete temporary files */
-			unlink(TEMP_SB);
-			unlink(tempEncoded);
-		} else {
-			/* Non .SB file */
-			bool patched = false;
-			/* Check for external files */
-
-			uint8 j;
-			for (j = 0; j < ARRAYSIZE(patchFiles); ++j) {
-				const struct PatchFile *pf = &patchFiles[j];
-
-				if (_version->versionString[1] == pf->lang && strcmp(pf->filename, _entry.filename) == 0) {
-					/* XXX patched data files are supposed to be in cwd */
-					Common::File fpPatch(pf->filename, "rb");
-
-					if (fpPatch.isOpen()) {
-						_entry.size = fpPatch.size();
-						print("Patching entry, new size = %d bytes\n", _entry.size);
-						fromFileToFile(fpPatch, outputData, _entry.size);
-						fpPatch.close();
-						patched = true;
-					}
-
-					break;
-				}
-			}
-
-			if (!patched) {
-				fromFileToFile(inputData, outputData, _entry.size);
-			}
-		}
-
-		/* Write entry to table */
-		outputTbl.write(_entry.filename, 12);
-		outputTbl.writeByte(_entry.bundle);
-		outputTbl.writeUint32BE(prevOffset);
-		outputTbl.writeUint32BE(_entry.size);
-	}
-
-	outputTbl.close();
-	outputData.close();
-
-	/* Merge the temporary table and temporary datafile to create final file */
-	createFinalFile(outpath);
-}
-
-#ifdef STANDALONE_MAIN
-int main(int argc, char *argv[]) {
-	CompressQueen queen(argv[0]);
-	return queen.run(argc, argv);
-}
-#endif
-

Deleted: tools/branches/gsoc2009-gui/compress_queen.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_queen.h	2009-12-26 13:35:57 UTC (rev 46581)
+++ tools/branches/gsoc2009-gui/compress_queen.h	2009-12-26 13:37:48 UTC (rev 46582)
@@ -1,65 +0,0 @@
-/* compress_queen - Rebuild QUEEN.1 file to contain Resource Table (and optionally compress sound & speech)
- * Copyright (C) 2009  The ScummVM Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef COMPRESS_QUEEN_H
-#define COMPRESS_QUEEN_H
-
-#include "compress.h"
-
-class CompressQueen : public CompressionTool {
-public:
-	CompressQueen(const std::string &name = "compress_queen");
-
-	virtual void execute();
-
-	// Keeping structs here avoids name-clashes with other tools
-	struct GameVersion {
-		char versionString[6];
-		uint8 isFloppy;
-		uint8 isDemo;
-		uint32 tableOffset;
-		uint32 dataFileSize;
-	};
-
-	struct Entry {
-		char filename[13];
-		uint8 bundle;
-		uint32 offset;
-		uint32 size;
-	};
-
-	struct VersionExtra {
-		uint8	compression;
-		uint16	entries;
-	};
-
-protected:
-	Entry _entry;
-	VersionExtra _versionExtra;
-	const GameVersion *_version;
-
-	void createFinalFile(Common::Filename outPath);
-	void fromFileToFile(Common::File &in, Common::File &out, uint32 amount);
-	const GameVersion *detectGameVersion(uint32 size);
-};
-
-#endif

Deleted: tools/branches/gsoc2009-gui/compress_saga.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_saga.cpp	2009-12-26 13:35:57 UTC (rev 46581)
+++ tools/branches/gsoc2009-gui/compress_saga.cpp	2009-12-26 13:37:48 UTC (rev 46582)
@@ -1,459 +0,0 @@
-/* compress_saga - Compress SAGA engine digital sound files into
- * MP3 and Ogg Vorbis format
- * Copyright (C) 2004, Marcoen Hirschberg
- * Copyright (C) 2004-2006  The ScummVM Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include <cstdlib>
-
-#include "compress.h"
-#include "compress_saga.h"
-#include "common/md5.h"
-#include "common/file.h"
-#include "common/util.h"
-#include "utils/audiostream.h"
-#include "utils/voc.h"
-#include "utils/wave.h"
-#include "utils/adpcm.h"
-
-#define FILE_MD5_BYTES 5000
-#define RSC_TABLEINFO_SIZE 8
-#define RSC_TABLEENTRY_SIZE 8
-#define HEADER_SIZE 9
-
-// Known ITE files
-static CompressSaga::GameFileDescription ITE_GameFiles[] = {
-	//	Common::Filename					swapEndian	md5									resourceType	frequency	stereo
-	{"sounds.rsc",					false,		"e2ccb61c325d6d1ead3be0e731fe29fe", kSoundPCM,		22050,		false},	// PC CD/disk
-	{"sounds.rsc",					true,		"95863b89a0916941f6c5e1789843ba14", kSoundPCM,		22050,		false},	// Mac
-	{"soundsd.rsc",					false,		"95a6c148e22e99a8c243f2978223583c", kSoundPCM,		22050,		false},	// New PC demos
-	{"soundsd.rsc",					true,		"b3a831fbed337d1f1300fee1dd474f6c", kSoundPCM,		22050,		false},	// Mac demos
-	// Unsupported (8 bit unsigned sound) - used in the early ITE Win32 demo
-	//{"soundsd.rsc",				false,		"a741139dd7365a13f463cd896ff9969a", kSoundPCM,		22050,		false},	// Old Win32 demo
-	{"ite sounds.bin",				true,		"441426c6bb2a517f65c7e49b57f7a345", kSoundMacPCM,	22050,		false}, // MacBinary
-
-	{"music.rsc",					false,		"d6454756517f042f01210458abe8edd4", kSoundPCM,		11025,		true},	// PC CD/disk with digital music
-	{"music.rsc",					true,		"1a91cd60169f367ecb6c6e058d899b2f", kSoundPCM,		11025,		true},	// Mac
-	{"musicd.rsc",					true,		"d6454756517f042f01210458abe8edd4", kSoundPCM,		11025,		true},	// New PC demos
-	{"musicd.rsc",					true,		"495bdde51fd9f4bea2b9c911091b1ab2", kSoundPCM,		11025,		false},	// New Mac demo
-	{"musicd.rsc",					true,		"1a91cd60169f367ecb6c6e058d899b2f", kSoundPCM,		11025,		true},	// Old Mac demo
-	{"ite music.bin",				true,		"441426c6bb2a517f65c7e49b57f7a345", kSoundMacPCM,	22050,		false}, // MacBinary
-
-	{"inherit the earth voices",	true,		"c14c4c995e7a0d3828e3812a494301b7", kSoundPCM,		22050,		false},	// Mac
-	{"voices.rsc",					false,		"41bb6b95d792dde5196bdb78740895a6", kSoundPCM,		22050,		false},	// CD
-	{"voices.rsc",					false,		"2fbad5d10b9b60a3415dc4aebbb11718", kSoundPCM,		22050,		false},	// German CD
-	{"voices.rsc",					false,		"c46e4392fcd2e89bc91e5567db33b62d", kSoundVOC,		-1,			false},	// Disk
-	{"voices.rsc",					false,		"0c9113e630f97ef0996b8c3114badb08", kSoundVOC,		-1,			false},	// German disk
-	{"voices.rsc",					false,		"c58e67c506af4ffa03fd0aac2079deb0", kSoundVOC,		-1,			false},	// Early DOS demo
-	{"voicesd.rsc",					false,		"e139d86bab2ee8ba3157337f894a92d4", kSoundVOX,		22050,		false},	// New PC demos and all Mac demos
-	// Unsupported (8 bit unsigned sound) - used in the early ITE Win32 demo
-	//{"voicesd.rsc",				false,		"0759eaf5b64ae19fd429920a70151ad3", kSoundPCM,		22050,		false},	// Old Win32 demo
-	{"ite voices.bin",				true,		"dba92ae7d57e942250fe135609708369", kSoundMacPCM,	22050,		false}	// MacBinary
-	// TODO: Add known Amiga files
-};
-
-// Known IHNM files
-static CompressSaga::GameFileDescription IHNM_GameFiles[] = {
-	//	Common::Filename					swapEndian	md5									resourceType	frequency	stereo
-	// FIXME: sfx.res is disabled for now, as there are issues when trying to encode it
-	//{"sfx.res",					false,		"1c610d543f32ec8b525e3f652536f269", kSoundWAV,		-1,			false},
-	{"voicess.res",					false,		"-1", 								kSoundWAV,		-1,			false},
-	{"voices1.res",					false,		"-1", 								kSoundWAV,		-1,			false},
-	{"voices2.res",					false,		"-1", 								kSoundWAV,		-1,			false},
-	{"voices3.res",					false,		"-1", 								kSoundWAV,		-1,			false},
-	{"voices4.res",					false,		"-1", 								kSoundWAV,		-1,			false},
-	{"voices5.res",					false,		"-1", 								kSoundWAV,		-1,			false},
-	{"voices6.res",					false,		"-1", 								kSoundWAV,		-1,			false},
-	// Demo
-	{"voicesd.res",					false,		"-1",								kSoundWAV,		-1,			false},
-};
-
-// --------------------------------------------------------------------------------
-
-static CompressSaga::GameDescription gameDescriptions[] = {
-	// Inherit the earth
-	{
-		GType_ITE,
-		ARRAYSIZE(ITE_GameFiles),
-		ITE_GameFiles,
-	},
-
-	// I Have No Mouth And I Must Scream
-	{
-		GType_IHNM,
-		ARRAYSIZE(IHNM_GameFiles),
-		IHNM_GameFiles,
-	},
-
-};
-
-typedef struct  {
-	uint32 offset;
-	uint32 size;
-} Record;
-
-// Constructor
-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
-	input.format = "*.*";
-	_inputPaths.push_back(input);
-
-	_shorthelp = "Used to compress SAGA engine games such as Inherit the Earth and I Have no Mouth.";
-	_helptext = "\nUsage: " + getName() +" [mode] [mode params] [-o outputfile = infile.cmp] <inputfile>\n";
-}
-
-InspectionMatch CompressSaga::inspectInput(const Common::Filename &filename) {
-	if (detectFile(&filename))
-		return IMATCH_PERFECT;
-	return IMATCH_AWFUL;
-}
-
-// --------------------------------------------------------------------------------
-
-bool CompressSaga::detectFile(const Common::Filename *infile) {
-	int gamesCount = ARRAYSIZE(gameDescriptions);
-	int i, j;
-	uint8 md5sum[16];
-	char md5str[32+1];
-
-	Common::md5_file(infile->getFullPath().c_str(), md5sum, FILE_MD5_BYTES);
-	print("Input file name: %s\n", infile->getFullPath().c_str());
-	for (j = 0; j < 16; j++) {
-		sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
-	}
-	print("md5: %s\n", md5str);
-
-	for (i = 0; i < gamesCount; i++) {
-		for (j = 0; j < gameDescriptions[i].filesCount; j++) {
-			if (i == 0) {		// ITE
-				// MD5 based detection, needed to distinguish the different file encodings
-				// of the ITE sound files
-				if (strcmp(gameDescriptions[i].filesDescriptions[j].md5, md5str) == 0) {
-					_currentGameDescription = &gameDescriptions[i];
-					_currentFileDescription = &_currentGameDescription->filesDescriptions[j];
-
-					print("Matched game: Inherit the Earth: Quest for the Orb\n");
-					return true;
-				}
-			} else {			// IHNM
-				// Common::Filename based detection, used in IHNM, as all its sound files have the
-				// same encoding
-
-				if (scumm_stricmp(gameDescriptions[i].filesDescriptions[j].fileName, infile->getFullName().c_str()) == 0) {
-					_currentGameDescription = &gameDescriptions[i];
-					_currentFileDescription = &_currentGameDescription->filesDescriptions[j];
-
-					print("Matched game: I Have No Mouth, and I Must Scream\n");
-					return true;
-				}
-			}
-		}
-	}
-	print("Unsupported file\n");
-	return false;
-}
-
-uint32 CompressSaga::copyFile(const char *fromFileName, Common::File &outputFile) {
-	size_t size;
-	char fbuf[2048];
-	Common::File tempf(fromFileName, "rb");
-
-	if (!tempf.isOpen())
-		error("Unable to open %s", fromFileName);
-
-	while ((size = tempf.read_noThrow(fbuf, sizeof(fbuf))) > 0) {
-		outputFile.write(fbuf, size);
-	}
-	size = tempf.pos();
-	return size;
-}
-
-void CompressSaga::copyFile(Common::File &inputFile, uint32 inputSize, const char *toFileName) {
-	size_t size;
-	char fbuf[2048];
-	Common::File tempf(toFileName, "wb");
-
-	if (!tempf.isOpen())
-		error("Unable to open %s", toFileName);
-	while (inputSize > 0) {
-		size = inputFile.read_noThrow(fbuf, inputSize > sizeof(fbuf) ? sizeof(fbuf) : inputSize);
-		if (size == 0) {
-			error("Unable to copy file");
-		}
-		tempf.write(fbuf, size);
-		inputSize -= size;
-	}
-}
-
-void CompressSaga::writeBufferToFile(uint8 *data, uint32 inputSize, const char *toFileName) {
-	Common::File tempf(toFileName, "wb");
-	if (!tempf.isOpen())
-		error("Unable to open %s", toFileName);
-	tempf.write(data, inputSize);
-}
-
-byte CompressSaga::compression_format(AudioFormat format) {
-	switch(format) {
-	case AUDIO_MP3:
-		return 0;
-	case AUDIO_VORBIS:
-		return 1;
-	case AUDIO_FLAC:
-		return 2;
-	case AUDIO_NONE:
-	default:
-		throw ToolException("Unknown compression format");
-	}
-}
-
-void CompressSaga::writeHeader(Common::File &outputFile) {
-	outputFile.writeByte(compression_format(_format));
-	outputFile.writeUint16LE(_sampleRate);
-	outputFile.writeUint32LE(_sampleSize);
-	outputFile.writeByte(_sampleBits);
-	outputFile.writeByte(_sampleStereo);
-}
-
-uint32 CompressSaga::encodeEntry(Common::File &inputFile, uint32 inputSize, Common::File &outputFile) {
-	uint8 *inputData = 0;
-	byte *buffer = 0;
-	int rate, size;
-	byte flags;
-
-	if (_currentFileDescription->resourceType == kSoundVOC) {
-		inputData = Audio::loadVOCFromStream(inputFile, size, rate);
-
-		_sampleSize = size;
-		_sampleRate = rate;
-		_sampleBits = 8;
-		_sampleStereo = 0;
-		writeHeader(outputFile);
-
-		writeBufferToFile(inputData, _sampleSize, TEMP_RAW);
-		free(inputData);
-
-		setRawAudioType( true, false, 8);
-		encodeAudio(TEMP_RAW, true, _sampleRate, tempEncoded, _format);
-		return copyFile(tempEncoded, outputFile) + HEADER_SIZE;
-	}
-	if (_currentFileDescription->resourceType == kSoundPCM) {
-		_sampleSize = inputSize;
-		_sampleRate = (uint16)_currentFileDescription->frequency;
-		_sampleBits = 16;
-		_sampleStereo = _currentFileDescription->stereo;
-		writeHeader(outputFile);
-
-		copyFile(inputFile, inputSize, TEMP_RAW);
-
-		setRawAudioType( !_currentFileDescription->swapEndian, _sampleStereo != 0, _sampleBits);
-		encodeAudio(TEMP_RAW, true, _sampleRate, tempEncoded, _format);
-		return copyFile(tempEncoded, outputFile) + HEADER_SIZE;
-	}
-	if (_currentFileDescription->resourceType == kSoundWAV) {
-		if (!Audio::loadWAVFromStream(inputFile, size, rate, flags))
-			error("Unable to read WAV");
-
-		_sampleSize = size;
-		_sampleRate = rate;
-		_sampleBits = ((flags & Audio::Mixer::FLAG_16BITS) != 0) ? 16 : 8;
-		_sampleStereo = ((flags & Audio::Mixer::FLAG_STEREO) != 0);
-		writeHeader(outputFile);
-
-		copyFile(inputFile, size, TEMP_RAW);
-
-		setRawAudioType( true, _sampleStereo != 0, _sampleBits);
-		encodeAudio(TEMP_RAW, true, _sampleRate, tempEncoded, _format);
-		return copyFile(tempEncoded, outputFile) + HEADER_SIZE;
-	}
-	if (_currentFileDescription->resourceType == kSoundVOX) {
-		_sampleSize = inputSize * 4;
-		_sampleRate = (uint16)_currentFileDescription->frequency;
-		_sampleBits = 16;
-		_sampleStereo = _currentFileDescription->stereo;
-		writeHeader(outputFile);
-
-		Audio::AudioStream *voxStream = Audio::makeADPCMStream(&inputFile, inputSize, Audio::kADPCMOki);
-		buffer = (byte *)malloc(_sampleSize);
-		uint32 voxSize = voxStream->readBuffer((int16*)buffer, inputSize * 2);
-		if (voxSize != inputSize * 2)
-			error("Wrong VOX output size");
-		writeBufferToFile((uint8 *)buffer, _sampleSize, TEMP_RAW);
-		free(buffer);
-
-		setRawAudioType( !_currentFileDescription->swapEndian, _sampleStereo != 0, _sampleBits);
-		encodeAudio(TEMP_RAW, true, _sampleRate, tempEncoded, _format);
-		return copyFile(tempEncoded, outputFile) + HEADER_SIZE;
-	}
-	if (_currentFileDescription->resourceType == kSoundMacPCM) {
-		error("MacBinary files are not supported yet");
-		// TODO
-		// Note: MacBinary files are unsigned. With the pending changes to setRawAudioType, there will need
-		// to be some changes here
-		/*
-		copyFile(inputFile, inputSize, TEMP_RAW);
-		_sampleSize = inputSize - 36;
-		_sampleRate = (uint16)currentFileDescription->frequency;
-		// The MAC CD Guild version has 8 bit sound, whereas the other versions have 16 bit sound
-		_sampleBits = 8;
-		_sampleStereo = currentFileDescription->stereo;
-		writeHeader(outputFile);
-
-		setRawAudioType( !currentFileDescription->swapEndian, currentFileDescription->stereo, _sampleBits);
-		encodeAudio(TEMP_RAW, true, currentFileDescription->frequency, tempEncoded, gCompMode);
-		return copyFile(tempEncoded, outputFile) + HEADER_SIZE;
-		*/
-	}
-
-	error("Unsupported resourceType %ul\n", _currentFileDescription->resourceType);
-	// Never reached
-	return 0;
-}
-
-void CompressSaga::sagaEncode(Common::Filename *inpath, Common::Filename *outpath) {
-	Common::File inputFile;
-	Common::File outputFile;
-	uint32 inputFileSize;
-	uint32 resTableOffset;
-	uint32 resTableCount;
-	uint32 i;
-
-	Record *inputTable;
-	Record *outputTable;
-
-	inputFile.open(*inpath, "rb");
-	inputFileSize = inputFile.size();
-	print("Filesize: %ul\n", inputFileSize);
-	/*
-	 * At the end of the resource file there are 2 values: one points to the
-	 * beginning of the resource table the other gives the number of
-	 * records in the table
-	 */
-	inputFile.seek(inputFileSize - RSC_TABLEINFO_SIZE, SEEK_SET);
-
-	if (!_currentFileDescription->swapEndian) {
-		resTableOffset = inputFile.readUint32LE();
-		resTableCount = inputFile.readUint32LE();
-	} else {
-		resTableOffset = inputFile.readUint32BE();
-		resTableCount = inputFile.readUint32BE();
-	}
-
-	print("Table offset: %ul\nnumber of records: %ul\n", resTableOffset, resTableCount);
-	if (resTableOffset != inputFileSize - RSC_TABLEINFO_SIZE - RSC_TABLEENTRY_SIZE * resTableCount) {
-		error("Something's wrong with your resource file");
-	}
-
-	// Go to beginning of the table
-	inputFile.seek(resTableOffset, SEEK_SET);
-
-	inputTable = (Record*)malloc(resTableCount * sizeof(Record));
-
-	// Put offsets of all the records in a table
-	for (i = 0; i < resTableCount; i++) {
-
-		if (!_currentFileDescription->swapEndian) {
-			inputTable[i].offset = inputFile.readUint32LE();
-			inputTable[i].size = inputFile.readUint32LE();
-		} else {
-			inputTable[i].offset = inputFile.readUint32BE();
-			inputTable[i].size = inputFile.readUint32BE();
-		}
-
-		print("Record: %ul, offset: %ul, size: %ul\n", i, inputTable[i].offset, inputTable[i].size);
-
-		if ((inputTable[i].offset > inputFileSize) ||
-			(inputTable[i].offset + inputTable[i].size > inputFileSize)) {
-			error("The offset points outside the file");
-		}
-
-	}
-	outputTable = (Record*)malloc(resTableCount * sizeof(Record));
-
-	if (outpath->empty()) {
-		*outpath = *inpath;
-		outpath->setExtension(".cmp");
-	}
-	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();
-
-		if (inputTable[i].size >= 8) {
-			outputTable[i].size = encodeEntry(inputFile, inputTable[i].size, outputFile);
-		} else {
-			outputTable[i].size = inputTable[i].size;	// Empty sound resource
-		}
-	}
-	inputFile.close();
-
-	resTableOffset = outputFile.pos();
-	for (i = 0; i < resTableCount; i++) {
-		outputFile.writeUint32LE(outputTable[i].offset);
-		outputFile.writeUint32LE(outputTable[i].size);
-	}
-	outputFile.writeUint32LE(resTableOffset);
-	outputFile.writeUint32LE(resTableCount);	// Should be the same number of entries
-
-	outputFile.close();
-
-	free(inputTable);
-	free(outputTable);
-
-	// Cleanup
-	unlink(TEMP_RAW);
-	unlink(tempEncoded);
-
-	print("Done!\n");
-}
-
-void CompressSaga::execute() {
-	Common::Filename inpath(_inputPaths[0].path);
-	Common::Filename &outpath = _outputPath;
-
-	if (outpath.directory()) {
-		outpath.setFullName(inpath.getName());
-		outpath.setExtension(".cmp");
-	}
-
-	if (detectFile(&inpath)) {
-		sagaEncode(&inpath, &outpath);
-	} else {
-		error("Failed to compress file %s", inpath.getFullPath().c_str());
-	}
-}
-
-#ifdef STANDALONE_MAIN
-int main(int argc, char *argv[]) {
-	CompressSaga saga(argv[0]);
-	return saga.run(argc, argv);
-}
-#endif
-

Deleted: tools/branches/gsoc2009-gui/compress_saga.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_saga.h	2009-12-26 13:35:57 UTC (rev 46581)
+++ tools/branches/gsoc2009-gui/compress_saga.h	2009-12-26 13:37:48 UTC (rev 46582)
@@ -1,89 +0,0 @@
-/* compress_saga - Compress SAGA engine digital sound files into
- * MP3 and Ogg Vorbis format
- * Copyright (C) 2004, Marcoen Hirschberg
- * Copyright (C) 2004-2006  The ScummVM Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef COMPRESS_SAGA_H
-#define COMPRESS_SAGA_H
-
-#include "compress.h"
-
-enum SAGAGameSoundTypes {
-	kSoundPCM = 0,
-	kSoundVOX = 1,
-	kSoundVOC = 2,
-	kSoundWAV = 3,
-	kSoundMacPCM = 4
-};
-
-enum SAGAGameType {
-	GType_ITE = 0,
-	GType_IHNM = 1
-};
-
-class CompressSaga : public CompressionTool {
-public:
-	CompressSaga(const std::string &name = "compress_saga");
-
-	virtual void execute();
-	
-	virtual InspectionMatch inspectInput(const Common::Filename &filename);
-
-	// Declarations should be inside the class to prevent linker errors
-
-	struct GameFileDescription {
-		const char *fileName;
-		bool swapEndian;
-		const char *md5;
-		SAGAGameSoundTypes resourceType;
-		long frequency;
-		bool stereo;
-	};
-
-	struct GameDescription {
-		SAGAGameType gameType;
-		int filesCount;
-		GameFileDescription *filesDescriptions;
-	};
-
-protected:
-
-	GameDescription *_currentGameDescription;
-	GameFileDescription *_currentFileDescription;
-
-	uint16 _sampleRate;
-	uint32 _sampleSize;
-	uint8 _sampleBits;
-	uint8 _sampleStereo;
-
-	bool detectFile(const Common::Filename *infile);
-	uint32 copyFile(const char *fromFileName, Common::File &outputFile);
-	void copyFile(Common::File &inputFile, uint32 inputSize, const char *toFileName);
-	void writeBufferToFile(uint8 *data, uint32 inputSize, const char *toFileName);
-	void writeHeader(Common::File &outputFile);
-	uint32 encodeEntry(Common::File &inputFile, uint32 inputSize, Common::File &outputFile);
-	void sagaEncode(Common::Filename *inpath, Common::Filename *outpath);
-
-	byte compression_format(AudioFormat format);
-};
-
-#endif

Deleted: tools/branches/gsoc2009-gui/compress_scumm_bun.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_bun.cpp	2009-12-26 13:35:57 UTC (rev 46581)
+++ tools/branches/gsoc2009-gui/compress_scumm_bun.cpp	2009-12-26 13:37:48 UTC (rev 46582)
@@ -1,1171 +0,0 @@
-/* compress_scumm_bun - compressor for bundle files
- * Copyright (C) 2004-2006  The ScummVM Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include <cassert>
-#include <cstdlib>
-#include <cstring>
-
-#include "compress_scumm_bun.h"
-#include "common/endian.h"
-
-/*
- * The "IMC" codec below (see cases 13 & 15 in decompressCodec) is actually a
- * variant of the IMA codec, see also
- *   <http://www.multimedia.cx/simpleaudio.html>
- *
- * It is somewhat different, though: the standard ADPCM codecs use a fixed
- * size for their data packets (4 bits), while the codec implemented here
- * varies the size of each "packet" between 2 and 7 bits.
- */
-
-static byte _imcTableEntryBitCount[89];
-
-static const int16 imcTable[89] = {
-		7,	  8,	9,	 10,   11,	 12,   13,	 14,
-	   16,	 17,   19,	 21,   23,	 25,   28,	 31,
-	   34,	 37,   41,	 45,   50,	 55,   60,	 66,
-	   73,	 80,   88,	 97,  107,	118,  130,	143,
-	  157,	173,  190,	209,  230,	253,  279,	307,
-	  337,	371,  408,	449,  494,	544,  598,	658,
-	  724,	796,  876,	963, 1060, 1166, 1282, 1411,
-	 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024,
-	 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484,
-	 7132, 7845, 8630, 9493,10442,11487,12635,13899,
-	15289,16818,18500,20350,22385,24623,27086,29794,
-	32767
-};
-
-static const byte imxOtherTable[6][64] = {
-	{
-		0xFF,
-		4
-	},
-
-	{
-		0xFF, 0xFF,
-		   2,    8
-	},
-
-	{
-		0xFF, 0xFF, 0xFF, 0xFF,
-		   1,    2,    4,    6
-	},
-
-	{
-		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-		   1,    2,    4,    6,    8,   12,   16,   32
-	},
-
-	{
-		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-		   1,    2,    4,    6,    8,   10,   12,   14,
-		  16,   18,   20,   22,   24,   26,   28,   32
-	},
-
-	{
-		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-		   1,    2,    3,    4,    5,    6,    7,    8,
-		   9,   10,   11,   12,   13,   14,   15,   16,
-		  17,   18,   19,   20,   21,   22,   23,   24,
-		  25,   26,   27,   28,   29,   30,   31,   32
-	}
-};
-
-void initializeImcTables() {
-	int pos;
-
-	for (pos = 0; pos < ARRAYSIZE(imcTable); ++pos) {
-		byte put = 0;
-		int32 tableValue = ((imcTable[pos] * 4) / 7) / 2;
-		while (tableValue != 0) {
-			tableValue /= 2;
-			put++;
-		}
-		if (put < 2) {
-			put = 2;
-		}
-		if (put > 7) {
-			put = 7;
-		}
-		_imcTableEntryBitCount[pos] = put;
-	}
-}
-
-#define NextBit                            \
-	do {                                   \
-		bit = mask & 1;                    \
-		mask >>= 1;                        \
-		if (!--bitsleft) {                 \
-			mask = READ_LE_UINT16(srcptr); \
-			srcptr += 2;                   \
-			bitsleft = 16;                 \
-		}                                  \
-	} while (0)
-
-int32 CompressScummBun::compDecode(byte *src, byte *dst) {
-	byte *result, *srcptr = src, *dstptr = dst;
-	int data, size, bit, bitsleft = 16, mask = READ_LE_UINT16(srcptr);
-	srcptr += 2;
-
-	for (;;) {
-		NextBit;
-		if (bit) {
-			*dstptr++ = *srcptr++;
-		} else {
-			NextBit;
-			if (!bit) {
-				NextBit;
-				size = bit << 1;
-				NextBit;
-				size = (size | bit) + 3;
-				data = *srcptr++ | 0xffffff00;
-			} else {
-				data = *srcptr++;
-				size = *srcptr++;
-
-				data |= 0xfffff000 + ((size & 0xf0) << 4);
-				size = (size & 0x0f) + 3;
-
-				if (size == 3)
-					if (((*srcptr++) + 1) == 1)
-						return (int32)(dstptr - dst);
-			}
-			result = dstptr + data;
-			while (size--)
-				*dstptr++ = *result++;
-		}
-	}
-}
-#undef NextBit
-
-int32 CompressScummBun::decompressCodec(int32 codec, byte *comp_input, byte *comp_output, int32 input_size) {
-	int32 output_size, channels;
-	int32 offset1, offset2, offset3, length, k, c, s, j, r, t, z;
-	byte *src, *t_table, *p, *ptr;
-	byte t_tmp1, t_tmp2;
-
-	switch (codec) {
-	case 0:
-		memcpy(comp_output, comp_input, input_size);
-		output_size = input_size;
-		break;
-
-	case 1:
-		output_size = compDecode(comp_input, comp_output);
-		break;
-
-	case 2:
-		output_size = compDecode(comp_input, comp_output);
-		p = comp_output;
-		for (z = 1; z < output_size; z++)
-			p[z] += p[z - 1];
-		break;
-
-	case 3:
-		output_size = compDecode(comp_input, comp_output);
-		p = comp_output;
-		for (z = 2; z < output_size; z++)
-			p[z] += p[z - 1];
-		for (z = 1; z < output_size; z++)
-			p[z] += p[z - 1];
-		break;
-
-	case 4:
-		output_size = compDecode(comp_input, comp_output);
-		p = comp_output;
-		for (z = 2; z < output_size; z++)
-			p[z] += p[z - 1];
-		for (z = 1; z < output_size; z++)
-			p[z] += p[z - 1];
-
-		t_table = (byte *)malloc(output_size);
-		memset(t_table, 0, output_size);
-
-		src = comp_output;
-		length = (output_size << 3) / 12;
-		k = 0;
-		if (length > 0) {
-			c = -12;
-			s = 0;
-			j = 0;
-			do {
-				ptr = src + length + (k >> 1);
-				t_tmp2 = src[j];
-				if (k & 1) {
-					r = c >> 3;
-					t_table[r + 2] = ((t_tmp2 & 0x0f) << 4) | (ptr[1] >> 4);
-					t_table[r + 1] = (t_tmp2 & 0xf0) | (t_table[r + 1]);
-				} else {
-					r = s >> 3;
-					t_table[r + 0] = ((t_tmp2 & 0x0f) << 4) | (ptr[0] & 0x0f);
-					t_table[r + 1] = t_tmp2 >> 4;
-				}
-				s += 12;
-				c += 12;
-				k++;
-				j++;
-			} while (k < length);
-		}
-		offset1 = ((length - 1) * 3) >> 1;
-		t_table[offset1 + 1] = (t_table[offset1 + 1]) | (src[length - 1] & 0xf0);
-		memcpy(src, t_table, output_size);
-		free(t_table);
-		break;
-
-	case 5:
-		output_size = compDecode(comp_input, comp_output);
-		p = comp_output;
-		for (z = 2; z < output_size; z++)
-			p[z] += p[z - 1];
-		for (z = 1; z < output_size; z++)
-			p[z] += p[z - 1];
-
-		t_table = (byte *)malloc(output_size);
-		memset(t_table, 0, output_size);
-
-		src = comp_output;
-		length = (output_size << 3) / 12;
-		k = 1;
-		c = 0;
-		s = 12;
-		t_table[0] = src[length] >> 4;
-		t = length + k;
-		j = 1;
-		if (t > k) {
-			do {
-				t_tmp1 = *(src + length + (k >> 1));
-				t_tmp2 = src[j - 1];
-				if (k & 1) {
-					r = c >> 3;
-					t_table[r + 0] = (t_tmp2 & 0xf0) | t_table[r];
-					t_table[r + 1] = ((t_tmp2 & 0x0f) << 4) | (t_tmp1 & 0x0f);
-				} else {
-					r = s >> 3;
-					t_table[r + 0] = t_tmp2 >> 4;
-					t_table[r - 1] = ((t_tmp2 & 0x0f) << 4) | (t_tmp1 >> 4);
-				}
-				s += 12;
-				c += 12;
-				k++;
-				j++;
-			} while (k < t);
-		}
-		memcpy(src, t_table, output_size);
-		free(t_table);
-		break;
-
-	case 6:
-		output_size = compDecode(comp_input, comp_output);
-		p = comp_output;
-		for (z = 2; z < output_size; z++)
-			p[z] += p[z - 1];
-		for (z = 1; z < output_size; z++)
-			p[z] += p[z - 1];
-
-		t_table = (byte *)malloc(output_size);
-		memset(t_table, 0, output_size);
-
-		src = comp_output;
-		length = (output_size << 3) / 12;
-		k = 0;
-		c = 0;
-		j = 0;
-		s = -12;
-		t_table[0] = src[output_size - 1];
-		t_table[output_size - 1] = src[length - 1];
-		t = length - 1;
-		if (t > 0) {
-			do {
-				t_tmp1 = *(src + length + (k >> 1));
-				t_tmp2 = src[j];
-				if (k & 1) {
-					r = s >> 3;
-					t_table[r + 2] = (t_tmp2 & 0xf0) | t_table[r + 2];
-					t_table[r + 3] = ((t_tmp2 & 0x0f) << 4) | (t_tmp1 >> 4);
-				} else {
-					r = c >> 3;
-					t_table[r + 2] = t_tmp2 >> 4;
-					t_table[r + 1] = ((t_tmp2 & 0x0f) << 4) | (t_tmp1 & 0x0f);
-				}
-				s += 12;
-				c += 12;
-				k++;
-				j++;
-			} while (k < t);
-		}
-		memcpy(src, t_table, output_size);
-		free(t_table);
-		break;
-
-	case 10:
-		output_size = compDecode(comp_input, comp_output);
-		p = comp_output;
-		for (z = 2; z < output_size; z++)
-			p[z] += p[z - 1];
-		for (z = 1; z < output_size; z++)
-			p[z] += p[z - 1];
-
-		t_table = (byte *)malloc(output_size);
-		memcpy(t_table, p, output_size);
-
-		offset1 = output_size / 3;
-		offset2 = offset1 << 1;
-		offset3 = offset2;
-		src = comp_output;
-
-		while (offset1--) {
-			offset2 -= 2;
-			offset3--;
-			t_table[offset2 + 0] = src[offset1];
-			t_table[offset2 + 1] = src[offset3];
-		}
-
-		src = comp_output;
-		length = (output_size << 3) / 12;
-		k = 0;
-		if (length > 0) {
-			c = -12;
-			s = 0;
-			do {
-				j = length + (k >> 1);
-				t_tmp1 = t_table[k];
-				if (k & 1) {
-					r = c >> 3;
-					t_tmp2 = t_table[j + 1];
-					src[r + 2] = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 >> 4);
-					src[r + 1] = (src[r + 1]) | (t_tmp1 & 0xf0);
-				} else {
-					r = s >> 3;
-					t_tmp2 = t_table[j];
-					src[r + 0] = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 & 0x0f);
-					src[r + 1] = t_tmp1 >> 4;
-				}
-				s += 12;
-				c += 12;
-				k++;
-			} while (k < length);
-		}
-		offset1 = ((length - 1) * 3) >> 1;
-		src[offset1 + 1] = (t_table[length] & 0xf0) | src[offset1 + 1];
-		free(t_table);
-		break;
-
-	case 11:
-		output_size = compDecode(comp_input, comp_output);
-		p = comp_output;
-		for (z = 2; z < output_size; z++)
-			p[z] += p[z - 1];
-		for (z = 1; z < output_size; z++)
-			p[z] += p[z - 1];
-
-		t_table = (byte *)malloc(output_size);
-		memcpy(t_table, p, output_size);
-
-		offset1 = output_size / 3;
-		offset2 = offset1 << 1;
-		offset3 = offset2;
-		src = comp_output;
-
-		while (offset1--) {
-			offset2 -= 2;
-			offset3--;
-			t_table[offset2 + 0] = src[offset1];
-			t_table[offset2 + 1] = src[offset3];
-		}
-
-		src = comp_output;
-		length = (output_size << 3) / 12;
-		k = 1;
-		c = 0;
-		s = 12;
-		t_tmp1 = t_table[length] >> 4;
-		src[0] = t_tmp1;
-		t = length + k;
-		if (t > k) {
-			do {
-				j = length + (k >> 1);
-				t_tmp1 = t_table[k - 1];
-				t_tmp2 = t_table[j];
-				if (k & 1) {
-					r = c >> 3;
-					src[r + 0] = (src[r]) | (t_tmp1 & 0xf0);
-					src[r + 1] = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 & 0x0f);
-				} else {
-					r = s >> 3;
-					src[r + 0] = t_tmp1 >> 4;
-					src[r - 1] = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 >> 4);
-				}
-				s += 12;
-				c += 12;
-				k++;
-			} while (k < t);
-		}
-		free(t_table);
-		break;
-
-	case 12:
-		output_size = compDecode(comp_input, comp_output);
-		p = comp_output;
-		for (z = 2; z < output_size; z++)
-			p[z] += p[z - 1];
-		for (z = 1; z < output_size; z++)
-			p[z] += p[z - 1];
-
-		t_table = (byte *)malloc(output_size);
-		memcpy(t_table, p, output_size);
-
-		offset1 = output_size / 3;
-		offset2 = offset1 << 1;
-		offset3 = offset2;
-		src = comp_output;
-
-		while (offset1--) {
-			offset2 -= 2;
-			offset3--;
-			t_table[offset2 + 0] = src[offset1];
-			t_table[offset2 + 1] = src[offset3];
-		}
-
-		src = comp_output;
-		length = (output_size << 3) / 12;
-		k = 0;
-		c = 0;
-		s = -12;
-		src[0] = t_table[output_size - 1];
-		src[output_size - 1] = t_table[length - 1];
-		t = length - 1;
-		if (t > 0) {
-			do {
-				j = length + (k >> 1);
-				t_tmp1 = t_table[k];
-				t_tmp2 = t_table[j];
-				if (k & 1) {
-					r = s >> 3;
-					src[r + 2] = (src[r + 2]) | (t_tmp1 & 0xf0);
-					src[r + 3] = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 >> 4);
-				} else {
-					r = c >> 3;
-					src[r + 2] = t_tmp1 >> 4;
-					src[r + 1] = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 & 0x0f);
-				}
-				s += 12;
-				c += 12;
-				k++;
-			} while (k < t);
-		}
-		free(t_table);
-		break;
-
-	case 13:
-	case 15:
-		if (codec == 13) {
-			channels = 1;
-		} else {
-			channels = 2;
-		}
-
-		{
-			// Decoder for the the IMA ADPCM variants used in COMI.
-			// Contrary to regular IMA ADPCM, this codec uses a variable
-			// bitsize for the encoded data.
-
-			const int MAX_CHANNELS = 2;
-			int32 outputSamplesLeft;
-			int32 destPos;
-			int16 firstWord;
-			byte initialTablePos[MAX_CHANNELS] = {0, 0};
-			int32 initialimcTableEntry[MAX_CHANNELS] = {7, 7};
-			int32 initialOutputWord[MAX_CHANNELS] = {0, 0};
-			int32 totalBitOffset, curTablePos, outputWord;
-			byte *dst;
-			int i;
-
-			// We only support mono and stereo
-			assert(channels == 1 || channels == 2);
-
-			src = comp_input;
-			dst = comp_output;
-			output_size = 0x2000;
-			outputSamplesLeft = 0x1000;
-
-			// Every data packet contains 0x2000 bytes of audio data
-			// when extracted. In order to encode bigger data sets,
-			// one has to split the data into multiple blocks.
-			//
-			// Every block starts with a 2 byte word. If that word is
-			// non-zero, it indicates the size of a block of raw audio
-			// data (not encoded) following it. That data we simply copy
-			// to the output buffer and the proceed by decoding the
-			// remaining data.
-			//
-			// If on the other hand the word is zero, then what follows
-			// are 7*channels bytes containing seed data for the decoder.
-			firstWord = READ_BE_UINT16(src);
-			src += 2;
-			if (firstWord != 0) {
-				// Copy raw data
-				memcpy(dst, src, firstWord);
-				dst += firstWord;
-				src += firstWord;
-				assert((firstWord & 1) == 0);
-				outputSamplesLeft -= firstWord / 2;
-			} else {
-				// Read the seed values for the decoder.
-				for (i = 0; i < channels; i++) {
-					initialTablePos[i] = *src;
-					src += 1;
-					initialimcTableEntry[i] = READ_BE_UINT32(src);
-					src += 4;
-					initialOutputWord[i] = READ_BE_UINT32(src);
-					src += 4;
-				}
-			}
-
-			totalBitOffset = 0;
-			// The channels are encoded separately.
-			for (int chan = 0; chan < channels; chan++) {
-				// Read initial state (this makes it possible for the data stream
-				// to be split & spread across multiple data chunks.
-				curTablePos = initialTablePos[chan];
-				//imcTableEntry = initialimcTableEntry[chan];
-				outputWord = initialOutputWord[chan];
-
-				// We need to interleave the channels in the output; we achieve
-				// that by using a variables dest offset:
-				destPos = chan * 2;
-
-				const int bound = (channels == 1)
-									? outputSamplesLeft
-									: ((chan == 0)
-										? (outputSamplesLeft+1) / 2
-										: outputSamplesLeft / 2);
-				for (i = 0; i < bound; ++i) {
-					// Determine the size (in bits) of the next data packet
-					const int32 curTableEntryBitCount = _imcTableEntryBitCount[curTablePos];
-					assert(2 <= curTableEntryBitCount && curTableEntryBitCount <= 7);
-
-					// Read the next data packet
-					const byte *readPos = src + (totalBitOffset >> 3);
-					const uint16 readWord = (uint16)(READ_BE_UINT16(readPos) << (totalBitOffset & 7));
-					const byte packet = (byte)(readWord >> (16 - curTableEntryBitCount));
-
-					// Advance read position to the next data packet
-					totalBitOffset += curTableEntryBitCount;
-
-					// Decode the data packet into a delta value for the output signal.
-					const byte signBitMask = (1 << (curTableEntryBitCount - 1));
-					const byte dataBitMask = (signBitMask - 1);
-					const byte data = (packet & dataBitMask);
-
-					int32 delta = imcTable[curTablePos] * (2 * data + 1) >> (curTableEntryBitCount - 1);
-
-					// The topmost bit in the data packet tells is a sign bit
-					if ((packet & signBitMask) != 0) {
-						delta = -delta;
-					}
-
-					// Accumulate the delta onto the output data
-					outputWord += delta;
-
-					// Clip outputWord to 16 bit signed, and write it into the destination stream
-					if (outputWord > 0x7fff)
-						outputWord = 0x7fff;
-					if (outputWord < -0x8000)
-						outputWord = -0x8000;
-					WRITE_BE_UINT16(dst + destPos, outputWord);
-					destPos += channels << 1;
-
-					// Adjust the curTablePos
-					curTablePos += (int8)imxOtherTable[curTableEntryBitCount - 2][data];
-					if (curTablePos < 0)
-						curTablePos = 0;
-					else if (curTablePos >= ARRAYSIZE(imcTable))
-						curTablePos = ARRAYSIZE(imcTable) - 1;
-				}
-			}
-		}
-		break;
-
-	default:
-		print("decompressCodec() Unknown codec %d!", (int)codec);
-		output_size = 0;
-		break;
-	}
-
-	return output_size;
-}
-
-void CompressScummBun::encodeWaveWithFlac(char *filename) {
-	char fbuf[2048];
-	char fbuf2[2048];
-	sprintf(fbuf, "%s.wav", filename);
-	sprintf(fbuf2, "%s.fla", filename);
-	encodeAudio(fbuf, false, -1, fbuf2, AUDIO_FLAC);
-}
-
-void CompressScummBun::encodeWaveWithOgg(char *filename) {
-	char fbuf[2048];
-	char fbuf2[2048];
-	sprintf(fbuf, "%s.wav", filename);
-	sprintf(fbuf2, "%s.ogg", filename);
-	encodeAudio(fbuf, false, -1, fbuf2, AUDIO_VORBIS);
-}
-
-void CompressScummBun::encodeWaveWithLame(char *filename) {
-	char fbuf[2048];
-	char fbuf2[2048];
-
-	sprintf(fbuf, "%s.wav", filename);
-	sprintf(fbuf2, "%s.mp3", filename);
-	encodeAudio(fbuf, false, -1, fbuf2, AUDIO_MP3);
-}
-
-void CompressScummBun::writeWaveHeader(int s_size, int rate, int chan) {
-	int bits = 16;
-	byte wav[44];
-	memset(wav, 0, 44);
-	wav[0] = 'R';
-	wav[1] = 'I';
-	wav[2] = 'F';
-	wav[3] = 'F';
-	wav[4] = (s_size + 36) & 0xff;
-	wav[5] = ((s_size +	36)	>> 8) &	0xff;
-	wav[6] = ((s_size +	36)	>> 16) & 0xff;
-	wav[7] = ((s_size +	36)	>> 24) & 0xff;
-	wav[8] = 'W';
-	wav[9] = 'A';
-	wav[10]	= 'V';
-	wav[11]	= 'E';
-	wav[12]	= 'f';
-	wav[13]	= 'm';
-	wav[14]	= 't';
-	wav[15]	= 0x20;
-	wav[16]	= 16;
-	wav[20]	= 1;
-	wav[22]	= chan;
-	wav[24]	= rate & 0xff;
-	wav[25]	= (rate	>> 8) &	0xff;
-	wav[26]	= (rate	>> 16) & 0xff;
-	wav[27]	= (rate	>> 24) & 0xff;
-	wav[28]	= (rate	* chan * (bits / 8)) & 0xff;
-	wav[29]	= ((rate * chan	* (bits	/ 8))>>	8) & 0xff;
-	wav[30]	= ((rate * chan	* (bits	/ 8)) >> 16) & 0xff;
-	wav[31]	= ((rate * chan	* (bits	/ 8)) >> 24) & 0xff;
-	wav[32]	= (chan	* (bits	/ 8)) &	0xff;
-	wav[33]	= ((chan * (bits / 8)) >> 8) & 0xff;
-	wav[34]	= bits;
-	wav[36]	= 'd';
-	wav[37]	= 'a';
-	wav[38]	= 't';
-	wav[39]	= 'a';
-	wav[40]	= s_size & 0xff;
-	wav[41]	= (s_size >> 8)	& 0xff;
-	wav[42]	= (s_size >> 16) & 0xff;
-	wav[43]	= (s_size >> 24) & 0xff;
-
-	_waveTmpFile.seek(0, SEEK_SET);
-	if (_waveTmpFile.write(wav, 44) != 44) {
-		error("error writing temp wave file");
-	}
-	_waveTmpFile.close();
-}
-
-void CompressScummBun::writeToTempWave(char *fileName, byte *output_data, unsigned int size) {
-	if (!_waveTmpFile.isOpen()) {
-		_waveTmpFile.open(fileName, "wb");
-		byte wav[44];
-		memset(wav, 0, 44);
-		_waveTmpFile.write(output_data, 44);
-		_waveDataSize = 0;
-	}
-	for (unsigned int j = 0; j < size - 1; j += 2) {
-		byte tmp = output_data[j + 0];
-		output_data[j + 0] = output_data[j + 1];
-		output_data[j + 1] = tmp;
-	}
-	_waveTmpFile.write(output_data, size);
-	_waveDataSize += size;
-}
-
-static AudioFormat gCompMode = AUDIO_MP3;
-
-typedef struct { int offset, size, codec; } CompTable;
-
-byte *CompressScummBun::decompressBundleSound(int index, Common::File  &input, int32 &finalSize) {
-	byte compOutput[0x2000];
-	int i;
-
-	input.seek(_bundleTable[index].offset, SEEK_SET);
-
-	uint32 tag = input.readUint32BE();
-	assert(tag == 'COMP');
-	int numCompItems = input.readUint32BE();
-	input.seek(8, SEEK_CUR);
-
-	CompTable *compTable = (CompTable *)malloc(sizeof(CompTable) * numCompItems);
-	int32 maxSize = 0;
-	for (i = 0; i < numCompItems; i++) {
-		compTable[i].offset = input.readUint32BE();
-		compTable[i].size = input.readUint32BE();
-		compTable[i].codec = input.readUint32BE();
-		input.seek(4, SEEK_CUR);
-		if (compTable[i].size > maxSize)
-			maxSize = compTable[i].size;
-	}
-	// CMI hack: one more byte at the end of input buffer
-	byte *compInput = (byte *)malloc(maxSize + 1);
-	byte *compFinal = (byte *)malloc(numCompItems * 0x2000);
-
-	finalSize = 0;
-
-	for (i = 0; i < numCompItems; i++) {
-		compInput[compTable[i].size] = 0;
-		input.seek(_bundleTable[index].offset + compTable[i].offset, SEEK_SET);
-		input.read_throwsOnError(compInput, compTable[i].size);
-		int outputSize = decompressCodec(compTable[i].codec, compInput, compOutput, compTable[i].size);
-		assert(outputSize <= 0x2000);
-		memcpy(compFinal + finalSize, compOutput, outputSize);
-		finalSize += outputSize;
-	}
-
-	free(compInput);
-	free(compTable);
-
-	return compFinal;
-}
-
-byte *CompressScummBun::convertTo16bit(byte *ptr, int inputSize, int &outputSize, int bits, int freq, int channels) {
-	outputSize = inputSize;
-	if (bits == 8)
-		outputSize *= 2;
-	if (bits == 12)
-		outputSize = (outputSize / 3) * 4;
-
-	byte *outputBuf = (byte *)malloc(outputSize);
-	if (bits == 8) {
-		byte *buf = outputBuf;
-		byte *src = ptr;
-		for (int i = 0; i < inputSize; i++) {
-			uint16 val = (*src++ - 0x80) << 8;
-			*buf++ = (byte)(val >> 8);
-			*buf++ = (byte)val;
-		}
-	}
-	if (bits == 12) {
-		int loop_size = inputSize / 3;
-		byte *decoded = outputBuf;
-		byte *source = ptr;
-		uint32 value;
-
-		while (loop_size--) {
-			byte v1 = *source++;
-			byte v2 = *source++;
-			byte v3 = *source++;
-			value = ((((v2 & 0x0f) << 8) | v1) << 4) - 0x8000;
-			*decoded++ = (byte)((value >> 8) & 0xff);
-			*decoded++ = (byte)(value & 0xff);
-			value = ((((v2 & 0xf0) << 4) | v3) << 4) - 0x8000;
-			*decoded++ = (byte)((value >> 8) & 0xff);
-			*decoded++ = (byte)(value & 0xff);
-		}
-	}
-	if (bits == 16) {
-		int loop_size = inputSize / 2;
-		byte *buf = outputBuf;
-		byte *src = ptr;
-		while (loop_size--) {
-			*buf++ = *src++;
-			*buf++ = *src++;
-		}
-	}
-
-	return outputBuf;
-}
-
-void CompressScummBun::countMapElements(byte *ptr, int &numRegions, int &numJumps, int &numSyncs, int &numMarkers) {
-	uint32 tag;
-	int32 size = 0;
-
-	do {
-		tag = READ_BE_UINT32(ptr); ptr += 4;
-		switch(tag) {
-		case 'TEXT':
-			if (!scumm_stricmp((const char *)(ptr + 8), "exit"))
-				numMarkers++;
-			size = READ_BE_UINT32(ptr); ptr += size + 4;
-			break;
-		case 'STOP':
-		case 'FRMT':
-		case 'DATA':
-			size = READ_BE_UINT32(ptr); ptr += size + 4;
-			break;
-		case 'REGN':
-			numRegions++;
-			size = READ_BE_UINT32(ptr); ptr += size + 4;
-			break;
-		case 'JUMP':
-			numJumps++;
-			size = READ_BE_UINT32(ptr); ptr += size + 4;
-			break;
-		case 'SYNC':
-			numSyncs++;
-			size = READ_BE_UINT32(ptr); ptr += size + 4;
-			break;
-		default:
-			error("countMapElements() Unknown tag of Map");
-		}
-	} while (tag != 'DATA');
-}
-
-struct Region {
-	int32 offset;
-	int32 length;
-};
-
-struct Jump {
-	int32 offset;
-	int32 dest;
-	byte hookId;
-	int16 fadeDelay;
-};
-
-struct Sync {
-	int32 size;
-	byte *ptr;
-};
-
-struct Marker {
-	int32 pos;
-	int32 length;
-	char *ptr;
-};
-
-static Region *_region;
-static int _numRegions;
-
-void CompressScummBun::writeRegions(byte *ptr, int bits, int freq, int channels, const char *dir, char *filename, Common::File &output) {
-	char tmpPath[200];
-
-	for (int l = 0; l < _numRegions; l++) {
-		int outputSize = 0;
-		int size = _region[l].length;
-		int offset = _region[l].offset;
-		byte *outputData = convertTo16bit(ptr + offset, size, outputSize, bits, freq, channels);
-		sprintf(tmpPath, "%s/%s_reg%03d.wav", dir, filename, l);
-		writeToTempWave(tmpPath, outputData, outputSize);
-		writeWaveHeader(_waveDataSize, freq, channels);
-		free(outputData);
-		sprintf(tmpPath, "%s/%s_reg%03d", dir, filename, l);
-
-		switch (gCompMode) {
-		case AUDIO_MP3:
-			encodeWaveWithLame(tmpPath);
-			break;
-		case AUDIO_VORBIS:
-			encodeWaveWithOgg(tmpPath);
-			break;
-		case AUDIO_FLAC:
-			encodeWaveWithFlac(tmpPath);
-			break;
-		default:
-			error("Unknown encoding method");
-		}
-
-		sprintf(tmpPath, "%s/%s_reg%03d.wav", dir, filename, l);
-		unlink(tmpPath);
-
-		int32 startPos = output.pos();
-		switch (gCompMode) {
-		case AUDIO_MP3:
-			sprintf(_cbundleTable[_cbundleCurIndex].filename, "%s_reg%03d.mp3", filename, l);
-			sprintf(tmpPath, "%s/%s_reg%03d.mp3", dir, filename, l);
-			break;
-		case AUDIO_VORBIS:
-			sprintf(_cbundleTable[_cbundleCurIndex].filename, "%s_reg%03d.ogg", filename, l);
-			sprintf(tmpPath, "%s/%s_reg%03d.ogg", dir, filename, l);
-			break;
-		case AUDIO_FLAC:
-			sprintf(_cbundleTable[_cbundleCurIndex].filename, "%s_reg%03d.fla", filename, l);
-			sprintf(tmpPath, "%s/%s_reg%03d.fla", dir, filename, l);
-			break;
-		default:
-			error("Unknown encoding method");
-		}
-		_cbundleTable[_cbundleCurIndex].offset = startPos;
-
-		Common::File cmpFile(tmpPath, "rb");
-		cmpFile.seek(0, SEEK_END);
-		size = cmpFile.pos();
-		cmpFile.seek(0, SEEK_SET);
-		byte *tmpBuf = (byte *)malloc(size);
-		cmpFile.read_throwsOnError(tmpBuf, size);
-		cmpFile.close();
-		unlink(tmpPath);
-
-		output.write(tmpBuf, size);
-		free(tmpBuf);
-		_cbundleTable[_cbundleCurIndex].size = output.pos() - startPos;
-		_cbundleCurIndex++;
-	}
-	free(_region);
-}
-
-void CompressScummBun::recalcRegions(int32 &value, int bits, int freq, int channels) {
-	int size = value;
-	if (bits == 8)
-		size *= 2;
-	if (bits == 12)
-		size = (size / 3) * 4;
-	value = size;
-}
-
-void CompressScummBun::writeToRMAPFile(byte *ptr, Common::File &output, char *filename, int &offsetData, int &bits, int &freq, int &channels) {
-	byte *s_ptr = ptr;
-	int32 size = 0;
-	int l;
-
-	uint32 tag = READ_BE_UINT32(ptr);
-	assert(tag == 'iMUS');
-	ptr += 16;
-
-	int curIndexRegion = 0;
-	int curIndexJump = 0;
-	int curIndexSync = 0;
-	int curIndexMarker = 0;
-
-	int numRegions = 0, numJumps = 0, numSyncs = 0, numMarkers = 0;
-	countMapElements(ptr, numRegions, numJumps, numSyncs, numMarkers);
-	Region *region = (Region *)malloc(sizeof(Region) * numRegions);
-	_region = (Region *)malloc(sizeof(Region) * numRegions);
-	_numRegions = numRegions;
-	Jump *jump = (Jump *)malloc(sizeof(Jump) * numJumps);
-	Sync *sync = (Sync *)malloc(sizeof(Sync) * numSyncs);
-	Marker *marker = (Marker *)malloc(sizeof(Marker) * numMarkers);
-
-	do {
-		tag = READ_BE_UINT32(ptr); ptr += 4;
-		switch (tag) {
-		case 'FRMT':
-			ptr += 12;
-			bits = READ_BE_UINT32(ptr); ptr += 4;
-			freq = READ_BE_UINT32(ptr); ptr += 4;
-			channels = READ_BE_UINT32(ptr); ptr += 4;
-			break;
-		case 'TEXT':
-			if (!scumm_stricmp((const char *)(ptr + 8), "exit")) {
-				marker[curIndexMarker].pos = READ_BE_UINT32(ptr + 4);
-				marker[curIndexMarker].length = strlen((const char *)(ptr + 8)) + 1;
-				marker[curIndexMarker].ptr = new char[marker[curIndexMarker].length];

@@ Diff output truncated at 100000 characters. @@

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