Port UMA part 5.3 (NCE EXT)

This commit is contained in:
CamilleLaVey
2026-10-01 16:52:15 -04:00
parent 73cac64037
commit e11ea7f008
8 changed files with 27 additions and 0 deletions
@@ -20,6 +20,7 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
EMULATE_BGR565("emulate_bgr565"),
RESCALE_HACK("rescale_hack"),
CPUOPT_UNSAFE_HOST_MMU("cpuopt_unsafe_host_mmu"),
RELOCATE_36BIT_ADDRESS_SPACE("relocate_36bit_address_space"),
USE_DOCKED_MODE("use_docked_mode"),
USE_AUTO_STUB("use_auto_stub"),
RENDERER_USE_DISK_SHADER_CACHE("use_disk_shader_cache"),
@@ -846,6 +846,13 @@ abstract class SettingsItem(
descriptionId = R.string.cpuopt_unsafe_host_mmu_description
)
)
put(
SwitchSetting(
BooleanSetting.RELOCATE_36BIT_ADDRESS_SPACE,
titleId = R.string.relocate_36bit_address_space,
descriptionId = R.string.relocate_36bit_address_space_description
)
)
put(
SwitchSetting(
BooleanSetting.RENDERER_REACTIVE_FLUSHING,
@@ -1527,6 +1527,7 @@ class SettingsFragmentPresenter(
add(HeaderSetting(R.string.cpu))
add(IntSetting.CPU_BACKEND.key)
add(BooleanSetting.RELOCATE_36BIT_ADDRESS_SPACE.key)
add(IntSetting.CPU_ACCURACY.key)
add(BooleanSetting.USE_AUTO_STUB.key)
add(SettingsItem.FASTMEM_COMBINED)
@@ -105,6 +105,8 @@
<string name="use_sync_core_description">Synchronize the core tick speed to the maximum speed percentage to improve performance without altering the game\'s actual speed.</string>
<string name="cpuopt_unsafe_host_mmu">Enable Host MMU Emulation</string>
<string name="cpuopt_unsafe_host_mmu_description">This optimization speeds up memory accesses by the guest program. Enabling it causes guest memory reads/writes to be done directly into memory and make use of Host\'s MMU. Disabling this forces all memory accesses to use Software MMU Emulation.</string>
<string name="relocate_36bit_address_space">Run 36-bit games natively</string>
<string name="relocate_36bit_address_space_description">Gives games built for the 36-bit address space the 39-bit layout so they can run with NCE instead of the JIT. Experimental: a game that relies on 36-bit addresses can crash.</string>
<string name="debug_knobs">Debug knobs</string>
<string name="debug_knobs_description">For development use only.</string>
<string name="debug_knobs_hint">0 to 65535</string>
+2
View File
@@ -259,6 +259,8 @@ struct Values {
Category::Cpu};
SwitchableSetting<CpuAccuracy, true> cpu_accuracy{linkage, CpuAccuracy::Auto,
"cpu_accuracy", Category::Cpu};
SwitchableSetting<bool> relocate_36bit_address_space{
linkage, false, "relocate_36bit_address_space", Category::Cpu};
SwitchableSetting<CpuClock> cpu_clock{linkage,
CpuClock::Normal,
"fast_cpu_time",
+4
View File
@@ -147,6 +147,10 @@ ProgramAddressSpaceType ProgramMetadata::GetAddressSpaceType() const {
return npdm_header.address_space_type;
}
void ProgramMetadata::SetAddressSpaceType(ProgramAddressSpaceType address_space) {
npdm_header.address_space_type.Assign(address_space);
}
u8 ProgramMetadata::GetMainThreadPriority() const {
return npdm_header.main_thread_priority;
}
+4
View File
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 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
@@ -73,6 +76,7 @@ public:
bool Is64BitProgram() const;
ProgramAddressSpaceType GetAddressSpaceType() const;
void SetAddressSpaceType(ProgramAddressSpaceType address_space);
u8 GetMainThreadPriority() const;
u8 GetMainThreadCore() const;
u32 GetMainThreadStackSize() const;
@@ -182,6 +182,12 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
}
metadata.Print();
if (Settings::values.relocate_36bit_address_space.GetValue() &&
Settings::values.cpu_backend.GetValue() == Settings::CpuBackend::Nce &&
metadata.GetAddressSpaceType() == FileSys::ProgramAddressSpaceType::Is36Bit) {
metadata.SetAddressSpaceType(FileSys::ProgramAddressSpaceType::Is39Bit);
}
// Enable NCE only for applications with 39-bit address space.
const bool is_39bit =
metadata.GetAddressSpaceType() == FileSys::ProgramAddressSpaceType::Is39Bit;