Config: Port Fastmem setting to new config system.

This commit is contained in:
Admiral H. Curtiss 2022-01-06 01:51:29 +01:00
parent 88d725c918
commit dc7e7d08ad
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
11 changed files with 14 additions and 18 deletions

View File

@ -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
{

View File

@ -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

View File

@ -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);
@ -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);
@ -275,7 +273,6 @@ void SConfig::LoadDefaults()
iTimingVariance = 40;
bCPUThread = false;
bFastmem = true;
bMMU = false;
iBBDumpPort = -1;
bSyncGPU = false;

View File

@ -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;

View File

@ -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
@ -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())

View File

@ -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));

View File

@ -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();
@ -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;

View File

@ -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();
@ -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();

View File

@ -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);
@ -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;

View File

@ -132,6 +132,7 @@ protected:
bool m_low_dcbz_hack = false;
bool m_fprf = false;
bool m_accurate_nans = false;
bool m_fastmem_enabled = false;
void RefreshConfig();

View File

@ -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();
});