From 989a95a1772dfa800f173d2d1c3eb22ac39c0afa Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 17 Mar 2026 18:19:52 +0100 Subject: [PATCH 1/2] Core: Add INI-only setting for page table fastmem --- Source/Core/Core/Config/MainSettings.cpp | 1 + Source/Core/Core/Config/MainSettings.h | 1 + Source/Core/Core/PowerPC/JitCommon/JitBase.cpp | 9 +++++---- Source/Core/Core/PowerPC/JitCommon/JitBase.h | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Config/MainSettings.cpp b/Source/Core/Core/Config/MainSettings.cpp index 441c5dd031..3d46d756bf 100644 --- a/Source/Core/Core/Config/MainSettings.cpp +++ b/Source/Core/Core/Config/MainSettings.cpp @@ -44,6 +44,7 @@ const Info MAIN_CPU_CORE{{System::Main, "Core", "CPUCore"}, PowerPC::DefaultCPUCore()}; const Info MAIN_JIT_FOLLOW_BRANCH{{System::Main, "Core", "JITFollowBranch"}, true}; const Info MAIN_FASTMEM{{System::Main, "Core", "Fastmem"}, true}; +const Info MAIN_PAGE_TABLE_FASTMEM{{System::Main, "Core", "PageTableFastmem"}, true}; const Info MAIN_FASTMEM_ARENA{{System::Main, "Core", "FastmemArena"}, true}; const Info MAIN_LARGE_ENTRY_POINTS_MAP{{System::Main, "Core", "LargeEntryPointsMap"}, true}; const Info MAIN_ACCURATE_CPU_CACHE{{System::Main, "Core", "AccurateCPUCache"}, false}; diff --git a/Source/Core/Core/Config/MainSettings.h b/Source/Core/Core/Config/MainSettings.h index 1946045e48..a1baf26242 100644 --- a/Source/Core/Core/Config/MainSettings.h +++ b/Source/Core/Core/Config/MainSettings.h @@ -57,6 +57,7 @@ extern const Info MAIN_SKIP_IPL; extern const Info MAIN_CPU_CORE; extern const Info MAIN_JIT_FOLLOW_BRANCH; extern const Info MAIN_FASTMEM; +extern const Info MAIN_PAGE_TABLE_FASTMEM; extern const Info MAIN_FASTMEM_ARENA; extern const Info MAIN_LARGE_ENTRY_POINTS_MAP; extern const Info MAIN_ACCURATE_CPU_CACHE; diff --git a/Source/Core/Core/PowerPC/JitCommon/JitBase.cpp b/Source/Core/Core/PowerPC/JitCommon/JitBase.cpp index d0ecd0a2b4..b2ff246cce 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitBase.cpp +++ b/Source/Core/Core/PowerPC/JitCommon/JitBase.cpp @@ -58,7 +58,7 @@ // After resetting the stack to the top, we call _resetstkoflw() to restore // the guard page at the 256kb mark. -const std::array*>, 24> JitBase::JIT_SETTINGS{{ +const std::array*>, 25> JitBase::JIT_SETTINGS{{ {&JitBase::bJITOff, &Config::MAIN_DEBUG_JIT_OFF}, {&JitBase::bJITLoadStoreOff, &Config::MAIN_DEBUG_JIT_LOAD_STORE_OFF}, {&JitBase::bJITLoadStorelXzOff, &Config::MAIN_DEBUG_JIT_LOAD_STORE_LXZ_OFF}, @@ -82,6 +82,7 @@ const std::array*>, 24> JitB {&JitBase::m_accurate_nans, &Config::MAIN_ACCURATE_NANS}, {&JitBase::m_accurate_fmadds, &Config::MAIN_ACCURATE_FMADDS}, {&JitBase::m_fastmem_enabled, &Config::MAIN_FASTMEM}, + {&JitBase::m_page_table_fastmem_enabled, &Config::MAIN_PAGE_TABLE_FASTMEM}, {&JitBase::m_accurate_cpu_cache_enabled, &Config::MAIN_ACCURATE_CPU_CACHE}, }}; @@ -145,9 +146,9 @@ void JitBase::RefreshConfig() jo.fp_exceptions = m_enable_float_exceptions; jo.div_by_zero_exceptions = m_enable_div_by_zero_exceptions; - if (!wanted_page_table_mappings && WantsPageTableMappings()) + if (wanted_page_table_mappings != WantsPageTableMappings()) { - // Mustn't call this if we're still initializing + // Mustn't call this if we're still initializing - it'll cause a crash if (Core::IsRunning(m_system)) m_system.GetMMU().PageTableUpdated(); } @@ -155,7 +156,7 @@ void JitBase::RefreshConfig() bool JitBase::WantsPageTableMappings() const { - return jo.fastmem; + return jo.fastmem && m_page_table_fastmem_enabled; } void JitBase::InitFastmemArena() diff --git a/Source/Core/Core/PowerPC/JitCommon/JitBase.h b/Source/Core/Core/PowerPC/JitCommon/JitBase.h index 2f366ad07f..612161b492 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitBase.h +++ b/Source/Core/Core/PowerPC/JitCommon/JitBase.h @@ -161,13 +161,14 @@ protected: bool m_accurate_nans = false; bool m_accurate_fmadds = false; bool m_fastmem_enabled = false; + bool m_page_table_fastmem_enabled = false; bool m_accurate_cpu_cache_enabled = false; bool m_enable_blr_optimization = false; bool m_cleanup_after_stackfault = false; u8* m_stack_guard = nullptr; - static const std::array*>, 24> JIT_SETTINGS; + static const std::array*>, 25> JIT_SETTINGS; bool DoesConfigNeedRefresh() const; void RefreshConfig(); From f509481cbf336ec420592b0d43b7c92dae9c8372 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 17 Mar 2026 18:45:15 +0100 Subject: [PATCH 2/2] Disable page table fastmem for TimeSplitters: Future Perfect TimeSplitters: Future Perfect is crashing if page table fastmem is enabled. The reason hasn't been analyzed yet. For the time being, let's use GameSettings to bring back the old behavior of not having page table fastmem. Fixes https://bugs.dolphin-emu.org/issues/14000. --- Data/Sys/GameSettings/G3F.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Data/Sys/GameSettings/G3F.ini b/Data/Sys/GameSettings/G3F.ini index 8d1eed58ca..a3db583a5a 100644 --- a/Data/Sys/GameSettings/G3F.ini +++ b/Data/Sys/GameSettings/G3F.ini @@ -3,6 +3,8 @@ [Core] # Values set here will override the main Dolphin settings. MMU = True +# Fixes freeze on second loading screen +PageTableFastmem = False [OnFrame] # Add memory patches to be applied every frame here.