- /Zc:inline
- /Zc:__cplusplus
- /Zc:externC
- /Zc:noexceptTypes
- /Zc:rvalueCast
- /Zc:ternary
No code changes were needed, since gcc implements all of these anyway
as far as I know.
KF6 isn't out yet, so this is mostly just a compile test against
Qt 6.
Main changes:
- KeyStoreModel.hpp: #include "KeyStoreQt.hpp" instead of simply
forward-defining the class.
src/kde/kf6/rom-properties-kf6_autogen/A2AGDIRYKS/moc_KeyStoreModel.cpp:151:1: required from here
/usr/include/qt6/QtCore/qmetatype.h:858:23: error: invalid application of ‘sizeof’ to incomplete type ‘KeyStoreQt’
858 | static_assert(sizeof(T), "Type argument of Q_PROPERTY or Q_DECLARE_METATYPE(T*) must be fully defined");
| ^~~~~~~~~
- stub-export.cpp: Don't set Qt::AA_EnableHighDpiScaling on Qt 6. It's
always enabled on Qt 6 and this constant is now deprecated.
- AchievementsItemDelegate: QVariant::canConvert(int) is deprecated.
The recommended replacement is QVariant::canConvert(QMetaType), which
is Qt 6 only, or alternatively, QVariant::canConvert<T>, which is
available in Qt 4 and Qt 5.
The only actual compile error I've hit so far is with KFileMetaData
because it uses QMap::insertMulti(), which was removed from Qt 6.
Due to random shenanigans and symbol ordering, libromdata started
crashing because the linker was attempting to resolve the IFUNC
functions before the rpcpu functions were available. Use gcc's
built-in CPU support functions instead.
(It *was* working for me yesterday, then I rebooted and it stopped
working until I made this change.)
This requires gcc-4.8+ or clang-6.0+.
An alternative workaround is using lazy binding (-Wl,-z,lazy), but this
could just delay the crash until later.
IfuncTest.c: Test for the CPU support functions and disable IFUNC
if they aren't available.
This causes issues on Xubuntu 16.04 if a system-wide zstd is installed
because extlib uses the internal version while minizip-ng tries using
the system version, and the system version isn't recent enough for
minizip-ng. (Requires 1.4.0; Xubuntu 16.04 has 1.3.1.)
librpthreads: Was missing SetMSVCDebugPath and EXCLUDE_FROM_ALL.
libunixcommon: Was missing "-fpic -fPIC".
[librpbase] ConfReader: Make it public:
Config.hpp(20,1): warning C4275: non dll-interface class
'LibRpBase::ConfReader' used as base for dll-interface class
'LibRpBase::Config'
================
RomData::supportedImageTypes_static(): Need to mark RP_LIBROMDATA_PUBLIC
in RomData_decl.hpp, not just the definition in each .cpp file. This
worked on Linux, but on Windows, it causes an error:
Amiibo.cpp(295,18): error C2375: 'LibRomData::Amiibo::supportedImageTypes_static': redefinition; different linkage
Note that this will result in more exported symbols than is strictly
necessary, but that shouldn't be too much of an issue.
================
Needed to change several libraries from STATIC to OBJECT in order to
ensure that files aren't truncated from libromdata.
TODO: Is it possible to remove "OBJECT"? It makes a mess in the compiler
output, since it links to each .obj individually instead of the .lib
files...
================
Need to define RP_BUILDING_FOR_DLL=1 for anything that links to libromdata
in order to ensure it has the dllimport definitions set up correctly.
This only seems to affect *some* symbols, not all of them... (notably
AboutTabText and ComBase data symbols)
[libwin32common] Moved IIDs from win_iid.c into IListView.hpp to avoid
having to export these symbols from libromdata.
ZLIB_LIBRARY -> ZLIB_LIBRARIES
Removed ZLIB_LIBRARIES from the KDE4 and KF5 UI frontends, since they
don't use zlib directly.
================
Link all tests to libromdata instead of individual static libraries.
This reduces the size of the compiled test executables, at the expense
of requiring libromdata to be built before the tests can be built.
This is required because librptest is linked to libromdata in order to
access librptexture to set the rp_image backend.
TODO: Only set the rp_image backend in tests that need it instead of
always setting it?
Among other things, it supports handling multiple targets in a single
subdirectory, which will be needed for the "-dll" targets when converting
libromdata to a DLL on Windows.
NOTE: Requires CMake 3.16. PCH will be disabled if using an earlier
version.
Other changes:
- TARGET_PRECOMPILED_HEADER() ignores force-include flags, so add
config.libc.h and c++11-compat.h to the header list to ensure that
stdafx.h has access to them.
- Removed all stdafx.c and stdafx.cpp files. CMake generates its own.
This will add a "ROM Properties configurator" entry to the applications
menu on most Linux desktop environments.
TODO:
- Custom rom-properties icon instead of "media-flash".
- GTK+ rp-config implementation.
Fixes#295: [Feature Request] rp-config launcher
Reported by @Amnesia1000.
For some reason, "-Wsuggest-override" is being turned into an error in
the MinGW-w64 build. This breaks Google Test, which is apparently
triggering some "suggest override" warnings.
clang-cl defaults to /Zc:throwingNew internally, but it prints a warning
if the parameter is specified:
clang-cl : warning : argument unused during compilation: '/Zc:throwingNew'
[-Wunused-command-line-argument]
Set -mssse3 and -msse4.1 on clang-cl. clang-cl normally works like MSVC,
but it doesn't enable SSSE3 or SSE 4.1 intrinsics by default. Instead,
the gcc-style parameters need to be specified.
TODO: Clang also supports some gcc-style warning flags.
- Use host gettext executables when cross-compiling with MinGW.
- Change CHECK_GETTEXT() from a macro to a function.
- Disable -Wno-cast-function-type, since it prints warnings every time
we use GetProcAddress().
This makes it more reliable across different platforms, and it ensures
we don't try using IFUNC if e.g. -fanalysis=address is enabled, since
AddressSanitizer doesn't support it.
config.librpcpu.h now defines HAVE_IFUNC if IFUNC is available.
Note that we're still checking a few things:
- Windows and Mac OS will never have IFUNC.
- glibc-2.11 is required for most architectures.
- glibc-2.18 is required for ARM.
This should fix the actual underlying problem. Adding the "fix" to
FstPrint.cpp failed because that uses snprintf(), not rp_sprintf().
Use the same setup as MinGW-w64:
- gnu_printf if not Windows, or if using UCRT or MinGW ANSI stdio.
- ms_printf if Windows and not using either UCRT or MinGW ANSI stdio.
This should fix the printf warning issues in all places in the MinGW-w64
build.
msvcrt.dll doesn't support %llx-style printf specifiers, but MinGW-w64
enables ANSI stdio by default, even if we're using msvcrt.dll.
This results in PRIx64 using %llx instead of %I64x, which causes printf
warnings, which fails the build due to -Werror=format.
ELF.cpp: Remove the FIXME for this.
Reference: https://fedoraproject.org/wiki/Format-Security-FAQ
-Werror=format-nonliteral is *not* enabled because there are some
legitimate uses of non-literal format strings.
Separated the warning flags into multiple variables.
Updated everything to build with this change.
Previously, it tested for --large-address-aware, --nxcompat, and
--tsaware. We're now also testing for --dynamicbase and --high-entropy-va.
In addition, newer ld shows things like "--[disable-]dynamicbase", so
adjust the check to only look for the important part, then prepend "--"
to the option.
Also: --large-address-aware is only supported on 32-bit, and
--high-entropy-va is only supported on 64-bit, so restrict those.
(Technically, --large-address-aware does something on 64-bit, but
it's rather useless. If not set, it *might* restrict process memory
to 2 GB.)
KDE Frameworks 5.85.0 enables this by default. It reduces startup time
by pre-linking global function symbols.
Also, filter out '=' from variable names. This broke the caching of
-Werror=return-type.
msvc.cmake: Copy the '=' change here.
GSound depends on libcanberra, but it's an indirect dependency, so
if we use GSound, we don't need to use libcanberra.
GSound is available on Ubuntu 16.04, so we can switch to it on
most systems. The libcanberra backend is still supported for now,
though it might be removed later.
Since GSound doesn't have a GTK+ dependency, we can use it in the
GTK4 backend. (libcanberra doesn't support GTK4.)
I don't have any GTK4 file browsers to test this, but it compiles.
GTK4 is disabled by default due to this.
GTK4 doesn't support Cairo, so we're falling back to GdkPixbuf for
now. There *is* a new GdkTexture class, which implements most of
GdkPixbuf's functionality without the overhead as Cairo.
Missing functionality:
- Drag & drop needs to be completely rewritten.
- gtk_dialog_run() doesn't exist anymore, so file dialogs need to be
reworked to use a signal handler. This will work in older versions
of GTK, too.
- Also: Handle URIs properly?
- GtkHeaderBar: GTK4 no longer has GtkButtonBox. Figure out "secondary"
there.
- GTK4 equivalent of gtk_container_set_border_width().
The Nautilus frontend is enabled, but Thunar is not, since that requires
more changes that can't easily be verified at the moment.
I tested a release build and it saved a total of 10,752 bytes.
On the other hand, it had a rather huge maintenance overhead, since I had
to ensure that all extlibs had __cdecl set up in the headers properly,
and this had to be redone on every update.
The i386 build of LZ4 on AppVeyor was failing in tests because of missing
stdcall symbols. I decided not to bother adding stdcall support to LZ4
and simply revert stdcall entirely.
- Load the amiibo-data.bin on demand.
- Use amiibo-data.bin to look up all the names.
- AmiiboData is now a Singleton, similar to Achievements.
- New macro CHARTABLE_VARIANT_FLAG that replaces (1U << 31).
amiibo-data.bin will be installed in /usr/share/rom-properties on
Linux systems.
TODO:
- Reload amiibo-data.bin if the timestamp changes.
- Find amiibo-data.bin on Windows.
- Allow overriding amiibo-data.bin using the config directory.
Split from librpbase/CMakeLists.txt.
[librpbase/tests] CMakeLists.txt: Use CHECK_NETTLE_2_OR_3.
Previously, we were checking for the Nettle library, which broke when the
library package was changed to NETTLE to fix a warning from CMake 3.17's
FIND_PACKAGE() in commit 5645e9f9b5.
(Rename FindNettle and FindSeccomp to FindNETTLE and FindSECCOMP.)
I'm not sure when this started happening, but leaving out a return
value from a non-void function is causing gcc to jump to a semi-random
function instead of simply returning an undefined value.
language_combo_box_set_selected_lc() was calling
language_combo_box_set_property() because of this:
.#4 0x00007fffca11e468 in language_combo_box_set_property(GObject*, guint, GValue const*, GParamSpec*) (object=0x7ffff70d0108, prop_id=1, value=0xa8, pspec=0x1)
at ../../src/gtk/LanguageComboBox.cpp:156
.#5 0x0000555555cf3ad0 in ()
.#6 0x000000000000656e in ()
.#7 0x0000555555cf3ad0 in ()
.#8 0x0000555555c46838 in ()
.#9 0x0000555555e5b6a0 in ()
.#10 0x00007fffca111d0b in rom_data_view_update_multi(RomDataView*, uint32_t) (page=page@entry=0x7fffe8020490 [RomDataView], user_lc=user_lc@entry=0)
at ../../src/gtk/RomDataView.cpp:1554
MiniZip 2.10.0 uses ZSTD_compressStream2() and ZSTD_EndDirective.
Note that MiniZip is not currently used outside of test suites,
so this won't be installed as part of the package.
I set this while testing some refcounting stuff earlier.
This fixes a regression from commit 2b4ada24e4.
([librpbase] IconAnimData: Changed to a reference-counted class.)
Starting with KDE Frameworks 5.74, KIO supports loading KPropertiesDialog
plugins using QPluginLoader, which uses JSON metadata instead of .desktop
files. KIO will print a warning to stderr if a plugin is still using the
.desktop method:
kf.kio.widgets: Plugin "rom-properties-kf5" is using the deprecated
loading style. Please port it to JSON loading.
Reference: 6519283f83
ParseMimeTypes.cmake: New function to print the MIME types in a format
usable by the JSON plugin metadata.
rom-properties-kf5.json.in: JSON version of the .desktop file.
NOTE: Even though the .desktop file still has the relevant data for older
versions of KIO, KIO 5.74 does *not* print a warning, since the JSON
metadata *is* present.
Moved the installed .so to kf5/propertiesdialog, which is required by the
plugin loader. The .desktop file has been updated for this, since it's
still needed for older versions and for ThumbCreator.
Updated all components that reference plugin paths for this change.
configure.kf5.h.in: Put the plugin paths here instead of defining them
using TARGET_COMPILE_DEFINITIONS().
TODO: Need to test on older KF5 versions and make sure that it still
works without any issues.
Updated all RomData subclasses and UI frontends for this change.
Animated icons now work correctly in UI frontends after e.g. extracting
an SRL from a DSi TAD package or Nintendo 3DS CIA.
We can unreference them since the RomData objects will keep a reference
until they're no longer needed.
Consolidated the SMDH and SRL objects into a single RomData* pointer.
dynamic_cast<> is used to distinguish between them where necessary.
The giant sbptr struct is no longer needed.
(NOTE: I thought the two RomData pointers were in a union, but apparently
they weren't...)
Removed CheckCXXNoRTTICompilerFlag.cmake to ensure we don't accidentally
re-add it and break dynamic_cast<>.
I chose MiniLZO instead of regular LZO because we only need to be able to
decompress LZO1X blocks.
[libromdata] CisoPspReader: Don't call lzo_init() if this JISO isn't
actually using LZO. Otherwise, if the DLL is missing on Windows, the
program will crash.
It has a unique header, but the index entries table is similar to the
other formats. It does *not* set the high bit to indicate NC; instead,
it uses the same method as CISOv2, where the compressed block size
matches the uncompressed block size.
Compression algorithm is lzo1x.
TODO:
- JISO supports NC areas. Figure this part out.
- Add LZO to extlib.
ZISO is basically CISO v0/v1 but with LZ4 instead of zlib.
CISO v2 can use either zlib or LZ4 on a per-block basis.
[cmake] Added LZ4 checks.
- TODO: Add an internal copy of LZ4.
This is useful for cases where the thumbnailer cannot download files or
write to the user's cache directory. libgnome-desktop, when configured
with bubblewrap enabled, doesn't allow access to the home directory
(aside from the file being thumbnailed), but *does* allow access to the
/usr/ directory.
Three cases are now possible, depending on if a cache file is present in
the system-wide cache directory and/or the user's cache directory:
- IS in system-wide, NOT in user's: Use the system-wide version.
- IS in system-wide, AND in user's: Use the user's version.
- NOT in system-wide: Use the user's version, calling rp-download if the
file doesn't exist.
New MIME type files:
- xdg/mime.no-thumbnail.types (types that don't have supported thumbnails)
- xdg/mime.thumbnail.types (types that have supported thumbnails)
These are now read at CMake time and are used to generate the .desktop
and .thumbnailer files.
The mime.types files are one line per MIME type, which is easier to work
with than a single line of everything.
The GTK+ .thumbnailer files only have mime.thumbnail.types, whereas the
KDE .desktop files have both thumbnail and no-thumbnail.
TODO: Sort and remove duplicates?
Also: Cleaned up installation of the .desktop/.thumbnail files. Removed
the explicit source/binary directories, since these functions have good
defaults:
- CONFIGURE_FILE() uses source dir for source, binary dir for destination.
- INSTALL() defaults to binary dir.
Added some MIME types from RomData subclasses that weren't added before:
- iQuePlayer
- PokemonMini
- DidjTex
- KhronosKTX2
- PowerVR3
- SegaPVR (image/x-sega-svr only)
MiniZip 2.10.0 added support for zstd as a compression method, so we
should support it.
Note that a system version of zstd is preferred on Linux systems.
Enabled the MiniZip test tools for manual builds only. Info-ZIP hasn't
been updated in a while, so I'm going to use the MiniZip test tools to
compress ZIP archives using zstd.
Enabled MiniZip compression in order to compress stuff using the minizip
test program.
mz_strm_zstd.c: FIXME: Compression level doesn't work. Hard-coded the
maximum compression level for now.
The variables have been (mostly) renamed to GTK2, though the user-facing
variable is still BUILD_XFCE, and it shows "XFCE" in the UI_FRONTENDS
status message.
I don't know if I'll be adding support for old GTK+ 2.x Nautilus
versions...
Same sort of dynamic loading as the Nautilus version, but with separate
plugin initialization code.
thunarx-mini.h: Definitions of various ThunarX structs, since we no longer
use the system-wide version.
Use G_DEFINE_DYNAMIC_TYPE_EXTENDED() instead of the ThunarX version.
Note that for RpThunarProvider, we need to use G_IMPLEMENT_INTERFACE_DYNAMIC().
G_IMPLEMENT_INTERFACE() crashes at runtime, even though the ThunarX
version worked fine. (Presumably, the ThunarX version was actually the
same as the glib DYNAMIC version...)
Added dummy class_finalize() functions, which are needed by the
G_DEFINE_DYNAMIC_TYPE_EXTENDED() macro.
The only differences are symbol names, which we can resolve at runtime.
Export all three plugin symbols. Depending on which initialization
function is called, we'll dlopen() the appropriate library and load
the symbols.
TODO:
- Create symlinks for the MATE and Cinnamon plugins.
- Update Debian packages to install symlinks.
- Other testing.
Note that we don't need to implement runtime fallbacks to stat():
1. If statx() isn't available at compile time, stat() will be used
regardless.
2. If glibc supports statx() but the kernel doesn't, glibc will
emulate statx(). This might introduce some extra overhead, but
it's easier to work with.
3. The BSDs keep their libc in sync with the kernel, so there's no
possibility that libc will support statx() if the kernel doesn't.
The os-secure files from rpcli and rp-download have been consolidated
into a single library. seccomp-debug.h has also been moved here and
converted into a .c file with a public interface in the .h file.
rpcli and rp-download can now call rp_secure_enable() with an OS-specific
parameter. A struct is provided that makes the parameter type-safe.
NOTE: syscall_wl (seccomp syscall whitelist) can't be NULL-terminated,
since syscall 0 is valid on most architectures. On x86, it's read().
Hence, we're specifying an explicit array size.
Also moved the Win32 security options and integrity level files here.
Updated Win32 code for this change.
integrity_level.c: Removed the pthread_once() usage for the Windows Vista
check, since we're not linking to librpthreads. The worst that could happen
is both threads set isVista to the same value.
[cmake] Adjusted security options:
- USE_SECCOMP: Moved from cmake/options.cmake to librpsecure/CMakeLists.txt.
- ENABLE_SECCOMP_DEBUG: Added to librpsecure/CMakeLists.txt. Replaces
the hard-coded SECCOMP_DEBUG in seccomp-debug.h.
[svrplus] Removed the libwin32common dependency. It was only used for the
Windows security options, and that's now handled by librpsecure.
[tests] Updated gtest_init.cpp to use librpsecure. Link all test suites to
librpsecure instead of libwin32common.
- TODO: seccomp() on Linux, pledge() on OpenBSD.
This should ensure better utilization of precompiled headers in gcc builds.
Note that ${CMAKE_BUILD_TYPE} is not necessarily all uppercase, so
convert it to uppercase before using it.
CMakeLists.txt: Make sure CMAKE_BUILD_TYPE gets cached as "Release" if it
isn't specified on the command line.
TODO: Do we need to ensure that ADD_COMPILED_HEADER() is added *after* all
flags/definitions are set, or does the ordering not matter?
This fixes the build on Ubuntu 14.04 with precompiled headers enabled.
Updated the compiler flag CMake files to use functions instead of macros
and to only check for functionality once regardless of how many times the
function is invoked. Among other things, this lets us remove the UNSET()
calls, since local variables are automatically deleted after returning
from the function.
FIXME: Make sure gcc is actually using the precompiled headers...
This seems to be needed on Ubuntu 14.04 for Thunar (GTK+ 2.x).
Newer versions have the extension directory defined in the pkgconfig
file, so it's not an issue there.
It's a bit more restrictive than rp-download, since rpcli doesn't need
to access the Internet.
Moved Win32 security option initialization to an os-secure file as well
for consistency.
Moved the OpenBSD pledge()/tame() check to a CMake macro file.
OpenBSD (and probably other BSDs) are similar to Mac OS X in that they
have a 64-bit off_t and no off64_t. Detect this correctly using cmake
macros and handle it in config.libc.h.in.
config.libc.h is force-included using command line parameters, similar
to c++11-compat.h. We can't simply add the binary directory to
INCLUDE_DIRECTORIES() because this breaks other CMake checks, since
CMake doesn't use INCLUDE_DIRECTORIES() when checking stuff.
I decided to try building rom-properties with MSVC 2019's ARM compilers,
and it seems to build properly. I can't test it at the moment, though.
CMake changes:
- ${CMAKE_SYSTEM_PROCESSOR} is always set to the host CPU. Check
_MSVC_C_ARCHITECTURE_FAMILY to determine the real CPU, then set
CMAKE_SYSTEM_PROCESSOR accordingly.
- Enable /EHsc if it isn't set already. It's set by CMake for i386
and amd64, but not for ARM or ARM64.
- Minimum subsystem version for ARM and ARM64 is 6.2. (Windows 8)
- Added some Win32 libraries that are included by default on i386 and
amd64, but not on ARM or ARM64.
- Reference: https://pete.akeo.ie/2017/05/compiling-desktop-arm-applications-with.html
Source changes:
- DelayLoadHelper.c, rp-config.c: Added subdirectory names for
ia64, ARM, and ARM64.
- TODO: Consolidate this into a common header file?
FIXME: Maybe we should use RP_LINKER_FLAGS_WIN32_EXE and
RP_LINKER_FLAGS_CONSOLE_EXE on MSVC. (We're using this on gcc.)
Not sure why I used one method or the other...
Using GCR_Cmake macros from: https://github.com/Makman2/GCR_CMake
Currently loading the full 16x16 sprite sheet as the icon for each
dropdown entry. This is obviously wrong, but it works as a basic
test for now.
PIMGTYPE.cpp: New function PIMGTYPE_load_png_from_gresource(). This
function loads a PNG image from the glibresources and returns it as
PIMGTYPE. This does *not* use rp_image at all; it uses Cairo's
built-in PNG loading functionality.
TODO: GdkPixbuf version.
Related bug report for LibreOffice:
https://bugs.documentfoundation.org/show_bug.cgi?id=125922
NOTE: dll-search.c still checks for "KDE5" for compatibility.
NOTE 2 We did NOT include "KDE5" in the forwarding plugins for
compatibility because they shouldn't be mixed-and-matched with
rom-properties versions.
The AppArmor profile has the following permissions, with everything else
denied:
- Allow TCP network access to download from online image databases.
- Allow read access to rom-properties.conf.
- Allow write access to .cache/rom-properties/.
This ensures we can add it after liboldwincompat.
This fixes EncodePointer() and DecodePointer() being used from
kernel32.lib instead of liboldwincompat in rom-properties.dll.
Enabled by default on MSVC only.
travis-ci still uses Ubuntu 14.04, and PrecompiledHeader.cmake doesn't
seem to pass the `-std=gnu++11` option properly, so gcc-4.8 ends up
failing.
TODO: Use cmake-3.16.0's built-in PCH support if available.
Nemo is yet another Nautilus fork. Nemo was initially forked from
Nautilus 3.x, so we don't have to worry about GTK+ 2.x versions.
Everything's basically the same as the Caja version, except the
files are named "nemo" instead of "caja".
It seems that the R and B channels are backwards, so we'll need to fix
that next. Other than that, both 2bpp and 4bpp decoding seems to work.
(A lot better than my terrible attempt, at least.)
[cmake] options.cmake: Added an option for PVRTC. The code is licensed
under the MIT license, but we might as well provide an option for it
because it's third-party code instead of my own code.
TODO:
- Fix R/B channel ordering.
- PVRTC-II decoding?
- Add PVRTC decoding to KTX and DDS.
This allows us to eliminate the OpenGL dependency, which lets us get rid
of the CMake option ENABLE_GL.
Removed all ENABLE_GL checks.
Removed #include "config.librptexture.h" where it's no longer needed.
When building with MinGW-w64, the manifests were being written with "x86"
even for 64-bit, which caused Windows to outright refuse to run the
program with no error message.
The check in platform.cmake checks both CMAKE_CL_64 and sizeof(void*),
so remove the one in platform/win32.cmake.
Also added untested checks for ARM/ARM64.
TODO: Verify cross-compile functionality.
JPEG decoding isn't as strictly checked as PNG decoding, and we don't
need specific JPEG writing functionality e.g. for APNGs and tEXt chunks,
so we can drop the libjpeg-turbo requirement on Windows.
This reduces the Windows distribution by around 1 MB uncompressed.
(521 KB for the 32-bit jpeg62.dll; 535 KB for the 64-bit jpeg32.dll.)
Related: Commit f548b5372d
(Removed the GDI+ PNG loader; renamed RpPng_libpng.cpp to RpPng.cpp.)
[librptexture] rp_image_backend: Allow width and height to be 0 if the
specified format is rp_image::FORMAT_NONE. This is done by
RpGdiplusBackend when constructing a backend using an existing
Gdiplus::Bitmap.
HAS_LD_COMPRESS_DEBUG_SECTIONS isn't actually being set. It was probably
set while I was testing stuff, but it got removed before committing in
commit 107224487f.
([cmake] Reworked --compress-debug-sections logic for compatibility with older systems.)
GNU ld treats these as the same, but clang ld requires a value to be
specified.
This fixes a regression on FreeBSD from commit 107224487f.
([cmake] Reworked --compress-debug-sections logic for compatibility with older systems.)
Ubuntu 14.04's ld (binutils-2.24) doesn't have --compress-debug-sections,
which causes travis-ci to fail.
cmake-3.6's try_compile() attempts to build an executable by default,
which *should* test the linker flags, but that isn't working, either.
Ubuntu 14.04 has cmake-3.3, so that wouldn't help anyway.
Instead, check the output of `ld --help` for the various options.
This seems to work for the most part.
Enabled this method for Mac OS X as well.
If the --compress-debug-sections=zlib linker test fails, then we'll
fall back to the old objcopy method. SplitDebugInformation.cmake uses
the same detection method to check if objcopy supports the option,
and if it does, it uses it.
Added our own copy for older CMake versions.
TextFuncs_iconv.cpp: #include </usr/include/iconv.h> on FreeBSD and
other non-Linux systems. This works around an issue where libiconv
takes over the default iconv.h if libiconv is installed *and* the
system has its own iconv(), which happens on FreeBSD 10.0 and later.
FIXME: The following TextFuncsTests are failing on FreeBSD 12.0:
- cp1252_to_utf8
- cp1252_to_utf16
- cp1252_sjis_to_utf8_fallback
- cp1252_sjis_to_utf16_fallback
- utf8_to_utf16
FreeBSD's objcopy doesn't have --compress-debug-sections, but ld does.
On Linux, this does provide an advantage over the previous method because
ld compresses the debug sections when creating the original executable,
which results in less disk access.
Three compression options are available in GNU ld:
- zlib-gnu: Use .zdebug_* sections.
- zlib-gabi: Use .debug_* sections with the C flag.
- zlib: Same as zlib-gabi.
FreeBSD's zlib option is the same as GNU ld's zlib/zlib-gabi option,
so we'll use it on all platforms.
NOTE: FreeBSD's default toolchain is llvm/clang as of FreeBSD 10.0, so
this should apply to other systems using llvm/clang.
S2TC was originally implemented because the S3TC patents were still in
effect. The patents expired in October 2017, which was *before* the
release of v1.2 (the first version with S3TC decoding), but I didn't want
to remove it so close to release.
Pretty much no one used the S2TC version, so it was just wasting space.
Code size reduction: (64-bit Gentoo Linux, gcc-9.1.0, release build)
text data bss dec hex filename
17058 9 0 17067 42ab ImageDecoder_S3TC.cpp.o [before]
13138 8 0 13146 335a ImageDecoder_S3TC.cpp.o [after]
-3920 -1 0 -3921 -f51 Difference
This fixes a ton of instances of the following warning, introduced in
cmake-3.14.0:
CMake Warning (dev) at cmake/libs/CheckGettext.cmake:30 (SET):
implicitly converting 'msgfmt executable.' to 'STRING' type.
Call Stack (most recent call first):
src/libi18n/CMakeLists.txt:9 (CHECK_GETTEXT)
This warning is for project developers. Use -Wno-dev to suppress it.
Caja is a fork of Nautilus 2.x, so everything's basically the same
as the GNOME extension, but with a different prefix.
Note that as of MATE 1.18.0, GTK+ 3.x is used, not 2.x. We're only
supporting GTK+ 3.x for MATE Desktop.
N.B.: Caja is a fork of Nautilus *2.x*, not *3.x*. The extension
interface doesn't seem to have changed, though.
Since the only real changes are names, the mate extension is handled
similarly to xfce3. The subdirectory has a CMakeLists file and defines
an RP_UI_GTK3_MATE macro, but it references the files in the gnome
directory.
gnome: Define RP_UI_GTK3_GNOME to distinguish between the two.
RomDataView: MATE uses the same settings as GNOME.
NOTE: We can't set up the MATE Debian configuration right now, since
Ubuntu 16.04 has a GTK+ 2.x version of MATE. I might set up a separate
"later-debian" directory with the updated files, though.
TODO:
- Both GNOME and MATE use /usr/share/thumbnailers, so the thumbnailer
file needs to be moved to a common package.
- Caja has an "About Extension" button. Implement this.
- Check Nautilus and other file browsers?
- Make sure all relevant MIME types are added to the XDG service files.
Caja *requires* the proper MIME types to be added, or else it won't
thumbnail the files.
If nautilus-extension.h is present, use it. Otherwise, use the file
from libnautilus-extension/ directly.
FindLibNautilusExtension: s/ThunarX2/libnautilus-extension/g
This uses Kreon drive firmware commands to unlock Xbox disc
reading commands.
rpcli on Linux can now list Xbox discs directly, though the
required ioctl is blocked if not running as root.
FIXME: The Windows build is probably broken right now.
This is a stripped-down version of libmspack containing only the necessary
functionality for Xbox 360 executables.
Xenia commit: e706cf0d5413c31b7e80a50411cc88cc7c71af30
License: LGPLv2.1
config.h.in: Modified for cmake; removed unnecessary checks.
debian/copyright: Added copyright information.
cmake/options.cmake: Added an ENABLE_LIBMSPACK option. (default is ON)
FindOpenGL.cmake doesn't set OPENGL_INCLUDE_DIR on Windows, but it does
set OPENGL_gl_LIBRARY.
For OpenGL preference: We're only using the GL headers, not the
libraries. cmake-3.11 added an option to switch between Legacy and
GLVND, and if the option isn't set, a warning is printed.
This will be used to show a UAC shield on Nintendo 3DS ROM images (and
later Nintendo Switch ROM images) that have "dangerous" permissions set.
Currently, it's set to show on *all* files, not just the relevant ones.
[cmake] win32.cmake: Increased the SDK version to Windows Vista (0x0600)
in order to use SHGetStockIconInfo() and related definitions.
TODO:
- Add a function to RomData to check if the file has "dangerous"
permissions set. (default will be no)
- Add a fallback for Windows XP, which does support overlay icons,
but is missing the following:
- UAC shield icon
- SHGetStockIconInfo()
Subclasses no longer have to implement the full readBlock() function.
Instead, they can implement getPhysBlockAddr(), which returns the
starting address of the specified physical block address.
Implemented readBlock() in SparseDiscReader. If a subclass doesn't
implement readBlock(), the default one will be used, which calls the
getPhysBlockAddr() function.
Updated all SparseDiscReader subclasses to use getPhysBlockAddr()
instead of readBlock(), *except* for GdiReader, which has to implement
its own readBlock() function because each track is stored in a separate
file.
This fixes issue #144: SparseDiscReader: Change readBlock() to
getBlockStart() or similar.
TODO: Test all affected formats before merging. 2352-byte CD images
and GDI images have been tested, but CISO, WBFS, and WUX have not.
This will be used to decompress Atari ST SNDH files.
Note that unice68 is GPLv3, so there's a compile-time option to
disable it.
TODO: Make it a DLL/SO instead and use dlopen().
[libromdata/tests] GcnFstTest: Copy/paste error caused i18n to be
linked to GcnFstPrint (twice) instead of GcnFstTest.
[win32] Added the TinyXML2 include directory.
[libromdata] Likewise. (though it probably isn't needed...)
[cmake] CheckTinyXML2.cmake: Set TINYXML2_INCLUDE_DIR if using the
internal copy.
https://github.com/nmoinvaz/minizip
[extlib] CMakeLists.txt: Disabled MiniZip compression. We're currently
only using it for decompression, so there's no need to build the
compression code, which wastes time and disk space.
All of the code is basically the same as xfce2, but the library
dependencies have changed.
- FindThunarX3.cmake: Find the GTK+ 3.x version of ThunarX.
- xfce3/CMakeLists.txt is a clone of xfce/CMakeLists.txt. It references
all of the sources from the xfce/ directory.
- Thunar 1.8.0 doesn't change the formatting in the properties dialog,
so RP_DFT_XFCE is kept as-is.
- #undef GTK_DISABLE_DEPRECATED in a few places because thunar-renamer.h
uses GtkVBox, which is deprecated in GTK+ 3.x.
- doc/COMPILING.md: Added rom-properties-xfce3.
TODO: Add a Debian package once it's added to the repository.
Starting with GTK+ 3.10, GtkImage provides a function to set its image
from a Cairo surface. Cairo uses the same ARGB32 pixel format as
rp_image, so using a Cairo surface instead of a GdkPixbuf eliminates the
need to swap the R and B channels.
Consequently, there is no SSSE3 code for CairoImageConv, since we're
just doing a plain old memcpy().
PIMGTYPE.hpp: New header with a typedef PIMGTYPE, which is either
GdkPixbuf* or cairo_surface_t*, depending on GTK+ version. Also defines
RP_GTK_USE_CAIRO if using Cairo, and has wrapper functions for PIMGTYPE.
Updated CreateThumbnail and RomDataView to use PIMGTYPE where applicable.
TODO: CreateThumbnailPrivate::rescaleImgClass() is not currently
implemented for Cairo.
We need to check CMAKE_CL_64, not just ${CMAKE_SYSTEM_PROCESSOR}, since
that variable indicates the host system, which is always 64-bit
regardless of the target architecture.
This fixes the 32-bit rp-config.exe. (rom-properties.dll didn't load
comctl32.dll due to the incorrect manifest, resulting in KeyManagerTab
crashing because GetModuleHandle(L"COMCTL32") returned nullptr.)
cmake/options.cmake: Unset QT_SELECT initially.
Set QT_SELECT in each individual directory based on the required version.
For libunixcommon, set it, call the required program, then unset it.
This should fix all of the issues:
- Qt4: If set to 5, qmake would fail to detect Qt/X11.
- Qt5: If set to 4, the plugin path was wrong.
This caused byteswapping tests to fail, and ImageDecoderLinearTest and
ImageDecoderTest both crashed.
It seems the IFUNC resolver function *was* being called, but the returned
function pointer wasn't. I'm not sure why.
This fixes tests on Xubuntu 16.04.
TODO: Test on gcc6.
C4024: 'function': different types for formal and actual parameter n
C4047: 'function': 'parameter' differs in levels of indirection from 'argument'
NOTE: /sdl doesn't do this.
The gettext libraries and executables were built on Ubuntu 18.04 using
MinGW-w64 with gcc-7.3.0.
iconv support has been disabled for the runtime, but it's still needed
for some of the build executables. For that, we're using win-iconv, which
is an iconv wrapper that uses the Windows API. [1]
In addition, several patches from the official MinGW package repository
were applied to gettext-0.19.8.1 in order to get it to build correctly
for Windows. [2]
TODO:
- Test packaging to ensure the correct DLL is packaged.
- Test bindtextdomain() to determine if it supports Unicode. If it
doesn't, then another patch will be needed.
[1] https://github.com/win-iconv/win-iconv
[2] https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-gettext
The default value is AUTO. If set to ON, CMake will fail if the
required packages are missing.
NOTE: OPTION() only supports BOOL. Use SET() and SET_PROPERTY() for
tristate support.
- Reference: https://cmake.org/pipermail/cmake/2016-October/064342.html
NOTE 2: libunixcommon still searches for the packages unconditionally
because it's used for rp-stub's search path.
Based on some of the code by @DankRank in issue #119.
(Use templates instead of including 30 nearly-identical files in
RomDataFactory)
Removed CheckCXX11LambdaAsFunctionPointer.cmake, since this functionality
was only ever used in RomDataFactory.
TODO: Initialize in the DLL and/or EXE entry point.
TODO: Search the DLL directories on Windows.
Added ENABLE_NLS. (defaults to OFF on Windows for now)
Thread-safe static initialization requires Vista or later, since XP
doesn't have enough TLS slots.
NOTE: We need to make sure that we use pthread_once() for one-time init
instead of using a static initializer.
NOTE: We're not linking to TinyXML2::tinyxml2 in libromdata because this
target only exists if it's found as a system library. Maybe we should
create it for the extlib version as well...
This allows the images to be decoded, but with lower quality.
Removed ENABLE_S3TC checks from all files except ImageDecoder_S3TC.cpp.
Unconditionally compile ImageDecoder_S3TC.cpp.
Ubuntu 17.04's gcc doesn't seem to handle LTO properly for some reason.
It crashes when compiling Qt5 automoc files.
- gcc: 6.3.0-12ubuntu2
- qtbase5-dev-tools: 5.7.1+dfsg-2ubuntu4~1
Mostly based on xfce's tumbler:
https://github.com/xfce-mirror/tumbler
Instead of exporting the RpThumbnail object directly, a skeleton object
created using gdbus-codegen is exported. The server-side object has
signals that map to the D-Bus methods.
RpThumbnail no longer has signals that map directly to the D-Bus object.
Instead, it calls functions in the skeleton object, which export the
signals.
Unfortunately, the file size has increased a bit. (TODO measure file
sizes in debug and release.)
FindGLib2.cmake: We need gio-unix for the gdbus-codegen generated files.
Import it in GLib2::glib so we don't have to link to it manually in the
rp-thumbnail-dbus project. (TODO: Make this a GIO library target instead
when doing the main commit)
TODO:
- Split the RpThumbnail object from the main code.
- Move rp-thumbnail-dbus out of the xfce directory?
Release build sizes: (MSVC 2017)
- rom-properties.dll: 655,360 -> 676,864 (+21,504 bytes)
- rpcli.exe: 480,768 -> 496,128 (+15,360 bytes)
It's not that much overhead, so I'll keep it enabled for all builds.
The manifest files are now .in files. They have replacement tags for
the `version` and `processorArchitecture` fields, which are filled in
by CMake's CONFIGURE_FILE() at configure time.
This will ensure that I don't forget to update the manifest version
numbers before release (which I did for rpcli in v1.0).
[cmake] win32.cmake: Set WIN32_MANIFEST_PROCESSOR_ARCHITECTURE to the
correct value for the manifest's `processorArchitecture` field.
Reference: https://opensource.apple.com/source/Libc/Libc-1044.1.2/string/FreeBSD/memmem.c
[cmake] gcc.cmake: -D_GNU_SOURCE=1 is required for memmem().
Interestingly, it seems to work fine in C++ code without this, but it
doesn't work in C code, and cmake compiles as C when checking for the
existence of memmem(). (CheckSymbolExists)
FIXME: Running CMake with -DENABLE_LTO=ON, then -DENABLE_LTO=OFF
doesn't seem to work right... (The flags aren't removed properly.)
[Kubuntu 17.04, cmake-3.7.2]
- _crt: If "static", use the static CRT. Otherwise, use the DLL CRT.
- Other parameters for specifying the configuration. If not specified,
applies to all configurations.
[svrplus] Only use the static CRT in the various Release builds.
TODO: We aren't using MinSizeRel or RelWithDebInfo right now.
Maybe we should...
Rebased CMakeLists.txt on the original TinyXML2 CMakeLists.txt,
but with lots of stuff disabled and some changes.
- Disable installation of everything except the DLL.
- Disable testing.
- Set TINYXML2_IMPORT as an interface definition when building
as a DLL.
- Remove TINYXML2_EXPORT in the static library build, which didn't
work anyway due to a typo.
- Added a debug postfix for debug DLLs.
- Disabled MSVC configuration that's alread yset in the platform
configuration.
- Added other MSVC options, including split debug settings.
- win32-gcc.cmake: Enable the "secure" API functions: *_s()
- FIXME: May not work on XP with MinGW's implementation, since it
uses MSVCRT.DLL.
- c99-compat.msvcrt.h: Don't redefine some functions on MinGW,
since gcc complains about missing dllimport attributes It also
causes problems with C++ namespace imports.
C4013 occurs in C code if an undefined function is referenced. This is
technically not an error in C, but it is in C++, so I'm forcing it to
be an error in order to prevent linker errors later on.
TinyXML2 will be used to parse Windows manifests.
The Ubuntu 17.04 64-bit dynamic library build is around 83 KB, so
this won't add too much to the executable size.
TODO:
- Use the system TinyXML2 if available.
- Compile as a DLL? (with delay loading on Windows, maybe)
CMakeLists.txt: Use the top-level CMake directories.
cmake/platform/win32*.cmake: Define the Windows SDK version in
win32.cmake. Use the same version (Windows XP) regardless of
the target operating system in order to keep everything consistent.
[libpng] CMakeLists.txt: Fix MSVC debug paths for png_static.
There were several issues caused by travis-ci using cmake-3.2.2
instead of what I have locally, cmake-3.7.2:
- FIND_PACKAGE(PkgConfig) sets PKG_CONFIG_FOUND, not PkgConfig_FOUND.
- Set cache internal variables instead of parent scope. (Probably not
needed, but it's a good idea.)
- Older PkgConfig CMake modules don't support PKG_GET_VARIABLE(), so use
defaults for Nautilus and Thunar extension directories in that case.
- Added diagnostic messages for older PkgConfig.
- Print the cmake version in travis-ci.
Squashed commit of the bugfix/travis-ci-gtk branch.
- Always use Windows XP (0x0501) for the SDK OS version.
- Check CMAKE_CL_64 for 64-bit MSVC.
- Use subsystem 5.02 (2003) for 64-bit and 5.01 (XP) for 32-bit.
MinGW-w64 only links in libssp if a function needs stack protection.
Since my toolchain doesn't have libssp enabled, this results in the
previous check passing (-fstack-protector-strong with a nearly empty
test program does nothing), but other tests end up failing because
libssp isn't available.
Use a test program with varargs, based on the C99 vsnprintf() wrapper
for older versions of MSVC.
Using MinGW-w64 4.0.6 with gcc-6.2.0.
Note that it still doesn't compile successfully due to missing
functionality in MinGW-w64 4.0.6. I'll try it again with 5.0.1 later.
Note that MinGW-w64 5.0.1 is still missing isolation-aware functionality,
so it won't be able to handle XP theming correctly.
Summary of changes:
- cmake/platform.cmake: MinGW-w64 uses separate crt*.o files for Unicode
instead of a separate entry point. Handle this by removing the "w" from
the Unicode entry point and passing the "-municode" option instead.
- libpng, rpcli, win32: CMake-3.7.2 doesn't add include paths to windres.
Add the include paths manually in order to fix .rc compilation.
- c++11-compat.h: Moved the case-insensitive string comparison macros
from c++11-compat.msvc.h. MinGW-w64 doesn't have the wcs*() functions,
but it does have macros for str*(), so we have to define the macros
only if said macros don't already exist.
- [libcachemgr] CacheManager: gettimeofday() is in time.h on MSVC,
and sys/time.h on MinGW-w64 and other platforms. sys/types.h is
no longer needed.
libromdata:
- RpWin32.cpp: Added more conditionals to the error list in order to
fix compilation with MinGW-w64.
- RpWin32.hpp: Use reinterpret_cast<> for the atomic memory access
functions.
rpcli:
- time_r.h: #define _POSIX_C_SOURCE is required on MinGW-w64 in order
to use the *_r() functions.
- properties.cpp: #include "time_r.h" earlier to prevent time.h from
being included before _POSIX_C_SOURCE is defined.
win32:
- QITab.h: Split the QISearch() defines out of RP_ComBase.h and added
definitions that are missing on MinGW-w64.
- Added an extra '0' in QITAB instances in order to suppress gcc's
"missing initializer" warning. [-Wmissing-field-initializers]
- Moved all COM smart pointers to the top of the file. Disabled some of
them in MSVC builds because they're already defined in comdefsp.h.
- rom-properties.def: Removed the comment and "LIBRARY" statement, since
GNU ld doesn't recognize them.
This partially fixes#50. (Add support for multiple image sizes.)
Multiple image sizes are now supported for external image databases, but
not for internal images. This will need to be added for EXE icons, and
possibly also Nintendo 3DS icons (48x48 and 24x24).
The internal version of libjpeg-turbo currently only builds on Windows.
(The bundled CMakeLists.txt is Windows only.)
All example and demo executables have been disabled, and the autoconf
build system has been removed. The only target that builds now is
jpeg62.dll.
Currently supports RGB, YCbCr, and grayscale images. (YCbCr is handled
using libjpeg's built-in colorspace conversion.)
NOTE: libjpeg's RGB support outputs 24-bit RGB, so we have to manually
expand it to 32-bit ARGB with an opaque alpha channel.
Tested with Nintendo DS cover art and it works:
- ASME (Super Mario 64 DS) (RGB)
- BXSE (Sonic Colors) (YCbCr)
I manually converted the images to grayscale and those worked as well.
TODO: CMYK/YCCK. (libjpeg has automatic YCCK->CMYK colorspace conversion,
but not CMYK->RGB.)
[cmake] Added libjpeg detection and options.
TODO:
- Add an internal copy of libjpeg-turbo.
- Make libjpeg support optional?
This is needed because the entry point must be specified manually when
building with MinGW with ASLR enabled.
The entry point should be wmain for Unicode console applications,
so we need to specify wmainCRTStartup instead of mainCRTStartup.
[rpcli] SET_WINDOWS_ENTRYPOINT(rpcli wmain)
Supported by MSVC 2005, MinGW-w64, 64-bit glibc, and 64-bit Mac OS X.
glibc is working on adding 64-bit time_t for 32-bit software.
Support for that has been added using -D_TIME_BITS=64.
32-bit Mac OS X doesn't, and won't, support 64-bit time_t.
References:
- https://lwn.net/Articles/715242/
- https://sourceware.org/glibc/wiki/Y2038ProofnessDesign