This commit adds support for compiling Dolphin for ARM on MacOS so that it can
run natively on the M1 processors without running through Rosseta2 emulation
providing a 30-50% performance speedup and less hitches from Rosseta2.
It consists of several key changes:
- Adding support for W^X allocation(MAP_JIT) for the ARM JIT
- Adding the machine context and config info to identify the M1 processor
- Additions to the build system and docs to support building universal binaries
- Adding code signing entitlements to access the MAP_JIT functionality
- Updating the MoltenVK libvulkan.dylib to a newer version with M1 support
Because we have an old-style find script that does not define a proper
CMake target for libusb, we need to use ${LIBUSB_LIBRARIES}
rather than "usb".
Ideally, we would fix the find script to define a target. However,
this issue breaks the fifoci-ogl-lin-mesa builder and I'd prefer it
to be fixed sooner rather than later.
On clang-11 build failed as:
```
[ 42%] Building CXX object Source/Core/Core/CMakeFiles/core.dir/PowerPC/Jit64/Jit.cpp.o
In file included from ../../../../Source/Core/Core/PowerPC/Jit64/Jit.cpp:5:
In file included from ../../../../Source/Core/Core/PowerPC/Jit64/Jit.h:21:
../../../../Externals/rangeset/include/rangeset/rangesizeset.h:325:3: error: unknown type name 'size_t'; did you mean 'std::size_t'?
size_t size() const {
^
```
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
/Externals/liblzma/config.h #defines HAVE_PTHREAD_CONDATTR_SETCLOCK
which results in /Externals/liblzma/tuklib/mythread.h calling the
function pthread_condattr_setclock. This function doesn't exist in
macOS 10.12+, which are the only macOS versions Dolphin supports, but
inserting an include guard makes macOS use an alternate function.
On Linux, if shared zlib is present, zlib.h is always available and -lz
links to zlib, even if you don't run find_package(ZLIB).
For some reason I have zlib installed on Windows (possibly from vcpkg),
so find_package(ZLIB) succeeds and ZLIB_FOUND is true.
When Dolphin uses shared zlib on Windows, the problem is that zlib.h
is not in the default include path, and the CMake target is called
ZLIB::ZLIB and there's neither a target nor a library called z.
However, both find_package(ZLIB) and add_subdirectory(Externals/zlib)
create a target called ZLIB::ZLIB, so I'll switch to that instead.
Hopefully this change doesn't break anyone's build.
This updates glslang to commit 4fc7a33910fb8e40b970d160e1b38ab3f67fe0f3
which is the current version listed in the known_good.json file for the
version 1.2.131.2 of the Vulkan-ValidationLayers repo.
Allows us to migrate off of printf specifiers and have more type-safe
formatting facilities. It also allows for custom type support as well.
fmt is also on track to have part of it standardized within C++2a, so
this will also lessen the transitional work necessary later on by
allowing new code to use it.
This simply adds the library but doesn't do anything with it yet.
On a few of our buildbot instances, we get warnings about the usage of
deprecated functions. We should correct these, especially if we're
delegating to system versions of the libraries if they're available.
However, in order to do that, we need to update our library variant from
2.1.1 so that the non-deprecated alternatives are actually available.
The CMakeLists file for the static zlib checks for presence of
unistd.h, but it doesn't properly define HAVE_UNISTD_H if it's found.
This change adds the necessary preprocessor definition if unistd.h is
found.
Upstream zlib handles this with by configuring zconf.h with CMake:
cacf7f1d4e/zconf.h.cmakein (L11)
Dolphin's static version of zlib doesn't do this, which is why setting
Z_HAVE_UNISTD_H in zlib's CMakeLists.txt isn't enough.
This probably wasn't noticed since because most *nix systems will use
the shared zlib. Force use of the static zlib (comment out
find_package(ZLIB) in the root CMakeLists.txt) and you'll see implicit
function declaration warnings during its compilation.
In some cases, this is required to avoid eventually getting a
USBD_STATUS_BAD_START_FRAME error back from the Windows USB stack.
This makes the libusbK code match the behaviour of the Linux backend.
It appears that the libusbK backend tried to get this behaviour by
setting StartFrame to 0. However, libusbK docs state that:
"Specifing 0 for KISO_CONTEXT::StartFrame (start transfer ASAP) is
restricted to the first transaction on a newly opened or reset pipe."
It's annoying to have source files automatically reformatted every time
Dolphin is built because it causes git to consider the source tree to
be dirty.
We already use a custom CMakeLists file for xxhash, so we can just make it's headers
public as part of its target interface.
This way, only libraries that link in the xxhash target will see its headers, as opposed
to every target under the top-level directory.
IsDeviceUsable in IOhidapi.cpp uses errno to detect if hid_write failed because of an unconnected Wiimote on a Dolphinbar (it expects errno == EPIPE in this case).
macOS’s implementation of hid_write detected this specific error (IOHIDDeviceSetReport returns kUSBHostReturnPipeStalled) but didn’t set errno so the check failed.
This add errno assignment to failure cases of macOS’s hid_write.
If available, use the system-generated unique ID for HID device paths instead of a transport/vid/pid/location tuple.
The Mayflash Dolphinbar registers four HID devices (regardless of the number of connected Wiimotes) which had the same path with the previous path building method, causing a bit of confusion when detecting and connecting to Wiimotes.
The unique IDs do not change if the computer is suspended and resumed, but do change if the HID device is unplugged/replugged.
A bunch of changes, looks mainly like bug fixes and code cleanup.
Notable changes:
- `cubeb_get_min_latency`'s signature was changed to take params via
pointer, requiring Dolphin code to be tweaked in two places.
- A fix for kinetiknz/cubeb#320, as reported by @shuffle2
- Fixed build on FreeBSD (kinetiknz/cubeb#344), as contributed by @endrift
* -Wno-unused-but-set-variable: only set this flag with gcc, otherwise
clang will issue warnings about the warning option being unknown :)
(-Wunknown-warning-option)
* -Wmissing-variable-declarations: clang warns about missing extern
declarations for non-static variables.
The latest version has tons of security fixes (which is expected for a
library such as mbedtls).
Updating also allows getting rid of a few deprecation warnings.
Check UsbDK availability at run time and activate UsbDk backend when
possible.
Fall back to current behavior when UsbDK not installed.
Signed-off-by: Dmitry Fleytman <dfleytma@...>
Signed-off-by: Sameeh Jubran <sameeh@...>
The usbdk backend is the only libusb backend that has official support
for isochronous transfers (which are required for Wii Speak,
microphones and cameras). And it's actively developed and maintained.
Compilers are very picky and don't use PCH when they have been compiled
with different flags. I even got some ICE in MSVC, so removing them for now.
Modules are the solution.
- The `PA_USE_{ASIO,WMME,...}` macros are no longer used, instead do
feature selection by compiling only the backends wanted.
- The `PA_WDMKS_NO_KSGUID_LIB` macro has been obviated along with the
link to ksguid.lib.
When on Linux and using libusb from Externals, and with libudev
available, an "undefined reference" error message appears at link time.
This is due to a wrong define being set in CMake for libusb with
libudev. This causes the code for netlink being used instead of the
correct code for libudev support.
Fix the issue by setting the correct define so the correct libusb code
is used.
1.0.21 adds a usbdk backend, which may be helpful as it could be
used in the future to work around the missing isochronous transfer
support for WinUSB backends.
Here is the full changelog (from libusb).
2016-10-01: v1.0.21:
* Core: Refactor code related to transfer flags and timeout handling
* Darwin: Ignore root hub simulation devices
* Darwin: Improved support for OS X El Capitan
* Darwin: Work around devices with buggy endpoint descriptors
* Darwin: Do not use objc_registerThreadWithCollector after its deprecation
* Darwin: Use C11 atomics on 10.12+ as the OS atomics are now deprecated
* Linux: Support preallocating kernel memory for zerocopy USB
* Linux: Deal with receiving POLLERR before all transfers have completed
* Solaris: Add solaris backend
* Windows: Add Visual Studio 2015 support
* Windows: Add usbdk backend
* Prevent attempts to recursively handle events
* Fix race condition in handle_timeout()
* Allow transferred argument to be optional in bulk APIs
* Various other bug fixes and improvements
This applies a patch that was merged into the mainline wxWidgets tree to
support label changing with wxToolBar. This originally only worked on
Windows and macOS, which is kind of annoying.
This is beneficial because it means that a tool doesn't have to be removed
and then reinserted into a wxToolBar instance in order to change the
label.
For more details, see ticket #17567 on the wxWidgets issue tracker.
On macOS, wxWidget’s tooltip.mm tries to include a system header with an improper capitalization (Appkit instead of AppKit), which causes the build to fail if the system headers are located on a case-sensitive filesystem.
Based on ca0c2efe7a. Credits go to flacs.
However, unlike the original commit, hidapi does not completely replace
the current implementations, so we can still connect Wiimotes with 1+2
(without pairing).
Also, it is only used on Linux and OS X for now. This removes the
advantage of having only one implementation but there is no other
choice: using hidapi on Windows is currently impossible because
hid_write() is implemented in a way that won't work with Wiimotes.
Additionally:
* We now check for the device name in addition to the PID/VID so we can
support the Balance Board and maybe third-party Wiimotes too. This
doesn't achieve anything with the DolphinBar but it does with hidraw.
* Added a check to not connect to the same device more than once.
This removes a Dolphin-specific patch to the wxWidgets3 code
for the following reasons:
* Calling wxWindowGTK::DoSetSize on a top-level window can end up
calling wxTopLevelWindowGTK::DoMoveWindow, which triggers an assert
because it is not supposed to be called for a top-level wxWindow.
* We should not be patching the wxWidgets code because that means the
toolbars will still be broken if someone builds without using the
WX that is in our Externals.
Instead, we now use a derived class for wxAuiToolBar and override
DoSetSize() to remove the problematic behaviour to get the same effect
(fixing toolbars) but without changing Externals code and without
causing asserts and other issues.
Dolphin no longer lowers itself below the top window when opening.
Dolphin no longer draws garbage lines all over the game list.
Use the correct platform macros so Dolphin can actually find the
translation catalogs on Unix.