diff options
author | bunnei <bunneidev@gmail.com> | 2022-10-15 09:48:28 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2022-10-19 04:13:35 +0200 |
commit | 638fa6170a8a4c36ffa644055e683a7e50aa7ae5 (patch) | |
tree | 42d24dd017358235db295b512d3be2228b9b95d5 /src/core | |
parent | core: core_timing: Remove unused IsHostTiming. (diff) | |
download | yuzu-638fa6170a8a4c36ffa644055e683a7e50aa7ae5.tar yuzu-638fa6170a8a4c36ffa644055e683a7e50aa7ae5.tar.gz yuzu-638fa6170a8a4c36ffa644055e683a7e50aa7ae5.tar.bz2 yuzu-638fa6170a8a4c36ffa644055e683a7e50aa7ae5.tar.lz yuzu-638fa6170a8a4c36ffa644055e683a7e50aa7ae5.tar.xz yuzu-638fa6170a8a4c36ffa644055e683a7e50aa7ae5.tar.zst yuzu-638fa6170a8a4c36ffa644055e683a7e50aa7ae5.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core.cpp | 25 | ||||
-rw-r--r-- | src/core/core_timing.cpp | 23 | ||||
-rw-r--r-- | src/core/core_timing.h | 2 |
3 files changed, 36 insertions, 14 deletions
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(); diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 2afb2696c..0e7b5f943 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -41,15 +41,7 @@ CoreTiming::CoreTiming() : clock{Common::CreateBestMatchingClock(Hardware::BASE_CLOCK_RATE, Hardware::CNTFREQ)} {} CoreTiming::~CoreTiming() { - paused = true; - shutting_down = true; - pause_event.Set(); - event.Set(); - if (timer_thread) { - timer_thread->join(); - } - timer_thread.reset(); - has_started = false; + Reset(); } void CoreTiming::ThreadEntry(CoreTiming& instance) { @@ -63,6 +55,7 @@ void CoreTiming::ThreadEntry(CoreTiming& instance) { } void CoreTiming::Initialize(std::function<void()>&& on_thread_init_) { + Reset(); on_thread_init = std::move(on_thread_init_); event_fifo_id = 0; shutting_down = false; @@ -304,6 +297,18 @@ void CoreTiming::ThreadLoop() { } } +void CoreTiming::Reset() { + paused = true; + shutting_down = true; + pause_event.Set(); + event.Set(); + if (timer_thread) { + timer_thread->join(); + } + timer_thread.reset(); + has_started = false; +} + std::chrono::nanoseconds CoreTiming::GetGlobalTimeNs() const { if (is_multicore) { return clock->GetTimeNS(); diff --git a/src/core/core_timing.h b/src/core/core_timing.h index bd21dd904..b5925193c 100644 --- a/src/core/core_timing.h +++ b/src/core/core_timing.h @@ -134,6 +134,8 @@ private: static void ThreadEntry(CoreTiming& instance); void ThreadLoop(); + void Reset(); + std::unique_ptr<Common::WallClock> clock; s64 global_timer = 0; |