diff --git a/src/core/system.cpp b/src/core/system.cpp index 6abe99017..f69d60b9a 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -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(); diff --git a/src/core/system.h b/src/core/system.h index 7679d2c8c..9e3f05e91 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -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& 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); diff --git a/src/duckstation-sdl/sdl_host_interface.cpp b/src/duckstation-sdl/sdl_host_interface.cpp index edac74c2b..3b2b027a6 100644 --- a/src/duckstation-sdl/sdl_host_interface.cpp +++ b/src/duckstation-sdl/sdl_host_interface.cpp @@ -933,7 +933,7 @@ void SDLHostInterface::DrawQuickSettingsMenu() m_settings.cpu_execution_mode = static_cast(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(execution_mode); settings_changed = true; if (m_system) - m_system->UpdateCPUExecutionMode(); + m_system->SetCPUExecutionMode(m_settings.cpu_execution_mode); } ImGui::EndTabItem();