Browse Source

[dynarmic, qt] fix build with QuaZip <=1.4 and fmt v9 (#2755)

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2755
pull/2757/head
crueter 2 months ago
parent
commit
551f244dfd
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 55
      .patch/mcl/0001-assert-macro.patch
  2. 42
      CMakeModules/FindDiscordRPC.cmake
  3. 10
      src/common/logging/log.h
  4. 3
      src/dynarmic/externals/cpmfile.json
  5. 5
      src/dynarmic/src/dynarmic/backend/arm64/emit_arm64.cpp
  6. 5
      src/dynarmic/src/dynarmic/backend/riscv64/emit_riscv64.cpp
  7. 2
      src/dynarmic/src/dynarmic/backend/x64/a32_emit_x64.cpp
  8. 2
      src/dynarmic/src/dynarmic/backend/x64/a64_emit_x64.cpp
  9. 2
      src/dynarmic/src/dynarmic/backend/x64/emit_x64.cpp
  10. 8
      src/dynarmic/src/dynarmic/ir/opcodes.h
  11. 1
      src/qt_common/config/shared_translation.h
  12. 2
      src/qt_common/qt_compat.h
  13. 15
      src/qt_common/util/compress.cpp
  14. 11
      src/qt_common/util/content.cpp

55
.patch/mcl/0001-assert-macro.patch

@ -0,0 +1,55 @@
diff --git a/include/mcl/assert.hpp b/include/mcl/assert.hpp
index f77dbe7..9ec0b9c 100644
--- a/include/mcl/assert.hpp
+++ b/include/mcl/assert.hpp
@@ -23,8 +23,11 @@ template<typename... Ts>
} // namespace mcl::detail
+#ifndef UNREACHABLE
#define UNREACHABLE() ASSERT_FALSE("Unreachable code!")
+#endif
+#ifndef ASSERT
#define ASSERT(expr) \
[&] { \
if (std::is_constant_evaluated()) { \
@@ -37,7 +40,9 @@ template<typename... Ts>
} \
} \
}()
+#endif
+#ifndef ASSERT_MSG
#define ASSERT_MSG(expr, ...) \
[&] { \
if (std::is_constant_evaluated()) { \
@@ -50,13 +55,24 @@ template<typename... Ts>
} \
} \
}()
+#endif
+#ifndef ASSERT_FALSE
#define ASSERT_FALSE(...) ::mcl::detail::assert_terminate("false", __VA_ARGS__)
+#endif
#if defined(NDEBUG) || defined(MCL_IGNORE_ASSERTS)
-# define DEBUG_ASSERT(expr) ASSUME(expr)
-# define DEBUG_ASSERT_MSG(expr, ...) ASSUME(expr)
+# ifndef DEBUG_ASSERT
+# define DEBUG_ASSERT(expr) ASSUME(expr)
+# endif
+# ifndef DEBUG_ASSERT_MSG
+# define DEBUG_ASSERT_MSG(expr, ...) ASSUME(expr)
+# endif
#else
-# define DEBUG_ASSERT(expr) ASSERT(expr)
-# define DEBUG_ASSERT_MSG(expr, ...) ASSERT_MSG(expr, __VA_ARGS__)
+# ifndef DEBUG_ASSERT
+# define DEBUG_ASSERT(expr) ASSERT(expr)
+# endif
+# ifndef DEBUG_ASSERT_MSG
+# define DEBUG_ASSERT_MSG(expr, ...) ASSERT_MSG(expr, __VA_ARGS__)
+# endif
#endif

42
CMakeModules/FindDiscordRPC.cmake

