Commit Graph

12593 Commits

Author SHA1 Message Date
David Korth
5a08131311 [cmake] gcc.cmake: -Wno-error=cast-align
The Ubuntu 16.04 Launchpad build for armhf failed due to a potential
alignment issue:

/<<PKGBUILDDIR>>/src/kde/AchQtDBus.cpp: In member function ‘int AchQtDBus::notifyFunc(LibRpBase::Achievements::ID)’:
/<<PKGBUILDDIR>>/src/kde/AchQtDBus.cpp:149:59: error: cast from ‘uchar* {aka unsigned char*}’ to ‘LibRpTexture::argb32_t*’ increases required alignment of target type [-Werror=cast-align]
   argb32_t *bits = reinterpret_cast<argb32_t*>(icon.bits());
                                                           ^

This shouldn't be an actual problem, since rp_image's image data is
always 16-byte aligned.

NOTE: Not rebuilding the Ubuntu 16.04 packages for ARM because of this.
(Both the armhf and arm64 builds were cancelled.)
2025-04-20 00:09:48 -04:00
David Korth
8dddba69d1 [debian] 2.5: Build for Ubuntu 18.04 "Bionic" Beaver. 2025-04-20 00:09:23 -04:00
David Korth
54e59d8db9 [libromdata/tests] CMakeLists.txt: Disable RomHeaderTest for Launchpad.
It's failing for some unknown reason and I can't be bothered to figure
out why.
2025-04-19 23:49:27 -04:00
David Korth
75a44f6f97 rom-properties 2.5 2025-04-19 23:47:38 -04:00
David Korth
2fec18b50b [librptext] TextFuncsTest: Skip emoji tests if using glibc <2.26.
glibc earlier than 2.26 did not have proper wcwidth() values for emojis.

