Commit Graph

11874 Commits

Author SHA1 Message Date
David Korth
05a4396ad8 rom-properties 2.4.1 2024-11-12 22:22:54 -05:00
David Korth
bf7429ed29 [win32] RP_ExtractImage: Fix an issue with directory thumbnailing for unsupported directories.
RP_ExtractImage::Load() needs to return E_FAIL, not S_OK, if the directory
is unsupported. Otherwise, Windows will show a regular directory icon,
without thumbnailing the directory's contents.

Fixes #427: No Thumbnails after install
Reported by @Conan179.
2024-11-12 22:21:43 -05:00
David Korth
e264415bcc [cmake] Fix Qt6 CMake build system issues on Ubuntu 24.10.
- Set QT_NO_CREATE_VERSIONLESS_TARGETS to disable Qt::Core. Otherwise,
  CMake ends up trying to create Qt::Core twice, even when building for
  KF6 only and not KF5+KF6:

CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt6Core/Qt6CoreVersionlessTargets.cmake:42 (message):
  Some (but not all) targets in this export set were already defined.

  Targets Defined: Qt::Core

  Targets not yet defined: Qt::CorePrivate

Call Stack (most recent call first):
  /usr/lib/x86_64-linux-gnu/cmake/Qt6Core/Qt6CoreConfig.cmake:68 (include)
  /usr/lib/x86_64-linux-gnu/cmake/Qt6/Qt6Config.cmake:174 (find_package)
  cmake/libs/RP_FindQt6andKF6.cmake:34 (FIND_PACKAGE)
  src/kde/kf6/CMakeLists.txt:6 (FIND_QT6_AND_KF6)

- Don't specify the minimum KF6 version, because that's breaking for
  some reason.

-- Could NOT find KF65.248.0 (missing: KF65.248.0_DIR)
-- Could NOT find KF65.248.0: found neither KF65.248.0Config.cmake nor kf65.248.0-config.cmake
CMake Error at /usr/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find KF6 (missing: 5.248.0) (found version "6.6.0")
Call Stack (most recent call first):
  /usr/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/ECM/find-modules/FindKF6.cmake:93 (find_package_handle_standard_args)
  cmake/libs/RP_FindQt6andKF6.cmake:78 (FIND_PACKAGE)
  src/kde/kf6/CMakeLists.txt:6 (FIND_QT6_AND_KF6)

(cherry picked from commit cb507652cb)

Conflicts:
	debian/changelog
2024-11-12 21:08:21 -05:00
David Korth
530c02f1cb [librpsecure] Whitelist statx() to fix amiiboc on armhf on Ubuntu 24.04 and later.
On armhf (glibc-2.39), amiiboc ends up calling statx() indirectly through
the fgets() function:

Program received signal SIGSYS, Bad system call.
__libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
warning: 47     ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S: No such file or directory
(gdb) bt
=0  __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
=1  0xb6d2ea0a in fstatat64_time64_statx (flag=4096, buf=0xbefff690,
    file=0xb6d91c18 "", fd=3) at ../sysdeps/unix/sysv/linux/fstatat64.c:50
=2  __GI___fstatat64_time64 (fd=3, file=0xb6d91c18 "", buf=0xbefff690,
    flag=4096) at ../sysdeps/unix/sysv/linux/fstatat64.c:150
=3  0xb6cdaae4 in __GI__IO_file_doallocate (fp=0x414f60) at libioP.h:1030
=4  0xb6ce5518 in __GI__IO_doallocbuf (fp=0x414f60) at libioP.h:1030
=5  __GI__IO_doallocbuf (fp=fp@entry=0x414f60) at genops.c:342
=6  0xb6ce3e86 in _IO_new_file_underflow (fp=0x414f60) at fileops.c:486
=7  0xb6ce557a in __GI__IO_default_uflow (fp=0x414f60) at libioP.h:1030
=8  0xb6cdc03e in __GI__IO_getline_info (fp=fp@entry=0x414f60,
    buf=buf@entry=0xbefff804 "ƀ㶫7\357Z\234\370\377\276\004\323\375\266\330\354\377\266\001", n=n@entry=255, delim=delim@entry=10,
    extract_delim=extract_delim@entry=1, eof=eof@entry=0x0) at iogetline.c:60
