From 47f1505499dd0ba8cd78c2d5ff3600c937d75236 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Fri, 19 Apr 2013 07:50:33 -0500 Subject: [PATCH] Add a fastmem option for enabling and disabling fastmem at runtime. --- Source/Core/Core/Src/ConfigManager.cpp | 2 ++ Source/Core/Core/Src/Core.cpp | 1 + Source/Core/Core/Src/CoreParameter.cpp | 1 + Source/Core/Core/Src/CoreParameter.h | 1 + Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp | 4 ++-- 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 09cce2a142..485c1ab259 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -201,6 +201,7 @@ void SConfig::SaveSettings() // Core ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2); ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore); + ini.Set("Core", "Fastmem", m_LocalCoreStartupParameter.bFastmem); ini.Set("Core", "CPUThread", m_LocalCoreStartupParameter.bCPUThread); ini.Set("Core", "DSPThread", m_LocalCoreStartupParameter.bDSPThread); ini.Set("Core", "DSPHLE", m_LocalCoreStartupParameter.bDSPHLE); @@ -354,6 +355,7 @@ void SConfig::LoadSettings() #else ini.Get("Core", "CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 1); #endif + ini.Get("Core", "Fastmem", &m_LocalCoreStartupParameter.bFastmem, true); ini.Get("Core", "DSPThread", &m_LocalCoreStartupParameter.bDSPThread, false); ini.Get("Core", "DSPHLE", &m_LocalCoreStartupParameter.bDSPHLE, true); ini.Get("Core", "CPUThread", &m_LocalCoreStartupParameter.bCPUThread, true); diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index c1dc79f7ef..0d8752195f 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -299,6 +299,7 @@ void CpuThread() } #if defined(_M_X64) || _M_ARM + if (_CoreParameter.bFastmem) EMM::InstallExceptionHandler(); // Let's run under memory watch #endif diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index 45a2822d8d..e05816cb64 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -60,6 +60,7 @@ void SCoreStartupParameter::LoadDefaults() bRunCompareServer = false; bDSPHLE = true; bDSPThread = true; + bFastmem = true; bEnableFPRF = false; bMMU = false; bDCBZOFF = false; diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index 2384a7908c..9652b84618 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -82,6 +82,7 @@ struct SCoreStartupParameter bool bJITILTimeProfiling; bool bJITILOutputIR; + bool bFastmem; bool bEnableFPRF; bool bCPUThread; diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp index 63dfa3ecbe..18c8044385 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp +++ b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp @@ -111,9 +111,9 @@ void EmuCodeBlock::SafeLoadToEAX(const Gen::OpArg & opAddress, int accessSize, s { #if defined(_M_X64) #ifdef ENABLE_MEM_CHECK - if (!Core::g_CoreStartupParameter.bMMU && !Core::g_CoreStartupParameter.bEnableDebugging) + if (!Core::g_CoreStartupParameter.bMMU && !Core::g_CoreStartupParameter.bEnableDebugging && Core::g_CoreStartupParameter.bFastmem) #else - if (!Core::g_CoreStartupParameter.bMMU) + if (!Core::g_CoreStartupParameter.bMMU && Core::g_CoreStartupParameter.bFastmem) #endif { UnsafeLoadToEAX(opAddress, accessSize, offset, signExtend);