[Scummvm-git-logs] scummvm-tools master -> 31c03cae6de017b79747fe26e57b600a814ab7f1

sev- sev at scummvm.org
Mon Apr 2 01:15:55 CEST 2018


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

Summary:
7d14b3d69d TOOLS: Fix warning
ec9ec3b66f TOOLS: Added tool for creating HDFRAMES.DAT for Blade Runner
31c03cae6d TOOLS: More granular progress bar for Blade Runner packer


Commit: 7d14b3d69dea34fa0fa38b3abc8d57aa3c0aebe7
    https://github.com/scummvm/scummvm-tools/commit/7d14b3d69dea34fa0fa38b3abc8d57aa3c0aebe7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-04-02T01:15:02+02:00

Commit Message:
TOOLS: Fix warning

Changed paths:
    decompiler/codegen.h


diff --git a/decompiler/codegen.h b/decompiler/codegen.h
index 440acda..9a53c1c 100644
--- a/decompiler/codegen.h
+++ b/decompiler/codegen.h
@@ -32,7 +32,7 @@
 
 class Engine;
 
-class Function;
+struct Function;
 
 const int kIndentAmount = 2; ///< How many spaces to use for each indent.
 


Commit: ec9ec3b66fc45bb6191196ebaf0083e1de74d82b
    https://github.com/scummvm/scummvm-tools/commit/ec9ec3b66fc45bb6191196ebaf0083e1de74d82b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-04-02T01:15:02+02:00

Commit Message:
TOOLS: Added tool for creating HDFRAMES.DAT for Blade Runner

Changed paths:
  A engines/bladerunner/pack_bladerunner.cpp
  A engines/bladerunner/pack_bladerunner.h
    Makefile.common
    README
    tools.cpp


diff --git a/Makefile.common b/Makefile.common
index ce2e9e5..91fdd6e 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -176,6 +176,7 @@ engines/sword2/sword2_clue.o: CPPFLAGS+=`pkg-config --cflags gtk+-2.0`
 
 tools_OBJS := \
 	engines/agos/compress_agos.o \
+	engines/bladerunner/pack_bladerunner.o \
 	engines/gob/compress_gob.o \
 	engines/gob/extract_fascination_cd.o \
 	engines/kyra/compress_kyra.o \
diff --git a/README b/README
index aee6634..d32487d 100644
--- a/README
+++ b/README
@@ -54,19 +54,19 @@ Extraction Tools:
 
         extract_cge
                 Unpacks Soltys and Sfinx game data files.
-                
+
                 Example of usage:
                 ./scummvm-tools-cli --tool extract_cge [-o outputdir] <inputfile>
 
         pack_cge
                Packs Soltys and Sfinx 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.
                 It seems to work also with Cruise for a Corpse. It accepts only
                 one input file. This may be either one of the archive file, in
@@ -94,7 +94,7 @@ Extraction Tools:
 
         extract_kyra
                 Unpacks .PAK files from Kyrandia games.
-                
+
                 It is also able to extract the installer package files from
                 Hand of Fate DOS floppy version. You should make sure you got
                 all WESTWOOD.### files for that, since they are one big package
@@ -109,7 +109,7 @@ Extraction Tools:
 
         extract_loom_tg16
                 Extracts data files from the PC-Engine version of Loom.
-                
+
                 Example of usage:
                 ./scummvm-tools-cli --tool extract_loom_tg16 [-o outputdir] <infile>
 
@@ -132,7 +132,7 @@ Extraction Tools:
 
         extract_mm_nes
                 Extracts data files from the NES version of Maniac Mansion.
-                
+
                 Example of usage:
                 ./scummvm-tools-cli --tool extract_mm_nes [-o outputdir] <infile.PRG>
 
@@ -177,7 +177,7 @@ Compression Tools:
 
                 Example of usage:
                 ./scummvm-tools-cli --tool compress_gob [-o outputpath] -f <conf_file>
-                
+
                 <conf file> is a .gob file generated by extract_gob_stk.
                 -f forces compression for all files.
                 The stick archive (STK/ITK/LTK) will be created in the directory
@@ -300,7 +300,7 @@ Compression Tools:
 
                 Example of usage:
                 ./scummvm-tools-cli --tool compress_sword1 --vorbis -q 7 BS1/swordres.rif
