[Scummvm-cvs-logs] SF.net SVN: scummvm:[42520] tools/branches/gsoc2009-gui
Remere at users.sourceforge.net
Remere at users.sourceforge.net
Thu Jul 16 02:43:47 CEST 2009
Revision: 42520
http://scummvm.svn.sourceforge.net/scummvm/?rev=42520&view=rev
Author: Remere
Date: 2009-07-16 00:43:47 +0000 (Thu, 16 Jul 2009)
Log Message:
-----------
*Added support for deducing tool based on input file. Right now it only checks extension, and only does so on some tools, so there is room for improvement.
*Fixed minor bugs / spelling mistakes / code formatting errors.
Modified Paths:
--------------
tools/branches/gsoc2009-gui/compress_agos.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_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/encode_dxa.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_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
Modified: tools/branches/gsoc2009-gui/compress_agos.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_agos.cpp 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_agos.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -209,7 +209,7 @@
void CompressAgos::execute() {
// We only got one input file
- if (_inputPaths.size() > 1)
+ if (_inputPaths.size() != 1)
error("Only one input file expected!");
Filename inpath(_inputPaths[0]);
Modified: tools/branches/gsoc2009-gui/compress_kyra.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_kyra.cpp 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_kyra.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -33,7 +33,7 @@
void CompressKyra::execute() {
// Check input
- if (_inputPaths.size() == 1)
+ if (_inputPaths.size() != 1)
error("One input file expected!");
Filename inpath(_inputPaths[0]);
Filename &outpath = _outputPath;
Modified: tools/branches/gsoc2009-gui/compress_queen.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_queen.cpp 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_queen.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -96,6 +96,10 @@
_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;
Modified: tools/branches/gsoc2009-gui/compress_queen.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_queen.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_queen.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -28,6 +28,8 @@
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-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_saga.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -116,6 +116,10 @@
_helptext = "\nUsage: %s [mode] [mode params] [-o outputfile = infile.cmp] <inputfile>\n" kCompressionAudioHelp;
}
+bool CompressSaga::inspectInput(const Filename &filename) {
+ return filename.hasExtension("rsc") || filename.hasExtension("res") || filename.hasExtension("bin") || filename.getFullName() == "inherit the earth voices";
+}
+
// --------------------------------------------------------------------------------
bool CompressSaga::detectFile(Filename *infile) {
@@ -404,7 +408,7 @@
void CompressSaga::execute() {
// Check input
- if (_inputPaths.size() == 1)
+ if (_inputPaths.size() != 1)
error("One input file expected!");
Filename inpath(_inputPaths[0]);
Filename &outpath = _outputPath;
Modified: tools/branches/gsoc2009-gui/compress_saga.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_saga.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_saga.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -44,6 +44,8 @@
class CompressSaga : public CompressionTool {
public:
CompressSaga(const std::string &name = "compress_saga");
+
+ virtual bool inspectInput(const Filename &filename);
virtual void execute();
Modified: tools/branches/gsoc2009-gui/compress_scumm_bun.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_bun.cpp 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_scumm_bun.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -1071,9 +1071,13 @@
_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)
+ if (_inputPaths.size() != 1)
error("One input file expected!");
Filename inpath(_inputPaths[0]);
Filename &outpath = _outputPath;
Modified: tools/branches/gsoc2009-gui/compress_scumm_bun.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_bun.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_scumm_bun.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -29,6 +29,8 @@
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-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_scumm_san.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -580,6 +580,10 @@
_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.");
Modified: tools/branches/gsoc2009-gui/compress_scumm_san.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_san.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_scumm_san.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -32,6 +32,8 @@
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-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_scumm_sou.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -137,11 +137,15 @@
_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)
+ if (_inputPaths.size() != 1)
error("One input file expected!");
Filename inpath(_inputPaths[0]);
Filename &outpath = _outputPath;
Modified: tools/branches/gsoc2009-gui/compress_scumm_sou.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_sou.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_scumm_sou.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -30,6 +30,8 @@
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-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_sword1.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -567,12 +567,16 @@
kCompressionAudioHelp;
}
+bool CompressSword1::inspectInput(const Filename &filename) {
+ return filename.hasExtension("clu");
+}
+
void CompressSword1::parseExtraArguments() {
- if(_arguments[_arguments_parsed] == "--speech-only") {
+ if (_arguments[_arguments_parsed] == "--speech-only") {
_compMusic = false;
++_arguments_parsed;
}
- if(_arguments[_arguments_parsed] == "--music-only") {
+ if (_arguments[_arguments_parsed] == "--music-only") {
_compSpeech = false;
++_arguments_parsed;
}
@@ -580,7 +584,7 @@
void CompressSword1::execute() {
// Check input
- if (_inputPaths.size() == 1)
+ if (_inputPaths.size() != 1)
error("One input file expected!");
Filename inpath(_inputPaths[0]);
Filename &outpath = _outputPath;
Modified: tools/branches/gsoc2009-gui/compress_sword1.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword1.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_sword1.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -29,8 +29,11 @@
class CompressSword1 : public CompressionTool {
public:
CompressSword1(const std::string &name = "compress_sword1");
+
+ virtual bool inspectInput(const Filename &filename);
virtual void execute();
+
protected:
void parseExtraArguments();
Modified: tools/branches/gsoc2009-gui/compress_sword2.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword2.cpp 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_sword2.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -53,6 +53,10 @@
_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;
@@ -61,8 +65,8 @@
// Check _input
- if (_inputPaths.size() == 1)
- error("One _input file expected!");
+ if (_inputPaths.size() != 1)
+ error("One input file expected!");
Filename inpath(_inputPaths[0]);
Filename &outpath = _outputPath;
Modified: tools/branches/gsoc2009-gui/compress_sword2.h
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword2.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/compress_sword2.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -29,8 +29,12 @@
class CompressSword2 : public CompressionTool {
public:
CompressSword2(const std::string &name = "compress_sword2");
+
+ virtual bool inspectInput(const Filename &filename);
virtual void execute();
+
+
protected:
File _input, _output_snd, _output_idx;
Modified: tools/branches/gsoc2009-gui/encode_dxa.cpp
===================================================================
--- tools/branches/gsoc2009-gui/encode_dxa.cpp 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/encode_dxa.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -21,7 +21,7 @@
*
*/
-#include "compress.h"
+#include "encode_dxa.h"
#include "util.h"
#include <png.h>
@@ -674,7 +674,7 @@
}
void convertWAV(const Filename *inpath, const Filename* outpath) {
- printf("Encoding audio...");
+ print("Encoding audio...");
fflush(stdout);
encodeAudio(inpath->getFullPath().c_str(), false, -1, outpath->getFullPath().c_str(), gCompMode);
@@ -726,7 +726,7 @@
// read some data from the Bink or Smacker file.
readVideoInfo(&inpath, width, height, framerate, frames, scaleMode);
- printf("Width = %d, Height = %d, Framerate = %d, Frames = %d\n",
+ print("Width = %d, Height = %d, Framerate = %d, Frames = %d\n",
width, height, framerate, frames);
// create the encoder object
@@ -740,7 +740,7 @@
uint8 *palette = NULL;
int framenum = 0;
- printf("Encoding video...");
+ print("Encoding video...");
fflush(stdout);
char fullname[1024];
@@ -786,20 +786,20 @@
framenum++;
if (framenum % 20 == 0) {
- printf("\rEncoding video...%d%% (%d of %d)", 100 * framenum / frames, framenum, frames);
+ print("\rEncoding video...%d%% (%d of %d)", 100 * framenum / frames, framenum, frames);
fflush(stdout);
}
}
- printf("\rEncoding video...100%% (%d of %d)\n", frames, frames);
+ print("\rEncoding video...100%% (%d of %d)\n", frames, frames);
return 0;
}
-#if defined(UNIX) && defined(EXPORT_MAIN)
-int main(int argc, char *argv[]) __attribute__((weak));
+#ifdef STANDALONE_MAIN
int main(int argc, char *argv[]) {
- return export_main(compress_dxa)(argc, argv);
+ EncodeDXA encode_dxa(argv[0]);
+ return encode_dxa.run(argc, argv);
}
#endif
Modified: tools/branches/gsoc2009-gui/extract_gob_stk.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_gob_stk.cpp 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/extract_gob_stk.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -44,6 +44,10 @@
_helptext = "\nUsage: " + _name + " [-o outputname] infilename\n";
}
+bool ExtractGobStk::inspectInput(const Filename &filename) {
+ return filename.hasExtension("stk") || filename.hasExtension("STK");
+}
+
ExtractGobStk::~ExtractGobStk() {
delete _chunks;
}
Modified: tools/branches/gsoc2009-gui/extract_gob_stk.h
===================================================================
--- tools/branches/gsoc2009-gui/extract_gob_stk.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/extract_gob_stk.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -28,6 +28,8 @@
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-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/extract_loom_tg16.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -1227,6 +1227,10 @@
_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;
Modified: tools/branches/gsoc2009-gui/extract_loom_tg16.h
===================================================================
--- tools/branches/gsoc2009-gui/extract_loom_tg16.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/extract_loom_tg16.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -31,6 +31,8 @@
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-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/extract_mm_apple.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -46,6 +46,10 @@
_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;
Modified: tools/branches/gsoc2009-gui/extract_mm_apple.h
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_apple.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/extract_mm_apple.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -31,6 +31,8 @@
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-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/extract_mm_c64.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -47,6 +47,10 @@
_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;
Modified: tools/branches/gsoc2009-gui/extract_mm_c64.h
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_c64.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/extract_mm_c64.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -31,6 +31,8 @@
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-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/extract_mm_nes.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -1118,6 +1118,10 @@
"\tJapanese version is NOT supported!\n";
}
+bool ExtractMMNes::inspectInput(const Filename &filename) {
+ return filename.hasExtension("PRG");
+}
+
void ExtractMMNes::execute() {
int i, j;
uint32 CRC;
Modified: tools/branches/gsoc2009-gui/extract_mm_nes.h
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_nes.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/extract_mm_nes.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -66,6 +66,8 @@
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_scumm_mac.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_scumm_mac.cpp 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/extract_scumm_mac.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -48,7 +48,7 @@
Filename inpath(_inputPaths[0]);
Filename outpath(_outputPath);
- if(outpath.empty())
+ if (outpath.empty())
outpath.setFullPath("out/");
File ifp(inpath, "rb");
Modified: tools/branches/gsoc2009-gui/extract_zak_c64.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_zak_c64.cpp 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/extract_zak_c64.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -47,6 +47,10 @@
_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;
Modified: tools/branches/gsoc2009-gui/extract_zak_c64.h
===================================================================
--- tools/branches/gsoc2009-gui/extract_zak_c64.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/extract_zak_c64.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -28,6 +28,8 @@
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-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/gui/pages.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -281,13 +281,25 @@
}
void ChooseInPage::onNext(wxWindow *panel) {
+
+ wxDirPickerCtrl *inDirWindow = dynamic_cast<wxDirPickerCtrl *>(panel->FindWindowByName(wxT("InputPicker")));
+ wxFilePickerCtrl *inFileWindow = dynamic_cast<wxFilePickerCtrl *>(panel->FindWindowByName(wxT("InputPicker")));
+
+ Filename filename;
+
+ if (inDirWindow)
+ filename = (const char *)inDirWindow ->GetPath().mb_str();
+ if (inFileWindow)
+ filename = (const char *)inFileWindow ->GetPath().mb_str();
+
if (_configuration.advanced) {
if (_configuration.selectedTool->_inputs.size() > 1)
switchPage(new ChooseExtraInPage(_topframe));
else
switchPage(new ChooseOutPage(_topframe));
} else {
- wxArrayString ls = g_tools.getToolList();
+ wxArrayString ls = g_tools.getToolList(filename,
+ _configuration.compressing? TOOLTYPE_COMPRESSION : TOOLTYPE_EXTRACTION);
// TODO: If only one input, skip this page and go right to ExtraInput
switchPage(new ChooseToolPage(_topframe, ls));
}
@@ -1194,5 +1206,3 @@
buttons->showFinish(true);
}
-
-
Modified: tools/branches/gsoc2009-gui/gui/tools.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/tools.cpp 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/gui/tools.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -232,12 +232,12 @@
return l;
}
-wxArrayString Tools::getGameList(ToolType tt) const {
+wxArrayString Tools::getToolList(const Filename &filename, ToolType tt) const {
wxArrayString l;
for (std::map<wxString, ToolGUI *>::const_iterator iter = tools.begin(); iter != tools.end(); ++iter)
if (tt == TOOLTYPE_ALL || iter->second->_type == tt)
- for (wxArrayString::const_iterator citer = iter->second->_games.begin(); citer != iter->second->_games.end(); ++citer)
- l.Add(*citer);
+ if (iter->second->inspectInput(filename))
+ l.Add(iter->second->_name);
l.Sort();
std::unique(l.begin(), l.end());
return l;
@@ -260,16 +260,6 @@
return iter->second;
}
-const ToolGUI *Tools::getByGame(const wxString &gamename, ToolType type) const {
- for (std::map<wxString, ToolGUI *>::const_iterator iter = tools.begin(); iter != tools.end(); ++iter)
- if (type == TOOLTYPE_ALL || iter->second->_type == type)
- for (wxArrayString::const_iterator citer = iter->second->_games.begin(); citer != iter->second->_games.end(); ++citer)
- if (*citer == gamename)
- return iter->second;
- return NULL;
-}
-
-
// The Tool class
ToolGUI::ToolGUI() {
@@ -303,8 +293,8 @@
delete _backend;
}
-void ToolGUI::addGame(const wxString &game_name) {
- _games.Add(game_name);
+bool ToolGUI::inspectInput(const Filename &filename) const {
+ return _backend->inspectInput(filename);
}
void ToolGUI::addInput(const wxString &input_wildcard, bool input_is_directory) {
Modified: tools/branches/gsoc2009-gui/gui/tools.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/tools.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/gui/tools.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -100,6 +100,14 @@
*/
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.
+ * @return True if we can possibly parse this file.
+ */
+ bool inspectInput(const Filename &filename) const;
+
// Helper functions to get info about the tool
/**
@@ -141,8 +149,6 @@
ToolInputs _inputs;
/** The help text displayed on the input/output page */
wxString _inHelpText;
- /** A list of all games supported by this tool */
- wxArrayString _games;
};
// Collection of all tools
@@ -176,15 +182,6 @@
const ToolGUI *get(const wxString &name) const;
/**
- * Returns a tool that supports the selected game
- *
- * @param game Name of the game
- * @param type The type of tool we're looking for
- * @return The tool that supports this game, and NULL if no tool does
- */
- const ToolGUI *getByGame(const wxString &game, ToolType type = TOOLTYPE_ALL) const;
-
- /**
* Returns a list of all tools
*
* @param tt Filter by this type of tool
@@ -193,12 +190,13 @@
wxArrayString getToolList(ToolType tt = TOOLTYPE_ALL) const;
/**
- * Returns a list of all games supported by all tools (of the specified type)
+ * Inspects the file and returns a list of tools that might be able to handle it
*
- * @param tt Filter by this type of tool
- * @return Returns all games supported, list is sorted and contains no duplicates
+ * @param filename The path to the file to inspect
+ * @param tt Only check tools of this type
+ * @return Returns all tools might be able to handle the file
*/
- wxArrayString getGameList(ToolType tt = TOOLTYPE_ALL) const;
+ wxArrayString getToolList(const Filename &filename, ToolType tt = TOOLTYPE_ALL) const;
protected:
/**
Modified: tools/branches/gsoc2009-gui/tool.cpp
===================================================================
--- tools/branches/gsoc2009-gui/tool.cpp 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/tool.cpp 2009-07-16 00:43:47 UTC (rev 42520)
@@ -117,6 +117,10 @@
execute();
}
+bool Tool::inspectInput(const Filename &filename) {
+ return true;
+}
+
void Tool::setPrintFunction(void (*f)(void *, const char *), void *udata) {
_internalPrint = f;
_print_udata = udata;
Modified: tools/branches/gsoc2009-gui/tool.h
===================================================================
--- tools/branches/gsoc2009-gui/tool.h 2009-07-16 00:06:15 UTC (rev 42519)
+++ tools/branches/gsoc2009-gui/tool.h 2009-07-16 00:43:47 UTC (rev 42520)
@@ -44,6 +44,14 @@
void run();
/**
+ * Returns true if the file appears to be a valid input to this tool,
+ * Default implementation always return true
+ *
+ * @param filename The file to inspect
+ */
+ virtual bool inspectInput(const Filename &filename);
+
+ /**
* Aborts executing of the tool, can be called from another thread
* The progress will not be aborted until the next call to notifyProgress
*/
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