Qt: Simplify runahead settings

This commit is contained in:
Connor McLaughlin
2021-01-26 02:48:40 +10:00
parent 1b16ba3d98
commit 16a32bf696
7 changed files with 92 additions and 71 deletions

View File

@ -495,8 +495,7 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
si.SetBoolValue("Main", "RewindEnable", false);
si.SetFloatValue("Main", "RewindFrequency", 10.0f);
si.SetIntValue("Main", "RewindSaveSlots", 10);
si.SetBoolValue("Main", "RunaheadEnable", false);
si.SetFloatValue("Main", "RunaheadFrames", 1);
si.SetFloatValue("Main", "RunaheadFrameCount", 0);
si.SetStringValue("CPU", "ExecutionMode", Settings::GetCPUExecutionModeName(Settings::DEFAULT_CPU_EXECUTION_MODE));
si.SetBoolValue("CPU", "RecompilerMemoryExceptions", false);
@ -666,7 +665,7 @@ void HostInterface::FixIncompatibleSettings(bool display_osd_messages)
#endif
// rewinding causes issues with mmap fastmem, so just use LUT
if ((g_settings.rewind_enable || g_settings.runahead_enable) && g_settings.IsUsingFastmem() &&
if ((g_settings.rewind_enable || g_settings.IsRunaheadEnabled()) && g_settings.IsUsingFastmem() &&
g_settings.cpu_fastmem_mode == CPUFastmemMode::MMap)
{
Log_WarningPrintf("Disabling mmap fastmem due to rewind being enabled");
@ -674,13 +673,13 @@ void HostInterface::FixIncompatibleSettings(bool display_osd_messages)
}
// code compilation is too slow with runahead, use the recompiler
if (g_settings.runahead_enable && g_settings.IsUsingCodeCache())
if (g_settings.IsRunaheadEnabled() && g_settings.IsUsingCodeCache())
{
Log_WarningPrintf("Code cache/recompiler disabled due to runahead");
g_settings.cpu_execution_mode = CPUExecutionMode::Interpreter;
}
if (g_settings.runahead_enable && g_settings.rewind_enable)
if (g_settings.IsRunaheadEnabled() && g_settings.rewind_enable)
{
Log_WarningPrintf("Rewind disabled due to runahead being enabled");
g_settings.rewind_enable = false;
@ -789,7 +788,7 @@ void HostInterface::CheckForSettingsChanges(const Settings& old_settings)
g_settings.display_line_start_offset != old_settings.display_line_start_offset ||
g_settings.display_line_end_offset != old_settings.display_line_end_offset ||
g_settings.rewind_enable != old_settings.rewind_enable ||
g_settings.runahead_enable != old_settings.runahead_enable)
g_settings.runahead_frames != old_settings.runahead_frames)
{
if (g_settings.IsUsingCodeCache())
CPU::CodeCache::Reinitialize();
@ -830,7 +829,6 @@ void HostInterface::CheckForSettingsChanges(const Settings& old_settings)
if (g_settings.rewind_enable != old_settings.rewind_enable ||
g_settings.rewind_save_frequency != old_settings.rewind_save_frequency ||
g_settings.rewind_save_slots != old_settings.rewind_save_slots ||
g_settings.runahead_enable != old_settings.runahead_enable ||
g_settings.runahead_frames != old_settings.runahead_frames)
{
System::UpdateMemorySaveStateSettings();

View File

@ -126,8 +126,7 @@ void Settings::Load(SettingsInterface& si)
rewind_enable = si.GetBoolValue("Main", "RewindEnable", false);
rewind_save_frequency = si.GetFloatValue("Main", "RewindFrequency", 10.0f);
rewind_save_slots = static_cast<u32>(si.GetIntValue("Main", "RewindSaveSlots", 10));
runahead_enable = si.GetBoolValue("Main", "RunaheadEnable", false);
runahead_frames = static_cast<u32>(si.GetIntValue("Main", "RunaheadFrames", 1));
runahead_frames = static_cast<u32>(si.GetIntValue("Main", "RunaheadFrameCount", 0));
cpu_execution_mode =
ParseCPUExecutionMode(
@ -303,8 +302,7 @@ void Settings::Save(SettingsInterface& si) const
si.SetBoolValue("Main", "RewindEnable", rewind_enable);
si.SetFloatValue("Main", "RewindFrequency", rewind_save_frequency);
si.SetIntValue("Main", "RewindSaveSlots", rewind_save_slots);
si.SetBoolValue("Main", "RunaheadEnable", runahead_enable);
si.SetIntValue("Main", "RunaheadFrames", runahead_frames);
si.SetIntValue("Main", "RunaheadFrameCount", runahead_frames);
si.SetStringValue("CPU", "ExecutionMode", GetCPUExecutionModeName(cpu_execution_mode));
si.SetBoolValue("CPU", "OverclockEnable", cpu_overclock_enable);

View File

@ -95,10 +95,9 @@ struct Settings
bool disable_all_enhancements = false;
bool rewind_enable = false;
bool runahead_enable = false;
float rewind_save_frequency = 10.0f;
u32 rewind_save_slots = 10;
u32 runahead_frames = 1;
u32 runahead_frames = 0;
GPURenderer gpu_renderer = GPURenderer::Software;
std::string gpu_adapter;
@ -224,6 +223,7 @@ struct Settings
ALWAYS_INLINE bool IsUsingCodeCache() const { return (cpu_execution_mode != CPUExecutionMode::Interpreter); }
ALWAYS_INLINE bool IsUsingRecompiler() const { return (cpu_execution_mode == CPUExecutionMode::Recompiler); }
ALWAYS_INLINE bool IsUsingSoftwareRenderer() const { return (gpu_renderer == GPURenderer::Software); }
ALWAYS_INLINE bool IsRunaheadEnabled() const { return (runahead_frames > 0); }
ALWAYS_INLINE PGXPMode GetPGXPMode()
{

View File

@ -1977,7 +1977,7 @@ void UpdateMemorySaveStateSettings()
s_rewind_load_frequency = -1;
s_rewind_load_counter = -1;
s_runahead_frames = g_settings.runahead_enable ? g_settings.runahead_frames : 0;
s_runahead_frames = g_settings.runahead_frames;
s_runahead_replay_pending = false;
if (s_runahead_frames > 0)
{