From 2aa44b10bae4db2862f9f7e59549da1b720975f9 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Thu, 6 Jan 2022 02:01:39 +0100 Subject: [PATCH] Config: Port TimingVariance setting to new config system. --- Source/Core/AudioCommon/Mixer.cpp | 2 +- Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp | 1 + Source/Core/Core/ConfigManager.cpp | 3 --- Source/Core/Core/ConfigManager.h | 1 - Source/Core/Core/HW/SystemTimers.cpp | 3 +-- 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp index 21cbb7ea2e..cf698eab84 100644 --- a/Source/Core/AudioCommon/Mixer.cpp +++ b/Source/Core/AudioCommon/Mixer.cpp @@ -77,7 +77,7 @@ unsigned int Mixer::MixerFifo::Mix(short* samples, unsigned int numSamples, { float numLeft = static_cast(((indexW - indexR) & INDEX_MASK) / 2); - u32 low_waterwark = m_input_sample_rate * SConfig::GetInstance().iTimingVariance / 1000; + u32 low_waterwark = m_input_sample_rate * Config::Get(Config::MAIN_TIMING_VARIANCE) / 1000; low_waterwark = std::min(low_waterwark, MAX_SAMPLES / 2); m_numLeftI = (numLeft + m_numLeftI * (CONTROL_AVG - 1)) / CONTROL_AVG; diff --git a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp index 59bff15aa0..0171a3c93b 100644 --- a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp +++ b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp @@ -104,6 +104,7 @@ bool IsSettingSaveable(const Config::Location& config_location) &Config::MAIN_FAST_DISC_SPEED.GetLocation(), &Config::MAIN_SYNC_ON_SKIP_IDLE.GetLocation(), &Config::MAIN_FASTMEM.GetLocation(), + &Config::MAIN_TIMING_VARIANCE.GetLocation(), // UI.General diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 1ad3213651..04e55612c7 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -99,7 +99,6 @@ void SConfig::SaveCoreSettings(IniFile& ini) { IniFile::Section* core = ini.GetOrCreateSection("Core"); - core->Set("TimingVariance", iTimingVariance); core->Set("CPUThread", bCPUThread); core->Set("SyncGPU", bSyncGPU); core->Set("SyncGpuMaxDistance", iSyncGpuMaxDistance); @@ -135,7 +134,6 @@ void SConfig::LoadCoreSettings(IniFile& ini) { IniFile::Section* core = ini.GetOrCreateSection("Core"); - core->Get("TimingVariance", &iTimingVariance, 40); core->Get("CPUThread", &bCPUThread, true); core->Get("SlotA", (int*)&m_EXIDevice[0], ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER); core->Get("SlotB", (int*)&m_EXIDevice[1], ExpansionInterface::EXIDEVICE_NONE); @@ -271,7 +269,6 @@ void SConfig::LoadDefaults() bAutomaticStart = false; bBootToPause = false; - iTimingVariance = 40; bCPUThread = false; bMMU = false; iBBDumpPort = -1; diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index 0bef47a7e0..fac71c4020 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -63,7 +63,6 @@ struct SConfig bool bJITNoBlockCache = false; bool bJITNoBlockLinking = false; - int iTimingVariance = 40; // in milli secounds bool bCPUThread = true; bool bCopyWiiSaveNetplay = true; diff --git a/Source/Core/Core/HW/SystemTimers.cpp b/Source/Core/Core/HW/SystemTimers.cpp index a1c9fe3baa..5f063a093e 100644 --- a/Source/Core/Core/HW/SystemTimers.cpp +++ b/Source/Core/Core/HW/SystemTimers.cpp @@ -173,7 +173,6 @@ void ThrottleCallback(u64 last_time, s64 cyclesLate) u64 time = Common::Timer::GetTimeUs(); s64 diff = last_time - time; - const SConfig& config = SConfig::GetInstance(); const float emulation_speed = Config::Get(Config::MAIN_EMULATION_SPEED); bool frame_limiter = emulation_speed > 0.0f && !Core::GetIsThrottlerTempDisabled(); u32 next_event = GetTicksPerSecond() / 1000; @@ -189,7 +188,7 @@ void ThrottleCallback(u64 last_time, s64 cyclesLate) { if (emulation_speed != 1.0f) next_event = u32(next_event * emulation_speed); - const s64 max_fallback = config.iTimingVariance * 1000; + const s64 max_fallback = Config::Get(Config::MAIN_TIMING_VARIANCE) * 1000; if (std::abs(diff) > max_fallback) { DEBUG_LOG_FMT(COMMON, "system too {}, {} ms skipped", diff < 0 ? "slow" : "fast",