Commit Graph

12419 Commits

Author SHA1 Message Date
David Korth
d87aa0dbde appveyor.cmd, appveyor.sh: Add ENABLE_ASTC to OPTEN.
Also ENABLE_OPENMP in appveyor.cmd.

Note that it doesn't actually do anything right now, since we're not
doing OFF/ON builds in AppVeyor anymore due to taking too long and
timing out after 1hr.
2025-03-29 22:38:25 -04:00
David Korth
af03225e3d [librptexture] ASTC, GodotSTEX: Fix build with ASTC decoding disabled.
Note that the ASTC container parser is still available even if ASTC
decoding is disabled, since it can at least get metadata, e.g. the
image dimensions.
2025-03-29 22:37:47 -04:00
David Korth
bafc14e792 NEWS.md: Move the rpcli text colorization note to "Other changes". 2025-03-29 22:29:04 -04:00
David Korth
5e859695d6 NEWS.md: Mention the RPF fix. 2025-03-29 21:09:35 -04:00
David Korth
d9c5742798 Revert "[libromdata] DpfReader: Use a ranged for loop to adjust virtual addresses instead of iterators."
This broke reading RPFs because the range-based `for` loop did not skip
the first entry. The original iterator version *did* skip the first entry.

This reverts commit d1b8a1e99e.

Affects: v2.4 - v2.4.1
2025-03-29 21:06:50 -04:00
David Korth
ad1962ccb9 Merge branch 'feature/arm-neon-optimizations' 2025-03-29 18:42:30 -04:00
David Korth
7d5dd140fa [librpbyteswap] byteswap_neon.c: Use uint8x8_t on 32-bit ARM.
It seems 32-bit ARM NEON doesn't have 128-bit vtbl instructions.

TODO: Figure out if this is in fact the case, and it's not just
MSVC rejecting the intrinsics for 32-bit ARM.

TODO: Actually test the 32-bit ARM version.

TODO: uint8x8x4_t for 32-bit, and uint8x16x2_t for 64-bit?
2025-03-29 18:40:25 -04:00
David Korth
1636b033c0 [librpbyteswap] CMakeLists.txt: Enable byteswap_neon.c on ARM in addition to ARM64. 2025-03-29 18:21:41 -04:00
David Korth
79b9a1dd91 [librpbyteswap/tests] ByteswapTest.cpp: Call RP_CPU_arm_HasNEON() on ARM to determine if the CPU supports NEON. 2025-03-29 17:49:00 -04:00
David Korth
7f1286a9a8 NEWS.md: Mention NEON-optimized byteswap functions. 2025-03-29 17:48:15 -04:00
David Korth
9b3c7a2e95 [librpcpuid] cpuflags_arm.c: Add a Linux check for ARM NEON using getauxval(AT_HWCAP).
FIXME: Might not be correct (or available) on Android. Needs testing!
2025-03-29 17:46:31 -04:00
David Korth
e1f8fd1fbd [librpcpuid] cpuflags_x86.c: Minor comment change. 2025-03-29 17:36:34 -04:00
David Korth
855edb5179 [librpcpuid] cpuflags_arm.c: New CPU flags implementation for ARM.
There's currently only one flag defined:

RP_CPUFLAG_ARM_NEON == CPU supports NEON

RP_CPU_Flags_arm_Init() currently initializes RP_CPU_Flags_arm to
RP_CPUFLAG_ARM_NEON on arm64 and 0 on arm.

...except on Windows, which *requires* NEON on ARM.

TODO: OS-specific NEON detection for 32-bit Linux and others.
2025-03-29 17:24:21 -04:00
David Korth
9b117c4577 fixup! [librpcpuid] cpuflags_x86: Rename stuff to indicate that it's all x86-specific.
[librpcpuid] cpuflags_x86.c: One more "RP_CPU_Flags" -> "RP_CPU_Flags_x86" change.
2025-03-29 17:17:33 -04:00
David Korth
77b08146f6 [librpcpuid] cpuflags_x86.h: Protect most of the file with the #if defined(RP_CPU_I386) || defined(RP_CPU_AMD64) check.
Nothing in this file is useful on non-x86 CPUs.