=9  0xb6cdc0c8 in __GI__IO_getline (fp=fp@entry=0x414f60,
    buf=buf@entry=0xbefff804 "ƀ㶫7\357Z\234\370\377\276\004\323\375\266\330\354\377\266\001", n=n@entry=255, delim=delim@entry=10,
    extract_delim=extract_delim@entry=1) at iogetline.c:34
=10 0xb6cdb288 in _IO_fgets (
    buf=buf@entry=0xbefff804 "ƀ㶫7\357Z\234\370\377\276\004\323\375\266\330\354\377\266\001", n=n@entry=256, fp=fp@entry=0x414f60) at iofgets.c:53
=11 0x004019e8 in fgets (__stream=0x414f60, __n=256,
    __s=0xbefff804 "ƀ㶫7\357Z\234\370\377\276\004\323\375\266\330\354\377\266\001") at /usr/include/arm-linux-gnueabihf/bits/stdio2.h:200
=12 main (argc=<optimized out>, argv=0xbefffaa4)
    at rom-properties/src/amiibo-data/amiiboc.cpp:204

(cherry picked from commit b18306df1c)

Conflicts:
	debian/changelog
2024-11-12 21:08:03 -05:00
David Korth
1210803d7c Version bump for development. (v2.4+) 2024-11-12 21:07:34 -05:00
David Korth
87eb036468 rom-properties 2.4 2024-11-10 22:39:38 -05:00
David Korth
b349a20d39 [gtk/tests] CMakeLists.txt: Need to completely disable RomDataFormatTest_glib, not just the test runner. 2024-11-10 22:22:05 -05:00
David Korth
e6025afc9e [gtk/tests] Also disable RomDataFormatTest_glib.
Failing on armhf.
2024-11-10 22:11:38 -05:00
David Korth
5b7d861243 FIXME: Some tests are failing on Launchpad on armhf/arm64.
Tests failing:
- ImageDecoderTest
- RomHeaderTest
- RomDataFormatTest_kf5

On armhf, RomDataFormatTest doesn't even compile due to a
truncation error:

/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp: In member function ‘virtual void LibRomData::Tests::RomDataFormatTest_formatDateTime_0_invalid_Test::TestBody()’:
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp:72:3: error: narrowing conversion of ‘2147483648u’ from ‘unsigned int’ to ‘time_t {aka long int}’ inside { } [-Wnarrowing]
  }};
   ^
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp: In member function ‘virtual void LibRomData::Tests::RomDataFormatTest_formatDateTime_1_dateOnly_Test::TestBody()’:
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp:101:3: error: narrowing conversion of ‘2147483648u’ from ‘unsigned int’ to ‘time_t {aka long int}’ inside { } [-Wnarrowing]
  }};
   ^
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp: In member function ‘virtual void LibRomData::Tests::RomDataFormatTest_formatDateTime_2_timeOnly_Test::TestBody()’:
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp:125:3: error: narrowing conversion of ‘2147483648u’ from ‘unsigned int’ to ‘time_t {aka long int}’ inside { } [-Wnarrowing]
  }};
   ^
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp: In member function ‘virtual void LibRomData::Tests::RomDataFormatTest_formatDateTime_3_dateAndTime_Test::TestBody()’:
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp:150:3: error: narrowing conversion of ‘2147483648u’ from ‘unsigned int’ to ‘time_t {aka long int}’ inside { } [-Wnarrowing]
  }};
   ^
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp: In member function ‘virtual void LibRomData::Tests::RomDataFormatTest_formatDateTime_4_invalid_Test::TestBody()’:
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp:177:3: error: narrowing conversion of ‘2147483648u’ from ‘unsigned int’ to ‘time_t {aka long int}’ inside { } [-Wnarrowing]
  }};
   ^
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp: In member function ‘virtual void LibRomData::Tests::RomDataFormatTest_formatDateTime_5_dateOnly_Test::TestBody()’:
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp:207:3: error: narrowing conversion of ‘2147483648u’ from ‘unsigned int’ to ‘time_t {aka long int}’ inside { } [-Wnarrowing]
  }};
   ^
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp: In member function ‘virtual void LibRomData::Tests::RomDataFormatTest_formatDateTime_6_timeOnly_noYear_Test::TestBody()’:
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp:232:3: error: narrowing conversion of ‘2147483648u’ from ‘unsigned int’ to ‘time_t {aka long int}’ inside { } [-Wnarrowing]
  }};
   ^
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp: In member function ‘virtual void LibRomData::Tests::RomDataFormatTest_formatDateTime_7_dateAndTime_noYear_Test::TestBody()’:
/<<PKGBUILDDIR>>/src/kde/tests/RomDataFormatTest.cpp:258:3: error: narrowing conversion of ‘2147483648u’ from ‘unsigned int’ to ‘time_t {aka long int}’ inside { } [-Wnarrowing]
  }};
   ^
