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

Remere at users.sourceforge.net Remere at users.sourceforge.net
Sun Jul 19 03:03:25 CEST 2009


Revision: 42602
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42602&view=rev
Author:   Remere
Date:     2009-07-19 01:03:25 +0000 (Sun, 19 Jul 2009)

Log Message:
-----------
*Converted ExtractKyra and EncodeDXA, now all tools should be working in the GUI (bugs not accounted for).

Modified Paths:
--------------
    tools/branches/gsoc2009-gui/encode_dxa.cpp
    tools/branches/gsoc2009-gui/extract_kyra.cpp
    tools/branches/gsoc2009-gui/extract_kyra.h
    tools/branches/gsoc2009-gui/gui/tools.cpp
    tools/branches/gsoc2009-gui/gui/tools.h

Added Paths:
-----------
    tools/branches/gsoc2009-gui/encode_dxa.h

Modified: tools/branches/gsoc2009-gui/encode_dxa.cpp
===================================================================
--- tools/branches/gsoc2009-gui/encode_dxa.cpp	2009-07-19 00:58:01 UTC (rev 42601)
+++ tools/branches/gsoc2009-gui/encode_dxa.cpp	2009-07-19 01:03:25 UTC (rev 42602)
@@ -38,10 +38,6 @@
 #define  BLOCKW	4
 #define  BLOCKH	4
 