Also, add some Japanese katakana tests. Older glibc wcwidth *does* have
proper wcwidth(() values for katakana, so we can at least test that.

Split the emoji tests into its own unit test.
2025-04-19 23:46:28 -04:00
David Korth
789fb055ca seccomp filters: RomDataFormat needs clock_getres(), at least on 32-bit (i386) KF5 builds. 2025-04-19 23:25:54 -04:00
David Korth
b5d4fd13bb [gtk,kde] RomDataFormatTest: Don't use std::array<> when the array size could change.
Instead of defining a constant to either 5 or 4, just switch back to a
C array. We don't get any real advantage by using std::array<> here.

This fixes garbage data being read for tests on 32-bit systems that
aren't using 64-bit time_t, resulting in test failures.
2025-04-19 23:20:48 -04:00
David Korth
96c801298f [libromdata] Nintendo3DS_SMDH: Add ".icn" as a valid file extension. 2025-04-19 22:56:30 -04:00
David Korth
d389a2eb74 [librptexture] rp_image_ops_neon.cpp: We're using 32-bit shuffle/or masks here, not 8-bit masks. 2025-04-19 22:38:24 -04:00
David Korth
7c445513fb [librpbyteswap] byteswap_neon.c: Add vreinterpretq*() casts.
Similar to the vtbl stuff, but for vrev.

Only needed for gcc...
2025-04-19 22:21:22 -04:00
David Korth
15fd12663c [doc/abi] Add romdata-6 ABI listings. 2025-04-19 22:03:47 -04:00
David Korth
8073d9d826 [librpfile] VectorFile: Move MAX_SIZE from the class definition to the .cpp file.
MSVC exports it from the DLL if it's in the class definition for some
reason. We don't want it exported.
2025-04-19 21:57:03 -04:00
David Korth
0214ec25ec [rapidjson] biginteger.h, diyfp.h: Use softintrin.lib for _umul128 on arm64ec.
Ported from upstream.

extlib\rapidjson\include\rapidjson\internal\biginteger.h(22,9): error C2220: the following warning is treated as an error (compiling source file src\librpbase\TextOut_json.cpp)
extlib\rapidjson\include\rapidjson\internal\biginteger.h(22,9): warning C4163: 'UnsignedMultiply128': not available as an intrinsic function (compiling source file src\librpbase\TextOut_json.cpp)
extlib\rapidjson\include\rapidjson\internal\diyfp.h(27,9): warning C4163: 'UnsignedMultiply128': not available as an intrinsic function (compiling source file src\librpbase\TextOut_json.cpp)
2025-04-19 17:52:16 -04:00
David Korth
e6c96bc1d2 [zlib-ng] CMakeLists.txt: Also disable INSTALL_UTILS.
This is also set by extlib/CMakeLists.txt.

CMake Warning (dev) at extlib/zlib-ng/CMakeLists.txt:145 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'INSTALL_UTILS'.
This warning is for project developers.  Use -Wno-dev to suppress it.
2025-04-19 17:31:34 -04:00
David Korth
74b0465ae1 [zlib-ng] CMakeLists.txt: Disable the various optimization options.
We're setting these using SET() in extlib/CMakeLists.txt, so having them
as actual options causes CMake to print a bunch of warnings like this:

CMake Warning (dev) at extlib/zlib-ng/CMakeLists.txt:133 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'WITH_SSE2'.
This warning is for project developers.  Use -Wno-dev to suppress it.

[extlib] CMakeLists.txt: SET(WITH_VPCLMULQDQ ON)
2025-04-19 17:19:05 -04:00
David Korth
8507eb43d8 [kde] RpQt.hpp: #include <QApplication>
Needed by the Qt4 build:

In file included from src/kde/OptionsMenuButton.hpp:24:0,
                 from rp.build/src/kde/kde4/moc_OptionsMenuButton.cpp:9,
                 from rp.build/src/kde/kde4/rom-properties-kde4_automoc.cpp:8:
src/kde/RpQt.hpp: In function ‘QFont getSystemMonospaceFont()’:
src/kde/RpQt.hpp:259:21: error: incomplete type ‘QApplication’ used in nested name specifier
  QFont fntMonospace(QApplication::font());
                     ^
2025-04-19 17:05:37 -04:00
David Korth
ef415b7998 NEWS.md: Mention that the KDE monospace font changes requires Qt 5.2 or later. 2025-04-19 17:00:45 -04:00
David Korth
a938888d17 [kde] RpQt.hpp: New inline function getSystemMonospaceFont().
This abstracts the differences betwene the Qt 5.2+ version, which uses
QFontDatabase::systemFont(), and the older Qt version, which just uses
the "Monospace" font.

Updated everything to use getSystemMonospaceFont().
2025-04-19 16:59:38 -04:00
David Korth
d655231b30 [kde] ConfigDialog::changeEvent(): Use QApplication instead of QGuiApplication for Qt4 compatibility. 2025-04-19 16:52:05 -04:00
David Korth
d7cb9370a5 [kde] QFontDatabase::systemFont() was added in Qt 5.2.
Add back the old version for older Qt.

Note that there's a few changes. In particular, RomDataView now uses
the same method as KeyStoreModel; that is, instead of creating a brand
new font using family "Monospace", it gets the application font and
applies the "Monospace" font family. I'm not sure if this will help
at all or not.

Also, we're not disabling QEvent::StyleChange, even though it's unlikely
to be useful without QFontDatabase::systemFont().
2025-04-19 16:50:36 -04:00
David Korth
df8805b0c1 [libromdata] WimPrivate::addFields_XML(): Explicitly initialize p to nullptr.
gcc-5.4.0 on Xubuntu 16.04 complains, even though it's not possible for
`p` to be used in an uninitialized state:

src/libromdata/Media/Wim_xml.cpp: In member function ‘int LibRomData::WimPrivate::addFields_XML()’:
src/libromdata/Media/Wim_xml.cpp:265:33: error: ‘p’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     char *const dupdesc = strdup(p + 9);
                                 ^
2025-04-19 16:37:51 -04:00
David Korth
e234de20e6 [locale] Update rom-properties.pot and *.po. 2025-04-19 16:34:50 -04:00
David Korth
a0bed9d59d NEWS.md: Mention the KDE UI frontend monospace font changes. 2025-04-19 16:13:18 -04:00
David Korth
f8db1096d8 [kde] Ext2AttrView, XfsAttrView: Handle style changes by installing an event filter in the top-level widget.
RpQt: Inlined installEventFilterInTopLevelWidget() in the .hpp file.
Otherwise, we'd have to link RpQt.cpp in with the XAttrView plugin,
and we can't do that easily because RpQt.cpp has more dependencies.
2025-04-19 16:11:57 -04:00
David Korth
c8e5871cc7 [kde] Split the top-level event filter code from RomDataView into RpQt.
New function installEventFilterInTopLevel() will install the specified
QWidget as an event filter into its top-level parent widget.
2025-04-19 16:03:59 -04:00
David Korth
d7ee9512ae [kde] RomDataView: Handle font changes for monospace font widgets.
Add an event filter for the top-level window. This lets us handle
QEvent::StyleChange.

Add all monospace widgets to a vector, vecMonoWidgets. On a font change,
all widgets in this vector will be updated.

NOTE: I'm using std::vector<> instead of QVector<> because QVector has
overhead from using pimpl.
2025-04-19 15:57:08 -04:00
David Korth
2f116d05a8 [kde] ConfigDialog: Forward QEvent::StyleChange to KeyManagerTab to handle font changes.
NOTE: There's also QEvent::ThemeChange. Both seem to get emitted here
when the monospace font is changed, so I'm not sure which one is
more "correct".

TODO: Handle font changes in other things that use monospace fonts.

KeyManagerTab: Handle QEvent::StyleChange instead of QEvent::FontChange.
QEvent::FontChange is for if something calls setFont(), not if the
system font changes.
2025-04-19 15:34:39 -04:00
David Korth
8147327146 [kde] Get the system-wide monospace font (FixedFont) instead of using "Monospace".
"Monospace" uses Qt's own default monospace font, which is usually
DejaVu Sans Mono. By using QFontDatabase, we can get the monospace
font set by the user in KDE's System Settings.

Updated everything that uses monospace fonts.

NOTE: The XAttr .ui files still have "Monospace". The actual font is
loaded in the main class constructor.
2025-04-19 15:22:46 -04:00
David Korth
98d49f4ec2 [libromdata] Wim_xml: number_of_images may be inaccurate. 2025-04-18 13:18:19 -04:00
David Korth
1508d05da2 [libromdata] Wim_xml: Handle more than 26 sub-images.
- Use uint32_t for unstaged_idx.
- Print the sub-image index as if it's an Excel column name:
  - 1a-1z for the first 26 sub-images
  - 1aa-1az for the next 26 sub-images
  - 1ba-1bz for the next 26 sub-images
  - etc...

See #445: [libromdata - WIM] Unstaged Windows OS installation images not properly supported
Requested by @pivotman319-owo.

TODO: "FLAGS" node contains "Windows Foundation".
2025-04-18 13:15:34 -04:00
David Korth
6f3f1e4aad [libromdata] Wim_xml: Handle a malformed unstaged image entry.
These entries end with "EDITIONS:" but don't actually have any editions
listed. Handle them as a regular staged image instead.
2025-04-18 12:58:28 -04:00
David Korth
7a4dbe8ddd [libromdata] Wim_xml: Don't use wimHeader.number_of_images as the actual image count.
Use the number of <IMAGE> elements instead.

This means that a malformed image could have the wrong "number of images",
which is displayed *before* the XML is parsed.

Also use the IMAGE's INDEX attribute for the actual index value.
2025-04-18 12:55:58 -04:00
David Korth
e9668100c9 [libromdata] Wim_xml.cpp: Store the unstaged index in WimIndex.
Use WimIndex.index and WimIndex.unstaged_idx when adding the ListData
instead of manually adding values. This prevents issues where a Wim
image with two unstaged images shows up as a single unstaged image.
2025-04-18 12:47:55 -04:00
David Korth
069e8d503c [libromdata] Wim_xml.cpp: "EDITIONS:" is in Description, not Display Description.
Tested with a Windows 7 64-bit Checked disc image.

See #445: [libromdata - WIM] Unstaged Windows OS installation images not properly supported
Requested by @pivotman319-owo.
2025-04-17 23:15:42 -04:00
David Korth
ea6adf3348 [librpbase] TextOut_text.cpp, ListDataField(): Calculate all timestamp widths instead of using a dummy value.
The dummy value may be off by a few characters depending on timezone and
locale settings.

In my case (GMT-5, en_US), the dummy value is "12/31/1969 12:00:00 AM",
which results in extra spaces if all timestamps are earlier than October
or before the 10th of the month, or possibly before 10 AM/PM.

This might be a bit slower, since all timestamps have to be formatted
twice. (TODO: Cache the formatted timestamps?)
2025-04-17 20:12:50 -04:00
David Korth
b4fe8c22e1 [libromdata] Wim_xml: Add special handling for unstaged images.
Unstaged images contain sets of components instead of a fully-installed
Windows system. These aren't as common as staged images.

The list of editions appears to be in the display description, though
I don't have an unstaged image to verify this. If the display description
contains "EDITIONS:", and the regular edition field and languages are
both empty, then it will be assumed to be unstaged. The list of editions
will be split and one image will be shown for each edition, using the
image number and a letter.

Should fix #445: [libromdata - WIM] Unstaged Windows OS installation images not properly supported
Requested by @pivotman319-owo.

NOTE: Needs to be verified!
2025-04-17 20:03:13 -04:00
David Korth
34b1c4b05b [librptexture] ARM NEON code: Use vreinterpret*() functions.
Both clang and MSVC appear to be rather lax with regards to vector
conversions, e.g. implicitly converting from 32x4 to 8x16.

gcc, by default, complains about it:

note: use '-flax-vector-conversions' to permit conversions between vectors with differing element types or numbers of subparts
error: cannot convert '__Uint32x4_t' to 'uint8x16_t'

Instead of adding '-flax-vector-conversions', add macros to make use of
vtbl with the vinterpret*() functions. Note that the vinterpret*()
functions don't change the resulting assembly at all; they merely specify
the explicit intent for the vector conversion.

Also, there are no vinterpret*() functions for the multi-vector types,
e.g. uint32x4x4_t; only for the single-vector types.
2025-04-17 19:38:56 -04:00
David Korth
6878e3f5e4 [librptexture] NEON: Remove the unnecessary AND mask for vtbl.
It turns out vtbl *does* zero out the destination value if the control
index is "out of range". We'll use 0xFF for this.

This makes the AND mask unnecessary.

ImageDecoderTest still passes with this change.

fromLinear32_neon():
- Remove the PixelFormat::G16R16 case from the has_alpha branch,
  since this format doesn't have alpha.
- has_alpha has a simpler meaning. Using "MASK_NONE" for images
  with alpha, and "MASK_ALPHA" for images without alpha, is
  confusing. The mask was supposed to mean "mask this channel *out*".

fromLinear32_ssse3(): Likewise.
2025-04-17 01:56:47 -04:00
David Korth
7ed47da83f [librptexture] rp_image::swizzle_ssse3(): backport SET_MASK_VALS() from the NEON version.
No AND mask is needed here.
2025-04-17 01:29:23 -04:00
David Korth
06a86667b3 [librptexture] rp_image_ops_neon.cpp: Added a NEON-optimized version of rp_image::swizzle().
Note that NEON's vtbl instructions doesn't support the bit 7 "zero it"
feature that x86's pshufb supports, so we have to use an AND mask in
addition to an OR mask.

Tested using luminance_alpha_reference_u.ktx2, which has a swizzle
value 'rrrg'. (Also used this for testing the previous commit, which
switched some mask stuff from 8-bit operations to 32-bit.)
2025-04-17 01:27:12 -04:00
David Korth
1ed88d90e1 [librptexture] rp_image::swizzle_ssse3(): Use u8_32 for pshufb_mask_vals.
This lets us use 32-bit operations instead of 8-bit operations, which
reduces code size and improves performance a bit.

This was already done for por_mask_vals, so I'm not sure why I didn't
do this for pshufb_mask_vals...

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

   text    data     bss     dec     hex filename
   2691       0       0    2691     a83 rp_image_ops_ssse3.cpp.o [before]
   2221       0       0    2221     8ad rp_image_ops_ssse3.cpp.o [after]
   -470       0       0    -470    -1d6 Difference
2025-04-17 00:56:18 -04:00
David Korth
6765222c58 [unice68] unice68.c, exactread(): Fix a missing printf() format parameter.
Fixes two CodeQL warnings:
- Incorrect format parameter.
- Too few format parameters.
2025-04-15 22:29:53 -04:00
David Korth
a9f6f7ed26 [libromdata] CBMDOSPrivate::read_GCR_track(): Expand sector to unsigned int.
Probably faster on modern CPUs, and CodeQL is complaining because it was
comparing a `uint8_t` iterator to an `unsigned int` end condition.
2025-04-15 19:39:50 -04:00
David Korth
94d1564f38 [librpbase] RomMetaDataPrivate::addProperty(): Fix mismatched delete.
pMetaData->data.str is allocated using malloc() [or, more specifically,
strdup()], so use free() instead of delete.

Found using CodeQL.
2025-04-15 18:43:20 -04:00
David Korth
1fc6cc824b Merge branch 'feature/arm-neon-ImageDecoder_Linear' 2025-04-13 11:50:58 -04:00
David Korth
acbd20859b [cmake] CPUInstructionSetFlags.cmake: Check for arm_neon.h when building for ARM.
[librpbyteswap,librptexture] If arm_neon.h isn't available, don't compile
any NEON-optimized functions.

Just in case someone wants to build rom-properties for an ancient ARM
system that was introduced before NEON...
2025-04-13 11:47:13 -04:00
David Korth
fd85248c27 [librpbyteswap] CMakeLists.txt: Remove unnecessary UNSET(arch). 2025-04-11 21:28:40 -04:00
David Korth
d30381d842 [librpbyteswap] byteswap_rp.h: Some more SSE2 -> NEON comment fixes. 2025-04-11 21:26:22 -04:00
David Korth
ce0f71ead6 [librpbyteswap] byteswap_neon.c: s/arm64/neon/ 2025-04-11 21:23:22 -04:00
David Korth
77d9be5adc [librptexture] ImageDecoder_Linear_neon.cpp: Fix some leftover "SSSE3" comments. 2025-04-11 19:54:08 -04:00