2024-11-10 21:59:15 -05:00
David Korth
af15c13b80 [debian] control: Add libkf5crash-dev.
[doc] COMPILING.md: Add KCrash packages.

Missed these in commit e263b35b07.
([kde] stub-export.cpp: Set up KAboutData.)
2024-11-10 21:40:39 -05:00
David Korth
2fde4ca142 [doc/abi] Add romdata-5 ABI listings. 2024-11-10 21:25:00 -05:00
David Korth
027211d11b [doc/abi] romdata-4.exports.amd64.Windows.msvc17.txt: Remove extraneous ')' characters from vftable entries. 2024-11-10 21:09:35 -05:00
David Korth
4efefe8c55 [rp-download] rp-download.cpp: Actually make use of ATTR_TPRINTF().
ATTR_TPRINTF() was added in commit 0096157cf8
([rp-download] rp-download.cpp: Simplify the printf attribute handling.)
but functions were still using ATTR_PRINTF.

Also, define ATTR_TPRINTF() as nothing if compiling for Win32 with
Unicode, so those builds don't fail with weird errors.
2024-11-10 20:40:03 -05:00
David Korth
638d243471 [libwin32darkmode] DarkMode.cpp: Convert MyOpenThemeData from a lambda function to a static function.
OpenNcThemeData is WINAPI, and gcc doesn't support using non-cdecl
calling conventions on lambda functions.

Note that this only affects the 32-bit i386 Windows build.

src/libwin32darkmode/DarkMode.cpp: In function ‘void FixDarkScrollBar()’:
src/libwin32darkmode/DarkMode.cpp:112:57: error: invalid ‘static_cast’ from type ‘void*(HWND, LPCWSTR)’ {aka ‘void*(HWND__*, const wchar_t*)’} to type ‘fnOpenNcThemeData’ {aka ‘void* (__attribute__((stdcall)) *)(HWND__*, const wchar_t*)’}
  112 |         addr->u1.Function = reinterpret_cast<ULONG_PTR>(static_cast<fnOpenNcThemeData>(MyOpenThemeData));
      |                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-11-10 20:36:01 -05:00
David Korth
1e72359a0a [locale] Update de.po and it.po from Crowdin.
Italian translation updates provided by MaRod92.
German translation updates provided by @xxmichibxx.

[win32] rp-it_IT.rc: Copy some translations from it.po.
2024-11-10 20:10:01 -05:00
David Korth
f04bcc35f5 [locale] Update rom-properties.pot and *.po. 2024-11-10 19:20:02 -05:00
David Korth
302738c2d6 [cmake] msvc.cmake: Disable /permissive- if using an SDK version older than 10.0.
Enable it for both debug and release if using 10.0 or later.

This fixes an issue when running package.cmd that caused
InitPropVariantFromUInt16() to not be detected correctly when using
the Windows 7 SDK. (/permissive- was only enabled for debug builds,
but MSVC builds are technically debug and release, so it got enabled
in the InitPropVariantFromUInt16() check.)

These errors occurred without this fix:

c:\program files (x86)\microsoft sdks\windows\v7.1a\include\objbase.h(239): error C2760: syntax error: unexpected token 'identifier', expected 'type specifier'
c:\program files (x86)\microsoft sdks\windows\v7.1a\include\gdiplusheaders.h(891): error C4596: 'EmfToWmfBits': illegal qualified name in member declaration
c:\program files (x86)\microsoft sdks\windows\v7.1a\include\gdiplusstringformat.h(220): error C4596: 'GetTrimming': illegal qualified name in member declaration
2024-11-10 18:57:20 -05:00
David Korth
dfaf135634 [libromdata] WiiUPackage: Don't attempt to get external artwork for titles that aren't games.
Updates and DLC were only available on eShop, not on disc.
2024-11-10 18:02:42 -05:00
David Korth
837535a707 [kde] RomDataView: Remove a line of debugging code.
Was accidentally committed in commit 63ae18ad87.
(Force PAL mode in language combo boxes if the game region is PAL.)
2024-11-10 17:47:29 -05:00
David Korth
63ae18ad87 Force PAL mode in language combo boxes if the game region is PAL.
[librpbase] RomData: Add an "isPAL" flag.

