Named "zAlgorithm"; will rename the XAttrReader functions next.
XAttrView: Set the compression algorithm in Ext2AttrView.
We're using Ext2AttrView because most Linux file systems that support
compression also support Ext2-style attributes.
When testing non-RomData files with `rp-stub -R`, I got random crashes.
gdb traced it back to an invalid g_bytes_unref() due to pngBytes not
being initialized properly.
This only affects the GTK4 version.
This fixes a regression from commit bc32b0c3a2.
([gtk] DragImage: Implement GTK4 drag & drop.)
Affects: v2.4 - v2.5
If supported, this will get the compression algorithm in use for
the specified file.
Currently, this is only implemented on Windows for both the read
functionality and the display functionality.
Regular NTFS compression uses LZNT1 and is indicated by the presence
of FILE_ATTRIBUTE_COMPRESSED.
Newer compression formats were added in Windows 10:
- XPRESS4K
- LZX
- XPRESS8K
- XPRESS16K
These do *not* set FILE_ATTRIBUTE_COMPRESSED, but for our purposes,
if one of these is set, the "Compressed" box will be checked.
A dropdown is shown that lists the current compression algorithm,
and all other algorithms. This might be changed to just a label
display later, unless I actually add the ability to change it later...
These are used for truecolor and 256-color formatting, which aren't
supported by the old Windows console. Skip the extra parameters so
they don't cause problems:
- truecolor (2): skip 3 extra parameters
- 256-color (5): skip 1 extra parameter
This required switching from a range-based `for` loop to a regular
index-based `for` loop, since we can't adjust the counter in a
range-based `for` loop.
Initialize num to 0, and reset it to 0 instead of -1.
Remove the explicit params.empty() check, since it will always have at
least one parameter. ("ESC m" will nd up having a single 0 parameter.)
isdigit() is defined as non-localized in C++, but isalpha() is not.
For consistency, define both here. This ensures that *only* the specified
characters are handled as digit or command characters, whereas the
localized versions might accept some other characters.
It's also slightly faster, since it doesn't have to do any localization
checks. Both gcc and MSVC compile vt_isdigit() to a subtract-and-compare.
gcc compiles vt_isalpha() to an AND, subtract, and compare; MSVC ends up
generating a few subtract-and-compares. (clang has the same behavior as
gcc in this case, though the generated code is slightly different.)
This will allow us to implement other "CSI" escape sequences later,
if needed. It also simplifies parsing in general, since, among other
things, we won't start to apply attributes until we know that the
"CSI" command in question is "m" (SGR, Select Graphic Rendition).
We're not supporting other sequences right now, e.g. "CSI n A" for
Cursor Up, but those would otherwise have been applied as attributes,
even though they don't end with "m".
TODO: If we do implement other "CSI n" sequences, we'll need to search
for the terminator before parsing the attributes.
StringField: New function htmlLinkToOsc8() to convert an HTML link
to OSC 8. The link must be in the following format:
<a href="https://blahblahblah">description</a>
STRF_CREDITS fields are generated by the RomData subclass and not taken
from the ROM file, so this should be consistent. Currently, only one
RomData subclass actually uses STRF_CREDITS: Amiibo
SafeString: Change `bool quotes` to `SafeStringFlags flags`. This contains
two flags: SSF_QUOTES and SSF_NO_ESCAPE. SSF_NO_ESCAPE is used for the
STRF_CREDITS field if using htmlLinkToOsc8(). Again, these fields should
not have weird control codes, since they're generated by the RomData
subclass, not taken from the ROM file.
Konsole seems to recognize "amiibo.life" as a link with the OSC 8 markup,
but not without it, so it seems it *is* working.
NOTE: The HTML link is left as-is if not converting to ANSI escapes.
Maybe it should be processed... (The RomHeaderTest results for Amiibo
would need to be updated in that case.)
Not all terminal emulators support it. KDE Konsole is listed as
supported, but it doesn't seem to be working here... Need to test
it on other supported terminal emulators.
At the very least, it doesn't cause anything to look *different*
if it's enabled and the terminal emulator doesn't support it.
[rpcli] vt.cpp: Ignore "OSC" sequences, since we can't do hyperlinks
with the older Windows console.
Bright foreground: 90-97
Bright background: 100-107
Note that these simply set the intensity flag and don't keep track of
whether or not "bright" was set, so setting a "regular" color won't
automatically remove the brightness.
Similar color scheme as rpcli.cpp:
- Status messages: Cyan
- Internal warnings: Yellow
- Valid keys: Green (for the "OK" message)
- Invalid keys: Red (for the error message)
The key names are not colorized.
TERM doesn't change for different file handles, so there's no need to
check it once for stdout and once for stderr.
Internal variable is_color_TERM is set by check_TERM_variable().
It's copied into ConsoleInfo_t for use elsewhere.
Supported terminals match this regex:
(?i)^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux
rpcli.cpp: On Non-Windows systems, don't set OF_Text_UseAnsiColor if
the console doesn't support ANSI color.
vt.cpp: On Non-Windows systems, do nothing in the various Console*()
color functions if the console doesn't support ANSI color.
These options are now only applied if compiling with clang.
While it's possible to use libc++ with gcc, it requires a lot of manual
changes, and basicaly no one does it. (libstdc++ with clang is commonly
done on desktop Linux systems, though.)
Don't -D_LIBCPP_ENABLE_ASSERTIONS on clang-17 or later. It's deprecated,
and may result in a compile error. (...though on Android/Termux with
clang-20.1.3, it didn't...)
Newer compilers usually add more warnings, so having -Werror by default
will most likely result in a compile error when new compiler versions
are released.
MSVC: Remove "-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING". This is no
longer relevant, since we don't support anything older than MSVC 2015.
Previously, when we used utf8_to_utf16(), this was automatically handled
by utf8_to_utf16(). Since we're not using that anymore, we have to call
strlen() ourselves. Otherwise, MultiByteToWideChar() will add the extra
NULL byte to the character count, resulting in an extra "space" being
written to the console. This causes the "-- Extracting..." text to be
offset by one space when extracting an internal image.
This fixes a regression from commit faeca807bd.
([rpcli] rpcli.cpp: Add color to the libgnuintl-8.dll and romdata-6.dll error messages.)
It seems this was broken since it was initially implemented in v2.0
in commit d732fbc010
([cmake] platform/gcc.cmake: Initial support for detecting DT_RELR.)
because TMP_HAVE_DT_RELR was unset too early.
This does mean we can't use ConsolePrint()'s newline parameter, so we'll
have to call ConsolePrintNewline() separately.
TextOut_text.cpp effectively does this already for "warning" fields.
NOTE: ConsolePrint() currently uses utf8_to_utf16() if printing to a
Windows console and ANSI isn't supported. This function is located
in libromdata (librptext), so we can't use it if romdata-6.dll is
missing. Use MultiByteToWideChar() directly instead. This might also
slightly improve performance, since an std::u16string is no longer
needed.
GDI+ init error: Localize the string. This can be localized because
libgnuintl-8.dll was already verified to be present at this point.
ROM filename and ATA/SCSI inquiry messages are now printed in cyan.
Error messages in those functions are now printed in red.
vt.cpp: Add two new functions:
- ConsoleSetTextColor(): Set the text color (ANSI value 0-7).
Has an optional 'bold' argument.
- ConsoleResetTextColor(): Reset the text color.
On Windows, if not using ANSI escape sequences, this uses Windows
console attributes.
TODO: Add an option to force-enable/force-disable color.
Need to use be32_to_cpu() for 32-bit values, not be16_to_cpu().
This fixes a regression from commit 5cfce44312.
([libromdata] ISO: Always use host-endian except for CD-i, in which case, always use big-endian.)
Affects: v1.8 - v2.5
NOTE: v1.8 was the first version with CD-i support, so this was
effectively "always" broken.