[Scummvm-git-logs] scummvm-tools master -> 678f3660a8e5c932456b73bcdbaf62b99eee0e55
criezy
criezy at scummvm.org
Sun Oct 25 14:57:51 UTC 2020
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:
0b60fb0404 TOOLS: Improve handling of inputs for tools that expect a directory as input
beadb61f17 TOUCHE: Fix incorrect input handling in compress_touche
2811dcbb06 TUCKER: Improve usage string to be consistent with other tools
033d317e26 PRINCE: Improve input handling for the pack extract and pack tools
2ca32a4d8e TOOLS: Mention improvements on input handling
678f3660a8 SWORD1: Add 6M13 music file to compression tool
Commit: 0b60fb040494b76d0e9564f20132c13d2dde33d0
https://github.com/scummvm/scummvm-tools/commit/0b60fb040494b76d0e9564f20132c13d2dde33d0
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-10-25T14:35:52Z
Commit Message:
TOOLS: Improve handling of inputs for tools that expect a directory as input
The main issue here is that the GUI Tools, if we use the default
wizard and do not first select a tool, has a file selector for
the input. It then tries to handle the case where the tool expect
a directory as input, but this was not properly handled and did
not work. The user had to manually stip the file name from the
input after selecting a file. It now works properly when giving
a file as input to a tool that expects a directory.
Changed paths:
tool.cpp
diff --git a/tool.cpp b/tool.cpp
index e34fc2c17..353b03499 100644
--- a/tool.cpp
+++ b/tool.cpp
@@ -145,15 +145,24 @@ bool Tool::addInputPath(const std::string& in) {
// Check the input is acceptable. Usually this is done when calling inspectInput(filename, format),
// but inspectInput(filename) might be reimplemented to be more restrictive (especially when the
// format is "*.*").
- if (inspectInput(in) == IMATCH_AWFUL)
- return false;
+ Common::Filename input(in);
+ if (inspectInput(input) == IMATCH_AWFUL) {
+ // The tool may expect a directory as input, but we may be given a file. So if the given path
+ // is not a directory, and is an awful match, try the directory as well.
+ if (input.directory())
+ return false;
+ input = input.getPath();
+ if (inspectInput(input) == IMATCH_AWFUL)
+ return false;
+ }
+
// Now we know it matches. Look for the best match.
int bestMatchIndex = -1;
InspectionMatch bestMatch = IMATCH_AWFUL;
for (ToolInputs::iterator iter = _inputPaths.begin(); iter != _inputPaths.end(); ++iter) {
if (!iter->path.empty())
continue;
- InspectionMatch match = inspectInput(in, iter->file ? iter->format : std::string("/"));
+ InspectionMatch match = inspectInput(input, iter->file ? iter->format : std::string("/"));
if (match == IMATCH_PERFECT) {
bestMatch = IMATCH_PERFECT;
bestMatchIndex = (iter - _inputPaths.begin());
@@ -166,11 +175,11 @@ bool Tool::addInputPath(const std::string& in) {
if (bestMatch == IMATCH_AWFUL) {
return false;
}
- _inputPaths[bestMatchIndex].path = in;
+ _inputPaths[bestMatchIndex].path = input.getFullPath();
if (!_inputPaths[bestMatchIndex].file) {
// Append '/' to input if it's not already done
- size_t s = in.size();
- if (in[s-1] != '/' && in[s-1] != '\\') {
+ size_t s = _inputPaths[bestMatchIndex].path.size();
+ if (_inputPaths[bestMatchIndex].path[s-1] != '/' && _inputPaths[bestMatchIndex].path[s-1] != '\\') {
_inputPaths[bestMatchIndex].path += '/';
}
}
Commit: beadb61f1731701f52df363c50b1811c75dda1e9
https://github.com/scummvm/scummvm-tools/commit/beadb61f1731701f52df363c50b1811c75dda1e9
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-10-25T14:40:48Z
Commit Message:
TOUCHE: Fix incorrect input handling in compress_touche
The tool expects a directory as input, and indicates as much
in the expected input pattern. However it was not setting
the file flag to false, and also was reimplementing the
inspectInput function without checking that the input was a
directory. Both those issues are fixed in this commit.
Changed paths:
engines/touche/compress_touche.cpp
diff --git a/engines/touche/compress_touche.cpp b/engines/touche/compress_touche.cpp
index beb9dee28..4a0074810 100644
--- a/engines/touche/compress_touche.cpp
+++ b/engines/touche/compress_touche.cpp
@@ -48,6 +48,7 @@ CompressTouche::CompressTouche(const std::string &name) : CompressionTool(name,
ToolInput input;
input.format = "/";
+ input.file = false;
_inputPaths.push_back(input);
_shorthelp = "Used to compress Touche speech files (Vxxx and OBJ).";
@@ -55,9 +56,10 @@ CompressTouche::CompressTouche(const std::string &name) : CompressionTool(name,
}
InspectionMatch CompressTouche::inspectInput(const Common::Filename &filename) {
- // We don't care for the actual file, just what's in this directory
- Common::Filename probe(filename);
+ if (!filename.directory())
+ return IMATCH_AWFUL;
+ Common::Filename probe(filename);
probe.setFullName("TOUCHE.DAT");
if (probe.exists())
return IMATCH_PERFECT;
Commit: 2811dcbb0604bb28d4f9d6f62f0d3ba485abcd99
https://github.com/scummvm/scummvm-tools/commit/2811dcbb0604bb28d4f9d6f62f0d3ba485abcd99
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-10-25T14:44:17Z
Commit Message:
TUCKER: Improve usage string to be consistent with other tools
Changed paths:
engines/tucker/compress_tucker.cpp
diff --git a/engines/tucker/compress_tucker.cpp b/engines/tucker/compress_tucker.cpp
index 8bc1538ec..1dde7865a 100644
--- a/engines/tucker/compress_tucker.cpp
+++ b/engines/tucker/compress_tucker.cpp
@@ -53,7 +53,7 @@ CompressTucker::CompressTucker(const std::string &name) : CompressionTool(name,
_inputPaths.push_back(input);
_shorthelp = "Used to compress the Bud Tucker data files.";
- _helptext = "\nUsage: " + getName() + " [mode params] [-o outputdir] inputdir\n";
+ _helptext = "\nUsage: " + getName() + " [mode params] [-o outputdir] <inputdir>\n";
}
int CompressTucker::append_compress_file(Common::File &output) {
Commit: 033d317e26a32699d0e304f5332c3ad6b4e798bd
https://github.com/scummvm/scummvm-tools/commit/033d317e26a32699d0e304f5332c3ad6b4e798bd
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-10-25T14:46:07Z
Commit Message:
PRINCE: Improve input handling for the pack extract and pack tools
Those tools expect a directory as input, and where setting the
expect input pattern as such. However they were not setting the
file flag to false.
Also the inspectInput implementations now check files in the
given directory to be more discriminatory and not just accept
any directory as a perfect match.
Changed paths:
engines/prince/extract_prince.cpp
engines/prince/pack_prince.cpp
engines/prince/pack_prince.h
diff --git a/engines/prince/extract_prince.cpp b/engines/prince/extract_prince.cpp
index eb1814962..6a472d96e 100644
--- a/engines/prince/extract_prince.cpp
+++ b/engines/prince/extract_prince.cpp
@@ -29,12 +29,13 @@ struct FileData;
ExtractPrince::ExtractPrince(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
ToolInput input;
input.format = "/";
+ input.file = false;
_inputPaths.push_back(input);
_outputToDirectory = true;
_shorthelp = "Used to extract The Prince and the Coward text data for translation.";
- _helptext = "\nUsage: " + getName() + " [-o /path/to/output/dir/] <inputfile>\n";
+ _helptext = "\nUsage: " + getName() + " [-o /path/to/output/dir/] <inputdir>\n";
}
void ExtractPrince::execute() {
@@ -160,8 +161,21 @@ void ExtractPrince::execute() {
print("All done!");
}
}
+
InspectionMatch ExtractPrince::inspectInput(const Common::Filename &filename) {
- return IMATCH_PERFECT;
+ if (!filename.directory())
+ return IMATCH_AWFUL;
+
+ // We expect either a "all/databank.ptc" file or a "variatxt.dat" file
+ Common::Filename probe(filename.getPath() + "all/databank.ptc");
+ if (probe.exists())
+ return IMATCH_PERFECT;
+ probe = filename;
+ probe.setFullName("variatxt.dat");
+ if (probe.exists())
+ return IMATCH_PERFECT;
+
+ return IMATCH_AWFUL;
}
// Uncompressed datafile loader
diff --git a/engines/prince/pack_prince.cpp b/engines/prince/pack_prince.cpp
index cdbb5f9b2..cbce619b0 100644
--- a/engines/prince/pack_prince.cpp
+++ b/engines/prince/pack_prince.cpp
@@ -27,12 +27,13 @@
PackPrince::PackPrince(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
ToolInput input;
input.format = "/";
+ input.file = false;
_inputPaths.push_back(input);
_outputToDirectory = true;
_shorthelp = "Used to repackage The Prince and the Coward text data for translation.";
- _helptext = "\nUsage: " + getName() + " [-o /path/to/output/dir/] /path/to/inputfiles\n";
+ _helptext = "\nUsage: " + getName() + " [-o /path/to/output/dir/] <inputdir>\n";
}
void PackPrince::execute() {
@@ -145,6 +146,19 @@ void PackPrince::execute() {
printf("File is created in %s\n", _outputPath.getFullPath().c_str());
}
+InspectionMatch PackPrince::inspectInput(const Common::Filename &filename) {
+ if (!filename.directory())
+ return IMATCH_AWFUL;
+
+ // We expect either a "all/databank.ptc" file or a "variatxt.dat" file
+ Common::Filename probe(filename);
+ probe.setFullName("variatxt.txt");
+ if (probe.exists())
+ return IMATCH_PERFECT;
+
+ return IMATCH_AWFUL;
+}
+
void PackPrince::packVariaTxt() {
// File size
uint fileSize = _databank.size();
diff --git a/engines/prince/pack_prince.h b/engines/prince/pack_prince.h
index b55b7d78c..85c69f2d7 100644
--- a/engines/prince/pack_prince.h
+++ b/engines/prince/pack_prince.h
@@ -31,6 +31,8 @@ public:
virtual void execute();
+ virtual InspectionMatch inspectInput(const Common::Filename &filename);
+
protected:
struct FileEntry {
uint32 _offset;
Commit: 2ca32a4d8e26525db307ad355dd0a2cc079a0103
https://github.com/scummvm/scummvm-tools/commit/2ca32a4d8e26525db307ad355dd0a2cc079a0103
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-10-25T14:52:03Z
Commit Message:
TOOLS: Mention improvements on input handling
Changed paths:
NEWS
diff --git a/NEWS b/NEWS
index 5681d3788..652284931 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ For a more comprehensive changelog of the latest experimental code, see:
2.3.0 (XXXX-XX-XX)
- Added tool for exctracting NGI's .nl archives
+ - Improve handling of input for tools that expect a directory as input.
2.2.0 (2020-09-27)
- Add a tool to extract Lost Eden archives
Commit: 678f3660a8e5c932456b73bcdbaf62b99eee0e55
https://github.com/scummvm/scummvm-tools/commit/678f3660a8e5c932456b73bcdbaf62b99eee0e55
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-10-25T14:56:36Z
Commit Message:
SWORD1: Add 6M13 music file to compression tool
This file is not used by the engine, but is present on the CDs.
To avoid confusion from users the file is now compressed as well.
Changed paths:
engines/sword1/compress_sword1.cpp
diff --git a/engines/sword1/compress_sword1.cpp b/engines/sword1/compress_sword1.cpp
index e454f8c19..ab0424e8d 100644
--- a/engines/sword1/compress_sword1.cpp
+++ b/engines/sword1/compress_sword1.cpp
@@ -31,7 +31,7 @@
#include "common/endian.h"
-#define TOTAL_TUNES 269
+#define TOTAL_TUNES 270
typedef struct {
char fileName[8];
@@ -308,7 +308,8 @@ MusicFile musicNames[TOTAL_TUNES] = {
{ "RM7", false },
{ "RM8", false },
{ "RM3C", false },
- { "RM3D", false }
+ { "RM3D", false },
+ { "6M13", true }
};
int16 *CompressSword1::uncompressSpeech(Common::File &clu, uint32 idx, uint32 cSize, uint32 *returnSize, bool* ok) {
More information about the Scummvm-git-logs
mailing list