UI frontends: Set the Language Combo Box's forcePAL flag to match the
RomData's isPAL flag.

Updated a number of RomData subclasses to set isPAL if it's known.

TODO: Set isPAL in:
- WiiUPackage
- WiiWAD
- Nintendo3DS

Other changes:

[libromdata] GameCubeBNR: Set d->isValid to false if comments could not
be read.
2024-11-10 17:35:56 -05:00
David Korth
cc9c3b4349 [libromdata/tests] SuperMagicDriveTest: Reset the aligned memory buffer to an 8-byte buffer, not 0-byte.
Valgrind complained that 0 is an invalid size value for posix_memalign().

Similar to ByteswapTest.

==2175587== posix_memalign() invalid size value: 0
==2175587==    at 0x484C1F1: posix_memalign (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2175587==    by 0x12FF4E: aligned_malloc(unsigned long, unsigned long) (aligned_malloc.h:89)
==2175587==    by 0x131165: aligned_uptr<unsigned char> (aligned_malloc.h:146)
==2175587==    by 0x131165: LibRomData::Tests::SuperMagicDriveTest::SuperMagicDriveTest() (SuperMagicDriveTest.cpp:34)
==2175587==    by 0x13133B: SuperMagicDriveTest_decodeBlock_cpp_test_Test (SuperMagicDriveTest.cpp:223)
==2175587==    by 0x13133B: testing::internal::TestFactoryImpl<LibRomData::Tests::SuperMagicDriveTest_decodeBlock_cpp_test_Test>::CreateTest() (gtest-internal.h:469)
==2175587==    by 0x154E94: testing::Test* testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) (gtest.cc:2599)
==2175587==    by 0x15F3B7: testing::Test* testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) (gtest.cc:2635)
==2175587==    by 0x14CA05: testing::TestInfo::Run() (gtest.cc:2843)
==2175587==    by 0x14CC92: testing::TestSuite::Run() (gtest.cc:3012)
==2175587==    by 0x1515D4: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5870)
==2175587==    by 0x156866: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2599)
==2175587==    by 0x15F783: bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2635)
==2175587==    by 0x14C8C3: testing::UnitTest::Run() (gtest.cc:5444)
==2175587==
==2175587== posix_memalign() invalid size value: 0
==2175587==    at 0x484C1F1: posix_memalign (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2175587==    by 0x12FF4E: aligned_malloc(unsigned long, unsigned long) (aligned_malloc.h:89)
==2175587==    by 0x130364: aligned_uptr<unsigned char> (aligned_malloc.h:146)
==2175587==    by 0x130364: LibRomData::Tests::SuperMagicDriveTest::TearDown() (SuperMagicDriveTest.cpp:110)
==2175587==    by 0x154E2C: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2599)
==2175587==    by 0x15F1D2: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2635)
==2175587==    by 0x14C830: testing::Test::Run() (gtest.cc:2682)
==2175587==    by 0x14CA96: testing::TestInfo::Run() (gtest.cc:2853)
==2175587==    by 0x14CC92: testing::TestSuite::Run() (gtest.cc:3012)
==2175587==    by 0x1515D4: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5870)
==2175587==    by 0x156866: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2599)
==2175587==    by 0x15F783: bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2635)
==2175587==    by 0x14C8C3: testing::UnitTest::Run() (gtest.cc:5444)
==2175587==
2024-11-10 16:58:22 -05:00
David Korth
6ff4efda18 [extlib] CMakeLists.txt: minigzip_cmd -> minigzip_cli; minizip_cmd -> minizip_cli
Without this renaming, these binaries are built automatically, even
though we don't need them most of the time.

With this renaming, they'll only be built if the user explicitly
specifies that they should be built.

This regressed when updating from minizip-ng v4.0.6 to v4.0.7 in
commit 3c90ea3d26.
2024-11-10 16:54:50 -05:00
David Korth
4d18f34566 [librpbyteswap/tests] ByteswapTest: Reset the aligned memory buffer to an 8-byte buffer, not 0-byte.
Valgrind complained that 0 is an invalid size value for posix_memalign().

