[Scummvm-cvs-logs] SF.net SVN: scummvm:[42015] tools/branches/gsoc2009-gui
Remere at users.sourceforge.net
Remere at users.sourceforge.net
Thu Jul 2 01:46:13 CEST 2009
Revision: 42015
http://scummvm.svn.sourceforge.net/scummvm/?rev=42015&view=rev
Author: Remere
Date: 2009-07-01 23:46:13 +0000 (Wed, 01 Jul 2009)
Log Message:
-----------
*All tools now can be compiled as the part of the GUI (kinda like static linking), by compiling with EXPORT_MAIN, the main function will be renamed to tool_name_main.
*Resolved alot of name clashes due to having all the tools in the same program.
*Added tool_entry_points.h, which contains all the tool entry points.
(Could not commit yesterday, SF was down)
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_saga.cpp
tools/branches/gsoc2009-gui/compress_scumm_bun.cpp
tools/branches/gsoc2009-gui/compress_scumm_san.cpp
tools/branches/gsoc2009-gui/compress_scumm_sou.cpp
tools/branches/gsoc2009-gui/compress_sword1.cpp
tools/branches/gsoc2009-gui/compress_sword2.cpp
tools/branches/gsoc2009-gui/compress_touche.cpp
tools/branches/gsoc2009-gui/compress_tucker.cpp
tools/branches/gsoc2009-gui/encode_dxa.cpp
tools/branches/gsoc2009-gui/extract_agos.cpp
tools/branches/gsoc2009-gui/extract_gob_stk.cpp
tools/branches/gsoc2009-gui/extract_kyra.cpp
tools/branches/gsoc2009-gui/extract_loom_tg16.cpp
tools/branches/gsoc2009-gui/extract_mm_apple.cpp
tools/branches/gsoc2009-gui/extract_mm_c64.cpp
tools/branches/gsoc2009-gui/extract_mm_nes.cpp
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/gui/pages.cpp
tools/branches/gsoc2009-gui/kyra_ins.cpp
tools/branches/gsoc2009-gui/util.h
Added Paths:
-----------
tools/branches/gsoc2009-gui/tool_entry_points.h
Modified: tools/branches/gsoc2009-gui/compress_agos.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_agos.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/compress_agos.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -230,9 +230,9 @@
}
}
-const char *helptext = "\nUsage: %s [mode] [mode params] [--mac] <infile>\n" kCompressionAudioHelp;
+int export_main(compress_agos)(int argc, char *argv[]) {
+ const char *helptext = "\nUsage: %s [mode] [mode params] [--mac] <infile>\n" kCompressionAudioHelp;
-int main(int argc, char *argv[]) {
bool convertMac = false;
Filename inpath, outpath;
Modified: tools/branches/gsoc2009-gui/compress_gob.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_gob.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/compress_gob.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -45,9 +45,9 @@
byte *packData(byte *src, uint32 &size);
-const char *helptext = "\nUsage: %s [-o <output> = out.stk] <input file>\n";
+int export_main(compress_gob)(int argc, char **argv) {
+ const char *helptext = "\nUsage: %s [-o <output> = out.stk] <input file>\n";
-int main(int argc, char **argv) {
Chunk *chunks;
FILE *stk;
FILE *gobConf;
Modified: tools/branches/gsoc2009-gui/compress_kyra.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_kyra.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/compress_kyra.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -31,9 +31,9 @@
static CompressMode gCompMode = kMP3Mode;
-const char *helptext = "\nUsage: %s [mode] [mode params] [-o out = ] <infile>\n" kCompressionAudioHelp;
+int export_main(compress_kyra)(int argc, char *argv[]) {
+ const char *helptext = "\nUsage: %s [mode] [mode params] [-o out = ] <infile>\n" kCompressionAudioHelp;
-int main(int argc, char *argv[]) {
Filename inpath, outpath;
int first_arg = 1;
int last_arg = argc - 1;
Modified: tools/branches/gsoc2009-gui/compress_queen.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_queen.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/compress_queen.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -204,9 +204,9 @@
unlink(TEMP_DAT);
}
-const char *helptext = "\nUsage: %s [mode] [mode params] [-o outputfile] <inputfile (queen.1)>\n" kCompressionAudioHelp;
+int export_main(compress_queen)(int argc, char *argv[]) {
+ const char *helptext = "\nUsage: %s [mode] [mode params] [-o outputfile] <inputfile (queen.1)>\n" kCompressionAudioHelp;
-int main(int argc, char *argv[]) {
FILE *inputData, *inputTbl, *outputTbl, *outputData, *tmpFile, *compFile;
uint8 compressionType = COMPRESSION_NONE;
Filename inpath, outpath;;
Modified: tools/branches/gsoc2009-gui/compress_saga.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_saga.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/compress_saga.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -436,9 +436,9 @@
printf("Done!\n");
}
-const char *helptext = "\nUsage: %s [mode] [mode params] [-o outputfile = infile.cmp] <inputfile>\n" kCompressionAudioHelp;
+int export_main(compress_saga)(int argc, char *argv[]) {
+ const char *helptext = "\nUsage: %s [mode] [mode params] [-o outputfile = infile.cmp] <inputfile>\n" kCompressionAudioHelp;
-int main(int argc, char *argv[]) {
Filename inpath, outpath;
int first_arg = 1;
int last_arg = argc - 1;
Modified: tools/branches/gsoc2009-gui/compress_scumm_bun.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_bun.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/compress_scumm_bun.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -1084,9 +1084,10 @@
cbundleCurIndex++;
}
-const char *helptext = "\nUsage: %s [mode] [mode-params] [-o outputfile = inputfile.bun] <inputfile>\n";
-int main(int argc, char *argv[]) {
+int export_main(compress_scumm_bun)(int argc, char *argv[]) {
+ const char *helptext = "\nUsage: %s [mode] [mode-params] [-o outputfile = inputfile.bun] <inputfile>\n";
+
Filename inpath, outpath;
int first_arg = 1;
int last_arg = argc - 1;
Modified: tools/branches/gsoc2009-gui/compress_scumm_san.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_san.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/compress_scumm_san.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -59,7 +59,7 @@
static AudioTrackInfo _audioTracks[MAX_TRACKS];
static bool _oggMode = false; // mp3 default
-void encodeWaveWithOgg(char *filename) {
+void encodeSanWaveWithOgg(char *filename) {
char fbuf[2048];
char fbuf2[2048];
sprintf(fbuf, "%s.wav", filename);
@@ -67,7 +67,7 @@
encodeAudio(fbuf, false, -1, fbuf2, kVorbisMode);
}
-void encodeWaveWithLame(char *filename) {
+void encodeSanWaveWithLame(char *filename) {
char fbuf[2048];
char fbuf2[2048];
@@ -128,7 +128,7 @@
fclose(_waveTmpFile);
_waveTmpFile = NULL;
}
-void writeToTempWave(char *fileName, byte *output_data, unsigned int size) {
+void writeToTempWaveFile(char *fileName, byte *output_data, unsigned int size) {
if (!_waveTmpFile) {
_waveTmpFile = fopen(fileName, "wb");
if (!_waveTmpFile) {
@@ -193,7 +193,7 @@
*dst++ = (byte)(val);
}
} while (--count);
- writeToTempWave(fileName, output_data, 0x1000);
+ writeToTempWaveFile(fileName, output_data, 0x1000);
bsize -= len;
d_src += len;
_IACTpos = 0;
@@ -626,11 +626,11 @@
handleAudioTrack(index, trackId, frame, nbframes, input, outputDir, inputFilename, size, volume, pan, false);
}
-// TODO
-// Feature set seems more limited than what kCompressionAudioHelp contains
-const char *helptext = "\nUsage: %s [mode] [mode-params] [-o outpufile = inputfile.san] <inputfile>\n" kCompressionAudioHelp;
+int export_main(compress_scumm_san)(int argc, char *argv[]) {
+ // TODO
+ // Feature set seems more limited than what kCompressionAudioHelp contains
+ const char *helptext = "\nUsage: %s [mode] [mode-params] [-o outpufile = inputfile.san] <inputfile>\n" kCompressionAudioHelp;
-int main(int argc, char *argv[]) {
Filename inpath, outpath;
char outdir[768];
int first_arg = 1;
@@ -836,9 +836,9 @@
writeWaveHeader(_waveDataSize);
sprintf(tmpPath, "%s/%s", outdir, inpath.getFullName());
if (_oggMode)
- encodeWaveWithOgg(tmpPath);
+ encodeSanWaveWithOgg(tmpPath);
else
- encodeWaveWithLame(tmpPath);
+ encodeSanWaveWithLame(tmpPath);
sprintf(tmpPath, "%s/%s.wav", outdir, inpath.getFullName());
unlink(tmpPath);
}
Modified: tools/branches/gsoc2009-gui/compress_scumm_sou.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_sou.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/compress_scumm_sou.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -140,9 +140,10 @@
writeUint32BE(output_idx, tot_size);
}
-const char *helptext = "\nUsage: %s [mode] [mode params] monster.sou\n" kCompressionAudioHelp;
-int main(int argc, char *argv[]) {
+int export_main(compress_scumm_sou)(int argc, char *argv[]) {
+ const char *helptext = "\nUsage: %s [mode] [mode params] monster.sou\n" kCompressionAudioHelp;
+
char buf[2048];
Filename inpath, outpath;
int first_arg = 1;
Modified: tools/branches/gsoc2009-gui/compress_sword1.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword1.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/compress_sword1.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -579,13 +579,14 @@
}
}
-const char *helptext = "\nUsage: %s [only] [mode] [mode params] [-o outputdir] <inputdir>\n"
- "only can be either:\n"
- " --speech-only only encode speech clusters\n"
- " --music-only only encode music files\n"
- kCompressionAudioHelp;
+int export_main(compress_sword1)(int argc, char *argv[]) {
-int main(int argc, char *argv[]) {
+ const char *helptext = "\nUsage: %s [only] [mode] [mode params] [-o outputdir] <inputdir>\n"
+ "only can be either:\n"
+ " --speech-only only encode speech clusters\n"
+ " --music-only only encode music files\n"
+ kCompressionAudioHelp;
+
CompressMode compMode = kMP3Mode;
Filename inpath, outpath;
int first_arg = 1;
Modified: tools/branches/gsoc2009-gui/compress_sword2.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword2.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/compress_sword2.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -60,9 +60,10 @@
#define GetCompressedSign(n) (((n) >> 3) & 1)
#define GetCompressedAmplitude(n) ((n) & 7)
-const char *helptext = "\nUsage: %s [params] <file>\n\n" kCompressionAudioHelp;
-int main(int argc, char *argv[]) {
+int export_main(compress_sword2)(int argc, char *argv[]) {
+ const char *helptext = "\nUsage: %s [params] <file>\n\n" kCompressionAudioHelp;
+
FILE *output, *f;
int j;
uint32 indexSize;
Modified: tools/branches/gsoc2009-gui/compress_touche.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_touche.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/compress_touche.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -164,9 +164,10 @@
printf("Done.\n");
}
-const char *helptext = "\nUsage: %s [params] [-o outputfile TOUCHE.*] <inputdir>\n* differs with compression type.\n" kCompressionAudioHelp;
-int main(int argc, char *argv[]) {
+int export_main(compress_touche)(int argc, char *argv[]) {
+ const char *helptext = "\nUsage: %s [params] [-o outputfile TOUCHE.*] <inputdir>\n* differs with compression type.\n" kCompressionAudioHelp;
+
Filename inpath, outpath;
int first_arg = 1;
int last_arg = argc - 1;
Modified: tools/branches/gsoc2009-gui/compress_tucker.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_tucker.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/compress_tucker.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -519,9 +519,10 @@
printf("Done.\n");
}
-const char *helptext = "\nUsage: %s [mode] [mode params] [-o outputdir] inputdir\n";
-int main(int argc, char *argv[]) {
+int export_main(compress_tucker)(int argc, char *argv[]) {
+ const char *helptext = "\nUsage: %s [mode] [mode params] [-o outputdir] inputdir\n";
+
Filename inpath, outpath;
int first_arg = 1;
int last_arg = argc - 1;
Modified: tools/branches/gsoc2009-gui/encode_dxa.cpp
===================================================================
--- tools/branches/gsoc2009-gui/encode_dxa.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/encode_dxa.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -569,8 +569,8 @@
if (!info_ptr)
return 1;
- if (setjmp(png_jmpbuf(png_ptr)))
- return 1;
+ //if (setjmp(png_jmpbuf(png_ptr)))
+ // return 1;
png_init_io(png_ptr, fp);
png_set_sig_bytes(png_ptr, 8);
@@ -591,8 +591,8 @@
png_read_update_info(png_ptr, info_ptr);
// read file
- if (setjmp(png_jmpbuf(png_ptr)))
- return 1;
+ //if (setjmp(png_jmpbuf(png_ptr)))
+ // return 1;
row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * height);
for (int y=0; y<height; y++)
@@ -680,9 +680,10 @@
encodeAudio(inpath->getFullPath(), false, -1, outpath->getFullPath(), gCompMode);
}
-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 main(int argc, char *argv[]) {
+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;
Modified: tools/branches/gsoc2009-gui/extract_agos.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_agos.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/extract_agos.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -186,7 +186,7 @@
return 1;
}
-int main(int argc, char *argv[]) {
+int export_main(extract_agos)(int argc, char *argv[]) {
int first_arg = 1;
int last_arg = argc;
Modified: tools/branches/gsoc2009-gui/extract_gob_stk.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_gob_stk.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/extract_gob_stk.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -36,14 +36,14 @@
~Chunk() { delete next; }
};
-void extractError(FILE *f1, FILE *f2, Chunk *chunks, const char *msg);
+void reportExtractionError(FILE *f1, FILE *f2, Chunk *chunks, const char *msg);
Chunk *readChunkList(FILE *stk, FILE *gobConf);
Chunk *readChunkListV2(FILE *stk, FILE *gobConf);
void extractChunks(Filename *outpath, FILE *stk, Chunk *chunks);
byte *unpackData(byte *src, uint32 &size);
byte *unpackPreGobData(byte *src, uint32 &size, uint32 &compSize);
-int main(int argc, char **argv) {
+int export_main(extract_gob_stk)(int argc, char **argv) {
char signature[7];
Chunk *chunks;
FILE *stk;
@@ -108,7 +108,7 @@
return 0;
}
-void extractError(FILE *f1, FILE *f2, Chunk *chunks, const char *msg) {
+void reportExtractionError(FILE *f1, FILE *f2, Chunk *chunks, const char *msg) {
if (f1)
fclose(f1);
if (f2)
@@ -126,7 +126,7 @@
while (numDataChunks-- > 0) {
if (fread(curChunk->name, 1, 13, stk) < 13)
- extractError(stk, gobConf, chunks, "Unexpected EOF");
+ reportExtractionError(stk, gobConf, chunks, "Unexpected EOF");
curChunk->size = readUint32LE(stk);
curChunk->offset = readUint32LE(stk);
@@ -178,13 +178,13 @@
// + 04 bytes : Start position of Filenames Section
if (fread(buffer, 1, 14, stk) < 14)
- extractError(stk, gobConf, chunks, "Unexpected EOF");
+ reportExtractionError(stk, gobConf, chunks, "Unexpected EOF");
buffer[14] = '\0';
sprintf(debugStr, "File generated on %s by ", buffer);
if (fread(buffer, 1, 8, stk) < 8)
- extractError(stk, gobConf, chunks, "Unexpected EOF");
+ reportExtractionError(stk, gobConf, chunks, "Unexpected EOF");
buffer[8] = '\0';
strcat(debugStr, buffer);
@@ -198,13 +198,13 @@
// + 04 bytes : Start position of Misc Section
if (fseek(stk, filenamePos, SEEK_SET) != 0)
- extractError(stk, gobConf, chunks, "Unable to locate Filename Section");
+ reportExtractionError(stk, gobConf, chunks, "Unable to locate Filename Section");
numDataChunks = readUint32LE(stk);
miscPos = readUint32LE(stk);
if (numDataChunks == 0)
- extractError(stk, gobConf, chunks, "Empty ITK/STK !");
+ reportExtractionError(stk, gobConf, chunks, "Empty ITK/STK !");
while (numDataChunks-- > 0) {
// Misc
@@ -223,16 +223,16 @@
// + 04 bytes : Compression flag (AFAIK : 0= uncompressed, 1= compressed)
if (fseek(stk, miscPos + (cpt * 61), SEEK_SET) != 0)
- extractError(stk, gobConf, chunks, "Unable to locate Misc Section");
+ reportExtractionError(stk, gobConf, chunks, "Unable to locate Misc Section");
filenamePos = readUint32LE(stk);
if (fread(buffer, 1, 36, stk) < 36)
- extractError(stk, gobConf, chunks, "Unexpected EOF in Misc Section");
+ reportExtractionError(stk, gobConf, chunks, "Unexpected EOF in Misc Section");
curChunk->size = readUint32LE(stk);
decompSize = readUint32LE(stk);
if (fread(buffer, 1, 5, stk) < 5)
- extractError(stk, gobConf, chunks, "Unexpected EOF in Misc Section");
+ reportExtractionError(stk, gobConf, chunks, "Unexpected EOF in Misc Section");
filePos = readUint32LE(stk);
compressFlag = readUint32LE(stk);
@@ -244,7 +244,7 @@
sprintf(debugStr,
"Unexpected value in compress flag : %d - Size : %d Uncompressed size : %d",
compressFlag, curChunk->size, decompSize);
- extractError(stk, gobConf, chunks, debugStr);
+ reportExtractionError(stk, gobConf, chunks, debugStr);
} else {
curChunk->packed=false;
}
@@ -256,10 +256,10 @@
// Those are now long filenames, at the opposite of previous STK version.
if (fseek(stk, filenamePos, SEEK_SET) != 0)
- extractError(stk, gobConf, chunks, "Unable to locate filename");
+ reportExtractionError(stk, gobConf, chunks, "Unable to locate filename");
if (fgets(curChunk->name, 64, stk) == 0)
- extractError(stk, gobConf, chunks, "Unable to read filename");
+ reportExtractionError(stk, gobConf, chunks, "Unable to read filename");
// Files
// =====
@@ -293,15 +293,15 @@
FILE *chunkFile;
outpath->setFullName(curChunk->name);
if (!(chunkFile = fopen(outpath->getFullPath(), "wb")))
- extractError(stk, 0, chunks, "Couldn't write file");
+ reportExtractionError(stk, 0, chunks, "Couldn't write file");
if (fseek(stk, curChunk->offset, SEEK_SET) == -1)
- extractError(stk, chunkFile, chunks, "Unexpected EOF");
+ reportExtractionError(stk, chunkFile, chunks, "Unexpected EOF");
byte *data = new byte[curChunk->size];
if (fread((char *) data, curChunk->size, 1, stk) < 1)
- extractError(stk, chunkFile, chunks, "Unexpected EOF");
+ reportExtractionError(stk, chunkFile, chunks, "Unexpected EOF");
if (curChunk->packed) {
uint32 realSize;
@@ -313,13 +313,13 @@
}
if (fwrite((char *) unpackedData, realSize, 1, chunkFile) < 1)
- extractError(stk, chunkFile, chunks, "Couldn't write");
+ reportExtractionError(stk, chunkFile, chunks, "Couldn't write");
delete[] unpackedData;
} else {
if (fwrite((char *) data, curChunk->size, 1, chunkFile) < 1)
- extractError(stk, chunkFile, chunks, "Couldn't write");
+ reportExtractionError(stk, chunkFile, chunks, "Couldn't write");
}
delete[] data;
Modified: tools/branches/gsoc2009-gui/extract_kyra.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_kyra.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/extract_kyra.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -24,7 +24,17 @@
#include "kyra_pak.h"
#include "kyra_ins.h"
-int main(int argc, char **argv) {
+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"
+ "-2 Extract files from HoF installer files\n";
+
int first_arg = 1;
int last_arg = argc - 1;
@@ -34,15 +44,7 @@
Filename outpath, inputpath;
// Check if we should display some helpful text
- parseHelpArguments(argv, argc, "\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"
- "-2 Extract files from HoF installer files\n");
+ parseHelpArguments(argv, argc, helptext);
int param = first_arg;
Modified: tools/branches/gsoc2009-gui/extract_loom_tg16.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_loom_tg16.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/extract_loom_tg16.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -1224,7 +1224,7 @@
return CRC ^ 0xFFFFFFFF;
}
-int main (int argc, char **argv) {
+int export_main(extract_loom_tg16)(int argc, char **argv) {
#ifdef MAKE_LFLS
FILE *input, *output;
int i, j;
Modified: tools/branches/gsoc2009-gui/extract_mm_apple.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_apple.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/extract_mm_apple.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -23,19 +23,19 @@
#include "util.h"
#include <stdarg.h>
-void writeByteAlt(FILE *fp, uint8 b) {
+void writeByteAltApple(FILE *fp, uint8 b) {
writeByte(fp, (uint8)(b ^ 0xFF));
}
-void writeUint16LEAlt(FILE *fp, uint16 value) {
+void writeUint16LEAltApple(FILE *fp, uint16 value) {
writeUint16LE(fp, (uint16)(value ^ 0xFFFF));
}
-#define writeByte writeByteAlt
-#define writeUint16LE writeUint16LEAlt
+#define writeByte writeByteAltApple
+#define writeUint16LE writeUint16LEAltApple
#define NUM_ROOMS 55
-unsigned char room_disks[NUM_ROOMS], room_tracks[NUM_ROOMS], room_sectors[NUM_ROOMS];
+unsigned char room_disks_apple[NUM_ROOMS], room_tracks_apple[NUM_ROOMS], room_sectors_apple[NUM_ROOMS];
static const int SectorOffset[36] = {
0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256,
@@ -52,7 +52,9 @@
3, 10, 1, 0, 0
};
-int main (int argc, char **argv) {
+int export_main(extract_mm_apple)(int argc, char **argv) {
+ const char *helptext = "\nUsage: %s [-o <output dir> = out/] <disk1.dsk> <disk2.dsk>\n";
+
FILE *input1, *input2, *output;
int i, j;
unsigned short signature;
@@ -64,8 +66,7 @@
Filename inpath, outpath;
// Check if we should display some helpful text
- parseHelpArguments(argv, argc,
- "\nUsage: %s [-o <output dir> = out/] <disk1.dsk> <disk2.dsk>\n");
+ parseHelpArguments(argv, argc, helptext);
// Continuing with finding out output directory
// also make sure we skip those arguments
@@ -112,14 +113,14 @@
/* copy room offsets */
for (i = 0; i < NUM_ROOMS; i++) {
- room_disks[i] = readByte(input1);
- writeByte(output, room_disks[i]);
+ room_disks_apple[i] = readByte(input1);
+ writeByte(output, room_disks_apple[i]);
}
for (i = 0; i < NUM_ROOMS; i++) {
- room_sectors[i] = readByte(input1);
- writeByte(output, room_sectors[i]);
- room_tracks[i] = readByte(input1);
- writeByte(output, room_tracks[i]);
+ room_sectors_apple[i] = readByte(input1);
+ writeByte(output, room_sectors_apple[i]);
+ room_tracks_apple[i] = readByte(input1);
+ writeByte(output, room_tracks_apple[i]);
}
/* copy costume offsets */
@@ -147,9 +148,9 @@
for (i = 0; i < NUM_ROOMS; i++) {
FILE *input;
- if (room_disks[i] == '1')
+ if (room_disks_apple[i] == '1')
input = input1;
- else if (room_disks[i] == '2')
+ else if (room_disks_apple[i] == '2')
input = input2;
else
continue;
@@ -161,7 +162,7 @@
error("Unable to create %s!", fname);
notice("Creating %s...", fname);
- fseek(input, (SectorOffset[room_tracks[i]] + room_sectors[i]) * 256, SEEK_SET);
+ fseek(input, (SectorOffset[room_tracks_apple[i]] + room_sectors_apple[i]) * 256, SEEK_SET);
for (j = 0; j < ResourcesPerFile[i]; j++) {
unsigned short len = readUint16LE(input);
Modified: tools/branches/gsoc2009-gui/extract_mm_c64.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_c64.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/extract_mm_c64.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -53,7 +53,9 @@
3, 10, 1, 0, 0
};
-int main (int argc, char **argv) {
+int export_main(extract_mm_c64)(int argc, char **argv) {
+ const char *helptext = "\nUsage: %s [-o <output dir> = out/] <disk1.d64> <disk2.d64>\n";
+
FILE *input1, *input2, *output;
int i, j;
unsigned short signature;
@@ -65,8 +67,7 @@
Filename inpath, outpath;
// Check if we should display some helpful text
- parseHelpArguments(argv, argc,
- "\nUsage: %s [-o <output dir> = out/] <disk1.d64> <disk2.d64>\n");
+ parseHelpArguments(argv, argc, helptext);
// Continuing with finding out output directory
// also make sure we skip those arguments
Modified: tools/branches/gsoc2009-gui/extract_mm_nes.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_nes.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/extract_mm_nes.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -28,16 +28,16 @@
#define MAKE_LFLS
#ifdef MAKE_LFLS
-void writeByteAlt(FILE *fp, uint8 b) {
+void writeByteAltNES(FILE *fp, uint8 b) {
writeByte(fp, (uint8)(b ^ 0xFF));
}
-void writeUint16LEAlt(FILE *fp, uint16 value) {
+void writeUint16LEAltNES(FILE *fp, uint16 value) {
writeUint16LE(fp, (uint16)(value ^ 0xFFFF));
}
-#define writeByte writeByteAlt
-#define writeUint16LE writeUint16LEAlt
+#define writeByte writeByteAltNES
+#define writeUint16LE writeUint16LEAltNES
#endif
typedef enum _res_type {
@@ -1165,7 +1165,12 @@
return CRC ^ 0xFFFFFFFF;
}
-int main(int argc, char **argv) {
+int export_main(extract_mm_nes)(int argc, char **argv) {
+ const char *helptext =
+ "\nUsage: %s [-o <output dir> = out/] <infile.PRG>\n"
+ "\tSupported versions: USA, Europe, Sweden, France, Germany, Spain\n"
+ "\tJapanese version is NOT supported!\n";
+
FILE *input, *output;
int i, j;
uint32 CRC;
@@ -1177,10 +1182,7 @@
Filename inpath, outpath;
// Check if we should display some helpful text
- parseHelpArguments(argv, argc,
- "\nUsage: %s [-o <output dir> = out/] <infile.PRG>\n"
- "\tSupported versions: USA, Europe, Sweden, France, Germany, Spain\n"
- "\tJapanese version is NOT supported!\n");
+ parseHelpArguments(argv, argc, helptext);
// Continuing with finding out output directory
// also make sure we skip those arguments
Modified: tools/branches/gsoc2009-gui/extract_parallaction.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_parallaction.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/extract_parallaction.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -320,11 +320,12 @@
}
}
-int main(int argc, char *argv[]) {
+int export_main(extract_parallaction)(int argc, char *argv[]) {
+ const char *helptext = "\nUsage: %s [--small] [-o <output dir> = out/] <file>\n";
+
Filename outpath;
- parseHelpArguments(argv, argc,
- "\nUsage: %s [--small] [-o <output dir> = out/] <file>\n");
+ parseHelpArguments(argv, argc, helptext);
// Continuing with finding out output directory
// also make sure we skip those arguments
Modified: tools/branches/gsoc2009-gui/extract_scumm_mac.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_scumm_mac.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/extract_scumm_mac.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -26,7 +26,12 @@
/* this makes extract_scumm_mac convert extracted file names to lower case */
#define CHANGECASE
-int main(int argc, char *argv[]) {
+int export_main(extract_scumm_mac)(int argc, char *argv[]) {
+ const char *helptext =
+ "\nUsage: %s [-o <output dir> = out/] <file>\n"
+ "\tSome Lucas Arts CDs appear to contains only an application.\n"
+ "\tThey actually contain a seperate data file as a hidden file.\n";
+
FILE *ifp, *ofp;
unsigned long file_record_off, file_record_len;
unsigned long file_off, file_len;
@@ -42,10 +47,7 @@
Filename outpath;
// Check if we should display some helpful text
- parseHelpArguments(argv, argc,
- "\nUsage: %s [-o <output dir> = out/] <file>\n"
- "\tSome Lucas Arts CDs appear to contains only an application.\n"
- "\tThey actually contain a seperate data file as a hidden file.\n");
+ parseHelpArguments(argv, argc, helptext);
// Continuing with finding out output directory
// also make sure we skip those arguments
Modified: tools/branches/gsoc2009-gui/extract_zak_c64.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_zak_c64.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/extract_zak_c64.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -23,19 +23,19 @@
#include "util.h"
#include <stdarg.h>
-void writeByteAlt(FILE *fp, uint8 b) {
+void writeByteAltC64(FILE *fp, uint8 b) {
writeByte(fp, (uint8)(b ^ 0xFF));
}
-void writeUint16LEAlt(FILE *fp, uint16 value) {
+void writeUint16LEAltC64(FILE *fp, uint16 value) {
writeUint16LE(fp, (uint16)(value ^ 0xFFFF));
}
-#define writeByte writeByteAlt
-#define writeUint16LE writeUint16LEAlt
+#define writeByte writeByteAltC64
+#define writeUint16LE writeUint16LEAltC64
#define NUM_ROOMS 59
-unsigned char room_disks[NUM_ROOMS], room_tracks[NUM_ROOMS], room_sectors[NUM_ROOMS];
+unsigned char room_disks_c64[NUM_ROOMS], room_tracks_c64[NUM_ROOMS], room_sectors_c64[NUM_ROOMS];
static const int SectorOffset[36] = {
0,
@@ -53,7 +53,9 @@
3, 1, 2, 1, 2, 1, 10, 1, 1
};
-int main (int argc, char **argv) {
+int export_main(extract_zak_c64)(int argc, char **argv) {
+ const char *helptext = "\nUsage: %s [-o <output dir> = out/] <disk1.d64> <disk2.d64>\n";
+
FILE *input1, *input2, *output;
int i, j;
unsigned short signature;
@@ -65,8 +67,7 @@
Filename outpath;
// Check if we should display some helpful text
- parseHelpArguments(argv, argc,
- "\nUsage: %s [-o <output dir> = out/] <disk1.d64> <disk2.d64>\n");
+ parseHelpArguments(argv, argc, helptext);
// Continuing with finding out output directory
// also make sure we skip those arguments
@@ -108,14 +109,14 @@
/* copy room offsets */
for (i = 0; i < NUM_ROOMS; i++) {
- room_disks[i] = readByte(input1);
- writeByte(output, room_disks[i]);
+ room_disks_c64[i] = readByte(input1);
+ writeByte(output, room_disks_c64[i]);
}
for (i = 0; i < NUM_ROOMS; i++) {
- room_sectors[i] = readByte(input1);
- writeByte(output, room_sectors[i]);
- room_tracks[i] = readByte(input1);
- writeByte(output, room_tracks[i]);
+ room_sectors_c64[i] = readByte(input1);
+ writeByte(output, room_sectors_c64[i]);
+ room_tracks_c64[i] = readByte(input1);
+ writeByte(output, room_tracks_c64[i]);
}
/* copy costume offsets */
@@ -141,9 +142,9 @@
for (i = 0; i < NUM_ROOMS; i++) {
FILE *input;
- if (room_disks[i] == '1')
+ if (room_disks_c64[i] == '1')
input = input1;
- else if (room_disks[i] == '2')
+ else if (room_disks_c64[i] == '2')
input = input2;
else
continue;
@@ -157,7 +158,7 @@
}
notice("Creating %s...", fname);
- fseek(input, (SectorOffset[room_tracks[i]] + room_sectors[i]) * 256, SEEK_SET);
+ fseek(input, (SectorOffset[room_tracks_c64[i]] + room_sectors_c64[i]) * 256, SEEK_SET);
for (j = 0; j < ResourcesPerFile[i]; j++) {
unsigned short len = readUint16LE(input);
Modified: tools/branches/gsoc2009-gui/gui/pages.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/pages.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/gui/pages.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -925,7 +925,8 @@
_process->Redirect();
} else {
_finished = true;
- outwin->WriteText(wxT("Could not find executable file on the current path. Check that the executable for the selected tool is available and place in the correct directory."));
+ outwin->WriteText(wxT("Subprocess exited successfully!"));
+ //outwin->WriteText(wxT("Could not find executable file on the current path. Check that the executable for the selected tool is available and place in the correct directory."));
}
}
Modified: tools/branches/gsoc2009-gui/kyra_ins.cpp
===================================================================
--- tools/branches/gsoc2009-gui/kyra_ins.cpp 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/kyra_ins.cpp 2009-07-01 23:46:13 UTC (rev 42015)
@@ -192,7 +192,7 @@
int numbytes = _src->getKeyMasked(4) + 4;
while (numbytes--)
- _tables[7][*itbl++] = _src->getKeyMasked(3);
+ _tables[7][*itbl++] = (uint8)_src->getKeyMasked(3);
generateTables(7, 8, 255, 19);
@@ -205,7 +205,7 @@
_src->advSrcBitsByIndex(_tables[7][cmd]);
if (cmd < 16) {
- *tmp++ = cmd;
+ *tmp++ = (uint8)cmd;
cnt--;
} else {
uint8 tmpI = 0;
Added: tools/branches/gsoc2009-gui/tool_entry_points.h
===================================================================
--- tools/branches/gsoc2009-gui/tool_entry_points.h (rev 0)
+++ tools/branches/gsoc2009-gui/tool_entry_points.h 2009-07-01 23:46:13 UTC (rev 42015)
@@ -0,0 +1,54 @@
+/* tool_entry-points - Entry points for all the tools supported by the GUI
+ * Copyright (C) 2009 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL
+ * $Id
+ *
+ */
+
+#ifndef TOOL_ENTRY_POINTS_H
+#define TOOL_ENTRY_POINTS_H
+
+typedef int (MainFunction*)(int argc, char **argv);
+#define import_main(tool_name) main_ ## tool_name
+
+extern int import_main(compress_agos)(int argc, char **argv);
+extern int import_main(compress_gob)(int argc, char **argv);
+extern int import_main(compress_kyra)(int argc, char **argv);
+extern int import_main(compress_queen)(int argc, char **argv);
+extern int import_main(compress_saga)(int argc, char **argv);
+extern int import_main(compress_scumm_bun)(int argc, char **argv);
+extern int import_main(compress_scumm_san)(int argc, char **argv);
+extern int import_main(compress_scumm_sou)(int argc, char **argv);
+extern int import_main(compress_sword1)(int argc, char **argv);
+extern int import_main(compress_sword2)(int argc, char **argv);
+extern int import_main(compress_touche)(int argc, char **argv);
+extern int import_main(compress_tucker)(int argc, char **argv);
+extern int import_main(encode_dxa)(int argc, char **argv);
+extern int import_main(extract_agos)(int argc, char **argv);
+extern int import_main(extract_gob_stk)(int argc, char **argv);
+extern int import_main(extract_kyra)(int argc, char **argv);
+extern int import_main(extract_loom_tg16)(int argc, char **argv);
+extern int import_main(extract_mm_apple)(int argc, char **argv);
+extern int import_main(extract_mm_c64)(int argc, char **argv);
+extern int import_main(extract_mm_nes)(int argc, char **argv);
+extern int import_main(extract_parallaction)(int argc, char **argv);
+extern int import_main(extract_scumm_mac)(int argc, char **argv);
+extern int import_main(extract_zak_c64)(int argc, char **argv);
+
+#endif
+
Property changes on: tools/branches/gsoc2009-gui/tool_entry_points.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/util.h
===================================================================
--- tools/branches/gsoc2009-gui/util.h 2009-07-01 23:16:18 UTC (rev 42014)
+++ tools/branches/gsoc2009-gui/util.h 2009-07-01 23:46:13 UTC (rev 42015)
@@ -57,7 +57,22 @@
typedef signed int int32;
#endif
+
/*
+ * Tools should not implement the actual main() themselves
+ * when they are compiled as a part of the master tool. So
+ * we make a macro to rename it automatically
+ *
+ * Perhaps EXPORT_MAIN is a bad name though.
+ */
+
+#ifdef EXPORT_MAIN
+ #define export_main(tool_name) main_ ## tool_name
+#else
+ #define export_main(tool_name) main
+#endif
+
+/*
* Various utility macros
*/
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