Skip to content

Commit

Permalink
Config: Port Fastmem setting to new config system.
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiralCurtiss committed Jan 6, 2022
1 parent 88d725c commit dc7e7d0
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 18 deletions.
1 change: 0 additions & 1 deletion Source/Core/Core/BootManager.cpp
Expand Up @@ -248,7 +248,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
StartUp.iSyncGpuMinDistance = netplay_settings.m_SyncGpuMinDistance;
StartUp.fSyncGpuOverclock = netplay_settings.m_SyncGpuOverclock;
StartUp.bMMU = netplay_settings.m_MMU;
StartUp.bFastmem = netplay_settings.m_Fastmem;
}
else
{
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp
Expand Up @@ -103,6 +103,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
&Config::MAIN_DISABLE_ICACHE.GetLocation(),
&Config::MAIN_FAST_DISC_SPEED.GetLocation(),
&Config::MAIN_SYNC_ON_SKIP_IDLE.GetLocation(),
&Config::MAIN_FASTMEM.GetLocation(),

// UI.General

Expand Down
3 changes: 0 additions & 3 deletions Source/Core/Core/ConfigManager.cpp
Expand Up @@ -100,7 +100,6 @@ void SConfig::SaveCoreSettings(IniFile& ini)
IniFile::Section* core = ini.GetOrCreateSection("Core");

core->Set("TimingVariance", iTimingVariance);
core->Set("Fastmem", bFastmem);
core->Set("CPUThread", bCPUThread);
core->Set("SyncGPU", bSyncGPU);
core->Set("SyncGpuMaxDistance", iSyncGpuMaxDistance);
Expand Down Expand Up @@ -136,7 +135,6 @@ void SConfig::LoadCoreSettings(IniFile& ini)
{
IniFile::Section* core = ini.GetOrCreateSection("Core");

core->Get("Fastmem", &bFastmem, true);
core->Get("TimingVariance", &iTimingVariance, 40);
core->Get("CPUThread", &bCPUThread, true);
core->Get("SlotA", (int*)&m_EXIDevice[0], ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER);
Expand Down Expand Up @@ -275,7 +273,6 @@ void SConfig::LoadDefaults()

iTimingVariance = 40;
bCPUThread = false;
bFastmem = true;
bMMU = false;
iBBDumpPort = -1;
bSyncGPU = false;
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/Core/ConfigManager.h
Expand Up @@ -63,8 +63,6 @@ struct SConfig
bool bJITNoBlockCache = false;
bool bJITNoBlockLinking = false;

bool bFastmem;

int iTimingVariance = 40; // in milli secounds
bool bCPUThread = true;
bool bCopyWiiSaveNetplay = true;
Expand Down
5 changes: 3 additions & 2 deletions Source/Core/Core/Core.cpp
Expand Up @@ -348,7 +348,8 @@ static void CpuThread(const std::optional<std::string>& savestate_path, bool del
static_cast<void>(IDCache::GetEnvForThread());
#endif

if (_CoreParameter.bFastmem)
const bool fastmem_enabled = Config::Get(Config::MAIN_FASTMEM);
if (fastmem_enabled)
EMM::InstallExceptionHandler(); // Let's run under memory watch

#ifdef USE_MEMORYWATCHER
Expand Down Expand Up @@ -396,7 +397,7 @@ static void CpuThread(const std::optional<std::string>& savestate_path, bool del

s_is_started = false;

if (_CoreParameter.bFastmem)
if (fastmem_enabled)
EMM::UninstallExceptionHandler();

if (GDBStub::IsActive())
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/DolphinAnalytics.cpp
Expand Up @@ -360,7 +360,7 @@ void DolphinAnalytics::MakePerGameBuilder()
builder.AddData("cfg-dsp-jit", Config::Get(Config::MAIN_DSP_JIT));
builder.AddData("cfg-dsp-thread", Config::Get(Config::MAIN_DSP_THREAD));
builder.AddData("cfg-cpu-thread", SConfig::GetInstance().bCPUThread);
builder.AddData("cfg-fastmem", SConfig::GetInstance().bFastmem);
builder.AddData("cfg-fastmem", Config::Get(Config::MAIN_FASTMEM));
builder.AddData("cfg-syncgpu", SConfig::GetInstance().bSyncGPU);
builder.AddData("cfg-audio-backend", Config::Get(Config::MAIN_AUDIO_BACKEND));
builder.AddData("cfg-oc-enable", Config::Get(Config::MAIN_OVERCLOCK_ENABLE));
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/Core/PowerPC/Jit64/Jit.cpp
Expand Up @@ -332,7 +332,7 @@ void Jit64::Init()
{
EnableBlockLink();

jo.fastmem_arena = SConfig::GetInstance().bFastmem && Memory::InitFastmemArena();
jo.fastmem_arena = m_fastmem_enabled && Memory::InitFastmemArena();
jo.optimizeGatherPipe = true;
jo.accurateSinglePrecision = true;
UpdateMemoryAndExceptionOptions();
Expand All @@ -355,8 +355,7 @@ void Jit64::Init()

// BLR optimization has the same consequences as block linking, as well as
// depending on the fault handler to be safe in the event of excessive BL.
m_enable_blr_optimization =
jo.enableBlocklink && SConfig::GetInstance().bFastmem && !m_enable_debugging;
m_enable_blr_optimization = jo.enableBlocklink && m_fastmem_enabled && !m_enable_debugging;
m_cleanup_after_stackfault = false;

m_stack = nullptr;
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/Core/PowerPC/JitArm64/Jit.cpp
Expand Up @@ -52,7 +52,7 @@ void JitArm64::Init()
AllocCodeSpace(CODE_SIZE + child_code_size);
AddChildCodeSpace(&m_far_code, child_code_size);

jo.fastmem_arena = SConfig::GetInstance().bFastmem && Memory::InitFastmemArena();
jo.fastmem_arena = m_fastmem_enabled && Memory::InitFastmemArena();
jo.enableBlocklink = true;
jo.optimizeGatherPipe = true;
UpdateMemoryAndExceptionOptions();
Expand All @@ -67,8 +67,7 @@ void JitArm64::Init()
analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_CARRY_MERGE);
analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_BRANCH_FOLLOW);

m_enable_blr_optimization =
jo.enableBlocklink && SConfig::GetInstance().bFastmem && !m_enable_debugging;
m_enable_blr_optimization = jo.enableBlocklink && m_fastmem_enabled && !m_enable_debugging;
m_cleanup_after_stackfault = false;

AllocStack();
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/PowerPC/JitCommon/JitBase.cpp
Expand Up @@ -54,6 +54,7 @@ void JitBase::RefreshConfig()
m_low_dcbz_hack = Config::Get(Config::MAIN_LOW_DCBZ_HACK);
m_fprf = Config::Get(Config::MAIN_FPRF);
m_accurate_nans = Config::Get(Config::MAIN_ACCURATE_NANS);
m_fastmem_enabled = Config::Get(Config::MAIN_FASTMEM);
analyzer.SetDebuggingEnabled(m_enable_debugging);
analyzer.SetBranchFollowingEnabled(Config::Get(Config::MAIN_JIT_FOLLOW_BRANCH));
analyzer.SetFloatExceptionsEnabled(m_enable_float_exceptions);
Expand All @@ -78,7 +79,7 @@ bool JitBase::CanMergeNextInstructions(int count) const
void JitBase::UpdateMemoryAndExceptionOptions()
{
bool any_watchpoints = PowerPC::memchecks.HasAny();
jo.fastmem = SConfig::GetInstance().bFastmem && jo.fastmem_arena && (MSR.DR || !any_watchpoints);
jo.fastmem = m_fastmem_enabled && jo.fastmem_arena && (MSR.DR || !any_watchpoints);
jo.memcheck = SConfig::GetInstance().bMMU || any_watchpoints;
jo.fp_exceptions = m_enable_float_exceptions;
jo.div_by_zero_exceptions = m_enable_div_by_zero_exceptions;
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/PowerPC/JitCommon/JitBase.h
Expand Up @@ -132,6 +132,7 @@ class JitBase : public CPUCoreBase
bool m_low_dcbz_hack = false;
bool m_fprf = false;
bool m_accurate_nans = false;
bool m_fastmem_enabled = false;

void RefreshConfig();

Expand Down
4 changes: 2 additions & 2 deletions Source/Core/DolphinQt/MenuBar.cpp
Expand Up @@ -829,9 +829,9 @@ void MenuBar::AddJITMenu()

m_jit_disable_fastmem = m_jit->addAction(tr("Disable Fastmem"));
m_jit_disable_fastmem->setCheckable(true);
m_jit_disable_fastmem->setChecked(!SConfig::GetInstance().bFastmem);
m_jit_disable_fastmem->setChecked(!Config::Get(Config::MAIN_FASTMEM));
connect(m_jit_disable_fastmem, &QAction::toggled, [this](bool enabled) {
SConfig::GetInstance().bFastmem = !enabled;
Config::SetBaseOrCurrent(Config::MAIN_FASTMEM, !enabled);
ClearCache();
});

Expand Down

0 comments on commit dc7e7d0

Please sign in to comment.