==2154638== posix_memalign() invalid size value: 0
==2154638==    at 0x484C1F1: posix_memalign (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2154638==    by 0x13764E: aligned_malloc(unsigned long, unsigned long) (aligned_malloc.h:89)
==2154638==    by 0x13EED5: aligned_uptr<unsigned char> (aligned_malloc.h:146)
==2154638==    by 0x13EED5: LibRpCpu::Tests::ByteswapTest::ByteswapTest() (ByteswapTest.cpp:32)
==2154638==    by 0x13FEC7: ByteswapTest_macroTest_Test (ByteswapTest.cpp:108)
==2154638==    by 0x13FEC7: testing::internal::TestFactoryImpl<LibRpCpu::Tests::ByteswapTest_macroTest_Test>::CreateTest() (gtest-internal.h:469)
==2154638==    by 0x165554: testing::Test* testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) (gtest.cc:2599)
==2154638==    by 0x16FA77: testing::Test* testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) (gtest.cc:2635)
==2154638==    by 0x15D0C5: testing::TestInfo::Run() (gtest.cc:2843)
==2154638==    by 0x15D352: testing::TestSuite::Run() (gtest.cc:3012)
==2154638==    by 0x161C94: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5870)
==2154638==    by 0x166F26: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2599)
==2154638==    by 0x16FE43: bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2635)
==2154638==    by 0x15CF83: testing::UnitTest::Run() (gtest.cc:5444)
==2154638==
==2154638== posix_memalign() invalid size value: 0
==2154638==    at 0x484C1F1: posix_memalign (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2154638==    by 0x13764E: aligned_malloc(unsigned long, unsigned long) (aligned_malloc.h:89)
==2154638==    by 0x137CDC: aligned_uptr<unsigned char> (aligned_malloc.h:146)
==2154638==    by 0x137CDC: LibRpCpu::Tests::ByteswapTest::TearDown() (ByteswapTest.cpp:102)
==2154638==    by 0x1654EC: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2599)
==2154638==    by 0x16F892: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2635)
==2154638==    by 0x15CEF0: testing::Test::Run() (gtest.cc:2682)
==2154638==    by 0x15D156: testing::TestInfo::Run() (gtest.cc:2853)
==2154638==    by 0x15D352: testing::TestSuite::Run() (gtest.cc:3012)
==2154638==    by 0x161C94: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5870)
==2154638==    by 0x166F26: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2599)
==2154638==    by 0x16FE43: bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2635)
==2154638==    by 0x15CF83: testing::UnitTest::Run() (gtest.cc:5444)
==2154638==
2024-11-10 16:48:16 -05:00
David Korth
37fd5fc696 [librpbyteswap/tests] s/LibRpCpu/LibRpByteswap/ 2024-11-10 16:46:21 -05:00
David Korth
989f93ef61 [libromdata] RomDataFactory::create(): Fix an uninitialized memory read when reading small files.
DDS_Blender/tex_cmp_bc1.dds is 368 bytes. One of the magic numbers is
located at 0x304 (772), so attempting to read this ended up reading
unintialized memory in the header buffer.

Fix this by checking that the magic number address is in range of the
header data that was read.

Found using valgrind-3.24.0:

[ RUN      ] DDS_Blender/ImageDecoderTest.decodeTest/DDS_Blender_tex_cmp_bc1_dds_gz_Image
==2140873== Conditional jump or move depends on uninitialised value(s)
==2140873==    at 0x49A2A2B: LibRomData::RomDataFactory::create(std::shared_ptr<LibRpFile::IRpFile> const&, unsigned int) (RomDataFactory.cpp:770)
==2140873==    by 0x174D0F: LibRomData::Tests::ImageDecoderTest::decodeTest_internal() (ImageDecoderTest.cpp:419)
==2140873==    by 0x175B4E: LibRomData::Tests::ImageDecoderTest_decodeTest_Test::TestBody() (ImageDecoderTest.cpp:482)
==2140873==    by 0x1CA0B2: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2599)
==2140873==    by 0x1D39A0: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2635)
==2140873==    by 0x1C2065: testing::Test::Run() (gtest.cc:2674)
==2140873==    by 0x1C2296: testing::TestInfo::Run() (gtest.cc:2853)
==2140873==    by 0x1C2492: testing::TestSuite::Run() (gtest.cc:3012)
==2140873==    by 0x1C6DD4: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5870)
==2140873==    by 0x1CB44A: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2599)
==2140873==    by 0x1D3F51: bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2635)
==2140873==    by 0x1C20C3: testing::UnitTest::Run() (gtest.cc:5444)
==2140873==
[       OK ] DDS_Blender/ImageDecoderTest.decodeTest/DDS_Blender_tex_cmp_bc1_dds_gz_Image (108 ms)
2024-11-10 16:37:45 -05:00
David Korth
e162b2e349 [librpfile] CMakeLists.txt: Explicitly link to libwin32common / libunixcommon.
Otherwise, the non-libromdata.so build fails:

