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

Remere at users.sourceforge.net Remere at users.sourceforge.net
Fri Jul 17 03:55:12 CEST 2009


Revision: 42557
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42557&view=rev
Author:   Remere
Date:     2009-07-17 01:55:11 +0000 (Fri, 17 Jul 2009)

Log Message:
-----------
*Tool inputs are now stored in the 'Tool' class, and not ToolGUI.
*Changed how auto-detection works, now, there is a default implementation which automatically matches against the tool input format, so there is no need to provide inspectInput in most cases.
*The Tool class itself now also parses input arguments, so the correct amount of input files are guaranteed when Tool::execute is called.

Modified Paths:
--------------
    tools/branches/gsoc2009-gui/compress_agos.cpp
    tools/branches/gsoc2009-gui/compress_gob.cpp
    tools/branches/gsoc2009-gui/compress_kyra.cpp
    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_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_touche.cpp
    tools/branches/gsoc2009-gui/compress_tucker.cpp
    tools/branches/gsoc2009-gui/extract_agos.cpp
    tools/branches/gsoc2009-gui/extract_gob_stk.cpp
    tools/branches/gsoc2009-gui/extract_gob_stk.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_scumm_mac.cpp
    tools/branches/gsoc2009-gui/extract_zak_c64.cpp
    tools/branches/gsoc2009-gui/extract_zak_c64.h
    tools/branches/gsoc2009-gui/gui/pages.cpp
    tools/branches/gsoc2009-gui/gui/tools.cpp
    tools/branches/gsoc2009-gui/gui/tools.h
    tools/branches/gsoc2009-gui/tool.cpp
    tools/branches/gsoc2009-gui/tool.h
    tools/branches/gsoc2009-gui/util.cpp
    tools/branches/gsoc2009-gui/util.h

Modified: tools/branches/gsoc2009-gui/compress_agos.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_agos.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_agos.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -27,8 +27,11 @@
 
 CompressAgos::CompressAgos(const std::string &name) : CompressionTool(name) {
 	_convertMac = false;
-
 	_outputToDirectory = false;
+	
+	ToolInput input;
+	input.format = "*.*";
+	_inputPaths.push_back(input);
 
 	_helptext = "\nUsage: %s [mode params] [--mac] [-o outfile] <infile>\n" kCompressionAudioHelp
 }
