From 3e8fe622a7d1dc8ff9d3a34d975b556b8fd35a94 Mon Sep 17 00:00:00 2001 From: lizzie Date: Fri, 17 Oct 2025 22:12:58 +0200 Subject: [PATCH] [compat] Solaris build fixes for openssl, catch2; NetBSD build fixes (#2752) Signed-off-by: lizzie Co-authored-by: crueter Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2752 Reviewed-by: Shinmegumi Reviewed-by: crueter Reviewed-by: MaranBr Co-authored-by: lizzie Co-committed-by: lizzie --- .gitignore | 6 ++ .patch/catch2/0001-solaris-isnan-fix.patch | 12 +++ .patch/libusb/0001-netbsd-gettime.patch | 25 ++++++ .patch/spirv-tools/0001-netbsd-fix.patch | 14 ++++ CMakeLists.txt | 23 +++++- docs/CPMUtil.md | 3 + docs/Caveats.md | 12 ++- docs/Deps.md | 91 +++++++++++++-------- docs/user/Architectures.md | 3 +- externals/cpmfile.json | 13 ++- externals/libusb/cpmfile.json | 5 +- externals/renderdoc/renderdoc_app.h | 2 +- src/common/demangle.cpp | 42 +++++----- src/common/settings_enums.h | 16 ++-- src/dynarmic/src/dynarmic/common/context.h | 15 ++++ src/dynarmic/src/dynarmic/ir/dense_list.h | 11 ++- src/dynarmic/src/dynarmic/ir/opt_passes.cpp | 2 +- src/dynarmic/tests/native/testenv.h | 40 ++++++--- src/qt_common/CMakeLists.txt | 6 +- src/qt_common/util/content.cpp | 1 - src/qt_common/util/game.cpp | 3 +- src/qt_common/util/game.h | 2 +- 22 files changed, 247 insertions(+), 100 deletions(-) create mode 100644 .patch/catch2/0001-solaris-isnan-fix.patch create mode 100644 .patch/libusb/0001-netbsd-gettime.patch create mode 100644 .patch/spirv-tools/0001-netbsd-fix.patch diff --git a/.gitignore b/.gitignore index 2b342e5145..0886224d8d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,12 @@ doc-build/ AppDir/ uruntime +# dtrace and ktrace stuffs +[dk]trace-out/ +[dk]trace.out +*.core +log.txt + # Generated source files src/common/scm_rev.cpp dist/english_plurals/generated_en.ts diff --git a/.patch/catch2/0001-solaris-isnan-fix.patch b/.patch/catch2/0001-solaris-isnan-fix.patch new file mode 100644 index 0000000000..498d6cd93e --- /dev/null +++ b/.patch/catch2/0001-solaris-isnan-fix.patch @@ -0,0 +1,12 @@ +diff --git a/src/catch2/matchers/catch_matchers_floating_point.cpp b/src/catch2/matchers/catch_matchers_floating_point.cpp +index fc7b444..0e1a3c2 100644 +--- a/src/catch2/matchers/catch_matchers_floating_point.cpp ++++ b/src/catch2/matchers/catch_matchers_floating_point.cpp +@@ -5,6 +5,7 @@ + // https://www.boost.org/LICENSE_1_0.txt) + + // SPDX-License-Identifier: BSL-1.0 ++#include + #include + #include + #include diff --git a/.patch/libusb/0001-netbsd-gettime.patch b/.patch/libusb/0001-netbsd-gettime.patch new file mode 100644 index 0000000000..8cfab9ea91 --- /dev/null +++ b/.patch/libusb/0001-netbsd-gettime.patch @@ -0,0 +1,25 @@ +diff --git a/libusb/os/netbsd_usb.c b/libusb/os/netbsd_usb.c +index a9a50b2..56e681b 100644 +--- a/libusb/os/netbsd_usb.c ++++ b/libusb/os/netbsd_usb.c +@@ -580,6 +580,20 @@ _access_endpoint(struct libusb_transfer *transfer) + return hpriv->endpoints[endpt]; + } + ++void usbi_get_monotonic_time(struct timespec *tp) { ++ struct timeval tv; ++ gettimeofday(&tv, NULL); ++ tp->tv_sec = tv.tv_sec; ++ tp->tv_nsec = tv.tv_usec * 1000ull; ++} ++ ++void usbi_get_real_time(struct timespec *tp) { ++ struct timeval tv; ++ gettimeofday(&tv, NULL); ++ tp->tv_sec = tv.tv_sec; ++ tp->tv_nsec = tv.tv_usec * 1000ull; ++} ++ + int + _sync_gen_transfer(struct usbi_transfer *itransfer) + { diff --git a/.patch/spirv-tools/0001-netbsd-fix.patch b/.patch/spirv-tools/0001-netbsd-fix.patch new file mode 100644 index 0000000000..e4b71f2938 --- /dev/null +++ b/.patch/spirv-tools/0001-netbsd-fix.patch @@ -0,0 +1,14 @@ +diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt +index eb4e69e..3155805 100644 +--- a/external/CMakeLists.txt ++++ b/external/CMakeLists.txt +@@ -72,7 +72,8 @@ if (SPIRV_TOOLS_USE_MIMALLOC) + pop_variable(MI_BUILD_TESTS) + endif() + +-if (DEFINED SPIRV-Headers_SOURCE_DIR) ++# NetBSD doesn't have SPIRV-Headers readily available on system ++if (DEFINED SPIRV-Headers_SOURCE_DIR AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD") + # This allows flexible position of the SPIRV-Headers repo. + set(SPIRV_HEADER_DIR ${SPIRV-Headers_SOURCE_DIR}) + else() diff --git a/CMakeLists.txt b/CMakeLists.txt index fa35ca3d16..b61bb49359 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,8 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") set(PLATFORM_FREEBSD ON) elseif (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") set(PLATFORM_OPENBSD ON) +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD") + set(PLATFORM_NETBSD ON) elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(PLATFORM_LINUX ON) endif() @@ -41,8 +43,7 @@ if (PLATFORM_SUN) list(APPEND CMAKE_PREFIX_PATH "/usr/lib/qt/6.6/lib/amd64/cmake") list(APPEND CMAKE_MODULE_PATH "/usr/lib/qt/6.6/lib/amd64/cmake") - # amazing - # absolutely incredible + # Amazing - absolutely incredible list(APPEND CMAKE_PREFIX_PATH "/usr/lib/amd64/cmake") list(APPEND CMAKE_MODULE_PATH "/usr/lib/amd64/cmake") @@ -63,6 +64,15 @@ if (PLATFORM_OPENBSD) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/X11R6/include") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/X11R6/include") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/X11R6/lib") +elseif (PLATFORM_NETBSD) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/X11R7/include") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/X11R7/include") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/X11R7/lib") +endif() + +# NetBSD: Fun for the whole family! +if (PLATFORM_NETBSD) + set(ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}:/usr/pkg/lib/ffmpeg7/pkgconfig") endif() # Detect current compilation architecture and create standard definitions @@ -149,6 +159,7 @@ endif() if (PLATFORM_FREEBSD) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib") + endif() # Set bundled sdl2/qt as dependent options. @@ -264,7 +275,11 @@ if (ENABLE_WEB_SERVICE) endif() option(ENABLE_OPENSSL "Enable OpenSSL backend for ISslConnection" ${DEFAULT_ENABLE_OPENSSL}) if (ENABLE_OPENSSL) - cmake_dependent_option(YUZU_USE_BUNDLED_OPENSSL "Download bundled OpenSSL build" "${MSVC}" "NOT ANDROID" ON) + set(DEFAULT_YUZU_USE_BUNDLED_OPENSSL OFF) + if (EXT_DEFAULT OR PLATFORM_SUN) + set(DEFAULT_YUZU_USE_BUNDLED_OPENSSL ON) + endif() + option(YUZU_USE_BUNDLED_OPENSSL "Download bundled OpenSSL build" ${DEFAULT_YUZU_USE_BUNDLED_OPENSSL}) endif() if (ANDROID AND YUZU_DOWNLOAD_ANDROID_VVL) @@ -351,7 +366,7 @@ if (YUZU_ROOM) add_compile_definitions(YUZU_ROOM) endif() -if (ANDROID OR PLATFORM_FREEBSD OR PLATFORM_OPENBSD OR PLATFORM_SUN OR APPLE) +if ((ANDROID OR APPLE OR UNIX) AND (NOT PLATFORM_LINUX OR ANDROID) AND NOT WIN32) if(CXX_APPLE OR CXX_CLANG) # libc++ has stop_token and jthread as experimental set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexperimental-library") diff --git a/docs/CPMUtil.md b/docs/CPMUtil.md index 779515ae7e..5015c4139c 100644 --- a/docs/CPMUtil.md +++ b/docs/CPMUtil.md @@ -8,6 +8,9 @@ Eden-specific options: - `YUZU_USE_CPM` is set by default on MSVC and Android. Other platforms should use this if certain "required" system dependencies (e.g. OpenSSL) are broken or missing * If this is `OFF`, required system dependencies will be searched via `find_package`, although most externals use CPM regardless. +- Force system libraries via CMake arguments: + * SDL2: `YUZU_USE_BUNDLED_SDL2` and `YUZU_USE_EXTERNAL_SDL2` + * FFmpeg: `YUZU_USE_EXTERNAL_FFMPEG` ## Tooling diff --git a/docs/Caveats.md b/docs/Caveats.md index 7bc2428bab..3f97766910 100644 --- a/docs/Caveats.md +++ b/docs/Caveats.md @@ -45,8 +45,18 @@ export LIBGL_ALWAYS_SOFTWARE=1 After configuration, you may need to modify `externals/ffmpeg/CMakeFiles/ffmpeg-build/build.make` to use `-j$(nproc)` instead of just `-j`. +`-lc++-experimental` doesn't exist in OpenBSD but the LLVM driver still tries to link against it, to solve just symlink `ln -s /usr/lib/libc++.a /usr/lib/libc++experimental.a`. + +If clang has errors, try using `g++-11`. + ## FreeBSD Eden is not currently available as a port on FreeBSD, though it is in the works. For now, the recommended method of usage is to compile it yourself. -The available OpenSSL port (3.0.17) is out-of-date, and using a bundled static library instead is recommended; to do so, add `-DYUZU_USE_BUNDLED_OPENSSL=ON` to your CMake configure command. \ No newline at end of file +The available OpenSSL port (3.0.17) is out-of-date, and using a bundled static library instead is recommended; to do so, add `-DYUZU_USE_BUNDLED_OPENSSL=ON` to your CMake configure command. + +## NetBSD + +System provides a default `g++-10` which doesn't support the current C++ codebase; install `clang-19` with `pkgin install clang-19`. Then build with `cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -B build`. + +Make may error out when generating C++ headers of SPIRV shaders, hence it's recommended to use `gmake` over the default system one. diff --git a/docs/Deps.md b/docs/Deps.md index b8a1be66d2..3c266ad98a 100644 --- a/docs/Deps.md +++ b/docs/Deps.md @@ -102,7 +102,7 @@ sudo pacman -Syu --needed base-devel boost catch2 cmake enet ffmpeg fmt git glsl Ubuntu, Debian, Mint Linux ```sh -sudo apt-get install autoconf cmake g++ gcc git glslang-tools libasound2t64 libboost-context-dev libglu1-mesa-dev libhidapi-dev libpulse-dev libtool libudev-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libxcb-xkb1 libxext-dev libxkbcommon-x11-0 mesa-common-dev nasm ninja-build qt6-base-private-dev libmbedtls-dev catch2 libfmt-dev liblz4-dev nlohmann-json3-dev libzstd-dev libssl-dev libavfilter-dev libavcodec-dev libswscale-dev pkg-config zlib1g-dev libva-dev libvdpau-dev qt6-tools-dev libzydis-dev zydis-tools libzycore-dev vulkan-utility-libraries-dev libvulkan-dev spirv-tools spirv-headers libusb-1.0-0-dev libxbyak-dev +sudo apt-get install autoconf cmake g++ gcc git glslang-tools libglu1-mesa-dev libhidapi-dev libpulse-dev libtool libudev-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libxcb-xkb1 libxext-dev libxkbcommon-x11-0 mesa-common-dev nasm ninja-build qt6-base-private-dev libmbedtls-dev catch2 libfmt-dev liblz4-dev nlohmann-json3-dev libzstd-dev libssl-dev libavfilter-dev libavcodec-dev libswscale-dev pkg-config zlib1g-dev libva-dev libvdpau-dev qt6-tools-dev libzydis-dev zydis-tools libzycore-dev libvulkan-dev spirv-tools spirv-headers libusb-1.0-0-dev libxbyak-dev libboost-dev libboost-fiber-dev libboost-context-dev libsdl2-dev libopus-dev libasound2t64 vulkan-utility-libraries-dev ``` * Ubuntu 22.04, Linux Mint 20, or Debian 12 or later is required. @@ -110,18 +110,28 @@ sudo apt-get install autoconf cmake g++ gcc git glslang-tools libasound2t64 libb
-Fedora Linux +AlmaLinux, Fedora, Red Hat Linux +Fedora: ```sh -sudo dnf install autoconf ccache cmake fmt-devel gcc{,-c++} glslang hidapi-devel json-devel libtool libusb1-devel libzstd-devel lz4-devel nasm ninja-build openssl-devel pulseaudio-libs-devel qt6-linguist qt6-qtbase{-private,}-devel qt6-qtwebengine-devel qt6-qtmultimedia-devel speexdsp-devel wayland-devel zlib-devel ffmpeg-devel libXext-devel +sudo dnf install autoconf cmake fmt-devel gcc{,-c++} glslang hidapi-devel json-devel libtool libusb1-devel libzstd-devel lz4-devel nasm ninja-build openssl-devel pulseaudio-libs-devel qt6-linguist qt6-qtbase{-private,}-devel qt6-qtwebengine-devel qt6-qtmultimedia-devel speexdsp-devel wayland-devel zlib-devel ffmpeg-devel libXext-devel boost jq ``` -* Force system libraries via CMake arguments: - * SDL2: `-DYUZU_USE_BUNDLED_SDL2=OFF -DYUZU_USE_EXTERNAL_SDL2=OFF` - * FFmpeg: `-DYUZU_USE_EXTERNAL_FFMPEG=OFF` -* [RPM Fusion](https://rpmfusion.org/) is required for `ffmpeg-devel` +AlmaLinux (use `YUZU_USE_CPM=ON`): +```sh +# vvv - Only if RPMfusion is not installed or EPEL isn't either +sudo dnf install epel-release dnf-utils +# (run rpmfusion installation afterwards) +# vvv - This will work for most systems +sudo dnf install autoconf cmake libtool libudev cmake gcc gcc-c++ qt6-qtbase-devel zlib-devel openssl-devel boost SDL2 ffmpeg-devel libdrm glslang jq patch +# Qt6 private GUI must be taken from CRB repos +sudo dnf config-manager --enable crb +sudo dnf install qt6-qtbase-private-devel +``` + +* [RPM Fusion](https://rpmfusion.org/Configuration) is required for `ffmpeg-devel` * Fedora 32 or later is required. -* Fedora 36+ users with GCC 12 need Clang and should configure CMake with: +* Fedora 36+ users with GCC 12 need Clang and should configure CMake with: `cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -B build`
@@ -145,44 +155,43 @@ brew install molten-vk vulkan-loader
FreeBSD -``` -devel/cmake -devel/sdl20 -devel/boost-libs -devel/catch2 -devel/libfmt -devel/nlohmann-json -devel/ninja -devel/nasm -devel/autoconf -devel/pkgconf -devel/qt6-base - -net/enet - -multimedia/ffnvcodec-headers -multimedia/ffmpeg - -audio/opus - -archivers/liblz4 - -lang/gcc12 - -graphics/glslang -graphics/vulkan-utility-libraries -``` +As root run: `pkg install devel/cmake devel/sdl20 devel/boost-libs devel/catch2 devel/libfmt devel/nlohmann-json devel/ninja devel/nasm devel/autoconf devel/pkgconf devel/qt6-base devel/simpleini net/enet multimedia/ffnvcodec-headers multimedia/ffmpeg audio/opus archivers/liblz4 lang/gcc12 graphics/glslang graphics/vulkan-utility-libraries graphics/spirv-tools www/cpp-httplib devel/jwt-cpp devel/unordered-dense devel/zydis` If using FreeBSD 12 or prior, use `devel/pkg-config` instead.
+
+NetBSD + +Install `pkgin` if not already `pkg_add pkgin`, see also the general [pkgsrc guide](https://www.netbsd.org/docs/pkgsrc/using.html). For NetBSD 10.1 provide `cat 'PKG_PATH="https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/x86_64/10.0_2025Q3/All/"' >/etc/pkg_install.conf`. If `pkgin` is taking too much time consider adding the following to `/etc/rc.conf`: +``` +ip6addrctl=YES +ip6addrctl_policy=ipv4_prefer +``` + +For NetBSD +10.1: `pkgin install git cmake boost fmtlib SDL2 catch2 libjwt spirv-headers ffmpeg7 libva nlohmann-json jq libopus qt6 mbedtls3 cpp-httplib lz4 vulkan-headers nasm autoconf enet pkg-config libusb1`. + +glslang is not available on NetBSD, to circumvent this simply build glslang by yourself: +```sh +pkgin python313 +git clone https://github.com/KhronosGroup/glslang.git +cd glslang +python3.13 ./update_glslang_sources.py +cmake -B build -DCMAKE_BUILD_TYPE=Release +cmake --build build -- -j`nproc` +cmake --install build +``` + +
+
OpenBSD ```sh pkg_add -u -pkg_add cmake nasm git boost unzip--iconv autoconf-2.72p0 bash ffmpeg glslang gmake llvm-19.1.7p3 qt6 jq fmt nlohmann-json enet boost vulkan-utility-libraries vulkan-headers spirv-headers spirv-tools catch2 sdl2 libusb1.1.0.27 +pkg_add cmake nasm git boost unzip--iconv autoconf-2.72p0 bash ffmpeg glslang gmake llvm-19.1.7p3 qt6 jq fmt nlohmann-json enet boost vulkan-utility-libraries vulkan-headers spirv-headers spirv-tools catch2 sdl2 libusb1-1.0.27 ``` +
@@ -210,6 +219,16 @@ Then install the libraries: `sudo pkg install qt6 boost glslang libzip library/l * `echo 'PATH=$(readlink -e /c/VulkanSDK/*/Bin/):$PATH' >> ~/.bashrc`
+
+RedoxOS + +```sh +sudo pkg update && sudo pkg install git cmake +sudo pkg install ffmpeg6 sdl2 zlib llvm18 +``` + +
+ ## All Done You may now return to the **[root build guide](Build.md)**. diff --git a/docs/user/Architectures.md b/docs/user/Architectures.md index 240feb666d..b12e5ab7dd 100644 --- a/docs/user/Architectures.md +++ b/docs/user/Architectures.md @@ -54,6 +54,7 @@ The vast majority of Eden's testing is done on Windows, Linux, and Android. Howe - FreeBSD - OpenBSD +- NetBSD - OpenIndiana (Solaris) - macOS @@ -127,6 +128,6 @@ AMD GPU support on these platforms is limited or nonexistent. ## VMs -Eden "can" run in a VM, but only with the software renderer, *unless* you create a hardware-accelerated KVM with GPU passthrough. If you *really* want to do this and don't have a spare GPU lying around, RX 570 and 580 GPUs are extremely cheap on the black market and are powerful enough to run most commercial games at 60fps. +Eden "can" run in a VM, but only with the software renderer, *unless* you create a hardware-accelerated KVM with GPU passthrough. If you *really* want to do this and don't have a spare GPU lying around, RX 570 and 580 GPUs are extremely cheap on the black market and are powerful enough to run most commercial games at 60 FPS. Some users and developers have had success using a pure OpenGL-accelerated KVM on Linux with a Windows VM, but this is ridiculously tedious to set up. You're probably better off dual-booting. \ No newline at end of file diff --git a/externals/cpmfile.json b/externals/cpmfile.json index 9025ec2787..242f582ba2 100644 --- a/externals/cpmfile.json +++ b/externals/cpmfile.json @@ -46,9 +46,10 @@ "package": "xbyak", "repo": "herumi/xbyak", "tag": "v%VERSION%", - "hash": "e84992c65ad62c577e2746ec5180132fd2875166d1e6b1521a0ff619787e1645792fe5f6a858fe94ed66f297912b6a6b89a509b5d5f5e81a2db1dd7e6790b1f5", + "hash": "b40dade90fb0e46a2bd52934f7ce461e37be931b571e58cbe2203bc08ed5b54c7ff1a29026c74c7f9805e4e3f6c9636deca528e6b4a8093ce7eae145218599f1", + "git_version": "7.29", "bundled": true, - "git_version": "7.30" + "skip_updates": true }, "xbyak": { "package": "xbyak", @@ -128,6 +129,9 @@ "git_version": "2025.4", "options": [ "SPIRV_SKIP_EXECUTABLES ON" + ], + "patches": [ + "0001-netbsd-fix.patch" ] }, "spirv-headers": { @@ -168,7 +172,10 @@ "tag": "v%VERSION%", "hash": "a95495142f915d6e9c2a23e80fe360343e9097680066a2f9d3037a070ba5f81ee5559a0407cc9e972dc2afae325873f1fc7ea07a64012c0f01aac6e549f03e3f", "version": "3.0.1", - "git_version": "3.11.0" + "git_version": "3.11.0", + "patches": [ + "0001-solaris-isnan-fix.patch" + ] }, "discord-rpc": { "package": "DiscordRPC", diff --git a/externals/libusb/cpmfile.json b/externals/libusb/cpmfile.json index dc69841ab7..4abe225ab3 100644 --- a/externals/libusb/cpmfile.json +++ b/externals/libusb/cpmfile.json @@ -4,6 +4,9 @@ "tag": "v%VERSION%", "hash": "98c5f7940ff06b25c9aa65aa98e23de4c79a4c1067595f4c73cc145af23a1c286639e1ba11185cd91bab702081f307b973f08a4c9746576dc8d01b3620a3aeb5", "find_args": "MODULE", - "git_version": "1.0.29" + "git_version": "1.0.29", + "patches": [ + "0001-netbsd-gettime.patch" + ] } } diff --git a/externals/renderdoc/renderdoc_app.h b/externals/renderdoc/renderdoc_app.h index 3fdc233165..43a62fdf85 100644 --- a/externals/renderdoc/renderdoc_app.h +++ b/externals/renderdoc/renderdoc_app.h @@ -43,7 +43,7 @@ #define RENDERDOC_CC __cdecl #elif defined(__linux__) || defined(__FreeBSD__) || defined(__sun__) #define RENDERDOC_CC -#elif defined(__APPLE__) +#elif defined(__APPLE__) || defined(__OpenBSD__) || defined(__NetBSD__) #define RENDERDOC_CC #else #error "Unknown platform" diff --git a/src/common/demangle.cpp b/src/common/demangle.cpp index b2c9d126aa..8cb8c35515 100644 --- a/src/common/demangle.cpp +++ b/src/common/demangle.cpp @@ -1,6 +1,11 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include +#include #include #include "common/demangle.h" @@ -9,29 +14,22 @@ namespace Common { std::string DemangleSymbol(const std::string& mangled) { - auto is_itanium = [](const std::string& name) -> bool { - // A valid Itanium encoding requires 1-4 leading underscores, followed by 'Z'. - auto pos = name.find_first_not_of('_'); - return pos > 0 && pos <= 4 && pos < name.size() && name[pos] == 'Z'; - }; - - if (mangled.empty()) { - return mangled; + if (mangled.size() > 0) { + auto const is_itanium = [](std::string_view name) -> bool { + // A valid Itanium encoding requires 1-4 leading underscores, followed by 'Z'. + auto const pos = name.find_first_not_of('_'); + return pos > 0 && pos <= 4 && pos < name.size() && name[pos] == 'Z'; + }; + std::string ret = mangled; + if (is_itanium(mangled)) { + if (char* p = llvm::itaniumDemangle(mangled); p != nullptr) { + ret = std::string{p}; + std::free(p); + } + } + return ret; } - - char* demangled = nullptr; - SCOPE_EXIT { - std::free(demangled); - }; - - if (is_itanium(mangled)) { - demangled = llvm::itaniumDemangle(mangled.c_str()); - } - - if (!demangled) { - return mangled; - } - return demangled; + return std::string{}; } } // namespace Common diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h index c8a5fc7bd9..3ba2144efc 100644 --- a/src/common/settings_enums.h +++ b/src/common/settings_enums.h @@ -21,8 +21,8 @@ template struct EnumMetadata { static std::vector> Canonicalizations(); static u32 Index(); - static constexpr T GetFirst(); - static constexpr T GetLast(); + static T GetFirst(); + static T GetLast(); }; #define PAIR_45(N, X, ...) {#X, N::X} __VA_OPT__(, PAIR_46(N, __VA_ARGS__)) @@ -82,10 +82,10 @@ struct EnumMetadata { template<> inline u32 EnumMetadata::Index() { \ return __COUNTER__; \ } \ - template<> inline constexpr NAME EnumMetadata::GetFirst() { \ + template<> inline NAME EnumMetadata::GetFirst() { \ return NAME::PP_HEAD(__VA_ARGS__); \ } \ - template<> inline constexpr NAME EnumMetadata::GetLast() { \ + template<> inline NAME EnumMetadata::GetLast() { \ return (std::vector>{PAIR(NAME, __VA_ARGS__)}).back().second; \ } @@ -106,17 +106,17 @@ inline u32 EnumMetadata::Index() { return 100; } template<> -inline constexpr AudioEngine EnumMetadata::GetFirst() { +inline AudioEngine EnumMetadata::GetFirst() { return AudioEngine::Auto; } template<> -inline constexpr AudioEngine EnumMetadata::GetLast() { +inline AudioEngine EnumMetadata::GetLast() { return AudioEngine::Oboe; } ENUM(AudioMode, Mono, Stereo, Surround); -static_assert(EnumMetadata::GetFirst() == AudioMode::Mono); -static_assert(EnumMetadata::GetLast() == AudioMode::Surround); +//static_assert(EnumMetadata::GetFirst() == AudioMode::Mono); +//static_assert(EnumMetadata::GetLast() == AudioMode::Surround); ENUM(Language, Japanese, EnglishAmerican, French, German, Italian, Spanish, Chinese, Korean, Dutch, Portuguese, Russian, Taiwanese, EnglishBritish, FrenchCanadian, SpanishLatin, diff --git a/src/dynarmic/src/dynarmic/common/context.h b/src/dynarmic/src/dynarmic/common/context.h index 0eb128449c..ea2c1ef251 100644 --- a/src/dynarmic/src/dynarmic/common/context.h +++ b/src/dynarmic/src/dynarmic/common/context.h @@ -12,7 +12,22 @@ # include # endif # ifdef __sun__ +// Thanks C macros for exisitng in Solaris headers, thanks a lot +// We really needed to define FOR EVERY SINGLE REGISTER didn't we? # include +# undef EAX +# undef EBX +# undef ECX +# undef EDX +# undef ESP +# undef EBP +# undef ESI +# undef EDI +# undef ERR +# undef SS +# undef CS +# undef ES +# undef DS # endif # ifdef __linux__ # include diff --git a/src/dynarmic/src/dynarmic/ir/dense_list.h b/src/dynarmic/src/dynarmic/ir/dense_list.h index 8dad418b47..895992170d 100644 --- a/src/dynarmic/src/dynarmic/ir/dense_list.h +++ b/src/dynarmic/src/dynarmic/ir/dense_list.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + #pragma once #include @@ -13,10 +16,10 @@ namespace Dynarmic { using const_pointer = const value_type*; using reference = value_type&; using const_reference = const value_type&; - using iterator = std::deque::iterator; - using const_iterator = std::deque::const_iterator; - using reverse_iterator = std::reverse_iterator; - using const_reverse_iterator = std::reverse_iterator; + using iterator = typename std::deque::iterator; + using const_iterator = typename std::deque::const_iterator; + using reverse_iterator = typename std::reverse_iterator; + using const_reverse_iterator = typename std::reverse_iterator; inline bool empty() const noexcept { return list.empty(); } inline size_type size() const noexcept { return list.size(); } diff --git a/src/dynarmic/src/dynarmic/ir/opt_passes.cpp b/src/dynarmic/src/dynarmic/ir/opt_passes.cpp index 25afde9b5d..42d0f17d3a 100644 --- a/src/dynarmic/src/dynarmic/ir/opt_passes.cpp +++ b/src/dynarmic/src/dynarmic/ir/opt_passes.cpp @@ -86,7 +86,7 @@ static void ConstantMemoryReads(IR::Block& block, A32::UserCallbacks* cb) { } static void FlagsPass(IR::Block& block) { - using Iterator = std::reverse_iterator; + using Iterator = typename std::reverse_iterator; struct FlagInfo { bool set_not_required = false; diff --git a/src/dynarmic/tests/native/testenv.h b/src/dynarmic/tests/native/testenv.h index 7a3d14eea0..f7a8622ed8 100644 --- a/src/dynarmic/tests/native/testenv.h +++ b/src/dynarmic/tests/native/testenv.h @@ -1,9 +1,25 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + #pragma once #include #ifdef __AVX__ #include #endif + +// NetBSD apparently still needs these... ugh +#ifdef __cpp_lib_bit_cast +#include +template constexpr inline To BitCast(const From& from) { + return std::bit_cast(from); +} +#else +template constexpr inline To BitCast(const From& from) { + return __builtin_bit_cast(To, from); +} +#endif + template void CheckedRun(F&& fn) { #ifdef __AVX__ @@ -32,18 +48,18 @@ void CheckedRun(F&& fn) { , "+x"(xmm8), "+x"(xmm9), "+x"(xmm10), "+x"(xmm11) : ); - CHECK(std::bit_cast(xmm0[0]) == 0); - CHECK(std::bit_cast(xmm1[0]) == 1); - CHECK(std::bit_cast(xmm2[0]) == 2); - CHECK(std::bit_cast(xmm3[0]) == 3); - CHECK(std::bit_cast(xmm4[0]) == 4); - CHECK(std::bit_cast(xmm5[0]) == 5); - CHECK(std::bit_cast(xmm6[0]) == 6); - CHECK(std::bit_cast(xmm7[0]) == 7); - CHECK(std::bit_cast(xmm8[0]) == 8); - CHECK(std::bit_cast(xmm9[0]) == 9); - CHECK(std::bit_cast(xmm10[0]) == 10); - CHECK(std::bit_cast(xmm11[0]) == 11); + CHECK(BitCast(xmm0[0]) == 0); + CHECK(BitCast(xmm1[0]) == 1); + CHECK(BitCast(xmm2[0]) == 2); + CHECK(BitCast(xmm3[0]) == 3); + CHECK(BitCast(xmm4[0]) == 4); + CHECK(BitCast(xmm5[0]) == 5); + CHECK(BitCast(xmm6[0]) == 6); + CHECK(BitCast(xmm7[0]) == 7); + CHECK(BitCast(xmm8[0]) == 8); + CHECK(BitCast(xmm9[0]) == 9); + CHECK(BitCast(xmm10[0]) == 10); + CHECK(BitCast(xmm11[0]) == 11); #else fn(); #endif diff --git a/src/qt_common/CMakeLists.txt b/src/qt_common/CMakeLists.txt index 02103100f1..3fe990d7f2 100644 --- a/src/qt_common/CMakeLists.txt +++ b/src/qt_common/CMakeLists.txt @@ -76,9 +76,9 @@ if (NOT APPLE AND ENABLE_OPENGL) endif() if (UNIX AND NOT APPLE) - if (TARGET Qt6::GuiPrivate) - target_link_libraries(qt_common PRIVATE Qt6::GuiPrivate) - else() + if (DEFINED Qt6Gui_PRIVATE_INCLUDE_DIRS) target_include_directories(qt_common PRIVATE ${Qt6Gui_PRIVATE_INCLUDE_DIRS}) + else() + target_link_libraries(qt_common PRIVATE Qt6::GuiPrivate) endif() endif() diff --git a/src/qt_common/util/content.cpp b/src/qt_common/util/content.cpp index ee30d4b22d..b42bdd8421 100644 --- a/src/qt_common/util/content.cpp +++ b/src/qt_common/util/content.cpp @@ -501,7 +501,6 @@ void ImportDataDir(FrontendCommon::DataManager::DataDir data_dir, auto progress_callback = [=](size_t total_size, size_t processed_size) { QMetaObject::invokeMethod(progress, "setValue", Qt::DirectConnection, Q_ARG(int, static_cast((processed_size * 100) / total_size))); - return !progress->wasCanceled(); }; diff --git a/src/qt_common/util/game.cpp b/src/qt_common/util/game.cpp index 767b5fc31f..62bfd8acd3 100644 --- a/src/qt_common/util/game.cpp +++ b/src/qt_common/util/game.cpp @@ -542,7 +542,8 @@ void CreateShortcut(const std::string& game_path, qgame_title); } -constexpr std::string GetShortcutPath(ShortcutTarget target) { +// TODO: You want this to be constexpr? Well too bad, clang19 doesn't believe this is a string literal +std::string GetShortcutPath(ShortcutTarget target) { { std::string shortcut_path{}; if (target == ShortcutTarget::Desktop) { diff --git a/src/qt_common/util/game.h b/src/qt_common/util/game.h index 5c6bb24910..2a7c77ef2d 100644 --- a/src/qt_common/util/game.h +++ b/src/qt_common/util/game.h @@ -78,7 +78,7 @@ void CreateShortcut(const std::string& game_path, std::string arguments_, const bool needs_title); -constexpr std::string GetShortcutPath(ShortcutTarget target); +std::string GetShortcutPath(ShortcutTarget target); void CreateHomeMenuShortcut(ShortcutTarget target); }