@ -1,27 +1,33 @@
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2022 Alexandre Bouvier <contact@amb.tf> # SPDX-FileCopyrightText: 2022 Alexandre Bouvier <contact@amb.tf>
# #
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
find_path(DiscordRPC_INCLUDE_DIR discord_rpc.h)
find_package(DiscordRPC CONFIG QUIET)
find_library(DiscordRPC_LIBRARY discord-rpc)
if (NOT DiscordRPC_FOUND)
find_path(DiscordRPC_INCLUDE_DIR discord_rpc.h)
find_library(DiscordRPC_LIBRARY discord-rpc)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DiscordRPC
REQUIRED_VARS
DiscordRPC_LIBRARY
DiscordRPC_INCLUDE_DIR
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DiscordRPC
REQUIRED_VARS
DiscordRPC_LIBRARY
DiscordRPC_INCLUDE_DIR
)
if (DiscordRPC_FOUND AND NOT TARGET DiscordRPC::discord-rpc)
add_library(DiscordRPC::discord-rpc UNKNOWN IMPORTED)
set_target_properties(DiscordRPC::discord-rpc PROPERTIES
IMPORTED_LOCATION "${DiscordRPC_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${DiscordRPC_INCLUDE_DIR}"
if (DiscordRPC_FOUND AND NOT TARGET DiscordRPC::discord-rpc)
add_library(DiscordRPC::discord-rpc UNKNOWN IMPORTED)
set_target_properties(DiscordRPC::discord-rpc PROPERTIES
IMPORTED_LOCATION "${DiscordRPC_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${DiscordRPC_INCLUDE_DIR}"
)
endif()
mark_as_advanced(
DiscordRPC_INCLUDE_DIR
DiscordRPC_LIBRARY
) )
endif() endif()
mark_as_advanced(
DiscordRPC_INCLUDE_DIR
DiscordRPC_LIBRARY
)

10
src/common/logging/log.h

@ -40,22 +40,22 @@ void FmtLogMessage(Class log_class, Level log_level, const char* filename, unsig
#endif #endif
#define LOG_DEBUG(log_class, ...) \ #define LOG_DEBUG(log_class, ...) \
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Debug, \
::Common::Log::FmtLogMessage(::Common::Log::Class::log_class, ::Common::Log::Level::Debug, \
__FILE__, __LINE__, __func__, \ __FILE__, __LINE__, __func__, \
__VA_ARGS__) __VA_ARGS__)
#define LOG_INFO(log_class, ...) \ #define LOG_INFO(log_class, ...) \
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Info, \
::Common::Log::FmtLogMessage(::Common::Log::Class::log_class, ::Common::Log::Level::Info, \
__FILE__, __LINE__, __func__, \ __FILE__, __LINE__, __func__, \
__VA_ARGS__) __VA_ARGS__)
#define LOG_WARNING(log_class, ...) \ #define LOG_WARNING(log_class, ...) \
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Warning, \
::Common::Log::FmtLogMessage(::Common::Log::Class::log_class, ::Common::Log::Level::Warning, \
__FILE__, __LINE__, __func__, \ __FILE__, __LINE__, __func__, \
__VA_ARGS__) __VA_ARGS__)
#define LOG_ERROR(log_class, ...) \ #define LOG_ERROR(log_class, ...) \
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Error, \
::Common::Log::FmtLogMessage(::Common::Log::Class::log_class, ::Common::Log::Level::Error, \
__FILE__, __LINE__, __func__, \ __FILE__, __LINE__, __func__, \
__VA_ARGS__) __VA_ARGS__)
#define LOG_CRITICAL(log_class, ...) \ #define LOG_CRITICAL(log_class, ...) \
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Critical, \
::Common::Log::FmtLogMessage(::Common::Log::Class::log_class, ::Common::Log::Level::Critical, \
__FILE__, __LINE__, __func__, \ __FILE__, __LINE__, __func__, \
__VA_ARGS__) __VA_ARGS__)

3
src/dynarmic/externals/cpmfile.json

