From c55f21729f03c1348259202f8db2dbfd8358c548 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 10 Dec 2023 20:50:58 +0100 Subject: [PATCH] Add "large entry points map" setting To aid in debugging, this makes it possible to disable the recently added 32/64 GiB region which hasn't had a proper name so far. --- .../dolphinemu/features/settings/model/BooleanSetting.kt | 2 ++ .../features/settings/ui/SettingsFragmentPresenter.kt | 8 ++++++++ Source/Android/app/src/main/res/values/strings.xml | 1 + Source/Core/Core/Config/MainSettings.cpp | 1 + Source/Core/Core/Config/MainSettings.h | 1 + Source/Core/Core/PowerPC/JitCommon/JitCache.cpp | 6 +++--- Source/Core/DolphinQt/MenuBar.cpp | 9 +++++++++ Source/Core/DolphinQt/MenuBar.h | 1 + 8 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.kt index 2d2a0065b4..a1131e4859 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.kt @@ -15,6 +15,7 @@ enum class BooleanSetting( MAIN_DSP_HLE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "DSPHLE", true), MAIN_FASTMEM(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "Fastmem", true), MAIN_FASTMEM_ARENA(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "FastmemArena", true), + MAIN_LARGE_ENTRY_POINTS_MAP(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "LargeEntryPointsMap", true), MAIN_CPU_THREAD(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "CPUThread", true), MAIN_SYNC_ON_SKIP_IDLE( Settings.FILE_DOLPHIN, @@ -899,6 +900,7 @@ enum class BooleanSetting( private val NOT_RUNTIME_EDITABLE_ARRAY = arrayOf( MAIN_DSP_HLE, MAIN_FASTMEM_ARENA, + MAIN_LARGE_ENTRY_POINTS_MAP, MAIN_CPU_THREAD, MAIN_ENABLE_CHEATS, MAIN_OVERRIDE_REGION_SETTINGS, diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt index b1e1271f89..1051f445ae 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt @@ -1949,6 +1949,14 @@ class SettingsFragmentPresenter( 0 ) ) + sl.add( + InvertedSwitchSetting( + context, + BooleanSetting.MAIN_LARGE_ENTRY_POINTS_MAP, + R.string.debug_large_entry_points_map, + 0 + ) + ) sl.add(HeaderSetting(context, R.string.debug_jit_header, 0)) sl.add( diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index 9575ec0eb2..489652b1e5 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -401,6 +401,7 @@ Warning: Debug settings will slow emulation Disable Fastmem Disable Fastmem Arena + Disable Large Entry Points Map Jit Jit Disabled Jit Load Store Disabled diff --git a/Source/Core/Core/Config/MainSettings.cpp b/Source/Core/Core/Config/MainSettings.cpp index c9b39b7381..21c453b6c7 100644 --- a/Source/Core/Core/Config/MainSettings.cpp +++ b/Source/Core/Core/Config/MainSettings.cpp @@ -40,6 +40,7 @@ const Info MAIN_CPU_CORE{{System::Main, "Core", "CPUCore"}, const Info MAIN_JIT_FOLLOW_BRANCH{{System::Main, "Core", "JITFollowBranch"}, true}; const Info MAIN_FASTMEM{{System::Main, "Core", "Fastmem"}, 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}; const Info MAIN_DSP_HLE{{System::Main, "Core", "DSPHLE"}, true}; const Info MAIN_MAX_FALLBACK{{System::Main, "Core", "MaxFallback"}, 100}; diff --git a/Source/Core/Core/Config/MainSettings.h b/Source/Core/Core/Config/MainSettings.h index 5994a9bfd1..dddda8ae7a 100644 --- a/Source/Core/Core/Config/MainSettings.h +++ b/Source/Core/Core/Config/MainSettings.h @@ -57,6 +57,7 @@ extern const Info MAIN_CPU_CORE; extern const Info MAIN_JIT_FOLLOW_BRANCH; extern const Info MAIN_FASTMEM; extern const Info MAIN_FASTMEM_ARENA; +extern const Info MAIN_LARGE_ENTRY_POINTS_MAP; extern const Info MAIN_ACCURATE_CPU_CACHE; // Should really be in the DSP section, but we're kind of stuck with bad decisions made in the past. extern const Info MAIN_DSP_HLE; diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp index af3842929f..327ee108a0 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp +++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp @@ -42,10 +42,10 @@ void JitBaseBlockCache::Init() { Common::JitRegister::Init(Config::Get(Config::MAIN_PERF_MAP_DIR)); -#ifdef _ARCH_64 - m_entry_points_ptr = reinterpret_cast(m_entry_points_arena.Create(FAST_BLOCK_MAP_SIZE)); -#else m_entry_points_ptr = nullptr; +#ifdef _ARCH_64 + if (Config::Get(Config::MAIN_LARGE_ENTRY_POINTS_MAP)) + m_entry_points_ptr = reinterpret_cast(m_entry_points_arena.Create(FAST_BLOCK_MAP_SIZE)); #endif Clear(); diff --git a/Source/Core/DolphinQt/MenuBar.cpp b/Source/Core/DolphinQt/MenuBar.cpp index 9b400e7c2a..a31465aac1 100644 --- a/Source/Core/DolphinQt/MenuBar.cpp +++ b/Source/Core/DolphinQt/MenuBar.cpp @@ -153,6 +153,7 @@ void MenuBar::OnEmulationStateChanged(Core::State state) m_jit_block_linking->setEnabled(!running); m_jit_disable_cache->setEnabled(!running); m_jit_disable_fastmem_arena->setEnabled(!running); + m_jit_disable_large_entry_points_map->setEnabled(!running); m_jit_clear_cache->setEnabled(running); m_jit_log_coverage->setEnabled(!running); m_jit_search_instruction->setEnabled(running); @@ -867,6 +868,14 @@ void MenuBar::AddJITMenu() connect(m_jit_disable_fastmem_arena, &QAction::toggled, [](bool enabled) { Config::SetBaseOrCurrent(Config::MAIN_FASTMEM_ARENA, !enabled); }); + m_jit_disable_large_entry_points_map = m_jit->addAction(tr("Disable Large Entry Points Map")); + m_jit_disable_large_entry_points_map->setCheckable(true); + m_jit_disable_large_entry_points_map->setChecked( + !Config::Get(Config::MAIN_LARGE_ENTRY_POINTS_MAP)); + connect(m_jit_disable_large_entry_points_map, &QAction::toggled, [](bool enabled) { + Config::SetBaseOrCurrent(Config::MAIN_LARGE_ENTRY_POINTS_MAP, !enabled); + }); + m_jit_clear_cache = m_jit->addAction(tr("Clear Cache"), this, &MenuBar::ClearCache); m_jit->addSeparator(); diff --git a/Source/Core/DolphinQt/MenuBar.h b/Source/Core/DolphinQt/MenuBar.h index e505160afa..3830b22f34 100644 --- a/Source/Core/DolphinQt/MenuBar.h +++ b/Source/Core/DolphinQt/MenuBar.h @@ -265,6 +265,7 @@ private: QAction* m_jit_disable_cache; QAction* m_jit_disable_fastmem; QAction* m_jit_disable_fastmem_arena; + QAction* m_jit_disable_large_entry_points_map; QAction* m_jit_clear_cache; QAction* m_jit_log_coverage; QAction* m_jit_search_instruction;