Commit Graph

516 Commits

Author SHA1 Message Date
David Korth
5e4571f209 Renamed extlib/libfmt/ to extlib/fmt/.
It's called just "fmt" upstream (or "fmtlib").
2025-03-20 22:16:59 -04:00
David Korth
0f076f7392 [tinyxml2] Update: 10.1.0 -> 11.0.0
No actual code changes; just a version bump.

[libwin32common] DelayLoadHelper.cmake: Update for tinyxml-11.dll.
2025-03-16 15:32:01 -04:00
David Korth
d6953b866d [tinyxml2] Update: 10.0.0 -> 10.1.0 2025-03-08 17:35:42 -05:00
David Korth
22348df95b [libfmt] Update: v11.1.3 -> v11.1.4 2025-02-28 23:53:04 -05:00
David Korth
41b84eb333 [libfmt] Install the DLL in Windows builds. 2025-02-25 22:55:55 -05:00
David Korth
120505d880 [libpng] Update: v1.6.46 -> v1.6.47
The APNG patch for v1.6.47 isn't out yet, so I hacked in some changes
to get the APNG code to build in pngrutil.c. In particular, the PNGv3
chromacity changes also modified pngrutil.c to use table-based dispatch
instead of an if/else. png_read_frame_head() doesn't use this yet, so
the APNG functions in pngrutil.c haven't been marked static yet, but
they do now return png_handle_result_code.

TODO: Rebase using the APNG patch once it's rebased for v1.6.47.

NOTE: PNGv3 apparently makes APNG part of the specification, so
libpng "should" gain built-in support for APNG without a patch at
some point.
2025-02-21 03:50:12 -05:00
David Korth
0bf6ffa226 [libfmt] base.h: Upstream workaround for the MSVC 2015 static_assert() compile error. 2025-02-21 01:42:17 -05:00
David Korth
7960595158 [zstd] Update: 1.5.6 -> 1.5.7 2025-02-19 22:07:44 -05:00
David Korth
2edf38d985 [googletest] Don't use the gcc-4.9 workaround if building with clang.
Not sure why this is getting triggered in the clang/arm64 build, since clang
doesn't define __GNUG__...
2025-02-18 18:36:48 -05:00
David Korth
379587b8ca [zlib-ng] CMakeLists.txt: Use -O1 in MinGW debug builds for AVX2 and AVX512.
It's similar to, but not the same as, the issue with MSVC 32-bit debug
builds that was fixed upstream in v2.2.4.

-O0 and -Og both crash; -O1 and higher work fine. The issue appears to be
%rax being 16-byte aligned, but not 32-byte aligned, when calling int
GET_CHUNK_MAG(). -O1 and higher enable inlining, which works around this
issue.
2025-02-18 18:09:03 -05:00
David Korth
ce2c376276 [extlib] zlib-ng: Remove obsolete CMake options.
These no longer apply to zlib-ng.

WITH_UNALIGNED was removed in v2.2.3.
2025-02-18 18:08:22 -05:00
David Korth
fd2751e185 [libfmt] base.h: static_assert(sizeof(data_)) fails on MSVC 2015.
extlib\libfmt\include\fmt\base.h(743): error C2327: 'fmt::v11::basic_specs::data_': is not a type name, static, or enumerator
2025-02-17 20:52:02 -05:00
David Korth
7bd91ef6dc [libfmt] Update: v11.1.2 -> v11.1.3 2025-02-16 14:20:16 -05:00
David Korth
f007daddf8 [zlib-ng] Update: v2.2.3 -> v2.2.4 2025-02-16 11:59:37 -05:00
David Korth
b7f33dc203 [zlib-ng] chunkset_avx(2|512).c: Fix for chunkmemset_16() in MSVC 2015 Debug x86 builds.
Re-enable AVX2 on MSVC 2015.

References:
- https://github.com/zlib-ng/zlib-ng/issues/1861
- https://github.com/zlib-ng/zlib-ng/pull/1862
2025-02-02 22:53:41 -05:00
David Korth
8a69aecabd [extlib] CMakeLists.txt: Disable AVX2 and AVX512 for zlib-ng if using MSVC 2015 or earlier.
Reference: https://github.com/zlib-ng/zlib-ng/issues/1861
2025-02-02 19:12:24 -05:00
David Korth
8f162643be Reapply "[zlib-ng] Update: v2.2.2 -> v2.2.3"
The crashes on AppVeyor appear to be related to AVX2, so I'll disable
AVX2 when using the internal copy of zlib-ng on Windows for now.