It may have made sense to only protect the flag definitions if the file
would be used for more than just x86, but we're better off using separate
files for different CPU architectures.
2025-03-29 17:14:15 -04:00
David Korth
84c811f137 [librpcpuid] cpuflags_x86.h: Minor formatting fix. 2025-03-29 17:11:05 -04:00
David Korth
f7ee278264 [librptexture/tests] ImageDecoderLinearTest.cpp: Don't skip GTEST_SKIP() if --gtest_brief=1 is specified. 2025-03-29 17:10:18 -04:00
David Korth
3b1eea198f [libromdata/tests] SuperMagicDriveTest.cpp: Use GTEST_SKIP() when skipping tests.
NOTE: Don't skip the GTEST_SKIP() if GTEST_FLAG_GET(brief) is set.
GTEST_SKIP() will print a "Skipped" message, which can be annoying,
but the test will be marked as PASSED instead of SKIPPED if we don't
skip it.
2025-03-29 17:08:30 -04:00
David Korth
79ddbb87c5 [librpcpuid] cpuflags_x86: Rename stuff to indicate that it's all x86-specific.
TEST_P(ImageDecoderLinearTest, fromLinear_ssse3_benchmark):
- Fix a typo: SSE2 -> SSSE3
2025-03-29 17:06:36 -04:00
David Korth
a3428ad0ab [librpbyteswap] byteswap_rp.h: Add NEON checks to the dispatch functions.
TODO:
- Implement RP_CPU_ARM_HasNEON() for 32-bit ARMv7.
- Rename the x86 functions to RP_CPU_x86_*().
2025-03-29 16:52:31 -04:00
David Korth
fba1f4a894 [librpbyteswap/tests] ByteswapTest: Enable dispatch function testing if NEON is available.
Note that the dispatch functions don't support NEON yet.
2025-03-29 16:48:19 -04:00
David Korth
2ccba6205b Remove IFUNC support.
It's only supported by glibc on Linux (and possibly some of the BSDs),
and it adds a lot of complexity. The regular C dispatch functions only
have a few instructions of overhead in most cases.

Adding ARM NEON would have complicated things:
- 32-bit ARMv7: Needs a check on Linux and Android; on Windows, it's
  guaranteed to be present.
- 64-bit ARMv8: Always exists.
2025-03-29 16:46:51 -04:00
David Korth
04669be863 [librpbyteswap/tests] ByteswapTest: Move the "c", "sse2", etc. for unDWORD/unQWORD before unDWORD/unQWORD.
This matches the unalignX tests and makes it easier to read the
test results.
2025-03-29 16:29:48 -04:00
David Korth
8aa861321e [librpbyteswap] byteswap_neon.c: Initial ARM NEON byteswapping functions.
For ARM64 only at the moment.

Tested on my Pixel 8 Pro:
Android 15, arm64, clang-19.1.7, release build, no LTO

   16-bit C unalign0: 61ms
16-bit NEON unalign0: 21ms

    16-bit C unDWORD: 48ms
 16-bit NEON unDWORD: 21ms

   32-bit C unalign0: 27ms
32-bit NEON unalign0: 20ms

    32-bit C unQWORD: 27ms
 32-bit NEON unQWORD: 23ms

   16-bit C unalign2: 44ms
16-bit NEON unalign2: 21ms

   32-bit C unalign4: 27ms
32-bit NEON unalign4: 23ms

NOTE: The 32-bit C unalign4 test was disabled for some reason.
I re-enabled it now.

