System: UpdateCPUExecutionMode -> SetCPUExecutionMode

This commit is contained in:
Stenzek 2020-02-05 17:43:00 +09:00
parent 93f85535eb
commit c26b9bc54c
3 changed files with 12 additions and 10 deletions

View File

@ -88,6 +88,13 @@ void System::UpdateGPUSettings()
m_gpu->UpdateSettings();
}
void System::SetCPUExecutionMode(CPUExecutionMode mode)
{
m_cpu_execution_mode = mode;
m_cpu_code_cache->Flush();
m_cpu_code_cache->SetUseRecompiler(mode == CPUExecutionMode::Recompiler);
}
bool System::Boot(const char* filename)
{
// Load CD image up and detect region.
@ -509,13 +516,6 @@ void System::UpdateMemoryCards()
}
}
void System::UpdateCPUExecutionMode()
{
m_cpu_execution_mode = GetSettings().cpu_execution_mode;
m_cpu_code_cache->Flush();
m_cpu_code_cache->SetUseRecompiler(m_cpu_execution_mode == CPUExecutionMode::Recompiler);
}
bool System::HasMedia() const
{
return m_cdrom->HasMedia();

View File

@ -80,6 +80,9 @@ public:
/// Updates GPU settings, without recreating the renderer.
void UpdateGPUSettings();
/// Forcibly changes the CPU execution mode, ignoring settings.
void SetCPUExecutionMode(CPUExecutionMode mode);
void RunFrame();
bool LoadEXE(const char* filename, std::vector<u8>& bios_image);
@ -92,7 +95,6 @@ public:
Controller* GetController(u32 slot) const;
void UpdateControllers();
void UpdateMemoryCards();
void UpdateCPUExecutionMode();
bool HasMedia() const;
bool InsertMedia(const char* path);

View File

@ -933,7 +933,7 @@ void SDLHostInterface::DrawQuickSettingsMenu()
m_settings.cpu_execution_mode = static_cast<CPUExecutionMode>(i);
settings_changed = true;
if (m_system)
m_system->UpdateCPUExecutionMode();
m_system->SetCPUExecutionMode(m_settings.cpu_execution_mode);
}
}
@ -1280,7 +1280,7 @@ void SDLHostInterface::DrawSettingsWindow()
m_settings.cpu_execution_mode = static_cast<CPUExecutionMode>(execution_mode);
settings_changed = true;
if (m_system)
m_system->UpdateCPUExecutionMode();
m_system->SetCPUExecutionMode(m_settings.cpu_execution_mode);
}
ImGui::EndTabItem();