Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

[dynarmic] fix userconfig casting warn (#55)

lizzie7b23cd0df4c2
diff --git a/externals/dynarmic/src/dynarmic/interface/A32/config.h b/externals/dynarmic/src/dynarmic/interface/A32/config.h
index 033967dc00..11fe2236a2 100644
--- a/externals/dynarmic/src/dynarmic/interface/A32/config.h
+++ b/externals/dynarmic/src/dynarmic/interface/A32/config.h
@@ -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.
* Copyright (c) 2016 MerryMage
* SPDX-License-Identifier: 0BSD
@@ -159,9 +162,6 @@ struct UserConfig {
/// Maximum size is limited by the maximum length of a x86_64 / arm64 jump.
std::uint32_t code_cache_size = 128 * 1024 * 1024; // bytes
- /// Processor ID
- std::uint32_t processor_id = 0;
-
/// Masks out the first N bits in host pointers from the page table.
/// The intention behind this is to allow users of Dynarmic to pack attributes in the
/// same integer and update the pointer attribute pair atomically.
@@ -172,6 +172,9 @@ struct UserConfig {
/// There are minor behavioural differences between versions.
ArchVersion arch_version = ArchVersion::v8;
+ /// Processor ID
+ std::uint8_t processor_id = 0;
+
/// Determines if we should detect memory accesses via page_table that straddle are
/// misaligned. Accesses that straddle page boundaries will fallback to the relevant
/// memory callback.
diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp
index d21aa5aacf..afbf178349 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp
@@ -1,3 +1,6 @@
+// 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
@@ -201,7 +204,7 @@ std::shared_ptr<Dynarmic::A32::Jit> ArmDynarmic32::MakeJit(Common::PageTable* pa
}
// Multi-process state
- config.processor_id = m_core_index;
+ config.processor_id = std::uint8_t(m_core_index);
config.global_monitor = &m_exclusive_monitor.monitor;
// Timing
@@ -210,9 +213,9 @@ std::shared_ptr<Dynarmic::A32::Jit> ArmDynarmic32::MakeJit(Common::PageTable* pa
// Code cache size
#ifdef ARCHITECTURE_arm64
- config.code_cache_size = 128_MiB;
+ config.code_cache_size = std::uint32_t(128_MiB);
#else
- config.code_cache_size = 512_MiB;
+ config.code_cache_size = std::uint32_t(512_MiB);
#endif
// Allow memory fault handling to work
@@ -223,7 +226,7 @@ std::shared_ptr<Dynarmic::A32::Jit> ArmDynarmic32::MakeJit(Common::PageTable* pa
// null_jit
if (!page_table) {
// Don't waste too much memory on null_jit
- config.code_cache_size = 8_MiB;
+ config.code_cache_size = std::uint32_t(8_MiB);
}
// Safe optimizations
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
index c251482182..99a80644ad 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
@@ -1,3 +1,6 @@
+// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -232,7 +235,7 @@ std::shared_ptr<Dynarmic::A64::Jit> ArmDynarmic64::MakeJit(Common::PageTable* pa
// Memory
if (page_table) {
config.page_table = reinterpret_cast<void**>(page_table->pointers.data());
- config.page_table_address_space_bits = address_space_bits;
+ config.page_table_address_space_bits = std::uint32_t(address_space_bits);
config.page_table_pointer_mask_bits = Common::PageTable::ATTRIBUTE_BITS;
config.silently_mirror_page_table = false;
config.absolute_offset_page_table = true;
@@ -242,7 +245,7 @@ std::shared_ptr<Dynarmic::A64::Jit> ArmDynarmic64::MakeJit(Common::PageTable* pa
config.fastmem_pointer = page_table->fastmem_arena ?
std::optional<uintptr_t>{reinterpret_cast<uintptr_t>(page_table->fastmem_arena)} :
std::nullopt;
- config.fastmem_address_space_bits = address_space_bits;
+ config.fastmem_address_space_bits = std::uint32_t(address_space_bits);
config.silently_mirror_fastmem = false;
config.fastmem_exclusive_access = config.fastmem_pointer != std::nullopt;
@@ -250,7 +253,7 @@ std::shared_ptr<Dynarmic::A64::Jit> ArmDynarmic64::MakeJit(Common::PageTable* pa
}
// Multi-process state
- config.processor_id = m_core_index;
+ config.processor_id = std::uint8_t(m_core_index);
config.global_monitor = &m_exclusive_monitor.monitor;
// System registers
@@ -269,9 +272,9 @@ std::shared_ptr<Dynarmic::A64::Jit> ArmDynarmic64::MakeJit(Common::PageTable* pa
// Code cache size
#ifdef ARCHITECTURE_arm64
- config.code_cache_size = 128_MiB;
+ config.code_cache_size = std::uint32_t(128_MiB);
#else
- config.code_cache_size = 512_MiB;
+ config.code_cache_size = std::uint32_t(512_MiB);
#endif
// Allow memory fault handling to work
@@ -282,7 +285,7 @@ std::shared_ptr<Dynarmic::A64::Jit> ArmDynarmic64::MakeJit(Common::PageTable* pa
// null_jit
if (!page_table) {
// Don't waste too much memory on null_jit
- config.code_cache_size = 8_MiB;
+ config.code_cache_size = std::uint32_t(8_MiB);
}
// Safe optimizations