diff --git a/src/common/settings.h b/src/common/settings.h index b47e1ef88..ffcdb811d 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -210,6 +210,7 @@ struct Values { true, true, &use_speed_limit}; + SwitchableSetting sync_core_speed{linkage, false, "sync_core_speed", Category::Core, Specialization::Default}; // Cpu SwitchableSetting cpu_backend{linkage, diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 1abfa920c..057688269 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -14,6 +14,7 @@ #include "common/x64/cpu_wait.h" #endif +#include "common/settings.h" #include "common/microprofile.h" #include "core/core_timing.h" #include "core/hardware_properties.h" @@ -184,10 +185,20 @@ void CoreTiming::ResetTicks() { } u64 CoreTiming::GetClockTicks() const { + u64 fres; if (is_multicore) [[likely]] { - return clock->GetCNTPCT(); + fres = clock->GetCNTPCT(); + } else { + fres = Common::WallClock::CPUTickToCNTPCT(cpu_ticks); + } + + if (Settings::values.sync_core_speed.GetValue()) { + const double ticks = static_cast(fres); + const double speed_limit = static_cast(Settings::values.speed_limit.GetValue())*0.01; + return static_cast(ticks/speed_limit); + } else { + return fres; } - return Common::WallClock::CPUTickToCNTPCT(cpu_ticks); } u64 CoreTiming::GetGPUTicks() const { diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp index df82f376f..6b5d990f0 100644 --- a/src/yuzu/configuration/shared_translation.cpp +++ b/src/yuzu/configuration/shared_translation.cpp @@ -71,6 +71,11 @@ std::unique_ptr InitializeTranslations(QWidget* parent) { "faster or not.\n200% for a 30 FPS game is 60 FPS, and for a " "60 FPS game it will be 120 FPS.\nDisabling it means unlocking the framerate to the " "maximum your PC can reach.")); + INSERT(Settings, sync_core_speed, tr("Synchronize core speed"), + tr("Synchronizes CPU core speed to game's maximum rendering speed, which can be useful to " + "increase FPS without increasing the actual speed of the game (animations, physics, etc.)\n" + "It's up to each game if it plays well with this or not. Most games (specially original ones) " + "simply ignore this.\nThis can help play the game stutter-free at a lower framerate.")); // Cpu INSERT(Settings, cpu_accuracy, tr("Accuracy:"),