TODO:
- Add the ARM NEON functions to the dispatch functions.
- Add support for 32-bit ARMv7. (Requires runtime deteciton!)
- Test the MSVC build.
2025-03-29 16:27:50 -04:00
David Korth
02575057ac [librptext] formatting.cpp: Restore #include <iomanip>.
Didn't cause problem on Gentoo Linux, but did break on Android and MSVC.
2025-03-29 14:04:13 -04:00
David Korth
8a001cc8ae [librpfile] VectorFile: Move VECTOR_FILE_MAX_SIZE to the class declaration and rename it to MAX_SIZE. 2025-03-29 13:35:50 -04:00
David Korth
e31b6fcac9 [libwin32common] sdk/commctrl_ts.h: Converted some more ListView_*() macros to static inline functions. 2025-03-29 13:05:10 -04:00
David Korth
d5e2b8266f [minizip-ng] Cherry-pick a slight memory optimization for 64-bit systems.
Slightly reduces struct size by getting rid of padding.

Not including the mz_crypt_openssl.c change because it doesn't apply here.
2025-03-29 12:21:23 -04:00
David Korth
7f3bda3238 [zlib-ng] CMakeLists.txt: Also don't print the list of architecture-specific source files.
There's a lot of them on amd64.
2025-03-29 12:16:54 -04:00
David Korth
b1676ede31 [zlib-ng] CMakeLists.txt: Add a dummy add_feature_info() function.
TODO: Use FeatureSummary for the main project?
2025-03-29 12:15:53 -04:00
David Korth
c3e2b1985b [zlib-ng] CMakeLists.txt: Disable the automatic feature summary function.
zlib-ng isn't the main package here, so the feature summary isn't useful.
2025-03-29 12:13:50 -04:00
David Korth
ee7a65253f [libromdata] WiiUPackage::init(): No need to access ticket through d-> at this point. 2025-03-29 12:09:08 -04:00
David Korth
6f558e4d16 [libwin32common] MiniU82T: Made the W2U8(const std::wstring&) version a wrapper around W2U8(const wchar_t*).
Added a length parameter, with -1 indicating C string.

Add checks to remove the trailing NULL byte when using C strings.

A2U8(): Added an std::string wrapper and the length parameter.
2025-03-29 11:55:17 -04:00
David Korth
d35a05f055 [libwin32common] MiniU82T: Pass std::wstring by const ref. 2025-03-29 11:46:49 -04:00
David Korth
0ad42ef54a [libwin32common] MiniU82T.hpp: Use macros for the ANSI U82T_?() functions for consistency. 2025-03-29 11:45:52 -04:00
David Korth
e5128ce9ae [libwin32common] MiniU82T: tcharx.h and tstring aren't actually needed here.
[librpfile] RpFile_win32.cpp: #include "tcharx.h"
[librpfile] RpFile_scsi_win32.cpp: Add tcharx.h comment.
2025-03-29 00:39:10 -04:00
David Korth
0a76ce63e4 [libwin32common] MiniU82T.hpp: Missing U82T_s() in ANSI mode. 2025-03-29 00:36:49 -04:00
David Korth
5b1a93a47d [libwin32common] MiniU82T: Make it a regular .cpp file.
The namespacing should prevent conflicts with librptext.
2025-03-29 00:30:19 -04:00
David Korth
160918d2e2 [libwin32common] MiniU82T.hpp: New header file with Mini-U82T.
[librpfile] Use MiniU82T.hpp instead of ad-hoc Mini-U82T implementations.
2025-03-29 00:29:29 -04:00
David Korth
85c71bfb98 [libromdata] stdafx.h: #include "librptext/formatting.hpp"
Forgot to commit this in commit e4ea8ee7b1.
([librptext] Split functions that require fmt and libi18n into formatting.cpp.)
2025-03-29 00:18:00 -04:00
David Korth
6072e7bca4 [librpfile] CMakeLists.txt: RpFile_win32.cpp still needs conversion.hpp for now. 2025-03-29 00:15:18 -04:00
David Korth
7eb353fa71 [librpfile] XAttrReader_win32.cpp: Add our own Mini-U82T() here.
Can't use librpfile because it causes rp-download to pull in
fmt-11.dll.

With this fix, rp-download no longer depends on fmt-11.dll.

TODO: Make a common "Mini U82T" header for anything that needs
these functions.
2025-03-29 00:07:46 -04:00
David Korth
eaa14eb875 [libcachecommon] Revert the fmt::format() changes.
This gets rid of rp-download's libfmt.so dependency on Linux, though
the Windows build is still pulling in fmt-11.dll for some reason.