This reverts commit 4a0672ad6f.
2025-02-02 19:04:24 -05:00
David Korth
4a0672ad6f Revert "[zlib-ng] Update: v2.2.2 -> v2.2.3"
This zlib-ng update is causing the AppVeyor MSVC 2015 x86 Debug build
to crash with an SEH exception in ImageDecoderTest and GcnFstTest.

This reverts commit 5178e6b25e.
2025-02-02 17:54:05 -05:00
David Korth
23fdcddf5b [libfmt] CMakeLists.txt: Allow CMake 3.5. (for Debian 8 ppc testing)
VRESION_GREATER_EQUAL was added in CMake 3.7, so add a workaround for that.
2025-02-02 12:39:09 -05:00
David Korth
9de5720776 [libpng] Update: v1.6.44 -> v1.6.46
[debian] copyright: Update libpng.
2025-01-27 18:22:34 -05:00
David Korth
5178e6b25e [zlib-ng] Update: v2.2.2 -> v2.2.3 2025-01-27 18:22:18 -05:00
David Korth
b11f9fa4c2 [libfmt] Build as a DLL on Windows and Mac OS X.
This significantly reduces the total size. fmt-11.dll's Release build
size is 128 KiB, and it cuts between 16-64 KiB from binaries that use it.

Total size of EXEs and DLLs, with amiiboc.exe and libgnuintl-8.dll,
but without test executables or PDBs:
[MSVC 2022 v17.6.5, Release build]

- Total size of EXEs and DLLs with header-only: 4,332,032
- Total size of EXEs and DLLs with fmt-11.dll:  4,161,536
- Difference:                                    -170,496

With test executables:

- Total size of EXEs and DLLs with header-only: 9,716,224
- Total size of EXEs and DLLs with fmt-11.dll:  7,907,840
- Difference:                                  -1,808,384

