mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
PowerPC: Allow toggling write-back cache during emulation
Now that PR 10575 is merged, the JIT automatically clears its cache when this setting is changed, making this reasonable to implement.
This commit is contained in:
parent
899d61bc7d
commit
b3bfcc5d7f
@ -902,7 +902,6 @@ enum class BooleanSetting(
|
||||
MAIN_OVERRIDE_REGION_SETTINGS,
|
||||
MAIN_MMU,
|
||||
MAIN_PAUSE_ON_PANIC,
|
||||
MAIN_ACCURATE_CPU_CACHE,
|
||||
MAIN_RAM_OVERRIDE_ENABLE,
|
||||
MAIN_CUSTOM_RTC_ENABLE,
|
||||
MAIN_DSP_JIT,
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "Common/FloatUtils.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
|
||||
#include "Core/CPUThreadConfigCallback.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
@ -262,8 +263,25 @@ CPUCore DefaultCPUCore()
|
||||
#endif
|
||||
}
|
||||
|
||||
void PowerPCManager::RefreshConfig()
|
||||
{
|
||||
const bool old_enable_dcache = m_ppc_state.m_enable_dcache;
|
||||
|
||||
m_ppc_state.m_enable_dcache = Config::Get(Config::MAIN_ACCURATE_CPU_CACHE);
|
||||
|
||||
if (old_enable_dcache && !m_ppc_state.m_enable_dcache)
|
||||
{
|
||||
INFO_LOG_FMT(POWERPC, "Flushing data cache");
|
||||
m_ppc_state.dCache.FlushAll();
|
||||
}
|
||||
}
|
||||
|
||||
void PowerPCManager::Init(CPUCore cpu_core)
|
||||
{
|
||||
m_registered_config_callback_id =
|
||||
CPUThreadConfigCallback::AddConfigChangedCallback([this] { RefreshConfig(); });
|
||||
RefreshConfig();
|
||||
|
||||
m_invalidate_cache_thread_safe =
|
||||
m_system.GetCoreTiming().RegisterEvent("invalidateEmulatedCache", InvalidateCacheThreadSafe);
|
||||
|
||||
@ -273,8 +291,6 @@ void PowerPCManager::Init(CPUCore cpu_core)
|
||||
m_ppc_state.iCache.Init();
|
||||
m_ppc_state.dCache.Init();
|
||||
|
||||
m_ppc_state.m_enable_dcache = Config::Get(Config::MAIN_ACCURATE_CPU_CACHE);
|
||||
|
||||
if (Config::Get(Config::MAIN_ENABLE_DEBUGGING))
|
||||
m_breakpoints.ClearAllTemporary();
|
||||
}
|
||||
@ -307,6 +323,7 @@ void PowerPCManager::ScheduleInvalidateCacheThreadSafe(u32 address)
|
||||
|
||||
void PowerPCManager::Shutdown()
|
||||
{
|
||||
CPUThreadConfigCallback::RemoveConfigChangedCallback(m_registered_config_callback_id);
|
||||
InjectExternalCPUCore(nullptr);
|
||||
m_system.GetJitInterface().Shutdown();
|
||||
m_system.GetInterpreter().Shutdown();
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
#include "Core/CPUThreadConfigCallback.h"
|
||||
#include "Core/Debugger/PPCDebugInterface.h"
|
||||
#include "Core/PowerPC/BreakPoints.h"
|
||||
#include "Core/PowerPC/ConditionRegister.h"
|
||||
@ -297,6 +298,7 @@ private:
|
||||
void InitializeCPUCore(CPUCore cpu_core);
|
||||
void ApplyMode();
|
||||
void ResetRegisters();
|
||||
void RefreshConfig();
|
||||
|
||||
PowerPCState m_ppc_state;
|
||||
|
||||
@ -308,6 +310,8 @@ private:
|
||||
MemChecks m_memchecks;
|
||||
PPCDebugInterface m_debug_interface;
|
||||
|
||||
CPUThreadConfigCallback::ConfigChangedCallbackID m_registered_config_callback_id;
|
||||
|
||||
CoreTiming::EventType* m_invalidate_cache_thread_safe = nullptr;
|
||||
|
||||
Core::System& m_system;
|
||||
|
@ -255,7 +255,6 @@ void AdvancedPane::Update()
|
||||
m_cpu_emulation_engine_combobox->setEnabled(!running);
|
||||
m_enable_mmu_checkbox->setEnabled(!running);
|
||||
m_pause_on_panic_checkbox->setEnabled(!running);
|
||||
m_accurate_cpu_cache_checkbox->setEnabled(!running);
|
||||
|
||||
{
|
||||
QFont bf = font();
|
||||
|
Loading…
Reference in New Issue
Block a user