summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2022-01-05 23:22:07 +0100
committerAdmiral H. Curtiss <pikachu025@gmail.com>2022-01-06 16:13:54 +0100
commitfb47035f97ab196dbc3e5a38791898eb90fb71a8 (patch)
tree43dfba57831921b08e33f315430b6dd6419a008f /Source/Core
parent5d11dc1926a7c76d8cfcd11d995e24244bdd7e71 (diff)
Config: Port emulation speed setting to new config system.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/AudioCommon/Mixer.cpp2
-rw-r--r--Source/Core/Core/BootManager.cpp17
-rw-r--r--Source/Core/Core/BootManager.h1
-rw-r--r--Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp1
-rw-r--r--Source/Core/Core/ConfigManager.cpp2
-rw-r--r--Source/Core/Core/ConfigManager.h2
-rw-r--r--Source/Core/Core/HW/SystemTimers.cpp7
-rw-r--r--Source/Core/Core/IOS/DolphinDevice.cpp8
-rw-r--r--Source/Core/Core/NetPlayClient.cpp4
-rw-r--r--Source/Core/DolphinQt/HotkeyScheduler.cpp14
-rw-r--r--Source/Core/DolphinQt/Settings/GeneralPane.cpp5
-rw-r--r--Source/Core/VideoCommon/VideoConfig.cpp4
12 files changed, 22 insertions, 45 deletions
diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp
index 6888d9520b..21cbb7ea2e 100644
--- a/Source/Core/AudioCommon/Mixer.cpp
+++ b/Source/Core/AudioCommon/Mixer.cpp
@@ -71,7 +71,7 @@ unsigned int Mixer::MixerFifo::Mix(short* samples, unsigned int numSamples,
// advance indexR with sample position
// remember fractional offset
- float emulationspeed = SConfig::GetInstance().m_EmulationSpeed;
+ float emulationspeed = Config::Get(Config::MAIN_EMULATION_SPEED);
float aid_sample_rate = static_cast<float>(m_input_sample_rate);
if (consider_framelimit && emulationspeed > 0.0f)
{
diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp
index acc46a7f16..29cb4bfec9 100644
--- a/Source/Core/Core/BootManager.cpp
+++ b/Source/Core/Core/BootManager.cpp
@@ -64,7 +64,6 @@ public:
// These store if the relevant setting should be reset back later (true) or if it should be left
// alone on restore (false)
- bool bSetEmulationSpeed = false;
bool bSetVolume = false;
std::array<bool, MAX_BBMOTES> bSetWiimoteSource{};
std::array<bool, SerialInterface::MAX_SI_CHANNELS> bSetPads{};
@@ -81,7 +80,6 @@ private:
int iSyncGpuMinDistance = 0;
float fSyncGpuOverclock = 0;
bool bFastDiscSpeed = false;
- float m_EmulationSpeed = 0;
std::string m_strGPUDeterminismMode;
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource{};
std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads{};
@@ -101,7 +99,6 @@ void ConfigCache::SaveConfig(const SConfig& config)
iSyncGpuMinDistance = config.iSyncGpuMinDistance;
fSyncGpuOverclock = config.fSyncGpuOverclock;
bFastDiscSpeed = config.bFastDiscSpeed;
- m_EmulationSpeed = config.m_EmulationSpeed;
m_strGPUDeterminismMode = config.m_strGPUDeterminismMode;
for (int i = 0; i != MAX_BBMOTES; ++i)
@@ -110,7 +107,6 @@ void ConfigCache::SaveConfig(const SConfig& config)
std::copy(std::begin(config.m_SIDevice), std::end(config.m_SIDevice), std::begin(Pads));
std::copy(std::begin(config.m_EXIDevice), std::end(config.m_EXIDevice), std::begin(m_EXIDevice));
- bSetEmulationSpeed = false;
bSetVolume = false;
bSetWiimoteSource.fill(false);
bSetPads.fill(false);
@@ -151,9 +147,6 @@ void ConfigCache::RestoreConfig(SConfig* config)
config->m_SIDevice[i] = Pads[i];
}
- if (bSetEmulationSpeed)
- config->m_EmulationSpeed = m_EmulationSpeed;
-
for (unsigned int i = 0; i < ExpansionInterface::MAX_EXI_CHANNELS; ++i)
{
if (bSetEXIDevice[i])
@@ -165,11 +158,6 @@ void ConfigCache::RestoreConfig(SConfig* config)
static ConfigCache config_cache;
-void SetEmulationSpeedReset(bool value)
-{
- config_cache.bSetEmulationSpeed = value;
-}
-
static GPUDeterminismMode ParseGPUDeterminismMode(const std::string& mode)
{
if (mode == "auto")
@@ -212,9 +200,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
core_section->Get("MMU", &StartUp.bMMU, StartUp.bMMU);
core_section->Get("SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
core_section->Get("FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed);
- if (core_section->Get("EmulationSpeed", &StartUp.m_EmulationSpeed, StartUp.m_EmulationSpeed))
- config_cache.bSetEmulationSpeed = true;
-
core_section->Get("GPUDeterminismMode", &StartUp.m_strGPUDeterminismMode,
StartUp.m_strGPUDeterminismMode);
@@ -302,8 +287,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
StartUp.bFastDiscSpeed = netplay_settings.m_FastDiscSpeed;
StartUp.bMMU = netplay_settings.m_MMU;
StartUp.bFastmem = netplay_settings.m_Fastmem;
- if (netplay_settings.m_HostInputAuthority && !netplay_settings.m_IsHosting)
- config_cache.bSetEmulationSpeed = true;
}
else
{
diff --git a/Source/Core/Core/BootManager.h b/Source/Core/Core/BootManager.h
index cdc790322e..10474c5f3f 100644
--- a/Source/Core/Core/BootManager.h
+++ b/Source/Core/Core/BootManager.h
@@ -11,7 +11,6 @@ struct WindowSystemInfo;
namespace BootManager
{
bool BootCore(std::unique_ptr<BootParameters> parameters, const WindowSystemInfo& wsi);
-void SetEmulationSpeedReset(bool value);
// Synchronise Dolphin's configuration with the SYSCONF (which may have changed during emulation),
// and restore settings that were overriden by per-game INIs or for some other reason.
diff --git a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp
index a41ef76b09..828ddf170c 100644
--- a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp
+++ b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp
@@ -97,6 +97,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
&Config::GetInfoForSimulateKonga(1).GetLocation(),
&Config::GetInfoForSimulateKonga(2).GetLocation(),
&Config::GetInfoForSimulateKonga(3).GetLocation(),
+ &Config::MAIN_EMULATION_SPEED.GetLocation(),
// UI.General
diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp
index c4b9cb079c..2f7607feac 100644
--- a/Source/Core/Core/ConfigManager.cpp
+++ b/Source/Core/Core/ConfigManager.cpp
@@ -120,7 +120,6 @@ void SConfig::SaveCoreSettings(IniFile& ini)
core->Set("WiimoteEnableSpeaker", m_WiimoteEnableSpeaker);
core->Set("WiimoteControllerInterface", connect_wiimotes_for_ciface);
core->Set("MMU", bMMU);
- core->Set("EmulationSpeed", m_EmulationSpeed);
core->Set("GPUDeterminismMode", m_strGPUDeterminismMode);
core->Set("PerfMapDir", m_perfDir);
}
@@ -165,7 +164,6 @@ void SConfig::LoadCoreSettings(IniFile& ini)
core->Get("SyncGpuOverclock", &fSyncGpuOverclock, 1.0f);
core->Get("FastDiscSpeed", &bFastDiscSpeed, false);
core->Get("DisableICache", &bDisableICache, false);
- core->Get("EmulationSpeed", &m_EmulationSpeed, 1.0f);
core->Get("GPUDeterminismMode", &m_strGPUDeterminismMode, "auto");
core->Get("PerfMapDir", &m_perfDir, "");
}
diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h
index 46804f3172..6a703a2746 100644
--- a/Source/Core/Core/ConfigManager.h
+++ b/Source/Core/Core/ConfigManager.h
@@ -146,8 +146,6 @@ struct SConfig
ExpansionInterface::TEXIDevices m_EXIDevice[3];
SerialInterface::SIDevices m_SIDevice[4];
- float m_EmulationSpeed;
-
SConfig(const SConfig&) = delete;
SConfig& operator=(const SConfig&) = delete;
SConfig(SConfig&&) = delete;
diff --git a/Source/Core/Core/HW/SystemTimers.cpp b/Source/Core/Core/HW/SystemTimers.cpp
index 62f10cdef1..a1c9fe3baa 100644
--- a/Source/Core/Core/HW/SystemTimers.cpp
+++ b/Source/Core/Core/HW/SystemTimers.cpp
@@ -174,7 +174,8 @@ void ThrottleCallback(u64 last_time, s64 cyclesLate)
s64 diff = last_time - time;
const SConfig& config = SConfig::GetInstance();
- bool frame_limiter = config.m_EmulationSpeed > 0.0f && !Core::GetIsThrottlerTempDisabled();
+ const float emulation_speed = Config::Get(Config::MAIN_EMULATION_SPEED);
+ bool frame_limiter = emulation_speed > 0.0f && !Core::GetIsThrottlerTempDisabled();
u32 next_event = GetTicksPerSecond() / 1000;
{
@@ -186,8 +187,8 @@ void ThrottleCallback(u64 last_time, s64 cyclesLate)
if (frame_limiter)
{
- if (config.m_EmulationSpeed != 1.0f)
- next_event = u32(next_event * config.m_EmulationSpeed);
+ if (emulation_speed != 1.0f)
+ next_event = u32(next_event * emulation_speed);
const s64 max_fallback = config.iTimingVariance * 1000;
if (std::abs(diff) > max_fallback)
{
diff --git a/Source/Core/Core/IOS/DolphinDevice.cpp b/Source/Core/Core/IOS/DolphinDevice.cpp
index 699cacfd42..3c533f9ab0 100644
--- a/Source/Core/Core/IOS/DolphinDevice.cpp
+++ b/Source/Core/Core/IOS/DolphinDevice.cpp
@@ -14,9 +14,7 @@
#include "Common/SettingsHandler.h"
#include "Common/Timer.h"
#include "Common/Version.h"
-#include "Core/BootManager.h"
#include "Core/Config/MainSettings.h"
-#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/HW/Memmap.h"
@@ -103,8 +101,7 @@ IPCReply GetSpeedLimit(const IOCtlVRequest& request)
return IPCReply(IPC_EINVAL);
}
- const SConfig& config = SConfig::GetInstance();
- const u32 speed_percent = config.m_EmulationSpeed * 100;
+ const u32 speed_percent = Config::Get(Config::MAIN_EMULATION_SPEED) * 100;
Memory::Write_U32(speed_percent, request.io_vectors[0].address);
return IPCReply(IPC_SUCCESS);
@@ -124,8 +121,7 @@ IPCReply SetSpeedLimit(const IOCtlVRequest& request)
}
const float speed = float(Memory::Read_U32(request.in_vectors[0].address)) / 100.0f;
- SConfig::GetInstance().m_EmulationSpeed = speed;
- BootManager::SetEmulationSpeedReset(true);
+ Config::SetCurrent(Config::MAIN_EMULATION_SPEED, speed);
return IPCReply(IPC_SUCCESS);
}
diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp
index 6dad22e5ba..4e40ec7f3b 100644
--- a/Source/Core/Core/NetPlayClient.cpp
+++ b/Source/Core/Core/NetPlayClient.cpp
@@ -2033,13 +2033,13 @@ bool NetPlayClient::GetNetPads(const int pad_nb, const bool batching, GCPadStatu
if (time_diff.count() >= 1.0 || !buffer_over_target)
{
// run fast if the buffer is overfilled, otherwise run normal speed
- SConfig::GetInstance().m_EmulationSpeed = buffer_over_target ? 0.0f : 1.0f;
+ Config::SetCurrent(Config::MAIN_EMULATION_SPEED, buffer_over_target ? 0.0f : 1.0f);
}
}
else
{
// Set normal speed when we're the host, otherwise it can get stuck at unlimited
- SConfig::GetInstance().m_EmulationSpeed = 1.0f;
+ Config::SetCurrent(Config::MAIN_EMULATION_SPEED, 1.0f);
}
}
diff --git a/Source/Core/DolphinQt/HotkeyScheduler.cpp b/Source/Core/DolphinQt/HotkeyScheduler.cpp
index 4fa3031e63..c3d2aadcb7 100644
--- a/Source/Core/DolphinQt/HotkeyScheduler.cpp
+++ b/Source/Core/DolphinQt/HotkeyScheduler.cpp
@@ -459,26 +459,26 @@ void HotkeyScheduler::Run()
Core::SetIsThrottlerTempDisabled(IsHotkey(HK_TOGGLE_THROTTLE, true));
auto ShowEmulationSpeed = []() {
+ const float emulation_speed = Config::Get(Config::MAIN_EMULATION_SPEED);
OSD::AddMessage(
- SConfig::GetInstance().m_EmulationSpeed <= 0 ?
+ emulation_speed <= 0 ?
"Speed Limit: Unlimited" :
- StringFromFormat("Speed Limit: %li%%",
- std::lround(SConfig::GetInstance().m_EmulationSpeed * 100.f)));
+ StringFromFormat("Speed Limit: %li%%", std::lround(emulation_speed * 100.f)));
};
if (IsHotkey(HK_DECREASE_EMULATION_SPEED))
{
- auto speed = SConfig::GetInstance().m_EmulationSpeed - 0.1;
+ auto speed = Config::Get(Config::MAIN_EMULATION_SPEED) - 0.1;
speed = (speed <= 0 || (speed >= 0.95 && speed <= 1.05)) ? 1.0 : speed;
- SConfig::GetInstance().m_EmulationSpeed = speed;
+ Config::SetCurrent(Config::MAIN_EMULATION_SPEED, speed);
ShowEmulationSpeed();
}
if (IsHotkey(HK_INCREASE_EMULATION_SPEED))
{
- auto speed = SConfig::GetInstance().m_EmulationSpeed + 0.1;
+ auto speed = Config::Get(Config::MAIN_EMULATION_SPEED) + 0.1;
speed = (speed >= 0.95 && speed <= 1.05) ? 1.0 : speed;
- SConfig::GetInstance().m_EmulationSpeed = speed;
+ Config::SetCurrent(Config::MAIN_EMULATION_SPEED, speed);
ShowEmulationSpeed();
}
diff --git a/Source/Core/DolphinQt/Settings/GeneralPane.cpp b/Source/Core/DolphinQt/Settings/GeneralPane.cpp
index d25efbf0ae..05ea785484 100644
--- a/Source/Core/DolphinQt/Settings/GeneralPane.cpp
+++ b/Source/Core/DolphinQt/Settings/GeneralPane.cpp
@@ -260,7 +260,7 @@ void GeneralPane::LoadConfig()
#ifdef USE_DISCORD_PRESENCE
m_checkbox_discord_presence->setChecked(Config::Get(Config::MAIN_USE_DISCORD_PRESENCE));
#endif
- int selection = qRound(SConfig::GetInstance().m_EmulationSpeed * 10);
+ int selection = qRound(Config::Get(Config::MAIN_EMULATION_SPEED) * 10);
if (selection < m_combobox_speedlimit->count())
m_combobox_speedlimit->setCurrentIndex(selection);
m_checkbox_dualcore->setChecked(SConfig::GetInstance().bCPUThread);
@@ -353,7 +353,8 @@ void GeneralPane::OnSaveConfig()
m_checkbox_override_region_settings->isChecked());
Config::SetBase(Config::MAIN_AUTO_DISC_CHANGE, m_checkbox_auto_disc_change->isChecked());
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_CHEATS, m_checkbox_cheats->isChecked());
- settings.m_EmulationSpeed = m_combobox_speedlimit->currentIndex() * 0.1f;
+ Config::SetBaseOrCurrent(Config::MAIN_EMULATION_SPEED,
+ m_combobox_speedlimit->currentIndex() * 0.1f);
Settings::Instance().SetFallbackRegion(
UpdateFallbackRegionFromIndex(m_combobox_fallback_region->currentIndex()));
diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp
index a835625691..c8f79b0e66 100644
--- a/Source/Core/VideoCommon/VideoConfig.cpp
+++ b/Source/Core/VideoCommon/VideoConfig.cpp
@@ -9,7 +9,7 @@
#include "Common/CommonTypes.h"
#include "Common/StringUtil.h"
#include "Core/Config/GraphicsSettings.h"
-#include "Core/ConfigManager.h"
+#include "Core/Config/MainSettings.h"
#include "Core/Core.h"
#include "Core/Movie.h"
#include "VideoCommon/DriverDetails.h"
@@ -24,7 +24,7 @@ static bool IsVSyncActive(bool enabled)
{
// Vsync is disabled when the throttler is disabled by the tab key.
return enabled && !Core::GetIsThrottlerTempDisabled() &&
- SConfig::GetInstance().m_EmulationSpeed == 1.0;
+ Config::Get(Config::MAIN_EMULATION_SPEED) == 1.0;
}
void UpdateActiveConfig()