mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 01:04:06 +00:00
Adds fixed frame frequency.
Adds possibility to control the frame time by setting the frame frequency by a command line argument (`-fixed-frame-frequency`). It's mostly useful for a trailer recording and graphics debugging.
This commit is contained in:
@@ -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
|
||||
|
||||
+7
-3
@@ -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<float>(
|
||||
1.0 / (fixedFrameFrequency > 0 ? fixedFrameFrequency : g_frequencyFilter->SmoothedFrequency()))};
|
||||
#endif
|
||||
ENSURE(realTimeSinceLastFrame > 0.0f);
|
||||
|
||||
@@ -531,6 +532,9 @@ static void RunGameOrAtlas(const PS::span<const char* const> 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<const char* const> argv)
|
||||
while (g_Shutdown == ShutdownType::None)
|
||||
{
|
||||
if (isVisual)
|
||||
Frame(rlInterface ? &*rlInterface : nullptr);
|
||||
Frame(rlInterface ? &*rlInterface : nullptr, fixedFrameFrequency);
|
||||
else if(rlInterface)
|
||||
rlInterface->TryApplyMessage();
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user