summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGPUCode <geoster3d@gmail.com>2023-11-17 21:23:48 +0100
committert895 <clombardo169@gmail.com>2023-11-25 06:46:47 +0100
commit48388376206aaa7d887b41030019035a06203867 (patch)
tree6dc27b3fc69d7ec4a1d4247fd0a00b7542ef72d4
parentexternals: Add oaknut submodule (diff)
downloadyuzu-48388376206aaa7d887b41030019035a06203867.tar
yuzu-48388376206aaa7d887b41030019035a06203867.tar.gz
yuzu-48388376206aaa7d887b41030019035a06203867.tar.bz2
yuzu-48388376206aaa7d887b41030019035a06203867.tar.lz
yuzu-48388376206aaa7d887b41030019035a06203867.tar.xz
yuzu-48388376206aaa7d887b41030019035a06203867.tar.zst
yuzu-48388376206aaa7d887b41030019035a06203867.zip
Diffstat (limited to '')
-rw-r--r--src/common/settings.cpp10
-rw-r--r--src/common/settings.h3
-rw-r--r--src/core/core.cpp3
-rw-r--r--src/core/device_memory.cpp11
-rw-r--r--src/core/device_memory.h2
5 files changed, 21 insertions, 8 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index 19dfe08da..167e984a6 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -156,8 +156,14 @@ bool IsFastmemEnabled() {
return true;
}
-bool IsNceEnabled(bool is_64bit) {
- return values.cpu_backend.GetValue() == CpuBackend::Nce && is_64bit;
+static bool is_nce_enabled = false;
+
+void SetNceEnabled(bool is_64bit) {
+ is_nce_enabled = values.cpu_backend.GetValue() == CpuBackend::Nce && is_64bit;
+}
+
+bool IsNceEnabled() {
+ return is_nce_enabled;
}
bool IsDockedMode() {
diff --git a/src/common/settings.h b/src/common/settings.h
index 389c747cb..fea639ee3 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -573,7 +573,8 @@ bool IsGPULevelExtreme();
bool IsGPULevelHigh();
bool IsFastmemEnabled();
-bool IsNceEnabled(bool is_64bit = true);
+void SetNceEnabled(bool is_64bit);
+bool IsNceEnabled();
bool IsDockedMode();
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 14d6c8c27..1d557fb43 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -136,7 +136,8 @@ struct System::Impl {
}
void Initialize(System& system) {
- device_memory = std::make_unique<Core::DeviceMemory>();
+ const bool direct_mapped_address = Settings::IsNceEnabled();
+ device_memory = std::make_unique<Core::DeviceMemory>(direct_mapped_address);
is_multicore = Settings::values.use_multi_core.GetValue();
extended_memory_layout =
diff --git a/src/core/device_memory.cpp b/src/core/device_memory.cpp
index de3f8ef8f..0528a8e3b 100644
--- a/src/core/device_memory.cpp
+++ b/src/core/device_memory.cpp
@@ -6,15 +6,20 @@
namespace Core {
-#ifdef ANDROID
+#ifdef ARCHITECTURE_arm64
constexpr size_t VirtualReserveSize = 1ULL << 38;
#else
constexpr size_t VirtualReserveSize = 1ULL << 39;
#endif
-DeviceMemory::DeviceMemory()
+DeviceMemory::DeviceMemory(bool direct_mapped_address)
: buffer{Kernel::Board::Nintendo::Nx::KSystemControl::Init::GetIntendedMemorySize(),
- VirtualReserveSize} {}
+ VirtualReserveSize} {
+ if (direct_mapped_address) {
+ buffer.EnableDirectMappedAddress();
+ }
+}
+
DeviceMemory::~DeviceMemory() = default;
} // namespace Core
diff --git a/src/core/device_memory.h b/src/core/device_memory.h
index 13388b73e..368f19e86 100644
--- a/src/core/device_memory.h
+++ b/src/core/device_memory.h
@@ -18,7 +18,7 @@ enum : u64 {
class DeviceMemory {
public:
- explicit DeviceMemory();
+ explicit DeviceMemory(bool direct_mapped_address);
~DeviceMemory();
DeviceMemory& operator=(const DeviceMemory&) = delete;