TODO: Add Delay-Load checks for fmt-11.dll to e.g. rpcli and the
Win32 UI frontend. (amiiboc and unit tests don't need it.)
2025-01-23 00:36:34 -05:00
David Korth
cd3b382617 [libfmt] CMakeLists.txt: Disable options.
These will be set in extlib/CMakeLists.txt.
2025-01-22 01:02:12 -05:00
David Korth
4007754b77 [extlib] CMakeLists.txt: Don't set extlib properties on fmt-header-only.
CMake 3.16.2 on AppVeyor (Win32) shows this error:

CMake Error in extlib/libfmt/CMakeLists.txt:
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "POSITION_INDEPENDENT_CODE" is not allowed.

CMake 3.31.0 on my Windows 7 VM didn't show this error...
2025-01-22 00:58:53 -05:00
David Korth
fa932de93f [libfmt] Add an internal copy of libfmt-11.1.2.
Currently used as a header-only build. Will eventually be changed to
build a DLL for Windows and Mac OS X.

Other changes needed to get the Windows version to build with libfmt:

Add #include <fmt/xchar.h> to some files for full wchar_t support
in libfmt. Otherwise, errors like this appear:

src\amiibo-data\amiiboc.cpp(175,8): error C2665: 'fmt::v11::print': no overloaded function could convert all the argument types
extlib\libfmt\include\fmt\base.h(2925,17): message : could be 'void fmt::v11::print<TCHAR*&>(FILE *,fmt::v11::fstring<TCHAR *&>,TCHAR *&)'
src\amiibo-data\amiiboc.cpp(175,8): message : 'void fmt::v11::print<TCHAR*&>(FILE *,fmt::v11::fstring<TCHAR *&>,TCHAR *&)': cannot convert argument 2 from 'wmain::<lambda_1>::()::FMT_COMPILE_STRING' to 'fmt::v11::fstring<TCHAR *&>'
src\amiibo-data\amiiboc.cpp(175,22): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
extlib\libfmt\include\fmt\base.h(2908,17): message : or       'void fmt::v11::print<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR*&>(fmt::v11::fstring<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR *&>,wmain::<lambda_1>::()::FMT_COMPILE_STRING &&,TCHAR *&)'
src\amiibo-data\amiiboc.cpp(175,8): message : 'void fmt::v11::print<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR*&>(fmt::v11::fstring<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR *&>,wmain::<lambda_1>::()::FMT_COMPILE_STRING &&,TCHAR *&)': cannot convert argument 1 from 'FILE *' to 'fmt::v11::fstring<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR *&>'
src\amiibo-data\amiiboc.cpp(175,14): message : No constructor could take the source type, or constructor overload resolution was ambiguous
src\amiibo-data\amiiboc.cpp(175,8): message : while trying to match the argument list '(FILE *, wmain::<lambda_1>::()::FMT_COMPILE_STRING, TCHAR *)' [build.vc17_64\src\amiibo-data\amiiboc.vcxproj]

Files modified for xchar.h:
- amiibo-data/amiiboc.cpp
- libromdata/stdafx.h (needed by WiiUPackage)
- libromdata/tests/RomHeaderTest.cpp

NOTE: Only included on Windows. xchar.h was added in libfmt-8.0.0,
which was first added (in Ubuntu LTS releases) in Ubuntu 20.04.
It's not needed on Linux, anyway.

New option USE_INTERNAL_FMT to force the use of the internal copy of
libfmt on Linux, for testing purposes. (...and also for Ubuntu 16.04)
- TODO: Maybe use it on 18.04, etc. for improved performance?
2025-01-21 23:59:20 -05:00
David Korth
f0647da5eb Remove CheckHiddenVisibility.cmake.
The root CMakeLists.txt has a minimum CMake version of 3.5, and
CheckHiddenVisibility.cmake's workarounds are only needed for
CMake 3.2 and earlier.

Set CMP0063 unconditionally (added in CMake 3.3) and set the
CMAKE_<LANG>_VISIBILITY_PRESET and CMAKE_VISIBILITY_INLINES_HIDDEN
variables where CHECK_HIDDEN_VISIBILITY() was called before.

There should effectively be no code changes with this commit.
2025-01-18 22:34:24 -05:00
David Korth
6e1b2cf3cd [minizip-ng] Don't export symbols if building as a static library.
Otherwise, the MiniZip-NG symbols end up getting exported from
libromdata.so, and we don't want to do that.
2025-01-18 22:27:02 -05:00
David Korth
fe163149b9 [googletest] Disable gtest_main and gmock_main.
The recent PIC changes for the internal TinyXML2 somehow broke compiling
gtest_main on Windows:

extlib\googletest\googletest\src\gtest_main.cc(48): error C2491: 'main':
    definition of dllimport function not allowed

Also disable gmock_main, since it depends on gtest_main.

We aren't actually using these, so it's not an issue.
(We implement our own main() in gtest_init.cpp.)

[extlib] CMakeLists.txt: Rename SET_EXTLIB_PROPERTIES_PIC() to
SET_EXTLIB_PROPERTIES_PIC_ONLY(), since SET_EXTLIB_PROPERTIES()
also sets POSITION_INDEPENDENT_CODE=TRUE.

Also use SET_EXTLIB_PROPERTIES_PIC_ONLY() for shared libraries that
may be installed, since we can't use SET_EXTLIB_PROPERTIES().
2025-01-11 12:30:51 -05:00
David Korth
b41b737c2c [extlib] CMakeLists.txt: Set POSITION_INDEPENDENT_CODE on all targets.
Adjusted SET_EXTLIB_PROPERTIES() to skip EXCLUDE_FROM_ALL if they're
being installed (i.e. SKIP_INSTALL_ALL is set when the function is
called).

This should fix a PIC issue when building the internal copy of
TinyXML2 on Linux, and possibly other libraries too:

/usr/bin/ld: lib/../extlib/tinyxml2/CMakeFiles/tinyxml2.dir/tinyxml2.cpp.o: warning: relocation against `stdout@@GLIBC_2.2.5' in read-only section `.text'
/usr/bin/ld: lib/../extlib/tinyxml2/CMakeFiles/tinyxml2.dir/tinyxml2.cpp.o: relocation R_X86_64_PC32 against symbol `stdout@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
2025-01-10 23:50:02 -05:00
David Korth
d470035e61 Switch to CMake's POSITION_INDEPENDENT_CODE property instead of manually adding "-fpic -fPIC".
Something changed that caused the build on Xubuntu 16.04 (32-bit) to fail:

[ 63%] Linking CXX shared library ../../lib/libromdata.so
/usr/bin/ld: read-only segment has dynamic IFUNC relocations; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: Bad value
collect2: error: ld returned 1 exit status
src/libromdata/CMakeFiles/romdata.dir/build.make:3614: recipe for target 'lib/libromdata.so.6.0' failed
make[2]: *** [lib/libromdata.so.6.0] Error 1

Setting POSITION_INDEPENDENT_CODE instead of "-fpic -fPIC" fixes this.

[extlib] Correctly set properties on the 'mspack' target instead of
'libmspack'. Otherwise, libmspack won't have either EXCLUDE_FROM_ALL
or POSITION_INDEPENDENT_CODE.
2025-01-05 14:02:13 -05:00
David Korth
1f8bd87910 [minizip-ng] Fix MiniZip DLL packaging on Windows.
- Don't install binaries. minigzip and minizip aren't compiled by
  default, so attempting to install them will fail.

- Set SKIP_INSTALL_LIBRARIES to OFF when building DLLs.

- Disable installation of headers, import libraries, and .cmake files.

- Install PDB files.
2024-11-23 14:10:54 -05:00
David Korth
c99b4c0837 [minizip-ng] Build as a .dll on Windows.
Since we're now using MiniZip in the J2ME parser, it should be compiled
as a DLL instead of statically linked.

Disable zstd support. It's causing issues with DelayLoad, since we're not
loading zstd in the J2ME parser. I originally enabled this to potentially
improve compression for test cases, but I ended up using .tar.zst instead
of zstd-compressed .zip files.

[libwin32common] Add MiniZip DLL information.

[libromdata] J2ME: Add MiniZip delay-load handling.

[libromdata] GczReader: Improve delay-load handling a bit.
2024-11-23 13:51:23 -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
eb5320fb8f [tinyxml2] Remove resources/.
These are test files and aren't really needed here.

[.github] codecov.yml: Remove "./extlib", which didn't work anyway:

warning - 2024-10-19 13:18:48,965 -- Some files were not found --- {"not_found_files": ["!./extlib"]}
2024-10-19 09:22:47 -04:00
David Korth
1052e7cbb5 [zlib-ng] Somehow missed a file while updating zlib-ng at some point... 2024-10-04 18:26:05 -04:00
David Korth
4050a03ad4 [zlib-ng] Fix a broken extra #ifdef introduced when updating zlib-ng to v2.2.2.
This fixes a regression from commit e9e16f425e.
([zlib-ng] Update: v2.2.1 -> v2.2.2)
2024-09-27 01:08:32 -04:00
David Korth
0fba585f24 [libpng] Update: v1.6.43 -> v1.6.44
[extlib] CMakeLists.txt: Set SKIP_INSTALL_CONFIG_FILE=ON.
New setting checked by the libpng-1.6.44 update.
2024-09-26 21:29:36 -04:00
David Korth
e9e16f425e [zlib-ng] Update: v2.2.1 -> v2.2.2 2024-09-25 21:57:24 -04:00
David Korth
70945ed34a [uniwidth] Update to Unicode 16.0.0. 2024-09-25 21:56:44 -04:00
David Korth
89e07bf47b [lz4] CMakeLists.txt: Set LZ4_LINK_LIBRARY. 2024-08-02 22:42:16 -04:00
David Korth
fd2898dfde Revert "[lz4] CMakeLists.txt: LZ4_LINK_LIBRARY isn't defined anymore; just use lz4."
This didn't work with generator expressions for installation.

This reverts commit ea14ebb1b8.
2024-08-02 22:41:07 -04:00
David Korth
fc9e22799f [extlib] CMakeLists.txt: Update CMake options for zlib-ng 2.2.1. 2024-08-02 20:55:23 -04:00
David Korth
ea14ebb1b8 [lz4] CMakeLists.txt: LZ4_LINK_LIBRARY isn't defined anymore; just use lz4.
Instead of defining LZ4_LINK_LIBRARY, an INTERFACE target 'lz4' is
created that links to either lz4_shared or lz4_static.
2024-08-02 20:53:53 -04:00
David Korth
ace57c011a [lz4] Update: v1.9.4 -> v1.10.0 2024-07-28 20:12:00 -04:00
David Korth
f9f7e32c52 [zlib-ng] Update: v2.1.6 -> v2.2.1
[librpbase] RpPng.cpp: FIXME: zlibng_version() isn't exported if
building with ZLIB_COMPAT.
2024-07-28 20:10:50 -04:00
David Korth
3c90ea3d26 [minizip-ng] Update: v4.0.6 -> v4.0.7 2024-07-02 00:23:19 -04:00
David Korth
58c54da1fb [minizip-ng] Update: v4.0.5 -> v4.0.6 2024-06-08 11:32:12 -04:00
David Korth
288375ab44 [zstd] Update: 1.5.5 -> 1.5.6
CheckZSTD.cmake: Update the version number here, too.
2024-03-30 12:16:26 -04:00
David Korth
a0e5dde6a3 [minizip-ng] Update: v4.0.4 -> v4.0.5 2024-03-17 18:45:35 -04:00
David Korth
c4c6d8a2f6 [libpng] CMakeLists.txt: Link to ${ZLIB_LIBRARY} instead of ZLIB::ZLIB.
ZLIB::ZLIB was causing problems where it would try linking to a literal
"zlibstatic" instead of libz.a. Not sure why...
2024-03-16 00:05:55 -04:00
David Korth
ef655b3538 [zlib-ng] CMakeLists.txt: Use zlibstatic if zlib isn't found.
Needed when building the internal copy of zlib-ng as a static library.
(Not too common, but I'm trying a test build with emscripten for lulz.)
2024-03-15 23:10:15 -04:00
David Korth
4c64309bc5 Split librpcpu into librpbyteswap and librpcpuid.
librpbyteswap is still embedded into libromdata and has exported
functions.

librpcpuid is a standalone static library and will be linked into
anything that needs CPU flags, instead of using __builtin_cpu_supports().
librpcpuid's version is more efficient because it has fewer tests and
it doesn't do string comparisons.

Remove #include "byteorder.h" from a few files, since it isn't actually used:
- librpbase/img/RpPng.cpp
- librpbase/img/RpPngWriter.cpp
- libromdata/disc/xdvdfs_structs.h
- libromdata/Media/hsfs_structs.h

[gtk,librpbase] Remove #include "librpcpu/cpu_dispatch.h" from stdafx.h,
since it's only used by a few files.

[gtk3] CMakeLists.txt: Removed SSSE3 checks. SSSE3 is only used by
GdkImageConv, which is only used by the XFCE (GTK2) UI frontend.

[gtk3] CairoImageConv.hpp: Remove #include "librpcpu/cpu_dispatch.h",
since it isn't actually used here.

[xfce] GdkImageConv_ifunc.cpp, [librpbyteswap] byteswap_ifunc.c:
- #include "config.librpcpuid.h" before checking for HAVE_IFUNC.
  This was indirectly included before, but explicitly including it
  allows us to skip the other inclusion if IFUNC is not available.
2024-03-14 21:56:58 -04:00
David Korth
589e71670e [googletest] Add workaround to fix the build on Debian 8. (gcc-4.9)
gcc-4.9 doesn't support std::is_trivially_copy_constructible<T> or
std::is_trivially_destructible<T>, so use __has_trivial_copy(T)
and __has_trivial_destructor(T) on old gcc.

It's not a perfect fix, but it gets the code to compile.

(I'm using Debian 8 to test big-endian using qemu-system-ppc.
Surprisingly, it's faster than Wii U Linux, even with all of
the CPU emulation overhead!)
2024-03-10 01:44:38 -05:00
David Korth
f26c7f8970 [libpng] Add a few _M_ARM64EC checks to fix the arm64ec build. 2024-03-03 16:28:35 -05:00
David Korth
5111f099d4 [extlib] functable.c: MSVC ARM64EC build fails if intrin.h is included here for some reason...
Everything works fine if it's disabled on ARM64EC, so disable it for now.
2024-03-03 16:24:55 -05:00
David Korth
2aef3c7b06 [libpng] Add files to the repository that were missed in the v1.6.43 update commit. 2024-02-25 13:33:13 -05:00
David Korth
c66509896c [libpng] Update: v1.6.42 -> v1.6.43
Also added some LoongArch files that were missed in the v1.6.42 update.
2024-02-25 13:16:35 -05:00
David Korth
20d731aad7 [libpng] Update: v1.6.40 -> v1.6.42
[zlib-ng] Export zlib as ZLIB::ZLIB. This is needed by
libpng-1.6.42's CMakeLists.txt
2024-02-17 20:13:22 -05:00
David Korth
afbddbdf1c [uniwidth] Update to Unicode 15.1.0 and assign width 1 to prepended concatenation marks. 2024-02-17 17:04:15 -05:00
David Korth
f4eb26ac4b [inih] Update: r56 -> r58
No significant changes for rom-properties' uses.
2024-02-17 16:59:50 -05:00
David Korth
a7c539470e [zlib-ng] Update: v2.1.5 -> v2.1.6
Use of TLS for the function table, which was added in v2.1.4, has been
dropped in v2.1.6 in favor of using atomic intrinsics.
2024-01-20 13:11:47 -05:00
David Korth
efd4fd587a [extlib] minizip-ng: Disable some stuff that doesn't work on CMake 3.5. 2024-01-08 20:28:38 -05:00
David Korth
b4f2ad34e7 [minizip-ng] Update: v4.0.2 -> v4.0.4
[extlib] CMakeLists.txt: Set -DMZ_COMPAT_VERSION=120 so we get
the newer version of unzLocateFile().
2024-01-07 23:51:40 -05:00
David Korth
b071500b22 [zlib-ng] Update: v2.1.4 -> v2.1.5 2024-01-07 23:50:42 -05:00
David Korth
d806eba66f [tinyxml] Update: 9.0.0 -> 10.0.0
Upstream has added `override` keywords, so we no longer have to
disable `-Wsuggest-override`.
2024-01-07 23:50:01 -05:00
David Korth
33edbb9f9a [unice68] unice68_pack.c: Explicitly cast dreg_t conversions.
Fixes the following 64-bit MSVC warnings:

unice68_pack.c(243,43): warning C4244: '=': conversion from '__int64' to 'dreg_t', possible loss of data
unice68_pack.c(319,28): warning C4244: '=': conversion from '__int64' to 'dreg_t', possible loss of data
unice68_pack.c(325,36): warning C4244: '=': conversion from '__int64' to 'dreg_t', possible loss of data
unice68_pack.c(456,40): warning C4244: '=': conversion from '__int64' to 'dreg_t', possible loss of data
unice68_pack.c(488,36): warning C4244: '=': conversion from '__int64' to 'dreg_t', possible loss of data
2023-12-03 15:21:40 -05:00
David Korth
6996007306 [zlib-ng] Don't set CMAKE_C_STANDARD_REQUIRED.
Otherwise, zlib-ng fails to build if using gcc-7.5.0, which doesn't
support C17.

TODO: Require at least C99, but *allow* C11 and C17?
2023-11-16 19:52:57 -05:00
David Korth
8a368f8598 [extlib] zbuild.h: Also disable Z_TLS for amd64.
This matches msvc.cmake, which disables thread-safe statics for both
i386 and amd64, even though we aren't really supporting 64-bit versions
of Windows XP or Windows Server 2003.
2023-11-11 20:23:19 -05:00
David Korth
06287b0638 [zlib-ng] Disable TLS when building for Windows on i386. Windows XP has problems with it.
rp-config suddenly started crashing on XP when trying to decode PNG
images. It turns out that *something* caused zlib-ng to start using
TLS, though the code indicates it may have always used it...

It's entirely possible that this was broken on XP for quite a while,
and I just didn't notice it until now.

TLS usage was added in zlib-ng 2.1.0-beta1. rom-properties updated
from v2.0.7 to v2.1.2 in rom-properties 2.2, so the previous release
will randomly crash on Windows XP.
2023-11-09 01:22:50 -05:00
David Korth
443bffddc9 Move libwin32darkmode from extlib/ to src/.
It's going to have a lot of local customizations, so it isn't really
a vendored library anymore. Among other things, I'm converting it from
header-only to .cpp files.
2023-11-02 21:12:54 -04:00
David Korth
17fabfb98e [libwin32darkmode] Initial import of win32-darkmode as a library.
In order to use "dark mode" in Win10 1809+ in a standard Win32 program,
we have to do all sorts of weird shenanigans.

Currently, dark mode is "enabled" in rp-config, but it only works in
context menus and scroll bars.

Reference: https://github.com/ysc3839/win32-darkmode
2023-11-02 21:09:40 -04:00
David Korth
30847e895f [minizip-ng] Update: v4.0.1 -> v4.0.2 2023-11-01 00:12:15 -04:00
David Korth
266c43c23c [rapidjson] Backport a patch to fix compilation with gcc-14.
Reference: https://bugs.gentoo.org/914581
2023-11-01 00:03:41 -04:00
David Korth
f475f1ee78 [rapidjson] _MODIFIED_RAPIDJSON.txt: Mention the std::iterator inheritance change. 2023-10-21 13:55:18 -04:00
David Korth
503a0b5f0d [rapidjson] Backport a patch to disable inheritance from std::iterator.
rapidjson hasn't had a proper release since August 2016, even though it's
had patches as recently as this past September. This patch is from
December 2017 and reworks GenericMemberIterator to not inherit from
std::iterator.

This fixes several warnings in MSVC when compiling in C++17 mode:

extlib\rapidjson\include\rapidjson/document.h(111,5): warning C4996:
'std::iterator<std::random_access_iterator_tag,internal::MaybeAddConst
    <Const,rapidjson::GenericMember<Encoding,Allocator>>::Type,ptrdiff_t,
    internal::MaybeAddConst<Const,rapidjson::GenericMember<Encoding,Allocator>>
    ::Type*,internal::MaybeAddConst<Const,rapidjson::GenericMember<Encoding,Allocator>>::Type&>':
warning STL4015: The std::iterator class template (used as a base class
to provide typedefs) is deprecated in C++17. (The <iterator> header is NOT
deprecated.) The C++ Standard has never required user-defined iterators to
derive from std::iterator. To fix this warning, stop deriving from
std::iterator and start providing publicly accessible typedefs named
iterator_category, value_type, difference_type, pointer, and reference.
Note that value_type is required to be non-const, even for constant
iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING
or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.
2023-10-21 13:05:35 -04:00
David Korth
803b7ca734 [zlib-ng] Update: v2.1.3 -> v2.1.4
The ARM64EC patch was merged upstream.
2023-10-21 12:34:26 -04:00
David Korth
8a6abda7c3 [zlib-ng] CMakeLists.txt: Add C17 to the known standards list.
Otherwise, it fails to build, since we're now using C17 instead of C11.
2023-10-21 12:15:24 -04:00
David Korth
563bb5f6c8 [unice68] unice68_unpack.c: depack_bytes: Check chk_dst_range(), *and* add chk_src_range().
One of the afl-fuzz tests (000003?) was failing due to the source
range being out of bounds.

Also, add assert() to the checked chk_src_range() and chk_dst_range()
functions.
2023-10-11 01:39:25 -04:00
David Korth
13363cfe69 [unice68] unice68_unpack.c, get_1_bit(): If chk_src_range() fails, return immediately.
Otherwise, attempting to dereference a5 will segfault.

This fixes all of the unice68 segfaults found with afl-fuzz so far...
at least in debug builds. Release builds are still faulting for some
reason...

TODO: Continue running afl-fuzz. I suspect I'll need to add something
similar to all uses of chk_src_range() and chk_dst_range().
2023-10-11 01:32:31 -04:00
David Korth
36fae53018 [extlib] unice68.c: Fix build.
- unice68_depacker() now has size parameters.

- Fix format string errors.
2023-10-11 01:01:01 -04:00
David Korth
2fb86861b4 [minizip-ng] Forgot to add cmake/detect-sanitizer.cmake to the repository. 2023-09-09 10:32:06 -04:00
David Korth
e241fed6e6 [minizip-ng] Fix two compile warnings.
- Define _DEFAULT_SOURCE in addition to _BSD_SOURCE.

In file included from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdlib.h:26,
                 from /home/david/programming/rom-properties/extlib/minizip-ng/mz.h:158,
                 from /home/david/programming/rom-properties/extlib/minizip-ng/mz_strm_mem.c:19:
/usr/include/features.h:196:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  196 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~

- mz_os_posix.c, mz_os_utf8_string_create(): `encoding` is unused.
2023-09-04 13:21:48 -04:00
David Korth
d7a7f5ca7d [minizip-ng] Update: v4.0.0 -> v4.0.1 2023-09-04 13:21:31 -04:00
David Korth
d9508735fb [googletest] library.json: Removed this file.
It was removed sometime between v1.11.0 and v1.12.0.
2023-08-12 15:18:13 -04:00
David Korth
f20a709f50 [tinyxml2] CMakeLists.txt: Set -DTINYXML2_NO_GCC_EXPORT as a public target compile definition.
This ensures any project that pulls in TinyXML2 also defines it.

I don't think this caused any actual problems, since libromdata.so wasn't
exporting TinyXML2 symbols when -DUSE_INTERNAL_XML=ON, but it does silence
a warning:

In file included from src/kde/config/AboutTab.cpp:48:0:
extlib/tinyxml2/tinyxml2.h:85:25: warning: "TINYXML2_NO_GCC_EXPORT" is not defined [-Wundef]
.#elif __GNUC__ >= 4 && !TINYXML2_NO_GCC_EXPORT
                         ^
2023-08-12 12:08:13 -04:00
David Korth
9c1db18574 Remove half-hearted support for Windows versions older than XP.
Windows 2000 support only partially worked in rp-config. The actual
shell extension component didn't work.

Support for ANSI Windows was mostly just compile-tested, and it was
becoming a burden to support something almost no one will use.

Removed most `#ifdef UNICODE` and `#ifdef _UNICODE` branches in
favor of using the Unicode path exclusively.

Removed oldwincompat, which was an attempt to get things working
properly on Windows 9x and 2000 with the MSVC 2010 runtime.
rom-properties doesn't compile with MSVC 2010 anymore, so this
probably wasn't very useful anyways.

Consolidated tstring macros in tcharx.h.

Removed GUID_fns.c since it was only useful in ANSI builds.
2023-07-31 21:32:47 -04:00
David Korth
a9a454d912 [gettext.win32] Updated to gettext-0.22.
Compiled using gcc-13.2.0 and MinGW-w64 11.0.0.

Removed the *.dll.debug files, since I'm not planning on debugging
gettext, and no one seems to care about them anyway.

NOTE: The libgnuintl-8.dll files are more than double the size of
the previous version. This might be due to using a newly-built
Gentoo crossdev MinGW-w64 toolchain on my laptop instead of the
old MinGW-w64 toolchain on Ubuntu 22.04, or it might be because
gettext-0.22 has more wchar_t functionality on Windows now.

TODO: Build for Windows on ARM using LLVM MinGW-w64.
2023-07-28 19:37:18 -04:00
David Korth
251d9060cf Fix and/or silence a bunch of MSVC warnings.
[libmspack-xenia] lzxd.c: Cast pointer differences to int.

[microtar] microtar.c: fwrite() and fread() return size_t.

[libcachecommon] CacheKeys.hpp: Silence C4834 and gcc -Wunused-result
for cacheKeys.c_str().

[libromdata] ELF.cpp: Cast val_dtag[] to uint32_t.

[libromdata] EXE_NE.cpp: Cast ao::uvector<> sizes to uint32_t.

[libromdata/tests] microtar_zstd.c: Cast toCopy to unsigned when passing
it to microtar functions.

[librpfile] RpFile_scsi_win32.cpp: Windows 8.1 SDK's ntddscsi.h doesn't
properly declare _NV_SEP_WRITE_CACHE_TYPE as an enum.

[librptext/tests] TextFuncsTest: Silence warnings about implicit
conversoin from double to unsigned int by only doing integer
calculations. (It's done at compile time, not runtime.)

[librptexture] PowerVR3, ValveVTF3: Explicitly cast some size_t
calculations to unsigned int.

[win32] KeyManagerTab: Explicitly cast the return value from
std::count_if() to int.
2023-07-23 13:06:53 -04:00
David Korth
b9dd3ed661 [googletest] CMakeLists.txt: Fix gtest's PDB filename in debug builds.
CMAKE_DEBUG_POSTFIX wasn't being set, so the PDB filename ended up being
gtestpdb_debug_postfix-NOTFOUND.pdb.

Set CMAKE_DEBUG_POSTFIX="d" and CMAKE_RELEASE_POSTFIX="" when building
with MSVC. For other compilers, both are set to "".
2023-07-16 18:47:04 -04:00
David Korth
b6e4e044cd [zstd] Handle ARM64EC as ARM64.
TODO: Send a patch upstream.
2023-07-14 20:11:55 -04:00
David Korth
cb6dbef896 [zlib-ng] Handle ARM64EC as ARM64.
TODO: Send a patch upstream.
2023-07-14 20:11:40 -04:00
David Korth
807be3a24b [zlib-ng] CMakeLists.txt: Disable a second option(ZLIB_ENABLE_TESTS).
This fixes a regression from commit 5086061436.
([zlib-ng] Update: v2.0.7 -> v2.1.2)
2023-07-01 11:31:01 -04:00
David Korth
9ec54f0346 [zlib-ng] Update: v2.1.2 -> v2.1.3 2023-07-01 02:16:57 -04:00
David Korth
c96f12a854 .clang-tidy: Enable scanning on header files.
Also disable some warnings that merely clutter up the logs and don't
help at all.

extlib/.clang-tidy: Attempt to disable header file scanning, but it
doesn't seem to work...
2023-06-30 22:56:49 -04:00
David Korth
fe305dbb0a .clang-tidy: Initial .clang-tidy file.
Still a work in progress.

extlib/.clang-tidy: Exclude extlib/.
2023-06-30 21:44:02 -04:00
David Korth
dd87260759 [libpng] Update: v1.6.39 -> v1.6.40 2023-06-26 18:01:52 -04:00
David Korth
5086061436 [zlib-ng] Update: v2.0.7 -> v2.1.2
zlib-ng v2.1 has significant performance improvements compared to v2.0.
In particular, decompression can be up to 56% faster on amd64 when
using AVX2 instructions.

FIXME: RomHeaderTest infinite-loops on Xubuntu 16.04 32-bit with 1.5 GB
RAM due to memory allocation issues. microtar_zstd.c doesn't ever receive
an "out of memory" error...
2023-06-11 12:45:30 -04:00
David Korth
9416444bb0 [minizip-ng] CMakeLists.txt: Disable project()'s DESCRIPTION and HOMEPAGE_URL.
Ubuntu 16.04 has CMake 3.5.1:
- DESCRIPTION was added in CMake 3.9.
- HOMEPAGE_URL was added in CMake 3.12.

CMake 3.5.1 incorrectly interprets these as programming languages and
gets very confused when it can't find .cmake files that describe how
to handle those "languages".

This was added in minizip-ng 4.0.0, so no rom-properties releases are
affected by this.
2023-06-11 12:24:39 -04:00
David Korth
06661cff3f [minizip-ng] CMakeLists.txt: Disable CheckSourceCompiles.
It doesn't seem like it's needed, and AppVeyor on Windows uses
cmake-3.16.2, which doesn't have it. (added in 3.19)
2023-05-21 14:01:33 -04:00
David Korth
690d214b80 [minizip-ng] Update: v3.0.10 -> v4.0.0
Major version bump due to removal of ZIP signature creation and
verification.
2023-05-21 13:10:24 -04:00