FAILED: lib/libextract-rom-properties.so
rpfile.dir/FileSystem_common.cpp.o: in function `LibRpFile::FileSystem::initConfigDirectories()':
librpfile/FileSystem_common.cpp:47:(.text+0x2d6): undefined reference to `LibUnixCommon::getConfigDirectory[abi:cxx11]()'
cachecommon.dir/CacheDir.cpp.o: in function `LibCacheCommon::initCacheDirectory()':
libcachecommon/CacheDir.cpp:43:(.text+0x240): undefined reference to `LibUnixCommon::getCacheDirectory[abi:cxx11]()'
2024-11-10 16:26:01 -05:00
David Korth
98bc4e5c45 [libromdata] GameCube, WiiTMD, WiiWAD: Use C++11 initialization for the access rights header vector. 2024-11-10 16:10:08 -05:00
David Korth
a6a4eb88ac [librpbase] RomMetaData.hpp: Reduce the Property enum from int to int8_t.
There's currently only 79 properties defined, so `int` wastes space.

This reduces the size of RomMetaDataPrivate from 344 bytes to 104 bytes
(on amd64).

TODO: Don't use an std::array<> for map_metaData?
2024-11-10 15:56:57 -05:00
David Korth
24da8031b2 [librpbase] RomData: Always allocate d->metaData instead of making it a pointer.
Most RomData subclasses support metadata now, so keeping it as a pointer
to reduce memory usage doesn't make sense anymore.

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

   text    data     bss     dec     hex filename
2288237   84088     696 2373021  24359d libromdata.so.5 [before]
2283405   84088     696 2368189  2422bd libromdata.so.5 [after]
  -4832       0       0   -4832   -12e0 Difference

Related changes:

Atari7800, CBMCart, ColecoVision, Intellivision, Sega8Bit:
- Now returns 0 instead of -ENOENT if no metadata was available.

GameBoyAdvance: 2 properties are returned, so increase the reservation.

PSP: Up to 4 properties are returned, so increase the reservation.
2024-11-10 15:51:08 -05:00
David Korth
f0a3b5a918 [libromdata] Split common code from WiiU and WiiUPackage extURLs() into WiiU::extURLs_int().
The extURLs() functions now check for d->isValid and then call
extURLs_int() to get the URLs using the id4.

For WiiU, the id4 is taken from d->discHeader.

For WiiUPackage, the id4 is taken from meta.xml.
2024-11-10 14:58:08 -05:00
David Korth
48e0bbff9d [libromdata] WiiUPackage: Use std::array<uint8_t, 16> for iv.
Fixes a clang-tidy warning:

src/libromdata/Console/WiiUPackage.cpp:171:3: warning: do not declare C-style arrays, use std::array<> instead [modernize-avoid-c-arrays]
  171 |                 uint8_t iv[16];
      |                 ^