-                
+
                 NOTE: Only the PC and Mac versions are currently supported.
                 The PSX version is not supported by this tool.
 
@@ -316,9 +316,9 @@ Compression Tools:
 
         compress_tinsel
                 Used to compress tinsel .smp files.
-                
+
                 The corresponding .idx file must be part of the command.
-                
+
                 Example of usage:
                 ./scummvm-tools-cli --tool compress_tinsel [mode_params] [-o outputfile] <infile.smp> <infile.idx>
                 ./scummvm-tools-cli --tool compress_tinsel --vorbis -q 9 ENGLISH.SMP ENGLISH.IDX
@@ -438,3 +438,17 @@ Encoder Tools:
 
                 Same as the above convert_dxa.bat, just for *nix-based systems.
                 It uses Wine to run RAD Game Tools.
+
+Other Tools:
+        pack_bladerunner
+                Used to combine Blade Runner CDFRAMES.DAT files into HDFRAMES.DAT.
+
+                1. Copy CDFRAMES.DAT file from CD1 to some directory.
+
+                2. Copy CDFRAMES.DAT files from CDs 2-4 to the same directory
+                but name them CDFRAMES2.DAT - CDFRAMES4.DAT respectively.
+
+                3. Run the tool:
+                  ./scummvm-tools-cli --tool pack_bladerunner [-o outputfile] <inputdir>
+
+                4. Copy the resulting HDFRAMES.DAT file to the game directory.
diff --git a/engines/bladerunner/pack_bladerunner.cpp b/engines/bladerunner/pack_bladerunner.cpp
new file mode 100644
index 0000000..f19c91e
--- /dev/null
+++ b/engines/bladerunner/pack_bladerunner.cpp
@@ -0,0 +1,184 @@
+/* ScummVM Tools
+ *
+ * ScummVM Tools 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 <string.h>
+#include "pack_bladerunner.h"
+#include "common/endian.h"
+
+PackBladeRunner::PackBladeRunner(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
+	ToolInput input;
+	input.format = "/";
+	_inputPaths.push_back(input);
+
+	_outputToDirectory = true;
+
+	_shorthelp = "Used to combine Blade Runner CDFRAMES.DAT files into HDFRAMES.DAT.";
+	_helptext = "\nUsage: " + getName() + " [-o /path/to/output/dir/] /path/to/inputfiles\n";
+}
+
+void PackBladeRunner::execute() {
+	Common::Filename mainDir = _inputPaths[0].path;
+	// We always need to setup default output path, since there is no obligation to specify it
+	if (_outputPath.empty()) {
+		_outputPath.setFullPath("./");
+	}
+
+	_outputPath.setFullName("HDFRAMES.DAT");
+
+	const int kHDPageCount = 2480;
+	const int kPageSize = 0x20000;
+	int32 *hdPageOffsets;
+	int32 *cdPageOffsets;
+	byte *buf;
+	byte timestamp[4];
+
+	hdPageOffsets = (int32 *)malloc(kHDPageCount * 4);
+	cdPageOffsets = (int32 *)malloc(kHDPageCount * 4);
+	buf = (byte *)malloc(kPageSize);
+
+	Common::File out;
+
+	out.open(_outputPath, "wb");
+
+	for (int i = 0; i < kHDPageCount; i++)
+		hdPageOffsets[i] = -1;
+
+	Common::File in;
+	int curCD = 1;
+
+	mainDir.setFullName("CDFRAMES.DAT");
+	in.open(mainDir, "rb");
+
+	if (!in.isOpen()) {
+		warning("Cannot open file %s", mainDir.getName().c_str());
+		return;
+	}
+
+	in.read_noThrow(timestamp, 4); // reading timestamp
+	out.write(timestamp, 4);
+
+	WRITE_LE_UINT32(buf, kHDPageCount);
+	out.write(buf, 4);
+
+	for (int i = 0; i < kHDPageCount; i++) {
+		WRITE_LE_UINT32(&buf[i * 4], hdPageOffsets[i]);
+	}
+
+	out.write(buf, kHDPageCount * 4);
+
+	int hdCurrentPage = 0;
+
+	while (true) {
+		uint32 cdPageCount = in.readUint32LE();
+		printf("Reading %d pages from %s...\n", cdPageCount, mainDir.getFullName().c_str());
+
+		for (uint32 i = 0; i < cdPageCount; i++) {
+			cdPageOffsets[i] = in.readUint32LE();
+		}
+
+		int cdCurrentPage = 0;
+
+		while (cdCurrentPage < cdPageCount) {
+			while (cdCurrentPage < cdPageCount) {
+				int i;
+				for (i = 0; i < hdCurrentPage && cdPageOffsets[cdCurrentPage] != hdPageOffsets[i]; i++)
+					;
+				if (i == hdCurrentPage)
+					break;
+
+				in.seek(kPageSize, SEEK_CUR); // skip the page, we've copied it
+				cdCurrentPage++;
+			}
+
+			if (cdCurrentPage == cdPageCount)
+				break;
+
+			in.read_noThrow(buf, kPageSize);
+			out.write(buf, kPageSize);
+
+			hdPageOffsets[hdCurrentPage++] = cdPageOffsets[cdCurrentPage++];
+		}
+
+		in.close();
+
+		updateProgress(curCD, 4);
+
+		curCD++;
+
+		if (curCD == 5)
+			break;
+
+		char fname[20];
+		snprintf(fname, 20, "CDFRAMES%d.DAT", curCD);
+
+		mainDir.setFullName(fname);
+		in.open(mainDir, "rb");
+
+		if (!in.isOpen()) {
+			warning("Cannot open file %s", mainDir.getName().c_str());
+			return;
+		}
+
+		in.seek(4, SEEK_CUR); // skip timestamp
+	}
+
+	for (int i = hdCurrentPage; i < kHDPageCount; i++) {
+		out.write(buf, kPageSize);
+	}
+
+#if 0
+	out.close();
+	_outputPath.setFullName("HDFRAMES.DAT");
+
+	out.open("HDFRAMES.DAT.HEADER");
+
+	out.write(timestamp, 4);
+
+	WRITE_LE_UINT32(buf, kHDPageCount);
+	out.write(buf, 4);
+#else
+
+	out.seek(8, SEEK_SET);
+#endif
+
+	for (int i = 0; i < kHDPageCount; i++) {
+		WRITE_LE_UINT32(&buf[i * 4], hdPageOffsets[i]);
+	}
+
+	out.write(buf, kHDPageCount * 4);
+
+	out.close();
+
+	free(buf);
+	free(cdPageOffsets);
+	free(hdPageOffsets);
+
+
+	printf("All done!\n");
+	printf("File is created in %s\n", _outputPath.getFullPath().c_str());
+}
+
+#ifdef STANDALONE_MAIN
+int main(int argc, char *argv[]) {
+	PackBladeRunner bladerunner(argv[0]);
+	return bladerunner.run(argc, argv);
+}
+#endif
diff --git a/engines/bladerunner/pack_bladerunner.h b/engines/bladerunner/pack_bladerunner.h
new file mode 100644
index 0000000..d500a6c
--- /dev/null
+++ b/engines/bladerunner/pack_bladerunner.h
@@ -0,0 +1,37 @@
+/* ScummVM Tools
+ *
+ * ScummVM Tools 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.
+ */
+
+/* Construct HDFRAMES.DAT out of CDFRAMES.DAT for Blade Runner */
+
+#ifndef PACK_BLADERUNNER_H
+#define PACK_BLADERUNNER_H
+
+#include "tool.h"
+#include "common/array.h"
+
+class PackBladeRunner : public Tool {
+public:
+	PackBladeRunner(const std::string &name = "pack_bladerunner");
+
+	virtual void execute();
+};
+
+#endif
diff --git a/tools.cpp b/tools.cpp
index 48aa65a..b45cc6d 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -47,6 +47,7 @@
 #endif
 
 #include "engines/agos/extract_agos.h"