Note that only a single fmt::format() invocation was used...

This effectively reverts commit dab0cc4c08.
([libcachecommon] Use libfmt instead of printf()-style functions.)

..except for the fprintf() to fputs() change in FilterCacheKeyTest.cpp,
which was kept.
2025-03-28 23:39:32 -04:00
David Korth
e4ea8ee7b1 [librptext] Split functions that require fmt and libi18n into formatting.cpp.
Added a new static library rptext-noi18n that lacks formatting.cpp.

[rp-download] Link to rptext-noi18n on Windows.

This gets rid of the libgnuintl-8.dll dependency, but something is still
pulling in fmt-11.dll. Specifically, it's pulling in this function:

fmt::v11::vformat

NOTE: This function is also being pulled in on the Linux build...
2025-03-28 23:32:09 -04:00
David Korth
f6b339bc4b Revert "[rp-download] Convert all printf()-style function usage to use libfmt instead."
Since adding DependentLoadFlags, rp-download no longer runs on Win10 1607+.
rp-download's text output is for debugging only, so just revert all of the
libfmt changes and go back to printf().

rp-download currently has two incorrect DLL dependencies:
- fmt-11.dll
- libgnuintl-8.dll

Not sure why it's depending on libgnuintl-8.dll, since nothing's being
localized here.

fmt-11.dll is still showing up as a dependency, even though rp-download
no longer uses it.

This reverts commit c5017c5fb0.

Conflicts:
	src/rp-download/rp-download.cpp
2025-03-28 23:09:55 -04:00
David Korth
4ef87f28a8 [tracker] rp-tracker.cpp: Handle Property::ReleaseYear and Property::CreationDate.
For Tracker v1, add a date object, which takes a time_t directly.

For Tracker v2 and v3, use the set_gvalue() function with a GValue
that has a GDateTime object added to it.

Tested with a ColecoVision ROM image (ReleaseYear) and a GameCube
save file (CreationDate).

NOTE: GCN save file should probably be "ModificationDate", but that
property isn't present in KDE. Not sure if it's present in Windows
or KDE...
2025-03-27 22:58:27 -04:00
David Korth
5d11ea9626 [rpcli] rpcli.cpp: Use _tcstol() instead of _ttol().
Besides having better error checking, glibc's atol() is simply a
wrapper around strtol() anyway. (Unsure about MSVC, but it's
probably similar.)

Among other things, with _ttol(), "-xJ" would end up being interpreted
as "-x0", since _ttol() returns 0 for an invalid number.

[lcoale] es.po, pt.po: Remove incorrect localizations for this code.
2025-03-27 18:47:59 -04:00
David Korth
fcd46c67fa [libromdata] ELFPrivate::readProgramHeader(): Fix typo that caused p_paddr to be initialized with phdr->p_vaddr.
p_paddr isn't actually used anywhere else right now, which is probably
why this went unnoticed. (It's also not used in many ELFs.)
2025-03-27 18:09:32 -04:00
David Korth
a1676f1794 [rpcli,rptest] Call SetConsoleOutputCP(CP_UTF8) on Windows Vista and later.
This ensures UTF-8 is decoded properly.

Tested on Windows XP (where it doesn't work), Windows 7 (works), and
Windows 10 (works). Not tested on Windows Vista, but I think it
should work there.

NOTE: The console output codepage is persistent, even after the program
exits. An atexit() handler is registered to restore the original console
output codepage.
2025-03-25 21:35:18 -04:00
David Korth
f41fca6a50 [rpcli] vt.cpp: Use std::string_view if it's available.
std::string_view has less overhead than std::string, since it doesn't
have to copy the whole string.

CMakeLists.txt: TODO: Does CHECK_CXX_SOURCE_COMPILES() ignore
CMAKE_CXX_STANDARD? Need to test this on a gcc version that
supports C++17 but not by default.
2025-03-25 20:47:20 -04:00