@@ -208,10 +211,7 @@
 }
 
 void CompressAgos::execute() {
-	// We only got one input file
-	if (_inputPaths.size() != 1)
-		error("Only one input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 
 	if (_outputPath.empty()) {
 		_outputPath = inpath;

Modified: tools/branches/gsoc2009-gui/compress_gob.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_gob.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_gob.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -36,14 +36,20 @@
 
 
 CompressGob::CompressGob(const std::string &name) : CompressionTool(name) {
+	_execMode = MODE_NORMAL;
+	_chunks = NULL;
+
+	ToolInput input;
+	input.format = "*.*";
+	_inputPaths.push_back(input);
+
 	_helptext = 
 		"\nUsage: " + _name + " [-f] [-o <output> = out.stk] <conf file>\n"
 		"<conf file> is a .gob file generated extract_gob_stk\n"
 		"<-f> ignores the compression flag in the .gob file and force compression for all files\n\n"
 		"The STK/ITK archive will be created in the current directory.\n";
 
-	_execMode = MODE_NORMAL;
-	_chunks = NULL;
+
 }
 
 CompressGob::~CompressGob() {
@@ -62,10 +68,7 @@
 	File gobConf;
 	uint16 chunkCount;
 
-	// We only got one input file
-	if (_inputPaths.size() > 1)
-		error("Only one input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename &outpath = _outputPath;
 
 	// We output with .stk extension, if there is no specific out file

Modified: tools/branches/gsoc2009-gui/compress_kyra.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_kyra.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_kyra.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -28,14 +28,15 @@
 #define TEMPFILE "TEMP.VOC"
 
 CompressKyra::CompressKyra(const std::string &name) : CompressionTool(name) {
+	ToolInput input;
+	input.format = "*.*";
+	_inputPaths.push_back(input);
+
 	_helptext = "\nUsage: " + _name + " [mode params] [-o outfile] <infile>\n" kCompressionAudioHelp;
 }
 
 void CompressKyra::execute() {
-	// Check input
-	if (_inputPaths.size() != 1)
-		error("One input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename &outpath = _outputPath;
 
 	if (inpath == outpath)

Modified: tools/branches/gsoc2009-gui/compress_queen.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_queen.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_queen.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -92,14 +92,14 @@
 CompressQueen::CompressQueen(const std::string &name) : CompressionTool(name) {
 	_outputToDirectory = false;
 	_supportsProgressBar = true;
+	
+	ToolInput input;
+	input.format = "queen.1";
+	_inputPaths.push_back(input);
 
 	_helptext = "\nUsage: %s [mode] [mode params] [-o outputfile] <inputfile (queen.1)>\n" kCompressionAudioHelp;
 }
 
-bool CompressQueen::inspectInput(const Filename &filename) {
-	return filename.getFullName() == "queen.1";
-}
-
 const CompressQueen::GameVersion *CompressQueen::detectGameVersion(uint32 size) {
 	const struct GameVersion *pgv = gameVersions;
 	int i;
@@ -174,10 +174,7 @@
 	int size, i = 1;
 	uint32 prevOffset;
 
-	// Check input
-	if (_inputPaths.size() != 1)
-		error("One input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename &outpath = _outputPath;
 
 	if (outpath.empty()) {

Modified: tools/branches/gsoc2009-gui/compress_queen.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_queen.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_queen.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -28,8 +28,6 @@
 class CompressQueen : public CompressionTool {
 public:
 	CompressQueen(const std::string &name = "compress_queen");
-	
-	virtual bool inspectInput(const Filename &filename);
 
 	virtual void execute();
 

Modified: tools/branches/gsoc2009-gui/compress_saga.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_saga.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_saga.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -112,6 +112,13 @@
 CompressSaga::CompressSaga(const std::string &name) : CompressionTool(name) {
 	_currentGameDescription = NULL;
 	_currentFileDescription = NULL;
+	
+	
+	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);
 
 	_helptext = "\nUsage: %s [mode] [mode params] [-o outputfile = infile.cmp] <inputfile>\n" kCompressionAudioHelp;
 }
@@ -407,10 +414,7 @@
 }
 
 void CompressSaga::execute() {
-	// Check input
-	if (_inputPaths.size() != 1)
-		error("One input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename &outpath = _outputPath;
 
 	// ITE

Modified: tools/branches/gsoc2009-gui/compress_scumm_bun.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_bun.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_scumm_bun.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -1067,19 +1067,16 @@
 
 CompressScummBun::CompressScummBun(const std::string &name) : CompressionTool(name) {
 	_cbundleCurIndex = 0;
+	
+	ToolInput input;
+	input.format = "*.bun";
+	_inputPaths.push_back(input);
 
 	_helptext = "\nUsage: " + _name + " [mode] [mode-params] [-o outputfile = inputfile.bun] <inputfile>\n";
 }
 
-bool CompressScummBun::inspectInput(const Filename &filename) {
-	return filename.hasExtension("bun");
-}
-
 void CompressScummBun::execute() {
-	// Check input
-	if (_inputPaths.size() != 1)
-		error("One input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename &outpath = _outputPath;
 
 	uint32 tag;

Modified: tools/branches/gsoc2009-gui/compress_scumm_bun.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_bun.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_scumm_bun.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -29,8 +29,6 @@
 class CompressScummBun : public CompressionTool {
 public:
 	CompressScummBun(const std::string &name = "compress_scumm_bun");
-	
-	virtual bool inspectInput(const Filename &filename);
 
 	virtual void execute();
 

Modified: tools/branches/gsoc2009-gui/compress_scumm_san.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_san.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_scumm_san.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -575,23 +575,20 @@
 
 CompressScummSan::CompressScummSan(const std::string &name) : CompressionTool(name) {
 	_IACTpos = 0;
+	
+	ToolInput input;
+	input.format = "*.san";
+	_inputPaths.push_back(input);
 
 	// TODO: Feature set seems more limited than what kCompressionAudioHelp contains
 	_helptext = "\nUsage: " + _name + " [mode] [mode-params] [-o outpufile = inputfile.san] <inputfile>\n" kCompressionAudioHelp;
 }
 
-bool CompressScummSan::inspectInput(const Filename &filename) {
-	return filename.hasExtension("san");
-}
-
 void CompressScummSan::execute() {
 	if (_format == AUDIO_FLAC)
 		error("Only ogg vorbis and MP3 is supported for this tool.");
 
-	// Check input
-	if (_inputPaths.size() != 1)
-		error("One input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename &outpath = _outputPath;
 
 	if (outpath.empty()) {

Modified: tools/branches/gsoc2009-gui/compress_scumm_san.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_san.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_scumm_san.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -32,8 +32,6 @@
 class CompressScummSan : public CompressionTool {
 public:
 	CompressScummSan(const std::string &name = "compress_scumm_san");
-	
-	virtual bool inspectInput(const Filename &filename);
 
 	virtual void execute();
 

Modified: tools/branches/gsoc2009-gui/compress_scumm_sou.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_sou.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_scumm_sou.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -133,21 +133,18 @@
 
 CompressScummSou::CompressScummSou(const std::string &name) : CompressionTool(name) {
 	_audioOuputFilename = OUTPUT_MP3;
+	
+	ToolInput input;
+	input.format = "*.sou";
+	_inputPaths.push_back(input);
 
 	_helptext = "\nUsage: " + _name + " [mode] [mode params] monster.sou\n" kCompressionAudioHelp;
 }
 
-bool CompressScummSou::inspectInput(const Filename &filename) {
-	return filename.hasExtension("sou");
-}
-
 void CompressScummSou::execute() {
 	char buf[2048];
 
-	// Check input
-	if (_inputPaths.size() != 1)
-		error("One input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename &outpath = _outputPath;
 
 	switch (_format) {

Modified: tools/branches/gsoc2009-gui/compress_scumm_sou.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_sou.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_scumm_sou.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -30,8 +30,6 @@
 class CompressScummSou : public CompressionTool {
 public:
 	CompressScummSou(const std::string &name = "compress_scumm_sou");
-	
-	virtual bool inspectInput(const Filename &filename);
 
 	virtual void execute();
 

Modified: tools/branches/gsoc2009-gui/compress_sword1.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword1.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_sword1.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -559,6 +559,10 @@
 CompressSword1::CompressSword1(const std::string &name) : CompressionTool(name) {
 	_compSpeech = true;
 	_compMusic = true;
+	
+	ToolInput input;
+	input.format = "*.clu";
+	_inputPaths.push_back(input);
 
 	_helptext = "\nUsage: %s [only] [mode] [mode params] [-o outputdir] <inputdir>\n"
 		"only can be either:\n"
@@ -567,10 +571,6 @@
 		kCompressionAudioHelp;
 }
 
-bool CompressSword1::inspectInput(const Filename &filename) {
-	return filename.hasExtension("clu");
-}
-
 void CompressSword1::parseExtraArguments() {
 	if (_arguments[_arguments_parsed] == "--speech-only") {
 		_compMusic = false;
@@ -583,10 +583,7 @@
 }
 
 void CompressSword1::execute() {
-	// Check input
-	if (_inputPaths.size() != 1)
-		error("One input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename &outpath = _outputPath;
 
 	switch (_format) {

Modified: tools/branches/gsoc2009-gui/compress_sword1.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword1.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_sword1.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -29,8 +29,6 @@
 class CompressSword1 : public CompressionTool {
 public:
 	CompressSword1(const std::string &name = "compress_sword1");
-	
-	virtual bool inspectInput(const Filename &filename);
 
 	virtual void execute();
 

Modified: tools/branches/gsoc2009-gui/compress_sword2.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword2.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_sword2.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -50,24 +50,21 @@
 #define GetCompressedAmplitude(n)  ((n) & 7)
 
 CompressSword2::CompressSword2(const std::string &name) : CompressionTool(name) {
+	
+	ToolInput input;
+	input.format = "*.clu";
+	_inputPaths.push_back(input);
+
 	_helptext = "\nUsage: " + _name + " [params] <file>\n\n" kCompressionAudioHelp;
 }
 
-bool CompressSword2::inspectInput(const Filename &filename) {
-	return filename.hasExtension("clu");
-}
-
 void CompressSword2::execute() {
 	int j;
 	uint32 indexSize;
 	uint32 totalSize;
 	uint32 length;
 	
-
-	// Check _input
-	if (_inputPaths.size() != 1)
-		error("One input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename &outpath = _outputPath;
 
 	switch (_format) {

Modified: tools/branches/gsoc2009-gui/compress_sword2.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword2.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_sword2.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -29,8 +29,6 @@
 class CompressSword2 : public CompressionTool {
 public:
 	CompressSword2(const std::string &name = "compress_sword2");
-	
-	virtual bool inspectInput(const Filename &filename);
 
 	virtual void execute();
 

Modified: tools/branches/gsoc2009-gui/compress_tinsel.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_tinsel.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_tinsel.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -48,7 +48,15 @@
 #define TEMP_ENC "tempfile.enc"
 
 CompressTinsel::CompressTinsel(const std::string &name) : CompressionTool(name) {
-	_helptext = "\nUsage: " + _name + " [mode-params] [-o outputname] <infile.smp> [infile.idx]\n" + kCompressionAudioHelp;
+	ToolInput input1;
+	input1.format = "*.smp";
+	_inputPaths.push_back(input1);
+	
+	ToolInput input2;
+	input2.format = "*.idx";
+	_inputPaths.push_back(input2);
+
+	_helptext = "\nUsage: " + _name + " [mode-params] [-o outputname] <infile.smp> <infile.idx>\n" + kCompressionAudioHelp;
 }
 
 /* Converts raw-data sample in input_smp of size SampleSize to requested dataformat and writes to output_smp */
@@ -248,24 +256,9 @@
 	uint32 sampleSize = 0;
 	uint32 sampleCount = 0;
 
-	Filename inpath_smp, inpath_idx;
+	Filename inpath_smp = _inputPaths[0].path;
+	Filename inpath_idx = _inputPaths[1].path;
 
-	// Check input
-	if (_inputPaths.size() < 1)
-		error("Atleast one input file expected!");
-
-	if (_inputPaths.size() == 1) {
-		// One input, assume idx and change extension for second input
-		inpath_smp = _inputPaths[0];
-		inpath_idx = inpath_smp;
-		inpath_idx.setExtension(".idx");
-	} else if (_inputPaths.size() == 2) {
-		inpath_smp = _inputPaths[0];
-		inpath_idx = _inputPaths[1];
-	} else {
-		error("At most two input files expected!");
-	}
-
 	_input_idx.open(inpath_idx, "rb");
 	_input_smp.open(inpath_smp, "rb");
 

Modified: tools/branches/gsoc2009-gui/compress_touche.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_touche.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_touche.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -39,9 +39,12 @@
 static uint32 input_Vxx_size[Vxx_HDR_LEN];
 
 CompressTouche::CompressTouche(const std::string &name) : CompressionTool(name) {
-	_inputFromDirectory = true;
 
-//	const char *helptext = "\nUsage: %s [params] [-o outputfile TOUCHE.*] <inputdir>\n* differs with compression type.\n" kCompressionAudioHelp;
+	ToolInput input;
+	input.format = "/";
+	_inputPaths.push_back(input);
+
+	_helptext = "\nUsage: %s [params] [-o outputfile TOUCHE.*] <inputdir>\n* differs with compression type.\n" kCompressionAudioHelp;
 }
 
 uint32 CompressTouche::compress_sound_data_file(uint32 current_offset, File &output, File &input, uint32 *offs_table, uint32 *size_table, int len) {
@@ -158,10 +161,7 @@
 }
 
 void CompressTouche::execute() {
-	// We only got one input file
-	if (_inputPaths.size() > 1)
-		error("Only one input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename &outpath = _outputPath;
 
 	if (outpath.empty()) {

Modified: tools/branches/gsoc2009-gui/compress_tucker.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_tucker.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/compress_tucker.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -40,7 +40,10 @@
 static CompressedData temp_table[10000];
 
 CompressTucker::CompressTucker(const std::string &name) : CompressionTool(name) {
-	_inputFromDirectory = true;
+	
+	ToolInput input;
+	input.format = "/";
+	_inputPaths.push_back(input);
 
 	_helptext = "\nUsage: %s [mode params] [-o outputdir] inputdir\n";
 }
@@ -402,10 +405,7 @@
 
 
 void CompressTucker::execute() {
-	// We only got one input dir
-	if (_inputPaths.size() > 1)
-		error("Only one input directory expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename &outpath = _outputPath;
 
 	// Default out is same as in directory, file names differ by extension

Modified: tools/branches/gsoc2009-gui/extract_agos.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_agos.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_agos.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -29,6 +29,10 @@
 
 ExtractAgos::ExtractAgos(const std::string &name) : Tool(name) {
 	_filelen = 0;
+	
+	ToolInput input;
+	input.format = "*.*";
+	_inputPaths.push_back(input);
 
 	_helptext = "\nUsage: " + _name + " [-o outputname] infilename\n";
 }
@@ -36,26 +40,25 @@
 // Run the actual tool
 void ExtractAgos::execute() {
 	// Loop through all input files
-	for (std::vector<std::string>::const_iterator iter = _inputPaths.begin(); iter != _inputPaths.end(); ++iter) {
-		Filename infilename(*iter);
-		uint8 *x = (uint8 *)loadfile(infilename);
+	Filename infilename(_inputPaths[0].path);
 
-		_outputPath.setFullName(infilename.getFullName());
+	uint8 *x = (uint8 *)loadfile(infilename);
 
-		uint32 decrlen = simon_decr_length(x, (uint32) _filelen);
-		uint8 *out = (uint8 *)malloc(decrlen);
+	_outputPath.setFullName(infilename.getFullName());
 
-		if (out) {
-			if (simon_decr(x, out, _filelen)) {
-				savefile(_outputPath.getFullPath(), out, decrlen);
-			}
-			else {
-				print("%s: decrunch error\n", iter->c_str());
-			}
+	uint32 decrlen = simon_decr_length(x, (uint32) _filelen);
+	uint8 *out = (uint8 *)malloc(decrlen);
 
-			free(x);
-			free(out);
+	if (out) {
+		if (simon_decr(x, out, _filelen)) {
+			savefile(_outputPath.getFullPath(), out, decrlen);
 		}
+		else {
+			print("%s: decrunch error\n", infilename.getFullPath());
+		}
+
+		free(x);
+		free(out);
 	}
 }
 

Modified: tools/branches/gsoc2009-gui/extract_gob_stk.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_gob_stk.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_gob_stk.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -40,14 +40,14 @@
 
 ExtractGobStk::ExtractGobStk(const std::string &name) : Tool(name) {
 	_chunks = NULL;
+	
+	ToolInput input;
+	input.format = "*.stk";
+	_inputPaths.push_back(input);
 
 	_helptext = "\nUsage: " + _name + " [-o outputname] infilename\n";
 }
 
-bool ExtractGobStk::inspectInput(const Filename &filename) {
-	return filename.hasExtension("stk") || filename.hasExtension("STK");
-}
-
 ExtractGobStk::~ExtractGobStk() {
 	delete _chunks;
 }
@@ -60,10 +60,7 @@
 	File f1;
 	File f2;
 
-	// We only got one input file
-	if (_inputPaths.size() > 1)
-		error("Only one input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 
 	stk.open(inpath.getFullPath(), "rb");
 

Modified: tools/branches/gsoc2009-gui/extract_gob_stk.h
===================================================================
--- tools/branches/gsoc2009-gui/extract_gob_stk.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_gob_stk.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -28,8 +28,6 @@
 public:
 	ExtractGobStk(const std::string &name = "extract_gob_stk");
 	~ExtractGobStk();
-	
-	virtual bool inspectInput(const Filename &filename);
 
 	virtual void execute();
 

Modified: tools/branches/gsoc2009-gui/extract_loom_tg16.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_loom_tg16.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_loom_tg16.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -1224,13 +1224,14 @@
 }
 
 ExtractLoomTG16::ExtractLoomTG16(const std::string &name) : Tool(name) {
+	
+	ToolInput input;
+	input.format = "*.iso";
+	_inputPaths.push_back(input);
+
 	_helptext = "\nUsage: " + _name + " [-o outputdir = out/] <infile>";
 }
 
-bool ExtractLoomTG16::inspectInput(const Filename &filename) {
-	return filename.hasExtension("ISO") || filename.hasExtension("iso");
-}
-
 void ExtractLoomTG16::execute() {
 #ifdef MAKE_LFLS
 	int i, j;
@@ -1239,11 +1240,7 @@
 #endif
 	uint32 CRC;
 
-
-	// We only got one input file
-	if (_inputPaths.size() > 1)
-		error("Only one input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename &outpath = _outputPath;
 
 	if (outpath.empty())

Modified: tools/branches/gsoc2009-gui/extract_loom_tg16.h
===================================================================
--- tools/branches/gsoc2009-gui/extract_loom_tg16.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_loom_tg16.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -31,8 +31,6 @@
 class ExtractLoomTG16 : public Tool {
 public:
 	ExtractLoomTG16(const std::string &name = "extract_loom_tg16");
-	
-	virtual bool inspectInput(const Filename &filename);
 
 	virtual void execute();
 

Modified: tools/branches/gsoc2009-gui/extract_mm_apple.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_apple.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_mm_apple.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -43,23 +43,25 @@
 };
 
 ExtractMMApple::ExtractMMApple(const std::string &name) : Tool(name) {
+	
+	ToolInput input1;
+	input1.format = "*.dsk";
+	_inputPaths.push_back(input1);
+
+	ToolInput input2;
+	input2.format = "*.dsk";
+	_inputPaths.push_back(input2);
+
 	_helptext = "\nUsage: " + _name + " [-o <output dir> = out/] <disk1.dsk> <disk2.dsk>\n";
 }
 
-bool ExtractMMApple::inspectInput(const Filename &filename) {
-	return filename.hasExtension("dsk");
-}
-
 void ExtractMMApple::execute() {
 	int i, j;
 	unsigned short signature;
 	char fname[256];
 
-	// Two disks...
-	if (_inputPaths.size() != 2)
-		error("Two input files expected!");
-	Filename inpath1(_inputPaths[0]);
-	Filename inpath2(_inputPaths[1]);
+	Filename inpath1(_inputPaths[0].path);
+	Filename inpath2(_inputPaths[1].path);
 	Filename &outpath = _outputPath;
 
 	if (outpath.empty())

Modified: tools/branches/gsoc2009-gui/extract_mm_apple.h
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_apple.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_mm_apple.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -31,8 +31,6 @@
 class ExtractMMApple : public Tool {
 public:
 	ExtractMMApple(const std::string &name = "extract_mm_apple");
-	
-	virtual bool inspectInput(const Filename &filename);
 
 	virtual void execute();
 

Modified: tools/branches/gsoc2009-gui/extract_mm_c64.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_c64.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_mm_c64.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -44,23 +44,25 @@
 };
 
 ExtractMMC64::ExtractMMC64(const std::string &name) : Tool(name) {
+	
+	ToolInput input1;
+	input1.format = "*.d64";
+	_inputPaths.push_back(input1);
+
+	ToolInput input2;
+	input2.format = "*.d64";
+	_inputPaths.push_back(input2);
+
 	_helptext = "\nUsage: " + _name + " [-o <output dir> = out/] <disk1.d64> <disk2.d64>\n";
 }
 
-bool ExtractMMC64::inspectInput(const Filename &filename) {
-	return filename.hasExtension("d64");
-}
-
 void ExtractMMC64::execute() {
 	int i, j;
 	unsigned short signature;
 	char fname[256];
 	
-	// Two disks...
-	if (_inputPaths.size() != 2)
-		error("Two input files expected!");
-	Filename inpath1(_inputPaths[0]);
-	Filename inpath2(_inputPaths[1]);
+	Filename inpath1(_inputPaths[0].path);
+	Filename inpath2(_inputPaths[1].path);
 	Filename &outpath = _outputPath;
 
 	if (outpath.empty())

Modified: tools/branches/gsoc2009-gui/extract_mm_c64.h
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_c64.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_mm_c64.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -31,8 +31,6 @@
 class ExtractMMC64 : public Tool {
 public:
 	ExtractMMC64(const std::string &name = "extract_mm_c64");
-	
-	virtual bool inspectInput(const Filename &filename);
 
 	virtual void execute();
 

Modified: tools/branches/gsoc2009-gui/extract_mm_nes.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_nes.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_mm_nes.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -1112,24 +1112,22 @@
 }
 
 ExtractMMNes::ExtractMMNes(const std::string &name) : Tool(name) {
+	
+	ToolInput input;
+	input.format = "*.PRG";
+	_inputPaths.push_back(input);
+
 	_helptext = 
 		"\nUsage: " + _name + " [-o <output dir> = out/] <infile.PRG>\n"
 		"\tSupported versions: USA, Europe, Sweden, France, Germany, Spain\n"
 		"\tJapanese version is NOT supported!\n";
 }
 
-bool ExtractMMNes::inspectInput(const Filename &filename) {
-	return filename.hasExtension("PRG");
-}
-
 void ExtractMMNes::execute() {
 	int i, j;
 	uint32 CRC;
 
-	// We only got one input file
-	if (_inputPaths.size() > 1)
-		error("Only one input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename &outpath = _outputPath;
 
 	File input(inpath, "rb");

Modified: tools/branches/gsoc2009-gui/extract_mm_nes.h
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_nes.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_mm_nes.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -66,8 +66,6 @@
 class ExtractMMNes : public Tool {
 public:
 	ExtractMMNes(const std::string &name = "extract_mm_nes");
-	
-	virtual bool inspectInput(const Filename &filename);
 
 	virtual void execute();
 

Modified: tools/branches/gsoc2009-gui/extract_parallaction.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_parallaction.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_parallaction.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -293,6 +293,11 @@
 }
 
 ExtractParallaction::ExtractParallaction(const std::string &name) : Tool(name) {
+	
+	ToolInput input;
+	input.format = "*.*";
+	_inputPaths.push_back(input);
+
 	_helptext = "\nUsage: " + _name + " [--small] [-o <output dir> = out/] <file>\n";
 }
 
@@ -305,10 +310,7 @@
 
 void ExtractParallaction::execute() {
 
-	// We only got one input file
-	if (_inputPaths.size() > 1)
-		error("Only one input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename &outpath = _outputPath;
 
 	if (outpath.empty())

Modified: tools/branches/gsoc2009-gui/extract_scumm_mac.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_scumm_mac.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_scumm_mac.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -27,6 +27,11 @@
 #define CHANGECASE
 
 ExtractScummMac::ExtractScummMac(const std::string &name) : Tool(name) {
+	
+	ToolInput input;
+	input.format = "*.*";
+	_inputPaths.push_back(input);
+
 	_helptext =
 		"\nUsage: " + _name + " [-o <output dir> = out/] <file>\n"
 		"\tSome Lucas Arts CDs appear to contains only an application.\n"
@@ -42,10 +47,7 @@
 	unsigned long i;
 	int j;
 
-	// We only got one input file
-	if (_inputPaths.size() > 1)
-		error("Only one input file expected!");
-	Filename inpath(_inputPaths[0]);
+	Filename inpath(_inputPaths[0].path);
 	Filename outpath(_outputPath);
 
 	if (outpath.empty())

Modified: tools/branches/gsoc2009-gui/extract_zak_c64.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_zak_c64.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_zak_c64.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -44,13 +44,13 @@
 };
 
 ExtractZakC64::ExtractZakC64(const std::string &name) : Tool(name) {
+	ToolInput input;
+	input.format = "*.d64";
+	_inputPaths.push_back(input);
+
 	_helptext = "\nUsage: " + _name + " [-o <output dir> = out/] <disk1.d64> <disk2.d64>\n";
 }
 
-bool ExtractZakC64::inspectInput(const Filename &filename) {
-	return filename.hasExtension("d64");
-}
-
 void ExtractZakC64::execute() {
 	int i, j;
 	unsigned short signature;
@@ -58,10 +58,8 @@
 	char fname[1024];
 
 	// Two disks...
-	if (_inputPaths.size() != 2)
-		error("Two input files expected!");
-	Filename inpath1(_inputPaths[0]);
-	Filename inpath2(_inputPaths[1]);
+	Filename inpath1(_inputPaths[0].path);
+	Filename inpath2(_inputPaths[1].path);
 	Filename &outpath = _outputPath;
 
 	if (outpath.empty())
@@ -158,7 +156,8 @@
 
 #ifdef STANDALONE_MAIN
 int main(int argc, char *argv[]) {
-	return export_main(extract_zak_c64)(argc, argv);
+	ExtractZakC64 z64(argv[0]);
+	return z64.run(argc, argv);
 }
 #endif
 

Modified: tools/branches/gsoc2009-gui/extract_zak_c64.h
===================================================================
--- tools/branches/gsoc2009-gui/extract_zak_c64.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/extract_zak_c64.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -28,8 +28,6 @@
 class ExtractZakC64 : public Tool {
 public:
 	ExtractZakC64(const std::string &name = "extract_zak_c64");
-	
-	virtual bool inspectInput(const Filename &filename);
 
 	virtual void execute();
 

Modified: tools/branches/gsoc2009-gui/gui/pages.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/pages.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/gui/pages.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -293,7 +293,7 @@
 		filename = (const char *)inFileWindow ->GetPath().mb_str();
 
 	if (_configuration.advanced) {
-		if (_configuration.selectedTool->_inputs.size() > 1)
+		if (_configuration.selectedTool->getInputList().size() > 1)
 			switchPage(new ChooseExtraInPage(_topframe));
 		else
 			switchPage(new ChooseOutPage(_topframe));
@@ -330,18 +330,19 @@
 	wxStaticBoxSizer *inputbox = new wxStaticBoxSizer(wxVERTICAL, panel, wxT("Input files"));
 
 	int i = 1;
-	wxASSERT_MSG(tool._inputs.size() > 1, wxT("Extra input page should not display with only one input"));
+	ToolInputs &inputs = tool.getInputList();
+	wxASSERT_MSG(inputs.size() > 1, wxT("Extra input page should not display with only one input"));
 
-	for (ToolInputs::const_iterator iter = tool._inputs.begin() + 1; iter != tool._inputs.end(); ++iter) {
+	for (ToolInputs::const_iterator iter = inputs.begin() + 1; iter != inputs.end(); ++iter) {
 		const ToolInput &input = *iter;
 
 		wxString windowName = wxT("InputPicker");
 		windowName << i;
 
-		if (input._file) {
+		if (input.file) {
 			inputbox->Add(new wxFilePickerCtrl(
 				panel, wxID_ANY, wxEmptyString, wxT("Select a file"), 
-				input._extension, 
+				wxString(input.format.c_str(), wxConvUTF8), 
 				wxDefaultPosition, wxDefaultSize, 
 				wxFLP_USE_TEXTCTRL | wxDIRP_DIR_MUST_EXIST, wxDefaultValidator, 
 				windowName));
@@ -382,7 +383,7 @@
 		filelist.erase(filelist.begin() + 1, filelist.end());
 
 	int i = 1;
-	for (ToolInputs::const_iterator iter = tool._inputs.begin(); iter != tool._inputs.end(); ++iter) {
+	for (ToolInputs::const_iterator iter = tool.getInputList().begin(); iter != tool.getInputList().end(); ++iter) {
 		wxString windowName = wxT("InputPicker");
 		windowName << i;
 

Modified: tools/branches/gsoc2009-gui/gui/tools.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/tools.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/gui/tools.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -80,19 +80,15 @@
 	addTool(new ToolGUI(new CompressSword1()));
 	addTool(new ToolGUI(new CompressSword2()));
 	addTool(new ToolGUI(new CompressTinsel()));
-	addTool(new ToolGUI(new CompressTouche(), wxT("/")));
-	addTool(new ToolGUI(new CompressTucker(), wxT("/")));
+	addTool(new ToolGUI(new CompressTouche()));
+	addTool(new ToolGUI(new CompressTucker()));
 
 	addTool(new ToolGUI(new ExtractAgos()));
 	addTool(new ToolGUI(new ExtractGobStk()));
 	addTool(new ToolGUI(new ExtractLoomTG16()));
 	addTool(new ToolGUI(new ExtractMMApple()));
-	ToolGUI *mmc64 = new ToolGUI(new ExtractMMC64());
-	mmc64->addInput(wxT("*.*"));
-	addTool(mmc64);
-	ToolGUI *mmnes = new ToolGUI(new ExtractMMNes());
-	mmnes->addInput(wxT("*.*"));
-	addTool(mmnes);
+	addTool(new ToolGUI(new ExtractMMC64()));
+	addTool(new ToolGUI(new ExtractMMNes()));
 	addTool(new ToolGUI(new ExtractParallaction()));
 	addTool(new ToolGUI(new ExtractZakC64()));
 
@@ -267,7 +263,7 @@
 	//wxLogError(wxT("Created empty tool, should never happened."));
 }
 
-ToolGUI::ToolGUI(Tool *tool, wxString input_extensions) {
+ToolGUI::ToolGUI(Tool *tool) {
 	_backend = tool;
 	_name = wxString(tool->_name.c_str(), wxConvUTF8);
 
@@ -279,12 +275,6 @@
 		wxLogError(wxT("Tools with unknown type shouldn't exist."));
 		_type = TOOLTYPE_UNKNOWN;
 	}
-	
-	// Sensible defaults
-	ToolInput input;
-	input._extension = input_extensions;
-	input._file = input_extensions != wxT("/");
-	_inputs.push_back(input);
 
 	_inHelpText = wxT("Please select any additional input files.");
 }
@@ -297,11 +287,8 @@
 	return _backend->inspectInput(filename);
 }
 
-void ToolGUI::addInput(const wxString &input_wildcard, bool input_is_directory) {
-	ToolInput t;
-	t._extension = input_wildcard;
-	t._file = !input_is_directory;
-	_inputs.push_back(t);
+ToolInputs ToolGUI::getInputList() const {
+	return _backend->_inputPaths;
 }
 
 bool ToolGUI::supportsAudioFormat(AudioFormat format) const {
@@ -318,8 +305,9 @@
 
 void ToolGUI::run(const Configuration &conf) const {
 	_backend->_inputPaths.clear();
-	for (wxArrayString::const_iterator iter = conf.inputFilePaths.begin(); iter != conf.inputFilePaths.end(); ++iter)
-		_backend->_inputPaths.push_back((const char *)iter->mb_str());
+	size_t i = 0;
+	for (wxArrayString::const_iterator iter = conf.inputFilePaths.begin(); iter != conf.inputFilePaths.end(); ++iter, ++i)
+		_backend->_inputPaths[i].path = (const char *)iter->mb_str();
 	_backend->_outputPath = std::string(conf.outputPath.mb_str());
 
 	CompressionTool *compression = dynamic_cast<CompressionTool *>(_backend);

Modified: tools/branches/gsoc2009-gui/gui/tools.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/tools.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/gui/tools.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -42,23 +42,7 @@
 	TOOLTYPE_ALL,
 };
 
-
 /**
- * Describes a possible input to the tool (since some take two seperate files, 
- * some a dir and some a single file
- */
-struct ToolInput {
-	/** The extension of this input file, ignored for directories */
-	wxString _extension;
-	/** A short description of what file is expected, displayed in the UI */
-	wxString _description;
-	/** If false, this input is a directory */
-	bool _file;
-};
-
-typedef std::vector<ToolInput> ToolInputs;
-
-/**
  * A tool supported by the Wizard, holds all information about what format it supports
  * what input it requires etc.
  * This is just the frontend, for the backend, the 'Tool' class is used, which this class
@@ -70,6 +54,7 @@
 class ToolGUI {
 	// Block copy-construction
 	ToolGUI(const ToolGUI &);
+
 public:
 	ToolGUI();
 	/**
@@ -79,10 +64,8 @@
 	 * you must set the type manually.
 	 *
 	 * @param name The name of the tool, should match the executable name (without the extension)
-	 * @param main The tool entry point, defined in tool_entry_point.h
-	 * @param input_extenion Filename filter of the input  to expect.
 	 */
-	ToolGUI(Tool *tool, wxString input_extension = wxT("*.*"));
+	ToolGUI(Tool *tool);
 	~ToolGUI();
 
 	/**
@@ -93,14 +76,6 @@
 	void addGame(const wxString &game_name);
 
 	/**
-	 * Adds a file input to the tool.
-	 *
-	 * @param input_wildcard The wildcard filename of the input, like "*.zip".
-	 * @param input_is_directory True if input is a directory (false by default).
-	 */
-	void addInput(const wxString &input_wildcard, bool input_is_directory = false);
-
-	/**
 	 * Returns true if the file appears to be valid input to this tool.
 	 *
 	 * @param filename The file to inspect.
@@ -108,6 +83,11 @@
 	 */
 	bool inspectInput(const Filename &filename) const;
 
+	/**
+	 *
+	 */
+	ToolInputs getInputList() const;
+
 	// Helper functions to get info about the tool
 	
 	/**
@@ -145,8 +125,6 @@
 	Tool *_backend;
 	/** Type of tool, either extract, compress or unknown */
 	ToolType _type;
-	/** List of all inputs this tool expects */
-	ToolInputs _inputs;
 	/** The help text displayed on the input/output page */
 	wxString _inHelpText;
 };

Modified: tools/branches/gsoc2009-gui/tool.cpp
===================================================================
--- tools/branches/gsoc2009-gui/tool.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/tool.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -32,7 +32,6 @@
 	_arguments_parsed = 0;
 	_argv = NULL;
 
-	_inputFromDirectory = false;
 	_outputToDirectory = true;
 	_supportedFormats = AUDIO_NONE;
 	_supportsProgressBar = false;
@@ -79,9 +78,14 @@
 	parseExtraArguments();
 
 	// Read input files from CLI
-	while (_arguments_parsed < _arguments.size()) {
+	for(ToolInputs::iterator iter = _inputPaths.begin(); iter != _inputPaths.end(); ++iter) {
+		if(_arguments_parsed > _inputPaths.size()) {
+			print("Too few input files!");
+			return -2;
+		}
+
 		std::string &in = _arguments[_arguments_parsed++];
-		if (_inputFromDirectory) {
+		if (!iter->file) {
 			// Append '/' to input if it's not already done
 			// TODO: We need a way to detect a proper directory here!
 			size_t s = in.size();
@@ -90,9 +94,15 @@
 				in[s+1] = '\0';
 			}
 		}
-		_inputPaths.push_back(in);
+
+		iter->path = in;
 	}
 
+	if(_arguments_parsed < _arguments.size()) {
+		print("Too many input files!");
+		return -2;
+	}
+
 	if (_inputPaths.empty()) {
 		// Display help text if we got no input
 		print(_helptext.c_str());
@@ -118,7 +128,36 @@
 }
 
 bool Tool::inspectInput(const Filename &filename) {
-	return true;
+	for (ToolInputs::iterator iter = _inputPaths.begin(); iter != _inputPaths.end(); ++iter) {
+		std::string p = iter->format;
+		if (p == "/") {
+			// Directory, we don't handle this yet, display all tools
+			return true;
+		}
+		
+		Filename cmp_filename = p;
+
+		if (cmp_filename.getName() == "*") {
+			if (cmp_filename.getExtension() == "*")
+				// Match anything!
+				return true;
+			else if (cmp_filename.getExtension() == filename.getExtension())
+				// Extensions are the same
+				return true;
+		} else {
+			// Match on filename
+			if (cmp_filename.getName() == filename.getName()) {
+				if (cmp_filename.getExtension() == "*")
+					return true;
+				else if (cmp_filename.getExtension() == filename.getExtension())
+					// Filenames are identical
+					return true;
+			}
+		}
+	}
+
+	// Didn't match any of our inputs
+	return false;
 }
 
 void Tool::setPrintFunction(void (*f)(void *, const char *), void *udata) {

Modified: tools/branches/gsoc2009-gui/tool.h
===================================================================
--- tools/branches/gsoc2009-gui/tool.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/tool.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -31,6 +31,25 @@
 
 class ToolGUI;
 
+/**
+ * Describes a possible input to the tool (since some take two seperate files, 
+ * some a dir and some a single file
+ */
+struct ToolInput {
+	ToolInput() : format("*.*"), file(true) {}
+
+	/** The expected format of the input file, in wildcard fashion */
+	std::string format;
+	/** A short description of what file is expected, displayed in the UI */
+	std::string description;
+	/** The path filled in */
+	std::string path;
+	/** If false, this input is a directory */
+	bool file;
+};
+
+typedef std::vector<ToolInput> ToolInputs;
+
 class Tool {
 public:
 	Tool(const std::string &name);
@@ -142,8 +161,8 @@
 
 public:
 
-	// Input
-	std::vector<std::string> _inputPaths;
+	/** List of all inputs this tool expects, also contains the paths filled in */
+	ToolInputs _inputPaths;
 
 	// Output
 	Filename _outputPath;
@@ -160,8 +179,6 @@
 
 	/** If this tools outputs to a directory, not a file. */
 	bool _outputToDirectory;
-	/** We don't take a single file, but an entire directory as input .*/
-	bool _inputFromDirectory;
 	/** Formats supported by this tool. */
 	AudioFormat _supportedFormats;
 	/** If this tool can display output progress in % */

Modified: tools/branches/gsoc2009-gui/util.cpp
===================================================================
--- tools/branches/gsoc2009-gui/util.cpp	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/util.cpp	2009-07-17 01:55:11 UTC (rev 42557)
@@ -273,6 +273,42 @@
 	return _path.substr(slash + 1);
 }
 
+std::string Filename::getName() const {
+	size_t slash = _path.rfind('/');
+	size_t dot = _path.rfind('.');
+	if (slash == std::string::npos)
+		slash = _path.rfind('\\');
+
+	if (dot == std::string::npos)
+		dot = _path.size();
+
+	if (slash == std::string::npos)
+		return _path.substr(0, dot);
+
+	if (dot < slash)
+		dot = _path.size();
+
+	return _path.substr(slash + 1, dot - slash - 1);
+}
+
+std::string Filename::getExtension() const {
+	size_t slash = _path.rfind('/');
+	size_t dot = _path.rfind('.');
+	if (slash == std::string::npos)
+		slash = _path.rfind('\\');
+
+	if (slash == std::string::npos)
+		slash = 0;
+
+	if (dot == std::string::npos)
+		return "";
+
+	if (dot < slash)
+		return "";
+
+	return _path.substr(dot + 1);
+}
+
 std::string Filename::getPath() const {
 	size_t slash = _path.rfind('/');
 	if (slash == std::string::npos)

Modified: tools/branches/gsoc2009-gui/util.h
===================================================================
--- tools/branches/gsoc2009-gui/util.h	2009-07-17 01:42:58 UTC (rev 42556)
+++ tools/branches/gsoc2009-gui/util.h	2009-07-17 01:55:11 UTC (rev 42557)
@@ -324,6 +324,8 @@
 
 	const std::string &getFullPath() const;
 	std::string getFullName() const;
+	std::string getName() const;
+	std::string getExtension() const;
 	std::string getPath() const;
 };
 


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