diff --git a/binaries/system/readme.txt b/binaries/system/readme.txt index 70cc49a9fd..120ba8ba6c 100644 --- a/binaries/system/readme.txt +++ b/binaries/system/readme.txt @@ -88,6 +88,9 @@ Advanced / diagnostic: -hashtest-full=X whether to enable computation of full hashes in replaymode (default true). Can be disabled to improve performance. -hashtest-quick=X whether to enable computation of quick hashes in replaymode (default false). Can be enabled for debugging purposes. +-fixed-frame-frequency=F fixes the frame time. With that flags it equals to 1/F. For example, + if F=60 it means the game behaves like it's always running with 60 FPS. + Archive builder: -archivebuild=PATH system PATH of the base directory containing mod data to be archived/precached specify all mods it depends on with -mod=NAME diff --git a/source/main.cpp b/source/main.cpp index 9924eb5249..a8dc337589 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -362,7 +362,7 @@ static void RendererIncrementalLoad() while (more && timer_Time() - startTime < maxTime); } -static void Frame(RL::Interface* rlInterface) +static void Frame(RL::Interface* rlInterface, const int fixedFrameFrequency) { g_Profiler2.RecordFrameStart(); PROFILE2("frame"); @@ -382,7 +382,8 @@ static void Frame(RL::Interface* rlInterface) // .. new method - filtered and more smooth, but errors may accumulate #else - const float realTimeSinceLastFrame = 1.0 / g_frequencyFilter->SmoothedFrequency(); + const float realTimeSinceLastFrame{static_cast( + 1.0 / (fixedFrameFrequency > 0 ? fixedFrameFrequency : g_frequencyFilter->SmoothedFrequency()))}; #endif ENSURE(realTimeSinceLastFrame > 0.0f); @@ -531,6 +532,9 @@ static void RunGameOrAtlas(const PS::span argv) const bool isNonVisualReplay = args.Has("replay"); const bool isVisual = !args.Has("autostart-nonvisual"); + const int fixedFrameFrequency{args.Has("fixed-frame-frequency") + ? args.Get("fixed-frame-frequency").ToInt() : 0}; + const OsPath replayFile( isVisualReplay ? args.Get("replay-visual") : isNonVisualReplay ? args.Get("replay") : ""); @@ -695,7 +699,7 @@ static void RunGameOrAtlas(const PS::span argv) while (g_Shutdown == ShutdownType::None) { if (isVisual) - Frame(rlInterface ? &*rlInterface : nullptr); + Frame(rlInterface ? &*rlInterface : nullptr, fixedFrameFrequency); else if(rlInterface) rlInterface->TryApplyMessage(); else