Commit Graph

12762 Commits

Author SHA1 Message Date
David Korth
8023ac119f [libromdata/tests] Disable RomHeaderTest, again.
It fails when running on the Launchpad build servers for some reason.
2025-05-10 17:08:10 -04:00
David Korth
1356d23d4c [debian] rules: Explicitly specify the Tracker API version, again.
Otherwise, we have to install the specific Tracker library, which is
versioned, so we end up with more problems.
2025-05-10 16:53:43 -04:00
David Korth
1f246e4ff6 rom-properties 2.5.1 2025-05-10 16:41:45 -04:00
David Korth
f5334daa78 [kde] Ext2AttrView: Use QString::arg() instead of fmt::format().
fmt::format() worked on my main system, but on Xubuntu 16.04, it didn't
work because the fmt headers aren't included:

src/kde/xattr/Ext2AttrView.cpp: In member function ‘void Ext2AttrViewPrivate::retranslateUi_nonDesigner()’:
src/kde/xattr/Ext2AttrView.cpp:94:13: error: ‘fmt’ has not been declared
   s_label = fmt::format(FRUN(s_lsattr_fmt), p->lsattr_chr,
             ^
src/kde/xattr/Ext2AttrView.cpp:94:42: error: ‘FRUN’ was not declared in this scope
   s_label = fmt::format(FRUN(s_lsattr_fmt), p->lsattr_chr,
                                          ^

We're not linking to fmt in the XAttrView plugin, so use QString::arg()
instead. (I'm guessing CMake auto-magically linked to fmt because
libromdata links to it...)

NOTE: The debug build still links to libfmt-11.so (and a bunch of other
libraries that aren't actually needed). The release build no longer links
to libfmt-11.so. I'm guessing CMake is skipping .so trimming in the debug
builds in order to save time.
2025-05-10 16:19:20 -04:00
David Korth
9d50275042 [libromdata] GameCubeSavePrivate::PDP_SWAP(): Initialize the union to 0.
This doesn't affect the compiled output, but it's needed by gcc-5.4
in order to be marked as constexpr.

The uninitialized union *is* allowed as of C++20, supported in
gcc-10.1 and later.

Also, put 'd' first so the whole DWORD is initialized instead of just
one 16-bit WORD.
2025-05-10 15:50:35 -04:00
David Korth
8c00596598 [librptexture] ImageDecoder_BC7.cpp, get_mode(): Remove constexpr.
assert() isn't constexpr-safe on Ubuntu 16.04. (glibc-2.23)
2025-05-10 15:16:18 -04:00
David Korth
7efa014ba8 [librpbyteswap] byteswap_rp.h, __swabf(): Initialize the union to 0.
This doesn't affect the compiled output, but it's needed by gcc-5.4
in order to be marked as constexpr.

The uninitialized union *is* allowed as of C++20, supported in
gcc-10.1 and later.
2025-05-10 15:09:57 -04:00
David Korth
3d0fd3627b [librptexture] PixelConversion.hpp: Remove constexpr for RGB9_E5_to_ARGB32().
MSVC 2022 doesn't like it, and apparently gcc-13.2.1 didn't like it.
(gcc-15.1.0 is fine with it, though...)
2025-05-10 14:54:13 -04:00
David Korth
9e2aff3d1a Undo some constexpr for MSVC.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
MSVC's byteswapping intrinsics are not constexpr.
2025-05-10 14:45:49 -04:00
David Korth
05e95ec9a8 [libromdata] Xbox360_XEX_Private::getOptHdrData(): Limit the maximum header size to 16 MB.
aflplusplus, and the debug version of rpcli, was hanging on some fuzzed
XEXes with ~4 GB headers because the debug version of std::vector<> was
initializing each byte, one at a time.

Headers shouldn't be that big, but we'll go with a maximum of 16 MB
just in case.

Found using aflplusplus-4.32c.
2025-05-10 14:16:25 -04:00
David Korth
4a85bc7be4 Added constexpr to a bunch of static inline functions.
[libromdata]
- SNES, isValidGameIDChar(): Use the is*_ascii() functions.
- DMG: Remove `inline` from some functions.
- GcnFst, WiiUFst: Completely inline the is_dir() functions.

[librpbase]
- cdrom_structs.h: Add CONSTEXPR; make CdromSectorInfo extern "C".
- RpPngWriter: Remove `inline` from u8strIsPngLatin1().

[librpbyteswap]
- bitstuff.h: CONSTEXPR and ATTR_CONST stuff.
- byteswap_rp.h: Likewise.

[librptexture]
- XboxXPR: Fully inline and constexpr fill_pattern() and
  get_swizzled_offset().

The inlining and constexpr for XboxXPR does reduce the code size
slightly:

Code size difference: (64-bit Gentoo Linux, gcc-15.1.0, release build, no LTO)

   text    data     bss     dec     hex filename
   8336    1208       0    9544    2548 XboxXPR.cpp.o [before]
   8240    1208       0    9448    24e8 XboxXPR.cpp.o [after]
    -96       0       0     -96     -60 Difference
2025-05-10 13:26:36 -04:00
David Korth
ae3dd69c78 [librptext] conversion_iconv.cpp: codePageToEncName(): Return an std::string.
This cleans up the code a bit, but does increase the .o size due to the
use of std::string.

Code size difference: (64-bit Gentoo Linux, gcc-15.1.0, release build, no LTO)

   text    data     bss     dec     hex filename
   6898       8       0    6906    1afa conversion_iconv.cpp.o [before]
   9780       8       0    9788    263c conversion_iconv.cpp.o [after]
  +2882       0       0   +2882    +b42 Difference
2025-05-10 13:18:05 -04:00
David Korth
b32ddb101e [librptexture] qoi.h: Update to latest git master release.
Upstream commit message:

Merge pull request #319 from DeeJayLSP/modulo

Make encoding 1.4% faster by replacing modulo with mask
2025-05-10 12:48:06 -04:00
David Korth
d58918f101 [rpcli] rpcli.cpp: Fix two errors introduced since switching over to vt.cpp.
- DoFile(): JSON errors should be printed to stdout, not stderr.

- _tmain(): Remove an extra newline after the `default:` case's
  "skipping unknown switch" message.
2025-05-10 12:46:07 -04:00
David Korth
25c5aa02cc [minizip] Update: v4.0.9 -> v4.0.10
Some checks failed
Codecov / run (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CMakeLists.txt: Add a missing "LINKER_LANGUAGE C". Not entirely sure
when this was added, or why I missed it...
2025-05-06 18:49:33 -04:00
David Korth
29aa2dacc9 [librpbase] TextOut_text.cpp, formatDateTime(): Use localtime_r() instead of fmt::localtime().
Some checks failed
Codecov / run (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
Interestingly, this didn't print any warnings or errors on gcc, but on
MSVC, this warning was produced:

src\librpbase\TextOut_text.cpp(359,20): error C2220: the following warning is treated as an error
src\librpbase\TextOut_text.cpp(359,20): warning C4996: 'fmt::v11::localtime': was declared deprecated
2025-05-04 20:33:27 -04:00
David Korth
10785d08fb Revert "time_r.h: Remove gmtime_r() and localtime_r() wrappers."
fmt-11.2.0 deprecated fmt::localtime(), so we'll need to bring back
our localtime_r() wrapper.

This reverts commit 137a7c0f5f.
2025-05-04 20:07:50 -04:00
David Korth
c66cd83539 [fmt] Update: v11.1.4 -> v11.2.0 2025-05-04 20:07:29 -04:00
David Korth
425f5a77e4 [libromdata] Nintendo3DSPrivate: Reduce headers_loaded from uint32_t to uint8_t.
Only 5 bits are currently used, and this reduces padding due to 64-bit
alignment in the mxh union.

Total struct size before: 9,176
Total struct size after:  9,168
Difference:                  -8
2025-05-04 12:51:20 -04:00
David Korth
050380db45 ctypex.h: Add is*_ascii() functions.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
These functions do non-localized checks, which improves performance in
most cases (due to not need to do locale lookups) and is more "correct"
when checking ROM headers in most cases.

[rpcli] vt.cpp: Removed vt_isdigit() and vt_isalpha(). We can use
isdigit_ascii() and isalpha_ascii() instead.

[libromdata] Updated most IS*() uses to is*_ascii().
NOTE: ISPRINT() and ISSPACE() are left as-is for now.

VirtualBoy: We can mark all of the private is*() functions as
constexpr now.
2025-05-04 12:45:15 -04:00
David Korth
b4ba027439 [libpng] Forgot to check in new file PNGCheckLibconf.cmake.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
2025-05-03 20:18:22 -04:00
David Korth
66e75f5a40 [libromdata] WiiTicketPrivate::getEncKey(): Use a lookup table for the CA/XS combinations.
Code size difference: (64-bit Gentoo Linux, gcc-15.1.0, release build, no LTO)

   text    data     bss     dec     hex filename
   8077     808       0    8885    22b5 WiiTicket.cpp.o [before]
   8029     808       0    8837    2285 WiiTicket.cpp.o [after]
    -48       0       0     -48     -30 Difference
2025-05-03 19:15:14 -04:00
David Korth
e804c1236f NEWS.md: Mention vWii packages. 2025-05-03 19:03:00 -04:00
David Korth
91e4a39eb1 [libromdata] WiiUPackage: Don't attempt to access Wii U-specific TMD or FST stuff in vWii packages.
vWii packages use v0 tickets and TMDs. The "content groups" doesn't
exist, nor does the FST, the system XMLs, or the TGA icons.

Skip all of these if a v0 TMD is detected.

TODO: Change the system name for v0?
2025-05-03 19:01:54 -04:00
David Korth
cbbe2e1a3d [libromdata] WiiTicket::isRomSupported_static(): Allow larger tickets for vWii titles.
NUS vWii titles may have a certificate chain appended to the ticket.
2025-05-03 19:01:26 -04:00
David Korth
85e9ca4fad [rpcli] vt.cpp: win32_color_map is only used on Windows. 2025-05-03 11:31:50 -04:00
David Korth
a077d26d67 [rpcli] vt.cpp, ConsoleSetTextColor(): Combine the two snprintf() calls into one. 2025-05-03 10:59:17 -04:00
David Korth
c706f7ba9b [libpng] Update: v1.6.47 -> v1.6.48
The APNG patch for v1.6.48 isn't out yet, but unlike v1.6.47, this
release doesn't have any major breaking changes.
2025-05-03 10:23:59 -04:00
David Korth
e07a45be0e NEWS.md: Mention URL colorization and "OSC 8" markup. 2025-05-03 09:45:59 -04:00
David Korth
45e049168e Merge branch 'feature/xattr-compression-algorithm'
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
2025-05-03 09:44:46 -04:00
David Korth
6056d61f2c NEWS.md: Mention xattr compression algorithms.
Some checks failed
Codecov / run (push) Has been cancelled
2025-05-03 09:44:05 -04:00
David Korth
21cc92b9c6 [librpfile] XAttrReader_p.hpp: Use bitflags instead of bools for all the "has*" variables.
std::bitset<> would also work, but the minimum size of std::bitset<> is
`unsigned long`, so it'd take up 8 bytes.
2025-05-02 23:19:58 -04:00
David Korth
594f379fe3 [librpfile] XAttrReader::hasXfsAttributes(): Fix typo; should return d->hasXfsAttributes, not d->hasExt2Attributes.
Not sure if this caused any weird issues...
2025-05-02 23:12:30 -04:00
David Korth
4c944a2add [gtk] Ext2AttrView: Fix alignment of lblCompression on GTK4.
Needed to enable hexpand and set xalign.

Not sure if this is needed or supported on GTK2 or GTK3, but using
gtk_box_pack_end() seems to work on the older versions anyway.
2025-05-02 21:38:52 -04:00
David Korth
88b9552cca [gtk] Ext2AttrView: Display the compression algorithm, if available.
XAttrView: Set the compression algorithm in Ext2AttrView.

We're using Ext2AttrView because most Linux file systems that support
compression also support Ext2-style attributes.
2025-05-02 21:34:37 -04:00
David Korth
6a425154a2 [kde] Ext2AttrViewPrivate::updateZAlgorithmLabel(): Remove a line of debugging code. 2025-05-02 21:22:44 -04:00
David Korth
dd75ff80ca [kde] Ext2AttrView: Revert the updateDisplay() change. [back to updateFlagsDisplay()]
This function is *only* used for flags. Not the compression algorithm.
2025-05-02 21:22:04 -04:00
David Korth
c9588a89f7 [gtk] Rename Ext2AttrView.c to Ext2AttrView.cpp.
XAttrReader::ZAlgorithm needs C++.
2025-05-02 21:18:10 -04:00
David Korth
147f9c745d [librpfile] XAttrReader: Rename the "compressionAlgorithm" stuff to "zAlgorithm".
[kde,win32] Update for this change.
2025-05-02 21:10:41 -04:00
David Korth
bca1c48b59 [librpfile] XAttrReader_posix.cpp: Remove some compression algorithm debugging code. 2025-05-02 21:06:46 -04:00
David Korth
ce01475b3d [kde] Ext2AttrView: Add a way to display the compression algorithm.
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.
2025-05-02 21:04:13 -04:00
David Korth
2982457dcc [librpfile] XAttrReader_posix.cpp: Get the compression algorithm on btrfs file systems.
This is stored in the "btrfs.compression" extended attribute.

TODO: Add a wrapper function for reading xattrs.
2025-05-02 21:03:40 -04:00
David Korth
1e094fdb8e [gtk] _RpDragImageCxx ctor: Initialize pngBytes to nullptr.
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
2025-05-02 21:02:59 -04:00
David Korth
1875c9da7e [win32] rp-*.rc: Update IDD_XATTRVIEW in the other languages.
rp-ru_RU.rc: There's now three rows in MS-DOS Attributes.
2025-05-02 20:19:56 -04:00
David Korth
b080caa4bf [win32] rp-en_US.rc: Minor adjustment to the compression algorithm dropdown. 2025-05-02 20:19:37 -04:00
David Korth
9f03ee8d45 [librpfile] XAttrReader: Initial "compression algorithm" function.
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...
2025-05-02 19:48:44 -04:00
David Korth
d4b1693c49 [librpfile] XAttrReader: Un-indent the public and private class declarations. 2025-05-02 19:45:03 -04:00
David Korth
6f9f6b9cff [librpfile] FileSystem_win32.cpp, filesize_int(): Check for INVALID_HANDLE_VALUE. 2025-05-02 19:32:13 -04:00
David Korth
e9dcd3f131 [rpcli] vt.cpp, win32_console_print_ansi_color(): Get the console handle from ci_stdout.
Some checks failed
Codecov / run (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
2025-05-01 22:45:43 -04:00
David Korth
917f0a497a [rpcli] vt.cpp: Skip "CSI 38 m" and "CSI 48 m".
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.
2025-05-01 22:33:22 -04:00