[compat] Solaris build fixes for openssl, catch2; NetBSD build fixes (#2752)

Signed-off-by: lizzie <lizzie@eden-emu.dev>
Co-authored-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2752
Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev>
Reviewed-by: crueter <crueter@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie 2025-10-17 22:12:58 +02:00 committed by crueter
parent 1c90b099d3
commit 3e8fe622a7
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
22 changed files with 247 additions and 100 deletions

View file

@ -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 <string>
#include <string_view>
#include <llvm/Demangle/Demangle.h>
#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

View file

@ -21,8 +21,8 @@ template <typename T>
struct EnumMetadata {
static std::vector<std::pair<std::string_view, T>> 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<NAME>::Index() { \
return __COUNTER__; \
} \
template<> inline constexpr NAME EnumMetadata<NAME>::GetFirst() { \
template<> inline NAME EnumMetadata<NAME>::GetFirst() { \
return NAME::PP_HEAD(__VA_ARGS__); \
} \
template<> inline constexpr NAME EnumMetadata<NAME>::GetLast() { \
template<> inline NAME EnumMetadata<NAME>::GetLast() { \
return (std::vector<std::pair<std::string_view, NAME>>{PAIR(NAME, __VA_ARGS__)}).back().second; \
}
@ -106,17 +106,17 @@ inline u32 EnumMetadata<AudioEngine>::Index() {
return 100;
}
template<>
inline constexpr AudioEngine EnumMetadata<AudioEngine>::GetFirst() {
inline AudioEngine EnumMetadata<AudioEngine>::GetFirst() {
return AudioEngine::Auto;
}
template<>
inline constexpr AudioEngine EnumMetadata<AudioEngine>::GetLast() {
inline AudioEngine EnumMetadata<AudioEngine>::GetLast() {
return AudioEngine::Oboe;
}
ENUM(AudioMode, Mono, Stereo, Surround);
static_assert(EnumMetadata<AudioMode>::GetFirst() == AudioMode::Mono);
static_assert(EnumMetadata<AudioMode>::GetLast() == AudioMode::Surround);
//static_assert(EnumMetadata<AudioMode>::GetFirst() == AudioMode::Mono);
//static_assert(EnumMetadata<AudioMode>::GetLast() == AudioMode::Surround);
ENUM(Language, Japanese, EnglishAmerican, French, German, Italian, Spanish, Chinese, Korean, Dutch,
Portuguese, Russian, Taiwanese, EnglishBritish, FrenchCanadian, SpanishLatin,

View file

@ -12,7 +12,22 @@
# include <ucontext.h>
# 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 <sys/regset.h>
# 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 <sys/syscall.h>

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <cstdint>
@ -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<value_type>::iterator;
using const_iterator = std::deque<value_type>::const_iterator;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
using iterator = typename std::deque<value_type>::iterator;
using const_iterator = typename std::deque<value_type>::const_iterator;
using reverse_iterator = typename std::reverse_iterator<iterator>;
using const_reverse_iterator = typename std::reverse_iterator<const_iterator>;
inline bool empty() const noexcept { return list.empty(); }
inline size_type size() const noexcept { return list.size(); }

View file

@ -86,7 +86,7 @@ static void ConstantMemoryReads(IR::Block& block, A32::UserCallbacks* cb) {
}
static void FlagsPass(IR::Block& block) {
using Iterator = std::reverse_iterator<IR::Block::iterator>;
using Iterator = typename std::reverse_iterator<IR::Block::iterator>;
struct FlagInfo {
bool set_not_required = false;

View file

@ -1,9 +1,25 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <catch2/catch_test_macros.hpp>
#ifdef __AVX__
#include <immintrin.h>
#endif
// NetBSD apparently still needs these... ugh
#ifdef __cpp_lib_bit_cast
#include <bit>
template <typename To, typename From> constexpr inline To BitCast(const From& from) {
return std::bit_cast<To>(from);
}
#else
template <typename To, typename From> constexpr inline To BitCast(const From& from) {
return __builtin_bit_cast(To, from);
}
#endif
template<typename F>
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<std::uint64_t>(xmm0[0]) == 0);
CHECK(std::bit_cast<std::uint64_t>(xmm1[0]) == 1);
CHECK(std::bit_cast<std::uint64_t>(xmm2[0]) == 2);
CHECK(std::bit_cast<std::uint64_t>(xmm3[0]) == 3);
CHECK(std::bit_cast<std::uint64_t>(xmm4[0]) == 4);
CHECK(std::bit_cast<std::uint64_t>(xmm5[0]) == 5);
CHECK(std::bit_cast<std::uint64_t>(xmm6[0]) == 6);
CHECK(std::bit_cast<std::uint64_t>(xmm7[0]) == 7);
CHECK(std::bit_cast<std::uint64_t>(xmm8[0]) == 8);
CHECK(std::bit_cast<std::uint64_t>(xmm9[0]) == 9);
CHECK(std::bit_cast<std::uint64_t>(xmm10[0]) == 10);
CHECK(std::bit_cast<std::uint64_t>(xmm11[0]) == 11);
CHECK(BitCast<std::uint64_t>(xmm0[0]) == 0);
CHECK(BitCast<std::uint64_t>(xmm1[0]) == 1);
CHECK(BitCast<std::uint64_t>(xmm2[0]) == 2);
CHECK(BitCast<std::uint64_t>(xmm3[0]) == 3);
CHECK(BitCast<std::uint64_t>(xmm4[0]) == 4);
CHECK(BitCast<std::uint64_t>(xmm5[0]) == 5);
CHECK(BitCast<std::uint64_t>(xmm6[0]) == 6);
CHECK(BitCast<std::uint64_t>(xmm7[0]) == 7);
CHECK(BitCast<std::uint64_t>(xmm8[0]) == 8);
CHECK(BitCast<std::uint64_t>(xmm9[0]) == 9);
CHECK(BitCast<std::uint64_t>(xmm10[0]) == 10);
CHECK(BitCast<std::uint64_t>(xmm11[0]) == 11);
#else
fn();
#endif

View file

@ -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()

View file

@ -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<int>((processed_size * 100) / total_size)));
return !progress->wasCanceled();
};

View file

@ -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) {

View file

@ -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);
}