From 1203082a8f1211ad6ce4d95f0c6947f7ecd27a55 Mon Sep 17 00:00:00 2001 From: lizzie Date: Thu, 17 Sep 2026 08:16:18 +0200 Subject: [PATCH] [msvc] fix build errors (#4451) MSVC doesn't consider atomic to be trivially copyable on x86 (why?). And other chary idiosyncrasies from constructing `std::optional` Signed-off-by: lizzie - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4451 Reviewed-by: Maufeat Reviewed-by: CamilleLaVey --- src/common/sparse_large_vector.h | 3 ++- src/core/arm/dynarmic/arm_dynarmic_32.cpp | 4 ++-- src/core/arm/dynarmic/arm_dynarmic_64.cpp | 4 ++-- src/core/hle/service/ssl/ssl.cpp | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/common/sparse_large_vector.h b/src/common/sparse_large_vector.h index 827944fb08..dad3aea97e 100644 --- a/src/common/sparse_large_vector.h +++ b/src/common/sparse_large_vector.h @@ -38,7 +38,8 @@ void FreeMemoryPages(void* base, std::size_t size) noexcept; /// A large page-aligned buffer that has optimized memory usage for zero-writes. template -requires std::is_trivially_copyable_v + // MSVC doesn't regard structs with atomics as trivially copyable + // requires std::is_trivially_copyable_v class SparseLargeVector final { public: constexpr SparseLargeVector() = default; diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp index 80e2b2dca9..8be0abc4fa 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp @@ -177,7 +177,7 @@ void ArmDynarmic32::MakeJit(Common::PageTable* page_table) { config.page_table = reinterpret_cast*>( const_cast(page_table->entries.data())); config.page_table_pointer_mask = Common::PageTable::ATTRIBUTE_MASK; - config.page_table_marked_bit = 0; + config.page_table_marked_bit = uint8_t(0); config.absolute_offset_page_table = true; config.detect_misaligned_access_via_page_table = 16 | 32 | 64 | 128; config.only_detect_misalignment_via_page_table_on_page_boundary = true; @@ -193,7 +193,7 @@ void ArmDynarmic32::MakeJit(Common::PageTable* page_table) { Kernel::Board::Nintendo::Nx::KSystemControl::Init::GetIntendedMemorySize()) < (1ULL << 39)) { // Systems like FreeBSD allocate memory really low by default, and since we pack our page table entries, // we have to manually sign extend when our actual pointer is negative. - config.page_table_sign_extension = Common::PageTable::SIGN_BIT; + config.page_table_sign_extension = std::uint8_t(Common::PageTable::SIGN_BIT); } } diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index 9662bf1712..9db40b9356 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp @@ -216,7 +216,7 @@ void ArmDynarmic64::MakeJit(Common::PageTable* page_table, std::size_t address_s const_cast(page_table->entries.data())); config.page_table_address_space_bits = std::uint32_t(address_space_bits); config.page_table_pointer_mask = Common::PageTable::ATTRIBUTE_MASK; - config.page_table_marked_bit = 0; + config.page_table_marked_bit = uint8_t(0); config.silently_mirror_page_table = false; config.absolute_offset_page_table = true; config.detect_misaligned_access_via_page_table = 16 | 32 | 64 | 128; @@ -235,7 +235,7 @@ void ArmDynarmic64::MakeJit(Common::PageTable* page_table, std::size_t address_s Kernel::Board::Nintendo::Nx::KSystemControl::Init::GetIntendedMemorySize()) < (1ULL << 39)) { // Systems like FreeBSD allocate memory really low by default, and since we pack our page table entries, // we have to manually sign extend when our actual pointer is negative. - config.page_table_sign_extension = Common::PageTable::SIGN_BIT; + config.page_table_sign_extension = std::uint8_t(Common::PageTable::SIGN_BIT); } } diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index 178c4c690b..999efd4295 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp @@ -238,7 +238,7 @@ private: Result GetSocketDescriptor(Out out_fd) { LOG_WARNING(Service_SSL, "(STUBBED)"); - *out_fd = socket->GetFD(); + *out_fd = uint32_t(socket->GetFD()); R_SUCCEED(); }