Commit Graph

12927 Commits

Author SHA1 Message Date
David Korth
981c173142 [libromdata] CisoPspDlopen.hpp: Need to typedef int pthread_once_t on Windows.
Some checks failed
Codecov / run (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
Normally this would be in pthread_once.h, but we're not using the
standard version due to calling a class member function.
2025-06-04 13:33:21 -04:00
David Korth
df719e959a [libromdata] CisoPspDlopen.hpp: Fix build warnings and errors in no-LZ4/no-LZO builds.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
NOTE: Disabling LZ4 and LZO entirely prevents the libraries from
being loaded at all. This currently results in CISOv2 images that
partially load, but fail when an LZ4-compressed block is encountered.
2025-06-04 10:48:41 -04:00
David Korth
3af7964b0c [librpthreads] pthread_once.c: Use sched_yield() for consistency.
Windows doesn't have either function. Instead, we end up calling
SwitchToThread().
2025-06-04 10:34:52 -04:00
David Korth
723712102a [libromdata] CisoPspDlopen: Use an implementation of pthread_once() to initialize the libraries.
We can't use standard pthread_once() here due to the use of member
functions. Instead, we're using a macro that simulates it, based on
the Windows version in pthread_once.c.

NOTE: Still using the standard pthread_once_t type, which is `long`
on Linux systems.

[librpthreads] CMakeLists.txt: Check for sched_yield().
pthread_yield() is deprecated as of glibc-2.34.

If sched_yield() isn't found, define it as pthread_yield().
2025-06-04 10:31:51 -04:00
David Korth
3416f16ad2 [libromdata] CisoPspDlopen: Remove some debugging printf()'s. 2025-06-04 10:13:46 -04:00
David Korth
3db391e8c1 [libromdata] CisoPspReader: Make the CisoPspDlopen object static.
This will make it so only one initialization is needed if using a single
libromdata.so load to read multiple PSP images.

NOTE: CisoPspDlopen isn't thread-safe at this point. Need to use
pthread_once() for initialization.
2025-06-04 10:12:37 -04:00
David Korth
4ab931b127 [libromdata] CMakeLists.txt: Bump the SOVERSION to 6.2.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
It's ABI-compatible with 6.0 and 6.1 (using only .so.6, not .so.6.2),
but there have been changes since the previous release.
2025-06-03 22:54:55 -04:00
David Korth
e1ef6e6d2f [libromdata] CisoPspDlopen: Split the dlopen() code from CisoPspreader into a separate class. 2025-06-03 22:54:42 -04:00
David Korth
e9625cb876 [libromdata] CisoPspReaderPrivate::init_pfn_LZO(): LZO, not LZ4. 2025-06-03 22:53:19 -04:00
David Korth
79c3a2e34d [libromdata] dlopen-notes.c: Add liblz4.so.1 and liblzo2.so.2 to the dlopen() notes section.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
2025-06-02 22:52:13 -04:00
David Korth
8650f2b1c2 [debian] control: Add liblz4-1 and liblzo2-2 as explicit dependencies to libromdata6.
These are now dlopen()'d, so ${shlibs:Depends} won't detect them.

NOTE: Newer versions of Debian tools might detect them if we add
dlopen() notes.
2025-06-02 22:43:12 -04:00
David Korth
e2f4ddde72 [libromdata] CisoPspReader: Dynamically load the LZO library using dlopen().
TODO: Keep the dlopen()'d libraries around for multiple uses?
May need to create a helper class...
2025-06-02 20:29:35 -04:00
David Korth
88a9a603ce [libromdata] CisoPspReader::CisoPspReader(): Missed a HAVE_LZ4. 2025-06-02 19:57:11 -04:00
David Korth
60b18c408f [libromdata] CisoPspReader: Dynamically load the LZ4 library using dlopen().
LZ4 is only used by CisoPspReader, so there's no need to load it on
startup on Linux systems. Instead, use dlopen().

Remove the various `#ifdef HAVE_LZ4` checks.

TODO: Show a warning if the image requires LZ4 but we don't have it.
For now, it just says the image couldn't be opened.

On Windows, we're switching from DelayLoad to LoadLibrary() for
consistency.

[libwin32common] DelayLoadHelper.h: Export rp_LoadLibrary().
This is used by CisoPspReader to load lz4.dll.

The exported version does not do a DLL whitelist check, whereas
the version used by the MSVC exception handler does.
2025-06-02 19:42:16 -04:00
David Korth
ed799a1cc2 [rp-download] rp-download.cpp: recvmmsg() is needed by cURL 8.13 for QUIC (HTTP/3).
Noticed this on my local system after updating from cURL 8.12 to 8.13:

$ /usr/libexec/rp-download -v sys/version.txt
URL: https://rpdb.gerbilsoft.com/sys/version.txt
Cache Filename: /home/user/.cache/rom-properties/sys/version.txt
Cache file for 'sys/version.txt' is already downloaded, but this cache key is set to download-if-newer.
SYSCALL TRAP: [amd64] recvmmsg()
Segmentation fault
2025-06-02 19:40:56 -04:00
David Korth
407fb36461 [libpng] Disable /guard:cf in MSVC builds for now.
Some checks failed
Codecov / run (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
This is what was causing the libpng crash in png_longjmp() on
Windows 10 in MSVC 2022 release builds.

See #451: libpng errors crash due to libpng setjmp/longjmp (Windows 10, release builds only)
Reported by @Masamune3210.
2025-05-26 11:11:51 -04:00
David Korth
55fac18b76 [librptext/tests] TextFuncsTest: Add fourCC tests.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
For both the char* version and the std::string version.

Code coverage change:

Before:
  source files: 607
  lines.......: 24.1% (11442 of 47453 lines)
  functions...: 24.0% (910 of 3786 functions)
  branches....: 17.0% (8352 of 49177 branches)

After:
  source files: 607
  lines.......: 24.1% (11450 of 47453 lines)
  functions...: 24.1% (911 of 3786 functions)
  branches....: 17.0% (8353 of 49177 branches)
2025-05-25 16:08:03 -04:00
David Korth
440bb7aeb5 Increase minimum CMake versions to "3.5...3.10".
CMake 4.0 drops compatibility with versions older than 3.5, and warns
that compatibility with < 3.10 will be dropped in a "future version".

CMake 3.30 previously warned about dropping support for older than
3.5, which was changed in 3.31 to older than 3.10.
2025-05-25 15:39:40 -04:00
David Korth
c0c8b2582c CMakeLists.txt: Enable policy CMP0177 if it's available.
This fixes a bunch of warnings similar to the following:

CMake Warning (dev) at src/kde/kf5/CMakeLists.txt:370 (INSTALL):
  Policy CMP0177 is not set: install() DESTINATION paths are normalized.  Run
  "cmake --help-policy CMP0177" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.
2025-05-25 15:29:54 -04:00
David Korth
7e51a47609 [libromdata] NES: Some FDS images have Heisei era years, starting at 01.
Assume anything <=57 is Heisei, and >=58 (1983) is Shōwa.

NOTE: The FDS was released in 1986, but we'll allow for 1983 just in case
there was an FDS game in development in 1985. (Maybe the lower bound
should be 1985 instead...)
2025-05-25 15:26:01 -04:00
David Korth
b72bd8a436 [extlib] Skip installation of binaries for minizip-ng.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
FIXME: The minigzip and minizip binaries are automatically built,
even though we use SET_EXTLIB_PROPERTIES(), which should exclude
them from ALL builds...
2025-05-25 00:35:04 -04:00
David Korth
7d6c7064d2 [libromdata] Xbox360_STFS_Private::getTitle(): Remove mojibake_chars.
I was originally going to use a lookup table, but decided to use
switch/case instead. I never removed the lookup table, though...
2025-05-24 15:13:05 -04:00
David Korth
065c86149a NEWS.md: Update the Xbox360_STFS mojibake description.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
2025-05-24 15:08:28 -04:00
David Korth
32ac318236 [libromdata] Xbox360_STFS_Private::getTitle(): It's all UTF-8.
The Shift-JIS thing was incorrect, even with the U+0081 code point.
It's all UTF-8 that was incorrectly converted from cp1252 to UTF-16BE.

Also, remove a redundant string conversion that I was using earlier for
debugging purposes and is no longer needed.
2025-05-24 15:06:47 -04:00
David Korth
5de651dbbe [libromdata] Xbox360_STFS: Fix titles for some packages that were authored incorrectly and have mojibake titles.
Two types of mojibake are detected and fixed:
- UTF-8 parsed as cp1252
- Shift-JIS parsed as cp1252

For the latter case, utf16_to_cp1252() on Linux (and other systems that
use iconv) has been modified to handle five code points that iconv()
doesn't support: 0x81, 0x8D, 0x8F, 0x90, 0x9D.

TODO: Also do this for utf8_to_cp1252() and other cp1252 functions?

On Windows, WideCharToMultiByte() and MultiByteToWideChar() handle these
code points without any issues.

These three title updates now show a correct title:

TU_11LK1UV_0000004000000.0000000000081 (UTF-8 as cp1252)
Name:  'Dodonpachi Daifukkatsu Black Label Title Update #1'
Title: '怒首領蜂 大復活 Black Label'

TU_12501VG_0000004000000.0000000000101 (UTF-8 as cp1252)
Name:  'DREAM C CLUB Title Update #4'
Title: 'ドリームクラブ'

TU_15LG1UH_000000C000000.0000000000083 (Shift-JIS as cp1252)
Name:  'Circle of Students Title Update #1'
Title: '円卓の生徒'

Fixes #450: X360 - Non-Latin Titles appearing as mojibake
Reported by @Masamune3210.
2025-05-24 15:02:21 -04:00
David Korth
34f76050cb [librpbase] RpPng: Work around a potential libpng crash when attempting to read empty data as a PNG image.
Check the magic number before initializing libpng.

It seems there's something wrong with MSVC 2022 (17.6.5) that causes a
release build of libpng to crash when calling longjmp() on Windows 10.

If this is in fact a compiler bug, and upgrading the compiler fixes it,
then I'll need to switch away from my Windows 7 VM because MSVC 17.6 is
the last version to support Windows 7 as a build environment.

See #451: libpng errors crash due to libpng setjmp/longjmp (Windows 10, release builds only)
Reported by @Masamune3210.
2025-05-24 13:53:47 -04:00
David Korth
223cee6c9c [librpbase/tests, libromdata/tests] Hexdumps: Add an extra space after the offset. 2025-05-22 23:49:10 -04:00
David Korth
fc44e1da01 [librptext] formatFileSize(): TODO: Have the UI frontend set the "default" dialect, e.g. using kdeglobals on KDE.
For now, defaulting to IEC. (Same as before, but now more explicit.)
2025-05-22 18:29:28 -04:00
David Korth
7c96eb5381 [libgsvt] gsvt_win32.c: Fix vt->bold initialization.
Some checks failed
Codecov / run (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
2025-05-20 21:34:40 -04:00
David Korth
54a7b12523 [libgsvt] gsvt_win32_console_print_ANSI_emulate(): xterm supports BEL (\007) in addition to ST for ending an OSC sequence.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
2025-05-17 14:42:04 -04:00
David Korth
443df8a7ab [libgsvt] gsvt_init_win32(): Set bold if the initial attributes have FOREGROUND_INTENSITY set. 2025-05-17 14:39:42 -04:00
David Korth
86638f478c [xdg] rom-properties.xml: Add GameCube/Wii executables (.dol).
.dol files aren't currently supported by rom-properties. shared-mime-info
is misidentifying them as image/vnd.microsoft.icon, which is clearly
wrong, so add this to fix the identification.
2025-05-17 14:36:18 -04:00
David Korth
55cb219a17 [rp-download] Set an "Accept:" header for the expected MIME type.
Some checks failed
Codecov / run (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
Expected MIME types:
- .png: image/png
- .jpg: image/jpeg
- .txt: text/plain

Not sure if this will make any real difference, but we might as well
set it anyway.
2025-05-17 13:17:45 -04:00
David Korth
05f08c2d32 [librpbyteswap] byteswap_rp.h: Can't mark __swabf() as constexpr on MSVC.
__swab32(), aka _byteswap_ulong(), is *still* not constexpr on MSVC.
2025-05-17 13:02:38 -04:00
David Korth
8e841026e9 [minizip-ng] CMakeLists.txt: Don't check for ZLIB/ZLIBNG.
zlib is already checked earlier. On my system, since I have zlib-ng
installed system-wide, this check picks it up, and causes libromdata.so.6
to be linked to libz-ng.so.2.

Disabling the check removes that linkage.

NOTE: The Ubuntu packages for 2.5 and 2.5.1 are *not* linked to zlib-ng,
since Ubuntu doesn't have zlib-ng included by default.

Also, update _MODIFIED_MINIZIP.txt for 4.0.10. (Forgot to do this when
updating from 4.0.9 to 4.0.10.)
2025-05-13 22:47:38 -04:00
David Korth
46c83d92c1 Rework CONSTEXPR_IF_MSVC2022 into CONSTEXPR_MULTILINE and CONSTEXPR_MULTILINE_NO_MSVC.
Some checks failed
Codecov / run (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
gcc-4.9 on Debian 8 doesn't support multi-line constexpr functions.

CONSTEXPR_MULTILINE enables constexpr for MSVC 2022 and gcc-5,
and later versions.

CONSTEXPR_MULTILINE_NO_MSVC enables constexpr for gcc-5 and later,
but not MSVC. Needed for functions that use intrinsics, which
(still) aren't marked as constexpr on MSVC.
2025-05-12 21:34:55 -04:00
David Korth
44eba93a3e Remove some old FIXMEs and TODOs.
Some checks failed
Codecov / run (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
2025-05-11 12:35:38 -04:00
David Korth
ade40a4965 [libromdata] IntellivisionPrivate::getTitle(): Handle characters 0x3E and 0x3F correctly.
These correspond to U+2191 UPWARDS ARROW and U+2190 LEFTWARDS ARROW,
respectively.
2025-05-11 11:46:03 -04:00
David Korth
0f2eccd3ac [librptexture] ImageSizeCalc.hpp, validateBlockSizeASTC(): Rework into a single-line constexpr() function.
Remove the assertions, since they aren't very useful. They'd only assert
if the file is corrupted.

TODO: Validate combinations?
2025-05-11 11:21:24 -04:00
David Korth
99942e6a04 rp-libfmt.h: Add a to_tstring() macro.
NOTE: `using` statements within `namespace fmt` didn't work:
src\rp-libfmt.h(48,21): error C2061: syntax error: identifier 'to_wstring'

[win32] RomDataFormat.cpp, ImageTypesTab.cpp: Use fmt::to_tstring().
2025-05-11 11:11:10 -04:00
David Korth
1912c62551 [libromdata/tests] GcnFstPrint, WiiUFstPrint: Add colorization for error and warning messages. 2025-05-11 11:04:32 -04:00
David Korth
43a7bd4a49 [libromdata/tests] GcnFstPrint, WiiUFstPrint: Use libgsvt.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
The Unicode text printing on Windows via _fputts() was causing the
console output to lock up on Windows 7. Switching to libgsvt fixes it.

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

   text    data     bss     dec     hex filename
  16247    1032      48   17327    43af GcnFstPrint [before]
  19006    1160      80   20246    4f16 GcnFstPrint [after]
  +2759    +128     +32   +2919    +b67 Difference

   text    data     bss     dec     hex filename
  15417    1016      48   16481    4061 WiiUFstPrint [before]
  18210    1144      80   19434    4bea WiiUFstPrint [after]
  +2793    +128     +32   +2953    +b89 Difference
2025-05-11 04:13:24 -04:00
David Korth
665a9f878c [locale] fr.po: Translate Ext2AttrView's placeholders by adding a space before the colon. 2025-05-11 03:47:23 -04:00
David Korth
94470e319a [kde] Use QC_() for translation, not QObjectDerivedClass::tr().
The xgettext call in locale/CMakeLists.txt doesn't detect
QObjectDerivedClass::tr(). Because of this, we ended up missing
a few strings for translation.

[locale] Update with the missed strings.
2025-05-11 03:46:48 -04:00
David Korth
9a5550f1f5 [locale] Update rom-properties.pot and *.po.
Forgot to do this for the v2.5.1 release...
2025-05-11 03:39:18 -04:00
David Korth
f13bde810f [librptexture] ImageDecoder::fromLinear32_ssse3(): Missed a 16-byte stride alignment check.
xtexconv includes a sample DDS that has stride == 15,076. Without this
check, rpcli crashes due to the use of movdqa on an unaligned pointer.

Reference: https://learn.microsoft.com/en-us/samples/microsoft/xbox-gdk-samples/xtexconv/
2025-05-11 03:20:44 -04:00
David Korth
f6d9394da8 [libgsvt] gsvt_win32.c, gsvt_win32_console_print_ANSI_emulate(): RESET command should update bold.
`bold` should be set to true if wAttributes has FOREGROUND_INTENSITY.
2025-05-11 02:36:16 -04:00
David Korth
a83c05459d [libgsvt] gsvt_win32.c: Get rid of an unnecessary #ifdef _WIN32. 2025-05-11 02:33:59 -04:00
David Korth
18b7ec55d3 [libgsvt] gsvtpp.cpp: Remove the struct _gsvt_console definition.
I added this here for testing purposes in order to verify that the
consoles were initialized properly. It isn't needed here anymore.
2025-05-11 01:22:49 -04:00
David Korth
53648f1ffa Merge branch 'feature/libgsvt' 2025-05-11 01:18:23 -04:00