[Scummvm-cvs-logs] scummvm-tools master -> 1687c993f74107fc3a5d92ee9c0a77c41bdfcba4

criezy criezy at scummvm.org
Tue Nov 22 01:25:43 CET 2011


This automated email contains information about 6 new commits which have been
pushed to the 'scummvm-tools' repo located at https://github.com/scummvm/scummvm-tools .

Summary:
b929faf4c2 TOOLS: Rewrite extract_cge to merge it into scummvm-tools
bbcfd5cb3a TOOLS: Add CGE extract/pack tools in VS build files
77312f5277 BUILD: Remove extract_cge from mingw build
3545033853 TOOLS: Fix expected input format for PackCge
968084cf1d TOOLS: Simplify handling of input files in ExtractCge
1687c993f7 TOOLS: Simplify the ExtractCge help string


Commit: b929faf4c22d1e1331ab99a2978658302c2f41ce
    https://github.com/scummvm/scummvm-tools/commit/b929faf4c22d1e1331ab99a2978658302c2f41ce
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2011-11-21T16:22:23-08:00

Commit Message:
TOOLS: Rewrite extract_cge to merge it into scummvm-tools

This involved splitting the extract and pack tool into two separate
tools, rewriting them to use the Common::File (and a few other things
from Common) instead of FILE* and changing the way in handles
input and output files.

Changed paths:
  A engines/cge/cge_structs.h
  A engines/cge/pack_cge.cpp
  A engines/cge/pack_cge.h
    .gitignore
    Makefile.common
    README
    engines/cge/extract_cge.cpp
    engines/cge/extract_cge.h
    tools.cpp



diff --git a/.gitignore b/.gitignore
index 447ffb8..3c1dd12 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,7 +15,6 @@
 /deriven
 /descumm
 /desword2
-/extract_cge
 /extract_mohawk
 /gob_loadcalc
 /ScummVM Tools.app
diff --git a/Makefile.common b/Makefile.common
index 2f6807c..49c2119 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -33,7 +33,6 @@ PROGRAMS = \
 	descumm \
 	desword2 \
 	gob_loadcalc \
-	extract_cge \
 	extract_mohawk \
 	construct_mohawk \
 	scummvm-tools-cli
@@ -154,9 +153,6 @@ degob_OBJS := \
 gob_loadcalc_OBJS := \
 	engines/gob/gob_loadcalc.o
 
-extract_cge_OBJS := \
-	engines/cge/extract_cge.o
-
 extract_mohawk_OBJS := \
 	engines/mohawk/archive.o \
 	engines/mohawk/extract_mohawk.o \
@@ -200,6 +196,8 @@ tools_OBJS := \
 	engines/touche/compress_touche.o \
 	engines/tucker/compress_tucker.o \
 	engines/agos/extract_agos.o \
+	engines/cge/extract_cge.o \
+	engines/cge/pack_cge.o \
 	engines/cine/extract_cine.o \
 	engines/cruise/extract_cruise_pc.o \
 	engines/gob/extract_gob_stk.o \
diff --git a/README b/README
index 17fef00..3906514 100644
--- a/README
+++ b/README
@@ -52,6 +52,16 @@ Extraction Tools:
                 Example of usage:
                 ./scummvm-tools-cli --tool extract_agos <infile 1> ... <infile n>
 
+        extract_cge
+                Unpack Soltys game data files.
+                Example of usage:
+                ./scummvm-tools-cli --tool extract_cge [-o outputdir] vol.dat vol.cat
+
+        pack_cge
+               Pack Soltys game data files.
+               Example of usage:
+                ./scummvm-tools-cli --tool pack_cge [-o outputdir] <inputdir>
+
         extract_cine
                 Unpacks Delphine's Cinematique engine's archive files.
                 Should work at least with Future Wars and Operation Stealth.
diff --git a/engines/cge/cge_structs.h b/engines/cge/cge_structs.h
new file mode 100644
index 0000000..7677476
--- /dev/null
+++ b/engines/cge/cge_structs.h
@@ -0,0 +1,70 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ */
+
+#ifndef CGE_STRUCTS_H
+#define CGE_STRUCTS_H
+
+#include "common/scummsys.h"
+
+#pragma pack(1)
+
+/**
+ * The following defines are copied from the cge engine file btfile.h
+ */
+#define kBtSize      1024
+#define kBtKeySize   13
+#define kBtLevel     2
+
+struct CgeBtKeypack {
+	char _key[kBtKeySize];
+	uint32 _mark;
+	uint16 _size;
+};
+
+struct CgeInner {
+	uint8 _key[kBtKeySize];
+	uint16 _down;
+};
+
+struct CgeHea {
+	uint16 _count;
+	uint16 _down;
+};
+
+#define CGE_INN_SIZE ((kBtSize - sizeof(CgeHea)) / sizeof(CgeInner))
+#define CGE_LEA_SIZE ((kBtSize - sizeof(CgeHea)) / sizeof(CgeBtKeypack))
+
+struct BtPage {
+	CgeHea _hea;
+	union {
+		// dummy filler to make proper size of union
+		uint8 _data[kBtSize - sizeof(CgeHea)];
+		// inner version of data: key + word-sized page link
+		CgeInner _inn[(kBtSize - sizeof(CgeHea)) / sizeof(CgeInner)];
+		// leaf version of data: key + all user data
+		CgeBtKeypack _lea[(kBtSize - sizeof(CgeHea)) / sizeof(CgeBtKeypack)];
+	};
+};
+
+#pragma pack()
+
+#endif
diff --git a/engines/cge/extract_cge.cpp b/engines/cge/extract_cge.cpp
index e6d8b38..add5688 100644
--- a/engines/cge/extract_cge.cpp
+++ b/engines/cge/extract_cge.cpp
@@ -24,42 +24,73 @@
 #include <stdlib.h>
 #include <string.h>
 #include "extract_cge.h"
