From 638fa6170a8a4c36ffa644055e683a7e50aa7ae5 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 15 Oct 2022 00:48:28 -0700 Subject: core: core_timing: Re-initialize if single/multicore state changes. --- src/core/core.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'src/core/core.cpp') diff --git a/src/core/core.cpp b/src/core/core.cpp index 2c4c0dbe4..622a20510 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -155,6 +155,24 @@ struct System::Impl { // Create default implementations of applets if one is not provided. applet_manager.SetDefaultAppletsIfMissing(); + + is_async_gpu = Settings::values.use_asynchronous_gpu_emulation.GetValue(); + + kernel.SetMulticore(is_multicore); + cpu_manager.SetMulticore(is_multicore); + cpu_manager.SetAsyncGpu(is_async_gpu); + } + + void ReinitializeIfNecessary(System& system) { + if (is_multicore == Settings::values.use_multi_core.GetValue()) { + return; + } + + LOG_DEBUG(Kernel, "Re-initializing"); + + is_multicore = Settings::values.use_multi_core.GetValue(); + + Initialize(system); } SystemResultStatus Run() { @@ -205,11 +223,8 @@ struct System::Impl { SystemResultStatus SetupForMainProcess(System& system, Frontend::EmuWindow& emu_window) { LOG_DEBUG(Core, "initialized OK"); - is_async_gpu = Settings::values.use_asynchronous_gpu_emulation.GetValue(); - - kernel.SetMulticore(is_multicore); - cpu_manager.SetMulticore(is_multicore); - cpu_manager.SetAsyncGpu(is_async_gpu); + // Setting changes may require a full system reinitialization (e.g., disabling multicore). + ReinitializeIfNecessary(system); kernel.Initialize(); cpu_manager.Initialize(); -- cgit v1.2.3