Skip to content

Commit b62b506

Browse files
authored
Merge pull request #1944 from eliasdaler/authoring_quiet
autoring: add -q option
2 parents cb65197 + 572e18b commit b62b506

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

tools/authoring/authoring.cc

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ int main(int argc, char** argv) {
9696
const auto inputs = args.positional();
9797
const auto license = args.get<std::string>("license");
9898
const bool asksForHelp = !!args.get<bool>("h");
99+
const bool quiet = !!args.get<bool>("q");
99100
const bool hasOutput = output.has_value();
100101
const bool hasExactlyOneInput = inputs.size() == 1;
101102

@@ -107,6 +108,7 @@ Usage: {} input.json [-h] -o output.bin
107108
-basedir path optional: base directory for the input files.
108109
-license file optional: use this license file.
109110
-threads count optional: number of threads to use for compression.
111+
-q optional: only print errors.
110112
-h displays this help information and exit.
111113
)",
112114
argv[0]);
@@ -199,7 +201,9 @@ Usage: {} input.json [-h] -o output.bin
199201
fmt::print("Too many files specified ({}), max allowed is {}\n", filesCount, c_maximumSectorCount);
200202
return -1;
201203
}
202-
fmt::print("Index size: {}\n", indexSectorsCount * 2048);
204+
if (!quiet) {
205+
fmt::print("Index size: {}\n", indexSectorsCount * 2048);
206+
}
203207

204208
PCSX::PS1Packer::Options options;
205209
options.booty = false;
@@ -219,8 +223,10 @@ Usage: {} input.json [-h] -o output.bin
219223
fmt::print("Executable size is not a multiple of 2048\n");
220224
return -1;
221225
}
222-
fmt::print("Executable size: {}\n", compressedExecutable->size());
223-
fmt::print("Executable location: {}\n", 23 + indexSectorsCount);
226+
if (!quiet) {
227+
fmt::print("Executable size: {}\n", compressedExecutable->size());
228+
fmt::print("Executable location: {}\n", 23 + indexSectorsCount);
229+
}
224230

225231
const unsigned executableSectorsCount = compressedExecutable->size() / 2048;
226232
unsigned currentSector = 23 + indexSectorsCount;
@@ -356,11 +362,13 @@ Usage: {} input.json [-h] -o output.bin
356362
return -1;
357363
}
358364
IndexEntry* entry = &indexEntryData[workUnitIndex];
359-
fmt::print("Processed file: {}\n", workUnit.fileInfo["path"].get<std::string>());
360-
fmt::print(" Original size: {}\n", entry->getDecompSize());
361-
fmt::print(" Compressed size: {}\n", entry->getCompressedSize() * 2048);
362-
fmt::print(" Compression method: {}\n", static_cast<uint32_t>(entry->getCompressionMethod()));
363-
fmt::print(" Sector offset: {}\n", currentSector);
365+
if (!quiet) {
366+
fmt::print("Processed file: {}\n", workUnit.fileInfo["path"].get<std::string>());
367+
fmt::print(" Original size: {}\n", entry->getDecompSize());
368+
fmt::print(" Compressed size: {}\n", entry->getCompressedSize() * 2048);
369+
fmt::print(" Compression method: {}\n", static_cast<uint32_t>(entry->getCompressionMethod()));
370+
fmt::print(" Sector offset: {}\n", currentSector);
371+
}
364372
entry->setSectorOffset(currentSector);
365373
unsigned sectorCount = entry->getCompressedSize();
366374
for (unsigned sector = 0; sector < sectorCount; sector++) {
@@ -370,7 +378,9 @@ Usage: {} input.json [-h] -o output.bin
370378
}
371379
}
372380

373-
fmt::print("Processed {} files.\n", filesCount);
381+
if (!quiet) {
382+
fmt::print("Processed {} files.\n", filesCount);
383+
}
374384

375385
uint8_t empty[2048] = {0};
376386
for (unsigned i = 0; i < 150; i++) {

0 commit comments

Comments
 (0)