mirror of
https://github.com/GerbilSoft/rom-properties.git
synced 2025-06-18 19:45:41 -04:00
[rpcli] rpcli.cpp: Colorize output in ExtractImages().
NOTE: Using Yellow for cases where an animated icon is requested but libpng doesn't support APNG. Add "is" to the "APNG is not supported" line.
This commit is contained in:
parent
b347c4fad6
commit
1dc3609bc7
@ -10178,7 +10178,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:200
|
#: ../src/rpcli/rpcli.cpp:200
|
||||||
msgctxt "rpcli"
|
msgctxt "rpcli"
|
||||||
msgid "APNG not supported, extracting only the first frame"
|
msgid "APNG is not supported, extracting only the first frame"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:219
|
#: ../src/rpcli/rpcli.cpp:219
|
||||||
|
@ -10197,7 +10197,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:200
|
#: ../src/rpcli/rpcli.cpp:200
|
||||||
msgctxt "rpcli"
|
msgctxt "rpcli"
|
||||||
msgid "APNG not supported, extracting only the first frame"
|
msgid "APNG is not supported, extracting only the first frame"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:219
|
#: ../src/rpcli/rpcli.cpp:219
|
||||||
|
@ -10192,7 +10192,7 @@ msgstr "Extracción de iconos animados en '{:s}'"
|
|||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:200
|
#: ../src/rpcli/rpcli.cpp:200
|
||||||
msgctxt "rpcli"
|
msgctxt "rpcli"
|
||||||
msgid "APNG not supported, extracting only the first frame"
|
msgid "APNG is not supported, extracting only the first frame"
|
||||||
msgstr "No es compatible con APNG. Sólo se extrae el primer fotograma."
|
msgstr "No es compatible con APNG. Sólo se extrae el primer fotograma."
|
||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:219
|
#: ../src/rpcli/rpcli.cpp:219
|
||||||
|
@ -10109,7 +10109,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:200
|
#: ../src/rpcli/rpcli.cpp:200
|
||||||
msgctxt "rpcli"
|
msgctxt "rpcli"
|
||||||
msgid "APNG not supported, extracting only the first frame"
|
msgid "APNG is not supported, extracting only the first frame"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:219
|
#: ../src/rpcli/rpcli.cpp:219
|
||||||
|
@ -10187,7 +10187,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:200
|
#: ../src/rpcli/rpcli.cpp:200
|
||||||
msgctxt "rpcli"
|
msgctxt "rpcli"
|
||||||
msgid "APNG not supported, extracting only the first frame"
|
msgid "APNG is not supported, extracting only the first frame"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:219
|
#: ../src/rpcli/rpcli.cpp:219
|
||||||
|
@ -10219,7 +10219,7 @@ msgstr "Extração de ícone animado em '{:s}'"
|
|||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:200
|
#: ../src/rpcli/rpcli.cpp:200
|
||||||
msgctxt "rpcli"
|
msgctxt "rpcli"
|
||||||
msgid "APNG not supported, extracting only the first frame"
|
msgid "APNG is not supported, extracting only the first frame"
|
||||||
msgstr "Incompatível com APNG. Somente primeiro quadro extraído."
|
msgstr "Incompatível com APNG. Somente primeiro quadro extraído."
|
||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:219
|
#: ../src/rpcli/rpcli.cpp:219
|
||||||
|
@ -10144,7 +10144,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:200
|
#: ../src/rpcli/rpcli.cpp:200
|
||||||
msgctxt "rpcli"
|
msgctxt "rpcli"
|
||||||
msgid "APNG not supported, extracting only the first frame"
|
msgid "APNG is not supported, extracting only the first frame"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:219
|
#: ../src/rpcli/rpcli.cpp:219
|
||||||
|
@ -10257,7 +10257,7 @@ msgstr "Извлекаем анимированную иконку в '{:s}'"
|
|||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:200
|
#: ../src/rpcli/rpcli.cpp:200
|
||||||
msgctxt "rpcli"
|
msgctxt "rpcli"
|
||||||
msgid "APNG not supported, extracting only the first frame"
|
msgid "APNG is not supported, extracting only the first frame"
|
||||||
msgstr "Нет поддержки APNG — только первый кард будет извлечён"
|
msgstr "Нет поддержки APNG — только первый кард будет извлечён"
|
||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:219
|
#: ../src/rpcli/rpcli.cpp:219
|
||||||
|
@ -10168,7 +10168,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:200
|
#: ../src/rpcli/rpcli.cpp:200
|
||||||
msgctxt "rpcli"
|
msgctxt "rpcli"
|
||||||
msgid "APNG not supported, extracting only the first frame"
|
msgid "APNG is not supported, extracting only the first frame"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../src/rpcli/rpcli.cpp:219
|
#: ../src/rpcli/rpcli.cpp:219
|
||||||
|
@ -177,26 +177,33 @@ static void ExtractImages(const RomData *romData, const vector<ExtractParam> &ex
|
|||||||
|
|
||||||
if (image && image->isValid()) {
|
if (image && image->isValid()) {
|
||||||
found = true;
|
found = true;
|
||||||
|
ConsoleSetTextColor(&ci_stderr, 6, true); // cyan
|
||||||
ConsolePrint(&ci_stderr, "-- ");
|
ConsolePrint(&ci_stderr, "-- ");
|
||||||
if (likely(!isMipmap)) {
|
if (likely(!isMipmap)) {
|
||||||
// tr: {0:s} == image type name, {1:s} == output filename
|
// tr: {0:s} == image type name, {1:s} == output filename
|
||||||
ConsolePrint(&ci_stderr,
|
ConsolePrint(&ci_stderr,
|
||||||
fmt::format(FRUN(C_("rpcli", "Extracting {0:s} into '{1:s}'")),
|
fmt::format(FRUN(C_("rpcli", "Extracting {0:s} into '{1:s}'")),
|
||||||
RomData::getImageTypeName(imageType),
|
RomData::getImageTypeName(imageType),
|
||||||
T2U8c(p.filename)), true);
|
T2U8c(p.filename)));
|
||||||
} else {
|
} else {
|
||||||
// tr: {0:d} == mipmap level, {1:s} == output filename
|
// tr: {0:d} == mipmap level, {1:s} == output filename
|
||||||
ConsolePrint(&ci_stderr,
|
ConsolePrint(&ci_stderr,
|
||||||
fmt::format(FRUN(C_("rpcli", "Extracting mipmap level {0:d} into '{1:s}'")),
|
fmt::format(FRUN(C_("rpcli", "Extracting mipmap level {0:d} into '{1:s}'")),
|
||||||
p.mipmapLevel, T2U8c(p.filename)), true);
|
p.mipmapLevel, T2U8c(p.filename)));
|
||||||
}
|
}
|
||||||
|
ConsoleResetTextColor(&ci_stderr);
|
||||||
|
ConsolePrintNewline(&ci_stderr);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
int errcode = RpPng::save(p.filename, image);
|
int errcode = RpPng::save(p.filename, image);
|
||||||
if (errcode != 0) {
|
if (errcode != 0) {
|
||||||
// tr: {0:s} == filename, {1:s} == error message
|
// tr: {0:s} == filename, {1:s} == error message
|
||||||
|
ConsoleSetTextColor(&ci_stderr, 1, true); // red
|
||||||
ConsolePrint(&ci_stderr,
|
ConsolePrint(&ci_stderr,
|
||||||
fmt::format(FRUN(C_("rpcli", "Couldn't create file '{0:s}': {1:s}")),
|
fmt::format(FRUN(C_("rpcli", "Couldn't create file '{0:s}': {1:s}")),
|
||||||
T2U8c(p.filename), strerror(-errcode)), true);
|
T2U8c(p.filename), strerror(-errcode)));
|
||||||
|
ConsoleResetTextColor(&ci_stderr);
|
||||||
|
ConsolePrintNewline(&ci_stderr);
|
||||||
} else {
|
} else {
|
||||||
ConsolePrint(&ci_stderr, " ");
|
ConsolePrint(&ci_stderr, " ");
|
||||||
ConsolePrint(&ci_stderr, C_("rpcli", "Done"), true);
|
ConsolePrint(&ci_stderr, C_("rpcli", "Done"), true);
|
||||||
@ -208,25 +215,35 @@ static void ExtractImages(const RomData *romData, const vector<ExtractParam> &ex
|
|||||||
auto iconAnimData = romData->iconAnimData();
|
auto iconAnimData = romData->iconAnimData();
|
||||||
if (iconAnimData && iconAnimData->count != 0 && iconAnimData->seq_count != 0) {
|
if (iconAnimData && iconAnimData->count != 0 && iconAnimData->seq_count != 0) {
|
||||||
found = true;
|
found = true;
|
||||||
|
ConsoleSetTextColor(&ci_stderr, 6, true); // cyan
|
||||||
ConsolePrint(&ci_stderr, "-- ");
|
ConsolePrint(&ci_stderr, "-- ");
|
||||||
ConsolePrint(&ci_stderr,
|
ConsolePrint(&ci_stderr,
|
||||||
fmt::format(FRUN(C_("rpcli", "Extracting animated icon into '{:s}'")),
|
fmt::format(FRUN(C_("rpcli", "Extracting animated icon into '{:s}'")),
|
||||||
T2U8c(p.filename)), true);
|
T2U8c(p.filename)));
|
||||||
|
ConsoleResetTextColor(&ci_stderr);
|
||||||
|
ConsolePrintNewline(&ci_stderr);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
int errcode = RpPng::save(p.filename, iconAnimData);
|
int errcode = RpPng::save(p.filename, iconAnimData);
|
||||||
if (errcode == -ENOTSUP) {
|
if (errcode == -ENOTSUP) {
|
||||||
|
ConsoleSetTextColor(&ci_stderr, 3, true); // yellow
|
||||||
ConsolePrint(&ci_stderr, " ");
|
ConsolePrint(&ci_stderr, " ");
|
||||||
ConsolePrint(&ci_stderr,
|
ConsolePrint(&ci_stderr,
|
||||||
C_("rpcli", "APNG not supported, extracting only the first frame"), true);
|
C_("rpcli", "APNG is not supported, extracting only the first frame"));
|
||||||
|
ConsoleResetTextColor(&ci_stderr);
|
||||||
|
ConsolePrintNewline(&ci_stderr);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
// falling back to outputting the first frame
|
// falling back to outputting the first frame
|
||||||
errcode = RpPng::save(p.filename, iconAnimData->frames[iconAnimData->seq_index[0]]);
|
errcode = RpPng::save(p.filename, iconAnimData->frames[iconAnimData->seq_index[0]]);
|
||||||
}
|
}
|
||||||
if (errcode != 0) {
|
if (errcode != 0) {
|
||||||
|
ConsoleSetTextColor(&ci_stderr, 1, true); // red
|
||||||
ConsolePrint(&ci_stderr, " ");
|
ConsolePrint(&ci_stderr, " ");
|
||||||
ConsolePrint(&ci_stderr,
|
ConsolePrint(&ci_stderr,
|
||||||
fmt::format(FRUN(C_("rpcli", "Couldn't create file '{0:s}': {1:s}")),
|
fmt::format(FRUN(C_("rpcli", "Couldn't create file '{0:s}': {1:s}")),
|
||||||
T2U8c(p.filename), strerror(-errcode)), true);
|
T2U8c(p.filename), strerror(-errcode)));
|
||||||
|
ConsoleResetTextColor(&ci_stderr);
|
||||||
|
ConsolePrintNewline(&ci_stderr);
|
||||||
} else {
|
} else {
|
||||||
ConsolePrint(&ci_stderr, " ");
|
ConsolePrint(&ci_stderr, " ");
|
||||||
ConsolePrint(&ci_stderr, C_("rpcli", "Done"), true);
|
ConsolePrint(&ci_stderr, C_("rpcli", "Done"), true);
|
||||||
@ -237,22 +254,23 @@ static void ExtractImages(const RomData *romData, const vector<ExtractParam> &ex
|
|||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
// TODO: Return an error code?
|
// TODO: Return an error code?
|
||||||
|
ConsoleSetTextColor(&ci_stderr, 1, true); // red
|
||||||
|
ConsolePrint(&ci_stderr, "-- ");
|
||||||
if (p.imageType == -1) {
|
if (p.imageType == -1) {
|
||||||
ConsolePrint(&ci_stderr, "-- ");
|
ConsolePrint(&ci_stderr, C_("rpcli", "Animated icon not found"));
|
||||||
ConsolePrint(&ci_stderr, C_("rpcli", "Animated icon not found"), true);
|
|
||||||
} else if (p.mipmapLevel >= 0) {
|
} else if (p.mipmapLevel >= 0) {
|
||||||
ConsolePrint(&ci_stderr, "-- ");
|
|
||||||
ConsolePrint(&ci_stderr,
|
ConsolePrint(&ci_stderr,
|
||||||
fmt::format(FRUN(C_("rpcli", "Mipmap level {:d} not found")), p.mipmapLevel), true);
|
fmt::format(FRUN(C_("rpcli", "Mipmap level {:d} not found")), p.mipmapLevel));
|
||||||
} else {
|
} else {
|
||||||
const RomData::ImageType imageType =
|
const RomData::ImageType imageType =
|
||||||
static_cast<RomData::ImageType>(p.imageType);
|
static_cast<RomData::ImageType>(p.imageType);
|
||||||
ConsolePrint(&ci_stderr, "-- ");
|
|
||||||
ConsolePrint(&ci_stderr,
|
ConsolePrint(&ci_stderr,
|
||||||
fmt::format(FRUN(C_("rpcli", "Image '{:s}' not found")),
|
fmt::format(FRUN(C_("rpcli", "Image '{:s}' not found")),
|
||||||
RomData::getImageTypeName(imageType)), true);
|
RomData::getImageTypeName(imageType)));
|
||||||
}
|
}
|
||||||
cerr.flush();
|
ConsoleResetTextColor(&ci_stderr);
|
||||||
|
ConsolePrintNewline(&ci_stderr);
|
||||||
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -352,6 +370,7 @@ static void DoFile(const TCHAR *filename, bool json, const vector<ExtractParam>
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
// TODO: Error checking.
|
// TODO: Error checking.
|
||||||
win32_console_print_ansi_color(oss.str().c_str());
|
win32_console_print_ansi_color(oss.str().c_str());
|
||||||
|
fflush(stdout);
|
||||||
} else
|
} else
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user