msvc.cmake: Specify MASM flags "/W0 /safeseh". This fixes the 32-bit masm
build when using MSBUILD with MSVC 2015. 64-bit wasn't affected, though
we're setting it for all MSVC platforms.
The rp_image_backend for GDI+ hasn't been implemented yet, but it's good
enough to merge back into master.
This fixes:
- #3: Use pngcheck to verify downloaded PNG images.
This partially fixes:
- #4: rp_image subclasses with factory class
Conflicts:
cmake/platform/gcc.cmake
cmake/platform/msvc.cmake
src/libromdata/CMakeLists.txt
src/libromdata/file/IRpFile.hpp
We're going to use dynamic_cast<> for rp_image_backend, so RTTI needs
to be enabled. Otherwise, things will go haywire at runtime.
Also, removed the commented-out RTTI lines from gcc.cmake, since we're
not going to be reenabling it. (It was disabled for gcc builds because
KDE's thumbnail.so uses it for ThumbCreator subclasses.)
This fixes#7.
Five days of work, two encryption libraries, and a ton of custom formats,
all for a single field in the GameCube properties page. \o/
[libromdata/tests] CMakeLists.txt: Change ${GTEST_LIBRARY} to gtest.
This was done upstream, but AesCipherTest was still using the variable,
which no longer exists.
Conflicts:
src/libromdata/GameCube.cpp
src/libromdata/tests/CMakeLists.txt
libromdata/tests/CMakeLists.txt:
- Link to gtest directly instead of ${GTEST_LIBRARY}.
- Removed INCLUDE_DIRECTORIES() for googletest, since it's added to
TARGET_INCLUDE_DIRECTORIES() by googletest's CMakeLists.txt.
extlib/googletest/googletest/CMakeLists.txt:
- Uncommented gtest_hide_internal_symbols.
Removed cmake/gtest.cmake, since it doesn't have anything useful other
than INCLUDE(CTest), which is now present in the top-level CMakeLists.txt.
MSVC 2002 introduced the /GS flag, and it's enabled by default as of
MSVC 2005. Added a check for 2002/2003, even though those versions
definitely aren't supported.
gcc added -fstack-protector and -fstack-protector-all in gcc-4.1,
and -fstack-protector-strong in gcc-4.9. Prefer strong if it's available,
then fall back to -fstack-protector-all then -fstack-protector if
strong isn't available.
FIXME: Add support for the older nettle-2.x API, since Ubuntu 14.04
still has nettle-2.7.1.
cmake/modules/FindNettle.cmake: CMake module to find Nettle.
Reference: 9fe71b1d77/cmake/FindNettle.cmake
FIXME: If ENABLE_DECRYPTION is enabled, and Nettle can't be found,
the build will fail. Maybe show a message advising the user to
set -DENABLE_DECRYPTION=0?
crypto/AesCipher.hpp: New interface for AES ciphers.
crypto/AesCipher_CAPI.cpp: Windows CAPI implementation.
Currently supports ECB and CBC chaining modes.
GameCube: Create a WiiPartition object for the update partition.
This isn't currently used, but it will eventually be used to determine
the System Update version, if the update partition is present.
config.libromdata.h.in: Added #define ENABLE_DECRYPTION 1.
gcn_structs.h: Added Wii ticket and partition header structs.
Also added a uint34_rshift2_t typedef for values that are actually
34-bit but stored as a uint32_t, since the lower 2 bits aren't
significant.
cmake/platform/win32-*.cmake: Increase the minimum Windows version to
5.01 (Windows XP), since the AES provider was added in XP.
WiiPartition TODO:
- Share the AesCipher objects with a reference counter.
- Don't initialize AesCipher in the constructor, since we might
only want the partition header information.
AesCipher_CAPI TODO:
- Share the HCRYPTPROV with reference counting.
This class will be used to load encryption keys from the keys.conf file
in the user's configuration directory.
options.cmake: Added an option ENABLE_DECRYPTION. This is enabled by
default; if disabled, KeyManager won't be built, and decryption won't
be available for newer ROM and disc images that are either fully
encrypted or have encrypted sections.
platform.cmake: Call CHECK_LARGE_FILE_SUPPORT(). Note that LFS is
required due to the size of Wii disc images, so if LFS isn't
available, CMake will fail with an error message.
c99-compat.msvcrt.h: #define fseeko() and ftello() to the MSVC
non-standard _fseeki64() and _ftelli64() functions. This was in
Gens/GS II's libcompat/W32U, but I'm not using W32U here.
RpFile_stdio.cpp: Use fseeko() and ftello().
This fixes issue #2.
In addition to reworking RpImage to use libpng and/or GDI+ directly,
this branch adds AppVeyor support for Windows CI. This required
fixing the build system to work with CMake's Visual Studio project
generator, which uses msbuild instead of nmake.
Conflicts:
.travis.yml
CMakeLists.txt
This adds "/MANIFEST:NO" to an individual target. This allows us to use
MSVC's automatic manifest generation for unit tests, while also enabling
custom manifests for the actual rom-properties.dll project.
msvc.cmake: Removed "/MANIFEST:NO" from the default CFLAGS.
[win32] CMakeLists.txt: Use SET_WINDOWS_NO_MANIFEST().
Only CL explicitly requires /nologo to be lowercase. The rest of them
are supported better by CMake if they're uppercase.
CMake's MSBUILD generator was already adding /NOLOGO to RC, so adding
it again caused RC to go crazy and think that we specified "-ologo".
Also disabled /NOLOGO for MASM, just in case.
With nmake, CMake's default /SUBSYSTEM is added after our linker flags.
With msbuild, it's added before, which caused console programs like
RpImageLoaderTest to be linked as /SUBSYSTEM:WINDOWS, which failed
due to no WinMain() function.
AppVeyor, a Windows-based CI service, mostly (only?) works with
msbuild instead of nmake, so I need to get everything working.
TODO: /MANIFEST:NO is causing problems with programs that don't have
a manifest resource (RpImageLoaderTest), and RC isn't accepting the
-nologo option for some reason.
Notable changes:
- win32-msvc.cmake: Set RP_LINKER_FLAGS_${_subsystem}_EXE. This variable
is used by a new function to add to target-specific LINK_FLAGS.
- platform.cmake: New function SET_WINDOWS_SUBSYSTEM. This adds the
relevant linker flags. Note that it's only used for MSVC.
- Added SET_WINDOWS_SUBSYSTEM() to all EXE and DLL projects. Note that
the WIN32 flag is not available in ADD_LIBRARY(), so we're not setting
it for the Win32 rom-properties.dll.
- [win32] Append to the target LINK_FLAGS instead of resetting it.
Otherwise, we lose the /SUBSYSTEM flag.
The reason why this didn't work before is because generator expressions
are unknown at configure time; they're expanded when compiling.
Hence, attempting to split pathname components didn't work.
We can use the generator expression TARGET_FILE_DIR to get the target's
directory instead of manually splitting pathname components. This should
work on CMake 2.8.x, and it gets rid of policy CMP0026 warnings on
CMake 3.0 and later.
Removed the manual CFLAG testing from platform/gcc.cmake.
Other required changes:
- Removed CMAKE_MINIMUM_REQUIRED() from everything except the
top-level CMakeLists.txt. This interfered with setting the
CMake policy, since each invocation reset the policies to
match the specified minimum version.
- Added NO_POLICY_SCOPE to the cmake/platform.cmake include
in order to allow policy changes within platform.cmake to
propagate to the rest of the project.
This is only needed when enabling ASLR on EXEs due to a bug in GNU ld.
DLLs are always compiled with relocation information, and they don't
have an entry point in the sense of an EXE entry point.
Older MinGW (gcc-4.5.2) now mostly compiles rom-properties.dll, but its
w32api implementation is missing lots of stuff, including IExtractImage.
Changes:
- CheckCXX11CompilerFlag.cmake: Check for static_assert(), not nullptr.
nullptr was added in gcc-4.6, while static_assert() was added in
gcc-4.3.
- stdafx.h: Removed #include <comdef.h>. This header provides some
COM utility classes that we aren't using.
- uvector.h: Added checks for gcc functionality.
- [libromdata] #include <stdlib.h> for free().
We're linking the DLLs and SOs as "MODULE", since they're always loaded
as plugins instead of directly linked into applications. Hence, we need
to set CMAKE_MODULE_LINKER_FLAGS in order to get linker flags to apply
to the modules.
This fixes an issue where "/manifest:no" wasn't being passed to MSVC's
linker, which caused a conflict when adding an isolation-aware manifest
file in order to properly support theming on Windows XP: (MSVC 2010)
CVTRES : fatal error CVT1100: duplicate resource. type:MANIFEST, name:2, language:0x0409
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
LINK Pass 1 failed. with 1105
RP_ComBase.hpp: MinGW-w64 does actually provide overloads for the atomic
functions, but only if _WIN32_WINNT >= 0x0502, which is set in the 64-bit
version but not the 32-bit version. Disable our overloads for the 32-bit
build, since we're still supporting 32-bit XP (0x0501).
Added file header comments to RP_ComBase.hpp and RP_ClassFactory.hpp.
KDE's kio_thumbnail.so uses RTTI for ThumbCreator, since that isn't
a QObject. Disabling RTTI completely breaks thumbnailing.
I'm leaving RTTI disabled in the MSVC build for now, since the Windows
equivalent uses COM, not RTTI.
The disc header is read, and some basic information is displayed.
The company code is decoded and looked up using a hard-coded list
of company codes from GameTDB:
- http://www.gametdb.com/Wii
- http://www.gametdb.com/Wii/Downloads
gcc.cmake: Added -Wno-multichar, since I'm using multi-character
constants in NintendoPublishers::ms_thirdPartyList[].
- options.cmake, src/CMakeLists.txt: Only attempt to build the
KDE4 and KDE5 plugins on Unix/Linux systems.
- TextFuncs:
- Fixed various wchar_t/char16_t issues.
- Implemented cp1252 fallback for Windows in cp1252_sjis_to_rp_string().
The W32U_mbs_to_UTF16() function now has a dwFlags parameter, which
is used by cp1252_sjis_to_rp_string() to ensure it fails if the string
contains invalid Shift-JIS sequences. (MB_ERR_INVALID_CHARS)
- Renamed 'n' variables to 'len'.
Split RomPropertiesDialogPluginFactory into separate files. Note that
separate files are needed for KDE4 and KDE5 due to changes in automoc.
automoc4 complains if it has an #include for .moc, whereas automoc5
doesn't recognize that K_PLUGIN_FACTORY() has a Q_OBJECT macro, so it
fails to link due to undefined references to a vtable.
cmake/options.cmake: Added BUILD_KDE4 and BUILD_KDE5 options.
Both default to ON, but if the dependencies are missing, then their
respective plugins won't be built.
KDE4_ADD_PLUGIN() builds the library in build/lib/ instead of
build/src/kde/, so objcopy couldn't find the .debug file.
Note that objcopy only embeds the filename portion, not the full path,
so this won't cause any problems when debugging.
Minor change in SplitDebugInformation to handle CMake linking the
shared library in build/lib/ instead of build/src/kde/.
Added options for SPLIT_DEBUG and INSTALL_DEBUG, though INSTALL_DEBUG
isn't currently used.
Some stuff was stripped out, including support for ANSI Windows.
The minimum version I'm officially going to support once I add
Windows support is XP, though 2000 might "just work".