+#include "cge_structs.h"
 
 #define BUFFER_SIZE 8192
 #define SEED        0xA5
-#define MAX_FILES   5000
 
-static void readData(FILE *f, byte *buff, int size) {
-	int bytesRead = fread(buff, 1, size, f);
-	for (int i = 0; i < bytesRead; ++i)
-		buff[i] ^= SEED;
+ExtractCge::ExtractCge(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
+	ToolInput input1;
+	input1.format = "vol.cat";
+	_inputPaths.push_back(input1);
+	
+	ToolInput input2;
+	input2.format = "vol.dat";
+	_inputPaths.push_back(input2);
+		
+	_outputToDirectory = true;
+
+	_shorthelp = "Used to extract Soltys data files.";
+	_helptext = "\nUsage: " + getName() + " [-o /path/to/output/dir/] /path/to/vol.dat /path/to/vol.cat\n";
 }
 
-static void writeData(FILE *f, byte *buff, int size) {
-	for (int i = 0; i < size; ++i)
+void ExtractCge::execute() {
+	unpack();
+}
+
+void ExtractCge::readData(Common::File &f, byte *buff, int size) {
+	int bytesRead = f.read_noThrow(buff, size);
+	for (int i = 0; i < bytesRead; ++i)
 		buff[i] ^= SEED;
-	fwrite(buff, 1, size, f);
 }
 
-static void unpack() {
-	printf("Unpacking...\n");
+void ExtractCge::unpack() {
+	print("Unpacking...\n");
 
-	FILE *volCat, *volDat, *fOut, *fFiles;
 	BtPage btPage;
 
-	if ((volCat = fopen("vol.cat", "rb")) == NULL) {
-		printf("FATAL: Unable to open vol.cat\n");
-		exit(0);
+	Common::File volCat, volDat;
+	Common::Filename inPath1(_inputPaths[0].path);
+	Common::Filename inPath2(_inputPaths[1].path);
+	if (scumm_stricmp(inPath1.getName().c_str(), "vol") != 0 || scumm_stricmp(inPath2.getName().c_str(), "vol") != 0) {
+		error("Wrong input file names.\n");
+	}
+	if (inPath1.hasExtension("cat") && inPath2.hasExtension("dat")) {
+		volCat.open(inPath1, "rb");
+		volDat.open(inPath2, "rb");
+	} else if (inPath1.hasExtension("dat") && inPath2.hasExtension("cat")) {
+		volCat.open(inPath2, "rb");
+		volDat.open(inPath1, "rb");
+	} else {
+		error("Wrong input file names.\n");
 	}
 
-	if ((volDat = fopen("vol.dat", "rb")) == NULL) {
-		printf("FATAL: Unable to open vol.dat\n");
-		exit(0);
+	if (!volCat.isOpen()) {
+		error("Unable to open vol.cat\n");
 	}
 
-	if ((fFiles = fopen("files.txt", "w")) == NULL) {
-		printf("FATAL: Unable to create files.txt\n");
-		exit(0);
+	if (!volDat.isOpen()) {
+		error("Unable to open vol.dat\n");
+	}
+
+	// We always need to setup default output path, since there is no obligation to specify it
+	if (_outputPath.empty())
+		_outputPath.setFullPath("./");
+
+	_outputPath.setFullName("files.txt");
+	Common::File fFiles(_outputPath, "w");
+	if (!fFiles.isOpen()) {
+		error("Unable to create files.txt\n");
 	}
 
 	// Get in a list of pages individual files will be on
@@ -72,10 +103,11 @@ static void unpack() {
 		pageList[i + 1] = btPage._inn[i]._down;
 	
 	bool first = true;
+	Common::File fOut;
 	// Loop through the pages of individual files
 	for (int i = 0; i <= pageCount; ++i) {
 		// Move to correct page and read it
-		fseek(volCat, pageList[i] * sizeof(BtPage), SEEK_SET);
+		volCat.seek(pageList[i] * sizeof(BtPage), SEEK_SET);
 		readData(volCat, (byte *)&btPage, sizeof(BtPage));
 		
 		// Process the files
@@ -85,149 +117,35 @@ static void unpack() {
 			
 			// Add filename to files list
 			if (!first)
-				fprintf(fFiles, "\n%s", btPage._lea[fileNum]._key);
+				fFiles.print("\n%s", btPage._lea[fileNum]._key);
 			else {
-				fprintf(fFiles, "%s", btPage._lea[fileNum]._key);
+				fFiles.print("%s", btPage._lea[fileNum]._key);
 				first = false;
 			}
 
-			fOut = fopen(fname, "wb");
+			_outputPath.setFullName(fname);
+			fOut.open(_outputPath, "wb");
 			byte *buffer = (byte *)malloc(btPage._lea[fileNum]._size);
 
-			fseek(volDat, btPage._lea[fileNum]._mark, SEEK_SET);
+			volDat.seek(btPage._lea[fileNum]._mark, SEEK_SET);
 			readData(volDat, buffer, btPage._lea[fileNum]._size);
-			fwrite(buffer, 1, btPage._lea[fileNum]._size, fOut);
+			fOut.write(buffer, btPage._lea[fileNum]._size);
 
-			fclose(fOut);
+			fOut.close();
 			free(buffer);
 		}
 	}
 
-	fclose(volCat);
-	fclose(volDat);
-	fclose(fFiles);
+	volCat.close();
+	volDat.close();
+	fFiles.close();
 }
 
-static void pack() {
-	FILE *volCat, *volDat, *fIn;
-	BtPage btPage;
-	printf("Packing...\n");
-
-	// Load in the list of files to recompress
-	char files[MAX_FILES][kBtKeySize];
-	int fileCount = 0;
-	if ((fIn = fopen("files.txt", "r")) == NULL) {
-		printf("FATAL: Unable to open files.txt\n");
-		exit(0);
-	}
-
-	while (!feof(fIn)) {
-		fscanf(fIn, "%s", &files[fileCount++][0]);
-		if (fileCount == MAX_FILES) {
-			printf("FATAL: Max files reached\n");
-			exit(0);
-		}
-	}
-	fclose(fIn);
-
-	// Open vol cat and dat files for writing
-	if ((volCat = fopen("vol.cat", "wb")) == NULL) {
-		printf("FATAL: Unable to create vol.cat\n");
-		exit(0);
-	}
-	if ((volDat = fopen("vol.dat", "wb")) == NULL) {
-		printf("FATAL: Unable to create vol.dat\n");
-		exit(0);
-	}
-
-	/* Build the index page */
-	// Header
-	memset(&btPage, 0, sizeof(BtPage));
-	int pageCount = fileCount / LEA_SIZE;
-	btPage._hea._count = pageCount;
-	btPage._hea._down = 1;
-
-	// Innert file list - lists the first file of the next page
-	for (int pageNum = 0; pageNum < pageCount; ++pageNum) {
-		int nextFile = (pageNum + 1) * LEA_SIZE;
-
-		btPage._inn[pageNum]._down = pageNum + 2;
-		strcpy((char *)&btPage._inn[pageNum]._key[0], files[nextFile]);
-	}
-
-	// Write out the index page
-	writeData(volCat, (byte *)&btPage, sizeof(BtPage));
-
-	// Loop through processing each page and the dat file
-	pageCount = (fileCount + LEA_SIZE - 1) / LEA_SIZE;
-	int fileIndex = 0;
-	for (int pageNum = 0; pageNum < pageCount; ++pageNum) {
-		int startFile = pageNum * LEA_SIZE;
-		int lastFile = (pageNum + 1) * LEA_SIZE - 1;
-		if (lastFile >= fileCount)
-			lastFile = fileCount - 1;
-
-		// Header
-		memset(&btPage, 0, sizeof(BtPage));
-		btPage._hea._count = lastFile - startFile + 1;
-		btPage._hea._down = 0xffff;
-
-		for (int fileNum = 0; fileNum < btPage._hea._count; ++fileNum, ++fileIndex) {
-			// Set filename and offset in dat file
-			strcpy(btPage._lea[fileNum]._key, &files[fileIndex][0]);
-			btPage._lea[fileNum]._mark = ftell(volDat);
-
-			// Load the given file and write it into the dat file
-			char fname[32];
-			strcpy(fname, files[fileIndex]);
-
-			// Open the file and get the size
-			fIn = fopen(fname, "rb");
-			if (!fIn) {
-				printf("FATAL: Error opening %s\n", fname);
-				exit(-1);
-			}
-			fseek(fIn, 0, SEEK_END);
-			int fileSize = ftell(fIn);
-			fseek(fIn, 0, SEEK_SET);
-			btPage._lea[fileNum]._size = fileSize;
-
-			// Allocate buffer space for the file
-			byte *buffer = (byte *)malloc(fileSize);
-
-			// Read it in, encrypt it, and write it out
-			fread(buffer, 1, fileSize, fIn);
-			writeData(volDat, buffer, fileSize);
-
-			free(buffer);
-			fclose(fIn);
-		}
-
-		// Write out the page
-		writeData(volCat, (byte *)&btPage, sizeof(BtPage));
-	}
-
-	fclose(volCat);
-	fclose(volDat);
+#ifdef STANDALONE_MAIN
+int main(int argc, char *argv[]) {
+	ExtractCge cge(argv[0]);
+	return cge.run(argc, argv);
 }
+#endif
 
 
-int main(int argc,  const char *argv[]) {
-	if (argc !=  2) {
-		printf("Usage:\n\t%s <option>\n", argv[0]);
-		printf("where option is\n");
-		printf("\t-e\tExtract Soltys game data (generates files.txt)\n");
-		printf("\t-p\tPack Soltys game data (requires files.txt)\n");
-		return -1;
-	}
- 
-	const char *option = argv[1];
-	if (!strcmp(option, "-e"))
-		unpack();
-	else if (!strcmp(option, "-p"))
-		pack();
-	else
-		printf("Invalid option specified\n");
-	return 0;
-}
-
diff --git a/engines/cge/extract_cge.h b/engines/cge/extract_cge.h
index 18cfd70..75f707d 100644
--- a/engines/cge/extract_cge.h
+++ b/engines/cge/extract_cge.h
@@ -23,52 +23,17 @@
 #ifndef EXTRACT_CGE_H
 #define EXTRACT_CGE_H
 
-typedef unsigned char byte;
-typedef unsigned char uint8;
-typedef unsigned short int uint16;
-typedef unsigned long int uint32;
-
-#pragma pack(1)
-
-/**
- * The following defines are copied from the cge engine file btfile.h
- */
-#define kBtSize      1024
-#define kBtKeySize   13
-#define kBtLevel     2
-
-
-struct BtKeypack {
-	char _key[kBtKeySize];
-	uint32 _mark;
-	uint16 _size;
-};
-
-struct Inner {
-	uint8 _key[kBtKeySize];
-	uint16 _down;
+#include "tool.h"
+
+class ExtractCge : public Tool {
+public:
+	ExtractCge(const std::string &name = "extract_cge");
+	
+	virtual void execute();
+	
+protected:
+	void readData(Common::File &f, byte *buff, int size);
+	void unpack();
 };
 
-struct Hea {
-	uint16 _count;
-	uint16 _down;
-};
-
-#define INN_SIZE ((kBtSize - sizeof(Hea)) / sizeof(Inner))
-#define LEA_SIZE ((kBtSize - sizeof(Hea)) / sizeof(BtKeypack))
-
-struct BtPage {
-	Hea _hea;
-	union {
-		// dummy filler to make proper size of union
-		uint8 _data[kBtSize - sizeof(Hea)];
-		// inner version of data: key + word-sized page link
-		Inner _inn[(kBtSize - sizeof(Hea)) / sizeof(Inner)];
-		// leaf version of data: key + all user data
-		BtKeypack _lea[(kBtSize - sizeof(Hea)) / sizeof(BtKeypack)];
-	};
-};
-
-#pragma pack()
-
 #endif
diff --git a/engines/cge/pack_cge.cpp b/engines/cge/pack_cge.cpp
new file mode 100644
index 0000000..3432389
--- /dev/null
+++ b/engines/cge/pack_cge.cpp
@@ -0,0 +1,173 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "pack_cge.h"
+#include "cge_structs.h"
+
+#define SEED        0xA5
+#define MAX_FILES   5000
+
+// TODO:
+//   - Use output directory instead of current directory
+//   - Use input directory instead of current directory
+
+PackCge::PackCge(const std::string &name) : Tool(name, TOOLTYPE_UNKNOWN) {
+	ToolInput input;
+	input.format = "*";
+	input.file = false;
+	_inputPaths.push_back(input);
+	
+	_outputToDirectory = true;
+
+	_shorthelp = "Used to repackage Soltys data files.";
+	_helptext = "\nUsage: " + getName() + " [-o /path/to/output/dir/] /path/to/one_game_file\n";
+}
+
+void PackCge::execute() {
+	pack();
+}
+
+
+void PackCge::writeData(Common::File &f, byte *buff, int size) {
+	for (int i = 0; i < size; ++i)
+		buff[i] ^= SEED;
+	f.write(buff, size);
+}
+
+void PackCge::pack() {
+	BtPage btPage;
+	print("Packing...\n");
+	
+	Common::Filename inPath(_inputPaths[0].path);
+
+	// Load in the list of files to recompress
+	char files[MAX_FILES][kBtKeySize];
+	int fileCount = 0;
+	inPath.setFullName("files.txt");
+	Common::File fIn(inPath, "r");
+	if (!fIn.isOpen()) {
+		error("Unable to open %s\n", inPath.getFullPath().c_str());
+	}
+
+	while (!fIn.eos()) {
+		fIn.scanString(&files[fileCount++][0]);
+		if (fileCount == MAX_FILES) {
+			error("Max files reached");
+		}
+	}
+	fIn.close();
+
+	// Open vol cat and dat files for writing
+	if (_outputPath.empty())
+		_outputPath.setFullPath("./");
+	_outputPath.setFullName("vol.cat");
+	Common::File volCat(_outputPath, "wb");
+	if (!volCat.isOpen()) {
+		error("Unable to create %s\n", _outputPath.getFullPath().c_str());
+	}
+	_outputPath.setFullName("vol.dat");
+	Common::File volDat(_outputPath, "wb");
+	if (!volDat.isOpen()) {
+		error("Unable to create %s\n", _outputPath.getFullPath().c_str());
+	}
+
+	/* Build the index page */
+	// Header
+	memset(&btPage, 0, sizeof(BtPage));
+	int pageCount = fileCount / CGE_LEA_SIZE;
+	btPage._hea._count = pageCount;
+	btPage._hea._down = 1;
+
+	// Innert file list - lists the first file of the next page
+	for (int pageNum = 0; pageNum < pageCount; ++pageNum) {
+		int nextFile = (pageNum + 1) * CGE_LEA_SIZE;
+
+		btPage._inn[pageNum]._down = pageNum + 2;
+		strcpy((char *)&btPage._inn[pageNum]._key[0], files[nextFile]);
+	}
+
+	// Write out the index page
+	writeData(volCat, (byte *)&btPage, sizeof(BtPage));
+
+	// Loop through processing each page and the dat file
+	pageCount = (fileCount + CGE_LEA_SIZE - 1) / CGE_LEA_SIZE;
+	int fileIndex = 0;
+	for (int pageNum = 0; pageNum < pageCount; ++pageNum) {
+		int startFile = pageNum * CGE_LEA_SIZE;
+		int lastFile = (pageNum + 1) * CGE_LEA_SIZE - 1;
+		if (lastFile >= fileCount)
+			lastFile = fileCount - 1;
+
+		// Header
+		memset(&btPage, 0, sizeof(BtPage));
+		btPage._hea._count = lastFile - startFile + 1;
+		btPage._hea._down = 0xffff;
+
+		for (int fileNum = 0; fileNum < btPage._hea._count; ++fileNum, ++fileIndex) {
+			// Set filename and offset in dat file
+			strcpy(btPage._lea[fileNum]._key, &files[fileIndex][0]);
+			btPage._lea[fileNum]._mark = volDat.pos();
+
+			// Load the given file and write it into the dat file
+			char fname[32];
+			strcpy(fname, files[fileIndex]);
+
+			// Open the file and get the size
+			inPath.setFullName(fname);
+			fIn.open(inPath, "rb");
+			if (!fIn.isOpen()) {
+				error("Error opening %s\n", inPath.getFullPath().c_str());
+			}
+			int fileSize = fIn.size();
+			fIn.seek(0, SEEK_SET);
+			btPage._lea[fileNum]._size = fileSize;
+
+			// Allocate buffer space for the file
+			byte *buffer = (byte *)malloc(fileSize);
+
+			// Read it in, encrypt it, and write it out
+			fIn.read_noThrow(buffer, fileSize);
+			writeData(volDat, buffer, fileSize);
+
+			free(buffer);
+			fIn.close();
+		}
+
+		// Write out the page
+		writeData(volCat, (byte *)&btPage, sizeof(BtPage));
+	}
+
+	volCat.close();
+	volDat.close();
+}
+
+#ifdef STANDALONE_MAIN
+int main(int argc, char *argv[]) {
+	PackCge cge(argv[0]);
+	return cge.run(argc, argv);
+}
+#endif
+
+
diff --git a/engines/cge/pack_cge.h b/engines/cge/pack_cge.h
new file mode 100644
index 0000000..f453e4a
--- /dev/null
+++ b/engines/cge/pack_cge.h
@@ -0,0 +1,39 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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.
+ *
+ */
+
+#ifndef PACK_CGE_H
+#define PACK_CGE_H
+
+#include "tool.h"
+
+class PackCge : public Tool {
+public:
+	PackCge(const std::string &name = "pack_cge");
+	
+	virtual void execute();
+	
+protected:
+	void writeData(Common::File &f, byte *buff, int size);
+	void pack();
+};
+
+#endif
diff --git a/tools.cpp b/tools.cpp
index 8b25ce2..1c678df 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -45,6 +45,8 @@
 #endif
 
 #include "engines/agos/extract_agos.h"
+#include "engines/cge/extract_cge.h"
+#include "engines/cge/pack_cge.h"
 #include "engines/cine/extract_cine.h"
 #include "engines/cruise/extract_cruise_pc.h"
 #include "engines/gob/extract_gob_stk.h"
@@ -80,6 +82,8 @@ Tools::Tools() {
 #endif
 
 	_tools.push_back(new ExtractAgos());
+	_tools.push_back(new ExtractCge());
+	_tools.push_back(new PackCge());
 	_tools.push_back(new ExtractCine());
 	_tools.push_back(new ExtractCruisePC());
 	_tools.push_back(new ExtractGobStk());


Commit: bbcfd5cb3a4655a97f828bcbee42c859d7ae190a
    https://github.com/scummvm/scummvm-tools/commit/bbcfd5cb3a4655a97f828bcbee42c859d7ae190a
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2011-11-21T16:22:53-08:00

Commit Message:
TOOLS: Add CGE extract/pack tools in VS build files

Changed paths:
    dists/msvc10/toolscli.vcxproj
    dists/msvc10/toolscli.vcxproj.filters
    dists/msvc10/toolsgui.vcxproj
    dists/msvc10/toolsgui.vcxproj.filters
    dists/msvc9/toolscli.vcproj
    dists/msvc9/toolsgui.vcproj



diff --git a/dists/msvc10/toolscli.vcxproj b/dists/msvc10/toolscli.vcxproj
index fed0637..616616d 100644
--- a/dists/msvc10/toolscli.vcxproj
+++ b/dists/msvc10/toolscli.vcxproj
@@ -110,6 +110,8 @@
     <ClCompile Include="..\..\engines\tucker\compress_tucker.cpp" />
     <ClCompile Include="..\..\encode_dxa.cpp" />
     <ClCompile Include="..\..\engines\agos\extract_agos.cpp" />
+    <ClCompile Include="..\..\engines\cge\extract_cge.cpp" />
+    <ClCompile Include="..\..\engines\cge\pack_cge.cpp" />
     <ClCompile Include="..\..\engines\cine\extract_cine.cpp" />
     <ClCompile Include="..\..\engines\cruise\extract_cruise_pc.cpp" />
     <ClCompile Include="..\..\engines\gob\extract_gob_stk.cpp" />
@@ -155,6 +157,8 @@
     <ClInclude Include="..\..\engines\tucker\compress_tucker.h" />
     <ClInclude Include="..\..\encode_dxa.h" />
     <ClInclude Include="..\..\engines\agos\extract_agos.h" />
+    <ClInclude Include="..\..\engines\cge\extract_cge.h" />
+    <ClInclude Include="..\..\engines\cge\pack_cge.h" />
     <ClInclude Include="..\..\engines\cine\extract_cine.h" />
     <ClInclude Include="..\..\engines\cruise\extract_cruise_pc.h" />
     <ClInclude Include="..\..\engines\gob\extract_gob_stk.h" />
@@ -194,4 +198,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/dists/msvc10/toolscli.vcxproj.filters b/dists/msvc10/toolscli.vcxproj.filters
index 69ef8ed..4de1d72 100644
--- a/dists/msvc10/toolscli.vcxproj.filters
+++ b/dists/msvc10/toolscli.vcxproj.filters
@@ -66,6 +66,12 @@
     <ClCompile Include="..\..\engines\agos\extract_agos.cpp">
       <Filter>tools</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\engines\cge\extract_cge.cpp">
+      <Filter>tools</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\engines\cge\pack_cge.cpp">
+      <Filter>tools</Filter>
+    </ClCompile>
     <ClCompile Include="..\..\engines\cine\extract_cine.cpp">
       <Filter>tools</Filter>
     </ClCompile>
@@ -197,6 +203,12 @@
     <ClInclude Include="..\..\engines\agos\extract_agos.h">
       <Filter>tools</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\engines\cge\extract_cge.h">
+      <Filter>tools</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\engines\cge\pack_cge.h">
+      <Filter>tools</Filter>
+    </ClInclude>
     <ClInclude Include="..\..\engines\cine\extract_cine.h">
       <Filter>tools</Filter>
     </ClInclude>
@@ -298,4 +310,4 @@
       <Filter>cli</Filter>
     </ResourceCompile>
   </ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/dists/msvc10/toolsgui.vcxproj b/dists/msvc10/toolsgui.vcxproj
index 69a93c9..795ac4c 100644
--- a/dists/msvc10/toolsgui.vcxproj
+++ b/dists/msvc10/toolsgui.vcxproj
@@ -125,6 +125,8 @@
     <ClInclude Include="..\..\compress_tucker.h" />
     <ClInclude Include="..\..\encode_dxa.h" />
     <ClInclude Include="..\..\extract_agos.h" />
+    <ClInclude Include="..\..\extract_cge.h" />
+    <ClInclude Include="..\..\pack_cge.h" />
     <ClInclude Include="..\..\extract_cine.h" />
     <ClInclude Include="..\..\extract_gob_stk.h" />
     <ClInclude Include="..\..\extract_kyra.h" />
@@ -171,6 +173,8 @@
     <ClCompile Include="..\..\encode_dxa.cpp" />
     <ClCompile Include="..\..\example_tool.cpp" />
     <ClCompile Include="..\..\extract_agos.cpp" />
+    <ClCompile Include="..\..\extract_cge.cpp" />
+    <ClCompile Include="..\..\pack_cge.cpp" />
     <ClCompile Include="..\..\extract_cine.cpp" />
     <ClCompile Include="..\..\extract_gob_stk.cpp" />
     <ClCompile Include="..\..\extract_kyra.cpp" />
@@ -191,4 +195,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/dists/msvc10/toolsgui.vcxproj.filters b/dists/msvc10/toolsgui.vcxproj.filters
index cb0a782..160b48f 100644
--- a/dists/msvc10/toolsgui.vcxproj.filters
+++ b/dists/msvc10/toolsgui.vcxproj.filters
@@ -126,6 +126,12 @@
     <ClInclude Include="..\..\extract_agos.h">
       <Filter>tools</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\extract_cge.h">
+      <Filter>tools</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\pack_cge.h">
+      <Filter>tools</Filter>
+    </ClInclude>
     <ClInclude Include="..\..\extract_cine.h">
       <Filter>tools</Filter>
     </ClInclude>
@@ -258,6 +264,12 @@
     <ClCompile Include="..\..\extract_agos.cpp">
       <Filter>tools</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\extract_cge.cpp">
+      <Filter>tools</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\pack_cge.cpp">
+      <Filter>tools</Filter>
+    </ClCompile>
     <ClCompile Include="..\..\extract_cine.cpp">
       <Filter>tools</Filter>
     </ClCompile>
@@ -295,4 +307,4 @@
   <ItemGroup>
     <ResourceCompile Include="toolsgui.rc" />
   </ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/dists/msvc9/toolscli.vcproj b/dists/msvc9/toolscli.vcproj
index 131e843..4b8a29f 100644
--- a/dists/msvc9/toolscli.vcproj
+++ b/dists/msvc9/toolscli.vcproj
@@ -303,6 +303,22 @@
 				RelativePath="..\..\engines\agos\extract_agos.h"
 				>
 			</File>
+                        <File
+                                RelativePath="..\..\engines\cge\extract_cge.cpp"
+                                >
+                        </File>
+                        <File
+                                RelativePath="..\..\engines\cge\extract_cge.h"
+                                >
+                        </File>
+                        <File
+                                RelativePath="..\..\engines\cge\pack_cge.cpp"
+                                >
+                        </File>
+                        <File
+                                RelativePath="..\..\engines\cge\pack_cge.h"
+                                >
+                        </File>
 			<File
 				RelativePath="..\..\engines\cine\extract_cine.cpp"
 				>
diff --git a/dists/msvc9/toolsgui.vcproj b/dists/msvc9/toolsgui.vcproj
index cbd38e3..7f171c9 100644
--- a/dists/msvc9/toolsgui.vcproj
+++ b/dists/msvc9/toolsgui.vcproj
@@ -455,6 +455,14 @@
 				RelativePath="..\..\extract_agos.h"
 				>
 			</File>
+                        <File
+                                RelativePath="..\..\extract_cge.cpp"
+                                >
+                        </File>
+                        <File
+                                RelativePath="..\..\extract_cge.h"
+                                >
+                        </File>
 			<File
 				RelativePath="..\..\extract_cine.cpp"
 				>


Commit: 77312f52777d5a4edece4c0bc2fc42c9b18d717e
    https://github.com/scummvm/scummvm-tools/commit/77312f52777d5a4edece4c0bc2fc42c9b18d717e
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2011-11-21T16:23:09-08:00

Commit Message:
BUILD: Remove extract_cge from mingw build

Changed paths:
    Makefile
    dists/win32/ScummVM Tools.iss



diff --git a/Makefile b/Makefile
index b323686..df70095 100644
--- a/Makefile
+++ b/Makefile
@@ -105,7 +105,6 @@ win32dist:   all
 	$(STRIP) deriven.exe -o $(WIN32PATH)/tools/deriven.exe
 	$(STRIP) descumm.exe -o $(WIN32PATH)/tools/descumm.exe
 	$(STRIP) desword2.exe -o $(WIN32PATH)/tools/desword2.exe
-	$(STRIP) extract_cge.exe -o $(WIN32PATH)/tools/extract_cge.exe
 	$(STRIP) extract_mohawk.exe -o $(WIN32PATH)/tools/extract_mohawk.exe
 	$(STRIP) gob_loadcalc.exe -o $(WIN32PATH)/tools/gob_loadcalc.exe
 	$(STRIP) scummvm-tools.exe -o $(WIN32PATH)/tools/scummvm-tools.exe
diff --git a/dists/win32/ScummVM Tools.iss b/dists/win32/ScummVM Tools.iss
index 00d1d29..344a514 100755
--- a/dists/win32/ScummVM Tools.iss	
+++ b/dists/win32/ScummVM Tools.iss	
@@ -32,7 +32,6 @@ Source: "tools\dekyra.exe"; DestDir: "{app}"; Flags: ignoreversion
 Source: "tools\deriven.exe"; DestDir: "{app}"; Flags: ignoreversion 

 Source: "tools\descumm.exe"; DestDir: "{app}"; Flags: ignoreversion 

 Source: "tools\desword2.exe"; DestDir: "{app}"; Flags: ignoreversion 

-Source: "tools\extract_cge.exe"; DestDir: "{app}"; Flags: ignoreversion 

 Source: "tools\extract_mohawk.exe"; DestDir: "{app}"; Flags: ignoreversion 

 Source: "tools\gob_loadcalc.exe"; DestDir: "{app}"; Flags: ignoreversion 

 Source: "tools\NEWS.txt"; DestDir: "{app}"; Flags: ignoreversion



Commit: 354503385374043ef81206feff8f473fb0df0163
    https://github.com/scummvm/scummvm-tools/commit/354503385374043ef81206feff8f473fb0df0163
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2011-11-21T16:23:24-08:00

Commit Message:
TOOLS: Fix expected input format for PackCge

Changed paths:
    engines/cge/pack_cge.cpp



diff --git a/engines/cge/pack_cge.cpp b/engines/cge/pack_cge.cpp
index 3432389..3dc4372 100644
--- a/engines/cge/pack_cge.cpp
+++ b/engines/cge/pack_cge.cpp
@@ -35,7 +35,7 @@
 
 PackCge::PackCge(const std::string &name) : Tool(name, TOOLTYPE_UNKNOWN) {
 	ToolInput input;
-	input.format = "*";
+	input.format = "/";
 	input.file = false;
 	_inputPaths.push_back(input);
 	


Commit: 968084cf1d98a37d554f3ed7bfe882768c6dfa4a
    https://github.com/scummvm/scummvm-tools/commit/968084cf1d98a37d554f3ed7bfe882768c6dfa4a
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2011-11-21T16:23:40-08:00

Commit Message:
TOOLS: Simplify handling of input files in ExtractCge

Changed paths:
    engines/cge/extract_cge.cpp



diff --git a/engines/cge/extract_cge.cpp b/engines/cge/extract_cge.cpp
index add5688..5055d8e 100644
--- a/engines/cge/extract_cge.cpp
+++ b/engines/cge/extract_cge.cpp
@@ -58,27 +58,13 @@ void ExtractCge::unpack() {
 	print("Unpacking...\n");
 
 	BtPage btPage;
-
-	Common::File volCat, volDat;
-	Common::Filename inPath1(_inputPaths[0].path);
-	Common::Filename inPath2(_inputPaths[1].path);
-	if (scumm_stricmp(inPath1.getName().c_str(), "vol") != 0 || scumm_stricmp(inPath2.getName().c_str(), "vol") != 0) {
-		error("Wrong input file names.\n");
-	}
-	if (inPath1.hasExtension("cat") && inPath2.hasExtension("dat")) {
-		volCat.open(inPath1, "rb");
-		volDat.open(inPath2, "rb");
-	} else if (inPath1.hasExtension("dat") && inPath2.hasExtension("cat")) {
-		volCat.open(inPath2, "rb");
-		volDat.open(inPath1, "rb");
-	} else {
-		error("Wrong input file names.\n");
-	}
-
+	
+	Common::File volCat(_inputPaths[0].path, "rb");
 	if (!volCat.isOpen()) {
 		error("Unable to open vol.cat\n");
 	}
 
+	Common::File volDat(_inputPaths[1].path, "rb");
 	if (!volDat.isOpen()) {
 		error("Unable to open vol.dat\n");
 	}


Commit: 1687c993f74107fc3a5d92ee9c0a77c41bdfcba4
    https://github.com/scummvm/scummvm-tools/commit/1687c993f74107fc3a5d92ee9c0a77c41bdfcba4
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2011-11-21T16:24:23-08:00

Commit Message:
TOOLS: Simplify the ExtractCge help string

Changed paths:
    engines/cge/extract_cge.cpp



diff --git a/engines/cge/extract_cge.cpp b/engines/cge/extract_cge.cpp
index 5055d8e..b7442be 100644
--- a/engines/cge/extract_cge.cpp
+++ b/engines/cge/extract_cge.cpp
@@ -41,7 +41,7 @@ ExtractCge::ExtractCge(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION
 	_outputToDirectory = true;
 
 	_shorthelp = "Used to extract Soltys data files.";
-	_helptext = "\nUsage: " + getName() + " [-o /path/to/output/dir/] /path/to/vol.dat /path/to/vol.cat\n";
+	_helptext = "\nUsage: " + getName() + " [-o /path/to/output/dir/] <vol.dat> <vol.cat>\n";
 }
 
 void ExtractCge::execute() {
@@ -58,7 +58,7 @@ void ExtractCge::unpack() {
 	print("Unpacking...\n");
 
 	BtPage btPage;
-	
+
 	Common::File volCat(_inputPaths[0].path, "rb");
 	if (!volCat.isOpen()) {
 		error("Unable to open vol.cat\n");






More information about the Scummvm-git-logs mailing list