Also, use array::fill() instead of memset(), since array::fill() will
generate 128-bit SIMD code with most modern compilers. (memset() probably
would as well, if clearing the full 16 bytes instead of just 14...)
2024-11-09 17:44:33 -05:00
David Korth
113191b77f [win32] res/*.rc: Update Win32 config dialogs to handle the addition of WiiUPackage. 2024-11-09 17:29:36 -05:00
David Korth
e961649f54 [libromdata] ImageTypesConfig: Add WiiUPackage.
In theory, this should be the same as Wii U, but there are some eShop
titles that weren't released on disc, and some disc titles that weren't
released on eShop.

TODO: Maybe combine the two? Would require adding "icon" to the regular
Wii U class. At some point, I'll add ATFS disc image reading...

TODO: Adjust the Win32 config dialogs.
2024-11-09 16:58:31 -05:00
David Korth
ba1c61770a [libromdata] WiiUPackage: Add suppor for external images.
Get the game ID from the product code in meta.xml. This can be used to
retrieve images from GameTDB, similar to WiiU.
2024-11-09 16:57:51 -05:00
David Korth
522c8f89ae [libromdata] WiiUPackagePrivate::addFields_System_XMLs(): Uncomment return -EIO; when all root nodes are missing.
Was temporarily disabled for debugging purposes in
commit 4de3e72d6a.

([libromdata] WiiUPackagePrivate::addFields_System_XMLs(): Allow processing even if one or two XMLs are missing.)
2024-11-09 16:42:41 -05:00
David Korth
e2d42eca3e [libromdata] PSP: PIC0.PNG is now presented as the "Banner" image. 2024-11-09 16:30:35 -05:00
David Korth
4ef95fe710 [gtk4] NautilusPlugin.cpp: Rearrange functions to match the GTK3 version.
The rearrangement was done to allow us to obtain caja/nemo-specific
function pointers. It also allows us to get rid of REGISTER_ACHDBUS().

Fixes a clang-tidy warning:

src/gtk/gtk4/NautilusPlugin.cpp:57:11: warning: function-like macro 'REGISTER_ACHDBUS' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage]
   57 | #  define REGISTER_ACHDBUS() AchGDBus::instance()
      |           ^
2024-11-09 15:36:08 -05:00
David Korth
4797dff838 [gtk3] NautilusPlugin.cpp: Get rid of REGISTER_ACHDBUS().
It's not needed now that a regular function is used for plugin
initialization. Instead, use the same pattern as ThunarPlugin.cpp.

Fixes a clang-tidy warning:

src/gtk/gtk3/NautilusPlugin.cpp:55:11: warning: function-like macro 'REGISTER_ACHDBUS' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage]
   55 | #  define REGISTER_ACHDBUS() AchGDBus::instance()
      |           ^
2024-11-09 15:33:17 -05:00
David Korth
ebe78a04b7 [kde] DosAttrView: Use Qt5 signal/slot syntax on Qt5 and later.
This actually causes a slight code size increase:

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

   text    data     bss     dec     hex filename
   5237       8       0    5245    147d [kf5] DosAttrView.cpp.o [before]
   5523       8       0    5531    159b [kf5] DosAttrView.cpp.o [before]
   +286       0       0    +286    +11e Difference

   text    data     bss     dec     hex filename
   5150      24       0    5174    1436 [kf6] DosAttrView.cpp.o [before]
   6010      24       0    6034    1792 [kf6] DosAttrView.cpp.o [after]
   +860       0       0    +860    +35c Difference

Still less than before converting the macro-like functions to inline
functions, though...
2024-11-09 15:26:26 -05:00
David Korth
4f2ef9465a [kde] DosAttrView: Convert the macro-like functions into inline functions.
This actually *reduces* the code size a bit:

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

   text    data     bss     dec     hex filename
   6863       8       0    6871    1ad7 [kf5] DosAttrView.cpp.o [before]
   5237       8       0    5245    147d [kf5] DosAttrView.cpp.o [after]
  -1626       0       0   -1626    -65a Difference

   text    data     bss     dec     hex filename
   6791      24       0    6815    1a9f [kf6] DosAttrView.cpp.o [before]
   5150      24       0    5174    1436 [kf6] DosAttrView.cpp.o [after]
  -1641       0       0   -1641    -669 Difference

Fixes two clang-tidy warnings:

DosAttrView.cpp:47:9: warning: function-like macro 'UPDATE_CHECKBOX' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage]
   47 | #define UPDATE_CHECKBOX(attr, obj) \
      |         ^
DosAttrView.cpp:71:9: warning: function-like macro 'CONNECT_CHECKBOX_SIGNAL' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage]
   71 | #define CONNECT_CHECKBOX_SIGNAL(obj) \
      |         ^
2024-11-09 15:25:48 -05:00
David Korth
a1bf18c397 [libromdata] DreamcastSave: Convert CHECK_FIELD() into a regular function, checkField().
This *does* cause a code size change:

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

   text    data     bss     dec     hex filename
  20155     496       0   20651    50ab DreamcastSave.cpp.o [before]
  20291     496       0   20787    5133 DreamcastSave.cpp.o [after]
   +136       0       0    +136     +88 Difference

It also fixes a clang-tidy warning:

src/libromdata/Console/DreamcastSave.cpp:291:9: warning: function-like macro 'CHECK_FIELD' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage]
  291 | #define CHECK_FIELD(field) \
      |         ^
2024-11-09 15:12:00 -05:00
David Korth
e4ca9029ac [libromdata] GameCubeSave, N64: Use inline functions instead of macro-like functions.
No code size difference.

Fixes a few clang-tidy warnings:

src/libromdata/Console/GameCubeSave.cpp:265:9: warning: function-like macro 'PDP_SWAP' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage]
  265 | #define PDP_SWAP(dest, src) \
      |         ^

src/libromdata/Console/N64.cpp:143:12: warning: function-like macro 'UNSWAP2' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage]
  143 |                         #define UNSWAP2(x) (uint32_t)(((x) >> 16) | ((x) << 16))
      |                                 ^
2024-11-09 15:05:06 -05:00
David Korth
9d1a0ee8cd NEWS.md: Mention the StartAllBack dark mode fix in v2.3.
Fixes #399: ROM Properties page displays incorrectly with StartAllBack installed
Reported by @kristibektashi.
2024-11-02 11:22:18 -04:00
David Korth
0685ae69fc A few more ranged for loop conversions. 2024-11-02 11:20:12 -04:00
David Korth
ed188669c5 [kde] stub-export.cpp: Fix two KDE4 issues.
- KLocalizedString, not KLocalizeString.

- KAboutData::setApplicationData() isn't available in KDE4.
  (TODO: Figure out how to do it?)
2024-11-02 00:04:38 -04:00
David Korth
93692e3369 [win32] RP_ShellPropSheetExt.cpp: Really revert the ranged for change.
Need to add pFields_cend to where it's reverted, since the first loop
was *not* reverted.

This fixes a regression from commit 2d51365fc5.
([librpbase] RomFields, RomMetaData: Add begin()/end() aliases that return const_iterator.)
2024-11-02 00:02:27 -04:00
David Korth
52ca8c2cf9 [librpbase/tests] CBCReaderTest: Specify 8U, not 8.
Fixes a clang warning in KDevelop:

Comparison of integers of different signs: 'const int' and
'const unsigned long' [-Wsign-compare]
2024-11-02 00:00:54 -04:00
David Korth
d164e8b9b5 [win32] RP_ShellPropSheetExt_Private::initDialog(): Revert the ranged for loop change for RomFields.
It has the same issue as the GTK version, requiring an iterator to
determine if it's at the end of the tab or not.

There's also iter_desc, which could have worked, but I accidentally
deleted the iter_desc definition.

TODO: Fix this.

This fixes a regression from commit 2d51365fc5.
([librpbase] RomFields, RomMetaData: Add begin()/end() aliases that return const_iterator.)
2024-11-01 22:33:24 -04:00
David Korth
e67ea9f4a2 [librpbase/tests] CBCReaderTest: Don't #ifdef within INSTANTIATE_TEST_SUITE_P().
It works fine on gcc/clang, but MSVC is failing:

src\librpbase\tests\CBCReaderTest.cpp(379): error C2121: '#': invalid character: possibly the result of a macro expansion
src\librpbase\tests\CBCReaderTest.cpp(379): error C2146: syntax error: missing ')' before identifier 'ifdef'
src\librpbase\tests\CBCReaderTest.cpp(379): error C2838: 'ECB': illegal qualified name in member declaration
src\librpbase\tests\CBCReaderTest.cpp(379): error C2838: 'CBC': illegal qualified name in member declaration
src\librpbase\tests\CBCReaderTest.cpp(379): error C3536: 't': cannot be used before it is initialized
src\librpbase\tests\CBCReaderTest.cpp(379): error C3539: a template-argument cannot be a type that contains 'auto'
src\librpbase\tests\CBCReaderTest.cpp(379): error C2027: use of undefined type 'std::tuple_size<int>'
  src\librpbase\tests\CBCReaderTest.cpp(371): note: see declaration of 'std::tuple_size<int>'
src\librpbase\tests\CBCReaderTest.cpp(379): error C2065: 'value': undeclared identifier
2024-11-01 22:15:32 -04:00
David Korth
d581516d97 [librpbase/tests] CBCReaderTest: Disable ECB/CBC checks in NoCrypto builds.
This should *really* fix the AppVeyor build.
2024-11-01 21:55:57 -04:00