+#include "engines/bladerunner/pack_bladerunner.h"
 #include "engines/cge/extract_cge.h"
 #include "engines/cge/pack_cge.h"
 #include "engines/cine/extract_cine.h"
@@ -88,6 +89,7 @@ Tools::Tools() {
 #endif
 
 	_tools.push_back(new ExtractAgos());
+	_tools.push_back(new PackBladeRunner());
 	_tools.push_back(new ExtractCge());
 	_tools.push_back(new PackCge());
 	_tools.push_back(new ExtractCine());
@@ -115,7 +117,7 @@ Tools::ToolList Tools::inspectInput(const Common::Filename &filename, ToolType t
 	ToolList perfect_choices;
 	ToolList good_choices;
 	ToolList awful_choices;
-	
+
 	Common::Filename dirname;
 	if (check_directory && !filename.directory())
 		dirname = filename.getPath();


Commit: 31c03cae6de017b79747fe26e57b600a814ab7f1
    https://github.com/scummvm/scummvm-tools/commit/31c03cae6de017b79747fe26e57b600a814ab7f1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-04-02T01:15:02+02:00

Commit Message:
TOOLS: More granular progress bar for Blade Runner packer

Changed paths:
    README
    engines/bladerunner/pack_bladerunner.cpp


diff --git a/README b/README
index d32487d..ab47190 100644
--- a/README
+++ b/README
@@ -449,6 +449,6 @@ Other Tools:
                 but name them CDFRAMES2.DAT - CDFRAMES4.DAT respectively.
 
                 3. Run the tool:
-                  ./scummvm-tools-cli --tool pack_bladerunner [-o outputfile] <inputdir>
+                  ./scummvm-tools-cli --tool pack_bladerunner [-o outputfile] <inputdir>/CDFRAMES.DAT
 
                 4. Copy the resulting HDFRAMES.DAT file to the game directory.
diff --git a/engines/bladerunner/pack_bladerunner.cpp b/engines/bladerunner/pack_bladerunner.cpp
index f19c91e..ab79efe 100644
--- a/engines/bladerunner/pack_bladerunner.cpp
+++ b/engines/bladerunner/pack_bladerunner.cpp
@@ -25,9 +25,11 @@
 
 PackBladeRunner::PackBladeRunner(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
 	ToolInput input;
-	input.format = "/";
+	input.format = "*.DAT";
 	_inputPaths.push_back(input);
 
+	_supportsProgressBar = true;
+
 	_outputToDirectory = true;
 
 	_shorthelp = "Used to combine Blade Runner CDFRAMES.DAT files into HDFRAMES.DAT.";
@@ -88,7 +90,7 @@ void PackBladeRunner::execute() {
 
 	while (true) {
 		uint32 cdPageCount = in.readUint32LE();
-		printf("Reading %d pages from %s...\n", cdPageCount, mainDir.getFullName().c_str());
+		print("Reading %d pages from %s...", cdPageCount, mainDir.getFullName().c_str());
 
 		for (uint32 i = 0; i < cdPageCount; i++) {
 			cdPageOffsets[i] = in.readUint32LE();
@@ -115,12 +117,12 @@ void PackBladeRunner::execute() {
 			out.write(buf, kPageSize);
 
 			hdPageOffsets[hdCurrentPage++] = cdPageOffsets[cdCurrentPage++];
+
+			updateProgress(hdCurrentPage, kHDPageCount);
 		}
 
 		in.close();
 
-		updateProgress(curCD, 4);
-
 		curCD++;
 
 		if (curCD == 5)
@@ -144,20 +146,7 @@ void PackBladeRunner::execute() {
 		out.write(buf, kPageSize);
 	}
 
-#if 0
-	out.close();
-	_outputPath.setFullName("HDFRAMES.DAT");
-
-	out.open("HDFRAMES.DAT.HEADER");
-
-	out.write(timestamp, 4);
-
-	WRITE_LE_UINT32(buf, kHDPageCount);
-	out.write(buf, 4);
-#else
-
 	out.seek(8, SEEK_SET);
-#endif
 
 	for (int i = 0; i < kHDPageCount; i++) {
 		WRITE_LE_UINT32(&buf[i * 4], hdPageOffsets[i]);
@@ -172,8 +161,8 @@ void PackBladeRunner::execute() {
 	free(hdPageOffsets);
 
 
-	printf("All done!\n");
-	printf("File is created in %s\n", _outputPath.getFullPath().c_str());
+	print("All done!");
+	print("File is created in %s", _outputPath.getFullPath().c_str());
 }
 
 #ifdef STANDALONE_MAIN





More information about the Scummvm-git-logs mailing list