@ -13,6 +13,9 @@
"hash": "f943bac39c1879986decad7a442ff4288eaeca4a2907684c7914e115a55ecc43c2782ded85c0835763fe04e40d5c82220ce864423e489e648e408a84f54dc4f3", "hash": "f943bac39c1879986decad7a442ff4288eaeca4a2907684c7914e115a55ecc43c2782ded85c0835763fe04e40d5c82220ce864423e489e648e408a84f54dc4f3",
"options": [ "options": [
"MCL_INSTALL OFF" "MCL_INSTALL OFF"
],
"patches": [
"0001-assert-macro.patch"
] ]
}, },
"zycore": { "zycore": {

5
src/dynarmic/src/dynarmic/backend/arm64/emit_arm64.cpp

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
/* This file is part of the dynarmic project. /* This file is part of the dynarmic project.
* Copyright (c) 2022 MerryMage * Copyright (c) 2022 MerryMage
* SPDX-License-Identifier: 0BSD * SPDX-License-Identifier: 0BSD
@ -238,7 +241,7 @@ EmittedBlockInfo EmitArm64(oaknut::CodeGenerator& code, IR::Block block, const E
#undef A32OPC #undef A32OPC
#undef A64OPC #undef A64OPC
default: default:
ASSERT_FALSE("Invalid opcode: {}", inst->GetOpcode());
ASSERT_FALSE("Invalid opcode: {:x}", std::size_t(inst->GetOpcode()));
break; break;
} }

5
src/dynarmic/src/dynarmic/backend/riscv64/emit_riscv64.cpp

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
/* This file is part of the dynarmic project. /* This file is part of the dynarmic project.
* Copyright (c) 2024 MerryMage * Copyright (c) 2024 MerryMage
* SPDX-License-Identifier: 0BSD * SPDX-License-Identifier: 0BSD
@ -140,7 +143,7 @@ EmittedBlockInfo EmitRV64(biscuit::Assembler& as, IR::Block block, const EmitCon
#undef A32OPC #undef A32OPC
#undef A64OPC #undef A64OPC
default: default:
ASSERT_FALSE("Invalid opcode: {}", inst->GetOpcode());
ASSERT_FALSE("Invalid opcode: {:x}", std::size_t(inst->GetOpcode()));
break; break;
} }
} }

2
src/dynarmic/src/dynarmic/backend/x64/a32_emit_x64.cpp

@ -145,7 +145,7 @@ A32EmitX64::BlockDescriptor A32EmitX64::Emit(IR::Block& block) {
#undef OPCODE #undef OPCODE
#undef A32OPC #undef A32OPC
#undef A64OPC #undef A64OPC
default: [[unlikely]] ASSERT_FALSE("Invalid opcode: {}", inst->GetOpcode());
default: [[unlikely]] ASSERT_FALSE("Invalid opcode: {:x}", std::size_t(inst->GetOpcode()));
} }
reg_alloc.EndOfAllocScope(); reg_alloc.EndOfAllocScope();
func(reg_alloc); func(reg_alloc);

2
src/dynarmic/src/dynarmic/backend/x64/a64_emit_x64.cpp

@ -130,7 +130,7 @@ A64EmitX64::BlockDescriptor A64EmitX64::Emit(IR::Block& block) noexcept {
#undef A32OPC #undef A32OPC
#undef A64OPC #undef A64OPC
default: [[unlikely]] { default: [[unlikely]] {
ASSERT_MSG(false, "Invalid opcode: {}", opcode);
ASSERT_MSG(false, "Invalid opcode: {:x}", std::size_t(opcode));
goto finish_this_inst; goto finish_this_inst;
} }
} }

2
src/dynarmic/src/dynarmic/backend/x64/emit_x64.cpp

@ -59,7 +59,7 @@ std::optional<EmitX64::BlockDescriptor> EmitX64::GetBasicBlock(IR::LocationDescr
} }
void EmitX64::EmitInvalid(EmitContext&, IR::Inst* inst) { void EmitX64::EmitInvalid(EmitContext&, IR::Inst* inst) {
ASSERT_MSG(false, "Invalid opcode: {}", inst->GetOpcode());
ASSERT_MSG(false, "Invalid opcode: {:x}", std::size_t(inst->GetOpcode()));
} }
void EmitX64::EmitVoid(EmitContext&, IR::Inst*) { void EmitX64::EmitVoid(EmitContext&, IR::Inst*) {

8
src/dynarmic/src/dynarmic/ir/opcodes.h

@ -654,11 +654,3 @@ constexpr bool MayGetNZCVFromOp(const Opcode op) noexcept {
} }
} // namespace Dynarmic::IR } // namespace Dynarmic::IR
template<>
struct fmt::formatter<Dynarmic::IR::Opcode> : fmt::formatter<std::string> {
template<typename FormatContext>
auto format(Dynarmic::IR::Opcode op, FormatContext& ctx) const {
return formatter<std::string>::format(Dynarmic::IR::GetNameOf(op), ctx);
}
};

1
src/qt_common/config/shared_translation.h

@ -14,6 +14,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <QString> #include <QString>
#include <QObject>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/settings_enums.h" #include "common/settings_enums.h"

2
src/qt_common/qt_compat.h

@ -3,7 +3,7 @@
#pragma once #pragma once
#include <QtVersionChecks>
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
#define STATE_CHANGED stateChanged #define STATE_CHANGED stateChanged

15
src/qt_common/util/compress.cpp

@ -82,16 +82,9 @@ bool compressSubDir(QuaZip *zip,
if (dir != origDir) { if (dir != origDir) {
QuaZipFile dirZipFile(zip); QuaZipFile dirZipFile(zip);
std::unique_ptr<QuaZipNewInfo> qzni; std::unique_ptr<QuaZipNewInfo> qzni;
if (options.getDateTime().isNull()) {
qzni = std::make_unique<QuaZipNewInfo>(origDirectory.relativeFilePath(dir)
+ QLatin1String("/"),
dir);
} else {
qzni = std::make_unique<QuaZipNewInfo>(origDirectory.relativeFilePath(dir)
+ QLatin1String("/"),
dir,
options.getDateTime());
}
qzni = std::make_unique<QuaZipNewInfo>(origDirectory.relativeFilePath(dir)
+ QLatin1String("/"),
dir);
if (!dirZipFile.open(QIODevice::WriteOnly, *qzni, nullptr, 0, 0)) { if (!dirZipFile.open(QIODevice::WriteOnly, *qzni, nullptr, 0, 0)) {
return false; return false;
} }
@ -156,7 +149,7 @@ bool compressFile(QuaZip *zip,
return false; return false;
} else { } else {
if (!outFile.open(QIODevice::WriteOnly, if (!outFile.open(QIODevice::WriteOnly,
QuaZipNewInfo(fileDest, fileName, options.getDateTime()),
QuaZipNewInfo(fileDest, fileName),
nullptr, nullptr,
0, 0,
options.getCompressionMethod(), options.getCompressionMethod(),

11
src/qt_common/util/content.cpp

@ -415,10 +415,8 @@ void ExportDataDir(FrontendCommon::DataManager::DataDir data_dir,
QGuiApplication::processEvents(); QGuiApplication::processEvents();
auto progress_callback = [=](size_t total_size, size_t processed_size) { auto progress_callback = [=](size_t total_size, size_t processed_size) {
QMetaObject::invokeMethod(progress,
&QtProgressDialog::setValue,
static_cast<int>((processed_size * 100) / total_size));
QMetaObject::invokeMethod(progress, "setValue", Qt::DirectConnection,
Q_ARG(int, static_cast<int>((processed_size * 100) / total_size)));
return !progress->wasCanceled(); return !progress->wasCanceled();
}; };
@ -501,9 +499,8 @@ void ImportDataDir(FrontendCommon::DataManager::DataDir data_dir,
QObject::connect(delete_watcher, &QFutureWatcher<bool>::finished, rootObject, [=]() { QObject::connect(delete_watcher, &QFutureWatcher<bool>::finished, rootObject, [=]() {
auto progress_callback = [=](size_t total_size, size_t processed_size) { auto progress_callback = [=](size_t total_size, size_t processed_size) {
QMetaObject::invokeMethod(progress,
&QtProgressDialog::setValue,
static_cast<int>((processed_size * 100) / total_size));
QMetaObject::invokeMethod(progress, "setValue", Qt::DirectConnection,
Q_ARG(int, static_cast<int>((processed_size * 100) / total_size)));
return !progress->wasCanceled(); return !progress->wasCanceled();
}; };

Loading…
Cancel
Save