Config: Port TimingVariance setting to new config system.

This commit is contained in:
Admiral H. Curtiss 2022-01-06 02:01:39 +01:00
parent dc7e7d08ad
commit 2aa44b10ba
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
5 changed files with 3 additions and 7 deletions

View File

@ -77,7 +77,7 @@ unsigned int Mixer::MixerFifo::Mix(short* samples, unsigned int numSamples,
{
float numLeft = static_cast<float>(((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;

View File

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

View File

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

View File

@ -63,7 +63,6 @@ struct SConfig
bool bJITNoBlockCache = false;
bool bJITNoBlockLinking = false;
int iTimingVariance = 40; // in milli secounds
bool bCPUThread = true;
bool bCopyWiiSaveNetplay = true;

View File

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