-static AudioFormat gCompMode = AUDIO_MP3;
-
-enum ScaleMode { S_NONE, S_INTERLACED, S_DOUBLE };
-
 struct DiffStruct {
 	uint16 map;
 	int count;
@@ -50,7 +46,7 @@
 
 class DxaEncoder {
 private:
-	FILE *_dxa;
+	File _dxa;
 	int _width, _height, _framerate, _framecount, _workheight;
 	uint8 *_prevframe, *_prevpalette;
 	ScaleMode _scaleMode;
@@ -65,15 +61,15 @@
 	uLong m13encode(byte *frame, byte *outbuf);
 
 public:
-	DxaEncoder(const char *filename, int width, int height, int framerate, ScaleMode scaleMode);
+	DxaEncoder(Tool &tool, Filename filename, int width, int height, int framerate, ScaleMode scaleMode);
 	~DxaEncoder();
 	void writeHeader();
 	void writeNULL();
 	void writeFrame(uint8 *frame, uint8 *palette);
 };
 
-DxaEncoder::DxaEncoder(const char *filename, int width, int height, int framerate, ScaleMode scaleMode) {
-	_dxa = fopen(filename, "wb");
+DxaEncoder::DxaEncoder(Tool &tool, Filename filename, int width, int height, int framerate, ScaleMode scaleMode) {
+	_dxa.open(filename, "wb");
 	_width = width;
 	_height = height;
 	_framerate = framerate;
@@ -92,12 +88,10 @@
 }
 
 DxaEncoder::~DxaEncoder() {
-	fseek(_dxa, 0, SEEK_SET);
+	_dxa.seek(0, SEEK_SET);
 
 	writeHeader();
 
-	fclose(_dxa);
-
 	delete[] _codeBuf;
 	delete[] _dataBuf;
 	delete[] _motBuf;
@@ -117,25 +111,25 @@
 	else if (_scaleMode == S_DOUBLE)
 		version |= 0x40;
 
-	writeUint32LE(_dxa, typeDEXA);
-	writeByte(_dxa, version);
+	_dxa.writeUint32LE(typeDEXA);
+	_dxa.writeByte(version);
 
-	writeUint16BE(_dxa, _framecount);
-	writeUint32BE(_dxa, _framerate);
-	writeUint16BE(_dxa, _width);
-	writeUint16BE(_dxa, _height);
+	_dxa.writeUint16BE(_framecount);
+	_dxa.writeUint32BE(_framerate);
+	_dxa.writeUint16BE(_width);
+	_dxa.writeUint16BE(_height);
 }
 
 void DxaEncoder::writeNULL() {
 	//NULL
-	writeUint32LE(_dxa, typeNULL);
+	_dxa.writeUint32LE(typeNULL);
 }
 
 void DxaEncoder::writeFrame(byte *frame, byte *palette) {
 
 	if (_framecount == 0 || memcmp(_prevpalette, palette, 768)) {
-		writeUint32LE(_dxa, typeCMAP);
-		fwrite(palette, 768, 1, _dxa);
+		_dxa.writeUint32LE(typeCMAP);
+		_dxa.write(palette, 768, 1);
 		memcpy(_prevpalette, palette, 768);
 	} else {
 		writeNULL();
@@ -145,7 +139,7 @@
 		//FRAM
 		byte compType;
 
-		writeUint32LE(_dxa, typeFRAM);
+		_dxa.writeUint32LE(typeFRAM);
 
 		if (_framecount == 0)
 			compType = 2;
@@ -159,9 +153,9 @@
 				uLong outsize = _width * _workheight;
 				byte *outbuf = new byte[outsize];
 				compress2(outbuf, &outsize, frame, _width * _workheight, 9);
-				writeByte(_dxa, compType);
-				writeUint32BE(_dxa, outsize);
-				fwrite(outbuf, outsize, 1, _dxa);
+				_dxa.writeByte(compType);
+				_dxa.writeUint32BE(outsize);
+				_dxa.write(outbuf, outsize, 1);
 				delete[] outbuf;
 				break;
 			}
@@ -220,9 +214,9 @@
 					frameoutbuf = rawbuf_z;
 				}
 
-				writeByte(_dxa, compType);
-				writeUint32BE(_dxa, frameoutsize);
-				fwrite(frameoutbuf, frameoutsize, 1, _dxa);
+				_dxa.writeByte(compType);
+				_dxa.writeUint32BE(frameoutsize);
+				_dxa.write(frameoutbuf, frameoutsize, 1);
 
 				delete[] xorbuf_z;
 				delete[] rawbuf_z;
@@ -541,7 +535,107 @@
 	return outb - outbuf;
 }
 
-int read_png_file(const char* filename, unsigned char *&image, unsigned char *&palette, int &width, int &height) {
+EncodeDXA::EncodeDXA(const std::string &name) : CompressionTool(name) {
+	
+	ToolInput input;
+	input.format = "*.*";
+	_inputPaths.push_back(input);
+
+	_helptext = 
+		"Usage: " + _name + " [mode] [mode-params] [-o outpufile = inputfile.san] <inputfile>\n" +
+		"Output will be two files, one with .dxa extension and the other depending on the used audio codec." 
+		+ kCompressionAudioHelp;
+}
+
+void EncodeDXA::execute() {
+	int width, height, framerate, frames;
+	ScaleMode scaleMode;
+	Filename inpath(_inputPaths[0].path);
+	Filename outpath(_outputPath);
+	
+	if (outpath.empty())
+		// Actual change of extension is done later...
+		outpath = inpath;
+
+	// check if the wav file exists.
+	Filename wavpath(inpath);
+	wavpath.setExtension(".wav");
+	struct stat statinfo;
+	if (!stat(wavpath.getFullPath().c_str(), &statinfo)) {
+		outpath.setExtension(audio_extensions(_format));
+		convertWAV(&wavpath, &outpath);
+	}
+
+	// read some data from the Bink or Smacker file.
+	readVideoInfo(&inpath, width, height, framerate, frames, scaleMode);
+
+	print("Width = %d, Height = %d, Framerate = %d, Frames = %d\n",
+		   width, height, framerate, frames);
+
+	// create the encoder object
+	outpath.setExtension(".dxa");
+	DxaEncoder dxe(*this, outpath, width, height, framerate, scaleMode);
+
+	// No sound block
+	dxe.writeNULL();
+
+	uint8 *image = NULL;
+	uint8 *palette = NULL;
+	int framenum = 0;
+
+	print("Encoding video...");
+
+	char fullname[1024];
+	strcpy(fullname, inpath.getFullPath().c_str());
+	for (int f = 0; f < frames; f++) {
+		char strbuf[1024];
+		if (frames > 999)
+			sprintf(strbuf, "%s%04d.png", fullname, framenum);
+		else if (frames > 99)
+			sprintf(strbuf, "%s%03d.png", fullname, framenum);
+		else if (frames > 9)
+			sprintf(strbuf, "%s%02d.png", fullname, framenum);
+		else
+			sprintf(strbuf, "%s%d.png", fullname, framenum);
+		inpath.setFullName(strbuf);
+
+		int r = read_png_file(inpath.getFullPath().c_str(), image, palette, width, height);
+
+		if (!palette) {
+			error("8-bit 256-color image expected");
+		}
+
+		if (!r) {
+			if (scaleMode != S_NONE) {
+				byte *unscaledImage = new byte[width * height / 2];
+
+				for (int y = 0; y < height; y += 2)
+					memcpy(&unscaledImage[(width*y)/2], &image[width*y], width);
+
+				dxe.writeFrame(unscaledImage, palette);
+				delete[] unscaledImage;
+			} else {
+				dxe.writeFrame(image, palette);
+			}
+		}
+
+		if (image) delete[] image;
+		if (palette) delete[] palette;
+
+		if (r)
+			break;
+
+		framenum++;
+
+		if (framenum % 20 == 0) {
+			print("Encoding video...%d%% (%d of %d)", 100 * framenum / frames, framenum, frames);
+		}
+	}
+
+	print("Encoding video...100%% (%d of %d)\n", frames, frames);
+}
+
+int EncodeDXA::read_png_file(const char* filename, unsigned char *&image, unsigned char *&palette, int &width, int &height) {
 	png_byte header[8];
 
 	png_byte color_type;
@@ -552,11 +646,9 @@
 	int number_of_passes;
 	png_bytep *row_pointers;
 
-	FILE *fp = fopen(filename, "rb");
-	if (!fp) {
-		error("read_png_file: Cannot open file: %s", filename);
-	}
-	fread(header, 1, 8, fp);
+	File fp(filename, "rb");
+
+	fp.read(header, 1, 8);
 	if (png_sig_cmp(header, 0, 8))
 		return 1;
 
@@ -617,44 +709,38 @@
 	memcpy(palette, pngpalette, 768);
 	free(pngpalette);
 
-	fclose(fp);
-
 	return 0;
 }
 
-void readVideoInfo(Filename *filename, int &width, int &height, int &framerate, int &frames,
-	ScaleMode &scaleMode) {
+void EncodeDXA::readVideoInfo(Filename *filename, int &width, int &height, int &framerate, int &frames, ScaleMode &scaleMode) {
 
-	FILE *smk = fopen(filename->getFullPath().c_str(), "rb");
-	if (!smk) {
-		error("readVideoInfo: Cannot open file: %s", filename->getFullPath().c_str());
-	}
+	File smk(*filename, "rb");
 
 	scaleMode = S_NONE;
 
 	char buf[4];
-	fread(buf, 1, 4, smk);
+	smk.read(buf, 1, 4);
 	if (!memcmp(buf, "BIK", 3)) {
 		// Skip file size
-		readUint32LE(smk);
+		smk.readUint32LE();
 
-		frames = readUint32LE(smk);
+		frames = smk.readUint32LE();
 
 		// Skip unknown
-		readUint32LE(smk);
-		readUint32LE(smk);
+		smk.readUint32LE();
+		smk.readUint32LE();
 
-		width = readUint32LE(smk);
-		height = readUint32LE(smk);
-		framerate = readUint32LE(smk);
+		width = smk.readUint32LE();
+		height = smk.readUint32LE();
+		framerate = smk.readUint32LE();
 	} else if (!memcmp(buf, "SMK2", 4) || !memcmp(buf, "SMK4", 4)) {
 		uint32 flags;
 
-		width = readUint32LE(smk);
-		height = readUint32LE(smk);
-		frames = readUint32LE(smk);
-		framerate = readUint32LE(smk);
-		flags = readUint32LE(smk);
+		width = smk.readUint32LE();
+		height = smk.readUint32LE();
+		frames = smk.readUint32LE();
+		framerate = smk.readUint32LE();
+		flags = smk.readUint32LE();
 
 		// If the Y-interlaced or Y-doubled flag is set, the RAD Video Tools
 		// will have scaled the frames to twice their original height.
@@ -669,133 +755,15 @@
 	} else {
 		error("readVideoInfo: Unknown type");
 	}
-
-	fclose(smk);
 }
 
-void convertWAV(const Filename *inpath, const Filename* outpath) {
+void EncodeDXA::convertWAV(const Filename *inpath, const Filename* outpath) {
 	print("Encoding audio...");
 	fflush(stdout);
 
-	encodeAudio(inpath->getFullPath().c_str(), false, -1, outpath->getFullPath().c_str(), gCompMode);
+	encodeAudio(inpath->getFullPath().c_str(), false, -1, outpath->getFullPath().c_str(), _format);
 }
 
-
-int export_main(compress_dxa)(int argc, char *argv[]) {
-	const char *helptext = "\nUsage: %s [mode] [mode-params] [-o outpufile = inputfile.san] <inputfile>\nOutput will be two files with the .dxa and the other depending on the used audio codec." kCompressionAudioHelp;
-	
-	int width, height, framerate, frames;
-	ScaleMode scaleMode;
-	Filename inpath, outpath;
-	int first_arg = 1;
-	int last_arg = argc - 1;
-
-	parseHelpArguments(argv, argc, helptext);
-
-	// compression mode
-	gCompMode = process_audio_params(argc, argv, &first_arg);
-	
-	// Now we try to find the proper output file
-	// also make sure we skip those arguments
-	if (parseOutputFileArguments(&outpath, argv, argc, first_arg))
-		first_arg += 2;
-	else if (parseOutputFileArguments(&outpath, argv, argc, last_arg - 2))
-		last_arg -= 2;
-	else 
-		// Just leave it empty, we just change extension of input file
-		;
-
-	inpath.setFullPath(argv[first_arg]);
-
-	if (outpath.empty()) {
-		// Actual change of extension is done later...
-		outpath = inpath;
-	}
-
-	inpath.setFullPath(argv[first_arg]);
-
-	// check if the wav file exists.
-	Filename wavpath(inpath);
-	wavpath.setExtension(".wav");
-	struct stat statinfo;
-	if (!stat(wavpath.getFullPath().c_str(), &statinfo)) {
-		outpath.setExtension(audio_extensions(gCompMode));
-		convertWAV(&wavpath, &outpath);
-	}
-
-	// read some data from the Bink or Smacker file.
-	readVideoInfo(&inpath, width, height, framerate, frames, scaleMode);
-
-	print("Width = %d, Height = %d, Framerate = %d, Frames = %d\n",
-		   width, height, framerate, frames);
-
-	// create the encoder object
-	outpath.setExtension(".dxa");
-	DxaEncoder dxe(outpath.getFullPath().c_str(), width, height, framerate, scaleMode);
-
-	// No sound block
-	dxe.writeNULL();
-
-	uint8 *image = NULL;
-	uint8 *palette = NULL;
-	int framenum = 0;
-
-	print("Encoding video...");
-	fflush(stdout);
-
-	char fullname[1024];
-	strcpy(fullname, inpath.getFullPath().c_str());
-	for (int f = 0; f < frames; f++) {
-		char strbuf[1024];
-		if (frames > 999)
-			sprintf(strbuf, "%s%04d.png", fullname, framenum);
-		else if (frames > 99)
-			sprintf(strbuf, "%s%03d.png", fullname, framenum);
-		else if (frames > 9)
-			sprintf(strbuf, "%s%02d.png", fullname, framenum);
-		else
-			sprintf(strbuf, "%s%d.png", fullname, framenum);
-		inpath.setFullName(strbuf);
-
-		int r = read_png_file(inpath.getFullPath().c_str(), image, palette, width, height);
-
-		if (!palette) {
-			error("8-bit 256-color image expected");
-		}
-
-		if (!r) {
-			if (scaleMode != S_NONE) {
-				byte *unscaledImage = new byte[width * height / 2];
-
-				for (int y = 0; y < height; y += 2)
-					memcpy(&unscaledImage[(width*y)/2], &image[width*y], width);
-
-				dxe.writeFrame(unscaledImage, palette);
-				delete[] unscaledImage;
-			} else {
-				dxe.writeFrame(image, palette);
-			}
-		}
-
-		if (image) delete[] image;
-		if (palette) delete[] palette;
-
-		if (r)
-			break;
-
-		framenum++;
-
-		if (framenum % 20 == 0) {
-			print("\rEncoding video...%d%% (%d of %d)", 100 * framenum / frames, framenum, frames);
-			fflush(stdout);
-		}
-	}
-
-	print("\rEncoding video...100%% (%d of %d)\n", frames, frames);
-
-	return 0;
-}
-
 #ifdef STANDALONE_MAIN
 int main(int argc, char *argv[]) {
 	EncodeDXA encode_dxa(argv[0]);

Added: tools/branches/gsoc2009-gui/encode_dxa.h
===================================================================
--- tools/branches/gsoc2009-gui/encode_dxa.h	                        (rev 0)
+++ tools/branches/gsoc2009-gui/encode_dxa.h	2009-07-19 01:03:25 UTC (rev 42602)
@@ -0,0 +1,52 @@
+/* encode_dxa - compressor for dxa files
+ * 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 ENCODE_DXA_H
+#define ENCODE_DXA_H
+
+#include "compress.h"
+
+
+enum ScaleMode {
+	S_NONE,
+	S_INTERLACED,
+	S_DOUBLE
+};
+
+class EncodeDXA : public CompressionTool {
+public:
+	EncodeDXA(const std::string &name = "encode_dxa");
+
+	virtual void execute();
+
+
+protected:
+
+	void convertWAV(const Filename *inpath, const Filename* outpath);
+	void readVideoInfo(Filename *filename, int &width, int &height, int &framerate, int &frames, ScaleMode &scaleMode);
+	int read_png_file(const char* filename, unsigned char *&image, unsigned char *&palette, int &width, int &height);
+};
+
+#endif
+
+


Property changes on: tools/branches/gsoc2009-gui/encode_dxa.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: tools/branches/gsoc2009-gui/extract_kyra.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_kyra.cpp	2009-07-19 00:58:01 UTC (rev 42601)
+++ tools/branches/gsoc2009-gui/extract_kyra.cpp	2009-07-19 01:03:25 UTC (rev 42602)
@@ -21,71 +21,65 @@
  *
  */
 
+#include "extract_kyra.h"
+
 #include "kyra_pak.h"
 #include "kyra_ins.h"
 
-int export_main(extract_kyra)(int argc, char *argv[]) {
-	const char *helptext = "\n"
-		"Usage: %s [params] [-o output] <archivefile> [-o output]\n"
-		"Default output path is ./out/\n"
-		"nParams:\n"
-		"-e <filename>     Extract only <filename> from the archive, will be extracted \n"
-		"                  into the current directory.\n"
-		"-x                Extract all files (default)\n"
-		"-a                Extract files from the Amiga .PAK files\n"
+ExtractKyra::ExtractKyra(const std::string &name) : Tool(name) {
+	extractAll = true;
+	extractOne = false;
+	isAmiga = false;
+	isHoFInstaller = false;
+	singleFilename = "";
+	
+	ToolInput input;
+	input.format = "*.*";
+	_inputPaths.push_back(input);
+
+	_helptext = 
+		"Usage: " + _name + "[params] [-o output] <archivefile> [-o output]\n" +
+		"Default output path is ./out/\n" +
+		"nParams:\n" +
+		"-e <filename>     Extract only <filename> from the archive, will be extracted \n" +
+		"                  into the current directory.\n" +
+		"-x                Extract all files (default)\n" +
+		"-a                Extract files from the Amiga .PAK files\n" +
 		"-2                Extract files from HoF installer files\n";
+}
 
-	int first_arg = 1;
-	int last_arg = argc - 1;
-
-	bool extractAll = true, extractOne = false, isAmiga = false, isHoFInstaller = false;
-	char singleFilename[256] = "";
-
-	Filename outpath, inputpath;
-
-	// Check if we should display some helpful text
-	parseHelpArguments(argv, argc, helptext);
-
-	int param = first_arg;
-
+void ExtractKyra::parseExtraArguments() {
 	// Parse our own arguments
-	for (; param < last_arg; ++param) {
-		if (strcmp(argv[param], "-x") == 0) {
+	while(_arguments_parsed < _arguments.size()) {
+		std::string arg = _arguments[_arguments_parsed];
+		if (arg == "-x") {
 			extractAll = true;
 			extractOne = false;
-		} else if (strcmp(argv[param], "-a") == 0) {
+		} else if (arg == "-a") {
 			isAmiga = true;
-		} else if (strcmp(argv[param], "-2") == 0) {
+		} else if (arg == "-2") {
 			isHoFInstaller = true;
-		} else if (strcmp(argv[param], "-n") == 0) {
+		} else if (arg == "-n") {
 			extractOne = true;
 			extractAll = false;
 
-			++param;
+			++_arguments_parsed;
 
-			if (param >= last_arg) {
+			if (_arguments_parsed >= _arguments.size()) {
 				error("No filename supplied to -n\nShould be used on the form: %s -n ALGAE.CPS -o out/ A_E.PAK");
 			} else {
-				strcpy(singleFilename, argv[param]);
+				singleFilename = _arguments[_arguments_parsed];
 			}
 		} else {
 			break;
 		}
+		++_arguments_parsed;
 	}
+}
 
-	// Parse output argument
-	if (parseOutputDirectoryArguments(&outpath, argv, argc, param))
-		param += 2;
-	else if (parseOutputDirectoryArguments(&outpath, argv, argc, argc - 2))
-		last_arg -= 1;
-	else
-		outpath.setFullPath("out/");
+void ExtractKyra::execute() {
+	Filename inputpath(_inputPaths[0].path);
 
-	// Extract files
-	if (first_arg != last_arg)
-		error("Expected only one input file.");
-
-	inputpath.setFullPath(argv[param]);
 	Extractor *extract = 0;
 	if (isHoFInstaller) {
 		extract = new HoFInstaller(inputpath.getFullPath().c_str());
@@ -101,21 +95,21 @@
 
 	// Everything has been decided, do the actual extraction
 	if (extractAll) {
-		extract->outputAllFiles(&outpath);
+		extract->outputAllFiles(&_outputPath);
 	} else if (extractOne) {
 		inputpath.setFullName(singleFilename);
-		extract->outputFileAs(singleFilename, inputpath.getFullPath().c_str());
+		extract->outputFileAs(singleFilename.c_str(), inputpath.getFullPath().c_str());
 	} else {
 		extract->drawFileList();
 	}
 
 	delete extract;
-	return 0;
 }
 
 #ifdef STANDALONE_MAIN
 int main(int argc, char *argv[]) {
-	return export_main(extract_kyra)(argc, argv);
+	ExtractKyra kyra(argv[0]);
+	return kyra.run(argc, argv);
 }
 #endif
 

Modified: tools/branches/gsoc2009-gui/extract_kyra.h
===================================================================
--- tools/branches/gsoc2009-gui/extract_kyra.h	2009-07-19 00:58:01 UTC (rev 42601)
+++ tools/branches/gsoc2009-gui/extract_kyra.h	2009-07-19 01:03:25 UTC (rev 42602)
@@ -23,8 +23,22 @@
 #ifndef EXTRACT_KYRA_H
 #define EXTRACT_KYRA_H
 
-#include "util.h"
+#include "tool.h"
 
+class ExtractKyra : public Tool {
+public:
+	ExtractKyra(const std::string &name = "extract_kyra");
+
+	virtual void execute();
+	
+	void parseExtraArguments();
+
+protected:
+	bool extractAll, extractOne, isAmiga, isHoFInstaller;
+	std::string singleFilename;
+};
+
+
 class Extractor {
 public:
 	virtual ~Extractor() {}

Modified: tools/branches/gsoc2009-gui/gui/tools.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/tools.cpp	2009-07-19 00:58:01 UTC (rev 42601)
+++ tools/branches/gsoc2009-gui/gui/tools.cpp	2009-07-19 01:03:25 UTC (rev 42602)
@@ -49,8 +49,10 @@
 #include "../compress_tinsel.h"
 #include "../compress_touche.h"
 #include "../compress_tucker.h"
+#include "../encode_dxa.h"
 #include "../extract_agos.h"
 #include "../extract_gob_stk.h"
+#include "../extract_kyra.h"
 #include "../extract_loom_tg16.h"
 #include "../extract_mm_apple.h"
 #include "../extract_mm_c64.h"
@@ -82,9 +84,11 @@
 	addTool(new ToolGUI(new CompressTinsel()));
 	addTool(new ToolGUI(new CompressTouche()));
 	addTool(new ToolGUI(new CompressTucker()));
+	addTool(new ToolGUI(new EncodeDXA(), TOOLTYPE_COMPRESSION));
 
 	addTool(new ToolGUI(new ExtractAgos()));
 	addTool(new ToolGUI(new ExtractGobStk()));
+	addTool(new ToolGUI(new ExtractKyra()));
 	addTool(new ToolGUI(new ExtractLoomTG16()));
 	addTool(new ToolGUI(new ExtractMMApple()));
 	addTool(new ToolGUI(new ExtractMMC64()));
@@ -258,23 +262,21 @@
 
 // The Tool class
 
-ToolGUI::ToolGUI() {
-	// Seems std is allowed to create dummy objects in maps.
-	//wxLogError(wxT("Created empty tool, should never happened."));
-}
-
-ToolGUI::ToolGUI(Tool *tool) {
+ToolGUI::ToolGUI(Tool *tool, ToolType type) {
 	_backend = tool;
 	_name = wxString(tool->_name.c_str(), wxConvUTF8);
 
-	if (_name.Find(wxT("extract")) != wxNOT_FOUND)
-		_type = TOOLTYPE_EXTRACTION;
-	else if (_name.Find(wxT("compress")) != wxNOT_FOUND)
-		_type = TOOLTYPE_COMPRESSION;
-	else {
-		wxLogError(wxT("Tools with unknown type shouldn't exist."));
-		_type = TOOLTYPE_UNKNOWN;
-	}
+	if(type == TOOLTYPE_UNKNOWN) {
+		if (_name.Find(wxT("extract")) != wxNOT_FOUND)
+			_type = TOOLTYPE_EXTRACTION;
+		else if (_name.Find(wxT("compress")) != wxNOT_FOUND)
+			_type = TOOLTYPE_COMPRESSION;
+		else {
+			wxLogError(wxT("Tools with unknown type shouldn't exist."));
+			_type = TOOLTYPE_UNKNOWN;
+		}
+	} else
+		_type = type;
 
 	_inHelpText = wxT("Please select any additional input files.");
 }

Modified: tools/branches/gsoc2009-gui/gui/tools.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/tools.h	2009-07-19 00:58:01 UTC (rev 42601)
+++ tools/branches/gsoc2009-gui/gui/tools.h	2009-07-19 01:03:25 UTC (rev 42602)
@@ -56,7 +56,6 @@
 	ToolGUI(const ToolGUI &);
 
 public:
-	ToolGUI();
 	/**
 	 * Creates a new tool, can be stack allocated and copied without problems
 	 * The type of tool is deduced from the name, if it contains 'extract', it's an extraction tool
@@ -65,7 +64,7 @@
 	 *
 	 * @param name The name of the tool, should match the executable name (without the extension)
 	 */
-	ToolGUI(Tool *tool);
+	ToolGUI(Tool *tool, ToolType type = TOOLTYPE_UNKNOWN);
 	~ToolGUI();
 
 	/**


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