Throttler: Rename "framelimiter" to "emulation speed".
We don't throttle by frames, we throttle by coretiming speed. So looking up VI for calculating the speed was just very wrong. The new ini option is a float, 1.0f for fullspeed. In the GUI, percentual values are used.
This commit is contained in:
1 parent
f3098bf426
commit
3ff4ec275a
14 files changed
+86
-69
No files matched your search
@@ -55,7 +55,7 @@ public:
|
||||
void RestoreConfig(SConfig* config);
|
||||
|
||||
// these store if the relevant setting should be reset back later (true) or if it should be left alone on restore (false)
|
||||
bool bSetFramelimit, bSetEXIDevice[MAX_EXI_CHANNELS], bSetVolume, bSetPads[MAX_SI_CHANNELS], bSetWiimoteSource[MAX_BBMOTES], bSetFrameSkip;
|
||||
bool bSetEmulationSpeed, bSetEXIDevice[MAX_EXI_CHANNELS], bSetVolume, bSetPads[MAX_SI_CHANNELS], bSetWiimoteSource[MAX_BBMOTES], bSetFrameSkip;
|
||||
|
||||
private:
|
||||
bool valid, bCPUThread, bSkipIdle, bSyncGPUOnSkipIdleHack, bFPRF, bAccurateNaNs, bMMU, bDCBZOFF, m_EnableJIT,
|
||||
@@ -64,7 +64,8 @@ private:
|
||||
int iCPUCore, Volume;
|
||||
int iWiimoteSource[MAX_BBMOTES];
|
||||
SIDevices Pads[MAX_SI_CHANNELS];
|
||||
unsigned int framelimit, frameSkip;
|
||||
unsigned int frameSkip;
|
||||
float m_EmulationSpeed;
|
||||
TEXIDevices m_EXIDevice[MAX_EXI_CHANNELS];
|
||||
std::string strBackend, sBackend;
|
||||
std::string m_strGPUDeterminismMode;
|
||||
@@ -102,7 +103,7 @@ void ConfigCache::SaveConfig(const SConfig& config)
|
||||
Pads[i] = config.m_SIDevice[i];
|
||||
}
|
||||
|
||||
framelimit = config.m_Framelimit;
|
||||
m_EmulationSpeed = config.m_EmulationSpeed;
|
||||
frameSkip = config.m_FrameSkip;
|
||||
|
||||
for (unsigned int i = 0; i < MAX_EXI_CHANNELS; ++i)
|
||||
@@ -114,7 +115,7 @@ void ConfigCache::SaveConfig(const SConfig& config)
|
||||
sBackend = config.sBackend;
|
||||
m_strGPUDeterminismMode = config.m_strGPUDeterminismMode;
|
||||
|
||||
bSetFramelimit = false;
|
||||
bSetEmulationSpeed = false;
|
||||
std::fill_n(bSetEXIDevice, (int)MAX_EXI_CHANNELS, false);
|
||||
bSetVolume = false;
|
||||
std::fill_n(bSetPads, (int)MAX_SI_CHANNELS, false);
|
||||
@@ -170,8 +171,8 @@ void ConfigCache::RestoreConfig(SConfig* config)
|
||||
config->m_SIDevice[i] = Pads[i];
|
||||
}
|
||||
|
||||
if (bSetFramelimit)
|
||||
config->m_Framelimit = framelimit;
|
||||
if (bSetEmulationSpeed)
|
||||
config->m_EmulationSpeed = m_EmulationSpeed;
|
||||
|
||||
if (bSetFrameSkip)
|
||||
{
|
||||
@@ -251,8 +252,8 @@ bool BootCore(const std::string& _rFilename)
|
||||
core_section->Get("HLE_BS2", &StartUp.bHLE_BS2, StartUp.bHLE_BS2);
|
||||
core_section->Get("ProgressiveScan", &StartUp.bProgressive, StartUp.bProgressive);
|
||||
core_section->Get("PAL60", &StartUp.bPAL60, StartUp.bPAL60);
|
||||
if (core_section->Get("FrameLimit", &SConfig::GetInstance().m_Framelimit, SConfig::GetInstance().m_Framelimit))
|
||||
config_cache.bSetFramelimit = true;
|
||||
if (core_section->Get("EmulationSpeed", &SConfig::GetInstance().m_EmulationSpeed, SConfig::GetInstance().m_EmulationSpeed))
|
||||
config_cache.bSetEmulationSpeed = true;
|
||||
if (core_section->Get("FrameSkip", &SConfig::GetInstance().m_FrameSkip))
|
||||
{
|
||||
config_cache.bSetFrameSkip = true;
|
||||
|
||||
@@ -261,7 +261,7 @@ void SConfig::SaveCoreSettings(IniFile& ini)
|
||||
core->Set("WiimoteEnableSpeaker", m_WiimoteEnableSpeaker);
|
||||
core->Set("RunCompareServer", bRunCompareServer);
|
||||
core->Set("RunCompareClient", bRunCompareClient);
|
||||
core->Set("FrameLimit", m_Framelimit);
|
||||
core->Set("EmulationSpeed", m_EmulationSpeed);
|
||||
core->Set("FrameSkip", m_FrameSkip);
|
||||
core->Set("Overclock", m_OCFactor);
|
||||
core->Set("OverclockEnable", m_OCEnable);
|
||||
@@ -526,7 +526,7 @@ void SConfig::LoadCoreSettings(IniFile& ini)
|
||||
core->Get("DCBZ", &bDCBZOFF, false);
|
||||
core->Get("FPRF", &bFPRF, false);
|
||||
core->Get("AccurateNaNs", &bAccurateNaNs, false);
|
||||
core->Get("FrameLimit", &m_Framelimit, 1); // auto frame limit by default
|
||||
core->Get("EmulationSpeed", &m_EmulationSpeed, 1.0f);
|
||||
core->Get("Overclock", &m_OCFactor, 1.0f);
|
||||
core->Get("OverclockEnable", &m_OCEnable, false);
|
||||
core->Get("FrameSkip", &m_FrameSkip, 0);
|
||||
|
||||
@@ -196,8 +196,7 @@ struct SConfig : NonCopyable
|
||||
|
||||
// interface language
|
||||
int m_InterfaceLanguage;
|
||||
// framelimit choose
|
||||
unsigned int m_Framelimit;
|
||||
float m_EmulationSpeed;
|
||||
bool m_OCEnable;
|
||||
float m_OCFactor;
|
||||
// other interface settings
|
||||
|
||||
+10
-10
@@ -110,7 +110,7 @@ static StoppedCallbackFunc s_on_stopped_callback = nullptr;
|
||||
static std::thread s_cpu_thread;
|
||||
static bool s_request_refresh_info = false;
|
||||
static int s_pause_and_lock_depth = 0;
|
||||
static bool s_is_framelimiter_temp_disabled = false;
|
||||
static bool s_is_throttler_temp_disabled = false;
|
||||
|
||||
#ifdef USE_MEMORYWATCHER
|
||||
static std::unique_ptr<MemoryWatcher> s_memory_watcher;
|
||||
@@ -127,14 +127,14 @@ static void InitIsCPUKey()
|
||||
}
|
||||
#endif
|
||||
|
||||
bool GetIsFramelimiterTempDisabled()
|
||||
bool GetIsThrottlerTempDisabled()
|
||||
{
|
||||
return s_is_framelimiter_temp_disabled;
|
||||
return s_is_throttler_temp_disabled;
|
||||
}
|
||||
|
||||
void SetIsFramelimiterTempDisabled(bool disable)
|
||||
void SetIsThrottlerTempDisabled(bool disable)
|
||||
{
|
||||
s_is_framelimiter_temp_disabled = disable;
|
||||
s_is_throttler_temp_disabled = disable;
|
||||
}
|
||||
|
||||
std::string GetStateFileName() { return s_state_filename; }
|
||||
@@ -746,7 +746,7 @@ bool PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
||||
return wasUnpaused;
|
||||
}
|
||||
|
||||
// Apply Frame Limit and Display FPS info
|
||||
// Display FPS info
|
||||
// This should only be called from VI
|
||||
void VideoThrottle()
|
||||
{
|
||||
@@ -767,12 +767,12 @@ void VideoThrottle()
|
||||
|
||||
// Executed from GPU thread
|
||||
// reports if a frame should be skipped or not
|
||||
// depending on the framelimit set
|
||||
// depending on the emulation speed set
|
||||
bool ShouldSkipFrame(int skipped)
|
||||
{
|
||||
const u32 TargetFPS = (SConfig::GetInstance().m_Framelimit > 1)
|
||||
? (SConfig::GetInstance().m_Framelimit - 1) * 5
|
||||
: VideoInterface::TargetRefreshRate;
|
||||
u32 TargetFPS = VideoInterface::TargetRefreshRate;
|
||||
if (SConfig::GetInstance().m_EmulationSpeed > 0.0f)
|
||||
TargetFPS = u32(TargetFPS * SConfig::GetInstance().m_EmulationSpeed);
|
||||
const u32 frames = s_drawn_frame.load();
|
||||
const bool fps_slow = !(s_timer.GetTimeDifference() < (frames + skipped) * 1000 / TargetFPS);
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ extern bool g_aspect_wide;
|
||||
|
||||
extern bool g_want_determinism;
|
||||
|
||||
bool GetIsFramelimiterTempDisabled();
|
||||
void SetIsFramelimiterTempDisabled(bool disable);
|
||||
bool GetIsThrottlerTempDisabled();
|
||||
void SetIsThrottlerTempDisabled(bool disable);
|
||||
|
||||
void Callback_VideoCopiedToXFB(bool video_update);
|
||||
|
||||
|
||||
@@ -195,21 +195,21 @@ static void ThrottleCallback(u64 last_time, int cyclesLate)
|
||||
|
||||
int diff = (u32)last_time - time;
|
||||
const SConfig& config = SConfig::GetInstance();
|
||||
bool frame_limiter = config.m_Framelimit && !Core::GetIsFramelimiterTempDisabled();
|
||||
bool frame_limiter = config.m_EmulationSpeed > 0.0f && !Core::GetIsThrottlerTempDisabled();
|
||||
u32 next_event = GetTicksPerSecond()/1000;
|
||||
if (config.m_Framelimit > 1)
|
||||
if (frame_limiter)
|
||||
{
|
||||
next_event = next_event * (config.m_Framelimit - 1) * 5 / VideoInterface::TargetRefreshRate;
|
||||
if (config.m_EmulationSpeed != 1.0f)
|
||||
next_event = u32(next_event * config.m_EmulationSpeed);
|
||||
const int max_fallback = config.iTimingVariance;
|
||||
if (abs(diff) > max_fallback)
|
||||
{
|
||||
DEBUG_LOG(COMMON, "system too %s, %d ms skipped", diff<0 ? "slow" : "fast", abs(diff) - max_fallback);
|
||||
last_time = time - max_fallback;
|
||||
}
|
||||
else if (diff > 0)
|
||||
Common::SleepCurrentThread(diff);
|
||||
}
|
||||
|
||||
const int max_fallback = config.iTimingVariance;
|
||||
if (frame_limiter && abs(diff) > max_fallback)
|
||||
{
|
||||
DEBUG_LOG(COMMON, "system too %s, %d ms skipped", diff<0 ? "slow" : "fast", abs(diff) - max_fallback);
|
||||
last_time = time - max_fallback;
|
||||
}
|
||||
else if (frame_limiter && diff > 0)
|
||||
Common::SleepCurrentThread(diff);
|
||||
CoreTiming::ScheduleEvent(next_event - cyclesLate, et_Throttle, last_time + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ const std::string hotkey_labels[] =
|
||||
_trans("Toggle EFB Copies"),
|
||||
_trans("Toggle Fog"),
|
||||
_trans("Toggle Frame limit"),
|
||||
_trans("Decrease Frame limit"),
|
||||
_trans("Increase Frame limit"),
|
||||
_trans("Decrease Emulation Speed"),
|
||||
_trans("Increase Emulation Speed"),
|
||||
|
||||
_trans("Freelook Decrease Speed"),
|
||||
_trans("Freelook Increase Speed"),
|
||||
|
||||
@@ -50,8 +50,8 @@ enum Hotkey
|
||||
HK_TOGGLE_FOG,
|
||||
HK_TOGGLE_THROTTLE,
|
||||
|
||||
HK_DECREASE_FRAME_LIMIT,
|
||||
HK_INCREASE_FRAME_LIMIT,
|
||||
HK_DECREASE_EMULATION_SPEED,
|
||||
HK_INCREASE_EMULATION_SPEED,
|
||||
|
||||
HK_FREELOOK_DECREASE_SPEED,
|
||||
HK_FREELOOK_INCREASE_SPEED,
|
||||
|
||||
Reference in new issue
Block a user