From fdf1bfc06a5ada9f9abcd3d16e8adf998000c037 Mon Sep 17 00:00:00 2001 From: Zephyron Date: Sat, 24 May 2025 17:10:19 +1000 Subject: [PATCH] feat: Add 10GB, 12GB, 14GB, and 16GB DRAM configuration options - Extended MemoryLayout enum with new memory size options - Added corresponding SMC memory size and arrangement constants - Updated system control functions to handle new memory configurations - Added appropriate application pool sizes for higher memory modes - Updated UI translations to display new DRAM options as "Unsafe" - Increased maximum memory layout setting from 8GB to 16GB This allows users to configure higher memory amounts for games and texture mods that require more than the standard 4-8GB configurations. All new options are marked as "Unsafe" in the UI to indicate they are experimental features beyond Nintendo's official specifications. Signed-off-by: Zephyron --- .../configuration/shared_translation.cpp | 4 ++ src/common/settings.h | 2 +- src/common/settings_enums.h | 2 +- .../board/nintendo/nx/k_system_control.cpp | 41 +++++++++++++++++++ .../kernel/board/nintendo/nx/secure_monitor.h | 9 ++++ 5 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/citron/configuration/shared_translation.cpp b/src/citron/configuration/shared_translation.cpp index 8a4786966..120e0a72a 100644 --- a/src/citron/configuration/shared_translation.cpp +++ b/src/citron/configuration/shared_translation.cpp @@ -517,6 +517,10 @@ std::unique_ptr ComboboxEnumeration(QWidget* parent) { PAIR(MemoryLayout, Memory_4Gb, tr("4GB DRAM (Default)")), PAIR(MemoryLayout, Memory_6Gb, tr("6GB DRAM (Unsafe)")), PAIR(MemoryLayout, Memory_8Gb, tr("8GB DRAM (Unsafe)")), + PAIR(MemoryLayout, Memory_10Gb, tr("10GB DRAM (Unsafe)")), + PAIR(MemoryLayout, Memory_12Gb, tr("12GB DRAM (Unsafe)")), + PAIR(MemoryLayout, Memory_14Gb, tr("14GB DRAM (Unsafe)")), + PAIR(MemoryLayout, Memory_16Gb, tr("16GB DRAM (Unsafe)")), }}); translations->insert({Settings::EnumMetadata::Index(), { diff --git a/src/common/settings.h b/src/common/settings.h index a2d0d5508..6f7d4df93 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -196,7 +196,7 @@ struct Values { SwitchableSetting memory_layout_mode{linkage, MemoryLayout::Memory_4Gb, MemoryLayout::Memory_4Gb, - MemoryLayout::Memory_8Gb, + MemoryLayout::Memory_16Gb, "memory_layout_mode", Category::Core}; SwitchableSetting use_speed_limit{ diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h index cf35618fe..06a787773 100644 --- a/src/common/settings_enums.h +++ b/src/common/settings_enums.h @@ -135,7 +135,7 @@ ENUM(CpuBackend, Dynarmic, Nce); ENUM(CpuAccuracy, Auto, Accurate, Unsafe, Paranoid); -ENUM(MemoryLayout, Memory_4Gb, Memory_6Gb, Memory_8Gb); +ENUM(MemoryLayout, Memory_4Gb, Memory_6Gb, Memory_8Gb, Memory_10Gb, Memory_12Gb, Memory_14Gb, Memory_16Gb); ENUM(ConfirmStop, Ask_Always, Ask_Based_On_Game, Ask_Never); diff --git a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp index 37fa39a73..98bd4b5f9 100644 --- a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp +++ b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project +// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include @@ -48,6 +49,14 @@ u32 GetMemorySizeForInit() { return Smc::MemorySize_6GB; case Settings::MemoryLayout::Memory_8Gb: return Smc::MemorySize_8GB; + case Settings::MemoryLayout::Memory_10Gb: + return Smc::MemorySize_10GB; + case Settings::MemoryLayout::Memory_12Gb: + return Smc::MemorySize_12GB; + case Settings::MemoryLayout::Memory_14Gb: + return Smc::MemorySize_14GB; + case Settings::MemoryLayout::Memory_16Gb: + return Smc::MemorySize_16GB; } return Smc::MemorySize_4GB; } @@ -60,6 +69,14 @@ Smc::MemoryArrangement GetMemoryArrangeForInit() { return Smc::MemoryArrangement_6GB; case Settings::MemoryLayout::Memory_8Gb: return Smc::MemoryArrangement_8GB; + case Settings::MemoryLayout::Memory_10Gb: + return Smc::MemoryArrangement_10GB; + case Settings::MemoryLayout::Memory_12Gb: + return Smc::MemoryArrangement_12GB; + case Settings::MemoryLayout::Memory_14Gb: + return Smc::MemoryArrangement_14GB; + case Settings::MemoryLayout::Memory_16Gb: + return Smc::MemoryArrangement_16GB; } return Smc::MemoryArrangement_4GB; } @@ -79,6 +96,14 @@ size_t KSystemControl::Init::GetIntendedMemorySize() { return 6_GiB; case Smc::MemorySize_8GB: return 8_GiB; + case Smc::MemorySize_10GB: + return 10_GiB; + case Smc::MemorySize_12GB: + return 12_GiB; + case Smc::MemorySize_14GB: + return 14_GiB; + case Smc::MemorySize_16GB: + return 16_GiB; } } @@ -114,6 +139,14 @@ std::size_t KSystemControl::Init::GetApplicationPoolSize() { case Smc::MemoryArrangement_8GB: // Real kernel sets this to 4916_MiB. We are not debugging applets. return 6547_MiB; + case Smc::MemoryArrangement_10GB: + return 8547_MiB; // ~8.35GB app pool + case Smc::MemoryArrangement_12GB: + return 10547_MiB; // ~10.3GB app pool + case Smc::MemoryArrangement_14GB: + return 12547_MiB; // ~12.25GB app pool + case Smc::MemoryArrangement_16GB: + return 14547_MiB; // ~14.2GB app pool } }(); @@ -139,6 +172,14 @@ size_t KSystemControl::Init::GetAppletPoolSize() { case Smc::MemoryArrangement_8GB: //! Real kernel sets this to 2193_MiB. We are not debugging applets. return 562_MiB; + case Smc::MemoryArrangement_10GB: + return 562_MiB; // Keep consistent with 8GB + case Smc::MemoryArrangement_12GB: + return 562_MiB; // Keep consistent with 8GB + case Smc::MemoryArrangement_14GB: + return 562_MiB; // Keep consistent with 8GB + case Smc::MemoryArrangement_16GB: + return 562_MiB; // Keep consistent with 8GB } }(); diff --git a/src/core/hle/kernel/board/nintendo/nx/secure_monitor.h b/src/core/hle/kernel/board/nintendo/nx/secure_monitor.h index b0e4123f0..2655b328d 100644 --- a/src/core/hle/kernel/board/nintendo/nx/secure_monitor.h +++ b/src/core/hle/kernel/board/nintendo/nx/secure_monitor.h @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project +// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #pragma once @@ -9,6 +10,10 @@ enum MemorySize { MemorySize_4GB = 0, MemorySize_6GB = 1, MemorySize_8GB = 2, + MemorySize_10GB = 3, + MemorySize_12GB = 4, + MemorySize_14GB = 5, + MemorySize_16GB = 6, }; enum MemoryArrangement { @@ -18,6 +23,10 @@ enum MemoryArrangement { MemoryArrangement_6GB = 3, MemoryArrangement_6GBForAppletDev = 4, MemoryArrangement_8GB = 5, + MemoryArrangement_10GB = 6, + MemoryArrangement_12GB = 7, + MemoryArrangement_14GB = 8, + MemoryArrangement_16GB = 9, }; } // namespace Kernel::Board::Nintendo::Nx::Smc